veo-sdk 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -855,7 +855,7 @@ function init(config) {
855
855
  // Fallback de carga del builder para bundlers: `import()` dinámico → el bundler
856
856
  // lo code-splitea (solo se descarga en modo builder). Así el consumidor por
857
857
  // bundler NO necesita copiar `veo-builder.js` ni setear `builderUrl`.
858
- () => import('./builder-LXIR3WMJ.mjs').then((m) => m.initBuilderMode())
858
+ () => import('./builder-FBNBSKCL.mjs').then((m) => m.initBuilderMode())
859
859
  );
860
860
  }
861
861
 
@@ -324,5 +324,5 @@ var veoBuilder=(function(exports){'use strict';function G(){return typeof window
324
324
  border-radius: 999px;
325
325
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
326
326
  }
327
- `,pt=class{constructor(){this.host=null;this.box=null;this.label=null;this.current=null;this.maxAncestors=dn;this.onPick=null;this.onCancel=null;this.onMove=t=>{let n=t.target;!(n instanceof Element)||this.isOwn(n)||(this.current=n,this.draw(n));};this.onClick=t=>{let n=this.current??(t.target instanceof Element?t.target:null);if(!n||this.isOwn(n))return;t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();let o=this.describe(n),i=this.onPick;this.stop(),i?.(o);};this.onKey=t=>{if(t.key!=="Escape")return;t.preventDefault(),t.stopPropagation();let n=this.onCancel;this.stop(),n?.();};this.swallow=t=>{this.isOwn(t.target)||(t.preventDefault(),t.stopPropagation());};this.reposition=()=>{this.current&&this.draw(this.current);};}start(t){this.stop(),this.maxAncestors=t.maxAncestors??dn,this.onPick=t.onPick,this.onCancel=t.onCancel??null;let n=document.createElement("div");n.setAttribute(co,"");let o=n.attachShadow({mode:"open"}),i=document.createElement("style");i.textContent=uo,this.box=document.createElement("div"),this.box.className="veo-pick-box",this.box.style.display="none",this.label=document.createElement("div"),this.label.className="veo-pick-label",this.label.style.display="none";let r=document.createElement("div");r.className="veo-pick-hint",r.textContent=t.hint??"Seleccion\xE1 un elemento \xB7 Esc para cancelar",o.append(i,this.box,this.label,r),document.body.appendChild(n),this.host=n,document.addEventListener("mousemove",this.onMove,true),document.addEventListener("click",this.onClick,true),document.addEventListener("mousedown",this.swallow,true),document.addEventListener("mouseup",this.swallow,true),document.addEventListener("keydown",this.onKey,true),window.addEventListener("scroll",this.reposition,true),window.addEventListener("resize",this.reposition);}stop(){document.removeEventListener("mousemove",this.onMove,true),document.removeEventListener("click",this.onClick,true),document.removeEventListener("mousedown",this.swallow,true),document.removeEventListener("mouseup",this.swallow,true),document.removeEventListener("keydown",this.onKey,true),window.removeEventListener("scroll",this.reposition,true),window.removeEventListener("resize",this.reposition),this.host?.parentNode&&this.host.parentNode.removeChild(this.host),this.host=null,this.box=null,this.label=null,this.current=null,this.onPick=null,this.onCancel=null;}isOwn(t){return t instanceof Node&&this.host!==null&&this.host.contains(t)}draw(t){if(!this.box||!this.label)return;let n=t.getBoundingClientRect();this.box.style.display="block",this.box.style.top=`${n.top}px`,this.box.style.left=`${n.left}px`,this.box.style.width=`${n.width}px`,this.box.style.height=`${n.height}px`;let o=Qe(t,0);this.label.textContent="";let i=document.createElement("div");i.className="veo-pick-sel",i.textContent=o;let r=document.createElement("div");r.className="veo-pick-dim",r.textContent=`${Math.round(n.width)} \xD7 ${Math.round(n.height)}`,this.label.append(i,r),this.label.style.display="block";let s=48,a=n.bottom+8+s>window.innerHeight;this.label.style.top=a?`${Math.max(8,n.top-s-8)}px`:`${n.bottom+8}px`,this.label.style.left=`${Math.max(8,n.left)}px`;}describe(t){let n=t.getBoundingClientRect();return {selector:Qe(t,this.maxAncestors),shortSelector:Qe(t,0),tag:t.tagName.toLowerCase(),id:t.id||null,classes:Je(t),text:(t.textContent??"").trim().slice(0,120),rect:{x:Math.round(n.left),y:Math.round(n.top),width:Math.round(n.width),height:Math.round(n.height)}}}},Re=null;function Ze(e){return $()?(Re||(Re=new pt),Re.start(e),{stop:()=>Re?.stop()}):{stop:()=>{}}}function un(){Re?.stop();}function et(){if(!G()||!$())return null;let e=gt();if(!e)return null;let t=e.token,n=mo(e.origin);if(!n)return null;let o=null,i=null,r=null,s=()=>i?i.target():r,a=m=>{s()?.postMessage({source:he,token:t,...m},n);},c=m=>{switch(m.type){case "panel-ready":a({type:"ready"});break;case "start-picker":o?.stop(),o=Ze({onPick:h=>{o=null,a({type:"picked",payload:h});},onCancel:()=>{o=null,a({type:"pick-cancelled"});},...m.maxAncestors!==void 0?{maxAncestors:m.maxAncestors}:{},...m.hint!==void 0?{hint:m.hint}:{}});break;case "stop-picker":o?.stop(),o=null;break;case "preview":m.guide&&Xe(m.guide).ready;break;case "close-preview":Pe();break;case "teardown":p();break}},l=m=>{if(m.origin!==n)return;let h=m.data;!h||h.source!==he||h.token!==t||c(h);},d=()=>a({type:"closed"}),p=()=>{window.removeEventListener("message",l),window.removeEventListener("pagehide",d),o?.stop(),o=null,Pe(),a({type:"closed"}),i?.teardown(),i=null,vt();};if(e.panel)i=an({dashboardOrigin:n,token:t,appOrigin:window.location.origin,guide:e.guide,panelPath:e.panelPath,onClose:()=>p()});else if(r=fo(),!r)return null;let f=()=>{window.addEventListener("message",l),window.addEventListener("pagehide",d),e.panel||a({type:"ready"});},u=window.__veoBuilder;return u?.apiKey&&u?.apiUrl?po(u.apiUrl,u.apiKey,t).then(m=>{m?f():window.console&&console.warn("[veo] token de builder inv\xE1lido \u2014 modo no activado");}):f(),{teardown:p}}async function po(e,t,n){try{let o=`${e.replace(/\/+$/,"")}/v1/builder/verify`,i=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":t},body:JSON.stringify({token:n})});return i.ok?(await i.json().catch(()=>null))?.valid!==!1:!0}catch{return true}}function fo(){return window.opener&&window.opener!==window?window.opener:window.parent&&window.parent!==window?window.parent:null}function mo(e){if(e)try{return new URL(e).origin}catch{return null}if($()&&document.referrer)try{return new URL(document.referrer).origin}catch{return null}return null}var ho="popup,width=1280,height=860",go=600;function pn(e){if(!G())return xo();let t=e.dashboardOrigin??window.location.origin,n=wo(e.appUrl),o=vo(e.appUrl,e.token,t),i=e.frame??null,r=i!==null,s=null;r?i.src=o:s=window.open(o,e.windowName??"veo-builder",e.windowFeatures??ho);let a=()=>r?i?.contentWindow??null:s,c=f=>{let u=a();u&&(!r&&s?.closed||u.postMessage({source:he,token:e.token,...f},n??"*"));},l,d=()=>{window.removeEventListener("message",p),l!==void 0&&(clearInterval(l),l=void 0);},p=f=>{if(n&&f.origin!==n)return;let u=f.data;if(!(!u||u.source!==he||u.token!==e.token))switch(u.type){case "ready":e.onReady?.();break;case "picked":u.payload&&e.onPicked?.(u.payload);break;case "pick-cancelled":e.onCancelled?.();break;case "closed":d(),e.onClosed?.();break}};return window.addEventListener("message",p),r||(l=setInterval(()=>{s?.closed&&(d(),e.onClosed?.());},go)),{startPicker:f=>c({type:"start-picker",...f?.maxAncestors!==void 0?{maxAncestors:f.maxAncestors}:{},...f?.hint!==void 0?{hint:f.hint}:{}}),stopPicker:()=>c({type:"stop-picker"}),preview:f=>c({type:"preview",guide:f}),closePreview:()=>c({type:"close-preview"}),close:()=>{c({type:"teardown"}),r?i&&(i.src="about:blank"):s&&!s.closed&&s.close(),d();}}}function vo(e,t,n){try{let o=new URL(e,window.location.href);return o.searchParams.set(oe,t),o.searchParams.set(ie,n),o.toString()}catch{return e}}function wo(e){try{return new URL(e,window.location.href).origin}catch{return null}}function xo(){return {startPicker:()=>{},stopPicker:()=>{},preview:()=>{},closePreview:()=>{},close:()=>{}}}et();exports.closeGuidePreview=Pe;exports.createBuilderSession=pn;exports.initBuilderMode=et;exports.previewGuide=Xe;exports.startElementPicker=Ze;exports.stopElementPicker=un;return exports;})({});//# sourceMappingURL=veo-builder.js.map
327
+ `,pt=class{constructor(){this.host=null;this.box=null;this.label=null;this.current=null;this.maxAncestors=dn;this.onPick=null;this.onCancel=null;this.onMove=t=>{let n=t.target;!(n instanceof Element)||this.isOwn(n)||(this.current=n,this.draw(n));};this.onClick=t=>{let n=this.current??(t.target instanceof Element?t.target:null);if(!n||this.isOwn(n))return;t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();let o=this.describe(n),i=this.onPick;this.stop(),i?.(o);};this.onKey=t=>{if(t.key!=="Escape")return;t.preventDefault(),t.stopPropagation();let n=this.onCancel;this.stop(),n?.();};this.swallow=t=>{this.isOwn(t.target)||(t.preventDefault(),t.stopPropagation());};this.reposition=()=>{this.current&&this.draw(this.current);};}start(t){this.stop(),this.maxAncestors=t.maxAncestors??dn,this.onPick=t.onPick,this.onCancel=t.onCancel??null;let n=document.createElement("div");n.setAttribute(co,"");let o=n.attachShadow({mode:"open"}),i=document.createElement("style");i.textContent=uo,this.box=document.createElement("div"),this.box.className="veo-pick-box",this.box.style.display="none",this.label=document.createElement("div"),this.label.className="veo-pick-label",this.label.style.display="none";let r=document.createElement("div");r.className="veo-pick-hint",r.textContent=t.hint??"Seleccion\xE1 un elemento \xB7 Esc para cancelar",o.append(i,this.box,this.label,r),document.body.appendChild(n),this.host=n,document.addEventListener("mousemove",this.onMove,true),document.addEventListener("click",this.onClick,true),document.addEventListener("mousedown",this.swallow,true),document.addEventListener("mouseup",this.swallow,true),document.addEventListener("keydown",this.onKey,true),window.addEventListener("scroll",this.reposition,true),window.addEventListener("resize",this.reposition);}stop(){document.removeEventListener("mousemove",this.onMove,true),document.removeEventListener("click",this.onClick,true),document.removeEventListener("mousedown",this.swallow,true),document.removeEventListener("mouseup",this.swallow,true),document.removeEventListener("keydown",this.onKey,true),window.removeEventListener("scroll",this.reposition,true),window.removeEventListener("resize",this.reposition),this.host?.parentNode&&this.host.parentNode.removeChild(this.host),this.host=null,this.box=null,this.label=null,this.current=null,this.onPick=null,this.onCancel=null;}isOwn(t){return t instanceof Node&&this.host!==null&&this.host.contains(t)}draw(t){if(!this.box||!this.label)return;let n=t.getBoundingClientRect();this.box.style.display="block",this.box.style.top=`${n.top}px`,this.box.style.left=`${n.left}px`,this.box.style.width=`${n.width}px`,this.box.style.height=`${n.height}px`;let o=Qe(t,0);this.label.textContent="";let i=document.createElement("div");i.className="veo-pick-sel",i.textContent=o;let r=document.createElement("div");r.className="veo-pick-dim",r.textContent=`${Math.round(n.width)} \xD7 ${Math.round(n.height)}`,this.label.append(i,r),this.label.style.display="block";let s=48,a=n.bottom+8+s>window.innerHeight;this.label.style.top=a?`${Math.max(8,n.top-s-8)}px`:`${n.bottom+8}px`,this.label.style.left=`${Math.max(8,n.left)}px`;}describe(t){let n=t.getBoundingClientRect();return {selector:Qe(t,this.maxAncestors),shortSelector:Qe(t,0),tag:t.tagName.toLowerCase(),id:t.id||null,classes:Je(t),text:(t.textContent??"").trim().slice(0,120),rect:{x:Math.round(n.left),y:Math.round(n.top),width:Math.round(n.width),height:Math.round(n.height)}}}},Re=null;function Ze(e){return $()?(Re||(Re=new pt),Re.start(e),{stop:()=>Re?.stop()}):{stop:()=>{}}}function un(){Re?.stop();}function et(){if(!G()||!$())return null;let e=gt();if(!e)return null;let t=e.token,n=mo(e.origin);if(!n)return null;let o=null,i=null,r=null,s=()=>i?i.target():r,a=m=>{s()?.postMessage({source:he,token:t,...m},n);},c=m=>{switch(m.type){case "panel-ready":a({type:"ready"});break;case "start-picker":o?.stop(),o=Ze({onPick:h=>{o=null,a({type:"picked",payload:h});},onCancel:()=>{o=null,a({type:"pick-cancelled"});},...m.maxAncestors!==void 0?{maxAncestors:m.maxAncestors}:{},...m.hint!==void 0?{hint:m.hint}:{}});break;case "stop-picker":o?.stop(),o=null;break;case "preview":m.guide&&Xe(m.guide).ready;break;case "close-preview":Pe();break;case "teardown":p();break}},l=m=>{if(m.origin!==n)return;let h=m.data;!h||h.source!==he||h.token!==t||c(h);},d=()=>a({type:"closed"}),p=()=>{window.removeEventListener("message",l),window.removeEventListener("pagehide",d),o?.stop(),o=null,Pe(),a({type:"closed"}),i?.teardown(),i=null,vt();};if(e.panel)i=an({dashboardOrigin:n,token:t,appOrigin:window.location.origin,guide:e.guide,panelPath:e.panelPath,onClose:()=>p()});else if(r=fo(),!r)return null;let f=()=>{window.addEventListener("message",l),window.addEventListener("pagehide",d),e.panel||a({type:"ready"});},u=window.__veoBuilder;return !e.panel&&u?.apiKey&&u?.apiUrl?po(u.apiUrl,u.apiKey,t).then(m=>{m?f():window.console&&console.warn("[veo] token de builder inv\xE1lido \u2014 modo no activado");}):f(),{teardown:p}}async function po(e,t,n){try{let o=`${e.replace(/\/+$/,"")}/v1/builder/verify`,i=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":t},body:JSON.stringify({token:n})});return i.ok?(await i.json().catch(()=>null))?.valid!==!1:!0}catch{return true}}function fo(){return window.opener&&window.opener!==window?window.opener:window.parent&&window.parent!==window?window.parent:null}function mo(e){if(e)try{return new URL(e).origin}catch{return null}if($()&&document.referrer)try{return new URL(document.referrer).origin}catch{return null}return null}var ho="popup,width=1280,height=860",go=600;function pn(e){if(!G())return xo();let t=e.dashboardOrigin??window.location.origin,n=wo(e.appUrl),o=vo(e.appUrl,e.token,t),i=e.frame??null,r=i!==null,s=null;r?i.src=o:s=window.open(o,e.windowName??"veo-builder",e.windowFeatures??ho);let a=()=>r?i?.contentWindow??null:s,c=f=>{let u=a();u&&(!r&&s?.closed||u.postMessage({source:he,token:e.token,...f},n??"*"));},l,d=()=>{window.removeEventListener("message",p),l!==void 0&&(clearInterval(l),l=void 0);},p=f=>{if(n&&f.origin!==n)return;let u=f.data;if(!(!u||u.source!==he||u.token!==e.token))switch(u.type){case "ready":e.onReady?.();break;case "picked":u.payload&&e.onPicked?.(u.payload);break;case "pick-cancelled":e.onCancelled?.();break;case "closed":d(),e.onClosed?.();break}};return window.addEventListener("message",p),r||(l=setInterval(()=>{s?.closed&&(d(),e.onClosed?.());},go)),{startPicker:f=>c({type:"start-picker",...f?.maxAncestors!==void 0?{maxAncestors:f.maxAncestors}:{},...f?.hint!==void 0?{hint:f.hint}:{}}),stopPicker:()=>c({type:"stop-picker"}),preview:f=>c({type:"preview",guide:f}),closePreview:()=>c({type:"close-preview"}),close:()=>{c({type:"teardown"}),r?i&&(i.src="about:blank"):s&&!s.closed&&s.close(),d();}}}function vo(e,t,n){try{let o=new URL(e,window.location.href);return o.searchParams.set(oe,t),o.searchParams.set(ie,n),o.toString()}catch{return e}}function wo(e){try{return new URL(e,window.location.href).origin}catch{return null}}function xo(){return {startPicker:()=>{},stopPicker:()=>{},preview:()=>{},closePreview:()=>{},close:()=>{}}}et();exports.closeGuidePreview=Pe;exports.createBuilderSession=pn;exports.initBuilderMode=et;exports.previewGuide=Xe;exports.startElementPicker=Ze;exports.stopElementPicker=un;return exports;})({});//# sourceMappingURL=veo-builder.js.map
328
328
  //# sourceMappingURL=veo-builder.js.map