@hyperframes/shader-transitions 0.8.228 → 0.8.230

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  content: "" !important;
4
4
  display: none !important;
5
5
  }`,pu=function(A){mu(A,"."+fn+Uu+Vs+`
6
- .`+gn+Fu+Vs)},mu=function(A,e){var r=A.ownerDocument;if(r){var t=r.createElement("style");t.textContent=e,A.appendChild(t)}},ko=(function(){function A(){}return A.getOrigin=function(e){var r=A._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),Eu=(function(){function A(e,r){this.context=e,this._options=r,this._cache={}}return A.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(kr(e)||Iu(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return wA(this,void 0,void 0,function(){var r,t,n,s,o=this;return cA(this,function(i){switch(i.label){case 0:return r=ko.isSameOrigin(e),t=!Vr(e)&&this._options.useCORS===!0&&oA.SUPPORT_CORS_IMAGES&&!r,n=!Vr(e)&&!r&&!kr(e)&&typeof this._options.proxy=="string"&&oA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Vr(e)&&!kr(e)&&!n&&!t?[2]:(s=e,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,B){var l=new Image;l.onload=function(){return a(l)},l.onerror=B,(bu(s)||t)&&(l.crossOrigin="anonymous"),l.src=s,l.complete===!0&&setTimeout(function(){return a(l)},500),o._options.imageTimeout>0&&setTimeout(function(){return B("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(s,o){var i=oA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(f){return o(f)},!1),u.readAsDataURL(a.response)}else o("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=o;var B=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+B+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var l=r._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return o("Timed out ("+l+"ms) proxying "+n)}}a.send()})},A})(),vu=/^data:image\/svg\+xml/i,Hu=/^data:image\/.*;base64,/i,yu=/^data:image\/.*/i,Iu=function(A){return oA.SUPPORT_SVG_DRAWING||!xu(A)},Vr=function(A){return yu.test(A)},bu=function(A){return Hu.test(A)},kr=function(A){return A.substr(0,4)==="blob"},xu=function(A){return A.substr(-3).toLowerCase()==="svg"||vu.test(A)},m=(function(){function A(e,r){this.type=0,this.x=e,this.y=r}return A.prototype.add=function(e,r){return new A(this.x+e,this.y+r)},A})(),He=function(A,e,r){return new m(A.x+(e.x-A.x)*r,A.y+(e.y-A.y)*r)},Tt=(function(){function A(e,r,t,n){this.type=1,this.start=e,this.startControl=r,this.endControl=t,this.end=n}return A.prototype.subdivide=function(e,r){var t=He(this.start,this.startControl,e),n=He(this.startControl,this.endControl,e),s=He(this.endControl,this.end,e),o=He(t,n,e),i=He(n,s,e),a=He(o,i,e);return r?new A(this.start,t,o,a):new A(a,i,s,this.end)},A.prototype.add=function(e,r){return new A(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),vA=function(A){return A.type===1},Tu=(function(){function A(e){var r=e.styles,t=e.bounds,n=ze(r.borderTopLeftRadius,t.width,t.height),s=n[0],o=n[1],i=ze(r.borderTopRightRadius,t.width,t.height),a=i[0],B=i[1],l=ze(r.borderBottomRightRadius,t.width,t.height),u=l[0],f=l[1],d=ze(r.borderBottomLeftRadius,t.width,t.height),g=d[0],w=d[1],x=[];x.push((s+a)/t.width),x.push((g+u)/t.width),x.push((o+w)/t.height),x.push((B+f)/t.height);var U=Math.max.apply(Math,x);U>1&&(s/=U,o/=U,a/=U,B/=U,u/=U,f/=U,g/=U,w/=U);var p=t.width-a,E=t.height-f,y=t.width-u,I=t.height-w,C=r.borderTopWidth,b=r.borderRightWidth,_=r.borderBottomWidth,S=r.borderLeftWidth,K=j(r.paddingTop,e.bounds.width),M=j(r.paddingRight,e.bounds.width),J=j(r.paddingBottom,e.bounds.width),R=j(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?z(t.left+S/3,t.top+C/3,s-S/3,o-C/3,Y.TOP_LEFT):new m(t.left+S/3,t.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?z(t.left+p,t.top+C/3,a-b/3,B-C/3,Y.TOP_RIGHT):new m(t.left+t.width-b/3,t.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?z(t.left+y,t.top+E,u-b/3,f-_/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/3,t.top+t.height-_/3),this.bottomLeftBorderDoubleOuterBox=g>0||w>0?z(t.left+S/3,t.top+I,g-S/3,w-_/3,Y.BOTTOM_LEFT):new m(t.left+S/3,t.top+t.height-_/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?z(t.left+S*2/3,t.top+C*2/3,s-S*2/3,o-C*2/3,Y.TOP_LEFT):new m(t.left+S*2/3,t.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?z(t.left+p,t.top+C*2/3,a-b*2/3,B-C*2/3,Y.TOP_RIGHT):new m(t.left+t.width-b*2/3,t.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?z(t.left+y,t.top+E,u-b*2/3,f-_*2/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b*2/3,t.top+t.height-_*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||w>0?z(t.left+S*2/3,t.top+I,g-S*2/3,w-_*2/3,Y.BOTTOM_LEFT):new m(t.left+S*2/3,t.top+t.height-_*2/3),this.topLeftBorderStroke=s>0||o>0?z(t.left+S/2,t.top+C/2,s-S/2,o-C/2,Y.TOP_LEFT):new m(t.left+S/2,t.top+C/2),this.topRightBorderStroke=s>0||o>0?z(t.left+p,t.top+C/2,a-b/2,B-C/2,Y.TOP_RIGHT):new m(t.left+t.width-b/2,t.top+C/2),this.bottomRightBorderStroke=u>0||f>0?z(t.left+y,t.top+E,u-b/2,f-_/2,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/2,t.top+t.height-_/2),this.bottomLeftBorderStroke=g>0||w>0?z(t.left+S/2,t.top+I,g-S/2,w-_/2,Y.BOTTOM_LEFT):new m(t.left+S/2,t.top+t.height-_/2),this.topLeftBorderBox=s>0||o>0?z(t.left,t.top,s,o,Y.TOP_LEFT):new m(t.left,t.top),this.topRightBorderBox=a>0||B>0?z(t.left+p,t.top,a,B,Y.TOP_RIGHT):new m(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||f>0?z(t.left+y,t.top+E,u,f,Y.BOTTOM_RIGHT):new m(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||w>0?z(t.left,t.top+I,g,w,Y.BOTTOM_LEFT):new m(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||o>0?z(t.left+S,t.top+C,Math.max(0,s-S),Math.max(0,o-C),Y.TOP_LEFT):new m(t.left+S,t.top+C),this.topRightPaddingBox=a>0||B>0?z(t.left+Math.min(p,t.width-b),t.top+C,p>t.width+b?0:Math.max(0,a-b),Math.max(0,B-C),Y.TOP_RIGHT):new m(t.left+t.width-b,t.top+C),this.bottomRightPaddingBox=u>0||f>0?z(t.left+Math.min(y,t.width-S),t.top+Math.min(E,t.height-_),Math.max(0,u-b),Math.max(0,f-_),Y.BOTTOM_RIGHT):new m(t.left+t.width-b,t.top+t.height-_),this.bottomLeftPaddingBox=g>0||w>0?z(t.left+S,t.top+Math.min(I,t.height-_),Math.max(0,g-S),Math.max(0,w-_),Y.BOTTOM_LEFT):new m(t.left+S,t.top+t.height-_),this.topLeftContentBox=s>0||o>0?z(t.left+S+R,t.top+C+K,Math.max(0,s-(S+R)),Math.max(0,o-(C+K)),Y.TOP_LEFT):new m(t.left+S+R,t.top+C+K),this.topRightContentBox=a>0||B>0?z(t.left+Math.min(p,t.width+S+R),t.top+C+K,p>t.width+S+R?0:a-S+R,B-(C+K),Y.TOP_RIGHT):new m(t.left+t.width-(b+M),t.top+C+K),this.bottomRightContentBox=u>0||f>0?z(t.left+Math.min(y,t.width-(S+R)),t.top+Math.min(E,t.height+C+K),Math.max(0,u-(b+M)),f-(_+J),Y.BOTTOM_RIGHT):new m(t.left+t.width-(b+M),t.top+t.height-(_+J)),this.bottomLeftContentBox=g>0||w>0?z(t.left+S+R,t.top+I,Math.max(0,g-(S+R)),w-(_+J),Y.BOTTOM_LEFT):new m(t.left+S+R,t.top+t.height-(_+J))}return A})(),Y;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var z=function(A,e,r,t,n){var s=4*((Math.sqrt(2)-1)/3),o=r*s,i=t*s,a=A+r,B=e+t;switch(n){case Y.TOP_LEFT:return new Tt(new m(A,B),new m(A,B-i),new m(a-o,e),new m(a,e));case Y.TOP_RIGHT:return new Tt(new m(A,e),new m(A+o,e),new m(a,B-i),new m(a,B));case Y.BOTTOM_RIGHT:return new Tt(new m(a,e),new m(a,e+i),new m(A+o,B),new m(A,B));case Y.BOTTOM_LEFT:default:return new Tt(new m(a,B),new m(a-o,B),new m(A,e+i),new m(A,e))}},Wt=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Lu=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Jt=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},Su=(function(){function A(e,r,t){this.offsetX=e,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return A})(),Lt=(function(){function A(e,r){this.path=e,this.target=r,this.type=1}return A})(),Ku=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),Du=function(A){return A.type===0},Xo=function(A){return A.type===1},_u=function(A){return A.type===2},ks=function(A,e){return A.length===e.length?A.some(function(r,t){return r===e[t]}):!1},Ru=function(A,e,r,t,n){return A.map(function(s,o){switch(o){case 0:return s.add(e,r);case 1:return s.add(e+t,r);case 2:return s.add(e+t,r+n);case 3:return s.add(e,r+n)}return s})},Wo=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),Jo=(function(){function A(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new Tu(this.container),this.container.styles.opacity<1&&this.effects.push(new Ku(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Su(t,n,s))}if(this.container.styles.overflowX!==0){var o=Wt(this.curves),i=Jt(this.curves);ks(o,i)?this.effects.push(new Lt(o,6)):(this.effects.push(new Lt(o,2)),this.effects.push(new Lt(i,4)))}}return A.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Xo(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var o=Wt(t.curves),i=Jt(t.curves);ks(o,i)||n.unshift(new Lt(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,e)})},A})(),wn=function(A,e,r,t){A.container.elements.forEach(function(n){var s=rA(n.flags,4),o=rA(n.flags,2),i=new Jo(n,A);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||o){var B=s||n.styles.isPositioned()?r:e,l=new Wo(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var f=0;B.negativeZIndex.some(function(g,w){return u>g.element.container.styles.zIndex.order?(f=w,!1):f>0}),B.negativeZIndex.splice(f,0,l)}else if(u>0){var d=0;B.positiveZIndex.some(function(g,w){return u>=g.element.container.styles.zIndex.order?(d=w+1,!1):d>0}),B.positiveZIndex.splice(d,0,l)}else B.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?B.nonPositionedFloats.push(l):B.nonPositionedInlineLevel.push(l);wn(i,l,s?l:r,a)}else n.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),wn(i,e,r,a);rA(n.flags,8)&&Yo(n,a)})},Yo=function(A,e){for(var r=A instanceof cn?A.start:1,t=A instanceof cn?A.reversed:!1,n=0;n<e.length;n++){var s=e[n];s.container instanceof To&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=at(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},Mu=function(A){var e=new Jo(A,null),r=new Wo(e),t=[];return wn(e,r,r,t),Yo(e.container,t),r},Xs=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},Ou=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return yA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Gu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Nu=function(A,e){switch(e){case 0:return St(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return St(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return St(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return St(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},St=function(A,e){var r=[];return vA(A)?r.push(A.subdivide(.5,!1)):r.push(A),vA(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},yA=function(A,e,r,t){var n=[];return vA(A)?n.push(A.subdivide(.5,!1)):n.push(A),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Zo=function(A){var e=A.bounds,r=A.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Yt=function(A){var e=A.styles,r=A.bounds,t=j(e.paddingLeft,r.width),n=j(e.paddingRight,r.width),s=j(e.paddingTop,r.width),o=j(e.paddingBottom,r.width);return r.add(t+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+n),-(e.borderTopWidth+e.borderBottomWidth+s+o))},Pu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Vu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Xr=function(A,e,r){var t=Pu(be(A.styles.backgroundOrigin,e),A),n=Vu(be(A.styles.backgroundClip,e),A),s=ku(be(A.styles.backgroundSize,e),r,t),o=s[0],i=s[1],a=ze(be(A.styles.backgroundPosition,e),t.width-o,t.height-i),B=Xu(be(A.styles.backgroundRepeat,e),a,s,t,n),l=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[B,l,u,o,i]},ye=function(A){return Z(A)&&A.value===Te.AUTO},Kt=function(A){return typeof A=="number"},ku=function(A,e,r){var t=e[0],n=e[1],s=e[2],o=A[0],i=A[1];if(!o)return[0,0];if(tA(o)&&i&&tA(i))return[j(o,r.width),j(i,r.height)];var a=Kt(s);if(Z(o)&&(o.value===Te.CONTAIN||o.value===Te.COVER)){if(Kt(s)){var B=r.width/r.height;return B<s!=(o.value===Te.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var l=Kt(t),u=Kt(n),f=l||u;if(ye(o)&&(!i||ye(i))){if(l&&u)return[t,n];if(!a&&!f)return[r.width,r.height];if(f&&a){var d=l?t:n*s,g=u?n:t/s;return[d,g]}var w=l?t:r.width,x=u?n:r.height;return[w,x]}if(a){var U=0,p=0;return tA(o)?U=j(o,r.width):tA(i)&&(p=j(i,r.height)),ye(o)?U=p*s:(!i||ye(i))&&(p=U/s),[U,p]}var E=null,y=null;if(tA(o)?E=j(o,r.width):i&&tA(i)&&(y=j(i,r.height)),E!==null&&(!i||ye(i))&&(y=l&&u?E/t*n:r.height),y!==null&&ye(o)&&(E=l&&u?y/n*t:r.width),E!==null&&y!==null)return[E,y];throw new Error("Unable to calculate background-size for element")},be=function(A,e){var r=A[e];return typeof r>"u"?A[0]:r},Xu=function(A,e,r,t,n){var s=e[0],o=e[1],i=r[0],a=r[1];switch(A){case 2:return[new m(Math.round(t.left),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(a+t.top+o)),new m(Math.round(t.left),Math.round(a+t.top+o))];case 3:return[new m(Math.round(t.left+s),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.height+t.top)),new m(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new m(Math.round(t.left+s),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o+a)),new m(Math.round(t.left+s),Math.round(t.top+o+a))];default:return[new m(Math.round(n.left),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.height+n.top)),new m(Math.round(n.left),Math.round(n.height+n.top))]}},Wu="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ws="Hidden Text",Ju=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",o.appendChild(t),n.src=Wu,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Ws)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(Ws)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return o.removeChild(t),{baseline:i,middle:a}},A.prototype.getMetrics=function(e,r){var t=e+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,r)),this._data[t]},A})(),qo=(function(){function A(e,r){this.context=e,this.options=r}return A})(),Yu=1e4,Zu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Ju(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return e.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},e.prototype.applyEffect=function(r){this.ctx.save(),_u(r)&&(this.ctx.globalAlpha=r.opacity),Du(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),Xo(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return wA(this,void 0,void 0,function(){return cA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var o=Un(r.text);o.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),n=Af(r.fontFamily).join(", "),s=ct(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},e.prototype.renderTextNode=function(r,t){return wA(this,void 0,void 0,function(){var n,s,o,i,a,B,l,u,f=this;return cA(this,function(d){return n=this.createFontStyle(t),s=n[0],o=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(o,i),B=a.baseline,l=a.middle,u=t.paintOrder,r.textBounds.forEach(function(g){u.forEach(function(w){switch(w){case 0:f.ctx.fillStyle=nA(t.color),f.renderTextWithLetterSpacing(g,t.letterSpacing,B);var x=t.textShadow;x.length&&g.text.trim().length&&(x.slice(0).reverse().forEach(function(U){f.ctx.shadowColor=nA(U.color),f.ctx.shadowOffsetX=U.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=U.offsetY.number*f.options.scale,f.ctx.shadowBlur=U.blur.number,f.renderTextWithLetterSpacing(g,t.letterSpacing,B)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),t.textDecorationLine.length&&(f.ctx.fillStyle=nA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(U){switch(U){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+B),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+l),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=nA(t.webkitTextStrokeColor),f.ctx.lineWidth=t.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+B)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Yt(r),o=Jt(t);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,p,p,B,l,u,f,y,d,g,I,w,x,U,p,E,y,I;return cA(this,function(C){switch(C.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,o=0,i=t.textNodes,C.label=1;case 1:return o<i.length?(a=i[o],[4,this.renderTextNode(a,s)]):[3,4];case 2:C.sent(),C.label=3;case 3:return o++,[3,1];case 4:if(!(t instanceof Io))return[3,8];C.label=5;case 5:return C.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,8];case 7:return C.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof bo&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof xo))return[3,12];C.label=9;case 9:return C.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,12];case 11:return C.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ko&&t.tree?(B=new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,B.render(t.tree)]):[3,14];case 13:l=C.sent(),t.width&&t.height&&this.ctx.drawImage(l,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),C.label=14;case 14:if(t instanceof Fn&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Pt?t.checked&&(this.ctx.save(),this.path([new m(t.bounds.left+u*.39363,t.bounds.top+u*.79),new m(t.bounds.left+u*.16,t.bounds.top+u*.5549),new m(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new m(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new m(t.bounds.left+u*.72983,t.bounds.top+u*.23),new m(t.bounds.left+u*.84,t.bounds.top+u*.34085),new m(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore()):t.type===Vt&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore())),qu(t)&&t.value.length){switch(f=this.createFontStyle(s),y=f[0],d=f[1],g=this.fontMetrics.getMetrics(y,d).baseline,this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=zu(t.styles.textAlign),I=Yt(t),w=0,t.styles.textAlign){case 1:w+=I.width/2;break;case 2:w+=I.width;break}x=I.add(w,0,0,-I.height/2+1),this.ctx.save(),this.path([new m(I.left,I.top),new m(I.left+I.width,I.top),new m(I.left+I.width,I.top+I.height),new m(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new nt(t.value,x),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(U=t.styles.listStyleImage,U.type!==0)return[3,18];p=void 0,E=U.url,C.label=15;case 15:return C.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return p=C.sent(),this.ctx.drawImage(p,t.bounds.left-(p.width+10),t.bounds.top),[3,18];case 17:return C.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(y=this.createFontStyle(s)[0],this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new XA(t.bounds.left,t.bounds.top+j(t.styles.paddingTop,t.bounds.width),t.bounds.width,Qs(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new nt(r.listValue,I),s.letterSpacing,Qs(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),C.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return wA(this,void 0,void 0,function(){var t,n,U,s,o,U,i,a,U,B,l,U,u,f,U,d,g,U,w,x,U;return cA(this,function(p){switch(p.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:p.sent(),t=0,n=r.negativeZIndex,p.label=2;case 2:return t<n.length?(U=n[t],[4,this.renderStack(U)]):[3,5];case 3:p.sent(),p.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:p.sent(),s=0,o=r.nonInlineLevel,p.label=7;case 7:return s<o.length?(U=o[s],[4,this.renderNode(U)]):[3,10];case 8:p.sent(),p.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,p.label=11;case 11:return i<a.length?(U=a[i],[4,this.renderStack(U)]):[3,14];case 12:p.sent(),p.label=13;case 13:return i++,[3,11];case 14:B=0,l=r.nonPositionedInlineLevel,p.label=15;case 15:return B<l.length?(U=l[B],[4,this.renderStack(U)]):[3,18];case 16:p.sent(),p.label=17;case 17:return B++,[3,15];case 18:u=0,f=r.inlineLevel,p.label=19;case 19:return u<f.length?(U=f[u],[4,this.renderNode(U)]):[3,22];case 20:p.sent(),p.label=21;case 21:return u++,[3,19];case 22:d=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return d<g.length?(U=g[d],[4,this.renderStack(U)]):[3,26];case 24:p.sent(),p.label=25;case 25:return d++,[3,23];case 26:w=0,x=r.positiveZIndex,p.label=27;case 27:return w<x.length?(U=x[w],[4,this.renderStack(U)]):[3,30];case 28:p.sent(),p.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var t=this;r.forEach(function(n,s){var o=vA(n)?n.start:n;s===0?t.ctx.moveTo(o.x,o.y):t.ctx.lineTo(o.x,o.y),vA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(r,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},e.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var o=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=o.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},e.prototype.renderBackgroundImage=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a;return cA(this,function(B){switch(B.label){case 0:t=r.styles.backgroundImage.length-1,n=function(l){var u,f,d,K,G,X,R,O,_,g,K,G,X,R,O,w,x,U,p,E,y,I,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA,hA;return cA(this,function(OA){switch(OA.label){case 0:if(l.type!==0)return[3,5];u=void 0,f=l.url,OA.label=1;case 1:return OA.trys.push([1,3,,4]),[4,s.context.cache.match(f)];case 2:return u=OA.sent(),[3,4];case 3:return OA.sent(),s.context.logger.error("Error loading background-image "+f),[3,4];case 4:return u&&(d=Xr(r,t,[u.width,u.height,u.width/u.height]),K=d[0],G=d[1],X=d[2],R=d[3],O=d[4],_=s.ctx.createPattern(s.resizeImage(u,R,O),"repeat"),s.renderRepeat(K,_,G,X)),[3,6];case 5:DB(l)?(g=Xr(r,t,[null,null,null]),K=g[0],G=g[1],X=g[2],R=g[3],O=g[4],w=xB(l.angle,R,O),x=w[0],U=w[1],p=w[2],E=w[3],y=w[4],I=document.createElement("canvas"),I.width=R,I.height=O,C=I.getContext("2d"),b=C.createLinearGradient(U,E,p,y),gs(l.stops,x).forEach(function(WA){return b.addColorStop(WA.stop,nA(WA.color))}),C.fillStyle=b,C.fillRect(0,0,R,O),R>0&&O>0&&(_=s.ctx.createPattern(I,"repeat"),s.renderRepeat(K,_,G,X))):_B(l)&&(S=Xr(r,t,[null,null,null]),K=S[0],M=S[1],J=S[2],R=S[3],O=S[4],eA=l.position.length===0?[dn]:l.position,G=j(eA[0],R),X=j(eA[eA.length-1],O),dA=TB(l,G,X,R,O),aA=dA[0],BA=dA[1],aA>0&&BA>0&&(FA=s.ctx.createRadialGradient(M+G,J+X,0,M+G,J+X,aA),gs(l.stops,aA*2).forEach(function(WA){return FA.addColorStop(WA.stop,nA(WA.color))}),s.path(K),s.ctx.fillStyle=FA,aA!==BA?(MA=r.bounds.left+.5*r.bounds.width,CA=r.bounds.top+.5*r.bounds.height,LA=BA/aA,hA=1/LA,s.ctx.save(),s.ctx.translate(MA,CA),s.ctx.transform(1,0,0,LA,0,0),s.ctx.translate(-MA,-CA),s.ctx.fillRect(M,hA*(J-CA)+CA,R,O*hA),s.ctx.restore()):s.ctx.fill())),OA.label=6;case 6:return t--,[2]}})},s=this,o=0,i=r.styles.backgroundImage.slice(0).reverse(),B.label=1;case 1:return o<i.length?(a=i[o],[5,n(a)]):[3,4];case 2:B.sent(),B.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,t,n){return wA(this,void 0,void 0,function(){return cA(this,function(s){return this.path(Xs(n,t)),this.ctx.fillStyle=nA(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,t,n,s){return wA(this,void 0,void 0,function(){var o,i;return cA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return o=Ou(s,n),this.path(o),this.ctx.fillStyle=nA(r),this.ctx.fill(),i=Gu(s,n),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,B,l,u=this;return cA(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!te(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],o=ju(be(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),te(t.backgroundColor)||(this.ctx.fillStyle=nA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(d){u.ctx.save();var g=Wt(r.curves),w=d.inset?0:Yu,x=Ru(g,-w+(d.inset?1:-1)*d.spread.number,(d.inset?1:-1)*d.spread.number,d.spread.number*(d.inset?-2:2),d.spread.number*(d.inset?-2:2));d.inset?(u.path(g),u.ctx.clip(),u.mask(x)):(u.mask(g),u.ctx.clip(),u.path(x)),u.ctx.shadowOffsetX=d.offsetX.number+w,u.ctx.shadowOffsetY=d.offsetY.number,u.ctx.shadowColor=nA(d.color),u.ctx.shadowBlur=d.blur.number,u.ctx.fillStyle=d.inset?nA(d.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),f.label=2;case 2:i=0,a=0,B=s,f.label=3;case 3:return a<B.length?(l=B[a],l.style!==0&&!te(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,i,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,i,r.curves)];case 10:f.sent(),f.label=11;case 11:i++,f.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,t,n,s,o){return wA(this,void 0,void 0,function(){var i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,C,I,C;return cA(this,function(b){return this.ctx.save(),i=Nu(s,n),a=Xs(s,n),o===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(B=a[0].start.x,l=a[0].start.y):(B=a[0].x,l=a[0].y),vA(a[1])?(u=a[1].end.x,f=a[1].end.y):(u=a[1].x,f=a[1].y),n===0||n===2?d=Math.abs(B-u):d=Math.abs(l-f),this.ctx.beginPath(),o===3?this.formatPath(i):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,w=t<3?t*2:t,o===3&&(g=t,w=t),x=!0,d<=g*2?x=!1:d<=g*2+w?(U=d/(2*g+w),g*=U,w*=U):(p=Math.floor((d+w)/(g+w)),E=(d-p*g)/(p-1),y=(d-(p+1)*g)/p,w=y<=0||Math.abs(w-E)<Math.abs(w-y)?E:y),x&&(o===3?this.ctx.setLineDash([0,g+w]):this.ctx.setLineDash([g,w])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=nA(r),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(vA(a[0])&&(I=a[3],C=a[0],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke()),vA(a[1])&&(I=a[1],C=a[2],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=Mu(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(qo),qu=function(A){return A instanceof So||A instanceof Lo?!0:A instanceof Fn&&A.type!==Vt&&A.type!==Pt},ju=function(A,e){switch(A){case 0:return Wt(e);case 2:return Lu(e);default:return Jt(e)}},zu=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},$u=["-apple-system","system-ui"],Af=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return $u.indexOf(e)===-1}):A},ef=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t,n;return cA(this,function(s){switch(s.label){case 0:return t=Bn(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,tf(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(qo),tf=function(A){return new Promise(function(e,r){var t=new Image;t.onload=function(){e(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},rf=(function(){function A(e){var r=e.id,t=e.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,dt([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),nf=(function(){function A(e,r){var t;this.windowBounds=r,this.instanceName="#"+A.instanceCount++,this.logger=new rf({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new Eu(this,e)}return A.instanceCount=1,A})(),sf=function(A,e){return e===void 0&&(e={}),of(A,e)};typeof window<"u"&&ko.setContext(window);var of=function(A,e){return wA(void 0,void 0,void 0,function(){var r,t,n,s,o,i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,b,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA;return cA(this,function(hA){switch(hA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=A.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(_=e.allowTaint)!==null&&_!==void 0?_:!1,imageTimeout:(S=e.imageTimeout)!==null&&S!==void 0?S:15e3,proxy:e.proxy,useCORS:(K=e.useCORS)!==null&&K!==void 0?K:!1},s=Jr({logging:(M=e.logging)!==null&&M!==void 0?M:!0,cache:e.cache},n),o={windowWidth:(J=e.windowWidth)!==null&&J!==void 0?J:t.innerWidth,windowHeight:(R=e.windowHeight)!==null&&R!==void 0?R:t.innerHeight,scrollX:(O=e.scrollX)!==null&&O!==void 0?O:t.pageXOffset,scrollY:(eA=e.scrollY)!==null&&eA!==void 0?eA:t.pageYOffset},i=new XA(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),a=new nf(s,i),B=(G=e.foreignObjectRendering)!==null&&G!==void 0?G:!1,l={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:B,copyStyles:B},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Ps(a,A,l),f=u.clonedReferenceElement,f?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=hA.sent(),g=pn(f)||iu(f)?Ri(f.ownerDocument):Zt(a,f),w=g.width,x=g.height,U=g.left,p=g.top,E=af(a,f,e.backgroundColor),y={canvas:e.canvas,backgroundColor:E,scale:(aA=(dA=e.scale)!==null&&dA!==void 0?dA:t.devicePixelRatio)!==null&&aA!==void 0?aA:1,x:((BA=e.x)!==null&&BA!==void 0?BA:0)+U,y:((FA=e.y)!==null&&FA!==void 0?FA:0)+p,width:(MA=e.width)!==null&&MA!==void 0?MA:Math.ceil(w),height:(CA=e.height)!==null&&CA!==void 0?CA:Math.ceil(x)},B?(a.logger.debug("Document cloned, using foreign object rendering"),b=new ef(a,y),[4,b.render(f)]):[3,3];case 2:return I=hA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+U+","+p+" with size "+w+"x"+x+" using computed rendering"),a.logger.debug("Starting DOM parsing"),C=_o(a,f),E===C.styles.backgroundColor&&(C.styles.backgroundColor=kA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+y.x+","+y.y+" with size "+y.width+"x"+y.height),b=new Zu(a,y),[4,b.render(C)];case 4:I=hA.sent(),hA.label=5;case 5:return(!((LA=e.removeContainer)!==null&&LA!==void 0)||LA)&&(Ps.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,I]}})})},af=function(A,e,r){var t=e.ownerDocument,n=t.documentElement?tt(A,getComputedStyle(t.documentElement).backgroundColor):kA.TRANSPARENT,s=t.body?tt(A,getComputedStyle(t.body).backgroundColor):kA.TRANSPARENT,o=typeof r=="string"?tt(A,r):r===null?kA.TRANSPARENT:4294967295;return e===t.documentElement?te(n)?te(s)?o:s:n:o},jo=sf;var zo=!1,Bf=new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]);function cf(){if(zo)return;zo=!0;let A=CanvasRenderingContext2D.prototype.createPattern;CanvasRenderingContext2D.prototype.createPattern=function(e,r){return e&&"width"in e&&"height"in e&&(e.width===0||e.height===0)?null:A.call(this,e,r)}}function Ai(){cf()}function ei(A){A.style.opacity="1",fe(A,"important"),A.querySelectorAll("[data-start]").forEach(e=>fe(e,"important"))}function lf(A,e){if(!A.id)return;let r=e.getElementById(A.id);r instanceof HTMLElement&&ei(r)}function uf(A){let e=A.ownerDocument.defaultView;e&&[A,...Array.from(A.querySelectorAll("*"))].forEach(r=>{if(Bf.has(r.tagName))return;let t=e.getComputedStyle(r);if(t.boxShadow==="none"||t.transform==="none")return;let n=A.ownerDocument.createElement("div");n.setAttribute("data-hyper-shader-shadow-shim",""),n.style.cssText=["position:absolute","inset:0","border-radius:inherit",`box-shadow:${t.boxShadow}`,"background:transparent","pointer-events:none","z-index:0"].join(";"),t.position==="static"&&(r.style.position="relative"),r.style.boxShadow="none",r.insertBefore(n,r.firstChild)})}function lt(){if(typeof document>"u")return!1;let A=document.createElement("canvas");if(A.setAttribute("layoutsubtree",""),!("layoutSubtree"in A))return!1;let e=A.getContext("2d");return e!=null&&typeof e.drawElementImage=="function"}async function ff(A,e,r,t,n){let s=document.createElement("canvas");s.width=r,s.height=t,s.setAttribute("layoutsubtree",""),s.style.cssText=`position:fixed;top:0;left:0;width:${r}px;height:${t}px;z-index:-9999;pointer-events:none;opacity:0`;let o=A.cloneNode(!0);n.forceVisible&&ei(o),s.appendChild(o),document.body.appendChild(s);try{await new Promise(l=>requestAnimationFrame(()=>requestAnimationFrame(()=>l())));let i=s.getContext("2d");i.fillStyle=e,i.fillRect(0,0,r,t);let a=s.firstElementChild;a&&i.drawElementImage(a,0,0,r,t);let B=document.createElement("canvas");return B.width=r,B.height=t,B.getContext("2d").drawImage(s,0,0),s.remove(),B}catch(i){throw s.remove(),i}}function ti(A,e,r=we,t=Qe,n={}){return lt()&&!n.preferBrowserPaint?ff(A,e,r,t,n).catch(()=>$o(A,e,r,t,n)):$o(A,e,r,t,n)}function $o(A,e,r,t,n={}){let s=o=>jo(A,{width:r,height:t,scale:n.scale??1,backgroundColor:e,logging:!1,foreignObjectRendering:o,useCORS:!0,allowTaint:!0,onclone:i=>{if(!A.id)return;let a=i.getElementById(A.id);a instanceof HTMLElement&&uf(a),n.forceVisible&&lf(A,i)},ignoreElements:i=>i.tagName==="CANVAS"||i.hasAttribute("data-no-capture")});return n.preferBrowserPaint===!0?s(!0).catch(()=>s(!1)):s(!1)}var sr="__hf-page-side-compositor",mn="__hf_page_compositor_v1__";function gf(A,e){let r=A.querySelectorAll("*"),t=e.querySelectorAll("*"),n=[[A,e]];r.forEach((i,a)=>n.push([i,t[a]]));let s=e,o=A;for(let i=A.parentElement;i&&i!==document.body&&i!==document.documentElement;i=i.parentElement){let a=i.cloneNode(!1);a.appendChild(s),n.push([i,a]),s=a,o=i}return{root:s,liveRoot:o,pairs:n}}function wf(A,e,r){let t=new Map;r.forEach(([o,i],a)=>{t.set(o,a),t.set(i,a)});let n=o=>{if(!("animationName"in o))return null;let i=o.effect;return`${t.get(i.target)}|${i.pseudoElement??""}|${o.animationName}`},s=new Map;for(let o of A.getAnimations({subtree:!0})){let i=n(o);i&&s.set(i,o.currentTime)}for(let o of e.getAnimations({subtree:!0})){let i=n(o);if(!i)continue;let a=s.get(i);a===void 0?o.cancel():(o.pause(),o.currentTime=a)}}function En(){if(typeof window>"u"||typeof document>"u"||!lt())return!1;let A=document.createElement("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl");return e?(e.getExtension("WEBGL_lose_context")?.loseContext(),!0):!1}function or(A){if(typeof window>"u")return!1;if(window.__HF_PAGE_COMPOSITOR_CANARY__=mn,!En())return console.warn("[HyperShader] page-side compositing requested but drawElementImage/WebGL is not available; falling back to opacity-flip mode (Node-side layered pipeline will handle the blend)."),!1;if(document.getElementById(sr))return!0;let{scenes:e,transitions:r,accentColors:t,width:n,height:s,defaultDuration:o}=A,i=document.createElement("canvas");i.id=sr,i.width=n,i.height=s,i.style.cssText="position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483646;pointer-events:none;display:none;",document.body.appendChild(i);let a=de(i,n,s);if(!a)return console.warn("[HyperShader] page-side compositor: WebGL context unavailable."),i.remove(),!1;let B=Ce(a),l=new Map;for(let K of r)if(K.shader!==void 0&&!l.has(K.shader))try{l.set(K.shader,he(a,Fe(K.shader)))}catch(M){console.warn(`[HyperShader] page-side compositor: failed to compile "${K.shader}":`,M)}let u=[];for(let K=0;K<r.length;K++){let M=r[K];if(!M||M.shader===void 0)continue;let J=e[K],R=e[K+1],O=l.get(M.shader);!J||!R||!O||u.push({time:M.time,duration:M.duration??o,shader:M.shader,fromSceneId:J,toSceneId:R,prog:O})}if(u.length===0)return i.remove(),!1;let f=SA(a),d=SA(a),g=document.createElement("canvas"),w=document.createElement("canvas");for(let K of[g,w])K.width=n,K.height=s,K.setAttribute("layoutsubtree",""),K.style.cssText="position:fixed;top:0;left:0;width:"+n+"px;height:"+s+"px;z-index:-9998;pointer-events:none;",document.body.appendChild(K);function x(K){for(let M of u)if(K>=M.time&&K<=M.time+M.duration)return M;return null}let U=null,p=0,E=window;async function y(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=document.getElementById(K.fromSceneId),J=document.getElementById(K.toSceneId);if(!(M instanceof HTMLElement)||!(J instanceof HTMLElement))return E.__hf_page_composite_pending=!1,!1;for(;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);for(let[O,eA]of[[M,g],[J,w]]){let G=O.cloneNode(!0);G.style.opacity="1",fe(G),G.querySelectorAll("[data-start]").forEach(FA=>{FA.style.opacity="1",fe(FA)});let{root:X,liveRoot:dA,pairs:aA}=gf(O,G),BA=document.createElement("div");BA.style.cssText=`position:absolute;left:0;top:0;width:${n}px;height:${s}px;margin:0;`,BA.appendChild(X),eA.appendChild(BA),wf(dA,X,aA)}let R=[];for(let O of[g,w])for(let eA of O.querySelectorAll("img"))eA.src&&eA.src.startsWith("data:")&&typeof eA.decode=="function"&&R.push(eA.decode().catch(()=>{}));return R.length>0&&await Promise.all(R),!0}function I(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=g.firstElementChild,J=w.firstElementChild;if(!M||!J)return E.__hf_page_composite_pending=!1,!1;let R=g.getContext("2d"),O=w.getContext("2d");if(!R?.drawElementImage||!O?.drawElementImage)return E.__hf_page_composite_pending=!1,!1;let eA=[[R,M],[O,J]];try{for(let[G,X]of eA)G.fillStyle=A.bgColor,G.fillRect(0,0,n,s),G.drawElementImage(X,0,0,n,s);NA(a,f,g),NA(a,d,w)}catch(G){return console.warn("[HyperShader] page-side compositor: scene capture failed:",G),i.style.display="none",E.__hf_page_composite_pending=!1,!1}finally{for(let[G]of eA)G.clearRect(0,0,n,s)}try{Ue(a,B,K.prog,f,d,p,t,n,s),i.style.display="block"}catch(G){console.warn("[HyperShader] page-side compositor: renderShader failed:",G),i.style.display="none"}return E.__hf_page_composite_pending=!1,!0}E.__hf_page_composite_resolve=I,E.__hf_page_composite_prepare=y;let C=window,b=()=>{if(!C.__hf)return;let K=C.__hf.seek;if(typeof K!="function")return;let M=J=>{let R=K.call(C.__hf,J),O=x(J);if(!O){for(i.style.display="none",E.__hf_page_composite_pending=!1;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);return R}return U=O,p=O.duration===0?1:Math.min(1,Math.max(0,(J-O.time)/O.duration)),E.__hf_page_composite_pending=!0,R};C.__hf.seek=M},_=0,S=window.setInterval(()=>{_+=1,C.__hf?.seek?(b(),window.clearInterval(S)):_>200&&(window.clearInterval(S),console.warn("[HyperShader] page-side compositor: window.__hf.seek never appeared after 10s; the engine bridge did not initialize. Falling back to opacity-flip mode."))},50);return!0}var Br=.7,Hn="power2.inOut",Qf="attribute vec2 a_pos; varying vec2 v_uv; void main(){v_uv=a_pos*0.5+0.5; gl_Position=vec4(a_pos,0,1);}",ir=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"],df="hyper-shader-preview-cache",RA="frames",Cf=1,hf="v1",ri=2,ni=1.25,Uf=1200;function Ff(A){let e=A.replace("#","");if(e.length<6)return[.5,.5,.5];let r=parseInt(e.slice(0,2),16)/255,t=parseInt(e.slice(2,4),16)/255,n=parseInt(e.slice(4,6),16)/255;return Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n)?[.5,.5,.5]:[r,t,n]}function ui(A){let[e,r,t]=Ff(A);return{accent:[e,r,t],dark:[e*.35,r*.35,t*.35],bright:[Math.min(1,e*1.5+.2),Math.min(1,r*1.5+.2),Math.min(1,t*1.5+.2)]}}function le(A,e,r){return Math.min(r,Math.max(e,A))}function pf(A,e){return A===void 0?e:Number.isFinite(A)&&A>0?A:e}var mf="__hf_shader_capture_scale",Ef="__hf_shader_loading";function fi(A,e){let r=window[A];if(typeof r=="string")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r);try{return new URLSearchParams(window.location.search).get(e)}catch{return null}}function vf(){let A=fi("__HF_SHADER_CAPTURE_SCALE",mf),e=A===null?NaN:Number(A);return le(Number.isFinite(e)&&e>0?e:1,.25,1)}function Hf(){let A=fi("__HF_SHADER_LOADING",Ef)?.trim().toLowerCase();return A==="player"||A==="true"||A==="1"?"player":A==="none"||A==="false"||A==="0"||A==="off"?"none":"internal"}function lr(A){let e=2166136261;for(let r=0;r<A.length;r+=1)e^=A.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}function yf(A){let e=Array.from(A.querySelectorAll("style")).map(t=>t.textContent||"").join(`
6
+ .`+gn+Fu+Vs)},mu=function(A,e){var r=A.ownerDocument;if(r){var t=r.createElement("style");t.textContent=e,A.appendChild(t)}},ko=(function(){function A(){}return A.getOrigin=function(e){var r=A._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),Eu=(function(){function A(e,r){this.context=e,this._options=r,this._cache={}}return A.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(kr(e)||Iu(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return wA(this,void 0,void 0,function(){var r,t,n,s,o=this;return cA(this,function(i){switch(i.label){case 0:return r=ko.isSameOrigin(e),t=!Vr(e)&&this._options.useCORS===!0&&oA.SUPPORT_CORS_IMAGES&&!r,n=!Vr(e)&&!r&&!kr(e)&&typeof this._options.proxy=="string"&&oA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Vr(e)&&!kr(e)&&!n&&!t?[2]:(s=e,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,B){var l=new Image;l.onload=function(){return a(l)},l.onerror=B,(bu(s)||t)&&(l.crossOrigin="anonymous"),l.src=s,l.complete===!0&&setTimeout(function(){return a(l)},500),o._options.imageTimeout>0&&setTimeout(function(){return B("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(s,o){var i=oA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(f){return o(f)},!1),u.readAsDataURL(a.response)}else o("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=o;var B=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+B+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var l=r._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return o("Timed out ("+l+"ms) proxying "+n)}}a.send()})},A})(),vu=/^data:image\/svg\+xml/i,Hu=/^data:image\/.*;base64,/i,yu=/^data:image\/.*/i,Iu=function(A){return oA.SUPPORT_SVG_DRAWING||!xu(A)},Vr=function(A){return yu.test(A)},bu=function(A){return Hu.test(A)},kr=function(A){return A.substr(0,4)==="blob"},xu=function(A){return A.substr(-3).toLowerCase()==="svg"||vu.test(A)},m=(function(){function A(e,r){this.type=0,this.x=e,this.y=r}return A.prototype.add=function(e,r){return new A(this.x+e,this.y+r)},A})(),He=function(A,e,r){return new m(A.x+(e.x-A.x)*r,A.y+(e.y-A.y)*r)},Tt=(function(){function A(e,r,t,n){this.type=1,this.start=e,this.startControl=r,this.endControl=t,this.end=n}return A.prototype.subdivide=function(e,r){var t=He(this.start,this.startControl,e),n=He(this.startControl,this.endControl,e),s=He(this.endControl,this.end,e),o=He(t,n,e),i=He(n,s,e),a=He(o,i,e);return r?new A(this.start,t,o,a):new A(a,i,s,this.end)},A.prototype.add=function(e,r){return new A(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),vA=function(A){return A.type===1},Tu=(function(){function A(e){var r=e.styles,t=e.bounds,n=ze(r.borderTopLeftRadius,t.width,t.height),s=n[0],o=n[1],i=ze(r.borderTopRightRadius,t.width,t.height),a=i[0],B=i[1],l=ze(r.borderBottomRightRadius,t.width,t.height),u=l[0],f=l[1],d=ze(r.borderBottomLeftRadius,t.width,t.height),g=d[0],w=d[1],x=[];x.push((s+a)/t.width),x.push((g+u)/t.width),x.push((o+w)/t.height),x.push((B+f)/t.height);var U=Math.max.apply(Math,x);U>1&&(s/=U,o/=U,a/=U,B/=U,u/=U,f/=U,g/=U,w/=U);var p=t.width-a,E=t.height-f,y=t.width-u,I=t.height-w,C=r.borderTopWidth,b=r.borderRightWidth,_=r.borderBottomWidth,S=r.borderLeftWidth,K=j(r.paddingTop,e.bounds.width),M=j(r.paddingRight,e.bounds.width),J=j(r.paddingBottom,e.bounds.width),R=j(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?z(t.left+S/3,t.top+C/3,s-S/3,o-C/3,Y.TOP_LEFT):new m(t.left+S/3,t.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?z(t.left+p,t.top+C/3,a-b/3,B-C/3,Y.TOP_RIGHT):new m(t.left+t.width-b/3,t.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?z(t.left+y,t.top+E,u-b/3,f-_/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/3,t.top+t.height-_/3),this.bottomLeftBorderDoubleOuterBox=g>0||w>0?z(t.left+S/3,t.top+I,g-S/3,w-_/3,Y.BOTTOM_LEFT):new m(t.left+S/3,t.top+t.height-_/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?z(t.left+S*2/3,t.top+C*2/3,s-S*2/3,o-C*2/3,Y.TOP_LEFT):new m(t.left+S*2/3,t.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?z(t.left+p,t.top+C*2/3,a-b*2/3,B-C*2/3,Y.TOP_RIGHT):new m(t.left+t.width-b*2/3,t.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?z(t.left+y,t.top+E,u-b*2/3,f-_*2/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b*2/3,t.top+t.height-_*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||w>0?z(t.left+S*2/3,t.top+I,g-S*2/3,w-_*2/3,Y.BOTTOM_LEFT):new m(t.left+S*2/3,t.top+t.height-_*2/3),this.topLeftBorderStroke=s>0||o>0?z(t.left+S/2,t.top+C/2,s-S/2,o-C/2,Y.TOP_LEFT):new m(t.left+S/2,t.top+C/2),this.topRightBorderStroke=s>0||o>0?z(t.left+p,t.top+C/2,a-b/2,B-C/2,Y.TOP_RIGHT):new m(t.left+t.width-b/2,t.top+C/2),this.bottomRightBorderStroke=u>0||f>0?z(t.left+y,t.top+E,u-b/2,f-_/2,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/2,t.top+t.height-_/2),this.bottomLeftBorderStroke=g>0||w>0?z(t.left+S/2,t.top+I,g-S/2,w-_/2,Y.BOTTOM_LEFT):new m(t.left+S/2,t.top+t.height-_/2),this.topLeftBorderBox=s>0||o>0?z(t.left,t.top,s,o,Y.TOP_LEFT):new m(t.left,t.top),this.topRightBorderBox=a>0||B>0?z(t.left+p,t.top,a,B,Y.TOP_RIGHT):new m(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||f>0?z(t.left+y,t.top+E,u,f,Y.BOTTOM_RIGHT):new m(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||w>0?z(t.left,t.top+I,g,w,Y.BOTTOM_LEFT):new m(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||o>0?z(t.left+S,t.top+C,Math.max(0,s-S),Math.max(0,o-C),Y.TOP_LEFT):new m(t.left+S,t.top+C),this.topRightPaddingBox=a>0||B>0?z(t.left+Math.min(p,t.width-b),t.top+C,p>t.width+b?0:Math.max(0,a-b),Math.max(0,B-C),Y.TOP_RIGHT):new m(t.left+t.width-b,t.top+C),this.bottomRightPaddingBox=u>0||f>0?z(t.left+Math.min(y,t.width-S),t.top+Math.min(E,t.height-_),Math.max(0,u-b),Math.max(0,f-_),Y.BOTTOM_RIGHT):new m(t.left+t.width-b,t.top+t.height-_),this.bottomLeftPaddingBox=g>0||w>0?z(t.left+S,t.top+Math.min(I,t.height-_),Math.max(0,g-S),Math.max(0,w-_),Y.BOTTOM_LEFT):new m(t.left+S,t.top+t.height-_),this.topLeftContentBox=s>0||o>0?z(t.left+S+R,t.top+C+K,Math.max(0,s-(S+R)),Math.max(0,o-(C+K)),Y.TOP_LEFT):new m(t.left+S+R,t.top+C+K),this.topRightContentBox=a>0||B>0?z(t.left+Math.min(p,t.width+S+R),t.top+C+K,p>t.width+S+R?0:a-S+R,B-(C+K),Y.TOP_RIGHT):new m(t.left+t.width-(b+M),t.top+C+K),this.bottomRightContentBox=u>0||f>0?z(t.left+Math.min(y,t.width-(S+R)),t.top+Math.min(E,t.height+C+K),Math.max(0,u-(b+M)),f-(_+J),Y.BOTTOM_RIGHT):new m(t.left+t.width-(b+M),t.top+t.height-(_+J)),this.bottomLeftContentBox=g>0||w>0?z(t.left+S+R,t.top+I,Math.max(0,g-(S+R)),w-(_+J),Y.BOTTOM_LEFT):new m(t.left+S+R,t.top+t.height-(_+J))}return A})(),Y;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var z=function(A,e,r,t,n){var s=4*((Math.sqrt(2)-1)/3),o=r*s,i=t*s,a=A+r,B=e+t;switch(n){case Y.TOP_LEFT:return new Tt(new m(A,B),new m(A,B-i),new m(a-o,e),new m(a,e));case Y.TOP_RIGHT:return new Tt(new m(A,e),new m(A+o,e),new m(a,B-i),new m(a,B));case Y.BOTTOM_RIGHT:return new Tt(new m(a,e),new m(a,e+i),new m(A+o,B),new m(A,B));case Y.BOTTOM_LEFT:default:return new Tt(new m(a,B),new m(a-o,B),new m(A,e+i),new m(A,e))}},Wt=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Lu=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Jt=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},Su=(function(){function A(e,r,t){this.offsetX=e,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return A})(),Lt=(function(){function A(e,r){this.path=e,this.target=r,this.type=1}return A})(),Ku=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),Du=function(A){return A.type===0},Xo=function(A){return A.type===1},_u=function(A){return A.type===2},ks=function(A,e){return A.length===e.length?A.some(function(r,t){return r===e[t]}):!1},Ru=function(A,e,r,t,n){return A.map(function(s,o){switch(o){case 0:return s.add(e,r);case 1:return s.add(e+t,r);case 2:return s.add(e+t,r+n);case 3:return s.add(e,r+n)}return s})},Wo=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),Jo=(function(){function A(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new Tu(this.container),this.container.styles.opacity<1&&this.effects.push(new Ku(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Su(t,n,s))}if(this.container.styles.overflowX!==0){var o=Wt(this.curves),i=Jt(this.curves);ks(o,i)?this.effects.push(new Lt(o,6)):(this.effects.push(new Lt(o,2)),this.effects.push(new Lt(i,4)))}}return A.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Xo(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var o=Wt(t.curves),i=Jt(t.curves);ks(o,i)||n.unshift(new Lt(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,e)})},A})(),wn=function(A,e,r,t){A.container.elements.forEach(function(n){var s=rA(n.flags,4),o=rA(n.flags,2),i=new Jo(n,A);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||o){var B=s||n.styles.isPositioned()?r:e,l=new Wo(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var f=0;B.negativeZIndex.some(function(g,w){return u>g.element.container.styles.zIndex.order?(f=w,!1):f>0}),B.negativeZIndex.splice(f,0,l)}else if(u>0){var d=0;B.positiveZIndex.some(function(g,w){return u>=g.element.container.styles.zIndex.order?(d=w+1,!1):d>0}),B.positiveZIndex.splice(d,0,l)}else B.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?B.nonPositionedFloats.push(l):B.nonPositionedInlineLevel.push(l);wn(i,l,s?l:r,a)}else n.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),wn(i,e,r,a);rA(n.flags,8)&&Yo(n,a)})},Yo=function(A,e){for(var r=A instanceof cn?A.start:1,t=A instanceof cn?A.reversed:!1,n=0;n<e.length;n++){var s=e[n];s.container instanceof To&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=at(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},Mu=function(A){var e=new Jo(A,null),r=new Wo(e),t=[];return wn(e,r,r,t),Yo(e.container,t),r},Xs=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},Ou=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return yA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Gu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Nu=function(A,e){switch(e){case 0:return St(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return St(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return St(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return St(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},St=function(A,e){var r=[];return vA(A)?r.push(A.subdivide(.5,!1)):r.push(A),vA(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},yA=function(A,e,r,t){var n=[];return vA(A)?n.push(A.subdivide(.5,!1)):n.push(A),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Zo=function(A){var e=A.bounds,r=A.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Yt=function(A){var e=A.styles,r=A.bounds,t=j(e.paddingLeft,r.width),n=j(e.paddingRight,r.width),s=j(e.paddingTop,r.width),o=j(e.paddingBottom,r.width);return r.add(t+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+n),-(e.borderTopWidth+e.borderBottomWidth+s+o))},Pu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Vu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Xr=function(A,e,r){var t=Pu(be(A.styles.backgroundOrigin,e),A),n=Vu(be(A.styles.backgroundClip,e),A),s=ku(be(A.styles.backgroundSize,e),r,t),o=s[0],i=s[1],a=ze(be(A.styles.backgroundPosition,e),t.width-o,t.height-i),B=Xu(be(A.styles.backgroundRepeat,e),a,s,t,n),l=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[B,l,u,o,i]},ye=function(A){return Z(A)&&A.value===Te.AUTO},Kt=function(A){return typeof A=="number"},ku=function(A,e,r){var t=e[0],n=e[1],s=e[2],o=A[0],i=A[1];if(!o)return[0,0];if(tA(o)&&i&&tA(i))return[j(o,r.width),j(i,r.height)];var a=Kt(s);if(Z(o)&&(o.value===Te.CONTAIN||o.value===Te.COVER)){if(Kt(s)){var B=r.width/r.height;return B<s!=(o.value===Te.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var l=Kt(t),u=Kt(n),f=l||u;if(ye(o)&&(!i||ye(i))){if(l&&u)return[t,n];if(!a&&!f)return[r.width,r.height];if(f&&a){var d=l?t:n*s,g=u?n:t/s;return[d,g]}var w=l?t:r.width,x=u?n:r.height;return[w,x]}if(a){var U=0,p=0;return tA(o)?U=j(o,r.width):tA(i)&&(p=j(i,r.height)),ye(o)?U=p*s:(!i||ye(i))&&(p=U/s),[U,p]}var E=null,y=null;if(tA(o)?E=j(o,r.width):i&&tA(i)&&(y=j(i,r.height)),E!==null&&(!i||ye(i))&&(y=l&&u?E/t*n:r.height),y!==null&&ye(o)&&(E=l&&u?y/n*t:r.width),E!==null&&y!==null)return[E,y];throw new Error("Unable to calculate background-size for element")},be=function(A,e){var r=A[e];return typeof r>"u"?A[0]:r},Xu=function(A,e,r,t,n){var s=e[0],o=e[1],i=r[0],a=r[1];switch(A){case 2:return[new m(Math.round(t.left),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(a+t.top+o)),new m(Math.round(t.left),Math.round(a+t.top+o))];case 3:return[new m(Math.round(t.left+s),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.height+t.top)),new m(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new m(Math.round(t.left+s),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o+a)),new m(Math.round(t.left+s),Math.round(t.top+o+a))];default:return[new m(Math.round(n.left),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.height+n.top)),new m(Math.round(n.left),Math.round(n.height+n.top))]}},Wu="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ws="Hidden Text",Ju=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",o.appendChild(t),n.src=Wu,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Ws)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(Ws)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return o.removeChild(t),{baseline:i,middle:a}},A.prototype.getMetrics=function(e,r){var t=e+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,r)),this._data[t]},A})(),qo=(function(){function A(e,r){this.context=e,this.options=r}return A})(),Yu=1e4,Zu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Ju(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return e.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},e.prototype.applyEffect=function(r){this.ctx.save(),_u(r)&&(this.ctx.globalAlpha=r.opacity),Du(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),Xo(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return wA(this,void 0,void 0,function(){return cA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var o=Un(r.text);o.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),n=Af(r.fontFamily).join(", "),s=ct(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},e.prototype.renderTextNode=function(r,t){return wA(this,void 0,void 0,function(){var n,s,o,i,a,B,l,u,f=this;return cA(this,function(d){return n=this.createFontStyle(t),s=n[0],o=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(o,i),B=a.baseline,l=a.middle,u=t.paintOrder,r.textBounds.forEach(function(g){u.forEach(function(w){switch(w){case 0:f.ctx.fillStyle=nA(t.color),f.renderTextWithLetterSpacing(g,t.letterSpacing,B);var x=t.textShadow;x.length&&g.text.trim().length&&(x.slice(0).reverse().forEach(function(U){f.ctx.shadowColor=nA(U.color),f.ctx.shadowOffsetX=U.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=U.offsetY.number*f.options.scale,f.ctx.shadowBlur=U.blur.number,f.renderTextWithLetterSpacing(g,t.letterSpacing,B)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),t.textDecorationLine.length&&(f.ctx.fillStyle=nA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(U){switch(U){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+B),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+l),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=nA(t.webkitTextStrokeColor),f.ctx.lineWidth=t.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+B)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Yt(r),o=Jt(t);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,p,p,B,l,u,f,y,d,g,I,w,x,U,p,E,y,I;return cA(this,function(C){switch(C.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,o=0,i=t.textNodes,C.label=1;case 1:return o<i.length?(a=i[o],[4,this.renderTextNode(a,s)]):[3,4];case 2:C.sent(),C.label=3;case 3:return o++,[3,1];case 4:if(!(t instanceof Io))return[3,8];C.label=5;case 5:return C.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,8];case 7:return C.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof bo&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof xo))return[3,12];C.label=9;case 9:return C.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,12];case 11:return C.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ko&&t.tree?(B=new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,B.render(t.tree)]):[3,14];case 13:l=C.sent(),t.width&&t.height&&this.ctx.drawImage(l,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),C.label=14;case 14:if(t instanceof Fn&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Pt?t.checked&&(this.ctx.save(),this.path([new m(t.bounds.left+u*.39363,t.bounds.top+u*.79),new m(t.bounds.left+u*.16,t.bounds.top+u*.5549),new m(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new m(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new m(t.bounds.left+u*.72983,t.bounds.top+u*.23),new m(t.bounds.left+u*.84,t.bounds.top+u*.34085),new m(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore()):t.type===Vt&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore())),qu(t)&&t.value.length){switch(f=this.createFontStyle(s),y=f[0],d=f[1],g=this.fontMetrics.getMetrics(y,d).baseline,this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=zu(t.styles.textAlign),I=Yt(t),w=0,t.styles.textAlign){case 1:w+=I.width/2;break;case 2:w+=I.width;break}x=I.add(w,0,0,-I.height/2+1),this.ctx.save(),this.path([new m(I.left,I.top),new m(I.left+I.width,I.top),new m(I.left+I.width,I.top+I.height),new m(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new nt(t.value,x),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(U=t.styles.listStyleImage,U.type!==0)return[3,18];p=void 0,E=U.url,C.label=15;case 15:return C.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return p=C.sent(),this.ctx.drawImage(p,t.bounds.left-(p.width+10),t.bounds.top),[3,18];case 17:return C.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(y=this.createFontStyle(s)[0],this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new XA(t.bounds.left,t.bounds.top+j(t.styles.paddingTop,t.bounds.width),t.bounds.width,Qs(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new nt(r.listValue,I),s.letterSpacing,Qs(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),C.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return wA(this,void 0,void 0,function(){var t,n,U,s,o,U,i,a,U,B,l,U,u,f,U,d,g,U,w,x,U;return cA(this,function(p){switch(p.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:p.sent(),t=0,n=r.negativeZIndex,p.label=2;case 2:return t<n.length?(U=n[t],[4,this.renderStack(U)]):[3,5];case 3:p.sent(),p.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:p.sent(),s=0,o=r.nonInlineLevel,p.label=7;case 7:return s<o.length?(U=o[s],[4,this.renderNode(U)]):[3,10];case 8:p.sent(),p.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,p.label=11;case 11:return i<a.length?(U=a[i],[4,this.renderStack(U)]):[3,14];case 12:p.sent(),p.label=13;case 13:return i++,[3,11];case 14:B=0,l=r.nonPositionedInlineLevel,p.label=15;case 15:return B<l.length?(U=l[B],[4,this.renderStack(U)]):[3,18];case 16:p.sent(),p.label=17;case 17:return B++,[3,15];case 18:u=0,f=r.inlineLevel,p.label=19;case 19:return u<f.length?(U=f[u],[4,this.renderNode(U)]):[3,22];case 20:p.sent(),p.label=21;case 21:return u++,[3,19];case 22:d=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return d<g.length?(U=g[d],[4,this.renderStack(U)]):[3,26];case 24:p.sent(),p.label=25;case 25:return d++,[3,23];case 26:w=0,x=r.positiveZIndex,p.label=27;case 27:return w<x.length?(U=x[w],[4,this.renderStack(U)]):[3,30];case 28:p.sent(),p.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var t=this;r.forEach(function(n,s){var o=vA(n)?n.start:n;s===0?t.ctx.moveTo(o.x,o.y):t.ctx.lineTo(o.x,o.y),vA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(r,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},e.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var o=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=o.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},e.prototype.renderBackgroundImage=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a;return cA(this,function(B){switch(B.label){case 0:t=r.styles.backgroundImage.length-1,n=function(l){var u,f,d,K,G,X,R,O,_,g,K,G,X,R,O,w,x,U,p,E,y,I,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA,hA;return cA(this,function(OA){switch(OA.label){case 0:if(l.type!==0)return[3,5];u=void 0,f=l.url,OA.label=1;case 1:return OA.trys.push([1,3,,4]),[4,s.context.cache.match(f)];case 2:return u=OA.sent(),[3,4];case 3:return OA.sent(),s.context.logger.error("Error loading background-image "+f),[3,4];case 4:return u&&(d=Xr(r,t,[u.width,u.height,u.width/u.height]),K=d[0],G=d[1],X=d[2],R=d[3],O=d[4],_=s.ctx.createPattern(s.resizeImage(u,R,O),"repeat"),s.renderRepeat(K,_,G,X)),[3,6];case 5:DB(l)?(g=Xr(r,t,[null,null,null]),K=g[0],G=g[1],X=g[2],R=g[3],O=g[4],w=xB(l.angle,R,O),x=w[0],U=w[1],p=w[2],E=w[3],y=w[4],I=document.createElement("canvas"),I.width=R,I.height=O,C=I.getContext("2d"),b=C.createLinearGradient(U,E,p,y),gs(l.stops,x).forEach(function(WA){return b.addColorStop(WA.stop,nA(WA.color))}),C.fillStyle=b,C.fillRect(0,0,R,O),R>0&&O>0&&(_=s.ctx.createPattern(I,"repeat"),s.renderRepeat(K,_,G,X))):_B(l)&&(S=Xr(r,t,[null,null,null]),K=S[0],M=S[1],J=S[2],R=S[3],O=S[4],eA=l.position.length===0?[dn]:l.position,G=j(eA[0],R),X=j(eA[eA.length-1],O),dA=TB(l,G,X,R,O),aA=dA[0],BA=dA[1],aA>0&&BA>0&&(FA=s.ctx.createRadialGradient(M+G,J+X,0,M+G,J+X,aA),gs(l.stops,aA*2).forEach(function(WA){return FA.addColorStop(WA.stop,nA(WA.color))}),s.path(K),s.ctx.fillStyle=FA,aA!==BA?(MA=r.bounds.left+.5*r.bounds.width,CA=r.bounds.top+.5*r.bounds.height,LA=BA/aA,hA=1/LA,s.ctx.save(),s.ctx.translate(MA,CA),s.ctx.transform(1,0,0,LA,0,0),s.ctx.translate(-MA,-CA),s.ctx.fillRect(M,hA*(J-CA)+CA,R,O*hA),s.ctx.restore()):s.ctx.fill())),OA.label=6;case 6:return t--,[2]}})},s=this,o=0,i=r.styles.backgroundImage.slice(0).reverse(),B.label=1;case 1:return o<i.length?(a=i[o],[5,n(a)]):[3,4];case 2:B.sent(),B.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,t,n){return wA(this,void 0,void 0,function(){return cA(this,function(s){return this.path(Xs(n,t)),this.ctx.fillStyle=nA(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,t,n,s){return wA(this,void 0,void 0,function(){var o,i;return cA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return o=Ou(s,n),this.path(o),this.ctx.fillStyle=nA(r),this.ctx.fill(),i=Gu(s,n),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,B,l,u=this;return cA(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!te(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],o=ju(be(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),te(t.backgroundColor)||(this.ctx.fillStyle=nA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(d){u.ctx.save();var g=Wt(r.curves),w=d.inset?0:Yu,x=Ru(g,-w+(d.inset?1:-1)*d.spread.number,(d.inset?1:-1)*d.spread.number,d.spread.number*(d.inset?-2:2),d.spread.number*(d.inset?-2:2));d.inset?(u.path(g),u.ctx.clip(),u.mask(x)):(u.mask(g),u.ctx.clip(),u.path(x)),u.ctx.shadowOffsetX=d.offsetX.number+w,u.ctx.shadowOffsetY=d.offsetY.number,u.ctx.shadowColor=nA(d.color),u.ctx.shadowBlur=d.blur.number,u.ctx.fillStyle=d.inset?nA(d.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),f.label=2;case 2:i=0,a=0,B=s,f.label=3;case 3:return a<B.length?(l=B[a],l.style!==0&&!te(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,i,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,i,r.curves)];case 10:f.sent(),f.label=11;case 11:i++,f.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,t,n,s,o){return wA(this,void 0,void 0,function(){var i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,C,I,C;return cA(this,function(b){return this.ctx.save(),i=Nu(s,n),a=Xs(s,n),o===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(B=a[0].start.x,l=a[0].start.y):(B=a[0].x,l=a[0].y),vA(a[1])?(u=a[1].end.x,f=a[1].end.y):(u=a[1].x,f=a[1].y),n===0||n===2?d=Math.abs(B-u):d=Math.abs(l-f),this.ctx.beginPath(),o===3?this.formatPath(i):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,w=t<3?t*2:t,o===3&&(g=t,w=t),x=!0,d<=g*2?x=!1:d<=g*2+w?(U=d/(2*g+w),g*=U,w*=U):(p=Math.floor((d+w)/(g+w)),E=(d-p*g)/(p-1),y=(d-(p+1)*g)/p,w=y<=0||Math.abs(w-E)<Math.abs(w-y)?E:y),x&&(o===3?this.ctx.setLineDash([0,g+w]):this.ctx.setLineDash([g,w])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=nA(r),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(vA(a[0])&&(I=a[3],C=a[0],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke()),vA(a[1])&&(I=a[1],C=a[2],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=Mu(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(qo),qu=function(A){return A instanceof So||A instanceof Lo?!0:A instanceof Fn&&A.type!==Vt&&A.type!==Pt},ju=function(A,e){switch(A){case 0:return Wt(e);case 2:return Lu(e);default:return Jt(e)}},zu=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},$u=["-apple-system","system-ui"],Af=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return $u.indexOf(e)===-1}):A},ef=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t,n;return cA(this,function(s){switch(s.label){case 0:return t=Bn(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,tf(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(qo),tf=function(A){return new Promise(function(e,r){var t=new Image;t.onload=function(){e(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},rf=(function(){function A(e){var r=e.id,t=e.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,dt([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),nf=(function(){function A(e,r){var t;this.windowBounds=r,this.instanceName="#"+A.instanceCount++,this.logger=new rf({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new Eu(this,e)}return A.instanceCount=1,A})(),sf=function(A,e){return e===void 0&&(e={}),of(A,e)};typeof window<"u"&&ko.setContext(window);var of=function(A,e){return wA(void 0,void 0,void 0,function(){var r,t,n,s,o,i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,b,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA;return cA(this,function(hA){switch(hA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=A.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(_=e.allowTaint)!==null&&_!==void 0?_:!1,imageTimeout:(S=e.imageTimeout)!==null&&S!==void 0?S:15e3,proxy:e.proxy,useCORS:(K=e.useCORS)!==null&&K!==void 0?K:!1},s=Jr({logging:(M=e.logging)!==null&&M!==void 0?M:!0,cache:e.cache},n),o={windowWidth:(J=e.windowWidth)!==null&&J!==void 0?J:t.innerWidth,windowHeight:(R=e.windowHeight)!==null&&R!==void 0?R:t.innerHeight,scrollX:(O=e.scrollX)!==null&&O!==void 0?O:t.pageXOffset,scrollY:(eA=e.scrollY)!==null&&eA!==void 0?eA:t.pageYOffset},i=new XA(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),a=new nf(s,i),B=(G=e.foreignObjectRendering)!==null&&G!==void 0?G:!1,l={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:B,copyStyles:B},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Ps(a,A,l),f=u.clonedReferenceElement,f?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=hA.sent(),g=pn(f)||iu(f)?Ri(f.ownerDocument):Zt(a,f),w=g.width,x=g.height,U=g.left,p=g.top,E=af(a,f,e.backgroundColor),y={canvas:e.canvas,backgroundColor:E,scale:(aA=(dA=e.scale)!==null&&dA!==void 0?dA:t.devicePixelRatio)!==null&&aA!==void 0?aA:1,x:((BA=e.x)!==null&&BA!==void 0?BA:0)+U,y:((FA=e.y)!==null&&FA!==void 0?FA:0)+p,width:(MA=e.width)!==null&&MA!==void 0?MA:Math.ceil(w),height:(CA=e.height)!==null&&CA!==void 0?CA:Math.ceil(x)},B?(a.logger.debug("Document cloned, using foreign object rendering"),b=new ef(a,y),[4,b.render(f)]):[3,3];case 2:return I=hA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+U+","+p+" with size "+w+"x"+x+" using computed rendering"),a.logger.debug("Starting DOM parsing"),C=_o(a,f),E===C.styles.backgroundColor&&(C.styles.backgroundColor=kA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+y.x+","+y.y+" with size "+y.width+"x"+y.height),b=new Zu(a,y),[4,b.render(C)];case 4:I=hA.sent(),hA.label=5;case 5:return(!((LA=e.removeContainer)!==null&&LA!==void 0)||LA)&&(Ps.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,I]}})})},af=function(A,e,r){var t=e.ownerDocument,n=t.documentElement?tt(A,getComputedStyle(t.documentElement).backgroundColor):kA.TRANSPARENT,s=t.body?tt(A,getComputedStyle(t.body).backgroundColor):kA.TRANSPARENT,o=typeof r=="string"?tt(A,r):r===null?kA.TRANSPARENT:4294967295;return e===t.documentElement?te(n)?te(s)?o:s:n:o},jo=sf;var zo=!1,Bf=new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]);function cf(){if(zo)return;zo=!0;let A=CanvasRenderingContext2D.prototype.createPattern;CanvasRenderingContext2D.prototype.createPattern=function(e,r){return e&&"width"in e&&"height"in e&&(e.width===0||e.height===0)?null:A.call(this,e,r)}}function Ai(){cf()}function ei(A){A.style.opacity="1",fe(A,"important"),A.querySelectorAll("[data-start]").forEach(e=>fe(e,"important"))}function lf(A,e){if(!A.id)return;let r=e.getElementById(A.id);r instanceof HTMLElement&&ei(r)}function uf(A){let e=A.ownerDocument.defaultView;e&&[A,...Array.from(A.querySelectorAll("*"))].forEach(r=>{if(Bf.has(r.tagName))return;let t=e.getComputedStyle(r);if(t.boxShadow==="none"||t.transform==="none")return;let n=A.ownerDocument.createElement("div");n.setAttribute("data-hyper-shader-shadow-shim",""),n.style.cssText=["position:absolute","inset:0","border-radius:inherit",`box-shadow:${t.boxShadow}`,"background:transparent","pointer-events:none","z-index:0"].join(";"),t.position==="static"&&(r.style.position="relative"),r.style.boxShadow="none",r.insertBefore(n,r.firstChild)})}function lt(){if(typeof document>"u")return!1;let A=document.createElement("canvas");if(A.setAttribute("layoutsubtree",""),!("layoutSubtree"in A))return!1;let e=A.getContext("2d");return e!=null&&typeof e.drawElementImage=="function"}async function ff(A,e,r,t,n){let s=document.createElement("canvas");s.width=r,s.height=t,s.setAttribute("layoutsubtree",""),s.style.cssText=`position:fixed;top:0;left:0;width:${r}px;height:${t}px;z-index:-9999;pointer-events:none;opacity:0`;let o=A.cloneNode(!0);n.forceVisible&&ei(o),s.appendChild(o),document.body.appendChild(s);try{await new Promise(l=>requestAnimationFrame(()=>requestAnimationFrame(()=>l())));let i=s.getContext("2d");i.fillStyle=e,i.fillRect(0,0,r,t);let a=s.firstElementChild;a&&i.drawElementImage(a,0,0,r,t);let B=document.createElement("canvas");return B.width=r,B.height=t,B.getContext("2d").drawImage(s,0,0),s.remove(),B}catch(i){throw s.remove(),i}}function ti(A,e,r=we,t=Qe,n={}){return lt()&&!n.preferBrowserPaint?ff(A,e,r,t,n).catch(()=>$o(A,e,r,t,n)):$o(A,e,r,t,n)}function $o(A,e,r,t,n={}){let s=o=>jo(A,{width:r,height:t,scale:n.scale??1,backgroundColor:e,logging:!1,foreignObjectRendering:o,useCORS:!0,allowTaint:!0,onclone:i=>{if(!A.id)return;let a=i.getElementById(A.id);a instanceof HTMLElement&&uf(a),n.forceVisible&&lf(A,i)},ignoreElements:i=>i.tagName==="CANVAS"||i.hasAttribute("data-no-capture")});return n.preferBrowserPaint===!0?s(!0).catch(()=>s(!1)):s(!1)}var sr="__hf-page-side-compositor",mn="__hf_page_compositor_v1__";function gf(A,e){let r=A.querySelectorAll("*"),t=e.querySelectorAll("*"),n=[[A,e]];r.forEach((i,a)=>n.push([i,t[a]]));let s=e,o=A;for(let i=A.parentElement;i&&i!==document.body&&i!==document.documentElement;i=i.parentElement){let a=i.cloneNode(!1);a.appendChild(s),n.push([i,a]),s=a,o=i}return{root:s,liveRoot:o,pairs:n}}function wf(A,e,r){let t=new Map;r.forEach(([o,i],a)=>{t.set(o,a),t.set(i,a)});let n=o=>{if(!("animationName"in o))return null;let i=o.effect;return`${t.get(i.target)}|${i.pseudoElement??""}|${o.animationName}`},s=new Map;for(let o of A.getAnimations({subtree:!0})){let i=n(o);i&&s.set(i,o.currentTime)}for(let o of e.getAnimations({subtree:!0})){let i=n(o);if(!i)continue;let a=s.get(i);a===void 0?o.cancel():(o.pause(),o.currentTime=a)}}function En(){if(typeof window>"u"||typeof document>"u"||!lt())return!1;let A=document.createElement("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl");return e?(e.getExtension("WEBGL_lose_context")?.loseContext(),!0):!1}function or(A){if(typeof window>"u")return!1;if(window.__HF_PAGE_COMPOSITOR_CANARY__=mn,!En())return console.warn("[HyperShader] page-side compositing requested but drawElementImage/WebGL is not available; falling back to opacity-flip mode (Node-side layered pipeline will handle the blend)."),!1;if(document.getElementById(sr))return!0;let{scenes:e,transitions:r,accentColors:t,width:n,height:s,defaultDuration:o}=A,i=document.createElement("canvas");i.id=sr,i.width=n,i.height=s,i.style.cssText="position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483646;pointer-events:none;display:none;",document.body.appendChild(i);let a=de(i,n,s);if(!a)return console.warn("[HyperShader] page-side compositor: WebGL context unavailable."),i.remove(),!1;let B=Ce(a),l=new Map;for(let K of r)if(K.shader!==void 0&&!l.has(K.shader))try{l.set(K.shader,he(a,Fe(K.shader)))}catch(M){console.warn(`[HyperShader] page-side compositor: failed to compile "${K.shader}":`,M)}let u=[];for(let K=0;K<r.length;K++){let M=r[K];if(!M||M.shader===void 0)continue;let J=e[K],R=e[K+1],O=l.get(M.shader);!J||!R||!O||u.push({time:M.time,duration:M.duration??o,shader:M.shader,fromSceneId:J,toSceneId:R,prog:O})}if(u.length===0)return i.remove(),!1;let f=SA(a),d=SA(a),g=document.createElement("canvas"),w=document.createElement("canvas");for(let K of[g,w])K.width=n,K.height=s,K.setAttribute("layoutsubtree",""),K.style.cssText="position:fixed;top:0;left:0;width:"+n+"px;height:"+s+"px;z-index:-9998;pointer-events:none;",document.body.appendChild(K);function x(K){for(let M of u)if(K>=M.time&&K<=M.time+M.duration)return M;return null}let U=null,p=0,E=window;async function y(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=document.getElementById(K.fromSceneId),J=document.getElementById(K.toSceneId);if(!(M instanceof HTMLElement)||!(J instanceof HTMLElement))return E.__hf_page_composite_pending=!1,!1;for(;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);for(let[O,eA]of[[M,g],[J,w]]){let G=O.cloneNode(!0);G.style.opacity="1",fe(G),G.querySelectorAll("[data-start]").forEach(FA=>{FA.style.opacity="1",fe(FA)});let{root:X,liveRoot:dA,pairs:aA}=gf(O,G),BA=document.createElement("div");BA.style.cssText=`position:absolute;left:0;top:0;width:${n}px;height:${s}px;margin:0;`,BA.appendChild(X),eA.appendChild(BA),wf(dA,X,aA)}let R=[];for(let O of[g,w])for(let eA of O.querySelectorAll("img"))eA.src&&eA.src.startsWith("data:")&&typeof eA.decode=="function"&&R.push(eA.decode().catch(()=>{}));return R.length>0&&await Promise.all(R),!0}function I(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=g.firstElementChild,J=w.firstElementChild;if(!M||!J)return E.__hf_page_composite_pending=!1,!1;let R=g.getContext("2d"),O=w.getContext("2d");if(!R?.drawElementImage||!O?.drawElementImage)return E.__hf_page_composite_pending=!1,!1;let eA=[[R,M],[O,J]];try{for(let[G,X]of eA)G.fillStyle=A.bgColor,G.fillRect(0,0,n,s),G.drawElementImage(X,0,0,n,s);NA(a,f,g),NA(a,d,w)}catch(G){return console.warn("[HyperShader] page-side compositor: scene capture failed:",G),i.style.display="none",E.__hf_page_composite_pending=!1,!1}finally{for(let[G]of eA)G.clearRect(0,0,n,s)}try{Ue(a,B,K.prog,f,d,p,t,n,s),i.style.display="block"}catch(G){console.warn("[HyperShader] page-side compositor: renderShader failed:",G),i.style.display="none"}return E.__hf_page_composite_pending=!1,!0}E.__hf_page_composite_resolve=I,E.__hf_page_composite_prepare=y;let C=window,b=()=>{if(!C.__hf)return;let K=C.__hf.seek;if(typeof K!="function")return;let M=J=>{let R=K.call(C.__hf,J),O=x(J);if(!O){for(i.style.display="none",E.__hf_page_composite_pending=!1;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);return R}return U=O,p=O.duration===0?1:Math.min(1,Math.max(0,(J-O.time)/O.duration)),E.__hf_page_composite_pending=!0,R};C.__hf.seek=M},_=0,S=window.setInterval(()=>{_+=1,C.__hf?.seek?(b(),window.clearInterval(S)):_>200&&(window.clearInterval(S),console.warn("[HyperShader] page-side compositor: window.__hf.seek never appeared after 10s; the engine bridge did not initialize. Falling back to opacity-flip mode."))},50);return!0}var Br=.7,Hn="power2.inOut",Qf="attribute vec2 a_pos; varying vec2 v_uv; void main(){v_uv=a_pos*0.5+0.5; gl_Position=vec4(a_pos,0,1);}",ir=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"],df="hyper-shader-preview-cache",RA="frames",Cf=1,hf="v1",ri=2,ni=1.25,Uf=1200;function Ff(A){let e=A.replace("#","");if(e.length<6)return[.5,.5,.5];let r=parseInt(e.slice(0,2),16)/255,t=parseInt(e.slice(2,4),16)/255,n=parseInt(e.slice(4,6),16)/255;return Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n)?[.5,.5,.5]:[r,t,n]}function ui(A){let[e,r,t]=Ff(A);return{accent:[e,r,t],dark:[e*.35,r*.35,t*.35],bright:[Math.min(1,e*1.5+.2),Math.min(1,r*1.5+.2),Math.min(1,t*1.5+.2)]}}function le(A,e,r){return Math.min(r,Math.max(e,A))}function pf(A,e){return A===void 0?e:Number.isFinite(A)&&A>0?A:e}var mf="__hf_shader_capture_scale",Ef="__hf_shader_loading";function fi(A,e){let r=window[A];if(typeof r=="string")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r);try{return new URLSearchParams(window.location.search).get(e)}catch{return null}}function vf(){let A=fi("__HF_SHADER_CAPTURE_SCALE",mf),e=A===null?NaN:Number(A);return le(Number.isFinite(e)&&e>0?e:1,.25,1)}function Hf(){if(window.__HF_REPLAY_SKIPPED_FRAMES)return"none";let A=fi("__HF_SHADER_LOADING",Ef)?.trim().toLowerCase();return A==="player"||A==="true"||A==="1"?"player":A==="none"||A==="false"||A==="0"||A==="off"?"none":"internal"}function lr(A){let e=2166136261;for(let r=0;r<A.length;r+=1)e^=A.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}function yf(A){let e=Array.from(A.querySelectorAll("style")).map(t=>t.textContent||"").join(`
7
7
  `),r=Array.from(A.querySelectorAll('link[rel~="stylesheet"]')).map(t=>`${t.href}:${t.getAttribute("integrity")||""}`).join(`
8
8
  `);return lr(`${e}
9
9
  ${r}`)}function If(A){return A.includes("gsap.timeline")||A.includes("__timelines")||A.includes(".to(")||A.includes(".set(")?!A.includes("HyperShader")&&!A.includes("hyper-shader")&&!A.includes("hyperShader"):!1}function bf(A){let e=Array.from(A.querySelectorAll('meta[name="hyperframes-project-signature"]')).map(t=>t.getAttribute("content")||"").join(`
@@ -3,7 +3,7 @@
3
3
  content: "" !important;
4
4
  display: none !important;
5
5
  }`,pu=function(A){mu(A,"."+fn+Uu+Vs+`
6
- .`+gn+Fu+Vs)},mu=function(A,e){var r=A.ownerDocument;if(r){var t=r.createElement("style");t.textContent=e,A.appendChild(t)}},ko=(function(){function A(){}return A.getOrigin=function(e){var r=A._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),Eu=(function(){function A(e,r){this.context=e,this._options=r,this._cache={}}return A.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(kr(e)||Iu(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return wA(this,void 0,void 0,function(){var r,t,n,s,o=this;return cA(this,function(i){switch(i.label){case 0:return r=ko.isSameOrigin(e),t=!Vr(e)&&this._options.useCORS===!0&&oA.SUPPORT_CORS_IMAGES&&!r,n=!Vr(e)&&!r&&!kr(e)&&typeof this._options.proxy=="string"&&oA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Vr(e)&&!kr(e)&&!n&&!t?[2]:(s=e,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,B){var l=new Image;l.onload=function(){return a(l)},l.onerror=B,(bu(s)||t)&&(l.crossOrigin="anonymous"),l.src=s,l.complete===!0&&setTimeout(function(){return a(l)},500),o._options.imageTimeout>0&&setTimeout(function(){return B("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(s,o){var i=oA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(f){return o(f)},!1),u.readAsDataURL(a.response)}else o("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=o;var B=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+B+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var l=r._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return o("Timed out ("+l+"ms) proxying "+n)}}a.send()})},A})(),vu=/^data:image\/svg\+xml/i,Hu=/^data:image\/.*;base64,/i,yu=/^data:image\/.*/i,Iu=function(A){return oA.SUPPORT_SVG_DRAWING||!xu(A)},Vr=function(A){return yu.test(A)},bu=function(A){return Hu.test(A)},kr=function(A){return A.substr(0,4)==="blob"},xu=function(A){return A.substr(-3).toLowerCase()==="svg"||vu.test(A)},m=(function(){function A(e,r){this.type=0,this.x=e,this.y=r}return A.prototype.add=function(e,r){return new A(this.x+e,this.y+r)},A})(),He=function(A,e,r){return new m(A.x+(e.x-A.x)*r,A.y+(e.y-A.y)*r)},Tt=(function(){function A(e,r,t,n){this.type=1,this.start=e,this.startControl=r,this.endControl=t,this.end=n}return A.prototype.subdivide=function(e,r){var t=He(this.start,this.startControl,e),n=He(this.startControl,this.endControl,e),s=He(this.endControl,this.end,e),o=He(t,n,e),i=He(n,s,e),a=He(o,i,e);return r?new A(this.start,t,o,a):new A(a,i,s,this.end)},A.prototype.add=function(e,r){return new A(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),vA=function(A){return A.type===1},Tu=(function(){function A(e){var r=e.styles,t=e.bounds,n=ze(r.borderTopLeftRadius,t.width,t.height),s=n[0],o=n[1],i=ze(r.borderTopRightRadius,t.width,t.height),a=i[0],B=i[1],l=ze(r.borderBottomRightRadius,t.width,t.height),u=l[0],f=l[1],d=ze(r.borderBottomLeftRadius,t.width,t.height),g=d[0],w=d[1],x=[];x.push((s+a)/t.width),x.push((g+u)/t.width),x.push((o+w)/t.height),x.push((B+f)/t.height);var U=Math.max.apply(Math,x);U>1&&(s/=U,o/=U,a/=U,B/=U,u/=U,f/=U,g/=U,w/=U);var p=t.width-a,E=t.height-f,y=t.width-u,I=t.height-w,C=r.borderTopWidth,b=r.borderRightWidth,_=r.borderBottomWidth,S=r.borderLeftWidth,K=j(r.paddingTop,e.bounds.width),M=j(r.paddingRight,e.bounds.width),J=j(r.paddingBottom,e.bounds.width),R=j(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?z(t.left+S/3,t.top+C/3,s-S/3,o-C/3,Y.TOP_LEFT):new m(t.left+S/3,t.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?z(t.left+p,t.top+C/3,a-b/3,B-C/3,Y.TOP_RIGHT):new m(t.left+t.width-b/3,t.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?z(t.left+y,t.top+E,u-b/3,f-_/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/3,t.top+t.height-_/3),this.bottomLeftBorderDoubleOuterBox=g>0||w>0?z(t.left+S/3,t.top+I,g-S/3,w-_/3,Y.BOTTOM_LEFT):new m(t.left+S/3,t.top+t.height-_/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?z(t.left+S*2/3,t.top+C*2/3,s-S*2/3,o-C*2/3,Y.TOP_LEFT):new m(t.left+S*2/3,t.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?z(t.left+p,t.top+C*2/3,a-b*2/3,B-C*2/3,Y.TOP_RIGHT):new m(t.left+t.width-b*2/3,t.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?z(t.left+y,t.top+E,u-b*2/3,f-_*2/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b*2/3,t.top+t.height-_*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||w>0?z(t.left+S*2/3,t.top+I,g-S*2/3,w-_*2/3,Y.BOTTOM_LEFT):new m(t.left+S*2/3,t.top+t.height-_*2/3),this.topLeftBorderStroke=s>0||o>0?z(t.left+S/2,t.top+C/2,s-S/2,o-C/2,Y.TOP_LEFT):new m(t.left+S/2,t.top+C/2),this.topRightBorderStroke=s>0||o>0?z(t.left+p,t.top+C/2,a-b/2,B-C/2,Y.TOP_RIGHT):new m(t.left+t.width-b/2,t.top+C/2),this.bottomRightBorderStroke=u>0||f>0?z(t.left+y,t.top+E,u-b/2,f-_/2,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/2,t.top+t.height-_/2),this.bottomLeftBorderStroke=g>0||w>0?z(t.left+S/2,t.top+I,g-S/2,w-_/2,Y.BOTTOM_LEFT):new m(t.left+S/2,t.top+t.height-_/2),this.topLeftBorderBox=s>0||o>0?z(t.left,t.top,s,o,Y.TOP_LEFT):new m(t.left,t.top),this.topRightBorderBox=a>0||B>0?z(t.left+p,t.top,a,B,Y.TOP_RIGHT):new m(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||f>0?z(t.left+y,t.top+E,u,f,Y.BOTTOM_RIGHT):new m(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||w>0?z(t.left,t.top+I,g,w,Y.BOTTOM_LEFT):new m(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||o>0?z(t.left+S,t.top+C,Math.max(0,s-S),Math.max(0,o-C),Y.TOP_LEFT):new m(t.left+S,t.top+C),this.topRightPaddingBox=a>0||B>0?z(t.left+Math.min(p,t.width-b),t.top+C,p>t.width+b?0:Math.max(0,a-b),Math.max(0,B-C),Y.TOP_RIGHT):new m(t.left+t.width-b,t.top+C),this.bottomRightPaddingBox=u>0||f>0?z(t.left+Math.min(y,t.width-S),t.top+Math.min(E,t.height-_),Math.max(0,u-b),Math.max(0,f-_),Y.BOTTOM_RIGHT):new m(t.left+t.width-b,t.top+t.height-_),this.bottomLeftPaddingBox=g>0||w>0?z(t.left+S,t.top+Math.min(I,t.height-_),Math.max(0,g-S),Math.max(0,w-_),Y.BOTTOM_LEFT):new m(t.left+S,t.top+t.height-_),this.topLeftContentBox=s>0||o>0?z(t.left+S+R,t.top+C+K,Math.max(0,s-(S+R)),Math.max(0,o-(C+K)),Y.TOP_LEFT):new m(t.left+S+R,t.top+C+K),this.topRightContentBox=a>0||B>0?z(t.left+Math.min(p,t.width+S+R),t.top+C+K,p>t.width+S+R?0:a-S+R,B-(C+K),Y.TOP_RIGHT):new m(t.left+t.width-(b+M),t.top+C+K),this.bottomRightContentBox=u>0||f>0?z(t.left+Math.min(y,t.width-(S+R)),t.top+Math.min(E,t.height+C+K),Math.max(0,u-(b+M)),f-(_+J),Y.BOTTOM_RIGHT):new m(t.left+t.width-(b+M),t.top+t.height-(_+J)),this.bottomLeftContentBox=g>0||w>0?z(t.left+S+R,t.top+I,Math.max(0,g-(S+R)),w-(_+J),Y.BOTTOM_LEFT):new m(t.left+S+R,t.top+t.height-(_+J))}return A})(),Y;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var z=function(A,e,r,t,n){var s=4*((Math.sqrt(2)-1)/3),o=r*s,i=t*s,a=A+r,B=e+t;switch(n){case Y.TOP_LEFT:return new Tt(new m(A,B),new m(A,B-i),new m(a-o,e),new m(a,e));case Y.TOP_RIGHT:return new Tt(new m(A,e),new m(A+o,e),new m(a,B-i),new m(a,B));case Y.BOTTOM_RIGHT:return new Tt(new m(a,e),new m(a,e+i),new m(A+o,B),new m(A,B));case Y.BOTTOM_LEFT:default:return new Tt(new m(a,B),new m(a-o,B),new m(A,e+i),new m(A,e))}},Wt=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Lu=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Jt=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},Su=(function(){function A(e,r,t){this.offsetX=e,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return A})(),Lt=(function(){function A(e,r){this.path=e,this.target=r,this.type=1}return A})(),Ku=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),Du=function(A){return A.type===0},Xo=function(A){return A.type===1},_u=function(A){return A.type===2},ks=function(A,e){return A.length===e.length?A.some(function(r,t){return r===e[t]}):!1},Ru=function(A,e,r,t,n){return A.map(function(s,o){switch(o){case 0:return s.add(e,r);case 1:return s.add(e+t,r);case 2:return s.add(e+t,r+n);case 3:return s.add(e,r+n)}return s})},Wo=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),Jo=(function(){function A(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new Tu(this.container),this.container.styles.opacity<1&&this.effects.push(new Ku(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Su(t,n,s))}if(this.container.styles.overflowX!==0){var o=Wt(this.curves),i=Jt(this.curves);ks(o,i)?this.effects.push(new Lt(o,6)):(this.effects.push(new Lt(o,2)),this.effects.push(new Lt(i,4)))}}return A.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Xo(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var o=Wt(t.curves),i=Jt(t.curves);ks(o,i)||n.unshift(new Lt(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,e)})},A})(),wn=function(A,e,r,t){A.container.elements.forEach(function(n){var s=rA(n.flags,4),o=rA(n.flags,2),i=new Jo(n,A);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||o){var B=s||n.styles.isPositioned()?r:e,l=new Wo(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var f=0;B.negativeZIndex.some(function(g,w){return u>g.element.container.styles.zIndex.order?(f=w,!1):f>0}),B.negativeZIndex.splice(f,0,l)}else if(u>0){var d=0;B.positiveZIndex.some(function(g,w){return u>=g.element.container.styles.zIndex.order?(d=w+1,!1):d>0}),B.positiveZIndex.splice(d,0,l)}else B.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?B.nonPositionedFloats.push(l):B.nonPositionedInlineLevel.push(l);wn(i,l,s?l:r,a)}else n.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),wn(i,e,r,a);rA(n.flags,8)&&Yo(n,a)})},Yo=function(A,e){for(var r=A instanceof cn?A.start:1,t=A instanceof cn?A.reversed:!1,n=0;n<e.length;n++){var s=e[n];s.container instanceof To&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=at(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},Mu=function(A){var e=new Jo(A,null),r=new Wo(e),t=[];return wn(e,r,r,t),Yo(e.container,t),r},Xs=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},Ou=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return yA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Gu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Nu=function(A,e){switch(e){case 0:return St(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return St(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return St(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return St(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},St=function(A,e){var r=[];return vA(A)?r.push(A.subdivide(.5,!1)):r.push(A),vA(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},yA=function(A,e,r,t){var n=[];return vA(A)?n.push(A.subdivide(.5,!1)):n.push(A),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Zo=function(A){var e=A.bounds,r=A.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Yt=function(A){var e=A.styles,r=A.bounds,t=j(e.paddingLeft,r.width),n=j(e.paddingRight,r.width),s=j(e.paddingTop,r.width),o=j(e.paddingBottom,r.width);return r.add(t+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+n),-(e.borderTopWidth+e.borderBottomWidth+s+o))},Pu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Vu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Xr=function(A,e,r){var t=Pu(be(A.styles.backgroundOrigin,e),A),n=Vu(be(A.styles.backgroundClip,e),A),s=ku(be(A.styles.backgroundSize,e),r,t),o=s[0],i=s[1],a=ze(be(A.styles.backgroundPosition,e),t.width-o,t.height-i),B=Xu(be(A.styles.backgroundRepeat,e),a,s,t,n),l=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[B,l,u,o,i]},ye=function(A){return Z(A)&&A.value===Te.AUTO},Kt=function(A){return typeof A=="number"},ku=function(A,e,r){var t=e[0],n=e[1],s=e[2],o=A[0],i=A[1];if(!o)return[0,0];if(tA(o)&&i&&tA(i))return[j(o,r.width),j(i,r.height)];var a=Kt(s);if(Z(o)&&(o.value===Te.CONTAIN||o.value===Te.COVER)){if(Kt(s)){var B=r.width/r.height;return B<s!=(o.value===Te.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var l=Kt(t),u=Kt(n),f=l||u;if(ye(o)&&(!i||ye(i))){if(l&&u)return[t,n];if(!a&&!f)return[r.width,r.height];if(f&&a){var d=l?t:n*s,g=u?n:t/s;return[d,g]}var w=l?t:r.width,x=u?n:r.height;return[w,x]}if(a){var U=0,p=0;return tA(o)?U=j(o,r.width):tA(i)&&(p=j(i,r.height)),ye(o)?U=p*s:(!i||ye(i))&&(p=U/s),[U,p]}var E=null,y=null;if(tA(o)?E=j(o,r.width):i&&tA(i)&&(y=j(i,r.height)),E!==null&&(!i||ye(i))&&(y=l&&u?E/t*n:r.height),y!==null&&ye(o)&&(E=l&&u?y/n*t:r.width),E!==null&&y!==null)return[E,y];throw new Error("Unable to calculate background-size for element")},be=function(A,e){var r=A[e];return typeof r>"u"?A[0]:r},Xu=function(A,e,r,t,n){var s=e[0],o=e[1],i=r[0],a=r[1];switch(A){case 2:return[new m(Math.round(t.left),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(a+t.top+o)),new m(Math.round(t.left),Math.round(a+t.top+o))];case 3:return[new m(Math.round(t.left+s),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.height+t.top)),new m(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new m(Math.round(t.left+s),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o+a)),new m(Math.round(t.left+s),Math.round(t.top+o+a))];default:return[new m(Math.round(n.left),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.height+n.top)),new m(Math.round(n.left),Math.round(n.height+n.top))]}},Wu="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ws="Hidden Text",Ju=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",o.appendChild(t),n.src=Wu,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Ws)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(Ws)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return o.removeChild(t),{baseline:i,middle:a}},A.prototype.getMetrics=function(e,r){var t=e+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,r)),this._data[t]},A})(),qo=(function(){function A(e,r){this.context=e,this.options=r}return A})(),Yu=1e4,Zu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Ju(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return e.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},e.prototype.applyEffect=function(r){this.ctx.save(),_u(r)&&(this.ctx.globalAlpha=r.opacity),Du(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),Xo(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return wA(this,void 0,void 0,function(){return cA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var o=Un(r.text);o.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),n=Af(r.fontFamily).join(", "),s=ct(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},e.prototype.renderTextNode=function(r,t){return wA(this,void 0,void 0,function(){var n,s,o,i,a,B,l,u,f=this;return cA(this,function(d){return n=this.createFontStyle(t),s=n[0],o=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(o,i),B=a.baseline,l=a.middle,u=t.paintOrder,r.textBounds.forEach(function(g){u.forEach(function(w){switch(w){case 0:f.ctx.fillStyle=nA(t.color),f.renderTextWithLetterSpacing(g,t.letterSpacing,B);var x=t.textShadow;x.length&&g.text.trim().length&&(x.slice(0).reverse().forEach(function(U){f.ctx.shadowColor=nA(U.color),f.ctx.shadowOffsetX=U.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=U.offsetY.number*f.options.scale,f.ctx.shadowBlur=U.blur.number,f.renderTextWithLetterSpacing(g,t.letterSpacing,B)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),t.textDecorationLine.length&&(f.ctx.fillStyle=nA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(U){switch(U){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+B),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+l),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=nA(t.webkitTextStrokeColor),f.ctx.lineWidth=t.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+B)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Yt(r),o=Jt(t);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,p,p,B,l,u,f,y,d,g,I,w,x,U,p,E,y,I;return cA(this,function(C){switch(C.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,o=0,i=t.textNodes,C.label=1;case 1:return o<i.length?(a=i[o],[4,this.renderTextNode(a,s)]):[3,4];case 2:C.sent(),C.label=3;case 3:return o++,[3,1];case 4:if(!(t instanceof Io))return[3,8];C.label=5;case 5:return C.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,8];case 7:return C.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof bo&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof xo))return[3,12];C.label=9;case 9:return C.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,12];case 11:return C.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ko&&t.tree?(B=new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,B.render(t.tree)]):[3,14];case 13:l=C.sent(),t.width&&t.height&&this.ctx.drawImage(l,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),C.label=14;case 14:if(t instanceof Fn&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Pt?t.checked&&(this.ctx.save(),this.path([new m(t.bounds.left+u*.39363,t.bounds.top+u*.79),new m(t.bounds.left+u*.16,t.bounds.top+u*.5549),new m(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new m(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new m(t.bounds.left+u*.72983,t.bounds.top+u*.23),new m(t.bounds.left+u*.84,t.bounds.top+u*.34085),new m(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore()):t.type===Vt&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore())),qu(t)&&t.value.length){switch(f=this.createFontStyle(s),y=f[0],d=f[1],g=this.fontMetrics.getMetrics(y,d).baseline,this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=zu(t.styles.textAlign),I=Yt(t),w=0,t.styles.textAlign){case 1:w+=I.width/2;break;case 2:w+=I.width;break}x=I.add(w,0,0,-I.height/2+1),this.ctx.save(),this.path([new m(I.left,I.top),new m(I.left+I.width,I.top),new m(I.left+I.width,I.top+I.height),new m(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new nt(t.value,x),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(U=t.styles.listStyleImage,U.type!==0)return[3,18];p=void 0,E=U.url,C.label=15;case 15:return C.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return p=C.sent(),this.ctx.drawImage(p,t.bounds.left-(p.width+10),t.bounds.top),[3,18];case 17:return C.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(y=this.createFontStyle(s)[0],this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new XA(t.bounds.left,t.bounds.top+j(t.styles.paddingTop,t.bounds.width),t.bounds.width,Qs(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new nt(r.listValue,I),s.letterSpacing,Qs(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),C.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return wA(this,void 0,void 0,function(){var t,n,U,s,o,U,i,a,U,B,l,U,u,f,U,d,g,U,w,x,U;return cA(this,function(p){switch(p.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:p.sent(),t=0,n=r.negativeZIndex,p.label=2;case 2:return t<n.length?(U=n[t],[4,this.renderStack(U)]):[3,5];case 3:p.sent(),p.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:p.sent(),s=0,o=r.nonInlineLevel,p.label=7;case 7:return s<o.length?(U=o[s],[4,this.renderNode(U)]):[3,10];case 8:p.sent(),p.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,p.label=11;case 11:return i<a.length?(U=a[i],[4,this.renderStack(U)]):[3,14];case 12:p.sent(),p.label=13;case 13:return i++,[3,11];case 14:B=0,l=r.nonPositionedInlineLevel,p.label=15;case 15:return B<l.length?(U=l[B],[4,this.renderStack(U)]):[3,18];case 16:p.sent(),p.label=17;case 17:return B++,[3,15];case 18:u=0,f=r.inlineLevel,p.label=19;case 19:return u<f.length?(U=f[u],[4,this.renderNode(U)]):[3,22];case 20:p.sent(),p.label=21;case 21:return u++,[3,19];case 22:d=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return d<g.length?(U=g[d],[4,this.renderStack(U)]):[3,26];case 24:p.sent(),p.label=25;case 25:return d++,[3,23];case 26:w=0,x=r.positiveZIndex,p.label=27;case 27:return w<x.length?(U=x[w],[4,this.renderStack(U)]):[3,30];case 28:p.sent(),p.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var t=this;r.forEach(function(n,s){var o=vA(n)?n.start:n;s===0?t.ctx.moveTo(o.x,o.y):t.ctx.lineTo(o.x,o.y),vA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(r,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},e.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var o=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=o.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},e.prototype.renderBackgroundImage=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a;return cA(this,function(B){switch(B.label){case 0:t=r.styles.backgroundImage.length-1,n=function(l){var u,f,d,K,G,X,R,O,_,g,K,G,X,R,O,w,x,U,p,E,y,I,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA,hA;return cA(this,function(OA){switch(OA.label){case 0:if(l.type!==0)return[3,5];u=void 0,f=l.url,OA.label=1;case 1:return OA.trys.push([1,3,,4]),[4,s.context.cache.match(f)];case 2:return u=OA.sent(),[3,4];case 3:return OA.sent(),s.context.logger.error("Error loading background-image "+f),[3,4];case 4:return u&&(d=Xr(r,t,[u.width,u.height,u.width/u.height]),K=d[0],G=d[1],X=d[2],R=d[3],O=d[4],_=s.ctx.createPattern(s.resizeImage(u,R,O),"repeat"),s.renderRepeat(K,_,G,X)),[3,6];case 5:DB(l)?(g=Xr(r,t,[null,null,null]),K=g[0],G=g[1],X=g[2],R=g[3],O=g[4],w=xB(l.angle,R,O),x=w[0],U=w[1],p=w[2],E=w[3],y=w[4],I=document.createElement("canvas"),I.width=R,I.height=O,C=I.getContext("2d"),b=C.createLinearGradient(U,E,p,y),gs(l.stops,x).forEach(function(WA){return b.addColorStop(WA.stop,nA(WA.color))}),C.fillStyle=b,C.fillRect(0,0,R,O),R>0&&O>0&&(_=s.ctx.createPattern(I,"repeat"),s.renderRepeat(K,_,G,X))):_B(l)&&(S=Xr(r,t,[null,null,null]),K=S[0],M=S[1],J=S[2],R=S[3],O=S[4],eA=l.position.length===0?[dn]:l.position,G=j(eA[0],R),X=j(eA[eA.length-1],O),dA=TB(l,G,X,R,O),aA=dA[0],BA=dA[1],aA>0&&BA>0&&(FA=s.ctx.createRadialGradient(M+G,J+X,0,M+G,J+X,aA),gs(l.stops,aA*2).forEach(function(WA){return FA.addColorStop(WA.stop,nA(WA.color))}),s.path(K),s.ctx.fillStyle=FA,aA!==BA?(MA=r.bounds.left+.5*r.bounds.width,CA=r.bounds.top+.5*r.bounds.height,LA=BA/aA,hA=1/LA,s.ctx.save(),s.ctx.translate(MA,CA),s.ctx.transform(1,0,0,LA,0,0),s.ctx.translate(-MA,-CA),s.ctx.fillRect(M,hA*(J-CA)+CA,R,O*hA),s.ctx.restore()):s.ctx.fill())),OA.label=6;case 6:return t--,[2]}})},s=this,o=0,i=r.styles.backgroundImage.slice(0).reverse(),B.label=1;case 1:return o<i.length?(a=i[o],[5,n(a)]):[3,4];case 2:B.sent(),B.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,t,n){return wA(this,void 0,void 0,function(){return cA(this,function(s){return this.path(Xs(n,t)),this.ctx.fillStyle=nA(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,t,n,s){return wA(this,void 0,void 0,function(){var o,i;return cA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return o=Ou(s,n),this.path(o),this.ctx.fillStyle=nA(r),this.ctx.fill(),i=Gu(s,n),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,B,l,u=this;return cA(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!te(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],o=ju(be(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),te(t.backgroundColor)||(this.ctx.fillStyle=nA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(d){u.ctx.save();var g=Wt(r.curves),w=d.inset?0:Yu,x=Ru(g,-w+(d.inset?1:-1)*d.spread.number,(d.inset?1:-1)*d.spread.number,d.spread.number*(d.inset?-2:2),d.spread.number*(d.inset?-2:2));d.inset?(u.path(g),u.ctx.clip(),u.mask(x)):(u.mask(g),u.ctx.clip(),u.path(x)),u.ctx.shadowOffsetX=d.offsetX.number+w,u.ctx.shadowOffsetY=d.offsetY.number,u.ctx.shadowColor=nA(d.color),u.ctx.shadowBlur=d.blur.number,u.ctx.fillStyle=d.inset?nA(d.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),f.label=2;case 2:i=0,a=0,B=s,f.label=3;case 3:return a<B.length?(l=B[a],l.style!==0&&!te(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,i,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,i,r.curves)];case 10:f.sent(),f.label=11;case 11:i++,f.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,t,n,s,o){return wA(this,void 0,void 0,function(){var i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,C,I,C;return cA(this,function(b){return this.ctx.save(),i=Nu(s,n),a=Xs(s,n),o===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(B=a[0].start.x,l=a[0].start.y):(B=a[0].x,l=a[0].y),vA(a[1])?(u=a[1].end.x,f=a[1].end.y):(u=a[1].x,f=a[1].y),n===0||n===2?d=Math.abs(B-u):d=Math.abs(l-f),this.ctx.beginPath(),o===3?this.formatPath(i):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,w=t<3?t*2:t,o===3&&(g=t,w=t),x=!0,d<=g*2?x=!1:d<=g*2+w?(U=d/(2*g+w),g*=U,w*=U):(p=Math.floor((d+w)/(g+w)),E=(d-p*g)/(p-1),y=(d-(p+1)*g)/p,w=y<=0||Math.abs(w-E)<Math.abs(w-y)?E:y),x&&(o===3?this.ctx.setLineDash([0,g+w]):this.ctx.setLineDash([g,w])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=nA(r),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(vA(a[0])&&(I=a[3],C=a[0],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke()),vA(a[1])&&(I=a[1],C=a[2],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=Mu(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(qo),qu=function(A){return A instanceof So||A instanceof Lo?!0:A instanceof Fn&&A.type!==Vt&&A.type!==Pt},ju=function(A,e){switch(A){case 0:return Wt(e);case 2:return Lu(e);default:return Jt(e)}},zu=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},$u=["-apple-system","system-ui"],Af=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return $u.indexOf(e)===-1}):A},ef=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t,n;return cA(this,function(s){switch(s.label){case 0:return t=Bn(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,tf(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(qo),tf=function(A){return new Promise(function(e,r){var t=new Image;t.onload=function(){e(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},rf=(function(){function A(e){var r=e.id,t=e.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,dt([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),nf=(function(){function A(e,r){var t;this.windowBounds=r,this.instanceName="#"+A.instanceCount++,this.logger=new rf({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new Eu(this,e)}return A.instanceCount=1,A})(),sf=function(A,e){return e===void 0&&(e={}),of(A,e)};typeof window<"u"&&ko.setContext(window);var of=function(A,e){return wA(void 0,void 0,void 0,function(){var r,t,n,s,o,i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,b,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA;return cA(this,function(hA){switch(hA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=A.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(_=e.allowTaint)!==null&&_!==void 0?_:!1,imageTimeout:(S=e.imageTimeout)!==null&&S!==void 0?S:15e3,proxy:e.proxy,useCORS:(K=e.useCORS)!==null&&K!==void 0?K:!1},s=Jr({logging:(M=e.logging)!==null&&M!==void 0?M:!0,cache:e.cache},n),o={windowWidth:(J=e.windowWidth)!==null&&J!==void 0?J:t.innerWidth,windowHeight:(R=e.windowHeight)!==null&&R!==void 0?R:t.innerHeight,scrollX:(O=e.scrollX)!==null&&O!==void 0?O:t.pageXOffset,scrollY:(eA=e.scrollY)!==null&&eA!==void 0?eA:t.pageYOffset},i=new XA(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),a=new nf(s,i),B=(G=e.foreignObjectRendering)!==null&&G!==void 0?G:!1,l={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:B,copyStyles:B},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Ps(a,A,l),f=u.clonedReferenceElement,f?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=hA.sent(),g=pn(f)||iu(f)?Ri(f.ownerDocument):Zt(a,f),w=g.width,x=g.height,U=g.left,p=g.top,E=af(a,f,e.backgroundColor),y={canvas:e.canvas,backgroundColor:E,scale:(aA=(dA=e.scale)!==null&&dA!==void 0?dA:t.devicePixelRatio)!==null&&aA!==void 0?aA:1,x:((BA=e.x)!==null&&BA!==void 0?BA:0)+U,y:((FA=e.y)!==null&&FA!==void 0?FA:0)+p,width:(MA=e.width)!==null&&MA!==void 0?MA:Math.ceil(w),height:(CA=e.height)!==null&&CA!==void 0?CA:Math.ceil(x)},B?(a.logger.debug("Document cloned, using foreign object rendering"),b=new ef(a,y),[4,b.render(f)]):[3,3];case 2:return I=hA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+U+","+p+" with size "+w+"x"+x+" using computed rendering"),a.logger.debug("Starting DOM parsing"),C=_o(a,f),E===C.styles.backgroundColor&&(C.styles.backgroundColor=kA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+y.x+","+y.y+" with size "+y.width+"x"+y.height),b=new Zu(a,y),[4,b.render(C)];case 4:I=hA.sent(),hA.label=5;case 5:return(!((LA=e.removeContainer)!==null&&LA!==void 0)||LA)&&(Ps.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,I]}})})},af=function(A,e,r){var t=e.ownerDocument,n=t.documentElement?tt(A,getComputedStyle(t.documentElement).backgroundColor):kA.TRANSPARENT,s=t.body?tt(A,getComputedStyle(t.body).backgroundColor):kA.TRANSPARENT,o=typeof r=="string"?tt(A,r):r===null?kA.TRANSPARENT:4294967295;return e===t.documentElement?te(n)?te(s)?o:s:n:o},jo=sf;var zo=!1,Bf=new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]);function cf(){if(zo)return;zo=!0;let A=CanvasRenderingContext2D.prototype.createPattern;CanvasRenderingContext2D.prototype.createPattern=function(e,r){return e&&"width"in e&&"height"in e&&(e.width===0||e.height===0)?null:A.call(this,e,r)}}function Ai(){cf()}function ei(A){A.style.opacity="1",fe(A,"important"),A.querySelectorAll("[data-start]").forEach(e=>fe(e,"important"))}function lf(A,e){if(!A.id)return;let r=e.getElementById(A.id);r instanceof HTMLElement&&ei(r)}function uf(A){let e=A.ownerDocument.defaultView;e&&[A,...Array.from(A.querySelectorAll("*"))].forEach(r=>{if(Bf.has(r.tagName))return;let t=e.getComputedStyle(r);if(t.boxShadow==="none"||t.transform==="none")return;let n=A.ownerDocument.createElement("div");n.setAttribute("data-hyper-shader-shadow-shim",""),n.style.cssText=["position:absolute","inset:0","border-radius:inherit",`box-shadow:${t.boxShadow}`,"background:transparent","pointer-events:none","z-index:0"].join(";"),t.position==="static"&&(r.style.position="relative"),r.style.boxShadow="none",r.insertBefore(n,r.firstChild)})}function lt(){if(typeof document>"u")return!1;let A=document.createElement("canvas");if(A.setAttribute("layoutsubtree",""),!("layoutSubtree"in A))return!1;let e=A.getContext("2d");return e!=null&&typeof e.drawElementImage=="function"}async function ff(A,e,r,t,n){let s=document.createElement("canvas");s.width=r,s.height=t,s.setAttribute("layoutsubtree",""),s.style.cssText=`position:fixed;top:0;left:0;width:${r}px;height:${t}px;z-index:-9999;pointer-events:none;opacity:0`;let o=A.cloneNode(!0);n.forceVisible&&ei(o),s.appendChild(o),document.body.appendChild(s);try{await new Promise(l=>requestAnimationFrame(()=>requestAnimationFrame(()=>l())));let i=s.getContext("2d");i.fillStyle=e,i.fillRect(0,0,r,t);let a=s.firstElementChild;a&&i.drawElementImage(a,0,0,r,t);let B=document.createElement("canvas");return B.width=r,B.height=t,B.getContext("2d").drawImage(s,0,0),s.remove(),B}catch(i){throw s.remove(),i}}function ti(A,e,r=we,t=Qe,n={}){return lt()&&!n.preferBrowserPaint?ff(A,e,r,t,n).catch(()=>$o(A,e,r,t,n)):$o(A,e,r,t,n)}function $o(A,e,r,t,n={}){let s=o=>jo(A,{width:r,height:t,scale:n.scale??1,backgroundColor:e,logging:!1,foreignObjectRendering:o,useCORS:!0,allowTaint:!0,onclone:i=>{if(!A.id)return;let a=i.getElementById(A.id);a instanceof HTMLElement&&uf(a),n.forceVisible&&lf(A,i)},ignoreElements:i=>i.tagName==="CANVAS"||i.hasAttribute("data-no-capture")});return n.preferBrowserPaint===!0?s(!0).catch(()=>s(!1)):s(!1)}var sr="__hf-page-side-compositor",mn="__hf_page_compositor_v1__";function gf(A,e){let r=A.querySelectorAll("*"),t=e.querySelectorAll("*"),n=[[A,e]];r.forEach((i,a)=>n.push([i,t[a]]));let s=e,o=A;for(let i=A.parentElement;i&&i!==document.body&&i!==document.documentElement;i=i.parentElement){let a=i.cloneNode(!1);a.appendChild(s),n.push([i,a]),s=a,o=i}return{root:s,liveRoot:o,pairs:n}}function wf(A,e,r){let t=new Map;r.forEach(([o,i],a)=>{t.set(o,a),t.set(i,a)});let n=o=>{if(!("animationName"in o))return null;let i=o.effect;return`${t.get(i.target)}|${i.pseudoElement??""}|${o.animationName}`},s=new Map;for(let o of A.getAnimations({subtree:!0})){let i=n(o);i&&s.set(i,o.currentTime)}for(let o of e.getAnimations({subtree:!0})){let i=n(o);if(!i)continue;let a=s.get(i);a===void 0?o.cancel():(o.pause(),o.currentTime=a)}}function En(){if(typeof window>"u"||typeof document>"u"||!lt())return!1;let A=document.createElement("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl");return e?(e.getExtension("WEBGL_lose_context")?.loseContext(),!0):!1}function or(A){if(typeof window>"u")return!1;if(window.__HF_PAGE_COMPOSITOR_CANARY__=mn,!En())return console.warn("[HyperShader] page-side compositing requested but drawElementImage/WebGL is not available; falling back to opacity-flip mode (Node-side layered pipeline will handle the blend)."),!1;if(document.getElementById(sr))return!0;let{scenes:e,transitions:r,accentColors:t,width:n,height:s,defaultDuration:o}=A,i=document.createElement("canvas");i.id=sr,i.width=n,i.height=s,i.style.cssText="position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483646;pointer-events:none;display:none;",document.body.appendChild(i);let a=de(i,n,s);if(!a)return console.warn("[HyperShader] page-side compositor: WebGL context unavailable."),i.remove(),!1;let B=Ce(a),l=new Map;for(let K of r)if(K.shader!==void 0&&!l.has(K.shader))try{l.set(K.shader,he(a,Fe(K.shader)))}catch(M){console.warn(`[HyperShader] page-side compositor: failed to compile "${K.shader}":`,M)}let u=[];for(let K=0;K<r.length;K++){let M=r[K];if(!M||M.shader===void 0)continue;let J=e[K],R=e[K+1],O=l.get(M.shader);!J||!R||!O||u.push({time:M.time,duration:M.duration??o,shader:M.shader,fromSceneId:J,toSceneId:R,prog:O})}if(u.length===0)return i.remove(),!1;let f=SA(a),d=SA(a),g=document.createElement("canvas"),w=document.createElement("canvas");for(let K of[g,w])K.width=n,K.height=s,K.setAttribute("layoutsubtree",""),K.style.cssText="position:fixed;top:0;left:0;width:"+n+"px;height:"+s+"px;z-index:-9998;pointer-events:none;",document.body.appendChild(K);function x(K){for(let M of u)if(K>=M.time&&K<=M.time+M.duration)return M;return null}let U=null,p=0,E=window;async function y(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=document.getElementById(K.fromSceneId),J=document.getElementById(K.toSceneId);if(!(M instanceof HTMLElement)||!(J instanceof HTMLElement))return E.__hf_page_composite_pending=!1,!1;for(;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);for(let[O,eA]of[[M,g],[J,w]]){let G=O.cloneNode(!0);G.style.opacity="1",fe(G),G.querySelectorAll("[data-start]").forEach(FA=>{FA.style.opacity="1",fe(FA)});let{root:X,liveRoot:dA,pairs:aA}=gf(O,G),BA=document.createElement("div");BA.style.cssText=`position:absolute;left:0;top:0;width:${n}px;height:${s}px;margin:0;`,BA.appendChild(X),eA.appendChild(BA),wf(dA,X,aA)}let R=[];for(let O of[g,w])for(let eA of O.querySelectorAll("img"))eA.src&&eA.src.startsWith("data:")&&typeof eA.decode=="function"&&R.push(eA.decode().catch(()=>{}));return R.length>0&&await Promise.all(R),!0}function I(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=g.firstElementChild,J=w.firstElementChild;if(!M||!J)return E.__hf_page_composite_pending=!1,!1;let R=g.getContext("2d"),O=w.getContext("2d");if(!R?.drawElementImage||!O?.drawElementImage)return E.__hf_page_composite_pending=!1,!1;let eA=[[R,M],[O,J]];try{for(let[G,X]of eA)G.fillStyle=A.bgColor,G.fillRect(0,0,n,s),G.drawElementImage(X,0,0,n,s);NA(a,f,g),NA(a,d,w)}catch(G){return console.warn("[HyperShader] page-side compositor: scene capture failed:",G),i.style.display="none",E.__hf_page_composite_pending=!1,!1}finally{for(let[G]of eA)G.clearRect(0,0,n,s)}try{Ue(a,B,K.prog,f,d,p,t,n,s),i.style.display="block"}catch(G){console.warn("[HyperShader] page-side compositor: renderShader failed:",G),i.style.display="none"}return E.__hf_page_composite_pending=!1,!0}E.__hf_page_composite_resolve=I,E.__hf_page_composite_prepare=y;let C=window,b=()=>{if(!C.__hf)return;let K=C.__hf.seek;if(typeof K!="function")return;let M=J=>{let R=K.call(C.__hf,J),O=x(J);if(!O){for(i.style.display="none",E.__hf_page_composite_pending=!1;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);return R}return U=O,p=O.duration===0?1:Math.min(1,Math.max(0,(J-O.time)/O.duration)),E.__hf_page_composite_pending=!0,R};C.__hf.seek=M},_=0,S=window.setInterval(()=>{_+=1,C.__hf?.seek?(b(),window.clearInterval(S)):_>200&&(window.clearInterval(S),console.warn("[HyperShader] page-side compositor: window.__hf.seek never appeared after 10s; the engine bridge did not initialize. Falling back to opacity-flip mode."))},50);return!0}var Br=.7,Hn="power2.inOut",Qf="attribute vec2 a_pos; varying vec2 v_uv; void main(){v_uv=a_pos*0.5+0.5; gl_Position=vec4(a_pos,0,1);}",ir=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"],df="hyper-shader-preview-cache",RA="frames",Cf=1,hf="v1",ri=2,ni=1.25,Uf=1200;function Ff(A){let e=A.replace("#","");if(e.length<6)return[.5,.5,.5];let r=parseInt(e.slice(0,2),16)/255,t=parseInt(e.slice(2,4),16)/255,n=parseInt(e.slice(4,6),16)/255;return Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n)?[.5,.5,.5]:[r,t,n]}function ui(A){let[e,r,t]=Ff(A);return{accent:[e,r,t],dark:[e*.35,r*.35,t*.35],bright:[Math.min(1,e*1.5+.2),Math.min(1,r*1.5+.2),Math.min(1,t*1.5+.2)]}}function le(A,e,r){return Math.min(r,Math.max(e,A))}function pf(A,e){return A===void 0?e:Number.isFinite(A)&&A>0?A:e}var mf="__hf_shader_capture_scale",Ef="__hf_shader_loading";function fi(A,e){let r=window[A];if(typeof r=="string")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r);try{return new URLSearchParams(window.location.search).get(e)}catch{return null}}function vf(){let A=fi("__HF_SHADER_CAPTURE_SCALE",mf),e=A===null?NaN:Number(A);return le(Number.isFinite(e)&&e>0?e:1,.25,1)}function Hf(){let A=fi("__HF_SHADER_LOADING",Ef)?.trim().toLowerCase();return A==="player"||A==="true"||A==="1"?"player":A==="none"||A==="false"||A==="0"||A==="off"?"none":"internal"}function lr(A){let e=2166136261;for(let r=0;r<A.length;r+=1)e^=A.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}function yf(A){let e=Array.from(A.querySelectorAll("style")).map(t=>t.textContent||"").join(`
6
+ .`+gn+Fu+Vs)},mu=function(A,e){var r=A.ownerDocument;if(r){var t=r.createElement("style");t.textContent=e,A.appendChild(t)}},ko=(function(){function A(){}return A.getOrigin=function(e){var r=A._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),Eu=(function(){function A(e,r){this.context=e,this._options=r,this._cache={}}return A.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(kr(e)||Iu(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return wA(this,void 0,void 0,function(){var r,t,n,s,o=this;return cA(this,function(i){switch(i.label){case 0:return r=ko.isSameOrigin(e),t=!Vr(e)&&this._options.useCORS===!0&&oA.SUPPORT_CORS_IMAGES&&!r,n=!Vr(e)&&!r&&!kr(e)&&typeof this._options.proxy=="string"&&oA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Vr(e)&&!kr(e)&&!n&&!t?[2]:(s=e,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,B){var l=new Image;l.onload=function(){return a(l)},l.onerror=B,(bu(s)||t)&&(l.crossOrigin="anonymous"),l.src=s,l.complete===!0&&setTimeout(function(){return a(l)},500),o._options.imageTimeout>0&&setTimeout(function(){return B("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(s,o){var i=oA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(f){return o(f)},!1),u.readAsDataURL(a.response)}else o("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=o;var B=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+B+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var l=r._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return o("Timed out ("+l+"ms) proxying "+n)}}a.send()})},A})(),vu=/^data:image\/svg\+xml/i,Hu=/^data:image\/.*;base64,/i,yu=/^data:image\/.*/i,Iu=function(A){return oA.SUPPORT_SVG_DRAWING||!xu(A)},Vr=function(A){return yu.test(A)},bu=function(A){return Hu.test(A)},kr=function(A){return A.substr(0,4)==="blob"},xu=function(A){return A.substr(-3).toLowerCase()==="svg"||vu.test(A)},m=(function(){function A(e,r){this.type=0,this.x=e,this.y=r}return A.prototype.add=function(e,r){return new A(this.x+e,this.y+r)},A})(),He=function(A,e,r){return new m(A.x+(e.x-A.x)*r,A.y+(e.y-A.y)*r)},Tt=(function(){function A(e,r,t,n){this.type=1,this.start=e,this.startControl=r,this.endControl=t,this.end=n}return A.prototype.subdivide=function(e,r){var t=He(this.start,this.startControl,e),n=He(this.startControl,this.endControl,e),s=He(this.endControl,this.end,e),o=He(t,n,e),i=He(n,s,e),a=He(o,i,e);return r?new A(this.start,t,o,a):new A(a,i,s,this.end)},A.prototype.add=function(e,r){return new A(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),vA=function(A){return A.type===1},Tu=(function(){function A(e){var r=e.styles,t=e.bounds,n=ze(r.borderTopLeftRadius,t.width,t.height),s=n[0],o=n[1],i=ze(r.borderTopRightRadius,t.width,t.height),a=i[0],B=i[1],l=ze(r.borderBottomRightRadius,t.width,t.height),u=l[0],f=l[1],d=ze(r.borderBottomLeftRadius,t.width,t.height),g=d[0],w=d[1],x=[];x.push((s+a)/t.width),x.push((g+u)/t.width),x.push((o+w)/t.height),x.push((B+f)/t.height);var U=Math.max.apply(Math,x);U>1&&(s/=U,o/=U,a/=U,B/=U,u/=U,f/=U,g/=U,w/=U);var p=t.width-a,E=t.height-f,y=t.width-u,I=t.height-w,C=r.borderTopWidth,b=r.borderRightWidth,_=r.borderBottomWidth,S=r.borderLeftWidth,K=j(r.paddingTop,e.bounds.width),M=j(r.paddingRight,e.bounds.width),J=j(r.paddingBottom,e.bounds.width),R=j(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?z(t.left+S/3,t.top+C/3,s-S/3,o-C/3,Y.TOP_LEFT):new m(t.left+S/3,t.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?z(t.left+p,t.top+C/3,a-b/3,B-C/3,Y.TOP_RIGHT):new m(t.left+t.width-b/3,t.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?z(t.left+y,t.top+E,u-b/3,f-_/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/3,t.top+t.height-_/3),this.bottomLeftBorderDoubleOuterBox=g>0||w>0?z(t.left+S/3,t.top+I,g-S/3,w-_/3,Y.BOTTOM_LEFT):new m(t.left+S/3,t.top+t.height-_/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?z(t.left+S*2/3,t.top+C*2/3,s-S*2/3,o-C*2/3,Y.TOP_LEFT):new m(t.left+S*2/3,t.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?z(t.left+p,t.top+C*2/3,a-b*2/3,B-C*2/3,Y.TOP_RIGHT):new m(t.left+t.width-b*2/3,t.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?z(t.left+y,t.top+E,u-b*2/3,f-_*2/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b*2/3,t.top+t.height-_*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||w>0?z(t.left+S*2/3,t.top+I,g-S*2/3,w-_*2/3,Y.BOTTOM_LEFT):new m(t.left+S*2/3,t.top+t.height-_*2/3),this.topLeftBorderStroke=s>0||o>0?z(t.left+S/2,t.top+C/2,s-S/2,o-C/2,Y.TOP_LEFT):new m(t.left+S/2,t.top+C/2),this.topRightBorderStroke=s>0||o>0?z(t.left+p,t.top+C/2,a-b/2,B-C/2,Y.TOP_RIGHT):new m(t.left+t.width-b/2,t.top+C/2),this.bottomRightBorderStroke=u>0||f>0?z(t.left+y,t.top+E,u-b/2,f-_/2,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/2,t.top+t.height-_/2),this.bottomLeftBorderStroke=g>0||w>0?z(t.left+S/2,t.top+I,g-S/2,w-_/2,Y.BOTTOM_LEFT):new m(t.left+S/2,t.top+t.height-_/2),this.topLeftBorderBox=s>0||o>0?z(t.left,t.top,s,o,Y.TOP_LEFT):new m(t.left,t.top),this.topRightBorderBox=a>0||B>0?z(t.left+p,t.top,a,B,Y.TOP_RIGHT):new m(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||f>0?z(t.left+y,t.top+E,u,f,Y.BOTTOM_RIGHT):new m(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||w>0?z(t.left,t.top+I,g,w,Y.BOTTOM_LEFT):new m(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||o>0?z(t.left+S,t.top+C,Math.max(0,s-S),Math.max(0,o-C),Y.TOP_LEFT):new m(t.left+S,t.top+C),this.topRightPaddingBox=a>0||B>0?z(t.left+Math.min(p,t.width-b),t.top+C,p>t.width+b?0:Math.max(0,a-b),Math.max(0,B-C),Y.TOP_RIGHT):new m(t.left+t.width-b,t.top+C),this.bottomRightPaddingBox=u>0||f>0?z(t.left+Math.min(y,t.width-S),t.top+Math.min(E,t.height-_),Math.max(0,u-b),Math.max(0,f-_),Y.BOTTOM_RIGHT):new m(t.left+t.width-b,t.top+t.height-_),this.bottomLeftPaddingBox=g>0||w>0?z(t.left+S,t.top+Math.min(I,t.height-_),Math.max(0,g-S),Math.max(0,w-_),Y.BOTTOM_LEFT):new m(t.left+S,t.top+t.height-_),this.topLeftContentBox=s>0||o>0?z(t.left+S+R,t.top+C+K,Math.max(0,s-(S+R)),Math.max(0,o-(C+K)),Y.TOP_LEFT):new m(t.left+S+R,t.top+C+K),this.topRightContentBox=a>0||B>0?z(t.left+Math.min(p,t.width+S+R),t.top+C+K,p>t.width+S+R?0:a-S+R,B-(C+K),Y.TOP_RIGHT):new m(t.left+t.width-(b+M),t.top+C+K),this.bottomRightContentBox=u>0||f>0?z(t.left+Math.min(y,t.width-(S+R)),t.top+Math.min(E,t.height+C+K),Math.max(0,u-(b+M)),f-(_+J),Y.BOTTOM_RIGHT):new m(t.left+t.width-(b+M),t.top+t.height-(_+J)),this.bottomLeftContentBox=g>0||w>0?z(t.left+S+R,t.top+I,Math.max(0,g-(S+R)),w-(_+J),Y.BOTTOM_LEFT):new m(t.left+S+R,t.top+t.height-(_+J))}return A})(),Y;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var z=function(A,e,r,t,n){var s=4*((Math.sqrt(2)-1)/3),o=r*s,i=t*s,a=A+r,B=e+t;switch(n){case Y.TOP_LEFT:return new Tt(new m(A,B),new m(A,B-i),new m(a-o,e),new m(a,e));case Y.TOP_RIGHT:return new Tt(new m(A,e),new m(A+o,e),new m(a,B-i),new m(a,B));case Y.BOTTOM_RIGHT:return new Tt(new m(a,e),new m(a,e+i),new m(A+o,B),new m(A,B));case Y.BOTTOM_LEFT:default:return new Tt(new m(a,B),new m(a-o,B),new m(A,e+i),new m(A,e))}},Wt=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Lu=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Jt=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},Su=(function(){function A(e,r,t){this.offsetX=e,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return A})(),Lt=(function(){function A(e,r){this.path=e,this.target=r,this.type=1}return A})(),Ku=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),Du=function(A){return A.type===0},Xo=function(A){return A.type===1},_u=function(A){return A.type===2},ks=function(A,e){return A.length===e.length?A.some(function(r,t){return r===e[t]}):!1},Ru=function(A,e,r,t,n){return A.map(function(s,o){switch(o){case 0:return s.add(e,r);case 1:return s.add(e+t,r);case 2:return s.add(e+t,r+n);case 3:return s.add(e,r+n)}return s})},Wo=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),Jo=(function(){function A(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new Tu(this.container),this.container.styles.opacity<1&&this.effects.push(new Ku(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Su(t,n,s))}if(this.container.styles.overflowX!==0){var o=Wt(this.curves),i=Jt(this.curves);ks(o,i)?this.effects.push(new Lt(o,6)):(this.effects.push(new Lt(o,2)),this.effects.push(new Lt(i,4)))}}return A.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Xo(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var o=Wt(t.curves),i=Jt(t.curves);ks(o,i)||n.unshift(new Lt(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,e)})},A})(),wn=function(A,e,r,t){A.container.elements.forEach(function(n){var s=rA(n.flags,4),o=rA(n.flags,2),i=new Jo(n,A);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||o){var B=s||n.styles.isPositioned()?r:e,l=new Wo(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var f=0;B.negativeZIndex.some(function(g,w){return u>g.element.container.styles.zIndex.order?(f=w,!1):f>0}),B.negativeZIndex.splice(f,0,l)}else if(u>0){var d=0;B.positiveZIndex.some(function(g,w){return u>=g.element.container.styles.zIndex.order?(d=w+1,!1):d>0}),B.positiveZIndex.splice(d,0,l)}else B.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?B.nonPositionedFloats.push(l):B.nonPositionedInlineLevel.push(l);wn(i,l,s?l:r,a)}else n.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),wn(i,e,r,a);rA(n.flags,8)&&Yo(n,a)})},Yo=function(A,e){for(var r=A instanceof cn?A.start:1,t=A instanceof cn?A.reversed:!1,n=0;n<e.length;n++){var s=e[n];s.container instanceof To&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=at(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},Mu=function(A){var e=new Jo(A,null),r=new Wo(e),t=[];return wn(e,r,r,t),Yo(e.container,t),r},Xs=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},Ou=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return yA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Gu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Nu=function(A,e){switch(e){case 0:return St(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return St(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return St(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return St(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},St=function(A,e){var r=[];return vA(A)?r.push(A.subdivide(.5,!1)):r.push(A),vA(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},yA=function(A,e,r,t){var n=[];return vA(A)?n.push(A.subdivide(.5,!1)):n.push(A),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Zo=function(A){var e=A.bounds,r=A.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Yt=function(A){var e=A.styles,r=A.bounds,t=j(e.paddingLeft,r.width),n=j(e.paddingRight,r.width),s=j(e.paddingTop,r.width),o=j(e.paddingBottom,r.width);return r.add(t+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+n),-(e.borderTopWidth+e.borderBottomWidth+s+o))},Pu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Vu=function(A,e){return A===0?e.bounds:A===2?Yt(e):Zo(e)},Xr=function(A,e,r){var t=Pu(be(A.styles.backgroundOrigin,e),A),n=Vu(be(A.styles.backgroundClip,e),A),s=ku(be(A.styles.backgroundSize,e),r,t),o=s[0],i=s[1],a=ze(be(A.styles.backgroundPosition,e),t.width-o,t.height-i),B=Xu(be(A.styles.backgroundRepeat,e),a,s,t,n),l=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[B,l,u,o,i]},ye=function(A){return Z(A)&&A.value===Te.AUTO},Kt=function(A){return typeof A=="number"},ku=function(A,e,r){var t=e[0],n=e[1],s=e[2],o=A[0],i=A[1];if(!o)return[0,0];if(tA(o)&&i&&tA(i))return[j(o,r.width),j(i,r.height)];var a=Kt(s);if(Z(o)&&(o.value===Te.CONTAIN||o.value===Te.COVER)){if(Kt(s)){var B=r.width/r.height;return B<s!=(o.value===Te.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var l=Kt(t),u=Kt(n),f=l||u;if(ye(o)&&(!i||ye(i))){if(l&&u)return[t,n];if(!a&&!f)return[r.width,r.height];if(f&&a){var d=l?t:n*s,g=u?n:t/s;return[d,g]}var w=l?t:r.width,x=u?n:r.height;return[w,x]}if(a){var U=0,p=0;return tA(o)?U=j(o,r.width):tA(i)&&(p=j(i,r.height)),ye(o)?U=p*s:(!i||ye(i))&&(p=U/s),[U,p]}var E=null,y=null;if(tA(o)?E=j(o,r.width):i&&tA(i)&&(y=j(i,r.height)),E!==null&&(!i||ye(i))&&(y=l&&u?E/t*n:r.height),y!==null&&ye(o)&&(E=l&&u?y/n*t:r.width),E!==null&&y!==null)return[E,y];throw new Error("Unable to calculate background-size for element")},be=function(A,e){var r=A[e];return typeof r>"u"?A[0]:r},Xu=function(A,e,r,t,n){var s=e[0],o=e[1],i=r[0],a=r[1];switch(A){case 2:return[new m(Math.round(t.left),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(a+t.top+o)),new m(Math.round(t.left),Math.round(a+t.top+o))];case 3:return[new m(Math.round(t.left+s),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.height+t.top)),new m(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new m(Math.round(t.left+s),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o+a)),new m(Math.round(t.left+s),Math.round(t.top+o+a))];default:return[new m(Math.round(n.left),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.height+n.top)),new m(Math.round(n.left),Math.round(n.height+n.top))]}},Wu="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ws="Hidden Text",Ju=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",o.appendChild(t),n.src=Wu,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Ws)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(Ws)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return o.removeChild(t),{baseline:i,middle:a}},A.prototype.getMetrics=function(e,r){var t=e+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,r)),this._data[t]},A})(),qo=(function(){function A(e,r){this.context=e,this.options=r}return A})(),Yu=1e4,Zu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Ju(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return e.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},e.prototype.applyEffect=function(r){this.ctx.save(),_u(r)&&(this.ctx.globalAlpha=r.opacity),Du(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),Xo(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return wA(this,void 0,void 0,function(){return cA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var o=Un(r.text);o.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),n=Af(r.fontFamily).join(", "),s=ct(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},e.prototype.renderTextNode=function(r,t){return wA(this,void 0,void 0,function(){var n,s,o,i,a,B,l,u,f=this;return cA(this,function(d){return n=this.createFontStyle(t),s=n[0],o=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(o,i),B=a.baseline,l=a.middle,u=t.paintOrder,r.textBounds.forEach(function(g){u.forEach(function(w){switch(w){case 0:f.ctx.fillStyle=nA(t.color),f.renderTextWithLetterSpacing(g,t.letterSpacing,B);var x=t.textShadow;x.length&&g.text.trim().length&&(x.slice(0).reverse().forEach(function(U){f.ctx.shadowColor=nA(U.color),f.ctx.shadowOffsetX=U.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=U.offsetY.number*f.options.scale,f.ctx.shadowBlur=U.blur.number,f.renderTextWithLetterSpacing(g,t.letterSpacing,B)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),t.textDecorationLine.length&&(f.ctx.fillStyle=nA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(U){switch(U){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+B),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+l),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=nA(t.webkitTextStrokeColor),f.ctx.lineWidth=t.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+B)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Yt(r),o=Jt(t);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,p,p,B,l,u,f,y,d,g,I,w,x,U,p,E,y,I;return cA(this,function(C){switch(C.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,o=0,i=t.textNodes,C.label=1;case 1:return o<i.length?(a=i[o],[4,this.renderTextNode(a,s)]):[3,4];case 2:C.sent(),C.label=3;case 3:return o++,[3,1];case 4:if(!(t instanceof Io))return[3,8];C.label=5;case 5:return C.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,8];case 7:return C.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof bo&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof xo))return[3,12];C.label=9;case 9:return C.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,12];case 11:return C.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ko&&t.tree?(B=new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,B.render(t.tree)]):[3,14];case 13:l=C.sent(),t.width&&t.height&&this.ctx.drawImage(l,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),C.label=14;case 14:if(t instanceof Fn&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Pt?t.checked&&(this.ctx.save(),this.path([new m(t.bounds.left+u*.39363,t.bounds.top+u*.79),new m(t.bounds.left+u*.16,t.bounds.top+u*.5549),new m(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new m(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new m(t.bounds.left+u*.72983,t.bounds.top+u*.23),new m(t.bounds.left+u*.84,t.bounds.top+u*.34085),new m(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore()):t.type===Vt&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=nA(Ss),this.ctx.fill(),this.ctx.restore())),qu(t)&&t.value.length){switch(f=this.createFontStyle(s),y=f[0],d=f[1],g=this.fontMetrics.getMetrics(y,d).baseline,this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=zu(t.styles.textAlign),I=Yt(t),w=0,t.styles.textAlign){case 1:w+=I.width/2;break;case 2:w+=I.width;break}x=I.add(w,0,0,-I.height/2+1),this.ctx.save(),this.path([new m(I.left,I.top),new m(I.left+I.width,I.top),new m(I.left+I.width,I.top+I.height),new m(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new nt(t.value,x),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(U=t.styles.listStyleImage,U.type!==0)return[3,18];p=void 0,E=U.url,C.label=15;case 15:return C.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return p=C.sent(),this.ctx.drawImage(p,t.bounds.left-(p.width+10),t.bounds.top),[3,18];case 17:return C.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(y=this.createFontStyle(s)[0],this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new XA(t.bounds.left,t.bounds.top+j(t.styles.paddingTop,t.bounds.width),t.bounds.width,Qs(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new nt(r.listValue,I),s.letterSpacing,Qs(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),C.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return wA(this,void 0,void 0,function(){var t,n,U,s,o,U,i,a,U,B,l,U,u,f,U,d,g,U,w,x,U;return cA(this,function(p){switch(p.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:p.sent(),t=0,n=r.negativeZIndex,p.label=2;case 2:return t<n.length?(U=n[t],[4,this.renderStack(U)]):[3,5];case 3:p.sent(),p.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:p.sent(),s=0,o=r.nonInlineLevel,p.label=7;case 7:return s<o.length?(U=o[s],[4,this.renderNode(U)]):[3,10];case 8:p.sent(),p.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,p.label=11;case 11:return i<a.length?(U=a[i],[4,this.renderStack(U)]):[3,14];case 12:p.sent(),p.label=13;case 13:return i++,[3,11];case 14:B=0,l=r.nonPositionedInlineLevel,p.label=15;case 15:return B<l.length?(U=l[B],[4,this.renderStack(U)]):[3,18];case 16:p.sent(),p.label=17;case 17:return B++,[3,15];case 18:u=0,f=r.inlineLevel,p.label=19;case 19:return u<f.length?(U=f[u],[4,this.renderNode(U)]):[3,22];case 20:p.sent(),p.label=21;case 21:return u++,[3,19];case 22:d=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return d<g.length?(U=g[d],[4,this.renderStack(U)]):[3,26];case 24:p.sent(),p.label=25;case 25:return d++,[3,23];case 26:w=0,x=r.positiveZIndex,p.label=27;case 27:return w<x.length?(U=x[w],[4,this.renderStack(U)]):[3,30];case 28:p.sent(),p.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var t=this;r.forEach(function(n,s){var o=vA(n)?n.start:n;s===0?t.ctx.moveTo(o.x,o.y):t.ctx.lineTo(o.x,o.y),vA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(r,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},e.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var o=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=o.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},e.prototype.renderBackgroundImage=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a;return cA(this,function(B){switch(B.label){case 0:t=r.styles.backgroundImage.length-1,n=function(l){var u,f,d,K,G,X,R,O,_,g,K,G,X,R,O,w,x,U,p,E,y,I,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA,hA;return cA(this,function(OA){switch(OA.label){case 0:if(l.type!==0)return[3,5];u=void 0,f=l.url,OA.label=1;case 1:return OA.trys.push([1,3,,4]),[4,s.context.cache.match(f)];case 2:return u=OA.sent(),[3,4];case 3:return OA.sent(),s.context.logger.error("Error loading background-image "+f),[3,4];case 4:return u&&(d=Xr(r,t,[u.width,u.height,u.width/u.height]),K=d[0],G=d[1],X=d[2],R=d[3],O=d[4],_=s.ctx.createPattern(s.resizeImage(u,R,O),"repeat"),s.renderRepeat(K,_,G,X)),[3,6];case 5:DB(l)?(g=Xr(r,t,[null,null,null]),K=g[0],G=g[1],X=g[2],R=g[3],O=g[4],w=xB(l.angle,R,O),x=w[0],U=w[1],p=w[2],E=w[3],y=w[4],I=document.createElement("canvas"),I.width=R,I.height=O,C=I.getContext("2d"),b=C.createLinearGradient(U,E,p,y),gs(l.stops,x).forEach(function(WA){return b.addColorStop(WA.stop,nA(WA.color))}),C.fillStyle=b,C.fillRect(0,0,R,O),R>0&&O>0&&(_=s.ctx.createPattern(I,"repeat"),s.renderRepeat(K,_,G,X))):_B(l)&&(S=Xr(r,t,[null,null,null]),K=S[0],M=S[1],J=S[2],R=S[3],O=S[4],eA=l.position.length===0?[dn]:l.position,G=j(eA[0],R),X=j(eA[eA.length-1],O),dA=TB(l,G,X,R,O),aA=dA[0],BA=dA[1],aA>0&&BA>0&&(FA=s.ctx.createRadialGradient(M+G,J+X,0,M+G,J+X,aA),gs(l.stops,aA*2).forEach(function(WA){return FA.addColorStop(WA.stop,nA(WA.color))}),s.path(K),s.ctx.fillStyle=FA,aA!==BA?(MA=r.bounds.left+.5*r.bounds.width,CA=r.bounds.top+.5*r.bounds.height,LA=BA/aA,hA=1/LA,s.ctx.save(),s.ctx.translate(MA,CA),s.ctx.transform(1,0,0,LA,0,0),s.ctx.translate(-MA,-CA),s.ctx.fillRect(M,hA*(J-CA)+CA,R,O*hA),s.ctx.restore()):s.ctx.fill())),OA.label=6;case 6:return t--,[2]}})},s=this,o=0,i=r.styles.backgroundImage.slice(0).reverse(),B.label=1;case 1:return o<i.length?(a=i[o],[5,n(a)]):[3,4];case 2:B.sent(),B.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,t,n){return wA(this,void 0,void 0,function(){return cA(this,function(s){return this.path(Xs(n,t)),this.ctx.fillStyle=nA(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,t,n,s){return wA(this,void 0,void 0,function(){var o,i;return cA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return o=Ou(s,n),this.path(o),this.ctx.fillStyle=nA(r),this.ctx.fill(),i=Gu(s,n),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,B,l,u=this;return cA(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!te(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],o=ju(be(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),te(t.backgroundColor)||(this.ctx.fillStyle=nA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(d){u.ctx.save();var g=Wt(r.curves),w=d.inset?0:Yu,x=Ru(g,-w+(d.inset?1:-1)*d.spread.number,(d.inset?1:-1)*d.spread.number,d.spread.number*(d.inset?-2:2),d.spread.number*(d.inset?-2:2));d.inset?(u.path(g),u.ctx.clip(),u.mask(x)):(u.mask(g),u.ctx.clip(),u.path(x)),u.ctx.shadowOffsetX=d.offsetX.number+w,u.ctx.shadowOffsetY=d.offsetY.number,u.ctx.shadowColor=nA(d.color),u.ctx.shadowBlur=d.blur.number,u.ctx.fillStyle=d.inset?nA(d.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),f.label=2;case 2:i=0,a=0,B=s,f.label=3;case 3:return a<B.length?(l=B[a],l.style!==0&&!te(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,i,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,i,r.curves)];case 10:f.sent(),f.label=11;case 11:i++,f.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,t,n,s,o){return wA(this,void 0,void 0,function(){var i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,C,I,C;return cA(this,function(b){return this.ctx.save(),i=Nu(s,n),a=Xs(s,n),o===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(B=a[0].start.x,l=a[0].start.y):(B=a[0].x,l=a[0].y),vA(a[1])?(u=a[1].end.x,f=a[1].end.y):(u=a[1].x,f=a[1].y),n===0||n===2?d=Math.abs(B-u):d=Math.abs(l-f),this.ctx.beginPath(),o===3?this.formatPath(i):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,w=t<3?t*2:t,o===3&&(g=t,w=t),x=!0,d<=g*2?x=!1:d<=g*2+w?(U=d/(2*g+w),g*=U,w*=U):(p=Math.floor((d+w)/(g+w)),E=(d-p*g)/(p-1),y=(d-(p+1)*g)/p,w=y<=0||Math.abs(w-E)<Math.abs(w-y)?E:y),x&&(o===3?this.ctx.setLineDash([0,g+w]):this.ctx.setLineDash([g,w])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=nA(r),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(vA(a[0])&&(I=a[3],C=a[0],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke()),vA(a[1])&&(I=a[1],C=a[2],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=Mu(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(qo),qu=function(A){return A instanceof So||A instanceof Lo?!0:A instanceof Fn&&A.type!==Vt&&A.type!==Pt},ju=function(A,e){switch(A){case 0:return Wt(e);case 2:return Lu(e);default:return Jt(e)}},zu=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},$u=["-apple-system","system-ui"],Af=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return $u.indexOf(e)===-1}):A},ef=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t,n;return cA(this,function(s){switch(s.label){case 0:return t=Bn(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,tf(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(qo),tf=function(A){return new Promise(function(e,r){var t=new Image;t.onload=function(){e(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},rf=(function(){function A(e){var r=e.id,t=e.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,dt([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,dt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),nf=(function(){function A(e,r){var t;this.windowBounds=r,this.instanceName="#"+A.instanceCount++,this.logger=new rf({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new Eu(this,e)}return A.instanceCount=1,A})(),sf=function(A,e){return e===void 0&&(e={}),of(A,e)};typeof window<"u"&&ko.setContext(window);var of=function(A,e){return wA(void 0,void 0,void 0,function(){var r,t,n,s,o,i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,b,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA;return cA(this,function(hA){switch(hA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=A.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(_=e.allowTaint)!==null&&_!==void 0?_:!1,imageTimeout:(S=e.imageTimeout)!==null&&S!==void 0?S:15e3,proxy:e.proxy,useCORS:(K=e.useCORS)!==null&&K!==void 0?K:!1},s=Jr({logging:(M=e.logging)!==null&&M!==void 0?M:!0,cache:e.cache},n),o={windowWidth:(J=e.windowWidth)!==null&&J!==void 0?J:t.innerWidth,windowHeight:(R=e.windowHeight)!==null&&R!==void 0?R:t.innerHeight,scrollX:(O=e.scrollX)!==null&&O!==void 0?O:t.pageXOffset,scrollY:(eA=e.scrollY)!==null&&eA!==void 0?eA:t.pageYOffset},i=new XA(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),a=new nf(s,i),B=(G=e.foreignObjectRendering)!==null&&G!==void 0?G:!1,l={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:B,copyStyles:B},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Ps(a,A,l),f=u.clonedReferenceElement,f?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=hA.sent(),g=pn(f)||iu(f)?Ri(f.ownerDocument):Zt(a,f),w=g.width,x=g.height,U=g.left,p=g.top,E=af(a,f,e.backgroundColor),y={canvas:e.canvas,backgroundColor:E,scale:(aA=(dA=e.scale)!==null&&dA!==void 0?dA:t.devicePixelRatio)!==null&&aA!==void 0?aA:1,x:((BA=e.x)!==null&&BA!==void 0?BA:0)+U,y:((FA=e.y)!==null&&FA!==void 0?FA:0)+p,width:(MA=e.width)!==null&&MA!==void 0?MA:Math.ceil(w),height:(CA=e.height)!==null&&CA!==void 0?CA:Math.ceil(x)},B?(a.logger.debug("Document cloned, using foreign object rendering"),b=new ef(a,y),[4,b.render(f)]):[3,3];case 2:return I=hA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+U+","+p+" with size "+w+"x"+x+" using computed rendering"),a.logger.debug("Starting DOM parsing"),C=_o(a,f),E===C.styles.backgroundColor&&(C.styles.backgroundColor=kA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+y.x+","+y.y+" with size "+y.width+"x"+y.height),b=new Zu(a,y),[4,b.render(C)];case 4:I=hA.sent(),hA.label=5;case 5:return(!((LA=e.removeContainer)!==null&&LA!==void 0)||LA)&&(Ps.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,I]}})})},af=function(A,e,r){var t=e.ownerDocument,n=t.documentElement?tt(A,getComputedStyle(t.documentElement).backgroundColor):kA.TRANSPARENT,s=t.body?tt(A,getComputedStyle(t.body).backgroundColor):kA.TRANSPARENT,o=typeof r=="string"?tt(A,r):r===null?kA.TRANSPARENT:4294967295;return e===t.documentElement?te(n)?te(s)?o:s:n:o},jo=sf;var zo=!1,Bf=new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]);function cf(){if(zo)return;zo=!0;let A=CanvasRenderingContext2D.prototype.createPattern;CanvasRenderingContext2D.prototype.createPattern=function(e,r){return e&&"width"in e&&"height"in e&&(e.width===0||e.height===0)?null:A.call(this,e,r)}}function Ai(){cf()}function ei(A){A.style.opacity="1",fe(A,"important"),A.querySelectorAll("[data-start]").forEach(e=>fe(e,"important"))}function lf(A,e){if(!A.id)return;let r=e.getElementById(A.id);r instanceof HTMLElement&&ei(r)}function uf(A){let e=A.ownerDocument.defaultView;e&&[A,...Array.from(A.querySelectorAll("*"))].forEach(r=>{if(Bf.has(r.tagName))return;let t=e.getComputedStyle(r);if(t.boxShadow==="none"||t.transform==="none")return;let n=A.ownerDocument.createElement("div");n.setAttribute("data-hyper-shader-shadow-shim",""),n.style.cssText=["position:absolute","inset:0","border-radius:inherit",`box-shadow:${t.boxShadow}`,"background:transparent","pointer-events:none","z-index:0"].join(";"),t.position==="static"&&(r.style.position="relative"),r.style.boxShadow="none",r.insertBefore(n,r.firstChild)})}function lt(){if(typeof document>"u")return!1;let A=document.createElement("canvas");if(A.setAttribute("layoutsubtree",""),!("layoutSubtree"in A))return!1;let e=A.getContext("2d");return e!=null&&typeof e.drawElementImage=="function"}async function ff(A,e,r,t,n){let s=document.createElement("canvas");s.width=r,s.height=t,s.setAttribute("layoutsubtree",""),s.style.cssText=`position:fixed;top:0;left:0;width:${r}px;height:${t}px;z-index:-9999;pointer-events:none;opacity:0`;let o=A.cloneNode(!0);n.forceVisible&&ei(o),s.appendChild(o),document.body.appendChild(s);try{await new Promise(l=>requestAnimationFrame(()=>requestAnimationFrame(()=>l())));let i=s.getContext("2d");i.fillStyle=e,i.fillRect(0,0,r,t);let a=s.firstElementChild;a&&i.drawElementImage(a,0,0,r,t);let B=document.createElement("canvas");return B.width=r,B.height=t,B.getContext("2d").drawImage(s,0,0),s.remove(),B}catch(i){throw s.remove(),i}}function ti(A,e,r=we,t=Qe,n={}){return lt()&&!n.preferBrowserPaint?ff(A,e,r,t,n).catch(()=>$o(A,e,r,t,n)):$o(A,e,r,t,n)}function $o(A,e,r,t,n={}){let s=o=>jo(A,{width:r,height:t,scale:n.scale??1,backgroundColor:e,logging:!1,foreignObjectRendering:o,useCORS:!0,allowTaint:!0,onclone:i=>{if(!A.id)return;let a=i.getElementById(A.id);a instanceof HTMLElement&&uf(a),n.forceVisible&&lf(A,i)},ignoreElements:i=>i.tagName==="CANVAS"||i.hasAttribute("data-no-capture")});return n.preferBrowserPaint===!0?s(!0).catch(()=>s(!1)):s(!1)}var sr="__hf-page-side-compositor",mn="__hf_page_compositor_v1__";function gf(A,e){let r=A.querySelectorAll("*"),t=e.querySelectorAll("*"),n=[[A,e]];r.forEach((i,a)=>n.push([i,t[a]]));let s=e,o=A;for(let i=A.parentElement;i&&i!==document.body&&i!==document.documentElement;i=i.parentElement){let a=i.cloneNode(!1);a.appendChild(s),n.push([i,a]),s=a,o=i}return{root:s,liveRoot:o,pairs:n}}function wf(A,e,r){let t=new Map;r.forEach(([o,i],a)=>{t.set(o,a),t.set(i,a)});let n=o=>{if(!("animationName"in o))return null;let i=o.effect;return`${t.get(i.target)}|${i.pseudoElement??""}|${o.animationName}`},s=new Map;for(let o of A.getAnimations({subtree:!0})){let i=n(o);i&&s.set(i,o.currentTime)}for(let o of e.getAnimations({subtree:!0})){let i=n(o);if(!i)continue;let a=s.get(i);a===void 0?o.cancel():(o.pause(),o.currentTime=a)}}function En(){if(typeof window>"u"||typeof document>"u"||!lt())return!1;let A=document.createElement("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl");return e?(e.getExtension("WEBGL_lose_context")?.loseContext(),!0):!1}function or(A){if(typeof window>"u")return!1;if(window.__HF_PAGE_COMPOSITOR_CANARY__=mn,!En())return console.warn("[HyperShader] page-side compositing requested but drawElementImage/WebGL is not available; falling back to opacity-flip mode (Node-side layered pipeline will handle the blend)."),!1;if(document.getElementById(sr))return!0;let{scenes:e,transitions:r,accentColors:t,width:n,height:s,defaultDuration:o}=A,i=document.createElement("canvas");i.id=sr,i.width=n,i.height=s,i.style.cssText="position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483646;pointer-events:none;display:none;",document.body.appendChild(i);let a=de(i,n,s);if(!a)return console.warn("[HyperShader] page-side compositor: WebGL context unavailable."),i.remove(),!1;let B=Ce(a),l=new Map;for(let K of r)if(K.shader!==void 0&&!l.has(K.shader))try{l.set(K.shader,he(a,Fe(K.shader)))}catch(M){console.warn(`[HyperShader] page-side compositor: failed to compile "${K.shader}":`,M)}let u=[];for(let K=0;K<r.length;K++){let M=r[K];if(!M||M.shader===void 0)continue;let J=e[K],R=e[K+1],O=l.get(M.shader);!J||!R||!O||u.push({time:M.time,duration:M.duration??o,shader:M.shader,fromSceneId:J,toSceneId:R,prog:O})}if(u.length===0)return i.remove(),!1;let f=SA(a),d=SA(a),g=document.createElement("canvas"),w=document.createElement("canvas");for(let K of[g,w])K.width=n,K.height=s,K.setAttribute("layoutsubtree",""),K.style.cssText="position:fixed;top:0;left:0;width:"+n+"px;height:"+s+"px;z-index:-9998;pointer-events:none;",document.body.appendChild(K);function x(K){for(let M of u)if(K>=M.time&&K<=M.time+M.duration)return M;return null}let U=null,p=0,E=window;async function y(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=document.getElementById(K.fromSceneId),J=document.getElementById(K.toSceneId);if(!(M instanceof HTMLElement)||!(J instanceof HTMLElement))return E.__hf_page_composite_pending=!1,!1;for(;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);for(let[O,eA]of[[M,g],[J,w]]){let G=O.cloneNode(!0);G.style.opacity="1",fe(G),G.querySelectorAll("[data-start]").forEach(FA=>{FA.style.opacity="1",fe(FA)});let{root:X,liveRoot:dA,pairs:aA}=gf(O,G),BA=document.createElement("div");BA.style.cssText=`position:absolute;left:0;top:0;width:${n}px;height:${s}px;margin:0;`,BA.appendChild(X),eA.appendChild(BA),wf(dA,X,aA)}let R=[];for(let O of[g,w])for(let eA of O.querySelectorAll("img"))eA.src&&eA.src.startsWith("data:")&&typeof eA.decode=="function"&&R.push(eA.decode().catch(()=>{}));return R.length>0&&await Promise.all(R),!0}function I(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=g.firstElementChild,J=w.firstElementChild;if(!M||!J)return E.__hf_page_composite_pending=!1,!1;let R=g.getContext("2d"),O=w.getContext("2d");if(!R?.drawElementImage||!O?.drawElementImage)return E.__hf_page_composite_pending=!1,!1;let eA=[[R,M],[O,J]];try{for(let[G,X]of eA)G.fillStyle=A.bgColor,G.fillRect(0,0,n,s),G.drawElementImage(X,0,0,n,s);NA(a,f,g),NA(a,d,w)}catch(G){return console.warn("[HyperShader] page-side compositor: scene capture failed:",G),i.style.display="none",E.__hf_page_composite_pending=!1,!1}finally{for(let[G]of eA)G.clearRect(0,0,n,s)}try{Ue(a,B,K.prog,f,d,p,t,n,s),i.style.display="block"}catch(G){console.warn("[HyperShader] page-side compositor: renderShader failed:",G),i.style.display="none"}return E.__hf_page_composite_pending=!1,!0}E.__hf_page_composite_resolve=I,E.__hf_page_composite_prepare=y;let C=window,b=()=>{if(!C.__hf)return;let K=C.__hf.seek;if(typeof K!="function")return;let M=J=>{let R=K.call(C.__hf,J),O=x(J);if(!O){for(i.style.display="none",E.__hf_page_composite_pending=!1;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);return R}return U=O,p=O.duration===0?1:Math.min(1,Math.max(0,(J-O.time)/O.duration)),E.__hf_page_composite_pending=!0,R};C.__hf.seek=M},_=0,S=window.setInterval(()=>{_+=1,C.__hf?.seek?(b(),window.clearInterval(S)):_>200&&(window.clearInterval(S),console.warn("[HyperShader] page-side compositor: window.__hf.seek never appeared after 10s; the engine bridge did not initialize. Falling back to opacity-flip mode."))},50);return!0}var Br=.7,Hn="power2.inOut",Qf="attribute vec2 a_pos; varying vec2 v_uv; void main(){v_uv=a_pos*0.5+0.5; gl_Position=vec4(a_pos,0,1);}",ir=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"],df="hyper-shader-preview-cache",RA="frames",Cf=1,hf="v1",ri=2,ni=1.25,Uf=1200;function Ff(A){let e=A.replace("#","");if(e.length<6)return[.5,.5,.5];let r=parseInt(e.slice(0,2),16)/255,t=parseInt(e.slice(2,4),16)/255,n=parseInt(e.slice(4,6),16)/255;return Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n)?[.5,.5,.5]:[r,t,n]}function ui(A){let[e,r,t]=Ff(A);return{accent:[e,r,t],dark:[e*.35,r*.35,t*.35],bright:[Math.min(1,e*1.5+.2),Math.min(1,r*1.5+.2),Math.min(1,t*1.5+.2)]}}function le(A,e,r){return Math.min(r,Math.max(e,A))}function pf(A,e){return A===void 0?e:Number.isFinite(A)&&A>0?A:e}var mf="__hf_shader_capture_scale",Ef="__hf_shader_loading";function fi(A,e){let r=window[A];if(typeof r=="string")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r);try{return new URLSearchParams(window.location.search).get(e)}catch{return null}}function vf(){let A=fi("__HF_SHADER_CAPTURE_SCALE",mf),e=A===null?NaN:Number(A);return le(Number.isFinite(e)&&e>0?e:1,.25,1)}function Hf(){if(window.__HF_REPLAY_SKIPPED_FRAMES)return"none";let A=fi("__HF_SHADER_LOADING",Ef)?.trim().toLowerCase();return A==="player"||A==="true"||A==="1"?"player":A==="none"||A==="false"||A==="0"||A==="off"?"none":"internal"}function lr(A){let e=2166136261;for(let r=0;r<A.length;r+=1)e^=A.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}function yf(A){let e=Array.from(A.querySelectorAll("style")).map(t=>t.textContent||"").join(`
7
7
  `),r=Array.from(A.querySelectorAll('link[rel~="stylesheet"]')).map(t=>`${t.href}:${t.getAttribute("integrity")||""}`).join(`
8
8
  `);return lr(`${e}
9
9
  ${r}`)}function If(A){return A.includes("gsap.timeline")||A.includes("__timelines")||A.includes(".to(")||A.includes(".set(")?!A.includes("HyperShader")&&!A.includes("hyper-shader")&&!A.includes("hyperShader"):!1}function bf(A){let e=Array.from(A.querySelectorAll('meta[name="hyperframes-project-signature"]')).map(t=>t.getAttribute("content")||"").join(`
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var gt="data-hf-clip-hidden";function fe(A,e=""){return A.style.setProperty("vis
3
3
  content: "" !important;
4
4
  display: none !important;
5
5
  }`,fu=function(A){gu(A,"."+Bn+lu+Gs+`
6
- .`+cn+uu+Gs)},gu=function(A,e){var r=A.ownerDocument;if(r){var t=r.createElement("style");t.textContent=e,A.appendChild(t)}},No=(function(){function A(){}return A.getOrigin=function(e){var r=A._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),wu=(function(){function A(e,r){this.context=e,this._options=r,this._cache={}}return A.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(Gr(e)||hu(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return wA(this,void 0,void 0,function(){var r,t,n,s,o=this;return cA(this,function(i){switch(i.label){case 0:return r=No.isSameOrigin(e),t=!Or(e)&&this._options.useCORS===!0&&oA.SUPPORT_CORS_IMAGES&&!r,n=!Or(e)&&!r&&!Gr(e)&&typeof this._options.proxy=="string"&&oA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Or(e)&&!Gr(e)&&!n&&!t?[2]:(s=e,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,B){var l=new Image;l.onload=function(){return a(l)},l.onerror=B,(Uu(s)||t)&&(l.crossOrigin="anonymous"),l.src=s,l.complete===!0&&setTimeout(function(){return a(l)},500),o._options.imageTimeout>0&&setTimeout(function(){return B("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(s,o){var i=oA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(f){return o(f)},!1),u.readAsDataURL(a.response)}else o("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=o;var B=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+B+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var l=r._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return o("Timed out ("+l+"ms) proxying "+n)}}a.send()})},A})(),Qu=/^data:image\/svg\+xml/i,du=/^data:image\/.*;base64,/i,Cu=/^data:image\/.*/i,hu=function(A){return oA.SUPPORT_SVG_DRAWING||!Fu(A)},Or=function(A){return Cu.test(A)},Uu=function(A){return du.test(A)},Gr=function(A){return A.substr(0,4)==="blob"},Fu=function(A){return A.substr(-3).toLowerCase()==="svg"||Qu.test(A)},m=(function(){function A(e,r){this.type=0,this.x=e,this.y=r}return A.prototype.add=function(e,r){return new A(this.x+e,this.y+r)},A})(),He=function(A,e,r){return new m(A.x+(e.x-A.x)*r,A.y+(e.y-A.y)*r)},xt=(function(){function A(e,r,t,n){this.type=1,this.start=e,this.startControl=r,this.endControl=t,this.end=n}return A.prototype.subdivide=function(e,r){var t=He(this.start,this.startControl,e),n=He(this.startControl,this.endControl,e),s=He(this.endControl,this.end,e),o=He(t,n,e),i=He(n,s,e),a=He(o,i,e);return r?new A(this.start,t,o,a):new A(a,i,s,this.end)},A.prototype.add=function(e,r){return new A(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),vA=function(A){return A.type===1},pu=(function(){function A(e){var r=e.styles,t=e.bounds,n=ze(r.borderTopLeftRadius,t.width,t.height),s=n[0],o=n[1],i=ze(r.borderTopRightRadius,t.width,t.height),a=i[0],B=i[1],l=ze(r.borderBottomRightRadius,t.width,t.height),u=l[0],f=l[1],d=ze(r.borderBottomLeftRadius,t.width,t.height),g=d[0],w=d[1],x=[];x.push((s+a)/t.width),x.push((g+u)/t.width),x.push((o+w)/t.height),x.push((B+f)/t.height);var U=Math.max.apply(Math,x);U>1&&(s/=U,o/=U,a/=U,B/=U,u/=U,f/=U,g/=U,w/=U);var p=t.width-a,E=t.height-f,y=t.width-u,I=t.height-w,C=r.borderTopWidth,b=r.borderRightWidth,_=r.borderBottomWidth,S=r.borderLeftWidth,K=j(r.paddingTop,e.bounds.width),M=j(r.paddingRight,e.bounds.width),J=j(r.paddingBottom,e.bounds.width),R=j(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?z(t.left+S/3,t.top+C/3,s-S/3,o-C/3,Y.TOP_LEFT):new m(t.left+S/3,t.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?z(t.left+p,t.top+C/3,a-b/3,B-C/3,Y.TOP_RIGHT):new m(t.left+t.width-b/3,t.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?z(t.left+y,t.top+E,u-b/3,f-_/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/3,t.top+t.height-_/3),this.bottomLeftBorderDoubleOuterBox=g>0||w>0?z(t.left+S/3,t.top+I,g-S/3,w-_/3,Y.BOTTOM_LEFT):new m(t.left+S/3,t.top+t.height-_/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?z(t.left+S*2/3,t.top+C*2/3,s-S*2/3,o-C*2/3,Y.TOP_LEFT):new m(t.left+S*2/3,t.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?z(t.left+p,t.top+C*2/3,a-b*2/3,B-C*2/3,Y.TOP_RIGHT):new m(t.left+t.width-b*2/3,t.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?z(t.left+y,t.top+E,u-b*2/3,f-_*2/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b*2/3,t.top+t.height-_*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||w>0?z(t.left+S*2/3,t.top+I,g-S*2/3,w-_*2/3,Y.BOTTOM_LEFT):new m(t.left+S*2/3,t.top+t.height-_*2/3),this.topLeftBorderStroke=s>0||o>0?z(t.left+S/2,t.top+C/2,s-S/2,o-C/2,Y.TOP_LEFT):new m(t.left+S/2,t.top+C/2),this.topRightBorderStroke=s>0||o>0?z(t.left+p,t.top+C/2,a-b/2,B-C/2,Y.TOP_RIGHT):new m(t.left+t.width-b/2,t.top+C/2),this.bottomRightBorderStroke=u>0||f>0?z(t.left+y,t.top+E,u-b/2,f-_/2,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/2,t.top+t.height-_/2),this.bottomLeftBorderStroke=g>0||w>0?z(t.left+S/2,t.top+I,g-S/2,w-_/2,Y.BOTTOM_LEFT):new m(t.left+S/2,t.top+t.height-_/2),this.topLeftBorderBox=s>0||o>0?z(t.left,t.top,s,o,Y.TOP_LEFT):new m(t.left,t.top),this.topRightBorderBox=a>0||B>0?z(t.left+p,t.top,a,B,Y.TOP_RIGHT):new m(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||f>0?z(t.left+y,t.top+E,u,f,Y.BOTTOM_RIGHT):new m(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||w>0?z(t.left,t.top+I,g,w,Y.BOTTOM_LEFT):new m(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||o>0?z(t.left+S,t.top+C,Math.max(0,s-S),Math.max(0,o-C),Y.TOP_LEFT):new m(t.left+S,t.top+C),this.topRightPaddingBox=a>0||B>0?z(t.left+Math.min(p,t.width-b),t.top+C,p>t.width+b?0:Math.max(0,a-b),Math.max(0,B-C),Y.TOP_RIGHT):new m(t.left+t.width-b,t.top+C),this.bottomRightPaddingBox=u>0||f>0?z(t.left+Math.min(y,t.width-S),t.top+Math.min(E,t.height-_),Math.max(0,u-b),Math.max(0,f-_),Y.BOTTOM_RIGHT):new m(t.left+t.width-b,t.top+t.height-_),this.bottomLeftPaddingBox=g>0||w>0?z(t.left+S,t.top+Math.min(I,t.height-_),Math.max(0,g-S),Math.max(0,w-_),Y.BOTTOM_LEFT):new m(t.left+S,t.top+t.height-_),this.topLeftContentBox=s>0||o>0?z(t.left+S+R,t.top+C+K,Math.max(0,s-(S+R)),Math.max(0,o-(C+K)),Y.TOP_LEFT):new m(t.left+S+R,t.top+C+K),this.topRightContentBox=a>0||B>0?z(t.left+Math.min(p,t.width+S+R),t.top+C+K,p>t.width+S+R?0:a-S+R,B-(C+K),Y.TOP_RIGHT):new m(t.left+t.width-(b+M),t.top+C+K),this.bottomRightContentBox=u>0||f>0?z(t.left+Math.min(y,t.width-(S+R)),t.top+Math.min(E,t.height+C+K),Math.max(0,u-(b+M)),f-(_+J),Y.BOTTOM_RIGHT):new m(t.left+t.width-(b+M),t.top+t.height-(_+J)),this.bottomLeftContentBox=g>0||w>0?z(t.left+S+R,t.top+I,Math.max(0,g-(S+R)),w-(_+J),Y.BOTTOM_LEFT):new m(t.left+S+R,t.top+t.height-(_+J))}return A})(),Y;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var z=function(A,e,r,t,n){var s=4*((Math.sqrt(2)-1)/3),o=r*s,i=t*s,a=A+r,B=e+t;switch(n){case Y.TOP_LEFT:return new xt(new m(A,B),new m(A,B-i),new m(a-o,e),new m(a,e));case Y.TOP_RIGHT:return new xt(new m(A,e),new m(A+o,e),new m(a,B-i),new m(a,B));case Y.BOTTOM_RIGHT:return new xt(new m(a,e),new m(a,e+i),new m(A+o,B),new m(A,B));case Y.BOTTOM_LEFT:default:return new xt(new m(a,B),new m(a-o,B),new m(A,e+i),new m(A,e))}},Xt=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},mu=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Wt=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},Eu=(function(){function A(e,r,t){this.offsetX=e,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return A})(),Tt=(function(){function A(e,r){this.path=e,this.target=r,this.type=1}return A})(),vu=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),Hu=function(A){return A.type===0},Po=function(A){return A.type===1},yu=function(A){return A.type===2},Ns=function(A,e){return A.length===e.length?A.some(function(r,t){return r===e[t]}):!1},Iu=function(A,e,r,t,n){return A.map(function(s,o){switch(o){case 0:return s.add(e,r);case 1:return s.add(e+t,r);case 2:return s.add(e+t,r+n);case 3:return s.add(e,r+n)}return s})},Vo=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),ko=(function(){function A(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new pu(this.container),this.container.styles.opacity<1&&this.effects.push(new vu(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Eu(t,n,s))}if(this.container.styles.overflowX!==0){var o=Xt(this.curves),i=Wt(this.curves);Ns(o,i)?this.effects.push(new Tt(o,6)):(this.effects.push(new Tt(o,2)),this.effects.push(new Tt(i,4)))}}return A.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Po(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var o=Xt(t.curves),i=Wt(t.curves);Ns(o,i)||n.unshift(new Tt(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,e)})},A})(),ln=function(A,e,r,t){A.container.elements.forEach(function(n){var s=rA(n.flags,4),o=rA(n.flags,2),i=new ko(n,A);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||o){var B=s||n.styles.isPositioned()?r:e,l=new Vo(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var f=0;B.negativeZIndex.some(function(g,w){return u>g.element.container.styles.zIndex.order?(f=w,!1):f>0}),B.negativeZIndex.splice(f,0,l)}else if(u>0){var d=0;B.positiveZIndex.some(function(g,w){return u>=g.element.container.styles.zIndex.order?(d=w+1,!1):d>0}),B.positiveZIndex.splice(d,0,l)}else B.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?B.nonPositionedFloats.push(l):B.nonPositionedInlineLevel.push(l);ln(i,l,s?l:r,a)}else n.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),ln(i,e,r,a);rA(n.flags,8)&&Xo(n,a)})},Xo=function(A,e){for(var r=A instanceof sn?A.start:1,t=A instanceof sn?A.reversed:!1,n=0;n<e.length;n++){var s=e[n];s.container instanceof Io&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=at(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},bu=function(A){var e=new ko(A,null),r=new Vo(e),t=[];return ln(e,r,r,t),Xo(e.container,t),r},Ps=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},xu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return yA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Tu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Lu=function(A,e){switch(e){case 0:return Lt(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return Lt(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return Lt(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return Lt(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},Lt=function(A,e){var r=[];return vA(A)?r.push(A.subdivide(.5,!1)):r.push(A),vA(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},yA=function(A,e,r,t){var n=[];return vA(A)?n.push(A.subdivide(.5,!1)):n.push(A),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Wo=function(A){var e=A.bounds,r=A.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Jt=function(A){var e=A.styles,r=A.bounds,t=j(e.paddingLeft,r.width),n=j(e.paddingRight,r.width),s=j(e.paddingTop,r.width),o=j(e.paddingBottom,r.width);return r.add(t+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+n),-(e.borderTopWidth+e.borderBottomWidth+s+o))},Su=function(A,e){return A===0?e.bounds:A===2?Jt(e):Wo(e)},Ku=function(A,e){return A===0?e.bounds:A===2?Jt(e):Wo(e)},Nr=function(A,e,r){var t=Su(be(A.styles.backgroundOrigin,e),A),n=Ku(be(A.styles.backgroundClip,e),A),s=Du(be(A.styles.backgroundSize,e),r,t),o=s[0],i=s[1],a=ze(be(A.styles.backgroundPosition,e),t.width-o,t.height-i),B=_u(be(A.styles.backgroundRepeat,e),a,s,t,n),l=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[B,l,u,o,i]},ye=function(A){return Z(A)&&A.value===Te.AUTO},St=function(A){return typeof A=="number"},Du=function(A,e,r){var t=e[0],n=e[1],s=e[2],o=A[0],i=A[1];if(!o)return[0,0];if(tA(o)&&i&&tA(i))return[j(o,r.width),j(i,r.height)];var a=St(s);if(Z(o)&&(o.value===Te.CONTAIN||o.value===Te.COVER)){if(St(s)){var B=r.width/r.height;return B<s!=(o.value===Te.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var l=St(t),u=St(n),f=l||u;if(ye(o)&&(!i||ye(i))){if(l&&u)return[t,n];if(!a&&!f)return[r.width,r.height];if(f&&a){var d=l?t:n*s,g=u?n:t/s;return[d,g]}var w=l?t:r.width,x=u?n:r.height;return[w,x]}if(a){var U=0,p=0;return tA(o)?U=j(o,r.width):tA(i)&&(p=j(i,r.height)),ye(o)?U=p*s:(!i||ye(i))&&(p=U/s),[U,p]}var E=null,y=null;if(tA(o)?E=j(o,r.width):i&&tA(i)&&(y=j(i,r.height)),E!==null&&(!i||ye(i))&&(y=l&&u?E/t*n:r.height),y!==null&&ye(o)&&(E=l&&u?y/n*t:r.width),E!==null&&y!==null)return[E,y];throw new Error("Unable to calculate background-size for element")},be=function(A,e){var r=A[e];return typeof r>"u"?A[0]:r},_u=function(A,e,r,t,n){var s=e[0],o=e[1],i=r[0],a=r[1];switch(A){case 2:return[new m(Math.round(t.left),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(a+t.top+o)),new m(Math.round(t.left),Math.round(a+t.top+o))];case 3:return[new m(Math.round(t.left+s),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.height+t.top)),new m(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new m(Math.round(t.left+s),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o+a)),new m(Math.round(t.left+s),Math.round(t.top+o+a))];default:return[new m(Math.round(n.left),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.height+n.top)),new m(Math.round(n.left),Math.round(n.height+n.top))]}},Ru="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Vs="Hidden Text",Mu=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",o.appendChild(t),n.src=Ru,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Vs)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(Vs)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return o.removeChild(t),{baseline:i,middle:a}},A.prototype.getMetrics=function(e,r){var t=e+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,r)),this._data[t]},A})(),Jo=(function(){function A(e,r){this.context=e,this.options=r}return A})(),Ou=1e4,Gu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Mu(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return e.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},e.prototype.applyEffect=function(r){this.ctx.save(),yu(r)&&(this.ctx.globalAlpha=r.opacity),Hu(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),Po(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return wA(this,void 0,void 0,function(){return cA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var o=Qn(r.text);o.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),n=Xu(r.fontFamily).join(", "),s=ct(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},e.prototype.renderTextNode=function(r,t){return wA(this,void 0,void 0,function(){var n,s,o,i,a,B,l,u,f=this;return cA(this,function(d){return n=this.createFontStyle(t),s=n[0],o=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(o,i),B=a.baseline,l=a.middle,u=t.paintOrder,r.textBounds.forEach(function(g){u.forEach(function(w){switch(w){case 0:f.ctx.fillStyle=nA(t.color),f.renderTextWithLetterSpacing(g,t.letterSpacing,B);var x=t.textShadow;x.length&&g.text.trim().length&&(x.slice(0).reverse().forEach(function(U){f.ctx.shadowColor=nA(U.color),f.ctx.shadowOffsetX=U.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=U.offsetY.number*f.options.scale,f.ctx.shadowBlur=U.blur.number,f.renderTextWithLetterSpacing(g,t.letterSpacing,B)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),t.textDecorationLine.length&&(f.ctx.fillStyle=nA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(U){switch(U){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+B),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+l),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=nA(t.webkitTextStrokeColor),f.ctx.lineWidth=t.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+B)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Jt(r),o=Wt(t);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,p,p,B,l,u,f,y,d,g,I,w,x,U,p,E,y,I;return cA(this,function(C){switch(C.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,o=0,i=t.textNodes,C.label=1;case 1:return o<i.length?(a=i[o],[4,this.renderTextNode(a,s)]):[3,4];case 2:C.sent(),C.label=3;case 3:return o++,[3,1];case 4:if(!(t instanceof vo))return[3,8];C.label=5;case 5:return C.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,8];case 7:return C.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Ho&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof yo))return[3,12];C.label=9;case 9:return C.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,12];case 11:return C.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof To&&t.tree?(B=new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,B.render(t.tree)]):[3,14];case 13:l=C.sent(),t.width&&t.height&&this.ctx.drawImage(l,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),C.label=14;case 14:if(t instanceof dn&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Nt?t.checked&&(this.ctx.save(),this.path([new m(t.bounds.left+u*.39363,t.bounds.top+u*.79),new m(t.bounds.left+u*.16,t.bounds.top+u*.5549),new m(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new m(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new m(t.bounds.left+u*.72983,t.bounds.top+u*.23),new m(t.bounds.left+u*.84,t.bounds.top+u*.34085),new m(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=nA(xs),this.ctx.fill(),this.ctx.restore()):t.type===Pt&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=nA(xs),this.ctx.fill(),this.ctx.restore())),Nu(t)&&t.value.length){switch(f=this.createFontStyle(s),y=f[0],d=f[1],g=this.fontMetrics.getMetrics(y,d).baseline,this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Vu(t.styles.textAlign),I=Jt(t),w=0,t.styles.textAlign){case 1:w+=I.width/2;break;case 2:w+=I.width;break}x=I.add(w,0,0,-I.height/2+1),this.ctx.save(),this.path([new m(I.left,I.top),new m(I.left+I.width,I.top),new m(I.left+I.width,I.top+I.height),new m(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new nt(t.value,x),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(U=t.styles.listStyleImage,U.type!==0)return[3,18];p=void 0,E=U.url,C.label=15;case 15:return C.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return p=C.sent(),this.ctx.drawImage(p,t.bounds.left-(p.width+10),t.bounds.top),[3,18];case 17:return C.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(y=this.createFontStyle(s)[0],this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new XA(t.bounds.left,t.bounds.top+j(t.styles.paddingTop,t.bounds.width),t.bounds.width,fs(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new nt(r.listValue,I),s.letterSpacing,fs(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),C.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return wA(this,void 0,void 0,function(){var t,n,U,s,o,U,i,a,U,B,l,U,u,f,U,d,g,U,w,x,U;return cA(this,function(p){switch(p.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:p.sent(),t=0,n=r.negativeZIndex,p.label=2;case 2:return t<n.length?(U=n[t],[4,this.renderStack(U)]):[3,5];case 3:p.sent(),p.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:p.sent(),s=0,o=r.nonInlineLevel,p.label=7;case 7:return s<o.length?(U=o[s],[4,this.renderNode(U)]):[3,10];case 8:p.sent(),p.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,p.label=11;case 11:return i<a.length?(U=a[i],[4,this.renderStack(U)]):[3,14];case 12:p.sent(),p.label=13;case 13:return i++,[3,11];case 14:B=0,l=r.nonPositionedInlineLevel,p.label=15;case 15:return B<l.length?(U=l[B],[4,this.renderStack(U)]):[3,18];case 16:p.sent(),p.label=17;case 17:return B++,[3,15];case 18:u=0,f=r.inlineLevel,p.label=19;case 19:return u<f.length?(U=f[u],[4,this.renderNode(U)]):[3,22];case 20:p.sent(),p.label=21;case 21:return u++,[3,19];case 22:d=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return d<g.length?(U=g[d],[4,this.renderStack(U)]):[3,26];case 24:p.sent(),p.label=25;case 25:return d++,[3,23];case 26:w=0,x=r.positiveZIndex,p.label=27;case 27:return w<x.length?(U=x[w],[4,this.renderStack(U)]):[3,30];case 28:p.sent(),p.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var t=this;r.forEach(function(n,s){var o=vA(n)?n.start:n;s===0?t.ctx.moveTo(o.x,o.y):t.ctx.lineTo(o.x,o.y),vA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(r,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},e.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var o=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=o.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},e.prototype.renderBackgroundImage=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a;return cA(this,function(B){switch(B.label){case 0:t=r.styles.backgroundImage.length-1,n=function(l){var u,f,d,K,G,X,R,O,_,g,K,G,X,R,O,w,x,U,p,E,y,I,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA,hA;return cA(this,function(OA){switch(OA.label){case 0:if(l.type!==0)return[3,5];u=void 0,f=l.url,OA.label=1;case 1:return OA.trys.push([1,3,,4]),[4,s.context.cache.match(f)];case 2:return u=OA.sent(),[3,4];case 3:return OA.sent(),s.context.logger.error("Error loading background-image "+f),[3,4];case 4:return u&&(d=Nr(r,t,[u.width,u.height,u.width/u.height]),K=d[0],G=d[1],X=d[2],R=d[3],O=d[4],_=s.ctx.createPattern(s.resizeImage(u,R,O),"repeat"),s.renderRepeat(K,_,G,X)),[3,6];case 5:HB(l)?(g=Nr(r,t,[null,null,null]),K=g[0],G=g[1],X=g[2],R=g[3],O=g[4],w=FB(l.angle,R,O),x=w[0],U=w[1],p=w[2],E=w[3],y=w[4],I=document.createElement("canvas"),I.width=R,I.height=O,C=I.getContext("2d"),b=C.createLinearGradient(U,E,p,y),ls(l.stops,x).forEach(function(WA){return b.addColorStop(WA.stop,nA(WA.color))}),C.fillStyle=b,C.fillRect(0,0,R,O),R>0&&O>0&&(_=s.ctx.createPattern(I,"repeat"),s.renderRepeat(K,_,G,X))):yB(l)&&(S=Nr(r,t,[null,null,null]),K=S[0],M=S[1],J=S[2],R=S[3],O=S[4],eA=l.position.length===0?[fn]:l.position,G=j(eA[0],R),X=j(eA[eA.length-1],O),dA=pB(l,G,X,R,O),aA=dA[0],BA=dA[1],aA>0&&BA>0&&(FA=s.ctx.createRadialGradient(M+G,J+X,0,M+G,J+X,aA),ls(l.stops,aA*2).forEach(function(WA){return FA.addColorStop(WA.stop,nA(WA.color))}),s.path(K),s.ctx.fillStyle=FA,aA!==BA?(MA=r.bounds.left+.5*r.bounds.width,CA=r.bounds.top+.5*r.bounds.height,LA=BA/aA,hA=1/LA,s.ctx.save(),s.ctx.translate(MA,CA),s.ctx.transform(1,0,0,LA,0,0),s.ctx.translate(-MA,-CA),s.ctx.fillRect(M,hA*(J-CA)+CA,R,O*hA),s.ctx.restore()):s.ctx.fill())),OA.label=6;case 6:return t--,[2]}})},s=this,o=0,i=r.styles.backgroundImage.slice(0).reverse(),B.label=1;case 1:return o<i.length?(a=i[o],[5,n(a)]):[3,4];case 2:B.sent(),B.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,t,n){return wA(this,void 0,void 0,function(){return cA(this,function(s){return this.path(Ps(n,t)),this.ctx.fillStyle=nA(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,t,n,s){return wA(this,void 0,void 0,function(){var o,i;return cA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return o=xu(s,n),this.path(o),this.ctx.fillStyle=nA(r),this.ctx.fill(),i=Tu(s,n),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,B,l,u=this;return cA(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!te(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],o=Pu(be(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),te(t.backgroundColor)||(this.ctx.fillStyle=nA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(d){u.ctx.save();var g=Xt(r.curves),w=d.inset?0:Ou,x=Iu(g,-w+(d.inset?1:-1)*d.spread.number,(d.inset?1:-1)*d.spread.number,d.spread.number*(d.inset?-2:2),d.spread.number*(d.inset?-2:2));d.inset?(u.path(g),u.ctx.clip(),u.mask(x)):(u.mask(g),u.ctx.clip(),u.path(x)),u.ctx.shadowOffsetX=d.offsetX.number+w,u.ctx.shadowOffsetY=d.offsetY.number,u.ctx.shadowColor=nA(d.color),u.ctx.shadowBlur=d.blur.number,u.ctx.fillStyle=d.inset?nA(d.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),f.label=2;case 2:i=0,a=0,B=s,f.label=3;case 3:return a<B.length?(l=B[a],l.style!==0&&!te(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,i,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,i,r.curves)];case 10:f.sent(),f.label=11;case 11:i++,f.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,t,n,s,o){return wA(this,void 0,void 0,function(){var i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,C,I,C;return cA(this,function(b){return this.ctx.save(),i=Lu(s,n),a=Ps(s,n),o===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(B=a[0].start.x,l=a[0].start.y):(B=a[0].x,l=a[0].y),vA(a[1])?(u=a[1].end.x,f=a[1].end.y):(u=a[1].x,f=a[1].y),n===0||n===2?d=Math.abs(B-u):d=Math.abs(l-f),this.ctx.beginPath(),o===3?this.formatPath(i):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,w=t<3?t*2:t,o===3&&(g=t,w=t),x=!0,d<=g*2?x=!1:d<=g*2+w?(U=d/(2*g+w),g*=U,w*=U):(p=Math.floor((d+w)/(g+w)),E=(d-p*g)/(p-1),y=(d-(p+1)*g)/p,w=y<=0||Math.abs(w-E)<Math.abs(w-y)?E:y),x&&(o===3?this.ctx.setLineDash([0,g+w]):this.ctx.setLineDash([g,w])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=nA(r),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(vA(a[0])&&(I=a[3],C=a[0],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke()),vA(a[1])&&(I=a[1],C=a[2],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=bu(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Jo),Nu=function(A){return A instanceof xo||A instanceof bo?!0:A instanceof dn&&A.type!==Pt&&A.type!==Nt},Pu=function(A,e){switch(A){case 0:return Xt(e);case 2:return mu(e);default:return Wt(e)}},Vu=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},ku=["-apple-system","system-ui"],Xu=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return ku.indexOf(e)===-1}):A},Wu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t,n;return cA(this,function(s){switch(s.label){case 0:return t=nn(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,Ju(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(Jo),Ju=function(A){return new Promise(function(e,r){var t=new Image;t.onload=function(){e(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Yu=(function(){function A(e){var r=e.id,t=e.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Qt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Qt([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Qt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Qt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),Zu=(function(){function A(e,r){var t;this.windowBounds=r,this.instanceName="#"+A.instanceCount++,this.logger=new Yu({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new wu(this,e)}return A.instanceCount=1,A})(),qu=function(A,e){return e===void 0&&(e={}),ju(A,e)};typeof window<"u"&&No.setContext(window);var ju=function(A,e){return wA(void 0,void 0,void 0,function(){var r,t,n,s,o,i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,b,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA;return cA(this,function(hA){switch(hA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=A.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(_=e.allowTaint)!==null&&_!==void 0?_:!1,imageTimeout:(S=e.imageTimeout)!==null&&S!==void 0?S:15e3,proxy:e.proxy,useCORS:(K=e.useCORS)!==null&&K!==void 0?K:!1},s=Vr({logging:(M=e.logging)!==null&&M!==void 0?M:!0,cache:e.cache},n),o={windowWidth:(J=e.windowWidth)!==null&&J!==void 0?J:t.innerWidth,windowHeight:(R=e.windowHeight)!==null&&R!==void 0?R:t.innerHeight,scrollX:(O=e.scrollX)!==null&&O!==void 0?O:t.pageXOffset,scrollY:(eA=e.scrollY)!==null&&eA!==void 0?eA:t.pageYOffset},i=new XA(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),a=new Zu(s,i),B=(G=e.foreignObjectRendering)!==null&&G!==void 0?G:!1,l={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:B,copyStyles:B},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Os(a,A,l),f=u.clonedReferenceElement,f?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=hA.sent(),g=Cn(f)||zl(f)?Ii(f.ownerDocument):Yt(a,f),w=g.width,x=g.height,U=g.left,p=g.top,E=zu(a,f,e.backgroundColor),y={canvas:e.canvas,backgroundColor:E,scale:(aA=(dA=e.scale)!==null&&dA!==void 0?dA:t.devicePixelRatio)!==null&&aA!==void 0?aA:1,x:((BA=e.x)!==null&&BA!==void 0?BA:0)+U,y:((FA=e.y)!==null&&FA!==void 0?FA:0)+p,width:(MA=e.width)!==null&&MA!==void 0?MA:Math.ceil(w),height:(CA=e.height)!==null&&CA!==void 0?CA:Math.ceil(x)},B?(a.logger.debug("Document cloned, using foreign object rendering"),b=new Wu(a,y),[4,b.render(f)]):[3,3];case 2:return I=hA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+U+","+p+" with size "+w+"x"+x+" using computed rendering"),a.logger.debug("Starting DOM parsing"),C=So(a,f),E===C.styles.backgroundColor&&(C.styles.backgroundColor=kA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+y.x+","+y.y+" with size "+y.width+"x"+y.height),b=new Gu(a,y),[4,b.render(C)];case 4:I=hA.sent(),hA.label=5;case 5:return(!((LA=e.removeContainer)!==null&&LA!==void 0)||LA)&&(Os.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,I]}})})},zu=function(A,e,r){var t=e.ownerDocument,n=t.documentElement?tt(A,getComputedStyle(t.documentElement).backgroundColor):kA.TRANSPARENT,s=t.body?tt(A,getComputedStyle(t.body).backgroundColor):kA.TRANSPARENT,o=typeof r=="string"?tt(A,r):r===null?kA.TRANSPARENT:4294967295;return e===t.documentElement?te(n)?te(s)?o:s:n:o},Yo=qu;var Zo=!1,$u=new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]);function Af(){if(Zo)return;Zo=!0;let A=CanvasRenderingContext2D.prototype.createPattern;CanvasRenderingContext2D.prototype.createPattern=function(e,r){return e&&"width"in e&&"height"in e&&(e.width===0||e.height===0)?null:A.call(this,e,r)}}function jo(){Af()}function zo(A){A.style.opacity="1",fe(A,"important"),A.querySelectorAll("[data-start]").forEach(e=>fe(e,"important"))}function ef(A,e){if(!A.id)return;let r=e.getElementById(A.id);r instanceof HTMLElement&&zo(r)}function tf(A){let e=A.ownerDocument.defaultView;e&&[A,...Array.from(A.querySelectorAll("*"))].forEach(r=>{if($u.has(r.tagName))return;let t=e.getComputedStyle(r);if(t.boxShadow==="none"||t.transform==="none")return;let n=A.ownerDocument.createElement("div");n.setAttribute("data-hyper-shader-shadow-shim",""),n.style.cssText=["position:absolute","inset:0","border-radius:inherit",`box-shadow:${t.boxShadow}`,"background:transparent","pointer-events:none","z-index:0"].join(";"),t.position==="static"&&(r.style.position="relative"),r.style.boxShadow="none",r.insertBefore(n,r.firstChild)})}function nr(){if(typeof document>"u")return!1;let A=document.createElement("canvas");if(A.setAttribute("layoutsubtree",""),!("layoutSubtree"in A))return!1;let e=A.getContext("2d");return e!=null&&typeof e.drawElementImage=="function"}async function rf(A,e,r,t,n){let s=document.createElement("canvas");s.width=r,s.height=t,s.setAttribute("layoutsubtree",""),s.style.cssText=`position:fixed;top:0;left:0;width:${r}px;height:${t}px;z-index:-9999;pointer-events:none;opacity:0`;let o=A.cloneNode(!0);n.forceVisible&&zo(o),s.appendChild(o),document.body.appendChild(s);try{await new Promise(l=>requestAnimationFrame(()=>requestAnimationFrame(()=>l())));let i=s.getContext("2d");i.fillStyle=e,i.fillRect(0,0,r,t);let a=s.firstElementChild;a&&i.drawElementImage(a,0,0,r,t);let B=document.createElement("canvas");return B.width=r,B.height=t,B.getContext("2d").drawImage(s,0,0),s.remove(),B}catch(i){throw s.remove(),i}}function $o(A,e,r=we,t=Qe,n={}){return nr()&&!n.preferBrowserPaint?rf(A,e,r,t,n).catch(()=>qo(A,e,r,t,n)):qo(A,e,r,t,n)}function qo(A,e,r,t,n={}){let s=o=>Yo(A,{width:r,height:t,scale:n.scale??1,backgroundColor:e,logging:!1,foreignObjectRendering:o,useCORS:!0,allowTaint:!0,onclone:i=>{if(!A.id)return;let a=i.getElementById(A.id);a instanceof HTMLElement&&tf(a),n.forceVisible&&ef(A,i)},ignoreElements:i=>i.tagName==="CANVAS"||i.hasAttribute("data-no-capture")});return n.preferBrowserPaint===!0?s(!0).catch(()=>s(!1)):s(!1)}var hn="__hf-page-side-compositor",Ai="__hf_page_compositor_v1__";function nf(A,e){let r=A.querySelectorAll("*"),t=e.querySelectorAll("*"),n=[[A,e]];r.forEach((i,a)=>n.push([i,t[a]]));let s=e,o=A;for(let i=A.parentElement;i&&i!==document.body&&i!==document.documentElement;i=i.parentElement){let a=i.cloneNode(!1);a.appendChild(s),n.push([i,a]),s=a,o=i}return{root:s,liveRoot:o,pairs:n}}function sf(A,e,r){let t=new Map;r.forEach(([o,i],a)=>{t.set(o,a),t.set(i,a)});let n=o=>{if(!("animationName"in o))return null;let i=o.effect;return`${t.get(i.target)}|${i.pseudoElement??""}|${o.animationName}`},s=new Map;for(let o of A.getAnimations({subtree:!0})){let i=n(o);i&&s.set(i,o.currentTime)}for(let o of e.getAnimations({subtree:!0})){let i=n(o);if(!i)continue;let a=s.get(i);a===void 0?o.cancel():(o.pause(),o.currentTime=a)}}function ei(){if(typeof window>"u"||typeof document>"u"||!nr())return!1;let A=document.createElement("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl");return e?(e.getExtension("WEBGL_lose_context")?.loseContext(),!0):!1}function Un(A){if(typeof window>"u")return!1;if(window.__HF_PAGE_COMPOSITOR_CANARY__=Ai,!ei())return console.warn("[HyperShader] page-side compositing requested but drawElementImage/WebGL is not available; falling back to opacity-flip mode (Node-side layered pipeline will handle the blend)."),!1;if(document.getElementById(hn))return!0;let{scenes:e,transitions:r,accentColors:t,width:n,height:s,defaultDuration:o}=A,i=document.createElement("canvas");i.id=hn,i.width=n,i.height=s,i.style.cssText="position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483646;pointer-events:none;display:none;",document.body.appendChild(i);let a=de(i,n,s);if(!a)return console.warn("[HyperShader] page-side compositor: WebGL context unavailable."),i.remove(),!1;let B=Ce(a),l=new Map;for(let K of r)if(K.shader!==void 0&&!l.has(K.shader))try{l.set(K.shader,he(a,Fe(K.shader)))}catch(M){console.warn(`[HyperShader] page-side compositor: failed to compile "${K.shader}":`,M)}let u=[];for(let K=0;K<r.length;K++){let M=r[K];if(!M||M.shader===void 0)continue;let J=e[K],R=e[K+1],O=l.get(M.shader);!J||!R||!O||u.push({time:M.time,duration:M.duration??o,shader:M.shader,fromSceneId:J,toSceneId:R,prog:O})}if(u.length===0)return i.remove(),!1;let f=SA(a),d=SA(a),g=document.createElement("canvas"),w=document.createElement("canvas");for(let K of[g,w])K.width=n,K.height=s,K.setAttribute("layoutsubtree",""),K.style.cssText="position:fixed;top:0;left:0;width:"+n+"px;height:"+s+"px;z-index:-9998;pointer-events:none;",document.body.appendChild(K);function x(K){for(let M of u)if(K>=M.time&&K<=M.time+M.duration)return M;return null}let U=null,p=0,E=window;async function y(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=document.getElementById(K.fromSceneId),J=document.getElementById(K.toSceneId);if(!(M instanceof HTMLElement)||!(J instanceof HTMLElement))return E.__hf_page_composite_pending=!1,!1;for(;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);for(let[O,eA]of[[M,g],[J,w]]){let G=O.cloneNode(!0);G.style.opacity="1",fe(G),G.querySelectorAll("[data-start]").forEach(FA=>{FA.style.opacity="1",fe(FA)});let{root:X,liveRoot:dA,pairs:aA}=nf(O,G),BA=document.createElement("div");BA.style.cssText=`position:absolute;left:0;top:0;width:${n}px;height:${s}px;margin:0;`,BA.appendChild(X),eA.appendChild(BA),sf(dA,X,aA)}let R=[];for(let O of[g,w])for(let eA of O.querySelectorAll("img"))eA.src&&eA.src.startsWith("data:")&&typeof eA.decode=="function"&&R.push(eA.decode().catch(()=>{}));return R.length>0&&await Promise.all(R),!0}function I(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=g.firstElementChild,J=w.firstElementChild;if(!M||!J)return E.__hf_page_composite_pending=!1,!1;let R=g.getContext("2d"),O=w.getContext("2d");if(!R?.drawElementImage||!O?.drawElementImage)return E.__hf_page_composite_pending=!1,!1;let eA=[[R,M],[O,J]];try{for(let[G,X]of eA)G.fillStyle=A.bgColor,G.fillRect(0,0,n,s),G.drawElementImage(X,0,0,n,s);NA(a,f,g),NA(a,d,w)}catch(G){return console.warn("[HyperShader] page-side compositor: scene capture failed:",G),i.style.display="none",E.__hf_page_composite_pending=!1,!1}finally{for(let[G]of eA)G.clearRect(0,0,n,s)}try{Ue(a,B,K.prog,f,d,p,t,n,s),i.style.display="block"}catch(G){console.warn("[HyperShader] page-side compositor: renderShader failed:",G),i.style.display="none"}return E.__hf_page_composite_pending=!1,!0}E.__hf_page_composite_resolve=I,E.__hf_page_composite_prepare=y;let C=window,b=()=>{if(!C.__hf)return;let K=C.__hf.seek;if(typeof K!="function")return;let M=J=>{let R=K.call(C.__hf,J),O=x(J);if(!O){for(i.style.display="none",E.__hf_page_composite_pending=!1;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);return R}return U=O,p=O.duration===0?1:Math.min(1,Math.max(0,(J-O.time)/O.duration)),E.__hf_page_composite_pending=!0,R};C.__hf.seek=M},_=0,S=window.setInterval(()=>{_+=1,C.__hf?.seek?(b(),window.clearInterval(S)):_>200&&(window.clearInterval(S),console.warn("[HyperShader] page-side compositor: window.__hf.seek never appeared after 10s; the engine bridge did not initialize. Falling back to opacity-flip mode."))},50);return!0}var ir=.7,pn="power2.inOut",of="attribute vec2 a_pos; varying vec2 v_uv; void main(){v_uv=a_pos*0.5+0.5; gl_Position=vec4(a_pos,0,1);}",sr=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"],af="hyper-shader-preview-cache",RA="frames",Bf=1,cf="v1",ti=2,ri=1.25,lf=1200;function uf(A){let e=A.replace("#","");if(e.length<6)return[.5,.5,.5];let r=parseInt(e.slice(0,2),16)/255,t=parseInt(e.slice(2,4),16)/255,n=parseInt(e.slice(4,6),16)/255;return Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n)?[.5,.5,.5]:[r,t,n]}function li(A){let[e,r,t]=uf(A);return{accent:[e,r,t],dark:[e*.35,r*.35,t*.35],bright:[Math.min(1,e*1.5+.2),Math.min(1,r*1.5+.2),Math.min(1,t*1.5+.2)]}}function le(A,e,r){return Math.min(r,Math.max(e,A))}function ff(A,e){return A===void 0?e:Number.isFinite(A)&&A>0?A:e}var gf="__hf_shader_capture_scale",wf="__hf_shader_loading";function ui(A,e){let r=window[A];if(typeof r=="string")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r);try{return new URLSearchParams(window.location.search).get(e)}catch{return null}}function Qf(){let A=ui("__HF_SHADER_CAPTURE_SCALE",gf),e=A===null?NaN:Number(A);return le(Number.isFinite(e)&&e>0?e:1,.25,1)}function df(){let A=ui("__HF_SHADER_LOADING",wf)?.trim().toLowerCase();return A==="player"||A==="true"||A==="1"?"player":A==="none"||A==="false"||A==="0"||A==="off"?"none":"internal"}function Br(A){let e=2166136261;for(let r=0;r<A.length;r+=1)e^=A.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}function Cf(A){let e=Array.from(A.querySelectorAll("style")).map(t=>t.textContent||"").join(`
6
+ .`+cn+uu+Gs)},gu=function(A,e){var r=A.ownerDocument;if(r){var t=r.createElement("style");t.textContent=e,A.appendChild(t)}},No=(function(){function A(){}return A.getOrigin=function(e){var r=A._link;return r?(r.href=e,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),wu=(function(){function A(e,r){this.context=e,this._options=r,this._cache={}}return A.prototype.addImage=function(e){var r=Promise.resolve();return this.has(e)||(Gr(e)||hu(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),r},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return wA(this,void 0,void 0,function(){var r,t,n,s,o=this;return cA(this,function(i){switch(i.label){case 0:return r=No.isSameOrigin(e),t=!Or(e)&&this._options.useCORS===!0&&oA.SUPPORT_CORS_IMAGES&&!r,n=!Or(e)&&!r&&!Gr(e)&&typeof this._options.proxy=="string"&&oA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Or(e)&&!Gr(e)&&!n&&!t?[2]:(s=e,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,B){var l=new Image;l.onload=function(){return a(l)},l.onerror=B,(Uu(s)||t)&&(l.crossOrigin="anonymous"),l.src=s,l.complete===!0&&setTimeout(function(){return a(l)},500),o._options.imageTimeout>0&&setTimeout(function(){return B("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(s,o){var i=oA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(f){return o(f)},!1),u.readAsDataURL(a.response)}else o("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=o;var B=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+B+"url="+encodeURIComponent(e)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var l=r._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return o("Timed out ("+l+"ms) proxying "+n)}}a.send()})},A})(),Qu=/^data:image\/svg\+xml/i,du=/^data:image\/.*;base64,/i,Cu=/^data:image\/.*/i,hu=function(A){return oA.SUPPORT_SVG_DRAWING||!Fu(A)},Or=function(A){return Cu.test(A)},Uu=function(A){return du.test(A)},Gr=function(A){return A.substr(0,4)==="blob"},Fu=function(A){return A.substr(-3).toLowerCase()==="svg"||Qu.test(A)},m=(function(){function A(e,r){this.type=0,this.x=e,this.y=r}return A.prototype.add=function(e,r){return new A(this.x+e,this.y+r)},A})(),He=function(A,e,r){return new m(A.x+(e.x-A.x)*r,A.y+(e.y-A.y)*r)},xt=(function(){function A(e,r,t,n){this.type=1,this.start=e,this.startControl=r,this.endControl=t,this.end=n}return A.prototype.subdivide=function(e,r){var t=He(this.start,this.startControl,e),n=He(this.startControl,this.endControl,e),s=He(this.endControl,this.end,e),o=He(t,n,e),i=He(n,s,e),a=He(o,i,e);return r?new A(this.start,t,o,a):new A(a,i,s,this.end)},A.prototype.add=function(e,r){return new A(this.start.add(e,r),this.startControl.add(e,r),this.endControl.add(e,r),this.end.add(e,r))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),vA=function(A){return A.type===1},pu=(function(){function A(e){var r=e.styles,t=e.bounds,n=ze(r.borderTopLeftRadius,t.width,t.height),s=n[0],o=n[1],i=ze(r.borderTopRightRadius,t.width,t.height),a=i[0],B=i[1],l=ze(r.borderBottomRightRadius,t.width,t.height),u=l[0],f=l[1],d=ze(r.borderBottomLeftRadius,t.width,t.height),g=d[0],w=d[1],x=[];x.push((s+a)/t.width),x.push((g+u)/t.width),x.push((o+w)/t.height),x.push((B+f)/t.height);var U=Math.max.apply(Math,x);U>1&&(s/=U,o/=U,a/=U,B/=U,u/=U,f/=U,g/=U,w/=U);var p=t.width-a,E=t.height-f,y=t.width-u,I=t.height-w,C=r.borderTopWidth,b=r.borderRightWidth,_=r.borderBottomWidth,S=r.borderLeftWidth,K=j(r.paddingTop,e.bounds.width),M=j(r.paddingRight,e.bounds.width),J=j(r.paddingBottom,e.bounds.width),R=j(r.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?z(t.left+S/3,t.top+C/3,s-S/3,o-C/3,Y.TOP_LEFT):new m(t.left+S/3,t.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?z(t.left+p,t.top+C/3,a-b/3,B-C/3,Y.TOP_RIGHT):new m(t.left+t.width-b/3,t.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?z(t.left+y,t.top+E,u-b/3,f-_/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/3,t.top+t.height-_/3),this.bottomLeftBorderDoubleOuterBox=g>0||w>0?z(t.left+S/3,t.top+I,g-S/3,w-_/3,Y.BOTTOM_LEFT):new m(t.left+S/3,t.top+t.height-_/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?z(t.left+S*2/3,t.top+C*2/3,s-S*2/3,o-C*2/3,Y.TOP_LEFT):new m(t.left+S*2/3,t.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?z(t.left+p,t.top+C*2/3,a-b*2/3,B-C*2/3,Y.TOP_RIGHT):new m(t.left+t.width-b*2/3,t.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?z(t.left+y,t.top+E,u-b*2/3,f-_*2/3,Y.BOTTOM_RIGHT):new m(t.left+t.width-b*2/3,t.top+t.height-_*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||w>0?z(t.left+S*2/3,t.top+I,g-S*2/3,w-_*2/3,Y.BOTTOM_LEFT):new m(t.left+S*2/3,t.top+t.height-_*2/3),this.topLeftBorderStroke=s>0||o>0?z(t.left+S/2,t.top+C/2,s-S/2,o-C/2,Y.TOP_LEFT):new m(t.left+S/2,t.top+C/2),this.topRightBorderStroke=s>0||o>0?z(t.left+p,t.top+C/2,a-b/2,B-C/2,Y.TOP_RIGHT):new m(t.left+t.width-b/2,t.top+C/2),this.bottomRightBorderStroke=u>0||f>0?z(t.left+y,t.top+E,u-b/2,f-_/2,Y.BOTTOM_RIGHT):new m(t.left+t.width-b/2,t.top+t.height-_/2),this.bottomLeftBorderStroke=g>0||w>0?z(t.left+S/2,t.top+I,g-S/2,w-_/2,Y.BOTTOM_LEFT):new m(t.left+S/2,t.top+t.height-_/2),this.topLeftBorderBox=s>0||o>0?z(t.left,t.top,s,o,Y.TOP_LEFT):new m(t.left,t.top),this.topRightBorderBox=a>0||B>0?z(t.left+p,t.top,a,B,Y.TOP_RIGHT):new m(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||f>0?z(t.left+y,t.top+E,u,f,Y.BOTTOM_RIGHT):new m(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||w>0?z(t.left,t.top+I,g,w,Y.BOTTOM_LEFT):new m(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||o>0?z(t.left+S,t.top+C,Math.max(0,s-S),Math.max(0,o-C),Y.TOP_LEFT):new m(t.left+S,t.top+C),this.topRightPaddingBox=a>0||B>0?z(t.left+Math.min(p,t.width-b),t.top+C,p>t.width+b?0:Math.max(0,a-b),Math.max(0,B-C),Y.TOP_RIGHT):new m(t.left+t.width-b,t.top+C),this.bottomRightPaddingBox=u>0||f>0?z(t.left+Math.min(y,t.width-S),t.top+Math.min(E,t.height-_),Math.max(0,u-b),Math.max(0,f-_),Y.BOTTOM_RIGHT):new m(t.left+t.width-b,t.top+t.height-_),this.bottomLeftPaddingBox=g>0||w>0?z(t.left+S,t.top+Math.min(I,t.height-_),Math.max(0,g-S),Math.max(0,w-_),Y.BOTTOM_LEFT):new m(t.left+S,t.top+t.height-_),this.topLeftContentBox=s>0||o>0?z(t.left+S+R,t.top+C+K,Math.max(0,s-(S+R)),Math.max(0,o-(C+K)),Y.TOP_LEFT):new m(t.left+S+R,t.top+C+K),this.topRightContentBox=a>0||B>0?z(t.left+Math.min(p,t.width+S+R),t.top+C+K,p>t.width+S+R?0:a-S+R,B-(C+K),Y.TOP_RIGHT):new m(t.left+t.width-(b+M),t.top+C+K),this.bottomRightContentBox=u>0||f>0?z(t.left+Math.min(y,t.width-(S+R)),t.top+Math.min(E,t.height+C+K),Math.max(0,u-(b+M)),f-(_+J),Y.BOTTOM_RIGHT):new m(t.left+t.width-(b+M),t.top+t.height-(_+J)),this.bottomLeftContentBox=g>0||w>0?z(t.left+S+R,t.top+I,Math.max(0,g-(S+R)),w-(_+J),Y.BOTTOM_LEFT):new m(t.left+S+R,t.top+t.height-(_+J))}return A})(),Y;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var z=function(A,e,r,t,n){var s=4*((Math.sqrt(2)-1)/3),o=r*s,i=t*s,a=A+r,B=e+t;switch(n){case Y.TOP_LEFT:return new xt(new m(A,B),new m(A,B-i),new m(a-o,e),new m(a,e));case Y.TOP_RIGHT:return new xt(new m(A,e),new m(A+o,e),new m(a,B-i),new m(a,B));case Y.BOTTOM_RIGHT:return new xt(new m(a,e),new m(a,e+i),new m(A+o,B),new m(A,B));case Y.BOTTOM_LEFT:default:return new xt(new m(a,B),new m(a-o,B),new m(A,e+i),new m(A,e))}},Xt=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},mu=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Wt=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},Eu=(function(){function A(e,r,t){this.offsetX=e,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return A})(),Tt=(function(){function A(e,r){this.path=e,this.target=r,this.type=1}return A})(),vu=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),Hu=function(A){return A.type===0},Po=function(A){return A.type===1},yu=function(A){return A.type===2},Ns=function(A,e){return A.length===e.length?A.some(function(r,t){return r===e[t]}):!1},Iu=function(A,e,r,t,n){return A.map(function(s,o){switch(o){case 0:return s.add(e,r);case 1:return s.add(e+t,r);case 2:return s.add(e+t,r+n);case 3:return s.add(e,r+n)}return s})},Vo=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),ko=(function(){function A(e,r){if(this.container=e,this.parent=r,this.effects=[],this.curves=new pu(this.container),this.container.styles.opacity<1&&this.effects.push(new vu(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Eu(t,n,s))}if(this.container.styles.overflowX!==0){var o=Xt(this.curves),i=Wt(this.curves);Ns(o,i)?this.effects.push(new Tt(o,6)):(this.effects.push(new Tt(o,2)),this.effects.push(new Tt(i,4)))}}return A.prototype.getEffects=function(e){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Po(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var o=Xt(t.curves),i=Wt(t.curves);Ns(o,i)||n.unshift(new Tt(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,e)})},A})(),ln=function(A,e,r,t){A.container.elements.forEach(function(n){var s=rA(n.flags,4),o=rA(n.flags,2),i=new ko(n,A);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||o){var B=s||n.styles.isPositioned()?r:e,l=new Vo(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var f=0;B.negativeZIndex.some(function(g,w){return u>g.element.container.styles.zIndex.order?(f=w,!1):f>0}),B.negativeZIndex.splice(f,0,l)}else if(u>0){var d=0;B.positiveZIndex.some(function(g,w){return u>=g.element.container.styles.zIndex.order?(d=w+1,!1):d>0}),B.positiveZIndex.splice(d,0,l)}else B.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?B.nonPositionedFloats.push(l):B.nonPositionedInlineLevel.push(l);ln(i,l,s?l:r,a)}else n.styles.isInlineLevel()?e.inlineLevel.push(i):e.nonInlineLevel.push(i),ln(i,e,r,a);rA(n.flags,8)&&Xo(n,a)})},Xo=function(A,e){for(var r=A instanceof sn?A.start:1,t=A instanceof sn?A.reversed:!1,n=0;n<e.length;n++){var s=e[n];s.container instanceof Io&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=at(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},bu=function(A){var e=new ko(A,null),r=new Vo(e),t=[];return ln(e,r,r,t),Xo(e.container,t),r},Ps=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},xu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return yA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return yA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return yA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Tu=function(A,e){switch(e){case 0:return yA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return yA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return yA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return yA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Lu=function(A,e){switch(e){case 0:return Lt(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return Lt(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return Lt(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return Lt(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},Lt=function(A,e){var r=[];return vA(A)?r.push(A.subdivide(.5,!1)):r.push(A),vA(e)?r.push(e.subdivide(.5,!0)):r.push(e),r},yA=function(A,e,r,t){var n=[];return vA(A)?n.push(A.subdivide(.5,!1)):n.push(A),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},Wo=function(A){var e=A.bounds,r=A.styles;return e.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Jt=function(A){var e=A.styles,r=A.bounds,t=j(e.paddingLeft,r.width),n=j(e.paddingRight,r.width),s=j(e.paddingTop,r.width),o=j(e.paddingBottom,r.width);return r.add(t+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+n),-(e.borderTopWidth+e.borderBottomWidth+s+o))},Su=function(A,e){return A===0?e.bounds:A===2?Jt(e):Wo(e)},Ku=function(A,e){return A===0?e.bounds:A===2?Jt(e):Wo(e)},Nr=function(A,e,r){var t=Su(be(A.styles.backgroundOrigin,e),A),n=Ku(be(A.styles.backgroundClip,e),A),s=Du(be(A.styles.backgroundSize,e),r,t),o=s[0],i=s[1],a=ze(be(A.styles.backgroundPosition,e),t.width-o,t.height-i),B=_u(be(A.styles.backgroundRepeat,e),a,s,t,n),l=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[B,l,u,o,i]},ye=function(A){return Z(A)&&A.value===Te.AUTO},St=function(A){return typeof A=="number"},Du=function(A,e,r){var t=e[0],n=e[1],s=e[2],o=A[0],i=A[1];if(!o)return[0,0];if(tA(o)&&i&&tA(i))return[j(o,r.width),j(i,r.height)];var a=St(s);if(Z(o)&&(o.value===Te.CONTAIN||o.value===Te.COVER)){if(St(s)){var B=r.width/r.height;return B<s!=(o.value===Te.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var l=St(t),u=St(n),f=l||u;if(ye(o)&&(!i||ye(i))){if(l&&u)return[t,n];if(!a&&!f)return[r.width,r.height];if(f&&a){var d=l?t:n*s,g=u?n:t/s;return[d,g]}var w=l?t:r.width,x=u?n:r.height;return[w,x]}if(a){var U=0,p=0;return tA(o)?U=j(o,r.width):tA(i)&&(p=j(i,r.height)),ye(o)?U=p*s:(!i||ye(i))&&(p=U/s),[U,p]}var E=null,y=null;if(tA(o)?E=j(o,r.width):i&&tA(i)&&(y=j(i,r.height)),E!==null&&(!i||ye(i))&&(y=l&&u?E/t*n:r.height),y!==null&&ye(o)&&(E=l&&u?y/n*t:r.width),E!==null&&y!==null)return[E,y];throw new Error("Unable to calculate background-size for element")},be=function(A,e){var r=A[e];return typeof r>"u"?A[0]:r},_u=function(A,e,r,t,n){var s=e[0],o=e[1],i=r[0],a=r[1];switch(A){case 2:return[new m(Math.round(t.left),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(t.top+o)),new m(Math.round(t.left+t.width),Math.round(a+t.top+o)),new m(Math.round(t.left),Math.round(a+t.top+o))];case 3:return[new m(Math.round(t.left+s),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.top)),new m(Math.round(t.left+s+i),Math.round(t.height+t.top)),new m(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new m(Math.round(t.left+s),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o)),new m(Math.round(t.left+s+i),Math.round(t.top+o+a)),new m(Math.round(t.left+s),Math.round(t.top+o+a))];default:return[new m(Math.round(n.left),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.top)),new m(Math.round(n.left+n.width),Math.round(n.height+n.top)),new m(Math.round(n.left),Math.round(n.height+n.top))]}},Ru="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Vs="Hidden Text",Mu=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",o.appendChild(t),n.src=Ru,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Vs)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(Vs)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return o.removeChild(t),{baseline:i,middle:a}},A.prototype.getMetrics=function(e,r){var t=e+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,r)),this._data[t]},A})(),Jo=(function(){function A(e,r){this.context=e,this.options=r}return A})(),Ou=1e4,Gu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Mu(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return e.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},e.prototype.applyEffect=function(r){this.ctx.save(),yu(r)&&(this.ctx.globalAlpha=r.opacity),Hu(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),Po(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(r){return wA(this,void 0,void 0,function(){return cA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var o=Qn(r.text);o.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},e.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),n=Xu(r.fontFamily).join(", "),s=ct(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},e.prototype.renderTextNode=function(r,t){return wA(this,void 0,void 0,function(){var n,s,o,i,a,B,l,u,f=this;return cA(this,function(d){return n=this.createFontStyle(t),s=n[0],o=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(o,i),B=a.baseline,l=a.middle,u=t.paintOrder,r.textBounds.forEach(function(g){u.forEach(function(w){switch(w){case 0:f.ctx.fillStyle=nA(t.color),f.renderTextWithLetterSpacing(g,t.letterSpacing,B);var x=t.textShadow;x.length&&g.text.trim().length&&(x.slice(0).reverse().forEach(function(U){f.ctx.shadowColor=nA(U.color),f.ctx.shadowOffsetX=U.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=U.offsetY.number*f.options.scale,f.ctx.shadowBlur=U.blur.number,f.renderTextWithLetterSpacing(g,t.letterSpacing,B)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),t.textDecorationLine.length&&(f.ctx.fillStyle=nA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(U){switch(U){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+B),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+l),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=nA(t.webkitTextStrokeColor),f.ctx.lineWidth=t.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+B)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Jt(r),o=Wt(t);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,p,p,B,l,u,f,y,d,g,I,w,x,U,p,E,y,I;return cA(this,function(C){switch(C.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,o=0,i=t.textNodes,C.label=1;case 1:return o<i.length?(a=i[o],[4,this.renderTextNode(a,s)]):[3,4];case 2:C.sent(),C.label=3;case 3:return o++,[3,1];case 4:if(!(t instanceof vo))return[3,8];C.label=5;case 5:return C.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,8];case 7:return C.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Ho&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof yo))return[3,12];C.label=9;case 9:return C.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return p=C.sent(),this.renderReplacedElement(t,n,p),[3,12];case 11:return C.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof To&&t.tree?(B=new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,B.render(t.tree)]):[3,14];case 13:l=C.sent(),t.width&&t.height&&this.ctx.drawImage(l,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),C.label=14;case 14:if(t instanceof dn&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Nt?t.checked&&(this.ctx.save(),this.path([new m(t.bounds.left+u*.39363,t.bounds.top+u*.79),new m(t.bounds.left+u*.16,t.bounds.top+u*.5549),new m(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new m(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new m(t.bounds.left+u*.72983,t.bounds.top+u*.23),new m(t.bounds.left+u*.84,t.bounds.top+u*.34085),new m(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=nA(xs),this.ctx.fill(),this.ctx.restore()):t.type===Pt&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=nA(xs),this.ctx.fill(),this.ctx.restore())),Nu(t)&&t.value.length){switch(f=this.createFontStyle(s),y=f[0],d=f[1],g=this.fontMetrics.getMetrics(y,d).baseline,this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Vu(t.styles.textAlign),I=Jt(t),w=0,t.styles.textAlign){case 1:w+=I.width/2;break;case 2:w+=I.width;break}x=I.add(w,0,0,-I.height/2+1),this.ctx.save(),this.path([new m(I.left,I.top),new m(I.left+I.width,I.top),new m(I.left+I.width,I.top+I.height),new m(I.left,I.top+I.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new nt(t.value,x),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(U=t.styles.listStyleImage,U.type!==0)return[3,18];p=void 0,E=U.url,C.label=15;case 15:return C.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return p=C.sent(),this.ctx.drawImage(p,t.bounds.left-(p.width+10),t.bounds.top),[3,18];case 17:return C.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(y=this.createFontStyle(s)[0],this.ctx.font=y,this.ctx.fillStyle=nA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",I=new XA(t.bounds.left,t.bounds.top+j(t.styles.paddingTop,t.bounds.width),t.bounds.width,fs(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new nt(r.listValue,I),s.letterSpacing,fs(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),C.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(r){return wA(this,void 0,void 0,function(){var t,n,U,s,o,U,i,a,U,B,l,U,u,f,U,d,g,U,w,x,U;return cA(this,function(p){switch(p.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:p.sent(),t=0,n=r.negativeZIndex,p.label=2;case 2:return t<n.length?(U=n[t],[4,this.renderStack(U)]):[3,5];case 3:p.sent(),p.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:p.sent(),s=0,o=r.nonInlineLevel,p.label=7;case 7:return s<o.length?(U=o[s],[4,this.renderNode(U)]):[3,10];case 8:p.sent(),p.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,p.label=11;case 11:return i<a.length?(U=a[i],[4,this.renderStack(U)]):[3,14];case 12:p.sent(),p.label=13;case 13:return i++,[3,11];case 14:B=0,l=r.nonPositionedInlineLevel,p.label=15;case 15:return B<l.length?(U=l[B],[4,this.renderStack(U)]):[3,18];case 16:p.sent(),p.label=17;case 17:return B++,[3,15];case 18:u=0,f=r.inlineLevel,p.label=19;case 19:return u<f.length?(U=f[u],[4,this.renderNode(U)]):[3,22];case 20:p.sent(),p.label=21;case 21:return u++,[3,19];case 22:d=0,g=r.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return d<g.length?(U=g[d],[4,this.renderStack(U)]):[3,26];case 24:p.sent(),p.label=25;case 25:return d++,[3,23];case 26:w=0,x=r.positiveZIndex,p.label=27;case 27:return w<x.length?(U=x[w],[4,this.renderStack(U)]):[3,30];case 28:p.sent(),p.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},e.prototype.formatPath=function(r){var t=this;r.forEach(function(n,s){var o=vA(n)?n.start:n;s===0?t.ctx.moveTo(o.x,o.y):t.ctx.lineTo(o.x,o.y),vA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(r,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},e.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var o=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=o.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},e.prototype.renderBackgroundImage=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a;return cA(this,function(B){switch(B.label){case 0:t=r.styles.backgroundImage.length-1,n=function(l){var u,f,d,K,G,X,R,O,_,g,K,G,X,R,O,w,x,U,p,E,y,I,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA,hA;return cA(this,function(OA){switch(OA.label){case 0:if(l.type!==0)return[3,5];u=void 0,f=l.url,OA.label=1;case 1:return OA.trys.push([1,3,,4]),[4,s.context.cache.match(f)];case 2:return u=OA.sent(),[3,4];case 3:return OA.sent(),s.context.logger.error("Error loading background-image "+f),[3,4];case 4:return u&&(d=Nr(r,t,[u.width,u.height,u.width/u.height]),K=d[0],G=d[1],X=d[2],R=d[3],O=d[4],_=s.ctx.createPattern(s.resizeImage(u,R,O),"repeat"),s.renderRepeat(K,_,G,X)),[3,6];case 5:HB(l)?(g=Nr(r,t,[null,null,null]),K=g[0],G=g[1],X=g[2],R=g[3],O=g[4],w=FB(l.angle,R,O),x=w[0],U=w[1],p=w[2],E=w[3],y=w[4],I=document.createElement("canvas"),I.width=R,I.height=O,C=I.getContext("2d"),b=C.createLinearGradient(U,E,p,y),ls(l.stops,x).forEach(function(WA){return b.addColorStop(WA.stop,nA(WA.color))}),C.fillStyle=b,C.fillRect(0,0,R,O),R>0&&O>0&&(_=s.ctx.createPattern(I,"repeat"),s.renderRepeat(K,_,G,X))):yB(l)&&(S=Nr(r,t,[null,null,null]),K=S[0],M=S[1],J=S[2],R=S[3],O=S[4],eA=l.position.length===0?[fn]:l.position,G=j(eA[0],R),X=j(eA[eA.length-1],O),dA=pB(l,G,X,R,O),aA=dA[0],BA=dA[1],aA>0&&BA>0&&(FA=s.ctx.createRadialGradient(M+G,J+X,0,M+G,J+X,aA),ls(l.stops,aA*2).forEach(function(WA){return FA.addColorStop(WA.stop,nA(WA.color))}),s.path(K),s.ctx.fillStyle=FA,aA!==BA?(MA=r.bounds.left+.5*r.bounds.width,CA=r.bounds.top+.5*r.bounds.height,LA=BA/aA,hA=1/LA,s.ctx.save(),s.ctx.translate(MA,CA),s.ctx.transform(1,0,0,LA,0,0),s.ctx.translate(-MA,-CA),s.ctx.fillRect(M,hA*(J-CA)+CA,R,O*hA),s.ctx.restore()):s.ctx.fill())),OA.label=6;case 6:return t--,[2]}})},s=this,o=0,i=r.styles.backgroundImage.slice(0).reverse(),B.label=1;case 1:return o<i.length?(a=i[o],[5,n(a)]):[3,4];case 2:B.sent(),B.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(r,t,n){return wA(this,void 0,void 0,function(){return cA(this,function(s){return this.path(Ps(n,t)),this.ctx.fillStyle=nA(r),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(r,t,n,s){return wA(this,void 0,void 0,function(){var o,i;return cA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return o=xu(s,n),this.path(o),this.ctx.fillStyle=nA(r),this.ctx.fill(),i=Tu(s,n),this.path(i),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(r){return wA(this,void 0,void 0,function(){var t,n,s,o,i,a,B,l,u=this;return cA(this,function(f){switch(f.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!te(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],o=Pu(be(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),te(t.backgroundColor)||(this.ctx.fillStyle=nA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:f.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(d){u.ctx.save();var g=Xt(r.curves),w=d.inset?0:Ou,x=Iu(g,-w+(d.inset?1:-1)*d.spread.number,(d.inset?1:-1)*d.spread.number,d.spread.number*(d.inset?-2:2),d.spread.number*(d.inset?-2:2));d.inset?(u.path(g),u.ctx.clip(),u.mask(x)):(u.mask(g),u.ctx.clip(),u.path(x)),u.ctx.shadowOffsetX=d.offsetX.number+w,u.ctx.shadowOffsetY=d.offsetY.number,u.ctx.shadowColor=nA(d.color),u.ctx.shadowBlur=d.blur.number,u.ctx.fillStyle=d.inset?nA(d.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),f.label=2;case 2:i=0,a=0,B=s,f.label=3;case 3:return a<B.length?(l=B[a],l.style!==0&&!te(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,i,r.curves,3)];case 6:return f.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,i,r.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,i,r.curves)];case 10:f.sent(),f.label=11;case 11:i++,f.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(r,t,n,s,o){return wA(this,void 0,void 0,function(){var i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,C,I,C;return cA(this,function(b){return this.ctx.save(),i=Lu(s,n),a=Ps(s,n),o===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(B=a[0].start.x,l=a[0].start.y):(B=a[0].x,l=a[0].y),vA(a[1])?(u=a[1].end.x,f=a[1].end.y):(u=a[1].x,f=a[1].y),n===0||n===2?d=Math.abs(B-u):d=Math.abs(l-f),this.ctx.beginPath(),o===3?this.formatPath(i):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,w=t<3?t*2:t,o===3&&(g=t,w=t),x=!0,d<=g*2?x=!1:d<=g*2+w?(U=d/(2*g+w),g*=U,w*=U):(p=Math.floor((d+w)/(g+w)),E=(d-p*g)/(p-1),y=(d-(p+1)*g)/p,w=y<=0||Math.abs(w-E)<Math.abs(w-y)?E:y),x&&(o===3?this.ctx.setLineDash([0,g+w]):this.ctx.setLineDash([g,w])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=nA(r),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(vA(a[0])&&(I=a[3],C=a[0],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke()),vA(a[1])&&(I=a[1],C=a[2],this.ctx.beginPath(),this.formatPath([new m(I.end.x,I.end.y),new m(C.start.x,C.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t;return cA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=bu(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Jo),Nu=function(A){return A instanceof xo||A instanceof bo?!0:A instanceof dn&&A.type!==Pt&&A.type!==Nt},Pu=function(A,e){switch(A){case 0:return Xt(e);case 2:return mu(e);default:return Wt(e)}},Vu=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},ku=["-apple-system","system-ui"],Xu=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return ku.indexOf(e)===-1}):A},Wu=(function(A){TA(e,A);function e(r,t){var n=A.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return e.prototype.render=function(r){return wA(this,void 0,void 0,function(){var t,n;return cA(this,function(s){switch(s.label){case 0:return t=nn(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,Ju(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=nA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(Jo),Ju=function(A){return new Promise(function(e,r){var t=new Image;t.onload=function(){e(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Yu=(function(){function A(e){var r=e.id,t=e.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Qt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Qt([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Qt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Qt([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),Zu=(function(){function A(e,r){var t;this.windowBounds=r,this.instanceName="#"+A.instanceCount++,this.logger=new Yu({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new wu(this,e)}return A.instanceCount=1,A})(),qu=function(A,e){return e===void 0&&(e={}),ju(A,e)};typeof window<"u"&&No.setContext(window);var ju=function(A,e){return wA(void 0,void 0,void 0,function(){var r,t,n,s,o,i,a,B,l,u,f,d,g,w,x,U,p,E,y,I,b,C,b,_,S,K,M,J,R,O,eA,G,X,dA,aA,BA,FA,MA,CA,LA;return cA(this,function(hA){switch(hA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=A.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(_=e.allowTaint)!==null&&_!==void 0?_:!1,imageTimeout:(S=e.imageTimeout)!==null&&S!==void 0?S:15e3,proxy:e.proxy,useCORS:(K=e.useCORS)!==null&&K!==void 0?K:!1},s=Vr({logging:(M=e.logging)!==null&&M!==void 0?M:!0,cache:e.cache},n),o={windowWidth:(J=e.windowWidth)!==null&&J!==void 0?J:t.innerWidth,windowHeight:(R=e.windowHeight)!==null&&R!==void 0?R:t.innerHeight,scrollX:(O=e.scrollX)!==null&&O!==void 0?O:t.pageXOffset,scrollY:(eA=e.scrollY)!==null&&eA!==void 0?eA:t.pageYOffset},i=new XA(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),a=new Zu(s,i),B=(G=e.foreignObjectRendering)!==null&&G!==void 0?G:!1,l={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:B,copyStyles:B},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Os(a,A,l),f=u.clonedReferenceElement,f?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return d=hA.sent(),g=Cn(f)||zl(f)?Ii(f.ownerDocument):Yt(a,f),w=g.width,x=g.height,U=g.left,p=g.top,E=zu(a,f,e.backgroundColor),y={canvas:e.canvas,backgroundColor:E,scale:(aA=(dA=e.scale)!==null&&dA!==void 0?dA:t.devicePixelRatio)!==null&&aA!==void 0?aA:1,x:((BA=e.x)!==null&&BA!==void 0?BA:0)+U,y:((FA=e.y)!==null&&FA!==void 0?FA:0)+p,width:(MA=e.width)!==null&&MA!==void 0?MA:Math.ceil(w),height:(CA=e.height)!==null&&CA!==void 0?CA:Math.ceil(x)},B?(a.logger.debug("Document cloned, using foreign object rendering"),b=new Wu(a,y),[4,b.render(f)]):[3,3];case 2:return I=hA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+U+","+p+" with size "+w+"x"+x+" using computed rendering"),a.logger.debug("Starting DOM parsing"),C=So(a,f),E===C.styles.backgroundColor&&(C.styles.backgroundColor=kA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+y.x+","+y.y+" with size "+y.width+"x"+y.height),b=new Gu(a,y),[4,b.render(C)];case 4:I=hA.sent(),hA.label=5;case 5:return(!((LA=e.removeContainer)!==null&&LA!==void 0)||LA)&&(Os.destroy(d)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,I]}})})},zu=function(A,e,r){var t=e.ownerDocument,n=t.documentElement?tt(A,getComputedStyle(t.documentElement).backgroundColor):kA.TRANSPARENT,s=t.body?tt(A,getComputedStyle(t.body).backgroundColor):kA.TRANSPARENT,o=typeof r=="string"?tt(A,r):r===null?kA.TRANSPARENT:4294967295;return e===t.documentElement?te(n)?te(s)?o:s:n:o},Yo=qu;var Zo=!1,$u=new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]);function Af(){if(Zo)return;Zo=!0;let A=CanvasRenderingContext2D.prototype.createPattern;CanvasRenderingContext2D.prototype.createPattern=function(e,r){return e&&"width"in e&&"height"in e&&(e.width===0||e.height===0)?null:A.call(this,e,r)}}function jo(){Af()}function zo(A){A.style.opacity="1",fe(A,"important"),A.querySelectorAll("[data-start]").forEach(e=>fe(e,"important"))}function ef(A,e){if(!A.id)return;let r=e.getElementById(A.id);r instanceof HTMLElement&&zo(r)}function tf(A){let e=A.ownerDocument.defaultView;e&&[A,...Array.from(A.querySelectorAll("*"))].forEach(r=>{if($u.has(r.tagName))return;let t=e.getComputedStyle(r);if(t.boxShadow==="none"||t.transform==="none")return;let n=A.ownerDocument.createElement("div");n.setAttribute("data-hyper-shader-shadow-shim",""),n.style.cssText=["position:absolute","inset:0","border-radius:inherit",`box-shadow:${t.boxShadow}`,"background:transparent","pointer-events:none","z-index:0"].join(";"),t.position==="static"&&(r.style.position="relative"),r.style.boxShadow="none",r.insertBefore(n,r.firstChild)})}function nr(){if(typeof document>"u")return!1;let A=document.createElement("canvas");if(A.setAttribute("layoutsubtree",""),!("layoutSubtree"in A))return!1;let e=A.getContext("2d");return e!=null&&typeof e.drawElementImage=="function"}async function rf(A,e,r,t,n){let s=document.createElement("canvas");s.width=r,s.height=t,s.setAttribute("layoutsubtree",""),s.style.cssText=`position:fixed;top:0;left:0;width:${r}px;height:${t}px;z-index:-9999;pointer-events:none;opacity:0`;let o=A.cloneNode(!0);n.forceVisible&&zo(o),s.appendChild(o),document.body.appendChild(s);try{await new Promise(l=>requestAnimationFrame(()=>requestAnimationFrame(()=>l())));let i=s.getContext("2d");i.fillStyle=e,i.fillRect(0,0,r,t);let a=s.firstElementChild;a&&i.drawElementImage(a,0,0,r,t);let B=document.createElement("canvas");return B.width=r,B.height=t,B.getContext("2d").drawImage(s,0,0),s.remove(),B}catch(i){throw s.remove(),i}}function $o(A,e,r=we,t=Qe,n={}){return nr()&&!n.preferBrowserPaint?rf(A,e,r,t,n).catch(()=>qo(A,e,r,t,n)):qo(A,e,r,t,n)}function qo(A,e,r,t,n={}){let s=o=>Yo(A,{width:r,height:t,scale:n.scale??1,backgroundColor:e,logging:!1,foreignObjectRendering:o,useCORS:!0,allowTaint:!0,onclone:i=>{if(!A.id)return;let a=i.getElementById(A.id);a instanceof HTMLElement&&tf(a),n.forceVisible&&ef(A,i)},ignoreElements:i=>i.tagName==="CANVAS"||i.hasAttribute("data-no-capture")});return n.preferBrowserPaint===!0?s(!0).catch(()=>s(!1)):s(!1)}var hn="__hf-page-side-compositor",Ai="__hf_page_compositor_v1__";function nf(A,e){let r=A.querySelectorAll("*"),t=e.querySelectorAll("*"),n=[[A,e]];r.forEach((i,a)=>n.push([i,t[a]]));let s=e,o=A;for(let i=A.parentElement;i&&i!==document.body&&i!==document.documentElement;i=i.parentElement){let a=i.cloneNode(!1);a.appendChild(s),n.push([i,a]),s=a,o=i}return{root:s,liveRoot:o,pairs:n}}function sf(A,e,r){let t=new Map;r.forEach(([o,i],a)=>{t.set(o,a),t.set(i,a)});let n=o=>{if(!("animationName"in o))return null;let i=o.effect;return`${t.get(i.target)}|${i.pseudoElement??""}|${o.animationName}`},s=new Map;for(let o of A.getAnimations({subtree:!0})){let i=n(o);i&&s.set(i,o.currentTime)}for(let o of e.getAnimations({subtree:!0})){let i=n(o);if(!i)continue;let a=s.get(i);a===void 0?o.cancel():(o.pause(),o.currentTime=a)}}function ei(){if(typeof window>"u"||typeof document>"u"||!nr())return!1;let A=document.createElement("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl");return e?(e.getExtension("WEBGL_lose_context")?.loseContext(),!0):!1}function Un(A){if(typeof window>"u")return!1;if(window.__HF_PAGE_COMPOSITOR_CANARY__=Ai,!ei())return console.warn("[HyperShader] page-side compositing requested but drawElementImage/WebGL is not available; falling back to opacity-flip mode (Node-side layered pipeline will handle the blend)."),!1;if(document.getElementById(hn))return!0;let{scenes:e,transitions:r,accentColors:t,width:n,height:s,defaultDuration:o}=A,i=document.createElement("canvas");i.id=hn,i.width=n,i.height=s,i.style.cssText="position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483646;pointer-events:none;display:none;",document.body.appendChild(i);let a=de(i,n,s);if(!a)return console.warn("[HyperShader] page-side compositor: WebGL context unavailable."),i.remove(),!1;let B=Ce(a),l=new Map;for(let K of r)if(K.shader!==void 0&&!l.has(K.shader))try{l.set(K.shader,he(a,Fe(K.shader)))}catch(M){console.warn(`[HyperShader] page-side compositor: failed to compile "${K.shader}":`,M)}let u=[];for(let K=0;K<r.length;K++){let M=r[K];if(!M||M.shader===void 0)continue;let J=e[K],R=e[K+1],O=l.get(M.shader);!J||!R||!O||u.push({time:M.time,duration:M.duration??o,shader:M.shader,fromSceneId:J,toSceneId:R,prog:O})}if(u.length===0)return i.remove(),!1;let f=SA(a),d=SA(a),g=document.createElement("canvas"),w=document.createElement("canvas");for(let K of[g,w])K.width=n,K.height=s,K.setAttribute("layoutsubtree",""),K.style.cssText="position:fixed;top:0;left:0;width:"+n+"px;height:"+s+"px;z-index:-9998;pointer-events:none;",document.body.appendChild(K);function x(K){for(let M of u)if(K>=M.time&&K<=M.time+M.duration)return M;return null}let U=null,p=0,E=window;async function y(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=document.getElementById(K.fromSceneId),J=document.getElementById(K.toSceneId);if(!(M instanceof HTMLElement)||!(J instanceof HTMLElement))return E.__hf_page_composite_pending=!1,!1;for(;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);for(let[O,eA]of[[M,g],[J,w]]){let G=O.cloneNode(!0);G.style.opacity="1",fe(G),G.querySelectorAll("[data-start]").forEach(FA=>{FA.style.opacity="1",fe(FA)});let{root:X,liveRoot:dA,pairs:aA}=nf(O,G),BA=document.createElement("div");BA.style.cssText=`position:absolute;left:0;top:0;width:${n}px;height:${s}px;margin:0;`,BA.appendChild(X),eA.appendChild(BA),sf(dA,X,aA)}let R=[];for(let O of[g,w])for(let eA of O.querySelectorAll("img"))eA.src&&eA.src.startsWith("data:")&&typeof eA.decode=="function"&&R.push(eA.decode().catch(()=>{}));return R.length>0&&await Promise.all(R),!0}function I(){let K=U;if(!K)return E.__hf_page_composite_pending=!1,!1;let M=g.firstElementChild,J=w.firstElementChild;if(!M||!J)return E.__hf_page_composite_pending=!1,!1;let R=g.getContext("2d"),O=w.getContext("2d");if(!R?.drawElementImage||!O?.drawElementImage)return E.__hf_page_composite_pending=!1,!1;let eA=[[R,M],[O,J]];try{for(let[G,X]of eA)G.fillStyle=A.bgColor,G.fillRect(0,0,n,s),G.drawElementImage(X,0,0,n,s);NA(a,f,g),NA(a,d,w)}catch(G){return console.warn("[HyperShader] page-side compositor: scene capture failed:",G),i.style.display="none",E.__hf_page_composite_pending=!1,!1}finally{for(let[G]of eA)G.clearRect(0,0,n,s)}try{Ue(a,B,K.prog,f,d,p,t,n,s),i.style.display="block"}catch(G){console.warn("[HyperShader] page-side compositor: renderShader failed:",G),i.style.display="none"}return E.__hf_page_composite_pending=!1,!0}E.__hf_page_composite_resolve=I,E.__hf_page_composite_prepare=y;let C=window,b=()=>{if(!C.__hf)return;let K=C.__hf.seek;if(typeof K!="function")return;let M=J=>{let R=K.call(C.__hf,J),O=x(J);if(!O){for(i.style.display="none",E.__hf_page_composite_pending=!1;g.firstChild;)g.removeChild(g.firstChild);for(;w.firstChild;)w.removeChild(w.firstChild);return R}return U=O,p=O.duration===0?1:Math.min(1,Math.max(0,(J-O.time)/O.duration)),E.__hf_page_composite_pending=!0,R};C.__hf.seek=M},_=0,S=window.setInterval(()=>{_+=1,C.__hf?.seek?(b(),window.clearInterval(S)):_>200&&(window.clearInterval(S),console.warn("[HyperShader] page-side compositor: window.__hf.seek never appeared after 10s; the engine bridge did not initialize. Falling back to opacity-flip mode."))},50);return!0}var ir=.7,pn="power2.inOut",of="attribute vec2 a_pos; varying vec2 v_uv; void main(){v_uv=a_pos*0.5+0.5; gl_Position=vec4(a_pos,0,1);}",sr=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"],af="hyper-shader-preview-cache",RA="frames",Bf=1,cf="v1",ti=2,ri=1.25,lf=1200;function uf(A){let e=A.replace("#","");if(e.length<6)return[.5,.5,.5];let r=parseInt(e.slice(0,2),16)/255,t=parseInt(e.slice(2,4),16)/255,n=parseInt(e.slice(4,6),16)/255;return Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n)?[.5,.5,.5]:[r,t,n]}function li(A){let[e,r,t]=uf(A);return{accent:[e,r,t],dark:[e*.35,r*.35,t*.35],bright:[Math.min(1,e*1.5+.2),Math.min(1,r*1.5+.2),Math.min(1,t*1.5+.2)]}}function le(A,e,r){return Math.min(r,Math.max(e,A))}function ff(A,e){return A===void 0?e:Number.isFinite(A)&&A>0?A:e}var gf="__hf_shader_capture_scale",wf="__hf_shader_loading";function ui(A,e){let r=window[A];if(typeof r=="string")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r);try{return new URLSearchParams(window.location.search).get(e)}catch{return null}}function Qf(){let A=ui("__HF_SHADER_CAPTURE_SCALE",gf),e=A===null?NaN:Number(A);return le(Number.isFinite(e)&&e>0?e:1,.25,1)}function df(){if(window.__HF_REPLAY_SKIPPED_FRAMES)return"none";let A=ui("__HF_SHADER_LOADING",wf)?.trim().toLowerCase();return A==="player"||A==="true"||A==="1"?"player":A==="none"||A==="false"||A==="0"||A==="off"?"none":"internal"}function Br(A){let e=2166136261;for(let r=0;r<A.length;r+=1)e^=A.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}function Cf(A){let e=Array.from(A.querySelectorAll("style")).map(t=>t.textContent||"").join(`
7
7
  `),r=Array.from(A.querySelectorAll('link[rel~="stylesheet"]')).map(t=>`${t.href}:${t.getAttribute("integrity")||""}`).join(`
8
8
  `);return Br(`${e}
9
9
  ${r}`)}function hf(A){return A.includes("gsap.timeline")||A.includes("__timelines")||A.includes(".to(")||A.includes(".set(")?!A.includes("HyperShader")&&!A.includes("hyper-shader")&&!A.includes("hyperShader"):!1}function Uf(A){let e=Array.from(A.querySelectorAll('meta[name="hyperframes-project-signature"]')).map(t=>t.getAttribute("content")||"").join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/shader-transitions",
3
- "version": "0.8.228",
3
+ "version": "0.8.230",
4
4
  "description": "WebGL shader transitions for HyperFrames compositions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  "tsup": "^8.0.0",
32
32
  "typescript": "^5.0.0",
33
33
  "vitest": "^4.1.11",
34
- "@hyperframes/core": "0.8.228"
34
+ "@hyperframes/core": "0.8.230"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsup",