@ms-cloudpack/link-proxy 0.2.15 → 0.2.16

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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- export const __webpack_id__=293;export const __webpack_ids__=[293];export const __webpack_modules__={25: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")}},191: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))}}},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)}}}},750:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},851:(e,t,n)=>{function o(e,t,n){function o(n,o){var r;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(r=n._zod).traits??(r.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in i.prototype)e in n||Object.defineProperty(n,e,{value:i.prototype[e].bind(n)});n._zod.constr=i,n._zod.def=o}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}Symbol("zod_brand");class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const s={};function i(e){return e&&Object.assign(s,e),s}function a(e,t){return"bigint"==typeof t?t.toString():t}function u(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function c(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function l(e,t,n){Object.defineProperty(e,t,{get(){{const o=n();return e[t]=o,o}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function d(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(e=10){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(26*Math.random())];return t}function f(e){return JSON.stringify(e)}const h=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function m(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const g=u(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function v(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function y(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 b(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n].continue)return!0;return!1}function w(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function k(e){return"string"==typeof e?e:e?.message}function A(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=k(e.inst?._zod.def?.error?.(e))??k(t?.error?.(e))??k(n.customError?.(e))??k(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}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 x=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,a,2),enumerable:!0})},_=o("$ZodError",x),C=o("$ZodError",x,{Parent:Error}),S=e=>(t,n,o,s)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},a);if(u instanceof Promise)throw new r;if(u.issues.length){const t=new(s?.Err??e)(u.issues.map(e=>A(e,a,i())));throw h(t,s?.callee),t}return u.value},E=S(C),P=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(r?.Err??e)(a.issues.map(e=>A(e,s,i())));throw h(t,r?.callee),t}return a.value},j=P(C),O=e=>(t,n,o)=>{const s=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new r;return a.issues.length?{success:!1,error:new(e??_)(a.issues.map(e=>A(e,s,i())))}:{success:!0,data:a.value}},z=O(C),M=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=>A(e,r,i())))}:{success:!0,data:s.value}},T=M(C),$=/^-?\d+(?:\.\d+)?/i,q=/true|false/i;class I{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),o=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const R={major:4,minor:0,patch:0},D=o("$ZodType",(e,t)=>{var n;e??(e={}),l(e._zod,"id",()=>t.type+"_"+p(10)),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=R;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,s=b(e);for(const i of t){if(i._zod.when){if(!i._zod.when(e))continue}else if(s)continue;const t=e.issues.length,a=i._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new r;if(o||a instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(s||(s=b(e,t)))});else{if(e.issues.length===t)continue;s||(s=b(e,t))}}return o?o.then(()=>e):e};e._zod.run=(n,s)=>{const i=e._zod.parse(n,s);if(i instanceof Promise){if(!1===s.async)throw new r;return i.then(e=>t(e,o,s))}return t(i,o,s)}}e["~standard"]={validate:t=>{try{const n=z(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return T(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),N=o("$ZodString",(e,t)=>{var n;D.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),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}}),L=o("$ZodNumber",(e,t)=>{D.init(e,t),e._zod.pattern=e._zod.bag.pattern??$,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}}),U=o("$ZodBoolean",(e,t)=>{D.init(e,t),e._zod.pattern=q,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}}),Z=o("$ZodAny",(e,t)=>{D.init(e,t),e._zod.parse=e=>e}),W=o("$ZodUnknown",(e,t)=>{D.init(e,t),e._zod.parse=e=>e});function B(e,t,n){e.issues.length&&t.issues.push(...w(n,e.issues)),t.value[n]=e.value}const H=o("$ZodArray",(e,t)=>{D.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=>B(t,n,e))):B(a,n,e)}return s.length?Promise.all(s).then(()=>n):n}});function F(e,t,n){e.issues.length&&t.issues.push(...w(n,e.issues)),t.value[n]=e.value}function J(e,t,n,o){e.issues.length?void 0===o[n]?t.value[n]=n in o?void 0:e.value:t.issues.push(...w(n,e.issues)):void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const G=o("$ZodObject",(e,t)=>{D.init(e,t);const n=u(()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof D))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter(e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});let o;l(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=m,i=!s.jitless,a=i&&g.value,{catchall:c}=t;let d;e._zod.parse=(s,u)=>{d??(d=n.value);const l=s.value;if(!r(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;const h=[];if(i&&a&&!1===u?.async&&!0!==u.jitless)o||(o=(e=>{const t=new I(["shape","payload","ctx"]),{keys:o,optionalKeys:r}=n.value,s=e=>{const t=f(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);for(const e of o)i[e]=p(15);t.write("const newResult = {}");for(const e of o)if(r.has(e)){const n=i[e];t.write(`const ${n} = ${s(e)};`);const o=f(e);t.write(`\n if (${n}.issues.length) {\n if (input[${o}] === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${o} in input) newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}else{const n=i[e];t.write(`const ${n} = ${s(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${f(e)}, ...iss.path] : [${f(e)}]\n })));`),t.write(`newResult[${f(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),s=o(s,u);else{s.value={};const e=d.shape;for(const t of d.keys){const n=e[t],o=n._zod.run({value:l[t],issues:[]},u),r="optional"===n._zod.optin&&"optional"===n._zod.optout;o instanceof Promise?h.push(o.then(e=>r?J(e,s,t,l):F(e,s,t))):r?J(o,s,t,l):F(o,s,t)}}if(!c)return h.length?Promise.all(h).then(()=>s):s;const m=[],g=d.keySet,v=c._zod,y=v.def.type;for(const e of Object.keys(l)){if(g.has(e))continue;if("never"===y){m.push(e);continue}const t=v.run({value:l[e],issues:[]},u);t instanceof Promise?h.push(t.then(t=>F(t,s,e))):F(t,s,e)}return m.length&&s.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),h.length?Promise.all(h).then(()=>s):s}});function V(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>A(e,o,i())))}),t}const Y=o("$ZodUnion",(e,t)=>{D.init(e,t),l(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),l(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=>c(e.source)).join("|")})$`)}}),e._zod.parse=(n,o)=>{let r=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)s.push(t),r=!0;else{if(0===t.issues.length)return t;s.push(t)}}return r?Promise.all(s).then(t=>V(t,n,e,o)):V(s,n,e,o)}}),K=o("$ZodRecord",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!function(e){if(!1===m(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==m(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=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const e of i)if("string"==typeof e||"number"==typeof e||"symbol"==typeof 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(...w(e,t.issues)),n.value[e]=t.value})):(i.issues.length&&n.issues.push(...w(e,i.issues)),n.value[e]=i.value)}let a;for(const e in r)i.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(const a of Reflect.ownKeys(r)){if("__proto__"===a)continue;const u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(e=>A(e,o,i())),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:r[a],issues:[]},o);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&n.issues.push(...w(a,e.issues)),n.value[u.value]=e.value})):(c.issues.length&&n.issues.push(...w(a,c.issues)),n.value[u.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),X=o("$ZodLiteral",(e,t)=>{D.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),Q=o("$ZodOptional",(e,t)=>{D.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),l(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${c(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)}),ee=o("$ZodNonOptional",(e,t)=>{D.init(e,t),l(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=>te(t,e)):te(r,e)}});function te(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}Symbol("ZodOutput"),Symbol("ZodInput");const ne=o("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");D.init(e,t),e.def=t,e.parse=(t,n)=>E(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>z(e,t,n),e.parseAsync=async(t,n)=>j(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>T(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)]}),e.clone=(t,n)=>v(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e)}),oe=o("ZodMiniString",(e,t)=>{N.init(e,t),ne.init(e,t)});function re(e){return function(e,t){return new e({type:"string",...y(t)})}(oe,e)}const se=o("ZodMiniNumber",(e,t)=>{L.init(e,t),ne.init(e,t)});function ie(e){return function(e,t){return new e({type:"number",checks:[],...y(t)})}(se,e)}const ae=o("ZodMiniBoolean",(e,t)=>{U.init(e,t),ne.init(e,t)});function ue(e){return function(e,t){return new e({type:"boolean",...y(t)})}(ae,e)}const ce=o("ZodMiniAny",(e,t)=>{Z.init(e,t),ne.init(e,t)});function le(){return new ce({type:"any"})}const de=o("ZodMiniUnknown",(e,t)=>{W.init(e,t),ne.init(e,t)}),pe=o("ZodMiniArray",(e,t)=>{H.init(e,t),ne.init(e,t)});function fe(e,t){return new pe({type:"array",element:e,...y(t)})}const he=o("ZodMiniObject",(e,t)=>{G.init(e,t),ne.init(e,t),l(e,"shape",()=>t.shape)});function me(e,t){const n={type:"object",get shape(){return d(this,"shape",{...e}),this.shape},...y(t)};return new he(n)}function ge(e,t){return new he({type:"object",get shape(){return d(this,"shape",{...e}),this.shape},catchall:(n=de,new n({type:"unknown"})),...y(t)});var n}const ve=o("ZodMiniUnion",(e,t)=>{Y.init(e,t),ne.init(e,t)});function ye(e,t){return new ve({type:"union",options:e,...y(t)})}const be=o("ZodMiniRecord",(e,t)=>{K.init(e,t),ne.init(e,t)});function we(e,t,n){return new be({type:"record",keyType:e,valueType:t,...y(n)})}const ke=o("ZodMiniLiteral",(e,t)=>{X.init(e,t),ne.init(e,t)});function Ae(e,t){return new ke({type:"literal",values:Array.isArray(e)?e:[e],...y(t)})}const xe=o("ZodMiniOptional",(e,t)=>{Q.init(e,t),ne.init(e,t)});function _e(e){return new xe({type:"optional",innerType:e})}const Ce=o("ZodMiniNonOptional",(e,t)=>{ee.init(e,t),ne.init(e,t)});function Se(e){return me(e)}function Ee(e){return ge(e)}Se({status:Ae(["idle","pending"]),remainingTasks:ie(),totalTasks:ie(),totalErrors:ie(),totalWarnings:ie()});const Pe=Se({name:re(),start:ie(),end:_e(ie()),threwException:_e(ue())}),je=Se({file:re(),line:_e(ie()),column:_e(ie())}),Oe=Se({text:re(),location:_e(je)}),ze=Se({text:re(),source:re(),location:_e(je),notes:_e(fe(Oe))}),Me=Se({id:re(),name:re(),status:Ae(["pending","complete"]),inputPath:re(),outputPath:_e(re()),errors:_e(fe(ze)),warnings:_e(fe(ze)),startTime:ie(),duration:_e(ie()),lastUpdated:_e(ie()),timings:_e(fe(Pe))});Se({tasks:fe(Me)});const Te=Ee({name:re(),version:re()}),$e=Se({packagePath:re(),hash:_e(re()),definition:_e(Te)}),qe=me({browser:we(re(),re()),node:we(re(),re())}),Ie=Se({path:re(),rootPath:_e(re()),includeAll:_e(ue()),ignoredPackages:_e(fe(re())),ignoreResolutions:_e(ue()),resolveStrategy:_e(Ae(["dedupe","duplicate"])),remote:_e(Se({hostUrl:re(),resolveMap:we(re(),le()),packages:me({definitions:we(re(),le()),transformedDefinitions:we(re(),le())}),packageHashes:me({hashesWithSource:qe,hashesWithNoSource:qe})}))}),Re=Se({linkedPath:Ie}),De=Se({resolveMap:we(re(),le()),linkedPaths:fe(Ie)}),Ne=Se({name:re(),version:_e(re())}),Le=ye([re(),ge({...Ne.shape})]),Ue=ye([re(),(Ze=Ne,function(e,t){const n=t._zod.def.shape,o={...n};for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return v(t,{...t._zod.def,shape:o,checks:[]})}(Ce,Ze))]);var Ze;const We=Ee({packageSettings:_e(fe(ge({match:ye([Le,fe(Le)])}))),generated:ge({packageSettings:fe(ge({match:Ue}))})}),Be=(ie(),re(),{path:["link","update"],type:$e}),He={path:["link","config"],type:We},Fe={path:["link","paths"],type:Re},Je={path:["link","done"],type:De},Ge={path:["link","disconnected"],type:me({reason:Ae(["lost","unreachable"])})};var Ve=Object.create,Ye=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Xe=Object.getOwnPropertyNames,Qe=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty,tt=(e,t)=>function(){return t||(0,e[Xe(e)[0]])((t={exports:{}}).exports,t),t.exports},nt=(e,t,n)=>(n=null!=e?Ve(Qe(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=Xe(t),i=0,a=s.length;i<a;i++)r=s[i],et.call(e,r)||undefined===r||Ye(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=Ke(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Ye(n,"default",{value:e,enumerable:!0}),e)),ot=tt({"../../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}}),rt=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=ot().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}}),st=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=ot().default,o=rt();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),it=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=st();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}}),at=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=it();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 ut(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(ct,t)};return t}function ct(e,t){return t(e)}function lt(e){return ut(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 dt(e){return Array.isArray(e)?e:[e]}function pt(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}"function"==typeof Symbol&&Symbol.asyncIterator;const ft=e=>e();function ht(e=0){return new Promise(t=>setTimeout(t,e))}var mt=nt(it(),1),gt=nt(at(),1),vt=class e extends Error{constructor(t,n){var o,r;const s=null==n?void 0:n.cause;super(t,{cause:s}),(0,mt.default)(this,"cause",void 0),(0,mt.default)(this,"shape",void 0),(0,mt.default)(this,"data",void 0),(0,mt.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 vt}(o)?(n.meta&&(o.meta=(0,gt.default)((0,gt.default)({},o.meta),n.meta)),o):pt(r=o)&&pt(r.error)&&"number"==typeof r.error.code&&"string"==typeof r.error.message?new e(o.error.message,(0,gt.default)((0,gt.default)({},n),{},{result:o})):new e("string"==typeof(s=o)?s:pt(s)&&"string"==typeof s.message?s.message:"Unknown error",(0,gt.default)((0,gt.default)({},n),{},{cause:o}));var r,s}};function yt(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 bt=e=>"function"==typeof e;var wt=nt(at(),1);const kt={query:"GET",mutation:"POST",subscription:"PATCH"};function At(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 xt=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=At(e);void 0!==t&&"POST"!==e.methodOverride&&o.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return o.length&&(n+="?"+o.join("&")),n},_t=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;const t=At(e);return void 0!==t?JSON.stringify(t):void 0};var Ct=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const St=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 Ct}};nt(at(),1);var Et=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Ot=Object.getOwnPropertyNames,zt=Object.getPrototypeOf,Mt=Object.prototype.hasOwnProperty,Tt=(e,t)=>function(){return t||(0,e[Ot(e)[0]])((t={exports:{}}).exports,t),t.exports},$t=(e,t,n)=>(n=null!=e?Et(zt(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=Ot(t),i=0,a=s.length;i<a;i++)r=s[i],Mt.call(e,r)||undefined===r||Pt(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=jt(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Pt(n,"default",{value:e,enumerable:!0}),e));const qt=()=>{},It=e=>{Object.freeze&&Object.freeze(e)};function Rt(e,t,n){var o;const r=t.join(".");return null!==(o=n[r])&&void 0!==o||(n[r]=new Proxy(qt,{get(o,r){if("string"==typeof r&&"then"!==r)return Rt(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)}),It(i.args),It(i.path),e(i)}})),n[r]}const Dt=e=>Rt(e,[],Object.create(null));var Nt=Tt({"../../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}}),Lt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Nt().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}}),Ut=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Nt().default,o=Lt();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),Zt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Ut();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}}),Wt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Zt();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}});$t(Wt(),1);$t(Zt(),1),Error;Error;var Bt=$t(Wt(),1),Ht=class extends Error{constructor(){super("Unable to transform response from server")}};function Ft(e,t){let n;try{n=function(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,Bt.default)((0,Bt.default)({},e),{},{error:n})}}return{ok:!0,result:(0,Bt.default)((0,Bt.default)({},e.result),(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.deserialize(e.result.data)})}}(e,t)}catch(e){throw new Ht}if(!(n.ok||pt(n.error.error)&&"number"==typeof n.error.error.code))throw new Ht;if(n.ok&&!pt(n.result))throw new Ht;return n}$t(Wt(),1),Symbol("lazy"),Symbol();const Jt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Gt(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:Jt,reject:Jt},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 Vt=nt(at(),1);function Yt(e){var t,n;const o=function(e){return{url:e.url.toString(),fetch:e.fetch,transformer:yt(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 xt((0,Vt.default)((0,Vt.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;St(e.signal);const n=e.getUrl(e),o=e.getBody(e),{type:r}=e,s=await(async()=>{const t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),i=(0,wt.default)((0,wt.default)((0,wt.default)({},e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),s);return function(e){if(e)return e;if("undefined"!=typeof window&&bt(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&bt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}(e.fetch)(n,{method:null!==(t=e.methodOverride)&&void 0!==t?t:kt[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,wt.default)((0,wt.default)({},e),{},{contentTypeHeader:"application/json",getUrl:xt,getBody:_t})))((0,Vt.default)((0,Vt.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:Gt(t("query")),mutation:Gt(t("mutation"))};return({op:e})=>ut(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=Ft(e.json,o.transformer.output);n.ok?(t.next({context:e.meta,result:n.result}),t.complete()):t.error(vt.from(n.error,{meta:e.meta}))}).catch(e=>{t.error(vt.from(e,{meta:null==r?void 0:r.meta}))}),()=>{}})}}function Kt(e){let t=e;const n=[],o=ut(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}nt(at(),1),Symbol();const Xt={enabled:!1,closeMs:0},Qt={enabled:!1,pongTimeoutMs:1e3,intervalMs:5e3},en=e=>0===e?0:Math.min(1e3*2**e,3e4),tn=(e,...t)=>"function"==typeof e?e(...t):e;var nn=nt(it(),1),on=class e extends Error{constructor(t){super(t.message,{cause:t.cause}),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,e.prototype)}},rn=class{constructor(e,t){this.onTimeout=e,this.timeoutMs=t,(0,nn.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 sn(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var an=nt(it(),1),un=class{constructor(){(0,an.default)(this,"outgoingRequests",new Array),(0,an.default)(this,"pendingRequests",{})}register(e,t){const{promise:n,resolve:o}=sn();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}},cn=nt(it(),1);function ln(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 dn=class e{constructor(t){var n;if((0,cn.default)(this,"id",++e.connectCount),(0,cn.default)(this,"WebSocketPonyfill",void 0),(0,cn.default)(this,"urlOptions",void 0),(0,cn.default)(this,"keepAliveOpts",void 0),(0,cn.default)(this,"wsObservable",Kt(null)),(0,cn.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 tn(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.addEventListener("message",function({data:e}){"PING"===e&&this.send("PONG")}),t.keepAliveOpts.enabled&&ln(e,t.keepAliveOpts),e.addEventListener("close",()=>{t.ws===e&&(t.ws=null)}),await function(e){const{promise:t,resolve:n,reject:o}=sn();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 tn(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,cn.default)(dn,"connectCount",0);var pn=nt(it(),1),fn=nt(at(),1),hn=class{constructor(e){var t;(0,pn.default)(this,"connectionState",void 0),(0,pn.default)(this,"allowReconnect",!1),(0,pn.default)(this,"requestManager",new un),(0,pn.default)(this,"activeConnection",void 0),(0,pn.default)(this,"reconnectRetryDelay",void 0),(0,pn.default)(this,"inactivityTimeout",void 0),(0,pn.default)(this,"callbacks",void 0),(0,pn.default)(this,"lazyMode",void 0),(0,pn.default)(this,"reconnecting",null),this.callbacks={onOpen:e.onOpen,onClose:e.onClose,onError:e.onError};const n=(0,fn.default)((0,fn.default)({},Xt),e.lazy);this.inactivityTimeout=new rn(()=>{this.requestManager.hasOutgoingRequests()||this.requestManager.hasPendingRequests()?this.inactivityTimeout.reset():this.close().catch(()=>null)},n.closeMs),this.activeConnection=new dn({WebSocketPonyfill:e.WebSocket,urlOptions:e,keepAlive:(0,fn.default)((0,fn.default)({},Qt),e.keepAlive)}),this.activeConnection.wsObservable.subscribe({next:e=>{e&&this.setupWebSocketListeners(e)}}),this.reconnectRetryDelay=null!==(t=e.retryDelayMs)&&void 0!==t?t:en,this.lazyMode=n.enabled,this.connectionState=Kt({type:"state",state:n.enabled?"idle":"connecting",error:null}),this.lazyMode||this.open().catch(()=>null)}async open(){var e=this;e.allowReconnect=!0,"connecting"!==e.connectionState.get().state&&e.connectionState.next({type:"state",state:"connecting",error:null});try{await e.activeConnection.open()}catch(t){return e.reconnect(new on({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(vt.from(new on({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 ut(a=>{const u=this.batchSend({id:e,method:t,params:{input:s.input.serialize(o),path:n,lastEventId:i}},(0,fn.default)((0,fn.default)({},a),{},{next(e){const t=Ft(e,s.output);t.ok?a.next({result:t.result}):a.error(vt.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:vt.from(e)}),this.reconnecting)return;const n=async e=>{try{await ht(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(vt.from(null!=e?e:new on({message:"WebSocket closed",cause:e}))),this.requestManager.delete(n.id))};e.addEventListener("open",()=>{ft(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(),"string"!=typeof e||["PING","PONG"].includes(e))return;const t=JSON.parse(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 on({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 on({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 on({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(JSON.stringify(1===t.length?t[0]:t))}batchSend(e,t){var n=this;return this.inactivityTimeout.reset(),ft(async()=>{n.activeConnection.isOpen()||await n.open(),await ht(0),n.requestManager.hasOutgoingRequests()&&n.send(n.requestManager.flush().map(({message:e})=>e))}).catch(n=>{this.requestManager.delete(e.id),t.error(vt.from(n))}),this.requestManager.register(e,t)}};function mn(e){const{client:t}=e,n=yt(e.transformer);return()=>({op:e})=>ut(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 gn=nt(it(),1),vn=nt(at(),1),yn=class{constructor(e){(0,gn.default)(this,"links",void 0),(0,gn.default)(this,"runtime",void 0),(0,gn.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){var t;return lt({links:this.links,op:(0,vn.default)((0,vn.default)({},e),{},{context:null!==(t=e.context)&&void 0!==t?t:{},id:++this.requestId})}).pipe(e=>{let t=0,n=null;const o=[];return ut(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 vt.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 bn=Symbol.for("trpc_untypedClient"),wn={query:"query",mutate:"mutation",subscribe:"subscription"};nt(at(),1),nt(at(),1),nt(tt({"../../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),nt(at(),1);var kn=tt({"../../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}}),An=tt({"../../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}}),xn=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=An();t.exports=function(e){return new n(e,0)},t.exports.__esModule=!0,t.exports.default=t.exports}}),_n=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=An();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 Cn(e){await async function(){if("undefined"!=typeof global){const e=global;if(void 0===e.WebSocket){const{WebSocket:t}=await n.e(621).then(n.t.bind(n,621,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:e.reporter});const t=new hn(e),o=function(e,t){try{return new URL(e,t)}catch{throw new Error(`Invalid URL: "${e}", base: ""`)}}(e.url),r="wss:"===o.protocol;o.protocol=r?"https:":"http:";const s=o.toString().replace(/\/$/,""),i=function(e){return function(e){const t=Dt(({path:t,args:n})=>{const o=[...t],r=(s=o.pop(),wn[s]);var s;const i=o.join(".");return e[r](i,...n)});return n=n=>n===bn?e:t[n],new Proxy(qt,{get(e,t){if("then"!==t)return n(t)}});var n}(new yn(e))}({links:[(a={condition:e=>"subscription"===e.type,true:mn({client:t}),false:Yt({url:s})},e=>{const t=dt(a.true).map(t=>t(e)),n=dt(a.false).map(t=>t(e));return e=>ut(o=>{const r=a.condition(e.op)?t:n;return lt({op:e.op,links:r}).subscribe(o)})})]});var a;return new Proxy({close:async()=>{await t.close()}},{get:(e,t)=>e.hasOwnProperty(t)?e[t]:i[t]})}nt(kn(),1),nt(xn(),1),nt(_n(),1),nt(at(),1);var Sn=n(606),En=n.n(Sn),Pn=n(607),jn=n.n(Pn),On=n(437),zn=n.n(On),Mn=n(750),Tn=n.n(Mn),$n=n(994),qn=n.n($n),In=n(415),Rn=n.n(In),Dn=n(941),Nn={};Nn.styleTagTransform=Rn(),Nn.setAttributes=Tn(),Nn.insert=zn().bind(null,"head"),Nn.domAPI=jn(),Nn.insertStyleElement=qn(),En()(Dn.default,Nn);const Ln=Dn.default&&Dn.default.locals?Dn.default.locals:void 0;class Un{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="${Ln.statusContainer+(o?` ${Ln.errorContainer}`:"")}">\n <h2 class="${Ln.title}">Cloudpack Link Proxy</h2>\n <p class="${Ln.message}">${o?"Error: ":""}${t}</p>\n ${n?`<p class="${Ln.message}"><strong>Tip:</strong> ${n}</p>`:""}\n <p class="${Ln.warning}">Do not close this page while Cloudpack link is running.</p>\n </div>\n `)}}class Zn{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 Wn(e){console.debug(`[Cloudpack] Checking session at ${e}`);const t=await Cn({url:e});let n=!1;try{n=!!await t.getSessionId.query()}catch{}finally{await t.close()}return n}const Bn=new class{ui;connectionManager;linkedPathData=null;constructor(){this.ui=new Un,this.connectionManager=new Zn}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({...Ge,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(Be,{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(Fe)||t.onDataChanged.subscribe(Fe,{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({...Je,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(He)){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({...He,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 Cn({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 Wn(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 Cn({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()}}};Bn.initialize()},941:(e,t,n)=>{n.d(t,{default:()=>a});var o=n(25),r=n.n(o),s=n(191),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.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.ScZ3E77NPMqtBzp0OwUr {\n background-color: var(--color-status-danger-background1);\n}\n\n.b6Vf2DbiFQkD7AEkJ7p_ h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-neutral-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr .b6Vf2DbiFQkD7AEkJ7p_ {\n color: var(--color-status-danger-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-status-danger-foreground1);\n}\n\n._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.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.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:"v64eNmuXrV4WWsOKdGgy",errorContainer:"ScZ3E77NPMqtBzp0OwUr",title:"b6Vf2DbiFQkD7AEkJ7p_",message:"_05tS4aUzls4kEWk9hkA7",warning:"kheFps3bT2VbnjAMYfSr"};const a=i},994:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}}};import e from"../runtime.js";import*as t from"./index.js";e.C(t),e(e.s=851);
2
+ export const __webpack_id__=293;export const __webpack_ids__=[293];export const __webpack_modules__={25: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")}},191: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))}}},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)}}}},750:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},851:(e,t,n)=>{function o(e,t,n){function o(n,o){var r;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(r=n._zod).traits??(r.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in i.prototype)e in n||Object.defineProperty(n,e,{value:i.prototype[e].bind(n)});n._zod.constr=i,n._zod.def=o}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}Symbol("zod_brand");class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const s={};function i(e){return e&&Object.assign(s,e),s}function a(e,t="|"){return e.map(e=>w(e)).join(t)}function u(e,t){return"bigint"==typeof t?t.toString():t}function c(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function l(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function d(e,t,n){Object.defineProperty(e,t,{get(){{const o=n();return e[t]=o,o}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function p(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function f(e=10){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(26*Math.random())];return t}function h(e){return JSON.stringify(e)}const m=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function g(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const v=c(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function y(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function b(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 w(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function k(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n].continue)return!0;return!1}function A(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function x(e){return"string"==typeof e?e:e?.message}function _(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=x(e.inst?._zod.def?.error?.(e))??x(t?.error?.(e))??x(n.customError?.(e))??x(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}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 S=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,u,2),enumerable:!0})},C=o("$ZodError",S),E=o("$ZodError",S,{Parent:Error}),P=e=>(t,n,o,s)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},a);if(u instanceof Promise)throw new r;if(u.issues.length){const t=new(s?.Err??e)(u.issues.map(e=>_(e,a,i())));throw m(t,s?.callee),t}return u.value},j=P(E),O=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(r?.Err??e)(a.issues.map(e=>_(e,s,i())));throw m(t,r?.callee),t}return a.value},z=O(E),M=e=>(t,n,o)=>{const s=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new r;return a.issues.length?{success:!1,error:new(e??C)(a.issues.map(e=>_(e,s,i())))}:{success:!0,data:a.value}},$=M(E),I=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=>_(e,r,i())))}:{success:!0,data:s.value}},T=I(E),q=/^-?\d+(?:\.\d+)?/i,R=/true|false/i;class D{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),o=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const N={major:4,minor:0,patch:0},U=o("$ZodType",(e,t)=>{var n;e??(e={}),d(e._zod,"id",()=>t.type+"_"+f(10)),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=N;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,s=k(e);for(const i of t){if(i._zod.when){if(!i._zod.when(e))continue}else if(s)continue;const t=e.issues.length,a=i._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new r;if(o||a instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(s||(s=k(e,t)))});else{if(e.issues.length===t)continue;s||(s=k(e,t))}}return o?o.then(()=>e):e};e._zod.run=(n,s)=>{const i=e._zod.parse(n,s);if(i instanceof Promise){if(!1===s.async)throw new r;return i.then(e=>t(e,o,s))}return t(i,o,s)}}e["~standard"]={validate:t=>{try{const n=$(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return T(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),L=o("$ZodString",(e,t)=>{var n;U.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),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}}),W=o("$ZodNumber",(e,t)=>{U.init(e,t),e._zod.pattern=e._zod.bag.pattern??q,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}}),Z=o("$ZodBoolean",(e,t)=>{U.init(e,t),e._zod.pattern=R,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}}),B=o("$ZodAny",(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),H=o("$ZodUnknown",(e,t)=>{U.init(e,t),e._zod.parse=e=>e});function F(e,t,n){e.issues.length&&t.issues.push(...A(n,e.issues)),t.value[n]=e.value}const J=o("$ZodArray",(e,t)=>{U.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=>F(t,n,e))):F(a,n,e)}return s.length?Promise.all(s).then(()=>n):n}});function G(e,t,n){e.issues.length&&t.issues.push(...A(n,e.issues)),t.value[n]=e.value}function V(e,t,n,o){e.issues.length?void 0===o[n]?t.value[n]=n in o?void 0:e.value:t.issues.push(...A(n,e.issues)):void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const Y=o("$ZodObject",(e,t)=>{U.init(e,t);const n=c(()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof U))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter(e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});let o;d(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=g,i=!s.jitless,a=i&&v.value,{catchall:u}=t;let l;e._zod.parse=(s,c)=>{l??(l=n.value);const d=s.value;if(!r(d))return s.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),s;const p=[];if(i&&a&&!1===c?.async&&!0!==c.jitless)o||(o=(e=>{const t=new D(["shape","payload","ctx"]),{keys:o,optionalKeys:r}=n.value,s=e=>{const t=h(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);for(const e of o)i[e]=f(15);t.write("const newResult = {}");for(const e of o)if(r.has(e)){const n=i[e];t.write(`const ${n} = ${s(e)};`);const o=h(e);t.write(`\n if (${n}.issues.length) {\n if (input[${o}] === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${o} in input) newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}else{const n=i[e];t.write(`const ${n} = ${s(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${h(e)}, ...iss.path] : [${h(e)}]\n })));`),t.write(`newResult[${h(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),s=o(s,c);else{s.value={};const e=l.shape;for(const t of l.keys){const n=e[t],o=n._zod.run({value:d[t],issues:[]},c),r="optional"===n._zod.optin&&"optional"===n._zod.optout;o instanceof Promise?p.push(o.then(e=>r?V(e,s,t,d):G(e,s,t))):r?V(o,s,t,d):G(o,s,t)}}if(!u)return p.length?Promise.all(p).then(()=>s):s;const m=[],g=l.keySet,v=u._zod,y=v.def.type;for(const e of Object.keys(d)){if(g.has(e))continue;if("never"===y){m.push(e);continue}const t=v.run({value:d[e],issues:[]},c);t instanceof Promise?p.push(t.then(t=>G(t,s,e))):G(t,s,e)}return m.length&&s.issues.push({code:"unrecognized_keys",keys:m,input:d,inst:e}),p.length?Promise.all(p).then(()=>s):s}});function K(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>_(e,o,i())))}),t}const X=o("$ZodUnion",(e,t)=>{U.init(e,t),d(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),d(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=>l(e.source)).join("|")})$`)}}),e._zod.parse=(n,o)=>{let r=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)s.push(t),r=!0;else{if(0===t.issues.length)return t;s.push(t)}}return r?Promise.all(s).then(t=>K(t,n,e,o)):K(s,n,e,o)}}),Q=o("$ZodRecord",(e,t)=>{U.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!function(e){if(!1===g(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==g(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=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const e of i)if("string"==typeof e||"number"==typeof e||"symbol"==typeof 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(...A(e,t.issues)),n.value[e]=t.value})):(i.issues.length&&n.issues.push(...A(e,i.issues)),n.value[e]=i.value)}let a;for(const e in r)i.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(const a of Reflect.ownKeys(r)){if("__proto__"===a)continue;const u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(e=>_(e,o,i())),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:r[a],issues:[]},o);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&n.issues.push(...A(a,e.issues)),n.value[u.value]=e.value})):(c.issues.length&&n.issues.push(...A(a,c.issues)),n.value[u.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),ee=o("$ZodLiteral",(e,t)=>{U.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),te=o("$ZodOptional",(e,t)=>{U.init(e,t),e._zod.optin="optional",e._zod.optout="optional",d(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),d(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${l(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)}),ne=o("$ZodNonOptional",(e,t)=>{U.init(e,t),d(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=>oe(t,e)):oe(r,e)}});function oe(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}Symbol("ZodOutput"),Symbol("ZodInput");const re=o("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");U.init(e,t),e.def=t,e.parse=(t,n)=>j(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>$(e,t,n),e.parseAsync=async(t,n)=>z(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>T(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)]}),e.clone=(t,n)=>y(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e)}),se=o("ZodMiniString",(e,t)=>{L.init(e,t),re.init(e,t)});function ie(e){return function(e,t){return new e({type:"string",...b(t)})}(se,e)}const ae=o("ZodMiniNumber",(e,t)=>{W.init(e,t),re.init(e,t)});function ue(e){return function(e,t){return new e({type:"number",checks:[],...b(t)})}(ae,e)}const ce=o("ZodMiniBoolean",(e,t)=>{Z.init(e,t),re.init(e,t)});function le(e){return function(e,t){return new e({type:"boolean",...b(t)})}(ce,e)}const de=o("ZodMiniAny",(e,t)=>{B.init(e,t),re.init(e,t)});function pe(){return new de({type:"any"})}const fe=o("ZodMiniUnknown",(e,t)=>{H.init(e,t),re.init(e,t)}),he=o("ZodMiniArray",(e,t)=>{J.init(e,t),re.init(e,t)});function me(e,t){return new he({type:"array",element:e,...b(t)})}const ge=o("ZodMiniObject",(e,t)=>{Y.init(e,t),re.init(e,t),d(e,"shape",()=>t.shape)});function ve(e,t){const n={type:"object",get shape(){return p(this,"shape",{...e}),this.shape},...b(t)};return new ge(n)}function ye(e,t){return new ge({type:"object",get shape(){return p(this,"shape",{...e}),this.shape},catchall:(n=fe,new n({type:"unknown"})),...b(t)});var n}const be=o("ZodMiniUnion",(e,t)=>{X.init(e,t),re.init(e,t)});function we(e,t){return new be({type:"union",options:e,...b(t)})}const ke=o("ZodMiniRecord",(e,t)=>{Q.init(e,t),re.init(e,t)});function Ae(e,t,n){return new ke({type:"record",keyType:e,valueType:t,...b(n)})}const xe=o("ZodMiniLiteral",(e,t)=>{ee.init(e,t),re.init(e,t)});function _e(e,t){return new xe({type:"literal",values:Array.isArray(e)?e:[e],...b(t)})}const Se=o("ZodMiniOptional",(e,t)=>{te.init(e,t),re.init(e,t)});function Ce(e){return new Se({type:"optional",innerType:e})}const Ee=o("ZodMiniNonOptional",(e,t)=>{ne.init(e,t),re.init(e,t)});function Pe(e){return ve(e)}function je(e){return ye(e)}i({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"}};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",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"};return e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${e.expected}, received ${(e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}return t})(e.input)}`;case"invalid_value":return 1===e.values.length?`Invalid input: expected ${w(e.values[0])}`:`Invalid option: expected one of ${a(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":""}: ${a(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}`}}})()}),Pe({status:_e(["idle","pending"]),remainingTasks:ue(),totalTasks:ue(),totalErrors:ue(),totalWarnings:ue()});const Oe=Pe({name:ie(),start:ue(),end:Ce(ue()),threwException:Ce(le())}),ze=Pe({file:ie(),line:Ce(ue()),column:Ce(ue())}),Me=Pe({text:ie(),location:Ce(ze)}),$e=Pe({text:ie(),source:ie(),location:Ce(ze),notes:Ce(me(Me))}),Ie=Pe({id:ie(),name:ie(),status:_e(["pending","complete"]),inputPath:ie(),outputPath:Ce(ie()),errors:Ce(me($e)),warnings:Ce(me($e)),startTime:ue(),duration:Ce(ue()),lastUpdated:Ce(ue()),timings:Ce(me(Oe))});Pe({tasks:me(Ie)});const Te=je({name:ie(),version:ie()}),qe=Pe({packagePath:ie(),hash:Ce(ie()),definition:Ce(Te)}),Re=ve({browser:Ae(ie(),ie()),node:Ae(ie(),ie())}),De=Pe({path:ie(),rootPath:Ce(ie()),includeAll:Ce(le()),ignoredPackages:Ce(me(ie())),ignoreResolutions:Ce(le()),resolveStrategy:Ce(_e(["dedupe","duplicate"])),remote:Ce(Pe({hostUrl:ie(),resolveMap:Ae(ie(),pe()),packages:ve({definitions:Ae(ie(),pe()),transformedDefinitions:Ae(ie(),pe())}),packageHashes:ve({hashesWithSource:Re,hashesWithNoSource:Re})}))}),Ne=Pe({linkedPath:De}),Ue=Pe({resolveMap:Ae(ie(),pe()),linkedPaths:me(De)}),Le=Pe({name:ie(),version:Ce(ie())}),We=we([ie(),ye({...Le.shape})]),Ze=we([ie(),(Be=Le,function(e,t){const n=t._zod.def.shape,o={...n};for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return y(t,{...t._zod.def,shape:o,checks:[]})}(Ee,Be))]);var Be;const He=je({packageSettings:Ce(me(ye({match:we([We,me(We)])}))),generated:ye({packageSettings:me(ye({match:Ze}))})}),Fe=(ue(),ie(),{path:["link","update"],type:qe}),Je={path:["link","config"],type:He},Ge={path:["link","paths"],type:Ne},Ve={path:["link","done"],type:Ue},Ye={path:["link","disconnected"],type:ve({reason:_e(["lost","unreachable"])})};var Ke=Object.create,Xe=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,tt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,ot=(e,t)=>function(){return t||(0,e[et(e)[0]])((t={exports:{}}).exports,t),t.exports},rt=(e,t,n)=>(n=null!=e?Ke(tt(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=et(t),i=0,a=s.length;i<a;i++)r=s[i],nt.call(e,r)||undefined===r||Xe(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=Qe(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Xe(n,"default",{value:e,enumerable:!0}),e)),st=ot({"../../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}}),it=ot({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=st().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}}),at=ot({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=st().default,o=it();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),ut=ot({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=at();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}}),ct=ot({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=ut();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 lt(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(dt,t)};return t}function dt(e,t){return t(e)}function pt(e){return lt(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 ft(e){return Array.isArray(e)?e:[e]}function ht(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}"function"==typeof Symbol&&Symbol.asyncIterator;const mt=e=>e();function gt(e=0){return new Promise(t=>setTimeout(t,e))}var vt=rt(ut(),1),yt=rt(ct(),1),bt=class e extends Error{constructor(t,n){var o,r;const s=null==n?void 0:n.cause;super(t,{cause:s}),(0,vt.default)(this,"cause",void 0),(0,vt.default)(this,"shape",void 0),(0,vt.default)(this,"data",void 0),(0,vt.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 bt}(o)?(n.meta&&(o.meta=(0,yt.default)((0,yt.default)({},o.meta),n.meta)),o):ht(r=o)&&ht(r.error)&&"number"==typeof r.error.code&&"string"==typeof r.error.message?new e(o.error.message,(0,yt.default)((0,yt.default)({},n),{},{result:o})):new e("string"==typeof(s=o)?s:ht(s)&&"string"==typeof s.message?s.message:"Unknown error",(0,yt.default)((0,yt.default)({},n),{},{cause:o}));var r,s}};function wt(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 kt=e=>"function"==typeof e;var At=rt(ct(),1);const xt={query:"GET",mutation:"POST",subscription:"PATCH"};function _t(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 St=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=_t(e);void 0!==t&&"POST"!==e.methodOverride&&o.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return o.length&&(n+="?"+o.join("&")),n},Ct=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;const t=_t(e);return void 0!==t?JSON.stringify(t):void 0};var Et=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Pt=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 Et}};rt(ct(),1);var jt=Object.create,Ot=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Mt=Object.getOwnPropertyNames,$t=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty,Tt=(e,t)=>function(){return t||(0,e[Mt(e)[0]])((t={exports:{}}).exports,t),t.exports},qt=(e,t,n)=>(n=null!=e?jt($t(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=Mt(t),i=0,a=s.length;i<a;i++)r=s[i],It.call(e,r)||undefined===r||Ot(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=zt(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Ot(n,"default",{value:e,enumerable:!0}),e));const Rt=()=>{},Dt=e=>{Object.freeze&&Object.freeze(e)};function Nt(e,t,n){var o;const r=t.join(".");return null!==(o=n[r])&&void 0!==o||(n[r]=new Proxy(Rt,{get(o,r){if("string"==typeof r&&"then"!==r)return Nt(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)}),Dt(i.args),Dt(i.path),e(i)}})),n[r]}const Ut=e=>Nt(e,[],Object.create(null));var Lt=Tt({"../../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}}),Wt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Lt().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}}),Zt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Lt().default,o=Wt();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),Bt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Zt();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}}),Ht=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Bt();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}});qt(Ht(),1);qt(Bt(),1),Error;Error;var Ft=qt(Ht(),1),Jt=class extends Error{constructor(){super("Unable to transform response from server")}};function Gt(e,t){let n;try{n=function(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,Ft.default)((0,Ft.default)({},e),{},{error:n})}}return{ok:!0,result:(0,Ft.default)((0,Ft.default)({},e.result),(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.deserialize(e.result.data)})}}(e,t)}catch(e){throw new Jt}if(!(n.ok||ht(n.error.error)&&"number"==typeof n.error.error.code))throw new Jt;if(n.ok&&!ht(n.result))throw new Jt;return n}qt(Ht(),1),Symbol("lazy"),Symbol();const Vt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Yt(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:Vt,reject:Vt},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 Kt=rt(ct(),1);function Xt(e){var t,n;const o=function(e){return{url:e.url.toString(),fetch:e.fetch,transformer:wt(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 St((0,Kt.default)((0,Kt.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;Pt(e.signal);const n=e.getUrl(e),o=e.getBody(e),{type:r}=e,s=await(async()=>{const t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),i=(0,At.default)((0,At.default)((0,At.default)({},e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),s);return function(e){if(e)return e;if("undefined"!=typeof window&&kt(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&kt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}(e.fetch)(n,{method:null!==(t=e.methodOverride)&&void 0!==t?t:xt[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,At.default)((0,At.default)({},e),{},{contentTypeHeader:"application/json",getUrl:St,getBody:Ct})))((0,Kt.default)((0,Kt.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:Yt(t("query")),mutation:Yt(t("mutation"))};return({op:e})=>lt(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=Gt(e.json,o.transformer.output);n.ok?(t.next({context:e.meta,result:n.result}),t.complete()):t.error(bt.from(n.error,{meta:e.meta}))}).catch(e=>{t.error(bt.from(e,{meta:null==r?void 0:r.meta}))}),()=>{}})}}function Qt(e){let t=e;const n=[],o=lt(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}rt(ct(),1),Symbol();const en={enabled:!1,closeMs:0},tn={enabled:!1,pongTimeoutMs:1e3,intervalMs:5e3},nn=e=>0===e?0:Math.min(1e3*2**e,3e4),on=(e,...t)=>"function"==typeof e?e(...t):e;var rn=rt(ut(),1),sn=class e extends Error{constructor(t){super(t.message,{cause:t.cause}),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,e.prototype)}},an=class{constructor(e,t){this.onTimeout=e,this.timeoutMs=t,(0,rn.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 un(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var cn=rt(ut(),1),ln=class{constructor(){(0,cn.default)(this,"outgoingRequests",new Array),(0,cn.default)(this,"pendingRequests",{})}register(e,t){const{promise:n,resolve:o}=un();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}},dn=rt(ut(),1);function pn(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 fn=class e{constructor(t){var n;if((0,dn.default)(this,"id",++e.connectCount),(0,dn.default)(this,"WebSocketPonyfill",void 0),(0,dn.default)(this,"urlOptions",void 0),(0,dn.default)(this,"keepAliveOpts",void 0),(0,dn.default)(this,"wsObservable",Qt(null)),(0,dn.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 on(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.addEventListener("message",function({data:e}){"PING"===e&&this.send("PONG")}),t.keepAliveOpts.enabled&&pn(e,t.keepAliveOpts),e.addEventListener("close",()=>{t.ws===e&&(t.ws=null)}),await function(e){const{promise:t,resolve:n,reject:o}=un();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 on(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,dn.default)(fn,"connectCount",0);var hn=rt(ut(),1),mn=rt(ct(),1),gn=class{constructor(e){var t;(0,hn.default)(this,"connectionState",void 0),(0,hn.default)(this,"allowReconnect",!1),(0,hn.default)(this,"requestManager",new ln),(0,hn.default)(this,"activeConnection",void 0),(0,hn.default)(this,"reconnectRetryDelay",void 0),(0,hn.default)(this,"inactivityTimeout",void 0),(0,hn.default)(this,"callbacks",void 0),(0,hn.default)(this,"lazyMode",void 0),(0,hn.default)(this,"reconnecting",null),this.callbacks={onOpen:e.onOpen,onClose:e.onClose,onError:e.onError};const n=(0,mn.default)((0,mn.default)({},en),e.lazy);this.inactivityTimeout=new an(()=>{this.requestManager.hasOutgoingRequests()||this.requestManager.hasPendingRequests()?this.inactivityTimeout.reset():this.close().catch(()=>null)},n.closeMs),this.activeConnection=new fn({WebSocketPonyfill:e.WebSocket,urlOptions:e,keepAlive:(0,mn.default)((0,mn.default)({},tn),e.keepAlive)}),this.activeConnection.wsObservable.subscribe({next:e=>{e&&this.setupWebSocketListeners(e)}}),this.reconnectRetryDelay=null!==(t=e.retryDelayMs)&&void 0!==t?t:nn,this.lazyMode=n.enabled,this.connectionState=Qt({type:"state",state:n.enabled?"idle":"connecting",error:null}),this.lazyMode||this.open().catch(()=>null)}async open(){var e=this;e.allowReconnect=!0,"connecting"!==e.connectionState.get().state&&e.connectionState.next({type:"state",state:"connecting",error:null});try{await e.activeConnection.open()}catch(t){return e.reconnect(new sn({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(bt.from(new sn({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 lt(a=>{const u=this.batchSend({id:e,method:t,params:{input:s.input.serialize(o),path:n,lastEventId:i}},(0,mn.default)((0,mn.default)({},a),{},{next(e){const t=Gt(e,s.output);t.ok?a.next({result:t.result}):a.error(bt.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:bt.from(e)}),this.reconnecting)return;const n=async e=>{try{await gt(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(bt.from(null!=e?e:new sn({message:"WebSocket closed",cause:e}))),this.requestManager.delete(n.id))};e.addEventListener("open",()=>{mt(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(),"string"!=typeof e||["PING","PONG"].includes(e))return;const t=JSON.parse(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 sn({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 sn({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 sn({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(JSON.stringify(1===t.length?t[0]:t))}batchSend(e,t){var n=this;return this.inactivityTimeout.reset(),mt(async()=>{n.activeConnection.isOpen()||await n.open(),await gt(0),n.requestManager.hasOutgoingRequests()&&n.send(n.requestManager.flush().map(({message:e})=>e))}).catch(n=>{this.requestManager.delete(e.id),t.error(bt.from(n))}),this.requestManager.register(e,t)}};function vn(e){const{client:t}=e,n=wt(e.transformer);return()=>({op:e})=>lt(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 yn=rt(ut(),1),bn=rt(ct(),1),wn=class{constructor(e){(0,yn.default)(this,"links",void 0),(0,yn.default)(this,"runtime",void 0),(0,yn.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){var t;return pt({links:this.links,op:(0,bn.default)((0,bn.default)({},e),{},{context:null!==(t=e.context)&&void 0!==t?t:{},id:++this.requestId})}).pipe(e=>{let t=0,n=null;const o=[];return lt(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 bt.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 kn=Symbol.for("trpc_untypedClient"),An={query:"query",mutate:"mutation",subscribe:"subscription"};rt(ct(),1),rt(ct(),1),rt(ot({"../../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),rt(ct(),1);var xn=ot({"../../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}}),_n=ot({"../../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}}),Sn=ot({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=_n();t.exports=function(e){return new n(e,0)},t.exports.__esModule=!0,t.exports.default=t.exports}}),Cn=ot({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=_n();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 En(e){const{url:t,reporter:o}=e;await async function(){if("undefined"!=typeof global){const e=global;if(void 0===e.WebSocket){const{WebSocket:t}=await n.e(621).then(n.t.bind(n,621,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:o});const r=new gn({url:t,onError:e=>{console.error("[Cloudpack] Unexpected websocket client error:",e)}}),s=function(e,t){try{return new URL(e,t)}catch{throw new Error(`Invalid URL: "${e}", base: ""`)}}(t),i="wss:"===s.protocol;s.protocol=i?"https:":"http:";const a=s.toString().replace(/\/$/,""),u=function(e){return function(e){const t=Ut(({path:t,args:n})=>{const o=[...t],r=(s=o.pop(),An[s]);var s;const i=o.join(".");return e[r](i,...n)});return n=n=>n===kn?e:t[n],new Proxy(Rt,{get(e,t){if("then"!==t)return n(t)}});var n}(new wn(e))}({links:[(l={condition:e=>"subscription"===e.type,true:vn({client:r}),false:Xt({url:a})},e=>{const t=ft(l.true).map(t=>t(e)),n=ft(l.false).map(t=>t(e));return e=>lt(o=>{const r=l.condition(e.op)?t:n;return pt({op:e.op,links:r}).subscribe(o)})})]}),c={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)},u.onDataChanged.subscribe(e,t))};var l;return new Proxy({close:async()=>{await r.close()},onDataChanged:c},{get:(e,t)=>e.hasOwnProperty(t)?e[t]:u[t]})}rt(xn(),1),rt(Sn(),1),rt(Cn(),1),rt(ct(),1);var Pn=n(606),jn=n.n(Pn),On=n(607),zn=n.n(On),Mn=n(437),$n=n.n(Mn),In=n(750),Tn=n.n(In),qn=n(994),Rn=n.n(qn),Dn=n(415),Nn=n.n(Dn),Un=n(941),Ln={};Ln.styleTagTransform=Nn(),Ln.setAttributes=Tn(),Ln.insert=$n().bind(null,"head"),Ln.domAPI=zn(),Ln.insertStyleElement=Rn(),jn()(Un.default,Ln);const Wn=Un.default&&Un.default.locals?Un.default.locals:void 0;class Zn{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="${Wn.statusContainer+(o?` ${Wn.errorContainer}`:"")}">\n <h2 class="${Wn.title}">Cloudpack Link Proxy</h2>\n <p class="${Wn.message}">${o?"Error: ":""}${t}</p>\n ${n?`<p class="${Wn.message}"><strong>Tip:</strong> ${n}</p>`:""}\n <p class="${Wn.warning}">Do not close this page while Cloudpack link is running.</p>\n </div>\n `)}}class Bn{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 Hn(e){console.debug(`[Cloudpack] Checking session at ${e}`);const t=await En({url:e});let n=!1;try{n=!!await t.getSessionId.query()}catch{}finally{await t.close()}return n}const Fn=new class{ui;connectionManager;linkedPathData=null;constructor(){this.ui=new Zn,this.connectionManager=new Bn}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({...Ye,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(Fe,{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(Ge)||t.onDataChanged.subscribe(Ge,{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({...Ve,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(Je)){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({...Je,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 En({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 Hn(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 En({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()}}};Fn.initialize()},941:(e,t,n)=>{n.d(t,{default:()=>a});var o=n(25),r=n.n(o),s=n(191),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.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.ScZ3E77NPMqtBzp0OwUr {\n background-color: var(--color-status-danger-background1);\n}\n\n.b6Vf2DbiFQkD7AEkJ7p_ h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-neutral-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr .b6Vf2DbiFQkD7AEkJ7p_ {\n color: var(--color-status-danger-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-status-danger-foreground1);\n}\n\n._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.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.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:"v64eNmuXrV4WWsOKdGgy",errorContainer:"ScZ3E77NPMqtBzp0OwUr",title:"b6Vf2DbiFQkD7AEkJ7p_",message:"_05tS4aUzls4kEWk9hkA7",warning:"kheFps3bT2VbnjAMYfSr"};const a=i},994:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}}};import e from"../runtime.js";import*as t from"./index.js";e.C(t),e(e.s=851);
3
3
  //# sourceMappingURL=index.js.map