@ahmedrowaihi/pdf-forge-preview 1.0.0-canary.0 → 1.0.0-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/fallback-build-manifest.json +2 -2
  4. package/.next/next-server.js.nft.json +1 -1
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/server/app/_global-error.html +2 -2
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/page/server-reference-manifest.json +1 -1
  16. package/.next/server/app/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/preview/[...slug]/page/server-reference-manifest.json +4 -4
  18. package/.next/server/app/preview/[...slug]/page.js +1 -1
  19. package/.next/server/app/preview/[...slug]/page.js.nft.json +1 -1
  20. package/.next/server/app/preview/[...slug]/page_client-reference-manifest.js +1 -1
  21. package/.next/server/chunks/ssr/[root-of-the-server]__1536282c._.js +1 -1
  22. package/.next/server/chunks/ssr/[root-of-the-server]__1536282c._.js.map +1 -1
  23. package/.next/server/chunks/ssr/[root-of-the-server]__95852430._.js +3 -0
  24. package/.next/server/chunks/ssr/[root-of-the-server]__95852430._.js.map +1 -0
  25. package/.next/server/chunks/ssr/[root-of-the-server]__cb0c7b1a._.js +1 -1
  26. package/.next/server/chunks/ssr/[root-of-the-server]__ecac8617._.js +2 -2
  27. package/.next/server/chunks/ssr/_810f54e9._.js +1 -1
  28. package/.next/server/chunks/ssr/_810f54e9._.js.map +1 -1
  29. package/.next/server/chunks/ssr/_c57c12df._.js +1 -1
  30. package/.next/server/chunks/ssr/_c57c12df._.js.map +1 -1
  31. package/.next/server/chunks/ssr/packages_preview-server_src_e17a2a9b._.js +1 -1
  32. package/.next/server/chunks/ssr/packages_preview-server_src_e17a2a9b._.js.map +1 -1
  33. package/.next/server/pages/500.html +2 -2
  34. package/.next/server/server-reference-manifest.js +1 -1
  35. package/.next/server/server-reference-manifest.json +5 -5
  36. package/.next/static/chunks/{959ed978a6e89a66.js → 2ecbbe3fa6012870.js} +1 -1
  37. package/.next/static/chunks/{a6db6456c5b75734.js → 8adcb219445d6056.js} +1 -1
  38. package/.next/trace +1 -1
  39. package/.next/trace-build +1 -1
  40. package/CHANGELOG.md +18 -0
  41. package/next.config.mjs +1 -1
  42. package/package.json +5 -5
  43. package/src/actions/export-single-template.ts +114 -21
  44. package/src/app/preview/[...slug]/download-button.tsx +1 -6
  45. package/src/app/preview/[...slug]/preview.tsx +3 -3
  46. package/src/utils/asset-registry.ts +152 -0
  47. package/.next/server/chunks/ssr/[root-of-the-server]__025eaae9._.js +0 -3
  48. package/.next/server/chunks/ssr/[root-of-the-server]__025eaae9._.js.map +0 -1
  49. /package/.next/static/{cdYIhKFtJ0GB-yJK5ywz_ → MJwu4qo8243SZCjO3lRNL}/_buildManifest.js +0 -0
  50. /package/.next/static/{cdYIhKFtJ0GB-yJK5ywz_ → MJwu4qo8243SZCjO3lRNL}/_clientMiddlewareManifest.json +0 -0
  51. /package/.next/static/{cdYIhKFtJ0GB-yJK5ywz_ → MJwu4qo8243SZCjO3lRNL}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,96328,(t,e,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var r={callServer:function(){return n.callServer},createServerReference:function(){return a.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var i in r)Object.defineProperty(s,i,{enumerable:!0,get:r[i]});let n=t.r(54968),o=t.r(8865),a=t.r(36718)},61863,84928,5248,t=>{"use strict";let e,s,r;var i,n,o=t.i(90311),a=t.i(7749),h=t.i(96328);let c=(0,h.createServerReference)("78b81665c2f52df9f88fe99a7a917efcffc2994c9c",h.callServer,void 0,h.findSourceMapURL,"getTemplatesDirectoryMetadataAction");var l=t.i(52154);l.default.env.USER_PROJECT_LOCATION,l.default.env.PREVIEW_SERVER_LOCATION,l.default.env.TEMPLATES_DIR_ABSOLUTE_PATH;let u="true"===l.default.env.NEXT_PUBLIC_IS_BUILDING,p="true"===l.default.env.NEXT_PUBLIC_IS_PREVIEW_DEVELOPMENT;t.s(["isBuilding",0,u,"isPreviewDevelopment",0,p],84928);let d=Object.create(null);d.open="0",d.close="1",d.ping="2",d.pong="3",d.message="4",d.upgrade="5",d.noop="6";let f=Object.create(null);Object.keys(d).forEach(t=>{f[d[t]]=t});let y={type:"error",data:"parser error"},g="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),m="function"==typeof ArrayBuffer,_=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,b=({type:t,data:e},s,r)=>{if(g&&e instanceof Blob)if(s)return r(e);else return v(e,r);if(m&&(e instanceof ArrayBuffer||_(e)))if(s)return r(e);else return v(new Blob([e]),r);return r(d[t]+(e||""))},v=(t,e)=>{let s=new FileReader;return s.onload=function(){e("b"+(s.result.split(",")[1]||""))},s.readAsDataURL(t)};function k(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<w.length;t++)E[w.charCodeAt(t)]=t;let T="function"==typeof ArrayBuffer,A=(t,e)=>{if("string"!=typeof t)return{type:"message",data:O(t,e)};let s=t.charAt(0);return"b"===s?{type:"message",data:R(t.substring(1),e)}:f[s]?t.length>1?{type:f[s],data:t.substring(1)}:{type:f[s]}:y},R=(t,e)=>T?O((t=>{let e=.75*t.length,s=t.length,r,i=0,n,o,a,h;"="===t[t.length-1]&&(e--,"="===t[t.length-2]&&e--);let c=new ArrayBuffer(e),l=new Uint8Array(c);for(r=0;r<s;r+=4)n=E[t.charCodeAt(r)],o=E[t.charCodeAt(r+1)],a=E[t.charCodeAt(r+2)],h=E[t.charCodeAt(r+3)],l[i++]=n<<2|o>>4,l[i++]=(15&o)<<4|a>>2,l[i++]=(3&a)<<6|63&h;return c})(t),e):{base64:!0,data:t},O=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer;function C(t){return t.reduce((t,e)=>t+e.length,0)}function B(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),r=0;for(let i=0;i<e;i++)s[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),s}function S(t){if(t){var e=t;for(var s in S.prototype)e[s]=S.prototype[s];return e}}S.prototype.on=S.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},S.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this},S.prototype.off=S.prototype.removeListener=S.prototype.removeAllListeners=S.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<r.length;i++)if((s=r[i])===e||s.fn===e){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},S.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=Array(arguments.length-1),s=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(s){s=s.slice(0);for(var r=0,i=s.length;r<i;++r)s[r].apply(this,e)}return this},S.prototype.emitReserved=S.prototype.emit,S.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},S.prototype.hasListeners=function(t){return!!this.listeners(t).length};let N="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),x="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function L(t,...e){return e.reduce((e,s)=>(t.hasOwnProperty(s)&&(e[s]=t[s]),e),{})}let P=x.setTimeout,q=x.clearTimeout;function U(t,e){e.useNativeTimers?(t.setTimeoutFn=P.bind(x),t.clearTimeoutFn=q.bind(x)):(t.setTimeoutFn=x.setTimeout.bind(x),t.clearTimeoutFn=x.clearTimeout.bind(x))}function j(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class I extends Error{constructor(t,e,s){super(t),this.description=e,this.context=s,this.type="TransportError"}}class D extends S{constructor(t){super(),this.writable=!1,U(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,s){return super.emitReserved("error",new I(t,e,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=A(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return -1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){let e=function(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}(t);return e.length?"?"+e:""}}class M extends D{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||e()})),this.writable||(t++,this.once("drain",function(){--t||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)};((t,e)=>{let s=t.split("\x1e"),r=[];for(let t=0;t<s.length;t++){let i=A(s[t],e);if(r.push(i),"error"===i.type)break}return r})(t,this.socket.binaryType).forEach(e),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){var e;let s,r,i;this.writable=!1,e=t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})},r=Array(s=t.length),i=0,t.forEach((t,n)=>{b(t,!1,t=>{r[n]=t,++i===s&&e(r.join("\x1e"))})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=j()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}}let F=!1;try{F="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}let V=F;function H(){}class K extends M{constructor(t){if(super(t),"undefined"!=typeof location){const e="https:"===location.protocol;let s=location.port;s||(s=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,e){let s=this.request({method:"POST",data:t});s.on("success",e),s.on("error",(t,e)=>{this.onError("xhr post error",t,e)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(t,e)=>{this.onError("xhr poll error",t,e)}),this.pollXhr=t}}class W extends S{constructor(t,e,s){super(),this.createRequest=t,U(this,s),this._opts=s,this._method=s.method||"GET",this._uri=e,this._data=void 0!==s.data?s.data:null,this._create()}_create(){var t;let e=L(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(e);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let t in s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(t)&&s.setRequestHeader(t,this._opts.extraHeaders[t])}catch(t){}if("POST"===this._method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{s.setRequestHeader("Accept","*/*")}catch(t){}null==(t=this._opts.cookieJar)||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var t;3===s.readyState&&(null==(t=this._opts.cookieJar)||t.parseCookies(s.getResponseHeader("set-cookie"))),4===s.readyState&&(200===s.status||1223===s.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof s.status?s.status:0)},0))},s.send(this._data)}catch(t){this.setTimeoutFn(()=>{this._onError(t)},0);return}"undefined"!=typeof document&&(this._index=W.requestsCount++,W.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=H,t)try{this._xhr.abort()}catch(t){}"undefined"!=typeof document&&delete W.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function Y(){for(let t in W.requests)W.requests.hasOwnProperty(t)&&W.requests[t].abort()}W.requestsCount=0,W.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",Y):"function"==typeof addEventListener&&addEventListener("onpagehide"in x?"pagehide":"unload",Y,!1));let z=(r=J({xdomain:!1}))&&null!==r.responseType;function J(t){let e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||V))return new XMLHttpRequest}catch(t){}if(!e)try{return new x[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}let $="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class X extends D{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,s=$?{}:L(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,s)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;b(s,this.supportsBinary,t=>{try{this.doWrite(s,t)}catch(t){}r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=j()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}}let Q=x.WebSocket||x.MozWebSocket,G={websocket:class extends X{createSocket(t,e,s){return $?new Q(t,e,s):e?new Q(t,e):new Q(t)}doWrite(t,e){this.ws.send(e)}},webtransport:class extends D{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{var r,i;let n,o,a,h,c=(r=Number.MAX_SAFE_INTEGER,i=this.socket.binaryType,s||(s=new TextDecoder),n=[],o=0,a=-1,h=!1,new TransformStream({transform(t,e){for(n.push(t);;){if(0===o){if(1>C(n))break;let t=B(n,1);h=(128&t[0])==128,o=(a=127&t[0])<126?3:126===a?1:2}else if(1===o){if(2>C(n))break;let t=B(n,2);a=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),o=3}else if(2===o){if(8>C(n))break;let t=B(n,8),s=new DataView(t.buffer,t.byteOffset,t.length),r=s.getUint32(0);if(r>2097151){e.enqueue(y);break}a=0x100000000*r+s.getUint32(4),o=3}else{if(C(n)<a)break;let t=B(n,a);e.enqueue(A(h?t:s.decode(t),i)),o=0}if(0===a||a>r){e.enqueue(y);break}}}})),l=t.readable.pipeThrough(c).getReader(),u=new TransformStream({transform(t,s){var r;r=e=>{let r,i=e.length;if(i<126)new DataView((r=new Uint8Array(1)).buffer).setUint8(0,i);else if(i<65536){let t=new DataView((r=new Uint8Array(3)).buffer);t.setUint8(0,126),t.setUint16(1,i)}else{let t=new DataView((r=new Uint8Array(9)).buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(i))}t.data&&"string"!=typeof t.data&&(r[0]|=128),s.enqueue(r),s.enqueue(e)},g&&t.data instanceof Blob?t.data.arrayBuffer().then(k).then(r):m&&(t.data instanceof ArrayBuffer||_(t.data))?r(k(t.data)):b(t,!1,t=>{e||(e=new TextEncoder),r(e.encode(t))})}});u.readable.pipeTo(t.writable),this._writer=u.writable.getWriter();let p=()=>{l.read().then(({done:t,value:e})=>{t||(this.onPacket(e),p())}).catch(t=>{})};p();let d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;this._writer.write(s).then(()=>{r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;null==(t=this._transport)||t.close()}},polling:class extends K{constructor(t){super(t);const e=t&&t.forceBase64;this.supportsBinary=z&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new W(J,this.uri(),t)}}},Z=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function te(t){var e,s;let r,i;if(t.length>8e3)throw"URI too long";let n=t,o=t.indexOf("["),a=t.indexOf("]");-1!=o&&-1!=a&&(t=t.substring(0,o)+t.substring(o,a).replace(/:/g,";")+t.substring(a,t.length));let h=Z.exec(t||""),c={},l=14;for(;l--;)c[tt[l]]=h[l]||"";return -1!=o&&-1!=a&&(c.source=n,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),r=(e=c.path).replace(/\/{2,9}/g,"/").split("/"),("/"==e.slice(0,1)||0===e.length)&&r.splice(0,1),"/"==e.slice(-1)&&r.splice(r.length-1,1),c.pathNames=r,s=c.query,i={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,s){e&&(i[e]=s)}),c.queryKey=i,c}let ts="function"==typeof addEventListener&&"function"==typeof removeEventListener,tr=[];ts&&addEventListener("offline",()=>{tr.forEach(t=>t())},!1);class ti extends S{constructor(t,e){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&"object"==typeof t&&(e=t,t=null),t){const s=te(t);e.hostname=s.host,e.secure="https"===s.protocol||"wss"===s.protocol,e.port=s.port,s.query&&(e.query=s.query)}else e.host&&(e.hostname=te(e.host).host);U(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(t=>{let e=t.prototype.name;this.transports.push(e),this._transportsByName[e]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},s=t.split("&");for(let t=0,r=s.length;t<r;t++){let r=s[t].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}(this.opts.query)),ts&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},tr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);let s=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let t=this.opts.rememberUpgrade&&ti.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let e=this.createTransport(t);e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ti.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let e=Error("server error");e.code=t.data,this._onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let e=0;e<this.writeBuffer.length;e++){let s=this.writeBuffer[e].data;if(s&&(t+="string"==typeof s?function(t){let e=0,s=0;for(let r=0,i=t.length;r<i;r++)(e=t.charCodeAt(r))<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(r++,s+=4);return s}(s):Math.ceil(1.33*(s.byteLength||s.size))),e>0&&t>this._maxPayload)return this.writeBuffer.slice(0,e);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,e,s){return this._sendPacket("message",t,e,s),this}send(t,e,s){return this._sendPacket("message",t,e,s),this}_sendPacket(t,e,s,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof s&&(r=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;let i={type:t,data:e,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ti.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ts&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let t=tr.indexOf(this._offlineEventListener);-1!==t&&tr.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this._prevBufferLen=0}}}ti.protocol=4;class tn extends ti{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),s=!1;ti.priorWebsocketSuccess=!1;let r=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",t=>{if(!s)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;ti.priorWebsocketSuccess="websocket"===e.name,this.transport.pause(()=>{s||"closed"!==this.readyState&&(c(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let t=Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}}))};function i(){s||(s=!0,c(),e.close(),e=null)}let n=t=>{let s=Error("probe error: "+t);s.transport=e.name,i(),this.emitReserved("upgradeError",s)};function o(){n("transport closed")}function a(){n("socket closed")}function h(t){e&&t.name!==e.name&&i()}let c=()=>{e.removeListener("open",r),e.removeListener("error",n),e.removeListener("close",o),this.off("close",a),this.off("upgrading",h)};e.once("open",r),e.once("error",n),e.once("close",o),this.once("close",a),this.once("upgrading",h),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{s||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}class to extends tn{constructor(t,e={}){const s="object"==typeof t?t:e;(!s.transports||s.transports&&"string"==typeof s.transports[0])&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(t=>G[t]).filter(t=>!!t)),super(t,s)}}to.protocol;let ta="function"==typeof ArrayBuffer,th=Object.prototype.toString,tc="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===th.call(Blob),tl="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===th.call(File);function tu(t){return ta&&(t instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer))||tc&&t instanceof Blob||tl&&t instanceof File}let tp=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(i=n||(n={}))[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK";class td{constructor(t){this.replacer=t}encode(t){return(t.type===n.EVENT||t.type===n.ACK)&&function t(e,s){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let s=0,r=e.length;s<r;s++)if(t(e[s]))return!0;return!1}if(tu(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1==arguments.length)return t(e.toJSON(),!0);for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return!0;return!1}(t)?this.encodeAsBinary({type:t.type===n.EVENT?n.BINARY_EVENT:n.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===n.BINARY_EVENT||t.type===n.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e,s,r=(e=[],s=t.data,t.data=function t(e,s){if(!e)return e;if(tu(e)){let t={_placeholder:!0,num:s.length};return s.push(e),t}if(Array.isArray(e)){let r=Array(e.length);for(let i=0;i<e.length;i++)r[i]=t(e[i],s);return r}if("object"==typeof e&&!(e instanceof Date)){let r={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=t(e[i],s));return r}return e}(s,e),t.attachments=e.length,{packet:t,buffers:e}),i=this.encodeAsString(r.packet),n=r.buffers;return n.unshift(i),n}}class tf extends S{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let s=(e=this.decodeString(t)).type===n.BINARY_EVENT;s||e.type===n.BINARY_ACK?(e.type=s?n.EVENT:n.ACK,this.reconstructor=new ty(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(tu(t)||t.base64)if(this.reconstructor)(e=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+t)}decodeString(t){let e=0,s={type:Number(t.charAt(0))};if(void 0===n[s.type])throw Error("unknown packet type "+s.type);if(s.type===n.BINARY_EVENT||s.type===n.BINARY_ACK){let r=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);let i=t.substring(r,e);if(i!=Number(i)||"-"!==t.charAt(e))throw Error("Illegal attachments");s.attachments=Number(i)}if("/"===t.charAt(e+1)){let r=e+1;for(;++e&&","!==t.charAt(e)&&e!==t.length;);s.nsp=t.substring(r,e)}else s.nsp="/";let r=t.charAt(e+1);if(""!==r&&Number(r)==r){let r=e+1;for(;++e;){let s=t.charAt(e);if(null==s||Number(s)!=s){--e;break}if(e===t.length)break}s.id=Number(t.substring(r,e+1))}if(t.charAt(++e)){let r=this.tryParse(t.substr(e));if(tf.isPayloadValid(s.type,r))s.data=r;else throw Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case n.CONNECT:return tm(e);case n.DISCONNECT:return void 0===e;case n.CONNECT_ERROR:return"string"==typeof e||tm(e);case n.EVENT:case n.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===tp.indexOf(e[0]));case n.ACK:case n.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ty{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e,s;let t=(e=this.reconPack,s=this.buffers,e.data=function t(e,s){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<s.length)return s[e.num];throw Error("illegal attachments")}if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=t(e[r],s);else if("object"==typeof e)for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=t(e[r],s));return e}(e.data,s),delete e.attachments,e);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let tg=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t};function tm(t){return"[object Object]"===Object.prototype.toString.call(t)}function t_(t){var e;return"string"==typeof t.nsp&&(void 0===(e=t.id)||tg(e))&&function(t,e){switch(t){case n.CONNECT:return void 0===e||tm(e);case n.DISCONNECT:return void 0===e;case n.EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===tp.indexOf(e[0]));case n.ACK:return Array.isArray(e);case n.CONNECT_ERROR:return"string"==typeof e||tm(e);default:return!1}}(t.type,t.data)}function tb(t,e,s){return t.on(e,s),function(){t.off(e,s)}}t.s(["Decoder",()=>tf,"Encoder",()=>td,"PacketType",()=>n,"isPacketValid",()=>t_,"protocol",0,5],46262);let tv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tk extends S{constructor(t,e,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[tb(t,"open",this.onopen.bind(this)),tb(t,"packet",this.onpacket.bind(this)),tb(t,"error",this.onerror.bind(this)),tb(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var s,r,i;if(tv.hasOwnProperty(t))throw Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:n.EVENT,data:e};if(o.options={},o.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){let t=this.ids++,s=e.pop();this._registerAckCallback(t,s),o.id=t}let a=null==(r=null==(s=this.io.engine)?void 0:s.transport)?void 0:r.writable,h=this.connected&&!(null==(i=this.io.engine)?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,e){var s;let r=null!=(s=this.flags.timeout)?s:this._opts.ackTimeout;if(void 0===r){this.acks[t]=e;return}let i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,Error("operation has timed out"))},r),n=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,t)};n.withError=!0,this.acks[t]=n}emitWithAck(t,...e){return new Promise((s,r)=>{let i=(t,e)=>t?r(t):s(e);i.withError=!0,e.push(i),this.emit(t,...e)})}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((t,...r)=>{if(s===this._queue[0])return null!==t?s.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...r)),s.pending=!1,this._drainQueue()}),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;let e=this._queue[0];(!e.pending||t)&&(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:n.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){let e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case n.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case n.EVENT:case n.BINARY_EVENT:this.onevent(t);break;case n.ACK:case n.BINARY_ACK:this.onack(t);break;case n.DISCONNECT:this.ondisconnect();break;case n.CONNECT_ERROR:this.destroy();let e=Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){let e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length)for(let e of this._anyListeners.slice())e.apply(this,t);super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,s=!1;return function(...r){s||(s=!0,e.packet({type:n.ACK,id:t,data:r}))}}onack(t){let e=this.acks[t.id];"function"==typeof e&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:n.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let e of this._anyOutgoingListeners.slice())e.apply(this,t.data)}}var tw=t.i(46262);function tE(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}tE.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(1&Math.floor(10*e))==0?t-s:t+s}return 0|Math.min(t,this.max)},tE.prototype.reset=function(){this.attempts=0},tE.prototype.setMin=function(t){this.ms=t},tE.prototype.setMax=function(t){this.max=t},tE.prototype.setJitter=function(t){this.jitter=t};class tT extends S{constructor(t,e){var s;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,U(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(s=e.randomizationFactor)?s:.5),this.backoff=new tE({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const r=e.parser||tw;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null==(e=this.backoff)||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null==(e=this.backoff)||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null==(e=this.backoff)||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new to(this.uri,this.opts);let e=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let r=tb(e,"open",function(){s.onopen(),t&&t()}),i=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},n=tb(e,"error",i);if(!1!==this._timeout){let t=this._timeout,s=this.setTimeoutFn(()=>{r(),i(Error("timeout")),e.close()},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(r),this.subs.push(n),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(tb(t,"ping",this.onping.bind(this)),tb(t,"data",this.ondata.bind(this)),tb(t,"error",this.onerror.bind(this)),tb(t,"close",this.onclose.bind(this)),tb(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new tk(this,t,e),this.nsps[t]=s),s}_destroy(t){for(let t of Object.keys(this.nsps))if(this.nsps[t].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let s=0;s<e.length;s++)this.engine.write(e[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var s;this.cleanup(),null==(s=this.engine)||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()}))},e);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}let tA={};function tR(t,e){let s;"object"==typeof t&&(e=t,t=void 0);let r=function(t,e="",s){let r=t;s=s||"undefined"!=typeof location&&location,null==t&&(t=s.protocol+"//"+s.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?s.protocol+t:s.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==s?s.protocol+"//"+t:"https://"+t),r=te(t)),!r.port&&(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(s&&s.port===r.port?"":":"+r.port),r}(t,(e=e||{}).path||"/socket.io"),i=r.source,n=r.id,o=r.path,a=tA[n]&&o in tA[n].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||a?s=new tT(i,e):(tA[n]||(tA[n]=new tT(i,e)),s=tA[n]),r.query&&!e.query&&(e.query=r.queryKey),s.socket(r.path,e)}Object.assign(tR,{Manager:tT,Socket:tk,io:tR,connect:tR});let tO=t=>{let e=(0,a.useRef)(null);(0,a.useEffect)(()=>{e.current||(e.current=tR());let s=e.current;return s.on("reload",e=>{console.debug("Reloading..."),t(e)}),()=>{s.off()}},[t])};t.s(["useHotreload",0,tO],5248);let tC=(0,a.createContext)(void 0);t.s(["TemplatesProvider",0,t=>{let[e,s]=(0,a.useState)(t.initialTemplatesDirectoryMetadata);return u||p||tO(()=>{c(t.initialTemplatesDirectoryMetadata.absolutePath).then(t=>{if(t)s(t);else throw Error("Hot reloading: unable to find the templates directory to update the sidebar")})}),(0,o.jsx)(tC.Provider,{value:{templatesDirectoryMetadata:e},children:t.children})},"useTemplates",0,()=>{let t=(0,a.useContext)(tC);if(void 0===t)throw Error("Cannot call `useTemplates` outside of a `TemplatesContext` provider.");return t}],61863)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,96328,(t,e,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var r={callServer:function(){return n.callServer},createServerReference:function(){return a.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var i in r)Object.defineProperty(s,i,{enumerable:!0,get:r[i]});let n=t.r(54968),o=t.r(8865),a=t.r(36718)},61863,84928,5248,t=>{"use strict";let e,s,r;var i,n,o=t.i(90311),a=t.i(7749),h=t.i(96328);let c=(0,h.createServerReference)("78771297828582a56297020d3b0622a57014c4c245",h.callServer,void 0,h.findSourceMapURL,"getTemplatesDirectoryMetadataAction");var l=t.i(52154);l.default.env.USER_PROJECT_LOCATION,l.default.env.PREVIEW_SERVER_LOCATION,l.default.env.TEMPLATES_DIR_ABSOLUTE_PATH;let u="true"===l.default.env.NEXT_PUBLIC_IS_BUILDING,p="true"===l.default.env.NEXT_PUBLIC_IS_PREVIEW_DEVELOPMENT;t.s(["isBuilding",0,u,"isPreviewDevelopment",0,p],84928);let d=Object.create(null);d.open="0",d.close="1",d.ping="2",d.pong="3",d.message="4",d.upgrade="5",d.noop="6";let f=Object.create(null);Object.keys(d).forEach(t=>{f[d[t]]=t});let y={type:"error",data:"parser error"},g="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),m="function"==typeof ArrayBuffer,_=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,b=({type:t,data:e},s,r)=>{if(g&&e instanceof Blob)if(s)return r(e);else return v(e,r);if(m&&(e instanceof ArrayBuffer||_(e)))if(s)return r(e);else return v(new Blob([e]),r);return r(d[t]+(e||""))},v=(t,e)=>{let s=new FileReader;return s.onload=function(){e("b"+(s.result.split(",")[1]||""))},s.readAsDataURL(t)};function k(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<w.length;t++)E[w.charCodeAt(t)]=t;let T="function"==typeof ArrayBuffer,A=(t,e)=>{if("string"!=typeof t)return{type:"message",data:O(t,e)};let s=t.charAt(0);return"b"===s?{type:"message",data:R(t.substring(1),e)}:f[s]?t.length>1?{type:f[s],data:t.substring(1)}:{type:f[s]}:y},R=(t,e)=>T?O((t=>{let e=.75*t.length,s=t.length,r,i=0,n,o,a,h;"="===t[t.length-1]&&(e--,"="===t[t.length-2]&&e--);let c=new ArrayBuffer(e),l=new Uint8Array(c);for(r=0;r<s;r+=4)n=E[t.charCodeAt(r)],o=E[t.charCodeAt(r+1)],a=E[t.charCodeAt(r+2)],h=E[t.charCodeAt(r+3)],l[i++]=n<<2|o>>4,l[i++]=(15&o)<<4|a>>2,l[i++]=(3&a)<<6|63&h;return c})(t),e):{base64:!0,data:t},O=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer;function C(t){return t.reduce((t,e)=>t+e.length,0)}function B(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),r=0;for(let i=0;i<e;i++)s[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),s}function S(t){if(t){var e=t;for(var s in S.prototype)e[s]=S.prototype[s];return e}}S.prototype.on=S.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},S.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this},S.prototype.off=S.prototype.removeListener=S.prototype.removeAllListeners=S.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<r.length;i++)if((s=r[i])===e||s.fn===e){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},S.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=Array(arguments.length-1),s=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(s){s=s.slice(0);for(var r=0,i=s.length;r<i;++r)s[r].apply(this,e)}return this},S.prototype.emitReserved=S.prototype.emit,S.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},S.prototype.hasListeners=function(t){return!!this.listeners(t).length};let N="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),x="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function L(t,...e){return e.reduce((e,s)=>(t.hasOwnProperty(s)&&(e[s]=t[s]),e),{})}let P=x.setTimeout,q=x.clearTimeout;function U(t,e){e.useNativeTimers?(t.setTimeoutFn=P.bind(x),t.clearTimeoutFn=q.bind(x)):(t.setTimeoutFn=x.setTimeout.bind(x),t.clearTimeoutFn=x.clearTimeout.bind(x))}function j(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class I extends Error{constructor(t,e,s){super(t),this.description=e,this.context=s,this.type="TransportError"}}class D extends S{constructor(t){super(),this.writable=!1,U(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,s){return super.emitReserved("error",new I(t,e,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=A(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return -1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){let e=function(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}(t);return e.length?"?"+e:""}}class M extends D{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||e()})),this.writable||(t++,this.once("drain",function(){--t||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)};((t,e)=>{let s=t.split("\x1e"),r=[];for(let t=0;t<s.length;t++){let i=A(s[t],e);if(r.push(i),"error"===i.type)break}return r})(t,this.socket.binaryType).forEach(e),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){var e;let s,r,i;this.writable=!1,e=t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})},r=Array(s=t.length),i=0,t.forEach((t,n)=>{b(t,!1,t=>{r[n]=t,++i===s&&e(r.join("\x1e"))})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=j()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}}let F=!1;try{F="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}let V=F;function H(){}class K extends M{constructor(t){if(super(t),"undefined"!=typeof location){const e="https:"===location.protocol;let s=location.port;s||(s=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,e){let s=this.request({method:"POST",data:t});s.on("success",e),s.on("error",(t,e)=>{this.onError("xhr post error",t,e)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(t,e)=>{this.onError("xhr poll error",t,e)}),this.pollXhr=t}}class W extends S{constructor(t,e,s){super(),this.createRequest=t,U(this,s),this._opts=s,this._method=s.method||"GET",this._uri=e,this._data=void 0!==s.data?s.data:null,this._create()}_create(){var t;let e=L(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(e);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let t in s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(t)&&s.setRequestHeader(t,this._opts.extraHeaders[t])}catch(t){}if("POST"===this._method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{s.setRequestHeader("Accept","*/*")}catch(t){}null==(t=this._opts.cookieJar)||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var t;3===s.readyState&&(null==(t=this._opts.cookieJar)||t.parseCookies(s.getResponseHeader("set-cookie"))),4===s.readyState&&(200===s.status||1223===s.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof s.status?s.status:0)},0))},s.send(this._data)}catch(t){this.setTimeoutFn(()=>{this._onError(t)},0);return}"undefined"!=typeof document&&(this._index=W.requestsCount++,W.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=H,t)try{this._xhr.abort()}catch(t){}"undefined"!=typeof document&&delete W.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function Y(){for(let t in W.requests)W.requests.hasOwnProperty(t)&&W.requests[t].abort()}W.requestsCount=0,W.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",Y):"function"==typeof addEventListener&&addEventListener("onpagehide"in x?"pagehide":"unload",Y,!1));let z=(r=J({xdomain:!1}))&&null!==r.responseType;function J(t){let e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||V))return new XMLHttpRequest}catch(t){}if(!e)try{return new x[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}let $="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class X extends D{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,s=$?{}:L(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,s)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;b(s,this.supportsBinary,t=>{try{this.doWrite(s,t)}catch(t){}r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=j()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}}let Q=x.WebSocket||x.MozWebSocket,G={websocket:class extends X{createSocket(t,e,s){return $?new Q(t,e,s):e?new Q(t,e):new Q(t)}doWrite(t,e){this.ws.send(e)}},webtransport:class extends D{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{var r,i;let n,o,a,h,c=(r=Number.MAX_SAFE_INTEGER,i=this.socket.binaryType,s||(s=new TextDecoder),n=[],o=0,a=-1,h=!1,new TransformStream({transform(t,e){for(n.push(t);;){if(0===o){if(1>C(n))break;let t=B(n,1);h=(128&t[0])==128,o=(a=127&t[0])<126?3:126===a?1:2}else if(1===o){if(2>C(n))break;let t=B(n,2);a=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),o=3}else if(2===o){if(8>C(n))break;let t=B(n,8),s=new DataView(t.buffer,t.byteOffset,t.length),r=s.getUint32(0);if(r>2097151){e.enqueue(y);break}a=0x100000000*r+s.getUint32(4),o=3}else{if(C(n)<a)break;let t=B(n,a);e.enqueue(A(h?t:s.decode(t),i)),o=0}if(0===a||a>r){e.enqueue(y);break}}}})),l=t.readable.pipeThrough(c).getReader(),u=new TransformStream({transform(t,s){var r;r=e=>{let r,i=e.length;if(i<126)new DataView((r=new Uint8Array(1)).buffer).setUint8(0,i);else if(i<65536){let t=new DataView((r=new Uint8Array(3)).buffer);t.setUint8(0,126),t.setUint16(1,i)}else{let t=new DataView((r=new Uint8Array(9)).buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(i))}t.data&&"string"!=typeof t.data&&(r[0]|=128),s.enqueue(r),s.enqueue(e)},g&&t.data instanceof Blob?t.data.arrayBuffer().then(k).then(r):m&&(t.data instanceof ArrayBuffer||_(t.data))?r(k(t.data)):b(t,!1,t=>{e||(e=new TextEncoder),r(e.encode(t))})}});u.readable.pipeTo(t.writable),this._writer=u.writable.getWriter();let p=()=>{l.read().then(({done:t,value:e})=>{t||(this.onPacket(e),p())}).catch(t=>{})};p();let d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;this._writer.write(s).then(()=>{r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;null==(t=this._transport)||t.close()}},polling:class extends K{constructor(t){super(t);const e=t&&t.forceBase64;this.supportsBinary=z&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new W(J,this.uri(),t)}}},Z=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function te(t){var e,s;let r,i;if(t.length>8e3)throw"URI too long";let n=t,o=t.indexOf("["),a=t.indexOf("]");-1!=o&&-1!=a&&(t=t.substring(0,o)+t.substring(o,a).replace(/:/g,";")+t.substring(a,t.length));let h=Z.exec(t||""),c={},l=14;for(;l--;)c[tt[l]]=h[l]||"";return -1!=o&&-1!=a&&(c.source=n,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),r=(e=c.path).replace(/\/{2,9}/g,"/").split("/"),("/"==e.slice(0,1)||0===e.length)&&r.splice(0,1),"/"==e.slice(-1)&&r.splice(r.length-1,1),c.pathNames=r,s=c.query,i={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,s){e&&(i[e]=s)}),c.queryKey=i,c}let ts="function"==typeof addEventListener&&"function"==typeof removeEventListener,tr=[];ts&&addEventListener("offline",()=>{tr.forEach(t=>t())},!1);class ti extends S{constructor(t,e){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&"object"==typeof t&&(e=t,t=null),t){const s=te(t);e.hostname=s.host,e.secure="https"===s.protocol||"wss"===s.protocol,e.port=s.port,s.query&&(e.query=s.query)}else e.host&&(e.hostname=te(e.host).host);U(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(t=>{let e=t.prototype.name;this.transports.push(e),this._transportsByName[e]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},s=t.split("&");for(let t=0,r=s.length;t<r;t++){let r=s[t].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}(this.opts.query)),ts&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},tr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);let s=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let t=this.opts.rememberUpgrade&&ti.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let e=this.createTransport(t);e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ti.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let e=Error("server error");e.code=t.data,this._onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let e=0;e<this.writeBuffer.length;e++){let s=this.writeBuffer[e].data;if(s&&(t+="string"==typeof s?function(t){let e=0,s=0;for(let r=0,i=t.length;r<i;r++)(e=t.charCodeAt(r))<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(r++,s+=4);return s}(s):Math.ceil(1.33*(s.byteLength||s.size))),e>0&&t>this._maxPayload)return this.writeBuffer.slice(0,e);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,e,s){return this._sendPacket("message",t,e,s),this}send(t,e,s){return this._sendPacket("message",t,e,s),this}_sendPacket(t,e,s,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof s&&(r=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;let i={type:t,data:e,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(ti.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ts&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let t=tr.indexOf(this._offlineEventListener);-1!==t&&tr.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this._prevBufferLen=0}}}ti.protocol=4;class tn extends ti{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),s=!1;ti.priorWebsocketSuccess=!1;let r=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",t=>{if(!s)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;ti.priorWebsocketSuccess="websocket"===e.name,this.transport.pause(()=>{s||"closed"!==this.readyState&&(c(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let t=Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}}))};function i(){s||(s=!0,c(),e.close(),e=null)}let n=t=>{let s=Error("probe error: "+t);s.transport=e.name,i(),this.emitReserved("upgradeError",s)};function o(){n("transport closed")}function a(){n("socket closed")}function h(t){e&&t.name!==e.name&&i()}let c=()=>{e.removeListener("open",r),e.removeListener("error",n),e.removeListener("close",o),this.off("close",a),this.off("upgrading",h)};e.once("open",r),e.once("error",n),e.once("close",o),this.once("close",a),this.once("upgrading",h),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{s||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}class to extends tn{constructor(t,e={}){const s="object"==typeof t?t:e;(!s.transports||s.transports&&"string"==typeof s.transports[0])&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(t=>G[t]).filter(t=>!!t)),super(t,s)}}to.protocol;let ta="function"==typeof ArrayBuffer,th=Object.prototype.toString,tc="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===th.call(Blob),tl="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===th.call(File);function tu(t){return ta&&(t instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer))||tc&&t instanceof Blob||tl&&t instanceof File}let tp=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(i=n||(n={}))[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK";class td{constructor(t){this.replacer=t}encode(t){return(t.type===n.EVENT||t.type===n.ACK)&&function t(e,s){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let s=0,r=e.length;s<r;s++)if(t(e[s]))return!0;return!1}if(tu(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1==arguments.length)return t(e.toJSON(),!0);for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return!0;return!1}(t)?this.encodeAsBinary({type:t.type===n.EVENT?n.BINARY_EVENT:n.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===n.BINARY_EVENT||t.type===n.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e,s,r=(e=[],s=t.data,t.data=function t(e,s){if(!e)return e;if(tu(e)){let t={_placeholder:!0,num:s.length};return s.push(e),t}if(Array.isArray(e)){let r=Array(e.length);for(let i=0;i<e.length;i++)r[i]=t(e[i],s);return r}if("object"==typeof e&&!(e instanceof Date)){let r={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=t(e[i],s));return r}return e}(s,e),t.attachments=e.length,{packet:t,buffers:e}),i=this.encodeAsString(r.packet),n=r.buffers;return n.unshift(i),n}}class tf extends S{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let s=(e=this.decodeString(t)).type===n.BINARY_EVENT;s||e.type===n.BINARY_ACK?(e.type=s?n.EVENT:n.ACK,this.reconstructor=new ty(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(tu(t)||t.base64)if(this.reconstructor)(e=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+t)}decodeString(t){let e=0,s={type:Number(t.charAt(0))};if(void 0===n[s.type])throw Error("unknown packet type "+s.type);if(s.type===n.BINARY_EVENT||s.type===n.BINARY_ACK){let r=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);let i=t.substring(r,e);if(i!=Number(i)||"-"!==t.charAt(e))throw Error("Illegal attachments");s.attachments=Number(i)}if("/"===t.charAt(e+1)){let r=e+1;for(;++e&&","!==t.charAt(e)&&e!==t.length;);s.nsp=t.substring(r,e)}else s.nsp="/";let r=t.charAt(e+1);if(""!==r&&Number(r)==r){let r=e+1;for(;++e;){let s=t.charAt(e);if(null==s||Number(s)!=s){--e;break}if(e===t.length)break}s.id=Number(t.substring(r,e+1))}if(t.charAt(++e)){let r=this.tryParse(t.substr(e));if(tf.isPayloadValid(s.type,r))s.data=r;else throw Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case n.CONNECT:return tm(e);case n.DISCONNECT:return void 0===e;case n.CONNECT_ERROR:return"string"==typeof e||tm(e);case n.EVENT:case n.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===tp.indexOf(e[0]));case n.ACK:case n.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ty{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e,s;let t=(e=this.reconPack,s=this.buffers,e.data=function t(e,s){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<s.length)return s[e.num];throw Error("illegal attachments")}if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=t(e[r],s);else if("object"==typeof e)for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=t(e[r],s));return e}(e.data,s),delete e.attachments,e);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let tg=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t};function tm(t){return"[object Object]"===Object.prototype.toString.call(t)}function t_(t){var e;return"string"==typeof t.nsp&&(void 0===(e=t.id)||tg(e))&&function(t,e){switch(t){case n.CONNECT:return void 0===e||tm(e);case n.DISCONNECT:return void 0===e;case n.EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===tp.indexOf(e[0]));case n.ACK:return Array.isArray(e);case n.CONNECT_ERROR:return"string"==typeof e||tm(e);default:return!1}}(t.type,t.data)}function tb(t,e,s){return t.on(e,s),function(){t.off(e,s)}}t.s(["Decoder",()=>tf,"Encoder",()=>td,"PacketType",()=>n,"isPacketValid",()=>t_,"protocol",0,5],46262);let tv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tk extends S{constructor(t,e,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[tb(t,"open",this.onopen.bind(this)),tb(t,"packet",this.onpacket.bind(this)),tb(t,"error",this.onerror.bind(this)),tb(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var s,r,i;if(tv.hasOwnProperty(t))throw Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:n.EVENT,data:e};if(o.options={},o.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){let t=this.ids++,s=e.pop();this._registerAckCallback(t,s),o.id=t}let a=null==(r=null==(s=this.io.engine)?void 0:s.transport)?void 0:r.writable,h=this.connected&&!(null==(i=this.io.engine)?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,e){var s;let r=null!=(s=this.flags.timeout)?s:this._opts.ackTimeout;if(void 0===r){this.acks[t]=e;return}let i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,Error("operation has timed out"))},r),n=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,t)};n.withError=!0,this.acks[t]=n}emitWithAck(t,...e){return new Promise((s,r)=>{let i=(t,e)=>t?r(t):s(e);i.withError=!0,e.push(i),this.emit(t,...e)})}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((t,...r)=>{if(s===this._queue[0])return null!==t?s.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...r)),s.pending=!1,this._drainQueue()}),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;let e=this._queue[0];(!e.pending||t)&&(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:n.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){let e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case n.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case n.EVENT:case n.BINARY_EVENT:this.onevent(t);break;case n.ACK:case n.BINARY_ACK:this.onack(t);break;case n.DISCONNECT:this.ondisconnect();break;case n.CONNECT_ERROR:this.destroy();let e=Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){let e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length)for(let e of this._anyListeners.slice())e.apply(this,t);super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,s=!1;return function(...r){s||(s=!0,e.packet({type:n.ACK,id:t,data:r}))}}onack(t){let e=this.acks[t.id];"function"==typeof e&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:n.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let e of this._anyOutgoingListeners.slice())e.apply(this,t.data)}}var tw=t.i(46262);function tE(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}tE.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(1&Math.floor(10*e))==0?t-s:t+s}return 0|Math.min(t,this.max)},tE.prototype.reset=function(){this.attempts=0},tE.prototype.setMin=function(t){this.ms=t},tE.prototype.setMax=function(t){this.max=t},tE.prototype.setJitter=function(t){this.jitter=t};class tT extends S{constructor(t,e){var s;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,U(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(s=e.randomizationFactor)?s:.5),this.backoff=new tE({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const r=e.parser||tw;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null==(e=this.backoff)||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null==(e=this.backoff)||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null==(e=this.backoff)||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new to(this.uri,this.opts);let e=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let r=tb(e,"open",function(){s.onopen(),t&&t()}),i=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},n=tb(e,"error",i);if(!1!==this._timeout){let t=this._timeout,s=this.setTimeoutFn(()=>{r(),i(Error("timeout")),e.close()},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(r),this.subs.push(n),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(tb(t,"ping",this.onping.bind(this)),tb(t,"data",this.ondata.bind(this)),tb(t,"error",this.onerror.bind(this)),tb(t,"close",this.onclose.bind(this)),tb(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new tk(this,t,e),this.nsps[t]=s),s}_destroy(t){for(let t of Object.keys(this.nsps))if(this.nsps[t].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let s=0;s<e.length;s++)this.engine.write(e[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var s;this.cleanup(),null==(s=this.engine)||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()}))},e);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}let tA={};function tR(t,e){let s;"object"==typeof t&&(e=t,t=void 0);let r=function(t,e="",s){let r=t;s=s||"undefined"!=typeof location&&location,null==t&&(t=s.protocol+"//"+s.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?s.protocol+t:s.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==s?s.protocol+"//"+t:"https://"+t),r=te(t)),!r.port&&(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(s&&s.port===r.port?"":":"+r.port),r}(t,(e=e||{}).path||"/socket.io"),i=r.source,n=r.id,o=r.path,a=tA[n]&&o in tA[n].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||a?s=new tT(i,e):(tA[n]||(tA[n]=new tT(i,e)),s=tA[n]),r.query&&!e.query&&(e.query=r.queryKey),s.socket(r.path,e)}Object.assign(tR,{Manager:tT,Socket:tk,io:tR,connect:tR});let tO=t=>{let e=(0,a.useRef)(null);(0,a.useEffect)(()=>{e.current||(e.current=tR());let s=e.current;return s.on("reload",e=>{console.debug("Reloading..."),t(e)}),()=>{s.off()}},[t])};t.s(["useHotreload",0,tO],5248);let tC=(0,a.createContext)(void 0);t.s(["TemplatesProvider",0,t=>{let[e,s]=(0,a.useState)(t.initialTemplatesDirectoryMetadata);return u||p||tO(()=>{c(t.initialTemplatesDirectoryMetadata.absolutePath).then(t=>{if(t)s(t);else throw Error("Hot reloading: unable to find the templates directory to update the sidebar")})}),(0,o.jsx)(tC.Provider,{value:{templatesDirectoryMetadata:e},children:t.children})},"useTemplates",0,()=>{let t=(0,a.useContext)(tC);if(void 0===t)throw Error("Cannot call `useTemplates` outside of a `TemplatesContext` provider.");return t}],61863)}]);
package/.next/trace CHANGED
@@ -1 +1 @@
1
- [{"name":"generate-buildid","duration":203,"timestamp":77725620,"id":4,"parentId":1,"tags":{},"startTime":1766836137836,"traceId":"c8e16ec65addc78b"},{"name":"load-custom-routes","duration":345,"timestamp":77725928,"id":5,"parentId":1,"tags":{},"startTime":1766836137837,"traceId":"c8e16ec65addc78b"},{"name":"create-dist-dir","duration":677,"timestamp":77726298,"id":6,"parentId":1,"tags":{},"startTime":1766836137837,"traceId":"c8e16ec65addc78b"},{"name":"clean","duration":222,"timestamp":77727570,"id":7,"parentId":1,"tags":{},"startTime":1766836137838,"traceId":"c8e16ec65addc78b"},{"name":"create-pages-mapping","duration":194,"timestamp":77807338,"id":8,"parentId":1,"tags":{},"startTime":1766836137918,"traceId":"c8e16ec65addc78b"},{"name":"collect-app-files","duration":2316,"timestamp":77807564,"id":9,"parentId":1,"tags":{},"startTime":1766836137918,"traceId":"c8e16ec65addc78b"},{"name":"create-app-mapping","duration":2604,"timestamp":77809903,"id":10,"parentId":1,"tags":{},"startTime":1766836137921,"traceId":"c8e16ec65addc78b"},{"name":"create-app-layouts","duration":125,"timestamp":77812534,"id":11,"parentId":1,"tags":{},"startTime":1766836137923,"traceId":"c8e16ec65addc78b"},{"name":"collect-default-files","duration":508,"timestamp":77814288,"id":13,"parentId":1,"tags":{},"startTime":1766836137925,"traceId":"c8e16ec65addc78b"},{"name":"generate-route-types","duration":11172,"timestamp":77813809,"id":12,"parentId":1,"tags":{},"startTime":1766836137925,"traceId":"c8e16ec65addc78b"},{"name":"public-dir-conflict-check","duration":89,"timestamp":77824999,"id":14,"parentId":1,"tags":{},"startTime":1766836137936,"traceId":"c8e16ec65addc78b"},{"name":"generate-routes-manifest","duration":1916,"timestamp":77825147,"id":15,"parentId":1,"tags":{},"startTime":1766836137936,"traceId":"c8e16ec65addc78b"},{"name":"run-turbopack","duration":6481512,"timestamp":77830127,"id":17,"parentId":1,"tags":{},"startTime":1766836137941,"traceId":"c8e16ec65addc78b"},{"name":"run-typescript","duration":4232265,"timestamp":84326790,"id":19,"parentId":1,"tags":{},"startTime":1766836144438,"traceId":"c8e16ec65addc78b"},{"name":"generate-required-server-files","duration":1974,"timestamp":88559645,"id":21,"parentId":1,"tags":{},"startTime":1766836148671,"traceId":"c8e16ec65addc78b"},{"name":"check-static-error-page","duration":2417,"timestamp":88613520,"id":23,"parentId":22,"tags":{},"startTime":1766836148724,"traceId":"c8e16ec65addc78b"},{"name":"is-page-static","duration":248225,"timestamp":88619489,"id":30,"parentId":25,"tags":{},"startTime":1766836148730,"traceId":"c8e16ec65addc78b"},{"name":"check-page","duration":252286,"timestamp":88615536,"id":25,"parentId":22,"tags":{"page":"/_global-error"},"startTime":1766836148726,"traceId":"c8e16ec65addc78b"},{"name":"is-page-static","duration":308292,"timestamp":88619199,"id":29,"parentId":24,"tags":{},"startTime":1766836148730,"traceId":"c8e16ec65addc78b"},{"name":"check-page","duration":313025,"timestamp":88614519,"id":24,"parentId":22,"tags":{"page":"/_not-found"},"startTime":1766836148725,"traceId":"c8e16ec65addc78b"},{"name":"is-page-static","duration":329330,"timestamp":88619594,"id":31,"parentId":26,"tags":{},"startTime":1766836148730,"traceId":"c8e16ec65addc78b"},{"name":"check-page","duration":333264,"timestamp":88615721,"id":26,"parentId":22,"tags":{"page":"/favicon.ico"},"startTime":1766836148727,"traceId":"c8e16ec65addc78b"},{"name":"is-page-static","duration":332295,"timestamp":88626497,"id":32,"parentId":27,"tags":{},"startTime":1766836148737,"traceId":"c8e16ec65addc78b"},{"name":"check-page","duration":343037,"timestamp":88615798,"id":27,"parentId":22,"tags":{"page":"/"},"startTime":1766836148727,"traceId":"c8e16ec65addc78b"},{"name":"is-page-static","duration":376604,"timestamp":88626850,"id":33,"parentId":28,"tags":{},"startTime":1766836148738,"traceId":"c8e16ec65addc78b"},{"name":"check-page","duration":387641,"timestamp":88615865,"id":28,"parentId":22,"tags":{"page":"/preview/[...slug]"},"startTime":1766836148727,"traceId":"c8e16ec65addc78b"},{"name":"static-check","duration":390745,"timestamp":88612781,"id":22,"parentId":1,"tags":{},"startTime":1766836148724,"traceId":"c8e16ec65addc78b"},{"name":"write-routes-manifest","duration":280,"timestamp":89004138,"id":35,"parentId":1,"tags":{},"startTime":1766836149115,"traceId":"c8e16ec65addc78b"},{"name":"load-dotenv","duration":49,"timestamp":89012190,"id":38,"parentId":37,"tags":{},"startTime":1766836149123,"traceId":"c8e16ec65addc78b"},{"name":"run-export-path-map","duration":287,"timestamp":89014138,"id":39,"parentId":37,"tags":{},"startTime":1766836149125,"traceId":"c8e16ec65addc78b"},{"name":"next-export","duration":96369,"timestamp":89011302,"id":37,"parentId":1,"tags":{},"startTime":1766836149122,"traceId":"c8e16ec65addc78b"},{"name":"move-exported-app-global-error-","duration":463,"timestamp":89108776,"id":40,"parentId":36,"tags":{},"startTime":1766836149220,"traceId":"c8e16ec65addc78b"},{"name":"static-generation","duration":103260,"timestamp":89007305,"id":36,"parentId":1,"tags":{},"startTime":1766836149118,"traceId":"c8e16ec65addc78b"},{"name":"write-routes-manifest","duration":255,"timestamp":89110704,"id":41,"parentId":1,"tags":{},"startTime":1766836149222,"traceId":"c8e16ec65addc78b"},{"name":"print-tree-view","duration":2137,"timestamp":89115274,"id":42,"parentId":1,"tags":{},"startTime":1766836149226,"traceId":"c8e16ec65addc78b"},{"name":"telemetry-flush","duration":86092,"timestamp":89117421,"id":43,"parentId":1,"tags":{},"startTime":1766836149228,"traceId":"c8e16ec65addc78b"},{"name":"next-build","duration":11500391,"timestamp":77703143,"id":1,"tags":{"buildMode":"default","version":"16.1.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1766836137814,"traceId":"c8e16ec65addc78b"}]
1
+ [{"name":"generate-buildid","duration":222,"timestamp":499701713,"id":4,"parentId":1,"tags":{},"startTime":1766915739062,"traceId":"c090be9b015c23c9"},{"name":"load-custom-routes","duration":311,"timestamp":499702073,"id":5,"parentId":1,"tags":{},"startTime":1766915739062,"traceId":"c090be9b015c23c9"},{"name":"create-dist-dir","duration":626,"timestamp":499702409,"id":6,"parentId":1,"tags":{},"startTime":1766915739062,"traceId":"c090be9b015c23c9"},{"name":"clean","duration":231,"timestamp":499703624,"id":7,"parentId":1,"tags":{},"startTime":1766915739063,"traceId":"c090be9b015c23c9"},{"name":"create-pages-mapping","duration":195,"timestamp":499752474,"id":8,"parentId":1,"tags":{},"startTime":1766915739112,"traceId":"c090be9b015c23c9"},{"name":"collect-app-files","duration":2373,"timestamp":499752707,"id":9,"parentId":1,"tags":{},"startTime":1766915739113,"traceId":"c090be9b015c23c9"},{"name":"create-app-mapping","duration":2773,"timestamp":499755103,"id":10,"parentId":1,"tags":{},"startTime":1766915739115,"traceId":"c090be9b015c23c9"},{"name":"create-app-layouts","duration":174,"timestamp":499757899,"id":11,"parentId":1,"tags":{},"startTime":1766915739118,"traceId":"c090be9b015c23c9"},{"name":"collect-default-files","duration":606,"timestamp":499759738,"id":13,"parentId":1,"tags":{},"startTime":1766915739120,"traceId":"c090be9b015c23c9"},{"name":"generate-route-types","duration":19018,"timestamp":499759271,"id":12,"parentId":1,"tags":{},"startTime":1766915739119,"traceId":"c090be9b015c23c9"},{"name":"public-dir-conflict-check","duration":81,"timestamp":499778308,"id":14,"parentId":1,"tags":{},"startTime":1766915739138,"traceId":"c090be9b015c23c9"},{"name":"generate-routes-manifest","duration":2015,"timestamp":499778447,"id":15,"parentId":1,"tags":{},"startTime":1766915739138,"traceId":"c090be9b015c23c9"},{"name":"run-turbopack","duration":6428990,"timestamp":499783481,"id":17,"parentId":1,"tags":{},"startTime":1766915739143,"traceId":"c090be9b015c23c9"},{"name":"run-typescript","duration":4266171,"timestamp":506217539,"id":19,"parentId":1,"tags":{},"startTime":1766915745577,"traceId":"c090be9b015c23c9"},{"name":"generate-required-server-files","duration":2010,"timestamp":510484323,"id":21,"parentId":1,"tags":{},"startTime":1766915749844,"traceId":"c090be9b015c23c9"},{"name":"check-static-error-page","duration":4381,"timestamp":510523481,"id":23,"parentId":22,"tags":{},"startTime":1766915749883,"traceId":"c090be9b015c23c9"},{"name":"is-page-static","duration":239622,"timestamp":510531299,"id":29,"parentId":25,"tags":{},"startTime":1766915749891,"traceId":"c090be9b015c23c9"},{"name":"check-page","duration":243539,"timestamp":510527502,"id":25,"parentId":22,"tags":{"page":"/_global-error"},"startTime":1766915749887,"traceId":"c090be9b015c23c9"},{"name":"is-page-static","duration":303468,"timestamp":510540470,"id":32,"parentId":27,"tags":{},"startTime":1766915749900,"traceId":"c090be9b015c23c9"},{"name":"check-page","duration":316249,"timestamp":510527740,"id":27,"parentId":22,"tags":{"page":"/"},"startTime":1766915749888,"traceId":"c090be9b015c23c9"},{"name":"is-page-static","duration":332115,"timestamp":510539133,"id":31,"parentId":24,"tags":{},"startTime":1766915749899,"traceId":"c090be9b015c23c9"},{"name":"check-page","duration":346810,"timestamp":510524487,"id":24,"parentId":22,"tags":{"page":"/_not-found"},"startTime":1766915749884,"traceId":"c090be9b015c23c9"},{"name":"is-page-static","duration":341030,"timestamp":510531715,"id":30,"parentId":26,"tags":{},"startTime":1766915749892,"traceId":"c090be9b015c23c9"},{"name":"check-page","duration":345114,"timestamp":510527670,"id":26,"parentId":22,"tags":{"page":"/favicon.ico"},"startTime":1766915749888,"traceId":"c090be9b015c23c9"},{"name":"is-page-static","duration":367542,"timestamp":510540702,"id":33,"parentId":28,"tags":{},"startTime":1766915749901,"traceId":"c090be9b015c23c9"},{"name":"check-page","duration":380502,"timestamp":510527803,"id":28,"parentId":22,"tags":{"page":"/preview/[...slug]"},"startTime":1766915749888,"traceId":"c090be9b015c23c9"},{"name":"static-check","duration":385626,"timestamp":510522716,"id":22,"parentId":1,"tags":{},"startTime":1766915749883,"traceId":"c090be9b015c23c9"},{"name":"write-routes-manifest","duration":274,"timestamp":510909025,"id":35,"parentId":1,"tags":{},"startTime":1766915750269,"traceId":"c090be9b015c23c9"},{"name":"load-dotenv","duration":32,"timestamp":510917315,"id":38,"parentId":37,"tags":{},"startTime":1766915750277,"traceId":"c090be9b015c23c9"},{"name":"run-export-path-map","duration":300,"timestamp":510919075,"id":39,"parentId":37,"tags":{},"startTime":1766915750279,"traceId":"c090be9b015c23c9"},{"name":"next-export","duration":96483,"timestamp":510916409,"id":37,"parentId":1,"tags":{},"startTime":1766915750276,"traceId":"c090be9b015c23c9"},{"name":"move-exported-app-global-error-","duration":418,"timestamp":511013953,"id":40,"parentId":36,"tags":{},"startTime":1766915750374,"traceId":"c090be9b015c23c9"},{"name":"static-generation","duration":103276,"timestamp":510912339,"id":36,"parentId":1,"tags":{},"startTime":1766915750272,"traceId":"c090be9b015c23c9"},{"name":"write-routes-manifest","duration":231,"timestamp":511015765,"id":41,"parentId":1,"tags":{},"startTime":1766915750376,"traceId":"c090be9b015c23c9"},{"name":"print-tree-view","duration":2238,"timestamp":511020726,"id":42,"parentId":1,"tags":{},"startTime":1766915750381,"traceId":"c090be9b015c23c9"},{"name":"telemetry-flush","duration":45619,"timestamp":511022978,"id":43,"parentId":1,"tags":{},"startTime":1766915750383,"traceId":"c090be9b015c23c9"},{"name":"next-build","duration":11389561,"timestamp":499679054,"id":1,"tags":{"buildMode":"default","version":"16.1.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1766915739039,"traceId":"c090be9b015c23c9"}]
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-turbopack","duration":6481512,"timestamp":77830127,"id":17,"parentId":1,"tags":{},"startTime":1766836137941,"traceId":"c8e16ec65addc78b"},{"name":"run-typescript","duration":4232265,"timestamp":84326790,"id":19,"parentId":1,"tags":{},"startTime":1766836144438,"traceId":"c8e16ec65addc78b"},{"name":"static-check","duration":390745,"timestamp":88612781,"id":22,"parentId":1,"tags":{},"startTime":1766836148724,"traceId":"c8e16ec65addc78b"},{"name":"static-generation","duration":103260,"timestamp":89007305,"id":36,"parentId":1,"tags":{},"startTime":1766836149118,"traceId":"c8e16ec65addc78b"},{"name":"telemetry-flush","duration":86092,"timestamp":89117421,"id":43,"parentId":1,"tags":{},"startTime":1766836149228,"traceId":"c8e16ec65addc78b"},{"name":"next-build","duration":11500391,"timestamp":77703143,"id":1,"tags":{"buildMode":"default","version":"16.1.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1766836137814,"traceId":"c8e16ec65addc78b"}]
1
+ [{"name":"run-turbopack","duration":6428990,"timestamp":499783481,"id":17,"parentId":1,"tags":{},"startTime":1766915739143,"traceId":"c090be9b015c23c9"},{"name":"run-typescript","duration":4266171,"timestamp":506217539,"id":19,"parentId":1,"tags":{},"startTime":1766915745577,"traceId":"c090be9b015c23c9"},{"name":"static-check","duration":385626,"timestamp":510522716,"id":22,"parentId":1,"tags":{},"startTime":1766915749883,"traceId":"c090be9b015c23c9"},{"name":"static-generation","duration":103276,"timestamp":510912339,"id":36,"parentId":1,"tags":{},"startTime":1766915750272,"traceId":"c090be9b015c23c9"},{"name":"telemetry-flush","duration":45619,"timestamp":511022978,"id":43,"parentId":1,"tags":{},"startTime":1766915750383,"traceId":"c090be9b015c23c9"},{"name":"next-build","duration":11389561,"timestamp":499679054,"id":1,"tags":{"buildMode":"default","version":"16.1.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1766915739039,"traceId":"c090be9b015c23c9"}]
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @ahmedrowaihi/pdf-forge-preview
2
2
 
3
+ ## 1.0.0-canary.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 72a1a1c: fix placeholders
8
+ - Updated dependencies [72a1a1c]
9
+ - @ahmedrowaihi/pdf-forge-printer@1.0.0-canary.2
10
+
11
+ ## 1.0.0-canary.1
12
+
13
+ ### Patch Changes
14
+
15
+ - a41e209: include esbuild
16
+ - b50f142: fix .next esbuild
17
+ - 1065ca3: sharp, esbuild, offline assets and watarfall
18
+ - Updated dependencies [1065ca3]
19
+ - @ahmedrowaihi/pdf-forge-printer@1.0.0-canary.1
20
+
3
21
  ## 1.0.0-canary.0
4
22
 
5
23
  ### Major Changes
package/next.config.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  * @type {import('next').NextConfig}
3
3
  */
4
4
  const nextConfig = {
5
- serverExternalPackages: ['esbuild'],
5
+ serverExternalPackages: ['esbuild', 'sharp'],
6
6
  // Noticed an issue with typescript transpilation when going from Next 14.1.1 to 14.1.2
7
7
  // and I narrowed that down into this PR https://github.com/vercel/next.js/pull/62005
8
8
  //
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ahmedrowaihi/pdf-forge-preview",
3
- "version": "1.0.0-canary.0",
3
+ "version": "1.0.0-canary.2",
4
4
  "description": "A live preview of your PDF templates right in your browser.",
5
5
  "main": "./index.mjs",
6
6
  "dependencies": {
7
7
  "next": "^16",
8
- "@ahmedrowaihi/pdf-forge-printer": "1.0.0-canary.0"
8
+ "@ahmedrowaihi/pdf-forge-printer": "1.0.0-canary.2"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@babel/core": "7.26.10",
@@ -34,7 +34,6 @@
34
34
  "@types/webpack": "5.28.5",
35
35
  "clsx": "2.1.1",
36
36
  "colorjs.io": "0.5.2",
37
- "esbuild": "0.25.10",
38
37
  "framer-motion": "12.23.22",
39
38
  "log-symbols": "4.1.0",
40
39
  "module-punycode": "npm:punycode@2.3.1",
@@ -42,6 +41,7 @@
42
41
  "ora": "5.4.1",
43
42
  "@tailwindcss/postcss": "4.1.17",
44
43
  "postcss": "8.5.6",
44
+ "esbuild": "0.25.10",
45
45
  "prism-react-renderer": "2.4.1",
46
46
  "react": "^19",
47
47
  "react-dom": "^19",
@@ -55,8 +55,8 @@
55
55
  "typescript": "5.8.3",
56
56
  "use-debounce": "10.0.4",
57
57
  "zod": "4.1.12",
58
- "@ahmedrowaihi/pdf-forge-components": "1.0.0-canary.0",
59
- "@ahmedrowaihi/pdf-forge-core": "1.0.0-canary.0"
58
+ "@ahmedrowaihi/pdf-forge-components": "1.0.0-canary.2",
59
+ "@ahmedrowaihi/pdf-forge-core": "1.0.0-canary.2"
60
60
  },
61
61
  "license": "MIT",
62
62
  "repository": {
@@ -2,13 +2,85 @@
2
2
 
3
3
  import { PlaywrightPdfService } from '@ahmedrowaihi/pdf-forge-printer';
4
4
  import { z } from 'zod';
5
+ import { getAssetRegistry } from '../utils/asset-registry';
6
+ import { getTemplatePathFromSlug } from './get-template-path-from-slug';
7
+ import { renderTemplateByPath } from './render-template-by-path';
5
8
  import { baseActionClient } from './safe-action';
6
9
 
7
10
  const pdfService = new PlaywrightPdfService();
8
11
 
12
+ /**
13
+ * Process HTML to replace relative asset URLs with base64 data URIs using asset registry
14
+ *
15
+ * Performance: Uses in-memory cache (zero file I/O after first scan)
16
+ * Strategy: Multiple simple regex passes (faster than complex combined pattern)
17
+ *
18
+ * Why regex over AST?
19
+ * - Regex: ~1-5ms for 200KB HTML (simple string ops)
20
+ * - AST: ~25-80ms (parse + traverse + serialize overhead)
21
+ * - HTML is well-formed from React, so regex is safe and faster
22
+ */
23
+ function embedAssetsInHtml(
24
+ html: string,
25
+ assetRegistry: Map<string, string>,
26
+ ): string {
27
+ const getBase64 = (url: string): string | undefined => {
28
+ return (
29
+ assetRegistry.get(url) ||
30
+ assetRegistry.get(`/${url}`) ||
31
+ assetRegistry.get(url.slice(1))
32
+ );
33
+ };
34
+
35
+ const shouldSkip = (url: string): boolean => {
36
+ return (
37
+ url.startsWith('data:') ||
38
+ url.startsWith('http://') ||
39
+ url.startsWith('https://') ||
40
+ url.startsWith('#') ||
41
+ url.startsWith('mailto:') ||
42
+ url.startsWith('tel:')
43
+ );
44
+ };
45
+
46
+ let processedHtml = html;
47
+
48
+ // Pattern 1: CSS url() - matches url('/fonts/...') or url("/fonts/...")
49
+ processedHtml = processedHtml.replace(
50
+ /url\((['"]?)([^'")]+)\1\)/gi,
51
+ (match: string, quote: string, url: string) => {
52
+ if (shouldSkip(url)) return match;
53
+ const base64 = getBase64(url);
54
+ return base64 ? `url(${quote}${base64}${quote})` : match;
55
+ },
56
+ );
57
+
58
+ // Pattern 2: src attribute - matches src="/fonts/..." or src='/fonts/...'
59
+ processedHtml = processedHtml.replace(
60
+ /src\s*=\s*(['"])([^'"]+)\1/gi,
61
+ (match: string, quote: string, url: string) => {
62
+ if (shouldSkip(url)) return match;
63
+ const base64 = getBase64(url);
64
+ return base64 ? `src=${quote}${base64}${quote}` : match;
65
+ },
66
+ );
67
+
68
+ // Pattern 3: href attribute - matches href="/fonts/..." or href='/fonts/...'
69
+ processedHtml = processedHtml.replace(
70
+ /href\s*=\s*(['"])([^'"]+)\1/gi,
71
+ (match: string, quote: string, url: string) => {
72
+ if (shouldSkip(url)) return match;
73
+ const base64 = getBase64(url);
74
+ return base64 ? `href=${quote}${base64}${quote}` : match;
75
+ },
76
+ );
77
+
78
+ return processedHtml;
79
+ }
80
+
9
81
  /**
10
82
  * Export a single template as a PDF or HTML file.
11
- * Uses Playwright directly for PDF/screenshot generation.
83
+ * Renders the template on the server and bundles assets automatically.
12
84
  */
13
85
  export const exportSingleTemplate = baseActionClient
14
86
  .metadata({
@@ -16,59 +88,80 @@ export const exportSingleTemplate = baseActionClient
16
88
  })
17
89
  .inputSchema(
18
90
  z.object({
19
- name: z.string(),
20
- html: z.string(),
91
+ templateSlug: z.string(),
21
92
  format: z.enum(['html', 'pdf', 'screenshot']).default('html'),
22
93
  darkMode: z.boolean().optional(),
23
94
  }),
24
95
  )
25
96
  .action(async ({ parsedInput }) => {
26
- if (parsedInput.format === 'html') {
27
- // Return HTML content for client-side download
28
- return Promise.resolve({
29
- name: parsedInput.name,
30
- html: parsedInput.html,
31
- format: 'html' as const,
32
- status: 'succeeded' as const,
33
- });
34
- }
35
-
36
- // Use Playwright service directly for PDF or screenshot generation
37
97
  try {
98
+ const templatePath = await getTemplatePathFromSlug(
99
+ parsedInput.templateSlug,
100
+ );
101
+
102
+ const renderingResult = await renderTemplateByPath(templatePath);
103
+ if ('error' in renderingResult) {
104
+ throw new Error(
105
+ `Failed to render template: ${renderingResult.error.message}`,
106
+ );
107
+ }
108
+
109
+ let html = renderingResult.markup;
110
+
111
+ if (parsedInput.format !== 'html') {
112
+ const assetRegistry = await getAssetRegistry(templatePath);
113
+ html = embedAssetsInHtml(html, assetRegistry);
114
+ }
115
+
116
+ if (parsedInput.format === 'html') {
117
+ return {
118
+ name: renderingResult.basename,
119
+ html,
120
+ format: 'html' as const,
121
+ status: 'succeeded' as const,
122
+ };
123
+ }
124
+
38
125
  let buffer: Uint8Array;
39
126
  let mimeType: string;
40
127
 
41
128
  if (parsedInput.format === 'pdf') {
42
129
  buffer = await pdfService.render({
43
- html: parsedInput.html,
130
+ html,
44
131
  outputType: 'pdf',
45
132
  darkMode: parsedInput.darkMode,
46
133
  });
47
134
  mimeType = 'application/pdf';
48
135
  } else {
49
- // screenshot
50
136
  buffer = await pdfService.render({
51
- html: parsedInput.html,
137
+ html,
52
138
  outputType: 'screenshot',
53
139
  darkMode: parsedInput.darkMode,
140
+ sharpResizeOptions: {
141
+ width: 2480,
142
+ height: 3508,
143
+ fit: 'cover',
144
+ position: 'center',
145
+ kernel: 'lanczos3' as const,
146
+ withoutEnlargement: false,
147
+ },
54
148
  });
55
149
  mimeType = 'image/png';
56
150
  }
57
151
 
58
- // Convert Uint8Array to base64 for transmission
59
152
  const base64 = Buffer.from(buffer).toString('base64');
60
153
 
61
154
  return {
62
- name: parsedInput.name,
155
+ name: renderingResult.basename,
63
156
  data: base64,
64
157
  format: parsedInput.format,
65
158
  mimeType,
66
159
  status: 'succeeded' as const,
67
160
  };
68
161
  } catch (error) {
69
- console.error('PDF generation error:', error);
162
+ console.error('Template export error:', error);
70
163
  throw new Error(
71
- `Failed to generate ${parsedInput.format}. ${error instanceof Error ? error.message : 'Unknown error'}`,
164
+ `Failed to export template. ${error instanceof Error ? error.message : 'Unknown error'}`,
72
165
  );
73
166
  }
74
167
  });
@@ -10,7 +10,6 @@ import { cn } from '../../../utils';
10
10
 
11
11
  interface DownloadButtonProps {
12
12
  templateSlug: string;
13
- htmlMarkup: string;
14
13
  darkMode?: boolean;
15
14
  }
16
15
 
@@ -18,14 +17,11 @@ type ExportFormat = 'pdf' | 'screenshot';
18
17
 
19
18
  export const DownloadButton = ({
20
19
  templateSlug,
21
- htmlMarkup,
22
20
  darkMode = false,
23
21
  }: DownloadButtonProps) => {
24
22
  const [isLoadingPdf, setIsLoadingPdf] = useState(false);
25
23
  const [isLoadingScreenshot, setIsLoadingScreenshot] = useState(false);
26
24
 
27
- const templateName = templateSlug.replace(/\.[^/.]+$/, '');
28
-
29
25
  const handleOpen = async (format: ExportFormat) => {
30
26
  if (format === 'pdf') {
31
27
  setIsLoadingPdf(true);
@@ -35,8 +31,7 @@ export const DownloadButton = ({
35
31
 
36
32
  try {
37
33
  const result = await exportSingleTemplate({
38
- name: templateName,
39
- html: htmlMarkup,
34
+ templateSlug,
40
35
  format,
41
36
  darkMode,
42
37
  });
@@ -28,7 +28,8 @@ interface PreviewProps extends React.ComponentProps<'div'> {
28
28
  }
29
29
 
30
30
  const Preview = ({ templateTitle, className, ...props }: PreviewProps) => {
31
- const { renderingResult, renderedTemplateMetadata } = usePreviewContext();
31
+ const { renderingResult, renderedTemplateMetadata, templateSlug } =
32
+ usePreviewContext();
32
33
 
33
34
  const router = useRouter();
34
35
  const pathname = usePathname();
@@ -132,8 +133,7 @@ const Preview = ({ templateTitle, className, ...props }: PreviewProps) => {
132
133
  {hasRenderingMetadata ? (
133
134
  <div className="flex justify-end">
134
135
  <DownloadButton
135
- templateSlug={templateTitle}
136
- htmlMarkup={renderedTemplateMetadata.markup}
136
+ templateSlug={templateSlug}
137
137
  darkMode={isDarkModeEnabled}
138
138
  />
139
139
  </div>