veo-sdk 0.5.2 → 0.5.4

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.
@@ -1,4 +1,4 @@
1
- var veoGuides=(function(exports){'use strict';function gt(){return typeof window<"u"}function Be(){return typeof document<"u"}var vt=["http:","https:"],yt="data-veo-guide",wt="veo:freq:";var bt="veo:walkthrough_state:";var Ct={shown:1,dismissed:2,completed:2};function kt(n){return n.slice(-16)||"default"}var Fe=class{constructor(e){this.storageKey=`${wt}${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,i]of this.cache)e-i.lastInteractionAt>7776e6&&(this.cache.delete(o),t=true);if(this.cache.size>500){let o=Array.from(this.cache.entries()).sort((r,s)=>r[1].lastInteractionAt-s[1].lastInteractionAt),i=this.cache.size-500;for(let r=0;r<i;r++){let s=o[r];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 i of t)if(i&&typeof i=="object"&&typeof i.guideId=="string"&&typeof i.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(i.status)){let r=i;o.push([r.guideId,r]);}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 He=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}),i;try{i=await fetch(`${this.apiUrl}/v1/guides/resolve?${o.toString()}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(r){return this.debug&&console.error("[veo] guides resolve fetch failed:",r),[]}if(!i.ok)return this.debug&&console.warn("[veo] guides resolve HTTP",i.status),[];try{let r=await i.json();return Array.isArray(r.guides)?r.guides:[]}catch(r){return this.debug&&console.error("[veo] guides resolve parse failed:",r),[]}}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 Et(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),n.metadata&&(e.metadata=n.metadata),e}var $e=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(Et(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(Et(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 We=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;let e=Date.now(),t=this.buffer.filter(r=>(r.nextRetryAt??0)<=e);if(t.length===0)return;this.flushing=true;let o=new Set(t);this.buffer=this.buffer.filter(r=>!o.has(r));let i=await Promise.allSettled(t.map(r=>this.config.client.send({guideId:r.guideId,payload:r.payload})));for(let r=0;r<i.length;r++){let s=i[r],a=t[r];!s||!a||s.status!=="fulfilled"&&(a.attempts+=1,a.attempts<this.config.maxRetries?(a.nextRetryAt=Date.now()+this.retryDelayMs(a.attempts),this.buffer.push(a)):this.safeOnError(s.reason,a));}this.flushing=false;}retryDelayMs(e){let t=Math.min(3e3*2**(e-1),3e4);return t/2+Math.random()*(t/2)}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{}}};var ie=Math.min,j=Math.max,Ae=Math.round;var _=n=>({x:n,y:n}),bn={left:"right",right:"left",bottom:"top",top:"bottom"};function ze(n,e,t){return j(n,ie(e,t))}function ce(n,e){return typeof n=="function"?n(e):n}function V(n){return n.split("-")[0]}function ue(n){return n.split("-")[1]}function at(n){return n==="x"?"y":"x"}function Ke(n){return n==="y"?"height":"width"}function z(n){let e=n[0];return e==="t"||e==="b"?"y":"x"}function qe(n){return at(z(n))}function It(n,e,t){t===void 0&&(t=false);let o=ue(n),i=qe(n),r=Ke(i),s=i==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=Te(s)),[s,Te(s)]}function Tt(n){let e=Te(n);return [Ue(n),e,Ue(e)]}function Ue(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var St=["left","right"],Rt=["right","left"],xn=["top","bottom"],Cn=["bottom","top"];function kn(n,e,t){switch(n){case "top":case "bottom":return t?e?Rt:St:e?St:Rt;case "left":case "right":return e?xn:Cn;default:return []}}function At(n,e,t,o){let i=ue(n),r=kn(V(n),t==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(Ue)))),r}function Te(n){let e=V(n);return bn[e]+n.slice(e.length)}function En(n){return {top:0,right:0,bottom:0,left:0,...n}}function lt(n){return typeof n!="number"?En(n):{top:n,right:n,bottom:n,left:n}}function re(n){let{x:e,y:t,width:o,height:i}=n;return {width:o,height:i,top:t,left:e,right:e+o,bottom:t+i,x:e,y:t}}function Pt(n,e,t){let{reference:o,floating:i}=n,r=z(e),s=qe(e),a=Ke(s),l=V(e),d=r==="y",c=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2,p;switch(l){case "top":p={x:c,y:o.y-i.height};break;case "bottom":p={x:c,y:o.y+o.height};break;case "right":p={x:o.x+o.width,y:u};break;case "left":p={x:o.x-i.width,y:u};break;default:p={x:o.x,y:o.y};}switch(ue(e)){case "start":p[s]-=f*(t&&d?-1:1);break;case "end":p[s]+=f*(t&&d?-1:1);break}return p}async function Lt(n,e){var t;e===void 0&&(e={});let{x:o,y:i,platform:r,rects:s,elements:a,strategy:l}=n,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:f=false,padding:p=0}=ce(e,n),h=lt(p),g=a[f?u==="floating"?"reference":"floating":u],v=re(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(g)))==null||t?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),w=u==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),y=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},C=re(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:x,strategy:l}):w);return {top:(v.top-C.top+h.top)/y.y,bottom:(C.bottom-v.bottom+h.bottom)/y.y,left:(v.left-C.left+h.left)/y.x,right:(C.right-v.right+h.right)/y.x}}var Sn=50,Gt=async(n,e,t)=>{let{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:Lt},l=await(s.isRTL==null?void 0:s.isRTL(e)),d=await s.getElementRects({reference:n,floating:e,strategy:i}),{x:c,y:u}=Pt(d,o,l),f=o,p=0,h={};for(let m=0;m<r.length;m++){let g=r[m];if(!g)continue;let{name:v,fn:w}=g,{x,y,data:C,reset:k}=await w({x:c,y:u,initialPlacement:o,placement:f,strategy:i,middlewareData:h,rects:d,platform:a,elements:{reference:n,floating:e}});c=x??c,u=y??u,h[v]={...h[v],...C},k&&p<Sn&&(p++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(d=k.rects===true?await s.getElementRects({reference:n,floating:e,strategy:i}):k.rects),{x:c,y:u}=Pt(d,f,l)),m=-1);}return {x:c,y:u,placement:f,strategy:i,middlewareData:h}},Nt=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:o,placement:i,rects:r,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:c=0}=ce(n,e)||{};if(d==null)return {};let u=lt(c),f={x:t,y:o},p=qe(i),h=Ke(p),m=await s.getDimensions(d),g=p==="y",v=g?"top":"left",w=g?"bottom":"right",x=g?"clientHeight":"clientWidth",y=r.reference[h]+r.reference[p]-f[p]-r.floating[h],C=f[p]-r.reference[p],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d)),$=k?k[x]:0;(!$||!await(s.isElement==null?void 0:s.isElement(k)))&&($=a.floating[x]||r.floating[h]);let Se=y/2-C/2,te=$/2-m[h]/2-1,W=ie(u[v],te),Re=ie(u[w],te),ne=W,Ie=$-m[h]-Re,S=$/2-m[h]/2+Se,oe=ze(ne,S,Ie),U=!l.arrow&&ue(i)!=null&&S!==oe&&r.reference[h]/2-(S<ne?W:Re)-m[h]/2<0,G=U?S<ne?S-ne:S-Ie:0;return {[p]:f[p]+G,data:{[p]:oe,centerOffset:S-oe-G,...U&&{alignmentOffset:G}},reset:U}}});var _t=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;let{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:c=true,crossAxis:u=true,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=true,...g}=ce(n,e);if((t=r.arrow)!=null&&t.alignmentOffset)return {};let v=V(i),w=z(a),x=V(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(d.floating)),C=f||(x||!m?[Te(a)]:Tt(a)),k=h!=="none";!f&&k&&C.push(...At(a,m,h,y));let $=[a,...C],Se=await l.detectOverflow(e,g),te=[],W=((o=r.flip)==null?void 0:o.overflows)||[];if(c&&te.push(Se[v]),u){let S=It(i,s,y);te.push(Se[S[0]],Se[S[1]]);}if(W=[...W,{placement:i,overflows:te}],!te.every(S=>S<=0)){var Re,ne;let S=(((Re=r.flip)==null?void 0:Re.index)||0)+1,oe=$[S];if(oe&&(!(u==="alignment"?w!==z(oe):false)||W.every(N=>z(N.placement)===w?N.overflows[0]>0:true)))return {data:{index:S,overflows:W},reset:{placement:oe}};let U=(ne=W.filter(G=>G.overflows[0]<=0).sort((G,N)=>G.overflows[1]-N.overflows[1])[0])==null?void 0:ne.placement;if(!U)switch(p){case "bestFit":{var Ie;let G=(Ie=W.filter(N=>{if(k){let q=z(N.placement);return q===w||q==="y"}return true}).map(N=>[N.placement,N.overflows.filter(q=>q>0).reduce((q,yn)=>q+yn,0)]).sort((N,q)=>N[1]-q[1])[0])==null?void 0:Ie[0];G&&(U=G);break}case "initialPlacement":U=a;break}if(i!==U)return {reset:{placement:U}}}return {}}}};var Rn=new Set(["left","top"]);async function In(n,e){let{placement:t,platform:o,elements:i}=n,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=V(t),a=ue(t),l=z(t)==="y",d=Rn.has(s)?-1:1,c=r&&l?-1:1,u=ce(e,n),{mainAxis:f,crossAxis:p,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"&&(p=a==="end"?h*-1:h),l?{x:p*c,y:f*d}:{x:f*d,y:p*c}}var Ot=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;let{x:i,y:r,placement:s,middlewareData:a}=e,l=await In(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}},Mt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:o,placement:i,platform:r}=e,{mainAxis:s=true,crossAxis:a=false,limiter:l={fn:v=>{let{x:w,y:x}=v;return {x:w,y:x}}},...d}=ce(n,e),c={x:t,y:o},u=await r.detectOverflow(e,d),f=z(V(i)),p=at(f),h=c[p],m=c[f];if(s){let v=p==="y"?"top":"left",w=p==="y"?"bottom":"right",x=h+u[v],y=h-u[w];h=ze(x,h,y);}if(a){let v=f==="y"?"top":"left",w=f==="y"?"bottom":"right",x=m+u[v],y=m-u[w];m=ze(x,m,y);}let g=l.fn({...e,[p]:h,[f]:m});return {...g,data:{x:g.x-t,y:g.y-o,enabled:{[p]:s,[f]:a}}}}}};function Ve(){return typeof window<"u"}function ae(n){return Bt(n)?(n.nodeName||"").toLowerCase():"#document"}function I(n){var e;return (n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function M(n){var e;return (e=(Bt(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Bt(n){return Ve()?n instanceof Node||n instanceof I(n).Node:false}function P(n){return Ve()?n instanceof Element||n instanceof I(n).Element:false}function D(n){return Ve()?n instanceof HTMLElement||n instanceof I(n).HTMLElement:false}function Dt(n){return !Ve()||typeof ShadowRoot>"u"?false:n instanceof ShadowRoot||n instanceof I(n).ShadowRoot}function pe(n){let{overflow:e,overflowX:t,overflowY:o,display:i}=L(n);return /auto|scroll|overlay|hidden|clip/.test(e+o+t)&&i!=="inline"&&i!=="contents"}function Ft(n){return /^(table|td|th)$/.test(ae(n))}function Pe(n){try{if(n.matches(":popover-open"))return !0}catch{}try{return n.matches(":modal")}catch{return false}}var Tn=/transform|translate|scale|rotate|perspective|filter/,An=/paint|layout|strict|content/,se=n=>!!n&&n!=="none",dt;function Ye(n){let e=P(n)?L(n):n;return se(e.transform)||se(e.translate)||se(e.scale)||se(e.rotate)||se(e.perspective)||!Xe()&&(se(e.backdropFilter)||se(e.filter))||Tn.test(e.willChange||"")||An.test(e.contain||"")}function Ht(n){let e=K(n);for(;D(e)&&!le(e);){if(Ye(e))return e;if(Pe(e))return null;e=K(e);}return null}function Xe(){return dt==null&&(dt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dt}function le(n){return /^(html|body|#document)$/.test(ae(n))}function L(n){return I(n).getComputedStyle(n)}function Le(n){return P(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function K(n){if(ae(n)==="html")return n;let e=n.assignedSlot||n.parentNode||Dt(n)&&n.host||M(n);return Dt(e)?e.host:e}function $t(n){let e=K(n);return le(e)?n.ownerDocument?n.ownerDocument.body:n.body:D(e)&&pe(e)?e:$t(e)}function je(n,e,t){var o;e===void 0&&(e=[]);let i=$t(n),r=i===((o=n.ownerDocument)==null?void 0:o.body),s=I(i);if(r){Qe(s);return e.concat(s,s.visualViewport||[],pe(i)?i:[],[])}else return e.concat(i,je(i,[]))}function Qe(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Kt(n){let e=L(n),t=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=D(n),r=i?n.offsetWidth:t,s=i?n.offsetHeight:o,a=Ae(t)!==r||Ae(o)!==s;return a&&(t=r,o=s),{width:t,height:o,$:a}}function qt(n){return P(n)?n:n.contextElement}function fe(n){let e=qt(n);if(!D(e))return _(1);let t=e.getBoundingClientRect(),{width:o,height:i,$:r}=Kt(e),s=(r?Ae(t.width):t.width)/o,a=(r?Ae(t.height):t.height)/i;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var Pn=_(0);function jt(n){let e=I(n);return !Xe()||!e.visualViewport?Pn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ln(n,e,t){return e===void 0&&(e=false),!t||e&&t!==I(n)?false:e}function Ge(n,e,t,o){e===void 0&&(e=false),t===void 0&&(t=false);let i=n.getBoundingClientRect(),r=qt(n),s=_(1);e&&(o?P(o)&&(s=fe(o)):s=fe(n));let a=Ln(r,t,o)?jt(r):_(0),l=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,c=i.width/s.x,u=i.height/s.y;if(r){let f=I(r),p=o&&P(o)?I(o):o,h=f,m=Qe(h);for(;m&&o&&p!==h;){let g=fe(m),v=m.getBoundingClientRect(),w=L(m),x=v.left+(m.clientLeft+parseFloat(w.paddingLeft))*g.x,y=v.top+(m.clientTop+parseFloat(w.paddingTop))*g.y;l*=g.x,d*=g.y,c*=g.x,u*=g.y,l+=x,d+=y,h=I(m),m=Qe(h);}}return re({width:c,height:u,x:l,y:d})}function Je(n,e){let t=Le(n).scrollLeft;return e?e.left+t:Ge(M(n)).left+t}function Vt(n,e){let t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Je(n,t),i=t.top+e.scrollTop;return {x:o,y:i}}function Gn(n){let{elements:e,rect:t,offsetParent:o,strategy:i}=n,r=i==="fixed",s=M(o),a=e?Pe(e.floating):false;if(o===s||a&&r)return t;let l={scrollLeft:0,scrollTop:0},d=_(1),c=_(0),u=D(o);if((u||!u&&!r)&&((ae(o)!=="body"||pe(s))&&(l=Le(o)),u)){let p=Ge(o);d=fe(o),c.x=p.x+o.clientLeft,c.y=p.y+o.clientTop;}let f=s&&!u&&!r?Vt(s,l):_(0);return {width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+c.x+f.x,y:t.y*d.y-l.scrollTop*d.y+c.y+f.y}}function Nn(n){return Array.from(n.getClientRects())}function _n(n){let e=M(n),t=Le(n),o=n.ownerDocument.body,i=j(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=j(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),s=-t.scrollLeft+Je(n),a=-t.scrollTop;return L(o).direction==="rtl"&&(s+=j(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:a}}var Wt=25;function On(n,e){let t=I(n),o=M(n),i=t.visualViewport,r=o.clientWidth,s=o.clientHeight,a=0,l=0;if(i){r=i.width,s=i.height;let c=Xe();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop);}let d=Je(o);if(d<=0){let c=o.ownerDocument,u=c.body,f=getComputedStyle(u),p=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(o.clientWidth-u.clientWidth-p);h<=Wt&&(r-=h);}else d<=Wt&&(r+=d);return {width:r,height:s,x:a,y:l}}function Mn(n,e){let t=Ge(n,true,e==="fixed"),o=t.top+n.clientTop,i=t.left+n.clientLeft,r=D(n)?fe(n):_(1),s=n.clientWidth*r.x,a=n.clientHeight*r.y,l=i*r.x,d=o*r.y;return {width:s,height:a,x:l,y:d}}function Ut(n,e,t){let o;if(e==="viewport")o=On(n,t);else if(e==="document")o=_n(M(n));else if(P(e))o=Mn(e,t);else {let i=jt(n);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height};}return re(o)}function Yt(n,e){let t=K(n);return t===e||!P(t)||le(t)?false:L(t).position==="fixed"||Yt(t,e)}function Dn(n,e){let t=e.get(n);if(t)return t;let o=je(n,[]).filter(a=>P(a)&&ae(a)!=="body"),i=null,r=L(n).position==="fixed",s=r?K(n):n;for(;P(s)&&!le(s);){let a=L(s),l=Ye(s);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||pe(s)&&!l&&Yt(n,s))?o=o.filter(c=>c!==s):i=a,s=K(s);}return e.set(n,o),o}function Bn(n){let{element:e,boundary:t,rootBoundary:o,strategy:i}=n,s=[...t==="clippingAncestors"?Pe(e)?[]:Dn(e,this._c):[].concat(t),o],a=Ut(e,s[0],i),l=a.top,d=a.right,c=a.bottom,u=a.left;for(let f=1;f<s.length;f++){let p=Ut(e,s[f],i);l=j(p.top,l),d=ie(p.right,d),c=ie(p.bottom,c),u=j(p.left,u);}return {width:d-u,height:c-l,x:u,y:l}}function Fn(n){let{width:e,height:t}=Kt(n);return {width:e,height:t}}function Hn(n,e,t){let o=D(e),i=M(e),r=t==="fixed",s=Ge(n,true,r,e),a={scrollLeft:0,scrollTop:0},l=_(0);function d(){l.x=Je(i);}if(o||!o&&!r)if((ae(e)!=="body"||pe(i))&&(a=Le(e)),o){let p=Ge(e,true,r,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop;}else i&&d();r&&!o&&i&&d();let c=i&&!o&&!r?Vt(i,a):_(0),u=s.left+a.scrollLeft-l.x-c.x,f=s.top+a.scrollTop-l.y-c.y;return {x:u,y:f,width:s.width,height:s.height}}function ct(n){return L(n).position==="static"}function zt(n,e){if(!D(n)||L(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return M(n)===t&&(t=t.ownerDocument.body),t}function Xt(n,e){let t=I(n);if(Pe(n))return t;if(!D(n)){let i=K(n);for(;i&&!le(i);){if(P(i)&&!ct(i))return i;i=K(i);}return t}let o=zt(n,e);for(;o&&Ft(o)&&ct(o);)o=zt(o,e);return o&&le(o)&&ct(o)&&!Ye(o)?t:o||Ht(n)||t}var $n=async function(n){let e=this.getOffsetParent||Xt,t=this.getDimensions,o=await t(n.floating);return {reference:Hn(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Wn(n){return L(n).direction==="rtl"}var Un={convertOffsetParentRelativeRectToViewportRelativeRect:Gn,getDocumentElement:M,getClippingRect:Bn,getOffsetParent:Xt,getElementRects:$n,getClientRects:Nn,getDimensions:Fn,getScale:fe,isElement:P,isRTL:Wn};var Y=Ot;var X=Mt,Q=_t;var he=Nt;var J=(n,e,t)=>{let o=new Map,i={platform:Un,...t},r={...i.platform,_c:o};return Gt(n,e,{...i,platform:r})};var zn={P:"p",BR:"br",STRONG:"strong",B:"strong",EM:"em",I:"em",U:"u",S:"s",UL:"ul",OL:"ol",LI:"li",A:"a"},Kn=new Set(["SCRIPT","STYLE","TEMPLATE","IFRAME","OBJECT","EMBED","NOSCRIPT","TITLE","TEXTAREA","SELECT","SVG","MATH"]),Qt=16*1024,qn=20,jn=1e3;function Jt(n,e){let t=e.createDocumentFragment();if(typeof n!="string"||n.length===0)return t;let o;try{o=new DOMParser().parseFromString(n.length>Qt?n.slice(0,Qt):n,"text/html");}catch{return t.appendChild(e.createTextNode(n)),t}let i={nodes:0,exceeded:false};for(let r of Array.from(o.body.childNodes)){let s=Ne(r,e,0,i);s&&t.appendChild(s);}if(i.exceeded){let r=e.createDocumentFragment();return r.appendChild(e.createTextNode(o.body.textContent??"")),r}return t}function Ne(n,e,t,o){if(o.exceeded)return null;if(++o.nodes>jn||t>qn)return o.exceeded=true,null;if(n.nodeType===Node.TEXT_NODE)return e.createTextNode(n.textContent??"");if(n.nodeType!==Node.ELEMENT_NODE)return null;let i=n;if(Kn.has(i.tagName))return null;let r=zn[i.tagName];if(!r){let a=e.createDocumentFragment();for(let l of Array.from(i.childNodes)){let d=Ne(l,e,t+1,o);d&&a.appendChild(d);}return a}if(r==="a"){let a=i.getAttribute("href")??"";if(!A(a)){let d=e.createDocumentFragment();for(let c of Array.from(i.childNodes)){let u=Ne(c,e,t+1,o);u&&d.appendChild(u);}return d}let l=e.createElement("a");l.setAttribute("href",a),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer nofollow");for(let d of Array.from(i.childNodes)){let c=Ne(d,e,t+1,o);c&&l.appendChild(c);}return l}let s=e.createElement(r);for(let a of Array.from(i.childNodes)){let l=Ne(a,e,t+1,o);l&&s.appendChild(l);}return s}function T(n,e,t){let o=e.createElement("div");o.className="veo-guide-content";let i=en(n);return i?Yn(o,i,e,t):Vn(o,n,e,t),o.appendChild(Oe(e,()=>t.onDismiss())),o}function Zt(n,e){let t=en(n);if(t)return t.filter(i=>i.type!=="button").map(i=>tn(i,e)).filter(i=>i!==null);let o=[];if(typeof n.imageUrl=="string"&&n.imageUrl&&A(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.push(i);}if(typeof n.title=="string"&&n.title){let i=e.createElement("h2");i.className="veo-guide-title",i.textContent=n.title,o.push(i);}if(typeof n.content=="string"&&n.content){let i=e.createElement("p");i.className="veo-guide-text",i.textContent=n.content,o.push(i);}return o}function Vn(n,e,t,o){if(typeof e.imageUrl=="string"&&e.imageUrl&&A(e.imageUrl)){let r=t.createElement("img");r.className="veo-guide-image",r.src=e.imageUrl,r.alt=typeof e.title=="string"?e.title:"",n.appendChild(r);}if(typeof e.title=="string"&&e.title){let r=t.createElement("h2");r.className="veo-guide-title",r.textContent=e.title,n.appendChild(r);}if(typeof e.content=="string"&&e.content){let r=t.createElement("p");r.className="veo-guide-text",r.textContent=e.content,n.appendChild(r);}let i=t.createElement("div");if(i.className="veo-guide-actions",typeof e.ctaText=="string"&&e.ctaText){let r=t.createElement("button");r.type="button",r.className="veo-guide-cta",r.textContent=e.ctaText,r.addEventListener("click",()=>{let s=e.ctaAction??"dismiss",a=Qn(e);o.onCtaClick(s,a);}),i.appendChild(r);}n.appendChild(i);}function en(n){if(!Array.isArray(n.blocks)||n.blocks.length===0)return null;let e=n.blocks.filter(t=>!t||typeof t!="object"?false:t.type==="image"?typeof t.url=="string"&&A(t.url):t.type==="title"||t.type==="text"||t.type==="button");return e.length>0?e:null}function Yn(n,e,t,o){let i=0;for(;i<e.length;){let r=e[i];if(r?.type==="button"){let a=t.createElement("div");a.className="veo-guide-actions";let l;for(;i<e.length&&e[i]?.type==="button";){let d=e[i];if(!l){let c=d.style?.align;(c==="left"||c==="center"||c==="right")&&(l=c);}a.appendChild(Xn(d,t,o)),i++;}l&&(a.style.justifyContent=nn[l]),n.appendChild(a);continue}let s=tn(r,t);s&&n.appendChild(s),i++;}}function tn(n,e){switch(n.type){case "title":{let t=e.createElement("h2");return t.className="veo-guide-title",t.textContent=typeof n.text=="string"?n.text:"",Ze(t,n.style,"text"),t}case "text":{let t=e.createElement("div");return t.className="veo-guide-text",typeof n.html=="string"&&n.html?t.appendChild(Jt(n.html,e)):t.textContent=typeof n.text=="string"?n.text:"",Ze(t,n.style,"text"),t}case "image":{if(typeof n.url!="string"||!A(n.url))return null;let t=e.createElement("img");return t.className="veo-guide-image",t.src=n.url,t.alt="",Ze(t,n.style,"image"),t}default:return null}}function Xn(n,e,t){let o=e.createElement("button");return o.type="button",o.className="veo-guide-cta",o.textContent=typeof n.text=="string"&&n.text?n.text:"OK",Ze(o,n.style,"button"),o.addEventListener("click",()=>{let i=n.action??"dismiss",r=i==="url"&&typeof n.url=="string"&&A(n.url)?n.url:i==="guide"&&typeof n.targetGuideId=="string"&&n.targetGuideId?n.targetGuideId:void 0,s={...typeof n.id=="string"&&n.id?{buttonId:n.id}:{},...typeof n.text=="string"&&n.text?{buttonText:n.text}:{}};t.onCtaClick(i,r,Object.keys(s).length?s:void 0);}),o}var nn={left:"flex-start",center:"center",right:"flex-end"};function _e(n,e,t){return Math.min(t,Math.max(e,n))}function Ze(n,e,t){if(!e||typeof e!="object")return;let o=e;if(t==="image"&&o.bleed===true){n.classList.add("veo-guide-image--bleed");return}let i=typeof o.align=="string"?o.align:null;i&&(i==="left"||i==="center"||i==="right")&&(t==="text"?n.style.textAlign=i:t==="image"&&(n.style.alignSelf=nn[i])),t!=="image"&&typeof o.color=="string"&&(n.style.color=o.color),t==="text"&&typeof o.fontSize=="number"&&Number.isFinite(o.fontSize)&&(n.style.fontSize=`${_e(o.fontSize,8,72)}px`),t==="image"&&typeof o.width=="number"&&Number.isFinite(o.width)&&(n.style.width=`${_e(o.width,10,100)}%`),t==="image"&&typeof o.radius=="number"&&Number.isFinite(o.radius)&&(n.style.borderRadius=`${_e(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&(n.style.marginTop=`${_e(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&(n.style.marginBottom=`${_e(o.marginBottom,0,64)}px`);}function Oe(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 A(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 vt.includes(t.protocol)}catch{return false}}function Qn(n){let e=n.style?.ctaUrl;if(typeof e=="string")return A(e)?e:void 0}var Jn={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},pt={left:"flex-start",center:"center",right:"flex-end"},Zn={left:"flex-start",center:"center",right:"flex-end"},eo={title:"text",text:"text",image:"self"},on={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)"},rn={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]},B=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function R(n,e,t){return Math.min(t,Math.max(e,n))}function sn(n,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&B.test(t.accentColor.trim())&&n.style.setProperty("--veo-primary",t.accentColor.trim()),typeof t.fontFamily=="string"&&t.fontFamily.length<=200&&!/[<>{}]/.test(t.fontFamily)&&n.style.setProperty("--veo-font",t.fontFamily.trim()),t.theme==="dark")for(let[r,s]of Object.entries(Jn))n.style.setProperty(r,s);typeof t.background=="string"&&B.test(t.background.trim())&&n.style.setProperty("--veo-bg",t.background.trim()),typeof t.textColor=="string"&&B.test(t.textColor.trim())&&n.style.setProperty("--veo-text",t.textColor.trim()),typeof t.textSecondaryColor=="string"&&B.test(t.textSecondaryColor.trim())&&n.style.setProperty("--veo-text-secondary",t.textSecondaryColor.trim()),typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-radius",`${R(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&n.style.setProperty("--veo-width",`${R(t.width,220,720)}px`),typeof t.height=="number"&&Number.isFinite(t.height)&&n.style.setProperty("--veo-min-h",`${R(t.height,120,900)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&n.style.setProperty("--veo-actions-justify",pt[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&n.style.setProperty("--veo-pad",`${R(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&n.style.setProperty("--veo-margin",`${R(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&n.style.setProperty("--veo-border-width",`${R(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&B.test(t.borderColor.trim())&&n.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&on[t.shadow]&&n.style.setProperty("--veo-shadow",on[t.shadow]);let o,i;if(typeof t.posX=="number"&&typeof t.posY=="number"?(o=R(t.posX,0,1),i=R(t.posY,0,1)):typeof t.overlayPosition=="string"&&rn[t.overlayPosition]&&([o,i]=rn[t.overlayPosition]),o!==void 0&&i!==void 0&&(n.style.setProperty("--veo-pos-x",`${o*100}%`),n.style.setProperty("--veo-pos-y",`${i*100}%`)),t.elements&&typeof t.elements=="object"){let r=t.elements;ut(n,"title",r.title),ut(n,"text",r.text),ut(n,"image",r.image),to(n,r.cta);}}function to(n,e){if(!e||typeof e!="object")return;let t=e;typeof t.align=="string"&&pt[t.align]&&n.style.setProperty("--veo-actions-justify",pt[t.align]),typeof t.background=="string"&&B.test(t.background.trim())&&n.style.setProperty("--veo-cta-bg",t.background.trim()),typeof t.color=="string"&&B.test(t.color.trim())&&n.style.setProperty("--veo-cta-color",t.color.trim()),typeof t.fontSize=="number"&&Number.isFinite(t.fontSize)&&n.style.setProperty("--veo-cta-size",`${R(t.fontSize,10,24)}px`),typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-cta-radius",`${R(t.radius,0,48)}px`);}function ut(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 r=(eo[e]??"text")==="self"?Zn[o.align]:o.align;n.style.setProperty(`--veo-${e}-align`,r);}typeof o.color=="string"&&B.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`,`${R(o.fontSize,8,72)}px`),typeof o.width=="number"&&Number.isFinite(o.width)&&n.style.setProperty(`--veo-${e}-width`,`${R(o.width,10,100)}%`),typeof o.radius=="number"&&Number.isFinite(o.radius)&&n.style.setProperty(`--veo-${e}-radius`,`${R(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&n.style.setProperty(`--veo-${e}-mt`,`${R(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&n.style.setProperty(`--veo-${e}-mb`,`${R(o.marginBottom,0,64)}px`);}function F(n){let e=n?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function O(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 H(n,e,t){let o=window.setInterval(()=>{if(n.isConnected)return;let i=document.querySelector(e);i&&O(i,n,t);},1e3);return ()=>window.clearInterval(o)}function E(n,e=5e3){return new Promise(t=>{let o=()=>{try{return document.querySelector(n)}catch{return null}},i=o();if(i){t(i);return}let r=false,s=d=>{r||(r=true,a.disconnect(),clearTimeout(l),t(d));},a=new MutationObserver(()=>{let d=o();d&&s(d);});a.observe(document.body,{childList:true,subtree:true});let l=setTimeout(()=>s(null),e);})}var an=`
1
+ var veoGuides=(function(exports){'use strict';function gt(){return typeof window<"u"}function Be(){return typeof document<"u"}var vt=["http:","https:"],yt="data-veo-guide",wt="veo:freq:";var bt="veo:walkthrough_state:";var Ct={shown:1,dismissed:2,completed:2};function kt(n){return n.slice(-16)||"default"}var Fe=class{constructor(e){this.storageKey=`${wt}${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,i]of this.cache)e-i.lastInteractionAt>7776e6&&(this.cache.delete(o),t=true);if(this.cache.size>500){let o=Array.from(this.cache.entries()).sort((r,s)=>r[1].lastInteractionAt-s[1].lastInteractionAt),i=this.cache.size-500;for(let r=0;r<i;r++){let s=o[r];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 i of t)if(i&&typeof i=="object"&&typeof i.guideId=="string"&&typeof i.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(i.status)){let r=i;o.push([r.guideId,r]);}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 He=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}),i;try{i=await fetch(`${this.apiUrl}/v1/guides/resolve?${o.toString()}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(r){return this.debug&&console.error("[veo] guides resolve fetch failed:",r),[]}if(!i.ok)return this.debug&&console.warn("[veo] guides resolve HTTP",i.status),[];try{let r=await i.json();return Array.isArray(r.guides)?r.guides:[]}catch(r){return this.debug&&console.error("[veo] guides resolve parse failed:",r),[]}}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 Et(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),n.metadata&&(e.metadata=n.metadata),e}var $e=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(Et(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(Et(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 We=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;let e=Date.now(),t=this.buffer.filter(r=>(r.nextRetryAt??0)<=e);if(t.length===0)return;this.flushing=true;let o=new Set(t);this.buffer=this.buffer.filter(r=>!o.has(r));let i=await Promise.allSettled(t.map(r=>this.config.client.send({guideId:r.guideId,payload:r.payload})));for(let r=0;r<i.length;r++){let s=i[r],a=t[r];!s||!a||s.status!=="fulfilled"&&(a.attempts+=1,a.attempts<this.config.maxRetries?(a.nextRetryAt=Date.now()+this.retryDelayMs(a.attempts),this.buffer.push(a)):this.safeOnError(s.reason,a));}this.flushing=false;}retryDelayMs(e){let t=Math.min(3e3*2**(e-1),3e4);return t/2+Math.random()*(t/2)}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{}}};var ie=Math.min,j=Math.max,Ae=Math.round;var _=n=>({x:n,y:n}),bn={left:"right",right:"left",bottom:"top",top:"bottom"};function ze(n,e,t){return j(n,ie(e,t))}function ce(n,e){return typeof n=="function"?n(e):n}function V(n){return n.split("-")[0]}function ue(n){return n.split("-")[1]}function at(n){return n==="x"?"y":"x"}function Ke(n){return n==="y"?"height":"width"}function z(n){let e=n[0];return e==="t"||e==="b"?"y":"x"}function qe(n){return at(z(n))}function It(n,e,t){t===void 0&&(t=false);let o=ue(n),i=qe(n),r=Ke(i),s=i==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=Te(s)),[s,Te(s)]}function Tt(n){let e=Te(n);return [Ue(n),e,Ue(e)]}function Ue(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var St=["left","right"],Rt=["right","left"],xn=["top","bottom"],Cn=["bottom","top"];function kn(n,e,t){switch(n){case "top":case "bottom":return t?e?Rt:St:e?St:Rt;case "left":case "right":return e?xn:Cn;default:return []}}function At(n,e,t,o){let i=ue(n),r=kn(V(n),t==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(Ue)))),r}function Te(n){let e=V(n);return bn[e]+n.slice(e.length)}function En(n){return {top:0,right:0,bottom:0,left:0,...n}}function lt(n){return typeof n!="number"?En(n):{top:n,right:n,bottom:n,left:n}}function re(n){let{x:e,y:t,width:o,height:i}=n;return {width:o,height:i,top:t,left:e,right:e+o,bottom:t+i,x:e,y:t}}function Pt(n,e,t){let{reference:o,floating:i}=n,r=z(e),s=qe(e),a=Ke(s),l=V(e),d=r==="y",c=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2,p;switch(l){case "top":p={x:c,y:o.y-i.height};break;case "bottom":p={x:c,y:o.y+o.height};break;case "right":p={x:o.x+o.width,y:u};break;case "left":p={x:o.x-i.width,y:u};break;default:p={x:o.x,y:o.y};}switch(ue(e)){case "start":p[s]-=f*(t&&d?-1:1);break;case "end":p[s]+=f*(t&&d?-1:1);break}return p}async function Lt(n,e){var t;e===void 0&&(e={});let{x:o,y:i,platform:r,rects:s,elements:a,strategy:l}=n,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:f=false,padding:p=0}=ce(e,n),h=lt(p),g=a[f?u==="floating"?"reference":"floating":u],v=re(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(g)))==null||t?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),w=u==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),y=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},C=re(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:x,strategy:l}):w);return {top:(v.top-C.top+h.top)/y.y,bottom:(C.bottom-v.bottom+h.bottom)/y.y,left:(v.left-C.left+h.left)/y.x,right:(C.right-v.right+h.right)/y.x}}var Sn=50,Gt=async(n,e,t)=>{let{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:Lt},l=await(s.isRTL==null?void 0:s.isRTL(e)),d=await s.getElementRects({reference:n,floating:e,strategy:i}),{x:c,y:u}=Pt(d,o,l),f=o,p=0,h={};for(let m=0;m<r.length;m++){let g=r[m];if(!g)continue;let{name:v,fn:w}=g,{x,y,data:C,reset:k}=await w({x:c,y:u,initialPlacement:o,placement:f,strategy:i,middlewareData:h,rects:d,platform:a,elements:{reference:n,floating:e}});c=x??c,u=y??u,h[v]={...h[v],...C},k&&p<Sn&&(p++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(d=k.rects===true?await s.getElementRects({reference:n,floating:e,strategy:i}):k.rects),{x:c,y:u}=Pt(d,f,l)),m=-1);}return {x:c,y:u,placement:f,strategy:i,middlewareData:h}},Nt=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:o,placement:i,rects:r,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:c=0}=ce(n,e)||{};if(d==null)return {};let u=lt(c),f={x:t,y:o},p=qe(i),h=Ke(p),m=await s.getDimensions(d),g=p==="y",v=g?"top":"left",w=g?"bottom":"right",x=g?"clientHeight":"clientWidth",y=r.reference[h]+r.reference[p]-f[p]-r.floating[h],C=f[p]-r.reference[p],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d)),$=k?k[x]:0;(!$||!await(s.isElement==null?void 0:s.isElement(k)))&&($=a.floating[x]||r.floating[h]);let Se=y/2-C/2,te=$/2-m[h]/2-1,W=ie(u[v],te),Re=ie(u[w],te),ne=W,Ie=$-m[h]-Re,S=$/2-m[h]/2+Se,oe=ze(ne,S,Ie),U=!l.arrow&&ue(i)!=null&&S!==oe&&r.reference[h]/2-(S<ne?W:Re)-m[h]/2<0,G=U?S<ne?S-ne:S-Ie:0;return {[p]:f[p]+G,data:{[p]:oe,centerOffset:S-oe-G,...U&&{alignmentOffset:G}},reset:U}}});var _t=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;let{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:c=true,crossAxis:u=true,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=true,...g}=ce(n,e);if((t=r.arrow)!=null&&t.alignmentOffset)return {};let v=V(i),w=z(a),x=V(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(d.floating)),C=f||(x||!m?[Te(a)]:Tt(a)),k=h!=="none";!f&&k&&C.push(...At(a,m,h,y));let $=[a,...C],Se=await l.detectOverflow(e,g),te=[],W=((o=r.flip)==null?void 0:o.overflows)||[];if(c&&te.push(Se[v]),u){let S=It(i,s,y);te.push(Se[S[0]],Se[S[1]]);}if(W=[...W,{placement:i,overflows:te}],!te.every(S=>S<=0)){var Re,ne;let S=(((Re=r.flip)==null?void 0:Re.index)||0)+1,oe=$[S];if(oe&&(!(u==="alignment"?w!==z(oe):false)||W.every(N=>z(N.placement)===w?N.overflows[0]>0:true)))return {data:{index:S,overflows:W},reset:{placement:oe}};let U=(ne=W.filter(G=>G.overflows[0]<=0).sort((G,N)=>G.overflows[1]-N.overflows[1])[0])==null?void 0:ne.placement;if(!U)switch(p){case "bestFit":{var Ie;let G=(Ie=W.filter(N=>{if(k){let q=z(N.placement);return q===w||q==="y"}return true}).map(N=>[N.placement,N.overflows.filter(q=>q>0).reduce((q,yn)=>q+yn,0)]).sort((N,q)=>N[1]-q[1])[0])==null?void 0:Ie[0];G&&(U=G);break}case "initialPlacement":U=a;break}if(i!==U)return {reset:{placement:U}}}return {}}}};var Rn=new Set(["left","top"]);async function In(n,e){let{placement:t,platform:o,elements:i}=n,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=V(t),a=ue(t),l=z(t)==="y",d=Rn.has(s)?-1:1,c=r&&l?-1:1,u=ce(e,n),{mainAxis:f,crossAxis:p,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"&&(p=a==="end"?h*-1:h),l?{x:p*c,y:f*d}:{x:f*d,y:p*c}}var Ot=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;let{x:i,y:r,placement:s,middlewareData:a}=e,l=await In(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}},Mt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:o,placement:i,platform:r}=e,{mainAxis:s=true,crossAxis:a=false,limiter:l={fn:v=>{let{x:w,y:x}=v;return {x:w,y:x}}},...d}=ce(n,e),c={x:t,y:o},u=await r.detectOverflow(e,d),f=z(V(i)),p=at(f),h=c[p],m=c[f];if(s){let v=p==="y"?"top":"left",w=p==="y"?"bottom":"right",x=h+u[v],y=h-u[w];h=ze(x,h,y);}if(a){let v=f==="y"?"top":"left",w=f==="y"?"bottom":"right",x=m+u[v],y=m-u[w];m=ze(x,m,y);}let g=l.fn({...e,[p]:h,[f]:m});return {...g,data:{x:g.x-t,y:g.y-o,enabled:{[p]:s,[f]:a}}}}}};function Ve(){return typeof window<"u"}function ae(n){return Bt(n)?(n.nodeName||"").toLowerCase():"#document"}function I(n){var e;return (n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function M(n){var e;return (e=(Bt(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Bt(n){return Ve()?n instanceof Node||n instanceof I(n).Node:false}function P(n){return Ve()?n instanceof Element||n instanceof I(n).Element:false}function D(n){return Ve()?n instanceof HTMLElement||n instanceof I(n).HTMLElement:false}function Dt(n){return !Ve()||typeof ShadowRoot>"u"?false:n instanceof ShadowRoot||n instanceof I(n).ShadowRoot}function pe(n){let{overflow:e,overflowX:t,overflowY:o,display:i}=L(n);return /auto|scroll|overlay|hidden|clip/.test(e+o+t)&&i!=="inline"&&i!=="contents"}function Ft(n){return /^(table|td|th)$/.test(ae(n))}function Pe(n){try{if(n.matches(":popover-open"))return !0}catch{}try{return n.matches(":modal")}catch{return false}}var Tn=/transform|translate|scale|rotate|perspective|filter/,An=/paint|layout|strict|content/,se=n=>!!n&&n!=="none",dt;function Ye(n){let e=P(n)?L(n):n;return se(e.transform)||se(e.translate)||se(e.scale)||se(e.rotate)||se(e.perspective)||!Xe()&&(se(e.backdropFilter)||se(e.filter))||Tn.test(e.willChange||"")||An.test(e.contain||"")}function Ht(n){let e=K(n);for(;D(e)&&!le(e);){if(Ye(e))return e;if(Pe(e))return null;e=K(e);}return null}function Xe(){return dt==null&&(dt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dt}function le(n){return /^(html|body|#document)$/.test(ae(n))}function L(n){return I(n).getComputedStyle(n)}function Le(n){return P(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function K(n){if(ae(n)==="html")return n;let e=n.assignedSlot||n.parentNode||Dt(n)&&n.host||M(n);return Dt(e)?e.host:e}function $t(n){let e=K(n);return le(e)?n.ownerDocument?n.ownerDocument.body:n.body:D(e)&&pe(e)?e:$t(e)}function je(n,e,t){var o;e===void 0&&(e=[]);let i=$t(n),r=i===((o=n.ownerDocument)==null?void 0:o.body),s=I(i);if(r){Qe(s);return e.concat(s,s.visualViewport||[],pe(i)?i:[],[])}else return e.concat(i,je(i,[]))}function Qe(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Kt(n){let e=L(n),t=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=D(n),r=i?n.offsetWidth:t,s=i?n.offsetHeight:o,a=Ae(t)!==r||Ae(o)!==s;return a&&(t=r,o=s),{width:t,height:o,$:a}}function qt(n){return P(n)?n:n.contextElement}function fe(n){let e=qt(n);if(!D(e))return _(1);let t=e.getBoundingClientRect(),{width:o,height:i,$:r}=Kt(e),s=(r?Ae(t.width):t.width)/o,a=(r?Ae(t.height):t.height)/i;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var Pn=_(0);function jt(n){let e=I(n);return !Xe()||!e.visualViewport?Pn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ln(n,e,t){return e===void 0&&(e=false),!t||e&&t!==I(n)?false:e}function Ge(n,e,t,o){e===void 0&&(e=false),t===void 0&&(t=false);let i=n.getBoundingClientRect(),r=qt(n),s=_(1);e&&(o?P(o)&&(s=fe(o)):s=fe(n));let a=Ln(r,t,o)?jt(r):_(0),l=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,c=i.width/s.x,u=i.height/s.y;if(r){let f=I(r),p=o&&P(o)?I(o):o,h=f,m=Qe(h);for(;m&&o&&p!==h;){let g=fe(m),v=m.getBoundingClientRect(),w=L(m),x=v.left+(m.clientLeft+parseFloat(w.paddingLeft))*g.x,y=v.top+(m.clientTop+parseFloat(w.paddingTop))*g.y;l*=g.x,d*=g.y,c*=g.x,u*=g.y,l+=x,d+=y,h=I(m),m=Qe(h);}}return re({width:c,height:u,x:l,y:d})}function Je(n,e){let t=Le(n).scrollLeft;return e?e.left+t:Ge(M(n)).left+t}function Vt(n,e){let t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Je(n,t),i=t.top+e.scrollTop;return {x:o,y:i}}function Gn(n){let{elements:e,rect:t,offsetParent:o,strategy:i}=n,r=i==="fixed",s=M(o),a=e?Pe(e.floating):false;if(o===s||a&&r)return t;let l={scrollLeft:0,scrollTop:0},d=_(1),c=_(0),u=D(o);if((u||!u&&!r)&&((ae(o)!=="body"||pe(s))&&(l=Le(o)),u)){let p=Ge(o);d=fe(o),c.x=p.x+o.clientLeft,c.y=p.y+o.clientTop;}let f=s&&!u&&!r?Vt(s,l):_(0);return {width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+c.x+f.x,y:t.y*d.y-l.scrollTop*d.y+c.y+f.y}}function Nn(n){return Array.from(n.getClientRects())}function _n(n){let e=M(n),t=Le(n),o=n.ownerDocument.body,i=j(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=j(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),s=-t.scrollLeft+Je(n),a=-t.scrollTop;return L(o).direction==="rtl"&&(s+=j(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:a}}var Wt=25;function On(n,e){let t=I(n),o=M(n),i=t.visualViewport,r=o.clientWidth,s=o.clientHeight,a=0,l=0;if(i){r=i.width,s=i.height;let c=Xe();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop);}let d=Je(o);if(d<=0){let c=o.ownerDocument,u=c.body,f=getComputedStyle(u),p=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(o.clientWidth-u.clientWidth-p);h<=Wt&&(r-=h);}else d<=Wt&&(r+=d);return {width:r,height:s,x:a,y:l}}function Mn(n,e){let t=Ge(n,true,e==="fixed"),o=t.top+n.clientTop,i=t.left+n.clientLeft,r=D(n)?fe(n):_(1),s=n.clientWidth*r.x,a=n.clientHeight*r.y,l=i*r.x,d=o*r.y;return {width:s,height:a,x:l,y:d}}function Ut(n,e,t){let o;if(e==="viewport")o=On(n,t);else if(e==="document")o=_n(M(n));else if(P(e))o=Mn(e,t);else {let i=jt(n);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height};}return re(o)}function Yt(n,e){let t=K(n);return t===e||!P(t)||le(t)?false:L(t).position==="fixed"||Yt(t,e)}function Dn(n,e){let t=e.get(n);if(t)return t;let o=je(n,[]).filter(a=>P(a)&&ae(a)!=="body"),i=null,r=L(n).position==="fixed",s=r?K(n):n;for(;P(s)&&!le(s);){let a=L(s),l=Ye(s);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||pe(s)&&!l&&Yt(n,s))?o=o.filter(c=>c!==s):i=a,s=K(s);}return e.set(n,o),o}function Bn(n){let{element:e,boundary:t,rootBoundary:o,strategy:i}=n,s=[...t==="clippingAncestors"?Pe(e)?[]:Dn(e,this._c):[].concat(t),o],a=Ut(e,s[0],i),l=a.top,d=a.right,c=a.bottom,u=a.left;for(let f=1;f<s.length;f++){let p=Ut(e,s[f],i);l=j(p.top,l),d=ie(p.right,d),c=ie(p.bottom,c),u=j(p.left,u);}return {width:d-u,height:c-l,x:u,y:l}}function Fn(n){let{width:e,height:t}=Kt(n);return {width:e,height:t}}function Hn(n,e,t){let o=D(e),i=M(e),r=t==="fixed",s=Ge(n,true,r,e),a={scrollLeft:0,scrollTop:0},l=_(0);function d(){l.x=Je(i);}if(o||!o&&!r)if((ae(e)!=="body"||pe(i))&&(a=Le(e)),o){let p=Ge(e,true,r,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop;}else i&&d();r&&!o&&i&&d();let c=i&&!o&&!r?Vt(i,a):_(0),u=s.left+a.scrollLeft-l.x-c.x,f=s.top+a.scrollTop-l.y-c.y;return {x:u,y:f,width:s.width,height:s.height}}function ct(n){return L(n).position==="static"}function zt(n,e){if(!D(n)||L(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return M(n)===t&&(t=t.ownerDocument.body),t}function Xt(n,e){let t=I(n);if(Pe(n))return t;if(!D(n)){let i=K(n);for(;i&&!le(i);){if(P(i)&&!ct(i))return i;i=K(i);}return t}let o=zt(n,e);for(;o&&Ft(o)&&ct(o);)o=zt(o,e);return o&&le(o)&&ct(o)&&!Ye(o)?t:o||Ht(n)||t}var $n=async function(n){let e=this.getOffsetParent||Xt,t=this.getDimensions,o=await t(n.floating);return {reference:Hn(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Wn(n){return L(n).direction==="rtl"}var Un={convertOffsetParentRelativeRectToViewportRelativeRect:Gn,getDocumentElement:M,getClippingRect:Bn,getOffsetParent:Xt,getElementRects:$n,getClientRects:Nn,getDimensions:Fn,getScale:fe,isElement:P,isRTL:Wn};var Y=Ot;var X=Mt,Q=_t;var he=Nt;var J=(n,e,t)=>{let o=new Map,i={platform:Un,...t},r={...i.platform,_c:o};return Gt(n,e,{...i,platform:r})};var zn={P:"p",BR:"br",STRONG:"strong",B:"strong",EM:"em",I:"em",U:"u",S:"s",UL:"ul",OL:"ol",LI:"li",A:"a"},Kn=new Set(["SCRIPT","STYLE","TEMPLATE","IFRAME","OBJECT","EMBED","NOSCRIPT","TITLE","TEXTAREA","SELECT","SVG","MATH"]),Qt=16*1024,qn=20,jn=1e3;function Jt(n,e){let t=e.createDocumentFragment();if(typeof n!="string"||n.length===0)return t;let o;try{o=new DOMParser().parseFromString(n.length>Qt?n.slice(0,Qt):n,"text/html");}catch{return t.appendChild(e.createTextNode(n)),t}let i={nodes:0,exceeded:false};for(let r of Array.from(o.body.childNodes)){let s=Ne(r,e,0,i);s&&t.appendChild(s);}if(i.exceeded){let r=e.createDocumentFragment();return r.appendChild(e.createTextNode(o.body.textContent??"")),r}return t}function Ne(n,e,t,o){if(o.exceeded)return null;if(++o.nodes>jn||t>qn)return o.exceeded=true,null;if(n.nodeType===Node.TEXT_NODE)return e.createTextNode(n.textContent??"");if(n.nodeType!==Node.ELEMENT_NODE)return null;let i=n;if(Kn.has(i.tagName))return null;let r=zn[i.tagName];if(!r){let a=e.createDocumentFragment();for(let l of Array.from(i.childNodes)){let d=Ne(l,e,t+1,o);d&&a.appendChild(d);}return a}if(r==="a"){let a=i.getAttribute("href")??"";if(!A(a)){let d=e.createDocumentFragment();for(let c of Array.from(i.childNodes)){let u=Ne(c,e,t+1,o);u&&d.appendChild(u);}return d}let l=e.createElement("a");l.setAttribute("href",a),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer nofollow");for(let d of Array.from(i.childNodes)){let c=Ne(d,e,t+1,o);c&&l.appendChild(c);}return l}let s=e.createElement(r);for(let a of Array.from(i.childNodes)){let l=Ne(a,e,t+1,o);l&&s.appendChild(l);}return s}function T(n,e,t){let o=e.createElement("div");o.className="veo-guide-content";let i=en(n);return i?Yn(o,i,e,t):Vn(o,n,e,t),o.appendChild(Oe(e,()=>t.onDismiss())),o}function Zt(n,e){let t=en(n);if(t){let i=[];for(let{block:r,idx:s}of t){if(r.type==="button")continue;let a=tn(r,e);a&&(a.dataset.veoIdx=String(s),i.push(a));}return i}let o=[];if(typeof n.imageUrl=="string"&&n.imageUrl&&A(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.push(i);}if(typeof n.title=="string"&&n.title){let i=e.createElement("h2");i.className="veo-guide-title",i.textContent=n.title,o.push(i);}if(typeof n.content=="string"&&n.content){let i=e.createElement("p");i.className="veo-guide-text",i.textContent=n.content,o.push(i);}return o}function Vn(n,e,t,o){if(typeof e.imageUrl=="string"&&e.imageUrl&&A(e.imageUrl)){let r=t.createElement("img");r.className="veo-guide-image",r.src=e.imageUrl,r.alt=typeof e.title=="string"?e.title:"",n.appendChild(r);}if(typeof e.title=="string"&&e.title){let r=t.createElement("h2");r.className="veo-guide-title",r.textContent=e.title,n.appendChild(r);}if(typeof e.content=="string"&&e.content){let r=t.createElement("p");r.className="veo-guide-text",r.textContent=e.content,n.appendChild(r);}let i=t.createElement("div");if(i.className="veo-guide-actions",typeof e.ctaText=="string"&&e.ctaText){let r=t.createElement("button");r.type="button",r.className="veo-guide-cta",r.textContent=e.ctaText,r.addEventListener("click",()=>{let s=e.ctaAction??"dismiss",a=Qn(e);o.onCtaClick(s,a);}),i.appendChild(r);}n.appendChild(i);}function en(n){if(!Array.isArray(n.blocks)||n.blocks.length===0)return null;let e=n.blocks.map((t,o)=>({block:t,idx:o})).filter(t=>{let o=t.block;return !o||typeof o!="object"?false:o.type==="image"?typeof o.url=="string"&&A(o.url):o.type==="title"||o.type==="text"||o.type==="button"});return e.length>0?e:null}function Yn(n,e,t,o){let i=0;for(;i<e.length;){let r=e[i];if(r?.block.type==="button"){let a=t.createElement("div");a.className="veo-guide-actions",a.dataset.veoIdx=String(r.idx);let l;for(;i<e.length&&e[i]?.block.type==="button";){let d=e[i].block;if(!l){let c=d.style?.align;(c==="left"||c==="center"||c==="right")&&(l=c);}a.appendChild(Xn(d,t,o)),i++;}l&&(a.style.justifyContent=nn[l]),n.appendChild(a);continue}let s=r?tn(r.block,t):null;s&&r&&(s.dataset.veoIdx=String(r.idx),n.appendChild(s)),i++;}}function tn(n,e){switch(n.type){case "title":{let t=e.createElement("h2");return t.className="veo-guide-title",t.textContent=typeof n.text=="string"?n.text:"",Ze(t,n.style,"text"),t}case "text":{let t=e.createElement("div");return t.className="veo-guide-text",typeof n.html=="string"&&n.html?t.appendChild(Jt(n.html,e)):t.textContent=typeof n.text=="string"?n.text:"",Ze(t,n.style,"text"),t}case "image":{if(typeof n.url!="string"||!A(n.url))return null;let t=e.createElement("img");return t.className="veo-guide-image",t.src=n.url,t.alt="",Ze(t,n.style,"image"),t}default:return null}}function Xn(n,e,t){let o=e.createElement("button");return o.type="button",o.className="veo-guide-cta",o.textContent=typeof n.text=="string"&&n.text?n.text:"OK",Ze(o,n.style,"button"),o.addEventListener("click",()=>{let i=n.action??"dismiss",r=i==="url"&&typeof n.url=="string"&&A(n.url)?n.url:i==="guide"&&typeof n.targetGuideId=="string"&&n.targetGuideId?n.targetGuideId:void 0,s={...typeof n.id=="string"&&n.id?{buttonId:n.id}:{},...typeof n.text=="string"&&n.text?{buttonText:n.text}:{}};t.onCtaClick(i,r,Object.keys(s).length?s:void 0);}),o}var nn={left:"flex-start",center:"center",right:"flex-end"};function _e(n,e,t){return Math.min(t,Math.max(e,n))}function Ze(n,e,t){if(!e||typeof e!="object")return;let o=e;if(t==="image"&&o.bleed===true){n.classList.add("veo-guide-image--bleed");return}let i=typeof o.align=="string"?o.align:null;i&&(i==="left"||i==="center"||i==="right")&&(t==="text"?n.style.textAlign=i:t==="image"&&(n.style.alignSelf=nn[i])),t!=="image"&&typeof o.color=="string"&&(n.style.color=o.color),t==="text"&&typeof o.fontSize=="number"&&Number.isFinite(o.fontSize)&&(n.style.fontSize=`${_e(o.fontSize,8,72)}px`),t==="image"&&typeof o.width=="number"&&Number.isFinite(o.width)&&(n.style.width=`${_e(o.width,10,100)}%`),t==="image"&&typeof o.radius=="number"&&Number.isFinite(o.radius)&&(n.style.borderRadius=`${_e(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&(n.style.marginTop=`${_e(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&(n.style.marginBottom=`${_e(o.marginBottom,0,64)}px`);}function Oe(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 A(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 vt.includes(t.protocol)}catch{return false}}function Qn(n){let e=n.style?.ctaUrl;if(typeof e=="string")return A(e)?e:void 0}var Jn={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},pt={left:"flex-start",center:"center",right:"flex-end"},Zn={left:"flex-start",center:"center",right:"flex-end"},eo={title:"text",text:"text",image:"self"},on={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)"},rn={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]},B=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function R(n,e,t){return Math.min(t,Math.max(e,n))}function sn(n,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&B.test(t.accentColor.trim())&&n.style.setProperty("--veo-primary",t.accentColor.trim()),typeof t.fontFamily=="string"&&t.fontFamily.length<=200&&!/[<>{}]/.test(t.fontFamily)&&n.style.setProperty("--veo-font",t.fontFamily.trim()),t.theme==="dark")for(let[r,s]of Object.entries(Jn))n.style.setProperty(r,s);typeof t.background=="string"&&B.test(t.background.trim())&&n.style.setProperty("--veo-bg",t.background.trim()),typeof t.textColor=="string"&&B.test(t.textColor.trim())&&n.style.setProperty("--veo-text",t.textColor.trim()),typeof t.textSecondaryColor=="string"&&B.test(t.textSecondaryColor.trim())&&n.style.setProperty("--veo-text-secondary",t.textSecondaryColor.trim()),typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-radius",`${R(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&n.style.setProperty("--veo-width",`${R(t.width,220,720)}px`),typeof t.height=="number"&&Number.isFinite(t.height)&&n.style.setProperty("--veo-min-h",`${R(t.height,120,900)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&n.style.setProperty("--veo-actions-justify",pt[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&n.style.setProperty("--veo-pad",`${R(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&n.style.setProperty("--veo-margin",`${R(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&n.style.setProperty("--veo-border-width",`${R(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&B.test(t.borderColor.trim())&&n.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&on[t.shadow]&&n.style.setProperty("--veo-shadow",on[t.shadow]);let o,i;if(typeof t.posX=="number"&&typeof t.posY=="number"?(o=R(t.posX,0,1),i=R(t.posY,0,1)):typeof t.overlayPosition=="string"&&rn[t.overlayPosition]&&([o,i]=rn[t.overlayPosition]),o!==void 0&&i!==void 0&&(n.style.setProperty("--veo-pos-x",`${o*100}%`),n.style.setProperty("--veo-pos-y",`${i*100}%`)),t.elements&&typeof t.elements=="object"){let r=t.elements;ut(n,"title",r.title),ut(n,"text",r.text),ut(n,"image",r.image),to(n,r.cta);}}function to(n,e){if(!e||typeof e!="object")return;let t=e;typeof t.align=="string"&&pt[t.align]&&n.style.setProperty("--veo-actions-justify",pt[t.align]),typeof t.background=="string"&&B.test(t.background.trim())&&n.style.setProperty("--veo-cta-bg",t.background.trim()),typeof t.color=="string"&&B.test(t.color.trim())&&n.style.setProperty("--veo-cta-color",t.color.trim()),typeof t.fontSize=="number"&&Number.isFinite(t.fontSize)&&n.style.setProperty("--veo-cta-size",`${R(t.fontSize,10,24)}px`),typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-cta-radius",`${R(t.radius,0,48)}px`);}function ut(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 r=(eo[e]??"text")==="self"?Zn[o.align]:o.align;n.style.setProperty(`--veo-${e}-align`,r);}typeof o.color=="string"&&B.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`,`${R(o.fontSize,8,72)}px`),typeof o.width=="number"&&Number.isFinite(o.width)&&n.style.setProperty(`--veo-${e}-width`,`${R(o.width,10,100)}%`),typeof o.radius=="number"&&Number.isFinite(o.radius)&&n.style.setProperty(`--veo-${e}-radius`,`${R(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&n.style.setProperty(`--veo-${e}-mt`,`${R(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&n.style.setProperty(`--veo-${e}-mb`,`${R(o.marginBottom,0,64)}px`);}function F(n){let e=n?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function O(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 H(n,e,t){let o=window.setInterval(()=>{if(n.isConnected)return;let i=document.querySelector(e);i&&O(i,n,t);},1e3);return ()=>window.clearInterval(o)}function E(n,e=5e3){return new Promise(t=>{let o=()=>{try{return document.querySelector(n)}catch{return null}},i=o();if(i){t(i);return}let r=false,s=d=>{r||(r=true,a.disconnect(),clearTimeout(l),t(d));},a=new MutationObserver(()=>{let d=o();d&&s(d);});a.observe(document.body,{childList:true,subtree:true});let l=setTimeout(()=>s(null),e);})}var an=`
2
2
  :host {
3
3
  --veo-primary: #FF5B35;
4
4
  --veo-text: #1f2937;
@@ -393,7 +393,7 @@ var veoGuides=(function(exports){'use strict';function gt(){return typeof window
393
393
  from { transform: translateY(-10px); opacity: 0; }
394
394
  to { transform: translateY(0); opacity: 1; }
395
395
  }
396
- `;var b=class{constructor(){this.host=null;this.shadow=null;this.cleanups=[];this.liveContainer=null;this.liveContent=null;this.liveBuild=null;this.liveKey="";}liveKeyOf(e){return ""}onLiveUpdate(e){}updateStep(e){if(!this.host||!this.liveContainer||!this.liveContent||!this.liveBuild||this.liveKeyOf(e)!==this.liveKey)return false;let t=this.liveBuild(e);return this.liveContainer.replaceChild(t,this.liveContent),this.liveContent=t,this.applyDesign(e.style),this.onLiveUpdate(e),true}createHost(){let e=document.createElement("div");e.setAttribute(yt,"");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=an,t.appendChild(o);let i=document.createElement("div");return t.appendChild(i),document.body.appendChild(e),this.host=e,this.shadow=t,{host:e,shadow:t,root:i}}applyDesign(e){this.host&&sn(this.host,e);}registerCleanup(e){this.cleanups.push(e);}hostElement(){return this.host}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 no={top:"bottom",bottom:"top",left:"right",right:"left"};function me(n,e,t){let o=no[e.split("-")[0]??"bottom"]??"top";for(let i of ["top","bottom","left","right"])n.style.setProperty(i,"");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 oo=150,ge=class extends b{constructor(){super(...arguments);this.tooltip=null;this.arrowEl=null;this.badgeBtn=null;this.open=false;this.shownEmitted=false;this.trigger="hover";this.side="top";this.closeTimer=null;this.stopFloat=null;}async render(t){let o=t.guide.guideSteps[0];if(!o)return;let i=o.selector??t.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await E(i);if(!r)return;let{host:s,root:a}=this.createHost(),l=a.ownerDocument??document;this.applyDesign(o.style);let d=o.style?.width;typeof d=="number"&&Number.isFinite(d)&&s.style.setProperty("--veo-badge-tip-width",`${Math.min(720,Math.max(220,d))}px`),this.trigger=o.style?.badgeTrigger==="click"?"click":"hover";let c=o.style?.tooltipPlacement;this.side=c==="bottom"||c==="left"||c==="right"?c:"top";let u=F(o.style);s.style.display="inline-flex",s.style.verticalAlign="middle";let f=dn(ln(o),l);a.appendChild(f),this.badgeBtn=f,O(r,s,u),this.registerCleanup(H(s,i,u));let p=l.createElement("div");p.className="veo-tooltip veo-badge-tooltip",p.style.display="none";let h=(y,C)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:y,...C?{metadata:C}:{}});},m=y=>T(y,l,{onCtaClick:(C,k,$)=>{h("cta_clicked",$),C==="url"&&k&&window.open(k,"_blank","noopener,noreferrer"),this.closeTooltip(),C==="guide"&&k&&t.onOpenGuide?.(k);},onDismiss:()=>this.closeTooltip()}),g=m(o);p.appendChild(g);let v=l.createElement("div");v.className="veo-tooltip-arrow",p.appendChild(v),a.appendChild(p),this.tooltip=p,this.arrowEl=v,this.liveContainer=p,this.liveContent=g,this.liveKey=this.liveKeyOf(o),this.liveBuild=m;let w=()=>{this.cancelClose(),this.open||(this.openTooltip(f),this.shownEmitted||(this.shownEmitted=true,h("shown")));};if(this.trigger==="hover"){let y=()=>{this.cancelClose(),this.closeTimer=window.setTimeout(()=>this.closeTooltip(),oo);};f.addEventListener("mouseenter",w),f.addEventListener("focus",w),f.addEventListener("mouseleave",y),f.addEventListener("blur",y),p.addEventListener("mouseenter",()=>this.cancelClose()),p.addEventListener("mouseleave",y);}else {f.addEventListener("click",()=>{this.open?this.closeTooltip():w();});let y=C=>{this.open&&(C.composedPath().includes(s)||this.closeTooltip());};document.addEventListener("click",y,true),this.registerCleanup(()=>document.removeEventListener("click",y,true));}let x=y=>{y.key==="Escape"&&this.open&&this.closeTooltip();};document.addEventListener("keydown",x),this.registerCleanup(()=>document.removeEventListener("keydown",x)),t.isPreview&&w();}liveKeyOf(t){let o=t.selector??"",i=F(t.style),r=t.style?.badgeTrigger==="click"?"click":"hover";return `${o}|${i}|${r}`}onLiveUpdate(t){if(this.badgeBtn){let i=this.badgeBtn.ownerDocument,r=dn(ln(t),i);this.badgeBtn.className=r.className,this.badgeBtn.setAttribute("style",r.getAttribute("style")??""),this.badgeBtn.replaceChildren(...Array.from(r.childNodes));}let o=t.style?.tooltipPlacement;this.side=o==="bottom"||o==="left"||o==="right"?o:"top",this.open&&this.badgeBtn&&this.position(this.badgeBtn);}destroy(){this.cancelClose(),this.stopFloat?.(),this.stopFloat=null,this.tooltip=null,this.arrowEl=null,this.badgeBtn=null,this.open=false,super.destroy();}openTooltip(t){if(!this.tooltip)return;this.tooltip.style.display="block",this.open=true,this.position(t);let o=()=>{this.position(t);};window.addEventListener("scroll",o,true),window.addEventListener("resize",o),this.stopFloat=()=>{window.removeEventListener("scroll",o,true),window.removeEventListener("resize",o);};}closeTooltip(){this.cancelClose(),!(!this.tooltip||!this.open)&&(this.tooltip.style.display="none",this.open=false,this.stopFloat?.(),this.stopFloat=null);}cancelClose(){this.closeTimer!==null&&(window.clearTimeout(this.closeTimer),this.closeTimer=null);}async position(t){let o=this.tooltip,i=this.arrowEl;if(!o||!i)return;let{x:r,y:s,placement:a,middlewareData:l}=await J(t,o,{strategy:"fixed",placement:this.side,middleware:[Y(8),Q(),X({padding:8}),he({element:i})]});o.style.left=`${r}px`,o.style.top=`${s}px`,me(i,a,l.arrow);}};function ln(n){let e=n.style?.badge;if(!e||typeof e!="object")return {kind:"icon"};let t=e;return {kind:t.kind==="dot"||t.kind==="pill"||t.kind==="text"||t.kind==="image"||t.kind==="icon"?t.kind:"icon",icon:typeof t.icon=="string"?t.icon:null,text:typeof t.text=="string"?t.text:null,imageUrl:typeof t.imageUrl=="string"?t.imageUrl:null,color:typeof t.color=="string"&&B.test(t.color.trim())?t.color.trim():null,size:typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}}function De(n,e,t){return Math.min(t,Math.max(e,n))}function dn(n,e){let t=e.createElement("button");t.type="button",t.className=`veo-badge veo-badge--${n.kind}`,t.setAttribute("aria-label","M\xE1s informaci\xF3n");let o=De(n.size??18,8,48);switch(n.kind){case "dot":t.style.width=`${o}px`,t.style.height=`${o}px`,n.color&&(t.style.background=n.color);break;case "pill":{t.textContent=n.text?.slice(0,24)||"Nuevo",t.style.fontSize=`${De(Math.round(o*.62),8,24)}px`,n.color&&(t.style.background=n.color);break}case "text":{t.textContent=n.text?.slice(0,32)||"Nuevo",t.style.fontSize=`${De(Math.round(o*.7),9,28)}px`,n.color&&(t.style.color=n.color);break}case "image":{if(n.imageUrl&&A(n.imageUrl)){let i=e.createElement("img");i.src=n.imageUrl,i.alt="",i.style.width=`${o}px`,i.style.height=`${o}px`,t.appendChild(i);}else t.className="veo-badge veo-badge--icon",t.textContent="?",t.style.width=`${o}px`,t.style.height=`${o}px`,t.style.fontSize=`${De(Math.round(o*.62),8,32)}px`;break}default:{t.textContent=(n.icon||"\u2139\uFE0F").slice(0,4),t.style.width=`${o}px`,t.style.height=`${o}px`,t.style.fontSize=`${De(Math.round(o*.62),8,32)}px`,n.color&&(t.style.color=n.color);break}}return t}function ve(n,e,t,o,i){let r=o.createElement("div");r.className="veo-guide-content";let s=o.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${e+1} de ${t}`,r.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);}r.appendChild(a);for(let h of Zt(n,o))r.appendChild(h);let l=o.createElement("div");l.className="veo-walkthrough-actions";let d=o.createElement("button");d.type="button",d.className="veo-walkthrough-skip",d.textContent="Omitir",d.addEventListener("click",()=>i.onSkip()),l.appendChild(d);let c=o.createElement("div");if(c.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",()=>i.onBack()),c.appendChild(h);}let u=e===t-1,f=o.createElement("button");f.type="button",f.className="veo-guide-cta";let p=u?"Finalizar":"Siguiente";return f.textContent=typeof n.ctaText=="string"&&n.ctaText?n.ctaText:p,f.addEventListener("click",()=>{u?i.onComplete():i.onNext();}),c.appendChild(f),l.appendChild(c),r.appendChild(l),r.appendChild(Oe(o,()=>i.onSkip())),r}var Z=class extends b{async render(e){let t=e.nav?.stepIndex??0,o=e.guide.guideSteps[t];if(!o)return;let i=o.style?.position==="bottom"?"bottom":"top",r=e.nav?null:o.selector?.trim()??null,s=null;if(r&&(s=await E(r),!s))return;let{host:a,root:l}=this.createHost();this.applyDesign(o.style);let d=l.ownerDocument??document,c=d.createElement("div");c.className=cn(i,!!s);let u=(p,h,m)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:p,...m?{metadata:m}:{}}),h&&window.open(h,"_blank","noopener,noreferrer"),e.onClose();},f=e.nav?ve(o,e.nav.stepIndex,e.nav.totalSteps,d,e.nav.callbacks):T(o,d,{onCtaClick:(p,h,m)=>{u("cta_clicked",p==="url"?h:void 0,m),p==="guide"&&h&&e.onOpenGuide?.(h);},onDismiss:()=>u("dismissed")});if(c.appendChild(f),l.appendChild(c),r&&s){a.style.display="block";let p=i==="top"?"prepend":"append";O(s,a,p),this.registerCleanup(H(a,r,p));}e.nav||(this.liveContainer=c,this.liveContent=f,this.liveBuild=p=>T(p,d,{onCtaClick:(h,m,g)=>{u("cta_clicked",h==="url"?m:void 0,g),h==="guide"&&m&&e.onOpenGuide?.(m);},onDismiss:()=>u("dismissed")}),this.liveKey=this.liveKeyOf(o),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"}));}liveKeyOf(e){let t=e.selector?.trim()??"";if(!t)return "";let o=e.style?.position==="bottom"?"bottom":"top";return `${t}|${o}`}onLiveUpdate(e){if(this.liveContainer){let t=e.style?.position==="bottom"?"bottom":"top",o=!!e.selector?.trim();this.liveContainer.className=cn(t,o);}}};function cn(n,e){return e?"veo-banner veo-banner-embedded":`veo-banner veo-banner-${n}`}function un(){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 i=0;i<t.length;i++)t[i]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let o=Array.from(t,i=>i.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 et(n,e,t,o){let i=n.createElement("iframe");i.className="veo-custom-frame",i.setAttribute("sandbox","allow-scripts"),i.setAttribute("title",t.guide.guideName||"OnUser"),i.style.width=o.width;let r=o.fixedHeight!==void 0&&o.fixedHeight!==null;r&&(i.style.height=ht(o.fixedHeight));let s=un(),a=e.style?.tailwind===true;i.srcdoc=lo(e.html??"",e.css??"",e.js??"",s,{hostCss:ro(),htmlAttrs:so(),tailwind:a});let l=()=>t.onClose(),d=c=>{if(c.source!==i.contentWindow)return;let u=c.data;if(!(!u||typeof u!="object"||u.__veo!==s))switch(u.type){case "dismiss":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),l();break;case "cta":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"cta_clicked"}),typeof u.url=="string"&&A(u.url)&&window.open(u.url,"_blank","noopener,noreferrer"),u.close!==false&&l();break;case "navigate":typeof u.url=="string"&&A(u.url)&&window.location.assign(u.url);break;case "track":typeof u.name=="string"&&t.onTrack&&t.onTrack(u.name,ao(u.props)?u.props:void 0);break;case "resize":!r&&typeof u.height=="number"&&u.height>0&&(i.style.height=`${Math.ceil(u.height)}px`);break}};return window.addEventListener("message",d),{iframe:i,cleanup:()=>window.removeEventListener("message",d)}}function ht(n){return typeof n=="number"?`${n}px`:n}var io=800*1024;function ro(){if(typeof document>"u")return "";let n="";try{for(let e of Array.from(document.styleSheets)){let t=null;try{t=e.cssRules;}catch{continue}if(t){for(let o of Array.from(t))if(n+=`${o.cssText}
396
+ `;var b=class{constructor(){this.host=null;this.shadow=null;this.cleanups=[];this.liveContainer=null;this.liveContent=null;this.liveBuild=null;this.liveKey="";}liveKeyOf(e){return ""}onLiveUpdate(e){}updateStep(e){if(!this.host||!this.liveContainer||!this.liveContent||!this.liveBuild||this.liveKeyOf(e)!==this.liveKey)return false;let t=this.liveBuild(e);return this.liveContainer.replaceChild(t,this.liveContent),this.liveContent=t,this.applyDesign(e.style),this.onLiveUpdate(e),true}createHost(){let e=document.createElement("div");e.setAttribute(yt,"");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=an,t.appendChild(o);let i=document.createElement("div");return t.appendChild(i),document.body.appendChild(e),this.host=e,this.shadow=t,{host:e,shadow:t,root:i}}applyDesign(e){this.host&&sn(this.host,e);}registerCleanup(e){this.cleanups.push(e);}hostElement(){return this.host}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 no={top:"bottom",bottom:"top",left:"right",right:"left"};function me(n,e,t){let o=no[e.split("-")[0]??"bottom"]??"top";for(let i of ["top","bottom","left","right"])n.style.setProperty(i,"");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 oo=150,ge=class extends b{constructor(){super(...arguments);this.tooltip=null;this.arrowEl=null;this.badgeBtn=null;this.open=false;this.shownEmitted=false;this.trigger="hover";this.side="top";this.closeTimer=null;this.stopFloat=null;}async render(t){let o=t.guide.guideSteps[0];if(!o)return;let i=o.selector??t.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await E(i);if(!r)return;let{host:s,root:a}=this.createHost(),l=a.ownerDocument??document;this.applyDesign(o.style);let d=o.style?.width;typeof d=="number"&&Number.isFinite(d)&&s.style.setProperty("--veo-badge-tip-width",`${Math.min(720,Math.max(220,d))}px`),this.trigger=o.style?.badgeTrigger==="click"?"click":"hover";let c=o.style?.tooltipPlacement;this.side=c==="bottom"||c==="left"||c==="right"?c:"top";let u=F(o.style);s.style.display="inline-flex",s.style.verticalAlign="middle";let f=dn(ln(o),l);a.appendChild(f),this.badgeBtn=f,O(r,s,u),this.registerCleanup(H(s,i,u));let p=l.createElement("div");p.className="veo-tooltip veo-badge-tooltip",p.style.display="none";let h=(y,C)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:y,...C?{metadata:C}:{}});},m=y=>T(y,l,{onCtaClick:(C,k,$)=>{h("cta_clicked",$),C==="url"&&k&&window.open(k,"_blank","noopener,noreferrer"),this.closeTooltip(),C==="guide"&&k&&t.onOpenGuide?.(k);},onDismiss:()=>this.closeTooltip()}),g=m(o);p.appendChild(g);let v=l.createElement("div");v.className="veo-tooltip-arrow",p.appendChild(v),a.appendChild(p),this.tooltip=p,this.arrowEl=v,this.liveContainer=p,this.liveContent=g,this.liveKey=this.liveKeyOf(o),this.liveBuild=m;let w=()=>{this.cancelClose(),this.open||(this.openTooltip(f),this.shownEmitted||(this.shownEmitted=true,h("shown")));};if(this.trigger==="hover"){let y=()=>{this.cancelClose(),this.closeTimer=window.setTimeout(()=>this.closeTooltip(),oo);};f.addEventListener("mouseenter",w),f.addEventListener("focus",w),f.addEventListener("mouseleave",y),f.addEventListener("blur",y),p.addEventListener("mouseenter",()=>this.cancelClose()),p.addEventListener("mouseleave",y);}else {f.addEventListener("click",()=>{this.open?this.closeTooltip():w();});let y=C=>{this.open&&(C.composedPath().includes(s)||this.closeTooltip());};document.addEventListener("click",y,true),this.registerCleanup(()=>document.removeEventListener("click",y,true));}let x=y=>{y.key==="Escape"&&this.open&&this.closeTooltip();};document.addEventListener("keydown",x),this.registerCleanup(()=>document.removeEventListener("keydown",x)),t.isPreview&&w();}liveKeyOf(t){let o=t.selector??"",i=F(t.style),r=t.style?.badgeTrigger==="click"?"click":"hover";return `${o}|${i}|${r}`}onLiveUpdate(t){if(this.badgeBtn){let i=this.badgeBtn.ownerDocument,r=dn(ln(t),i);this.badgeBtn.className=r.className,this.badgeBtn.setAttribute("style",r.getAttribute("style")??""),this.badgeBtn.replaceChildren(...Array.from(r.childNodes));}let o=t.style?.tooltipPlacement;this.side=o==="bottom"||o==="left"||o==="right"?o:"top",this.open&&this.badgeBtn&&this.position(this.badgeBtn);}destroy(){this.cancelClose(),this.stopFloat?.(),this.stopFloat=null,this.tooltip=null,this.arrowEl=null,this.badgeBtn=null,this.open=false,super.destroy();}openTooltip(t){if(!this.tooltip)return;this.tooltip.style.display="block",this.open=true,this.position(t);let o=()=>{this.position(t);};window.addEventListener("scroll",o,true),window.addEventListener("resize",o),this.stopFloat=()=>{window.removeEventListener("scroll",o,true),window.removeEventListener("resize",o);};}closeTooltip(){this.cancelClose(),!(!this.tooltip||!this.open)&&(this.tooltip.style.display="none",this.open=false,this.stopFloat?.(),this.stopFloat=null);}cancelClose(){this.closeTimer!==null&&(window.clearTimeout(this.closeTimer),this.closeTimer=null);}async position(t){let o=this.tooltip,i=this.arrowEl;if(!o||!i)return;let{x:r,y:s,placement:a,middlewareData:l}=await J(t,o,{strategy:"fixed",placement:this.side,middleware:[Y(8),Q(),X({padding:8}),he({element:i})]});o.style.left=`${r}px`,o.style.top=`${s}px`,me(i,a,l.arrow);}};function ln(n){let e=n.style?.badge;if(!e||typeof e!="object")return {kind:"icon"};let t=e;return {kind:t.kind==="dot"||t.kind==="pill"||t.kind==="text"||t.kind==="image"||t.kind==="icon"?t.kind:"icon",icon:typeof t.icon=="string"?t.icon:null,text:typeof t.text=="string"?t.text:null,imageUrl:typeof t.imageUrl=="string"?t.imageUrl:null,color:typeof t.color=="string"&&B.test(t.color.trim())?t.color.trim():null,size:typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}}function De(n,e,t){return Math.min(t,Math.max(e,n))}function dn(n,e){let t=e.createElement("button");t.type="button",t.className=`veo-badge veo-badge--${n.kind}`,t.setAttribute("aria-label","M\xE1s informaci\xF3n");let o=De(n.size??18,8,48);switch(n.kind){case "dot":t.style.width=`${o}px`,t.style.height=`${o}px`,n.color&&(t.style.background=n.color);break;case "pill":{t.textContent=n.text?.slice(0,24)||"Nuevo",t.style.fontSize=`${De(Math.round(o*.62),8,24)}px`,n.color&&(t.style.background=n.color);break}case "text":{t.textContent=n.text?.slice(0,32)||"Nuevo",t.style.fontSize=`${De(Math.round(o*.7),9,28)}px`,n.color&&(t.style.color=n.color);break}case "image":{if(n.imageUrl&&A(n.imageUrl)){let i=e.createElement("img");i.src=n.imageUrl,i.alt="",i.style.width=`${o}px`,i.style.height=`${o}px`,t.appendChild(i);}else t.className="veo-badge veo-badge--icon",t.textContent="?",t.style.width=`${o}px`,t.style.height=`${o}px`,t.style.fontSize=`${De(Math.round(o*.62),8,32)}px`;break}default:{t.textContent=(n.icon||"\u2139\uFE0F").slice(0,4),t.style.width=`${o}px`,t.style.height=`${o}px`,t.style.fontSize=`${De(Math.round(o*.62),8,32)}px`,n.color&&(t.style.color=n.color);break}}return t}function ve(n,e,t,o,i){let r=o.createElement("div");r.className="veo-guide-content";let s=o.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${e+1} de ${t}`,r.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);}r.appendChild(a);for(let h of Zt(n,o))r.appendChild(h);let l=o.createElement("div");l.className="veo-walkthrough-actions";let d=o.createElement("button");d.type="button",d.className="veo-walkthrough-skip",d.textContent="Omitir",d.addEventListener("click",()=>i.onSkip()),l.appendChild(d);let c=o.createElement("div");if(c.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",()=>i.onBack()),c.appendChild(h);}let u=e===t-1,f=o.createElement("button");f.type="button",f.className="veo-guide-cta";let p=u?"Finalizar":"Siguiente";return f.textContent=typeof n.ctaText=="string"&&n.ctaText?n.ctaText:p,f.addEventListener("click",()=>{u?i.onComplete():i.onNext();}),c.appendChild(f),l.appendChild(c),r.appendChild(l),r.appendChild(Oe(o,()=>i.onSkip())),r}var Z=class extends b{async render(e){let t=e.nav?.stepIndex??0,o=e.guide.guideSteps[t];if(!o)return;let i=o.style?.position==="bottom"?"bottom":"top",r=o.selector?.trim()||null,s=null;if(r&&(s=await E(r),!s))return;let{host:a,root:l}=this.createHost();this.applyDesign(o.style);let d=l.ownerDocument??document,c=d.createElement("div");c.className=cn(i,!!s);let u=(p,h,m)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:p,...m?{metadata:m}:{}}),h&&window.open(h,"_blank","noopener,noreferrer"),e.onClose();},f=e.nav?ve(o,e.nav.stepIndex,e.nav.totalSteps,d,e.nav.callbacks):T(o,d,{onCtaClick:(p,h,m)=>{u("cta_clicked",p==="url"?h:void 0,m),p==="guide"&&h&&e.onOpenGuide?.(h);},onDismiss:()=>u("dismissed")});if(c.appendChild(f),l.appendChild(c),r&&s){a.style.display="block";let p=i==="top"?"prepend":"append";O(s,a,p),this.registerCleanup(H(a,r,p));}e.nav||(this.liveContainer=c,this.liveContent=f,this.liveBuild=p=>T(p,d,{onCtaClick:(h,m,g)=>{u("cta_clicked",h==="url"?m:void 0,g),h==="guide"&&m&&e.onOpenGuide?.(m);},onDismiss:()=>u("dismissed")}),this.liveKey=this.liveKeyOf(o),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"}));}liveKeyOf(e){let t=e.selector?.trim()??"";if(!t)return "";let o=e.style?.position==="bottom"?"bottom":"top";return `${t}|${o}`}onLiveUpdate(e){if(this.liveContainer){let t=e.style?.position==="bottom"?"bottom":"top",o=!!e.selector?.trim();this.liveContainer.className=cn(t,o);}}};function cn(n,e){return e?"veo-banner veo-banner-embedded":`veo-banner veo-banner-${n}`}function un(){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 i=0;i<t.length;i++)t[i]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let o=Array.from(t,i=>i.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 et(n,e,t,o){let i=n.createElement("iframe");i.className="veo-custom-frame",i.setAttribute("sandbox","allow-scripts"),i.setAttribute("title",t.guide.guideName||"OnUser"),i.style.width=o.width;let r=o.fixedHeight!==void 0&&o.fixedHeight!==null;r&&(i.style.height=ht(o.fixedHeight));let s=un(),a=e.style?.tailwind===true;i.srcdoc=lo(e.html??"",e.css??"",e.js??"",s,{hostCss:ro(),htmlAttrs:so(),tailwind:a});let l=()=>t.onClose(),d=c=>{if(c.source!==i.contentWindow)return;let u=c.data;if(!(!u||typeof u!="object"||u.__veo!==s))switch(u.type){case "dismiss":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),l();break;case "cta":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"cta_clicked"}),typeof u.url=="string"&&A(u.url)&&window.open(u.url,"_blank","noopener,noreferrer"),u.close!==false&&l();break;case "navigate":typeof u.url=="string"&&A(u.url)&&window.location.assign(u.url);break;case "track":typeof u.name=="string"&&t.onTrack&&t.onTrack(u.name,ao(u.props)?u.props:void 0);break;case "resize":!r&&typeof u.height=="number"&&u.height>0&&(i.style.height=`${Math.ceil(u.height)}px`);break}};return window.addEventListener("message",d),{iframe:i,cleanup:()=>window.removeEventListener("message",d)}}function ht(n){return typeof n=="number"?`${n}px`:n}var io=800*1024;function ro(){if(typeof document>"u")return "";let n="";try{for(let e of Array.from(document.styleSheets)){let t=null;try{t=e.cssRules;}catch{continue}if(t){for(let o of Array.from(t))if(n+=`${o.cssText}
397
397
  `,n.length>io)return n}}}catch{return n}return n}function so(){if(typeof document>"u")return "";try{let n=document.documentElement,e=[];for(let t of ["class","style","data-theme","data-mode","data-color-mode"]){let o=n.getAttribute(t);o&&o.length<=1e3&&!/["<>]/.test(o)&&e.push(`${t}="${o}"`);}return e.join(" ")}catch{return ""}}function ao(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function lo(n,e,t,o,i){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(){var r=document.getElementById('__veo_root');var h=r?r.getBoundingClientRect().height:document.documentElement.scrollHeight;P({type:'resize',height:Math.ceil(h)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){var _r=document.getElementById('__veo_root');new ResizeObserver(H).observe(_r||document.documentElement);}}catch(e){}})();`,s=i.hostCss?`<style>${ft(i.hostCss,"style")}</style>`:"",a=i.tailwind?'<script src="https://cdn.tailwindcss.com"></script>':"";return `<!DOCTYPE html><html ${i.htmlAttrs}><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;}body{font-family:system-ui,-apple-system,sans-serif;}</style>`+s+"<style>html,body{margin:0!important;padding:0!important;background:transparent!important;height:auto!important;min-height:0!important;max-height:none!important;width:auto!important;min-width:0!important;overflow:visible!important;color-scheme:normal!important;}</style>"+a+`<style>${ft(e,"style")}</style></head><body style="margin:0!important;background:transparent!important;min-height:0!important;height:auto!important;"><div id="__veo_root">${n}</div><script>${r}</script>`+(t?`<script>${ft(t,"script")}</script>`:"")+"</body></html>"}function ft(n,e){let t=e==="script"?/<\/script/gi:/<\/style/gi;return n.replace(t,`<\\/${e}`)}var co={mode:"floating",position:"bottom-right"},pn=16,uo=360,ye=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??co,i=null;if(o.mode==="anchored"){let c=o.selector??t.selector??e.guide.activationRules.selector;if(typeof c!="string"||c.length===0||(i=await E(c),!i))return}let{root:r}=this.createHost(),s=r.ownerDocument??document,a=s.createElement("div");a.className=o.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:l,cleanup:d}=et(s,t,e,{width:ht(o.width??uo),fixedHeight:o.height??null});this.registerCleanup(d),a.appendChild(l),r.appendChild(a),o.mode==="floating"?po(a,o):i&&this.registerCleanup(await this.setupAnchoredPosition(i,a,o)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(e,t,o){let i=o.side??"bottom",r=async()=>{let{x:a,y:l}=await J(e,t,{placement:i,strategy:"fixed",middleware:[Y(o.offsetY??8),Q(),X({padding:8})]});t.style.left=`${a}px`,t.style.top=`${l}px`;};await r();let s=()=>{r();};return window.addEventListener("scroll",s,true),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,true),window.removeEventListener("resize",s);}}};function po(n,e){let t=e.position??"bottom-right",o=`${e.offsetX??pn}px`,i=`${e.offsetY??pn}px`,r=n.style;if(t==="center"){r.top="50%",r.left="50%",r.transform="translate(-50%, -50%)";return}let[s,a]=t.split("-");s==="top"?r.top=i:r.bottom=i,a==="left"?r.left=o:a==="right"?r.right=o:(r.left="50%",r.transform="translateX(-50%)");}function tt(n,e,t){let o=e.guide.guideSteps[0];if(!o)return;let i=o.fields??[],r=()=>{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 f=t.createElement("h2");f.className="veo-guide-title",f.textContent=o.title,s.appendChild(f);}if(o.content){let f=t.createElement("p");f.className="veo-guide-text",f.textContent=o.content,s.appendChild(f);}let a=[],l=t.createElement("form");l.className="veo-form",l.noValidate=true;for(let f of i){let{wrapper:p,read:h}=ho(f,t);a.push({field:f,read:h}),l.appendChild(p);}let d=t.createElement("p");d.className="veo-form-error",d.style.display="none",l.appendChild(d);let c=t.createElement("div");c.className="veo-guide-actions";let u=t.createElement("button");u.type="submit",u.className="veo-guide-cta",u.textContent=o.ctaText||"Enviar",c.appendChild(u),l.appendChild(c),l.addEventListener("submit",f=>{f.preventDefault(),d.style.display="none";let p={};for(let{field:m,read:g}of a){let v=g();if(v==null||v===""){if(m.required){d.textContent=`Completa "${m.label}"`,d.style.display="block";return}continue}p[m.key]=v;}if(Object.keys(p).length===0){d.textContent="Responde al menos un campo",d.style.display="block";return}u.disabled=true,(e.onFormSubmit??(()=>Promise.resolve(true)))(p).then(m=>{if(!m){u.disabled=false,d.textContent="No se pudo enviar. Prueba de nuevo.",d.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;fo(n,t,g),window.setTimeout(()=>e.onClose(),g?2200:1400);});}),s.appendChild(l),s.appendChild(Oe(t,r)),n.appendChild(s);}function fo(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 i=e.createElement("p");i.className="veo-form-preview-note",i.textContent=t,n.appendChild(i);}}function ho(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 i=e.createElement("textarea");return i.className="veo-form-input",i.rows=3,n.placeholder&&(i.placeholder=n.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()}}case "number":{let i=e.createElement("input");return i.type="number",i.className="veo-form-input",n.placeholder&&(i.placeholder=n.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()===""?void 0:Number(i.value)}}case "select":{let i=e.createElement("select");i.className="veo-form-input";let r=e.createElement("option");r.value="",r.textContent=n.placeholder||"Elige una opci\xF3n\u2026",i.appendChild(r);for(let s of n.options??[]){let a=e.createElement("option");a.value=s,a.textContent=s,i.appendChild(a);}return t.appendChild(i),{wrapper:t,read:()=>i.value||void 0}}case "radio":{let i=e.createElement("div");i.className="veo-form-options";let r=`veo-${n.key}`,s=[];for(let a of n.options??[]){let l=e.createElement("label");l.className="veo-form-option";let d=e.createElement("input");d.type="radio",d.name=r,d.value=a,s.push(d);let c=e.createElement("span");c.textContent=a,l.appendChild(d),l.appendChild(c),i.appendChild(l);}return t.appendChild(i),{wrapper:t,read:()=>s.find(a=>a.checked)?.value}}case "multiselect":{let i=e.createElement("div");i.className="veo-form-options";let r=[];for(let s of n.options??[]){let a=e.createElement("label");a.className="veo-form-option";let l=e.createElement("input");l.type="checkbox",l.value=s,r.push(l);let d=e.createElement("span");d.textContent=s,a.appendChild(l),a.appendChild(d),i.appendChild(a);}return t.appendChild(i),{wrapper:t,read:()=>{let s=r.filter(a=>a.checked).map(a=>a.value);return s.length>0?s:void 0}}}case "checkbox":{let i=e.createElement("label");i.className="veo-form-option";let r=e.createElement("input");r.type="checkbox";let s=e.createElement("span");return s.textContent=n.placeholder||"S\xED",i.appendChild(r),i.appendChild(s),t.appendChild(i),{wrapper:t,read:()=>r.checked?true:n.required?"":false}}case "yesno":{let i=e.createElement("div");i.className="veo-form-options";let r=`veo-${n.key}`,[s,a]=n.options?.length===2?n.options:["S\xED","No"],l=[];for(let{label:d,value:c}of [{label:s,value:true},{label:a,value:false}]){let u=e.createElement("label");u.className="veo-form-option";let f=e.createElement("input");f.type="radio",f.name=r,l.push({input:f,value:c});let p=e.createElement("span");p.textContent=d,u.appendChild(f),u.appendChild(p),i.appendChild(u);}return t.appendChild(i),{wrapper:t,read:()=>l.find(d=>d.input.checked)?.value}}case "nps":return fn(t,e,0,10,"veo-nps-btn");case "rating":return fn(t,e,1,5,"veo-rating-btn","\u2605");default:{let i=e.createElement("input");return i.type="text",i.className="veo-form-input",n.placeholder&&(i.placeholder=n.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()}}}}function fn(n,e,t,o,i,r){let s=e.createElement("div");s.className="veo-form-scale";let a,l=[];for(let d=t;d<=o;d++){let c=e.createElement("button");c.type="button",c.className=i,c.textContent=r??String(d),c.setAttribute("aria-label",String(d)),c.addEventListener("click",()=>{a=d,l.forEach((u,f)=>{let p=r?f+t<=d:f+t===d;u.classList.toggle("veo-scale-active",p);});}),l.push(c),s.appendChild(c);}return n.appendChild(s),{wrapper:n,read:()=>a}}var we=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 i=o.ownerDocument??document,r=i.createElement("div");r.className="veo-modal-overlay";let s=i.createElement("div");s.className="veo-modal-card",tt(s,e,i),r.appendChild(s),o.appendChild(r);let a=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();};r.addEventListener("click",d=>{d.target===r&&a();});let l=d=>{d.key==="Escape"&&a();};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var be=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 i=await E(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=F(t.style);O(i,r,a),this.registerCleanup(H(r,o,a));let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-custom-inline";let{iframe:c,cleanup:u}=et(l,t,e,{width:"100%"});this.registerCleanup(u),d.appendChild(c),s.appendChild(d),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var xe=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 i=await E(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=F(t.style);O(i,r,a),this.registerCleanup(H(r,o,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-inline",tt(d,e,l),s.appendChild(d),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Ce=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 i=await E(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=F(t.style);O(i,r,a),this.registerCleanup(H(r,o,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-inline";let c=(f,p,h)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:f,...h?{metadata:h}:{}}),p&&window.open(p,"_blank","noopener,noreferrer"),e.onClose();},u=T(t,l,{onCtaClick:(f,p,h)=>{c("cta_clicked",f==="url"?p:void 0,h),f==="guide"&&p&&e.onOpenGuide?.(p);},onDismiss:()=>c("dismissed")});d.appendChild(u),s.appendChild(d),this.liveContainer=d,this.liveContent=u,this.liveKey=`${o}|${a}`,this.liveBuild=f=>T(f,l,{onCtaClick:(p,h,m)=>{c("cta_clicked",p==="url"?h:void 0,m),p==="guide"&&h&&e.onOpenGuide?.(h);},onDismiss:()=>c("dismissed")}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(e){return `${e.selector??""}|${F(e.style)}`}};function hn(n){return n.style?.backdrop===false?"veo-modal-overlay veo-modal-overlay--none":"veo-modal-overlay"}var ee=class extends b{constructor(){super(...arguments);this.overlay=null;}render(t){let o=t.nav?.stepIndex??0,i=t.guide.guideSteps[o];if(!i)return;let{root:r}=this.createHost();this.applyDesign(i.style);let s=r.ownerDocument??document,a=s.createElement("div");a.className=hn(i),this.overlay=a;let l=s.createElement("div");l.className="veo-modal-card";let d=(p,h,m)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:o,action:p,...m?{metadata:m}:{}}),h&&window.open(h,"_blank","noopener,noreferrer"),t.onClose();},c=()=>{t.nav?t.nav.callbacks.onSkip():d("dismissed");},u=t.nav?ve(i,t.nav.stepIndex,t.nav.totalSteps,s,t.nav.callbacks):T(i,s,{onCtaClick:(p,h,m)=>{d("cta_clicked",p==="url"?h:void 0,m),p==="guide"&&h&&t.onOpenGuide?.(h);},onDismiss:()=>d("dismissed")});l.appendChild(u),a.appendChild(l),r.appendChild(a),t.nav||(this.liveContainer=l,this.liveContent=u,this.liveBuild=p=>T(p,s,{onCtaClick:(h,m,g)=>{d("cta_clicked",h==="url"?m:void 0,g),h==="guide"&&m&&t.onOpenGuide?.(m);},onDismiss:()=>d("dismissed")})),a.addEventListener("click",p=>{p.target===a&&c();});let f=p=>{p.key==="Escape"&&c();};document.addEventListener("keydown",f),this.registerCleanup(()=>document.removeEventListener("keydown",f)),t.nav||t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}onLiveUpdate(t){this.overlay&&(this.overlay.className=hn(t));}destroy(){this.overlay=null,super.destroy();}};var ke=class extends b{constructor(){super(...arguments);this.side="bottom";this.reposition=null;}async render(t){let o=t.guide.guideSteps[0];if(!o)return;let i=o.selector??t.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await E(i);if(!r)return;let s=o.style?.tooltipPlacement;this.side=s==="top"||s==="left"||s==="right"?s:"bottom";let{root:a}=this.createHost();this.applyDesign(o.style);let l=a.ownerDocument??document,d=l.createElement("div");d.className="veo-tooltip";let c=(m,g,v)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:m,...v?{metadata:v}:{}}),g&&window.open(g,"_blank","noopener,noreferrer"),t.onClose();},u=T(o,l,{onCtaClick:(m,g,v)=>{c("cta_clicked",m==="url"?g:void 0,v),m==="guide"&&g&&t.onOpenGuide?.(g);},onDismiss:()=>c("dismissed")});d.appendChild(u);let f=l.createElement("div");f.className="veo-tooltip-arrow",d.appendChild(f),a.appendChild(d);let p=async()=>{let{x:m,y:g,placement:v,middlewareData:w}=await J(r,d,{placement:this.side,middleware:[Y(10),Q(),X({padding:8}),he({element:f})]});d.style.left=`${m}px`,d.style.top=`${g}px`,me(f,v,w.arrow);};await p();let h=()=>{p();};this.reposition=h,window.addEventListener("scroll",h,true),window.addEventListener("resize",h),this.registerCleanup(()=>{window.removeEventListener("scroll",h,true),window.removeEventListener("resize",h);}),this.liveContainer=d,this.liveContent=u,this.liveKey=i,this.liveBuild=m=>T(m,l,{onCtaClick:(g,v,w)=>{c("cta_clicked",g==="url"?v:void 0,w),g==="guide"&&v&&t.onOpenGuide?.(v);},onDismiss:()=>c("dismissed")}),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(t){return t.selector??""}onLiveUpdate(t){let o=t.style?.tooltipPlacement;this.side=o==="top"||o==="left"||o==="right"?o:"bottom",this.reposition?.();}};var Ee=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 i=await E(o,5e3);if(!i)return false;let r=t.style?.tooltipPlacement,s=r==="top"||r==="left"||r==="right"?r:"bottom",{root:a}=this.createHost();this.applyDesign(t.style);let l=a.ownerDocument??document,d=l.createElement("div");d.className="veo-walkthrough";let c=ve(t,e.currentStepIndex,e.guide.guideSteps.length,l,e.callbacks);d.appendChild(c);let u=l.createElement("div");u.className="veo-walkthrough-arrow",d.appendChild(u),a.appendChild(d);let f=async()=>{let{x:h,y:m,placement:g,middlewareData:v}=await J(i,d,{placement:s,middleware:[Y(10),Q(),X({padding:8}),he({element:u})]});d.style.left=`${h}px`,d.style.top=`${m}px`,me(u,g,v.arrow);};await f();let p=()=>{f();};return window.addEventListener("scroll",p,true),window.addEventListener("resize",p),this.registerCleanup(()=>{window.removeEventListener("scroll",p,true),window.removeEventListener("resize",p);}),true}};var nt=class{constructor(e){this.state=null;this.storageKey=`${bt}${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 go=3e4,vo={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},ot=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;this.resolveCache=null;this.inflightResolve=null;this.armedTriggers=new Map;if(this.debug=t.debug===true,this.apiUrl=t.apiUrl,this.apiKey=t.apiKey,this.resolver=t.resolver??new He(t.apiUrl,t.apiKey,this.debug),t.trackerQueue)this.trackerQueue=t.trackerQueue;else {let i=new $e(t.apiUrl,t.apiKey);this.trackerQueue=new We({client:i,flushIntervalMs:3e3,batchSize:5,maxRetries:3,onError:(r,s)=>{this.debug&&console.warn(`[veo] dropped guide interaction after retries: guideId=${s.guideId} action=${s.payload.action}`,r);}});}let o=kt(t.apiKey);this.frequencyCache=t.frequencyCache??new Fe(o),this.walkthroughState=t.walkthroughState??new nt(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 i;try{i=await this.resolveGuides(o,e);}catch(r){this.debug&&console.error("[veo] guides resolver threw:",r);return}this.debug&&console.log(`[veo] guides: ${i.length} eligible at ${e}`),this.disarmTriggers();for(let r of i){let s=r.activationRules.trigger;if((s==="on_click"||s==="on_hover")&&r.activationRules.selector){this.armInteractionTrigger(r,o,t,e);continue}await this.showGuide(r,o,t,e);}}async showGuide(e,t,o,i){if(this.frequencyCache.shouldFilter(e.guideId,e.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${e.guideId}`);return}if(this.activeByGuideId.has(e.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${e.guideId}`);return}if(e.guideType==="walkthrough"&&e.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${e.guideId} skipped (another active)`);return}await this.startWalkthrough(e,t,o,i);return}this.runSingleStepRender(e,o,i);}armInteractionTrigger(e,t,o,i){if(this.frequencyCache.shouldFilter(e.guideId,e.displayFrequency)||this.activeByGuideId.has(e.guideId)||this.armedTriggers.has(e.guideId))return;let r=e.activationRules.selector,s=e.activationRules.trigger==="on_hover"?"mouseover":"click",a=d=>{let c=d.target;if(c instanceof Element){try{if(!c.closest(r))return}catch{return}l(),this.showGuide(e,t,o,i);}},l=()=>{document.removeEventListener(s,a,true),this.armedTriggers.delete(e.guideId);};document.addEventListener(s,a,true),this.armedTriggers.set(e.guideId,l),this.debug&&console.log(`[veo] guides: armed ${s} trigger for ${e.guideId} on ${r}`);}disarmTriggers(){for(let e of this.armedTriggers.values())e();this.armedTriggers.clear();}async resolveGuides(e,t){let o=`${e}
398
398
  ${t}`,i=Date.now();if(this.resolveCache?.key===o&&i-this.resolveCache.at<go)return this.debug&&console.log("[veo] guides: resolve cache hit"),this.resolveCache.guides;if(this.inflightResolve?.key===o)return this.inflightResolve.promise;let r=this.resolver.resolve(e,t);this.inflightResolve={key:o,promise:r};try{let s=await r;return this.resolveCache={key:o,at:Date.now(),guides:s},s}finally{this.inflightResolve?.key===o&&(this.inflightResolve=null);}}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.disarmTriggers(),this.dispatched.clear(),this.resolveCache=null,this.inflightResolve=null,this.trackerQueue.destroy();}runSingleStepRender(e,t,o){let i=this.createSingleStepRenderer(e.guideType);if(!i)return;this.activeByGuideId.set(e.guideId,i);let r=e.activationRules.delayMs??0;window.setTimeout(()=>this.mountSingleStepRenderer(e,i,t,o),r);}mountSingleStepRenderer(e,t,o,i){this.activeRenderers.add(t),this.activeByGuideId.set(e.guideId,t);let r=()=>{t.destroy(),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);},s=c=>{this.handleInteraction(e,o,i,c);},a=(c,u)=>{this.client.track(c,u);},l=c=>this.submitFormResponse(e.guideId,c),d=c=>{this.openGuideById(c,o,i);};try{t.render({guide:e,onInteraction:s,onClose:r,onTrack:a,onFormSubmit:l,onOpenGuide:d});}catch(c){this.debug&&console.error("[veo] renderer.render threw:",c),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);}}async openGuideById(e,t,o){if(this.activeByGuideId.has(e))return;let i=await this.resolver.fetchById(e);if(!i){this.debug&&console.warn(`[veo] guides: chained guide ${e} not found`);return}let r=this.client.getEndUserId()??this.client.getAnonymousId();if(i.guideType==="walkthrough"&&i.guideSteps.length>1){this.walkthroughState.hasActive()||await this.startWalkthrough(i,r,t,o);return}this.runSingleStepRender(i,t,o);}async tryResumeWalkthrough(e,t,o){let i=this.walkthroughState.current();if(!i)return false;let r=await this.resolver.fetchById(i.guideId);if(!r||r.guideType!=="walkthrough")return this.debug&&console.log(`[veo] guides: walkthrough ${i.guideId} no longer available, cleaning up`),this.tearDownWalkthrough(),true;let s=Math.min(i.currentStepIndex,r.guideSteps.length-1);return await this.renderWalkthroughStep(r,s,e,t,o),true}async startWalkthrough(e,t,o,i){this.walkthroughState.start(e.guideId,e.guideSteps.length),await this.renderWalkthroughStep(e,0,t,o,i)&&(this.enqueueInteractionOnce(e.guideId,t,o,i,"shown",0),this.frequencyCache.record(e.guideId,"shown"));}async renderWalkthroughStep(e,t,o,i,r){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null),this.activeWalkthroughGuide=e;let s={onNext:()=>this.handleWalkthroughNext(o,i,r),onBack:()=>this.handleWalkthroughBack(o,i,r),onSkip:()=>this.handleWalkthroughSkip(o,i,r),onComplete:()=>this.handleWalkthroughComplete(o,i,r)},a=e.guideSteps[t],l=yo(a);if(l==="modal"||l==="banner"){let u=l==="modal"?new ee:new Z;try{u.render({guide:e,onInteraction:()=>{},onClose:()=>{},nav:{stepIndex:t,totalSteps:e.guideSteps.length,callbacks:s}});}catch(f){return this.debug&&console.error("[veo] sequence renderer threw:",f),this.tearDownWalkthrough(),false}return this.activeWalkthroughRenderer=u,true}let d=new Ee,c=false;try{c=await d.render({guide:e,currentStepIndex:t,callbacks:s});}catch(u){this.debug&&console.error("[veo] walkthrough renderer threw:",u);}return c?(this.activeWalkthroughRenderer=d,true):(this.debug&&console.warn(`[veo] walkthrough ${e.guideId} step ${t} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(e,t,o){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.advance();if(!r){this.handleWalkthroughComplete(e,t,o);return}this.enqueueInteraction(i.guideId,e,t,o,"step_advanced",r.currentStepIndex),this.renderWalkthroughStep(i,r.currentStepIndex,e,t,o);}handleWalkthroughBack(e,t,o){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.current();if(!r||r.currentStepIndex===0)return;let s=this.walkthroughState.back();s&&(this.enqueueInteraction(i.guideId,e,t,o,"step_back",s.currentStepIndex),this.renderWalkthroughStep(i,s.currentStepIndex,e,t,o));}handleWalkthroughSkip(e,t,o){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,o,"dismissed",r.currentStepIndex),this.frequencyCache.record(i.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(e,t,o){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,o,"completed",r.currentStepIndex),this.frequencyCache.record(i.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,i){let r=i.metadata?.buttonId?`:${i.metadata.buttonId}`:"",s=`${e.guideId}:${i.action}${r}`;if(this.dispatched.has(s)){this.debug&&console.log(`[veo] guides: dedup hit ${s}`);return}this.dispatched.add(s);let a=vo[i.action];a&&this.frequencyCache.record(e.guideId,a);let l=this.client.getEndUserId();if(!l){this.debug&&console.warn("[veo] guides: interaction without endUserId \u2014 skipping enqueue");return}this.trackerQueue.enqueue({guideId:e.guideId,payload:{endUserId:l,sessionId:t,action:i.action,stepIndex:i.stepIndex,pageUrl:o,pagePath:mn(o),...i.metadata?{metadata:i.metadata}:{}}});}enqueueInteraction(e,t,o,i,r,s){this.trackerQueue.enqueue({guideId:e,payload:{endUserId:t,sessionId:o,action:r,stepIndex:s,pageUrl:i,pagePath:mn(i)}});}enqueueInteractionOnce(e,t,o,i,r,s){let a=`${e}:${r}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(e,t,o,i,r,s));}createSingleStepRenderer(e){switch(e){case "modal":return new ee;case "banner":return new Z;case "tooltip":return new ke;case "custom":return new ye;case "inline":return new Ce;case "inline-custom":return new be;case "form":return new we;case "inline-form":return new xe;case "badge":return new ge;case "walkthrough":return null}}async submitFormResponse(e,t){let o=this.client.getEndUserId()??this.client.getAnonymousId();try{let i=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 !i.ok&&this.debug&&console.warn("[veo] form-response respondi\xF3",i.status),i.ok}catch(i){return this.debug&&console.warn("[veo] form-response fall\xF3:",i),false}}};function mn(n){try{return new URL(n).pathname}catch{return "/"}}function yo(n){let e=n?.style?.render;return typeof e=="string"?e:"walkthrough"}var wo="__veo_preview__",mt=class{constructor(){this.singleStep=null;this.walkthrough=null;this.walkthroughGuide=null;this.walkthroughIndex=0;this.input=null;}preview(e){let t=e.guideSteps[0];if(this.singleStep&&this.input&&e.guideType===this.input.guideType&&e.guideType!=="walkthrough"&&t&&this.singleStep.updateStep(t))return this.input=e,{close:()=>this.close(),ready:Promise.resolve({rendered:true}),host:()=>this.activeHost()};this.close(),this.input=e;let o=bo(e),i=typeof e.startStepIndex=="number"?e.startStepIndex:0,r=o.guideType==="walkthrough"?this.startWalkthrough(o,i):this.renderSingleStep(o);return {close:()=>this.close(),ready:r,host:()=>this.activeHost()}}activeHost(){return this.singleStep?this.singleStep.hostElement():this.walkthrough instanceof b?this.walkthrough.hostElement():null}close(){this.singleStep&&(de(this.singleStep),this.singleStep=null),this.walkthrough&&(de(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(e){let t=xo(e.guideType);if(!t)return {rendered:false};this.singleStep=t;let o=false;try{await t.render({guide:e,onInteraction:i=>{i.action==="shown"&&(o=!0);},onClose:()=>this.close(),onTrack:()=>{},onOpenGuide:()=>{},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?(de(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&&(de(this.walkthrough),this.walkthrough=null);let o={onNext:()=>{let l=this.walkthroughIndex+1;if(l>=t.guideSteps.length){this.close();return}this.walkthroughIndex=l,this.renderWalkthroughStep(l);},onBack:()=>{let l=this.walkthroughIndex-1;l<0||(this.walkthroughIndex=l,this.renderWalkthroughStep(l));},onSkip:()=>this.close(),onComplete:()=>this.close()},r=t.guideSteps[e]?.style?.render;if(r==="modal"||r==="banner"){let l=r==="modal"?new ee:new Z;try{l.render({guide:t,onInteraction:()=>{},onClose:()=>this.close(),nav:{stepIndex:e,totalSteps:t.guideSteps.length,callbacks:o}});}catch{return de(l),false}return this.walkthroughGuide!==t?(de(l),false):(this.walkthrough=l,true)}let s=new Ee,a=false;try{a=await s.render({guide:t,currentStepIndex:e,callbacks:o});}catch{a=false;}return !a||this.walkthroughGuide!==t?(de(s),false):(this.walkthrough=s,true)}},it=null;function rt(n){return Be()?(it||(it=new mt),it.preview(n)):{close:()=>{},ready:Promise.resolve({rendered:false}),host:()=>null}}function gn(){it?.close();}function bo(n){let e=n.activationRules?.selector,t={url:n.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...e!==void 0?{selector:e}:{}};return {guideId:wo,guideName:n.guideName??"Preview",guideType:n.guideType,guideSteps:n.guideSteps,activationRules:t,displayFrequency:"always",displayPriority:0}}function xo(n){switch(n){case "modal":return new ee;case "banner":return new Z;case "tooltip":return new ke;case "custom":return new ye;case "inline":return new Ce;case "inline-custom":return new be;case "form":return new we;case "inline-form":return new xe;case "badge":return new ge;case "walkthrough":return null}}function de(n){try{n.destroy();}catch{}}var st=null;async function vn(n){if(!Be())return null;st?.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 l=window.veo,d=l?.getEndUserId?.()??l?.getAnonymousId?.()??null;if(!d)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:d,answers:a})})).ok}catch{return false}},o=null,i=()=>{e&&(o?.close(),o=rt({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."}));},r=Co({label:e?`Vista previa: ${e.guideName}`:"Link de preview inv\xE1lido o vencido",error:!e,onReshow:e?i:null,onClose:()=>s.teardown()}),s={teardown(){o?.close(),o=null,r.remove(),st===s&&(st=null);}};return st=s,i(),s}function Co(n){let e=document.createElement("div");e.setAttribute("data-veo-preview-chip","");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=`
399
399
  .chip { position: fixed; bottom: 16px; right: 16px; z-index: 2147483647;