@langgenius/nodwork-darwin-arm64 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/.env +4 -2
- package/payload/.env.example +7 -7
- package/payload/dist/chunk-BjEoQXZ0.js +3 -1
- package/payload/dist/cli.d.ts +2 -1
- package/payload/dist/cli.js +81 -78
- package/payload/dist/devtools-BlmLo7Xr.js +4 -1
- package/payload/dist/dist-CBEQIXzT.js +42 -0
- package/payload/dist/esm-tr7Ewvys.js +4 -1
- package/payload/dist/execAsync-BIjkAgah.js +4 -1
- package/payload/dist/execAsync-CPR512EA.js +4 -1
- package/payload/dist/execAsync-CnOzhlrf.js +4 -1
- package/payload/dist/execAsync-DQVy41gW.js +4 -1
- package/payload/dist/execAsync-vhOmnPjZ.js +4 -1
- package/payload/dist/getMachineId-bsd-BMAsH7qg.js +4 -1
- package/payload/dist/getMachineId-bsd-Bk6BAb01.js +4 -1
- package/payload/dist/getMachineId-bsd-BkRAvuSn.js +4 -1
- package/payload/dist/getMachineId-bsd-DfuvcX-U.js +4 -1
- package/payload/dist/getMachineId-bsd-DmI9CGb4.js +4 -1
- package/payload/dist/getMachineId-darwin-35YzSVNC.js +4 -1
- package/payload/dist/getMachineId-darwin-BCjooYuC.js +4 -1
- package/payload/dist/getMachineId-darwin-CtMD-SWJ.js +4 -1
- package/payload/dist/getMachineId-darwin-DNIo6LSV.js +4 -1
- package/payload/dist/getMachineId-darwin-DWnZdpTE.js +4 -1
- package/payload/dist/getMachineId-linux-1Qp6uUaE.js +4 -1
- package/payload/dist/getMachineId-linux-B_btxrTN.js +4 -1
- package/payload/dist/getMachineId-linux-C57LTlPy.js +4 -1
- package/payload/dist/getMachineId-linux-DglB2GdG.js +4 -1
- package/payload/dist/getMachineId-linux-icyJzh7l.js +4 -1
- package/payload/dist/getMachineId-unsupported-Bov1Lpgp.js +4 -1
- package/payload/dist/getMachineId-unsupported-DrK_WseJ.js +4 -1
- package/payload/dist/getMachineId-unsupported-MUYHbDrO.js +4 -1
- package/payload/dist/getMachineId-unsupported-VXYdQUK6.js +4 -1
- package/payload/dist/getMachineId-unsupported-qXR8iwed.js +4 -1
- package/payload/dist/getMachineId-win-AJwG-tUg.js +4 -1
- package/payload/dist/getMachineId-win-BNoB-fgM.js +4 -1
- package/payload/dist/getMachineId-win-C1zjfcvc.js +4 -1
- package/payload/dist/getMachineId-win-CcbWa3OH.js +4 -1
- package/payload/dist/getMachineId-win-DaQ2gd8n.js +4 -1
- package/payload/dist/{login_cycle-13KVh887-C5wDm6lw.js → login_cycle-13KVh887-CMYa1Xhr.js} +4 -1
- package/payload/dist/runtime_auth_helpers-etyYdhk_-4r56nasu.js +3 -0
- package/payload/dist/{runtime_auth_helpers-etyYdhk_-C1ZUGu8v.js → runtime_auth_helpers-etyYdhk_-CGPWxqBd.js} +4 -1
- package/payload/dist/status-B0HhS6E_-Bzj2KB_H.js +4 -1
- package/payload/package.json +1 -2
- package/payload/dist/dist-D-Wi6B-S.js +0 -39
- package/payload/dist/runtime_auth_helpers-etyYdhk_-MwfTPQoL.js +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="24018735-1456-5d3d-8e26-f3f00983f8b2")}catch(e){}}();
|
|
1
3
|
import{i as e,o as t,t as n}from"./chunk-BjEoQXZ0.js";var r=n(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),i=n(((t,n)=>{let{EMPTY_BUFFER:i}=r(),a=Buffer[Symbol.species];function o(e,t){if(e.length===0)return i;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let t=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return r<t?new a(n.buffer,n.byteOffset,r):n}function s(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function c(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function l(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function u(e){if(u.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new a(e):ArrayBuffer.isView(e)?t=new a(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),u.readOnly=!1),t}if(n.exports={concat:o,mask:s,toArrayBuffer:l,toBuffer:u,unmask:c},!process.env.WS_NO_BUFFER_UTIL)try{let t=e(`bufferutil`);n.exports.mask=function(e,n,r,i,a){a<48?s(e,n,r,i,a):t.mask(e,n,r,i,a)},n.exports.unmask=function(e,n){e.length<32?c(e,n):t.unmask(e,n)}}catch{}})),a=n(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),o=n(((t,n)=>{let o=e(`zlib`),s=i(),c=a(),{kStatusCode:l}=r(),u=Buffer[Symbol.species],d=Buffer.from([0,0,255,255]),f=Symbol(`permessage-deflate`),p=Symbol(`total-length`),m=Symbol(`callback`),h=Symbol(`buffers`),g=Symbol(`error`),_;n.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,_||=new c(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[m];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){_.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){_.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let r=this._isServer?`client`:`server`;if(!this._inflate){let e=`${r}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:o.Z_DEFAULT_WINDOWBITS;this._inflate=o.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[f]=this,this._inflate[p]=0,this._inflate[h]=[],this._inflate.on(`error`,b),this._inflate.on(`data`,y)}this._inflate[m]=n,this._inflate.write(e),t&&this._inflate.write(d),this._inflate.flush(()=>{let e=this._inflate[g];if(e){this._inflate.close(),this._inflate=null,n(e);return}let i=s.concat(this._inflate[h],this._inflate[p]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[p]=0,this._inflate[h]=[],t&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),n(null,i)})}_compress(e,t,n){let r=this._isServer?`server`:`client`;if(!this._deflate){let e=`${r}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:o.Z_DEFAULT_WINDOWBITS;this._deflate=o.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[p]=0,this._deflate[h]=[],this._deflate.on(`data`,v)}this._deflate[m]=n,this._deflate.write(e),this._deflate.flush(o.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=s.concat(this._deflate[h],this._deflate[p]);t&&(e=new u(e.buffer,e.byteOffset,e.length-4)),this._deflate[m]=null,this._deflate[p]=0,this._deflate[h]=[],t&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function v(e){this[h].push(e),this[p]+=e.length}function y(e){if(this[p]+=e.length,this[f]._maxPayload<1||this[p]<=this[f]._maxPayload){this[h].push(e);return}this[g]=RangeError(`Max payload size exceeded`),this[g].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[g][l]=1009,this.removeListener(`data`,y),this.reset()}function b(e){if(this[f]._inflate=null,this[g]){this[m](this[g]);return}e[l]=1007,this[m](e)}})),s=n(((t,n)=>{let{isUtf8:i}=e(`buffer`),{hasBlob:a}=r(),o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function s(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function c(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function l(e){return a&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:l,isValidStatusCode:s,isValidUTF8:c,tokenChars:o},i)n.exports.isValidUTF8=function(e){return e.length<24?c(e):i(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=e(`utf-8-validate`);n.exports.isValidUTF8=function(e){return e.length<32?c(e):t(e)}}catch{}})),c=n(((t,n)=>{let{Writable:a}=e(`stream`),c=o(),{BINARY_TYPES:l,EMPTY_BUFFER:u,kStatusCode:d,kWebSocket:f}=r(),{concat:p,toArrayBuffer:m,unmask:h}=i(),{isValidStatusCode:g,isValidUTF8:_}=s(),v=Buffer[Symbol.species];n.exports=class extends a{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||l[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[f]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new v(t.buffer,t.byteOffset+e,t.length-e),new v(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new v(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[c.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=u;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&h(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[c.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?p(n,t):this._binaryType===`arraybuffer`?m(p(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=p(n,t);if(!this._skipUTF8Validation&&!_(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,u),this.end();else{let n=e.readUInt16BE(0);if(!g(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new v(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!_(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[d]=r,a}}})),l=n(((t,n)=>{let{Duplex:a}=e(`stream`),{randomFillSync:c}=e(`crypto`),l=o(),{EMPTY_BUFFER:u,kWebSocket:d,NOOP:f}=r(),{isBlob:p,isValidStatusCode:m}=s(),{mask:h,toBuffer:g}=i(),_=Symbol(`kByteLength`),v=Buffer.alloc(4),y=8*1024,b,x=y;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=f,this[d]=void 0}static frame(e,t){let n,r=!1,i=2,a=!1;t.mask&&(n=t.maskBuffer||v,t.generateMask?t.generateMask(n):(x===y&&(b===void 0&&(b=Buffer.alloc(y)),c(b,0,y),x=0),n[0]=b[x++],n[1]=b[x++],n[2]=b[x++],n[3]=b[x++]),a=(n[0]|n[1]|n[2]|n[3])===0,i=6);let o;typeof e==`string`?(!t.mask||a)&&t[_]!==void 0?o=t[_]:(e=Buffer.from(e),o=e.length):(o=e.length,r=t.mask&&t.readOnly&&!a);let s=o;o>=65536?(i+=8,s=127):o>125&&(i+=2,s=126);let l=Buffer.allocUnsafe(r?o+i:i);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=s,s===126?l.writeUInt16BE(o,2):s===127&&(l[2]=l[3]=0,l.writeUIntBE(o,4,6)),!t.mask||(l[1]|=128,l[i-4]=n[0],l[i-3]=n[1],l[i-2]=n[2],l[i-1]=n[3],a)?[l,e]:r?(h(e,n,l,i,o),[l]):(h(e,n,e,0,o),[l,e])}close(t,n,r,i){let a;if(t===void 0)a=u;else if(typeof t!=`number`||!m(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);a=Buffer.allocUnsafe(2+e),a.writeUInt16BE(t,0),typeof n==`string`?a.write(n,2):a.set(n,2)}let o={[_]:a.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(a,o),i):this.enqueue([this.dispatch,a,!1,o,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):p(t)?(i=t.size,a=!1):(t=g(t),i=t.length,a=g.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[_]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};p(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):p(t)?(i=t.size,a=!1):(t=g(t),i=t.length,a=g.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[_]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};p(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[l.extensionName],i=t.binary?2:1,a=t.compress,o,s;typeof e==`string`?(o=Buffer.byteLength(e),s=!1):p(e)?(o=e.size,s=!1):(e=g(e),o=e.length,s=g.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=o>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let c={[_]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:s,rsv1:a};p(e)?this._state===0?this.getBlobData(e,this._compress,c,n):this.enqueue([this.getBlobData,e,this._compress,c,n]):this._state===0?this.dispatch(e,this._compress,c,n):this.enqueue([this.dispatch,e,this._compress,c,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[_],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(S,this,e,i);return}this._bufferedBytes-=r[_];let a=g(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(C,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[l.extensionName];this._bufferedBytes+=r[_],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){S(this,Error(`The socket was closed while data was being compressed`),i);return}this._bufferedBytes-=r[_],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][_],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][_],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function S(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function C(e,t,n){S(e,t,n),e.onerror(t)}})),u=n(((e,t)=>{let{kForOnEventAttribute:n,kListener:i}=r(),a=Symbol(`kCode`),o=Symbol(`kData`),s=Symbol(`kError`),c=Symbol(`kMessage`),l=Symbol(`kReason`),u=Symbol(`kTarget`),d=Symbol(`kType`),f=Symbol(`kWasClean`);var p=class{constructor(e){this[u]=null,this[d]=e}get target(){return this[u]}get type(){return this[d]}};Object.defineProperty(p.prototype,`target`,{enumerable:!0}),Object.defineProperty(p.prototype,`type`,{enumerable:!0});var m=class extends p{constructor(e,t={}){super(e),this[a]=t.code===void 0?0:t.code,this[l]=t.reason===void 0?``:t.reason,this[f]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[a]}get reason(){return this[l]}get wasClean(){return this[f]}};Object.defineProperty(m.prototype,`code`,{enumerable:!0}),Object.defineProperty(m.prototype,`reason`,{enumerable:!0}),Object.defineProperty(m.prototype,`wasClean`,{enumerable:!0});var h=class extends p{constructor(e,t={}){super(e),this[s]=t.error===void 0?null:t.error,this[c]=t.message===void 0?``:t.message}get error(){return this[s]}get message(){return this[c]}};Object.defineProperty(h.prototype,`error`,{enumerable:!0}),Object.defineProperty(h.prototype,`message`,{enumerable:!0});var g=class extends p{constructor(e,t={}){super(e),this[o]=t.data===void 0?null:t.data}get data(){return this[o]}};Object.defineProperty(g.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:m,ErrorEvent:h,Event:p,EventTarget:{addEventListener(e,t,r={}){for(let a of this.listeners(e))if(!r[n]&&a[i]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new g(`message`,{data:n?e:e.toString()});r[u]=this,_(t,this,r)};else if(e===`close`)a=function(e,n){let r=new m(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[u]=this,_(t,this,r)};else if(e===`error`)a=function(e){let n=new h(`error`,{error:e,message:e.message});n[u]=this,_(t,this,n)};else if(e===`open`)a=function(){let e=new p(`open`);e[u]=this,_(t,this,e)};else return;a[n]=!!r[n],a[i]=t,r.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[i]===t&&!r[n]){this.removeListener(e,r);break}}},MessageEvent:g};function _(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),d=n(((e,t)=>{let{tokenChars:n}=s();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),f=n(((t,n)=>{let a=e(`events`),f=e(`https`),p=e(`http`),m=e(`net`),h=e(`tls`),{randomBytes:g,createHash:_}=e(`crypto`),{Duplex:v,Readable:y}=e(`stream`),{URL:b}=e(`url`),x=o(),S=c(),C=l(),{isBlob:w}=s(),{BINARY_TYPES:T,CLOSE_TIMEOUT:E,EMPTY_BUFFER:D,GUID:O,kForOnEventAttribute:k,kListener:A,kStatusCode:j,kWebSocket:M,NOOP:N}=r(),{EventTarget:{addEventListener:P,removeEventListener:F}}=u(),{format:I,parse:L}=d(),{toBuffer:ee}=i(),te=Symbol(`kAborted`),R=[8,13],z=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],B=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var V=class e extends a{constructor(t,n,r){super(),this._binaryType=T[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=D,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),ne(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){T.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new S({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new C(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[M]=this,a[M]=this,t[M]=this,i.on(`conclude`,se),i.on(`drain`,ce),i.on(`error`,le),i.on(`message`,de),i.on(`ping`,fe),i.on(`pong`,pe),a.onerror=he,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,_e),t.on(`data`,ve),t.on(`end`,ye),t.on(`error`,be),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[x.extensionName]&&this._extensions[x.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){H(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),ge(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){oe(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||D,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){oe(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||D,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){oe(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[x.extensionName]||(i.compress=!1),this._sender.send(t||D,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){H(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(V,`CONNECTING`,{enumerable:!0,value:z.indexOf(`CONNECTING`)}),Object.defineProperty(V.prototype,`CONNECTING`,{enumerable:!0,value:z.indexOf(`CONNECTING`)}),Object.defineProperty(V,`OPEN`,{enumerable:!0,value:z.indexOf(`OPEN`)}),Object.defineProperty(V.prototype,`OPEN`,{enumerable:!0,value:z.indexOf(`OPEN`)}),Object.defineProperty(V,`CLOSING`,{enumerable:!0,value:z.indexOf(`CLOSING`)}),Object.defineProperty(V.prototype,`CLOSING`,{enumerable:!0,value:z.indexOf(`CLOSING`)}),Object.defineProperty(V,`CLOSED`,{enumerable:!0,value:z.indexOf(`CLOSED`)}),Object.defineProperty(V.prototype,`CLOSED`,{enumerable:!0,value:z.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(V.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(V.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[k])return t[A];return null},set(t){for(let t of this.listeners(e))if(t[k]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[k]:!0})}})}),V.prototype.addEventListener=P,V.prototype.removeEventListener=F,n.exports=V;function ne(e,t,n,r){let i={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:E,protocolVersion:R[1],maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=i.autoPong,e._closeTimeout=i.closeTimeout,!R.includes(i.protocolVersion))throw RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${R.join(`, `)})`);let a;if(t instanceof b)a=t;else try{a=new b(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}a.protocol===`http:`?a.protocol=`ws:`:a.protocol===`https:`&&(a.protocol=`wss:`),e._url=a.href;let o=a.protocol===`wss:`,s=a.protocol===`ws+unix:`,c;if(a.protocol!==`ws:`&&!o&&!s?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:s&&!a.pathname?c=`The URL's pathname is empty`:a.hash&&(c=`The URL contains a fragment identifier`),c){let t=SyntaxError(c);if(e._redirects===0)throw t;re(e,t);return}let l=o?443:80,u=g(16).toString(`base64`),d=o?f.request:p.request,m=new Set,h;if(i.createConnection=i.createConnection||(o?ae:ie),i.defaultPort=i.defaultPort||l,i.port=a.port||l,i.host=a.hostname.startsWith(`[`)?a.hostname.slice(1,-1):a.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":u,Connection:`Upgrade`,Upgrade:`websocket`},i.path=a.pathname+a.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(h=new x({...i.perMessageDeflate,isServer:!1,maxPayload:i.maxPayload}),i.headers[`Sec-WebSocket-Extensions`]=I({[x.extensionName]:h.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!B.test(e)||m.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);m.add(e)}i.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(i.origin&&(i.protocolVersion<13?i.headers[`Sec-WebSocket-Origin`]=i.origin:i.headers.Origin=i.origin),(a.username||a.password)&&(i.auth=`${a.username}:${a.password}`),s){let e=i.path.split(`:`);i.socketPath=e[0],i.path=e[1]}let v;if(i.followRedirects){if(e._redirects===0){e._originalIpc=s,e._originalSecure=o,e._originalHostOrSocketPath=s?i.socketPath:a.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=s?e._originalIpc?i.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!o)&&(delete i.headers.authorization,delete i.headers.cookie,t||delete i.headers.host,i.auth=void 0)}i.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(i.auth).toString(`base64`)),v=e._req=d(i),e._redirects&&e.emit(`redirect`,e.url,v)}else v=e._req=d(i);i.timeout&&v.on(`timeout`,()=>{H(e,v,`Opening handshake has timed out`)}),v.on(`error`,t=>{v===null||v[te]||(v=e._req=null,re(e,t))}),v.on(`response`,a=>{let o=a.headers.location,s=a.statusCode;if(o&&i.followRedirects&&s>=300&&s<400){if(++e._redirects>i.maxRedirects){H(e,v,`Maximum redirects exceeded`);return}v.abort();let a;try{a=new b(o,t)}catch{re(e,SyntaxError(`Invalid URL: ${o}`));return}ne(e,a,n,r)}else e.emit(`unexpected-response`,v,a)||H(e,v,`Unexpected server response: ${a.statusCode}`)}),v.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==V.CONNECTING)return;v=e._req=null;let a=t.headers.upgrade;if(a===void 0||a.toLowerCase()!==`websocket`){H(e,n,`Invalid Upgrade header`);return}let o=_(`sha1`).update(u+O).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==o){H(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?m.size&&(c=`Server sent no subprotocol`):m.size?m.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){H(e,n,c);return}s&&(e._protocol=s);let l=t.headers[`sec-websocket-extensions`];if(l!==void 0){if(!h){H(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=L(l)}catch{H(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==x.extensionName){H(e,n,`Server indicated an extension that was not requested`);return}try{h.accept(t[x.extensionName])}catch{H(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[x.extensionName]=h}e.setSocket(n,r,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(v,e):v.end()}function re(e,t){e._readyState=V.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function ie(e){return e.path=e.socketPath,m.connect(e)}function ae(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=m.isIP(e.host)?``:e.host),h.connect(e)}function H(e,t,n){e._readyState=V.CLOSING;let r=Error(n);Error.captureStackTrace(r,H),t.setHeader?(t[te]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(re,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function oe(e,t,n){if(t){let n=w(t)?t.size:ee(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${z[e.readyState]})`);process.nextTick(n,t)}}function se(e,t){let n=this[M];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[M]!==void 0&&(n._socket.removeListener(`data`,ve),process.nextTick(me,n._socket),e===1005?n.close():n.close(e,t))}function ce(){let e=this[M];e.isPaused||e._socket.resume()}function le(e){let t=this[M];t._socket[M]!==void 0&&(t._socket.removeListener(`data`,ve),process.nextTick(me,t._socket),t.close(e[j])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function ue(){this[M].emitClose()}function de(e,t){this[M].emit(`message`,e,t)}function fe(e){let t=this[M];t._autoPong&&t.pong(e,!this._isServer,N),t.emit(`ping`,e)}function pe(e){this[M].emit(`pong`,e)}function me(e){e.resume()}function he(e){let t=this[M];t.readyState!==V.CLOSED&&(t.readyState===V.OPEN&&(t._readyState=V.CLOSING,ge(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function ge(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function _e(){let e=this[M];if(this.removeListener(`close`,_e),this.removeListener(`data`,ve),this.removeListener(`end`,ye),e._readyState=V.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[M]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,ue),e._receiver.on(`finish`,ue))}function ve(e){this[M]._receiver.write(e)||this.pause()}function ye(){let e=this[M];e._readyState=V.CLOSING,e._receiver.end(),this.end()}function be(){let e=this[M];this.removeListener(`error`,be),this.on(`error`,N),e&&(e._readyState=V.CLOSING,this.destroy())}})),p=n(((t,n)=>{f();let{Duplex:r}=e(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),m=n(((e,t)=>{let{tokenChars:n}=s();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),h=n(((t,n)=>{let i=e(`events`),a=e(`http`),{Duplex:s}=e(`stream`),{createHash:c}=e(`crypto`),l=d(),u=o(),p=m(),h=f(),{CLOSE_TIMEOUT:g,GUID:_,kWebSocket:v}=r(),y=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends i{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:g,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:h,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=a.createServer((e,t)=>{let n=a.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=b(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(x,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(x,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{x(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,S);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){w(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){w(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!y.test(i)){w(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){w(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){C(t,400);return}let s=e.headers[`sec-websocket-protocol`],c=new Set;if(s!==void 0)try{c=p.parse(s)}catch{w(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let d=e.headers[`sec-websocket-extensions`],f={};if(this.options.perMessageDeflate&&d!==void 0){let n=new u({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=l.parse(d);e[u.extensionName]&&(n.accept(e[u.extensionName]),f[u.extensionName]=n)}catch{w(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,l)=>{if(!a)return C(t,o||401,s,l);this.completeUpgrade(f,i,c,e,t,n,r)});return}if(!this.options.verifyClient(a))return C(t,401)}this.completeUpgrade(f,i,c,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,o){if(!i.readable||!i.writable)return i.destroy();if(i[v])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return C(i,503);let s=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${c(`sha1`).update(t+_).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(s.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[u.extensionName]){let t=e[u.extensionName].params,n=l.format({[u.extensionName]:[t]});s.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,s,r),i.write(s.concat(`\r
|
|
2
4
|
`).join(`\r
|
|
3
5
|
`)),i.removeListener(`error`,S),d.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on(`close`,()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(x,this)})),o(d,r)}};function b(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function x(e){e._state=2,e.emit(`close`)}function S(){this.destroy()}function C(e,t,n,r){n||=a.STATUS_CODES[t],r={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...r},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${a.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join(`\r
|
|
@@ -93,4 +95,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
93
95
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lo(e,t){if(e){if(typeof e==`string`)return Ro(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ro(e,t)}}function Ro(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zo(e,t){if(!(typeof Symbol>`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function Bo(e){if(Array.isArray(e))return e}function Vo(e){var t=[...arguments].slice(1);if(t.length===0||typeof e!=`string`)return[e].concat(t);for(var n=t.slice(),r=``,i=0,a=0;a<e.length;++a){var o=e[a];if(o!==`%`){r+=o;continue}var s=e[a+1];switch(++a,s){case`c`:case`O`:case`o`:++i,r+=`%${s}`;break;case`d`:case`i`:var c=Fo(n.splice(i,1),1)[0];r+=parseInt(c,10).toString();break;case`f`:var l=Fo(n.splice(i,1),1)[0];r+=parseFloat(l).toString();break;case`s`:var u=Fo(n.splice(i,1),1)[0];r+=String(u);break;default:r+=`%${s}`}}return[r].concat(jo(n))}function Ho(e,t){var n;if(typeof Symbol>`u`||e[Symbol.iterator]==null){if(Array.isArray(e)||(n=Go(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
94
96
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function Uo(e){return qo(e)||Ko(e)||Go(e)||Wo()}function Wo(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
95
97
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Go(e,t){if(e){if(typeof e==`string`)return Jo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jo(e,t)}}function Ko(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function qo(e){if(Array.isArray(e))return Jo(e)}function Jo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Yo=/\s{4}(in|at)\s{1}/,Xo=/:\d+:\d+(\n|$)/;function Zo(e){return Yo.test(e)||Xo.test(e)}var Qo=/ \(\<anonymous\>\)$|\@unknown\:0\:0$|\(|\)|\[|\]/gm;function $o(e,t){return e.replace(Qo,``)===t.replace(Qo,``)}var es=console,ts={recordChangeDescriptions:!1,recordTimeline:!1};function ns(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:ts;if(e.hasOwnProperty(`__REACT_DEVTOOLS_GLOBAL_HOOK__`))return null;function i(e){try{if(typeof e.version==`string`)return e.bundleType>0?`development`:`production`;var t=Function.prototype.toString;if(e.Mount&&e.Mount._renderNewRootComponent){var n=t.call(e.Mount._renderNewRootComponent);return n.indexOf(`function`)===0?n.indexOf(`storedMeasure`)===-1?n.indexOf(`should be a pure function`)===-1?n.indexOf(`nextElement`)!==-1||n.indexOf(`nextComponent`)!==-1?`unminified`:`outdated`:n.indexOf(`NODE_ENV`)!==-1||n.indexOf(`development`)!==-1||n.indexOf(`true`)!==-1?`development`:n.indexOf(`nextElement`)!==-1||n.indexOf(`nextComponent`)!==-1?`unminified`:`development`:`development`:`production`}}catch{}return`production`}function a(e){try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&(l=!0,setTimeout(function(){throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://react.dev/link/perf-use-production-build`)}))}catch{}}var o=n,s=0;function c(t){var n=++s;F.set(n,t);var a=l?`deadcode`:i(t);I.emit(`renderer`,{id:n,renderer:t,reactBuildType:a});var c=Ao(I,n,t,e,o,r);return c==null?(I.hasUnsupportedRendererAttached=!0,I.emit(`unsupported-renderer-version`)):(I.rendererInterfaces.set(n,c),I.emit(`renderer-attached`,{id:n,rendererInterface:c})),n}var l=!1;function u(e,t){return I.on(e,t),function(){return I.off(e,t)}}function d(e,t){P[e]||(P[e]=[]),P[e].push(t)}function f(e,t){if(P[e]){var n=P[e].indexOf(t);n!==-1&&P[e].splice(n,1),P[e].length||delete P[e]}}function p(e,t){P[e]&&P[e].map(function(e){return e(t)})}function m(e){var t=M;return t[e]||(t[e]=new Set),t[e]}function h(e,t){N.get(e)?.handleCommitFiberUnmount(t)}function g(e,t,n){var r=I.getFiberRoots(e),i=t.current,a=r.has(t),o=i.memoizedState==null||i.memoizedState.element==null;!a&&!o?r.add(t):a&&o&&r.delete(t),N.get(e)?.handleCommitFiberRoot(t,n)}function _(e,t){N.get(e)?.handlePostCommitFiberRoot(t)}var b=!1;function x(e,t){b=t,t?C():w()}var S=[];function C(){if(I.settings&&!(S.length>0))for(var e=[`group`,`groupCollapsed`,`info`,`log`],t=function(){var e=r[n],t=es[e];es[e]=function(){var e=I.settings,n=[...arguments];if(e==null){t.apply(void 0,n);return}e.hideConsoleLogsInStrictMode||t.apply(void 0,[v].concat(Uo(Vo.apply(void 0,n))))},S.push(function(){es[e]=t})},n=0,r=e;n<r.length;n++)t()}function w(){S.forEach(function(e){return e()}),S.length=0}var T=[],E=[];function D(e){var t=e.stack.split(`
|
|
96
|
-
`);return t.length>1?t[1]:null}function O(){return E}function k(e){var t=D(e);t!==null&&T.push(t)}function A(e){if(T.length>0){var t=T.pop(),n=D(e);n!==null&&E.push([t,n])}}function j(){if(I.settings)for(var e=[`error`,`trace`,`warn`],t=function(){var e=r[n],t=es[e];es[e]=function(){var n=I.settings,r=[...arguments];if(n==null){t.apply(void 0,r);return}if(!(b&&n.hideConsoleLogsInStrictMode)){var i=!1,a=!1;if(n.appendComponentStack){var o=r.length>0?r[r.length-1]:null;a=typeof o==`string`&&Zo(o)}var s=n.showInlineWarningsAndErrors&&(e===`error`||e===`warn`),c=Ho(I.rendererInterfaces.values()),l;try{for(c.s();!(l=c.n()).done;){var u=l.value,d=u.onErrorOrWarning,f=u.getComponentStack;try{s&&d?.(e,r.slice())}catch(e){setTimeout(function(){throw e},0)}try{if(n.appendComponentStack&&f!=null){var p=f(Error(`react-stack-top-frame`));if(p!==null){var m=p.enableOwnerStacks,h=p.componentStack;if(h!==``){var g=Error(``);if(g.name=m?`Stack`:`Component Stack`,g.stack=(m?`Error Stack:`:`Error Component Stack:`)+h,a){if($o(r[r.length-1],h)){var _=r[0];r.length>1&&typeof _==`string`&&_.endsWith(`%s`)&&(r[0]=_.slice(0,_.length-2)),r[r.length-1]=g,i=!0}}else r.push(g),i=!0}break}}}catch(e){setTimeout(function(){throw e},0)}}}catch(e){c.e(e)}finally{c.f()}if(n.breakOnConsoleErrors)debugger;b?t.apply(void 0,[i?y:v].concat(Uo(Vo.apply(void 0,r)))):t.apply(void 0,r)}}},n=0,r=e;n<r.length;n++)t()}var M={},N=new Map,P={},F=new Map,I={rendererInterfaces:N,listeners:P,backends:new Map,renderers:F,hasUnsupportedRendererAttached:!1,emit:p,getFiberRoots:m,inject:c,on:d,off:f,sub:u,supportsFiber:!0,supportsFlight:!0,checkDCE:a,onCommitFiberUnmount:h,onCommitFiberRoot:g,onPostCommitFiberRoot:_,setStrictMode:x,getInternalModuleRanges:O,registerInternalModuleStart:k,registerInternalModuleStop:A};return t==null?(I.settings={appendComponentStack:!0,breakOnConsoleErrors:!1,showInlineWarningsAndErrors:!0,hideConsoleLogsInStrictMode:!1},j()):Promise.resolve(t).then(function(e){I.settings=e,I.emit(`settingsInitialized`,e),j()}).catch(function(){es.error(`React DevTools failed to get Console Patching settings. Console won't be patched and some console features will not work.`)}),Object.defineProperty(e,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!1,enumerable:!1,get:function(){return I}}),I}function rs(e,t,n,r){if(e==null)return function(){};function i(e,n){t.registerRendererInterface(e,n),n.flushInitialOperations()}var a=[e.sub(`renderer-attached`,function(e){var t=e.id,n=e.rendererInterface;i(t,n)}),e.sub(`unsupported-renderer-version`,function(){t.onUnsupportedRenderer()}),e.sub(`fastRefreshScheduled`,t.onFastRefreshScheduled),e.sub(`operations`,t.onHookOperations),e.sub(`traceUpdates`,t.onTraceUpdates),e.sub(`settingsInitialized`,t.onHookSettings)];return t.addListener(`getIfHasUnsupportedRendererVersion`,function(){e.hasUnsupportedRendererAttached&&t.onUnsupportedRenderer()}),e.rendererInterfaces.forEach(function(e,t){i(t,e)}),e.emit(`react-devtools`,t),e.reactDevtoolsAgent=t,t.addListener(`shutdown`,function(){a.forEach(function(e){return e()}),e.rendererInterfaces.forEach(function(e){e.cleanup()}),e.reactDevtoolsAgent=null}),t.addListener(`updateHookSettings`,function(t){e.settings=t}),t.addListener(`getHookSettings`,function(){e.settings!=null&&t.onHookSettings(e.settings)}),r&&t.onReloadAndProfileSupportedByHost(),function(){a.forEach(function(e){return e()})}}function is(e,t){var n=!1,r={bottom:0,left:0,right:0,top:0},i=t[e];if(i!=null){for(var a=0,o=Object.keys(r);a<o.length;a++){var s=o[a];r[s]=i}n=!0}var c=t[e+`Horizontal`];if(c!=null)r.left=c,r.right=c,n=!0;else{var l=t[e+`Left`];l!=null&&(r.left=l,n=!0);var u=t[e+`Right`];u!=null&&(r.right=u,n=!0);var d=t[e+`End`];d!=null&&(r.right=d,n=!0);var f=t[e+`Start`];f!=null&&(r.left=f,n=!0)}var p=t[e+`Vertical`];if(p!=null)r.bottom=p,r.top=p,n=!0;else{var m=t[e+`Bottom`];m!=null&&(r.bottom=m,n=!0);var h=t[e+`Top`];h!=null&&(r.top=h,n=!0)}return n?r:null}function as(e){"@babel/helpers - typeof";return as=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},as(e)}function os(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ss(e,t,n,r){e.addListener(`NativeStyleEditor_measure`,function(r){var i=r.id,a=r.rendererID;us(t,e,n,i,a)}),e.addListener(`NativeStyleEditor_renameAttribute`,function(r){var i=r.id,a=r.rendererID,o=r.oldName,s=r.newName,c=r.value;fs(t,i,a,o,s,c),setTimeout(function(){return us(t,e,n,i,a)})}),e.addListener(`NativeStyleEditor_setValue`,function(r){var i=r.id,a=r.rendererID,o=r.name,s=r.value;ps(t,i,a,o,s),setTimeout(function(){return us(t,e,n,i,a)})}),e.send(`isNativeStyleEditorSupported`,{isSupported:!0,validAttributes:r})}var cs={top:0,left:0,right:0,bottom:0},ls=new Map;function us(e,t,n,r,i){var a=e.getInstanceAndStyle({id:r,rendererID:i});if(!a||!a.style){t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:null,style:null});return}var o=a.instance,s=a.style,c=n(s),l=ls.get(r);if(l!=null&&(c=Object.assign({},c,l)),!o||typeof o.measure!=`function`){t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:null,style:c||null});return}o.measure(function(e,n,i,a,o,s){if(typeof e!=`number`){t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:null,style:c||null});return}var l=c!=null&&is(`margin`,c)||cs,u=c!=null&&is(`padding`,c)||cs;t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:{x:e,y:n,width:i,height:a,left:o,top:s,margin:l,padding:u},style:c||null})})}function ds(e){var t={};for(var n in e)t[n]=e[n];return t}function fs(e,t,n,r,i,a){var o,s=e.getInstanceAndStyle({id:t,rendererID:n});if(!(!s||!s.style)){var c=s.instance,l=s.style,u=i?(o={},os(o,r,void 0),os(o,i,a),o):os({},r,void 0),d;if(c!==null&&typeof c.setNativeProps==`function`){var f=ls.get(t);f?Object.assign(f,u):ls.set(t,u),c.setNativeProps({style:u})}else if(Me(l)){var p=l.length-1;as(l[p])===`object`&&!Me(l[p])?(d=ds(l[p]),delete d[r],i?d[i]=a:d[r]=void 0,e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`,p],value:d})):e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:l.concat([u])})}else as(l)===`object`?(d=ds(l),delete d[r],i?d[i]=a:d[r]=void 0,e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:d})):e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:[l,u]});e.emit(`hideNativeHighlight`)}}function ps(e,t,n,r,i){var a=e.getInstanceAndStyle({id:t,rendererID:n});if(!(!a||!a.style)){var o=a.instance,s=a.style,c=os({},r,i);if(o!==null&&typeof o.setNativeProps==`function`){var l=ls.get(t);l?Object.assign(l,c):ls.set(t,c),o.setNativeProps({style:c})}else if(Me(s)){var u=s.length-1;as(s[u])===`object`&&!Me(s[u])?e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`,u,r],value:i}):e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:s.concat([c])})}else e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:[s,c]});e.emit(`hideNativeHighlight`)}}var ms=et();function hs(e){if(s){var t,n=[...arguments].slice(1);(t=console).log.apply(t,[`%c[core/backend] %c${e}`,`color: teal; font-weight: bold;`,`font-weight: bold;`].concat(n))}}function gs(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2?arguments[2]:void 0;ns(window,e,t,n)}function _s(e){var t=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t==null)return;var n=e||{},r=n.host,i=r===void 0?`localhost`:r,a=n.nativeStyleEditorValidAttributes,o=n.useHttps,c=o===void 0?!1:o,l=n.port,u=l===void 0?8097:l,d=n.websocket,f=n.resolveRNStyle,p=f===void 0?null:f,m=n.retryConnectionDelay,h=m===void 0?2e3:m,g=n.isAppActive,_=g===void 0?function(){return!0}:g,v=n.onSettingsUpdated,y=n.isReloadAndProfileSupported,b=y===void 0?mt():y,x=n.isProfiling,S=n.onReloadAndProfile,C=n.onReloadAndProfileFlagsReset,w=c?`wss`:`ws`,T=null;function E(){T===null&&(T=setTimeout(function(){return _s(e)},h))}if(!_()){E();return}var D=null,O=[],k=w+`://`+i+`:`+u,A=d||new window.WebSocket(k);A.onclose=j,A.onerror=M,A.onmessage=N,A.onopen=function(){D=new Fr({listen:function(e){return O.push(e),function(){var t=O.indexOf(e);t>=0&&O.splice(t,1)}},send:function(e,t,n){A.readyState===A.OPEN?(s&&hs(`wall.send()`,e,t),A.send(JSON.stringify({event:e,payload:t}))):(s&&hs(`wall.send()`,`Shutting down bridge because of closed WebSocket connection`),D!==null&&D.shutdown(),E())}}),D.addListener(`updateComponentFilters`,function(e){ms=e}),window.__REACT_DEVTOOLS_COMPONENT_FILTERS__??D.send(`overrideComponentFilters`,ms);var e=new Xr(D,x,S);if(typeof C==`function`&&C(),v!=null&&e.addListener(`updateHookSettings`,v),e.addListener(`shutdown`,function(){v!=null&&e.removeListener(`updateHookSettings`,v),t.emit(`shutdown`)}),rs(t,e,window,b),p!=null||t.resolveRNStyle!=null)ss(D,e,p||t.resolveRNStyle,a||t.nativeStyleEditorValidAttributes||null);else{var n,r,i=function(){D!==null&&ss(D,e,n,r)};t.hasOwnProperty(`resolveRNStyle`)||Object.defineProperty(t,`resolveRNStyle`,{enumerable:!1,get:function(){return n},set:function(e){n=e,i()}}),t.hasOwnProperty(`nativeStyleEditorValidAttributes`)||Object.defineProperty(t,`nativeStyleEditorValidAttributes`,{enumerable:!1,get:function(){return r},set:function(e){r=e,i()}})}};function j(){s&&hs(`WebSocket.onclose`),D!==null&&D.emit(`shutdown`),E()}function M(){s&&hs(`WebSocket.onerror`),E()}function N(e){var t;try{if(typeof e.data==`string`)t=JSON.parse(e.data),s&&hs(`WebSocket.onmessage`,t);else throw Error()}catch{console.error(`[React DevTools] Failed to parse JSON: `+e.data);return}O.forEach(function(e){try{e(t)}catch(e){throw console.log(`[React DevTools] Error calling listener`,t),console.log(`error:`,e),e}})}}function vs(e){var t=e.onSubscribe,n=e.onUnsubscribe,r=e.onMessage,i=e.nativeStyleEditorValidAttributes,a=e.resolveRNStyle,o=e.onSettingsUpdated,s=e.isReloadAndProfileSupported,c=s===void 0?mt():s,l=e.isProfiling,u=e.onReloadAndProfile,d=e.onReloadAndProfileFlagsReset,f=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f!=null){var p=new Fr({listen:function(e){return t(e),function(){n(e)}},send:function(e,t){r(e,t)}});p.addListener(`updateComponentFilters`,function(e){ms=e}),window.__REACT_DEVTOOLS_COMPONENT_FILTERS__??p.send(`overrideComponentFilters`,ms);var m=new Xr(p,l,u);typeof d==`function`&&d(),o!=null&&m.addListener(`updateHookSettings`,o),m.addListener(`shutdown`,function(){o!=null&&m.removeListener(`updateHookSettings`,o),f.emit(`shutdown`)});var h=rs(f,m,window,c),g=a||f.resolveRNStyle;return g!=null&&ss(p,m,g,i||f.nativeStyleEditorValidAttributes||null),h}}})(),r})())}))(),1);y.default.initialize(),y.default.connectToDevTools();export{};
|
|
98
|
+
`);return t.length>1?t[1]:null}function O(){return E}function k(e){var t=D(e);t!==null&&T.push(t)}function A(e){if(T.length>0){var t=T.pop(),n=D(e);n!==null&&E.push([t,n])}}function j(){if(I.settings)for(var e=[`error`,`trace`,`warn`],t=function(){var e=r[n],t=es[e];es[e]=function(){var n=I.settings,r=[...arguments];if(n==null){t.apply(void 0,r);return}if(!(b&&n.hideConsoleLogsInStrictMode)){var i=!1,a=!1;if(n.appendComponentStack){var o=r.length>0?r[r.length-1]:null;a=typeof o==`string`&&Zo(o)}var s=n.showInlineWarningsAndErrors&&(e===`error`||e===`warn`),c=Ho(I.rendererInterfaces.values()),l;try{for(c.s();!(l=c.n()).done;){var u=l.value,d=u.onErrorOrWarning,f=u.getComponentStack;try{s&&d?.(e,r.slice())}catch(e){setTimeout(function(){throw e},0)}try{if(n.appendComponentStack&&f!=null){var p=f(Error(`react-stack-top-frame`));if(p!==null){var m=p.enableOwnerStacks,h=p.componentStack;if(h!==``){var g=Error(``);if(g.name=m?`Stack`:`Component Stack`,g.stack=(m?`Error Stack:`:`Error Component Stack:`)+h,a){if($o(r[r.length-1],h)){var _=r[0];r.length>1&&typeof _==`string`&&_.endsWith(`%s`)&&(r[0]=_.slice(0,_.length-2)),r[r.length-1]=g,i=!0}}else r.push(g),i=!0}break}}}catch(e){setTimeout(function(){throw e},0)}}}catch(e){c.e(e)}finally{c.f()}if(n.breakOnConsoleErrors)debugger;b?t.apply(void 0,[i?y:v].concat(Uo(Vo.apply(void 0,r)))):t.apply(void 0,r)}}},n=0,r=e;n<r.length;n++)t()}var M={},N=new Map,P={},F=new Map,I={rendererInterfaces:N,listeners:P,backends:new Map,renderers:F,hasUnsupportedRendererAttached:!1,emit:p,getFiberRoots:m,inject:c,on:d,off:f,sub:u,supportsFiber:!0,supportsFlight:!0,checkDCE:a,onCommitFiberUnmount:h,onCommitFiberRoot:g,onPostCommitFiberRoot:_,setStrictMode:x,getInternalModuleRanges:O,registerInternalModuleStart:k,registerInternalModuleStop:A};return t==null?(I.settings={appendComponentStack:!0,breakOnConsoleErrors:!1,showInlineWarningsAndErrors:!0,hideConsoleLogsInStrictMode:!1},j()):Promise.resolve(t).then(function(e){I.settings=e,I.emit(`settingsInitialized`,e),j()}).catch(function(){es.error(`React DevTools failed to get Console Patching settings. Console won't be patched and some console features will not work.`)}),Object.defineProperty(e,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!1,enumerable:!1,get:function(){return I}}),I}function rs(e,t,n,r){if(e==null)return function(){};function i(e,n){t.registerRendererInterface(e,n),n.flushInitialOperations()}var a=[e.sub(`renderer-attached`,function(e){var t=e.id,n=e.rendererInterface;i(t,n)}),e.sub(`unsupported-renderer-version`,function(){t.onUnsupportedRenderer()}),e.sub(`fastRefreshScheduled`,t.onFastRefreshScheduled),e.sub(`operations`,t.onHookOperations),e.sub(`traceUpdates`,t.onTraceUpdates),e.sub(`settingsInitialized`,t.onHookSettings)];return t.addListener(`getIfHasUnsupportedRendererVersion`,function(){e.hasUnsupportedRendererAttached&&t.onUnsupportedRenderer()}),e.rendererInterfaces.forEach(function(e,t){i(t,e)}),e.emit(`react-devtools`,t),e.reactDevtoolsAgent=t,t.addListener(`shutdown`,function(){a.forEach(function(e){return e()}),e.rendererInterfaces.forEach(function(e){e.cleanup()}),e.reactDevtoolsAgent=null}),t.addListener(`updateHookSettings`,function(t){e.settings=t}),t.addListener(`getHookSettings`,function(){e.settings!=null&&t.onHookSettings(e.settings)}),r&&t.onReloadAndProfileSupportedByHost(),function(){a.forEach(function(e){return e()})}}function is(e,t){var n=!1,r={bottom:0,left:0,right:0,top:0},i=t[e];if(i!=null){for(var a=0,o=Object.keys(r);a<o.length;a++){var s=o[a];r[s]=i}n=!0}var c=t[e+`Horizontal`];if(c!=null)r.left=c,r.right=c,n=!0;else{var l=t[e+`Left`];l!=null&&(r.left=l,n=!0);var u=t[e+`Right`];u!=null&&(r.right=u,n=!0);var d=t[e+`End`];d!=null&&(r.right=d,n=!0);var f=t[e+`Start`];f!=null&&(r.left=f,n=!0)}var p=t[e+`Vertical`];if(p!=null)r.bottom=p,r.top=p,n=!0;else{var m=t[e+`Bottom`];m!=null&&(r.bottom=m,n=!0);var h=t[e+`Top`];h!=null&&(r.top=h,n=!0)}return n?r:null}function as(e){"@babel/helpers - typeof";return as=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},as(e)}function os(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ss(e,t,n,r){e.addListener(`NativeStyleEditor_measure`,function(r){var i=r.id,a=r.rendererID;us(t,e,n,i,a)}),e.addListener(`NativeStyleEditor_renameAttribute`,function(r){var i=r.id,a=r.rendererID,o=r.oldName,s=r.newName,c=r.value;fs(t,i,a,o,s,c),setTimeout(function(){return us(t,e,n,i,a)})}),e.addListener(`NativeStyleEditor_setValue`,function(r){var i=r.id,a=r.rendererID,o=r.name,s=r.value;ps(t,i,a,o,s),setTimeout(function(){return us(t,e,n,i,a)})}),e.send(`isNativeStyleEditorSupported`,{isSupported:!0,validAttributes:r})}var cs={top:0,left:0,right:0,bottom:0},ls=new Map;function us(e,t,n,r,i){var a=e.getInstanceAndStyle({id:r,rendererID:i});if(!a||!a.style){t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:null,style:null});return}var o=a.instance,s=a.style,c=n(s),l=ls.get(r);if(l!=null&&(c=Object.assign({},c,l)),!o||typeof o.measure!=`function`){t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:null,style:c||null});return}o.measure(function(e,n,i,a,o,s){if(typeof e!=`number`){t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:null,style:c||null});return}var l=c!=null&&is(`margin`,c)||cs,u=c!=null&&is(`padding`,c)||cs;t.send(`NativeStyleEditor_styleAndLayout`,{id:r,layout:{x:e,y:n,width:i,height:a,left:o,top:s,margin:l,padding:u},style:c||null})})}function ds(e){var t={};for(var n in e)t[n]=e[n];return t}function fs(e,t,n,r,i,a){var o,s=e.getInstanceAndStyle({id:t,rendererID:n});if(!(!s||!s.style)){var c=s.instance,l=s.style,u=i?(o={},os(o,r,void 0),os(o,i,a),o):os({},r,void 0),d;if(c!==null&&typeof c.setNativeProps==`function`){var f=ls.get(t);f?Object.assign(f,u):ls.set(t,u),c.setNativeProps({style:u})}else if(Me(l)){var p=l.length-1;as(l[p])===`object`&&!Me(l[p])?(d=ds(l[p]),delete d[r],i?d[i]=a:d[r]=void 0,e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`,p],value:d})):e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:l.concat([u])})}else as(l)===`object`?(d=ds(l),delete d[r],i?d[i]=a:d[r]=void 0,e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:d})):e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:[l,u]});e.emit(`hideNativeHighlight`)}}function ps(e,t,n,r,i){var a=e.getInstanceAndStyle({id:t,rendererID:n});if(!(!a||!a.style)){var o=a.instance,s=a.style,c=os({},r,i);if(o!==null&&typeof o.setNativeProps==`function`){var l=ls.get(t);l?Object.assign(l,c):ls.set(t,c),o.setNativeProps({style:c})}else if(Me(s)){var u=s.length-1;as(s[u])===`object`&&!Me(s[u])?e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`,u,r],value:i}):e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:s.concat([c])})}else e.overrideValueAtPath({type:`props`,id:t,rendererID:n,path:[`style`],value:[s,c]});e.emit(`hideNativeHighlight`)}}var ms=et();function hs(e){if(s){var t,n=[...arguments].slice(1);(t=console).log.apply(t,[`%c[core/backend] %c${e}`,`color: teal; font-weight: bold;`,`font-weight: bold;`].concat(n))}}function gs(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2?arguments[2]:void 0;ns(window,e,t,n)}function _s(e){var t=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t==null)return;var n=e||{},r=n.host,i=r===void 0?`localhost`:r,a=n.nativeStyleEditorValidAttributes,o=n.useHttps,c=o===void 0?!1:o,l=n.port,u=l===void 0?8097:l,d=n.websocket,f=n.resolveRNStyle,p=f===void 0?null:f,m=n.retryConnectionDelay,h=m===void 0?2e3:m,g=n.isAppActive,_=g===void 0?function(){return!0}:g,v=n.onSettingsUpdated,y=n.isReloadAndProfileSupported,b=y===void 0?mt():y,x=n.isProfiling,S=n.onReloadAndProfile,C=n.onReloadAndProfileFlagsReset,w=c?`wss`:`ws`,T=null;function E(){T===null&&(T=setTimeout(function(){return _s(e)},h))}if(!_()){E();return}var D=null,O=[],k=w+`://`+i+`:`+u,A=d||new window.WebSocket(k);A.onclose=j,A.onerror=M,A.onmessage=N,A.onopen=function(){D=new Fr({listen:function(e){return O.push(e),function(){var t=O.indexOf(e);t>=0&&O.splice(t,1)}},send:function(e,t,n){A.readyState===A.OPEN?(s&&hs(`wall.send()`,e,t),A.send(JSON.stringify({event:e,payload:t}))):(s&&hs(`wall.send()`,`Shutting down bridge because of closed WebSocket connection`),D!==null&&D.shutdown(),E())}}),D.addListener(`updateComponentFilters`,function(e){ms=e}),window.__REACT_DEVTOOLS_COMPONENT_FILTERS__??D.send(`overrideComponentFilters`,ms);var e=new Xr(D,x,S);if(typeof C==`function`&&C(),v!=null&&e.addListener(`updateHookSettings`,v),e.addListener(`shutdown`,function(){v!=null&&e.removeListener(`updateHookSettings`,v),t.emit(`shutdown`)}),rs(t,e,window,b),p!=null||t.resolveRNStyle!=null)ss(D,e,p||t.resolveRNStyle,a||t.nativeStyleEditorValidAttributes||null);else{var n,r,i=function(){D!==null&&ss(D,e,n,r)};t.hasOwnProperty(`resolveRNStyle`)||Object.defineProperty(t,`resolveRNStyle`,{enumerable:!1,get:function(){return n},set:function(e){n=e,i()}}),t.hasOwnProperty(`nativeStyleEditorValidAttributes`)||Object.defineProperty(t,`nativeStyleEditorValidAttributes`,{enumerable:!1,get:function(){return r},set:function(e){r=e,i()}})}};function j(){s&&hs(`WebSocket.onclose`),D!==null&&D.emit(`shutdown`),E()}function M(){s&&hs(`WebSocket.onerror`),E()}function N(e){var t;try{if(typeof e.data==`string`)t=JSON.parse(e.data),s&&hs(`WebSocket.onmessage`,t);else throw Error()}catch{console.error(`[React DevTools] Failed to parse JSON: `+e.data);return}O.forEach(function(e){try{e(t)}catch(e){throw console.log(`[React DevTools] Error calling listener`,t),console.log(`error:`,e),e}})}}function vs(e){var t=e.onSubscribe,n=e.onUnsubscribe,r=e.onMessage,i=e.nativeStyleEditorValidAttributes,a=e.resolveRNStyle,o=e.onSettingsUpdated,s=e.isReloadAndProfileSupported,c=s===void 0?mt():s,l=e.isProfiling,u=e.onReloadAndProfile,d=e.onReloadAndProfileFlagsReset,f=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f!=null){var p=new Fr({listen:function(e){return t(e),function(){n(e)}},send:function(e,t){r(e,t)}});p.addListener(`updateComponentFilters`,function(e){ms=e}),window.__REACT_DEVTOOLS_COMPONENT_FILTERS__??p.send(`overrideComponentFilters`,ms);var m=new Xr(p,l,u);typeof d==`function`&&d(),o!=null&&m.addListener(`updateHookSettings`,o),m.addListener(`shutdown`,function(){o!=null&&m.removeListener(`updateHookSettings`,o),f.emit(`shutdown`)});var h=rs(f,m,window,c),g=a||f.resolveRNStyle;return g!=null&&ss(p,m,g,i||f.nativeStyleEditorValidAttributes||null),h}}})(),r})())}))(),1);y.default.initialize(),y.default.connectToDevTools();export{};
|
|
99
|
+
//# debugId=24018735-1456-5d3d-8e26-f3f00983f8b2
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="97e76e43-a3d0-568e-9605-7f13c000ba35")}catch(e){}}();
|
|
3
|
+
import{t as e}from"./chunk-BjEoQXZ0.js";const t=e=>typeof e==`string`,n=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},r=e=>e==null?``:``+e,i=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},a=/###/g,o=e=>e&&e.indexOf(`###`)>-1?e.replace(a,`.`):e,s=e=>!e||t(e),c=(e,n,r)=>{let i=t(n)?n.split(`.`):n,a=0;for(;a<i.length-1;){if(s(e))return{};let t=o(i[a]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return s(e)?{}:{obj:e,k:o(i[a])}},l=(e,t,n)=>{let{obj:r,k:i}=c(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=c(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=c(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},u=(e,t,n,r)=>{let{obj:i,k:a}=c(e,t,Object);i[a]=i[a]||[],i[a].push(n)},d=(e,t)=>{let{obj:n,k:r}=c(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},f=(e,t,n)=>{let r=d(e,n);return r===void 0?d(t,n):r},p=(e,n,r)=>{for(let i in n)i!==`__proto__`&&i!==`constructor`&&(i in e?t(e[i])||e[i]instanceof String||t(n[i])||n[i]instanceof String?r&&(e[i]=n[i]):p(e[i],n[i],r):e[i]=n[i]);return e},m=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`);var h={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`};const ee=e=>t(e)?e.replace(/[&<>"'\/]/g,e=>h[e]):e;var te=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}};const ne=[` `,`,`,`?`,`!`,`;`],g=new te(20),re=(e,t,n)=>{t||=``,n||=``;let r=ne.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=g.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},_=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},v=e=>e?.replace(/_/g,`-`),ie={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}};var y=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||ie,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,n,r,i){return i&&!this.debug?null:(t(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},ae=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},b=class extends ae{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,n,r,i={}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=i.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:i.ignoreJSONStructure,s;e.indexOf(`.`)>-1?s=e.split(`.`):(s=[e,n],r&&(Array.isArray(r)?s.push(...r):t(r)&&a?s.push(...r.split(a)):s.push(r)));let c=d(this.data,s);return!c&&!n&&!r&&e.indexOf(`.`)>-1&&(e=s[0],n=s[1],r=s.slice(2).join(`.`)),c||!o||!t(r)?c:_(this.data?.[e]?.[n],r,a)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),l(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,n,r,i={silent:!1}){for(let i in r)(t(r[i])||Array.isArray(r[i]))&&this.addResource(e,n,i,r[i],{silent:!0});i.silent||this.emit(`added`,e,n,r)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=d(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?p(s,n,i):s={...s,...n},l(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},x={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}};const oe=Symbol(`i18next/PATH_KEY`);function se(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===oe?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function S(e,t){let{[oe]:n}=e(se()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}const ce={},le=e=>!t(e)&&typeof e!=`boolean`&&typeof e!=`number`;var ue=class e extends ae{constructor(e,t={}){super(),i([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=y.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=le(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,n){let r=n.nsSeparator===void 0?this.options.nsSeparator:n.nsSeparator;r===void 0&&(r=`:`);let i=n.keySeparator===void 0?this.options.keySeparator:n.keySeparator,a=n.ns||this.options.defaultNS||[],o=r&&e.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!re(e,r,i);if(o&&!s){let n=e.match(this.interpolator.nestingRegexp);if(n&&n.length>0)return{key:e,namespaces:t(a)?[a]:a};let o=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(i)}return{key:e,namespaces:t(a)?[a]:a}}translate(n,r,i){let a=typeof r==`object`?{...r}:r;if(typeof a!=`object`&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a==`object`&&(a={...a}),a||={},n==null)return``;typeof n==`function`&&(n=S(n,{...this.options,...a})),Array.isArray(n)||(n=[String(n)]),n=n.map(e=>typeof e==`function`?S(e,{...this.options,...a}):String(e));let o=a.returnDetails===void 0?this.options.returnDetails:a.returnDetails,s=a.keySeparator===void 0?this.options.keySeparator:a.keySeparator,{key:c,namespaces:l}=this.extractFromKey(n[n.length-1],a),u=l[l.length-1],d=a.nsSeparator===void 0?this.options.nsSeparator:a.nsSeparator;d===void 0&&(d=`:`);let f=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()===`cimode`)return p?o?{res:`${u}${d}${c}`,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:`${u}${d}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:c;let m=this.resolve(n,a),h=m?.res,ee=m?.usedKey||c,te=m?.exactUsedKey||c,ne=[`[object Number]`,`[object Function]`,`[object RegExp]`],g=a.joinArrays===void 0?this.options.joinArrays:a.joinArrays,re=!this.i18nFormat||this.i18nFormat.handleAsObject,_=a.count!==void 0&&!t(a.count),v=e.hasDefaultValue(a),ie=_?this.pluralResolver.getSuffix(f,a.count,a):``,y=a.ordinal&&_?this.pluralResolver.getSuffix(f,a.count,{ordinal:!1}):``,ae=_&&!a.ordinal&&a.count===0,b=ae&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${ie}`]||a[`defaultValue${y}`]||a.defaultValue,x=h;re&&!h&&v&&(x=b);let oe=le(x),se=Object.prototype.toString.apply(x);if(re&&x&&oe&&ne.indexOf(se)<0&&!(t(g)&&Array.isArray(x))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(ee,x,{...a,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(m.res=e,m.usedParams=this.getUsedParamsDetails(a),m):e}if(s){let e=Array.isArray(x),t=e?[]:{},n=e?te:ee;for(let e in x)if(Object.prototype.hasOwnProperty.call(x,e)){let r=`${n}${s}${e}`;v&&!h?t[e]=this.translate(r,{...a,defaultValue:le(b)?b[e]:void 0,joinArrays:!1,ns:l}):t[e]=this.translate(r,{...a,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=x[e])}h=t}}else if(re&&t(g)&&Array.isArray(h))h=h.join(g),h&&=this.extendTranslation(h,n,a,i);else{let e=!1,t=!1;!this.isValidLookup(h)&&v&&(e=!0,h=b),this.isValidLookup(h)||(t=!0,h=c);let r=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&t?void 0:h,o=v&&b!==h&&this.options.updateMissing;if(t||e||o){if(this.logger.log(o?`updateKey`:`missingKey`,f,u,c,o?b:h),s){let e=this.resolve(c,{...a,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(a.lng||this.language):e.push(a.lng||this.language);let n=(e,t,n)=>{let i=v&&n!==h?n:r;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,i,o,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,i,o,a),this.emit(`missingKey`,e,u,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,a);ae&&a[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],c+t,a[`defaultValue${t}`]||b)})}):n(e,c,b))}h=this.extendTranslation(h,n,a,m,i),t&&h===c&&this.options.appendNamespaceToMissingKey&&(h=`${u}${d}${c}`),(t||e)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${c}`:c,e?h:void 0,a))}return o?(m.res=h,m.usedParams=this.getUsedParamsDetails(a),m):h}extendTranslation(e,n,r,i,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});let o=t(e)&&(r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables),s;if(o){let t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let c=r.replace&&!t(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,r.lng||this.language||i.usedLng,r),o){let t=e.match(this.interpolator.nestingRegexp),n=t&&t.length;s<n&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>a?.[0]===e[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${n[0]}`),null):this.translate(...e,n),r)),r.interpolation&&this.interpolator.reset()}let o=r.postProcess||this.options.postProcess,s=t(o)?[o]:o;return e!=null&&s?.length&&r.applyPostProcessor!==!1&&(e=x.handle(s,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,i,a,o,s;return t(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?S(e,{...this.options,...n}):e)),e.forEach(e=>{if(this.isValidLookup(r))return;let c=this.extractFromKey(e,n),l=c.key;i=l;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));let d=n.count!==void 0&&!t(n.count),f=d&&!n.ordinal&&n.count===0,p=n.context!==void 0&&(t(n.context)||typeof n.context==`number`)&&n.context!==``,m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(e=>{this.isValidLookup(r)||(s=e,!ce[`${m[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(ce[`${m[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(`, `)}" won't get resolved as namespace "${s}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),m.forEach(t=>{if(this.isValidLookup(r))return;o=t;let i=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,t,e,n);else{let e;d&&(e=this.pluralResolver.getSuffix(t,n.count,n));let r=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(n.ordinal&&e.indexOf(a)===0&&i.push(l+e.replace(a,this.options.pluralSeparator)),i.push(l+e),f&&i.push(l+r)),p){let t=`${l}${this.options.contextSeparator||`_`}${n.context}`;i.push(t),d&&(n.ordinal&&e.indexOf(a)===0&&i.push(t+e.replace(a,this.options.pluralSeparator)),i.push(t+e),f&&i.push(t+r))}}let s;for(;s=i.pop();)this.isValidLookup(r)||(a=s,r=this.getResource(t,e,s,n))}))})}),{res:r,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let n=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],r=e.replace&&!t(e.replace),i=r?e.replace:e;if(r&&e.count!==void 0&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(let e of n)delete i[e]}return i}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},de=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=y.create(`languageUtils`)}getScriptPartFromCode(e){if(e=v(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=v(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(t(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,n){if(!e)return[];if(typeof e==`function`&&(e=e(n)),t(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||=e[this.getScriptPartFromCode(n)],r||=e[this.formatLanguageCode(n)],r||=e[this.getLanguagePartFromCode(n)],r||=e.default,r||[]}toResolveHierarchy(e,n){let r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),i=[],a=e=>{e&&(this.isSupportedCode(e)?i.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return t(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&a(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&a(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&a(this.getLanguagePartFromCode(e))):t(e)&&a(this.formatLanguageCode(e)),r.forEach(e=>{i.indexOf(e)<0&&a(this.formatLanguageCode(e))}),i}};const fe={zero:0,one:1,two:2,few:3,many:4,other:5},pe={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})};var me=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=y.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=v(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),pe;if(!e.match(/-|_/))return pe;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>fe[e]-fe[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}};const he=(e,n,r,i=`.`,a=!0)=>{let o=f(e,n,r);return!o&&a&&t(r)&&(o=_(e,r,i),o===void 0&&(o=_(n,r,i))),o},ge=e=>e.replace(/\$/g,`$$$$`);var _e=class{constructor(e={}){this.logger=y.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:h,nestingOptionsSeparator:te,maxReplaces:ne,alwaysFormat:g}=e.interpolation;this.escape=t===void 0?ee:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?m(i):a||`{{`,this.suffix=o?m(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?m(d):f||m(`$t(`),this.nestingSuffix=p?m(p):h||m(`)`),this.nestingOptionsSeparator=te||`,`,this.maxReplaces=ne||1e3,this.alwaysFormat=g===void 0?!1:g,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,i,a){let o,s,c,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=e=>{if(e.indexOf(this.formatSeparator)<0){let t=he(n,l,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(t,void 0,i,{...a,...n,interpolationkey:e}):t}let t=e.split(this.formatSeparator),r=t.shift().trim(),o=t.join(this.formatSeparator).trim();return this.format(he(n,l,r,this.options.keySeparator,this.options.ignoreJSONStructure),o,i,{...a,...n,interpolationkey:r})};this.resetRegExp();let d=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=a?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:a.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>ge(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?ge(this.escape(e)):ge(e)}].forEach(n=>{for(c=0;o=n.regex.exec(e);){let i=o[1].trim();if(s=u(i),s===void 0)if(typeof d==`function`){let n=d(e,o,a);s=t(n)?n:``}else if(a&&Object.prototype.hasOwnProperty.call(a,i))s=``;else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${i} for interpolating ${e}`),s=``;else !t(s)&&!this.useRawValueToEscape&&(s=r(s));let l=n.safeValue(s);if(e=e.replace(o[0],l),f?(n.regex.lastIndex+=s.length,n.regex.lastIndex-=o[0].length):n.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n,i={}){let a,o,s,c=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${m(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,s);let a=i.match(/'/g),o=i.match(/"/g);((a?.length??0)%2==0&&!o||(o?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{s=JSON.parse(i),t&&(s={...t,...s})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,e};for(;a=this.nestingRegexp.exec(e);){let l=[];s={...i},s=s.replace&&!t(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=/{.*}/.test(a[1])?a[1].lastIndexOf(`}`)+1:a[1].indexOf(this.formatSeparator);if(u!==-1&&(l=a[1].slice(u).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),a[1]=a[1].slice(0,u)),o=n(c.call(this,a[1].trim(),s),s),o&&a[0]===e&&!t(o))return o;t(o)||(o=r(o)),o||=(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),``),l.length&&(o=l.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:a[1].trim()}),o.trim())),e=e.replace(a[0],o),this.regexp.lastIndex=0}return e}};const ve=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},ye=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(v(r),i),t[o]=s),s(n)}},be=e=>(t,n,r)=>e(v(n),r)(t);var xe=class{constructor(e={}){this.logger=y.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?ye:be;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ye(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ve(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}};const Se=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};var Ce=class extends ae{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=y.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{u(n.loaded,[i],a),Se(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,n,r={},i){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),i&&i();t(e)&&(e=this.languageUtils.toResolveHierarchy(e)),t(n)&&(n=[n]);let a=this.queueLoad(e,n,r,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}};const we=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let n={};if(typeof e[1]==`object`&&(n=e[1]),t(e[1])&&(n.defaultValue=e[1]),t(e[2])&&(n.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let t=e[3]||e[2];Object.keys(t).forEach(e=>{n[e]=t[e]})}return n},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Te=e=>(t(e.ns)&&(e.ns=[e.ns]),t(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),t(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),Ee=()=>{},De=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Oe=`__i18next_supportNoticeShown`,ke=()=>!!(typeof globalThis<`u`&&globalThis[Oe]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env&&process.env.NODE_ENV===`production`),Ae=()=>{typeof globalThis<`u`&&(globalThis[Oe]=!0)},je=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),C=class e extends ae{constructor(e={},t){if(super(),this.options=Te(e),this.services={},this.logger=y,this.modules={external:[]},De(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},r){this.isInitializing=!0,typeof e==`function`&&(r=e,e={}),e.defaultNS==null&&e.ns&&(t(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let i=we();this.options={...i,...this.options,...Te(e)},this.options.interpolation={...i.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=i.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!je(this)&&!ke()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),Ae());let a=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?y.init(a(this.modules.logger),this.options):y.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:xe;let t=new de(this.options);this.store=new b(this.options.resources,this.options);let n=this.services;n.logger=y,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new me(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(n.formatter=a(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new _e(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Ce(a(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=a(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=a(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new ue(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,r||=Ee,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let o=n(),s=()=>{let e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),o.resolve(t),r(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?s():setTimeout(s,0),o}loadResources(e,n=Ee){let r=n,i=t(e)?e:this.language;if(typeof e==`function`&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return r();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};i?t(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(e)})}else r(null)}reloadResources(e,t,r){let i=n();return typeof e==`function`&&(r=e,e=void 0),typeof t==`function`&&(r=t,t=void 0),e||=this.languages,t||=this.options.ns,r||=Ee,this.services.backendConnector.reload(e,t,e=>{i.resolve(),r(e)}),i}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&x.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;let i=n();this.emit(`languageChanging`,e);let a=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(t,n)=>{n?this.isLanguageChangingTo===e&&(a(n),this.translator.changeLanguage(n),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,n),this.logger.log(`languageChanged`,n)):this.isLanguageChangingTo=void 0,i.resolve((...e)=>this.t(...e)),r&&r(t,(...e)=>this.t(...e))},s=n=>{!e&&!n&&this.services.languageDetector&&(n=[]);let r=t(n)?n:n&&n[0],i=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(t(n)?[n]:n);i&&(this.language||a(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{o(e,i)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),i}getFixedT(e,n,r){let i=(e,t,...n)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(n)),a.lng=a.lng||i.lng,a.lngs=a.lngs||i.lngs,a.ns=a.ns||i.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||r||i.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=S(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=S(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=S(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return t(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=r,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,r){let i=n();return this.options.ns?(t(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{i.resolve(),r&&r(e)}),i):(r&&r(),Promise.resolve())}loadLanguages(e,r){let i=n();t(e)&&(e=[e]);let a=this.options.preload||[],o=e.filter(e=>a.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=a.concat(o),this.loadResources(e=>{i.resolve(),r&&r(e)}),i):(r&&r(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new de(we());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=Ee){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new b(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...we().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new _e(n)}return a.translator=new ue(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();C.createInstance,C.dir,C.init,C.loadResources,C.reloadResources,C.use,C.changeLanguage,C.getFixedT,C.t,C.exists,C.setDefaultNamespace,C.hasLoadedNamespace,C.loadNamespaces,C.loadLanguages;const Me=[`en`,`zh-Hans`],Ne=/^zh(?:[-_]|$)/i,Pe=e=>Me.includes(e),Fe=e=>{if(!e)return null;let t=e.trim();return t?Pe(t)?t:Ne.test(t)?`zh-Hans`:t.toLowerCase().startsWith(`en`)?`en`:null:null},Ie=e=>{for(let t of e){let e=Fe(t);if(e)return e}return`en`};new Set(Me);const Le={finish:()=>{}},Re=()=>({setContext:()=>{},setFingerprint:()=>{},setLevel:()=>{},setTag:()=>{},setUser:()=>{}}),ze=()=>({addBreadcrumb:e=>{},captureException:e=>{},destroy:async()=>{},enabled:!1,flush:async()=>!0,init:async()=>{},startInactiveSpan:e=>Le,withScope:e=>e(Re())}),Be=e=>{if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t},Ve=e=>typeof e==`string`?e:String(e),He=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},Ue=e=>{let t={clientApp:e.clientApp,environment:e.environment,runtime:e.runtime,...e.appVersion?{appVersion:e.appVersion}:{},...e.release?{release:e.release}:{}},n={client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{}};return{contexts:{client:t},tags:n,user:{id:null}}},We=(e,t,n)=>{let r=He(n);if(Object.keys(r).length===0){delete e.contexts[t];return}e.contexts[t]=r},Ge=(e,t)=>{delete e.contexts[t]},Ke=(e,t,n)=>{if(n==null||n===``){delete e.tags[t];return}e.tags[t]=Ve(n)},qe=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Je=/^[a-f0-9]{16,}$/i,Ye=/^\d{4,}$/,Xe=new Set([`access_token`,`code`,`jwt`,`refresh_token`,`session`,`signature`,`state`,`token`]),Ze=new Set([`authorization`,`cookie`,`set-auth-token`,`set-cookie`,`x-api-key`,`x-auth-token`,`x-csrf-token`]),Qe=e=>e&&(qe.test(e)?`:uuid`:Ye.test(e)?`:id`:Je.test(e)?`:hash`:e),$e=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`forEach`in e&&typeof e.forEach==`function`,et=e=>{if(!e)return[];if($e(e)){let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t}return Array.isArray(e)?e.map(([e,t])=>[e,t]):Object.entries(e).flatMap(([e,t])=>Array.isArray(t)?t.map(t=>[e,String(t)]):t==null?[]:[[e,String(t)]])},tt=e=>{let t={};for(let[n,r]of et(e)){let e=n.toLowerCase();Ze.has(e)||(t[e]=r)}return t},nt=e=>{try{let t=new URL(e);t.username=``,t.password=``,t.hash=``,t.pathname=t.pathname.split(`/`).map(Qe).join(`/`);let n=new URLSearchParams;return t.searchParams.forEach((e,t)=>{Xe.has(t.toLowerCase())||n.append(t,e)}),t.search=n.toString(),t.toString()}catch{let[t]=e.split(`?`);return t??e}},rt=(e,t=512)=>e.length<=t?e:`${e.slice(0,t)}…`,it=e=>e<=0?!1:e>=1?!0:Math.random()<e,at=e=>e.errorClass===`user_facing`?`warning`:`error`,ot=e=>{switch(e){case`ok`:return`ok`;case`timeout`:return`deadline_exceeded`;case`send_failed`:return`internal_error`;default:return`internal_error`}},w=e=>e instanceof Error?e:Error(rt(typeof e==`string`?e:`Unknown frontend stability error`)),st=e=>e??`info`,ct=(e,t)=>{let n=e.flushTimeoutMs??1500,r=Ue(e),i=(e,n)=>t.withScope(t=>{for(let[e,n]of Object.entries(r.tags))t.setTag(e,n);for(let[e,n]of Object.entries(r.contexts))t.setContext(e,n);if(r.user.id&&t.setUser({id:r.user.id}),!e)return n();for(let[n,r]of Object.entries(e.tags??{}))r&&t.setTag(n,r);for(let[n,r]of Object.entries(e.contexts??{}))t.setContext(n,r);return e.level&&t.setLevel(e.level),e.fingerprint&&e.fingerprint.length>0&&t.setFingerprint(e.fingerprint),n()}),a=n=>{let r=Be({client_app:e.clientApp,environment:e.environment,runtime:e.runtime,...e.release?{release:e.release}:{},...n.attributes??{}});return t.startInactiveSpan({name:n.name,op:n.op,attributes:r})};return{addBreadcrumb:e=>{t.enabled&&(e.level!==`error`&&e.level!==`fatal`&&!it(.2)||t.addBreadcrumb({...e,level:st(e.level)}))},captureException:(e,n)=>{t.enabled&&i(n,()=>{t.captureException(w(e))})},clearScopeContext:e=>{Ge(r,e)},clearUser:()=>{r.user={id:null}},createHttpPort:()=>({onRequestStart:({kind:e,method:n,timeoutMs:r,url:o})=>{let s=a({name:`${n} ${e}`,op:`http.client`,attributes:{http_kind:e,http_method:n,http_url:o,...r===void 0?{}:{http_timeout_ms:r}}});return{finish:({error:a,status:c,statusCode:l})=>{s.finish({attributes:{http_result:c,...l===void 0?{}:{http_status_code:l}},status:ot(c)}),c===`error`&&a&&i({contexts:{http:{method:n,statusCode:l,timeoutMs:r,url:o}},level:`error`,tags:{http_kind:e,http_method:n,http_result:c}},()=>{t.captureException(w(a))})}}}}),createNetworkPort:()=>({onHeartbeatTimeout:({error:e,intervalMs:n})=>{i({contexts:{network:{intervalMs:n}},level:`warning`,tags:{transport_phase:`heartbeat_timeout`}},()=>{t.captureException(w(e??Error(`Heartbeat timed out`)))})},onRpcStart:({channel:e,timeoutMs:n})=>{let r=a({name:e,op:`rpc.client`,attributes:{rpc_channel:e,rpc_timeout_ms:n}});return{finish:a=>{r.finish({attributes:{rpc_result:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{rpc_error_class:a.errorClass}:{}},status:ot(a.status)}),a.status!==`ok`&&i({contexts:{rpc:{channel:e,code:a.code,domain:a.domain,errorClass:a.errorClass,timeoutMs:n}},level:at(a),tags:{rpc_channel:e,rpc_result:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{rpc_error_class:a.errorClass}:{}}},()=>{t.captureException(w(a.error))})}}},onTransportError:({error:e,phase:n})=>{i({contexts:{transport:{phase:n}},level:`error`,tags:{transport_phase:n}},()=>{t.captureException(w(e))})},onWsConnectStart:({kind:e})=>{let n=a({name:`ws.${e}`,op:`ws.connect`,attributes:{ws_kind:e}});return{finish:({error:r,status:a})=>{n.finish({attributes:{ws_kind:e,ws_result:a},status:ot(a)}),a===`error`&&i({contexts:{transport:{kind:e}},level:`error`,tags:{ws_kind:e,ws_result:a}},()=>{t.captureException(w(r))})}}},onWsEvent:({channel:e})=>{it(.2)&&t.addBreadcrumb({category:`ws.event`,data:{channel:e},level:`info`,message:`Received ${e}`})},onWsStatusChange:({status:e})=>{t.enabled&&t.addBreadcrumb({category:`ws.status`,data:{status:e},level:e===`error`?`error`:`info`,message:`Transport ${e}`})}}),flush:async e=>t.enabled?await t.flush(e??n):!1,setScopeContext:(e,t)=>{We(r,e,t)},setTag:(e,t)=>{Ke(r,e,t)},setUser:e=>{r.user=e},startSpan:a}},lt=e=>e.length===0?[ze()]:e,ut=e=>{let t=lt(e);return t.find(e=>e.enabled)??t[0]??ze()},dt=e=>{let t=lt(e),n=ut(t),r=t.filter(e=>e.enabled);return{addBreadcrumb:e=>{for(let n of t)try{n.addBreadcrumb(e)}catch{}},captureException:e=>{for(let n of t)try{n.captureException(e)}catch{}},destroy:async()=>{for(let e of t)if(e.destroy)try{await e.destroy()}catch{}},enabled:t.some(e=>e.enabled),flush:async e=>(await Promise.allSettled((r.length>0?r:t).map(async t=>{try{return await t.flush(e)}catch{return!1}}))).every(e=>e.status===`fulfilled`&&e.value===!0),init:async()=>{for(let e of t)if(e.init)try{await e.init()}catch{}},startInactiveSpan:e=>{try{return n.startInactiveSpan(e)}catch{return ze().startInactiveSpan(e)}},withScope:e=>{let t=e;try{return n.withScope(t)}catch{return ze().withScope(t)}}}};let ft=function(e){return e.NOOP=`noop`,e.POSTHOG_BROWSER=`posthog-browser`,e.POSTHOG_REACT_NATIVE=`posthog-react-native`,e.SENTRY=`sentry`,e}({});const pt=new Set(Object.values(ft)),mt=(e,t=[ft.SENTRY])=>{let n=e?.trim();if(!n)return{invalidNames:[],names:[...t]};let r=n.split(`,`),i=[],a=[];for(let e of r){let t=e.trim().toLowerCase();if(!t)continue;if(!pt.has(t)){i.push(t);continue}let n=t;a.includes(n)||a.push(n)}return a.length>0?{invalidNames:i,names:a}:{invalidNames:i,names:[]}},ht=e=>{let t={};for(let[n,r]of Object.entries(e))r==null||r===``||(t[n]=r);return t},gt=e=>Object.keys(e).length>0,_t=(e,t)=>{t.userId?e.setUser({id:t.userId}):e.clearUser(),e.setTag(`workspace_id`,t.workspaceId??null),e.setTag(`pipeline_id`,t.pipelineId??null),e.setTag(`task_id`,t.taskId??null),e.setTag(`environment_id`,t.environmentId??null),e.setTag(`route_view`,t.routeView??null),e.setTag(`command_name`,t.commandName??null),e.setTag(`auth_phase`,t.authPhase??null);let n=ht({deviceCode:t.deviceCode,environmentId:t.environmentId,memberId:t.memberId,pipelineId:t.pipelineId,taskId:t.taskId,workspaceId:t.workspaceId});gt(n)?e.setScopeContext(`echo`,n):e.clearScopeContext(`echo`);let r=ht({authPhase:t.authPhase,commandName:t.commandName,cwd:t.cwd,interactive:t.interactive,routeTemplate:t.routeTemplate,routeView:t.routeView,screen:t.screen});gt(r)?e.setScopeContext(`surface`,r):e.clearScopeContext(`surface`)},vt={finish:()=>{}},yt={finish:()=>{}},bt={finish:()=>{}},xt=()=>({onHeartbeatTimeout:()=>{},onRpcStart:()=>vt,onTransportError:()=>{},onWsConnectStart:()=>yt,onWsEvent:()=>{},onWsStatusChange:()=>{}}),St=()=>({onRequestStart:()=>bt}),Ct=/^[^@]+@([^+]+)(?:\+.+)?$/,wt=e=>{if(!e)return;let t=Ct.exec(e.trim())?.[1]?.trim();if(t)return t},Tt=/\/+$/,T=e=>e.replace(Tt,``),Et=e=>e instanceof Request?e.url:e instanceof URL?e.toString():e,Dt=(e,t)=>t?.method?t.method:e instanceof Request?e.method:`GET`,Ot=(e={})=>{let t=e.fetchImpl??fetch,n=e.observability??St(),r=e.kind??`http`;return async(e,i)=>{let a=nt(Et(e)),o=Dt(e,i).toUpperCase(),s=n.onRequestStart({kind:r,method:o,url:a});try{let n=await t(e,i);return s.finish({status:`ok`,statusCode:n.status}),n}catch(e){throw s.finish({status:`error`,error:e}),e}}};Object.freeze({status:`aborted`});function E(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var kt=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},At=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const jt={};function D(e){return e&&Object.assign(jt,e),jt}function Mt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Nt(e,t){return typeof t==`bigint`?t.toString():t}function Pt(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Ft(e){return e==null}function It(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Lt(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const Rt=Symbol(`evaluating`);function O(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Rt)return r===void 0&&(r=Rt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function k(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function A(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function zt(e){return JSON.stringify(e)}function Bt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Vt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ht(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ut=Pt(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function j(e){if(Ht(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ht(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Wt(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}const Gt=new Set([`string`,`number`,`symbol`]);function Kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function M(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function qt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Jt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Yt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return M(e,A(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return k(this,`shape`,e),e},checks:[]}))}function Xt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return M(e,A(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return k(this,`shape`,r),r},checks:[]}))}function Zt(e,t){if(!j(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return M(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return k(this,`shape`,n),n}}))}function Qt(e,t){if(!j(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return M(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return k(this,`shape`,n),n}}))}function $t(e,t){return M(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return k(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function en(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return M(t,A(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return k(this,`shape`,i),i},checks:[]}))}function tn(e,t,n){return M(t,A(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return k(this,`shape`,i),i}}))}function P(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nn(e){return typeof e==`string`?e:e?.message}function I(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nn(e.inst?._zod.def?.error?.(e))??nn(t?.error?.(e))??nn(n.customError?.(e))??nn(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function rn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function an(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const on=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Nt,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},sn=E(`$ZodError`,on),cn=E(`$ZodError`,on,{Parent:Error});function ln(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function un(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}const dn=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new kt;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,D())));throw Vt(t,i?.callee),t}return o.value},fn=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,D())));throw Vt(t,i?.callee),t}return o.value},pn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new kt;return a.issues.length?{success:!1,error:new(e??sn)(a.issues.map(e=>I(e,i,D())))}:{success:!0,data:a.value}},mn=pn(cn),hn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>I(e,i,D())))}:{success:!0,data:a.value}},gn=hn(cn),_n=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return dn(e)(t,n,i)},vn=e=>(t,n,r)=>dn(e)(t,n,r),yn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return fn(e)(t,n,i)},bn=e=>async(t,n,r)=>fn(e)(t,n,r),xn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pn(e)(t,n,i)},Sn=e=>(t,n,r)=>pn(e)(t,n,r),Cn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hn(e)(t,n,i)},wn=e=>async(t,n,r)=>hn(e)(t,n,r),Tn=/^[cC][^\s-]{8,}$/,En=/^[0-9a-z]+$/,Dn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,On=/^[0-9a-vA-V]{20}$/,kn=/^[A-Za-z0-9]{27}$/,An=/^[a-zA-Z0-9_-]{21}$/,jn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Nn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Fn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const In=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Rn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vn=/^[A-Za-z0-9_-]*$/,Hn=/^\+[1-9]\d{6,14}$/,Un=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Wn=RegExp(`^${Un}$`);function Gn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kn(e){return RegExp(`^${Gn(e)}$`)}function qn(e){let t=Gn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Un}T(?:${r})$`)}const Jn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yn=/^-?\d+$/,Xn=/^-?\d+(?:\.\d+)?$/,Zn=/^(?:true|false)$/i,Qn=/^null$/i,$n=/^[^A-Z]*$/,er=/^[^a-z]*$/,L=E(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tr={number:`number`,bigint:`bigint`,object:`date`},nr=E(`$ZodCheckLessThan`,(e,t)=>{L.init(e,t);let n=tr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rr=E(`$ZodCheckGreaterThan`,(e,t)=>{L.init(e,t);let n=tr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=E(`$ZodCheckMultipleOf`,(e,t)=>{L.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Lt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ar=E(`$ZodCheckNumberFormat`,(e,t)=>{L.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Jt[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),or=E(`$ZodCheckMaxLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ft(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=rn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sr=E(`$ZodCheckMinLength`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ft(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=rn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cr=E(`$ZodCheckLengthEquals`,(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ft(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=rn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),lr=E(`$ZodCheckStringFormat`,(e,t)=>{var n,r;L.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ur=E(`$ZodCheckRegex`,(e,t)=>{lr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dr=E(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$n,lr.init(e,t)}),fr=E(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=er,lr.init(e,t)}),pr=E(`$ZodCheckIncludes`,(e,t)=>{L.init(e,t);let n=Kt(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),mr=E(`$ZodCheckStartsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`^${Kt(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),hr=E(`$ZodCheckEndsWith`,(e,t)=>{L.init(e,t);let n=RegExp(`.*${Kt(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),gr=E(`$ZodCheckOverwrite`,(e,t)=>{L.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var _r=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
4
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
5
|
+
`))}};const vr={major:4,minor:3,patch:6},R=E(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=P(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new kt;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=P(e,t))});else{if(e.issues.length===t)continue;r||=P(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(P(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new kt;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new kt;return o.then(e=>t(e,r,a))}return t(o,r,a)}}O(e,`~standard`,()=>({validate:t=>{try{let n=mn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return gn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),yr=E(`$ZodString`,(e,t)=>{R.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Jn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),z=E(`$ZodStringFormat`,(e,t)=>{lr.init(e,t),yr.init(e,t)}),br=E(`$ZodGUID`,(e,t)=>{t.pattern??=Mn,z.init(e,t)}),xr=E(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Nn(e)}else t.pattern??=Nn();z.init(e,t)}),Sr=E(`$ZodEmail`,(e,t)=>{t.pattern??=Pn,z.init(e,t)}),Cr=E(`$ZodURL`,(e,t)=>{z.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),wr=E(`$ZodEmoji`,(e,t)=>{t.pattern??=Fn(),z.init(e,t)}),Tr=E(`$ZodNanoID`,(e,t)=>{t.pattern??=An,z.init(e,t)}),Er=E(`$ZodCUID`,(e,t)=>{t.pattern??=Tn,z.init(e,t)}),Dr=E(`$ZodCUID2`,(e,t)=>{t.pattern??=En,z.init(e,t)}),Or=E(`$ZodULID`,(e,t)=>{t.pattern??=Dn,z.init(e,t)}),kr=E(`$ZodXID`,(e,t)=>{t.pattern??=On,z.init(e,t)}),Ar=E(`$ZodKSUID`,(e,t)=>{t.pattern??=kn,z.init(e,t)}),jr=E(`$ZodISODateTime`,(e,t)=>{t.pattern??=qn(t),z.init(e,t)}),Mr=E(`$ZodISODate`,(e,t)=>{t.pattern??=Wn,z.init(e,t)}),Nr=E(`$ZodISOTime`,(e,t)=>{t.pattern??=Kn(t),z.init(e,t)}),Pr=E(`$ZodISODuration`,(e,t)=>{t.pattern??=jn,z.init(e,t)}),Fr=E(`$ZodIPv4`,(e,t)=>{t.pattern??=In,z.init(e,t),e._zod.bag.format=`ipv4`}),Ir=E(`$ZodIPv6`,(e,t)=>{t.pattern??=Ln,z.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Lr=E(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rn,z.init(e,t)}),Rr=E(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zn,z.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function zr(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Br=E(`$ZodBase64`,(e,t)=>{t.pattern??=Bn,z.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{zr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Vr(e){if(!Vn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return zr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Hr=E(`$ZodBase64URL`,(e,t)=>{t.pattern??=Vn,z.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Vr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ur=E(`$ZodE164`,(e,t)=>{t.pattern??=Hn,z.init(e,t)});function Wr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Gr=E(`$ZodJWT`,(e,t)=>{z.init(e,t),e._zod.check=n=>{Wr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Kr=E(`$ZodNumber`,(e,t)=>{R.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),qr=E(`$ZodNumberFormat`,(e,t)=>{ar.init(e,t),Kr.init(e,t)}),Jr=E(`$ZodBoolean`,(e,t)=>{R.init(e,t),e._zod.pattern=Zn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Yr=E(`$ZodNull`,(e,t)=>{R.init(e,t),e._zod.pattern=Qn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Xr=E(`$ZodUnknown`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),Zr=E(`$ZodNever`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Qr(e,t,n){e.issues.length&&t.issues.push(...F(n,e.issues)),t.value[n]=e.value}const $r=E(`$ZodArray`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Qr(t,n,e))):Qr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function ei(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...F(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ti(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=qt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ni(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ei(e,n,i,t,u))):ei(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const ri=E(`$ZodObject`,(e,t)=>{if(R.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Pt(()=>ti(t));O(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Ht,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>ei(n,t,e,s,r))):ei(i,t,e,s,r)}return i?ni(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ii=E(`$ZodObjectJIT`,(e,t)=>{ri.init(e,t);let n=e._zod.parse,r=Pt(()=>ti(t)),i=e=>{let t=new _r([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=zt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=zt(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
6
|
+
if (${n}.issues.length) {
|
|
7
|
+
if (${o} in input) {
|
|
8
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
9
|
+
...iss,
|
|
10
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
11
|
+
})));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (${n}.value === undefined) {
|
|
16
|
+
if (${o} in input) {
|
|
17
|
+
newResult[${o}] = undefined;
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
newResult[${o}] = ${n}.value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
`):t.write(`
|
|
24
|
+
if (${n}.issues.length) {
|
|
25
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
26
|
+
...iss,
|
|
27
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (${n}.value === undefined) {
|
|
32
|
+
if (${o} in input) {
|
|
33
|
+
newResult[${o}] = undefined;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
newResult[${o}] = ${n}.value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Ht,s=!jt.jitless,c=s&&Ut.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ni([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function ai(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!P(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>I(e,r,D())))}),t)}const oi=E(`$ZodUnion`,(e,t)=>{R.init(e,t),O(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),O(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),O(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),O(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>It(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>ai(t,i,e,a)):ai(s,i,e,a)}}),si=E(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,oi.init(e,t);let n=e._zod.parse;O(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Pt(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Ht(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),ci=E(`$ZodIntersection`,(e,t)=>{R.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ui(e,t,n)):ui(e,i,a)}});function li(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(j(e)&&j(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=li(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=li(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ui(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),P(e))return e;let o=li(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const di=E(`$ZodRecord`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!j(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...F(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...F(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Xn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>I(e,r,D())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...F(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...F(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),fi=E(`$ZodEnum`,(e,t)=>{R.init(e,t);let n=Mt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Gt.has(typeof e)).map(e=>typeof e==`string`?Kt(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),pi=E(`$ZodLiteral`,(e,t)=>{if(R.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Kt(e):e?Kt(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),mi=E(`$ZodTransform`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new At(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new kt;return n.value=i,n}});function hi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const gi=E(`$ZodOptional`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),O(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${It(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>hi(t,e.value)):hi(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),_i=E(`$ZodExactOptional`,(e,t)=>{gi.init(e,t),O(e._zod,`values`,()=>t.innerType._zod.values),O(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),vi=E(`$ZodNullable`,(e,t)=>{R.init(e,t),O(e._zod,`optin`,()=>t.innerType._zod.optin),O(e._zod,`optout`,()=>t.innerType._zod.optout),O(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${It(e.source)}|null)$`):void 0}),O(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),yi=E(`$ZodDefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>bi(e,t)):bi(r,t)}});function bi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const xi=E(`$ZodPrefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Si=E(`$ZodNonOptional`,(e,t)=>{R.init(e,t),O(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ci(t,e)):Ci(i,e)}});function Ci(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const wi=E(`$ZodCatch`,(e,t)=>{R.init(e,t),O(e._zod,`optin`,()=>t.innerType._zod.optin),O(e._zod,`optout`,()=>t.innerType._zod.optout),O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,D()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,D()))},input:e.value}),e.issues=[]),e)}}),Ti=E(`$ZodPipe`,(e,t)=>{R.init(e,t),O(e._zod,`values`,()=>t.in._zod.values),O(e._zod,`optin`,()=>t.in._zod.optin),O(e._zod,`optout`,()=>t.out._zod.optout),O(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ei(e,t.in,n)):Ei(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ei(e,t.out,n)):Ei(r,t.out,n)}});function Ei(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Di=E(`$ZodReadonly`,(e,t)=>{R.init(e,t),O(e._zod,`propValues`,()=>t.innerType._zod.propValues),O(e._zod,`values`,()=>t.innerType._zod.values),O(e._zod,`optin`,()=>t.innerType?._zod?.optin),O(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Oi):Oi(r)}});function Oi(e){return e.value=Object.freeze(e.value),e}const ki=E(`$ZodLazy`,(e,t)=>{R.init(e,t),O(e._zod,`innerType`,()=>t.getter()),O(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),O(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),O(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),O(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ai=E(`$ZodCustom`,(e,t)=>{L.init(e,t),R.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ji(t,n,r,e));ji(i,n,r,e)}});function ji(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(an(e))}}var Mi,Ni=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Pi(){return new Ni}(Mi=globalThis).__zod_globalRegistry??(Mi.__zod_globalRegistry=Pi());const Fi=globalThis.__zod_globalRegistry;function Ii(e,t){return new e({type:`string`,...N(t)})}function Li(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}function Ri(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}function zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}function Ui(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}function Wi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}function Gi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}function Ki(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}function qi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}function Ji(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}function Yi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}function Xi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}function Zi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}function Qi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}function $i(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}function ea(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}function ta(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}function na(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}function ra(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}function ia(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(t)})}function aa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N(t)})}function oa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}function sa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}function ca(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}function la(e,t){return new e({type:`number`,checks:[],...N(t)})}function ua(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...N(t)})}function da(e,t){return new e({type:`boolean`,...N(t)})}function fa(e,t){return new e({type:`null`,...N(t)})}function pa(e){return new e({type:`unknown`})}function ma(e,t){return new e({type:`never`,...N(t)})}function ha(e,t){return new nr({check:`less_than`,...N(t),value:e,inclusive:!1})}function ga(e,t){return new nr({check:`less_than`,...N(t),value:e,inclusive:!0})}function _a(e,t){return new rr({check:`greater_than`,...N(t),value:e,inclusive:!1})}function va(e,t){return new rr({check:`greater_than`,...N(t),value:e,inclusive:!0})}function ya(e,t){return new ir({check:`multiple_of`,...N(t),value:e})}function ba(e,t){return new or({check:`max_length`,...N(t),maximum:e})}function xa(e,t){return new sr({check:`min_length`,...N(t),minimum:e})}function Sa(e,t){return new cr({check:`length_equals`,...N(t),length:e})}function Ca(e,t){return new ur({check:`string_format`,format:`regex`,...N(t),pattern:e})}function wa(e){return new dr({check:`string_format`,format:`lowercase`,...N(e)})}function Ta(e){return new fr({check:`string_format`,format:`uppercase`,...N(e)})}function Ea(e,t){return new pr({check:`string_format`,format:`includes`,...N(t),includes:e})}function Da(e,t){return new mr({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}function Oa(e,t){return new hr({check:`string_format`,format:`ends_with`,...N(t),suffix:e})}function B(e){return new gr({check:`overwrite`,tx:e})}function ka(e){return B(t=>t.normalize(e))}function Aa(){return B(e=>e.trim())}function ja(){return B(e=>e.toLowerCase())}function Ma(){return B(e=>e.toUpperCase())}function Na(){return B(e=>Bt(e))}function Pa(e,t,n){return new e({type:`array`,element:t,...N(n)})}function Fa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N(n)})}function Ia(e){let t=La(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(an(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(an(r))}},e(n.value,n)));return t}function La(e,t){let n=new L({check:`custom`,...N(t)});return n._zod.check=e,n}function Ra(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Fi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function V(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,V(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&H(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function za(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
40
|
+
|
|
41
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ba(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Ha(t,`input`,e.processors),output:Ha(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function H(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return H(r.element,n);if(r.type===`set`)return H(r.valueType,n);if(r.type===`lazy`)return H(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return H(r.innerType,n);if(r.type===`intersection`)return H(r.left,n)||H(r.right,n);if(r.type===`record`||r.type===`map`)return H(r.keyType,n)||H(r.valueType,n);if(r.type===`pipe`)return H(r.in,n)||H(r.out,n);if(r.type===`object`){for(let e in r.shape)if(H(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(H(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(H(e,n))return!0;return!!(r.rest&&H(r.rest,n))}return!1}const Va=(e,t={})=>n=>{let r=Ra({...n,processors:t});return V(e,r),za(r,e),Ba(r,e)},Ha=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ra({...i??{},target:a,io:t,processors:n});return V(e,o),za(o,e),Ba(o,e)},Ua={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Wa=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ua[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ga=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Ka=(e,t,n,r)=>{n.type=`boolean`},qa=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ja=(e,t,n,r)=>{n.not={}},Ya=(e,t,n,r)=>{let i=e._zod.def,a=Mt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Xa=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Za=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Qa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},$a=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=V(a.element,t,{...r,path:[...r.path,`items`]})},eo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=V(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=V(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},to=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>V(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},no=(e,t,n,r)=>{let i=e._zod.def,a=V(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=V(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ro=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=V(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=V(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=V(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},io=(e,t,n,r)=>{let i=e._zod.def,a=V(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ao=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},oo=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},so=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},co=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},lo=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;V(a,t,r);let o=t.seen.get(e);o.ref=a},uo=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fo=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},po=(e,t,n,r)=>{let i=e._zod.innerType;V(i,t,r);let a=t.seen.get(e);a.ref=i},mo=E(`ZodISODateTime`,(e,t)=>{jr.init(e,t),K.init(e,t)});function ho(e){return aa(mo,e)}const go=E(`ZodISODate`,(e,t)=>{Mr.init(e,t),K.init(e,t)});function _o(e){return oa(go,e)}const vo=E(`ZodISOTime`,(e,t)=>{Nr.init(e,t),K.init(e,t)});function yo(e){return sa(vo,e)}const bo=E(`ZodISODuration`,(e,t)=>{Pr.init(e,t),K.init(e,t)});function xo(e){return ca(bo,e)}const So=(e,t)=>{sn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>un(e,t)},flatten:{value:t=>ln(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Nt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Nt,2)}},isEmpty:{get(){return e.issues.length===0}}})};E(`ZodError`,So);const U=E(`ZodError`,So,{Parent:Error}),Co=dn(U),wo=fn(U),To=pn(U),Eo=hn(U),Do=_n(U),Oo=vn(U),ko=yn(U),Ao=bn(U),jo=xn(U),Mo=Sn(U),No=Cn(U),Po=wn(U),W=E(`ZodType`,(e,t)=>(R.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ha(e,`input`),output:Ha(e,`output`)}}),e.toJSONSchema=Va(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(A(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>M(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Co(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>To(e,t,n),e.parseAsync=async(t,n)=>wo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Eo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Do(e,t,n),e.decode=(t,n)=>Oo(e,t,n),e.encodeAsync=async(t,n)=>ko(e,t,n),e.decodeAsync=async(t,n)=>Ao(e,t,n),e.safeEncode=(t,n)=>jo(e,t,n),e.safeDecode=(t,n)=>Mo(e,t,n),e.safeEncodeAsync=async(t,n)=>No(e,t,n),e.safeDecodeAsync=async(t,n)=>Po(e,t,n),e.refine=(t,n)=>e.check(Zs(t,n)),e.superRefine=t=>e.check(Qs(t)),e.overwrite=t=>e.check(B(t)),e.optional=()=>js(e),e.exactOptional=()=>Ns(e),e.nullable=()=>Fs(e),e.nullish=()=>js(Fs(e)),e.nonoptional=t=>Vs(e,t),e.array=()=>hs(e),e.or=t=>vs([e,t]),e.and=t=>Ss(e,t),e.transform=t=>Gs(e,ks(t)),e.default=t=>Ls(e,t),e.prefault=t=>zs(e,t),e.catch=t=>Us(e,t),e.pipe=t=>Gs(e,t),e.readonly=()=>qs(e),e.describe=t=>{let n=e.clone();return Fi.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Fi.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Fi.get(e);let n=e.clone();return Fi.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Fo=E(`_ZodString`,(e,t)=>{yr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ca(...t)),e.includes=(...t)=>e.check(Ea(...t)),e.startsWith=(...t)=>e.check(Da(...t)),e.endsWith=(...t)=>e.check(Oa(...t)),e.min=(...t)=>e.check(xa(...t)),e.max=(...t)=>e.check(ba(...t)),e.length=(...t)=>e.check(Sa(...t)),e.nonempty=(...t)=>e.check(xa(1,...t)),e.lowercase=t=>e.check(wa(t)),e.uppercase=t=>e.check(Ta(t)),e.trim=()=>e.check(Aa()),e.normalize=(...t)=>e.check(ka(...t)),e.toLowerCase=()=>e.check(ja()),e.toUpperCase=()=>e.check(Ma()),e.slugify=()=>e.check(Na())}),Io=E(`ZodString`,(e,t)=>{yr.init(e,t),Fo.init(e,t),e.email=t=>e.check(Li(Lo,t)),e.url=t=>e.check(Ui(Bo,t)),e.jwt=t=>e.check(ia(ts,t)),e.emoji=t=>e.check(Wi(Vo,t)),e.guid=t=>e.check(Ri(Ro,t)),e.uuid=t=>e.check(zi(zo,t)),e.uuidv4=t=>e.check(Bi(zo,t)),e.uuidv6=t=>e.check(Vi(zo,t)),e.uuidv7=t=>e.check(Hi(zo,t)),e.nanoid=t=>e.check(Gi(Ho,t)),e.guid=t=>e.check(Ri(Ro,t)),e.cuid=t=>e.check(Ki(Uo,t)),e.cuid2=t=>e.check(qi(Wo,t)),e.ulid=t=>e.check(Ji(Go,t)),e.base64=t=>e.check(ta(Qo,t)),e.base64url=t=>e.check(na($o,t)),e.xid=t=>e.check(Yi(Ko,t)),e.ksuid=t=>e.check(Xi(qo,t)),e.ipv4=t=>e.check(Zi(Jo,t)),e.ipv6=t=>e.check(Qi(Yo,t)),e.cidrv4=t=>e.check($i(Xo,t)),e.cidrv6=t=>e.check(ea(Zo,t)),e.e164=t=>e.check(ra(es,t)),e.datetime=t=>e.check(ho(t)),e.date=t=>e.check(_o(t)),e.time=t=>e.check(yo(t)),e.duration=t=>e.check(xo(t))});function G(e){return Ii(Io,e)}const K=E(`ZodStringFormat`,(e,t)=>{z.init(e,t),Fo.init(e,t)}),Lo=E(`ZodEmail`,(e,t)=>{Sr.init(e,t),K.init(e,t)}),Ro=E(`ZodGUID`,(e,t)=>{br.init(e,t),K.init(e,t)}),zo=E(`ZodUUID`,(e,t)=>{xr.init(e,t),K.init(e,t)}),Bo=E(`ZodURL`,(e,t)=>{Cr.init(e,t),K.init(e,t)}),Vo=E(`ZodEmoji`,(e,t)=>{wr.init(e,t),K.init(e,t)}),Ho=E(`ZodNanoID`,(e,t)=>{Tr.init(e,t),K.init(e,t)}),Uo=E(`ZodCUID`,(e,t)=>{Er.init(e,t),K.init(e,t)}),Wo=E(`ZodCUID2`,(e,t)=>{Dr.init(e,t),K.init(e,t)}),Go=E(`ZodULID`,(e,t)=>{Or.init(e,t),K.init(e,t)}),Ko=E(`ZodXID`,(e,t)=>{kr.init(e,t),K.init(e,t)}),qo=E(`ZodKSUID`,(e,t)=>{Ar.init(e,t),K.init(e,t)}),Jo=E(`ZodIPv4`,(e,t)=>{Fr.init(e,t),K.init(e,t)}),Yo=E(`ZodIPv6`,(e,t)=>{Ir.init(e,t),K.init(e,t)}),Xo=E(`ZodCIDRv4`,(e,t)=>{Lr.init(e,t),K.init(e,t)}),Zo=E(`ZodCIDRv6`,(e,t)=>{Rr.init(e,t),K.init(e,t)}),Qo=E(`ZodBase64`,(e,t)=>{Br.init(e,t),K.init(e,t)}),$o=E(`ZodBase64URL`,(e,t)=>{Hr.init(e,t),K.init(e,t)}),es=E(`ZodE164`,(e,t)=>{Ur.init(e,t),K.init(e,t)}),ts=E(`ZodJWT`,(e,t)=>{Gr.init(e,t),K.init(e,t)}),ns=E(`ZodNumber`,(e,t)=>{Kr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r),e.gt=(t,n)=>e.check(_a(t,n)),e.gte=(t,n)=>e.check(va(t,n)),e.min=(t,n)=>e.check(va(t,n)),e.lt=(t,n)=>e.check(ha(t,n)),e.lte=(t,n)=>e.check(ga(t,n)),e.max=(t,n)=>e.check(ga(t,n)),e.int=t=>e.check(as(t)),e.safe=t=>e.check(as(t)),e.positive=t=>e.check(_a(0,t)),e.nonnegative=t=>e.check(va(0,t)),e.negative=t=>e.check(ha(0,t)),e.nonpositive=t=>e.check(ga(0,t)),e.multipleOf=(t,n)=>e.check(ya(t,n)),e.step=(t,n)=>e.check(ya(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function rs(e){return la(ns,e)}const is=E(`ZodNumberFormat`,(e,t)=>{qr.init(e,t),ns.init(e,t)});function as(e){return ua(is,e)}const os=E(`ZodBoolean`,(e,t)=>{Jr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r)});function ss(e){return da(os,e)}const cs=E(`ZodNull`,(e,t)=>{Yr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r)});function ls(e){return fa(cs,e)}const us=E(`ZodUnknown`,(e,t)=>{Xr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ds(){return pa(us)}const fs=E(`ZodNever`,(e,t)=>{Zr.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r)});function ps(e){return ma(fs,e)}const ms=E(`ZodArray`,(e,t)=>{$r.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(xa(t,n)),e.nonempty=t=>e.check(xa(1,t)),e.max=(t,n)=>e.check(ba(t,n)),e.length=(t,n)=>e.check(Sa(t,n)),e.unwrap=()=>e.element});function hs(e,t){return Pa(ms,e,t)}const gs=E(`ZodObject`,(e,t)=>{ii.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),O(e,`shape`,()=>t.shape),e.keyof=()=>Es(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ds()}),e.loose=()=>e.clone({...e._zod.def,catchall:ds()}),e.strict=()=>e.clone({...e._zod.def,catchall:ps()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Zt(e,t),e.safeExtend=t=>Qt(e,t),e.merge=t=>$t(e,t),e.pick=t=>Yt(e,t),e.omit=t=>Xt(e,t),e.partial=(...t)=>en(As,e,t[0]),e.required=(...t)=>tn(Bs,e,t[0])});function q(e,t){return new gs({type:`object`,shape:e??{},...N(t)})}const _s=E(`ZodUnion`,(e,t)=>{oi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e.options=t.options});function vs(e,t){return new _s({type:`union`,options:e,...N(t)})}const ys=E(`ZodDiscriminatedUnion`,(e,t)=>{_s.init(e,t),si.init(e,t)});function bs(e,t,n){return new ys({type:`union`,options:t,discriminator:e,...N(n)})}const xs=E(`ZodIntersection`,(e,t)=>{ci.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function Ss(e,t){return new xs({type:`intersection`,left:e,right:t})}const Cs=E(`ZodRecord`,(e,t)=>{di.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ws(e,t,n){return new Cs({type:`record`,keyType:e,valueType:t,...N(n)})}const Ts=E(`ZodEnum`,(e,t)=>{fi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ya(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ts({...t,checks:[],...N(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ts({...t,checks:[],...N(r),entries:i})}});function Es(e,t){return new Ts({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N(t)})}const Ds=E(`ZodLiteral`,(e,t)=>{pi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new Ds({type:`literal`,values:Array.isArray(e)?e:[e],...N(t)})}const Os=E(`ZodTransform`,(e,t)=>{mi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new At(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(an(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(an(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ks(e){return new Os({type:`transform`,transform:e})}const As=E(`ZodOptional`,(e,t)=>{gi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function js(e){return new As({type:`optional`,innerType:e})}const Ms=E(`ZodExactOptional`,(e,t)=>{_i.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ns(e){return new Ms({type:`optional`,innerType:e})}const Ps=E(`ZodNullable`,(e,t)=>{vi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fs(e){return new Ps({type:`nullable`,innerType:e})}const Is=E(`ZodDefault`,(e,t)=>{yi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ls(e,t){return new Is({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Wt(t)}})}const Rs=E(`ZodPrefault`,(e,t)=>{xi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zs(e,t){return new Rs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Wt(t)}})}const Bs=E(`ZodNonOptional`,(e,t)=>{Si.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vs(e,t){return new Bs({type:`nonoptional`,innerType:e,...N(t)})}const Hs=E(`ZodCatch`,(e,t)=>{wi.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Us(e,t){return new Hs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Ws=E(`ZodPipe`,(e,t)=>{Ti.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.in=t.in,e.out=t.out});function Gs(e,t){return new Ws({type:`pipe`,in:e,out:t})}const Ks=E(`ZodReadonly`,(e,t)=>{Di.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qs(e){return new Ks({type:`readonly`,innerType:e})}const Js=E(`ZodLazy`,(e,t)=>{ki.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Ys(e){return new Js({type:`lazy`,getter:e})}const Xs=E(`ZodCustom`,(e,t)=>{Ai.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r)});function Zs(e,t={}){return Fa(Xs,e,t)}function Qs(e){return Ia(e)}q({identityToken:G().trim().min(1),nonce:G().trim().optional().nullable(),email:G().trim().email().optional().nullable(),name:q({firstName:G().trim().optional().nullable(),lastName:G().trim().optional().nullable()}).optional().nullable(),preferredLanguage:Es(Me)}),q({isAvailable:ss()});const $s=Ys(()=>vs([G(),rs(),ss(),ls(),hs($s),ws(G(),$s)])),ec=q({error:G().trim().min(1),details:ws(G(),$s)}),tc=q({expiresAt:G().datetime(),updatedAt:G().datetime()}),nc=q({id:G().trim().min(1),email:G().trim().email(),name:G(),image:G().nullable()}),rc=q({token:G().trim().min(1),onboardingCompleted:ss(),session:tc,user:nc}),ic=q({token:G().trim().min(1)});q({token:G().trim().min(1)});const Y={PENDING:`pending`,COMPLETED:`completed`,EXPIRED:`expired`,ERROR:`error`};Y.COMPLETED,Y.EXPIRED,Y.ERROR;const ac={BROWSER_PAGE:`browser_page`,DEEP_LINK:`deep_link`},oc={GITHUB:`github`,GOOGLE:`google`,SLACK:`slack`},sc={GOOGLE_WORKSPACE:`google-workspace`},cc=Es([ac.BROWSER_PAGE,ac.DEEP_LINK]),lc=Es([oc.GITHUB,oc.GOOGLE,oc.SLACK]),uc=Es([sc.GOOGLE_WORKSPACE]);q({returnMode:cc,preferredLanguage:Es(Me)});const dc=q({authorizationUrl:G().trim().min(1),expiresAt:G().datetime(),state:G().trim().min(1)}),fc=dc.extend({provider:lc}),pc=dc.extend({provider:uc}),mc=q({state:G().trim().min(1)}),hc=mc.extend({expiresAt:G().datetime(),name:G(),token:G().trim().min(1),userId:G().trim().min(1),avatarUrl:G()}),gc=mc.extend({reason:G().trim().min(1),status:J(Y.ERROR)}),_c=bs(`status`,[mc.extend({provider:lc,status:J(Y.PENDING)}),hc.extend({provider:lc,status:J(Y.COMPLETED)}),mc.extend({provider:lc,status:J(Y.EXPIRED)}),gc.extend({provider:lc})]),vc=bs(`status`,[mc.extend({provider:uc,status:J(Y.PENDING)}),hc.extend({provider:uc,status:J(Y.COMPLETED)}),mc.extend({provider:uc,status:J(Y.EXPIRED)}),gc.extend({provider:uc})]);var yc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.USE_PROXY=e.UNSUPPORTED_MEDIA_TYPE=e.UNPROCESSABLE_ENTITY=e.UNAUTHORIZED=e.TOO_MANY_REQUESTS=e.TEMPORARY_REDIRECT=e.SWITCHING_PROTOCOLS=e.SERVICE_UNAVAILABLE=e.SEE_OTHER=e.RESET_CONTENT=e.REQUESTED_RANGE_NOT_SATISFIABLE=e.REQUEST_URI_TOO_LONG=e.REQUEST_TOO_LONG=e.REQUEST_TIMEOUT=e.REQUEST_HEADER_FIELDS_TOO_LARGE=e.PROXY_AUTHENTICATION_REQUIRED=e.PROCESSING=e.PRECONDITION_REQUIRED=e.PRECONDITION_FAILED=e.PERMANENT_REDIRECT=e.PAYMENT_REQUIRED=e.PARTIAL_CONTENT=e.OK=e.NOT_MODIFIED=e.NOT_IMPLEMENTED=e.NOT_FOUND=e.NOT_ACCEPTABLE=e.NON_AUTHORITATIVE_INFORMATION=e.NO_CONTENT=e.NETWORK_AUTHENTICATION_REQUIRED=e.MULTIPLE_CHOICES=e.MULTI_STATUS=e.MOVED_TEMPORARILY=e.MOVED_PERMANENTLY=e.METHOD_NOT_ALLOWED=e.METHOD_FAILURE=e.LOCKED=e.LENGTH_REQUIRED=e.INTERNAL_SERVER_ERROR=e.INSUFFICIENT_STORAGE=e.INSUFFICIENT_SPACE_ON_RESOURCE=e.IM_A_TEAPOT=e.HTTP_VERSION_NOT_SUPPORTED=e.GONE=e.GATEWAY_TIMEOUT=e.FORBIDDEN=e.FAILED_DEPENDENCY=e.EXPECTATION_FAILED=e.CREATED=e.CONTINUE=e.CONFLICT=e.BAD_REQUEST=e.BAD_GATEWAY=e.ACCEPTED=void 0,e.ACCEPTED=202,e.BAD_GATEWAY=502,e.BAD_REQUEST=400,e.CONFLICT=409,e.CONTINUE=100,e.CREATED=201,e.EXPECTATION_FAILED=417,e.FAILED_DEPENDENCY=424,e.FORBIDDEN=403,e.GATEWAY_TIMEOUT=504,e.GONE=410,e.HTTP_VERSION_NOT_SUPPORTED=505,e.IM_A_TEAPOT=418,e.INSUFFICIENT_SPACE_ON_RESOURCE=419,e.INSUFFICIENT_STORAGE=507,e.INTERNAL_SERVER_ERROR=500,e.LENGTH_REQUIRED=411,e.LOCKED=423,e.METHOD_FAILURE=420,e.METHOD_NOT_ALLOWED=405,e.MOVED_PERMANENTLY=301,e.MOVED_TEMPORARILY=302,e.MULTI_STATUS=207,e.MULTIPLE_CHOICES=300,e.NETWORK_AUTHENTICATION_REQUIRED=511,e.NO_CONTENT=204,e.NON_AUTHORITATIVE_INFORMATION=203,e.NOT_ACCEPTABLE=406,e.NOT_FOUND=404,e.NOT_IMPLEMENTED=501,e.NOT_MODIFIED=304,e.OK=200,e.PARTIAL_CONTENT=206,e.PAYMENT_REQUIRED=402,e.PERMANENT_REDIRECT=308,e.PRECONDITION_FAILED=412,e.PRECONDITION_REQUIRED=428,e.PROCESSING=102,e.PROXY_AUTHENTICATION_REQUIRED=407,e.REQUEST_HEADER_FIELDS_TOO_LARGE=431,e.REQUEST_TIMEOUT=408,e.REQUEST_TOO_LONG=413,e.REQUEST_URI_TOO_LONG=414,e.REQUESTED_RANGE_NOT_SATISFIABLE=416,e.RESET_CONTENT=205,e.SEE_OTHER=303,e.SERVICE_UNAVAILABLE=503,e.SWITCHING_PROTOCOLS=101,e.TEMPORARY_REDIRECT=307,e.TOO_MANY_REQUESTS=429,e.UNAUTHORIZED=401,e.UNPROCESSABLE_ENTITY=422,e.UNSUPPORTED_MEDIA_TYPE=415,e.USE_PROXY=305,e.default={ACCEPTED:e.ACCEPTED,BAD_GATEWAY:e.BAD_GATEWAY,BAD_REQUEST:e.BAD_REQUEST,CONFLICT:e.CONFLICT,CONTINUE:e.CONTINUE,CREATED:e.CREATED,EXPECTATION_FAILED:e.EXPECTATION_FAILED,FORBIDDEN:e.FORBIDDEN,GATEWAY_TIMEOUT:e.GATEWAY_TIMEOUT,GONE:e.GONE,HTTP_VERSION_NOT_SUPPORTED:e.HTTP_VERSION_NOT_SUPPORTED,IM_A_TEAPOT:e.IM_A_TEAPOT,INSUFFICIENT_SPACE_ON_RESOURCE:e.INSUFFICIENT_SPACE_ON_RESOURCE,INSUFFICIENT_STORAGE:e.INSUFFICIENT_STORAGE,INTERNAL_SERVER_ERROR:e.INTERNAL_SERVER_ERROR,LENGTH_REQUIRED:e.LENGTH_REQUIRED,LOCKED:e.LOCKED,METHOD_FAILURE:e.METHOD_FAILURE,METHOD_NOT_ALLOWED:e.METHOD_NOT_ALLOWED,MOVED_PERMANENTLY:e.MOVED_PERMANENTLY,MOVED_TEMPORARILY:e.MOVED_TEMPORARILY,MULTI_STATUS:e.MULTI_STATUS,MULTIPLE_CHOICES:e.MULTIPLE_CHOICES,NETWORK_AUTHENTICATION_REQUIRED:e.NETWORK_AUTHENTICATION_REQUIRED,NO_CONTENT:e.NO_CONTENT,NON_AUTHORITATIVE_INFORMATION:e.NON_AUTHORITATIVE_INFORMATION,NOT_ACCEPTABLE:e.NOT_ACCEPTABLE,NOT_FOUND:e.NOT_FOUND,NOT_IMPLEMENTED:e.NOT_IMPLEMENTED,NOT_MODIFIED:e.NOT_MODIFIED,OK:e.OK,PARTIAL_CONTENT:e.PARTIAL_CONTENT,PAYMENT_REQUIRED:e.PAYMENT_REQUIRED,PERMANENT_REDIRECT:e.PERMANENT_REDIRECT,PRECONDITION_FAILED:e.PRECONDITION_FAILED,PRECONDITION_REQUIRED:e.PRECONDITION_REQUIRED,PROCESSING:e.PROCESSING,PROXY_AUTHENTICATION_REQUIRED:e.PROXY_AUTHENTICATION_REQUIRED,REQUEST_HEADER_FIELDS_TOO_LARGE:e.REQUEST_HEADER_FIELDS_TOO_LARGE,REQUEST_TIMEOUT:e.REQUEST_TIMEOUT,REQUEST_TOO_LONG:e.REQUEST_TOO_LONG,REQUEST_URI_TOO_LONG:e.REQUEST_URI_TOO_LONG,REQUESTED_RANGE_NOT_SATISFIABLE:e.REQUESTED_RANGE_NOT_SATISFIABLE,RESET_CONTENT:e.RESET_CONTENT,SEE_OTHER:e.SEE_OTHER,SERVICE_UNAVAILABLE:e.SERVICE_UNAVAILABLE,SWITCHING_PROTOCOLS:e.SWITCHING_PROTOCOLS,TEMPORARY_REDIRECT:e.TEMPORARY_REDIRECT,TOO_MANY_REQUESTS:e.TOO_MANY_REQUESTS,UNAUTHORIZED:e.UNAUTHORIZED,UNPROCESSABLE_ENTITY:e.UNPROCESSABLE_ENTITY,UNSUPPORTED_MEDIA_TYPE:e.UNSUPPORTED_MEDIA_TYPE,USE_PROXY:e.USE_PROXY}})),bc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reasonPhraseToStatusCode=e.statusCodeToReasonPhrase=void 0,e.statusCodeToReasonPhrase={202:`Accepted`,502:`Bad Gateway`,400:`Bad Request`,409:`Conflict`,100:`Continue`,201:`Created`,417:`Expectation Failed`,424:`Failed Dependency`,403:`Forbidden`,504:`Gateway Timeout`,410:`Gone`,505:`HTTP Version Not Supported`,418:`I'm a teapot`,419:`Insufficient Space on Resource`,507:`Insufficient Storage`,500:`Internal Server Error`,411:`Length Required`,423:`Locked`,420:`Method Failure`,405:`Method Not Allowed`,301:`Moved Permanently`,302:`Moved Temporarily`,207:`Multi-Status`,300:`Multiple Choices`,511:`Network Authentication Required`,204:`No Content`,203:`Non Authoritative Information`,406:`Not Acceptable`,404:`Not Found`,501:`Not Implemented`,304:`Not Modified`,200:`OK`,206:`Partial Content`,402:`Payment Required`,308:`Permanent Redirect`,412:`Precondition Failed`,428:`Precondition Required`,102:`Processing`,103:`Early Hints`,426:`Upgrade Required`,407:`Proxy Authentication Required`,431:`Request Header Fields Too Large`,408:`Request Timeout`,413:`Request Entity Too Large`,414:`Request-URI Too Long`,416:`Requested Range Not Satisfiable`,205:`Reset Content`,303:`See Other`,503:`Service Unavailable`,101:`Switching Protocols`,307:`Temporary Redirect`,429:`Too Many Requests`,401:`Unauthorized`,451:`Unavailable For Legal Reasons`,422:`Unprocessable Entity`,415:`Unsupported Media Type`,305:`Use Proxy`,421:`Misdirected Request`},e.reasonPhraseToStatusCode={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421}})),xc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStatusText=e.getStatusCode=e.getReasonPhrase=void 0;var t=bc();function n(e){var n=t.statusCodeToReasonPhrase[e.toString()];if(!n)throw Error(`Status code does not exist: `+e);return n}e.getReasonPhrase=n;function r(e){var n=t.reasonPhraseToStatusCode[e];if(!n)throw Error(`Reason phrase does not exist: `+e);return n}e.getStatusCode=r,e.getStatusText=n})),Sc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.StatusCodes=void 0,(function(e){e[e.CONTINUE=100]=`CONTINUE`,e[e.SWITCHING_PROTOCOLS=101]=`SWITCHING_PROTOCOLS`,e[e.PROCESSING=102]=`PROCESSING`,e[e.EARLY_HINTS=103]=`EARLY_HINTS`,e[e.OK=200]=`OK`,e[e.CREATED=201]=`CREATED`,e[e.ACCEPTED=202]=`ACCEPTED`,e[e.NON_AUTHORITATIVE_INFORMATION=203]=`NON_AUTHORITATIVE_INFORMATION`,e[e.NO_CONTENT=204]=`NO_CONTENT`,e[e.RESET_CONTENT=205]=`RESET_CONTENT`,e[e.PARTIAL_CONTENT=206]=`PARTIAL_CONTENT`,e[e.MULTI_STATUS=207]=`MULTI_STATUS`,e[e.MULTIPLE_CHOICES=300]=`MULTIPLE_CHOICES`,e[e.MOVED_PERMANENTLY=301]=`MOVED_PERMANENTLY`,e[e.MOVED_TEMPORARILY=302]=`MOVED_TEMPORARILY`,e[e.SEE_OTHER=303]=`SEE_OTHER`,e[e.NOT_MODIFIED=304]=`NOT_MODIFIED`,e[e.USE_PROXY=305]=`USE_PROXY`,e[e.TEMPORARY_REDIRECT=307]=`TEMPORARY_REDIRECT`,e[e.PERMANENT_REDIRECT=308]=`PERMANENT_REDIRECT`,e[e.BAD_REQUEST=400]=`BAD_REQUEST`,e[e.UNAUTHORIZED=401]=`UNAUTHORIZED`,e[e.PAYMENT_REQUIRED=402]=`PAYMENT_REQUIRED`,e[e.FORBIDDEN=403]=`FORBIDDEN`,e[e.NOT_FOUND=404]=`NOT_FOUND`,e[e.METHOD_NOT_ALLOWED=405]=`METHOD_NOT_ALLOWED`,e[e.NOT_ACCEPTABLE=406]=`NOT_ACCEPTABLE`,e[e.PROXY_AUTHENTICATION_REQUIRED=407]=`PROXY_AUTHENTICATION_REQUIRED`,e[e.REQUEST_TIMEOUT=408]=`REQUEST_TIMEOUT`,e[e.CONFLICT=409]=`CONFLICT`,e[e.GONE=410]=`GONE`,e[e.LENGTH_REQUIRED=411]=`LENGTH_REQUIRED`,e[e.PRECONDITION_FAILED=412]=`PRECONDITION_FAILED`,e[e.REQUEST_TOO_LONG=413]=`REQUEST_TOO_LONG`,e[e.REQUEST_URI_TOO_LONG=414]=`REQUEST_URI_TOO_LONG`,e[e.UNSUPPORTED_MEDIA_TYPE=415]=`UNSUPPORTED_MEDIA_TYPE`,e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]=`REQUESTED_RANGE_NOT_SATISFIABLE`,e[e.EXPECTATION_FAILED=417]=`EXPECTATION_FAILED`,e[e.IM_A_TEAPOT=418]=`IM_A_TEAPOT`,e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]=`INSUFFICIENT_SPACE_ON_RESOURCE`,e[e.METHOD_FAILURE=420]=`METHOD_FAILURE`,e[e.MISDIRECTED_REQUEST=421]=`MISDIRECTED_REQUEST`,e[e.UNPROCESSABLE_ENTITY=422]=`UNPROCESSABLE_ENTITY`,e[e.LOCKED=423]=`LOCKED`,e[e.FAILED_DEPENDENCY=424]=`FAILED_DEPENDENCY`,e[e.UPGRADE_REQUIRED=426]=`UPGRADE_REQUIRED`,e[e.PRECONDITION_REQUIRED=428]=`PRECONDITION_REQUIRED`,e[e.TOO_MANY_REQUESTS=429]=`TOO_MANY_REQUESTS`,e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]=`REQUEST_HEADER_FIELDS_TOO_LARGE`,e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]=`UNAVAILABLE_FOR_LEGAL_REASONS`,e[e.INTERNAL_SERVER_ERROR=500]=`INTERNAL_SERVER_ERROR`,e[e.NOT_IMPLEMENTED=501]=`NOT_IMPLEMENTED`,e[e.BAD_GATEWAY=502]=`BAD_GATEWAY`,e[e.SERVICE_UNAVAILABLE=503]=`SERVICE_UNAVAILABLE`,e[e.GATEWAY_TIMEOUT=504]=`GATEWAY_TIMEOUT`,e[e.HTTP_VERSION_NOT_SUPPORTED=505]=`HTTP_VERSION_NOT_SUPPORTED`,e[e.INSUFFICIENT_STORAGE=507]=`INSUFFICIENT_STORAGE`,e[e.NETWORK_AUTHENTICATION_REQUIRED=511]=`NETWORK_AUTHENTICATION_REQUIRED`})(e.StatusCodes||={})})),Cc=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ReasonPhrases=void 0,(function(e){e.ACCEPTED=`Accepted`,e.BAD_GATEWAY=`Bad Gateway`,e.BAD_REQUEST=`Bad Request`,e.CONFLICT=`Conflict`,e.CONTINUE=`Continue`,e.CREATED=`Created`,e.EXPECTATION_FAILED=`Expectation Failed`,e.FAILED_DEPENDENCY=`Failed Dependency`,e.FORBIDDEN=`Forbidden`,e.GATEWAY_TIMEOUT=`Gateway Timeout`,e.GONE=`Gone`,e.HTTP_VERSION_NOT_SUPPORTED=`HTTP Version Not Supported`,e.IM_A_TEAPOT=`I'm a teapot`,e.INSUFFICIENT_SPACE_ON_RESOURCE=`Insufficient Space on Resource`,e.INSUFFICIENT_STORAGE=`Insufficient Storage`,e.INTERNAL_SERVER_ERROR=`Internal Server Error`,e.LENGTH_REQUIRED=`Length Required`,e.LOCKED=`Locked`,e.METHOD_FAILURE=`Method Failure`,e.METHOD_NOT_ALLOWED=`Method Not Allowed`,e.MOVED_PERMANENTLY=`Moved Permanently`,e.MOVED_TEMPORARILY=`Moved Temporarily`,e.MULTI_STATUS=`Multi-Status`,e.MULTIPLE_CHOICES=`Multiple Choices`,e.NETWORK_AUTHENTICATION_REQUIRED=`Network Authentication Required`,e.NO_CONTENT=`No Content`,e.NON_AUTHORITATIVE_INFORMATION=`Non Authoritative Information`,e.NOT_ACCEPTABLE=`Not Acceptable`,e.NOT_FOUND=`Not Found`,e.NOT_IMPLEMENTED=`Not Implemented`,e.NOT_MODIFIED=`Not Modified`,e.OK=`OK`,e.PARTIAL_CONTENT=`Partial Content`,e.PAYMENT_REQUIRED=`Payment Required`,e.PERMANENT_REDIRECT=`Permanent Redirect`,e.PRECONDITION_FAILED=`Precondition Failed`,e.PRECONDITION_REQUIRED=`Precondition Required`,e.PROCESSING=`Processing`,e.EARLY_HINTS=`Early Hints`,e.UPGRADE_REQUIRED=`Upgrade Required`,e.PROXY_AUTHENTICATION_REQUIRED=`Proxy Authentication Required`,e.REQUEST_HEADER_FIELDS_TOO_LARGE=`Request Header Fields Too Large`,e.REQUEST_TIMEOUT=`Request Timeout`,e.REQUEST_TOO_LONG=`Request Entity Too Large`,e.REQUEST_URI_TOO_LONG=`Request-URI Too Long`,e.REQUESTED_RANGE_NOT_SATISFIABLE=`Requested Range Not Satisfiable`,e.RESET_CONTENT=`Reset Content`,e.SEE_OTHER=`See Other`,e.SERVICE_UNAVAILABLE=`Service Unavailable`,e.SWITCHING_PROTOCOLS=`Switching Protocols`,e.TEMPORARY_REDIRECT=`Temporary Redirect`,e.TOO_MANY_REQUESTS=`Too Many Requests`,e.UNAUTHORIZED=`Unauthorized`,e.UNAVAILABLE_FOR_LEGAL_REASONS=`Unavailable For Legal Reasons`,e.UNPROCESSABLE_ENTITY=`Unprocessable Entity`,e.UNSUPPORTED_MEDIA_TYPE=`Unsupported Media Type`,e.USE_PROXY=`Use Proxy`,e.MISDIRECTED_REQUEST=`Misdirected Request`})(e.ReasonPhrases||={})})),X=e((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__exportStar||function(e,t){for(var r in e)r!==`default`&&!t.hasOwnProperty(r)&&n(t,e,r)},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0});var a=i(yc()),o=xc(),s=xc();Object.defineProperty(e,`getStatusCode`,{enumerable:!0,get:function(){return s.getStatusCode}}),Object.defineProperty(e,`getReasonPhrase`,{enumerable:!0,get:function(){return s.getReasonPhrase}}),Object.defineProperty(e,`getStatusText`,{enumerable:!0,get:function(){return s.getStatusText}});var c=Sc();Object.defineProperty(e,`StatusCodes`,{enumerable:!0,get:function(){return c.StatusCodes}});var l=Cc();Object.defineProperty(e,`ReasonPhrases`,{enumerable:!0,get:function(){return l.ReasonPhrases}}),r(yc(),e),e.default=t(t({},a.default),{getStatusCode:o.getStatusCode,getStatusText:o.getStatusText})}))();const Z=(e,t)=>{let n=JSON.parse(e),r=t.safeParse(n);if(!r.success)throw r.error;return r.data};let wc=function(e){return e.OK=`ok`,e.UNAUTHORIZED=`unauthorized`,e}({});const Tc=q({success:ss()}),Ec=q({token:G().trim().min(1),userId:G().trim().min(1),email:G().trim().email(),expiresAt:G().datetime(),updatedAt:G().datetime(),name:G(),avatarUrl:G()}),Dc=q({ok:J(!0),revokedAt:G().datetime(),sessionId:G().trim().min(1)}),Q=async(e,t)=>{let n=Z(await e.text(),ec);throw Error(n.error)},Oc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/email-otp/send-verification-otp`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:t.email})});return r.status===X.StatusCodes.NO_CONTENT?{success:!0}:r.status===X.StatusCodes.OK?Z(await r.text(),Tc):await Q(r,`Failed to request sign-in code`)},kc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/sign-in/email-otp`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:t.email,otp:t.otp,preferredLanguage:t.preferredLanguage})});return r.status===X.StatusCodes.OK?Z(await r.text(),ic):await Q(r,`Failed to verify sign-in code`)},Ac=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/oauth/${encodeURIComponent(t.provider)}/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({returnMode:t.returnMode,preferredLanguage:t.preferredLanguage})});return r.status===X.StatusCodes.OK?Z(await r.text(),fc):await Q(r,`Failed to start external OAuth login`)},jc=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/oauth/${encodeURIComponent(t.provider)}/completion`,T(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===X.StatusCodes.OK?Z(await a.text(),_c):await Q(a,`Failed to load external OAuth completion state`)},Mc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/sso/${encodeURIComponent(t.provider)}/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({returnMode:t.returnMode,preferredLanguage:t.preferredLanguage})});return r.status===X.StatusCodes.OK?Z(await r.text(),pc):await Q(r,`Failed to start external SSO login`)},Nc=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/sso/${encodeURIComponent(t.provider)}/completion`,T(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===X.StatusCodes.OK?Z(await a.text(),vc):await Q(a,`Failed to load external SSO completion state`)},Pc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/cli-session/exchange`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return r.status===X.StatusCodes.OK?Z(await r.text(),Ec):await Q(r,`Failed to create CLI session`)},Fc=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${T(e)}/api/auth/cli-session/logout`,{method:`POST`,headers:{authorization:`Bearer ${t.token}`}});if(r.status===X.StatusCodes.UNAUTHORIZED)throw Error(`Stored auth is invalid or expired`);return r.status===X.StatusCodes.OK?Z(await r.text(),Dc):await Q(r,`Failed to revoke CLI session`)},Ic=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/get-session`,T(e));i.searchParams.set(`disableCookieCache`,`true`),t.disableRefresh&&i.searchParams.set(`disableRefresh`,`true`);let a=await r(i,{method:`GET`,headers:{authorization:`Bearer ${t.token}`}});return a.status===X.StatusCodes.OK?{status:wc.OK,session:Z(await a.text(),rc),error:null}:a.status===X.StatusCodes.UNAUTHORIZED?{status:wc.UNAUTHORIZED,session:null,error:Z(await a.text(),ec)}:await Q(a,`Failed to refresh session`)};var Lc=class extends Error{constructor(e,t){super(e),this.name=`HttpClientResponseError`,this.status=t.status,this.statusText=t.statusText,this.bodyText=t.bodyText,t.cause!==void 0&&(this.cause=t.cause)}};const Rc=async e=>{try{return await e.clone().text()}catch{return}},zc=async(e,t=`HTTP request failed`)=>{if(e.ok)return;let n=await Rc(e);throw new Lc(t,{status:e.status,statusText:e.statusText,bodyText:n})},Bc=/^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,Vc=/^\d+$/;let Hc=function(e){return e[e.V1=1]=`V1`,e}({}),Uc=function(e){return e.CLI=`cli`,e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.BROWSER_USE=`browser-use`,e}({}),Wc=function(e){return e.STABLE=`stable`,e.BETA=`beta`,e.PREVIEW=`preview`,e}({}),Gc=function(e){return e.UP_TO_DATE=`up_to_date`,e.UPDATE_AVAILABLE=`update_available`,e.UPDATE_REQUIRED=`update_required`,e}({}),Kc=function(e){return e.COMMAND=`command`,e.DOWNLOAD=`download`,e.STORE=`store`,e.DOCS=`docs`,e}({}),qc=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.WIN_X64=`win-x64`,e}({}),Jc=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.LINUX_X64=`linux-x64`,e.LINUX_ARM64=`linux-arm64`,e}({}),Yc=function(e){return e.IOS=`ios`,e.ANDROID=`android`,e}({}),Xc=function(e){return e.CHROME=`chrome`,e}({});const Zc=new Set(Object.values(Uc)),Qc=new Set(Object.values(Wc)),$c=new Set(Object.values(Kc)),el=Object.values(qc),tl=Object.values(Jc),nl=Object.values(Yc),rl=Object.values(Xc),il={[Uc.CLI]:tl,[Uc.DESKTOP]:el,[Uc.MOBILE]:nl,[Uc.BROWSER_USE]:rl},al=e=>typeof e==`object`&&!!e,$=(e,t)=>{if(typeof e!=`string`||e.trim().length===0)throw Error(`Release manifest ${t} must be a non-empty string`);return e.trim()},ol=(e,t)=>{if(e!=null){if(typeof e!=`string`||e.trim().length===0)throw Error(`Release manifest ${t} must be a non-empty string when provided`);return e.trim()}},sl=(e,t)=>{if(e!=null){if(typeof e!=`number`||!Number.isFinite(e))throw TypeError(`Release manifest ${t} must be a finite number when provided`);return e}},cl=(e,t)=>{let n=sl(e,t);if(n!=null){if(!Number.isInteger(n)||n<0)throw Error(`Release manifest ${t} must be a non-negative integer when provided`);return n}},ll=(e,t)=>{let n=Vc.test(e),r=Vc.test(t);return n&&r?Number(e)-Number(t):n?-1:r?1:e.localeCompare(t)},ul=e=>{let t=e.trim().match(Bc);if(!t)throw Error(`Invalid release version: ${e}`);return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:t[4]?t[4].split(`.`):[]}},dl=e=>Zc.has(e),fl=e=>Qc.has(e),pl=e=>$c.has(e),ml=(e,t)=>il[e].includes(t),hl=(e,t)=>{let n=ul(e),r=ul(t);if(n.major!==r.major)return n.major-r.major;if(n.minor!==r.minor)return n.minor-r.minor;if(n.patch!==r.patch)return n.patch-r.patch;let i=n.prerelease.length>0,a=r.prerelease.length>0;if(!i&&!a)return 0;if(!i)return 1;if(!a)return-1;let o=Math.max(n.prerelease.length,r.prerelease.length);for(let e=0;e<o;e+=1){let t=n.prerelease[e],i=r.prerelease[e];if(t==null)return-1;if(i==null)return 1;let a=ll(t,i);if(a!==0)return a}return 0},gl=(e,t)=>hl(t,e.minimumSupportedVersion)<0?Gc.UPDATE_REQUIRED:hl(t,e.latestVersion)<0?Gc.UPDATE_AVAILABLE:Gc.UP_TO_DATE,_l=e=>{if(!ml(e.product,e.platform))throw Error(`Unsupported release platform '${e.platform}' for product '${e.product}'`);return`v1/releases/${e.product}/${e.channel}/${e.platform}.json`},vl=e=>{if(!al(e))throw TypeError(`Release manifest must be an object`);let t=e.schemaVersion;if(t!==Hc.V1)throw Error(`Unsupported release manifest schema version: ${String(t)}`);let n=$(e.product,`product`);if(!dl(n))throw Error(`Unsupported release product: ${n}`);let r=$(e.channel,`channel`);if(!fl(r))throw Error(`Unsupported release channel: ${r}`);let i=$(e.platform,`platform`);if(!ml(n,i))throw Error(`Unsupported release platform '${i}' for product '${n}'`);let a=i,o=e.actions;if(!Array.isArray(o))throw TypeError(`Release manifest actions must be an array`);let s=o.map((e,t)=>{if(!al(e))throw TypeError(`Release manifest actions[${t}] must be an object`);let n=$(e.kind,`actions[${t}].kind`);if(!pl(n))throw Error(`Unsupported release action kind: ${n}`);return{kind:n,label:$(e.label,`actions[${t}].label`),url:ol(e.url,`actions[${t}].url`),command:ol(e.command,`actions[${t}].command`),sha256:ol(e.sha256,`actions[${t}].sha256`),size:cl(e.size,`actions[${t}].size`)}}),c=sl(e.rolloutPercentage,`rolloutPercentage`);if(c!=null&&(!Number.isInteger(c)||c<0||c>100))throw Error(`Release manifest rolloutPercentage must be an integer between 0 and 100`);return{schemaVersion:Hc.V1,product:n,channel:r,platform:a,latestVersion:$(e.latestVersion,`latestVersion`),minimumSupportedVersion:$(e.minimumSupportedVersion,`minimumSupportedVersion`),publishedAt:$(e.publishedAt,`publishedAt`),releaseNotesUrl:ol(e.releaseNotesUrl,`releaseNotesUrl`),message:ol(e.message,`message`),rolloutPercentage:c,actions:s}},yl=new Set([`localhost`,`127.0.0.1`,`::1`]),bl=e=>yl.has(e),xl=e=>{let t=T(e.trim()),n=new URL(t);if(n.protocol===`https:`||n.protocol===`http:`&&bl(n.hostname))return T(n.toString());throw Error(`Updates base URL must use https or localhost http: ${e}`)},Sl=e=>`${xl(e.baseUrl)}/${_l({product:e.product,channel:e.channel,platform:e.platform})}`,Cl=async e=>e.json(),wl=async e=>{let t=new AbortController,n=setTimeout(()=>{t.abort()},e.timeoutMs);try{let n=await e.fetchImpl(e.url,{method:`GET`,signal:t.signal,headers:{accept:`application/json`}});return await zc(n,`Release manifest request failed`),vl(await Cl(n))}finally{clearTimeout(n)}},Tl=async e=>{let t=e.fetch??fetch,n=await wl({url:Sl({baseUrl:e.baseUrl,product:e.product,channel:e.channel,platform:e.platform}),fetchImpl:t,timeoutMs:e.timeoutMs??5e3});return{availability:gl(n,e.currentVersion),manifest:n}};export{Ie as A,ct as C,Be as D,nt as E,ze as O,wt as S,rt as T,ft as _,Gc as a,xt as b,jc as c,Fc as d,Oc as f,Ot as g,Mc as h,Uc as i,Me as k,Ic as l,Ac as m,Jc as n,wc as o,kc as p,Wc as r,Pc as s,Tl as t,Nc as u,_t as v,tt as w,mt as x,dt as y};
|
|
42
|
+
//# debugId=97e76e43-a3d0-568e-9605-7f13c000ba35
|