PageSourceSearch

https://objekt.my/_next/static/chunks/2xl9psb01o1el.js

js objekt.my collected 2026-09-30 15:04:19 UTC 94,254 bytes, 184 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,9641,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.loop=a.conditional=a.parse=void 0,a.parse=function t(e,a){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r;if(Array.isArray(a))a.forEach(function(a){return t(e,a,r,i)});else if("function"==typeof a)a(e,r,i,t);else{var o=Object.keys(a)[0];Array.isArray(a[o])?(i[o]={},t(e,a[o],r,i[o])):i[o]=a[o](e,r,i,t)}return r},a.conditional=function(t,e){return function(a,r,i,o){e(a,r,i)&&o(a,t,r,i)}},a.loop=function(t,e){return function(a,r,i,o){for(var s=[],n=a.pos;e(a,r,i);){var c={};if(o(a,t,r,c),a.pos===n)break;n=a.pos,s.push(c)}return s}}},9920,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.readBits=a.readArray=a.readUnsigned=a.readString=a.peekBytes=a.readBytes=a.peekByte=a.readByte=a.buildStream=void 0,a.buildStream=function(t){return{data:t,pos:0}};var r=function(){return function(t){return t.data[t.pos++]}};a.readByte=r,a.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var i=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};a.readBytes=i,a.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}},a.readString=function(t){return function(e){return Array.from(i(t)(e)).map(function(t){return String.fromCharCode(t)}).join("")}},a.readUnsigned=function(t){return function(e){var a=i(2)(e);return t?(a[1]<<8)+a[0]:(a[0]<<8)+a[1]}},a.readArray=function(t,e){return function(a,r,o){for(var s="function"==typeof e?e(a,r,o):e,n=i(t),c=Array(s),d=0;d<s;d++)c[d]=n(a);return c}};var o=function(t,e,a){for(var r=0,i=0;i<a;i++)r+=t[e+i]&&Math.pow(2,a-i-1);return r};a.readBits=function(t){return function(e){for(var a=r()(e),i=Array(8),s=0;s<8;s++)i[7-s]=!!(a&1<<s);return Object.keys(t).reduce(function(e,a){var r=t[a];return r.length?e[a]=o(i,r.index,r.length):e[a]=i[r.index],e},{})}}},61369,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var r=t.r(9641),i=t.r(9920),o={blocks:function(t){for(var e=[],a=t.data.length,r=0,o=(0,i.readByte)()(t);0!==o&&o;o=(0,i.readByte)()(t)){if(t.pos+o>=a){var s=a-t.pos;e.push((0,i.readBytes)(s)(t)),r+=s;break}e.push((0,i.readBytes)(o)(t)),r+=o}for(var n=new Uint8Array(r),c=0,d=0;d<e.length;d++)n.set(e[d],c),c+=e[d].length;return n}},s=(0,r.conditional)({gce:[{codes:(0,i.readBytes)(2)},{byteSize:(0,i.readByte)()},{extras:(0,i.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,i.readUnsigned)(!0)},{transparentColorIndex:(0,i.readByte)()},{terminator:(0,i.readByte)()}]},function(t){var e=(0,i.peekBytes)(2)(t);return 33===e[0]&&249===e[1]}),n=(0,r.conditional)({image:[{code:(0,i.readByte)()},{descriptor:[{left:(0,i.readUnsigned)(!0)},{top:(0,i.readUnsigned)(!0)},{width:(0,i.readUnsigned)(!0)},{height:(0,i.readUnsigned)(!0)},{lct:(0,i.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,r.conditional)({lct:(0,i.readArray)(3,function(t,e,a){return Math.pow(2,a.descriptor.lct.size+1)})},function(t,e,a){return a.descriptor.lct.exists}),{data:[{minCodeSize:(0,i.readByte)()},o]}]},function(t){return 44===(0,i.peekByte)()(t)}),c=(0,r.conditional)({text:[{codes:(0,i.readBytes)(2)},{blockSize:(0,i.readByte)()},{preData:function(t,e,a){return(0,i.readBytes)(a.text.blockSize)(t)}},o]},function(t){var e=(0,i.peekBytes)(2)(t);return 33===e[0]&&1===e[1]}),d=(0,r.conditional)({application:[{codes:(0,i.readBytes)(2)},{blockSize:(0,i.readByte)()},{id:function(t,e,a){return(0,i.readString)(a.blockSize)(t)}},o]},function(t){var e=(0,i.peekBytes)(2)(t);return 33===e[0]&&255===e[1]}),l=(0,r.conditional)({comment:[{codes:(0,i.readBytes)(2)},o]},function(t){var e=(0,i.peekBytes)(2)(t);return 33===e[0]&&254===e[1]});a.default=[{header:[{signature:(0,i.readString)(3)},{version:(0,i.readString)(3)}]},{lsd:[{width:(0,i.readUnsigned)(!0)},{height:(0,i.readUnsigned)(!0)},{gct:(0,i.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,i.readByte)()},{pixelAspectRatio:(0,i.readByte)()}]},(0,r.conditional)({gct:(0,i.readArray)(3,function(t,e){return Math.pow(2,e.lsd.gct.size+1)})},function(t,e){return e.lsd.gct.exists}),{frames:(0,r.loop)([s,d,l,n,c],function(t){var e=(0,i.peekByte)()(t);return 33===e||44===e})}]},10133,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.deinterlace=void 0,a.deinterlace=function(t,e){for(var a=Array(t.length),r=t.length/e,i=[0,4,2,1],o=[8,8,4,2],s=0,n=0;n<4;n++)for(var c=i[n];c<r;c+=o[n])!function(r,i){var o=t.slice(i*e,(i+1)*e);a.splice.apply(a,[r*e,e].concat(o))}(c,s),s++;return a}},92319,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.lzw=void 0,a.lzw=function(t,e,a){var r,i,o,s,n,c,d,l,h,u,p,m,f,g,x,y=Array(a),v=Array(4096),b=Array(4096),w=Array(4097);for(n=(i=1<<t)+1,r=i+2,d=-1,o=(1<<(s=t+1))-1,l=0;l<i;l++)v[l]=0,b[l]=l;for(u=p=m=f=g=x=0,h=0;h<a;){if(0===f){if(p<s){u+=e[x]<<p,p+=8,x++;continue}if(l=u&o,u>>=s,p-=s,l>r||l==n)break;if(l==i){o=(1<<(s=t+1))-1,r=i+2,d=-1;continue}if(-1==d){w[f++]=b[l],d=l,m=l;continue}for(c=l,l==r&&(w[f++]=m,l=d);l>i;)w[f++]=b[l],l=v[l];m=255&b[l],w[f++]=m,r<4096&&(v[r]=d,b[r]=m,(++r&o)==0&&r<4096&&(s++,o+=r)),d=c}f--,y[g++]=w[f],h++}for(h=g;h<a;h++)y[h]=0;return y}},1482,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.decompressFrames=a.decompressFrame=a.parseGIF=void 0;var r,i=(r=t.r(61369))&&r.__esModule?r:{default:r},o=t.r(9641),s=t.r(9920),n=t.r(10133),c=t.r(92319);a.parseGIF=function(t){var e=new Uint8Array(t);return(0,o.parse)((0,s.buildStream)(e),i.default)};var d=function(t){for(var e=t.pixels.length,a=new Uint8ClampedArray(4*e),r=0;r<e;r++){var i=4*r,o=t.pixels[r],s=t.colorTable[o]||[0,0,0];a[i]=s[0],a[i+1]=s[1],a[i+2]=s[2],a[i+3]=255*(o!==t.transparentIndex)}return a},l=function(t,e,a){if(!t.image)return void console.warn("gif frame does not have associated image.");var r=t.image,i=r.descriptor.width*r.descriptor.height,o=(0,c.lzw)(r.data.minCodeSize,r.data.blocks,i);r.descriptor.lct.interlaced&&(o=(0,n.deinterlace)(o,r.descriptor.width));
1var s={pixels:o,dims:{top:t.image.descriptor.top,left:t.image.descriptor.left,width:t.image.descriptor.width,height:t.image.descriptor.height}};return r.descriptor.lct&&r.descriptor.lct.exists?s.colorTable=r.lct:s.colorTable=e,t.gce&&(s.delay=10*(t.gce.delay||10),s.disposalType=t.gce.extras.disposal,t.gce.extras.transparentColorGiven&&(s.transparentIndex=t.gce.transparentColorIndex)),a&&(s.patch=d(s)),s};a.decompressFrame=l,a.decompressFrames=function(t,e){return t.frames.filter(function(t){return t.image}).map(function(a){return l(a,t.gct,e)})}},34257,(t,e,a)=>{"use strict";function r(t,e,a,r){for(var i=t[e++],o=1<<i,s=o+1,n=s+1,c=i+1,d=(1<<c)-1,l=0,h=0,u=0,p=t[e++],m=new Int32Array(4096),f=null;;){for(;l<16&&0!==p;)h|=t[e++]<<l,l+=8,1===p?p=t[e++]:--p;if(l<c)break;var g=h&d;if(h>>=c,l-=c,g===o){n=s+1,d=(1<<(c=i+1))-1,f=null;continue}if(g===s)break;for(var x=g<n?g:f,y=0,v=x;v>o;)v=m[v]>>8,++y;var b=v;if(u+y+ +(x!==g)>r)return void console.log("Warning, gif stream longer than expected.");a[u++]=b;var w=u+=y;for(x!==g&&(a[u++]=b),v=x;y--;)v=m[v],a[--w]=255&v,v>>=8;null!==f&&n<4096&&(m[n++]=f<<8|b,n>=d+1&&c<12&&(++c,d=d<<1|1)),f=g}return u!==r&&console.log("Warning, gif stream shorter than expected."),a}try{a.GifWriter=function(t,e,a,r){var i=0,r=void 0===r?{}:r,o=void 0===r.loop?null:r.loop,s=void 0===r.palette?null:r.palette;if(e<=0||a<=0||e>65535||a>65535)throw Error("Width/Height invalid.");function n(t){var e=t.length;if(e<2||e>256||e&e-1)throw Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return e}t[i++]=71,t[i++]=73,t[i++]=70,t[i++]=56,t[i++]=57,t[i++]=97;var c=0,d=0;if(null!==s){for(var l=n(s);l>>=1;)++c;if(l=1<<c,--c,void 0!==r.background){if((d=r.background)>=l)throw Error("Background index out of range.");if(0===d)throw Error("Background index explicitly passed as 0.")}}if(t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&a,t[i++]=a>>8&255,t[i++]=128*(null!==s)|c,t[i++]=d,t[i++]=0,null!==s)for(var h=0,u=s.length;h<u;++h){var p=s[h];t[i++]=p>>16&255,t[i++]=p>>8&255,t[i++]=255&p}if(null!==o){if(o<0||o>65535)throw Error("Loop count invalid.");t[i++]=33,t[i++]=255,t[i++]=11,t[i++]=78,t[i++]=69,t[i++]=84,t[i++]=83,t[i++]=67,t[i++]=65,t[i++]=80,t[i++]=69,t[i++]=50,t[i++]=46,t[i++]=48,t[i++]=3,t[i++]=1,t[i++]=255&o,t[i++]=o>>8&255,t[i++]=0}var m=!1;this.addFrame=function(e,a,r,o,c,d){if(!0===m&&(--i,m=!1),d=void 0===d?{}:d,e<0||a<0||e>65535||a>65535)throw Error("x/y invalid.");if(r<=0||o<=0||r>65535||o>65535)throw Error("Width/Height invalid.");if(c.length<r*o)throw Error("Not enough pixels for the frame size.");var l=!0,h=d.palette;if(null==h&&(l=!1,h=s),null==h)throw Error("Must supply either a local or global palette.");for(var u=n(h),p=0;u>>=1;)++p;u=1<<p;var f=void 0===d.delay?0:d.delay,g=void 0===d.disposal?0:d.disposal;if(g<0||g>3)throw Error("Disposal out of range.");var x=!1,y=0;if(void 0!==d.transparent&&null!==d.transparent&&(x=!0,(y=d.transparent)<0||y>=u))throw Error("Transparent color index.");if((0!==g||x||0!==f)&&(t[i++]=33,t[i++]=249,t[i++]=4,t[i++]=g<<2|!0===x,t[i++]=255&f,t[i++]=f>>8&255,t[i++]=y,t[i++]=0),t[i++]=44,t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&a,t[i++]=a>>8&255,t[i++]=255&r,t[i++]=r>>8&255,t[i++]=255&o,t[i++]=o>>8&255,t[i++]=!0===l?128|p-1:0,!0===l)for(var v=0,b=h.length;v<b;++v){var w=h[v];t[i++]=w>>16&255,t[i++]=w>>8&255,t[i++]=255&w}return i=function(t,e,a,r){t[e++]=a;var i=e++,o=1<<a,s=o-1,n=o+1,c=n+1,d=a+1,l=0,h=0;function u(a){for(;l>=a;)t[e++]=255&h,h>>=8,l-=8,e===i+256&&(t[i]=255,i=e++)}function p(t){h|=t<<l,l+=d,u(8)}var m=r[0]&s,f={};p(o);for(var g=1,x=r.length;g<x;++g){var y=r[g]&s,v=m<<8|y,b=f[v];if(void 0===b){for(h|=m<<l,l+=d;l>=8;)t[e++]=255&h,h>>=8,l-=8,e===i+256&&(t[i]=255,i=e++);4096===c?(p(o),c=n+1,d=a+1,f={}):(c>=1<<d&&++d,f[v]=c++),m=y}else m=b}return p(m),p(n),u(1),i+1===e?t[i]=0:(t[i]=e-i-1,t[e++]=0),e}(t,i,p<2?2:p,c)},this.end=function(){return!1===m&&(t[i++]=59,m=!0),i},this.getOutputBuffer=function(){return t},this.setOutputBuffer=function(e){t=e},this.getOutputBufferPosition=function(){return i},this.setOutputBufferPosition=function(t){i=t}},a.GifReader=function(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||(t[e++]+1&253)!=56||97!==t[e++])throw Error("Invalid GIF 87a/89a header.");var a=t[e++]|t[e++]<<8,i=t[e++]|t[e++]<<8,o=t[e++],s=1<<(7&o)+1;t[e++],t[e++];var n=null,c=null;o>>7&&(n=e,c=s,e+=3*s);var d=!0,l=[],h=0,u=null,p=0,m=null;for(this.width=a,this.height=i;d&&e<t.length;)switch(t[e++]){case 33:switch(t[e++]){case 255:if(11!==t[e]||78==t[e+1]&&69==t[e+2]&&84==t[e+3]&&83==t[e+4]&&67==t[e+5]&&65==t[e+6]&&80==t[e+7]&&69==t[e+8]&&50==t[e+9]&&46==t[e+10]&&48==t[e+11]&&3==t[e+12]&&1==t[e+13]&&0==t[e+16])e+=14,m=t[e++
1]|t[e++]<<8,e++;else for(e+=12;;){var f=t[e++];if(!(f>=0))throw Error("Invalid block size");if(0===f)break;e+=f}break;case 249:if(4!==t[e++]||0!==t[e+4])throw Error("Invalid graphics extension block.");var g=t[e++];h=t[e++]|t[e++]<<8,u=t[e++],(1&g)==0&&(u=null),p=g>>2&7,e++;break;case 254:for(;;){var f=t[e++];if(!(f>=0))throw Error("Invalid block size");if(0===f)break;e+=f}break;default:throw Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var x=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,v=t[e++]|t[e++]<<8,b=t[e++]|t[e++]<<8,w=t[e++],k=w>>7,j=w>>6&1,C=1<<(7&w)+1,P=n,I=c,F=!1;if(k){var F=!0;P=e,I=C,e+=3*C}var M=e;for(e++;;){var f=t[e++];if(!(f>=0))throw Error("Invalid block size");if(0===f)break;e+=f}l.push({x:x,y:y,width:v,height:b,has_local_palette:F,palette_offset:P,palette_size:I,data_offset:M,data_length:e-M,transparent_index:u,interlaced:!!j,delay:h,disposal:p});break;case 59:d=!1;break;default:throw Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return l.length},this.loopCount=function(){return m},this.frameInfo=function(t){if(t<0||t>=l.length)throw Error("Frame index out of range.");return l[t]},this.decodeAndBlitFrameBGRA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,n=new Uint8Array(s);r(t,o.data_offset,n,s);var c=o.palette_offset,d=o.transparent_index;null===d&&(d=256);var l=o.width,h=a-l,u=l,p=(o.y*a+o.x)*4,m=((o.y+o.height)*a+o.x)*4,f=p,g=4*h;!0===o.interlaced&&(g+=4*a*7);for(var x=8,y=0,v=n.length;y<v;++y){var b=n[y];if(0===u&&(f+=g,u=l,f>=m&&(g=4*h+4*a*(x-1),f=p+(l+h)*(x<<1),x>>=1)),b===d)f+=4;else{var w=t[c+3*b],k=t[c+3*b+1],j=t[c+3*b+2];i[f++]=j,i[f++]=k,i[f++]=w,i[f++]=255}--u}},this.decodeAndBlitFrameRGBA=function(e,i){var o=this.frameInfo(e),s=o.width*o.height,n=new Uint8Array(s);r(t,o.data_offset,n,s);var c=o.palette_offset,d=o.transparent_index;null===d&&(d=256);var l=o.width,h=a-l,u=l,p=(o.y*a+o.x)*4,m=((o.y+o.height)*a+o.x)*4,f=p,g=4*h;!0===o.interlaced&&(g+=4*a*7);for(var x=8,y=0,v=n.length;y<v;++y){var b=n[y];if(0===u&&(f+=g,u=l,f>=m&&(g=4*h+4*a*(x-1),f=p+(l+h)*(x<<1),x>>=1)),b===d)f+=4;else{var w=t[c+3*b],k=t[c+3*b+1],j=t[c+3*b+2];i[f++]=w,i[f++]=k,i[f++]=j,i[f++]=255}--u}}}}catch(t){}},3187,t=>{"use strict";var e=t.i(43476),a=t.i(56420);let r=(0,a.default)("badge-plus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),i=(0,a.default)("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);var o=t.i(89664),s=t.i(16327);let n=(0,a.default)("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]),c=(0,a.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),d=(0,a.default)("square-centerline-dashed-horizontal",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]),l=(0,a.default)("square-centerline-dashed-vertical",[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);var h=t.i(75849),h=h;let u=(0,a.default)("image-plus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]),p=(0,a.default)("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]),m=(0,a.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var f=t.i(7330),f=f;(0,a.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}
1],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);var g=t.i(9306),g=g;let x=(0,a.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),y=(0,a.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),v=(0,a.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);var b=t.i(3303),w=t.i(71645),k=t.i(46696),j=t.i(76639),C=t.i(10204),P=t.i(99375),I=t.i(75157);class F{currentBorder=null;drawBorder(t,e,a){if(!this.currentBorder||"none"===this.currentBorder.type)return;t.save();let r=this.currentBorder;switch(r.type){case"solid":this.drawSolid(t,e,a,r);break;case"gradient":this.drawGradient(t,e,a,r);break;case"polaroid":this.drawPolaroid(t,e,a,r);break;case"dashed":this.drawDashed(t,e,a,r)}t.restore()}drawSolid(t,e,a,r){r.shadow&&(t.shadowColor="rgba(0,0,0,0.3)",t.shadowBlur=15,t.shadowOffsetY=5),t.fillStyle=r.color,t.fillRect(0,0,e,r.width),t.fillRect(e-r.width,0,r.width,a),t.fillRect(0,a-r.width,e,r.width),t.fillRect(0,0,r.width,a)}drawGradient(t,e,a,r){r.shadow&&(t.shadowColor="rgba(0,0,0,0.3)",t.shadowBlur=15,t.shadowOffsetY=5);let i=t.createLinearGradient(0,0,e,a),o=Math.max(r.colors.length-1,1);r.colors.forEach((t,e)=>{i.addColorStop(e/o,t)}),t.fillStyle=i,t.fillRect(0,0,e,r.width),t.fillRect(e-r.width,0,r.width,a),t.fillRect(0,a-r.width,e,r.width),t.fillRect(0,0,r.width,a)}drawPolaroid(t,e,a,r){r.shadow&&(t.shadowColor="rgba(0,0,0,0.3)",t.shadowBlur=15,t.shadowOffsetY=5),t.fillStyle=r.color,t.fillRect(0,0,e,r.topWidth),t.fillRect(e-r.sideWidth,0,r.sideWidth,a),t.fillRect(0,a-r.bottomWidth,e,r.bottomWidth),t.fillRect(0,0,r.sideWidth,a)}drawDashed(t,e,a,r){t.strokeStyle=r.color,t.lineWidth=r.width,t.setLineDash(r.dashPattern??[10,5]);let i=r.width/2;t.strokeRect(i,i,e-r.width,a-r.width),t.setLineDash([])}}var M=t.i(1482),S=t.i(34257);let G={sideOverlap:61.8,bottomOverlap:139.23},T={topRadius:70,bottomRadius:42},R={leftThickness:10,rightThickness:9,rightInset:1},O={west:{widthMultiplier:3,scaleFactor:1.2,startOpacity:.7,endOpacity:.4},east:{widthMultiplier:3,scaleFactor:1.2,startOpacity:.7,endOpacity:.4},south:{edgeOpacity:.5,centerOpacity:.7}},E={baseOpacity:.03,innerTint:{red:240,green:245,blue:255,opacity:.05},innerEdge:{red:180,green:190,blue:210,opacity:.12,lineWidth:.8}},L={top:{heightPercent:.3,startOpacity:.07,middleOpacity:.02,endOpacity:0}},N={north:{startOpacity:.1,endOpacity:0},west:{startOpacity:.18,endOpacity:0},east:{startOpacity:.18,endOpacity:0},south:{startOpacity:0,endOpacity:.18}},B={red:140,green:140,blue:140,opacity:.45,widthReduction:.4},A={topClip:5},V={topCurveStartPercent:.6},U={sideGap:8,topGap:8,bottomGap:14,recessShadow:{blur:22,offsetY:4,opacity:.35}},_={angle:-22,widthFraction:.32,position:.35,peakOpacity:.045,secondary:{widthFraction:.12,position:.62,peakOpacity:.0225}},$={cornerOpacity:.18,centerOpacity:0};class z{canvas;ctx;backgroundImage=null;photocardImage=null;originalPhotocardImage=null;originalPhotocardFile=null;frameMode=!1;isPlaceholder=!1;modalOpen=!1;onUploadRequest=null;borderManager=null;photocardGif=this.freshGifState();backgroundGif=this.freshGifState();photocardVideo=this.freshVideoState();backgroundVideo=this.freshVideoState();camera={active:!1,stream:null,video:null,facingMode:"environment",animationFrame:null,currentZoom:1,minZoom:1,maxZoom:10};background={x:0,y:0,scale:1,rotation:0,flipH:!1,flipV:!1};photocard={x:0,y:0,scale:1,rotation:0,flipH:!1,flipV:!1,layer:"front",showToploader:!0};crop={enabled:!1,aspectRatio:null,bounds:{x:0,y:0,width:0,height:0}};editMode="photocard";animation={active:!1,velocityX:0,velocityY:0};photocardSavedPos={x:0,y:0};gesture={active:!1,startDistance:0,startAngle:0,startScale:1,startRotation:0,lastX:0,lastY:0,pointers:[]};toploaderGradientCache={westGradient:null,eastGradient:null,southGradient:null,cachedWidth:null,cached
1Height:null};freshGifState(){return{isGif:!1,frames:[],delays:[],currentFrame:0,lastFrameTime:0,animationFrame:null}}freshVideoState(){return{isVideo:!1,element:null,originalFile:null,animationFrame:null}}init(t,e){this.canvas=t;let a=t.getContext("2d",{alpha:!1});if(!a)throw Error("2D canvas context is unavailable");this.ctx=a,this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high",this.onUploadRequest=e,this.resizeCanvas(),this.attachEventListeners(),this.loadPlaceholderPhotocard(),this.render()}setModalOpen(t){this.modalOpen=t}resizeCanvas(){let t,e,a=this.canvas.parentElement;if(!a)return;let r=a.classList.contains("camera-active"),i=a.classList.contains("preview-mode");if(r){let r=window.innerWidth,i=window.innerHeight;e=a.classList.contains("aspect-3-4")?4/3*(t=Math.min(.75*i,r)):a.classList.contains("aspect-9-16")?16/9*(t=Math.min(.5625*i,r)):a.classList.contains("aspect-1-1")?t=Math.min(i,r):4/3*(t=Math.min(.75*i,r))}else{if(i)return void this.updatePreviewDisplay();let r=a.getBoundingClientRect();t=r.width,e=r.height,(t<100||e<100)&&(t=600,e=800)}let o=window.devicePixelRatio||1;this.canvas.width=t*o,this.canvas.height=e*o,this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(o,o),this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high",r||(this.canvas.style.width=`${t}px`,this.canvas.style.height=`${e}px`),this.render()}updatePreviewDisplay(){let t=this.canvas.parentElement;if(!t)return;let e=window.devicePixelRatio||1,a=this.canvas.width/e,r=this.canvas.height/e;this.canvas.style.width=`${a}px`,this.canvas.style.height=`${r}px`;let i=Math.min(800,t.getBoundingClientRect().width||800);if(a>i){let e=i/a;this.canvas.style.transform=`scale(${e})`,this.canvas.style.transformOrigin="top left",t.style.height=`${r*e}px`}else this.canvas.style.transform="none",t.style.height="auto";this.render()}attachEventListeners(){window.addEventListener("resize",()=>this.resizeCanvas()),this.canvas.addEventListener("pointerdown",t=>this.handlePointerDown(t)),this.canvas.addEventListener("pointermove",t=>this.handlePointerMove(t)),this.canvas.addEventListener("pointerup",t=>this.handlePointerUp(t)),this.canvas.addEventListener("pointercancel",t=>this.handlePointerUp(t)),this.canvas.addEventListener("touchstart",t=>{if(this.isPlaceholder&&1===t.touches.length){let e=t.touches[0],a=this.canvas.getBoundingClientRect();if(this.isPointOnPhotocard(e.clientX-a.left,e.clientY-a.top))return}t.preventDefault()},{passive:!1}),this.canvas.addEventListener("touchmove",t=>t.preventDefault(),{passive:!1}),this.canvas.addEventListener("click",t=>{if(!this.photocardImage||!this.isPlaceholder)return;let e=this.canvas.getBoundingClientRect();this.isPointOnPhotocard(t.clientX-e.left,t.clientY-e.top)&&(t.preventDefault(),this.onUploadRequest?.())}),this.canvas.addEventListener("wheel",t=>this.handleWheel(t),{passive:!1})}handlePointerDown(t){if(!this.modalOpen&&(this.backgroundImage||this.photocardImage)){if(this.isPlaceholder&&0===this.gesture.pointers.length){let e=this.canvas.getBoundingClientRect();if(this.isPointOnPhotocard(t.clientX-e.left,t.clientY-e.top)){let e=this.photocard.scale;this.photocard.scale*=.95,this.render(),this.onUploadRequest?.(),setTimeout(()=>{this.photocard.scale=e,this.render()},150),t.preventDefault(),t.stopPropagation();return}}if(this.gesture.pointers.push({id:t.pointerId,x:t.clientX,y:t.clientY}),1===this.gesture.pointers.length)"photocard"===this.editMode&&(this.photocardSavedPos={x:this.photocard.x,y:this.photocard.y}),this.gesture.lastX=t.clientX,this.gesture.lastY=t.clientY;else if(2===this.gesture.pointers.length){let t=this.gesture.pointers[0],e=this.gesture.pointers[1];this.gesture.lastCenterX=(t.x+e.x)/2,this.gesture.lastCenterY=(t.y+e.y)/2,this.gesture.startDistance=this.getDistance(t,e),this.gesture.startAngle=this.getAngle(t,e),this.gesture.startScale="background"===this.editMode?this.background.scale:this.photocard.scale,this.gesture.startRotation="background"===this.editMode?this.background.rotation:this.photocard.rotation}this.gesture.active=!0,this.animation.active=!1}}handlePointerMove(t){if(this.modalOpen)return;if(this.isPlaceholder&&!this.gesture.active){let e=this.canvas.getBoundingClientRect();this.canvas.style.cursor=this.isPointOnPhotocard(t.clientX-e.left,t.clientY-e.top)?"pointer":"grab"}if(!this.gesture.active)return;let e=this.gesture.pointers.findIndex(e=>e.id===t.pointerId);if(-1!==e&&(this.gesture.pointers[e].x=t.clientX,this.gesture.pointers[e].y=t.clientY),"background"===this.editMode&&this.backgroundImage){if(1===this.gesture.pointers.length){let e=t.clientX-this.gesture.lastX,a=t.clientY-this.gesture.lastY;this.background.x+=e,this.background.y+=a,this.gesture.lastX=t.clientX,this.gesture.lastY=t.clientY,this.animation.velocityX=e,this.animation.velocityY=a}else if(2===this.gesture.pointers.length){let t=this.gesture.pointers[0],e=this.gesture.pointers[1],a=(t.x+e.x)/2,r=(t.y+e.y)/2;void 0!==this.gesture.lastCenterX&&(this.background.x+=a-this.gesture.lastCenterX,this.background.y+=r-(this.gesture.lastCenterY??r)),this.gesture.lastCenterX=a,this.gesture.lastCenterY=r,this.background.scale=Math.max(.1,Math.min(3,this.gesture.startScale*(this.getDistance(t,e)/this.gesture.startDistance)))}}else if("photocard"===this.editMode&&this.photocardImage){if(1===this.gesture.pointers.length){let e=t.clientX-this.gesture.lastX,a=t.clientY-this.gesture.lastY;this.photocard.x+=e,this.photocard.y+=a,this.gesture.lastX=t.clientX,this.gesture.lastY=t.clientY,this.animation.velocityX=e,this.animation.velocityY=a}else if(2===this.gesture.pointers.length){let t=this.gesture.pointers[0],e=this.gesture.pointers[1];this.photocard.scale=Math.max(.1,Math.min(5,this.gesture.startScale*(this.getDistance(t,e)/this.gesture.startDistance))),this.photocard.rotation=this.gesture.startRotation+(this.getAngle(t,e)-this.gesture.startAngle)}}this.render()}handlePointerUp(t){if(this.gesture.pointers=this.gesture.pointers.filter(e=>e.id!==t.pointerId),0===this.gesture.pointers.length)this.gesture.active=!1,this.gesture.lastCenterX=void 0,this.gesture.lastCenterY=void 0,Math.abs(this.animation.velocityX)>1||Math.abs(this.animation.velocityY)>1?this.startInertia():"photocard"!==this.editMode||this.isPhotocardVisible()||this.snapPhotocardBack();else if(1===this.gesture.pointers.length){let t=this.gesture.pointers[0];this.gesture.lastX=t.x,this.gesture.lastY=t.y,this.gesture.lastCenterX=void 0,this.gesture.lastCenterY=void 0}}handleWheel(t){t.preventDefault();let e=t.deltaY>0?.95:1.05;"background"===this.editMode&&this.backgroundImage?this.background.scale=Math.max(.1,Math.min(3,this.background.scale*e)):"photocard"===this.editMode&&this.photocardImage&&(this.photocard.scale=Math.max(.1,Math.min(5,this.photocard.scale*e))),this.render()}startInertia(){this.animation.active=!0;let t=()=>{if(this.animation.active){if("background"===this.editMode&&this.backgroundImage?(this.background.x+=this.animation.velocityX,this.background.y+=this.animation.velocityY):"photocard"===this.editMode&&this.photocardImage&&(this.photocard.x+=this.animation.velocityX,this.photocard.y+=this.animation.velocityY),this.animation.velocityX*=.9,this.animation.velocityY*=.9,.1>
1Math.abs(this.animation.velocityX)&&.1>Math.abs(this.animation.velocityY)){this.animation.active=!1,"photocard"!==this.editMode||this.isPhotocardVisible()||this.snapPhotocardBack();return}this.render(),requestAnimationFrame(t)}};t()}isPhotocardVisible(){if(!this.photocardImage)return!1;let t=window.devicePixelRatio||1,e=this.canvas.width/t,a=this.canvas.height/t,r=this.photocardImage,i=(r.videoWidth??r.width)*this.photocard.scale,o=(r.videoHeight??r.height)*this.photocard.scale,s=Math.abs(Math.cos(this.photocard.rotation)),n=Math.abs(Math.sin(this.photocard.rotation)),c=(i*s+o*n)/2,d=(i*n+o*s)/2,{x:l,y:h}=this.photocard;return l+c>0&&l-c<e&&h+d>0&&h-d<a}snapPhotocardBack(){let t=this.photocard.x,e=this.photocard.y,a=this.photocardSavedPos.x,r=this.photocardSavedPos.y,i=performance.now(),o=s=>{let n=Math.min((s-i)/300,1),c=1-(1-n)**3;this.photocard.x=t+(a-t)*c,this.photocard.y=e+(r-e)*c,this.render(),n<1&&requestAnimationFrame(o)};requestAnimationFrame(o)}getDistance(t,e){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}getAngle(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}isPointOnPhotocard(t,e){if(!this.photocardImage)return!1;let a=t-this.photocard.x,r=e-this.photocard.y,i=Math.cos(-this.photocard.rotation),o=Math.sin(-this.photocard.rotation),s=(a*i-r*o)/this.photocard.scale,n=(a*o+r*i)/this.photocard.scale,c=this.photocardImage.videoWidth??this.photocardImage.width,d=this.photocardImage.videoHeight??this.photocardImage.height;return Math.abs(s)<=c/2&&Math.abs(n)<=d/2}async startCamera(t){this.camera.video=t;let e=await navigator.mediaDevices.getUserMedia({video:{facingMode:this.camera.facingMode,width:{ideal:1920},height:{ideal:1080}},audio:!1});this.camera.stream=e,t.srcObject=e,this.camera.active=!0,await new Promise(e=>{t.onloadedmetadata=()=>e()}),this.renderCameraFrame()}stopCamera(){this.camera.stream?.getTracks().forEach(t=>{t.stop()}),this.camera.stream=null,this.camera.animationFrame&&cancelAnimationFrame(this.camera.animationFrame),this.camera.animationFrame=null,this.camera.active=!1,this.camera.video=null,this.render()}renderCameraFrame(){this.camera.active&&this.camera.video&&(this.render(),this.camera.animationFrame=requestAnimationFrame(()=>this.renderCameraFrame()))}captureFrame(){if(!this.camera.active||!this.camera.video)return;let t=document.createElement("canvas");t.width=this.camera.video.videoWidth,t.height=this.camera.video.videoHeight,t.getContext("2d")?.drawImage(this.camera.video,0,0);let e=new Image;e.onload=()=>{this.backgroundImage=e,this.stopCamera(),(!this.photocardImage||this.isPlaceholder)&&this.loadPlaceholderPhotocard()},e.src=t.toDataURL("image/png")}setCameraZoom(t){if(!this.camera.stream||!this.camera.active)return Promise.resolve(!1);let e=Math.max(this.camera.minZoom,Math.min(this.camera.maxZoom,t));this.camera.currentZoom=e;let a=this.camera.stream.getVideoTracks()[0];return a?.getCapabilities&&a.getCapabilities().zoom?a.applyConstraints({advanced:[{zoom:e}]}).then(()=>!0).catch(()=>!1):Promise.resolve(!1)}getCameraZoom(){return this.camera.currentZoom}loadPlaceholderPhotocard(){let t=`<svg width="600" height="900" xmlns="http://www.w3.org/2000/svg">
2      <rect width="600" height="900" rx="28" fill="#6d22ff" fill-opacity="0.08" stroke="#7435ff" stroke-width="2.5" stroke-opacity="0.45" stroke-dasharray="14 8"/>
3      <circle cx="300" cy="392" r="48" fill="#6d22ff" fill-opacity="0.18"/>
4      <path d="M300 414 L300 372 M285 387 L300 370 L315 387" stroke="#a58cff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
5      <text x="300" y="490" font-family="-apple-system,BlinkMacSystemFont,'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="34" font-weight="600" letter-spacing="-0.5" fill="#c4a8ff" fill-opacity="0.95" text-anchor="middle">Upload Photocard</text>
6      <text x="300" y="528" font-family="-apple-system,BlinkMacSystemFont,'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="24" font-weight="400" fill="#8d74ff" fill-opacity="0.8" text-anchor="middle">Tap anywhere to begin</text>
7    </svg>`,e=new Image;e.onload=()=>{this.photocardImage=e,this.originalPhotocardImage=null,this.originalPhotocardFile=null,this.frameMode=!1,this.isPlaceholder=!0,this.canvas.classList.add("placeholder-active");let t=this.canvas.getBoundingClientRect();this.photocard.x=t.width/2,this.photocard.y=t.height/2,this.photocard.rotation=0,this.photocard.scale=Math.min(t.width,t.height)/(3*e.width),this.render()},e.src=`data:image/svg+xml;base64,${btoa(t)}`}
7loadBackground(t){return t.type.startsWith("video/")?this.loadBackgroundVideo(t):"image/gif"===t.type?this.loadBackgroundGif(t):new Promise((e,a)=>{let r=new FileReader;r.onload=t=>{let r=new Image;r.onload=()=>{this.backgroundImage=r,this.backgroundGif.isGif=!1,this.backgroundVideo.isVideo=!1,this.render(),e()},r.onerror=a;let i=t.target?.result;"string"!=typeof i?a(Error("Failed to read background image")):r.src=i},r.onerror=a,r.readAsDataURL(t)})}async loadBackgroundGif(t){let e=await t.arrayBuffer(),a=await this.parseGif(e);this.backgroundGif={isGif:!0,frames:a.frames,delays:a.delays,currentFrame:0,lastFrameTime:performance.now(),animationFrame:null},this.backgroundImage=a.frames[0],this.startBackgroundGifAnimation(),this.render()}async loadBackgroundVideo(t){return new Promise((e,a)=>{let r=document.createElement("video");r.muted=!0,r.loop=!0,r.playsInline=!0,r.autoplay=!1;let i=URL.createObjectURL(t),o=!1;r.onloadedmetadata=()=>{this.backgroundVideo.isVideo=!0,this.backgroundVideo.element=r,this.backgroundVideo.originalFile=t,this.backgroundGif.isGif=!1,r.currentTime=0},r.onseeked=()=>{o||(o=!0,this.backgroundImage=r,r.play().then(()=>{this.startBackgroundVideoAnimation(),this.render(),e()}).catch(a))},r.onerror=()=>{URL.revokeObjectURL(i),a(Error("Failed to load video"))},r.src=i})}loadPhotocard(t){return t.type.startsWith("video/")?this.loadPhotocardVideo(t):"image/gif"===t.type?this.loadPhotocardGif(t):new Promise((e,a)=>{let r=new FileReader;r.onload=r=>{let i=new Image;i.onload=()=>{this.photocardImage=i,this.originalPhotocardImage=i,this.originalPhotocardFile=t,this.frameMode=!1,this.isPlaceholder=!1,this.photocardGif.isGif=!1,this.photocardVideo.isVideo=!1,this.canvas.classList.remove("placeholder-active"),this.canvas.style.cursor="grab";let a=this.canvas.getBoundingClientRect();this.photocard.x=a.width/2,this.photocard.y=a.height/2,this.photocard.rotation=0,this.photocard.scale=Math.min(a.width,a.height)/(3*i.width),this.render(),e()},i.onerror=a;let o=r.target?.result;"string"!=typeof o?a(Error("Failed to read photocard image")):i.src=o},r.onerror=a,r.readAsDataURL(t)})}async loadPhotocardGif(t){let e=await t.arrayBuffer(),a=await this.parseGif(e);this.photocardGif={isGif:!0,frames:a.frames,delays:a.delays,currentFrame:0,lastFrameTime:performance.now(),animationFrame:null},this.photocardImage=a.frames[0],this.originalPhotocardImage=null,this.originalPhotocardFile=null,this.frameMode=!1,this.isPlaceholder=!1,this.canvas.classList.remove("placeholder-active"),this.canvas.style.cursor="grab";let r=this.canvas.getBoundingClientRect();this.photocard.x=r.width/2,this.photocard.y=r.height/2,this.photocard.rotation=0,this.photocard.scale=Math.min(r.width,r.height)/(1.5*a.frames[0].width),this.startPhotocardGifAnimation(),this.render()}async loadPhotocardVideo(t){return new Promise((e,a)=>{let r=document.createElement("video");
7r.muted=!0,r.loop=!0,r.playsInline=!0,r.autoplay=!1;let i=URL.createObjectURL(t),o=!1;r.onloadedmetadata=()=>{this.photocardVideo.isVideo=!0,this.photocardVideo.element=r,this.photocardVideo.originalFile=t,this.photocardGif.isGif=!1,this.isPlaceholder=!1,r.currentTime=0},r.onseeked=()=>{if(o)return;o=!0,this.photocardImage=r,this.originalPhotocardImage=null,this.originalPhotocardFile=null,this.frameMode=!1,this.canvas.classList.remove("placeholder-active"),this.canvas.style.cursor="grab";let t=this.canvas.getBoundingClientRect();this.photocard.x=t.width/2,this.photocard.y=t.height/2,this.photocard.rotation=0,this.photocard.scale=Math.min(t.width,t.height)/(1.5*r.videoWidth),r.play().then(()=>{this.startPhotocardVideoAnimation(),this.render(),e()}).catch(a)},r.onerror=()=>{URL.revokeObjectURL(i),a(Error("Failed to load video"))},r.src=i})}async parseGif(t){try{let e=(0,M.parseGIF)(t),a=(0,M.decompressFrames)(e,!0);if(a.length>0)return this.processGifuctFrames(a)}catch{}try{let e=new S.GifReader(new Uint8Array(t));return this.processOmggifFrames(e)}catch{throw Error("Could not parse GIF — no compatible library available")}}processGifuctFrames(t){return new Promise((e,a)=>{if(!t.length)return a(Error("GIF has no frames"));let r=t[0].dims.width,i=t[0].dims.height,o=document.createElement("canvas");o.width=r,o.height=i;let s=o.getContext("2d");if(!s)return void a(Error("Failed to create GIF frame context"));let n=[],c=[],d=0;t.forEach((r,i)=>{let l=s.createImageData(r.dims.width,r.dims.height);l.data.set(r.patch),s.putImageData(l,r.dims.left,r.dims.top);let h=new Image;h.onload=()=>{++d===t.length&&e({frames:n,delays:c})},h.onerror=()=>a(Error(`Failed frame ${i}`)),h.src=o.toDataURL("image/png"),n[i]=h,c[i]=(r.delay??10)*10})})}processOmggifFrames(t){return new Promise((e,a)=>{let r=t.numFrames(),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let o=i.getContext("2d");if(!o)return void a(Error("Failed to create GIF frame context"));let s=[],n=[],c=0;for(let d=0;d<r;d++){let l=t.frameInfo(d),h=new Uint8ClampedArray(t.width*t.height*4);t.decodeAndBlitFrameRGBA(d,h);let u=o.createImageData(t.width,t.height);u.data.set(h),o.putImageData(u,0,0);let p=new Image;p.onload=()=>{++c===r&&e({frames:s,delays:n})},p.onerror=()=>a(Error(`Failed frame ${d}`)),p.src=i.toDataURL("image/png"),s[d]=p,n[d]=(l.delay??10)*10}})}startPhotocardGifAnimation(){let t=e=>{this.photocardGif.isGif&&(e-this.photocardGif.lastFrameTime>=this.photocardGif.delays[this.photocardGif.currentFrame]&&(this.photocardGif.currentFrame=(this.photocardGif.currentFrame+1)%this.photocardGif.frames.length,this.photocardImage=this.photocardGif.frames[this.photocardGif.currentFrame],this.photocardGif.lastFrameTime=e,this.render()),this.photocardGif.animationFrame=requestAnimationFrame(t))};this.photocardGif.animationFrame=requestAnimationFrame(t)}startBackgroundGifAnimation(){let t=e=>{this.backgroundGif.isGif&&(e-this.backgroundGif.lastFrameTime>=this.backgroundGif.delays[this.backgroundGif.currentFrame]&&(this.backgroundGif.currentFrame=(this.backgroundGif.currentFrame+1)%this.backgroundGif.frames.length,this.backgroundImage=this.backgroundGif.frames[this.backgroundGif.currentFrame],this.backgroundGif.lastFrameTime=e,this.render()),this.backgroundGif.animationFrame=requestAnimationFrame(t))};this.backgroundGif.animationFrame=requestAnimationFrame(t)}stopGifAnim(t){t.animationFrame&&(cancelAnimationFrame(t.animationFrame),t.animationFrame=null)}startPhotocardVideoAnimation(){let t=()=>{this.photocardVideo.isVideo&&(this.render(),this.photocardVideo.animationFrame=requestAnimationFrame(t))};this.photocardVideo.animationFrame=requestAnimationFrame(t)}startBackgroundVideoAnimation(){let t=()=>{this.backgroundVideo.isVideo&&(this.render(),this.backgroundVideo.animationFrame=requestAnimationFrame(t))};this.backgroundVideo.animationFrame=requestAnimationFrame(t)}stopVideoAnim(t){t.animationFrame&&(cancelAnimationFrame(t.animationFrame),t.animationFrame=null),t.element?.pause()}render(){let t=window.devicePixelRatio||1,e=this.canvas.width/t,a=this.canvas.height/t;this.ctx.clearRect(0,0,e,a),this.camera.active&&this.camera.video?this.drawCameraFeed(e,a):this.backgroundImage&&this.drawBackgroun
7d(e,a),this.photocardImage&&"back"===this.photocard.layer&&this.drawPhotocard(),this.borderManager?.drawBorder(this.ctx,e,a),this.photocardImage&&"front"===this.photocard.layer&&this.drawPhotocard(),this.drawCropOverlay(e,a)}drawCameraFeed(t,e){let a,r,i=this.camera.video;if(!i)return;let o=i.videoWidth/i.videoHeight;o>t/e?(r=e,a=e*o):(a=t,r=t/o),this.ctx.save(),this.ctx.translate(t/2+this.background.x,e/2+this.background.y),this.ctx.rotate(this.background.rotation*Math.PI/180),this.ctx.scale(this.background.scale*(this.background.flipH?-1:1),this.background.scale*(this.background.flipV?-1:1)),this.ctx.drawImage(i,-a/2,-r/2,a,r),this.ctx.restore()}drawBackground(t,e){let a,r,i=this.backgroundImage;if(!i)return;let o=(i.videoWidth??i.width)/(i.videoHeight??i.height);o>t/e?(r=e,a=e*o):(a=t,r=t/o),this.ctx.save(),this.ctx.translate(t/2+this.background.x,e/2+this.background.y),this.ctx.rotate(this.background.rotation*Math.PI/180),this.ctx.scale(this.background.scale*(this.background.flipH?-1:1),this.background.scale*(this.background.flipV?-1:1)),this.ctx.drawImage(i,-a/2,-r/2,a,r),this.ctx.restore()}drawPhotocard(){this.ctx.save(),this.ctx.translate(this.photocard.x,this.photocard.y),this.ctx.rotate(this.photocard.rotation),this.ctx.scale(this.photocard.scale*(this.photocard.flipH?-1:1),this.photocard.scale*(this.photocard.flipV?-1:1));let t=this.photocardImage;if(!t)return void this.ctx.restore();let e=t.videoWidth??t.width,a=t.videoHeight??t.height;if(this.frameMode)this.ctx.drawImage(t,-e/2,-a/2,e,a);else if(this.photocard.showToploader){let{sideGap:r,topGap:i,bottomGap:o,recessShadow:s}=U,n=e-2*r,c=a-i-o,d=-e/2+r,l=-a/2+i;this.ctx.save(),this.ctx.shadowColor=`rgba(0,0,0,${s.opacity})`,this.ctx.shadowBlur=s.blur,this.ctx.shadowOffsetY=s.offsetY,this.ctx.fillStyle="#000",this.ctx.beginPath(),this.ctx.moveTo(d+4,l),this.ctx.lineTo(d+n-4,l),this.ctx.arcTo(d+n,l,d+n,l+4,4),this.ctx.lineTo(d+n,l+c-4),this.ctx.arcTo(d+n,l+c,d+n-4,l+c,4),this.ctx.lineTo(d+4,l+c),this.ctx.arcTo(d,l+c,d,l+c-4,4),this.ctx.lineTo(d,l+4),this.ctx.arcTo(d,l,d+4,l,4),this.ctx.closePath(),this.ctx.fill(),this.ctx.restore(),this.ctx.save(),this.ctx.beginPath(),this.ctx.moveTo(d+4,l),this.ctx.lineTo(d+n-4,l),this.ctx.arcTo(d+n,l,d+n,l+4,4),this.ctx.lineTo(d+n,l+c-4),this.ctx.arcTo(d+n,l+c,d+n-4,l+c,4),this.ctx.lineTo(d+4,l+c),this.ctx.arcTo(d,l+c,d,l+c-4,4),this.ctx.lineTo(d,l+4),this.ctx.arcTo(d,l,d+4,l,4),this.ctx.closePath(),this.ctx.clip(),this.ctx.drawImage(t,d,l,n,c),this.ctx.restore(),this.drawToploader(e,a)}else this.ctx.drawImage(t,-e/2,-a/2,e,a);this.ctx.restore()}drawToploader(t,e){let a=G.sideOverlap,r=G.bottomOverlap,i=t+2*a,o=e+a+r,s=this.toploaderGradientCache.cachedWidth!==t||this.toploaderGradientCache.cachedHeight!==e,n=-(i/2),c=-(e/2)-a,d=T.topRadius,l=T.bottomRadius,h=R.leftThickness,u=R.rightThickness;this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(n,c+A.topClip,i,o-A.topClip),this.ctx.clip();let p=(t,e,a,r,i,o)=>{this.ctx.beginPath(),this.ctx.moveTo(t+i,e),this.ctx.lineTo(t+a-i,e),this.ctx.arcTo(t+a,e,t+a,e+i,i),this.ctx.lineTo(t+a,e+r-o),this.ctx.arcTo(t+a,e+r,t+a-o,e+r,o),this.ctx.lineTo(t+o,e+r),this.ctx.arcTo(t,e+r,t,e+r-o,o),this.ctx.lineTo(t,e+i),this.ctx.arcTo(t,e,t+i,e,i),this.ctx.closePath()},m=d*V.topCurveStartPercent;if(this.ctx.beginPath(),this.ctx.moveTo(n+m,c),this.ctx.arcTo(n,c,n,c+d,d),this.ctx.lineTo(n,c+o-l),this.ctx.arcTo(n,c+o,n+l,c+o,l),this.ctx.lineTo(n+h+(l-h),c+o-h),this.ctx.arcTo(n+h,c+o-h,n+h,c+o-h-(l-h),l-h),this.ctx.lineTo(n+h,c+h+(d-h)),this.ctx.arcTo(n+h,c+h,n+h+(d-h)*V.topCurveStartPercent,c+h,d-h),this.ctx.lineTo(n+m,c),this.ctx.closePath(),s){let t=this.ctx.createLinearGradient(n,c,n+h*O.west.widthMultiplier*O.west.scaleFactor,c);t.addColorStop(0,`rgba(255,255,255,${O.west.startOpacity})`),t.addColorStop(1,`rgba(255,255,255,${O.west.endOpacity})`),this.toploaderGradientCache.westGradient=t}let f=this.toploaderGradientCache.westGradient;if(!f)return;this.ctx.fillStyle=f,this.ctx.fill();let g=i-d*V.topCurveStartPercent;if(this.ctx.beginPath(),this.ctx.moveTo(n+g,c),this.ctx.arcTo(n+i,c,n+i,c+d,d),this.ctx.lineTo(n+i,c+o-l),this.ctx.arcTo(n+i,c+o,n+i-l,c+o,l),this.ctx.lineTo(n+i-u*O.east.scaleFactor-(l-u*O.east.scaleFactor),c+o-u*O.east.scaleFactor),this.ctx.arcTo(n+i-u*O.east.scaleFactor,c+o-u*O.east.scaleFactor,n+i-u*O.east.scaleFactor,c+o-u*O.east.scaleFactor-(l-u*O.east.scaleFactor),l-u*O.east.scaleFactor),this.ctx.lineTo(n+i-u*O.east.scaleFactor,c+u*O.east.scaleFactor+(d-u*O.east.scaleFactor)),this.ctx.arcTo(n+i-u*O.east.scaleFactor,c+u*O.east.scaleFactor,n+i-u*O.east.scaleFactor-(d-u*O.east.scaleFactor)*V.topCurveStartPercent,c+u*O.east.scaleFactor,d-u*O.east.scaleFactor),this.ctx.lineTo(n+g,c),this.ctx.closePath(),s){let t=this.ctx.createLinearGradient(n+i,c,n+i-u*O.east.widthMultiplier*O.east.scaleFactor,c);t.addColorStop(0,`rgba(255,255,255,${O.east.startOpacity})`),t.addColorStop(1,`rgba(255,255,255,${O.east.endOpacity})`),this.toploaderGradientCache.eastGradient=t}let x=this.toploaderGradientCache.eastGradient;if(!x)return;this.ctx.fillStyle=x,this.ctx.fill();let y=n+l,v=n+i-l;if(this.ctx.beginPath(),this.ctx.moveTo(y,c+o),this.ctx.lineTo(v,c+o),this.ctx.lineTo(v,c+o-h),this.ctx.lineTo(y,c+o-h),this.ctx.closePath(),s){let t=this.ctx.createLinearGradient(y,c+o,v,c+o);t.addColorStop(0,`rgba(255,255,255,${O.south.edgeOpacity})`),t.addColorStop(.5,`rgba(255,255,255,${O.south.centerOpacity})`),t.addColorStop(1,`rgba(255,255,255,${O.south.edgeOpacity})`),this.toploaderGradientCache.southGradient=t}let b=this.toploaderGradientCache.southGradient;if(!b)return;this.ctx.fillStyle=b,this.ctx.fill(),p(n,c,i,o,d,l),this.ctx.fillStyle=`rgba(255,255,255,${E.baseOpacity})`,this.ctx.fill();let w=n+h,k=c+h,j=i-h-u,C=o-h-h;p(w,k,j,C,d-h,l-h);let{innerTint:P}=E;this.ctx.fillStyle=`rgba(${P.red},${P.green},${P.blue},${P.opacity})`,this.ctx.fill();let{innerEdge:I}=E;this.ctx.strokeStyle=`rgba(${I.red},${I.green},${I.blue},${I.opacity})`,this.ctx.lineWidth=I.lineWidth,this.ctx.stroke();let F=this.ctx.createLinearGradient(w,k,w,k+C*L.top.heightPercent),M=L.top;F.addColorStop(0,`rgba(255,255,255,${M.startOpacity})`),F.addColorStop(.2,`rgba(255,255,255,${M.middleOpacity})`),F.addColorStop(1,`rgba(255,255,255,${M.endOpacity})`),p(w,k,j,C*M.heightPercent,d-h,0),this.ctx.fillStyle=F,this.ctx.fill();let S=_;this.ctx.save(),p(w,k,j,C,d-h,l-h),this.ctx.clip();let U=(t,e,a)=>{let r=j*t,i=w+j/2,o=k+C*e,s=S.angle*Math.PI/180;this.ctx.save(),this.ctx.translate(i,o),this.ctx.rotate(s);let n=this.ctx.createLinearGradient(-r/2,0,r/2,0);n.addColorStop(0,"rgba(255,255,255,0)"),n.addColorStop(.4,`rgba(255,255,255,${.5*a})`),n.addColorStop(.5,`rgba(255,255,255,${a})`),n.addColorStop(.6,`rgba(255,255,255,${.5*a})`),n.addColorStop(1,"rgba(255,255,255,0)"),this.ctx.fillStyle=n;let c=Math.hypot(j,C);
7this.ctx.fillRect(-r/2,-c,r,2*c),this.ctx.restore()};U(S.widthFraction,S.position,S.peakOpacity),S.secondary&&U(S.secondary.widthFraction,S.secondary.position,S.secondary.peakOpacity),this.ctx.restore();let z=$;this.ctx.save(),p(w,k,j,C,d-h,l-h),this.ctx.clip();let H=w+j/2,W=k+C/2,D=Math.hypot(j,C)/2,Y=this.ctx.createRadialGradient(H,W,.55*D,H,W,D);Y.addColorStop(0,`rgba(0,0,0,${z.centerOpacity})`),Y.addColorStop(1,`rgba(0,0,0,${z.cornerOpacity})`),this.ctx.fillStyle=Y,this.ctx.fillRect(w,k,j,C),this.ctx.restore();let X=a-h,q=a-u,Z=r-h,K=a-h,J=R.rightInset,Q=d-h,tt=l-h,te=(t,e,a,r,i,o,s,n)=>{this.ctx.beginPath(),this.ctx.moveTo(t+i,e),this.ctx.lineTo(t+a-o,e),o>0&&this.ctx.arcTo(t+a,e,t+a,e+o,o),this.ctx.lineTo(t+a,e+r-n),n>0&&this.ctx.arcTo(t+a,e+r,t+a-n,e+r,n),this.ctx.lineTo(t+s,e+r),s>0&&this.ctx.arcTo(t,e+r,t,e+r-s,s),this.ctx.lineTo(t,e+i),i>0&&this.ctx.arcTo(t,e,t+i,e,i),this.ctx.closePath()},ta=this.ctx.createLinearGradient(n,c+h,n,c+h+K);ta.addColorStop(0,`rgba(0,0,0,${N.north.startOpacity})`),ta.addColorStop(1,`rgba(0,0,0,${N.north.endOpacity})`),this.ctx.fillStyle=ta,te(n+h,c+h,i-h-u,K,Q,Q,0,0),this.ctx.fill();let tr=this.ctx.createLinearGradient(n+h,c,n+h+X,c);tr.addColorStop(0,`rgba(0,0,0,${N.west.startOpacity})`),tr.addColorStop(1,`rgba(0,0,0,${N.west.endOpacity})`),this.ctx.fillStyle=tr,te(n+h,c+h,X,o-h-h,Q,0,tt,0),this.ctx.fill();let ti=this.ctx.createLinearGradient(n+i-u-J,c,n+i-u-q-J,c);ti.addColorStop(0,`rgba(0,0,0,${N.east.startOpacity})`),ti.addColorStop(1,`rgba(0,0,0,${N.east.endOpacity})`),this.ctx.fillStyle=ti,te(n+i-u-q-J,c+h,q,o-h-h,0,Q,0,tt),this.ctx.fill();let to=this.ctx.createLinearGradient(n,c+o-h-Z,n,c+o-h);to.addColorStop(0,`rgba(0,0,0,${N.south.startOpacity})`),to.addColorStop(1,`rgba(0,0,0,${N.south.endOpacity})`),this.ctx.fillStyle=to,te(n+h,c+o-h-Z,i-h-u,Z,0,0,tt,tt),this.ctx.fill();let ts=B;this.ctx.strokeStyle=`rgba(${ts.red},${ts.green},${ts.blue},${ts.opacity})`;let tn=n+h,tc=n+i-u*O.east.scaleFactor,td=c+h,tl=c+o-h;this.ctx.lineWidth=h*ts.widthReduction,this.ctx.beginPath(),this.ctx.moveTo(tn,td+Q),this.ctx.lineTo(tn,tl-tt),this.ctx.stroke(),this.ctx.lineWidth=h*ts.widthReduction,this.ctx.beginPath(),this.ctx.moveTo(tn+tt,tl),this.ctx.lineTo(tc-tt,tl),this.ctx.stroke(),this.ctx.lineWidth=u*O.east.scaleFactor*ts.widthReduction,this.ctx.beginPath(),this.ctx.moveTo(tc,td+Q),this.ctx.lineTo(tc,tl-tt),this.ctx.stroke(),this.toploaderGradientCache.cachedWidth=t,this.toploaderGradientCache.cachedHeight=e,this.ctx.restore()}drawCropOverlay(t,e){if(!this.crop.enabled)return;let{x:a,y:r,width:i,height:o}=this.crop.bounds;this.ctx.save(),this.ctx.fillStyle="rgba(0,0,0,0.6)",r>0&&this.ctx.fillRect(0,0,t,r),r+o<e&&this.ctx.fillRect(0,r+o,t,e-r-o),a>0&&this.ctx.fillRect(0,r,a,o),a+i<t&&this.ctx.fillRect(a+i,r,t-a-i,o),this.ctx.strokeStyle="rgba(255,255,255,0.8)",this.ctx.lineWidth=2,this.ctx.strokeRect(a,r,i,o);let s=Math.min(20,i/5,o/5);this.ctx.lineWidth=3,this.ctx.strokeStyle="rgba(199,182,249,1)",[[a,r+s,a,r,a+s,r],[a+i-s,r,a+i,r,a+i,r+s],[a,r+o-s,a,r+o,a+s,r+o],[a+i-s,r+o,a+i,r+o,a+i,r+o-s]].forEach(([t,e,a,r,i,o])=>{this.ctx.beginPath(),this.ctx.moveTo(t,e),this.ctx.lineTo(a,r),this.ctx.lineTo(i,o),this.ctx.stroke()}),this.ctx.restore()}
7updateBackground(t,e){this.backgroundImage&&(this.background[t]=e,this.render())}flipBackgroundHorizontal(){this.backgroundImage&&(this.background.flipH=!this.background.flipH,this.render())}flipBackgroundVertical(){this.backgroundImage&&(this.background.flipV=!this.background.flipV,this.render())}resetBackground(){this.backgroundImage&&(this.background={x:0,y:0,scale:1,rotation:0,flipH:!1,flipV:!1},this.render())}updatePhotocard(t,e){this.photocardImage&&(this.photocard[t]=e,this.render())}resetPhotocard(){if(!this.photocardImage)return;let t=this.canvas.getBoundingClientRect(),e=this.photocardImage.videoWidth??this.photocardImage.width;this.photocard={x:t.width/2,y:t.height/2,scale:Math.min(t.width,t.height)/(3*e),rotation:0,flipH:!1,flipV:!1,layer:this.photocard.layer,showToploader:this.photocard.showToploader},this.photocardVideo.isVideo&&this.photocardVideo.element&&this.photocardVideo.element.play().catch(()=>{}),this.render()}async createFrameFromPhotocard(){if(!this.originalPhotocardImage||!this.originalPhotocardFile||this.isPlaceholder)throw Error("Frame extraction needs a still image photocard");let t=await this.removeBackground(this.originalPhotocardFile);this.photocardImage=t,this.frameMode=!0,this.photocard.showToploader=!1;let e=this.canvas.getBoundingClientRect();this.photocard.x=e.width/2,this.photocard.y=e.height/2,this.photocard.rotation=0,this.photocard.scale=.78*Math.min(e.width/t.width,e.height/t.height),this.render()}restorePhotocardFrameSource(){if(!this.originalPhotocardImage)return;this.photocardImage=this.originalPhotocardImage,this.frameMode=!1,this.photocard.showToploader=!0;let t=this.canvas.getBoundingClientRect();this.photocard.x=t.width/2,this.photocard.y=t.height/2,this.photocard.rotation=0,this.photocard.scale=Math.min(t.width,t.height)/(3*this.originalPhotocardImage.width),this.render()}async removeBackground(t){let e=new FormData;e.append("image",t,t.name||"fco.png");let a=await fetch("/api/proofshot/remove-bg",{method:"POST",body:e});if(!a.ok){let t="Failed to remove background";try{t=(await a.json()).error??t}catch{}throw Error(t)}let r=await a.blob(),i=URL.createObjectURL(r);try{let t=await this.loadImageFromUrl(i);return await this.cropTransparentPadding(t)}finally{URL.revokeObjectURL(i)}}loadImageFromUrl(t){return new Promise((e,a)=>{let r=new Image;r.onload=()=>e(r),r.onerror=a,r.src=t})}cropTransparentPadding(t){let e=document.createElement("canvas");e.width=t.naturalWidth||t.width,e.height=t.naturalHeight||t.height;let a=e.getContext("2d",{willReadFrequently:!0});if(!a)throw Error("Failed to create source canvas context");a.drawImage(t,0,0,e.width,e.height);let{data:r,width:i,height:o}=a.getImageData(0,0,e.width,e.height),s=i,n=o,c=-1,d=-1;for(let t=0;t<o;t++)for(let e=0;e<i;e++)r[(t*i+e)*4+3]<=8||(s=Math.min(s,e),n=Math.min(n,t),c=Math.max(c,e),d=Math.max(d,t));if(c<s||d<n)return this.loadImageFromUrl(e.toDataURL("image/png"));let l=Math.round(.035*Math.max(i,o));s=Math.max(0,s-l),n=Math.max(0,n-l),c=Math.min(i-1,c+l),d=Math.min(o-1,d+l);let h=document.createElement("canvas");h.width=c-s+1,h.height=d-n+1;let u=h.getContext("2d");if(!u)throw Error("Failed to create output canvas context");return u.drawImage(e,s,n,h.width,h.height,0,0,h.width,h.height),this.loadImageFromUrl(h.toDataURL("image/png"))}flipHorizontal(){this.photocardImage&&(this.photocard.flipH=!this.photocard.flipH,this.render())}flipVertical(){this.photocardImage&&(this.photocard.flipV=!this.photocard.flipV,this.render())}rotateLeft(){this.photocardImage&&(this.photocard.rotation-=Math.PI/2,this.render())}rotateRight(){this.photocardImage&&(this.photocard.rotation+=Math.PI/2,this.render())}toggleToploader(t){t&&(this.frameMode=!1),this.photocard.showToploader=t,this.render()}setEditMode(t){this.editMode=t}reset(){this.stopGifAnim(this.photocardGif),this.stopGifAnim(this.backgroundGif),this.stopVideoAnim(this.photocardVideo),this.stopVideoAnim(this.backgroundVideo),this.photocardVideo.element?.src?.startsWith("blob:")&&URL.revokeObjectURL(this.photocardVideo.element.src),this.backgroundVideo.element?.src?.startsWith("blob:")&&URL.revokeObjectURL(this.backgroundVideo.element.src),this.backgroundImage=null,this.photocardImage=null,this.originalPhotocardImage=null,this.originalPhotocardFile=null,this.frameMode=!1,this.isPlaceholder=!1,this.photocardGif=this.freshGifState(),this.backgroundGif=this.freshGifState(),this.photocardVideo=this.freshVideoState(),this.backgroundVideo=this.freshVideoState(),this.background={x:0,y:0,scale:1,rotation:0,flipH:!1,flipV:!1},this.photocard={x:0,y:0,scale:1,rotation:0,flipH:!1,flipV:!1,layer:"front",showToploader:!0},this.loadPlaceholderPhotocard()}hasGifAnimation(){return this.photocardGif.isGif||this.backgroundGif.isGif}hasVideo(){return this.photocardVideo.isVideo||this.backgroundVideo.isVideo}exportImage(t=!1){return t&&this.hasGifAnimation()?this.exportAsGif():new Promise((t,e)=>{try{let a=document.createElement("canvas");a.width=this.canvas.width,a.height=this.canvas.height,a.getContext("2d")?.drawImage(this.canvas,0,0),a.toBlob(a=>a?t(a):e(Error("Export failed")),"image/png")}catch(t){e(t)}})}async exportAsGif(){let t,e=window.GIF;if(!e)throw Error("gif.js not loaded");let a=this.photocardGif.isGif?this.photocardGif.frames.length:1,r=this.backgroundGif.isGif?this.backgroundGif.frames.length:1,i=Math.max(a,r),o=window.devicePixelRatio||1,s=this.canvas.width/o,n=this.canvas.height/o;try{let e=await fetch("https://cdn.jsdelivr.net/npm/[email protected]/dist/gif.worker.js");t=URL.createObjectURL(await e.blob())}catch{}let c=new e({workers:2*!!t,quality:10,width:s,height:n,workerScript:t});for(let t=0;t<i;t++){this.photocardGif.isGif&&(this.photocardImage=this.photocardGif.frames[t%a]),this.backgroundGif.isGif&&(this.backgroundImage=this.backgroundGif.frames[t%r]),this.render();let e=this.photocardGif.isGif&&this.backgroundGif.isGif?Math.max(this.photocardGif.delays[t%a],this.backgroundGif.delays[t%r]):this.photocardGif.isGif?this.photocardGif.delays[t%a]:this.backgroundGif.isGif?this.backgroundGif.delays[t%r]:100;c.addFrame(this.canvas,{copy:!0,delay:e})}return new Promise((e,a)=>{c.on("finished",a=>{t&&URL.revokeObjectURL(t),e(a)}),c.on("error",e=>{t&&URL.revokeObjectURL(t),a(e)}),c.render()})}async exportAsVideo(t){let e,a=t??(this.photocardVideo.isVideo&&this.photocardVideo.element?.duration||this.backgroundVideo.isVideo&&this.backgroundVideo.element?.duration||10),r=this.photocardVideo.isVideo?this.photocardVideo.element:this.backgroundVideo.isVideo?this.backgroundVideo.element:null,i=r?.videoWidth??this.canvas.width,o=r?.videoHeight??this.canvas.height,s=document.createElement("canvas");s.width=i,s.height=o;let n=s.getContext("2d");if(!n)throw Error("Failed to create export canvas context");n.imageSmoothingEnabled=!0,n.imageSmoothingQuality="high";
7let c=s.captureStream(30),d=[{type:"video/mp4",ext:"mp4"},{type:"video/mp4;codecs=h264",ext:"mp4"},{type:"video/webm;codecs=vp9",ext:"webm"},{type:"video/webm;codecs=vp8",ext:"webm"},{type:"video/webm",ext:"webm"}].find(t=>MediaRecorder.isTypeSupported(t.type))??{type:"video/webm",ext:"webm"},l=new MediaRecorder(c,{mimeType:d.type}),h=[];l.ondataavailable=t=>{t.data.size>0&&h.push(t.data)};let u=window.devicePixelRatio||1,p=this.canvas.width,m=this.canvas.height,f=()=>{if(n.clearRect(0,0,i,o),this.backgroundImage){let t,e,a,r,s=(this.backgroundImage.videoWidth??this.backgroundImage.width)/(this.backgroundImage.videoHeight??this.backgroundImage.height);s>i/o?(a=(i-(t=(e=o)*s))/2,r=0):(e=(t=i)/s,a=0,r=(o-e)/2),n.drawImage(this.backgroundImage,a,r,t,e)}if(this.photocardImage){let t=this.photocardImage.videoWidth??this.photocardImage.width,e=this.photocardImage.videoHeight??this.photocardImage.height,a=i/(p/u),r=o/(m/u),s=Math.min(a,r),c=this.photocard.scale*s,d=t*c,l=e*c,h=this.photocard.x*a,f=this.photocard.y*r;if(n.save(),n.translate(h,f),n.rotate(this.photocard.rotation),this.photocard.showToploader){let t=U.sideGap*c,e=U.topGap*c,a=U.bottomGap*c;n.save(),n.shadowColor=`rgba(0,0,0,${U.recessShadow.opacity})`,n.shadowBlur=U.recessShadow.blur*c,n.shadowOffsetY=U.recessShadow.offsetY*c,n.fillStyle="#000",n.fillRect(-d/2+t,-l/2+e,d-2*t,l-e-a),n.restore(),n.drawImage(this.photocardImage,-d/2+t,-l/2+e,d-2*t,l-e-a)}else n.drawImage(this.photocardImage,-d/2,-l/2,d,l);if(n.restore(),this.photocard.showToploader){let i=this.ctx;this.ctx=n,n.save(),n.translate(this.photocard.x*a,this.photocard.y*r),n.rotate(this.photocard.rotation),n.scale(c*(this.photocard.flipH?-1:1),c*(this.photocard.flipV?-1:1)),this.drawToploader(t,e),n.restore(),this.ctx=i}}e=requestAnimationFrame(f)};return new Promise((t,r)=>{l.onstop=()=>{cancelAnimationFrame(e),t({blob:new Blob(h,{type:d.type}),mimeType:d.type,extension:d.ext})},l.onerror=t=>{cancelAnimationFrame(e),r(t)},f(),l.start(),setTimeout(()=>{l.stop(),c.getTracks().forEach(t=>{t.stop()})},1e3*a)})}}let H={x:0,y:0,scale:1,rotation:0},W={x:0,y:0,scale:1,rotation:0};function D({label:t,value:a,min:r,max:i,step:o,display:s,onChange:n}){return(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,e.jsx)("span",{children:t}),(0,e.jsx)("span",{className:"font-mono text-foreground",children:s})]}),(0,e.jsx)("input",{type:"range",min:r,max:i,step:o,value:a,onChange:t=>n(parseFloat(t.target.value)),className:"w-full h-2 rounded-full appearance-none bg-border cursor-pointer accent-primary"})]})}t.s(["ProofshotEditor",0,function(){let t=(0,w.useRef)(null),a=(0,w.useRef)(null),M=(0,w.useRef)(null),S=(0,w.useRef)(null),G=(0,w.useRef)(null),T=(0,w.useRef)(null),R=(0,w.useRef)(!1),O=(0,w.useRef)(null),E=(0,w.useRef)(null),L=(0,w.useRef)(!0),N=(0,w.useRef)(null),B=(0,w.useRef)(null),A=(0,w.useRef)(!0),V=(0,w.useRef)(null),U=(0,w.useRef)(()=>{}),_=(0,w.useRef)(()=>{}),[$,Y]=(0,w.useState)("photocard"),[X,q]=(0,w.useState)(!1),[Z,K]=(0,w.useState)(!1),[J,Q]=(0,w.useState)(!1),[tt,te]=(0,w.useState)("Loading…"),[ta,tr]=(0,w.useState)(!1),[ti,to]=(0,w.useState)(!1),[ts,tn]=(0,w.useState)(!1),[tc,td]=(0,w.useState)(!1),[tl,th]=(0,w.useState)("3:4"),[tu,tp]=(0,w.useState)(1),[tm,tf]=(0,w.useState)(!0),[tg,tx]=(0,w.useState)(!1),[ty,tv]=(0,w.useState)(H),[tb,tw]=(0,w.useState)(W),[tk,tj]=(0,w.useState)(!1),[tC,tP]=(0,w.useState)("3:4"),tI=(0,w.useCallback)(()=>{G.current?.click()},[]);(0,w.useEffect)(()=>{if(!t.current)return;R.current=window.innerWidth<=767,R.current&&K(!0);let e=new z;e.borderManager=new F,e.init(t.current,()=>tI()),T.current=e;let a="proofshot-visited";return localStorage.getItem(a)||setTimeout(()=>{k.toast.info("Welcome to Proofshot! Upload a background to get started."),localStorage.setItem(a,"true")},500),()=>{e.stopCamera()}},[tI]),(0,w.useEffect)(()=>{let t=t=>{if(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement)return;let e=T.current;e&&("s"===t.key&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),U.current()),"r"===t.key&&(t.ctrlKey||t.metaKey)&&(t.preventDefault(),_.current()),"h"===t.key&&e.flipHorizontal(),"v"===t.key&&e.flipVertical(),"["===t.key&&e.rotateLeft(),"]"===t.key&&e.rotateRight())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[]);let tF=t=>{Q(!0),te(t)},tM=(0,w.useCallback)(()=>{let t=T.current;t&&tv({x:t.background.x,y:t.background.y,scale:t.background.scale,rotation:t.background.rotation})},[]),tS=(0,w.useCallback)(()=>{let t=T.current;t&&tw({x:t.photocard.x,y:t.photocard.y,scale:t.photocard.scale,rotation:180*t.photocard.rotation/Math.PI})},[]),tG=(0,w.useCallback)((t,e)=>{let a=O.current,r=E.current;if(!a||!r)return;let i=a.querySelector(`[data-mode="${t}"]`);i&&(e?(r.style.transform=`translateX(${i.offsetLeft}px)`,r.style.width=`${i.offsetWidth}px`):(r.style.transition="none",r.style.transform=`translateX(${i.offsetLeft}px)`,r.style.width=`${i.offsetWidth}px`,r.offsetWidth,r.style.transition=""))},[]),tT=(0,w.useCallback)((t,e)=>{let a=N.current,r=B.current;if(!a||!r)return;let i=a.querySelector(`[data-mode="${t}"]`);i&&(e?(r.style.transform=`translateX(${i.offsetLeft}px)`,r.style.width=`${i.offsetWidth}px`):(r.style.transition="none",r.style.transform=`translateX(${i.offsetLeft}px)`,r.style.width=`${i.offsetWidth}px`,r.offsetWidth,r.style.transition=""))},[]);(0,w.useLayoutEffect)(()=>{L.current?(L.current=!1,tG($,!1)):tG($,!0)},[$,tG]),(0,w.useLayoutEffect)(()=>{A.current?(A.current=!1,tT($,!1)):tT($,!0)},[$,tT]),(0,w.useEffect)(()=>{let t=()=>{tG($,!1),tT($,!1)};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[$,tG,tT]),(0,w.useEffect)(()=>
7{if(!tk)return;let t=t=>{V.current&&!V.current.contains(t.target)&&tj(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[tk]);let tR=(t,e)=>{let a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a)},tO=t=>{Y(t),T.current?.setEditMode(t)},tE=async t=>{let e=t.target.files?.[0];if(e){if(!e.type.startsWith("image/")&&!e.type.startsWith("video/"))return void k.toast.error("Please select a valid image or video file");try{tF("Loading background…");let t=T.current;if(!t)return void k.toast.error("Editor not ready");t.camera.active&&(t.stopCamera(),tB()),await t.loadBackground(e),tM(),setTimeout(()=>t.resizeCanvas(),100),R.current&&tn(!0),td(!0),k.toast.success("Background loaded")}catch{k.toast.error("Failed to load background")}finally{Q(!1),t.target.value=""}}},tL=async t=>{let e=t.target.files?.[0];if(e){if(!e.type.startsWith("image/")&&!e.type.startsWith("video/"))return void k.toast.error("Please select a valid image or video file");try{tF("Loading photocard…");let t=T.current;if(!t)return void k.toast.error("Editor not ready");await t.loadPhotocard(e),tx(!1),tf(t.photocard.showToploader),tS(),k.toast.success("Photocard loaded")}catch{k.toast.error("Failed to load photocard")}finally{Q(!1),t.target.value=""}}},tN=async t=>{t.preventDefault();let e=Array.from(t.dataTransfer.files).filter(t=>t.type.startsWith("image/")||t.type.startsWith("video/"));if(!e.length)return void k.toast.error("Please drop image or video files");let a=T.current;a?(e[0]&&(await a.loadBackground(e[0]),tM()),e[1]&&(await a.loadPhotocard(e[1]),tx(!1),tf(a.photocard.showToploader),tS())):k.toast.error("Editor not ready")},tB=()=>{let e=a.current;if(!e)return;e.classList.remove("camera-active"),e.classList.remove("preview-mode");let r=t.current;r&&(r.style.width="",r.style.height=""),tr(!1),to(!1)},tA=async()=>{if(!navigator.mediaDevices?.getUserMedia)return k.toast.error("Camera not supported on this device"),!1;if(!M.current)return!1;try{tF("Starting camera…");let t=T.current;if(!t)return k.toast.error("Editor not ready"),Q(!1),!1;await t.startCamera(M.current),tr(!0),to(!0);let e=a.current;if(!e)return Q(!1),!1;return e.classList.add("camera-active"),tV(e,tl),setTimeout(()=>{T.current?.resizeCanvas(),T.current?.resetPhotocard(),tS()},100),Q(!1),!0}catch(e){let t=e.name;return"NotAllowedError"===t||"PermissionDeniedError"===t?k.toast.error("Camera permission denied."):"NotFoundError"===t?k.toast.error("No camera found on this device."):k.toast.error("Failed to access camera"),Q(!1),!1}},tV=(t,e)=>{t.classList.remove("aspect-3-4","aspect-9-16","aspect-1-1"),"3:4"===e?t.classList.add("aspect-3-4"):"9:16"===e?t.classList.add("aspect-9-16"):t.classList.add("aspect-1-1")},tU=async()=>{K(!1),await tA()},t_=async()=>{tn(!1),td(!1);let t=T.current;t&&(t.backgroundImage=null,R.current?(K(!0),t.render()):await tA()||k.toast.info("Ready for new proofshot"))},t$=()=>{confirm("Reset the canvas? This will clear all images.")&&(T.current?.reset(),tx(!1),td(!1),tf(!0),tM(),tS(),k.toast.success("Canvas reset"))};_.current=t$;let tz=async()=>{let t=T.current;if(!t)return void k.toast.error("Editor not ready");if(!t.backgroundImage)return void k.toast.error("Please add a background image before saving");let e=t.hasVideo(),a=t.hasGifAnimation(),r=!e&&a;tF(e?"Generating video…":r?"Generating animated GIF…":"Exporting…");try{let a,i,o;if(e){let e=await t.exportAsVideo();a=e.blob,i=e.mimeType,o=e.extension}else r?(a=await t.exportImage(!0),i="image/gif",o="gif"):(a=await t.exportImage(!1),i="image/png",o="png");let s=`proofshot-${Date.now()}.${o}`;if(!R.current||/Android/i.test(navigator.userAgent)||e)tR(a,s),k.toast.success(e?"Video saved!":r?"Animated GIF saved!":"Proofshot saved!");else{let t=new File([a],s,{type:i});if(navigator.canShare?.({files:[t]}))try{await navigator.share({files:[t],title:"Proofshot",text:"Check out my proofshot!"}),k.toast.success("Shared!")}catch(t){"AbortError"!==t.name&&(tR(a,s),k.toast.success("Saved!"))}else tR(a,s),k.toast.success("Saved!")}q(!0)}catch{k.toast.error("Failed to save proofshot")}finally{Q(!1)}};U.current=tz;let tH=async()=>{let t=T.current;if(!t)return void k.toast.error("Editor not ready");if(!t.backgroundImage)return void k.toast.error("Please add a background image before saving");tF("Generating video…");try{let e=await t.exportAsVideo();tR(e.blob,`proofshot-${Date.now()}.${e.extension}`),k.toast.success("Video saved!"),q(!0)}catch{k.toast.error("Failed to save video")}finally{Q(!1)}},tW=async()=>{q(!1),tn(!1),td(!1);let t=T.current;t&&(t.backgroundImage=null,R.current?(K(!0),t.render()):await tA()||(t.render(),k.toast.info("Ready for new proofshot")))},tD=()=>{T.current?.resetPhotocard(),tS()};(0,w.useEffect)(()=>{T.current?.setModalOpen(X)},[X]);let tY=(0,I.cn)("relative bg-[#1a1a1a] rounded-lg border border-border overflow-hidden mx-auto touch-none select-none",{"w-[600px] h-[800px] max-w-full":"3:4"===tC&&!ta,"w-[450px] h-[800px] max-w-full":"9:16"===tC&&!ta,"w-[600px] h-[600px] max-w-full":"1:1"===tC&&!ta});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b.default,{src:"https://cdn.jsdelivr.net/npm/[email protected]/dist/gif.js",strategy:"lazyOnload"}),(0,e.jsx)("input",{ref:S,type:"file",accept:"image/*,image/gif,video/*",className:"hidden",onChange:tE}),(0,e.jsx)("input",{ref:G,type:"file",accept:"image/*,image/gif,video/*",className:"hidden",onChange:tL}
7),(0,e.jsx)("video",{ref:M,autoPlay:!0,playsInline:!0,className:"hidden"}),(0,e.jsxs)("div",{className:"flex flex-col md:flex-row h-full overflow-hidden gap-4",children:[(0,e.jsxs)("div",{className:"flex-1 flex flex-col gap-3 min-h-0 overflow-y-auto md:overflow-visible",children:[Z&&(0,e.jsx)("div",{className:"fixed inset-0 z-[999] bg-background flex items-center justify-center p-8",children:(0,e.jsxs)("div",{className:"flex flex-col items-center gap-6 text-center max-w-sm w-full",children:[(0,e.jsx)("div",{className:"w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center",children:(0,e.jsx)(i,{className:"w-10 h-10 text-primary"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-2xl font-bold mb-3",children:"Ready to Create?"}),(0,e.jsx)("p",{className:"text-muted-foreground text-lg",children:"Take a photo of your photocard with your camera"})]}),(0,e.jsxs)("button",{type:"button",onClick:tU,className:"flex items-center gap-2 bg-primary text-primary-foreground px-8 py-4 rounded-lg text-lg font-bold hover:bg-primary/90 transition-colors min-w-[200px] justify-center shadow-lg",children:[(0,e.jsx)(i,{className:"w-6 h-6"}),"Launch Camera"]})]})}),(0,e.jsxs)("section",{ref:a,"aria-label":"Proofshot canvas",className:tY,onDragOver:t=>t.preventDefault(),onDrop:tN,children:[(0,e.jsx)("canvas",{ref:t,className:"block cursor-grab active:cursor-grabbing transition-opacity"}),!ta&&(0,e.jsxs)("div",{ref:N,className:"t-tabs canvas-tabs absolute top-3 left-1/2 -translate-x-1/2 z-10",role:"tablist",children:[(0,e.jsx)("span",{ref:B,className:"t-tabs-pill","aria-hidden":"true"}),["photocard","background"].map(t=>(0,e.jsxs)("button",{type:"button","data-mode":t,role:"tab",onClick:()=>tO(t),"aria-selected":$===t,className:"t-tab flex items-center gap-1.5 text-xs font-medium",children:["photocard"===t?(0,e.jsx)(n,{className:"w-3 h-3"}):(0,e.jsx)(h.default,{className:"w-3 h-3"}),"photocard"===t?"Photocard":"Background"]},t))]}),ta&&ti&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"fixed bottom-0 left-1/2 -translate-x-1/2 flex flex-col items-center w-full max-w-[75vh] px-3 z-[1001] pointer-events-none",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between w-full mb-3 pointer-events-auto",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>{T.current?.resetPhotocard(),tS(),k.toast.success("Photocard reset")},className:"flex items-center gap-1.5 bg-[rgba(100,100,100,0.7)] text-white px-3 h-11 rounded-md text-sm font-semibold backdrop-blur-sm active:scale-95 transition-transform",children:[(0,e.jsx)(m,{className:"w-4 h-4"})," Reset"]}),(0,e.jsx)("button",{type:"button",onClick:()=>{let e,r=T.current,i=a.current;r&&i?(tP(tl),r.captureFrame(),to(!1),tr(!1),i.classList.remove("camera-active"),i.classList.add("preview-mode"),tV(i,tl),i.style.position="relative",i.style.top="auto",i.style.left="auto",i.style.zIndex="auto",i.style.width="",i.style.height="",i.style.maxWidth=R.current?"100vw":"800px",i.style.maxHeight=R.current?"calc(100vh - 180px)":"none",setTimeout(()=>{t.current&&(t.current.style.width="",t.current.style.height=""),r.resizeCanvas(),setTimeout(()=>{R.current&&window.scrollTo({top:0,behavior:"smooth"})},150)},100),tn(!0),td(!0),Object.assign((e=document.createElement("div")).style,{position:"fixed",inset:"0",background:"white",zIndex:"9999",pointerEvents:"none",animation:"none",opacity:"1",transition:"opacity 0.3s"}),document.body.appendChild(e),requestAnimationFrame(()=>{e.style.opacity="0",setTimeout(()=>document.body.removeChild(e),300)}),k.toast.success("Photo captured!")):k.toast.error("Editor not ready")},className:"w-[70px] h-[70px] rounded-full border-[3px] border-white/95 bg-transparent flex items-center justify-center active:scale-[0.88] transition-transform shrink-0",style:{boxShadow:"0 0 0 6px rgba(255,255,255,0.2), 0 6px 12px rgba(0,0,0,0.4)"},"aria-label":"Capture",children:(0,e.jsx)("div",{className:"w-[54px] h-[54px] rounded-full bg-white"})}),(0,e.jsx)("button",{type:"button",onClick:()=>{let t=["3:4","9:16","1:1"],e=t[(t.indexOf(tl)+1)%t.length];th(e);let r=a.current;r&&(tV(r,e),setTimeout(()=>T.current?.resizeCanvas(),100))},className:"bg-[rgba(100,100,100,0.7)] text-white px-3 h-11 min-w-[50px] rounded-md text-sm font-semibold font-mono backdrop-blur-sm active:scale-95 transition-transform",children:tl})]}),(0,e.jsxs)("div",{className:"flex items-center justify-center gap-2 mt-1 mb-1 pointer-events-auto",children:[(0,e.jsx)("button",{type:"button",onClick:()=>{let t=Math.max(1,tu-.5);tp(t),T.current?.setCameraZoom(t)},className:"w-8 h-8 flex items-center justify-center text-white active:scale-90 transition-transform",children:(0,e.jsx)(v,{className:"w-5 h-5"})}),(0,e.jsx)("input",{type:"range",min:1,max:10,step:.1,value:tu,onChange:t=>{let e=parseFloat(t.target.value);tp(e),T.current?.setCameraZoom(e)},className:"w-[100px] accent-white"}),(0,e.jsx)("button",{type:"button",onClick:()=>{let t=Math.min(10,tu+.5);tp(t),T.current?.setCameraZoom(t)},className:"w-8 h-8 flex items-center justify-center text-white active:scale-90 transition-transform",children:(0,e.jsx)(y,{className:"w-5 h-5"})})]})]}),(0,e.jsx)("button",{type:"button",onClick:()=>S.current?.click(),className:"fixed bottom-6 left-6 w-[50px] h-[50px] rounded-full bg-black/60 border border-white/30 text-white flex items-center justify-center backdrop-blur-sm active:scale-90 active:bg-black/80 transition-transform z-[1002]","aria-label":"Upload background",children:(0,e.jsx)(h.default,{className:"w-6 h-6"})}),(0,e.jsx)("button",{type:"button",onClick:tI,className:"fixed bottom-6 right-6 w-[50px] h-[50px] rounded-full bg-black/60 border border-white/30 text-white flex items-center justify-center backdrop-blur-sm active:scale-90 active:bg-black/80 transition-transform z-[1002]","aria-label":"Change objekt image",children:(0,e.jsx)(r,{className:"w-6 h-6"})})]})]}),ts&&(0,e.jsxs)("div",{className:"flex gap-3 justify-center",children:[(0,e.jsxs)("button",{type:"button",onClick:t_,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg bg-secondary text-secondary-foreground hover:bg-secondary/80 font-medium",children:[(0,e.jsx)(f.default,{className:"w-4 h-4"})," Retake"]}),(0,e.jsxs)("button",{type:"button",onClick:()=>tz(),className:"flex items-center gap-2 px-5 py-2.5 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 font-medium",children:[(0,e.jsx)(o.Check,{className:"w-4 h-4"})," Save"]})]}),!1]}),(0,e.jsx)("div",{className:"hidden md:flex md:w-80 flex-shrink-0 bg-[#1a1a1a] border border-border rounded-lg flex-col overflow-hidden md:max-h-full md:overflow-y-auto sticky top-0",children:(0,e.jsxs)("div",{className:"flex flex-col gap-5 p-5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider",children:"Proofshot"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Adjust layers"})]}),(0,e.jsxs)("div",{ref:V,className:"relative",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>tj(t=>
7!t),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-secondary text-secondary-foreground text-sm hover:bg-secondary/80",children:[(0,e.jsx)("span",{children:tC}),(0,e.jsx)(s.ChevronDown,{className:"w-3.5 h-3.5"})]}),tk&&(0,e.jsx)("div",{className:"aspect-dd-open absolute right-0 top-full mt-1 bg-popover border border-border rounded-lg shadow-lg z-50 overflow-hidden min-w-20",children:["3:4","9:16","1:1"].map(t=>(0,e.jsxs)("button",{type:"button",onClick:()=>{let e;tP(t),th(t),(e=a.current)&&(e.classList.remove("aspect-3-4","aspect-9-16","aspect-1-1"),e.classList.remove("preview-mode"),"3:4"===t?e.classList.add("aspect-3-4"):"9:16"===t?e.classList.add("aspect-9-16"):e.classList.add("aspect-1-1"),setTimeout(()=>{T.current?.resizeCanvas(),tM(),tS()},100)),tj(!1)},className:(0,I.cn)("w-full flex items-center justify-between px-3 py-2 text-sm hover:bg-accent",tC===t&&"bg-accent"),children:[(0,e.jsx)("span",{children:t}),tC===t&&(0,e.jsx)(o.Check,{className:"w-3.5 h-3.5"})]},t))})]})]}),(0,e.jsxs)("div",{ref:O,className:"t-tabs proofshot-tabs flex gap-1 bg-secondary/50 p-1 rounded-lg",role:"tablist",children:[(0,e.jsx)("span",{ref:E,className:"t-tabs-pill","aria-hidden":"true"}),["photocard","background"].map(t=>(0,e.jsxs)("button",{type:"button",role:"tab","data-mode":t,onClick:()=>tO(t),"aria-selected":$===t,className:"t-tab flex-1 flex items-center justify-center gap-2 py-2 rounded-md text-sm font-medium",children:["photocard"===t?(0,e.jsx)(n,{className:"w-4 h-4"}):(0,e.jsx)(h.default,{className:"w-4 h-4"}),"photocard"===t?"Photocard":"Background"]},t))]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground font-medium mb-2.5",children:"Add Media"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>S.current?.click(),className:"flex-1 flex flex-col items-center gap-1.5 p-3 rounded-lg bg-secondary hover:bg-secondary/80",children:[(0,e.jsx)(u,{className:"w-5 h-5"}
7),(0,e.jsx)("span",{className:"text-sm",children:"Background"})]}),(0,e.jsxs)("button",{type:"button",onClick:()=>tA(),className:"flex-1 flex flex-col items-center gap-1.5 p-3 rounded-lg bg-secondary hover:bg-secondary/80 md:hidden",children:[(0,e.jsx)(i,{className:"w-5 h-5"}),(0,e.jsx)("span",{className:"text-sm",children:"Camera"})]}),(0,e.jsxs)("button",{type:"button",onClick:tI,className:"flex-1 flex flex-col items-center gap-1.5 p-3 rounded-lg bg-secondary hover:bg-secondary/80",children:[(0,e.jsx)(r,{className:"w-5 h-5"}),(0,e.jsx)("span",{className:"text-sm",children:"Photocard"})]})]})]}),"background"===$&&(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("p",{className:"text-sm text-muted-foreground font-medium flex items-center gap-1.5",children:[(0,e.jsx)(h.default,{className:"w-3.5 h-3.5"})," Background"]}),(0,e.jsx)(D,{label:"Position X",value:ty.x,min:-500,max:500,step:1,display:Math.round(ty.x).toString(),onChange:t=>{tv(e=>({...e,x:t})),T.current?.updateBackground("x",t)}}),(0,e.jsx)(D,{label:"Position Y",value:ty.y,min:-500,max:500,step:1,display:Math.round(ty.y).toString(),onChange:t=>{tv(e=>({...e,y:t}
7)),T.current?.updateBackground("y",t)}}),(0,e.jsx)(D,{label:"Scale",value:ty.scale,min:.1,max:3,step:.01,display:ty.scale.toFixed(2),onChange:t=>{tv(e=>({...e,scale:t})),T.current?.updateBackground("scale",t)}}),(0,e.jsx)(D,{label:"Rotation",value:ty.rotation,min:-180,max:180,step:1,display:`${Math.round(ty.rotation)}\xb0`,onChange:t=>{tv(e=>({...e,rotation:t})),T.current?.updateBackground("rotation",t)}}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("button",{type:"button",onClick:()=>T.current?.flipBackgroundHorizontal(),className:"flex-1 flex items-center justify-center gap-1 p-2.5 rounded-md bg-secondary hover:bg-secondary/80 text-sm",children:(0,e.jsx)(d,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:()=>T.current?.flipBackgroundVertical(),className:"flex-1 flex items-center justify-center gap-1 p-2.5 rounded-md bg-secondary hover:bg-secondary/80 text-sm",children:(0,e.jsx)(l,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:()=>{T.current?.resetBackground(),tM()},className:"flex-1 flex items-center justify-center gap-1 p-2.5 rounded-md bg-secondary hover:bg-secondary/80 text-sm",children:(0,e.jsx)(m,{className:"w-4 h-4"})})]})]}),"photocard"===$&&(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("p",{className:"text-sm text-muted-foreground font-medium flex items-center gap-1.5",children:[(0,e.jsx)(n,{className:"w-3.5 h-3.5"})," Photocard"]}),(0,e.jsx)(D,{label:"Position X",value:tb.x,min:0,max:1e3,step:1,display:Math.round(tb.x).toString(),onChange:t=>{tw(e=>({...e,x:t})),T.current?.updatePhotocard("x",t)}}),(0,e.jsx)(D,{label:"Position Y",value:tb.y,min:0,max:1e3,step:1,display:Math.round(tb.y).toString(),onChange:t=>{tw(e=>({...e,y:t})),T.current?.updatePhotocard("y",t)}}),(0,e.jsx)(D,{label:"Scale",value:tb.scale,min:.1,max:5,step:.01,display:tb.scale.toFixed(2),onChange:t=>{tw(e=>({...e,scale:t})),T.current?.updatePhotocard("scale",t)}}),(0,e.jsx)(D,{label:"Rotation",value:tb.rotation,min:-180,max:180,step:1,display:`${Math.round(tb.rotation)}\xb0`,onChange:t=>{tw(e=>({...e,rotation:t})),T.current?.updatePhotocard("rotation",t*Math.PI/180)}}),!1,(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(P.Switch,{id:"toploader",checked:tm,disabled:tg,onCheckedChange:t=>{tg&&t&&tx(!1),tf(t),T.current?.toggleToploader(t)}}),(0,e.jsx)(C.Label,{htmlFor:"toploader",className:"text-base",children:"Show Toploader"})]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)("button",{type:"button",onClick:tD,className:"flex-1 flex items-center justify-center gap-1.5 p-2.5 rounded-md bg-secondary hover:bg-secondary/80 text-sm",children:[(0,e.jsx)(m,{className:"w-4 h-4"})," Reset"]}),(0,e.jsxs)("button",{type:"button",onClick:tD,className:"flex-1 flex items-center justify-center gap-1.5 p-2.5 rounded-md bg-secondary hover:bg-secondary/80 text-sm",children:[(0,e.jsx)(p,{className:"w-4 h-4"})," Position"]})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border",children:[(0,e.jsxs)("button",{type:"button",onClick:t$,className:"flex items-center justify-center gap-2 p-2.5 rounded-lg bg-secondary hover:bg-secondary/80 text-sm font-medium",children:[(0,e.jsx)(m,{className:"w-4 h-4"})," Reset Canvas"]}),(0,e.jsx)("button",{type:"button",onClick:tz,className:"flex items-center justify-center gap-2 p-2.5 rounded-lg bg-green-600 hover:bg-green-700 text-white text-sm font-semibold",children:"Save"}),(0,e.jsxs)("button",{type:"button",onClick:tH,className:"flex items-center justify-center gap-2 p-2.5 rounded-lg bg-secondary hover:bg-secondary/80 text-sm font-medium",children:[(0,e.jsx)(x,{className:"w-4 h-4"})," Save as Video"]})]})]})})]}),J&&(0,e.jsx)("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-[9999]",children:(0,e.jsxs)("div",{className:"flex flex-col items-center gap-4 text-white",children:[(0,e.jsx)("div",{className:"w-12 h-12 border-4 border-white/30 border-t-white rounded-full animate-spin"}),(0,e.jsx)("span",{className:"t-shimmer loading-shimmer font-semibold","data-text":tt,children:tt})]})}),(0,e.jsx)(j.Dialog,{open:X,onOpenChange:t=>{q(t),T.current?.setModalOpen(t)},children:(0,e.jsxs)(j.DialogContent,{className:"max-w-sm",children:[(0,e.jsx)(j.DialogHeader,{children:(0,e.jsx)(j.DialogTitle,{children:"What's Next?"})}),(0,e.jsxs)("div",{className:"flex flex-col gap-3 mt-2",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>q(!1),className:"flex items-center justify-center gap-2 p-3 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 font-medium",children:[(0,e.jsx)(c,{className:"w-4 h-4"})," Keep Editing"]}),(0,e.jsxs)("button",{type:"button",onClick:tW,className:"flex items-center justify-center gap-2 p-3 rounded-lg bg-secondary hover:bg-secondary/80 text-secondary-foreground font-medium",children:[(0,e.jsx)(g.default,{className:"w-4 h-4"})," Discard Image"]})]})]})}),(0,e.jsx)("style",{children:`
8        /* ── transitions-dev variables ── */
9        :root {
10          --tabs-dur: 200ms;
11          --tabs-ease: cubic-bezier(0.22, 1, 0.36, 1);
12          --shimmer-dur: 2000ms;
13          --shimmer-band: 400%;
14          --shimmer-ease: linear;
15        }
16        /* ── Aspect ratio dropdown open animation ── */
17        @keyframes aspect-dd-in {
18          from { transform: scale(0.97); opacity: 0; }
19          to   { transform: scale(1);    opacity: 1; }
20        }
21        .aspect-dd-open {
22          transform-origin: top right;
23          animation: aspect-dd-in 200ms cubic-bezier(0.22, 1, 0.36, 1) both;
24        }
25        @media (prefers-reduced-motion: reduce) {
26          .aspect-dd-open { animation: none !important; }
27        }
28        /* ── Tabs sliding ── */
29        .t-tabs {
30          position: relative;
31          display: inline-flex;
32          align-items: center;
33          gap: 3px;
34          padding: 3px;
35          border-radius: 48px;
36        }
37        .t-tab {
38          position: relative;
39          appearance: none;
40          border: 0;
41          background: transparent;
42          height: 30px;
43          padding: 4px 12px;
44          color: var(--tabs-text-muted);
45          cursor: pointer;
46          border-radius: 48px;
47          z-index: 1;
48          transition: color var(--tabs-dur) var(--tabs-ease);
49        }
50        .t-tab:not([aria-selected="true"]):hover,
51        .t-tab[aria-selected="true"] { color: var(--tabs-text-active); }
52        .t-tabs-pill {
53          position: absolute;
54          top: 3px;
55          left: 0;
56          height: 30px;
57          width: 0;
58          background: var(--tabs-pill-bg);
59          border-radius: 48px;
60          transform: translateX(0);
61          transition:
62            transform var(--tabs-dur) var(--tabs-ease),
63            width     var(--tabs-dur) var(--tabs-ease);
64          will-change: transform, width;
65          z-index: 0;
66          pointer-events: none;
67        }
68        @media (prefers-reduced-motion: reduce) {
69          .t-tabs-pill, .t-tab { transition: none !important; }
70        }
71        /* ── Canvas overlay tabs ── */
72        .canvas-tabs.t-tabs {
73          position: absolute;
74          border-radius: 0.5rem;
75          background: rgba(0, 0, 0, 0.55);
76          backdrop-filter: blur(8px);
77          padding: 3px;
78          gap: 3px;
79        }
80        .canvas-tabs .t-tabs-pill {
81          --tabs-pill-bg: #ffffff;
82          top: 3px;
83          height: calc(100% - 6px);
84          border-radius: 6px;
85        }
86        .canvas-tabs .t-tab {
87          --tabs-text-muted: rgba(255, 255, 255, 0.55);
88          --tabs-text-active: #1a1a1a;
89          height: auto;
90          padding: 4px 10px;
91          border-radius: 6px;
92        }
93        /* ── Proofshot tabs overrides ── */
94        .proofshot-tabs.t-tabs {
95          display: flex;
96          border-radius: 0.5rem;
97          background: transparent;
98          padding: 4px;
99          gap: 4px;
100        }
101        .proofshot-tabs .t-tabs-pill {
102          --tabs-pill-bg: var(--background);
103          top: 4px;
104          height: calc(100% - 8px);
105          border-radius: 0.375rem;
106          box-shadow: 0 1px 3px rgba(0,0,0,0.25);
107        }
108        .proofshot-tabs .t-tab {
109          --tabs-text-muted: var(--muted-foreground);
110          --tabs-text-active: var(--foreground);
111          height: auto;
112          padding: 6px 0;
113          border-radius: 0.375rem;
114        }
115        /* ── Shimmer text ── */
116        .t-shimmer {
117          position: relative;
118          display: inline-block;
119          color: var(--shimmer-base);
120        }
121        .t-shimmer::before {
122          content: attr(data-text);
123          position: absolute;
124          inset: 0;
125          pointer-events: none;
126          background-image: linear-gradient(
127            90deg,
128            transparent 0%, transparent 40%,
129            var(--shimmer-highlight) 50%,
130            transparent 60%, transparent 100%
131          );
132          background-size: var(--shimmer-band) 100%;
133          background-repeat: no-repeat;
134          -webkit-background-clip: text;
135          background-clip: text;
136          color: transparent;
137          -webkit-text-fill-color: transparent;
138          animation: t-shimmer var(--shimmer-dur) var(--shimmer-ease) infinite;
139        }
140        @keyframes t-shimmer {
141          0%   { background-position: 100% 0; }
142          100% { background-position: 0% 0; }
143        }
144        @media (prefers-reduced-motion: reduce) {
145          .t-shimmer::before { animation: none !important; }
146        }
147        /* Loading overlay shimmer colours */
148        .loading-shimmer {
149          --shimmer-base: rgba(255, 255, 255, 0.65);
150          --shimmer-highlight: #ffffff;
151        }
152        /* ── canvas/camera ── */
153        .aspect-3-4 { aspect-ratio: 3/4; }
154        .aspect-9-16 { aspect-ratio: 9/16; }
155        .aspect-1-1 { aspect-ratio: 1/1; }
156        .camera-active {
157          position: fixed !important;
158          inset: 0 !important;
159          z-index: 1000 !important;
160          width: 100vw !important;
161          height: 100dvh !important;
162          max-width: none !important;
163          max-height: none !important;
164          aspect-ratio: unset !important;
165          border-radius: 0 !important;
166          margin: 0 !important;
167          background: #000 !important;
168          display: flex !important;
169          align-items: flex-start !important;
170          justify-content: center !important;
171        }
172        .camera-active canvas {
173          position: relative;
174          width: auto !important;
175          height: auto !important;
176          max-width: 100vw;
177          max-height: 100dvh;
178        }
179        .camera-active.aspect-3-4 canvas { aspect-ratio: 3/4; width: min(calc(100dvh * 0.75), 100vw) !important; height: auto !important; }
180        .camera-active.aspect-9-16 canvas { aspect-ratio: 9/16; width: min(calc(100dvh * 0.5625), 100vw) !important; height: auto !important; }
181        .camera-active.aspect-1-1 canvas { aspect-ratio: 1/1; width: min(100dvh, 100vw) !important; height: auto !important; }
182        canvas.placeholder-active { animation: placeholderPulse 2s ease-in-out infinite; }
183        @keyframes placeholderPulse { 0%,100% { opacity:1; } 50% { opacity:0.85; } }
184      `})]})}],3187)},8341,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r={cancelIdleCallback:function(){return s},requestIdleCallback:function(){return o}};for(var i in r)Object.defineProperty(a,i,{enumerable:!0,get:r[i]});let o="u">typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(t){let e=Date.now();return self.setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},s="u">typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(t){return clearTimeout(t)};("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),e.exports=a.default)},19083,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r={ESCAPE_REGEX:function(){return s},htmlEscapeAttributeString:function(){return l},htmlEscapeJsonString:function(){return d}};for(var i in r)Object.defineProperty(a,i,{enumerable:!0,get:r[i]});let o={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},s=/[&><\u2028\u2029]/g,n={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;"},c=/[&"'<>]/g;function d(t){return t.replace(s,t=>o[t])}function l(t){return t.replace(c,t=>n[t])}},79520,(t,e,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r={default:function(){return b},handleClientScriptLoad:function(){return x},initScriptLoader:function(){return y}};for(var i in r)Object.defineProperty(a,i,{enumerable:!0,get:r[i]});let o=t.r(55682),s=t.r(90809),n=t.r(43476),c=o._(t.r(74080)),d=s._(t.r(71645)),l=t.r(42732),h=t.r(22737),u=t.r(8341),p=t.r(19083),m=new Map,f=new Set,g=t=>{let{src:e,id:a,onLoad:r=()=>{},onReady:i=null,dangerouslySetInnerHTML:o,children:s="",strategy:n="afterInteractive",onError:d,stylesheets:l}=t,u=a||e;if(u&&f.has(u))return;if(m.has(e)){f.add(u),m.get(e).then(r,d);return}let p=()=>{i&&i(),f.add(u)},g=document.createElement("script"),x=new Promise((t,e)=>{g.addEventListener("load",function(e){t(),r&&r.call(this,e),p()}),g.addEventListener("error",function(t){e(t)})}).catch(function(t){d&&d(t)});o?(g.innerHTML=o.__html||"",p()):s?(g.textContent="string"==typeof s?s:Array.isArray(s)?s.join(""):"",p()):e&&(g.src=e,m.set(e,x)),(0,h.setAttributesFromProps)(g,t),"worker"===n&&g.setAttribute("type","text/partytown"),g.setAttribute("data-nscript",n),l&&(t=>{if(c.default.preinit)return t.forEach(t=>{c.default.preinit(t,{as:"style"})});if("u">typeof window){let e=document.head;t.forEach(t=>{let a=document.createElement("link");a.type="text/css",a.rel="stylesheet",a.href=t,e.appendChild(a)})}})(l),document.body.appendChild(g)};function x(t){let{strategy:e="afterInteractive"}=t;"lazyOnload"===e?window.addEventListener("load",()=>{(0,u.requestIdleCallback)(()=>g(t))}):g(t)}function y(t){t.forEach(x),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEac
184h(t=>{let e=t.id||t.getAttribute("src");f.add(e)})}function v(t){let{id:e,src:a="",onLoad:r=()=>{},onReady:i=null,strategy:o="afterInteractive",onError:s,stylesheets:h,...m}=t,{updateScripts:x,scripts:y,getIsSsr:v,appDir:b,nonce:w}=(0,d.useContext)(l.HeadManagerContext);w=m.nonce||w;let k=(0,d.useRef)(!1);(0,d.useEffect)(()=>{let t=e||a;k.current||(i&&t&&f.has(t)&&i(),k.current=!0)},[i,e,a]);let j=(0,d.useRef)(!1);if((0,d.useEffect)(()=>{if(!j.current){if("afterInteractive"===o)g(t);else"lazyOnload"===o&&("complete"===document.readyState?(0,u.requestIdleCallback)(()=>g(t)):window.addEventListener("load",()=>{(0,u.requestIdleCallback)(()=>g(t))}));j.current=!0}},[t,o]),("beforeInteractive"===o||"worker"===o)&&(x?(y[o]=(y[o]||[]).concat([{id:e,src:a,onLoad:r,onReady:i,onError:s,...m,nonce:w}]),x(y)):v&&v()?f.add(e||a):v&&!v()&&g({...t,nonce:w})),b){if(h&&h.forEach(t=>{c.default.preinit(t,{as:"style"})}),"beforeInteractive"===o)if(!a)return m.dangerouslySetInnerHTML&&(m.children=m.dangerouslySetInnerHTML.__html,delete m.dangerouslySetInnerHTML),(0,n.jsx)("script",{nonce:w,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${(0,p.htmlEscapeJsonString)(JSON.stringify([0,{...m,id:e}]))})`}});else return c.default.preload(a,m.integrity?{as:"script",integrity:m.integrity,nonce:w,crossOrigin:m.crossOrigin}:{as:"script",nonce:w,crossOrigin:m.crossOrigin}),(0,n.jsx)("script",{nonce:w,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${(0,p.htmlEscapeJsonString)(JSON.stringify([a,{...m,id:e}]))})`}});"afterInteractive"===o&&a&&c.default.preload(a,m.integrity?{as:"script",integrity:m.integrity,nonce:w,crossOrigin:m.crossOrigin}:{as:"script",nonce:w,crossOrigin:m.crossOrigin})}return null}Object.defineProperty(v,"__nextScript",{value:!0});let b=v;("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),e.exports=a.default)},3303,(t,e,a)=>{e.exports=t.r(79520)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.