@sortsys/v2-client 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -6
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3143,7 +3143,7 @@ declare const appRouter: BuiltRouter<{
|
|
|
3143
3143
|
productId: string;
|
|
3144
3144
|
vendorId: string | null;
|
|
3145
3145
|
timestamp: Date;
|
|
3146
|
-
|
|
3146
|
+
pricePerBaseUnit: number;
|
|
3147
3147
|
isRealPurchase: boolean;
|
|
3148
3148
|
comment: string | null;
|
|
3149
3149
|
}[];
|
|
@@ -3152,7 +3152,8 @@ declare const appRouter: BuiltRouter<{
|
|
|
3152
3152
|
create: MutationProcedure<{
|
|
3153
3153
|
input: {
|
|
3154
3154
|
productId: string;
|
|
3155
|
-
|
|
3155
|
+
pricePerBaseUnit: number;
|
|
3156
|
+
timestamp: Date;
|
|
3156
3157
|
isRealPurchase: boolean;
|
|
3157
3158
|
vendorId?: string | null | undefined;
|
|
3158
3159
|
comment?: string | null | undefined;
|
|
@@ -3168,7 +3169,8 @@ declare const appRouter: BuiltRouter<{
|
|
|
3168
3169
|
data: {
|
|
3169
3170
|
productId?: string | undefined;
|
|
3170
3171
|
vendorId?: string | null | undefined;
|
|
3171
|
-
|
|
3172
|
+
pricePerBaseUnit?: number | undefined;
|
|
3173
|
+
timestamp?: Date | undefined;
|
|
3172
3174
|
isRealPurchase?: boolean | undefined;
|
|
3173
3175
|
comment?: string | null | undefined;
|
|
3174
3176
|
};
|
|
@@ -4032,6 +4034,8 @@ type TRPCQueryPaths<TClient> = TRPCPaths<TClient, "query">;
|
|
|
4032
4034
|
type TRPCMutatePaths<TClient> = TRPCPaths<TClient, "mutate">;
|
|
4033
4035
|
type QueryPaths = TRPCQueryPaths<MyTRPCClient>;
|
|
4034
4036
|
type MutatePaths = TRPCMutatePaths<MyTRPCClient>;
|
|
4037
|
+
export type QueryResult<PathT extends TRPCQueryPaths<MyTRPCClient>> = Awaited<ReturnType<PathValue<MyTRPCClient, `${PathT}.query`>>>;
|
|
4038
|
+
export type MutateResult<PathT extends TRPCQueryPaths<MyTRPCClient>> = Awaited<ReturnType<PathValue<MyTRPCClient, `${PathT}.mutate`>>>;
|
|
4035
4039
|
type AnyFn = (...args: any[]) => any;
|
|
4036
4040
|
type FirstParam<F> = F extends AnyFn ? Parameters<F> extends [
|
|
4037
4041
|
infer A,
|
|
@@ -4089,9 +4093,8 @@ export interface Client {
|
|
|
4089
4093
|
* Listen to auth state changes
|
|
4090
4094
|
* @returns Unsubscribe function
|
|
4091
4095
|
*/
|
|
4092
|
-
listenAuthState(listener: (
|
|
4093
|
-
|
|
4094
|
-
}) => void): (() => void);
|
|
4096
|
+
listenAuthState(listener: () => void): (() => void);
|
|
4097
|
+
loggedIn(): boolean;
|
|
4095
4098
|
restoreSession(): Promise<void>;
|
|
4096
4099
|
clearCache(): Promise<void>;
|
|
4097
4100
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var{create:eX,defineProperty:m0,getOwnPropertyDescriptor:X1,getOwnPropertyNames:_0,getPrototypeOf:Z1}=Object,B1=Object.prototype.hasOwnProperty,S=(X,Z)=>function(){return Z||(0,X[_0(X)[0]])((Z={exports:{}}).exports,Z),Z.exports},Q1=(X,Z,B,Q)=>{if(Z&&typeof Z==="object"||typeof Z==="function"){for(var G=_0(Z),Y=0,W=G.length,H;Y<W;Y++)if(H=G[Y],!B1.call(X,H)&&H!==B)m0(X,H,{get:((V)=>Z[V]).bind(null,H),enumerable:!(Q=X1(Z,H))||Q.enumerable})}return X},T=(X,Z,B)=>(B=X!=null?eX(Z1(X)):{},Q1(Z||!X||!X.__esModule?m0(B,"default",{value:X,enumerable:!0}):B,X)),d0=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(X,Z){function B(Q){return Z.exports=B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(G){return typeof G}:function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},Z.exports.__esModule=!0,Z.exports.default=Z.exports,B(Q)}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),G1=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(X,Z){var B=d0().default;function Q(G,Y){if(B(G)!="object"||!G)return G;var W=G[Symbol.toPrimitive];if(W!==void 0){var H=W.call(G,Y||"default");if(B(H)!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Y==="string"?String:Number)(G)}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),Y1=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(X,Z){var B=d0().default,Q=G1();function G(Y){var W=Q(Y,"string");return B(W)=="symbol"?W:W+""}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),y=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(X,Z){var B=Y1();function Q(G,Y,W){return(Y=B(Y))in G?Object.defineProperty(G,Y,{value:W,enumerable:!0,configurable:!0,writable:!0}):G[Y]=W,G}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),x=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(X,Z){var B=y();function Q(Y,W){var H=Object.keys(Y);if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(Y);W&&(V=V.filter(function(D){return Object.getOwnPropertyDescriptor(Y,D).enumerable})),H.push.apply(H,V)}return H}function G(Y){for(var W=1;W<arguments.length;W++){var H=arguments[W]!=null?arguments[W]:{};W%2?Q(Object(H),!0).forEach(function(V){B(Y,V,H[V])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Y,Object.getOwnPropertyDescriptors(H)):Q(Object(H)).forEach(function(V){Object.defineProperty(Y,V,Object.getOwnPropertyDescriptor(H,V))})}return Y}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}});function g(X){let Z={subscribe(B){let Q=null,G=!1,Y=!1,W=!1;function H(){if(Q===null){W=!0;return}if(Y)return;if(Y=!0,typeof Q==="function")Q();else if(Q)Q.unsubscribe()}if(Q=X({next(V){var D;if(G)return;(D=B.next)===null||D===void 0||D.call(B,V)},error(V){var D;if(G)return;G=!0,(D=B.error)===null||D===void 0||D.call(B,V),H()},complete(){var V;if(G)return;G=!0,(V=B.complete)===null||V===void 0||V.call(B),H()}}),W)H();return{unsubscribe:H}},pipe(...B){return B.reduce(W1,Z)}};return Z}function W1(X,Z){return Z(X)}function Z0(X){let Z=new AbortController;return new Promise((Q,G)=>{let Y=!1;function W(){if(Y)return;Y=!0,H.unsubscribe()}Z.signal.addEventListener("abort",()=>{G(Z.signal.reason)});let H=X.subscribe({next(V){Y=!0,Q(V),W()},error(V){G(V)},complete(){Z.abort(),W()}})})}function B0(X){return(Z)=>{let B=0,Q=null,G=[];function Y(){if(Q)return;Q=Z.subscribe({next(H){for(let D of G){var V;(V=D.next)===null||V===void 0||V.call(D,H)}},error(H){for(let D of G){var V;(V=D.error)===null||V===void 0||V.call(D,H)}},complete(){for(let V of G){var H;(H=V.complete)===null||H===void 0||H.call(V)}}})}function W(){if(B===0&&Q){let H=Q;Q=null,H.unsubscribe()}}return g((H)=>{return B++,G.push(H),Y(),{unsubscribe(){B--,W();let V=G.findIndex((D)=>D===H);if(V>-1)G.splice(V,1)}}})}}var PZ=Symbol();function M8(X){let Z=X,B=[],Q=(W)=>{if(Z!==void 0)W.next(Z);B.push(W)},G=(W)=>{B.splice(B.indexOf(W),1)},Y=g((W)=>{return Q(W),()=>{G(W)}});return Y.next=(W)=>{if(Z===W)return;Z=W;for(let H of B)H.next(W)},Y.get=()=>Z,Y}function b0(X){return g((Z)=>{function B(G=0,Y=X.op){let W=X.links[G];if(!W)throw Error("No more links to execute - did you forget to add an ending link?");return W({op:Y,next(V){return B(G+1,V)}})}return B().subscribe(Z)})}var H8={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};var l0=[H8.BAD_GATEWAY,H8.SERVICE_UNAVAILABLE,H8.GATEWAY_TIMEOUT,H8.INTERNAL_SERVER_ERROR];function m(X){return!!X&&!Array.isArray(X)&&typeof X==="object"}var{create:H1,defineProperty:u0,getOwnPropertyDescriptor:V1,getOwnPropertyNames:p0,getPrototypeOf:D1}=Object,K1=Object.prototype.hasOwnProperty,V8=(X,Z)=>function(){return Z||(0,X[p0(X)[0]])((Z={exports:{}}).exports,Z),Z.exports},A1=(X,Z,B,Q)=>{if(Z&&typeof Z==="object"||typeof Z==="function"){for(var G=p0(Z),Y=0,W=G.length,H;Y<W;Y++)if(H=G[Y],!K1.call(X,H)&&H!==B)u0(X,H,{get:((V)=>Z[V]).bind(null,H),enumerable:!(Q=V1(Z,H))||Q.enumerable})}return X},D8=(X,Z,B)=>(B=X!=null?H1(D1(X)):{},A1(Z||!X||!X.__esModule?u0(B,"default",{value:X,enumerable:!0}):B,X)),n0=()=>{},c0=(X)=>{if(Object.freeze)Object.freeze(X)};function i0(X,Z,B){var Q;let G=Z.join(".");return(Q=B[G])!==null&&Q!==void 0||(B[G]=new Proxy(n0,{get(Y,W){if(typeof W!=="string"||W==="then")return;return i0(X,[...Z,W],B)},apply(Y,W,H){let V=Z[Z.length-1],D={args:H,path:Z};if(V==="call")D={args:H.length>=2?[H[1]]:[],path:Z.slice(0,-1)};else if(V==="apply")D={args:H.length>=2?H[1]:[],path:Z.slice(0,-1)};return c0(D.args),c0(D.path),X(D)}})),B[G]}var L8=(X)=>i0(X,[],Object.create(null)),Q0=(X)=>{return new Proxy(n0,{get(Z,B){if(B==="then")return;return X(B)}})};var a0=V8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(X,Z){function B(Q){return Z.exports=B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(G){return typeof G}:function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},Z.exports.__esModule=!0,Z.exports.default=Z.exports,B(Q)}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),U1=V8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(X,Z){var B=a0().default;function Q(G,Y){if(B(G)!="object"||!G)return G;var W=G[Symbol.toPrimitive];if(W!==void 0){var H=W.call(G,Y||"default");if(B(H)!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Y==="string"?String:Number)(G)}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),q1=V8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(X,Z){var B=a0().default,Q=U1();function G(Y){var W=Q(Y,"string");return B(W)=="symbol"?W:W+""}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),G0=V8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(X,Z){var B=q1();function Q(G,Y,W){return(Y=B(Y))in G?Object.defineProperty(G,Y,{value:W,enumerable:!0,configurable:!0,writable:!0}):G[Y]=W,G}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),I8=V8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(X,Z){var B=G0();function Q(Y,W){var H=Object.keys(Y);if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(Y);W&&(V=V.filter(function(D){return Object.getOwnPropertyDescriptor(Y,D).enumerable})),H.push.apply(H,V)}return H}function G(Y){for(var W=1;W<arguments.length;W++){var H=arguments[W]!=null?arguments[W]:{};W%2?Q(Object(H),!0).forEach(function(V){B(Y,V,H[V])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Y,Object.getOwnPropertyDescriptors(H)):Q(Object(H)).forEach(function(V){Object.defineProperty(Y,V,Object.getOwnPropertyDescriptor(H,V))})}return Y}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),dZ=D8(I8(),1);var uZ=D8(G0(),1);var w8=D8(I8(),1);function J1(X,Z){if("error"in X){let Q=Z.deserialize(X.error);return{ok:!1,error:(0,w8.default)((0,w8.default)({},X),{},{error:Q})}}return{ok:!0,result:(0,w8.default)((0,w8.default)({},X.result),(!X.result.type||X.result.type==="data")&&{type:"data",data:Z.deserialize(X.result.data)})}}var Y0=class extends Error{constructor(){super("Unable to transform response from server")}};function W0(X,Z){let B;try{B=J1(X,Z)}catch(Q){throw new Y0}if(!B.ok&&(!m(B.error.error)||typeof B.error.error.code!=="number"))throw new Y0;if(B.ok&&!m(B.result))throw new Y0;return B}var pZ=D8(I8(),1);var nZ=Symbol();var T8=T(y(),1),t=T(x(),1);function o0(X){return X instanceof R}function w1(X){return m(X)&&m(X.error)&&typeof X.error.code==="number"&&typeof X.error.message==="string"}function T1(X,Z){if(typeof X==="string")return X;if(m(X)&&typeof X.message==="string")return X.message;return Z}var R=class X extends Error{constructor(Z,B){var Q,G;let Y=B===null||B===void 0?void 0:B.cause;super(Z,{cause:Y});(0,T8.default)(this,"cause",void 0),(0,T8.default)(this,"shape",void 0),(0,T8.default)(this,"data",void 0),(0,T8.default)(this,"meta",void 0),this.meta=B===null||B===void 0?void 0:B.meta,this.cause=Y,this.shape=B===null||B===void 0||(Q=B.result)===null||Q===void 0?void 0:Q.error,this.data=B===null||B===void 0||(G=B.result)===null||G===void 0?void 0:G.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,X.prototype)}static from(Z,B={}){let Q=Z;if(o0(Q)){if(B.meta)Q.meta=(0,t.default)((0,t.default)({},Q.meta),B.meta);return Q}if(w1(Q))return new X(Q.error.message,(0,t.default)((0,t.default)({},B),{},{result:Q}));return new X(T1(Q,"Unknown error"),(0,t.default)((0,t.default)({},B),{},{cause:Q}))}};function E8(X){let Z=X;if(!Z)return{input:{serialize:(B)=>B,deserialize:(B)=>B},output:{serialize:(B)=>B,deserialize:(B)=>B}};if("input"in Z)return Z;return{input:Z,output:Z}}var s0=(X)=>typeof X==="function";function t0(X){if(X)return X;if(typeof window<"u"&&s0(window.fetch))return window.fetch;if(typeof globalThis<"u"&&s0(globalThis.fetch))return globalThis.fetch;throw Error("No fetch implementation found")}var K8=T(x(),1);function x8(X){return{url:X.url.toString(),fetch:X.fetch,transformer:E8(X.transformer),methodOverride:X.methodOverride}}function E1(X){let Z={};for(let B=0;B<X.length;B++){let Q=X[B];Z[B]=Q}return Z}var x1={query:"GET",mutation:"POST",subscription:"PATCH"};function r0(X){return"input"in X?X.transformer.input.serialize(X.input):E1(X.inputs.map((Z)=>X.transformer.input.serialize(Z)))}var A8=(X)=>{let Z=X.url.split("?"),Q=Z[0].replace(/\/$/,"")+"/"+X.path,G=[];if(Z[1])G.push(Z[1]);if("inputs"in X)G.push("batch=1");if(X.type==="query"||X.type==="subscription"){let Y=r0(X);if(Y!==void 0&&X.methodOverride!=="POST")G.push(`input=${encodeURIComponent(JSON.stringify(Y))}`)}if(G.length)Q+="?"+G.join("&");return Q},e0=(X)=>{if(X.type==="query"&&X.methodOverride!=="POST")return;let Z=r0(X);return Z!==void 0?JSON.stringify(Z):void 0},H0=(X)=>{return ZX((0,K8.default)((0,K8.default)({},X),{},{contentTypeHeader:"application/json",getUrl:A8,getBody:e0}))},C1=class extends Error{constructor(){super("AbortError");this.name="AbortError",this.message="AbortError"}},P1=(X)=>{var Z;if(!(X===null||X===void 0?void 0:X.aborted))return;if((Z=X.throwIfAborted)===null||Z===void 0||Z.call(X),typeof DOMException<"u")throw new DOMException("AbortError","AbortError");throw new C1};async function XX(X){var Z;P1(X.signal);let B=X.getUrl(X),Q=X.getBody(X),G=(Z=X.methodOverride)!==null&&Z!==void 0?Z:x1[X.type],Y=await(async()=>{let H=await X.headers();if(Symbol.iterator in H)return Object.fromEntries(H);return H})(),W=(0,K8.default)((0,K8.default)((0,K8.default)({},X.contentTypeHeader&&G!=="GET"?{"content-type":X.contentTypeHeader}:{}),X.trpcAcceptHeader?{"trpc-accept":X.trpcAcceptHeader}:void 0),Y);return t0(X.fetch)(B,{method:G,signal:X.signal,body:Q,headers:W})}async function ZX(X){let Z={},B=await XX(X);Z.response=B;let Q=await B.json();return Z.responseJSON=Q,{json:Q,meta:Z}}var m7=T(x(),1);var BX=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function V0(X){let Z=null,B=null,Q=()=>{clearTimeout(B),B=null,Z=null};function G(H){let V=[[]],D=0;while(!0){let z=H[D];if(!z)break;let A=V[V.length-1];if(z.aborted){var q;(q=z.reject)===null||q===void 0||q.call(z,Error("Aborted")),D++;continue}if(X.validate(A.concat(z).map((K)=>K.key))){A.push(z),D++;continue}if(A.length===0){var U;(U=z.reject)===null||U===void 0||U.call(z,Error("Input is too big for a single dispatch")),D++;continue}V.push([])}return V}function Y(){let H=G(Z);Q();for(let V of H){if(!V.length)continue;let D={items:V};for(let U of V)U.batch=D;X.fetch(D.items.map((U)=>U.key)).then(async(U)=>{await Promise.all(U.map(async(A,N)=>{let K=D.items[N];try{var F;let M=await Promise.resolve(A);(F=K.resolve)===null||F===void 0||F.call(K,M)}catch(M){var J;(J=K.reject)===null||J===void 0||J.call(K,M)}K.batch=null,K.reject=null,K.resolve=null}));for(let A of D.items){var z;(z=A.reject)===null||z===void 0||z.call(A,Error("Missing result")),A.batch=null}}).catch((U)=>{for(let A of D.items){var z;(z=A.reject)===null||z===void 0||z.call(A,U),A.batch=null}})}}function W(H){var V;let D={aborted:!1,key:H,batch:null,resolve:BX,reject:BX},q=new Promise((U,z)=>{var A;D.reject=z,D.resolve=U,(A=Z)!==null&&A!==void 0||(Z=[]),Z.push(D)});return(V=B)!==null&&V!==void 0||(B=setTimeout(Y)),q}return{load:W}}function QX(...X){let Z=new AbortController,B=X.length,Q=0,G=()=>{if(++Q===B)Z.abort()};for(let Y of X)if(Y===null||Y===void 0?void 0:Y.aborted)G();else Y===null||Y===void 0||Y.addEventListener("abort",G,{once:!0});return Z.signal}var C8=T(x(),1);function D0(X){var Z,B;let Q=x8(X),G=(Z=X.maxURLLength)!==null&&Z!==void 0?Z:1/0,Y=(B=X.maxItems)!==null&&B!==void 0?B:1/0;return()=>{let W=(q)=>{return{validate(U){if(G===1/0&&Y===1/0)return!0;if(U.length>Y)return!1;let z=U.map((K)=>K.path).join(","),A=U.map((K)=>K.input);return A8((0,C8.default)((0,C8.default)({},Q),{},{type:q,path:z,inputs:A,signal:null})).length<=G},async fetch(U){let z=U.map((M)=>M.path).join(","),A=U.map((M)=>M.input),N=QX(...U.map((M)=>M.signal)),K=await H0((0,C8.default)((0,C8.default)({},Q),{},{path:z,inputs:A,type:q,headers(){if(!X.headers)return{};if(typeof X.headers==="function")return X.headers({opList:U});return X.headers},signal:N}));return(Array.isArray(K.json)?K.json:U.map(()=>K.json)).map((M)=>({meta:K.meta,json:M}))}}},H=V0(W("query")),V=V0(W("mutation")),D={query:H,mutation:V};return({op:q})=>{return g((U)=>{if(q.type==="subscription")throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let A=D[q.type].load(q),N=void 0;return A.then((K)=>{N=K;let F=W0(K.json,Q.transformer.output);if(!F.ok){U.error(R.from(F.error,{meta:K.meta}));return}U.next({context:K.meta,result:F.result}),U.complete()}).catch((K)=>{U.error(R.from(K,{meta:N===null||N===void 0?void 0:N.meta}))}),()=>{}})}}}var i7=T(x(),1);var K0=(X,...Z)=>{return typeof X==="function"?X(...Z):X},e7=T(y(),1);function R1(){let X,Z;return{promise:new Promise((Q,G)=>{X=Q,Z=G}),resolve:X,reject:Z}}async function O1(X){let Z=await K0(X.url);if(!X.connectionParams)return Z;let Q=`${Z.includes("?")?"&":"?"}connectionParams=1`;return Z+Q}async function k1(X){let Z={method:"connectionParams",data:await K0(X)};return JSON.stringify(Z)}var XB=T(y(),1);var u=T(y(),1);function S1(X){let{promise:Z,resolve:B,reject:Q}=R1();return X.addEventListener("open",()=>{X.removeEventListener("error",Q),B()}),X.addEventListener("error",Q),Z}function $1(X,{intervalMs:Z,pongTimeoutMs:B}){let Q,G;function Y(){Q=setTimeout(()=>{X.send("PING"),G=setTimeout(()=>{X.close()},B)},Z)}function W(){clearTimeout(Q),Y()}function H(){clearTimeout(G),W()}X.addEventListener("open",Y),X.addEventListener("message",({data:V})=>{if(clearTimeout(Q),Y(),V==="PONG")H()}),X.addEventListener("close",()=>{clearTimeout(Q),clearTimeout(G)})}var f1=class X{constructor(Z){var B;if((0,u.default)(this,"id",++X.connectCount),(0,u.default)(this,"WebSocketPonyfill",void 0),(0,u.default)(this,"urlOptions",void 0),(0,u.default)(this,"keepAliveOpts",void 0),(0,u.default)(this,"wsObservable",M8(null)),(0,u.default)(this,"openPromise",null),this.WebSocketPonyfill=(B=Z.WebSocketPonyfill)!==null&&B!==void 0?B:WebSocket,!this.WebSocketPonyfill)throw 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=Z.urlOptions,this.keepAliveOpts=Z.keepAlive}get ws(){return this.wsObservable.get()}set ws(Z){this.wsObservable.next(Z)}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 Z=this;if(Z.openPromise)return Z.openPromise;Z.id=++X.connectCount;let B=O1(Z.urlOptions).then((Q)=>new Z.WebSocketPonyfill(Q));Z.openPromise=B.then(async(Q)=>{if(Z.ws=Q,Q.addEventListener("message",function({data:G}){if(G==="PING")this.send("PONG")}),Z.keepAliveOpts.enabled)$1(Q,Z.keepAliveOpts);if(Q.addEventListener("close",()=>{if(Z.ws===Q)Z.ws=null}),await S1(Q),Z.urlOptions.connectionParams)Q.send(await k1(Z.urlOptions.connectionParams))});try{await Z.openPromise}finally{Z.openPromise=null}}async close(){var Z=this;try{await Z.openPromise}finally{var B;(B=Z.ws)===null||B===void 0||B.close()}}};(0,u.default)(f1,"connectCount",0);var ZB=T(y(),1),BB=T(x(),1);var A0=T(y(),1),GX=T(x(),1),j1=class{constructor(X){(0,A0.default)(this,"links",void 0),(0,A0.default)(this,"runtime",void 0),(0,A0.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=X.links.map((Z)=>Z(this.runtime))}$request(X){var Z;return b0({links:this.links,op:(0,GX.default)((0,GX.default)({},X),{},{context:(Z=X.context)!==null&&Z!==void 0?Z:{},id:++this.requestId})}).pipe(B0())}async requestAsPromise(X){var Z=this;try{let B=Z.$request(X);return(await Z0(B)).result.data}catch(B){throw R.from(B)}}query(X,Z,B){return this.requestAsPromise({type:"query",path:X,input:Z,context:B===null||B===void 0?void 0:B.context,signal:B===null||B===void 0?void 0:B.signal})}mutation(X,Z,B){return this.requestAsPromise({type:"mutation",path:X,input:Z,context:B===null||B===void 0?void 0:B.context,signal:B===null||B===void 0?void 0:B.signal})}subscription(X,Z,B){return this.$request({type:"subscription",path:X,input:Z,context:B.context,signal:B.signal}).subscribe({next(G){switch(G.result.type){case"state":{var Y;(Y=B.onConnectionStateChange)===null||Y===void 0||Y.call(B,G.result);break}case"started":{var W;(W=B.onStarted)===null||W===void 0||W.call(B,{context:G.context});break}case"stopped":{var H;(H=B.onStopped)===null||H===void 0||H.call(B);break}case"data":case void 0:{var V;(V=B.onData)===null||V===void 0||V.call(B,G.result.data);break}}},error(G){var Y;(Y=B.onError)===null||Y===void 0||Y.call(B,G)},complete(){var G;(G=B.onComplete)===null||G===void 0||G.call(B)}})}};var y1=Symbol.for("trpc_untypedClient"),g1={query:"query",mutate:"mutation",subscribe:"subscription"},h1=(X)=>{return g1[X]};function v1(X){let Z=L8(({path:B,args:Q})=>{let G=[...B],Y=h1(G.pop()),W=G.join(".");return X[Y](W,...Q)});return Q0((B)=>{if(B===y1)return X;return Z[B]})}function YX(X){let Z=new j1(X);return v1(Z)}var SB=T(x(),1);var $B=T(x(),1);var m1=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(X,Z){function B(G){var Y,W,H,V=2;for(typeof Symbol<"u"&&(W=Symbol.asyncIterator,H=Symbol.iterator);V--;){if(W&&(Y=G[W])!=null)return Y.call(G);if(H&&(Y=G[H])!=null)return new Q(Y.call(G));W="@@asyncIterator",H="@@iterator"}throw TypeError("Object is not async iterable")}function Q(G){function Y(W){if(Object(W)!==W)return Promise.reject(TypeError(W+" is not an object."));var H=W.done;return Promise.resolve(W.value).then(function(V){return{value:V,done:H}})}return Q=function(H){this.s=H,this.n=H.next},Q.prototype={s:null,n:null,next:function(){return Y(this.n.apply(this.s,arguments))},return:function(H){var V=this.s.return;return V===void 0?Promise.resolve({value:H,done:!0}):Y(V.apply(this.s,arguments))},throw:function(H){var V=this.s.return;return V===void 0?Promise.reject(H):Y(V.apply(this.s,arguments))}},new Q(G)}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),fB=T(m1(),1);var jB=T(x(),1);var _1=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(X,Z){function B(){var Q=typeof SuppressedError=="function"?SuppressedError:function(H,V){var D=Error();return D.name="SuppressedError",D.error=H,D.suppressed=V,D},G={},Y=[];function W(H,V){if(V!=null){if(Object(V)!==V)throw TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(H)var D=V[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(D===void 0&&(D=V[Symbol.dispose||Symbol.for("Symbol.dispose")],H))var q=D;if(typeof D!="function")throw TypeError("Object is not disposable.");q&&(D=function(){try{q.call(V)}catch(z){return Promise.reject(z)}}),Y.push({v:V,d:D,a:H})}else H&&Y.push({d:V,a:H});return V}return{e:G,u:W.bind(null,!1),a:W.bind(null,!0),d:function(){var V,D=this.e,q=0;function U(){for(;V=Y.pop();)try{if(!V.a&&q===1)return q=0,Y.push(V),Promise.resolve().then(U);if(V.d){var A=V.d.call(V.v);if(V.a)return q|=2,Promise.resolve(A).then(U,z)}else q|=1}catch(N){return z(N)}if(q===1)return D!==G?Promise.reject(D):Promise.resolve();if(D!==G)throw D}function z(A){return D=D!==G?new Q(A,D):A,U()}return U()}}}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),WX=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(X,Z){function B(Q,G){this.v=Q,this.k=G}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),d1=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(X,Z){var B=WX();function Q(G){return new B(G,0)}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),b1=S({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(X,Z){var B=WX();function Q(Y){return function(){return new G(Y.apply(this,arguments))}}function G(Y){var W,H;function V(q,U){try{var z=Y[q](U),A=z.value,N=A instanceof B;Promise.resolve(N?A.v:A).then(function(K){if(N){var F=q==="return"?"return":"next";if(!A.k||K.done)return V(F,K);K=Y[F](K).value}D(z.done?"return":"normal",K)},function(K){V("throw",K)})}catch(K){D("throw",K)}}function D(q,U){switch(q){case"return":W.resolve({value:U,done:!0});break;case"throw":W.reject(U);break;default:W.resolve({value:U,done:!1})}(W=W.next)?V(W.key,W.arg):H=null}this._invoke=function(q,U){return new Promise(function(z,A){var N={key:q,arg:U,resolve:z,reject:A,next:null};H?H=H.next=N:(W=H=N,V(q,U))})},typeof Y.return!="function"&&(this.return=void 0)}G.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},G.prototype.next=function(Y){return this._invoke("next",Y)},G.prototype.throw=function(Y){return this._invoke("throw",Y)},G.prototype.return=function(Y){return this._invoke("return",Y)},Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),yB=T(_1(),1),gB=T(d1(),1),hB=T(b1(),1),vB=T(x(),1);class U0{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(X,Z){this.keyToValue.set(X,Z),this.valueToKey.set(Z,X)}getByKey(X){return this.keyToValue.get(X)}getByValue(X){return this.valueToKey.get(X)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class U8{constructor(X){this.generateIdentifier=X,this.kv=new U0}register(X,Z){if(this.kv.getByValue(X))return;if(!Z)Z=this.generateIdentifier(X);this.kv.set(Z,X)}clear(){this.kv.clear()}getIdentifier(X){return this.kv.getByValue(X)}getValue(X){return this.kv.getByKey(X)}}class q0 extends U8{constructor(){super((X)=>X.name);this.classToAllowedProps=new Map}register(X,Z){if(typeof Z==="object"){if(Z.allowProps)this.classToAllowedProps.set(X,Z.allowProps);super.register(X,Z.identifier)}else super.register(X,Z)}getAllowedProps(X){return this.classToAllowedProps.get(X)}}function l1(X){if("values"in Object)return Object.values(X);let Z=[];for(let B in X)if(X.hasOwnProperty(B))Z.push(X[B]);return Z}function HX(X,Z){let B=l1(X);if("find"in B)return B.find(Z);let Q=B;for(let G=0;G<Q.length;G++){let Y=Q[G];if(Z(Y))return Y}return}function p(X,Z){Object.entries(X).forEach(([B,Q])=>Z(Q,B))}function r(X,Z){return X.indexOf(Z)!==-1}function z0(X,Z){for(let B=0;B<X.length;B++){let Q=X[B];if(Z(Q))return Q}return}class N0{constructor(){this.transfomers={}}register(X){this.transfomers[X.name]=X}findApplicable(X){return HX(this.transfomers,(Z)=>Z.isApplicable(X))}findByName(X){return this.transfomers[X]}}var c1=(X)=>Object.prototype.toString.call(X).slice(8,-1),F0=(X)=>typeof X>"u",u1=(X)=>X===null,n=(X)=>{if(typeof X!=="object"||X===null)return!1;if(X===Object.prototype)return!1;if(Object.getPrototypeOf(X)===null)return!0;return Object.getPrototypeOf(X)===Object.prototype},P8=(X)=>n(X)&&Object.keys(X).length===0,$=(X)=>Array.isArray(X),p1=(X)=>typeof X==="string",n1=(X)=>typeof X==="number"&&!isNaN(X),i1=(X)=>typeof X==="boolean",VX=(X)=>X instanceof RegExp,_=(X)=>X instanceof Map,d=(X)=>X instanceof Set,J0=(X)=>c1(X)==="Symbol",DX=(X)=>X instanceof Date&&!isNaN(X.valueOf()),R8=(X)=>X instanceof Error,M0=(X)=>typeof X==="number"&&isNaN(X),KX=(X)=>i1(X)||u1(X)||F0(X)||n1(X)||p1(X)||J0(X),AX=(X)=>typeof X==="bigint",UX=(X)=>X===1/0||X===-1/0,qX=(X)=>ArrayBuffer.isView(X)&&!(X instanceof DataView),zX=(X)=>X instanceof URL;var O8=(X)=>X.replace(/\\/g,"\\\\").replace(/\./g,"\\."),k8=(X)=>X.map(String).map(O8).join("."),e=(X,Z)=>{let B=[],Q="";for(let Y=0;Y<X.length;Y++){let W=X.charAt(Y);if(!Z&&W==="\\"){let D=X.charAt(Y+1);if(D==="\\"){Q+="\\",Y++;continue}else if(D!==".")throw Error("invalid path")}if(W==="\\"&&X.charAt(Y+1)==="."){Q+=".",Y++;continue}if(W==="."){B.push(Q),Q="";continue}Q+=W}let G=Q;return B.push(G),B};function h(X,Z,B,Q){return{isApplicable:X,annotation:Z,transform:B,untransform:Q}}var NX=[h(F0,"undefined",()=>null,()=>{return}),h(AX,"bigint",(X)=>X.toString(),(X)=>{if(typeof BigInt<"u")return BigInt(X);return console.error("Please add a BigInt polyfill."),X}),h(DX,"Date",(X)=>X.toISOString(),(X)=>new Date(X)),h(R8,"Error",(X,Z)=>{let B={name:X.name,message:X.message};if("cause"in X)B.cause=X.cause;return Z.allowedErrorProps.forEach((Q)=>{B[Q]=X[Q]}),B},(X,Z)=>{let B=Error(X.message,{cause:X.cause});return B.name=X.name,B.stack=X.stack,Z.allowedErrorProps.forEach((Q)=>{B[Q]=X[Q]}),B}),h(VX,"regexp",(X)=>""+X,(X)=>{let Z=X.slice(1,X.lastIndexOf("/")),B=X.slice(X.lastIndexOf("/")+1);return new RegExp(Z,B)}),h(d,"set",(X)=>[...X.values()],(X)=>new Set(X)),h(_,"map",(X)=>[...X.entries()],(X)=>new Map(X)),h((X)=>M0(X)||UX(X),"number",(X)=>{if(M0(X))return"NaN";if(X>0)return"Infinity";else return"-Infinity"},Number),h((X)=>X===0&&1/X===-1/0,"number",()=>{return"-0"},Number),h(zX,"URL",(X)=>X.toString(),(X)=>new URL(X))];function S8(X,Z,B,Q){return{isApplicable:X,annotation:Z,transform:B,untransform:Q}}var FX=S8((X,Z)=>{if(J0(X))return!!Z.symbolRegistry.getIdentifier(X);return!1},(X,Z)=>{return["symbol",Z.symbolRegistry.getIdentifier(X)]},(X)=>X.description,(X,Z,B)=>{let Q=B.symbolRegistry.getValue(Z[1]);if(!Q)throw Error("Trying to deserialize unknown symbol");return Q}),a1=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((X,Z)=>{return X[Z.name]=Z,X},{}),JX=S8(qX,(X)=>["typed-array",X.constructor.name],(X)=>[...X],(X,Z)=>{let B=a1[Z[1]];if(!B)throw Error("Trying to deserialize unknown typed array");return new B(X)});function L0(X,Z){if(X?.constructor)return!!Z.classRegistry.getIdentifier(X.constructor);return!1}var MX=S8(L0,(X,Z)=>{return["class",Z.classRegistry.getIdentifier(X.constructor)]},(X,Z)=>{let B=Z.classRegistry.getAllowedProps(X.constructor);if(!B)return{...X};let Q={};return B.forEach((G)=>{Q[G]=X[G]}),Q},(X,Z,B)=>{let Q=B.classRegistry.getValue(Z[1]);if(!Q)throw Error(`Trying to deserialize unknown class '${Z[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(Q.prototype),X)}),LX=S8((X,Z)=>{return!!Z.customTransformerRegistry.findApplicable(X)},(X,Z)=>{return["custom",Z.customTransformerRegistry.findApplicable(X).name]},(X,Z)=>{return Z.customTransformerRegistry.findApplicable(X).serialize(X)},(X,Z,B)=>{let Q=B.customTransformerRegistry.findByName(Z[1]);if(!Q)throw Error("Trying to deserialize unknown custom value");return Q.deserialize(X)}),o1=[MX,FX,LX,JX],I0=(X,Z)=>{let B=z0(o1,(G)=>G.isApplicable(X,Z));if(B)return{value:B.transform(X,Z),type:B.annotation(X,Z)};let Q=z0(NX,(G)=>G.isApplicable(X,Z));if(Q)return{value:Q.transform(X,Z),type:Q.annotation};return},IX={};NX.forEach((X)=>{IX[X.annotation]=X});var wX=(X,Z,B)=>{if($(Z))switch(Z[0]){case"symbol":return FX.untransform(X,Z,B);case"class":return MX.untransform(X,Z,B);case"custom":return LX.untransform(X,Z,B);case"typed-array":return JX.untransform(X,Z,B);default:throw Error("Unknown transformation: "+Z)}else{let Q=IX[Z];if(!Q)throw Error("Unknown transformation: "+Z);return Q.untransform(X,B)}};var X8=(X,Z)=>{if(Z>X.size)throw Error("index out of bounds");let B=X.keys();while(Z>0)B.next(),Z--;return B.next().value};function TX(X){if(r(X,"__proto__"))throw Error("__proto__ is not allowed as a property");if(r(X,"prototype"))throw Error("prototype is not allowed as a property");if(r(X,"constructor"))throw Error("constructor is not allowed as a property")}var EX=(X,Z)=>{TX(Z);for(let B=0;B<Z.length;B++){let Q=Z[B];if(d(X))X=X8(X,+Q);else if(_(X)){let G=+Q,Y=+Z[++B]===0?"key":"value",W=X8(X,G);switch(Y){case"key":X=W;break;case"value":X=X.get(W);break}}else X=X[Q]}return X},$8=(X,Z,B)=>{if(TX(Z),Z.length===0)return B(X);let Q=X;for(let Y=0;Y<Z.length-1;Y++){let W=Z[Y];if($(Q)){let H=+W;Q=Q[H]}else if(n(Q))Q=Q[W];else if(d(Q)){let H=+W;Q=X8(Q,H)}else if(_(Q)){if(Y===Z.length-2)break;let V=+W,D=+Z[++Y]===0?"key":"value",q=X8(Q,V);switch(D){case"key":Q=q;break;case"value":Q=Q.get(q);break}}}let G=Z[Z.length-1];if($(Q))Q[+G]=B(Q[+G]);else if(n(Q))Q[G]=B(Q[G]);if(d(Q)){let Y=X8(Q,+G),W=B(Y);if(Y!==W)Q.delete(Y),Q.add(W)}if(_(Q)){let Y=+Z[Z.length-2],W=X8(Q,Y);switch(+G===0?"key":"value"){case"key":{let V=B(W);if(Q.set(V,Q.get(W)),V!==W)Q.delete(W);break}case"value":{Q.set(W,B(Q.get(W)));break}}}return X};var xX=(X)=>X<1;function w0(X,Z,B,Q=[]){if(!X)return;let G=xX(B);if(!$(X)){p(X,(H,V)=>w0(H,Z,B,[...Q,...e(V,G)]));return}let[Y,W]=X;if(W)p(W,(H,V)=>{w0(H,Z,B,[...Q,...e(V,G)])});Z(Y,Q)}function CX(X,Z,B,Q){return w0(Z,(G,Y)=>{X=$8(X,Y,(W)=>wX(W,G,Q))},B),X}function PX(X,Z,B){let Q=xX(B);function G(Y,W){let H=EX(X,e(W,Q));Y.map((V)=>e(V,Q)).forEach((V)=>{X=$8(X,V,()=>H)})}if($(Z)){let[Y,W]=Z;if(Y.forEach((H)=>{X=$8(X,e(H,Q),()=>X)}),W)p(W,G)}else p(Z,G);return X}var s1=(X,Z)=>n(X)||$(X)||_(X)||d(X)||R8(X)||L0(X,Z);function t1(X,Z,B){let Q=B.get(X);if(Q)Q.push(Z);else B.set(X,[Z])}function RX(X,Z){let B={},Q=void 0;if(X.forEach((G)=>{if(G.length<=1)return;if(!Z)G=G.map((H)=>H.map(String)).sort((H,V)=>H.length-V.length);let[Y,...W]=G;if(Y.length===0)Q=W.map(k8);else B[k8(Y)]=W.map(k8)}),Q)if(P8(B))return[Q];else return[Q,B];else return P8(B)?void 0:B}var T0=(X,Z,B,Q,G=[],Y=[],W=new Map)=>{let H=KX(X);if(!H){t1(X,G,Z);let A=W.get(X);if(A)return Q?{transformedValue:null}:A}if(!s1(X,B)){let A=I0(X,B),N=A?{transformedValue:A.value,annotations:[A.type]}:{transformedValue:X};if(!H)W.set(X,N);return N}if(r(Y,X))return{transformedValue:null};let V=I0(X,B),D=V?.value??X,q=$(D)?[]:{},U={};p(D,(A,N)=>{if(N==="__proto__"||N==="constructor"||N==="prototype")throw Error(`Detected property ${N}. This is a prototype pollution risk, please remove it from your object.`);let K=T0(A,Z,B,Q,[...G,N],[...Y,X],W);if(q[N]=K.transformedValue,$(K.annotations))U[O8(N)]=K.annotations;else if(n(K.annotations))p(K.annotations,(F,J)=>{U[O8(N)+"."+J]=F})});let z=P8(U)?{transformedValue:q,annotations:V?[V.type]:void 0}:{transformedValue:q,annotations:V?[V.type,U]:U};if(!H)W.set(X,z);return z};function f8(X){return Object.prototype.toString.call(X).slice(8,-1)}function j8(X){return f8(X)==="Array"}function E0(X){if(f8(X)!=="Object")return!1;let Z=Object.getPrototypeOf(X);return!!Z&&Z.constructor===Object&&Z===Object.prototype}function r1(X,Z,B,Q,G){let Y={}.propertyIsEnumerable.call(Q,Z)?"enumerable":"nonenumerable";if(Y==="enumerable")X[Z]=B;if(G&&Y==="nonenumerable")Object.defineProperty(X,Z,{value:B,enumerable:!1,writable:!0,configurable:!0})}function y8(X,Z={}){if(j8(X))return X.map((G)=>y8(G,Z));if(!E0(X))return X;let B=Object.getOwnPropertyNames(X),Q=Object.getOwnPropertySymbols(X);return[...B,...Q].reduce((G,Y)=>{if(Y==="__proto__")return G;if(j8(Z.props)&&!Z.props.includes(Y))return G;let W=X[Y],H=y8(W,Z);return r1(G,Y,H,X,Z.nonenumerable),G},{})}class L{constructor({dedupe:X=!1}={}){this.classRegistry=new q0,this.symbolRegistry=new U8((Z)=>Z.description??""),this.customTransformerRegistry=new N0,this.allowedErrorProps=[],this.dedupe=X}serialize(X){let Z=new Map,B=T0(X,Z,this,this.dedupe),Q={json:B.transformedValue};if(B.annotations)Q.meta={...Q.meta,values:B.annotations};let G=RX(Z,this.dedupe);if(G)Q.meta={...Q.meta,referentialEqualities:G};if(Q.meta)Q.meta.v=1;return Q}deserialize(X,Z){let{json:B,meta:Q}=X,G=Z?.inPlace?B:y8(B);if(Q?.values)G=CX(G,Q.values,Q.v??0,this);if(Q?.referentialEqualities)G=PX(G,Q.referentialEqualities,Q.v??0);return G}stringify(X){return JSON.stringify(this.serialize(X))}parse(X){return this.deserialize(JSON.parse(X),{inPlace:!0})}registerClass(X,Z){this.classRegistry.register(X,Z)}registerSymbol(X,Z){this.symbolRegistry.register(X,Z)}registerCustom(X,Z){this.customTransformerRegistry.register({name:Z,...X})}allowErrorProps(...X){this.allowedErrorProps.push(...X)}}L.defaultInstance=new L;L.serialize=L.defaultInstance.serialize.bind(L.defaultInstance);L.deserialize=L.defaultInstance.deserialize.bind(L.defaultInstance);L.stringify=L.defaultInstance.stringify.bind(L.defaultInstance);L.parse=L.defaultInstance.parse.bind(L.defaultInstance);L.registerClass=L.defaultInstance.registerClass.bind(L.defaultInstance);L.registerSymbol=L.defaultInstance.registerSymbol.bind(L.defaultInstance);L.registerCustom=L.defaultInstance.registerCustom.bind(L.defaultInstance);L.allowErrorProps=L.defaultInstance.allowErrorProps.bind(L.defaultInstance);var q8=L;var{serialize:xQ,deserialize:CQ,stringify:PQ,parse:RQ,registerClass:OQ,registerCustom:kQ,registerSymbol:SQ,allowErrorProps:$Q}=L;var e1=new TextEncoder,XZ=new TextDecoder;function x0(X){let Z=e1.encode(X),B="";for(let Q of Z)B+=String.fromCharCode(Q);return btoa(B)}function ZZ(X){let Z=atob(X),B=new Uint8Array(Z.length);for(let Q=0;Q<Z.length;Q++)B[Q]=Z.charCodeAt(Q);return XZ.decode(B)}class C0{dbName;storeName;version;db;initP;constructor(X,Z="kv",B=1){this.dbName=X;this.storeName=Z;this.version=B;this.initP=this.open()}async open(){this.db=await new Promise((X,Z)=>{let B=indexedDB.open(this.dbName,this.version);B.onupgradeneeded=()=>{let Q=B.result;if(!Q.objectStoreNames.contains(this.storeName))Q.createObjectStore(this.storeName)},B.onsuccess=()=>{B.result.onversionchange=()=>B.result.close(),X(B.result)},B.onerror=()=>Z(B.error)})}async withTx(X,Z){return await this.initP,new Promise((B,Q)=>{let G=this.db.transaction(this.storeName,X),Y=G.objectStore(this.storeName),W;try{W=Z(Y)}catch(V){G.abort(),Q(V);return}let H;if(W)W.onsuccess=()=>H=W.result,W.onerror=()=>Q(W.error);G.oncomplete=()=>B(H),G.onerror=()=>Q(G.error),G.onabort=()=>Q(G.error)})}async get(X){let Z=x0(X);return await this.withTx("readonly",(Q)=>Q.get(Z))??null}async set(X,Z){let B=x0(X);await this.withTx("readwrite",(Q)=>Q.put(Z,B))}async del(X){let Z=x0(X);await this.withTx("readwrite",(B)=>B.delete(Z))}async clear(){await this.withTx("readwrite",(X)=>X.clear())}async keys(){let X=await this.withTx("readonly",(B)=>B.getAllKeys()),Z=new Set;for(let B of X){if(typeof B!=="string")continue;try{Z.add(ZZ(B))}catch{}}return Z}}class P0{maxSize;map=new Map;constructor(X){this.maxSize=X;if(X<=0)throw Error("maxSize must be > 0")}get(X){let Z=this.map.get(X);if(Z===void 0)return;return this.map.delete(X),this.map.set(X,Z),Z}set(X,Z){if(this.map.has(X))this.map.delete(X);if(this.map.set(X,Z),this.map.size>this.maxSize){let B=this.map.keys().next().value;this.map.delete(B)}}delete(X){this.map.delete(X)}clear(){this.map.clear()}keys(){return this.map.keys()}}function Z8(){try{return typeof window==="object"}catch(X){return!1}}function R0(){let X=(Q)=>Q.buffer.slice(Q.byteOffset,Q.byteOffset+Q.byteLength),Z=(Q)=>new Uint8Array(Q);if(!Z8()||!("indexedDB"in globalThis)){let Q=new P0(500);return{async getBytes(G){let Y=Q.get(G);return Y?new Uint8Array(Y):null},async setBytes(G,Y){Q.set(G,new Uint8Array(Y))},async delete(G){Q.delete(G)},async clear(){Q.clear()},async keys(){return new Set(Q.keys())}}}let B=null;try{B=new C0("sortsys-v2-cache")}catch{return R0()}return{async getBytes(Q){let G=await B.get(Q);if(!G)return null;if(G.exp!==0&&G.exp<=Date.now())return await B.del(Q),null;return Z(G.value)},async setBytes(Q,G){let Y={value:X(G),exp:Date.now()+3600000};try{await B.set(Q,Y)}catch{}},async delete(Q){try{await B.del(Q)}catch{}},async clear(){try{await B.clear()}catch{}},async keys(){try{return await B.keys()}catch{return new Set}}}}var O0=function(X,Z){return O0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,Q){B.__proto__=Q}||function(B,Q){for(var G in Q)if(Object.prototype.hasOwnProperty.call(Q,G))B[G]=Q[G]},O0(X,Z)};function z8(X,Z){if(typeof Z!=="function"&&Z!==null)throw TypeError("Class extends value "+String(Z)+" is not a constructor or null");O0(X,Z);function B(){this.constructor=X}X.prototype=Z===null?Object.create(Z):(B.prototype=Z.prototype,new B)}function OX(X,Z,B,Q){function G(Y){return Y instanceof B?Y:new B(function(W){W(Y)})}return new(B||(B=Promise))(function(Y,W){function H(q){try{D(Q.next(q))}catch(U){W(U)}}function V(q){try{D(Q.throw(q))}catch(U){W(U)}}function D(q){q.done?Y(q.value):G(q.value).then(H,V)}D((Q=Q.apply(X,Z||[])).next())})}function g8(X,Z){var B={label:0,sent:function(){if(Y[0]&1)throw Y[1];return Y[1]},trys:[],ops:[]},Q,G,Y,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=H(0),W.throw=H(1),W.return=H(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function H(D){return function(q){return V([D,q])}}function V(D){if(Q)throw TypeError("Generator is already executing.");while(W&&(W=0,D[0]&&(B=0)),B)try{if(Q=1,G&&(Y=D[0]&2?G.return:D[0]?G.throw||((Y=G.return)&&Y.call(G),0):G.next)&&!(Y=Y.call(G,D[1])).done)return Y;if(G=0,Y)D=[D[0]&2,Y.value];switch(D[0]){case 0:case 1:Y=D;break;case 4:return B.label++,{value:D[1],done:!1};case 5:B.label++,G=D[1],D=[0];continue;case 7:D=B.ops.pop(),B.trys.pop();continue;default:if((Y=B.trys,!(Y=Y.length>0&&Y[Y.length-1]))&&(D[0]===6||D[0]===2)){B=0;continue}if(D[0]===3&&(!Y||D[1]>Y[0]&&D[1]<Y[3])){B.label=D[1];break}if(D[0]===6&&B.label<Y[1]){B.label=Y[1],Y=D;break}if(Y&&B.label<Y[2]){B.label=Y[2],B.ops.push(D);break}if(Y[2])B.ops.pop();B.trys.pop();continue}D=Z.call(X,B)}catch(q){D=[6,q],G=0}finally{Q=Y=0}if(D[0]&5)throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}}function i(X){var Z=typeof Symbol==="function"&&Symbol.iterator,B=Z&&X[Z],Q=0;if(B)return B.call(X);if(X&&typeof X.length==="number")return{next:function(){if(X&&Q>=X.length)X=void 0;return{value:X&&X[Q++],done:!X}}};throw TypeError(Z?"Object is not iterable.":"Symbol.iterator is not defined.")}function B8(X,Z){var B=typeof Symbol==="function"&&X[Symbol.iterator];if(!B)return X;var Q=B.call(X),G,Y=[],W;try{while((Z===void 0||Z-- >0)&&!(G=Q.next()).done)Y.push(G.value)}catch(H){W={error:H}}finally{try{if(G&&!G.done&&(B=Q.return))B.call(Q)}finally{if(W)throw W.error}}return Y}function Q8(X,Z,B){if(B||arguments.length===2){for(var Q=0,G=Z.length,Y;Q<G;Q++)if(Y||!(Q in Z)){if(!Y)Y=Array.prototype.slice.call(Z,0,Q);Y[Q]=Z[Q]}}return X.concat(Y||Array.prototype.slice.call(Z))}function a(X){return this instanceof a?(this.v=X,this):new a(X)}function kX(X,Z,B){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var Q=B.apply(X,Z||[]),G,Y=[];return G=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),H("next"),H("throw"),H("return",W),G[Symbol.asyncIterator]=function(){return this},G;function W(A){return function(N){return Promise.resolve(N).then(A,U)}}function H(A,N){if(Q[A]){if(G[A]=function(K){return new Promise(function(F,J){Y.push([A,K,F,J])>1||V(A,K)})},N)G[A]=N(G[A])}}function V(A,N){try{D(Q[A](N))}catch(K){z(Y[0][3],K)}}function D(A){A.value instanceof a?Promise.resolve(A.value.v).then(q,U):z(Y[0][2],A)}function q(A){V("next",A)}function U(A){V("throw",A)}function z(A,N){if(A(N),Y.shift(),Y.length)V(Y[0][0],Y[0][1])}}function SX(X){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var Z=X[Symbol.asyncIterator],B;return Z?Z.call(X):(X=typeof i==="function"?i(X):X[Symbol.iterator](),B={},Q("next"),Q("throw"),Q("return"),B[Symbol.asyncIterator]=function(){return this},B);function Q(Y){B[Y]=X[Y]&&function(W){return new Promise(function(H,V){W=X[Y](W),G(H,V,W.done,W.value)})}}function G(Y,W,H,V){Promise.resolve(V).then(function(D){Y({value:D,done:H})},W)}}function w(X){return typeof X==="function"}function $X(X){var Z=function(Q){Error.call(Q),Q.stack=Error().stack},B=X(Z);return B.prototype=Object.create(Error.prototype),B.prototype.constructor=B,B}var h8=$X(function(X){return function(B){X(this),this.message=B?B.length+` errors occurred during unsubscription:
|
|
2
|
-
`+
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=B}});function k0(X,Z){if(X){var B=X.indexOf(Z);0<=B&&X.splice(B,1)}}var v8=function(){function X(Z){this.initialTeardown=Z,this.closed=!1,this._parentage=null,this._finalizers=null}return X.prototype.unsubscribe=function(){var Z,B,Q,G,Y;if(!this.closed){this.closed=!0;var W=this._parentage;if(W)if(this._parentage=null,Array.isArray(W))try{for(var H=i(W),V=H.next();!V.done;V=H.next()){var D=V.value;D.remove(this)}}catch(K){Z={error:K}}finally{try{if(V&&!V.done&&(B=H.return))B.call(H)}finally{if(Z)throw Z.error}}else W.remove(this);var q=this.initialTeardown;if(w(q))try{q()}catch(K){Y=K instanceof h8?K.errors:[K]}var U=this._finalizers;if(U){this._finalizers=null;try{for(var z=i(U),A=z.next();!A.done;A=z.next()){var N=A.value;try{fX(N)}catch(K){if(Y=Y!==null&&Y!==void 0?Y:[],K instanceof h8)Y=Q8(Q8([],B8(Y)),B8(K.errors));else Y.push(K)}}}catch(K){Q={error:K}}finally{try{if(A&&!A.done&&(G=z.return))G.call(z)}finally{if(Q)throw Q.error}}}if(Y)throw new h8(Y)}},X.prototype.add=function(Z){var B;if(Z&&Z!==this)if(this.closed)fX(Z);else{if(Z instanceof X){if(Z.closed||Z._hasParent(this))return;Z._addParent(this)}(this._finalizers=(B=this._finalizers)!==null&&B!==void 0?B:[]).push(Z)}},X.prototype._hasParent=function(Z){var B=this._parentage;return B===Z||Array.isArray(B)&&B.includes(Z)},X.prototype._addParent=function(Z){var B=this._parentage;this._parentage=Array.isArray(B)?(B.push(Z),B):B?[B,Z]:Z},X.prototype._removeParent=function(Z){var B=this._parentage;if(B===Z)this._parentage=null;else if(Array.isArray(B))k0(B,Z)},X.prototype.remove=function(Z){var B=this._finalizers;if(B&&k0(B,Z),Z instanceof X)Z._removeParent(this)},X.EMPTY=function(){var Z=new X;return Z.closed=!0,Z}(),X}();var aQ=v8.EMPTY;function m8(X){return X instanceof v8||X&&"closed"in X&&w(X.remove)&&w(X.add)&&w(X.unsubscribe)}function fX(X){if(w(X))X();else X.unsubscribe()}var f={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var G8={setTimeout:function(X,Z){var B=[];for(var Q=2;Q<arguments.length;Q++)B[Q-2]=arguments[Q];var G=G8.delegate;if(G===null||G===void 0?void 0:G.setTimeout)return G.setTimeout.apply(G,Q8([X,Z],B8(B)));return setTimeout.apply(void 0,Q8([X,Z],B8(B)))},clearTimeout:function(X){var Z=G8.delegate;return((Z===null||Z===void 0?void 0:Z.clearTimeout)||clearTimeout)(X)},delegate:void 0};function _8(X){G8.setTimeout(function(){var Z=f.onUnhandledError;if(Z)Z(X);else throw X})}function S0(){}var jX=function(){return $0("C",void 0,void 0)}();function yX(X){return $0("E",void 0,X)}function gX(X){return $0("N",X,void 0)}function $0(X,Z,B){return{kind:X,value:Z,error:B}}var o=null;function hX(X){if(f.useDeprecatedSynchronousErrorHandling){var Z=!o;if(Z)o={errorThrown:!1,error:null};if(X(),Z){var B=o,Q=B.errorThrown,G=B.error;if(o=null,Q)throw G}}else X()}function vX(X){if(f.useDeprecatedSynchronousErrorHandling&&o)o.errorThrown=!0,o.error=X}var N8=function(X){z8(Z,X);function Z(B){var Q=X.call(this)||this;if(Q.isStopped=!1,B){if(Q.destination=B,m8(B))B.add(Q)}else Q.destination=YZ;return Q}return Z.create=function(B,Q,G){return new b8(B,Q,G)},Z.prototype.next=function(B){if(this.isStopped)j0(gX(B),this);else this._next(B)},Z.prototype.error=function(B){if(this.isStopped)j0(yX(B),this);else this.isStopped=!0,this._error(B)},Z.prototype.complete=function(){if(this.isStopped)j0(jX,this);else this.isStopped=!0,this._complete()},Z.prototype.unsubscribe=function(){if(!this.closed)this.isStopped=!0,X.prototype.unsubscribe.call(this),this.destination=null},Z.prototype._next=function(B){this.destination.next(B)},Z.prototype._error=function(B){try{this.destination.error(B)}finally{this.unsubscribe()}},Z.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Z}(v8);var BZ=Function.prototype.bind;function f0(X,Z){return BZ.call(X,Z)}var QZ=function(){function X(Z){this.partialObserver=Z}return X.prototype.next=function(Z){var B=this.partialObserver;if(B.next)try{B.next(Z)}catch(Q){d8(Q)}},X.prototype.error=function(Z){var B=this.partialObserver;if(B.error)try{B.error(Z)}catch(Q){d8(Q)}else d8(Z)},X.prototype.complete=function(){var Z=this.partialObserver;if(Z.complete)try{Z.complete()}catch(B){d8(B)}},X}(),b8=function(X){z8(Z,X);function Z(B,Q,G){var Y=X.call(this)||this,W;if(w(B)||!B)W={next:B!==null&&B!==void 0?B:void 0,error:Q!==null&&Q!==void 0?Q:void 0,complete:G!==null&&G!==void 0?G:void 0};else{var H;if(Y&&f.useDeprecatedNextContext)H=Object.create(B),H.unsubscribe=function(){return Y.unsubscribe()},W={next:B.next&&f0(B.next,H),error:B.error&&f0(B.error,H),complete:B.complete&&f0(B.complete,H)};else W=B}return Y.destination=new QZ(W),Y}return Z}(N8);function d8(X){if(f.useDeprecatedSynchronousErrorHandling)vX(X);else _8(X)}function GZ(X){throw X}function j0(X,Z){var B=f.onStoppedNotification;B&&G8.setTimeout(function(){return B(X,Z)})}var YZ={closed:!0,next:S0,error:GZ,complete:S0};var Y8=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}();function l8(X){return X}function mX(X){if(X.length===0)return l8;if(X.length===1)return X[0];return function(B){return X.reduce(function(Q,G){return G(Q)},B)}}var P=function(){function X(Z){if(Z)this._subscribe=Z}return X.prototype.lift=function(Z){var B=new X;return B.source=this,B.operator=Z,B},X.prototype.subscribe=function(Z,B,Q){var G=this,Y=HZ(Z)?Z:new b8(Z,B,Q);return hX(function(){var W=G,H=W.operator,V=W.source;Y.add(H?H.call(Y,V):V?G._subscribe(Y):G._trySubscribe(Y))}),Y},X.prototype._trySubscribe=function(Z){try{return this._subscribe(Z)}catch(B){Z.error(B)}},X.prototype.forEach=function(Z,B){var Q=this;return B=_X(B),new B(function(G,Y){var W=new b8({next:function(H){try{Z(H)}catch(V){Y(V),W.unsubscribe()}},error:Y,complete:G});Q.subscribe(W)})},X.prototype._subscribe=function(Z){var B;return(B=this.source)===null||B===void 0?void 0:B.subscribe(Z)},X.prototype[Y8]=function(){return this},X.prototype.pipe=function(){var Z=[];for(var B=0;B<arguments.length;B++)Z[B]=arguments[B];return mX(Z)(this)},X.prototype.toPromise=function(Z){var B=this;return Z=_X(Z),new Z(function(Q,G){var Y;B.subscribe(function(W){return Y=W},function(W){return G(W)},function(){return Q(Y)})})},X.create=function(Z){return new X(Z)},X}();function _X(X){var Z;return(Z=X!==null&&X!==void 0?X:f.Promise)!==null&&Z!==void 0?Z:Promise}function WZ(X){return X&&w(X.next)&&w(X.error)&&w(X.complete)}function HZ(X){return X&&X instanceof N8||WZ(X)&&m8(X)}function VZ(X){return w(X===null||X===void 0?void 0:X.lift)}function b(X){return function(Z){if(VZ(Z))return Z.lift(function(B){try{return X(B,this)}catch(Q){this.error(Q)}});throw TypeError("Unable to lift unknown Observable type")}}function s(X,Z,B,Q,G){return new DZ(X,Z,B,Q,G)}var DZ=function(X){z8(Z,X);function Z(B,Q,G,Y,W,H){var V=X.call(this,B)||this;return V.onFinalize=W,V.shouldUnsubscribe=H,V._next=Q?function(D){try{Q(D)}catch(q){B.error(q)}}:X.prototype._next,V._error=Y?function(D){try{Y(D)}catch(q){B.error(q)}finally{this.unsubscribe()}}:X.prototype._error,V._complete=G?function(){try{G()}catch(D){B.error(D)}finally{this.unsubscribe()}}:X.prototype._complete,V}return Z.prototype.unsubscribe=function(){var B;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var Q=this.closed;X.prototype.unsubscribe.call(this),!Q&&((B=this.onFinalize)===null||B===void 0||B.call(this))}},Z}(N8);function dX(X){return X&&w(X.schedule)}function KZ(X){return X[X.length-1]}function bX(X){return dX(KZ(X))?X.pop():void 0}var c8=function(X){return X&&typeof X.length==="number"&&typeof X!=="function"};function u8(X){return w(X===null||X===void 0?void 0:X.then)}function p8(X){return w(X[Y8])}function n8(X){return Symbol.asyncIterator&&w(X===null||X===void 0?void 0:X[Symbol.asyncIterator])}function i8(X){return TypeError("You provided "+(X!==null&&typeof X==="object"?"an invalid object":"'"+X+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function AZ(){if(typeof Symbol!=="function"||!Symbol.iterator)return"@@iterator";return Symbol.iterator}var a8=AZ();function o8(X){return w(X===null||X===void 0?void 0:X[a8])}function s8(X){return kX(this,arguments,function(){var B,Q,G,Y;return g8(this,function(W){switch(W.label){case 0:B=X.getReader(),W.label=1;case 1:W.trys.push([1,,9,10]),W.label=2;case 2:return[4,a(B.read())];case 3:if(Q=W.sent(),G=Q.value,Y=Q.done,!Y)return[3,5];return[4,a(void 0)];case 4:return[2,W.sent()];case 5:return[4,a(G)];case 6:return[4,W.sent()];case 7:return W.sent(),[3,2];case 8:return[3,10];case 9:return B.releaseLock(),[7];case 10:return[2]}})})}function t8(X){return w(X===null||X===void 0?void 0:X.getReader)}function v(X){if(X instanceof P)return X;if(X!=null){if(p8(X))return UZ(X);if(c8(X))return qZ(X);if(u8(X))return zZ(X);if(n8(X))return lX(X);if(o8(X))return NZ(X);if(t8(X))return FZ(X)}throw i8(X)}function UZ(X){return new P(function(Z){var B=X[Y8]();if(w(B.subscribe))return B.subscribe(Z);throw TypeError("Provided object does not correctly implement Symbol.observable")})}function qZ(X){return new P(function(Z){for(var B=0;B<X.length&&!Z.closed;B++)Z.next(X[B]);Z.complete()})}function zZ(X){return new P(function(Z){X.then(function(B){if(!Z.closed)Z.next(B),Z.complete()},function(B){return Z.error(B)}).then(null,_8)})}function NZ(X){return new P(function(Z){var B,Q;try{for(var G=i(X),Y=G.next();!Y.done;Y=G.next()){var W=Y.value;if(Z.next(W),Z.closed)return}}catch(H){B={error:H}}finally{try{if(Y&&!Y.done&&(Q=G.return))Q.call(G)}finally{if(B)throw B.error}}Z.complete()})}function lX(X){return new P(function(Z){JZ(X,Z).catch(function(B){return Z.error(B)})})}function FZ(X){return lX(s8(X))}function JZ(X,Z){var B,Q,G,Y;return OX(this,void 0,void 0,function(){var W,H;return g8(this,function(V){switch(V.label){case 0:V.trys.push([0,5,6,11]),B=SX(X),V.label=1;case 1:return[4,B.next()];case 2:if(Q=V.sent(),!!Q.done)return[3,4];if(W=Q.value,Z.next(W),Z.closed)return[2];V.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return H=V.sent(),G={error:H},[3,11];case 6:if(V.trys.push([6,,9,10]),!(Q&&!Q.done&&(Y=B.return)))return[3,8];return[4,Y.call(B)];case 7:V.sent(),V.label=8;case 8:return[3,10];case 9:if(G)throw G.error;return[7];case 10:return[7];case 11:return Z.complete(),[2]}})})}function O(X,Z,B,Q,G){if(Q===void 0)Q=0;if(G===void 0)G=!1;var Y=Z.schedule(function(){if(B(),G)X.add(this.schedule(null,Q));else this.unsubscribe()},Q);if(X.add(Y),!G)return Y}function r8(X,Z){if(Z===void 0)Z=0;return b(function(B,Q){B.subscribe(s(Q,function(G){return O(Q,X,function(){return Q.next(G)},Z)},function(){return O(Q,X,function(){return Q.complete()},Z)},function(G){return O(Q,X,function(){return Q.error(G)},Z)}))})}function e8(X,Z){if(Z===void 0)Z=0;return b(function(B,Q){Q.add(X.schedule(function(){return B.subscribe(Q)},Z))})}function cX(X,Z){return v(X).pipe(e8(Z),r8(Z))}function uX(X,Z){return v(X).pipe(e8(Z),r8(Z))}function pX(X,Z){return new P(function(B){var Q=0;return Z.schedule(function(){if(Q===X.length)B.complete();else if(B.next(X[Q++]),!B.closed)this.schedule()})})}function nX(X,Z){return new P(function(B){var Q;return O(B,Z,function(){Q=X[a8](),O(B,Z,function(){var G,Y,W;try{G=Q.next(),Y=G.value,W=G.done}catch(H){B.error(H);return}if(W)B.complete();else B.next(Y)},0,!0)}),function(){return w(Q===null||Q===void 0?void 0:Q.return)&&Q.return()}})}function X0(X,Z){if(!X)throw Error("Iterable cannot be null");return new P(function(B){O(B,Z,function(){var Q=X[Symbol.asyncIterator]();O(B,Z,function(){Q.next().then(function(G){if(G.done)B.complete();else B.next(G.value)})},0,!0)})})}function iX(X,Z){return X0(s8(X),Z)}function aX(X,Z){if(X!=null){if(p8(X))return cX(X,Z);if(c8(X))return pX(X,Z);if(u8(X))return uX(X,Z);if(n8(X))return X0(X,Z);if(o8(X))return nX(X,Z);if(t8(X))return iX(X,Z)}throw i8(X)}function F8(X,Z){return Z?aX(X,Z):v(X)}function oX(X,Z){return b(function(B,Q){var G=0;B.subscribe(s(Q,function(Y){Q.next(X.call(Z,Y,G++))}))})}function sX(X,Z,B,Q,G,Y,W,H){var V=[],D=0,q=0,U=!1,z=function(){if(U&&!V.length&&!D)Z.complete()},A=function(K){return D<Q?N(K):V.push(K)},N=function(K){Y&&Z.next(K),D++;var F=!1;v(B(K,q++)).subscribe(s(Z,function(J){if(G===null||G===void 0||G(J),Y)A(J);else Z.next(J)},function(){F=!0},void 0,function(){if(F)try{D--;var J=function(){var M=V.shift();if(W)O(Z,W,function(){return N(M)});else N(M)};while(V.length&&D<Q)J();z()}catch(M){Z.error(M)}}))};return X.subscribe(s(Z,A,function(){U=!0,z()})),function(){H===null||H===void 0||H()}}function y0(X,Z,B){if(B===void 0)B=1/0;if(w(Z))return y0(function(Q,G){return oX(function(Y,W){return Z(Q,Y,G,W)})(v(X(Q,G)))},B);else if(typeof Z==="number")B=Z;return b(function(Q,G){return sX(Q,G,X,B)})}function tX(X){if(X===void 0)X=1/0;return y0(l8,X)}function rX(){return tX(1)}function g0(){var X=[];for(var Z=0;Z<arguments.length;Z++)X[Z]=arguments[Z];return rX()(F8(X,bX(X)))}function MZ(X){function Z(B){if(B===null||typeof B!=="object")return B;if(Array.isArray(B))return B.map(Z);let Q={};for(let G of Object.keys(B).sort()){let Y=B[G];if(Y===void 0||typeof Y==="function"||typeof Y==="symbol")continue;Q[G]=Z(Y)}return Q}return JSON.stringify(Z(X))}var LZ=new TextDecoder,h0=new TextEncoder;function IZ(X){return h0.encode(X)}function wZ(X){let Z=MZ(X),B=IZ(Z),Q=0xcbf29ce484222325n,G=0x100000001b3n,Y=0xffffffffffffffffn;for(let W=0;W<B.length;W++)Q^=BigInt(B[W]),Q=Q*G&Y;return Q.toString(16).padStart(16,"0")}function TZ(X){if(!(X instanceof R))return!1;return X.data?.code?.toLowerCase?.()==="unauthorized"}function y5(X,Z){let B=Z?.cache??R0(),Q=null,G=YX({links:[D0({url:X,transformer:q8,headers:(K)=>{if(!Q)return{};return{Authorization:`Bearer ${Q}`}}})]});function Y(K,F){let J=wZ(F??null);return`trpc:${K}.query:${J}`}let W={};function H(K,F){if(K in W)return W[K];let J=F().finally(()=>{setTimeout(()=>{if(W[K]===J)delete W[K]},250)});return W[K]=J,J}async function V(K){return B.getBytes(K).then((F)=>{if(!F)return null;try{return q8.parse(LZ.decode(F))}catch(J){return null}})}let D=[];function q(K){if(K.startsWith("trpc:"))K=K.split(":")[1];for(let[F,J]of D){let I=F.split(":")[1].split(".").slice(0,-1).join(".");if(K.startsWith(I))(async()=>J())()}}let U=[];function z(){for(let K of U)(async()=>K({loggedIn:!!Q}))()}let A=Object.freeze({async query(K,F,J){J??={},J.strategy??="network-first";let M=G;for(let E of`${K}.query`.split("."))M=M?.[E];if(!M)throw Error(`could not resolve query path ${K}`);let I=Y(K,F);async function j(){try{return[await H(I,()=>M(F))??null,null]}catch(E){if(E instanceof R){if(N(E),E?.code==="ConnectionRefused")return[null,null];return[null,E]}return[null,R.from(E)]}}async function W8(E){let[l,J8]=E;if(J8||!l)return await B.delete(I),[null,J8];let C=h0.encode(q8.stringify(l));return await B.setBytes(I,C),[l,null]}if(J.strategy==="cache-only")return[await V(I),null];if(J.strategy==="network-only")return await W8(await j());if(J.strategy==="cache-first"){let E=await V(I);if(E)return[E,null];return await W8(await j())}if(J.strategy==="network-first"){let[E,l]=await j();if(E)return await W8([E,null]);if(E=await V(I),E)return[E,null];return[null,l]}throw Error(`invalid strategy for _query: ${J.strategy}`)},async invalidate(K){if(K.startsWith("trpc:"))K=K.split(":")[1];function F(M){let I=M.split(".").slice(0,-1),j;if(I.length>1)j=I.slice(0,-1).join(".");else j=I.join(".");return K.startsWith(j)}let J=[];for(let M of await B.keys()){if(!M.startsWith("trpc:"))continue;let I=M.split(":")[1];if(!I.endsWith(".query"))continue;if(F(I))J.push(B.delete(M)),delete W[M]}await Promise.all(J);for(let M of Object.keys(W)){if(!M.startsWith("trpc:"))continue;let I=M.split(":")[1];if(!I.endsWith(".query"))continue;if(F(I))delete W[M]}q(K)},streamQuery(K,F,J){J??={},J.strategy??="cache-first";let M=G;for(let C of`${K}.query`.split("."))M=M?.[C];if(!M)throw Error(`could not resolve query path ${K}`);let I=Y(K,F);async function j(){try{return[await H(I,()=>M(F))??null,null]}catch(C){if(C instanceof R){if(N(C),C?.code==="ConnectionRefused")return[null,null];return[null,C]}return[null,R.from(C)]}}async function W8(C){if(!C)return await B.delete(I),null;let c=h0.encode(q8.stringify(C));return await B.setBytes(I,c),C}async function*E(){if(J.strategy==="cache-first"||J.strategy==="cache-only"){let k=await V(I);if(k)yield[k,null];if(J.strategy==="cache-only")return}let[C,c]=await W8(await j());if(yield[C,c],c&&J?.strategy==="network-first")yield[await V(I),null]}let l=F8(E()),J8=new P((C)=>{let c=async()=>{let[k,v0]=await j();if(k&&v0)C.next([k,v0])};return D.push([I,c]),()=>{for(let k=0;k<D.length;k++)if(D[k][1]===c){D.splice(k,1);return}}});return g0(l,J8)},async mutate(K,F,J){let M=G;for(let I of`${K}.mutate`.split("."))M=M?.[I];if(!M)throw Error(`could not resolve mutation path ${K}`);try{let I=await M(F);return await A.invalidate(K),[I,null]}catch(I){if(N(I),!(I instanceof Error))return[null,Error("unexpected error")];return[null,I]}},async login(K){let[F,J]=await A.mutate("auth.login",K);if(J)throw J;if(Q=F.token,Z8())localStorage.setItem("__sortsys-v2_token",Q);z()},async logout(){if(await B.clear(),!Q){if(Z8())localStorage.removeItem("__sortsys-v2_token");return}if(await A.mutate("auth.logout",void 0).catch(()=>{}),Q=null,Z8())localStorage.removeItem("__sortsys-v2_token");z()},listenAuthState:(K)=>{return U.push(K),()=>{for(let F=0;F<U.length;F++)if(U[F]===K){U.splice(F,1);return}}},async restoreSession(){if(Z8())Q=localStorage.getItem("__sortsys-v2_token"),z()},async clearCache(){return B.clear()}});function N(K){if(!TZ(K))return;A.logout().catch(()=>{})}return A}export{y5 as createClient};
|
|
1
|
+
var{create:G1,defineProperty:c0,getOwnPropertyDescriptor:Y1,getOwnPropertyNames:u0,getPrototypeOf:W1}=Object,H1=Object.prototype.hasOwnProperty,f=(X,Z)=>function(){return Z||(0,X[u0(X)[0]])((Z={exports:{}}).exports,Z),Z.exports},V1=(X,Z,Q,B)=>{if(Z&&typeof Z==="object"||typeof Z==="function"){for(var G=u0(Z),Y=0,W=G.length,H;Y<W;Y++)if(H=G[Y],!H1.call(X,H)&&H!==Q)c0(X,H,{get:((V)=>Z[V]).bind(null,H),enumerable:!(B=Y1(Z,H))||B.enumerable})}return X},T=(X,Z,Q)=>(Q=X!=null?G1(W1(X)):{},V1(Z||!X||!X.__esModule?c0(Q,"default",{value:X,enumerable:!0}):Q,X)),p0=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(X,Z){function Q(B){return Z.exports=Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(G){return typeof G}:function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},Z.exports.__esModule=!0,Z.exports.default=Z.exports,Q(B)}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),D1=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(X,Z){var Q=p0().default;function B(G,Y){if(Q(G)!="object"||!G)return G;var W=G[Symbol.toPrimitive];if(W!==void 0){var H=W.call(G,Y||"default");if(Q(H)!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Y==="string"?String:Number)(G)}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),K1=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(X,Z){var Q=p0().default,B=D1();function G(Y){var W=B(Y,"string");return Q(W)=="symbol"?W:W+""}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),g=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(X,Z){var Q=K1();function B(G,Y,W){return(Y=Q(Y))in G?Object.defineProperty(G,Y,{value:W,enumerable:!0,configurable:!0,writable:!0}):G[Y]=W,G}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),P=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(X,Z){var Q=g();function B(Y,W){var H=Object.keys(Y);if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(Y);W&&(V=V.filter(function(D){return Object.getOwnPropertyDescriptor(Y,D).enumerable})),H.push.apply(H,V)}return H}function G(Y){for(var W=1;W<arguments.length;W++){var H=arguments[W]!=null?arguments[W]:{};W%2?B(Object(H),!0).forEach(function(V){Q(Y,V,H[V])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Y,Object.getOwnPropertyDescriptors(H)):B(Object(H)).forEach(function(V){Object.defineProperty(Y,V,Object.getOwnPropertyDescriptor(H,V))})}return Y}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}});function h(X){let Z={subscribe(Q){let B=null,G=!1,Y=!1,W=!1;function H(){if(B===null){W=!0;return}if(Y)return;if(Y=!0,typeof B==="function")B();else if(B)B.unsubscribe()}if(B=X({next(V){var D;if(G)return;(D=Q.next)===null||D===void 0||D.call(Q,V)},error(V){var D;if(G)return;G=!0,(D=Q.error)===null||D===void 0||D.call(Q,V),H()},complete(){var V;if(G)return;G=!0,(V=Q.complete)===null||V===void 0||V.call(Q),H()}}),W)H();return{unsubscribe:H}},pipe(...Q){return Q.reduce(A1,Z)}};return Z}function A1(X,Z){return Z(X)}function W0(X){let Z=new AbortController;return new Promise((B,G)=>{let Y=!1;function W(){if(Y)return;Y=!0,H.unsubscribe()}Z.signal.addEventListener("abort",()=>{G(Z.signal.reason)});let H=X.subscribe({next(V){Y=!0,B(V),W()},error(V){G(V)},complete(){Z.abort(),W()}})})}function H0(X){return(Z)=>{let Q=0,B=null,G=[];function Y(){if(B)return;B=Z.subscribe({next(H){for(let D of G){var V;(V=D.next)===null||V===void 0||V.call(D,H)}},error(H){for(let D of G){var V;(V=D.error)===null||V===void 0||V.call(D,H)}},complete(){for(let V of G){var H;(H=V.complete)===null||H===void 0||H.call(V)}}})}function W(){if(Q===0&&B){let H=B;B=null,H.unsubscribe()}}return h((H)=>{return Q++,G.push(H),Y(),{unsubscribe(){Q--,W();let V=G.findIndex((D)=>D===H);if(V>-1)G.splice(V,1)}}})}}var fZ=Symbol();function T8(X){let Z=X,Q=[],B=(W)=>{if(Z!==void 0)W.next(Z);Q.push(W)},G=(W)=>{Q.splice(Q.indexOf(W),1)},Y=h((W)=>{return B(W),()=>{G(W)}});return Y.next=(W)=>{if(Z===W)return;Z=W;for(let H of Q)H.next(W)},Y.get=()=>Z,Y}function n0(X){return h((Z)=>{function Q(G=0,Y=X.op){let W=X.links[G];if(!W)throw Error("No more links to execute - did you forget to add an ending link?");return W({op:Y,next(V){return Q(G+1,V)}})}return Q().subscribe(Z)})}var A8={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};var i0=[A8.BAD_GATEWAY,A8.SERVICE_UNAVAILABLE,A8.GATEWAY_TIMEOUT,A8.INTERNAL_SERVER_ERROR];function _(X){return!!X&&!Array.isArray(X)&&typeof X==="object"}var{create:q1,defineProperty:o0,getOwnPropertyDescriptor:U1,getOwnPropertyNames:s0,getPrototypeOf:z1}=Object,N1=Object.prototype.hasOwnProperty,q8=(X,Z)=>function(){return Z||(0,X[s0(X)[0]])((Z={exports:{}}).exports,Z),Z.exports},F1=(X,Z,Q,B)=>{if(Z&&typeof Z==="object"||typeof Z==="function"){for(var G=s0(Z),Y=0,W=G.length,H;Y<W;Y++)if(H=G[Y],!N1.call(X,H)&&H!==Q)o0(X,H,{get:((V)=>Z[V]).bind(null,H),enumerable:!(B=U1(Z,H))||B.enumerable})}return X},U8=(X,Z,Q)=>(Q=X!=null?q1(z1(X)):{},F1(Z||!X||!X.__esModule?o0(Q,"default",{value:X,enumerable:!0}):Q,X)),t0=()=>{},a0=(X)=>{if(Object.freeze)Object.freeze(X)};function r0(X,Z,Q){var B;let G=Z.join(".");return(B=Q[G])!==null&&B!==void 0||(Q[G]=new Proxy(t0,{get(Y,W){if(typeof W!=="string"||W==="then")return;return r0(X,[...Z,W],Q)},apply(Y,W,H){let V=Z[Z.length-1],D={args:H,path:Z};if(V==="call")D={args:H.length>=2?[H[1]]:[],path:Z.slice(0,-1)};else if(V==="apply")D={args:H.length>=2?H[1]:[],path:Z.slice(0,-1)};return a0(D.args),a0(D.path),X(D)}})),Q[G]}var E8=(X)=>r0(X,[],Object.create(null)),V0=(X)=>{return new Proxy(t0,{get(Z,Q){if(Q==="then")return;return X(Q)}})};var e0=q8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(X,Z){function Q(B){return Z.exports=Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(G){return typeof G}:function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},Z.exports.__esModule=!0,Z.exports.default=Z.exports,Q(B)}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),J1=q8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(X,Z){var Q=e0().default;function B(G,Y){if(Q(G)!="object"||!G)return G;var W=G[Symbol.toPrimitive];if(W!==void 0){var H=W.call(G,Y||"default");if(Q(H)!="object")return H;throw TypeError("@@toPrimitive must return a primitive value.")}return(Y==="string"?String:Number)(G)}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),M1=q8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(X,Z){var Q=e0().default,B=J1();function G(Y){var W=B(Y,"string");return Q(W)=="symbol"?W:W+""}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),D0=q8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(X,Z){var Q=M1();function B(G,Y,W){return(Y=Q(Y))in G?Object.defineProperty(G,Y,{value:W,enumerable:!0,configurable:!0,writable:!0}):G[Y]=W,G}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),x8=q8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(X,Z){var Q=D0();function B(Y,W){var H=Object.keys(Y);if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(Y);W&&(V=V.filter(function(D){return Object.getOwnPropertyDescriptor(Y,D).enumerable})),H.push.apply(H,V)}return H}function G(Y){for(var W=1;W<arguments.length;W++){var H=arguments[W]!=null?arguments[W]:{};W%2?B(Object(H),!0).forEach(function(V){Q(Y,V,H[V])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Y,Object.getOwnPropertyDescriptors(H)):B(Object(H)).forEach(function(V){Object.defineProperty(Y,V,Object.getOwnPropertyDescriptor(H,V))})}return Y}Z.exports=G,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),pZ=U8(x8(),1);var oZ=U8(D0(),1);var C8=U8(x8(),1);function T1(X,Z){if("error"in X){let B=Z.deserialize(X.error);return{ok:!1,error:(0,C8.default)((0,C8.default)({},X),{},{error:B})}}return{ok:!0,result:(0,C8.default)((0,C8.default)({},X.result),(!X.result.type||X.result.type==="data")&&{type:"data",data:Z.deserialize(X.result.data)})}}var K0=class extends Error{constructor(){super("Unable to transform response from server")}};function A0(X,Z){let Q;try{Q=T1(X,Z)}catch(B){throw new K0}if(!Q.ok&&(!_(Q.error.error)||typeof Q.error.error.code!=="number"))throw new K0;if(Q.ok&&!_(Q.result))throw new K0;return Q}var sZ=U8(x8(),1);var tZ=Symbol();var P8=T(g(),1),e=T(P(),1);function XX(X){return X instanceof O}function P1(X){return _(X)&&_(X.error)&&typeof X.error.code==="number"&&typeof X.error.message==="string"}function R1(X,Z){if(typeof X==="string")return X;if(_(X)&&typeof X.message==="string")return X.message;return Z}var O=class X extends Error{constructor(Z,Q){var B,G;let Y=Q===null||Q===void 0?void 0:Q.cause;super(Z,{cause:Y});(0,P8.default)(this,"cause",void 0),(0,P8.default)(this,"shape",void 0),(0,P8.default)(this,"data",void 0),(0,P8.default)(this,"meta",void 0),this.meta=Q===null||Q===void 0?void 0:Q.meta,this.cause=Y,this.shape=Q===null||Q===void 0||(B=Q.result)===null||B===void 0?void 0:B.error,this.data=Q===null||Q===void 0||(G=Q.result)===null||G===void 0?void 0:G.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,X.prototype)}static from(Z,Q={}){let B=Z;if(XX(B)){if(Q.meta)B.meta=(0,e.default)((0,e.default)({},B.meta),Q.meta);return B}if(P1(B))return new X(B.error.message,(0,e.default)((0,e.default)({},Q),{},{result:B}));return new X(R1(B,"Unknown error"),(0,e.default)((0,e.default)({},Q),{},{cause:B}))}};function R8(X){let Z=X;if(!Z)return{input:{serialize:(Q)=>Q,deserialize:(Q)=>Q},output:{serialize:(Q)=>Q,deserialize:(Q)=>Q}};if("input"in Z)return Z;return{input:Z,output:Z}}var ZX=(X)=>typeof X==="function";function QX(X){if(X)return X;if(typeof window<"u"&&ZX(window.fetch))return window.fetch;if(typeof globalThis<"u"&&ZX(globalThis.fetch))return globalThis.fetch;throw Error("No fetch implementation found")}var z8=T(P(),1);function O8(X){return{url:X.url.toString(),fetch:X.fetch,transformer:R8(X.transformer),methodOverride:X.methodOverride}}function O1(X){let Z={};for(let Q=0;Q<X.length;Q++){let B=X[Q];Z[Q]=B}return Z}var k1={query:"GET",mutation:"POST",subscription:"PATCH"};function BX(X){return"input"in X?X.transformer.input.serialize(X.input):O1(X.inputs.map((Z)=>X.transformer.input.serialize(Z)))}var N8=(X)=>{let Z=X.url.split("?"),B=Z[0].replace(/\/$/,"")+"/"+X.path,G=[];if(Z[1])G.push(Z[1]);if("inputs"in X)G.push("batch=1");if(X.type==="query"||X.type==="subscription"){let Y=BX(X);if(Y!==void 0&&X.methodOverride!=="POST")G.push(`input=${encodeURIComponent(JSON.stringify(Y))}`)}if(G.length)B+="?"+G.join("&");return B},GX=(X)=>{if(X.type==="query"&&X.methodOverride!=="POST")return;let Z=BX(X);return Z!==void 0?JSON.stringify(Z):void 0},q0=(X)=>{return WX((0,z8.default)((0,z8.default)({},X),{},{contentTypeHeader:"application/json",getUrl:N8,getBody:GX}))},$1=class extends Error{constructor(){super("AbortError");this.name="AbortError",this.message="AbortError"}},f1=(X)=>{var Z;if(!(X===null||X===void 0?void 0:X.aborted))return;if((Z=X.throwIfAborted)===null||Z===void 0||Z.call(X),typeof DOMException<"u")throw new DOMException("AbortError","AbortError");throw new $1};async function YX(X){var Z;f1(X.signal);let Q=X.getUrl(X),B=X.getBody(X),G=(Z=X.methodOverride)!==null&&Z!==void 0?Z:k1[X.type],Y=await(async()=>{let H=await X.headers();if(Symbol.iterator in H)return Object.fromEntries(H);return H})(),W=(0,z8.default)((0,z8.default)((0,z8.default)({},X.contentTypeHeader&&G!=="GET"?{"content-type":X.contentTypeHeader}:{}),X.trpcAcceptHeader?{"trpc-accept":X.trpcAcceptHeader}:void 0),Y);return QX(X.fetch)(Q,{method:G,signal:X.signal,body:B,headers:W})}async function WX(X){let Z={},Q=await YX(X);Z.response=Q;let B=await Q.json();return Z.responseJSON=B,{json:B,meta:Z}}var c7=T(P(),1);var HX=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function U0(X){let Z=null,Q=null,B=()=>{clearTimeout(Q),Q=null,Z=null};function G(H){let V=[[]],D=0;while(!0){let F=H[D];if(!F)break;let K=V[V.length-1];if(F.aborted){var U;(U=F.reject)===null||U===void 0||U.call(F,Error("Aborted")),D++;continue}if(X.validate(K.concat(F).map((A)=>A.key))){K.push(F),D++;continue}if(K.length===0){var q;(q=F.reject)===null||q===void 0||q.call(F,Error("Input is too big for a single dispatch")),D++;continue}V.push([])}return V}function Y(){let H=G(Z);B();for(let V of H){if(!V.length)continue;let D={items:V};for(let q of V)q.batch=D;X.fetch(D.items.map((q)=>q.key)).then(async(q)=>{await Promise.all(q.map(async(K,N)=>{let A=D.items[N];try{var z;let J=await Promise.resolve(K);(z=A.resolve)===null||z===void 0||z.call(A,J)}catch(J){var M;(M=A.reject)===null||M===void 0||M.call(A,J)}A.batch=null,A.reject=null,A.resolve=null}));for(let K of D.items){var F;(F=K.reject)===null||F===void 0||F.call(K,Error("Missing result")),K.batch=null}}).catch((q)=>{for(let K of D.items){var F;(F=K.reject)===null||F===void 0||F.call(K,q),K.batch=null}})}}function W(H){var V;let D={aborted:!1,key:H,batch:null,resolve:HX,reject:HX},U=new Promise((q,F)=>{var K;D.reject=F,D.resolve=q,(K=Z)!==null&&K!==void 0||(Z=[]),Z.push(D)});return(V=Q)!==null&&V!==void 0||(Q=setTimeout(Y)),U}return{load:W}}function VX(...X){let Z=new AbortController,Q=X.length,B=0,G=()=>{if(++B===Q)Z.abort()};for(let Y of X)if(Y===null||Y===void 0?void 0:Y.aborted)G();else Y===null||Y===void 0||Y.addEventListener("abort",G,{once:!0});return Z.signal}var k8=T(P(),1);function z0(X){var Z,Q;let B=O8(X),G=(Z=X.maxURLLength)!==null&&Z!==void 0?Z:1/0,Y=(Q=X.maxItems)!==null&&Q!==void 0?Q:1/0;return()=>{let W=(U)=>{return{validate(q){if(G===1/0&&Y===1/0)return!0;if(q.length>Y)return!1;let F=q.map((A)=>A.path).join(","),K=q.map((A)=>A.input);return N8((0,k8.default)((0,k8.default)({},B),{},{type:U,path:F,inputs:K,signal:null})).length<=G},async fetch(q){let F=q.map((J)=>J.path).join(","),K=q.map((J)=>J.input),N=VX(...q.map((J)=>J.signal)),A=await q0((0,k8.default)((0,k8.default)({},B),{},{path:F,inputs:K,type:U,headers(){if(!X.headers)return{};if(typeof X.headers==="function")return X.headers({opList:q});return X.headers},signal:N}));return(Array.isArray(A.json)?A.json:q.map(()=>A.json)).map((J)=>({meta:A.meta,json:J}))}}},H=U0(W("query")),V=U0(W("mutation")),D={query:H,mutation:V};return({op:U})=>{return h((q)=>{if(U.type==="subscription")throw Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let K=D[U.type].load(U),N=void 0;return K.then((A)=>{N=A;let z=A0(A.json,B.transformer.output);if(!z.ok){q.error(O.from(z.error,{meta:A.meta}));return}q.next({context:A.meta,result:z.result}),q.complete()}).catch((A)=>{q.error(O.from(A,{meta:N===null||N===void 0?void 0:N.meta}))}),()=>{}})}}}var r7=T(P(),1);var N0=(X,...Z)=>{return typeof X==="function"?X(...Z):X},GQ=T(g(),1);function S1(){let X,Z;return{promise:new Promise((B,G)=>{X=B,Z=G}),resolve:X,reject:Z}}async function j1(X){let Z=await N0(X.url);if(!X.connectionParams)return Z;let B=`${Z.includes("?")?"&":"?"}connectionParams=1`;return Z+B}async function y1(X){let Z={method:"connectionParams",data:await N0(X)};return JSON.stringify(Z)}var YQ=T(g(),1);var i=T(g(),1);function g1(X){let{promise:Z,resolve:Q,reject:B}=S1();return X.addEventListener("open",()=>{X.removeEventListener("error",B),Q()}),X.addEventListener("error",B),Z}function h1(X,{intervalMs:Z,pongTimeoutMs:Q}){let B,G;function Y(){B=setTimeout(()=>{X.send("PING"),G=setTimeout(()=>{X.close()},Q)},Z)}function W(){clearTimeout(B),Y()}function H(){clearTimeout(G),W()}X.addEventListener("open",Y),X.addEventListener("message",({data:V})=>{if(clearTimeout(B),Y(),V==="PONG")H()}),X.addEventListener("close",()=>{clearTimeout(B),clearTimeout(G)})}var v1=class X{constructor(Z){var Q;if((0,i.default)(this,"id",++X.connectCount),(0,i.default)(this,"WebSocketPonyfill",void 0),(0,i.default)(this,"urlOptions",void 0),(0,i.default)(this,"keepAliveOpts",void 0),(0,i.default)(this,"wsObservable",T8(null)),(0,i.default)(this,"openPromise",null),this.WebSocketPonyfill=(Q=Z.WebSocketPonyfill)!==null&&Q!==void 0?Q:WebSocket,!this.WebSocketPonyfill)throw 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=Z.urlOptions,this.keepAliveOpts=Z.keepAlive}get ws(){return this.wsObservable.get()}set ws(Z){this.wsObservable.next(Z)}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 Z=this;if(Z.openPromise)return Z.openPromise;Z.id=++X.connectCount;let Q=j1(Z.urlOptions).then((B)=>new Z.WebSocketPonyfill(B));Z.openPromise=Q.then(async(B)=>{if(Z.ws=B,B.addEventListener("message",function({data:G}){if(G==="PING")this.send("PONG")}),Z.keepAliveOpts.enabled)h1(B,Z.keepAliveOpts);if(B.addEventListener("close",()=>{if(Z.ws===B)Z.ws=null}),await g1(B),Z.urlOptions.connectionParams)B.send(await y1(Z.urlOptions.connectionParams))});try{await Z.openPromise}finally{Z.openPromise=null}}async close(){var Z=this;try{await Z.openPromise}finally{var Q;(Q=Z.ws)===null||Q===void 0||Q.close()}}};(0,i.default)(v1,"connectCount",0);var WQ=T(g(),1),HQ=T(P(),1);var F0=T(g(),1),DX=T(P(),1),m1=class{constructor(X){(0,F0.default)(this,"links",void 0),(0,F0.default)(this,"runtime",void 0),(0,F0.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=X.links.map((Z)=>Z(this.runtime))}$request(X){var Z;return n0({links:this.links,op:(0,DX.default)((0,DX.default)({},X),{},{context:(Z=X.context)!==null&&Z!==void 0?Z:{},id:++this.requestId})}).pipe(H0())}async requestAsPromise(X){var Z=this;try{let Q=Z.$request(X);return(await W0(Q)).result.data}catch(Q){throw O.from(Q)}}query(X,Z,Q){return this.requestAsPromise({type:"query",path:X,input:Z,context:Q===null||Q===void 0?void 0:Q.context,signal:Q===null||Q===void 0?void 0:Q.signal})}mutation(X,Z,Q){return this.requestAsPromise({type:"mutation",path:X,input:Z,context:Q===null||Q===void 0?void 0:Q.context,signal:Q===null||Q===void 0?void 0:Q.signal})}subscription(X,Z,Q){return this.$request({type:"subscription",path:X,input:Z,context:Q.context,signal:Q.signal}).subscribe({next(G){switch(G.result.type){case"state":{var Y;(Y=Q.onConnectionStateChange)===null||Y===void 0||Y.call(Q,G.result);break}case"started":{var W;(W=Q.onStarted)===null||W===void 0||W.call(Q,{context:G.context});break}case"stopped":{var H;(H=Q.onStopped)===null||H===void 0||H.call(Q);break}case"data":case void 0:{var V;(V=Q.onData)===null||V===void 0||V.call(Q,G.result.data);break}}},error(G){var Y;(Y=Q.onError)===null||Y===void 0||Y.call(Q,G)},complete(){var G;(G=Q.onComplete)===null||G===void 0||G.call(Q)}})}};var d1=Symbol.for("trpc_untypedClient"),_1={query:"query",mutate:"mutation",subscribe:"subscription"},b1=(X)=>{return _1[X]};function l1(X){let Z=E8(({path:Q,args:B})=>{let G=[...Q],Y=b1(G.pop()),W=G.join(".");return X[Y](W,...B)});return V0((Q)=>{if(Q===d1)return X;return Z[Q]})}function KX(X){let Z=new m1(X);return l1(Z)}var gQ=T(P(),1);var hQ=T(P(),1);var c1=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(X,Z){function Q(G){var Y,W,H,V=2;for(typeof Symbol<"u"&&(W=Symbol.asyncIterator,H=Symbol.iterator);V--;){if(W&&(Y=G[W])!=null)return Y.call(G);if(H&&(Y=G[H])!=null)return new B(Y.call(G));W="@@asyncIterator",H="@@iterator"}throw TypeError("Object is not async iterable")}function B(G){function Y(W){if(Object(W)!==W)return Promise.reject(TypeError(W+" is not an object."));var H=W.done;return Promise.resolve(W.value).then(function(V){return{value:V,done:H}})}return B=function(H){this.s=H,this.n=H.next},B.prototype={s:null,n:null,next:function(){return Y(this.n.apply(this.s,arguments))},return:function(H){var V=this.s.return;return V===void 0?Promise.resolve({value:H,done:!0}):Y(V.apply(this.s,arguments))},throw:function(H){var V=this.s.return;return V===void 0?Promise.reject(H):Y(V.apply(this.s,arguments))}},new B(G)}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),vQ=T(c1(),1);var mQ=T(P(),1);var u1=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(X,Z){function Q(){var B=typeof SuppressedError=="function"?SuppressedError:function(H,V){var D=Error();return D.name="SuppressedError",D.error=H,D.suppressed=V,D},G={},Y=[];function W(H,V){if(V!=null){if(Object(V)!==V)throw TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(H)var D=V[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(D===void 0&&(D=V[Symbol.dispose||Symbol.for("Symbol.dispose")],H))var U=D;if(typeof D!="function")throw TypeError("Object is not disposable.");U&&(D=function(){try{U.call(V)}catch(F){return Promise.reject(F)}}),Y.push({v:V,d:D,a:H})}else H&&Y.push({d:V,a:H});return V}return{e:G,u:W.bind(null,!1),a:W.bind(null,!0),d:function(){var V,D=this.e,U=0;function q(){for(;V=Y.pop();)try{if(!V.a&&U===1)return U=0,Y.push(V),Promise.resolve().then(q);if(V.d){var K=V.d.call(V.v);if(V.a)return U|=2,Promise.resolve(K).then(q,F)}else U|=1}catch(N){return F(N)}if(U===1)return D!==G?Promise.reject(D):Promise.resolve();if(D!==G)throw D}function F(K){return D=D!==G?new B(K,D):K,q()}return q()}}}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),AX=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(X,Z){function Q(B,G){this.v=B,this.k=G}Z.exports=Q,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),p1=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(X,Z){var Q=AX();function B(G){return new Q(G,0)}Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),n1=f({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(X,Z){var Q=AX();function B(Y){return function(){return new G(Y.apply(this,arguments))}}function G(Y){var W,H;function V(U,q){try{var F=Y[U](q),K=F.value,N=K instanceof Q;Promise.resolve(N?K.v:K).then(function(A){if(N){var z=U==="return"?"return":"next";if(!K.k||A.done)return V(z,A);A=Y[z](A).value}D(F.done?"return":"normal",A)},function(A){V("throw",A)})}catch(A){D("throw",A)}}function D(U,q){switch(U){case"return":W.resolve({value:q,done:!0});break;case"throw":W.reject(q);break;default:W.resolve({value:q,done:!1})}(W=W.next)?V(W.key,W.arg):H=null}this._invoke=function(U,q){return new Promise(function(F,K){var N={key:U,arg:q,resolve:F,reject:K,next:null};H?H=H.next=N:(W=H=N,V(U,q))})},typeof Y.return!="function"&&(this.return=void 0)}G.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},G.prototype.next=function(Y){return this._invoke("next",Y)},G.prototype.throw=function(Y){return this._invoke("throw",Y)},G.prototype.return=function(Y){return this._invoke("return",Y)},Z.exports=B,Z.exports.__esModule=!0,Z.exports.default=Z.exports}}),dQ=T(u1(),1),_Q=T(p1(),1),bQ=T(n1(),1),lQ=T(P(),1);class J0{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(X,Z){this.keyToValue.set(X,Z),this.valueToKey.set(Z,X)}getByKey(X){return this.keyToValue.get(X)}getByValue(X){return this.valueToKey.get(X)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class F8{constructor(X){this.generateIdentifier=X,this.kv=new J0}register(X,Z){if(this.kv.getByValue(X))return;if(!Z)Z=this.generateIdentifier(X);this.kv.set(Z,X)}clear(){this.kv.clear()}getIdentifier(X){return this.kv.getByValue(X)}getValue(X){return this.kv.getByKey(X)}}class M0 extends F8{constructor(){super((X)=>X.name);this.classToAllowedProps=new Map}register(X,Z){if(typeof Z==="object"){if(Z.allowProps)this.classToAllowedProps.set(X,Z.allowProps);super.register(X,Z.identifier)}else super.register(X,Z)}getAllowedProps(X){return this.classToAllowedProps.get(X)}}function i1(X){if("values"in Object)return Object.values(X);let Z=[];for(let Q in X)if(X.hasOwnProperty(Q))Z.push(X[Q]);return Z}function qX(X,Z){let Q=i1(X);if("find"in Q)return Q.find(Z);let B=Q;for(let G=0;G<B.length;G++){let Y=B[G];if(Z(Y))return Y}return}function a(X,Z){Object.entries(X).forEach(([Q,B])=>Z(B,Q))}function X8(X,Z){return X.indexOf(Z)!==-1}function L0(X,Z){for(let Q=0;Q<X.length;Q++){let B=X[Q];if(Z(B))return B}return}class I0{constructor(){this.transfomers={}}register(X){this.transfomers[X.name]=X}findApplicable(X){return qX(this.transfomers,(Z)=>Z.isApplicable(X))}findByName(X){return this.transfomers[X]}}var a1=(X)=>Object.prototype.toString.call(X).slice(8,-1),w0=(X)=>typeof X>"u",o1=(X)=>X===null,o=(X)=>{if(typeof X!=="object"||X===null)return!1;if(X===Object.prototype)return!1;if(Object.getPrototypeOf(X)===null)return!0;return Object.getPrototypeOf(X)===Object.prototype},$8=(X)=>o(X)&&Object.keys(X).length===0,S=(X)=>Array.isArray(X),s1=(X)=>typeof X==="string",t1=(X)=>typeof X==="number"&&!isNaN(X),r1=(X)=>typeof X==="boolean",UX=(X)=>X instanceof RegExp,b=(X)=>X instanceof Map,l=(X)=>X instanceof Set,T0=(X)=>a1(X)==="Symbol",zX=(X)=>X instanceof Date&&!isNaN(X.valueOf()),f8=(X)=>X instanceof Error,E0=(X)=>typeof X==="number"&&isNaN(X),NX=(X)=>r1(X)||o1(X)||w0(X)||t1(X)||s1(X)||T0(X),FX=(X)=>typeof X==="bigint",JX=(X)=>X===1/0||X===-1/0,MX=(X)=>ArrayBuffer.isView(X)&&!(X instanceof DataView),LX=(X)=>X instanceof URL;var S8=(X)=>X.replace(/\\/g,"\\\\").replace(/\./g,"\\."),j8=(X)=>X.map(String).map(S8).join("."),Z8=(X,Z)=>{let Q=[],B="";for(let Y=0;Y<X.length;Y++){let W=X.charAt(Y);if(!Z&&W==="\\"){let D=X.charAt(Y+1);if(D==="\\"){B+="\\",Y++;continue}else if(D!==".")throw Error("invalid path")}if(W==="\\"&&X.charAt(Y+1)==="."){B+=".",Y++;continue}if(W==="."){Q.push(B),B="";continue}B+=W}let G=B;return Q.push(G),Q};function v(X,Z,Q,B){return{isApplicable:X,annotation:Z,transform:Q,untransform:B}}var IX=[v(w0,"undefined",()=>null,()=>{return}),v(FX,"bigint",(X)=>X.toString(),(X)=>{if(typeof BigInt<"u")return BigInt(X);return console.error("Please add a BigInt polyfill."),X}),v(zX,"Date",(X)=>X.toISOString(),(X)=>new Date(X)),v(f8,"Error",(X,Z)=>{let Q={name:X.name,message:X.message};if("cause"in X)Q.cause=X.cause;return Z.allowedErrorProps.forEach((B)=>{Q[B]=X[B]}),Q},(X,Z)=>{let Q=Error(X.message,{cause:X.cause});return Q.name=X.name,Q.stack=X.stack,Z.allowedErrorProps.forEach((B)=>{Q[B]=X[B]}),Q}),v(UX,"regexp",(X)=>""+X,(X)=>{let Z=X.slice(1,X.lastIndexOf("/")),Q=X.slice(X.lastIndexOf("/")+1);return new RegExp(Z,Q)}),v(l,"set",(X)=>[...X.values()],(X)=>new Set(X)),v(b,"map",(X)=>[...X.entries()],(X)=>new Map(X)),v((X)=>E0(X)||JX(X),"number",(X)=>{if(E0(X))return"NaN";if(X>0)return"Infinity";else return"-Infinity"},Number),v((X)=>X===0&&1/X===-1/0,"number",()=>{return"-0"},Number),v(LX,"URL",(X)=>X.toString(),(X)=>new URL(X))];function y8(X,Z,Q,B){return{isApplicable:X,annotation:Z,transform:Q,untransform:B}}var wX=y8((X,Z)=>{if(T0(X))return!!Z.symbolRegistry.getIdentifier(X);return!1},(X,Z)=>{return["symbol",Z.symbolRegistry.getIdentifier(X)]},(X)=>X.description,(X,Z,Q)=>{let B=Q.symbolRegistry.getValue(Z[1]);if(!B)throw Error("Trying to deserialize unknown symbol");return B}),e1=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((X,Z)=>{return X[Z.name]=Z,X},{}),TX=y8(MX,(X)=>["typed-array",X.constructor.name],(X)=>[...X],(X,Z)=>{let Q=e1[Z[1]];if(!Q)throw Error("Trying to deserialize unknown typed array");return new Q(X)});function x0(X,Z){if(X?.constructor)return!!Z.classRegistry.getIdentifier(X.constructor);return!1}var EX=y8(x0,(X,Z)=>{return["class",Z.classRegistry.getIdentifier(X.constructor)]},(X,Z)=>{let Q=Z.classRegistry.getAllowedProps(X.constructor);if(!Q)return{...X};let B={};return Q.forEach((G)=>{B[G]=X[G]}),B},(X,Z,Q)=>{let B=Q.classRegistry.getValue(Z[1]);if(!B)throw Error(`Trying to deserialize unknown class '${Z[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(B.prototype),X)}),xX=y8((X,Z)=>{return!!Z.customTransformerRegistry.findApplicable(X)},(X,Z)=>{return["custom",Z.customTransformerRegistry.findApplicable(X).name]},(X,Z)=>{return Z.customTransformerRegistry.findApplicable(X).serialize(X)},(X,Z,Q)=>{let B=Q.customTransformerRegistry.findByName(Z[1]);if(!B)throw Error("Trying to deserialize unknown custom value");return B.deserialize(X)}),XZ=[EX,wX,xX,TX],C0=(X,Z)=>{let Q=L0(XZ,(G)=>G.isApplicable(X,Z));if(Q)return{value:Q.transform(X,Z),type:Q.annotation(X,Z)};let B=L0(IX,(G)=>G.isApplicable(X,Z));if(B)return{value:B.transform(X,Z),type:B.annotation};return},CX={};IX.forEach((X)=>{CX[X.annotation]=X});var PX=(X,Z,Q)=>{if(S(Z))switch(Z[0]){case"symbol":return wX.untransform(X,Z,Q);case"class":return EX.untransform(X,Z,Q);case"custom":return xX.untransform(X,Z,Q);case"typed-array":return TX.untransform(X,Z,Q);default:throw Error("Unknown transformation: "+Z)}else{let B=CX[Z];if(!B)throw Error("Unknown transformation: "+Z);return B.untransform(X,Q)}};var Q8=(X,Z)=>{if(Z>X.size)throw Error("index out of bounds");let Q=X.keys();while(Z>0)Q.next(),Z--;return Q.next().value};function RX(X){if(X8(X,"__proto__"))throw Error("__proto__ is not allowed as a property");if(X8(X,"prototype"))throw Error("prototype is not allowed as a property");if(X8(X,"constructor"))throw Error("constructor is not allowed as a property")}var OX=(X,Z)=>{RX(Z);for(let Q=0;Q<Z.length;Q++){let B=Z[Q];if(l(X))X=Q8(X,+B);else if(b(X)){let G=+B,Y=+Z[++Q]===0?"key":"value",W=Q8(X,G);switch(Y){case"key":X=W;break;case"value":X=X.get(W);break}}else X=X[B]}return X},g8=(X,Z,Q)=>{if(RX(Z),Z.length===0)return Q(X);let B=X;for(let Y=0;Y<Z.length-1;Y++){let W=Z[Y];if(S(B)){let H=+W;B=B[H]}else if(o(B))B=B[W];else if(l(B)){let H=+W;B=Q8(B,H)}else if(b(B)){if(Y===Z.length-2)break;let V=+W,D=+Z[++Y]===0?"key":"value",U=Q8(B,V);switch(D){case"key":B=U;break;case"value":B=B.get(U);break}}}let G=Z[Z.length-1];if(S(B))B[+G]=Q(B[+G]);else if(o(B))B[G]=Q(B[G]);if(l(B)){let Y=Q8(B,+G),W=Q(Y);if(Y!==W)B.delete(Y),B.add(W)}if(b(B)){let Y=+Z[Z.length-2],W=Q8(B,Y);switch(+G===0?"key":"value"){case"key":{let V=Q(W);if(B.set(V,B.get(W)),V!==W)B.delete(W);break}case"value":{B.set(W,Q(B.get(W)));break}}}return X};var kX=(X)=>X<1;function P0(X,Z,Q,B=[]){if(!X)return;let G=kX(Q);if(!S(X)){a(X,(H,V)=>P0(H,Z,Q,[...B,...Z8(V,G)]));return}let[Y,W]=X;if(W)a(W,(H,V)=>{P0(H,Z,Q,[...B,...Z8(V,G)])});Z(Y,B)}function $X(X,Z,Q,B){return P0(Z,(G,Y)=>{X=g8(X,Y,(W)=>PX(W,G,B))},Q),X}function fX(X,Z,Q){let B=kX(Q);function G(Y,W){let H=OX(X,Z8(W,B));Y.map((V)=>Z8(V,B)).forEach((V)=>{X=g8(X,V,()=>H)})}if(S(Z)){let[Y,W]=Z;if(Y.forEach((H)=>{X=g8(X,Z8(H,B),()=>X)}),W)a(W,G)}else a(Z,G);return X}var ZZ=(X,Z)=>o(X)||S(X)||b(X)||l(X)||f8(X)||x0(X,Z);function QZ(X,Z,Q){let B=Q.get(X);if(B)B.push(Z);else Q.set(X,[Z])}function SX(X,Z){let Q={},B=void 0;if(X.forEach((G)=>{if(G.length<=1)return;if(!Z)G=G.map((H)=>H.map(String)).sort((H,V)=>H.length-V.length);let[Y,...W]=G;if(Y.length===0)B=W.map(j8);else Q[j8(Y)]=W.map(j8)}),B)if($8(Q))return[B];else return[B,Q];else return $8(Q)?void 0:Q}var R0=(X,Z,Q,B,G=[],Y=[],W=new Map)=>{let H=NX(X);if(!H){QZ(X,G,Z);let K=W.get(X);if(K)return B?{transformedValue:null}:K}if(!ZZ(X,Q)){let K=C0(X,Q),N=K?{transformedValue:K.value,annotations:[K.type]}:{transformedValue:X};if(!H)W.set(X,N);return N}if(X8(Y,X))return{transformedValue:null};let V=C0(X,Q),D=V?.value??X,U=S(D)?[]:{},q={};a(D,(K,N)=>{if(N==="__proto__"||N==="constructor"||N==="prototype")throw Error(`Detected property ${N}. This is a prototype pollution risk, please remove it from your object.`);let A=R0(K,Z,Q,B,[...G,N],[...Y,X],W);if(U[N]=A.transformedValue,S(A.annotations))q[S8(N)]=A.annotations;else if(o(A.annotations))a(A.annotations,(z,M)=>{q[S8(N)+"."+M]=z})});let F=$8(q)?{transformedValue:U,annotations:V?[V.type]:void 0}:{transformedValue:U,annotations:V?[V.type,q]:q};if(!H)W.set(X,F);return F};function h8(X){return Object.prototype.toString.call(X).slice(8,-1)}function v8(X){return h8(X)==="Array"}function O0(X){if(h8(X)!=="Object")return!1;let Z=Object.getPrototypeOf(X);return!!Z&&Z.constructor===Object&&Z===Object.prototype}function BZ(X,Z,Q,B,G){let Y={}.propertyIsEnumerable.call(B,Z)?"enumerable":"nonenumerable";if(Y==="enumerable")X[Z]=Q;if(G&&Y==="nonenumerable")Object.defineProperty(X,Z,{value:Q,enumerable:!1,writable:!0,configurable:!0})}function m8(X,Z={}){if(v8(X))return X.map((G)=>m8(G,Z));if(!O0(X))return X;let Q=Object.getOwnPropertyNames(X),B=Object.getOwnPropertySymbols(X);return[...Q,...B].reduce((G,Y)=>{if(Y==="__proto__")return G;if(v8(Z.props)&&!Z.props.includes(Y))return G;let W=X[Y],H=m8(W,Z);return BZ(G,Y,H,X,Z.nonenumerable),G},{})}class L{constructor({dedupe:X=!1}={}){this.classRegistry=new M0,this.symbolRegistry=new F8((Z)=>Z.description??""),this.customTransformerRegistry=new I0,this.allowedErrorProps=[],this.dedupe=X}serialize(X){let Z=new Map,Q=R0(X,Z,this,this.dedupe),B={json:Q.transformedValue};if(Q.annotations)B.meta={...B.meta,values:Q.annotations};let G=SX(Z,this.dedupe);if(G)B.meta={...B.meta,referentialEqualities:G};if(B.meta)B.meta.v=1;return B}deserialize(X,Z){let{json:Q,meta:B}=X,G=Z?.inPlace?Q:m8(Q);if(B?.values)G=$X(G,B.values,B.v??0,this);if(B?.referentialEqualities)G=fX(G,B.referentialEqualities,B.v??0);return G}stringify(X){return JSON.stringify(this.serialize(X))}parse(X){return this.deserialize(JSON.parse(X),{inPlace:!0})}registerClass(X,Z){this.classRegistry.register(X,Z)}registerSymbol(X,Z){this.symbolRegistry.register(X,Z)}registerCustom(X,Z){this.customTransformerRegistry.register({name:Z,...X})}allowErrorProps(...X){this.allowedErrorProps.push(...X)}}L.defaultInstance=new L;L.serialize=L.defaultInstance.serialize.bind(L.defaultInstance);L.deserialize=L.defaultInstance.deserialize.bind(L.defaultInstance);L.stringify=L.defaultInstance.stringify.bind(L.defaultInstance);L.parse=L.defaultInstance.parse.bind(L.defaultInstance);L.registerClass=L.defaultInstance.registerClass.bind(L.defaultInstance);L.registerSymbol=L.defaultInstance.registerSymbol.bind(L.defaultInstance);L.registerCustom=L.defaultInstance.registerCustom.bind(L.defaultInstance);L.allowErrorProps=L.defaultInstance.allowErrorProps.bind(L.defaultInstance);var J8=L;var{serialize:kB,deserialize:$B,stringify:fB,parse:SB,registerClass:jB,registerCustom:yB,registerSymbol:gB,allowErrorProps:hB}=L;var GZ=new TextEncoder,YZ=new TextDecoder;function k0(X){let Z=GZ.encode(X),Q="";for(let B of Z)Q+=String.fromCharCode(B);return btoa(Q)}function WZ(X){let Z=atob(X),Q=new Uint8Array(Z.length);for(let B=0;B<Z.length;B++)Q[B]=Z.charCodeAt(B);return YZ.decode(Q)}class $0{dbName;storeName;version;db;initP;constructor(X,Z="kv",Q=1){this.dbName=X;this.storeName=Z;this.version=Q;this.initP=this.open()}async open(){this.db=await new Promise((X,Z)=>{let Q=indexedDB.open(this.dbName,this.version);Q.onupgradeneeded=()=>{let B=Q.result;if(!B.objectStoreNames.contains(this.storeName))B.createObjectStore(this.storeName)},Q.onsuccess=()=>{Q.result.onversionchange=()=>Q.result.close(),X(Q.result)},Q.onerror=()=>Z(Q.error)})}async withTx(X,Z){return await this.initP,new Promise((Q,B)=>{let G=this.db.transaction(this.storeName,X),Y=G.objectStore(this.storeName),W;try{W=Z(Y)}catch(V){G.abort(),B(V);return}let H;if(W)W.onsuccess=()=>H=W.result,W.onerror=()=>B(W.error);G.oncomplete=()=>Q(H),G.onerror=()=>B(G.error),G.onabort=()=>B(G.error)})}async get(X){let Z=k0(X);return await this.withTx("readonly",(B)=>B.get(Z))??null}async set(X,Z){let Q=k0(X);await this.withTx("readwrite",(B)=>B.put(Z,Q))}async del(X){let Z=k0(X);await this.withTx("readwrite",(Q)=>Q.delete(Z))}async clear(){await this.withTx("readwrite",(X)=>X.clear())}async keys(){let X=await this.withTx("readonly",(Q)=>Q.getAllKeys()),Z=new Set;for(let Q of X){if(typeof Q!=="string")continue;try{Z.add(WZ(Q))}catch{}}return Z}}class f0{maxSize;map=new Map;constructor(X){this.maxSize=X;if(X<=0)throw Error("maxSize must be > 0")}get(X){let Z=this.map.get(X);if(Z===void 0)return;return this.map.delete(X),this.map.set(X,Z),Z}set(X,Z){if(this.map.has(X))this.map.delete(X);if(this.map.set(X,Z),this.map.size>this.maxSize){let Q=this.map.keys().next().value;this.map.delete(Q)}}delete(X){this.map.delete(X)}clear(){this.map.clear()}keys(){return this.map.keys()}}function B8(){try{return typeof window==="object"}catch(X){return!1}}function S0(){let X=(B)=>B.buffer.slice(B.byteOffset,B.byteOffset+B.byteLength),Z=(B)=>new Uint8Array(B);if(!B8()||!("indexedDB"in globalThis)){let B=new f0(500);return{async getBytes(G){let Y=B.get(G);return Y?new Uint8Array(Y):null},async setBytes(G,Y){B.set(G,new Uint8Array(Y))},async delete(G){B.delete(G)},async clear(){B.clear()},async keys(){return new Set(B.keys())}}}let Q=null;try{Q=new $0("sortsys-v2-cache")}catch{return S0()}return{async getBytes(B){let G=await Q.get(B);if(!G)return null;if(G.exp!==0&&G.exp<=Date.now())return await Q.del(B),null;return Z(G.value)},async setBytes(B,G){let Y={value:X(G),exp:Date.now()+3600000};try{await Q.set(B,Y)}catch{}},async delete(B){try{await Q.del(B)}catch{}},async clear(){try{await Q.clear()}catch{}},async keys(){try{return await Q.keys()}catch{return new Set}}}}var j0=function(X,Z){return j0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,B){Q.__proto__=B}||function(Q,B){for(var G in B)if(Object.prototype.hasOwnProperty.call(B,G))Q[G]=B[G]},j0(X,Z)};function c(X,Z){if(typeof Z!=="function"&&Z!==null)throw TypeError("Class extends value "+String(Z)+" is not a constructor or null");j0(X,Z);function Q(){this.constructor=X}X.prototype=Z===null?Object.create(Z):(Q.prototype=Z.prototype,new Q)}function jX(X,Z,Q,B){function G(Y){return Y instanceof Q?Y:new Q(function(W){W(Y)})}return new(Q||(Q=Promise))(function(Y,W){function H(U){try{D(B.next(U))}catch(q){W(q)}}function V(U){try{D(B.throw(U))}catch(q){W(q)}}function D(U){U.done?Y(U.value):G(U.value).then(H,V)}D((B=B.apply(X,Z||[])).next())})}function d8(X,Z){var Q={label:0,sent:function(){if(Y[0]&1)throw Y[1];return Y[1]},trys:[],ops:[]},B,G,Y,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=H(0),W.throw=H(1),W.return=H(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function H(D){return function(U){return V([D,U])}}function V(D){if(B)throw TypeError("Generator is already executing.");while(W&&(W=0,D[0]&&(Q=0)),Q)try{if(B=1,G&&(Y=D[0]&2?G.return:D[0]?G.throw||((Y=G.return)&&Y.call(G),0):G.next)&&!(Y=Y.call(G,D[1])).done)return Y;if(G=0,Y)D=[D[0]&2,Y.value];switch(D[0]){case 0:case 1:Y=D;break;case 4:return Q.label++,{value:D[1],done:!1};case 5:Q.label++,G=D[1],D=[0];continue;case 7:D=Q.ops.pop(),Q.trys.pop();continue;default:if((Y=Q.trys,!(Y=Y.length>0&&Y[Y.length-1]))&&(D[0]===6||D[0]===2)){Q=0;continue}if(D[0]===3&&(!Y||D[1]>Y[0]&&D[1]<Y[3])){Q.label=D[1];break}if(D[0]===6&&Q.label<Y[1]){Q.label=Y[1],Y=D;break}if(Y&&Q.label<Y[2]){Q.label=Y[2],Q.ops.push(D);break}if(Y[2])Q.ops.pop();Q.trys.pop();continue}D=Z.call(X,Q)}catch(U){D=[6,U],G=0}finally{B=Y=0}if(D[0]&5)throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}}function d(X){var Z=typeof Symbol==="function"&&Symbol.iterator,Q=Z&&X[Z],B=0;if(Q)return Q.call(X);if(X&&typeof X.length==="number")return{next:function(){if(X&&B>=X.length)X=void 0;return{value:X&&X[B++],done:!X}}};throw TypeError(Z?"Object is not iterable.":"Symbol.iterator is not defined.")}function G8(X,Z){var Q=typeof Symbol==="function"&&X[Symbol.iterator];if(!Q)return X;var B=Q.call(X),G,Y=[],W;try{while((Z===void 0||Z-- >0)&&!(G=B.next()).done)Y.push(G.value)}catch(H){W={error:H}}finally{try{if(G&&!G.done&&(Q=B.return))Q.call(B)}finally{if(W)throw W.error}}return Y}function Y8(X,Z,Q){if(Q||arguments.length===2){for(var B=0,G=Z.length,Y;B<G;B++)if(Y||!(B in Z)){if(!Y)Y=Array.prototype.slice.call(Z,0,B);Y[B]=Z[B]}}return X.concat(Y||Array.prototype.slice.call(Z))}function s(X){return this instanceof s?(this.v=X,this):new s(X)}function yX(X,Z,Q){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var B=Q.apply(X,Z||[]),G,Y=[];return G=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),H("next"),H("throw"),H("return",W),G[Symbol.asyncIterator]=function(){return this},G;function W(K){return function(N){return Promise.resolve(N).then(K,q)}}function H(K,N){if(B[K]){if(G[K]=function(A){return new Promise(function(z,M){Y.push([K,A,z,M])>1||V(K,A)})},N)G[K]=N(G[K])}}function V(K,N){try{D(B[K](N))}catch(A){F(Y[0][3],A)}}function D(K){K.value instanceof s?Promise.resolve(K.value.v).then(U,q):F(Y[0][2],K)}function U(K){V("next",K)}function q(K){V("throw",K)}function F(K,N){if(K(N),Y.shift(),Y.length)V(Y[0][0],Y[0][1])}}function gX(X){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var Z=X[Symbol.asyncIterator],Q;return Z?Z.call(X):(X=typeof d==="function"?d(X):X[Symbol.iterator](),Q={},B("next"),B("throw"),B("return"),Q[Symbol.asyncIterator]=function(){return this},Q);function B(Y){Q[Y]=X[Y]&&function(W){return new Promise(function(H,V){W=X[Y](W),G(H,V,W.done,W.value)})}}function G(Y,W,H,V){Promise.resolve(V).then(function(D){Y({value:D,done:H})},W)}}function w(X){return typeof X==="function"}function _8(X){var Z=function(B){Error.call(B),B.stack=Error().stack},Q=X(Z);return Q.prototype=Object.create(Error.prototype),Q.prototype.constructor=Q,Q}var b8=_8(function(X){return function(Q){X(this),this.message=Q?Q.length+` errors occurred during unsubscription:
|
|
2
|
+
`+Q.map(function(B,G){return G+1+") "+B.toString()}).join(`
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=Q}});function M8(X,Z){if(X){var Q=X.indexOf(Z);0<=Q&&X.splice(Q,1)}}var W8=function(){function X(Z){this.initialTeardown=Z,this.closed=!1,this._parentage=null,this._finalizers=null}return X.prototype.unsubscribe=function(){var Z,Q,B,G,Y;if(!this.closed){this.closed=!0;var W=this._parentage;if(W)if(this._parentage=null,Array.isArray(W))try{for(var H=d(W),V=H.next();!V.done;V=H.next()){var D=V.value;D.remove(this)}}catch(A){Z={error:A}}finally{try{if(V&&!V.done&&(Q=H.return))Q.call(H)}finally{if(Z)throw Z.error}}else W.remove(this);var U=this.initialTeardown;if(w(U))try{U()}catch(A){Y=A instanceof b8?A.errors:[A]}var q=this._finalizers;if(q){this._finalizers=null;try{for(var F=d(q),K=F.next();!K.done;K=F.next()){var N=K.value;try{hX(N)}catch(A){if(Y=Y!==null&&Y!==void 0?Y:[],A instanceof b8)Y=Y8(Y8([],G8(Y)),G8(A.errors));else Y.push(A)}}}catch(A){B={error:A}}finally{try{if(K&&!K.done&&(G=F.return))G.call(F)}finally{if(B)throw B.error}}}if(Y)throw new b8(Y)}},X.prototype.add=function(Z){var Q;if(Z&&Z!==this)if(this.closed)hX(Z);else{if(Z instanceof X){if(Z.closed||Z._hasParent(this))return;Z._addParent(this)}(this._finalizers=(Q=this._finalizers)!==null&&Q!==void 0?Q:[]).push(Z)}},X.prototype._hasParent=function(Z){var Q=this._parentage;return Q===Z||Array.isArray(Q)&&Q.includes(Z)},X.prototype._addParent=function(Z){var Q=this._parentage;this._parentage=Array.isArray(Q)?(Q.push(Z),Q):Q?[Q,Z]:Z},X.prototype._removeParent=function(Z){var Q=this._parentage;if(Q===Z)this._parentage=null;else if(Array.isArray(Q))M8(Q,Z)},X.prototype.remove=function(Z){var Q=this._finalizers;if(Q&&M8(Q,Z),Z instanceof X)Z._removeParent(this)},X.EMPTY=function(){var Z=new X;return Z.closed=!0,Z}(),X}();var y0=W8.EMPTY;function l8(X){return X instanceof W8||X&&"closed"in X&&w(X.remove)&&w(X.add)&&w(X.unsubscribe)}function hX(X){if(w(X))X();else X.unsubscribe()}var j={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var H8={setTimeout:function(X,Z){var Q=[];for(var B=2;B<arguments.length;B++)Q[B-2]=arguments[B];var G=H8.delegate;if(G===null||G===void 0?void 0:G.setTimeout)return G.setTimeout.apply(G,Y8([X,Z],G8(Q)));return setTimeout.apply(void 0,Y8([X,Z],G8(Q)))},clearTimeout:function(X){var Z=H8.delegate;return((Z===null||Z===void 0?void 0:Z.clearTimeout)||clearTimeout)(X)},delegate:void 0};function c8(X){H8.setTimeout(function(){var Z=j.onUnhandledError;if(Z)Z(X);else throw X})}function g0(){}var vX=function(){return h0("C",void 0,void 0)}();function mX(X){return h0("E",void 0,X)}function dX(X){return h0("N",X,void 0)}function h0(X,Z,Q){return{kind:X,value:Z,error:Q}}var t=null;function V8(X){if(j.useDeprecatedSynchronousErrorHandling){var Z=!t;if(Z)t={errorThrown:!1,error:null};if(X(),Z){var Q=t,B=Q.errorThrown,G=Q.error;if(t=null,B)throw G}}else X()}function _X(X){if(j.useDeprecatedSynchronousErrorHandling&&t)t.errorThrown=!0,t.error=X}var L8=function(X){c(Z,X);function Z(Q){var B=X.call(this)||this;if(B.isStopped=!1,Q){if(B.destination=Q,l8(Q))Q.add(B)}else B.destination=KZ;return B}return Z.create=function(Q,B,G){return new p8(Q,B,G)},Z.prototype.next=function(Q){if(this.isStopped)m0(dX(Q),this);else this._next(Q)},Z.prototype.error=function(Q){if(this.isStopped)m0(mX(Q),this);else this.isStopped=!0,this._error(Q)},Z.prototype.complete=function(){if(this.isStopped)m0(vX,this);else this.isStopped=!0,this._complete()},Z.prototype.unsubscribe=function(){if(!this.closed)this.isStopped=!0,X.prototype.unsubscribe.call(this),this.destination=null},Z.prototype._next=function(Q){this.destination.next(Q)},Z.prototype._error=function(Q){try{this.destination.error(Q)}finally{this.unsubscribe()}},Z.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Z}(W8);var HZ=Function.prototype.bind;function v0(X,Z){return HZ.call(X,Z)}var VZ=function(){function X(Z){this.partialObserver=Z}return X.prototype.next=function(Z){var Q=this.partialObserver;if(Q.next)try{Q.next(Z)}catch(B){u8(B)}},X.prototype.error=function(Z){var Q=this.partialObserver;if(Q.error)try{Q.error(Z)}catch(B){u8(B)}else u8(Z)},X.prototype.complete=function(){var Z=this.partialObserver;if(Z.complete)try{Z.complete()}catch(Q){u8(Q)}},X}(),p8=function(X){c(Z,X);function Z(Q,B,G){var Y=X.call(this)||this,W;if(w(Q)||!Q)W={next:Q!==null&&Q!==void 0?Q:void 0,error:B!==null&&B!==void 0?B:void 0,complete:G!==null&&G!==void 0?G:void 0};else{var H;if(Y&&j.useDeprecatedNextContext)H=Object.create(Q),H.unsubscribe=function(){return Y.unsubscribe()},W={next:Q.next&&v0(Q.next,H),error:Q.error&&v0(Q.error,H),complete:Q.complete&&v0(Q.complete,H)};else W=Q}return Y.destination=new VZ(W),Y}return Z}(L8);function u8(X){if(j.useDeprecatedSynchronousErrorHandling)_X(X);else c8(X)}function DZ(X){throw X}function m0(X,Z){var Q=j.onStoppedNotification;Q&&H8.setTimeout(function(){return Q(X,Z)})}var KZ={closed:!0,next:g0,error:DZ,complete:g0};var D8=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}();function n8(X){return X}function bX(X){if(X.length===0)return n8;if(X.length===1)return X[0];return function(Q){return X.reduce(function(B,G){return G(B)},Q)}}var C=function(){function X(Z){if(Z)this._subscribe=Z}return X.prototype.lift=function(Z){var Q=new X;return Q.source=this,Q.operator=Z,Q},X.prototype.subscribe=function(Z,Q,B){var G=this,Y=qZ(Z)?Z:new p8(Z,Q,B);return V8(function(){var W=G,H=W.operator,V=W.source;Y.add(H?H.call(Y,V):V?G._subscribe(Y):G._trySubscribe(Y))}),Y},X.prototype._trySubscribe=function(Z){try{return this._subscribe(Z)}catch(Q){Z.error(Q)}},X.prototype.forEach=function(Z,Q){var B=this;return Q=lX(Q),new Q(function(G,Y){var W=new p8({next:function(H){try{Z(H)}catch(V){Y(V),W.unsubscribe()}},error:Y,complete:G});B.subscribe(W)})},X.prototype._subscribe=function(Z){var Q;return(Q=this.source)===null||Q===void 0?void 0:Q.subscribe(Z)},X.prototype[D8]=function(){return this},X.prototype.pipe=function(){var Z=[];for(var Q=0;Q<arguments.length;Q++)Z[Q]=arguments[Q];return bX(Z)(this)},X.prototype.toPromise=function(Z){var Q=this;return Z=lX(Z),new Z(function(B,G){var Y;Q.subscribe(function(W){return Y=W},function(W){return G(W)},function(){return B(Y)})})},X.create=function(Z){return new X(Z)},X}();function lX(X){var Z;return(Z=X!==null&&X!==void 0?X:j.Promise)!==null&&Z!==void 0?Z:Promise}function AZ(X){return X&&w(X.next)&&w(X.error)&&w(X.complete)}function qZ(X){return X&&X instanceof L8||AZ(X)&&l8(X)}function UZ(X){return w(X===null||X===void 0?void 0:X.lift)}function u(X){return function(Z){if(UZ(Z))return Z.lift(function(Q){try{return X(Q,this)}catch(B){this.error(B)}});throw TypeError("Unable to lift unknown Observable type")}}function r(X,Z,Q,B,G){return new zZ(X,Z,Q,B,G)}var zZ=function(X){c(Z,X);function Z(Q,B,G,Y,W,H){var V=X.call(this,Q)||this;return V.onFinalize=W,V.shouldUnsubscribe=H,V._next=B?function(D){try{B(D)}catch(U){Q.error(U)}}:X.prototype._next,V._error=Y?function(D){try{Y(D)}catch(U){Q.error(U)}finally{this.unsubscribe()}}:X.prototype._error,V._complete=G?function(){try{G()}catch(D){Q.error(D)}finally{this.unsubscribe()}}:X.prototype._complete,V}return Z.prototype.unsubscribe=function(){var Q;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var B=this.closed;X.prototype.unsubscribe.call(this),!B&&((Q=this.onFinalize)===null||Q===void 0||Q.call(this))}},Z}(L8);var cX=_8(function(X){return function(){X(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var i8=function(X){c(Z,X);function Z(){var Q=X.call(this)||this;return Q.closed=!1,Q.currentObservers=null,Q.observers=[],Q.isStopped=!1,Q.hasError=!1,Q.thrownError=null,Q}return Z.prototype.lift=function(Q){var B=new uX(this,this);return B.operator=Q,B},Z.prototype._throwIfClosed=function(){if(this.closed)throw new cX},Z.prototype.next=function(Q){var B=this;V8(function(){var G,Y;if(B._throwIfClosed(),!B.isStopped){if(!B.currentObservers)B.currentObservers=Array.from(B.observers);try{for(var W=d(B.currentObservers),H=W.next();!H.done;H=W.next()){var V=H.value;V.next(Q)}}catch(D){G={error:D}}finally{try{if(H&&!H.done&&(Y=W.return))Y.call(W)}finally{if(G)throw G.error}}}})},Z.prototype.error=function(Q){var B=this;V8(function(){if(B._throwIfClosed(),!B.isStopped){B.hasError=B.isStopped=!0,B.thrownError=Q;var G=B.observers;while(G.length)G.shift().error(Q)}})},Z.prototype.complete=function(){var Q=this;V8(function(){if(Q._throwIfClosed(),!Q.isStopped){Q.isStopped=!0;var B=Q.observers;while(B.length)B.shift().complete()}})},Z.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(Z.prototype,"observed",{get:function(){var Q;return((Q=this.observers)===null||Q===void 0?void 0:Q.length)>0},enumerable:!1,configurable:!0}),Z.prototype._trySubscribe=function(Q){return this._throwIfClosed(),X.prototype._trySubscribe.call(this,Q)},Z.prototype._subscribe=function(Q){return this._throwIfClosed(),this._checkFinalizedStatuses(Q),this._innerSubscribe(Q)},Z.prototype._innerSubscribe=function(Q){var B=this,G=this,Y=G.hasError,W=G.isStopped,H=G.observers;if(Y||W)return y0;return this.currentObservers=null,H.push(Q),new W8(function(){B.currentObservers=null,M8(H,Q)})},Z.prototype._checkFinalizedStatuses=function(Q){var B=this,G=B.hasError,Y=B.thrownError,W=B.isStopped;if(G)Q.error(Y);else if(W)Q.complete()},Z.prototype.asObservable=function(){var Q=new C;return Q.source=this,Q},Z.create=function(Q,B){return new uX(Q,B)},Z}(C);var uX=function(X){c(Z,X);function Z(Q,B){var G=X.call(this)||this;return G.destination=Q,G.source=B,G}return Z.prototype.next=function(Q){var B,G;(G=(B=this.destination)===null||B===void 0?void 0:B.next)===null||G===void 0||G.call(B,Q)},Z.prototype.error=function(Q){var B,G;(G=(B=this.destination)===null||B===void 0?void 0:B.error)===null||G===void 0||G.call(B,Q)},Z.prototype.complete=function(){var Q,B;(B=(Q=this.destination)===null||Q===void 0?void 0:Q.complete)===null||B===void 0||B.call(Q)},Z.prototype._subscribe=function(Q){var B,G;return(G=(B=this.source)===null||B===void 0?void 0:B.subscribe(Q))!==null&&G!==void 0?G:y0},Z}(i8);function pX(X){return X&&w(X.schedule)}function NZ(X){return X[X.length-1]}function nX(X){return pX(NZ(X))?X.pop():void 0}var a8=function(X){return X&&typeof X.length==="number"&&typeof X!=="function"};function o8(X){return w(X===null||X===void 0?void 0:X.then)}function s8(X){return w(X[D8])}function t8(X){return Symbol.asyncIterator&&w(X===null||X===void 0?void 0:X[Symbol.asyncIterator])}function r8(X){return TypeError("You provided "+(X!==null&&typeof X==="object"?"an invalid object":"'"+X+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function FZ(){if(typeof Symbol!=="function"||!Symbol.iterator)return"@@iterator";return Symbol.iterator}var e8=FZ();function X0(X){return w(X===null||X===void 0?void 0:X[e8])}function Z0(X){return yX(this,arguments,function(){var Q,B,G,Y;return d8(this,function(W){switch(W.label){case 0:Q=X.getReader(),W.label=1;case 1:W.trys.push([1,,9,10]),W.label=2;case 2:return[4,s(Q.read())];case 3:if(B=W.sent(),G=B.value,Y=B.done,!Y)return[3,5];return[4,s(void 0)];case 4:return[2,W.sent()];case 5:return[4,s(G)];case 6:return[4,W.sent()];case 7:return W.sent(),[3,2];case 8:return[3,10];case 9:return Q.releaseLock(),[7];case 10:return[2]}})})}function Q0(X){return w(X===null||X===void 0?void 0:X.getReader)}function m(X){if(X instanceof C)return X;if(X!=null){if(s8(X))return JZ(X);if(a8(X))return MZ(X);if(o8(X))return LZ(X);if(t8(X))return iX(X);if(X0(X))return IZ(X);if(Q0(X))return wZ(X)}throw r8(X)}function JZ(X){return new C(function(Z){var Q=X[D8]();if(w(Q.subscribe))return Q.subscribe(Z);throw TypeError("Provided object does not correctly implement Symbol.observable")})}function MZ(X){return new C(function(Z){for(var Q=0;Q<X.length&&!Z.closed;Q++)Z.next(X[Q]);Z.complete()})}function LZ(X){return new C(function(Z){X.then(function(Q){if(!Z.closed)Z.next(Q),Z.complete()},function(Q){return Z.error(Q)}).then(null,c8)})}function IZ(X){return new C(function(Z){var Q,B;try{for(var G=d(X),Y=G.next();!Y.done;Y=G.next()){var W=Y.value;if(Z.next(W),Z.closed)return}}catch(H){Q={error:H}}finally{try{if(Y&&!Y.done&&(B=G.return))B.call(G)}finally{if(Q)throw Q.error}}Z.complete()})}function iX(X){return new C(function(Z){TZ(X,Z).catch(function(Q){return Z.error(Q)})})}function wZ(X){return iX(Z0(X))}function TZ(X,Z){var Q,B,G,Y;return jX(this,void 0,void 0,function(){var W,H;return d8(this,function(V){switch(V.label){case 0:V.trys.push([0,5,6,11]),Q=gX(X),V.label=1;case 1:return[4,Q.next()];case 2:if(B=V.sent(),!!B.done)return[3,4];if(W=B.value,Z.next(W),Z.closed)return[2];V.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return H=V.sent(),G={error:H},[3,11];case 6:if(V.trys.push([6,,9,10]),!(B&&!B.done&&(Y=Q.return)))return[3,8];return[4,Y.call(Q)];case 7:V.sent(),V.label=8;case 8:return[3,10];case 9:if(G)throw G.error;return[7];case 10:return[7];case 11:return Z.complete(),[2]}})})}function k(X,Z,Q,B,G){if(B===void 0)B=0;if(G===void 0)G=!1;var Y=Z.schedule(function(){if(Q(),G)X.add(this.schedule(null,B));else this.unsubscribe()},B);if(X.add(Y),!G)return Y}function B0(X,Z){if(Z===void 0)Z=0;return u(function(Q,B){Q.subscribe(r(B,function(G){return k(B,X,function(){return B.next(G)},Z)},function(){return k(B,X,function(){return B.complete()},Z)},function(G){return k(B,X,function(){return B.error(G)},Z)}))})}function G0(X,Z){if(Z===void 0)Z=0;return u(function(Q,B){B.add(X.schedule(function(){return Q.subscribe(B)},Z))})}function aX(X,Z){return m(X).pipe(G0(Z),B0(Z))}function oX(X,Z){return m(X).pipe(G0(Z),B0(Z))}function sX(X,Z){return new C(function(Q){var B=0;return Z.schedule(function(){if(B===X.length)Q.complete();else if(Q.next(X[B++]),!Q.closed)this.schedule()})})}function tX(X,Z){return new C(function(Q){var B;return k(Q,Z,function(){B=X[e8](),k(Q,Z,function(){var G,Y,W;try{G=B.next(),Y=G.value,W=G.done}catch(H){Q.error(H);return}if(W)Q.complete();else Q.next(Y)},0,!0)}),function(){return w(B===null||B===void 0?void 0:B.return)&&B.return()}})}function Y0(X,Z){if(!X)throw Error("Iterable cannot be null");return new C(function(Q){k(Q,Z,function(){var B=X[Symbol.asyncIterator]();k(Q,Z,function(){B.next().then(function(G){if(G.done)Q.complete();else Q.next(G.value)})},0,!0)})})}function rX(X,Z){return Y0(Z0(X),Z)}function eX(X,Z){if(X!=null){if(s8(X))return aX(X,Z);if(a8(X))return sX(X,Z);if(o8(X))return oX(X,Z);if(t8(X))return Y0(X,Z);if(X0(X))return tX(X,Z);if(Q0(X))return rX(X,Z)}throw r8(X)}function I8(X,Z){return Z?eX(X,Z):m(X)}function X1(X,Z){return u(function(Q,B){var G=0;Q.subscribe(r(B,function(Y){B.next(X.call(Z,Y,G++))}))})}function Z1(X,Z,Q,B,G,Y,W,H){var V=[],D=0,U=0,q=!1,F=function(){if(q&&!V.length&&!D)Z.complete()},K=function(A){return D<B?N(A):V.push(A)},N=function(A){Y&&Z.next(A),D++;var z=!1;m(Q(A,U++)).subscribe(r(Z,function(M){if(G===null||G===void 0||G(M),Y)K(M);else Z.next(M)},function(){z=!0},void 0,function(){if(z)try{D--;var M=function(){var J=V.shift();if(W)k(Z,W,function(){return N(J)});else N(J)};while(V.length&&D<B)M();F()}catch(J){Z.error(J)}}))};return X.subscribe(r(Z,K,function(){q=!0,F()})),function(){H===null||H===void 0||H()}}function d0(X,Z,Q){if(Q===void 0)Q=1/0;if(w(Z))return d0(function(B,G){return X1(function(Y,W){return Z(B,Y,G,W)})(m(X(B,G)))},Q);else if(typeof Z==="number")Q=Z;return u(function(B,G){return Z1(B,G,X,Q)})}function Q1(X){if(X===void 0)X=1/0;return d0(n8,X)}function B1(){return Q1(1)}function _0(){var X=[];for(var Z=0;Z<arguments.length;Z++)X[Z]=arguments[Z];return B1()(I8(X,nX(X)))}function EZ(X){function Z(Q){if(Q===null||typeof Q!=="object")return Q;if(Array.isArray(Q))return Q.map(Z);let B={};for(let G of Object.keys(Q).sort()){let Y=Q[G];if(Y===void 0||typeof Y==="function"||typeof Y==="symbol")continue;B[G]=Z(Y)}return B}return JSON.stringify(Z(X))}var xZ=new TextDecoder,b0=new TextEncoder;function CZ(X){return b0.encode(X)}function PZ(X){let Z=EZ(X),Q=CZ(Z),B=0xcbf29ce484222325n,G=0x100000001b3n,Y=0xffffffffffffffffn;for(let W=0;W<Q.length;W++)B^=BigInt(Q[W]),B=B*G&Y;return B.toString(16).padStart(16,"0")}function RZ(X){if(!(X instanceof O))return!1;return X.data?.code?.toLowerCase?.()==="unauthorized"}function a5(X,Z){let Q=Z?.cache??S0(),B=null,G=KX({links:[z0({url:X,transformer:J8,headers:(z)=>{if(!B)return{};return{Authorization:`Bearer ${B}`}}})]});function Y(z,M){let J=PZ(M??null);return`trpc:${z}.query:${J}`}let W={};function H(z,M){if(z in W)return W[z];let J=M().finally(()=>{setTimeout(()=>{if(W[z]===J)delete W[z]},250)});return W[z]=J,J}async function V(z){return Q.getBytes(z).then((M)=>{if(!M)return null;try{return J8.parse(xZ.decode(M))}catch(J){return null}})}let D=[];function U(z){if(z.startsWith("trpc:"))z=z.split(":")[1];for(let[M,J]of D){let I=M.split(":")[1].split(".").slice(0,-1).join(".");if(z.startsWith(I))(async()=>J())()}}let q=new i8,F=!!B;function K(){let z=!!B;if(z===F)return;F=z,q.next()}let N=Object.freeze({async query(z,M,J){J??={},J.strategy??="network-first";let E=G;for(let x of`${z}.query`.split("."))E=E?.[x];if(!E)throw Error(`could not resolve query path ${z}`);let I=Y(z,M);async function y(){try{return[await H(I,()=>E(M))??null,null]}catch(x){if(x instanceof O){if(A(x),x?.code==="ConnectionRefused")return[null,null];return[null,x]}return[null,O.from(x)]}}async function K8(x){let[p,w8]=x;if(w8||!p)return await Q.delete(I),[null,w8];let R=b0.encode(J8.stringify(p));return await Q.setBytes(I,R),[p,null]}if(J.strategy==="cache-only")return[await V(I),null];if(J.strategy==="network-only")return await K8(await y());if(J.strategy==="cache-first"){let x=await V(I);if(x)return[x,null];return await K8(await y())}if(J.strategy==="network-first"){let[x,p]=await y();if(x)return await K8([x,null]);if(x=await V(I),x)return[x,null];return[null,p]}throw Error(`invalid strategy for _query: ${J.strategy}`)},async invalidate(z){if(z.startsWith("trpc:"))z=z.split(":")[1];function M(E){let I=E.split(".").slice(0,-1),y;if(I.length>1)y=I.slice(0,-1).join(".");else y=I.join(".");return z.startsWith(y)}let J=[];for(let E of await Q.keys()){if(!E.startsWith("trpc:"))continue;let I=E.split(":")[1];if(!I.endsWith(".query"))continue;if(M(I))J.push(Q.delete(E)),delete W[E]}await Promise.all(J);for(let E of Object.keys(W)){if(!E.startsWith("trpc:"))continue;let I=E.split(":")[1];if(!I.endsWith(".query"))continue;if(M(I))delete W[E]}U(z)},streamQuery(z,M,J){J??={},J.strategy??="cache-first";let E=G;for(let R of`${z}.query`.split("."))E=E?.[R];if(!E)throw Error(`could not resolve query path ${z}`);let I=Y(z,M);async function y(){try{return[await H(I,()=>E(M))??null,null]}catch(R){if(R instanceof O){if(A(R),R?.code==="ConnectionRefused")return[null,null];return[null,R]}return[null,O.from(R)]}}async function K8(R){if(!R)return await Q.delete(I),null;let n=b0.encode(J8.stringify(R));return await Q.setBytes(I,n),R}async function*x(){if(J.strategy==="cache-first"||J.strategy==="cache-only"){let $=await V(I);if($)yield[$,null];if(J.strategy==="cache-only")return}let[R,n]=await K8(await y());if(yield[R,n],n&&J?.strategy==="network-first")yield[await V(I),null]}let p=I8(x()),w8=new C((R)=>{let n=async()=>{let[$,l0]=await y();if($&&l0)R.next([$,l0])};return D.push([I,n]),()=>{for(let $=0;$<D.length;$++)if(D[$][1]===n){D.splice($,1);return}}});return _0(p,w8)},async mutate(z,M,J){let E=G;for(let I of`${z}.mutate`.split("."))E=E?.[I];if(!E)throw Error(`could not resolve mutation path ${z}`);try{let I=await E(M);return await N.invalidate(z),[I,null]}catch(I){if(A(I),!(I instanceof Error))return[null,Error("unexpected error")];return[null,I]}},async login(z){let[M,J]=await N.mutate("auth.login",z);if(J)throw J;if(B=M.token,B8())localStorage.setItem("__sortsys-v2_token",B);K()},async logout(){if(await Q.clear(),!B){if(B8())localStorage.removeItem("__sortsys-v2_token");return}if(await N.mutate("auth.logout",void 0).catch(()=>{}),B=null,B8())localStorage.removeItem("__sortsys-v2_token");K()},listenAuthState:(z)=>{let M=q.subscribe(()=>{z()});return()=>M.unsubscribe()},loggedIn(){return!!B},async restoreSession(){if(B8())B=localStorage.getItem("__sortsys-v2_token"),K()},async clearCache(){return Q.clear()}});function A(z){if(!RZ(z))return;N.logout().catch(()=>{})}return N}export{a5 as createClient};
|