@ms-cloudpack/link-proxy 0.2.83 → 0.2.84

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/NOTICE.txt CHANGED
@@ -4,7 +4,7 @@ This package incorporates material as listed below or described in the code.
4
4
 
5
5
  ----
6
6
 
7
- @trpc/client 11.9.0 - MIT
7
+ @trpc/client 11.10.0 - MIT
8
8
  git+https://github.com/trpc/trpc.git
9
9
 
10
10
  Author: KATT
@@ -33,7 +33,7 @@ SOFTWARE.
33
33
 
34
34
  ----
35
35
 
36
- @trpc/server 11.9.0 - MIT
36
+ @trpc/server 11.10.0 - MIT
37
37
  git+https://github.com/trpc/trpc.git
38
38
 
39
39
  Author: KATT
@@ -0,0 +1,2 @@
1
+ export const __webpack_esm_id__=693;export const __webpack_esm_ids__=[693];export const __webpack_esm_modules__={693(e){e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}};
2
+ //# sourceMappingURL=693.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"897.chunk.js","mappings":"wHAEAA,EAAOC,QAAU,WACf,MAAM,IAAIC,MACR,wFAGJ,C","sources":["webpack://@ms-cloudpack/link-proxy/../../node_modules/.store/ws-virtual-6842c20491/package/browser.js"],"sourcesContent":["'use strict';\n\nmodule.exports = function () {\n throw new Error(\n 'ws does not work in the browser. Browser clients must use the native ' +\n 'WebSocket object'\n );\n};\n"],"names":["module","exports","Error"],"ignoreList":[],"sourceRoot":""}
1
+ {"version":3,"file":"693.chunk.js","mappings":"wHAEAA,EAAOC,QAAU,WACf,MAAM,IAAIC,MACR,wFAGJ,C","sources":["webpack://@ms-cloudpack/link-proxy/../../node_modules/.store/ws-virtual-df339bbbe3/package/browser.js"],"sourcesContent":["'use strict';\n\nmodule.exports = function () {\n throw new Error(\n 'ws does not work in the browser. Browser clients must use the native ' +\n 'WebSocket object'\n );\n};\n"],"names":["module","exports","Error"],"sourceRoot":""}
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- var e,t,n,o,r={115(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,o,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(o)for(var a=0;a<this.length;a++){var u=this[a][0];null!=u&&(i[u]=!0)}for(var c=0;c<e.length;c++){var l=[].concat(e[c]);o&&i[l[0]]||(void 0!==s&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=s),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),r&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=r):l[4]="".concat(r)),t.push(l))}},t}},415(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},421(e){e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var o=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},437(e){var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},606(e){var t=[];function n(e){for(var n=-1,o=0;o<t.length;o++)if(t[o].identifier===e){n=o;break}return n}function o(e,o){for(var s={},i=[],a=0;a<e.length;a++){var u=e[a],c=o.base?u[0]+o.base:u[0],l=s[c]||0,d="".concat(c," ").concat(l);s[c]=l+1;var p=n(d),f={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)t[p].references++,t[p].updater(f);else{var h=r(f,o);o.byIndex=a,t.splice(a,0,{identifier:d,updater:h,references:1})}i.push(d)}return i}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=o(e=e||[],r=r||{});return function(e){e=e||[];for(var i=0;i<s.length;i++){var a=n(s[i]);t[a].references--}for(var u=o(e,r),c=0;c<s.length;c++){var l=n(s[c]);0===t[l].references&&(t[l].updater(),t.splice(l,1))}s=u}}},607(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,r&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},721(e,t,n){n.d(t,{default:()=>a});var o=n(421),r=n.n(o),s=n(115),i=n.n(s)()(r());i.push([e.id,":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\nbody {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.statusContainer__v64eNmuXrV4WWsOKdGgy {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr {\n background-color: var(--color-status-danger-background1);\n}\n\n.title__b6Vf2DbiFQkD7AEkJ7p_ h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n.message__05tS4aUzls4kEWk9hkA7 {\n color: var(--color-neutral-foreground1);\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr .title__b6Vf2DbiFQkD7AEkJ7p_ {\n color: var(--color-status-danger-foreground1);\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr .message__05tS4aUzls4kEWk9hkA7 {\n color: var(--color-status-danger-foreground1);\n}\n\n.message__05tS4aUzls4kEWk9hkA7 code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr .message__05tS4aUzls4kEWk9hkA7 code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.warning__kheFps3bT2VbnjAMYfSr {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n","",{version:3,sources:["webpack://./src/UIManager.module.css"],names:[],mappings:"AAAA;EACE,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,oCAAoC;AACtC;;AAEA;EACE;IACE,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,oCAAoC;EACtC;AACF;;AAEA;EACE,kDAAkD;EAClD,SAAS;EACT,UAAU;EACV;;;;;;;cAOY;AACd;;AAEA;EACE,aAAa;EACb,kBAAkB;EAClB,kDAAkD;EAClD,YAAY;EACZ,wCAAwC;AAC1C;;AAEA;EACE,wDAAwD;AAC1D;;AAEA;EACE,uCAAuC;EACvC,aAAa;AACf;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,kDAAkD;EAClD,gBAAgB;EAChB,kBAAkB;EAClB,2DAA2D;EAC3D,gBAAgB;AAClB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;EACE,iBAAiB;EACjB,gBAAgB;EAChB,uCAAuC;AACzC",sourcesContent:[":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\n:global body {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.statusContainer {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.errorContainer {\n background-color: var(--color-status-danger-background1);\n}\n\n.title h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n.message {\n color: var(--color-neutral-foreground1);\n}\n\n.errorContainer .title {\n color: var(--color-status-danger-foreground1);\n}\n\n.errorContainer .message {\n color: var(--color-status-danger-foreground1);\n}\n\n.message code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.errorContainer .message code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.warning {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n"],sourceRoot:""}]),i.locals={statusContainer:"statusContainer__v64eNmuXrV4WWsOKdGgy",errorContainer:"errorContainer__ScZ3E77NPMqtBzp0OwUr",title:"title__b6Vf2DbiFQkD7AEkJ7p_",message:"message__05tS4aUzls4kEWk9hkA7",warning:"warning__kheFps3bT2VbnjAMYfSr"};const a=i},750(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},994(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={id:e,exports:{}};return r[e](n,n.exports,i),n.exports}i.m=r,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&o&&n;("object"==typeof a||"function"==typeof a)&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>n[e]);return s.default=()=>n,i.d(r,s),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,n)=>(i.f[n](e,t),t),[])),i.u=e=>e+".chunk.js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n={293:0},o=e=>{var t,o,{__webpack_esm_ids__:r,__webpack_esm_modules__:s,__webpack_esm_runtime__:a}=e,u=0;for(t in s)i.o(s,t)&&(i.m[t]=s[t]);for(a&&a(i);u<r.length;u++)o=r[u],i.o(n,o)&&n[o]&&n[o][0](),n[r[u]]=0},i.f.j=(e,t)=>{var r=i.o(n,e)?n[e]:void 0;if(0!==r)if(r)t.push(r[1]);else{var s=import("../"+i.u(e)).then(o,t=>{throw 0!==n[e]&&(n[e]=void 0),t});s=Promise.race([s,new Promise(t=>r=n[e]=[t])]),t.push(r[1]=s)}},i.nc=void 0;var a={};function u(e,t,n){function o(n,o){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:o,constr:i,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,o);const r=i.prototype,s=Object.keys(r);for(let e=0;e<s.length;e++){const t=s[e];t in n||(n[t]=r[t].bind(n))}}const r=n?.Parent??Object;class s extends r{}function i(e){var t;const r=n?.Parent?new s:this;o(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}i.r(a),i.d(a,{base64:()=>de,base64url:()=>pe,bigint:()=>_e,boolean:()=>Ce,browserEmail:()=>oe,cidrv4:()=>ce,cidrv6:()=>le,cuid:()=>q,cuid2:()=>N,date:()=>ve,datetime:()=>we,domain:()=>he,duration:()=>B,e164:()=>me,email:()=>X,emoji:()=>se,extendedDuration:()=>H,guid:()=>J,hex:()=>Oe,hostname:()=>fe,html5Email:()=>Q,idnEmail:()=>ne,integer:()=>ke,ipv4:()=>ie,ipv6:()=>ae,ksuid:()=>L,lowercase:()=>Ee,mac:()=>ue,md5_base64:()=>Te,md5_base64url:()=>Ie,md5_hex:()=>Me,nanoid:()=>W,null:()=>Se,number:()=>xe,rfc5322Email:()=>ee,sha1_base64:()=>Ze,sha1_base64url:()=>De,sha1_hex:()=>Re,sha256_base64:()=>Ne,sha256_base64url:()=>Ue,sha256_hex:()=>qe,sha384_base64:()=>Le,sha384_base64url:()=>We,sha384_hex:()=>Fe,sha512_base64:()=>He,sha512_base64url:()=>Je,sha512_hex:()=>Be,string:()=>Ae,time:()=>be,ulid:()=>U,undefined:()=>Pe,unicodeEmail:()=>te,uppercase:()=>je,uuid:()=>G,uuid4:()=>Y,uuid6:()=>V,uuid7:()=>K,xid:()=>F}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class c extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}Error;const l={};function d(e){return e&&Object.assign(l,e),l}function p(e,t="|"){return e.map(e=>k(e)).join(t)}function f(e,t){return"bigint"==typeof t?t.toString():t}function h(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function m(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const g=Symbol("evaluating");function v(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==g)return void 0===o&&(o=g,o=n()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}const y="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function b(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function w(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function A(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function _(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function k(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function x(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function C(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function S(e){return"string"==typeof e?e:e?.message}function P(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=S(e.inst?._zod.def?.error?.(e))??S(t?.error?.(e))??S(n.customError?.(e))??S(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}h(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}),new Set(["string","number","symbol"]),new Set(["string","number","bigint","boolean","symbol","undefined"]),Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_VALUE,Number.MAX_VALUE;const E=(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,f,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},j=u("$ZodError",E),O=u("$ZodError",E,{Parent:Error}),z=e=>(t,n,o,r)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new c;if(i.issues.length){const t=new(r?.Err??e)(i.issues.map(e=>P(e,s,d())));throw y(t,r?.callee),t}return i.value},$=z(O),M=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(r?.Err??e)(i.issues.map(e=>P(e,s,d())));throw y(t,r?.callee),t}return i.value},T=M(O),I=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new c;return s.issues.length?{success:!1,error:new(e??j)(s.issues.map(e=>P(e,r,d())))}:{success:!0,data:s.value}},R=I(O),Z=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>P(e,r,d())))}:{success:!0,data:s.value}},D=Z(O),q=/^[cC][^\s-]{8,}$/,N=/^[0-9a-z]+$/,U=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,F=/^[0-9a-vA-V]{20}$/,L=/^[A-Za-z0-9]{27}$/,W=/^[a-zA-Z0-9_-]{21}$/,B=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,H=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,J=/^([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})$/,G=e=>e?new 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)$/,Y=G(4),V=G(6),K=G(7),X=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Q=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ee=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,te=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ne=te,oe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,re="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function se(){return new RegExp(re,"u")}const ie=/^(?:(?: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])$/,ae=/^(([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}|:))$/,ue=e=>{const t=w(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ce=/^((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])$/,le=/^(([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])$/,de=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pe=/^[A-Za-z0-9_-]*$/,fe=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,he=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,me=/^\+[1-9]\d{6,14}$/,ge="(?:(?:\\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])))",ve=new RegExp(`^${ge}$`);function ye(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function be(e){return new RegExp(`^${ye(e)}$`)}function we(e){const t=ye({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${ge}T(?:${o})$`)}const Ae=e=>new RegExp(`^${e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*"}$`),_e=/^-?\d+n?$/,ke=/^-?\d+$/,xe=/^-?\d+(?:\.\d+)?$/,Ce=/^(?:true|false)$/i,Se=/^null$/i,Pe=/^undefined$/i,Ee=/^[^A-Z]*$/,je=/^[^a-z]*$/,Oe=/^[0-9a-fA-F]*$/;function ze(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function $e(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Me=/^[0-9a-fA-F]{32}$/,Te=ze(22,"=="),Ie=$e(22),Re=/^[0-9a-fA-F]{40}$/,Ze=ze(27,"="),De=$e(27),qe=/^[0-9a-fA-F]{64}$/,Ne=ze(43,"="),Ue=$e(43),Fe=/^[0-9a-fA-F]{96}$/,Le=ze(64,""),We=$e(64),Be=/^[0-9a-fA-F]{128}$/,He=ze(86,"=="),Je=$e(86),Ge={major:4,minor:3,patch:6},Ye=u("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ge;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const t of o)for(const n of t._zod.onattach)n(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let o,r=x(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(r)continue;const t=e.issues.length,i=s._zod.check(e);if(i instanceof Promise&&!1===n?.async)throw new c;if(o||i instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await i,e.issues.length!==t&&(r||(r=x(e,t)))});else{if(e.issues.length===t)continue;r||(r=x(e,t))}}return o?o.then(()=>e):e},n=(n,r,s)=>{if(x(n))return n.aborted=!0,n;const i=t(r,o,s);if(i instanceof Promise){if(!1===s.async)throw new c;return i.then(t=>e._zod.parse(t,s))}return e._zod.parse(i,s)};e._zod.run=(r,s)=>{if(s.skipChecks)return e._zod.parse(r,s);if("backward"===s.direction){const t=e._zod.parse({value:r.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,s)):n(t,r,s)}const i=e._zod.parse(r,s);if(i instanceof Promise){if(!1===s.async)throw new c;return i.then(e=>t(e,o,s))}return t(i,o,s)}}v(e,"~standard",()=>({validate:t=>{try{const n=R(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return D(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ve=u("$ZodString",(e,t)=>{Ye.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ae(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ke=u("$ZodNumber",(e,t)=>{Ye.init(e,t),e._zod.pattern=e._zod.bag.pattern??xe,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const s="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),Xe=u("$ZodBoolean",(e,t)=>{Ye.init(e,t),e._zod.pattern=Ce,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Qe=u("$ZodAny",(e,t)=>{Ye.init(e,t),e._zod.parse=e=>e}),et=u("$ZodUnknown",(e,t)=>{Ye.init(e,t),e._zod.parse=e=>e});function tt(e,t,n){e.issues.length&&t.issues.push(...C(n,e.issues)),t.value[n]=e.value}const nt=u("$ZodArray",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const s=[];for(let e=0;e<r.length;e++){const i=r[e],a=t.element._zod.run({value:i,issues:[]},o);a instanceof Promise?s.push(a.then(t=>tt(t,n,e))):tt(a,n,e)}return s.length?Promise.all(s).then(()=>n):n}});function ot(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...C(n,e.issues))}void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const rt=u("$ZodObject",(e,t)=>{Ye.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const o=h(()=>function(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=e.shape,Object.keys(o).filter(e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}(t));v(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n});const r=b,s=t.catchall;let i;e._zod.parse=(t,n)=>{i??(i=o.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const u=[],c=i.shape;for(const e of i.keys){const o=c[e],r="optional"===o._zod.optout,s=o._zod.run({value:a[e],issues:[]},n);s instanceof Promise?u.push(s.then(n=>ot(n,t,e,a,r))):ot(s,t,e,a,r)}return s?function(e,t,n,o,r,s){const i=[],a=r.keySet,u=r.catchall._zod,c=u.def.type,l="optional"===u.optout;for(const r in t){if(a.has(r))continue;if("never"===c){i.push(r);continue}const s=u.run({value:t[r],issues:[]},o);s instanceof Promise?e.push(s.then(e=>ot(e,n,r,t,l))):ot(s,n,r,t,l)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}(u,a,t,n,o.value,e):u.length?Promise.all(u).then(()=>t):t}});function st(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter(e=>!x(e));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>P(e,o,d())))}),t)}const it=u("$ZodUnion",(e,t)=>{Ye.init(e,t),v(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),v(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),v(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),v(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>m(e.source)).join("|")})$`)}});const n=1===t.options.length,o=t.options[0]._zod.run;e._zod.parse=(r,s)=>{if(n)return o(r,s);let i=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},s);if(t instanceof Promise)a.push(t),i=!0;else{if(0===t.issues.length)return t;a.push(t)}}return i?Promise.all(a).then(t=>st(t,r,e,s)):st(a,r,e,s)}}),at=u("$ZodRecord",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!function(e){if(!1===b(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==b(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const e of i)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const i=t.valueType._zod.run({value:r[e],issues:[]},o);i instanceof Promise?s.push(i.then(t=>{t.issues.length&&n.issues.push(...C(e,t.issues)),n.value[e]=t.value})):(i.issues.length&&n.issues.push(...C(e,i.issues)),n.value[e]=i.value)}let u;for(const e in r)a.has(e)||(u=u??[],u.push(e));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:u})}else{n.value={};for(const i of Reflect.ownKeys(r)){if("__proto__"===i)continue;let a=t.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof i&&xe.test(i)&&a.issues.length){const e=t.keyType._zod.run({value:Number(i),issues:[]},o);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?n.value[i]=r[i]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>P(e,o,d())),input:i,path:[i],inst:e});continue}const u=t.valueType._zod.run({value:r[i],issues:[]},o);u instanceof Promise?s.push(u.then(e=>{e.issues.length&&n.issues.push(...C(i,e.issues)),n.value[a.value]=e.value})):(u.issues.length&&n.issues.push(...C(i,u.issues)),n.value[a.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),ut=u("$ZodLiteral",(e,t)=>{if(Ye.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?w(e):e?w(e.toString()):String(e)).join("|")})$`),e._zod.parse=(o,r)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});function ct(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const lt=u("$ZodOptional",(e,t)=>{Ye.init(e,t),e._zod.optin="optional",e._zod.optout="optional",v(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),v(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${m(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(t=>ct(t,e.value)):ct(o,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),dt=u("$ZodNonOptional",(e,t)=>{Ye.init(e,t),v(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(t=>pt(t,e)):pt(r,e)}});function pt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ft;Symbol("ZodOutput"),Symbol("ZodInput");(ft=globalThis).__zod_globalRegistry??(ft.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}),globalThis.__zod_globalRegistry;const ht=u("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Ye.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>$(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>R(e,t,n),e.parseAsync=async(t,n)=>T(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>D(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>A(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.apply=t=>t(e)}),mt=u("ZodMiniString",(e,t)=>{Ve.init(e,t),ht.init(e,t)});function gt(e){return function(e,t){return new mt({type:"string",..._(t)})}(0,e)}const vt=u("ZodMiniNumber",(e,t)=>{Ke.init(e,t),ht.init(e,t)});function yt(e){return function(e,t){return new vt({type:"number",checks:[],..._(t)})}(0,e)}const bt=u("ZodMiniBoolean",(e,t)=>{Xe.init(e,t),ht.init(e,t)});function wt(e){return function(e,t){return new bt({type:"boolean",..._(t)})}(0,e)}const At=u("ZodMiniAny",(e,t)=>{Qe.init(e,t),ht.init(e,t)});function _t(){return new At({type:"any"})}const kt=u("ZodMiniUnknown",(e,t)=>{et.init(e,t),ht.init(e,t)});const xt=u("ZodMiniArray",(e,t)=>{nt.init(e,t),ht.init(e,t)});function Ct(e,t){return new xt({type:"array",element:e,..._(t)})}const St=u("ZodMiniObject",(e,t)=>{rt.init(e,t),ht.init(e,t),v(e,"shape",()=>t.shape)});function Pt(e,t){const n={type:"object",shape:e??{},..._(t)};return new St(n)}function Et(e,t){return new St({type:"object",shape:e,catchall:new kt({type:"unknown"}),..._(t)})}const jt=u("ZodMiniUnion",(e,t)=>{it.init(e,t),ht.init(e,t)});function Ot(e,t){return new jt({type:"union",options:e,..._(t)})}const zt=u("ZodMiniRecord",(e,t)=>{at.init(e,t),ht.init(e,t)});function $t(e,t,n){return new zt({type:"record",keyType:e,valueType:t,..._(n)})}const Mt=u("ZodMiniLiteral",(e,t)=>{ut.init(e,t),ht.init(e,t)});function Tt(e,t){return new Mt({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}const It=u("ZodMiniOptional",(e,t)=>{lt.init(e,t),ht.init(e,t)});function Rt(e){return new It({type:"optional",innerType:e})}const Zt=u("ZodMiniNonOptional",(e,t)=>{dt.init(e,t),ht.init(e,t)});function Dt(e){return Pt(e)}function qt(e){return Et(e)}d({localeError:(()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{const t=o[e.expected]??e.expected,n=function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input);return`Invalid input: expected ${t}, received ${o[n]??n}`}case"invalid_value":return 1===e.values.length?`Invalid input: expected ${k(e.values[0])}`:`Invalid option: expected one of ${p(e.values,"|")}`;case"too_big":{const n=e.inclusive?"<=":"<",o=t(e.origin);return o?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.inclusive?">=":">",o=t(e.origin);return o?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${o.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${p(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}}})()}),Dt({status:Tt(["idle","pending"]),remainingTasks:yt(),totalTasks:yt(),totalErrors:yt(),totalWarnings:yt()});const Nt=Dt({name:gt(),start:yt(),end:Rt(yt()),threwException:Rt(wt())}),Ut=Dt({file:gt(),line:Rt(yt()),column:Rt(yt())}),Ft=Dt({text:gt(),location:Rt(Ut)}),Lt=Dt({text:gt(),source:gt(),location:Rt(Ut),notes:Rt(Ct(Ft))}),Wt=Dt({id:gt(),name:gt(),status:Tt(["pending","complete"]),inputPath:gt(),outputPath:Rt(gt()),errors:Rt(Ct(Lt)),warnings:Rt(Ct(Lt)),startTime:yt(),duration:Rt(yt()),lastUpdated:Rt(yt()),timings:Rt(Ct(Nt))});Dt({tasks:Ct(Wt)});const Bt=qt({name:gt(),version:gt()}),Ht=Dt({packagePath:gt(),hash:Rt(gt()),definition:Rt(Bt)}),Jt=Pt({browser:$t(gt(),gt()),node:$t(gt(),gt())}),Gt=Dt({path:gt(),rootPath:Rt(gt()),includeAll:Rt(wt()),ignoredPackages:Rt(Ct(gt())),ignoreResolutions:Rt(Ot([wt(),Ct(gt())])),resolveStrategy:Rt(Tt(["dedupe","duplicate"])),remote:Rt(Dt({hostUrl:gt(),resolveMap:$t(gt(),_t()),packages:Pt({definitions:$t(gt(),_t()),transformedDefinitions:$t(gt(),_t())}),packageHashes:Pt({hashesWithSource:Jt,hashesWithNoSource:Jt})}))}),Yt=Dt({linkedPath:Gt}),Vt=Dt({resolveMap:$t(gt(),_t()),linkedPaths:Ct(Gt)}),Kt=Dt({name:gt(),version:Rt(gt())}),Xt=Ot([gt(),Et({...Kt.shape})]),Qt=Ot([gt(),(en=Kt,function(e,t){const n=function(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return r=this,s="shape",i=o,Object.defineProperty(r,s,{value:i,writable:!0,enumerable:!0,configurable:!0}),o;var r,s,i}});return A(t,n)}(Zt,en))]);var en;const tn=qt({packageSettings:Rt(Ct(Et({match:Ot([Xt,Ct(Xt)])}))),generated:Et({packageSettings:Ct(Et({match:Qt}))})}),nn=(Dt({packageName:gt(),version:gt(),entryPoints:Ct(Pt({importPath:gt(),bundleUrl:gt()}))}),yt(),gt(),{path:["link","update"],type:Ht}),on={path:["link","config"],type:tn},rn={path:["link","paths"],type:Yt},sn={path:["link","done"],type:Vt},an={path:["link","disconnected"],type:Pt({reason:Tt(["lost","unreachable"])})};var un=Object.create,cn=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,dn=Object.getOwnPropertyNames,pn=Object.getPrototypeOf,fn=Object.prototype.hasOwnProperty,hn=(e,t)=>function(){return t||(0,e[dn(e)[0]])((t={exports:{}}).exports,t),t.exports},mn=(e,t,n)=>(n=null!=e?un(pn(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=dn(t),i=0,a=s.length;i<a;i++)r=s[i],fn.call(e,r)||void 0===r||cn(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=ln(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:cn(n,"default",{value:e,enumerable:!0}),e)),gn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),vn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=gn().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),yn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=gn().default,o=vn();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),bn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=yn();t.exports=function(e,t,o){return(t=n(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),wn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=bn();function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});function An(e){const t={subscribe(t){let n=null,o=!1,r=!1,s=!1;function i(){null!==n?r||(r=!0,"function"==typeof n?n():n&&n.unsubscribe()):s=!0}return n=e({next(e){var n;o||null===(n=t.next)||void 0===n||n.call(t,e)},error(e){var n;o||(o=!0,null===(n=t.error)||void 0===n||n.call(t,e),i())},complete(){var e;o||(o=!0,null===(e=t.complete)||void 0===e||e.call(t),i())}}),s&&i(),{unsubscribe:i}},pipe:(...e)=>e.reduce(_n,t)};return t}function _n(e,t){return t(e)}function kn(e){return An(t=>function t(n=0,o=e.op){const r=e.links[n];if(!r)throw new Error("No more links to execute - did you forget to add an ending link?");return r({op:o,next:e=>t(n+1,e)})}().subscribe(t))}function xn(e){return Array.isArray(e)?e:[e]}function Cn(e){return t=>{const n=xn(e.true).map(e=>e(t)),o=xn(e.false).map(e=>e(t));return t=>An(r=>{const s=e.condition(t.op)?n:o;return kn({op:t.op,links:s}).subscribe(r)})}}function Sn(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}"function"==typeof Symbol&&Symbol.asyncIterator;const Pn=e=>e();function En(e=0){return new Promise(t=>setTimeout(t,e))}var jn=mn(bn(),1),On=mn(wn(),1),zn=class e extends Error{constructor(t,n){var o,r;const s=null==n?void 0:n.cause;super(t,{cause:s}),(0,jn.default)(this,"cause",void 0),(0,jn.default)(this,"shape",void 0),(0,jn.default)(this,"data",void 0),(0,jn.default)(this,"meta",void 0),this.meta=null==n?void 0:n.meta,this.cause=s,this.shape=null==n||null===(o=n.result)||void 0===o?void 0:o.error,this.data=null==n||null===(r=n.result)||void 0===r?void 0:r.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){const o=t;return function(e){return e instanceof zn}(o)?(n.meta&&(o.meta=(0,On.default)((0,On.default)({},o.meta),n.meta)),o):Sn(r=o)&&Sn(r.error)&&"number"==typeof r.error.code&&"string"==typeof r.error.message?new e(o.error.message,(0,On.default)((0,On.default)({},n),{},{result:o})):new e("string"==typeof(s=o)?s:Sn(s)&&"string"==typeof s.message?s.message:"Unknown error",(0,On.default)((0,On.default)({},n),{},{cause:o}));var r,s}};function $n(e){return e?"input"in e?e:{input:e,output:e}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}const Mn=e=>"function"==typeof e;var Tn=mn(wn(),1);const In={query:"GET",mutation:"POST",subscription:"PATCH"};function Rn(e){return"input"in e?e.transformer.input.serialize(e.input):function(e){const t={};for(let n=0;n<e.length;n++){const o=e[n];t[n]=o}return t}(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Zn=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const o=[];if(t[1]&&o.push(t[1]),"inputs"in e&&o.push("batch=1"),"query"===e.type||"subscription"===e.type){const t=Rn(e);void 0!==t&&"POST"!==e.methodOverride&&o.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return o.length&&(n+="?"+o.join("&")),n},Dn=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;const t=Rn(e);return void 0!==t?JSON.stringify(t):void 0};var qn=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Nn=e=>{var t;if(null==e?void 0:e.aborted){if(null===(t=e.throwIfAborted)||void 0===t||t.call(e),"undefined"!=typeof DOMException)throw new DOMException("AbortError","AbortError");throw new qn}};mn(wn(),1);var Un=Object.create,Fn=Object.defineProperty,Ln=Object.getOwnPropertyDescriptor,Wn=Object.getOwnPropertyNames,Bn=Object.getPrototypeOf,Hn=Object.prototype.hasOwnProperty,Jn=(e,t)=>function(){return t||(0,e[Wn(e)[0]])((t={exports:{}}).exports,t),t.exports},Gn=(e,t,n)=>(n=null!=e?Un(Bn(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=Wn(t),i=0,a=s.length;i<a;i++)r=s[i],Hn.call(e,r)||void 0===r||Fn(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=Ln(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Fn(n,"default",{value:e,enumerable:!0}),e));const Yn=()=>{},Vn=e=>{Object.freeze&&Object.freeze(e)};function Kn(e,t,n){var o;const r=t.join(".");return null!==(o=n[r])&&void 0!==o||(n[r]=new Proxy(Yn,{get(o,r){if("string"==typeof r&&"then"!==r)return Kn(e,[...t,r],n)},apply(n,o,r){const s=t[t.length-1];let i={args:r,path:t};return"call"===s?i={args:r.length>=2?[r[1]]:[],path:t.slice(0,-1)}:"apply"===s&&(i={args:r.length>=2?r[1]:[],path:t.slice(0,-1)}),Vn(i.args),Vn(i.path),e(i)}})),n[r]}const Xn=e=>Kn(e,[],Object.create(null));var Qn=Jn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),eo=Jn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Qn().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),to=Jn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Qn().default,o=eo();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),no=Jn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=to();t.exports=function(e,t,o){return(t=n(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),oo=Jn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=no();function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});Gn(oo(),1);Gn(no(),1),Error;Error;var ro=Gn(oo(),1),so=class extends Error{constructor(){super("Unable to transform response from server")}};function io(e,t){let n;try{n=function(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,ro.default)((0,ro.default)({},e),{},{error:n})}}return{ok:!0,result:(0,ro.default)((0,ro.default)({},e.result),(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.deserialize(e.result.data)})}}(e,t)}catch(e){throw new so}if(!(n.ok||Sn(n.error.error)&&"number"==typeof n.error.error.code))throw new so;if(n.ok&&!Sn(n.result))throw new so;return n}Gn(oo(),1),Symbol();const ao=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function uo(e){let t=null,n=null;function o(){const o=function(t){const n=[[]];let o=0;for(;;){const i=t[o];if(!i)break;const a=n[n.length-1];if(i.aborted){var r;null===(r=i.reject)||void 0===r||r.call(i,new Error("Aborted")),o++;continue}var s;e.validate(a.concat(i).map(e=>e.key))?(a.push(i),o++):0!==a.length?n.push([]):(null===(s=i.reject)||void 0===s||s.call(i,new Error("Input is too big for a single dispatch")),o++)}return n}(t);clearTimeout(n),n=null,t=null;for(const t of o){if(!t.length)continue;const n={items:t};for(const e of t)e.batch=n;e.fetch(n.items.map(e=>e.key)).then(async e=>{await Promise.all(e.map(async(e,t)=>{const o=n.items[t];try{var r;const t=await Promise.resolve(e);null===(r=o.resolve)||void 0===r||r.call(o,t)}catch(e){var s;null===(s=o.reject)||void 0===s||s.call(o,e)}o.batch=null,o.reject=null,o.resolve=null}));for(const e of n.items){var t;null===(t=e.reject)||void 0===t||t.call(e,new Error("Missing result")),e.batch=null}}).catch(e=>{for(const o of n.items){var t;null===(t=o.reject)||void 0===t||t.call(o,e),o.batch=null}})}}return{load:function(e){var r;const s={aborted:!1,key:e,batch:null,resolve:ao,reject:ao},i=new Promise((e,n)=>{var o;s.reject=n,s.resolve=e,null!==(o=t)&&void 0!==o||(t=[]),t.push(s)});return null!==(r=n)&&void 0!==r||(n=setTimeout(o)),i}}}var co=mn(wn(),1);function lo(e){var t,n;const o=function(e){return{url:e.url.toString(),fetch:e.fetch,transformer:$n(e.transformer),methodOverride:e.methodOverride}}(e),r=null!==(t=e.maxURLLength)&&void 0!==t?t:1/0,s=null!==(n=e.maxItems)&&void 0!==n?n:1/0;return()=>{const t=t=>({validate(e){if(r===1/0&&s===1/0)return!0;if(e.length>s)return!1;const n=e.map(e=>e.path).join(","),i=e.map(e=>e.input);return Zn((0,co.default)((0,co.default)({},o),{},{type:t,path:n,inputs:i,signal:null})).length<=r},async fetch(n){const r=n.map(e=>e.path).join(","),s=n.map(e=>e.input),i=function(...e){const t=new AbortController,n=e.length;let o=0;const r=()=>{++o===n&&t.abort()};for(const t of e)(null==t?void 0:t.aborted)?r():null==t||t.addEventListener("abort",r,{once:!0});return t.signal}(...n.map(e=>e.signal)),a=await(e=>async function(e){const t={},n=await async function(e){var t;Nn(e.signal);const n=e.getUrl(e),o=e.getBody(e),r=null!==(t=e.methodOverride)&&void 0!==t?t:In[e.type],s=await(async()=>{const t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),i=(0,Tn.default)((0,Tn.default)((0,Tn.default)({},e.contentTypeHeader&&"GET"!==r?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),s);return function(e){if(e)return e;if("undefined"!=typeof window&&Mn(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&Mn(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}(e.fetch)(n,{method:r,signal:e.signal,body:o,headers:i})}(e);t.response=n;const o=await n.json();return t.responseJSON=o,{json:o,meta:t}}((0,Tn.default)((0,Tn.default)({},e),{},{contentTypeHeader:"application/json",getUrl:Zn,getBody:Dn})))((0,co.default)((0,co.default)({},o),{},{path:r,inputs:s,type:t,headers:()=>e.headers?"function"==typeof e.headers?e.headers({opList:n}):e.headers:{},signal:i}));return(Array.isArray(a.json)?a.json:n.map(()=>a.json)).map(e=>({meta:a.meta,json:e}))}}),n={query:uo(t("query")),mutation:uo(t("mutation"))};return({op:e})=>An(t=>{if("subscription"===e.type)throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let r;return n[e.type].load(e).then(e=>{r=e;const n=io(e.json,o.transformer.output);n.ok?(t.next({context:e.meta,result:n.result}),t.complete()):t.error(zn.from(n.error,{meta:e.meta}))}).catch(e=>{t.error(zn.from(e,{meta:null==r?void 0:r.meta}))}),()=>{}})}}function po(e){let t=e;const n=[],o=An(e=>((e=>{void 0!==t&&e.next(t),n.push(e)})(e),()=>{(e=>{n.splice(n.indexOf(e),1)})(e)}));return o.next=e=>{if(t!==e){t=e;for(const t of n)t.next(e)}},o.get=()=>t,o}mn(wn(),1),Symbol();const fo={encode:e=>JSON.stringify(e),decode:e=>{if("string"!=typeof e)throw new Error("jsonEncoder received binary data. JSON uses text frames. Use a binary encoder for binary data.");return JSON.parse(e)}},ho={enabled:!1,closeMs:0},mo={enabled:!1,pongTimeoutMs:1e3,intervalMs:5e3},go=e=>0===e?0:Math.min(1e3*2**e,3e4),vo=(e,...t)=>"function"==typeof e?e(...t):e;var yo=mn(bn(),1),bo=class e extends Error{constructor(t){super(t.message,{cause:t.cause}),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,e.prototype)}},wo=class{constructor(e,t){this.onTimeout=e,this.timeoutMs=t,(0,yo.default)(this,"timeout",void 0)}reset(){this.timeout&&(clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs))}start(){clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs)}stop(){clearTimeout(this.timeout),this.timeout=void 0}};function Ao(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var _o=mn(bn(),1),ko=class{constructor(){(0,_o.default)(this,"outgoingRequests",new Array),(0,_o.default)(this,"pendingRequests",{})}register(e,t){const{promise:n,resolve:o}=Ao();return this.outgoingRequests.push({id:String(e.id),message:e,end:n,callbacks:{next:t.next,complete:()=>{t.complete(),o()},error:e=>{t.error(e),o()}}}),()=>{this.delete(e.id),t.complete(),o()}}delete(e){null!==e&&(this.outgoingRequests=this.outgoingRequests.filter(({id:t})=>t!==String(e)),delete this.pendingRequests[String(e)])}flush(){const e=this.outgoingRequests;this.outgoingRequests=[];for(const t of e)this.pendingRequests[t.id]=t;return e}getPendingRequests(){return Object.values(this.pendingRequests)}getPendingRequest(e){return null===e?null:this.pendingRequests[String(e)]}getOutgoingRequests(){return this.outgoingRequests}getRequests(){return[...this.getOutgoingRequests().map(e=>({state:"outgoing",message:e.message,end:e.end,callbacks:e.callbacks})),...this.getPendingRequests().map(e=>({state:"pending",message:e.message,end:e.end,callbacks:e.callbacks}))]}hasPendingRequests(){return this.getPendingRequests().length>0}hasPendingSubscriptions(){return this.getPendingRequests().some(e=>"subscription"===e.message.method)}hasOutgoingRequests(){return this.outgoingRequests.length>0}},xo=mn(bn(),1);function Co(e,{intervalMs:t,pongTimeoutMs:n}){let o,r;function s(){o=setTimeout(()=>{e.send("PING"),r=setTimeout(()=>{e.close()},n)},t)}e.addEventListener("open",s),e.addEventListener("message",({data:e})=>{clearTimeout(o),s(),"PONG"===e&&(clearTimeout(r),clearTimeout(o),s())}),e.addEventListener("close",()=>{clearTimeout(o),clearTimeout(r)})}var So=class e{constructor(t){var n;if((0,xo.default)(this,"id",++e.connectCount),(0,xo.default)(this,"WebSocketPonyfill",void 0),(0,xo.default)(this,"urlOptions",void 0),(0,xo.default)(this,"keepAliveOpts",void 0),(0,xo.default)(this,"wsObservable",po(null)),(0,xo.default)(this,"openPromise",null),this.WebSocketPonyfill=null!==(n=t.WebSocketPonyfill)&&void 0!==n?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++e.connectCount;const n=async function(e){const t=await vo(e.url);if(!e.connectionParams)return t;const n=t.includes("?")?"&":"?";return t+`${n}connectionParams=1`}(t.urlOptions).then(e=>new t.WebSocketPonyfill(e));t.openPromise=n.then(async e=>{t.ws=e,e.binaryType="arraybuffer",e.addEventListener("message",function({data:e}){"PING"===e&&this.send("PONG")}),t.keepAliveOpts.enabled&&Co(e,t.keepAliveOpts),e.addEventListener("close",()=>{t.ws===e&&(t.ws=null)}),await function(e){const{promise:t,resolve:n,reject:o}=Ao();return e.addEventListener("open",()=>{e.removeEventListener("error",o),n()}),e.addEventListener("error",o),t}(e),t.urlOptions.connectionParams&&e.send(await async function(e){const t={method:"connectionParams",data:await vo(e)};return JSON.stringify(t)}(t.urlOptions.connectionParams))});try{await t.openPromise}finally{t.openPromise=null}}async close(){try{await this.openPromise}finally{var e;null===(e=this.ws)||void 0===e||e.close()}}};(0,xo.default)(So,"connectCount",0);var Po=mn(bn(),1),Eo=mn(wn(),1),jo=class{constructor(e){var t,n;(0,Po.default)(this,"connectionState",void 0),(0,Po.default)(this,"allowReconnect",!1),(0,Po.default)(this,"requestManager",new ko),(0,Po.default)(this,"activeConnection",void 0),(0,Po.default)(this,"reconnectRetryDelay",void 0),(0,Po.default)(this,"inactivityTimeout",void 0),(0,Po.default)(this,"callbacks",void 0),(0,Po.default)(this,"lazyMode",void 0),(0,Po.default)(this,"encoder",void 0),(0,Po.default)(this,"reconnecting",null),this.encoder=null!==(t=e.experimental_encoder)&&void 0!==t?t:fo,this.callbacks={onOpen:e.onOpen,onClose:e.onClose,onError:e.onError};const o=(0,Eo.default)((0,Eo.default)({},ho),e.lazy);this.inactivityTimeout=new wo(()=>{this.requestManager.hasOutgoingRequests()||this.requestManager.hasPendingRequests()?this.inactivityTimeout.reset():this.close().catch(()=>null)},o.closeMs),this.activeConnection=new So({WebSocketPonyfill:e.WebSocket,urlOptions:e,keepAlive:(0,Eo.default)((0,Eo.default)({},mo),e.keepAlive)}),this.activeConnection.wsObservable.subscribe({next:e=>{e&&this.setupWebSocketListeners(e)}}),this.reconnectRetryDelay=null!==(n=e.retryDelayMs)&&void 0!==n?n:go,this.lazyMode=o.enabled,this.connectionState=po({type:"state",state:o.enabled?"idle":"connecting",error:null}),this.lazyMode||this.open().catch(()=>null)}async open(){var e=this;e.allowReconnect=!0,"idle"===e.connectionState.get().state&&e.connectionState.next({type:"state",state:"connecting",error:null});try{await e.activeConnection.open()}catch(t){return e.reconnect(new bo({message:"Initialization error",cause:t})),e.reconnecting}}async close(){var e=this;e.allowReconnect=!1,e.inactivityTimeout.stop();const t=[];for(const n of e.requestManager.getRequests())"subscription"===n.message.method?n.callbacks.complete():"outgoing"===n.state?n.callbacks.error(zn.from(new bo({message:"Closed before connection was established"}))):t.push(n.end);await Promise.all(t).catch(()=>null),await e.activeConnection.close().catch(()=>null),e.connectionState.next({type:"state",state:"idle",error:null})}request({op:{id:e,type:t,path:n,input:o,signal:r},transformer:s,lastEventId:i}){return An(a=>{const u=this.batchSend({id:e,method:t,params:{input:s.input.serialize(o),path:n,lastEventId:i}},(0,Eo.default)((0,Eo.default)({},a),{},{next(e){const t=io(e,s.output);t.ok?a.next({result:t.result}):a.error(zn.from(t.error))}}));return()=>{u(),"subscription"===t&&this.activeConnection.isOpen()&&this.send({id:e,method:"subscription.stop"}),null==r||r.removeEventListener("abort",u)}})}get connection(){return(e=this.activeConnection).isOpen()?{id:e.id,state:"open",ws:e.ws}:e.isClosed()?{id:e.id,state:"closed",ws:e.ws}:e.ws?{id:e.id,state:"connecting",ws:e.ws}:null;var e}reconnect(e){var t=this;if(this.connectionState.next({type:"state",state:"connecting",error:zn.from(e)}),this.reconnecting)return;const n=async e=>{try{await En(t.reconnectRetryDelay(e)),t.allowReconnect&&(await t.activeConnection.close(),await t.activeConnection.open(),t.requestManager.hasPendingRequests()&&t.send(t.requestManager.getPendingRequests().map(({message:e})=>e))),t.reconnecting=null}catch(t){await n(e+1)}};this.reconnecting=n(0)}setupWebSocketListeners(e){var t=this;const n=e=>{const t=this.requestManager.getPendingRequests();for(const{message:n,callbacks:o}of t)"subscription"!==n.method&&(o.error(zn.from(null!=e?e:new bo({message:"WebSocket closed",cause:e}))),this.requestManager.delete(n.id))};e.addEventListener("open",()=>{Pn(async()=>{var e,n;t.lazyMode&&t.inactivityTimeout.start(),null===(e=(n=t.callbacks).onOpen)||void 0===e||e.call(n),t.connectionState.next({type:"state",state:"pending",error:null})}).catch(t=>{e.close(3e3),n(t)})}),e.addEventListener("message",({data:e})=>{if(this.inactivityTimeout.reset(),["PING","PONG"].includes(e))return;const t=this.encoder.decode(e);"method"in t?this.handleIncomingRequest(t):this.handleResponseMessage(t)}),e.addEventListener("close",e=>{var t,o;n(e),null===(t=(o=this.callbacks).onClose)||void 0===t||t.call(o,e),this.lazyMode&&!this.requestManager.hasPendingSubscriptions()||this.reconnect(new bo({message:"WebSocket closed",cause:e}))}),e.addEventListener("error",e=>{var t,o;n(e),null===(t=(o=this.callbacks).onError)||void 0===t||t.call(o,e),this.reconnect(new bo({message:"WebSocket closed",cause:e}))})}handleResponseMessage(e){const t=this.requestManager.getPendingRequest(e.id);if(!t)return;t.callbacks.next(e);let n=!0;"result"in e&&"subscription"===t.message.method&&("data"===e.result.type&&(t.message.params.lastEventId=e.result.id),"stopped"!==e.result.type&&(n=!1)),n&&(t.callbacks.complete(),this.requestManager.delete(e.id))}handleIncomingRequest(e){"reconnect"===e.method&&this.reconnect(new bo({message:"Server requested reconnect"}))}send(e){if(!this.activeConnection.isOpen())throw new Error("Active connection is not open");const t=e instanceof Array?e:[e];this.activeConnection.ws.send(this.encoder.encode(1===t.length?t[0]:t))}batchSend(e,t){var n=this;return this.inactivityTimeout.reset(),Pn(async()=>{n.activeConnection.isOpen()||await n.open(),await En(0),n.requestManager.hasOutgoingRequests()&&n.send(n.requestManager.flush().map(({message:e})=>e))}).catch(n=>{this.requestManager.delete(e.id),t.error(zn.from(n))}),this.requestManager.register(e,t)}};function Oo(e){const{client:t}=e,n=$n(e.transformer);return()=>({op:e})=>An(o=>{const r="subscription"===e.type?t.connectionState.subscribe({next(t){o.next({result:t,context:e.context})}}):null,s=t.request({op:e,transformer:n}).subscribe(o);return()=>{s.unsubscribe(),null==r||r.unsubscribe()}})}var zo=mn(bn(),1),$o=mn(wn(),1),Mo=class{constructor(e){(0,zo.default)(this,"links",void 0),(0,zo.default)(this,"runtime",void 0),(0,zo.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){var t;return kn({links:this.links,op:(0,$o.default)((0,$o.default)({},e),{},{context:null!==(t=e.context)&&void 0!==t?t:{},id:++this.requestId})}).pipe(e=>{let t=0,n=null;const o=[];return An(r=>(t++,o.push(r),n||(n=e.subscribe({next(e){for(const n of o){var t;null===(t=n.next)||void 0===t||t.call(n,e)}},error(e){for(const n of o){var t;null===(t=n.error)||void 0===t||t.call(n,e)}},complete(){for(const t of o){var e;null===(e=t.complete)||void 0===e||e.call(t)}}})),{unsubscribe(){t--,function(){if(0===t&&n){const e=n;n=null,e.unsubscribe()}}();const e=o.findIndex(e=>e===r);e>-1&&o.splice(e,1)}}))})}async requestAsPromise(e){try{const t=this.$request(e);return(await function(e){const t=new AbortController;return new Promise((n,o)=>{let r=!1;function s(){r||(r=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{o(t.signal.reason)});const i=e.subscribe({next(e){r=!0,n(e),s()},error(e){o(e)},complete(){t.abort(),s()}})})}(t)).result.data}catch(e){throw zn.from(e)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case"state":var t;null===(t=n.onConnectionStateChange)||void 0===t||t.call(n,e.result);break;case"started":var o;null===(o=n.onStarted)||void 0===o||o.call(n,{context:e.context});break;case"stopped":var r;null===(r=n.onStopped)||void 0===r||r.call(n);break;case"data":case void 0:var s;null===(s=n.onData)||void 0===s||s.call(n,e.result.data)}},error(e){var t;null===(t=n.onError)||void 0===t||t.call(n,e)},complete(){var e;null===(e=n.onComplete)||void 0===e||e.call(n)}})}};const To=Symbol.for("trpc_untypedClient"),Io={query:"query",mutate:"mutation",subscribe:"subscription"};mn(wn(),1),mn(wn(),1),mn(hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(n=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new n(e)}t.exports=function(e){var t,o,r,s=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(o&&null!=(t=e[o]))return t.call(e);if(r&&null!=(t=e[r]))return new n(t.call(e));o="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")},t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),mn(wn(),1);var Ro=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){t.exports=function(){var e="function"==typeof SuppressedError?SuppressedError:function(e,t){var n=Error();return n.name="SuppressedError",n.error=e,n.suppressed=t,n},t={},n=[];function o(e,t){if(null!=t){if(Object(t)!==t)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(e)var o=t[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(void 0===o&&(o=t[Symbol.dispose||Symbol.for("Symbol.dispose")],e))var r=o;if("function"!=typeof o)throw new TypeError("Object is not disposable.");r&&(o=function(){try{r.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:o,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var o,r=this.e,s=0;function i(){for(;o=n.pop();)try{if(!o.a&&1===s)return s=0,n.push(o),Promise.resolve().then(i);if(o.d){var e=o.d.call(o.v);if(o.a)return s|=2,Promise.resolve(e).then(i,a)}else s|=1}catch(e){return a(e)}if(1===s)return r!==t?Promise.reject(r):Promise.resolve();if(r!==t)throw r}function a(n){return r=r!==t?new e(n,r):n,i()}return i()}}},t.exports.__esModule=!0,t.exports.default=t.exports}}),Zo=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){t.exports=function(e,t){this.v=e,this.k=t},t.exports.__esModule=!0,t.exports.default=t.exports}}),Do=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=Zo();t.exports=function(e){return new n(e,0)},t.exports.__esModule=!0,t.exports.default=t.exports}}),qo=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=Zo();function o(e){var t,o;function r(t,o){try{var i=e[t](o),a=i.value,u=a instanceof n;Promise.resolve(u?a.v:a).then(function(n){if(u){var o="return"===t?"return":"next";if(!a.k||n.done)return r(o,n);n=e[o](n).value}s(i.done?"return":"normal",n)},function(e){r("throw",e)})}catch(e){s("throw",e)}}function s(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?r(t.key,t.arg):o=null}this._invoke=function(e,n){return new Promise(function(s,i){var a={key:e,arg:n,resolve:s,reject:i,next:null};o?o=o.next=a:(t=o=a,r(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}o.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)},t.exports=function(e){return function(){return new o(e.apply(this,arguments))}},t.exports.__esModule=!0,t.exports.default=t.exports}});async function No(e){const{url:t,reporter:n,onOpen:o}=e;await async function(){if("undefined"!=typeof globalThis){const e=globalThis;if(void 0===e.WebSocket){const{WebSocket:t}=await i.e(897).then(i.t.bind(i,897,19));e.WebSocket=t}}}(),function({reporter:e}){"undefined"!=typeof process&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",e?.ignoreLogMessage("Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable"))}({reporter:n}),n?.ignoreLogMessage("Received network error or non-101 status code."),n?.ignoreLogMessage("Connection was closed before it was established.");const r=new jo({url:t,onError:e=>{const t=e;t?.message?console.error(`[Cloudpack] Websocket client error: ${t.message}`):console.error("[Cloudpack] Unexpected websocket client error")},onOpen(){o?.()}});const s=function(e,t){try{return new URL(e,t)}catch{throw new Error(`Invalid URL: "${e}", base: ""`)}}(t),a="wss:"===s.protocol;s.protocol=a?"https:":"http:";const u=s.toString().replace(/\/$/,""),c=function(e){return function(e){const t=Xn(({path:t,args:n})=>{const o=[...t],r=(s=o.pop(),Io[s]);var s;const i=o.join(".");return e[r](i,...n)});return n=n=>n===To?e:t[n],new Proxy(Yn,{get(e,t){if("then"!==t)return n(t)}});var n}(new Mo(e))}({links:[Cn({condition:e=>"subscription"===e.type,true:Oo({client:r}),false:lo({url:u})})]}),l={subscribe:(e,t)=>(t={...t},t.onError??=t=>{console.error(`[Cloudpack] Error in ${e.path.join(".")} data subscription (this may be a Cloudpack bug): `+t.message)},c.onDataChanged.subscribe(e,t))};return new Proxy({close:async()=>{await r.close()},onDataChanged:l},{get:(e,t)=>e.hasOwnProperty(t)?e[t]:c[t]})}mn(Ro(),1),mn(Do(),1),mn(qo(),1),mn(wn(),1);var Uo=i(606),Fo=i.n(Uo),Lo=i(607),Wo=i.n(Lo),Bo=i(437),Ho=i.n(Bo),Jo=i(750),Go=i.n(Jo),Yo=i(994),Vo=i.n(Yo),Ko=i(415),Xo=i.n(Ko),Qo=i(721),er={};er.styleTagTransform=Xo(),er.setAttributes=Go(),er.insert=Ho().bind(null,"head"),er.domAPI=Wo(),er.insertStyleElement=Vo(),Fo()(Qo.default,er);const tr=Qo.default&&Qo.default.locals?Qo.default.locals:void 0;class nr{element;constructor(e="root"){this.element=document.getElementById(e)}updateStatus(e){const{message:t,tip:n,isError:o=!1,data:r}=e,s=o?"error":"debug";r?console[s](t,r):console[s](t),this.element&&(this.element.innerHTML=`\n <div class="${tr.statusContainer+(o?` ${tr.errorContainer}`:"")}">\n <h2 class="${tr.title}">Cloudpack Link Proxy</h2>\n <p class="${tr.message}">${o?"Error: ":""}${t}</p>\n ${n?`<p class="${tr.message}"><strong>Tip:</strong> ${n}</p>`:""}\n <p class="${tr.warning}">Do not close this page while Cloudpack link is running.</p>\n </div>\n `)}}class or{clients=new Map;connectionStates=new Map;checkInterval=null;checkIntervalMs=5e3;addClient(e,t){this.clients.set(e,t),this.connectionStates.set(e,!0)}getClient(e){return this.clients.get(e)}async checkConnection(e){const t=this.clients.get(e);if(!t)return!1;try{return await t.getSessionId.query(),!0}catch(t){return console.warn(`${e} client connection lost:`,t),!1}}startMonitoring(e){this.checkInterval&&window.clearInterval(this.checkInterval),this.checkInterval=window.setInterval(()=>{(async()=>{for(const[t,n]of this.clients){if("link"!=t&&"host"!=t)throw new Error(`Invalid client ID: ${t}`);const n=this.connectionStates.get(t)||!1,o=await this.checkConnection(t);n!==o&&await e({id:t,isConnected:o,wasConnected:n}),this.connectionStates.set(t,o)}})().catch(e=>{console.error("Error in connection monitoring:",e)})},this.checkIntervalMs)}stopMonitoring(){this.checkInterval&&(window.clearInterval(this.checkInterval),this.checkInterval=null)}async closeAll(){for(const[e,t]of this.clients)try{await t.close(),console.log(`Closed ${e} client`)}catch(t){console.error(`Error closing ${e} client:`,t)}this.clients.clear(),this.connectionStates.clear()}}async function rr(e){console.debug(`[Cloudpack] Checking session at ${e}`);const t=await No({url:e});let n=!1;try{n=!!await t.getSessionId.query()}catch{}finally{await t.close()}return n}const sr=new class{ui;connectionManager;linkedPathData=null;constructor(){this.ui=new nr,this.connectionManager=new or}handleConnectionChange=async e=>{const{id:t,isConnected:n,wasConnected:o}=e;o&&!n&&("host"===t?await this.handleHostDisconnection():"link"===t&&await this.handleLinkDisconnection())};async handleHostDisconnection(e){const t=e?.unreachable??!1,n=t?"unreachable":"lost";this.ui.updateStatus({message:`Connection to host ${n}. The session will be terminated.`,isError:!0});const o=this.connectionManager.getClient("link");let r,s=!1;if(o)try{await o.publishData.mutate({...an,data:{reason:n}}),s=!0}catch{this.ui.updateStatus({message:`Error notifying link client of host connection ${n}.`,isError:!0})}await this.cleanup(),t?r="Make sure you have a <code>cloudpack start</code> session running and use the URL from your app to run link with the following command: <code>cloudpack link --remote [URL]</code>":(r="If you did not close the start session terminal, this is a bug. Please report it.",s||(r+=" Link client was not successfully notified of host disconnection. You may need to terminate the link session in the terminal.")),this.ui.updateStatus({message:`Connection to host ${n}. You can close this page.`,tip:r,isError:!0})}async handleLinkDisconnection(){this.ui.updateStatus({message:"Connection to link client lost. Cleaning up linked paths...",isError:!0});const e=this.connectionManager.getClient("host");if(e&&this.linkedPathData){const{linkedPath:t}=this.linkedPathData,n=t.path;try{await e.unlinkPath.mutate({linkedPath:{path:n}}),this.ui.updateStatus({message:"Connection to link client lost. Successfully unlinked paths on host. You can close this page.",tip:"If you did not close the link client terminal. This is a bug. Please report it."})}catch(e){this.ui.updateStatus({message:"Connection to link client lost. Failed to unlink paths on host.",tip:"You may need to restart the host application to unlink the paths.",isError:!0,data:e})}}else this.ui.updateStatus({message:"Cannot clean up: host client or link data not available",tip:"You may need to restart the host application to unlink the paths.",isError:!0});await this.cleanup()}setupLinkUpdateHandler(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");e&&t&&e.onDataChanged.subscribe(nn,{onData:e=>{this.ui.updateStatus({message:"Forwarding package update to the host...",data:e}),t.notifyLinkChange.mutate(e).then(()=>this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})).catch(e=>{this.ui.updateStatus({message:"Error forwarding package update to the host. This is a bug. Please report it.",isError:!0,data:e})})}})}async setupLinkPathHandler(){const e=this.connectionManager.getClient("host"),t=this.connectionManager.getClient("link");t&&e&&(await t.getData.query(rn)||t.onDataChanged.subscribe(rn,{onData:n=>{this.ui.updateStatus({message:"Processing link setup...",data:n}),this.linkedPathData=n,e.linkPath.mutate(this.linkedPathData).then(e=>{const{resolveMap:n,linkedPaths:o}=e;this.ui.updateStatus({message:"Sending link setup result back to the link server...",data:e}),t.publishData.mutate({...sn,data:{resolveMap:n,linkedPaths:o}}).then(()=>{this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})}).catch(e=>{this.ui.updateStatus({message:"Error sending link setup result back to the link server. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})})})}}))}async setupConfig(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");if(e&&t)try{if(!await e.getData.query(on)){this.ui.updateStatus({message:"Fetching host configuration..."});const n=await t.getLinkConfig.query();this.ui.updateStatus({message:"Sending host configuration to the link server...",data:n}),await e.publishData.mutate({...on,data:n}),this.ui.updateStatus({message:"Host configuration sent to the link server."})}}catch(e){this.ui.updateStatus({message:"Error setting up configuration. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})}}async cleanup(){this.connectionManager.stopMonitoring(),await this.connectionManager.closeAll()}async initialize(){this.ui.updateStatus({message:"Initializing Cloudpack Link Proxy..."});try{if(!window.__cloudpack)throw this.ui.updateStatus({message:"Cloudpack context not found on window.",tip:"This is a bug. Please report it.",isError:!0}),new Error("Cloudpack not found on window.");const{pageSessionContext:e}=window.__cloudpack;if(!e)throw this.ui.updateStatus({message:"Session context not found on window.__cloudpack.",tip:"This is a bug. Please report it.",isError:!0,data:window.__cloudpack}),new Error("Session context not found on window.__cloudpack");const{apiUrl:t,hostApiServerUrls:n}=e;if(!n||n.length<=0)return void this.ui.updateStatus({message:"No host URL provided.",tip:"This is a bug. Please report it.",data:e,isError:!0});const o=await No({url:t});let r;this.connectionManager.addClient("link",o);for(const e of n)if(this.ui.updateStatus({message:`Checking host API server at ${e}...`}),await rr(e)){this.ui.updateStatus({message:`Host API server is active at ${e}.`}),r=e;break}if(!r)return void await this.handleHostDisconnection({unreachable:!0});const s=await No({url:r});this.connectionManager.addClient("host",s);const i=await o.getSessionId.query(),a=await s.getSessionId.query();this.ui.updateStatus({message:`Link Session: ${i}, Host Session: ${a}`}),this.connectionManager.startMonitoring(this.handleConnectionChange),this.setupLinkUpdateHandler(),await this.setupLinkPathHandler(),await this.setupConfig()}catch(e){const t=e instanceof Error?e.message:String(e);this.ui.updateStatus({message:t,isError:!0,tip:"This is a bug. Please report it.",data:e}),await this.cleanup()}}};sr.initialize();
2
+ var e,t,n,o,r={721(e,t,n){n.d(t,{default:()=>a});var o=n(421),r=n.n(o),s=n(115),i=n.n(s)()(r());i.push([e.id,":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\nbody {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.statusContainer__v64eNmuXrV4WWsOKdGgy {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr {\n background-color: var(--color-status-danger-background1);\n}\n\n.title__b6Vf2DbiFQkD7AEkJ7p_ h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n.message__05tS4aUzls4kEWk9hkA7 {\n color: var(--color-neutral-foreground1);\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr .title__b6Vf2DbiFQkD7AEkJ7p_ {\n color: var(--color-status-danger-foreground1);\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr .message__05tS4aUzls4kEWk9hkA7 {\n color: var(--color-status-danger-foreground1);\n}\n\n.message__05tS4aUzls4kEWk9hkA7 code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.errorContainer__ScZ3E77NPMqtBzp0OwUr .message__05tS4aUzls4kEWk9hkA7 code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.warning__kheFps3bT2VbnjAMYfSr {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n","",{version:3,sources:["webpack://./src/UIManager.module.css"],names:[],mappings:"AAAA;EACE,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,oCAAoC;AACtC;;AAEA;EACE;IACE,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,oCAAoC;EACtC;AACF;;AAEA;EACE,kDAAkD;EAClD,SAAS;EACT,UAAU;EACV;;;;;;;cAOY;AACd;;AAEA;EACE,aAAa;EACb,kBAAkB;EAClB,kDAAkD;EAClD,YAAY;EACZ,wCAAwC;AAC1C;;AAEA;EACE,wDAAwD;AAC1D;;AAEA;EACE,uCAAuC;EACvC,aAAa;AACf;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,kDAAkD;EAClD,gBAAgB;EAChB,kBAAkB;EAClB,2DAA2D;EAC3D,gBAAgB;AAClB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;EACE,iBAAiB;EACjB,gBAAgB;EAChB,uCAAuC;AACzC",sourcesContent:[":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\n:global body {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.statusContainer {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.errorContainer {\n background-color: var(--color-status-danger-background1);\n}\n\n.title h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n.message {\n color: var(--color-neutral-foreground1);\n}\n\n.errorContainer .title {\n color: var(--color-status-danger-foreground1);\n}\n\n.errorContainer .message {\n color: var(--color-status-danger-foreground1);\n}\n\n.message code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.errorContainer .message code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.warning {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n"],sourceRoot:""}]),i.locals={statusContainer:"statusContainer__v64eNmuXrV4WWsOKdGgy",errorContainer:"errorContainer__ScZ3E77NPMqtBzp0OwUr",title:"title__b6Vf2DbiFQkD7AEkJ7p_",message:"message__05tS4aUzls4kEWk9hkA7",warning:"warning__kheFps3bT2VbnjAMYfSr"};const a=i},115(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,o,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(o)for(var a=0;a<this.length;a++){var u=this[a][0];null!=u&&(i[u]=!0)}for(var c=0;c<e.length;c++){var l=[].concat(e[c]);o&&i[l[0]]||(void 0!==s&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=s),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),r&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=r):l[4]="".concat(r)),t.push(l))}},t}},421(e){e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var o=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},606(e){var t=[];function n(e){for(var n=-1,o=0;o<t.length;o++)if(t[o].identifier===e){n=o;break}return n}function o(e,o){for(var s={},i=[],a=0;a<e.length;a++){var u=e[a],c=o.base?u[0]+o.base:u[0],l=s[c]||0,d="".concat(c," ").concat(l);s[c]=l+1;var p=n(d),f={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)t[p].references++,t[p].updater(f);else{var h=r(f,o);o.byIndex=a,t.splice(a,0,{identifier:d,updater:h,references:1})}i.push(d)}return i}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=o(e=e||[],r=r||{});return function(e){e=e||[];for(var i=0;i<s.length;i++){var a=n(s[i]);t[a].references--}for(var u=o(e,r),c=0;c<s.length;c++){var l=n(s[c]);0===t[l].references&&(t[l].updater(),t.splice(l,1))}s=u}}},437(e){var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},994(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},750(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},607(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,r&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},415(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={id:e,exports:{}};return r[e](n,n.exports,i),n.exports}i.m=r,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&o&&n;("object"==typeof a||"function"==typeof a)&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>n[e]);return s.default=()=>n,i.d(r,s),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,n)=>(i.f[n](e,t),t),[])),i.u=e=>e+".chunk.js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n={293:0},o=e=>{var t,o,{__webpack_esm_ids__:r,__webpack_esm_modules__:s,__webpack_esm_runtime__:a}=e,u=0;for(t in s)i.o(s,t)&&(i.m[t]=s[t]);for(a&&a(i);u<r.length;u++)o=r[u],i.o(n,o)&&n[o]&&n[o][0](),n[r[u]]=0},i.f.j=(e,t)=>{var r=i.o(n,e)?n[e]:void 0;if(0!==r)if(r)t.push(r[1]);else{var s=import("../"+i.u(e)).then(o,t=>{throw 0!==n[e]&&(n[e]=void 0),t});s=Promise.race([s,new Promise(t=>r=n[e]=[t])]),t.push(r[1]=s)}},i.nc=void 0;var a={};function u(e,t,n){function o(n,o){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:o,constr:i,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,o);const r=i.prototype,s=Object.keys(r);for(let e=0;e<s.length;e++){const t=s[e];t in n||(n[t]=r[t].bind(n))}}const r=n?.Parent??Object;class s extends r{}function i(e){var t;const r=n?.Parent?new s:this;o(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}i.r(a),i.d(a,{base64:()=>de,base64url:()=>pe,bigint:()=>_e,boolean:()=>Ce,browserEmail:()=>oe,cidrv4:()=>ce,cidrv6:()=>le,cuid:()=>q,cuid2:()=>N,date:()=>ve,datetime:()=>we,domain:()=>he,duration:()=>B,e164:()=>me,email:()=>X,emoji:()=>se,extendedDuration:()=>H,guid:()=>J,hex:()=>Oe,hostname:()=>fe,html5Email:()=>Q,idnEmail:()=>ne,integer:()=>ke,ipv4:()=>ie,ipv6:()=>ae,ksuid:()=>L,lowercase:()=>Ee,mac:()=>ue,md5_base64:()=>Te,md5_base64url:()=>Ie,md5_hex:()=>Me,nanoid:()=>W,null:()=>Se,number:()=>xe,rfc5322Email:()=>ee,sha1_base64:()=>Ze,sha1_base64url:()=>De,sha1_hex:()=>Re,sha256_base64:()=>Ne,sha256_base64url:()=>Ue,sha256_hex:()=>qe,sha384_base64:()=>Le,sha384_base64url:()=>We,sha384_hex:()=>Fe,sha512_base64:()=>He,sha512_base64url:()=>Je,sha512_hex:()=>Be,string:()=>Ae,time:()=>be,ulid:()=>U,undefined:()=>Pe,unicodeEmail:()=>te,uppercase:()=>je,uuid:()=>G,uuid4:()=>Y,uuid6:()=>V,uuid7:()=>K,xid:()=>F}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class c extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}Error;const l={};function d(e){return e&&Object.assign(l,e),l}function p(e,t="|"){return e.map(e=>k(e)).join(t)}function f(e,t){return"bigint"==typeof t?t.toString():t}function h(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function m(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const g=Symbol("evaluating");function v(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==g)return void 0===o&&(o=g,o=n()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}const y="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function b(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function w(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function A(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function _(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function k(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function x(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function C(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function S(e){return"string"==typeof e?e:e?.message}function P(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=S(e.inst?._zod.def?.error?.(e))??S(t?.error?.(e))??S(n.customError?.(e))??S(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}h(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}),new Set(["string","number","symbol"]),new Set(["string","number","bigint","boolean","symbol","undefined"]),Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_VALUE,Number.MAX_VALUE;const E=(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,f,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},j=u("$ZodError",E),O=u("$ZodError",E,{Parent:Error}),z=e=>(t,n,o,r)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new c;if(i.issues.length){const t=new(r?.Err??e)(i.issues.map(e=>P(e,s,d())));throw y(t,r?.callee),t}return i.value},$=z(O),M=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(r?.Err??e)(i.issues.map(e=>P(e,s,d())));throw y(t,r?.callee),t}return i.value},T=M(O),I=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new c;return s.issues.length?{success:!1,error:new(e??j)(s.issues.map(e=>P(e,r,d())))}:{success:!0,data:s.value}},R=I(O),Z=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>P(e,r,d())))}:{success:!0,data:s.value}},D=Z(O),q=/^[cC][^\s-]{8,}$/,N=/^[0-9a-z]+$/,U=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,F=/^[0-9a-vA-V]{20}$/,L=/^[A-Za-z0-9]{27}$/,W=/^[a-zA-Z0-9_-]{21}$/,B=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,H=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,J=/^([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})$/,G=e=>e?new 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)$/,Y=G(4),V=G(6),K=G(7),X=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Q=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ee=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,te=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ne=te,oe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,re="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function se(){return new RegExp(re,"u")}const ie=/^(?:(?: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])$/,ae=/^(([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}|:))$/,ue=e=>{const t=w(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ce=/^((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])$/,le=/^(([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])$/,de=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pe=/^[A-Za-z0-9_-]*$/,fe=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,he=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,me=/^\+[1-9]\d{6,14}$/,ge="(?:(?:\\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])))",ve=new RegExp(`^${ge}$`);function ye(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function be(e){return new RegExp(`^${ye(e)}$`)}function we(e){const t=ye({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${ge}T(?:${o})$`)}const Ae=e=>new RegExp(`^${e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*"}$`),_e=/^-?\d+n?$/,ke=/^-?\d+$/,xe=/^-?\d+(?:\.\d+)?$/,Ce=/^(?:true|false)$/i,Se=/^null$/i,Pe=/^undefined$/i,Ee=/^[^A-Z]*$/,je=/^[^a-z]*$/,Oe=/^[0-9a-fA-F]*$/;function ze(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function $e(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Me=/^[0-9a-fA-F]{32}$/,Te=ze(22,"=="),Ie=$e(22),Re=/^[0-9a-fA-F]{40}$/,Ze=ze(27,"="),De=$e(27),qe=/^[0-9a-fA-F]{64}$/,Ne=ze(43,"="),Ue=$e(43),Fe=/^[0-9a-fA-F]{96}$/,Le=ze(64,""),We=$e(64),Be=/^[0-9a-fA-F]{128}$/,He=ze(86,"=="),Je=$e(86),Ge={major:4,minor:3,patch:6},Ye=u("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ge;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const t of o)for(const n of t._zod.onattach)n(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let o,r=x(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(r)continue;const t=e.issues.length,i=s._zod.check(e);if(i instanceof Promise&&!1===n?.async)throw new c;if(o||i instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await i,e.issues.length!==t&&(r||(r=x(e,t)))});else{if(e.issues.length===t)continue;r||(r=x(e,t))}}return o?o.then(()=>e):e},n=(n,r,s)=>{if(x(n))return n.aborted=!0,n;const i=t(r,o,s);if(i instanceof Promise){if(!1===s.async)throw new c;return i.then(t=>e._zod.parse(t,s))}return e._zod.parse(i,s)};e._zod.run=(r,s)=>{if(s.skipChecks)return e._zod.parse(r,s);if("backward"===s.direction){const t=e._zod.parse({value:r.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,s)):n(t,r,s)}const i=e._zod.parse(r,s);if(i instanceof Promise){if(!1===s.async)throw new c;return i.then(e=>t(e,o,s))}return t(i,o,s)}}v(e,"~standard",()=>({validate:t=>{try{const n=R(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return D(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ve=u("$ZodString",(e,t)=>{Ye.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ae(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ke=u("$ZodNumber",(e,t)=>{Ye.init(e,t),e._zod.pattern=e._zod.bag.pattern??xe,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const s="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),Xe=u("$ZodBoolean",(e,t)=>{Ye.init(e,t),e._zod.pattern=Ce,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Qe=u("$ZodAny",(e,t)=>{Ye.init(e,t),e._zod.parse=e=>e}),et=u("$ZodUnknown",(e,t)=>{Ye.init(e,t),e._zod.parse=e=>e});function tt(e,t,n){e.issues.length&&t.issues.push(...C(n,e.issues)),t.value[n]=e.value}const nt=u("$ZodArray",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const s=[];for(let e=0;e<r.length;e++){const i=r[e],a=t.element._zod.run({value:i,issues:[]},o);a instanceof Promise?s.push(a.then(t=>tt(t,n,e))):tt(a,n,e)}return s.length?Promise.all(s).then(()=>n):n}});function ot(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...C(n,e.issues))}void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const rt=u("$ZodObject",(e,t)=>{Ye.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const o=h(()=>function(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=e.shape,Object.keys(o).filter(e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}(t));v(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n});const r=b,s=t.catchall;let i;e._zod.parse=(t,n)=>{i??(i=o.value);const a=t.value;if(!r(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const u=[],c=i.shape;for(const e of i.keys){const o=c[e],r="optional"===o._zod.optout,s=o._zod.run({value:a[e],issues:[]},n);s instanceof Promise?u.push(s.then(n=>ot(n,t,e,a,r))):ot(s,t,e,a,r)}return s?function(e,t,n,o,r,s){const i=[],a=r.keySet,u=r.catchall._zod,c=u.def.type,l="optional"===u.optout;for(const r in t){if(a.has(r))continue;if("never"===c){i.push(r);continue}const s=u.run({value:t[r],issues:[]},o);s instanceof Promise?e.push(s.then(e=>ot(e,n,r,t,l))):ot(s,n,r,t,l)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}(u,a,t,n,o.value,e):u.length?Promise.all(u).then(()=>t):t}});function st(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter(e=>!x(e));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>P(e,o,d())))}),t)}const it=u("$ZodUnion",(e,t)=>{Ye.init(e,t),v(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),v(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),v(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),v(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>m(e.source)).join("|")})$`)}});const n=1===t.options.length,o=t.options[0]._zod.run;e._zod.parse=(r,s)=>{if(n)return o(r,s);let i=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},s);if(t instanceof Promise)a.push(t),i=!0;else{if(0===t.issues.length)return t;a.push(t)}}return i?Promise.all(a).then(t=>st(t,r,e,s)):st(a,r,e,s)}}),at=u("$ZodRecord",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!function(e){if(!1===b(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==b(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const e of i)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const i=t.valueType._zod.run({value:r[e],issues:[]},o);i instanceof Promise?s.push(i.then(t=>{t.issues.length&&n.issues.push(...C(e,t.issues)),n.value[e]=t.value})):(i.issues.length&&n.issues.push(...C(e,i.issues)),n.value[e]=i.value)}let u;for(const e in r)a.has(e)||(u=u??[],u.push(e));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:u})}else{n.value={};for(const i of Reflect.ownKeys(r)){if("__proto__"===i)continue;let a=t.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof i&&xe.test(i)&&a.issues.length){const e=t.keyType._zod.run({value:Number(i),issues:[]},o);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?n.value[i]=r[i]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>P(e,o,d())),input:i,path:[i],inst:e});continue}const u=t.valueType._zod.run({value:r[i],issues:[]},o);u instanceof Promise?s.push(u.then(e=>{e.issues.length&&n.issues.push(...C(i,e.issues)),n.value[a.value]=e.value})):(u.issues.length&&n.issues.push(...C(i,u.issues)),n.value[a.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),ut=u("$ZodLiteral",(e,t)=>{if(Ye.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?w(e):e?w(e.toString()):String(e)).join("|")})$`),e._zod.parse=(o,r)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});function ct(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const lt=u("$ZodOptional",(e,t)=>{Ye.init(e,t),e._zod.optin="optional",e._zod.optout="optional",v(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),v(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${m(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(t=>ct(t,e.value)):ct(o,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),dt=u("$ZodNonOptional",(e,t)=>{Ye.init(e,t),v(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(t=>pt(t,e)):pt(r,e)}});function pt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ft;Symbol("ZodOutput"),Symbol("ZodInput");(ft=globalThis).__zod_globalRegistry??(ft.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}),globalThis.__zod_globalRegistry;const ht=u("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Ye.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>$(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>R(e,t,n),e.parseAsync=async(t,n)=>T(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>D(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>A(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.apply=t=>t(e)}),mt=u("ZodMiniString",(e,t)=>{Ve.init(e,t),ht.init(e,t)});function gt(e){return function(e,t){return new mt({type:"string",..._(t)})}(0,e)}const vt=u("ZodMiniNumber",(e,t)=>{Ke.init(e,t),ht.init(e,t)});function yt(e){return function(e,t){return new vt({type:"number",checks:[],..._(t)})}(0,e)}const bt=u("ZodMiniBoolean",(e,t)=>{Xe.init(e,t),ht.init(e,t)});function wt(e){return function(e,t){return new bt({type:"boolean",..._(t)})}(0,e)}const At=u("ZodMiniAny",(e,t)=>{Qe.init(e,t),ht.init(e,t)});function _t(){return new At({type:"any"})}const kt=u("ZodMiniUnknown",(e,t)=>{et.init(e,t),ht.init(e,t)});const xt=u("ZodMiniArray",(e,t)=>{nt.init(e,t),ht.init(e,t)});function Ct(e,t){return new xt({type:"array",element:e,..._(t)})}const St=u("ZodMiniObject",(e,t)=>{rt.init(e,t),ht.init(e,t),v(e,"shape",()=>t.shape)});function Pt(e,t){const n={type:"object",shape:e??{},..._(t)};return new St(n)}function Et(e,t){return new St({type:"object",shape:e,catchall:new kt({type:"unknown"}),..._(t)})}const jt=u("ZodMiniUnion",(e,t)=>{it.init(e,t),ht.init(e,t)});function Ot(e,t){return new jt({type:"union",options:e,..._(t)})}const zt=u("ZodMiniRecord",(e,t)=>{at.init(e,t),ht.init(e,t)});function $t(e,t,n){return new zt({type:"record",keyType:e,valueType:t,..._(n)})}const Mt=u("ZodMiniLiteral",(e,t)=>{ut.init(e,t),ht.init(e,t)});function Tt(e,t){return new Mt({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}const It=u("ZodMiniOptional",(e,t)=>{lt.init(e,t),ht.init(e,t)});function Rt(e){return new It({type:"optional",innerType:e})}const Zt=u("ZodMiniNonOptional",(e,t)=>{dt.init(e,t),ht.init(e,t)});function Dt(e){return Pt(e)}function qt(e){return Et(e)}d({localeError:(()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{const t=o[e.expected]??e.expected,n=function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input);return`Invalid input: expected ${t}, received ${o[n]??n}`}case"invalid_value":return 1===e.values.length?`Invalid input: expected ${k(e.values[0])}`:`Invalid option: expected one of ${p(e.values,"|")}`;case"too_big":{const n=e.inclusive?"<=":"<",o=t(e.origin);return o?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.inclusive?">=":">",o=t(e.origin);return o?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${o.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${p(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}}})()}),Dt({status:Tt(["idle","pending"]),remainingTasks:yt(),totalTasks:yt(),totalErrors:yt(),totalWarnings:yt()});const Nt=Dt({name:gt(),start:yt(),end:Rt(yt()),threwException:Rt(wt())}),Ut=Dt({file:gt(),line:Rt(yt()),column:Rt(yt())}),Ft=Dt({text:gt(),location:Rt(Ut)}),Lt=Dt({text:gt(),source:gt(),location:Rt(Ut),notes:Rt(Ct(Ft))}),Wt=Dt({id:gt(),name:gt(),status:Tt(["pending","complete"]),inputPath:gt(),outputPath:Rt(gt()),errors:Rt(Ct(Lt)),warnings:Rt(Ct(Lt)),startTime:yt(),duration:Rt(yt()),lastUpdated:Rt(yt()),timings:Rt(Ct(Nt))});Dt({tasks:Ct(Wt)});const Bt=qt({name:gt(),version:gt()}),Ht=Dt({packagePath:gt(),hash:Rt(gt()),definition:Rt(Bt)}),Jt=Pt({browser:$t(gt(),gt()),node:$t(gt(),gt())}),Gt=Dt({path:gt(),rootPath:Rt(gt()),includeAll:Rt(wt()),ignoredPackages:Rt(Ct(gt())),ignoreResolutions:Rt(Ot([wt(),Ct(gt())])),resolveStrategy:Rt(Tt(["dedupe","duplicate"])),remote:Rt(Dt({hostUrl:gt(),resolveMap:$t(gt(),_t()),packages:Pt({definitions:$t(gt(),_t()),transformedDefinitions:$t(gt(),_t())}),packageHashes:Pt({hashesWithSource:Jt,hashesWithNoSource:Jt})}))}),Yt=Dt({linkedPath:Gt}),Vt=Dt({resolveMap:$t(gt(),_t()),linkedPaths:Ct(Gt)}),Kt=Dt({name:gt(),version:Rt(gt())}),Xt=Ot([gt(),Et({...Kt.shape})]),Qt=Ot([gt(),(en=Kt,function(e,t){const n=function(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return r=this,s="shape",i=o,Object.defineProperty(r,s,{value:i,writable:!0,enumerable:!0,configurable:!0}),o;var r,s,i}});return A(t,n)}(Zt,en))]);var en;const tn=qt({packageSettings:Rt(Ct(Et({match:Ot([Xt,Ct(Xt)])}))),generated:Et({packageSettings:Ct(Et({match:Qt}))})}),nn=(Dt({packageName:gt(),version:gt(),entryPoints:Ct(Pt({importPath:gt(),bundleUrl:gt()}))}),yt(),gt(),{path:["link","update"],type:Ht}),on={path:["link","config"],type:tn},rn={path:["link","paths"],type:Yt},sn={path:["link","done"],type:Vt},an={path:["link","disconnected"],type:Pt({reason:Tt(["lost","unreachable"])})};var un=Object.create,cn=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,dn=Object.getOwnPropertyNames,pn=Object.getPrototypeOf,fn=Object.prototype.hasOwnProperty,hn=(e,t)=>function(){return t||(0,e[dn(e)[0]])((t={exports:{}}).exports,t),t.exports},mn=(e,t,n)=>(n=null!=e?un(pn(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=dn(t),i=0,a=s.length;i<a;i++)r=s[i],fn.call(e,r)||void 0===r||cn(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=ln(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:cn(n,"default",{value:e,enumerable:!0}),e)),gn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),vn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=gn().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),yn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=gn().default,o=vn();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),bn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=yn();t.exports=function(e,t,o){return(t=n(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),wn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=bn();function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});function An(e){const t={subscribe(t){let n=null,o=!1,r=!1,s=!1;function i(){null!==n?r||(r=!0,"function"==typeof n?n():n&&n.unsubscribe()):s=!0}return n=e({next(e){var n;o||null===(n=t.next)||void 0===n||n.call(t,e)},error(e){var n;o||(o=!0,null===(n=t.error)||void 0===n||n.call(t,e),i())},complete(){var e;o||(o=!0,null===(e=t.complete)||void 0===e||e.call(t),i())}}),s&&i(),{unsubscribe:i}},pipe:(...e)=>e.reduce(_n,t)};return t}function _n(e,t){return t(e)}function kn(e){return An(t=>function t(n=0,o=e.op){const r=e.links[n];if(!r)throw new Error("No more links to execute - did you forget to add an ending link?");return r({op:o,next:e=>t(n+1,e)})}().subscribe(t))}function xn(e){return Array.isArray(e)?e:[e]}function Cn(e){return t=>{const n=xn(e.true).map(e=>e(t)),o=xn(e.false).map(e=>e(t));return t=>An(r=>{const s=e.condition(t.op)?n:o;return kn({op:t.op,links:s}).subscribe(r)})}}function Sn(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}"function"==typeof Symbol&&Symbol.asyncIterator;const Pn=e=>e();function En(e=0){return new Promise(t=>setTimeout(t,e))}var jn=mn(bn(),1),On=mn(wn(),1);function zn(e){return e instanceof $n}var $n=class e extends Error{constructor(t,n){var o,r;const s=null==n?void 0:n.cause;super(t,{cause:s}),(0,jn.default)(this,"cause",void 0),(0,jn.default)(this,"shape",void 0),(0,jn.default)(this,"data",void 0),(0,jn.default)(this,"meta",void 0),this.meta=null==n?void 0:n.meta,this.cause=s,this.shape=null==n||null===(o=n.result)||void 0===o?void 0:o.error,this.data=null==n||null===(r=n.result)||void 0===r?void 0:r.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){const o=t;return zn(o)?(n.meta&&(o.meta=(0,On.default)((0,On.default)({},o.meta),n.meta)),o):Sn(r=o)&&Sn(r.error)&&"number"==typeof r.error.code&&"string"==typeof r.error.message?new e(o.error.message,(0,On.default)((0,On.default)({},n),{},{result:o,cause:n.cause})):new e("string"==typeof(s=o)?s:Sn(s)&&"string"==typeof s.message?s.message:"Unknown error",(0,On.default)((0,On.default)({},n),{},{cause:o}));var r,s}};function Mn(e){return e?"input"in e?e:{input:e,output:e}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}const Tn=e=>"function"==typeof e;var In=mn(wn());const Rn={query:"GET",mutation:"POST",subscription:"PATCH"};function Zn(e){return"input"in e?e.transformer.input.serialize(e.input):function(e){const t={};for(let n=0;n<e.length;n++){const o=e[n];t[n]=o}return t}(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Dn=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const o=[];if(t[1]&&o.push(t[1]),"inputs"in e&&o.push("batch=1"),"query"===e.type||"subscription"===e.type){const t=Zn(e);void 0!==t&&"POST"!==e.methodOverride&&o.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return o.length&&(n+="?"+o.join("&")),n},qn=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;const t=Zn(e);return void 0!==t?JSON.stringify(t):void 0};var Nn=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Un=e=>{var t;if(null==e?void 0:e.aborted){if(null===(t=e.throwIfAborted)||void 0===t||t.call(e),"undefined"!=typeof DOMException)throw new DOMException("AbortError","AbortError");throw new Nn}};mn(wn(),1);var Fn=Object.create,Ln=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Bn=Object.getOwnPropertyNames,Hn=Object.getPrototypeOf,Jn=Object.prototype.hasOwnProperty,Gn=(e,t)=>function(){return t||(0,e[Bn(e)[0]])((t={exports:{}}).exports,t),t.exports},Yn=(e,t,n)=>(n=null!=e?Fn(Hn(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=Bn(t),i=0,a=s.length;i<a;i++)r=s[i],Jn.call(e,r)||void 0===r||Ln(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=Wn(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Ln(n,"default",{value:e,enumerable:!0}),e));const Vn=()=>{},Kn=e=>{Object.freeze&&Object.freeze(e)};function Xn(e,t,n){var o;const r=t.join(".");return null!==(o=n[r])&&void 0!==o||(n[r]=new Proxy(Vn,{get(o,r){if("string"==typeof r&&"then"!==r)return Xn(e,[...t,r],n)},apply(n,o,r){const s=t[t.length-1];let i={args:r,path:t};return"call"===s?i={args:r.length>=2?[r[1]]:[],path:t.slice(0,-1)}:"apply"===s&&(i={args:r.length>=2?r[1]:[],path:t.slice(0,-1)}),Kn(i.args),Kn(i.path),e(i)}})),n[r]}const Qn=e=>Xn(e,[],Object.create(null));var eo=Gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),to=Gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=eo().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),no=Gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=eo().default,o=to();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),oo=Gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=no();t.exports=function(e,t,o){return(t=n(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),ro=Gn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=oo();function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});Yn(ro(),1);Yn(oo(),1),Error;Error;var so=Yn(ro(),1),io=class extends Error{constructor(){super("Unable to transform response from server")}};function ao(e,t){let n;try{n=function(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,so.default)((0,so.default)({},e),{},{error:n})}}return{ok:!0,result:(0,so.default)((0,so.default)({},e.result),(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.deserialize(e.result.data)})}}(e,t)}catch(e){throw new io}if(!(n.ok||Sn(n.error.error)&&"number"==typeof n.error.error.code))throw new io;if(n.ok&&!Sn(n.result))throw new io;return n}Yn(ro(),1),Symbol();const uo=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function co(e){let t=null,n=null;function o(){const o=function(t){const n=[[]];let o=0;for(;;){const i=t[o];if(!i)break;const a=n[n.length-1];if(i.aborted){var r;null===(r=i.reject)||void 0===r||r.call(i,new Error("Aborted")),o++;continue}var s;e.validate(a.concat(i).map(e=>e.key))?(a.push(i),o++):0!==a.length?n.push([]):(null===(s=i.reject)||void 0===s||s.call(i,new Error("Input is too big for a single dispatch")),o++)}return n}(t);clearTimeout(n),n=null,t=null;for(const t of o){if(!t.length)continue;const n={items:t};for(const e of t)e.batch=n;e.fetch(n.items.map(e=>e.key)).then(async e=>{await Promise.all(e.map(async(e,t)=>{const o=n.items[t];try{var r;const t=await Promise.resolve(e);null===(r=o.resolve)||void 0===r||r.call(o,t)}catch(e){var s;null===(s=o.reject)||void 0===s||s.call(o,e)}o.batch=null,o.reject=null,o.resolve=null}));for(const e of n.items){var t;null===(t=e.reject)||void 0===t||t.call(e,new Error("Missing result")),e.batch=null}}).catch(e=>{for(const o of n.items){var t;null===(t=o.reject)||void 0===t||t.call(o,e),o.batch=null}})}}return{load:function(e){var r;const s={aborted:!1,key:e,batch:null,resolve:uo,reject:uo},i=new Promise((e,n)=>{var o;s.reject=n,s.resolve=e,null!==(o=t)&&void 0!==o||(t=[]),t.push(s)});return null!==(r=n)&&void 0!==r||(n=setTimeout(o)),i}}}var lo=mn(wn(),1);function po(e){var t,n;const o=function(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Mn(e.transformer),methodOverride:e.methodOverride}}(e),r=null!==(t=e.maxURLLength)&&void 0!==t?t:1/0,s=null!==(n=e.maxItems)&&void 0!==n?n:1/0;return()=>{const t=t=>({validate(e){if(r===1/0&&s===1/0)return!0;if(e.length>s)return!1;const n=e.map(e=>e.path).join(","),i=e.map(e=>e.input);return Dn((0,lo.default)((0,lo.default)({},o),{},{type:t,path:n,inputs:i,signal:null})).length<=r},async fetch(n){const r=n.map(e=>e.path).join(","),s=n.map(e=>e.input),i=function(...e){const t=new AbortController,n=e.length;let o=0;const r=()=>{++o===n&&t.abort()};for(const t of e)(null==t?void 0:t.aborted)?r():null==t||t.addEventListener("abort",r,{once:!0});return t.signal}(...n.map(e=>e.signal)),a=await(e=>async function(e){const t={},n=await async function(e){var t;Un(e.signal);const n=e.getUrl(e),o=e.getBody(e),r=null!==(t=e.methodOverride)&&void 0!==t?t:Rn[e.type],s=await(async()=>{const t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),i=(0,In.default)((0,In.default)((0,In.default)({},e.contentTypeHeader&&"GET"!==r?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),s);return function(e){if(e)return e;if("undefined"!=typeof window&&Tn(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&Tn(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}(e.fetch)(n,{method:r,signal:e.signal,body:o,headers:i})}(e);t.response=n;const o=await n.json();return t.responseJSON=o,{json:o,meta:t}}((0,In.default)((0,In.default)({},e),{},{contentTypeHeader:"application/json",getUrl:Dn,getBody:qn})))((0,lo.default)((0,lo.default)({},o),{},{path:r,inputs:s,type:t,headers:()=>e.headers?"function"==typeof e.headers?e.headers({opList:n}):e.headers:{},signal:i}));return(Array.isArray(a.json)?a.json:n.map(()=>a.json)).map(e=>({meta:a.meta,json:e}))}}),n={query:co(t("query")),mutation:co(t("mutation"))};return({op:e})=>An(t=>{if("subscription"===e.type)throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let r;return n[e.type].load(e).then(e=>{r=e;const n=ao(e.json,o.transformer.output);n.ok?(t.next({context:e.meta,result:n.result}),t.complete()):t.error($n.from(n.error,{meta:e.meta}))}).catch(e=>{t.error($n.from(e,{meta:null==r?void 0:r.meta}))}),()=>{}})}}function fo(e){let t=e;const n=[],o=An(e=>((e=>{void 0!==t&&e.next(t),n.push(e)})(e),()=>{(e=>{n.splice(n.indexOf(e),1)})(e)}));return o.next=e=>{if(t!==e){t=e;for(const t of n)t.next(e)}},o.get=()=>t,o}mn(wn(),1),Symbol();const ho={encode:e=>JSON.stringify(e),decode:e=>{if("string"!=typeof e)throw new Error("jsonEncoder received binary data. JSON uses text frames. Use a binary encoder for binary data.");return JSON.parse(e)}},mo={enabled:!1,closeMs:0},go={enabled:!1,pongTimeoutMs:1e3,intervalMs:5e3},vo=e=>0===e?0:Math.min(1e3*2**e,3e4),yo=(e,...t)=>"function"==typeof e?e(...t):e;var bo=mn(bn(),1),wo=class e extends Error{constructor(t){super(t.message,{cause:t.cause}),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,e.prototype)}},Ao=class{constructor(e,t){this.onTimeout=e,this.timeoutMs=t,(0,bo.default)(this,"timeout",void 0)}reset(){this.timeout&&(clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs))}start(){clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs)}stop(){clearTimeout(this.timeout),this.timeout=void 0}};function _o(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var ko=mn(bn(),1),xo=class{constructor(){(0,ko.default)(this,"outgoingRequests",new Array),(0,ko.default)(this,"pendingRequests",{})}register(e,t){const{promise:n,resolve:o}=_o();return this.outgoingRequests.push({id:String(e.id),message:e,end:n,callbacks:{next:t.next,complete:()=>{t.complete(),o()},error:e=>{t.error(e),o()}}}),()=>{this.delete(e.id),t.complete(),o()}}delete(e){null!==e&&(this.outgoingRequests=this.outgoingRequests.filter(({id:t})=>t!==String(e)),delete this.pendingRequests[String(e)])}flush(){const e=this.outgoingRequests;this.outgoingRequests=[];for(const t of e)this.pendingRequests[t.id]=t;return e}getPendingRequests(){return Object.values(this.pendingRequests)}getPendingRequest(e){return null===e?null:this.pendingRequests[String(e)]}getOutgoingRequests(){return this.outgoingRequests}getRequests(){return[...this.getOutgoingRequests().map(e=>({state:"outgoing",message:e.message,end:e.end,callbacks:e.callbacks})),...this.getPendingRequests().map(e=>({state:"pending",message:e.message,end:e.end,callbacks:e.callbacks}))]}hasPendingRequests(){return this.getPendingRequests().length>0}hasPendingSubscriptions(){return this.getPendingRequests().some(e=>"subscription"===e.message.method)}hasOutgoingRequests(){return this.outgoingRequests.length>0}},Co=mn(bn(),1);function So(e,{intervalMs:t,pongTimeoutMs:n}){let o,r;function s(){o=setTimeout(()=>{e.send("PING"),r=setTimeout(()=>{e.close()},n)},t)}e.addEventListener("open",s),e.addEventListener("message",({data:e})=>{clearTimeout(o),s(),"PONG"===e&&(clearTimeout(r),clearTimeout(o),s())}),e.addEventListener("close",()=>{clearTimeout(o),clearTimeout(r)})}var Po=class e{constructor(t){var n;if((0,Co.default)(this,"id",++e.connectCount),(0,Co.default)(this,"WebSocketPonyfill",void 0),(0,Co.default)(this,"urlOptions",void 0),(0,Co.default)(this,"keepAliveOpts",void 0),(0,Co.default)(this,"encoder",void 0),(0,Co.default)(this,"wsObservable",fo(null)),(0,Co.default)(this,"openPromise",null),this.WebSocketPonyfill=null!==(n=t.WebSocketPonyfill)&&void 0!==n?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++e.connectCount;const n=async function(e){const t=await yo(e.url);if(!e.connectionParams)return t;const n=t.includes("?")?"&":"?";return t+`${n}connectionParams=1`}(t.urlOptions).then(e=>new t.WebSocketPonyfill(e));t.openPromise=n.then(async e=>{t.ws=e,e.binaryType="arraybuffer",e.addEventListener("message",function({data:e}){"PING"===e&&this.send("PONG")}),t.keepAliveOpts.enabled&&So(e,t.keepAliveOpts),e.addEventListener("close",()=>{t.ws===e&&(t.ws=null)}),await function(e){const{promise:t,resolve:n,reject:o}=_o();return e.addEventListener("open",()=>{e.removeEventListener("error",o),n()}),e.addEventListener("error",o),t}(e),t.urlOptions.connectionParams&&e.send(await async function(e,t){const n={method:"connectionParams",data:await yo(e)};return t.encode(n)}(t.urlOptions.connectionParams,t.encoder))});try{await t.openPromise}finally{t.openPromise=null}}async close(){try{await this.openPromise}finally{var e;null===(e=this.ws)||void 0===e||e.close()}}};(0,Co.default)(Po,"connectCount",0);var Eo=mn(bn(),1),jo=mn(wn(),1),Oo=class{constructor(e){var t,n;(0,Eo.default)(this,"connectionState",void 0),(0,Eo.default)(this,"allowReconnect",!1),(0,Eo.default)(this,"requestManager",new xo),(0,Eo.default)(this,"activeConnection",void 0),(0,Eo.default)(this,"reconnectRetryDelay",void 0),(0,Eo.default)(this,"inactivityTimeout",void 0),(0,Eo.default)(this,"callbacks",void 0),(0,Eo.default)(this,"lazyMode",void 0),(0,Eo.default)(this,"encoder",void 0),(0,Eo.default)(this,"reconnecting",null),this.encoder=null!==(t=e.experimental_encoder)&&void 0!==t?t:ho,this.callbacks={onOpen:e.onOpen,onClose:e.onClose,onError:e.onError};const o=(0,jo.default)((0,jo.default)({},mo),e.lazy);this.inactivityTimeout=new Ao(()=>{this.requestManager.hasOutgoingRequests()||this.requestManager.hasPendingRequests()?this.inactivityTimeout.reset():this.close().catch(()=>null)},o.closeMs),this.activeConnection=new Po({WebSocketPonyfill:e.WebSocket,urlOptions:e,keepAlive:(0,jo.default)((0,jo.default)({},go),e.keepAlive),encoder:this.encoder}),this.activeConnection.wsObservable.subscribe({next:e=>{e&&this.setupWebSocketListeners(e)}}),this.reconnectRetryDelay=null!==(n=e.retryDelayMs)&&void 0!==n?n:vo,this.lazyMode=o.enabled,this.connectionState=fo({type:"state",state:o.enabled?"idle":"connecting",error:null}),this.lazyMode||this.open().catch(()=>null)}async open(){var e=this;e.allowReconnect=!0,"idle"===e.connectionState.get().state&&e.connectionState.next({type:"state",state:"connecting",error:null});try{await e.activeConnection.open()}catch(t){return e.reconnect(new wo({message:"Initialization error",cause:t})),e.reconnecting}}async close(){var e=this;e.allowReconnect=!1,e.inactivityTimeout.stop();const t=[];for(const n of e.requestManager.getRequests())"subscription"===n.message.method?n.callbacks.complete():"outgoing"===n.state?n.callbacks.error($n.from(new wo({message:"Closed before connection was established"}))):t.push(n.end);await Promise.all(t).catch(()=>null),await e.activeConnection.close().catch(()=>null),e.connectionState.next({type:"state",state:"idle",error:null})}request({op:{id:e,type:t,path:n,input:o,signal:r},transformer:s,lastEventId:i}){return An(a=>{const u=this.batchSend({id:e,method:t,params:{input:s.input.serialize(o),path:n,lastEventId:i}},(0,jo.default)((0,jo.default)({},a),{},{next(e){const t=ao(e,s.output);t.ok?a.next({result:t.result}):a.error($n.from(t.error))}}));return()=>{u(),"subscription"===t&&this.activeConnection.isOpen()&&this.send({id:e,method:"subscription.stop"}),null==r||r.removeEventListener("abort",u)}})}get connection(){return(e=this.activeConnection).isOpen()?{id:e.id,state:"open",ws:e.ws}:e.isClosed()?{id:e.id,state:"closed",ws:e.ws}:e.ws?{id:e.id,state:"connecting",ws:e.ws}:null;var e}reconnect(e){var t=this;if(this.connectionState.next({type:"state",state:"connecting",error:$n.from(e)}),this.reconnecting)return;const n=async e=>{try{await En(t.reconnectRetryDelay(e)),t.allowReconnect&&(await t.activeConnection.close(),await t.activeConnection.open(),t.requestManager.hasPendingRequests()&&t.send(t.requestManager.getPendingRequests().map(({message:e})=>e))),t.reconnecting=null}catch(t){await n(e+1)}};this.reconnecting=n(0)}setupWebSocketListeners(e){var t=this;const n=e=>{const t=this.requestManager.getPendingRequests();for(const{message:n,callbacks:o}of t)"subscription"!==n.method&&(o.error($n.from(null!=e?e:new wo({message:"WebSocket closed",cause:e}))),this.requestManager.delete(n.id))};e.addEventListener("open",()=>{Pn(async()=>{var e,n;t.lazyMode&&t.inactivityTimeout.start(),null===(e=(n=t.callbacks).onOpen)||void 0===e||e.call(n),t.connectionState.next({type:"state",state:"pending",error:null})}).catch(t=>{e.close(3e3),n(t)})}),e.addEventListener("message",({data:e})=>{if(this.inactivityTimeout.reset(),["PING","PONG"].includes(e))return;const t=this.encoder.decode(e);"method"in t?this.handleIncomingRequest(t):this.handleResponseMessage(t)}),e.addEventListener("close",e=>{var t,o;n(e),null===(t=(o=this.callbacks).onClose)||void 0===t||t.call(o,e),this.lazyMode&&!this.requestManager.hasPendingSubscriptions()||this.reconnect(new wo({message:"WebSocket closed",cause:e}))}),e.addEventListener("error",e=>{var t,o;n(e),null===(t=(o=this.callbacks).onError)||void 0===t||t.call(o,e),this.reconnect(new wo({message:"WebSocket closed",cause:e}))})}handleResponseMessage(e){const t=this.requestManager.getPendingRequest(e.id);if(!t)return;t.callbacks.next(e);let n=!0;"result"in e&&"subscription"===t.message.method&&("data"===e.result.type&&(t.message.params.lastEventId=e.result.id),"stopped"!==e.result.type&&(n=!1)),n&&(t.callbacks.complete(),this.requestManager.delete(e.id))}handleIncomingRequest(e){"reconnect"===e.method&&this.reconnect(new wo({message:"Server requested reconnect"}))}send(e){if(!this.activeConnection.isOpen())throw new Error("Active connection is not open");const t=e instanceof Array?e:[e];this.activeConnection.ws.send(this.encoder.encode(1===t.length?t[0]:t))}batchSend(e,t){var n=this;return this.inactivityTimeout.reset(),Pn(async()=>{n.activeConnection.isOpen()||await n.open(),await En(0),n.requestManager.hasOutgoingRequests()&&n.send(n.requestManager.flush().map(({message:e})=>e))}).catch(n=>{this.requestManager.delete(e.id),t.error($n.from(n))}),this.requestManager.register(e,t)}};function zo(e){const{client:t}=e,n=Mn(e.transformer);return()=>({op:e})=>An(o=>{const r="subscription"===e.type?t.connectionState.subscribe({next(t){o.next({result:t,context:e.context})}}):null,s=t.request({op:e,transformer:n}).subscribe(o);return()=>{s.unsubscribe(),null==r||r.unsubscribe()}})}var $o=mn(bn(),1),Mo=mn(wn(),1),To=class{constructor(e){(0,$o.default)(this,"links",void 0),(0,$o.default)(this,"runtime",void 0),(0,$o.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){var t;return kn({links:this.links,op:(0,Mo.default)((0,Mo.default)({},e),{},{context:null!==(t=e.context)&&void 0!==t?t:{},id:++this.requestId})}).pipe(e=>{let t=0,n=null;const o=[];return An(r=>(t++,o.push(r),n||(n=e.subscribe({next(e){for(const n of o){var t;null===(t=n.next)||void 0===t||t.call(n,e)}},error(e){for(const n of o){var t;null===(t=n.error)||void 0===t||t.call(n,e)}},complete(){for(const t of o){var e;null===(e=t.complete)||void 0===e||e.call(t)}}})),{unsubscribe(){t--,function(){if(0===t&&n){const e=n;n=null,e.unsubscribe()}}();const e=o.findIndex(e=>e===r);e>-1&&o.splice(e,1)}}))})}async requestAsPromise(e){try{const t=this.$request(e);return(await function(e){const t=new AbortController;return new Promise((n,o)=>{let r=!1;function s(){r||(r=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{o(t.signal.reason)});const i=e.subscribe({next(e){r=!0,n(e),s()},error(e){o(e)},complete(){t.abort(),s()}})})}(t)).result.data}catch(e){throw $n.from(e)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case"state":var t;null===(t=n.onConnectionStateChange)||void 0===t||t.call(n,e.result);break;case"started":var o;null===(o=n.onStarted)||void 0===o||o.call(n,{context:e.context});break;case"stopped":var r;null===(r=n.onStopped)||void 0===r||r.call(n);break;case"data":case void 0:var s;null===(s=n.onData)||void 0===s||s.call(n,e.result.data)}},error(e){var t;null===(t=n.onError)||void 0===t||t.call(n,e)},complete(){var e;null===(e=n.onComplete)||void 0===e||e.call(n)}})}};const Io=Symbol.for("trpc_untypedClient"),Ro={query:"query",mutate:"mutation",subscribe:"subscription"};mn(wn(),1),mn(wn(),1),mn(hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(n=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new n(e)}t.exports=function(e){var t,o,r,s=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(o&&null!=(t=e[o]))return t.call(e);if(r&&null!=(t=e[r]))return new n(t.call(e));o="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")},t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),mn(wn(),1);var Zo=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){t.exports=function(){var e="function"==typeof SuppressedError?SuppressedError:function(e,t){var n=Error();return n.name="SuppressedError",n.error=e,n.suppressed=t,n},t={},n=[];function o(e,t){if(null!=t){if(Object(t)!==t)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(e)var o=t[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(void 0===o&&(o=t[Symbol.dispose||Symbol.for("Symbol.dispose")],e))var r=o;if("function"!=typeof o)throw new TypeError("Object is not disposable.");r&&(o=function(){try{r.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:o,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var o,r=this.e,s=0;function i(){for(;o=n.pop();)try{if(!o.a&&1===s)return s=0,n.push(o),Promise.resolve().then(i);if(o.d){var e=o.d.call(o.v);if(o.a)return s|=2,Promise.resolve(e).then(i,a)}else s|=1}catch(e){return a(e)}if(1===s)return r!==t?Promise.reject(r):Promise.resolve();if(r!==t)throw r}function a(n){return r=r!==t?new e(n,r):n,i()}return i()}}},t.exports.__esModule=!0,t.exports.default=t.exports}}),Do=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){t.exports=function(e,t){this.v=e,this.k=t},t.exports.__esModule=!0,t.exports.default=t.exports}}),qo=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=Do();t.exports=function(e){return new n(e,0)},t.exports.__esModule=!0,t.exports.default=t.exports}}),No=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=Do();function o(e){var t,o;function r(t,o){try{var i=e[t](o),a=i.value,u=a instanceof n;Promise.resolve(u?a.v:a).then(function(n){if(u){var o="return"===t?"return":"next";if(!a.k||n.done)return r(o,n);n=e[o](n).value}s(i.done?"return":"normal",n)},function(e){r("throw",e)})}catch(e){s("throw",e)}}function s(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?r(t.key,t.arg):o=null}this._invoke=function(e,n){return new Promise(function(s,i){var a={key:e,arg:n,resolve:s,reject:i,next:null};o?o=o.next=a:(t=o=a,r(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}o.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)},t.exports=function(e){return function(){return new o(e.apply(this,arguments))}},t.exports.__esModule=!0,t.exports.default=t.exports}});async function Uo(e){const{url:t,reporter:n,onOpen:o}=e;await async function(){if("undefined"!=typeof globalThis){const e=globalThis;if(void 0===e.WebSocket){const{WebSocket:t}=await i.e(693).then(i.t.bind(i,693,19));e.WebSocket=t}}}(),function({reporter:e}){"undefined"!=typeof process&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",e?.ignoreLogMessage("Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable"))}({reporter:n}),n?.ignoreLogMessage("Received network error or non-101 status code."),n?.ignoreLogMessage("Connection was closed before it was established.");const r=new Oo({url:t,onError:e=>{const t=e;t?.message?console.error(`[Cloudpack] Websocket client error: ${t.message}`):console.error("[Cloudpack] Unexpected websocket client error")},onOpen(){o?.()}});const s=function(e,t){try{return new URL(e,t)}catch{throw new Error(`Invalid URL: "${e}", base: ""`)}}(t),a="wss:"===s.protocol;s.protocol=a?"https:":"http:";const u=s.toString().replace(/\/$/,""),c=function(e){return function(e){const t=Qn(({path:t,args:n})=>{const o=[...t],r=(s=o.pop(),Ro[s]);var s;const i=o.join(".");return e[r](i,...n)});return n=n=>n===Io?e:t[n],new Proxy(Vn,{get(e,t){if("then"!==t)return n(t)}});var n}(new To(e))}({links:[Cn({condition:e=>"subscription"===e.type,true:zo({client:r}),false:po({url:u})})]}),l={subscribe:(e,t)=>(t={...t},t.onError??=t=>{console.error(`[Cloudpack] Error in ${e.path.join(".")} data subscription (this may be a Cloudpack bug): `+t.message)},c.onDataChanged.subscribe(e,t))};return new Proxy({close:async()=>{await r.close()},onDataChanged:l},{get:(e,t)=>e.hasOwnProperty(t)?e[t]:c[t]})}mn(Zo(),1),mn(qo(),1),mn(No(),1),mn(wn(),1);var Fo=i(606),Lo=i.n(Fo),Wo=i(607),Bo=i.n(Wo),Ho=i(437),Jo=i.n(Ho),Go=i(750),Yo=i.n(Go),Vo=i(994),Ko=i.n(Vo),Xo=i(415),Qo=i.n(Xo),er=i(721),tr={};tr.styleTagTransform=Qo(),tr.setAttributes=Yo(),tr.insert=Jo().bind(null,"head"),tr.domAPI=Bo(),tr.insertStyleElement=Ko(),Lo()(er.default,tr);const nr=er.default&&er.default.locals?er.default.locals:void 0;class or{element;constructor(e="root"){this.element=document.getElementById(e)}updateStatus(e){const{message:t,tip:n,isError:o=!1,data:r}=e,s=o?"error":"debug";r?console[s](t,r):console[s](t),this.element&&(this.element.innerHTML=`\n <div class="${nr.statusContainer+(o?` ${nr.errorContainer}`:"")}">\n <h2 class="${nr.title}">Cloudpack Link Proxy</h2>\n <p class="${nr.message}">${o?"Error: ":""}${t}</p>\n ${n?`<p class="${nr.message}"><strong>Tip:</strong> ${n}</p>`:""}\n <p class="${nr.warning}">Do not close this page while Cloudpack link is running.</p>\n </div>\n `)}}class rr{clients=new Map;connectionStates=new Map;checkInterval=null;checkIntervalMs=5e3;addClient(e,t){this.clients.set(e,t),this.connectionStates.set(e,!0)}getClient(e){return this.clients.get(e)}async checkConnection(e){const t=this.clients.get(e);if(!t)return!1;try{return await t.getSessionId.query(),!0}catch(t){return console.warn(`${e} client connection lost:`,t),!1}}startMonitoring(e){this.checkInterval&&window.clearInterval(this.checkInterval),this.checkInterval=window.setInterval(()=>{(async()=>{for(const[t,n]of this.clients){if("link"!=t&&"host"!=t)throw new Error(`Invalid client ID: ${t}`);const n=this.connectionStates.get(t)||!1,o=await this.checkConnection(t);n!==o&&await e({id:t,isConnected:o,wasConnected:n}),this.connectionStates.set(t,o)}})().catch(e=>{console.error("Error in connection monitoring:",e)})},this.checkIntervalMs)}stopMonitoring(){this.checkInterval&&(window.clearInterval(this.checkInterval),this.checkInterval=null)}async closeAll(){for(const[e,t]of this.clients)try{await t.close(),console.log(`Closed ${e} client`)}catch(t){console.error(`Error closing ${e} client:`,t)}this.clients.clear(),this.connectionStates.clear()}}async function sr(e){console.debug(`[Cloudpack] Checking session at ${e}`);const t=await Uo({url:e});let n=!1;try{n=!!await t.getSessionId.query()}catch{}finally{await t.close()}return n}const ir=new class{ui;connectionManager;linkedPathData=null;constructor(){this.ui=new or,this.connectionManager=new rr}handleConnectionChange=async e=>{const{id:t,isConnected:n,wasConnected:o}=e;o&&!n&&("host"===t?await this.handleHostDisconnection():"link"===t&&await this.handleLinkDisconnection())};async handleHostDisconnection(e){const t=e?.unreachable??!1,n=t?"unreachable":"lost";this.ui.updateStatus({message:`Connection to host ${n}. The session will be terminated.`,isError:!0});const o=this.connectionManager.getClient("link");let r,s=!1;if(o)try{await o.publishData.mutate({...an,data:{reason:n}}),s=!0}catch{this.ui.updateStatus({message:`Error notifying link client of host connection ${n}.`,isError:!0})}await this.cleanup(),t?r="Make sure you have a <code>cloudpack start</code> session running and use the URL from your app to run link with the following command: <code>cloudpack link --remote [URL]</code>":(r="If you did not close the start session terminal, this is a bug. Please report it.",s||(r+=" Link client was not successfully notified of host disconnection. You may need to terminate the link session in the terminal.")),this.ui.updateStatus({message:`Connection to host ${n}. You can close this page.`,tip:r,isError:!0})}async handleLinkDisconnection(){this.ui.updateStatus({message:"Connection to link client lost. Cleaning up linked paths...",isError:!0});const e=this.connectionManager.getClient("host");if(e&&this.linkedPathData){const{linkedPath:t}=this.linkedPathData,n=t.path;try{await e.unlinkPath.mutate({linkedPath:{path:n}}),this.ui.updateStatus({message:"Connection to link client lost. Successfully unlinked paths on host. You can close this page.",tip:"If you did not close the link client terminal. This is a bug. Please report it."})}catch(e){this.ui.updateStatus({message:"Connection to link client lost. Failed to unlink paths on host.",tip:"You may need to restart the host application to unlink the paths.",isError:!0,data:e})}}else this.ui.updateStatus({message:"Cannot clean up: host client or link data not available",tip:"You may need to restart the host application to unlink the paths.",isError:!0});await this.cleanup()}setupLinkUpdateHandler(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");e&&t&&e.onDataChanged.subscribe(nn,{onData:e=>{this.ui.updateStatus({message:"Forwarding package update to the host...",data:e}),t.notifyLinkChange.mutate(e).then(()=>this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})).catch(e=>{this.ui.updateStatus({message:"Error forwarding package update to the host. This is a bug. Please report it.",isError:!0,data:e})})}})}async setupLinkPathHandler(){const e=this.connectionManager.getClient("host"),t=this.connectionManager.getClient("link");t&&e&&(await t.getData.query(rn)||t.onDataChanged.subscribe(rn,{onData:n=>{this.ui.updateStatus({message:"Processing link setup...",data:n}),this.linkedPathData=n,e.linkPath.mutate(this.linkedPathData).then(e=>{const{resolveMap:n,linkedPaths:o}=e;this.ui.updateStatus({message:"Sending link setup result back to the link server...",data:e}),t.publishData.mutate({...sn,data:{resolveMap:n,linkedPaths:o}}).then(()=>{this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})}).catch(e=>{this.ui.updateStatus({message:"Error sending link setup result back to the link server. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})})})}}))}async setupConfig(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");if(e&&t)try{if(!await e.getData.query(on)){this.ui.updateStatus({message:"Fetching host configuration..."});const n=await t.getLinkConfig.query();this.ui.updateStatus({message:"Sending host configuration to the link server...",data:n}),await e.publishData.mutate({...on,data:n}),this.ui.updateStatus({message:"Host configuration sent to the link server."})}}catch(e){this.ui.updateStatus({message:"Error setting up configuration. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})}}async cleanup(){this.connectionManager.stopMonitoring(),await this.connectionManager.closeAll()}async initialize(){this.ui.updateStatus({message:"Initializing Cloudpack Link Proxy..."});try{if(!window.__cloudpack)throw this.ui.updateStatus({message:"Cloudpack context not found on window.",tip:"This is a bug. Please report it.",isError:!0}),new Error("Cloudpack not found on window.");const{pageSessionContext:e}=window.__cloudpack;if(!e)throw this.ui.updateStatus({message:"Session context not found on window.__cloudpack.",tip:"This is a bug. Please report it.",isError:!0,data:window.__cloudpack}),new Error("Session context not found on window.__cloudpack");const{apiUrl:t,hostApiServerUrls:n}=e;if(!n||n.length<=0)return void this.ui.updateStatus({message:"No host URL provided.",tip:"This is a bug. Please report it.",data:e,isError:!0});const o=await Uo({url:t});let r;this.connectionManager.addClient("link",o);for(const e of n)if(this.ui.updateStatus({message:`Checking host API server at ${e}...`}),await sr(e)){this.ui.updateStatus({message:`Host API server is active at ${e}.`}),r=e;break}if(!r)return void await this.handleHostDisconnection({unreachable:!0});const s=await Uo({url:r});this.connectionManager.addClient("host",s);const i=await o.getSessionId.query(),a=await s.getSessionId.query();this.ui.updateStatus({message:`Link Session: ${i}, Host Session: ${a}`}),this.connectionManager.startMonitoring(this.handleConnectionChange),this.setupLinkUpdateHandler(),await this.setupLinkPathHandler(),await this.setupConfig()}catch(e){const t=e instanceof Error?e.message:String(e);this.ui.updateStatus({message:t,isError:!0,tip:"This is a bug. Please report it.",data:e}),await this.cleanup()}}};ir.initialize();
3
3
  //# sourceMappingURL=index.js.map