viewgate-wrapper 1.10.29 → 1.10.30

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.
@@ -9,7 +9,7 @@ React keys must be passed directly to JSX without using spread:
9
9
  display: none !important;
10
10
  }`,Ef=(t,A)=>{xf(t,`.${an}${Ff}${na}
11
11
  .${cn}${mf}${na}`,A)},xf=(t,A,e)=>{const r=t.ownerDocument;if(r){const s=r.createElement("style");s.textContent=A,e&&(s.nonce=e),t.appendChild(s)}},yf=(t,A)=>{const e=t.ownerDocument.createElement("base");e.href=A;const r=t.getElementsByTagName("head").item(0);r?.insertBefore(e,r?.firstChild??null)};class x{constructor(A,e){this.type=0,this.x=A,this.y=e}add(A,e){return new x(this.x+A,this.y+e)}}const it=(t,A,e)=>new x(t.x+(A.x-t.x)*e,t.y+(A.y-t.y)*e);class pe{constructor(A,e,r,s){this.type=1,this.start=A,this.startControl=e,this.endControl=r,this.end=s}subdivide(A,e){const r=it(this.start,this.startControl,A),s=it(this.startControl,this.endControl,A),n=it(this.endControl,this.end,A),o=it(r,s,A),i=it(s,n,A),a=it(o,i,A);return e?new pe(this.start,r,o,a):new pe(a,i,n,this.end)}add(A,e){return new pe(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))}reverse(){return new pe(this.end,this.endControl,this.startControl,this.start)}}const OA=t=>t.type===1;class Hf{constructor(A){const e=A.styles,r=A.bounds;let[s,n]=Ht(e.borderTopLeftRadius,r.width,r.height),[o,i]=Ht(e.borderTopRightRadius,r.width,r.height),[a,l]=Ht(e.borderBottomRightRadius,r.width,r.height),[c,B]=Ht(e.borderBottomLeftRadius,r.width,r.height);const f=[];f.push((s+o)/r.width),f.push((c+a)/r.width),f.push((n+B)/r.height),f.push((i+l)/r.height);const u=Math.max(...f);u>1&&(s/=u,n/=u,o/=u,i/=u,a/=u,l/=u,c/=u,B/=u);const h=r.width-o,p=r.height-l,C=r.width-a,y=r.height-B,w=e.borderTopWidth,b=e.borderRightWidth,H=e.borderBottomWidth,m=e.borderLeftWidth,D=O(e.paddingTop,A.bounds.width),k=O(e.paddingRight,A.bounds.width),X=O(e.paddingBottom,A.bounds.width),K=O(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||n>0?rA(r.left+m/3,r.top+w/3,s-m/3,n-w/3,P.TOP_LEFT):new x(r.left+m/3,r.top+w/3),this.topRightBorderDoubleOuterBox=s>0||n>0?rA(r.left+h,r.top+w/3,o-b/3,i-w/3,P.TOP_RIGHT):new x(r.left+r.width-b/3,r.top+w/3),this.bottomRightBorderDoubleOuterBox=a>0||l>0?rA(r.left+C,r.top+p,a-b/3,l-H/3,P.BOTTOM_RIGHT):new x(r.left+r.width-b/3,r.top+r.height-H/3),this.bottomLeftBorderDoubleOuterBox=c>0||B>0?rA(r.left+m/3,r.top+y,c-m/3,B-H/3,P.BOTTOM_LEFT):new x(r.left+m/3,r.top+r.height-H/3),this.topLeftBorderDoubleInnerBox=s>0||n>0?rA(r.left+m*2/3,r.top+w*2/3,s-m*2/3,n-w*2/3,P.TOP_LEFT):new x(r.left+m*2/3,r.top+w*2/3),this.topRightBorderDoubleInnerBox=s>0||n>0?rA(r.left+h,r.top+w*2/3,o-b*2/3,i-w*2/3,P.TOP_RIGHT):new x(r.left+r.width-b*2/3,r.top+w*2/3),this.bottomRightBorderDoubleInnerBox=a>0||l>0?rA(r.left+C,r.top+p,a-b*2/3,l-H*2/3,P.BOTTOM_RIGHT):new x(r.left+r.width-b*2/3,r.top+r.height-H*2/3),this.bottomLeftBorderDoubleInnerBox=c>0||B>0?rA(r.left+m*2/3,r.top+y,c-m*2/3,B-H*2/3,P.BOTTOM_LEFT):new x(r.left+m*2/3,r.top+r.height-H*2/3),this.topLeftBorderStroke=s>0||n>0?rA(r.left+m/2,r.top+w/2,s-m/2,n-w/2,P.TOP_LEFT):new x(r.left+m/2,r.top+w/2),this.topRightBorderStroke=s>0||n>0?rA(r.left+h,r.top+w/2,o-b/2,i-w/2,P.TOP_RIGHT):new x(r.left+r.width-b/2,r.top+w/2),this.bottomRightBorderStroke=a>0||l>0?rA(r.left+C,r.top+p,a-b/2,l-H/2,P.BOTTOM_RIGHT):new x(r.left+r.width-b/2,r.top+r.height-H/2),this.bottomLeftBorderStroke=c>0||B>0?rA(r.left+m/2,r.top+y,c-m/2,B-H/2,P.BOTTOM_LEFT):new x(r.left+m/2,r.top+r.height-H/2),this.topLeftBorderBox=s>0||n>0?rA(r.left,r.top,s,n,P.TOP_LEFT):new x(r.left,r.top),this.topRightBorderBox=o>0||i>0?rA(r.left+h,r.top,o,i,P.TOP_RIGHT):new x(r.left+r.width,r.top),this.bottomRightBorderBox=a>0||l>0?rA(r.left+C,r.top+p,a,l,P.BOTTOM_RIGHT):new x(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=c>0||B>0?rA(r.left,r.top+y,c,B,P.BOTTOM_LEFT):new x(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||n>0?rA(r.left+m,r.top+w,Math.max(0,s-m),Math.max(0,n-w),P.TOP_LEFT):new x(r.left+m,r.top+w),this.topRightPaddingBox=o>0||i>0?rA(r.left+Math.min(h,r.width-b),r.top+w,h>r.width+b?0:Math.max(0,o-b),Math.max(0,i-w),P.TOP_RIGHT):new x(r.left+r.width-b,r.top+w),this.bottomRightPaddingBox=a>0||l>0?rA(r.left+Math.min(C,r.width-m),r.top+Math.min(p,r.height-H),Math.max(0,a-b),Math.max(0,l-H),P.BOTTOM_RIGHT):new x(r.left+r.width-b,r.top+r.height-H),this.bottomLeftPaddingBox=c>0||B>0?rA(r.left+m,r.top+Math.min(y,r.height-H),Math.max(0,c-m),Math.max(0,B-H),P.BOTTOM_LEFT):new x(r.left+m,r.top+r.height-H),this.topLeftContentBox=s>0||n>0?rA(r.left+m+K,r.top+w+D,Math.max(0,s-(m+K)),Math.max(0,n-(w+D)),P.TOP_LEFT):new x(r.left+m+K,r.top+w+D),this.topRightContentBox=o>0||i>0?rA(r.left+Math.min(h,r.width+m+K),r.top+w+D,h>r.width+m+K?0:o-m+K,i-(w+D),P.TOP_RIGHT):new x(r.left+r.width-(b+k),r.top+w+D),this.bottomRightContentBox=a>0||l>0?rA(r.left+Math.min(C,r.width-(m+K)),r.top+Math.min(p,r.height+w+D),Math.max(0,a-(b+k)),l-(H+X),P.BOTTOM_RIGHT):new x(r.left+r.width-(b+k),r.top+r.height-(H+X)),this.bottomLeftContentBox=c>0||B>0?rA(r.left+m+K,r.top+y,Math.max(0,c-(m+K)),B-(H+X),P.BOTTOM_LEFT):new x(r.left+m+K,r.top+r.height-(H+X))}}var P;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(P||(P={}));const rA=(t,A,e,r,s)=>{const n=4*((Math.sqrt(2)-1)/3),o=e*n,i=r*n,a=t+e,l=A+r;switch(s){case P.TOP_LEFT:return new pe(new x(t,l),new x(t,l-i),new x(a-o,A),new x(a,A));case P.TOP_RIGHT:return new pe(new x(t,A),new x(t+o,A),new x(a,l-i),new x(a,l));case P.BOTTOM_RIGHT:return new pe(new x(a,A),new x(a,A+i),new x(t+o,l),new x(t,l));case P.BOTTOM_LEFT:default:return new pe(new x(a,l),new x(a-o,l),new x(t,A+i),new x(t,A))}},Nr=t=>[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox],bf=t=>[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox],_r=t=>[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox];class oa{constructor(A,e,r){this.offsetX=A,this.offsetY=e,this.matrix=r,this.type=0,this.target=6}}class Gr{constructor(A,e){this.path=A,this.target=e,this.type=1}}class If{constructor(A){this.opacity=A,this.type=2,this.target=6}}class Rt{constructor(A){this.applyClip=A,this.type=3,this.target=6}}const vf=t=>t.type===0,ia=t=>t.type===1,Sf=t=>t.type===2,Lf=t=>t.type===3,aa=(t,A)=>t.length===A.length?t.some((e,r)=>e===A[r]):!1,Tf=(t,A,e,r,s)=>t.map((n,o)=>{switch(o){case 0:return n.add(A,e);case 1:return n.add(A+r,e);case 2:return n.add(A+r,e+s);case 3:return n.add(A,e+s)}return n});class ca{constructor(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}}class la{constructor(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new Hf(this.container),this.container.styles.opacity<1&&this.effects.push(new If(this.container.styles.opacity)),this.container.styles.rotate!==null){const r=this.container.styles.transformOrigin,s=this.container.bounds.left+O(r[0],this.container.bounds.width),n=this.container.bounds.top+O(r[1],this.container.bounds.height),i=this.container.styles.rotate*Math.PI/180,a=Math.cos(i),l=Math.sin(i),c=[a,l,-l,a,0,0];this.effects.push(new oa(s,n,c))}if(this.container.styles.transform!==null){const r=this.container.styles.transformOrigin,s=this.container.bounds.left+O(r[0],this.container.bounds.width),n=this.container.bounds.top+O(r[1],this.container.bounds.height),o=this.container.styles.transform;this.effects.push(new oa(s,n,o))}if(this.container.styles.overflowX!==0){const r=Nr(this.curves),s=_r(this.curves);aa(r,s)?this.effects.push(new Gr(r,6)):(this.effects.push(new Gr(r,2)),this.effects.push(new Gr(s,4)))}if(this.container.styles.clipPath.type!==0){const r=Kf(this.container.styles.clipPath,this.container.bounds);r&&this.effects.push(r)}}getEffects(A){let e=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent;const s=this.effects.slice(0);for(;r;){const n=r.effects.filter(o=>!ia(o));if(e||r.container.styles.position!==0||!r.parent){if(e=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){const o=Nr(r.curves),i=_r(r.curves);aa(o,i)||s.unshift(new Gr(i,6))}s.unshift(...n)}else s.unshift(...n);r=r.parent}return s.filter(n=>nA(n.target,A))}}const Ba=(t,A,e,r,s)=>t==="closest-side"?Math.min(A-e,r-A):t==="farthest-side"?Math.max(A-e,r-A):O(t,s),Kf=(t,A)=>{const{left:e,top:r,width:s,height:n}=A;switch(t.type){case 1:{const o=O(t.left,s),i=O(t.top,n),a=e+o,l=r+i,c=Math.max(0,s-o-O(t.right,s)),B=Math.max(0,n-i-O(t.bottom,n));return new Rt(f=>{f.beginPath(),f.rect(a,l,c,B),f.clip()})}case 2:{const o=e+O(t.cx,s),i=r+O(t.cy,n);let a;return t.radius==="closest-side"?a=Math.min(o-e,i-r,e+s-o,r+n-i):t.radius==="farthest-side"?a=Math.max(o-e,i-r,e+s-o,r+n-i):a=O(t.radius,Math.sqrt(s*s+n*n)/Math.SQRT2),new Rt(l=>{l.beginPath(),l.arc(o,i,Math.max(0,a),0,Math.PI*2),l.clip()})}case 3:{const o=e+O(t.cx,s),i=r+O(t.cy,n),a=Ba(t.rx,o,e,e+s,s),l=Ba(t.ry,i,r,r+n,n);return new Rt(c=>{c.beginPath(),c.ellipse(o,i,Math.max(0,a),Math.max(0,l),0,0,Math.PI*2),c.clip()})}case 4:{const o=t.points.map(([i,a])=>[e+O(i,s),r+O(a,n)]);return new Rt(i=>{if(i.beginPath(),o.length>0){i.moveTo(o[0][0],o[0][1]);for(let a=1;a<o.length;a++)i.lineTo(o[a][0],o[a][1]);i.closePath()}i.clip()})}case 5:{const{d:o}=t;return new Rt(i=>{try{const a=i.getTransform();i.translate(e,r),i.clip(new Path2D(o)),i.setTransform(a)}catch{}})}case 0:return null;default:return null}},ln=(t,A,e,r)=>{t.container.elements.forEach(s=>{const n=nA(s.flags,4),o=nA(s.flags,2),i=new la(s,t);nA(s.styles.display,2048)&&r.push(i);const a=nA(s.flags,8)?[]:r;if(n||o){const l=n||s.styles.isPositioned()?e:A,c=new ca(i);if(s.styles.isPositioned()||s.styles.opacity<1||s.styles.isTransformed()){const B=s.styles.zIndex.order;if(B<0){let f=0;l.negativeZIndex.some((u,h)=>B>u.element.container.styles.zIndex.order?(f=h,!1):f>0),l.negativeZIndex.splice(f,0,c)}else if(B>0){let f=0;l.positiveZIndex.some((u,h)=>B>=u.element.container.styles.zIndex.order?(f=h+1,!1):f>0),l.positiveZIndex.splice(f,0,c)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else s.styles.isFloating()?l.nonPositionedFloats.push(c):l.nonPositionedInlineLevel.push(c);ln(i,c,n?c:e,a)}else s.styles.isInlineLevel()?A.inlineLevel.push(i):A.nonInlineLevel.push(i),ln(i,A,e,a);nA(s.flags,8)&&ga(s,a)})},ga=(t,A)=>{let e=t instanceof An?t.start:1;const r=t instanceof An?t.reversed:!1;for(let s=0;s<A.length;s++){const n=A[s];n.container instanceof _i&&typeof n.container.value=="number"&&n.container.value!==0&&(e=n.container.value),n.listValue=Dt(e,n.container.styles.listStyleType,!0),e+=r?-1:1}},Df=t=>{const A=new la(t,null),e=new ca(A),r=[];return ln(A,e,e,r),ga(A.container,r),e},da=t=>{const A=t.bounds,e=t.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},Mt=t=>{const A=t.styles,e=t.bounds,r=O(A.paddingLeft,e.width),s=O(A.paddingRight,e.width),n=O(A.paddingTop,e.width),o=O(A.paddingBottom,e.width);return e.add(r+A.borderLeftWidth,n+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+r+s),-(A.borderTopWidth+A.borderBottomWidth+n+o))},Of=(t,A)=>t===0?A.bounds:t===2?Mt(A):da(A),Rf=(t,A)=>t===0?A.bounds:t===2?Mt(A):da(A),Bn=(t,A,e)=>{const r=Of(ct(t.styles.backgroundOrigin,A),t),s=Rf(ct(t.styles.backgroundClip,A),t),n=Mf(ct(t.styles.backgroundSize,A),e,r);let[o,i]=n;const a=Ht(ct(t.styles.backgroundPosition,A),r.width-o,r.height-i),l=Nf(ct(t.styles.backgroundRepeat,A),a,n,r,s),c=Math.round(r.left+a[0]),B=Math.round(r.top+a[1]);return o=Math.max(1,o),i=Math.max(1,i),[l,c,B,o,i]},at=t=>R(t)&&t.value===rt.AUTO,Vr=t=>typeof t=="number",Mf=(t,[A,e,r],s)=>{const[n,o]=t;if(!n)return[0,0];if(J(n)&&o&&J(o))return[O(n,s.width),O(o,s.height)];const i=Vr(r);if(R(n)&&(n.value===rt.CONTAIN||n.value===rt.COVER))return Vr(r)?s.width/s.height<r!=(n.value===rt.COVER)?[s.width,s.width/r]:[s.height*r,s.height]:[s.width,s.height];const a=Vr(A),l=Vr(e),c=a||l;if(at(n)&&(!o||at(o))){if(a&&l)return[A,e];if(!i&&!c)return[s.width,s.height];if(c&&i){const p=a?A:e*r,C=l?e:A/r;return[p,C]}const u=a?A:s.width,h=l?e:s.height;return[u,h]}if(i){let u=0,h=0;return J(n)?u=O(n,s.width):J(o)&&(h=O(o,s.height)),at(n)?u=h*r:(!o||at(o))&&(h=u/r),[u,h]}let B=null,f=null;if(J(n)?B=O(n,s.width):o&&J(o)&&(f=O(o,s.height)),B!==null&&(!o||at(o))&&(f=a&&l?B/A*e:s.height),f!==null&&at(n)&&(B=a&&l?f/e*A:s.width),B!==null&&f!==null)return[B,f];throw new Error("Unable to calculate background-size for element")},ct=(t,A)=>{const e=t[A];return typeof e>"u"?t[0]:e},Nf=(t,[A,e],[r,s],n,o)=>{switch(t){case 2:return[new x(Math.round(n.left),Math.round(n.top+e)),new x(Math.round(n.left+n.width),Math.round(n.top+e)),new x(Math.round(n.left+n.width),Math.round(s+n.top+e)),new x(Math.round(n.left),Math.round(s+n.top+e))];case 3:return[new x(Math.round(n.left+A),Math.round(n.top)),new x(Math.round(n.left+A+r),Math.round(n.top)),new x(Math.round(n.left+A+r),Math.round(n.height+n.top)),new x(Math.round(n.left+A),Math.round(n.height+n.top))];case 1:return[new x(Math.round(n.left+A),Math.round(n.top+e)),new x(Math.round(n.left+A+r),Math.round(n.top+e)),new x(Math.round(n.left+A+r),Math.round(n.top+e+s)),new x(Math.round(n.left+A),Math.round(n.top+e+s))];default:return[new x(Math.round(o.left),Math.round(o.top)),new x(Math.round(o.left+o.width),Math.round(o.top)),new x(Math.round(o.left+o.width),Math.round(o.height+o.top)),new x(Math.round(o.left),Math.round(o.height+o.top))]}},_f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",ua="Hidden Text";class Gf{constructor(A){this._data={},this._document=A}parseMetrics(A,e){const r=this._document.createElement("div"),s=this._document.createElement("img"),n=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=A,r.style.fontSize=e,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),s.src=_f,s.width=1,s.height=1,s.style.margin="0",s.style.padding="0",s.style.verticalAlign="baseline",n.style.fontFamily=A,n.style.fontSize=e,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(ua)),r.appendChild(n),r.appendChild(s);const i=s.offsetTop-n.offsetTop+2;r.removeChild(n),r.appendChild(this._document.createTextNode(ua)),r.style.lineHeight="normal",s.style.verticalAlign="super";const a=s.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:i,middle:a}}getMetrics(A,e){const r=`${A} ${e}`;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(A,e)),this._data[r]}}class fa{constructor(A,e){this.context=A,this.options=e}}class Vf{constructor(A){this.ctx=A.ctx,this.context=A.context,this.canvas=A.canvas}async renderBackgroundImage(A){let e=A.styles.backgroundImage.length-1;for(const r of A.styles.backgroundImage.slice(0).reverse())r.type===0?await this.renderBackgroundURLImage(A,r,e):Ug(r)?this.renderLinearGradient(A,r,e):Fg(r)&&this.renderRadialGradient(A,r,e),e--}async renderBackgroundURLImage(A,e,r){let s;const n=e.url;try{s=await this.context.cache.match(n)}catch{this.context.logger.error(`Error loading background-image ${n}`)}if(s){const o=isNaN(s.width)||s.width===0?1:s.width,i=isNaN(s.height)||s.height===0?1:s.height,[a,l,c,B,f]=Bn(A,r,[o,i,o/i]),u=this.ctx.createPattern(this.resizeImage(s,B,f,A.styles.imageRendering),"repeat");this.renderRepeat(a,u,l,c)}}renderLinearGradient(A,e,r){const[s,n,o,i,a]=Bn(A,r,[null,null,null]),[l,c,B,f,u]=wg(e.angle,i,a),p=(this.canvas.ownerDocument??document).createElement("canvas");p.width=i,p.height=a;const C=p.getContext("2d"),y=C.createLinearGradient(c,f,B,u);if(ri(e.stops,l||1).forEach(w=>y.addColorStop(w.stop,eA(w.color))),C.fillStyle=y,C.fillRect(0,0,i,a),i>0&&a>0){const w=this.ctx.createPattern(p,"repeat");this.renderRepeat(s,w,n,o)}}renderRadialGradient(A,e,r){const[s,n,o,i,a]=Bn(A,r,[null,null,null]),l=e.position.length===0?[Ne]:e.position,c=O(l[0],i),B=O(l[l.length-1],a);let[f,u]=hg(e,c,B,i,a);if((f===0||u===0)&&(f=Math.max(f,.01),u=Math.max(u,.01)),f>0&&u>0){const h=this.ctx.createRadialGradient(n+c,o+B,0,n+c,o+B,f);if(ri(e.stops,f*2).forEach(p=>h.addColorStop(p.stop,eA(p.color))),this.path(s),this.ctx.fillStyle=h,f!==u){const p=A.bounds.left+.5*A.bounds.width,C=A.bounds.top+.5*A.bounds.height,y=u/f,w=1/y;this.ctx.save(),this.ctx.translate(p,C),this.ctx.transform(1,0,0,y,0,0),this.ctx.translate(-p,-C),this.ctx.fillRect(n,w*(o-C)+C,i,a*w),this.ctx.restore()}else this.ctx.fill()}}renderRepeat(A,e,r,s){this.path(A),this.ctx.fillStyle=e,this.ctx.translate(r,s),this.ctx.fill(),this.ctx.translate(-r,-s)}resizeImage(A,e,r,s){const o=(this.canvas.ownerDocument??document).createElement("canvas");o.width=Math.max(1,e),o.height=Math.max(1,r);const i=o.getContext("2d");return s===VA.PIXELATED||s===VA.CRISP_EDGES?(this.context.logger.debug("Disabling image smoothing for background image due to CSS image-rendering"),i.imageSmoothingEnabled=!1):s===VA.SMOOTH?(this.context.logger.debug("Enabling image smoothing for background image due to CSS image-rendering: smooth"),i.imageSmoothingEnabled=!0):i.imageSmoothingEnabled=this.ctx.imageSmoothingEnabled,this.ctx.imageSmoothingQuality&&(i.imageSmoothingQuality=this.ctx.imageSmoothingQuality),i.drawImage(A,0,0,A.width,A.height,0,0,e,r),o}path(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()}formatPath(A){A.forEach((e,r)=>{const s=OA(e)?e.start:e;r===0?this.ctx.moveTo(s.x,s.y):this.ctx.lineTo(s.x,s.y),OA(e)&&this.ctx.bezierCurveTo(e.startControl.x,e.startControl.y,e.endControl.x,e.endControl.y,e.end.x,e.end.y)})}}const wa=(t,A)=>{switch(A){case 0:return WA(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return WA(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return WA(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);default:return WA(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},kf=(t,A)=>{switch(A){case 0:return WA(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return WA(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return WA(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);default:return WA(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},Pf=(t,A)=>{switch(A){case 0:return WA(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return WA(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return WA(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);default:return WA(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},Xf=(t,A)=>{switch(A){case 0:return kr(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return kr(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return kr(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);default:return kr(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},kr=(t,A)=>{const e=[];return OA(t)?e.push(t.subdivide(.5,!1)):e.push(t),OA(A)?e.push(A.subdivide(.5,!0)):e.push(A),e},WA=(t,A,e,r)=>{const s=[];return OA(t)?s.push(t.subdivide(.5,!1)):s.push(t),OA(e)?s.push(e.subdivide(.5,!0)):s.push(e),OA(r)?s.push(r.subdivide(.5,!0).reverse()):s.push(r),OA(A)?s.push(A.subdivide(.5,!1).reverse()):s.push(A),s};class Wf{constructor(A,e){this.ctx=A.ctx,this.pathCallbacks=e}async renderSolidBorder(A,e,r){this.pathCallbacks.path(wa(r,e)),this.ctx.fillStyle=eA(A),this.ctx.fill()}async renderDoubleBorder(A,e,r,s){if(e<3){await this.renderSolidBorder(A,r,s);return}const n=kf(s,r);this.pathCallbacks.path(n),this.ctx.fillStyle=eA(A),this.ctx.fill();const o=Pf(s,r);this.pathCallbacks.path(o),this.ctx.fill()}async renderDashedDottedBorder(A,e,r,s,n){this.ctx.save();const o=Xf(s,r),i=wa(s,r);n===2&&(this.pathCallbacks.path(i),this.ctx.clip());let a,l,c,B;OA(i[0])?(a=i[0].start.x,l=i[0].start.y):(a=i[0].x,l=i[0].y),OA(i[1])?(c=i[1].end.x,B=i[1].end.y):(c=i[1].x,B=i[1].y);let f;r===0||r===2?f=Math.abs(a-c):f=Math.abs(l-B),this.ctx.beginPath(),n===3?this.pathCallbacks.formatPath(o):this.pathCallbacks.formatPath(i.slice(0,2));let u=e<3?e*3:e*2,h=e<3?e*2:e;n===3&&(u=e,h=e);let p=!0;if(f<=u*2)p=!1;else if(f<=u*2+h){const C=f/(2*u+h);u*=C,h*=C}else{const C=Math.floor((f+h)/(u+h)),y=(f-C*u)/(C-1),w=(f-(C+1)*u)/C;h=w<=0||Math.abs(h-y)<Math.abs(h-w)?y:w}if(p&&(n===3?this.ctx.setLineDash([0,u+h]):this.ctx.setLineDash([u,h])),n===3?(this.ctx.lineCap="round",this.ctx.lineWidth=e):this.ctx.lineWidth=e*2+1.1,this.ctx.strokeStyle=eA(A),this.ctx.stroke(),this.ctx.setLineDash([]),n===2){if(OA(i[0])){const C=i[3],y=i[0];this.ctx.beginPath(),this.pathCallbacks.formatPath([new x(C.end.x,C.end.y),new x(y.start.x,y.start.y)]),this.ctx.stroke()}if(OA(i[1])){const C=i[1],y=i[2];this.ctx.beginPath(),this.pathCallbacks.formatPath([new x(C.end.x,C.end.y),new x(y.start.x,y.start.y)]),this.ctx.stroke()}}this.ctx.restore()}}class Jf{constructor(A,e){this.activeEffects=[],this.ctx=A.ctx,this.pathCallback=e}applyEffects(A){for(;this.activeEffects.length;)this.popEffect();A.forEach(e=>this.applyEffect(e))}applyEffect(A){this.ctx.save(),Sf(A)?this.ctx.globalAlpha=A.opacity:vf(A)?(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)):ia(A)?(this.pathCallback.path(A.path),this.ctx.clip()):Lf(A)&&A.applyClip(this.ctx),this.activeEffects.push(A)}popEffect(){this.activeEffects.pop(),this.ctx.restore()}getActiveEffectCount(){return this.activeEffects.length}hasActiveEffects(){return this.activeEffects.length>0}}const Yf=["-apple-system","system-ui"],jf=/[\u2E80-\u2FFF\u3000-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF01-\uFFEF]/,zf=t=>jf.test(t),Zf=()=>{if(typeof navigator>"u")return null;const t=navigator.userAgent,A=/iPhone|iPad|iPod/.test(t),e=/Macintosh/.test(t)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1;if(!A&&!e)return null;const r=[/(?:iPhone|CPU(?:\siPhone)?)\sOS\s(\d+)[\._](\d+)/,/Version\/(\d+)\.(\d+)/];for(const s of r){const n=t.match(s);if(n&&n[1])return parseInt(n[1],10)}return null},$f=t=>{const A=Zf();return A!==null&&A>=15&&A<17?t.map(e=>Yf.indexOf(e)!==-1?'-apple-system, "Helvetica Neue", Arial, sans-serif':e):t};class qf{constructor(A){this.ctx=A.ctx,this.options=A.options}iterateLettersWithLetterSpacing(A,e,r,s){const n=Tr(A.text),o=A.bounds.top+r;let i=A.bounds.left;for(const a of n){if(zf(a)){const l=this.ctx.textBaseline;this.ctx.textBaseline="ideographic",s(a,i,o),this.ctx.textBaseline=l}else s(a,i,o);i+=this.ctx.measureText(a).width+e}}renderTextWithLetterSpacing(A,e,r){e===0?this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+r):this.iterateLettersWithLetterSpacing(A,e,r,(s,n,o)=>{this.ctx.fillText(s,n,o)})}renderTextBoundWithPaintOrder(A,e,r){r.forEach(s=>{switch(s){case 0:this.ctx.fillStyle=eA(e.color),this.renderTextWithLetterSpacing(A,e.letterSpacing,e.fontSize.number);break;case 1:e.webkitTextStrokeWidth&&A.text.trim().length&&(this.ctx.strokeStyle=eA(e.webkitTextStrokeColor),this.ctx.lineWidth=e.webkitTextStrokeWidth,this.ctx.lineJoin=typeof window<"u"&&window.chrome?"miter":"round",e.letterSpacing===0?this.ctx.strokeText(A.text,A.bounds.left,A.bounds.top+e.fontSize.number):this.iterateLettersWithLetterSpacing(A,e.letterSpacing,e.fontSize.number,(n,o,i)=>this.ctx.strokeText(n,o,i)),this.ctx.strokeStyle="",this.ctx.lineWidth=0,this.ctx.lineJoin="miter");break}})}renderTextDecoration(A,e){this.ctx.fillStyle=eA(e.textDecorationColor||e.color);let r=1;typeof e.textDecorationThickness=="number"?r=e.textDecorationThickness:e.textDecorationThickness==="from-font"&&(r=Math.max(1,Math.floor(e.fontSize.number*.05)));let s=0;typeof e.textUnderlineOffset=="number"&&(s=e.textUnderlineOffset);const n=e.textDecorationStyle;e.textDecorationLine.forEach(o=>{let i=0;switch(o){case 1:i=A.top+A.height-r+s;break;case 2:i=A.top;break;case 3:i=A.top+(A.height/2-r/2);break;default:return}this.drawDecorationLine(A.left,i,A.width,r,n)})}drawDecorationLine(A,e,r,s,n){switch(n){case 0:this.ctx.fillRect(A,e,r,s);break;case 1:const o=Math.max(1,s);this.ctx.fillRect(A,e,r,s),this.ctx.fillRect(A,e+s+o,r,s);break;case 2:this.ctx.save(),this.ctx.beginPath(),this.ctx.setLineDash([s,s*2]),this.ctx.lineWidth=s,this.ctx.strokeStyle=this.ctx.fillStyle,this.ctx.moveTo(A,e+s/2),this.ctx.lineTo(A+r,e+s/2),this.ctx.stroke(),this.ctx.restore();break;case 3:this.ctx.save(),this.ctx.beginPath(),this.ctx.setLineDash([s*3,s*2]),this.ctx.lineWidth=s,this.ctx.strokeStyle=this.ctx.fillStyle,this.ctx.moveTo(A,e+s/2),this.ctx.lineTo(A+r,e+s/2),this.ctx.stroke(),this.ctx.restore();break;case 4:this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=s,this.ctx.strokeStyle=this.ctx.fillStyle;const i=s*2,a=s*4;let l=A;for(this.ctx.moveTo(l,e+s/2);l<A+r;){const c=Math.min(l+a/2,A+r);if(this.ctx.quadraticCurveTo(l+a/4,e+s/2-i,c,e+s/2),l=c,l<A+r){const B=Math.min(l+a/2,A+r);this.ctx.quadraticCurveTo(l+a/4,e+s/2+i,B,e+s/2),l=B}}this.ctx.stroke(),this.ctx.restore();break;default:this.ctx.fillRect(A,e,r,s)}}truncateTextWithEllipsis(A,e,r){const n=this.ctx.measureText("…").width,o=Tr(A);if(r===0){const i=c=>this.ctx.measureText(o.slice(0,c).join("")).width+n<=e;let a=0,l=o.length;for(;a<l;){const c=a+l+1>>1;i(c)?a=c:l=c-1}return o.slice(0,a).join("")+"…"}else{let i=n;const a=[];for(const l of o){const c=this.ctx.measureText(l).width;if(i+c>e)break;a.push(l),i+=c+r}return a.join("")+"…"}}createFontStyle(A){const e=A.fontVariant.filter(n=>n==="normal"||n==="small-caps").join(""),r=$f(A.fontFamily).join(", "),s=oe(A.fontSize)?`${A.fontSize.number}${A.fontSize.unit}`:`${A.fontSize.number}px`;return[[A.fontStyle,e,A.fontWeight,s,r].join(" "),r,s]}async renderTextNode(A,e,r){const[s]=this.createFontStyle(e);this.ctx.font=s,this.ctx.direction=e.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic";const n=e.paintOrder,o=e.fontSize.number*1.5;if(e.webkitLineClamp>0&&(e.display&2)!==0&&e.overflowY===1&&A.textBounds.length>0){const B=[];let f=[],u=A.textBounds[0].bounds.top;A.textBounds.forEach(p=>{Math.abs(p.bounds.top-u)>=o*.5?(f.length>0&&B.push(f),f=[p],u=p.bounds.top):f.push(p)}),f.length>0&&B.push(f);const h=e.webkitLineClamp;if(B.length>h){for(let C=0;C<h-1;C++)B[C].forEach(y=>{this.renderTextBoundWithPaintOrder(y,e,n)});const p=B[h-1];if(p&&p.length>0&&r){const C=p.map(m=>m.text).join(""),y=p[0],w=r.width-(y.bounds.left-r.left),b=this.truncateTextWithEllipsis(C,w,e.letterSpacing),H=new Ve(b,y.bounds);n.forEach(m=>{switch(m){case 0:this.ctx.fillStyle=eA(e.color),e.letterSpacing===0?this.ctx.fillText(b,y.bounds.left,y.bounds.top+e.fontSize.number):this.iterateLettersWithLetterSpacing(H,e.letterSpacing,e.fontSize.number,(D,k,X)=>this.ctx.fillText(D,k,X));break;case 1:e.webkitTextStrokeWidth&&b.trim().length&&(this.ctx.strokeStyle=eA(e.webkitTextStrokeColor),this.ctx.lineWidth=e.webkitTextStrokeWidth,this.ctx.lineJoin=typeof window<"u"&&window.chrome?"miter":"round",e.letterSpacing===0?this.ctx.strokeText(b,y.bounds.left,y.bounds.top+e.fontSize.number):this.iterateLettersWithLetterSpacing(H,e.letterSpacing,e.fontSize.number,(D,k,X)=>this.ctx.strokeText(D,k,X)),this.ctx.strokeStyle="",this.ctx.lineWidth=0,this.ctx.lineJoin="miter");break}})}return}}const a=e.textOverflow===1&&r&&e.overflowX===1&&A.textBounds.length>0;let l=!1,c="";if(a){const B=A.textBounds[0].bounds.top;if(A.textBounds.every(u=>Math.abs(u.bounds.top-B)<o*.5)){let u=A.textBounds.map(C=>C.text).join("");u=u.replace(/\s+/g," ").trim();const h=this.ctx.measureText(u).width,p=r.width;h>p&&(l=!0,c=this.truncateTextWithEllipsis(u,p,e.letterSpacing))}}if(l){const B=A.textBounds[0],f=new Ve(c,B.bounds);n.forEach(u=>{switch(u){case 0:{this.ctx.fillStyle=eA(e.color),e.letterSpacing===0?this.ctx.fillText(c,B.bounds.left,B.bounds.top+e.fontSize.number):this.iterateLettersWithLetterSpacing(f,e.letterSpacing,e.fontSize.number,(p,C,y)=>this.ctx.fillText(p,C,y));const h=e.textShadow;h.length&&c.trim().length&&(h.slice(0).reverse().forEach(p=>{this.ctx.shadowColor=eA(p.color),this.ctx.shadowOffsetX=p.offsetX.number*this.options.scale,this.ctx.shadowOffsetY=p.offsetY.number*this.options.scale,this.ctx.shadowBlur=p.blur.number,e.letterSpacing===0?this.ctx.fillText(c,B.bounds.left,B.bounds.top+e.fontSize.number):this.iterateLettersWithLetterSpacing(f,e.letterSpacing,e.fontSize.number,(C,y,w)=>this.ctx.fillText(C,y,w))}),this.ctx.shadowColor="",this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.ctx.shadowBlur=0);break}case 1:e.webkitTextStrokeWidth&&c.trim().length&&(this.ctx.strokeStyle=eA(e.webkitTextStrokeColor),this.ctx.lineWidth=e.webkitTextStrokeWidth,this.ctx.lineJoin=typeof window<"u"&&window.chrome?"miter":"round",e.letterSpacing===0?this.ctx.strokeText(c,B.bounds.left,B.bounds.top+e.fontSize.number):this.iterateLettersWithLetterSpacing(f,e.letterSpacing,e.fontSize.number,(h,p,C)=>this.ctx.strokeText(h,p,C)),this.ctx.strokeStyle="",this.ctx.lineWidth=0,this.ctx.lineJoin="miter");break}});return}A.textBounds.forEach(B=>{n.forEach(f=>{switch(f){case 0:{this.ctx.fillStyle=eA(e.color),this.renderTextWithLetterSpacing(B,e.letterSpacing,e.fontSize.number);const u=e.textShadow;u.length&&B.text.trim().length&&(u.slice(0).reverse().forEach(h=>{this.ctx.shadowColor=eA(h.color),this.ctx.shadowOffsetX=h.offsetX.number*this.options.scale,this.ctx.shadowOffsetY=h.offsetY.number*this.options.scale,this.ctx.shadowBlur=h.blur.number,this.renderTextWithLetterSpacing(B,e.letterSpacing,e.fontSize.number)}),this.ctx.shadowColor="",this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.ctx.shadowBlur=0),e.textDecorationLine.length&&this.renderTextDecoration(B.bounds,e);break}case 1:{if(e.webkitTextStrokeWidth&&B.text.trim().length){this.ctx.strokeStyle=eA(e.webkitTextStrokeColor),this.ctx.lineWidth=e.webkitTextStrokeWidth,this.ctx.lineJoin=typeof window<"u"&&window.chrome?"miter":"round";const u=e.fontSize.number;e.letterSpacing===0?this.ctx.strokeText(B.text,B.bounds.left,B.bounds.top+u):this.iterateLettersWithLetterSpacing(B,e.letterSpacing,u,(h,p,C)=>this.ctx.strokeText(h,p,C)),this.ctx.strokeStyle="",this.ctx.lineWidth=0,this.ctx.lineJoin="miter"}break}}})})}}const Aw=1e4;class gn extends fa{constructor(A,e){super(A,e),this.canvas=e.canvas?e.canvas:document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),e.canvas||(this.canvas.width=Math.floor(e.width*e.scale),this.canvas.height=Math.floor(e.height*e.scale),this.canvas.style.width=`${e.width}px`,this.canvas.style.height=`${e.height}px`),this.fontMetrics=new Gf(document),this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-e.x,-e.y),this.ctx.textBaseline="bottom",e.imageSmoothing!==void 0&&(this.ctx.imageSmoothingEnabled=e.imageSmoothing),e.imageSmoothingQuality&&(this.ctx.imageSmoothingQuality=e.imageSmoothingQuality),this.backgroundRenderer=new Vf({ctx:this.ctx,context:this.context,canvas:this.canvas,options:{width:e.width,height:e.height,scale:e.scale}}),this.borderRenderer=new Wf({ctx:this.ctx},{path:r=>this.path(r),formatPath:r=>this.formatPath(r)}),this.effectsRenderer=new Jf({ctx:this.ctx},{path:r=>this.path(r)}),this.textRenderer=new qf({ctx:this.ctx,context:this.context,options:{scale:e.scale}}),this.context.logger.debug(`Canvas renderer initialized (${e.width}x${e.height}) with scale ${e.scale}`)}async renderStack(A){A.element.container.styles.isVisible()&&await this.renderStackContent(A)}async renderNode(A){if(nA(A.container.flags,16))debugger;A.container.styles.isVisible()&&(await this.renderNodeBackgroundAndBorders(A),await this.renderNodeContent(A))}renderReplacedElement(A,e,r){const s=r.naturalWidth||A.intrinsicWidth,n=r.naturalHeight||A.intrinsicHeight;if(r&&s>0&&n>0){const o=Mt(A),i=_r(e);this.path(i),this.ctx.save(),this.ctx.clip();let a=0,l=0,c=s,B=n,f=o.left,u=o.top,h=o.width,p=o.height;const{objectFit:C}=A.styles,y=h/p,w=c/B;if(C===2)w>y?(p=h/w,u+=(o.height-p)/2):(h=p*w,f+=(o.width-h)/2);else if(C===4)w>y?(c=B*y,a+=(s-c)/2):(B=c/y,l+=(n-B)/2);else if(C===8)c>h?(a+=(c-h)/2,c=h):(f+=(h-c)/2,h=c),B>p?(l+=(B-p)/2,B=p):(u+=(p-B)/2,p=B);else if(C===16){const b=w>y?h:p*w,H=c>h?c:h;b<H?w>y?(p=h/w,u+=(o.height-p)/2):(h=p*w,f+=(o.width-h)/2):(c>h?(a+=(c-h)/2,c=h):(f+=(h-c)/2,h=c),B>p?(l+=(B-p)/2,B=p):(u+=(p-B)/2,p=B))}this.ctx.drawImage(r,a,l,c,B,f,u,h,p),this.ctx.restore()}}async renderNodeContent(A){this.effectsRenderer.applyEffects(A.getEffects(4));const e=A.container,r=A.curves,s=e.styles,n=Mt(e);for(const o of e.textNodes)await this.textRenderer.renderTextNode(o,s,n);if(e instanceof Ri)try{const o=await this.context.cache.match(e.src),i=this.ctx.imageSmoothingEnabled;s.imageRendering===VA.PIXELATED||s.imageRendering===VA.CRISP_EDGES?(this.context.logger.debug(`Disabling image smoothing for ${e.src} due to CSS image-rendering: ${s.imageRendering===VA.PIXELATED?"pixelated":"crisp-edges"}`),this.ctx.imageSmoothingEnabled=!1):s.imageRendering===VA.SMOOTH&&(this.context.logger.debug(`Enabling image smoothing for ${e.src} due to CSS image-rendering: smooth`),this.ctx.imageSmoothingEnabled=!0),this.renderReplacedElement(e,r,o),this.ctx.imageSmoothingEnabled=i}catch{this.context.logger.error(`Error loading image ${e.src}`)}if(e instanceof Mi&&this.renderReplacedElement(e,r,e.canvas),e instanceof Ni)try{const o=await this.context.cache.match(e.svg);this.renderReplacedElement(e,r,o)}catch{this.context.logger.error(`Error loading svg ${e.svg.substring(0,255)}`)}if(e instanceof Pi&&e.tree){const i=await new gn(this.context,{scale:this.options.scale,backgroundColor:e.backgroundColor,x:0,y:0,width:e.width,height:e.height}).render(e.tree);e.width&&e.height&&this.ctx.drawImage(i,0,0,e.width,e.height,e.bounds.left,e.bounds.top,e.bounds.width,e.bounds.height)}if(e instanceof Lt){const o=Math.min(e.bounds.width,e.bounds.height);e.type===Kr?e.checked&&(this.ctx.save(),this.path([new x(e.bounds.left+o*.39363,e.bounds.top+o*.79),new x(e.bounds.left+o*.16,e.bounds.top+o*.5549),new x(e.bounds.left+o*.27347,e.bounds.top+o*.44071),new x(e.bounds.left+o*.39694,e.bounds.top+o*.5649),new x(e.bounds.left+o*.72983,e.bounds.top+o*.23),new x(e.bounds.left+o*.84,e.bounds.top+o*.34085),new x(e.bounds.left+o*.39363,e.bounds.top+o*.79)]),this.ctx.fillStyle=eA(Gi),this.ctx.fill(),this.ctx.restore()):e.type===Dr&&e.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(e.bounds.left+o/2,e.bounds.top+o/2,o/4,0,Math.PI*2,!0),this.ctx.fillStyle=eA(Gi),this.ctx.fill(),this.ctx.restore())}if(ew(e)&&e.value.length){const[o,i,a]=this.textRenderer.createFontStyle(s),{baseline:l}=this.fontMetrics.getMetrics(i,a);this.ctx.font=o;const c=e instanceof Lt&&e.isPlaceholder;this.ctx.fillStyle=eA(c?rf:s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=rw(e.styles.textAlign);const B=Mt(e);let f=0;switch(e.styles.textAlign){case 1:f+=B.width/2;break;case 2:f+=B.width;break}let u=0;if(e instanceof Lt){const p=O(s.fontSize,0);u=(B.height-p)/2}const h=B.add(f,u,0,0);this.ctx.save(),this.path([new x(B.left,B.top),new x(B.left+B.width,B.top),new x(B.left+B.width,B.top+B.height),new x(B.left,B.top+B.height)]),this.ctx.clip(),this.textRenderer.renderTextWithLetterSpacing(new Ve(e.value,h),s.letterSpacing,l),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(nA(e.styles.display,2048)){if(e.styles.listStyleImage!==null){const o=e.styles.listStyleImage;if(o.type===0){let i;const a=o.url;try{i=await this.context.cache.match(a),this.ctx.drawImage(i,e.bounds.left-(i.width+10),e.bounds.top)}catch{this.context.logger.error(`Error loading list-style-image ${a}`)}}}else if(A.listValue&&e.styles.listStyleType!==-1){const[o]=this.textRenderer.createFontStyle(s);this.ctx.font=o,this.ctx.fillStyle=eA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right";const i=new yA(e.bounds.left,e.bounds.top+O(e.styles.paddingTop,e.bounds.width),e.bounds.width,fi(s.lineHeight,s.fontSize.number)/2+1);this.textRenderer.renderTextWithLetterSpacing(new Ve(A.listValue,i),s.letterSpacing,fi(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"}}}async renderStackContent(A){if(nA(A.element.container.flags,16))debugger;await this.renderNodeBackgroundAndBorders(A.element);for(const e of A.negativeZIndex)await this.renderStack(e);await this.renderNodeContent(A.element);for(const e of A.nonInlineLevel)await this.renderNode(e);for(const e of A.nonPositionedFloats)await this.renderStack(e);for(const e of A.nonPositionedInlineLevel)await this.renderStack(e);for(const e of A.inlineLevel)await this.renderNode(e);for(const e of A.zeroOrAutoZIndexOrTransformedOrOpacity)await this.renderStack(e);for(const e of A.positiveZIndex)await this.renderStack(e)}mask(A){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.options.width,0),this.ctx.lineTo(this.options.width,this.options.height),this.ctx.lineTo(0,this.options.height),this.ctx.lineTo(0,0),this.formatPath(A.slice(0).reverse()),this.ctx.closePath()}path(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()}formatPath(A){A.forEach((e,r)=>{const s=OA(e)?e.start:e;r===0?this.ctx.moveTo(s.x,s.y):this.ctx.lineTo(s.x,s.y),OA(e)&&this.ctx.bezierCurveTo(e.startControl.x,e.startControl.y,e.endControl.x,e.endControl.y,e.end.x,e.end.y)})}async renderNodeBackgroundAndBorders(A){this.effectsRenderer.applyEffects(A.getEffects(2));const e=A.container.styles,r=!He(e.backgroundColor)||e.backgroundImage.length,s=[{style:e.borderTopStyle,color:e.borderTopColor,width:e.borderTopWidth},{style:e.borderRightStyle,color:e.borderRightColor,width:e.borderRightWidth},{style:e.borderBottomStyle,color:e.borderBottomColor,width:e.borderBottomWidth},{style:e.borderLeftStyle,color:e.borderLeftColor,width:e.borderLeftWidth}],n=tw(ct(e.backgroundClip,0),A.curves);(r||e.boxShadow.length)&&(this.ctx.save(),this.path(n),this.ctx.clip(),He(e.backgroundColor)||(this.ctx.fillStyle=eA(e.backgroundColor),this.ctx.fill()),await this.backgroundRenderer.renderBackgroundImage(A.container),this.ctx.restore(),e.boxShadow.slice(0).reverse().forEach(i=>{this.ctx.save();const a=Nr(A.curves),l=i.inset?0:Aw,c=Tf(a,-l+(i.inset?1:-1)*i.spread.number,(i.inset?1:-1)*i.spread.number,i.spread.number*(i.inset?-2:2),i.spread.number*(i.inset?-2:2));i.inset?(this.path(a),this.ctx.clip(),this.mask(c)):(this.mask(a),this.ctx.clip(),this.path(c)),this.ctx.shadowOffsetX=i.offsetX.number+l,this.ctx.shadowOffsetY=i.offsetY.number,this.ctx.shadowColor=eA(i.color),this.ctx.shadowBlur=i.blur.number,this.ctx.fillStyle=i.inset?eA(i.color):"rgba(0,0,0,1)",this.ctx.fill(),this.ctx.restore()}));let o=0;for(const i of s)i.style!==0&&!He(i.color)&&i.width>0&&(i.style===2?await this.borderRenderer.renderDashedDottedBorder(i.color,i.width,o,A.curves,2):i.style===3?await this.borderRenderer.renderDashedDottedBorder(i.color,i.width,o,A.curves,3):i.style===4?await this.borderRenderer.renderDoubleBorder(i.color,i.width,o,A.curves):await this.borderRenderer.renderSolidBorder(i.color,o,A.curves)),o++}async render(A){this.options.backgroundColor&&(this.ctx.fillStyle=eA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height));const e=Df(A);return await this.renderStack(e),this.effectsRenderer.applyEffects([]),this.canvas}}const ew=t=>t instanceof ki||t instanceof Vi?!0:t instanceof Lt&&t.type!==Dr&&t.type!==Kr,tw=(t,A)=>{switch(t){case 0:return Nr(A);case 2:return bf(A);default:return _r(A)}},rw=t=>{switch(t){case 1:return"center";case 2:return"right";default:return"left"}};class sw extends fa{constructor(A,e){super(A,e),this.canvas=e.canvas?e.canvas:document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),this.options=e,this.canvas.width=Math.floor(e.width*e.scale),this.canvas.height=Math.floor(e.height*e.scale),this.canvas.style.width=`${e.width}px`,this.canvas.style.height=`${e.height}px`,this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-e.x,-e.y),this.context.logger.debug(`EXPERIMENTAL ForeignObject renderer initialized (${e.width}x${e.height} at ${e.x},${e.y}) with scale ${e.scale}`)}async render(A){const e=qs(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),r=await nw(e);return this.options.backgroundColor&&(this.ctx.fillStyle=eA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),this.canvas}}const nw=t=>new Promise((A,e)=>{const r=new Image;r.onload=()=>{A(r)},r.onerror=e,r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(t))}`});class ha{constructor({id:A,enabled:e}){this.id=A,this.enabled=e,this.start=Date.now()}debug(...A){this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug(this.id,`${this.getTime()}ms`,...A):this.info(...A))}getTime(){return Date.now()-this.start}info(...A){this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info(this.id,`${this.getTime()}ms`,...A)}warn(...A){this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn(this.id,`${this.getTime()}ms`,...A):this.info(...A))}error(...A){this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error(this.id,`${this.getTime()}ms`,...A):this.info(...A))}}ha.instances={};class ow{constructor(A,e){if(this.context=A,this._options=e,this._cache=new Map,this._pendingOperations=new Map,this.maxSize=e.maxCacheSize??100,this.maxSize<1)throw new Error("Cache maxSize must be at least 1");this.maxSize>1e4&&this.context.logger.warn(`Cache maxSize ${this.maxSize} is very large and may cause memory issues. Consider using a smaller value (recommended: 100-1000).`)}addImage(A){const e=this._pendingOperations.get(A);if(e)return e;if(this.has(A)){const r=this._cache.get(A);return r&&(r.lastAccessed=Date.now()),Promise.resolve()}if(un(A)||lw(A)){const r=this._addImageInternal(A);return this._pendingOperations.set(A,r),r.finally(()=>{this._pendingOperations.delete(A)}),r}return Promise.resolve()}async _addImageInternal(A){const e=this._options.imageTimeout??15e3,r=new Promise((n,o)=>{setTimeout(()=>{o(new Error(`Image load timeout after ${e}ms: ${A}`))},e)}),s=Promise.race([this.loadImage(A),r]);s.catch(n=>{this.context.logger.error(`Failed to load image ${A}: ${n instanceof Error?n.message:"Unknown error"}`)}),this.set(A,s)}match(A){const e=this._cache.get(A);if(e)return e.lastAccessed=Date.now(),e.value}set(A,e){if(this._cache.has(A)){const r=this._cache.get(A);r.value=e,r.lastAccessed=Date.now();return}this._cache.size>=this.maxSize&&this.evictLRU(),this._cache.set(A,{value:e,lastAccessed:Date.now()})}evictLRU(){let A=null,e=1/0;for(const[r,s]of this._cache.entries())s.lastAccessed<e&&(e=s.lastAccessed,A=r);A&&(this._cache.delete(A),this.context.logger.debug(`Cache: Evicted LRU entry: ${A}`))}size(){return this._cache.size}getMaxSize(){return this.maxSize}clear(){this._cache.clear()}async loadImage(A){const e=this.context.originChecker,r=a=>e.isSameOrigin(a),s=typeof this._options.customIsSameOrigin=="function"?await this._options.customIsSameOrigin(A,r):r(A),n=!dn(A)&&this._options.useCORS===!0&&FA.SUPPORT_CORS_IMAGES&&!s,o=!dn(A)&&!s&&!un(A)&&typeof this._options.proxy=="string"&&FA.SUPPORT_CORS_XHR&&!n;if(!s&&this._options.allowTaint===!1&&!dn(A)&&!un(A)&&!o&&!n)return;let i=A;return o&&(i=await this.proxy(i)),this.context.logger.debug(`Added image ${A.substring(0,256)}`),await new Promise((a,l)=>{const c=new Image;c.onload=()=>a(c),c.onerror=l,(Bw(i)||n)&&(c.crossOrigin="anonymous"),c.src=i,c.complete===!0&&setTimeout(()=>a(c),500),this._options.imageTimeout>0&&setTimeout(()=>l(`Timed out (${this._options.imageTimeout}ms) loading image`),this._options.imageTimeout)})}has(A){return this._cache.has(A)}keys(){return Promise.resolve(Object.keys(this._cache))}proxy(A){const e=this._options.proxy;if(!e)throw new Error("No proxy defined");const r=A.substring(0,256);return new Promise((s,n)=>{const o=FA.SUPPORT_RESPONSE_TYPE?"blob":"text",i=new XMLHttpRequest;i.onload=()=>{if(i.status===200)if(o==="text")s(i.response);else{const l=new FileReader;l.addEventListener("load",()=>s(l.result),!1),l.addEventListener("error",c=>n(c),!1),l.readAsDataURL(i.response)}else n(`Failed to proxy resource ${r} with status code ${i.status}`)},i.onerror=n;const a=e.indexOf("?")>-1?"&":"?";if(i.open("GET",`${e}${a}url=${encodeURIComponent(A)}&responseType=${o}`),o!=="text"&&i instanceof XMLHttpRequest&&(i.responseType=o),this._options.imageTimeout){const l=this._options.imageTimeout;i.timeout=l,i.ontimeout=()=>n(`Timed out (${l}ms) proxying ${r}`)}i.send()})}}const iw=/^data:image\/svg\+xml/i,aw=/^data:image\/.*;base64,/i,cw=/^data:image\/.*/i,lw=t=>FA.SUPPORT_SVG_DRAWING||!gw(t),dn=t=>cw.test(t),Bw=t=>aw.test(t),un=t=>t.substr(0,4)==="blob",gw=t=>t.substr(-3).toLowerCase()==="svg"||iw.test(t);class dw{constructor(A){if(!A||!A.document)throw new Error("Valid window object required for OriginChecker");if(!A.location||!A.location.href)throw new Error("Window object must have valid location");this.link=A.document.createElement("a"),this.origin=this.getOrigin(A.location.href)}getOrigin(A){return this.link.href=A,this.link.href=this.link.href,this.link.protocol+this.link.hostname+this.link.port}isSameOrigin(A){return this.getOrigin(A)===this.origin}getContextOrigin(){return this.origin}}class Pr{constructor(A,e,r){this.windowBounds=e,this.instanceName=`#${Pr.instanceCount++}`,this.config=r,this.logger=new ha({id:this.instanceName,enabled:A.logging}),this.originChecker=new dw(r.window),this.cache=A.cache??r.cache??new ow(this,A)}}Pr.instanceCount=1;class Nt{constructor(A={}){if(this.window=A.window||(typeof window<"u"?window:null),!this.window)throw new Error("Window object is required but not available");this.cspNonce=A.cspNonce,this.cache=A.cache}static fromElement(A,e={}){const r=A.ownerDocument;if(!r)throw new Error("Element is not attached to a document");const s=r.defaultView;if(!s)throw new Error("Document is not attached to a window");return new Nt({window:s,...e})}clone(A={}){return new Nt({window:A.window||this.window,cspNonce:A.cspNonce??this.cspNonce,cache:A.cache??this.cache})}}function uw(t){console.warn("[html2canvas-pro] setDefaultConfig is deprecated. Pass configuration to html2canvas directly.")}class fw{constructor(A={}){this.config={maxImageTimeout:3e5,allowDataUrls:!0,...A}}validateUrl(A,e="general"){if(!A||typeof A!="string")return{valid:!1,error:"URL must be a non-empty string"};if(A.startsWith("data:"))return this.config.allowDataUrls?{valid:!0,sanitized:A}:{valid:!1,error:"Data URLs are not allowed"};if(A.startsWith("blob:"))return{valid:!0,sanitized:A};try{const r=new URL(A);if(!["http:","https:"].includes(r.protocol))return{valid:!1,error:`Protocol ${r.protocol} is not allowed. Only http and https are permitted.`};if(e==="proxy"&&this.config.allowedProxyDomains&&this.config.allowedProxyDomains.length>0){const s=r.hostname.toLowerCase();if(!this.config.allowedProxyDomains.some(o=>{const i=o.toLowerCase();return s===i||s.endsWith("."+i)}))return{valid:!1,error:`Proxy domain ${r.hostname} is not in the allowed list`}}if(e==="proxy"){if(!this.config.allowLocalhostProxy){const s=r.hostname.toLowerCase();if(s==="localhost"||s==="127.0.0.1"||s==="::1")return{valid:!1,error:"Localhost is not allowed for proxy URLs"};if(this.isPrivateIP(s))return{valid:!1,error:"Private IP addresses are not allowed for proxy URLs"};if(s.startsWith("169.254.")||s.startsWith("fe80:"))return{valid:!1,error:"Link-local addresses are not allowed for proxy URLs"}}return{valid:!0,sanitized:A,requiresRuntimeCheck:!0}}return{valid:!0,sanitized:A}}catch(r){return{valid:!1,error:`Invalid URL format: ${r instanceof Error?r.message:"Unknown error"}`}}}isPrivateIP(A){return[/^0\./,/^10\./,/^100\.(6[4-9]|[7-9][0-9]|1[0-1][0-9]|12[0-7])\./,/^127\./,/^169\.254\./,/^172\.(1[6-9]|2[0-9]|3[0-1])\./,/^192\.0\.0\./,/^192\.0\.2\./,/^192\.168\./,/^198\.(1[8-9])\./,/^198\.51\.100\./,/^203\.0\.113\./,/^2(2[4-9]|3[0-9])\./,/^24[0-9]\./,/^255\.255\.255\.255$/].some(r=>r.test(A))?!0:A.includes(":")?this.isPrivateIPv6(A):!1}isPrivateIPv6(A){const s=A.toLowerCase().trim().replace(/^\[|\]$/g,"").split("%")[0];if(/^(0:){7}1$/.test(s)||s==="::1"||/^(0:){7}0$/.test(s)||s==="::")return!0;const n=this.expandIPv6(s);if(!n)return this.isPrivateIPv6Prefix(s);const o=parseInt(n.substring(0,2),16);if(o>=252&&o<=253)return!0;if(o===254){const i=parseInt(n.substring(2,4),16);if(i>=128&&i<=191)return!0}return o===255}expandIPv6(A){try{if(A.includes("::")){const e=A.split("::");if(e.length>2)return null;const r=e[0]?e[0].split(":"):[],s=e[1]?e[1].split(":"):[],n=8-r.length-s.length;if(n<0)return null;const o=Array(n).fill("0000");return[...r,...o,...s].map(a=>a.padStart(4,"0")).join(":")}else{const e=A.split(":");return e.length!==8?null:e.map(r=>r.padStart(4,"0")).join(":")}}catch{return null}}isPrivateIPv6Prefix(A){return!!(/^fc[0-9a-f]{0,2}:?/i.test(A)||/^fd[0-9a-f]{0,2}:?/i.test(A)||/^fe[89ab][0-9a-f]:?/i.test(A)||/^ff[0-9a-f]{0,2}:?/i.test(A))}validateCspNonce(A){return!A||typeof A!="string"?{valid:!1,error:"CSP nonce must be a non-empty string"}:A.length<16?{valid:!1,error:"CSP nonce is too short (minimum 16 characters recommended)"}:/^[A-Za-z0-9+/=_-]+$/.test(A)?{valid:!0,sanitized:A}:{valid:!1,error:"CSP nonce contains invalid characters"}}validateImageTimeout(A){return typeof A!="number"||isNaN(A)?{valid:!1,error:"Image timeout must be a number"}:A<0?{valid:!1,error:"Image timeout cannot be negative"}:this.config.maxImageTimeout&&A>this.config.maxImageTimeout?{valid:!1,error:`Image timeout ${A}ms exceeds maximum allowed ${this.config.maxImageTimeout}ms`}:{valid:!0,sanitized:A}}validateDimensions(A,e){if(typeof A!="number"||typeof e!="number")return{valid:!1,error:"Dimensions must be numbers"};if(isNaN(A)||isNaN(e))return{valid:!1,error:"Dimensions cannot be NaN"};if(A<=0||e<=0)return{valid:!1,error:"Dimensions must be positive"};const r=32767;return A>r||e>r?{valid:!1,error:`Dimensions exceed maximum allowed (${r}px)`}:{valid:!0,sanitized:{width:A,height:e}}}validateScale(A){return typeof A!="number"||isNaN(A)?{valid:!1,error:"Scale must be a number"}:A<=0?{valid:!1,error:"Scale must be positive"}:A>10?{valid:!1,error:"Scale factor too large (maximum 10x)"}:{valid:!0,sanitized:A}}validateElement(A){return A?typeof A!="object"?{valid:!1,error:"Element must be an object"}:typeof HTMLElement<"u"&&A instanceof HTMLElement?A.ownerDocument?{valid:!0}:{valid:!1,error:"Element must be attached to a document"}:A.ownerDocument?A.ownerDocument.defaultView?{valid:!0}:{valid:!1,error:"Document must be attached to a window (ownerDocument.defaultView required)"}:{valid:!1,error:"Element must be attached to a document (ownerDocument required)"}:{valid:!1,error:"Element is required"}}validateOptions(A){const e=[],r=A.proxy;if(r!=null&&typeof r=="string"&&r.length>0){const s=this.validateUrl(r,"proxy");s.valid||e.push(`Proxy: ${s.error}`)}if(A.imageTimeout!==void 0){const s=this.validateImageTimeout(A.imageTimeout);s.valid||e.push(`Image timeout: ${s.error}`)}if(A.width!==void 0||A.height!==void 0){const s=A.width??800,n=A.height??600,o=this.validateDimensions(s,n);o.valid||e.push(`Dimensions: ${o.error}`)}if(A.scale!==void 0){const s=this.validateScale(A.scale);s.valid||e.push(`Scale: ${s.error}`)}if(A.cspNonce!==void 0){const s=this.validateCspNonce(A.cspNonce);s.valid||e.push(`CSP nonce: ${s.error}`)}if(this.config.customValidator){const s=this.config.customValidator(A,"options");s.valid||e.push(`Custom validation: ${s.error}`)}return e.length>0?{valid:!1,error:e.join("; ")}:{valid:!0}}}function ww(t={}){return new fw({allowDataUrls:!0,maxImageTimeout:3e5,...t})}class hw{constructor(A,e=!0){this.context=A,this.activeMetrics=new Map,this.completedMetrics=[],this.enabled=e,this.getTime=typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now()}start(A,e){this.enabled&&(this.activeMetrics.has(A)&&this.context?.logger.warn(`Performance metric '${A}' already started. Overwriting.`),this.activeMetrics.set(A,{name:A,startTime:this.getTime(),metadata:e}))}end(A){if(!this.enabled)return;const e=this.activeMetrics.get(A);if(!e){this.context?.logger.warn(`Performance metric '${A}' not found. Was start() called?`);return}return e.endTime=this.getTime(),e.duration=e.endTime-e.startTime,this.completedMetrics.push(e),this.activeMetrics.delete(A),this.context?.logger.debug(`⏱️ ${A}: ${e.duration.toFixed(2)}ms`,e.metadata),e}measure(A,e,r){this.start(A,r);try{const s=e();return this.end(A),s}catch(s){throw this.end(A),s}}async measureAsync(A,e,r){this.start(A,r);try{const s=await e();return this.end(A),s}catch(s){throw this.end(A),s}}getMetrics(){return[...this.completedMetrics]}getMetric(A){return this.completedMetrics.find(e=>e.name===A)}getSummary(){const A=this.completedMetrics.reduce((r,s)=>r+(s.duration||0),0),e=this.completedMetrics.map(r=>({name:r.name,duration:r.duration||0,percentage:A>0?((r.duration||0)/A*100).toFixed(1)+"%":"0%"}));return{totalDuration:A,metrics:this.getMetrics(),breakdown:e}}logSummary(){if(!this.enabled||this.completedMetrics.length===0||!this.context)return;const A=this.getSummary();this.context.logger.info(`
12
- 📊 Performance Summary (Total: ${A.totalDuration.toFixed(2)}ms):`),A.breakdown.sort((e,r)=>r.duration-e.duration).forEach(e=>{this.context.logger.info(` ${e.name.padEnd(20)} ${e.duration.toFixed(2).padStart(8)}ms ${e.percentage.padStart(6)}`)})}clear(){this.activeMetrics.clear(),this.completedMetrics.splice(0)}isEnabled(){return this.enabled}getActiveMetrics(){return Array.from(this.activeMetrics.keys())}}const pa=(t,A={},e)=>{const r=e||Nt.fromElement(t,{cspNonce:A.cspNonce,cache:A.cache});return Cw(t,A,r)},pw=t=>{console.warn('[html2canvas-pro] setCspNonce is deprecated. Pass cspNonce in options instead: html2canvas(element, { cspNonce: "..." })'),typeof window<"u"&&uw(new Nt({window,cspNonce:t}))};pa.setCspNonce=pw;const Qw=t=>{["scale","width","height","imageTimeout","x","y","windowWidth","windowHeight","scrollX","scrollY"].forEach(e=>{const r=t[e];if(r!=null&&typeof r!="number"){const s=Number(r);Number.isNaN(s)||(t[e]=s)}})},Cw=async(t,A,e)=>{if(Qw(A),!A.skipValidation){const aA=A.validator||ww(),W=aA.validateElement(t);if(!W.valid)throw new Error(W.error);const bA=aA.validateOptions(A);if(!bA.valid)throw new Error(`Invalid options: ${bA.error}`)}if(!t||typeof t!="object")throw new Error("Invalid element provided as first argument");const r=t.ownerDocument;if(!r)throw new Error("Element is not attached to a Document");const s=r.defaultView;if(!s)throw new Error("Document is not attached to a Window");const n={allowTaint:A.allowTaint??!1,imageTimeout:A.imageTimeout??15e3,proxy:A.proxy,useCORS:A.useCORS??!1,customIsSameOrigin:A.customIsSameOrigin},o={logging:A.logging??!0,cache:A.cache??e.cache,...n},i=800,a=600,l=0,c=s,B={windowWidth:A.windowWidth??c.innerWidth??i,windowHeight:A.windowHeight??c.innerHeight??a,scrollX:A.scrollX??c.pageXOffset??l,scrollY:A.scrollY??c.pageYOffset??l},f=new yA(B.scrollX,B.scrollY,B.windowWidth,B.windowHeight),u=new Pr(o,f,e),h=A.enablePerformanceMonitoring??A.logging??!1,p=new hw(u,h);p.start("total",{width:B.windowWidth,height:B.windowHeight});const C=A.foreignObjectRendering??!1,y={allowTaint:A.allowTaint??!1,onclone:A.onclone,ignoreElements:A.ignoreElements,iframeContainer:A.iframeContainer,inlineImages:C,copyStyles:C,cspNonce:A.cspNonce??e.cspNonce};u.logger.debug(`Starting document clone with size ${f.width}x${f.height} scrolled to ${-f.left},${-f.top}`),p.start("clone");const w=new sa(u,t,y),b=w.clonedReferenceElement;if(!b)throw new Error("Unable to find element in cloned iframe");const H=await w.toIFrame(r,f);p.end("clone");const{width:m,height:D,left:k,top:X}=en(b)||cf(b)?Ic(b.ownerDocument):jt(u,b),K=Uw(u,b,A.backgroundColor),pA={canvas:A.canvas,backgroundColor:K,scale:A.scale??s.devicePixelRatio??1,x:(A.x??0)+k,y:(A.y??0)+X,width:A.width??Math.ceil(m),height:A.height??Math.ceil(D),imageSmoothing:A.imageSmoothing,imageSmoothingQuality:A.imageSmoothingQuality};let dA,Y;try{return C?(u.logger.debug("Document cloned, using foreign object rendering"),p.start("render-foreignobject"),dA=await new sw(u,pA).render(b),p.end("render-foreignobject")):(u.logger.debug(`Document cloned, element located at ${k},${X} with size ${m}x${D} using computed rendering`),u.logger.debug("Starting DOM parsing"),p.start("parse"),Y=Wi(u,b),p.end("parse"),K===Y.styles.backgroundColor&&(Y.styles.backgroundColor=ae.TRANSPARENT),u.logger.debug(`Starting renderer for element at ${pA.x},${pA.y} with size ${pA.width}x${pA.height}`),p.start("render"),dA=await new gn(u,pA).render(Y),p.end("render")),p.start("cleanup"),(A.removeContainer??!0)&&(sa.destroy(H)||u.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),p.end("cleanup"),p.end("total"),u.logger.debug("Finished rendering"),h&&p.logSummary(),dA}finally{Y&&Y.restoreTree()}},Uw=(t,A,e)=>{const r=A.ownerDocument,s=r.documentElement?tt(t,getComputedStyle(r.documentElement).backgroundColor):ae.TRANSPARENT,n=r.body?tt(t,getComputedStyle(r.body).backgroundColor):ae.TRANSPARENT,o=typeof e=="string"?tt(t,e):e===null?ae.TRANSPARENT:4294967295;return A===r.documentElement?He(s)?He(n)?o:n:s:o},_t=2147483647,fn=_t-1,wn=_t-1,Fw=_t-10,mw=_t-5,Ew=_t-15,le="data-vg-pin-id",xw=()=>{const t=window.innerWidth;return t<768?"mobile":t<1024?"tablet":"desktop"},Qa=(t,A)=>{if(!t)return"";try{const e=new Date(t);return isNaN(e.getTime())?"":new Intl.DateTimeFormat(A==="es"?"es-ES":"en-US",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}catch{return""}},Ca=({url:t,className:A,style:e,tooltipStyle:r,onHover:s})=>{const n=U.useRef(null),o=()=>{if(!n.current||!s)return;const i=n.current.getBoundingClientRect(),a=i.top,l=window.innerHeight-i.bottom,c=a<140&&l>a?"bottom":"top";s({url:t,x:i.left+i.width/2,y:c==="top"?i.top:i.bottom,direction:c})};return g.jsxs("div",{ref:n,className:`vg-url-tag ${A||""}`,style:e,onMouseEnter:o,onMouseMove:o,onMouseLeave:()=>s?.(null),children:[g.jsx(Uc,{"data-source-path":"/src/components/ViewGateOverlay.tsx:117",size:e?.fontSize?parseInt(e.fontSize)+1:10}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:118",style:{maxWidth:e?.maxWidth||"150px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:new URL(t).pathname})]})},Gt=t=>{const A=[],e=[],r=[];let s=t;for(;s&&s.nodeType===Node.ELEMENT_NODE;){if(s.id&&!s.id.startsWith("vg-")&&!s.id.includes(":")){A.unshift(`#${s.id}`),r.unshift(`${s.localName}#${s.id}`);break}let n=s.localName;const o=Array.from(s.parentNode?.children||[]).indexOf(s),i=`${s.localName}[${o}]`;r.unshift(i);const a=s.getAttribute("data-testid")||s.getAttribute("data-qa");if(a&&e.push(`[data-testid="${a}"]`),s.getAttribute("placeholder"),s.getAttribute("aria-label"),s.getAttribute("role"),s.getAttribute("name"),s.getAttribute("title"),a){n=`[${s.hasAttribute("data-testid")?"data-testid":"data-qa"}="${a}"]`,A.unshift(n);break}const l=Array.from(s.parentNode?.children||[]).filter(c=>c.localName===s?.localName);if(l.length>1){const c=l.indexOf(s)+1;n+=`:nth-of-type(${c})`}A.unshift(n),s=s.parentElement}return{selector:A.join(" > "),fallbacks:e,vgPath:r.join(" > ")}},yw=t=>{const{vgPath:A}=Gt(t);return{vgPath:A,classHash:t.className,parentTag:t.parentElement?.tagName.toLowerCase(),neighborCount:t.parentElement?.children.length,ariaLabel:t.getAttribute("aria-label")||void 0,role:t.getAttribute("role")||void 0,name:t.getAttribute("name")||void 0,type:t.getAttribute("type")||void 0,placeholder:t.getAttribute("placeholder")||void 0,textSnippet:(t.innerText||"").slice(0,30).trim()}},Hw=(()=>{let t=null,A=null;return e=>{if(!e||typeof window>"u"||typeof document>"u")return e;if(e.includes("oklch")||e.includes("oklab")||e.includes("lab(")||e.includes("lch(")||e.includes("color("))try{if(t||(t=document.createElement("canvas"),t.width=1,t.height=1),A||(A=t.getContext("2d",{willReadFrequently:!0})),A){A.fillStyle="#000000",A.fillStyle=e;const n=A.fillStyle;if(n&&!n.includes("oklch")&&!n.includes("oklab"))return n}const r=document.createElement("div");r.style.color=e,document.body.appendChild(r);const s=getComputedStyle(r).color;return document.body.removeChild(r),s&&!s.includes("oklch")?s:"rgb(0,0,0)"}catch{return"rgb(0,0,0)"}return e}})(),bw=t=>{const A=window.getComputedStyle(t),e={};return["display","position","margin","padding","font-size","color","background-color","width","height","z-index"].forEach(s=>{const n=A.getPropertyValue(s);e[s]=Hw(n)}),e},Iw=t=>{const e=Object.keys(t).find(n=>n.startsWith("__reactFiber$")||n.startsWith("__reactInternalInstance$"));if(!e)return"";const r=[];let s=t[e];for(;s;){const n=s.type;if(typeof n=="function"){const o=n.displayName||n.name;o&&!o.includes("ViewGate")&&!r.includes(o)&&r.unshift(o)}s=s.return}return r.join(" > ")||"Generic Component"},hn=t=>{if(!t||t.id==="viewgate-ui"||t.id==="viewgate-shadow-host"||t.closest("#viewgate-shadow-host"))return!1;if(t.getAttribute("role")==="dialog"||t.getAttribute("aria-modal")==="true"||t.classList.contains("modal")||t.classList.contains("modal-content"))return!0;const A=window.getComputedStyle(t),e=t.getBoundingClientRect(),r=t.getAttribute("role");if(r&&["listbox","menu","combobox","tooltip","option"].includes(r)||e.width<120&&e.height<120)return!1;const n=parseInt(A.zIndex)||0,o=A.position==="fixed"||A.position==="absolute",i=e.width>window.innerWidth*.4&&e.height>window.innerHeight*.4,a=Math.abs(e.left+e.width/2-window.innerWidth/2)<50,l=t.getAttribute("class")||"",c=l.toLowerCase().includes("modal")||l.toLowerCase().includes("dialog");return!!(o&&n>=100&&(i||a||c))},Le=t=>{if(!t.isConnected)return!1;const A=window.getComputedStyle(t);if(A.display==="none"||A.visibility==="hidden"||A.opacity==="0")return t.tagName!=="BODY"&&t.tagName,!1;if(t.offsetWidth===0||t.offsetHeight===0)return!1;let e=t.parentElement;for(;e;){const s=window.getComputedStyle(e);if(s.display==="none"||s.visibility==="hidden"||s.opacity==="0")return!1;e=e.parentElement}const r=t.getBoundingClientRect();return!(r.width===0||r.height===0)},Ua=(t,A=document)=>{const e=A.querySelector(t);if(e)return e;const r=A.querySelectorAll("*");for(const s of Array.from(r)){const n=s.shadowRoot;if(n){const o=Ua(t,n);if(o)return o}}return null},Fa=(t,A)=>{let e=document.elementFromPoint(t,A);for(;e&&e.shadowRoot;){const r=e.shadowRoot.elementFromPoint(t,A);if(!r||r===e)break;e=r}return e},vw=t=>{if(!t.tag)return null;const A=Array.from(document.getElementsByTagName(t.tag));let e=null,r=0;for(const s of A){if(!Xr(s,t))continue;let n=0;const o=s.getAttribute("placeholder"),i=t.attributes?.placeholder||t.fingerprint?.placeholder;i&&o===i&&(n+=6);const a=s.getAttribute("type"),l=t.attributes?.type||t.fingerprint?.type;if(l&&a===l&&(n+=2),s.innerText?.trim()===t.text.trim()&&(n+=5),t.fingerprint?.vgPath){const{vgPath:c}=Gt(s);(c===t.vgPath||t.fingerprint?.vgPath===c)&&(n+=10)}n>r&&n>=7&&(r=n,e=s)}return e},Xr=(t,A)=>{if(t.tagName.toLowerCase()!==A.tag.toLowerCase())return!1;const e=t.getAttribute("placeholder"),r=A.attributes?.placeholder||A.fingerprint?.placeholder;if(r&&e&&r!==e)return!1;const s=t.getAttribute("type"),n=A.attributes?.type||A.fingerprint?.type;return!(n&&s&&n!==s)},ma=(t,A)=>{if(A){const o=Array.from(document.querySelectorAll(`[${le}="${A}"]`));if(o.length>0){const i=o.filter(a=>Xr(a,t));if(i.length===0)o.forEach(a=>a.removeAttribute(le));else{const a=i.find(c=>{const{vgPath:B}=Gt(c);return B===t.vgPath||t.fingerprint?.vgPath===B}),l=a&&Le(a)?a:i.find(c=>!(!Le(c)||t.metadata?.isModal&&!c.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content')));return l?(o.forEach(c=>{c!==l&&c.removeAttribute(le)}),l):null}}}const r=(t.selector?Array.from(document.querySelectorAll(t.selector)):[]).filter(o=>Xr(o,t));let s=r.find(o=>{const{vgPath:i}=Gt(o);return i===t.vgPath||t.fingerprint?.vgPath===i})||r[0]||null;if(s&&Le(s))if(t.metadata?.isModal&&!s.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content'))s=null;else return s;if(t.fallbackSelectors)for(const o of t.fallbackSelectors){const i=Ua(o);if(i&&Xr(i,t)&&Le(i)){if(t.metadata?.isModal&&!i.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content'))continue;return i}}const n=vw(t);return n&&Le(n)?t.metadata?.isModal&&!n.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content')?null:n:null},pn=t=>({tag:t.tagName.toLowerCase(),text:(t.innerText||t.getAttribute("placeholder")||"").slice(0,50).trim(),role:t.getAttribute("role")||void 0,type:t.getAttribute("type")||void 0}),Sw=t=>{const A=t.parentElement;if(!A)return;const e=Array.from(A.children).filter(o=>o!==t).slice(0,5).map(o=>pn(o)),r=Array.from(A.children),s=r.indexOf(t);let n="middle";return s===0&&(n="start"),s===r.length-1&&(n="end"),{target:{...pn(t),location:`${n} of ${A.tagName.toLowerCase()}`},parent:pn(A),siblings:e}},Ea=(t,A)=>{let e="unknown:0",r=t;for(;r;){const f=r.getAttribute("data-source-path");if(f){e=f;break}r=r.parentElement}const s=Iw(t),{selector:n,fallbacks:o,vgPath:i}=Gt(t),a={};["placeholder","aria-label","name","type","alt","title","value","role"].forEach(f=>{const u=t.getAttribute(f);u&&(a[f]=u)});const l=(()=>{let f=t;for(;f&&f!==document.body;){if(hn(f))return!0;f=f.parentElement}return!1})();let c;l&&A&&!A.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content')&&(c=Ea(A));const B=`${t.tagName.toLowerCase()}-${(t.innerText||"").slice(0,20).replace(/\s+/g,"_")}-${n.split(" > ").slice(-1)}`;return{tag:t.tagName.toLowerCase(),id:t.id||"",classes:t.className||"",text:(t.innerText||"").slice(0,100).trim(),selector:n,vgPath:i,outerHtml:t.outerHTML,parentContext:(t.parentElement?.innerText||"").slice(0,150).trim(),componentPath:s,signature:B,source:e,attributes:a,fallbackSelectors:[...new Set(o)].slice(0,5),domPath:[],viewportSize:{width:window.innerWidth,height:window.innerHeight},uiContext:Sw(t),fingerprint:yw(t),metadata:{hint:`Edit ${e.split(":")[0]} at line ${e.split(":")[1]||"?"}`,computedStyles:bw(t),viewportBreakpoint:xw(),outerHtml:t.outerHTML.slice(0,1500),scrollPosition:{x:window.scrollX,y:window.scrollY},isModal:l,triggerReference:c}}},xa=()=>{const{addToast:t,language:A,t:e,apiKey:r,baseUrl:s,disableViewGate:n,hasActiveToasts:o}=no(),i=U.useMemo(()=>typeof window>"u"?!1:window.location.href.includes("viewgate-backlog"),[]),[a,l]=U.useState(typeof window<"u"?window.location.pathname:"/");U.useEffect(()=>{const d=()=>l(window.location.pathname);window.addEventListener("popstate",d);const I=window.history.pushState,F=window.history.replaceState;return window.history.pushState=function(...L){I.apply(this,L),d()},window.history.replaceState=function(...L){F.apply(this,L),d()},()=>{window.removeEventListener("popstate",d),window.history.pushState=I,window.history.replaceState=F}},[]);const[c,B]=U.useState(!1),[f,u]=U.useState("medium"),[h,p]=U.useState("medium"),[C,y]=U.useState("all"),[w,b]=U.useState(null),[H,m]=U.useState(null),[D,k]=U.useState(""),[X,K]=U.useState(!1),[pA,dA]=U.useState(!1),[Y,aA]=U.useState(!1),[W,bA]=U.useState([]),[uA,IA]=U.useState(null),[Pe,lt]=U.useState(!1),[qA,Q]=U.useState({}),[S,V]=U.useState(null),[j,Ae]=U.useState(!1),[vA,z]=U.useState(null),LA=U.useCallback(async d=>{const I=await fetch(d,{headers:{"x-api-key":r}});if(!I.ok)throw new Error("Fetch failed");return I.json()},[r]),Xe=U.useMemo(()=>i?"backlog":"pending,todo,in_progress,review,ready_for_review,bug_fixing",[i]),{data:Te,isLoading:Cn}=jn(r?`${s}/api/projects/active-sprint`:null,LA,{refreshInterval:3e4,revalidateOnFocus:!0}),{data:We,isLoading:Qe,mutate:JA}=jn(r&&(Te||i)?`${s}/api/annotations?status=${Xe}`:null,LA,{refreshInterval:1e4,revalidateOnFocus:!0,dedupingInterval:2e3}),[Be,Un]=U.useState(null),Z=U.useRef(W);Z.current=W;const[M,tA]=U.useState(null),sA=U.useRef(null),[mA,RA]=U.useState([]),oA=U.useMemo(()=>{let d=Array.isArray(W)?W:[];if(d=d.filter(F=>{try{return new URL(F.url).pathname===a}catch{return!0}}),S){const F=mA.find(L=>L.annotations&&Array.isArray(L.annotations)&&L.annotations.some(G=>G._id===S));F?d=F.annotations:d=d.filter(L=>L._id===S)}return d=d.filter(F=>F.status!=="completed"&&F.status!=="done"),window.location.href.includes("viewgate-backlog")||(M==="pending"?d=d.filter(F=>F.status!=="ready_for_review"):M==="ready"&&(d=d.filter(F=>F.status==="ready_for_review"))),C!=="all"&&(d=d.filter(F=>(F.priority||"medium")===C)),d},[S,W,mA,M,C]);U.useEffect(()=>{S&&oA.length===0&&!Qe&&V(null)},[S,oA.length,Qe]);const[QA,Je]=U.useState(()=>{if(typeof window>"u")return{top:24,right:24};const d=localStorage.getItem("vg-exit-pos");return d?JSON.parse(d):{top:24,right:24}}),[ee,Vt]=U.useState(!1),YA=U.useRef(null),[fA,te]=U.useState(()=>{if(typeof window>"u")return{bottom:30,right:30};const d=localStorage.getItem("vg-bar-pos");return d?JSON.parse(d):{bottom:30,right:30}}),[Ce,Wr]=U.useState(!1),kA=U.useRef(null),Kw=d=>{d.preventDefault(),d.stopPropagation();const I=d.currentTarget.parentElement?.getBoundingClientRect();I&&(Vt(!0),YA.current={x:d.clientX,y:d.clientY,top:QA.top,right:QA.right,width:I.width,height:I.height})},Dw=d=>{d.preventDefault(),d.stopPropagation();const I=d.currentTarget.parentElement?.getBoundingClientRect();I&&(Wr(!0),kA.current={x:d.clientX,y:d.clientY,bottom:fA.bottom,right:fA.right,width:I.width,height:I.height})};U.useEffect(()=>{if(!ee&&!Ce)return;const d=F=>{if(ee&&YA.current){const L=F.clientX-YA.current.x,G=F.clientY-YA.current.y;let $=YA.current.top+G,q=YA.current.right-L;const T=10;$=Math.max(T,Math.min(window.innerHeight-YA.current.height-T,$)),q=Math.max(T,Math.min(window.innerWidth-YA.current.width-T,q)),Je({top:$,right:q})}if(Ce&&kA.current){const L=F.clientX-kA.current.x,G=F.clientY-kA.current.y;let $=kA.current.bottom-G,q=kA.current.right-L;const T=10;$=Math.max(T,Math.min(window.innerHeight-kA.current.height-T,$)),q=Math.max(T,Math.min(window.innerWidth-kA.current.width-T,q)),te({bottom:$,right:q})}},I=()=>{ee&&(Vt(!1),localStorage.setItem("vg-exit-pos",JSON.stringify(QA)),YA.current=null),Ce&&(Wr(!1),localStorage.setItem("vg-bar-pos",JSON.stringify(fA)),kA.current=null)};return window.addEventListener("mousemove",d),window.addEventListener("mouseup",I),()=>{window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",I)}},[ee,Ce,QA,fA]);const[Fn,mn]=U.useState(null),[ya,Ha]=U.useState(""),[oh,ih]=U.useState({}),Jr=U.useRef(null),Bt=U.useRef(null),kt=U.useCallback(()=>{typeof window>"u"||(Bt.current&&cancelAnimationFrame(Bt.current),Bt.current=requestAnimationFrame(()=>{Bt.current=null;const d=Z.current,I=Array.isArray(d)?d:[],F=new Set(I.map(AA=>AA._id));document.querySelectorAll(`[${le}]`).forEach(AA=>{const SA=AA.getAttribute(le);SA&&!F.has(SA)&&AA.removeAttribute(le)});const G=Array.from(document.querySelectorAll('[role="dialog"], [aria-modal="true"], .modal, .modal-backdrop, .fixed.inset-0')).find(AA=>hn(AA)&&Le(AA)),$=!!G,q=new Map,T=new Map;I.forEach(AA=>{if(!AA||!AA.reference)return;try{const hA=window.location.pathname;if(new URL(AA.url).pathname!==hA)return}catch{return}const SA=!!AA.reference.metadata?.isModal,re=AA.reference.metadata?.triggerReference;let wA=ma(AA.reference,AA._id),NA=!1;if(re){const hA=ma(re);hA&&Le(hA)&&(wA=hA,NA=!0)}if(!wA||!Le(wA))return;let TA=!1;if($?TA=G.contains(wA):NA?TA=!0:TA=!SA,!TA)return;const ge=wA.getAttribute(le);ge!==AA._id&&(document.querySelectorAll(`[${le}="${AA._id}"]`).forEach(hA=>{hA.removeAttribute(le)}),ge||wA.setAttribute(le,AA._id));const jA=NA?q:T;jA.has(wA)||jA.set(wA,{anns:[]}),jA.get(wA).anns.push(AA)});const EA=[],MA=(AA,SA)=>{AA.forEach((re,wA)=>{const{anns:NA}=re,TA=wA.getBoundingClientRect(),ge=TA.left+TA.width/2,jA=TA.top+TA.height/2;if(ge>=0&&ge<=window.innerWidth&&jA>=0&&jA<=window.innerHeight){const hA=document.elementFromPoint(ge,jA),Ke=document.getElementById("viewgate-shadow-host");if(hA&&!wA.contains(hA)&&hA!==Ke&&!Ke?.contains(hA))return}EA.push({id:NA[0]._id+(SA?"_trig":""),element:wA,rect:TA,annotations:NA.sort((hA,Ke)=>new Date(Ke.timestamp||Ke.createdAt).getTime()-new Date(hA.timestamp||hA.createdAt).getTime()),isModal:!!NA[0].reference?.metadata?.isModal,isTriggerPin:SA})})};MA(q,!0),MA(T,!1),RA(EA)}))},[]);U.useEffect(()=>{if(We){const d=Array.isArray(We)?We:We?.data||[];if(Array.isArray(d)){const I=d.reduce((F,L)=>F.find($=>$._id===L._id)?F:F.concat([L]),[]);bA(I)}}else Qe||bA([])},[We,Qe]),U.useEffect(()=>{z(Te||null)},[Te]),U.useEffect(()=>{Y&&W.length===0&&!Qe&&aA(!1)},[Y,W.length,Qe]),U.useEffect(()=>{kt();const d=new MutationObserver(()=>kt()),I=new ResizeObserver(()=>kt()),F=()=>kt();return d.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),I.observe(document.documentElement),window.addEventListener("scroll",F,!0),()=>{d.disconnect(),I.disconnect(),window.removeEventListener("scroll",F,!0),Bt.current&&cancelAnimationFrame(Bt.current)}},[c,W,kt,Y,S,a]);const En=U.useCallback(d=>{let I=d;for(;I&&I!==document.body;){if(hn(I))return I;I=I.parentElement}return null},[]);U.useEffect(()=>{const d=I=>{const F=I.target;F&&(En(F)||(sA.current=F))};return window.addEventListener("mousedown",d,!0),()=>window.removeEventListener("mousedown",d,!0)},[En]),U.useEffect(()=>{Jr.current=document.getElementById("viewgate-shadow-host")},[]);const xn=U.useCallback(d=>{if(!c||H)return;const I=Fa(d.clientX,d.clientY);if(!I||Jr.current?.contains(I)||I.closest(".vg-no-capture")){b(null);return}const F=I.getBoundingClientRect();b({tag:I.tagName.toLowerCase(),source:I.getAttribute("data-source-path")||"unknown:0",rect:F,element:I,previewText:(I.innerText||"").slice(0,100)||(I.getAttribute("placeholder")||"").slice(0,100)||I.tagName.toLowerCase(),semanticReference:{...Ea(I,sA.current),normalizedOffset:{x:(d.clientX-F.left)/F.width,y:(d.clientY-F.top)/F.height}}})},[c,H]),yn=U.useCallback(async d=>{if(!c||H)return;const I=Fa(d.clientX,d.clientY);if(!(!I||Jr.current?.contains(I)||I.closest(".vg-no-capture"))&&w){d.preventDefault(),d.stopPropagation(),dA(!0);try{const F=w.element,L=F.getBoundingClientRect(),G=En(F)||document.body,$=G.getBoundingClientRect(),q=await pa(G,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff",ignoreElements:SA=>Jr.current?.contains(SA)||SA.id==="viewgate-shadow-host"}),T=document.createElement("canvas"),EA=T.getContext("2d"),MA=L.left-$.left,AA=L.top-$.top;T.width=L.width*2,T.height=L.height*2,EA?(EA.drawImage(q,MA*2,AA*2,L.width*2,L.height*2,0,0,L.width*2,L.height*2),T.toBlob(async SA=>{if(SA){const re=new FileReader;re.onloadend=()=>{m({...w,visualPreview:re.result})},re.readAsDataURL(SA)}else m(w)},"image/webp",.85)):m(w)}catch(F){console.error("Failed to capture high-fidelity preview:",F),m(w)}finally{dA(!1),b(null)}}},[c,w,H]);U.useEffect(()=>{const d=I=>{if(I.key==="Escape"){H?m(null):Y?aA(!1):c&&B(!1);return}const L=(()=>{let q=document.activeElement;for(;q&&q.shadowRoot&&q.shadowRoot.activeElement;)q=q.shadowRoot.activeElement;return q})();if(["input","textarea"].includes((L?.tagName||"").toLowerCase())||L?.isContentEditable)return;const $=I.key.toLowerCase();if($==="c"&&!H&&!Y){if(!(vA&&vA.status!=="closed")&&!i&&!c){t(A==="es"?"No hay un sprint activo. No se pueden generar comentarios.":"No active sprint found. Cannot generate comments.","error");return}B(T=>!T)}$==="v"&&!H&&(W.length>0||Y)&&(aA(q=>!q),Y||B(!1))};return c&&!H?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("keydown",d),window.addEventListener("mousemove",xn,!0),window.addEventListener("click",yn,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("keydown",d),window.removeEventListener("mousemove",xn,!0),window.removeEventListener("click",yn,!0)}},[c,H,Y,W,xn,yn]);const Ow=async()=>{if(!H||!D.trim())return;K(!0);const{semanticReference:d}=H,[I,F]=(d.source||"").split(":"),L=F||"0";try{const G=await fetch(`${s}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":r},body:JSON.stringify({filePath:I,line:parseInt(L),url:window.location.href,title:D.length>50?D.substring(0,50)+"...":D,message:D,status:i?"backlog":"pending",priority:f,screenshot:H.visualPreview,componentName:d.componentPath||H.tag,reference:{...d,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()}})});if(!G.ok){const $=await G.json().catch(()=>({}));throw new Error($.error||"Backend failed")}t(e.success,"success"),m(null),k(""),B(!1),JA()}catch(G){console.error(G);const $=G.message&&G.message!=="Backend failed"?G.message:e.error;t($,"error")}finally{K(!1)}};return g.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1529",className:"vg-container",children:g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1530",className:"vg-no-capture",children:[!o&&g.jsxs("div",{style:{position:"fixed",top:`${QA.top}px`,right:`${QA.right}px`,zIndex:fn+10,display:"flex",alignItems:"center",gap:"8px",transition:ee?"none":"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:[g.jsx("div",{onMouseDown:Kw,style:{width:"20px",height:"32px",borderRadius:"6px",backgroundColor:"rgba(255, 255, 255, 0.85)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"#1e293b",opacity:c?0:1,visibility:c?"hidden":"visible",transition:"all 0.2s",border:"1px solid rgba(0,0,0,0.1)",boxShadow:"0 2px 8px rgba(0,0,0,0.05)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="white",d.currentTarget.style.color="#000000"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.85)",d.currentTarget.style.color="#1e293b"},children:g.jsx(Ao,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1574",size:14})}),g.jsx("button",{onClick:d=>{d.stopPropagation(),IA({title:e.exitConfirmTitle||"Close ViewGate?",message:e.exitConfirmMessage||"Are you sure you want to close ViewGate?",type:"danger",onConfirm:()=>n()})},title:"Cerrar ViewGate",style:{width:"40px",height:"40px",borderRadius:"12px",backgroundColor:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid rgba(0,0,0,0.05)",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",cursor:"pointer",color:"#64748b",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},onMouseEnter:d=>{d.currentTarget.style.transform="scale(1.1) rotate(90deg)",d.currentTarget.style.color="#ef4444",d.currentTarget.style.backgroundColor="white"},onMouseLeave:d=>{d.currentTarget.style.transform="scale(1) rotate(0deg)",d.currentTarget.style.color="#64748b",d.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.9)"},children:g.jsx(ds,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1614",size:20,strokeWidth:2.5})})]}),g.jsxs("div",{style:{position:"fixed",bottom:`${fA.bottom}px`,right:`${fA.right}px`,zIndex:fn,display:"flex",alignItems:"center",gap:"8px",transition:Ce?"none":"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"},id:"viewgate-ui",children:[g.jsx("div",{onMouseDown:Dw,style:{width:"24px",height:"40px",borderRadius:"10px",backgroundColor:"rgba(255, 255, 255, 0.85)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"#1e293b",opacity:c?0:1,visibility:c?"hidden":"visible",transition:"all 0.2s",border:"1px solid rgba(0,0,0,0.1)",boxShadow:"0 2px 8px rgba(0,0,0,0.05)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="white",d.currentTarget.style.color="#000000"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.85)",d.currentTarget.style.color="#1e293b"},className:"vg-animate-slide-up",children:g.jsx(Ao,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1663",size:16})}),g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1666",className:"vg-action-bar vg-animate-slide-up",style:{transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"},children:[g.jsx("button",{onClick:()=>{if(!vA&&!i&&!c){t(A==="es"?"No hay un sprint activo. No se pueden generar comentarios.":"No active sprint found. Cannot generate comments.","error");return}B(!c)},className:"vg-button-primary vg-animate-pop",style:{padding:"12px 24px",background:c?"#ef4444":!vA&&!i?"#94a3b8":void 0,cursor:!vA&&!i&&!c?"not-allowed":"pointer",opacity:!vA&&!i&&!c?.7:1},title:!vA&&!i&&!c?A==="es"?"Requiere sprint activo":"Requires active sprint":"",children:g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1684",style:{display:"flex",alignItems:"center",gap:"10px"},children:[c?g.jsx(ds,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1685",size:20,className:"vg-animate-pop"}):g.jsx(Yt,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1685",size:20,className:"vg-animate-pop"}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1686",children:c?e.exitMode:e.enterMode})]})}),W.length>0&&g.jsxs("button",{onClick:()=>{aA(!Y),B(!1),m(null)},className:"vg-button-ghost vg-animate-pop",style:{animationDelay:"0.1s"},children:[g.jsx(Cc,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1699",size:20}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1700",children:e.viewComments})]})]})]}),pA&&g.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1708",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:fn+1,cursor:"wait"},children:g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1714",className:"vg-glassmorphism",style:{padding:"30px 50px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[g.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1715",className:"vg-spinner"}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1716",style:{fontWeight:600,fontSize:"14px",color:"#000000"},children:"Capturando..."})]})}),c&&!H&&g.jsx("div",{className:"vg-backdrop-blur",style:{opacity:1,clipPath:w?`polygon(
12
+ 📊 Performance Summary (Total: ${A.totalDuration.toFixed(2)}ms):`),A.breakdown.sort((e,r)=>r.duration-e.duration).forEach(e=>{this.context.logger.info(` ${e.name.padEnd(20)} ${e.duration.toFixed(2).padStart(8)}ms ${e.percentage.padStart(6)}`)})}clear(){this.activeMetrics.clear(),this.completedMetrics.splice(0)}isEnabled(){return this.enabled}getActiveMetrics(){return Array.from(this.activeMetrics.keys())}}const pa=(t,A={},e)=>{const r=e||Nt.fromElement(t,{cspNonce:A.cspNonce,cache:A.cache});return Cw(t,A,r)},pw=t=>{console.warn('[html2canvas-pro] setCspNonce is deprecated. Pass cspNonce in options instead: html2canvas(element, { cspNonce: "..." })'),typeof window<"u"&&uw(new Nt({window,cspNonce:t}))};pa.setCspNonce=pw;const Qw=t=>{["scale","width","height","imageTimeout","x","y","windowWidth","windowHeight","scrollX","scrollY"].forEach(e=>{const r=t[e];if(r!=null&&typeof r!="number"){const s=Number(r);Number.isNaN(s)||(t[e]=s)}})},Cw=async(t,A,e)=>{if(Qw(A),!A.skipValidation){const aA=A.validator||ww(),W=aA.validateElement(t);if(!W.valid)throw new Error(W.error);const bA=aA.validateOptions(A);if(!bA.valid)throw new Error(`Invalid options: ${bA.error}`)}if(!t||typeof t!="object")throw new Error("Invalid element provided as first argument");const r=t.ownerDocument;if(!r)throw new Error("Element is not attached to a Document");const s=r.defaultView;if(!s)throw new Error("Document is not attached to a Window");const n={allowTaint:A.allowTaint??!1,imageTimeout:A.imageTimeout??15e3,proxy:A.proxy,useCORS:A.useCORS??!1,customIsSameOrigin:A.customIsSameOrigin},o={logging:A.logging??!0,cache:A.cache??e.cache,...n},i=800,a=600,l=0,c=s,B={windowWidth:A.windowWidth??c.innerWidth??i,windowHeight:A.windowHeight??c.innerHeight??a,scrollX:A.scrollX??c.pageXOffset??l,scrollY:A.scrollY??c.pageYOffset??l},f=new yA(B.scrollX,B.scrollY,B.windowWidth,B.windowHeight),u=new Pr(o,f,e),h=A.enablePerformanceMonitoring??A.logging??!1,p=new hw(u,h);p.start("total",{width:B.windowWidth,height:B.windowHeight});const C=A.foreignObjectRendering??!1,y={allowTaint:A.allowTaint??!1,onclone:A.onclone,ignoreElements:A.ignoreElements,iframeContainer:A.iframeContainer,inlineImages:C,copyStyles:C,cspNonce:A.cspNonce??e.cspNonce};u.logger.debug(`Starting document clone with size ${f.width}x${f.height} scrolled to ${-f.left},${-f.top}`),p.start("clone");const w=new sa(u,t,y),b=w.clonedReferenceElement;if(!b)throw new Error("Unable to find element in cloned iframe");const H=await w.toIFrame(r,f);p.end("clone");const{width:m,height:D,left:k,top:X}=en(b)||cf(b)?Ic(b.ownerDocument):jt(u,b),K=Uw(u,b,A.backgroundColor),pA={canvas:A.canvas,backgroundColor:K,scale:A.scale??s.devicePixelRatio??1,x:(A.x??0)+k,y:(A.y??0)+X,width:A.width??Math.ceil(m),height:A.height??Math.ceil(D),imageSmoothing:A.imageSmoothing,imageSmoothingQuality:A.imageSmoothingQuality};let dA,Y;try{return C?(u.logger.debug("Document cloned, using foreign object rendering"),p.start("render-foreignobject"),dA=await new sw(u,pA).render(b),p.end("render-foreignobject")):(u.logger.debug(`Document cloned, element located at ${k},${X} with size ${m}x${D} using computed rendering`),u.logger.debug("Starting DOM parsing"),p.start("parse"),Y=Wi(u,b),p.end("parse"),K===Y.styles.backgroundColor&&(Y.styles.backgroundColor=ae.TRANSPARENT),u.logger.debug(`Starting renderer for element at ${pA.x},${pA.y} with size ${pA.width}x${pA.height}`),p.start("render"),dA=await new gn(u,pA).render(Y),p.end("render")),p.start("cleanup"),(A.removeContainer??!0)&&(sa.destroy(H)||u.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),p.end("cleanup"),p.end("total"),u.logger.debug("Finished rendering"),h&&p.logSummary(),dA}finally{Y&&Y.restoreTree()}},Uw=(t,A,e)=>{const r=A.ownerDocument,s=r.documentElement?tt(t,getComputedStyle(r.documentElement).backgroundColor):ae.TRANSPARENT,n=r.body?tt(t,getComputedStyle(r.body).backgroundColor):ae.TRANSPARENT,o=typeof e=="string"?tt(t,e):e===null?ae.TRANSPARENT:4294967295;return A===r.documentElement?He(s)?He(n)?o:n:s:o},_t=2147483647,fn=_t-1,wn=_t-1,Fw=_t-10,mw=_t-5,Ew=_t-15,le="data-vg-pin-id",xw=()=>{const t=window.innerWidth;return t<768?"mobile":t<1024?"tablet":"desktop"},Qa=(t,A)=>{if(!t)return"";try{const e=new Date(t);return isNaN(e.getTime())?"":new Intl.DateTimeFormat(A==="es"?"es-ES":"en-US",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}catch{return""}},Ca=({url:t,className:A,style:e,tooltipStyle:r,onHover:s})=>{const n=U.useRef(null),o=()=>{if(!n.current||!s)return;const i=n.current.getBoundingClientRect(),a=i.top,l=window.innerHeight-i.bottom,c=a<140&&l>a?"bottom":"top";s({url:t,x:i.left+i.width/2,y:c==="top"?i.top:i.bottom,direction:c})};return g.jsxs("div",{ref:n,className:`vg-url-tag ${A||""}`,style:e,onMouseEnter:o,onMouseMove:o,onMouseLeave:()=>s?.(null),children:[g.jsx(Uc,{"data-source-path":"/src/components/ViewGateOverlay.tsx:117",size:e?.fontSize?parseInt(e.fontSize)+1:10}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:118",style:{maxWidth:e?.maxWidth||"150px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:new URL(t).pathname})]})},Gt=t=>{const A=[],e=[],r=[];let s=t;for(;s&&s.nodeType===Node.ELEMENT_NODE;){if(s.id&&!s.id.startsWith("vg-")&&!s.id.includes(":")){A.unshift(`#${s.id}`),r.unshift(`${s.localName}#${s.id}`);break}let n=s.localName;const o=Array.from(s.parentNode?.children||[]).indexOf(s),i=`${s.localName}[${o}]`;r.unshift(i);const a=s.getAttribute("data-testid")||s.getAttribute("data-qa");if(a&&e.push(`[data-testid="${a}"]`),s.getAttribute("placeholder"),s.getAttribute("aria-label"),s.getAttribute("role"),s.getAttribute("name"),s.getAttribute("title"),a){n=`[${s.hasAttribute("data-testid")?"data-testid":"data-qa"}="${a}"]`,A.unshift(n);break}const l=Array.from(s.parentNode?.children||[]).filter(c=>c.localName===s?.localName);if(l.length>1){const c=l.indexOf(s)+1;n+=`:nth-of-type(${c})`}A.unshift(n),s=s.parentElement}return{selector:A.join(" > "),fallbacks:e,vgPath:r.join(" > ")}},yw=t=>{const{vgPath:A}=Gt(t);return{vgPath:A,classHash:t.className,parentTag:t.parentElement?.tagName.toLowerCase(),neighborCount:t.parentElement?.children.length,ariaLabel:t.getAttribute("aria-label")||void 0,role:t.getAttribute("role")||void 0,name:t.getAttribute("name")||void 0,type:t.getAttribute("type")||void 0,placeholder:t.getAttribute("placeholder")||void 0,textSnippet:(t.innerText||"").slice(0,30).trim()}},Hw=(()=>{let t=null,A=null;return e=>{if(!e||typeof window>"u"||typeof document>"u")return e;if(e.includes("oklch")||e.includes("oklab")||e.includes("lab(")||e.includes("lch(")||e.includes("color("))try{if(t||(t=document.createElement("canvas"),t.width=1,t.height=1),A||(A=t.getContext("2d",{willReadFrequently:!0})),A){A.fillStyle="#000000",A.fillStyle=e;const n=A.fillStyle;if(n&&!n.includes("oklch")&&!n.includes("oklab"))return n}const r=document.createElement("div");r.style.color=e,document.body.appendChild(r);const s=getComputedStyle(r).color;return document.body.removeChild(r),s&&!s.includes("oklch")?s:"rgb(0,0,0)"}catch{return"rgb(0,0,0)"}return e}})(),bw=t=>{const A=window.getComputedStyle(t),e={};return["display","position","margin","padding","font-size","color","background-color","width","height","z-index"].forEach(s=>{const n=A.getPropertyValue(s);e[s]=Hw(n)}),e},Iw=t=>{const e=Object.keys(t).find(n=>n.startsWith("__reactFiber$")||n.startsWith("__reactInternalInstance$"));if(!e)return"";const r=[];let s=t[e];for(;s;){const n=s.type;if(typeof n=="function"){const o=n.displayName||n.name;o&&!o.includes("ViewGate")&&!r.includes(o)&&r.unshift(o)}s=s.return}return r.join(" > ")||"Generic Component"},hn=t=>{if(!t||t.id==="viewgate-ui"||t.id==="viewgate-shadow-host"||t.closest("#viewgate-shadow-host"))return!1;if(t.getAttribute("role")==="dialog"||t.getAttribute("aria-modal")==="true"||t.classList.contains("modal")||t.classList.contains("modal-content"))return!0;const A=window.getComputedStyle(t),e=t.getBoundingClientRect(),r=t.getAttribute("role");if(r&&["listbox","menu","combobox","tooltip","option"].includes(r)||e.width<120&&e.height<120)return!1;const n=parseInt(A.zIndex)||0,o=A.position==="fixed"||A.position==="absolute",i=e.width>window.innerWidth*.4&&e.height>window.innerHeight*.4,a=Math.abs(e.left+e.width/2-window.innerWidth/2)<50,l=t.getAttribute("class")||"",c=l.toLowerCase().includes("modal")||l.toLowerCase().includes("dialog");return!!(o&&n>=100&&(i||a||c))},Le=t=>{if(!t.isConnected)return!1;const A=window.getComputedStyle(t);if(A.display==="none"||A.visibility==="hidden"||A.opacity==="0")return t.tagName!=="BODY"&&t.tagName,!1;if(t.offsetWidth===0||t.offsetHeight===0)return!1;let e=t.parentElement;for(;e;){const s=window.getComputedStyle(e);if(s.display==="none"||s.visibility==="hidden"||s.opacity==="0")return!1;e=e.parentElement}const r=t.getBoundingClientRect();return!(r.width===0||r.height===0)},Ua=(t,A=document)=>{const e=A.querySelector(t);if(e)return e;const r=A.querySelectorAll("*");for(const s of Array.from(r)){const n=s.shadowRoot;if(n){const o=Ua(t,n);if(o)return o}}return null},Fa=(t,A)=>{let e=document.elementFromPoint(t,A);for(;e&&e.shadowRoot;){const r=e.shadowRoot.elementFromPoint(t,A);if(!r||r===e)break;e=r}return e},vw=t=>{if(!t.tag)return null;const A=Array.from(document.getElementsByTagName(t.tag));let e=null,r=0;for(const s of A){if(!Xr(s,t))continue;let n=0;const o=s.getAttribute("placeholder"),i=t.attributes?.placeholder||t.fingerprint?.placeholder;i&&o===i&&(n+=6);const a=s.getAttribute("type"),l=t.attributes?.type||t.fingerprint?.type;if(l&&a===l&&(n+=2),s.innerText?.trim()===t.text.trim()&&(n+=5),t.fingerprint?.vgPath){const{vgPath:c}=Gt(s);(c===t.vgPath||t.fingerprint?.vgPath===c)&&(n+=10)}n>r&&n>=7&&(r=n,e=s)}return e},Xr=(t,A)=>{if(t.tagName.toLowerCase()!==A.tag.toLowerCase())return!1;const e=t.getAttribute("placeholder"),r=A.attributes?.placeholder||A.fingerprint?.placeholder;if(r&&e&&r!==e)return!1;const s=t.getAttribute("type"),n=A.attributes?.type||A.fingerprint?.type;return!(n&&s&&n!==s)},ma=(t,A)=>{if(A){const o=Array.from(document.querySelectorAll(`[${le}="${A}"]`));if(o.length>0){const i=o.filter(a=>Xr(a,t));if(i.length===0)o.forEach(a=>a.removeAttribute(le));else{const a=i.find(c=>{const{vgPath:B}=Gt(c);return B===t.vgPath||t.fingerprint?.vgPath===B}),l=a&&Le(a)?a:i.find(c=>!(!Le(c)||t.metadata?.isModal&&!c.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content')));return l?(o.forEach(c=>{c!==l&&c.removeAttribute(le)}),l):null}}}const r=(t.selector?Array.from(document.querySelectorAll(t.selector)):[]).filter(o=>Xr(o,t));let s=r.find(o=>{const{vgPath:i}=Gt(o);return i===t.vgPath||t.fingerprint?.vgPath===i})||r[0]||null;if(s&&Le(s))if(t.metadata?.isModal&&!s.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content'))s=null;else return s;if(t.fallbackSelectors)for(const o of t.fallbackSelectors){const i=Ua(o);if(i&&Xr(i,t)&&Le(i)){if(t.metadata?.isModal&&!i.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content'))continue;return i}}const n=vw(t);return n&&Le(n)?t.metadata?.isModal&&!n.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content')?null:n:null},pn=t=>({tag:t.tagName.toLowerCase(),text:(t.innerText||t.getAttribute("placeholder")||"").slice(0,50).trim(),role:t.getAttribute("role")||void 0,type:t.getAttribute("type")||void 0}),Sw=t=>{const A=t.parentElement;if(!A)return;const e=Array.from(A.children).filter(o=>o!==t).slice(0,5).map(o=>pn(o)),r=Array.from(A.children),s=r.indexOf(t);let n="middle";return s===0&&(n="start"),s===r.length-1&&(n="end"),{target:{...pn(t),location:`${n} of ${A.tagName.toLowerCase()}`},parent:pn(A),siblings:e}},Ea=(t,A)=>{let e="unknown:0",r=t;for(;r;){const f=r.getAttribute("data-source-path");if(f){e=f;break}r=r.parentElement}const s=Iw(t),{selector:n,fallbacks:o,vgPath:i}=Gt(t),a={};["placeholder","aria-label","name","type","alt","title","value","role"].forEach(f=>{const u=t.getAttribute(f);u&&(a[f]=u)});const l=(()=>{let f=t;for(;f&&f!==document.body;){if(hn(f))return!0;f=f.parentElement}return!1})();let c;l&&A&&!A.closest('[role="dialog"], [aria-modal="true"], .modal, .modal-content')&&(c=Ea(A));const B=`${t.tagName.toLowerCase()}-${(t.innerText||"").slice(0,20).replace(/\s+/g,"_")}-${n.split(" > ").slice(-1)}`;return{tag:t.tagName.toLowerCase(),id:t.id||"",classes:t.className||"",text:(t.innerText||"").slice(0,100).trim(),selector:n,vgPath:i,outerHtml:t.outerHTML,parentContext:t.parentElement?`<${t.parentElement.tagName.toLowerCase()} ${Array.from(t.parentElement.attributes).map(f=>`${f.name}="${f.value}"`).join(" ").slice(0,500)}>`:"N/A",componentPath:s,signature:B,source:e,attributes:a,fallbackSelectors:[...new Set(o)].slice(0,5),domPath:[],viewportSize:{width:window.innerWidth,height:window.innerHeight},uiContext:Sw(t),fingerprint:yw(t),metadata:{hint:`Edit ${e.split(":")[0]} at line ${e.split(":")[1]||"?"}`,computedStyles:bw(t),viewportBreakpoint:xw(),outerHtml:t.outerHTML.slice(0,1500),scrollPosition:{x:window.scrollX,y:window.scrollY},isModal:l,triggerReference:c}}},xa=()=>{const{addToast:t,language:A,t:e,apiKey:r,baseUrl:s,disableViewGate:n,hasActiveToasts:o}=no(),i=U.useMemo(()=>typeof window>"u"?!1:window.location.href.includes("viewgate-backlog"),[]),[a,l]=U.useState(typeof window<"u"?window.location.pathname:"/");U.useEffect(()=>{const d=()=>l(window.location.pathname);window.addEventListener("popstate",d);const I=window.history.pushState,F=window.history.replaceState;return window.history.pushState=function(...L){I.apply(this,L),d()},window.history.replaceState=function(...L){F.apply(this,L),d()},()=>{window.removeEventListener("popstate",d),window.history.pushState=I,window.history.replaceState=F}},[]);const[c,B]=U.useState(!1),[f,u]=U.useState("medium"),[h,p]=U.useState("medium"),[C,y]=U.useState("all"),[w,b]=U.useState(null),[H,m]=U.useState(null),[D,k]=U.useState(""),[X,K]=U.useState(!1),[pA,dA]=U.useState(!1),[Y,aA]=U.useState(!1),[W,bA]=U.useState([]),[uA,IA]=U.useState(null),[Pe,lt]=U.useState(!1),[qA,Q]=U.useState({}),[S,V]=U.useState(null),[j,Ae]=U.useState(!1),[vA,z]=U.useState(null),LA=U.useCallback(async d=>{const I=await fetch(d,{headers:{"x-api-key":r}});if(!I.ok)throw new Error("Fetch failed");return I.json()},[r]),Xe=U.useMemo(()=>i?"backlog":"pending,todo,in_progress,review,ready_for_review,bug_fixing",[i]),{data:Te,isLoading:Cn}=jn(r?`${s}/api/projects/active-sprint`:null,LA,{refreshInterval:3e4,revalidateOnFocus:!0}),{data:We,isLoading:Qe,mutate:JA}=jn(r&&(Te||i)?`${s}/api/annotations?status=${Xe}`:null,LA,{refreshInterval:1e4,revalidateOnFocus:!0,dedupingInterval:2e3}),[Be,Un]=U.useState(null),Z=U.useRef(W);Z.current=W;const[M,tA]=U.useState(null),sA=U.useRef(null),[mA,RA]=U.useState([]),oA=U.useMemo(()=>{let d=Array.isArray(W)?W:[];if(d=d.filter(F=>{try{return new URL(F.url).pathname===a}catch{return!0}}),S){const F=mA.find(L=>L.annotations&&Array.isArray(L.annotations)&&L.annotations.some(G=>G._id===S));F?d=F.annotations:d=d.filter(L=>L._id===S)}return d=d.filter(F=>F.status!=="completed"&&F.status!=="done"),window.location.href.includes("viewgate-backlog")||(M==="pending"?d=d.filter(F=>F.status!=="ready_for_review"):M==="ready"&&(d=d.filter(F=>F.status==="ready_for_review"))),C!=="all"&&(d=d.filter(F=>(F.priority||"medium")===C)),d},[S,W,mA,M,C]);U.useEffect(()=>{S&&oA.length===0&&!Qe&&V(null)},[S,oA.length,Qe]);const[QA,Je]=U.useState(()=>{if(typeof window>"u")return{top:24,right:24};const d=localStorage.getItem("vg-exit-pos");return d?JSON.parse(d):{top:24,right:24}}),[ee,Vt]=U.useState(!1),YA=U.useRef(null),[fA,te]=U.useState(()=>{if(typeof window>"u")return{bottom:30,right:30};const d=localStorage.getItem("vg-bar-pos");return d?JSON.parse(d):{bottom:30,right:30}}),[Ce,Wr]=U.useState(!1),kA=U.useRef(null),Kw=d=>{d.preventDefault(),d.stopPropagation();const I=d.currentTarget.parentElement?.getBoundingClientRect();I&&(Vt(!0),YA.current={x:d.clientX,y:d.clientY,top:QA.top,right:QA.right,width:I.width,height:I.height})},Dw=d=>{d.preventDefault(),d.stopPropagation();const I=d.currentTarget.parentElement?.getBoundingClientRect();I&&(Wr(!0),kA.current={x:d.clientX,y:d.clientY,bottom:fA.bottom,right:fA.right,width:I.width,height:I.height})};U.useEffect(()=>{if(!ee&&!Ce)return;const d=F=>{if(ee&&YA.current){const L=F.clientX-YA.current.x,G=F.clientY-YA.current.y;let $=YA.current.top+G,q=YA.current.right-L;const T=10;$=Math.max(T,Math.min(window.innerHeight-YA.current.height-T,$)),q=Math.max(T,Math.min(window.innerWidth-YA.current.width-T,q)),Je({top:$,right:q})}if(Ce&&kA.current){const L=F.clientX-kA.current.x,G=F.clientY-kA.current.y;let $=kA.current.bottom-G,q=kA.current.right-L;const T=10;$=Math.max(T,Math.min(window.innerHeight-kA.current.height-T,$)),q=Math.max(T,Math.min(window.innerWidth-kA.current.width-T,q)),te({bottom:$,right:q})}},I=()=>{ee&&(Vt(!1),localStorage.setItem("vg-exit-pos",JSON.stringify(QA)),YA.current=null),Ce&&(Wr(!1),localStorage.setItem("vg-bar-pos",JSON.stringify(fA)),kA.current=null)};return window.addEventListener("mousemove",d),window.addEventListener("mouseup",I),()=>{window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",I)}},[ee,Ce,QA,fA]);const[Fn,mn]=U.useState(null),[ya,Ha]=U.useState(""),[oh,ih]=U.useState({}),Jr=U.useRef(null),Bt=U.useRef(null),kt=U.useCallback(()=>{typeof window>"u"||(Bt.current&&cancelAnimationFrame(Bt.current),Bt.current=requestAnimationFrame(()=>{Bt.current=null;const d=Z.current,I=Array.isArray(d)?d:[],F=new Set(I.map(AA=>AA._id));document.querySelectorAll(`[${le}]`).forEach(AA=>{const SA=AA.getAttribute(le);SA&&!F.has(SA)&&AA.removeAttribute(le)});const G=Array.from(document.querySelectorAll('[role="dialog"], [aria-modal="true"], .modal, .modal-backdrop, .fixed.inset-0')).find(AA=>hn(AA)&&Le(AA)),$=!!G,q=new Map,T=new Map;I.forEach(AA=>{if(!AA||!AA.reference)return;try{const hA=window.location.pathname;if(new URL(AA.url).pathname!==hA)return}catch{return}const SA=!!AA.reference.metadata?.isModal,re=AA.reference.metadata?.triggerReference;let wA=ma(AA.reference,AA._id),NA=!1;if(re){const hA=ma(re);hA&&Le(hA)&&(wA=hA,NA=!0)}if(!wA||!Le(wA))return;let TA=!1;if($?TA=G.contains(wA):NA?TA=!0:TA=!SA,!TA)return;const ge=wA.getAttribute(le);ge!==AA._id&&(document.querySelectorAll(`[${le}="${AA._id}"]`).forEach(hA=>{hA.removeAttribute(le)}),ge||wA.setAttribute(le,AA._id));const jA=NA?q:T;jA.has(wA)||jA.set(wA,{anns:[]}),jA.get(wA).anns.push(AA)});const EA=[],MA=(AA,SA)=>{AA.forEach((re,wA)=>{const{anns:NA}=re,TA=wA.getBoundingClientRect(),ge=TA.left+TA.width/2,jA=TA.top+TA.height/2;if(ge>=0&&ge<=window.innerWidth&&jA>=0&&jA<=window.innerHeight){const hA=document.elementFromPoint(ge,jA),Ke=document.getElementById("viewgate-shadow-host");if(hA&&!wA.contains(hA)&&hA!==Ke&&!Ke?.contains(hA))return}EA.push({id:NA[0]._id+(SA?"_trig":""),element:wA,rect:TA,annotations:NA.sort((hA,Ke)=>new Date(Ke.timestamp||Ke.createdAt).getTime()-new Date(hA.timestamp||hA.createdAt).getTime()),isModal:!!NA[0].reference?.metadata?.isModal,isTriggerPin:SA})})};MA(q,!0),MA(T,!1),RA(EA)}))},[]);U.useEffect(()=>{if(We){const d=Array.isArray(We)?We:We?.data||[];if(Array.isArray(d)){const I=d.reduce((F,L)=>F.find($=>$._id===L._id)?F:F.concat([L]),[]);bA(I)}}else Qe||bA([])},[We,Qe]),U.useEffect(()=>{z(Te||null)},[Te]),U.useEffect(()=>{Y&&W.length===0&&!Qe&&aA(!1)},[Y,W.length,Qe]),U.useEffect(()=>{kt();const d=new MutationObserver(()=>kt()),I=new ResizeObserver(()=>kt()),F=()=>kt();return d.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),I.observe(document.documentElement),window.addEventListener("scroll",F,!0),()=>{d.disconnect(),I.disconnect(),window.removeEventListener("scroll",F,!0),Bt.current&&cancelAnimationFrame(Bt.current)}},[c,W,kt,Y,S,a]);const En=U.useCallback(d=>{let I=d;for(;I&&I!==document.body;){if(hn(I))return I;I=I.parentElement}return null},[]);U.useEffect(()=>{const d=I=>{const F=I.target;F&&(En(F)||(sA.current=F))};return window.addEventListener("mousedown",d,!0),()=>window.removeEventListener("mousedown",d,!0)},[En]),U.useEffect(()=>{Jr.current=document.getElementById("viewgate-shadow-host")},[]);const xn=U.useCallback(d=>{if(!c||H)return;const I=Fa(d.clientX,d.clientY);if(!I||Jr.current?.contains(I)||I.closest(".vg-no-capture")){b(null);return}const F=I.getBoundingClientRect();b({tag:I.tagName.toLowerCase(),source:I.getAttribute("data-source-path")||"unknown:0",rect:F,element:I,previewText:(I.innerText||"").slice(0,100)||(I.getAttribute("placeholder")||"").slice(0,100)||I.tagName.toLowerCase(),semanticReference:{...Ea(I,sA.current),normalizedOffset:{x:(d.clientX-F.left)/F.width,y:(d.clientY-F.top)/F.height}}})},[c,H]),yn=U.useCallback(async d=>{if(!c||H)return;const I=Fa(d.clientX,d.clientY);if(!(!I||Jr.current?.contains(I)||I.closest(".vg-no-capture"))&&w){d.preventDefault(),d.stopPropagation(),dA(!0);try{const F=w.element,L=F.getBoundingClientRect(),G=En(F)||document.body,$=G.getBoundingClientRect(),q=await pa(G,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff",ignoreElements:SA=>Jr.current?.contains(SA)||SA.id==="viewgate-shadow-host"}),T=document.createElement("canvas"),EA=T.getContext("2d"),MA=L.left-$.left,AA=L.top-$.top;T.width=L.width*2,T.height=L.height*2,EA?(EA.drawImage(q,MA*2,AA*2,L.width*2,L.height*2,0,0,L.width*2,L.height*2),T.toBlob(async SA=>{if(SA){const re=new FileReader;re.onloadend=()=>{m({...w,visualPreview:re.result})},re.readAsDataURL(SA)}else m(w)},"image/webp",.85)):m(w)}catch(F){console.error("Failed to capture high-fidelity preview:",F),m(w)}finally{dA(!1),b(null)}}},[c,w,H]);U.useEffect(()=>{const d=I=>{if(I.key==="Escape"){H?m(null):Y?aA(!1):c&&B(!1);return}const L=(()=>{let q=document.activeElement;for(;q&&q.shadowRoot&&q.shadowRoot.activeElement;)q=q.shadowRoot.activeElement;return q})();if(["input","textarea"].includes((L?.tagName||"").toLowerCase())||L?.isContentEditable)return;const $=I.key.toLowerCase();if($==="c"&&!H&&!Y){if(!(vA&&vA.status!=="closed")&&!i&&!c){t(A==="es"?"No hay un sprint activo. No se pueden generar comentarios.":"No active sprint found. Cannot generate comments.","error");return}B(T=>!T)}$==="v"&&!H&&(W.length>0||Y)&&(aA(q=>!q),Y||B(!1))};return c&&!H?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("keydown",d),window.addEventListener("mousemove",xn,!0),window.addEventListener("click",yn,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("keydown",d),window.removeEventListener("mousemove",xn,!0),window.removeEventListener("click",yn,!0)}},[c,H,Y,W,xn,yn]);const Ow=async()=>{if(!H||!D.trim())return;K(!0);const{semanticReference:d}=H,[I,F]=(d.source||"").split(":"),L=F||"0";try{const G=await fetch(`${s}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":r},body:JSON.stringify({filePath:I,line:parseInt(L),url:window.location.href,title:D.length>50?D.substring(0,50)+"...":D,message:D,status:i?"backlog":"pending",priority:f,screenshot:H.visualPreview,componentName:d.componentPath||H.tag,reference:{...d,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()}})});if(!G.ok){const $=await G.json().catch(()=>({}));throw new Error($.error||"Backend failed")}t(e.success,"success"),m(null),k(""),B(!1),JA()}catch(G){console.error(G);const $=G.message&&G.message!=="Backend failed"?G.message:e.error;t($,"error")}finally{K(!1)}};return g.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1529",className:"vg-container",children:g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1530",className:"vg-no-capture",children:[!o&&g.jsxs("div",{style:{position:"fixed",top:`${QA.top}px`,right:`${QA.right}px`,zIndex:fn+10,display:"flex",alignItems:"center",gap:"8px",transition:ee?"none":"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},children:[g.jsx("div",{onMouseDown:Kw,style:{width:"20px",height:"32px",borderRadius:"6px",backgroundColor:"rgba(255, 255, 255, 0.85)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"#1e293b",opacity:c?0:1,visibility:c?"hidden":"visible",transition:"all 0.2s",border:"1px solid rgba(0,0,0,0.1)",boxShadow:"0 2px 8px rgba(0,0,0,0.05)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="white",d.currentTarget.style.color="#000000"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.85)",d.currentTarget.style.color="#1e293b"},children:g.jsx(Ao,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1574",size:14})}),g.jsx("button",{onClick:d=>{d.stopPropagation(),IA({title:e.exitConfirmTitle||"Close ViewGate?",message:e.exitConfirmMessage||"Are you sure you want to close ViewGate?",type:"danger",onConfirm:()=>n()})},title:"Cerrar ViewGate",style:{width:"40px",height:"40px",borderRadius:"12px",backgroundColor:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid rgba(0,0,0,0.05)",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",cursor:"pointer",color:"#64748b",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},onMouseEnter:d=>{d.currentTarget.style.transform="scale(1.1) rotate(90deg)",d.currentTarget.style.color="#ef4444",d.currentTarget.style.backgroundColor="white"},onMouseLeave:d=>{d.currentTarget.style.transform="scale(1) rotate(0deg)",d.currentTarget.style.color="#64748b",d.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.9)"},children:g.jsx(ds,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1614",size:20,strokeWidth:2.5})})]}),g.jsxs("div",{style:{position:"fixed",bottom:`${fA.bottom}px`,right:`${fA.right}px`,zIndex:fn,display:"flex",alignItems:"center",gap:"8px",transition:Ce?"none":"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"},id:"viewgate-ui",children:[g.jsx("div",{onMouseDown:Dw,style:{width:"24px",height:"40px",borderRadius:"10px",backgroundColor:"rgba(255, 255, 255, 0.85)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"grab",color:"#1e293b",opacity:c?0:1,visibility:c?"hidden":"visible",transition:"all 0.2s",border:"1px solid rgba(0,0,0,0.1)",boxShadow:"0 2px 8px rgba(0,0,0,0.05)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="white",d.currentTarget.style.color="#000000"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.85)",d.currentTarget.style.color="#1e293b"},className:"vg-animate-slide-up",children:g.jsx(Ao,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1663",size:16})}),g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1666",className:"vg-action-bar vg-animate-slide-up",style:{transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"},children:[g.jsx("button",{onClick:()=>{if(!vA&&!i&&!c){t(A==="es"?"No hay un sprint activo. No se pueden generar comentarios.":"No active sprint found. Cannot generate comments.","error");return}B(!c)},className:"vg-button-primary vg-animate-pop",style:{padding:"12px 24px",background:c?"#ef4444":!vA&&!i?"#94a3b8":void 0,cursor:!vA&&!i&&!c?"not-allowed":"pointer",opacity:!vA&&!i&&!c?.7:1},title:!vA&&!i&&!c?A==="es"?"Requiere sprint activo":"Requires active sprint":"",children:g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1684",style:{display:"flex",alignItems:"center",gap:"10px"},children:[c?g.jsx(ds,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1685",size:20,className:"vg-animate-pop"}):g.jsx(Yt,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1685",size:20,className:"vg-animate-pop"}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1686",children:c?e.exitMode:e.enterMode})]})}),W.length>0&&g.jsxs("button",{onClick:()=>{aA(!Y),B(!1),m(null)},className:"vg-button-ghost vg-animate-pop",style:{animationDelay:"0.1s"},children:[g.jsx(Cc,{"data-source-path":"/src/components/ViewGateOverlay.tsx:1699",size:20}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1700",children:e.viewComments})]})]})]}),pA&&g.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1708",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:fn+1,cursor:"wait"},children:g.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1714",className:"vg-glassmorphism",style:{padding:"30px 50px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[g.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1715",className:"vg-spinner"}),g.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:1716",style:{fontWeight:600,fontSize:"14px",color:"#000000"},children:"Capturando..."})]})}),c&&!H&&g.jsx("div",{className:"vg-backdrop-blur",style:{opacity:1,clipPath:w?`polygon(
13
13
  0% 0%, 0% 100%, 100% 100%, 100% 0%, 0% 0%,
14
14
  ${w.rect.left}px ${w.rect.top}px,
15
15
  ${w.rect.right}px ${w.rect.top}px,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-wrapper",
3
- "version": "1.10.29",
3
+ "version": "1.10.30",
4
4
  "type": "module",
5
5
  "main": "./dist/viewgate-wrapper.umd.cjs",
6
6
  "module": "./dist/viewgate-wrapper.js",