@sortsys/v2-client 0.1.11 → 0.1.13

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 CHANGED
@@ -3794,7 +3794,7 @@ export interface Client {
3794
3794
  Error
3795
3795
  ]>;
3796
3796
  /**
3797
- * invalidate the cache given a quer ypath or cache key
3797
+ * invalidate the cache given a query path or cache key
3798
3798
  * (invalidates multiple elements, recurse up)
3799
3799
  */
3800
3800
  invalidate(pathOrKey: string): Promise<void>;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
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:
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 H0(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 V0(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 E8(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 b(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 x8=(X)=>r0(X,[],Object.create(null)),D0=(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}}),K0=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}}),C8=q8({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(X,Z){var Q=K0();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(C8(),1);var oZ=U8(K0(),1);var P8=U8(C8(),1);function T1(X,Z){if("error"in X){let B=Z.deserialize(X.error);return{ok:!1,error:(0,P8.default)((0,P8.default)({},X),{},{error:B})}}return{ok:!0,result:(0,P8.default)((0,P8.default)({},X.result),(!X.result.type||X.result.type==="data")&&{type:"data",data:Z.deserialize(X.result.data)})}}var A0=class extends Error{constructor(){super("Unable to transform response from server")}};function q0(X,Z){let Q;try{Q=T1(X,Z)}catch(B){throw new A0}if(!Q.ok&&(!b(Q.error.error)||typeof Q.error.error.code!=="number"))throw new A0;if(Q.ok&&!b(Q.result))throw new A0;return Q}var sZ=U8(C8(),1);var tZ=Symbol();var R8=T(g(),1),e=T(P(),1);function XX(X){return X instanceof k}function P1(X){return b(X)&&b(X.error)&&typeof X.error.code==="number"&&typeof X.error.message==="string"}function R1(X,Z){if(typeof X==="string")return X;if(b(X)&&typeof X.message==="string")return X.message;return Z}var k=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,R8.default)(this,"cause",void 0),(0,R8.default)(this,"shape",void 0),(0,R8.default)(this,"data",void 0),(0,R8.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 O8(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 k8(X){return{url:X.url.toString(),fetch:X.fetch,transformer:O8(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},U0=(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 z0(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 $8=T(P(),1);function N0(X){var Z,Q;let B=k8(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,$8.default)((0,$8.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 U0((0,$8.default)((0,$8.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=z0(W("query")),V=z0(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=q0(A.json,B.transformer.output);if(!z.ok){q.error(k.from(z.error,{meta:A.meta}));return}q.next({context:A.meta,result:z.result}),q.complete()}).catch((A)=>{q.error(k.from(A,{meta:N===null||N===void 0?void 0:N.meta}))}),()=>{}})}}}var r7=T(P(),1);var F0=(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 F0(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 F0(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",E8(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 J0=T(g(),1),DX=T(P(),1),m1=class{constructor(X){(0,J0.default)(this,"links",void 0),(0,J0.default)(this,"runtime",void 0),(0,J0.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(V0())}async requestAsPromise(X){var Z=this;try{let Q=Z.$request(X);return(await H0(Q)).result.data}catch(Q){throw k.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=x8(({path:Q,args:B})=>{let G=[...Q],Y=b1(G.pop()),W=G.join(".");return X[Y](W,...B)});return D0((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 M0{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 M0}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 L0 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 I0(X,Z){for(let Q=0;Q<X.length;Q++){let B=X[Q];if(Z(B))return B}return}class w0{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),T0=(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},f8=(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,l=(X)=>X instanceof Map,c=(X)=>X instanceof Set,E0=(X)=>a1(X)==="Symbol",zX=(X)=>X instanceof Date&&!isNaN(X.valueOf()),S8=(X)=>X instanceof Error,x0=(X)=>typeof X==="number"&&isNaN(X),NX=(X)=>r1(X)||o1(X)||T0(X)||t1(X)||s1(X)||E0(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 j8=(X)=>X.replace(/\\/g,"\\\\").replace(/\./g,"\\."),y8=(X)=>X.map(String).map(j8).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(T0,"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(S8,"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(c,"set",(X)=>[...X.values()],(X)=>new Set(X)),v(l,"map",(X)=>[...X.entries()],(X)=>new Map(X)),v((X)=>x0(X)||JX(X),"number",(X)=>{if(x0(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 g8(X,Z,Q,B){return{isApplicable:X,annotation:Z,transform:Q,untransform:B}}var wX=g8((X,Z)=>{if(E0(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=g8(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 C0(X,Z){if(X?.constructor)return!!Z.classRegistry.getIdentifier(X.constructor);return!1}var EX=g8(C0,(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=g8((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],P0=(X,Z)=>{let Q=I0(XZ,(G)=>G.isApplicable(X,Z));if(Q)return{value:Q.transform(X,Z),type:Q.annotation(X,Z)};let B=I0(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(c(X))X=Q8(X,+B);else if(l(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},h8=(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(c(B)){let H=+W;B=Q8(B,H)}else if(l(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(c(B)){let Y=Q8(B,+G),W=Q(Y);if(Y!==W)B.delete(Y),B.add(W)}if(l(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 R0(X,Z,Q,B=[]){if(!X)return;let G=kX(Q);if(!S(X)){a(X,(H,V)=>R0(H,Z,Q,[...B,...Z8(V,G)]));return}let[Y,W]=X;if(W)a(W,(H,V)=>{R0(H,Z,Q,[...B,...Z8(V,G)])});Z(Y,B)}function $X(X,Z,Q,B){return R0(Z,(G,Y)=>{X=h8(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=h8(X,V,()=>H)})}if(S(Z)){let[Y,W]=Z;if(Y.forEach((H)=>{X=h8(X,Z8(H,B),()=>X)}),W)a(W,G)}else a(Z,G);return X}var ZZ=(X,Z)=>o(X)||S(X)||l(X)||c(X)||S8(X)||C0(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(y8);else Q[y8(Y)]=W.map(y8)}),B)if(f8(Q))return[B];else return[B,Q];else return f8(Q)?void 0:Q}var O0=(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=P0(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=P0(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=O0(K,Z,Q,B,[...G,N],[...Y,X],W);if(U[N]=A.transformedValue,S(A.annotations))q[j8(N)]=A.annotations;else if(o(A.annotations))a(A.annotations,(z,M)=>{q[j8(N)+"."+M]=z})});let F=f8(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 v8(X){return Object.prototype.toString.call(X).slice(8,-1)}function m8(X){return v8(X)==="Array"}function k0(X){if(v8(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 d8(X,Z={}){if(m8(X))return X.map((G)=>d8(G,Z));if(!k0(X))return X;let Q=Object.getOwnPropertyNames(X),B=Object.getOwnPropertySymbols(X);return[...Q,...B].reduce((G,Y)=>{if(Y==="__proto__")return G;if(m8(Z.props)&&!Z.props.includes(Y))return G;let W=X[Y],H=d8(W,Z);return BZ(G,Y,H,X,Z.nonenumerable),G},{})}class L{constructor({dedupe:X=!1}={}){this.classRegistry=new L0,this.symbolRegistry=new F8((Z)=>Z.description??""),this.customTransformerRegistry=new w0,this.allowedErrorProps=[],this.dedupe=X}serialize(X){let Z=new Map,Q=O0(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:d8(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 $0(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 f0{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=$0(X);return await this.withTx("readonly",(B)=>B.get(Z))??null}async set(X,Z){let Q=$0(X);await this.withTx("readwrite",(B)=>B.put(Z,Q))}async del(X){let Z=$0(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 S0{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 j0(){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 S0(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 f0("sortsys-v2-cache")}catch{return j0()}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 y0=function(X,Z){return y0=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]},y0(X,Z)};function u(X,Z){if(typeof Z!=="function"&&Z!==null)throw TypeError("Class extends value "+String(Z)+" is not a constructor or null");y0(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 _8(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 _(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 _==="function"?_(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 b8(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 l8=b8(function(X){return function(Q){X(this),this.message=Q?Q.length+` errors occurred during unsubscription:
2
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.httpCode===401}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};
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=_(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 l8?A.errors:[A]}var q=this._finalizers;if(q){this._finalizers=null;try{for(var F=_(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 l8)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 l8(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 g0=W8.EMPTY;function c8(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 u8(X){H8.setTimeout(function(){var Z=j.onUnhandledError;if(Z)Z(X);else throw X})}function h0(){}var vX=function(){return v0("C",void 0,void 0)}();function mX(X){return v0("E",void 0,X)}function dX(X){return v0("N",X,void 0)}function v0(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){u(Z,X);function Z(Q){var B=X.call(this)||this;if(B.isStopped=!1,Q){if(B.destination=Q,c8(Q))Q.add(B)}else B.destination=KZ;return B}return Z.create=function(Q,B,G){return new n8(Q,B,G)},Z.prototype.next=function(Q){if(this.isStopped)d0(dX(Q),this);else this._next(Q)},Z.prototype.error=function(Q){if(this.isStopped)d0(mX(Q),this);else this.isStopped=!0,this._error(Q)},Z.prototype.complete=function(){if(this.isStopped)d0(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 m0(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){p8(B)}},X.prototype.error=function(Z){var Q=this.partialObserver;if(Q.error)try{Q.error(Z)}catch(B){p8(B)}else p8(Z)},X.prototype.complete=function(){var Z=this.partialObserver;if(Z.complete)try{Z.complete()}catch(Q){p8(Q)}},X}(),n8=function(X){u(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&&m0(Q.next,H),error:Q.error&&m0(Q.error,H),complete:Q.complete&&m0(Q.complete,H)};else W=Q}return Y.destination=new VZ(W),Y}return Z}(L8);function p8(X){if(j.useDeprecatedSynchronousErrorHandling)_X(X);else u8(X)}function DZ(X){throw X}function d0(X,Z){var Q=j.onStoppedNotification;Q&&H8.setTimeout(function(){return Q(X,Z)})}var KZ={closed:!0,next:h0,error:DZ,complete:h0};var D8=function(){return typeof Symbol==="function"&&Symbol.observable||"@@observable"}();function i8(X){return X}function bX(X){if(X.length===0)return i8;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 n8(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 n8({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)&&c8(X)}function UZ(X){return w(X===null||X===void 0?void 0:X.lift)}function p(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){u(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=b8(function(X){return function(){X(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var a8=function(X){u(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=_(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 g0;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){u(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:g0},Z}(a8);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 o8=function(X){return X&&typeof X.length==="number"&&typeof X!=="function"};function s8(X){return w(X===null||X===void 0?void 0:X.then)}function t8(X){return w(X[D8])}function r8(X){return Symbol.asyncIterator&&w(X===null||X===void 0?void 0:X[Symbol.asyncIterator])}function e8(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 X0=FZ();function Z0(X){return w(X===null||X===void 0?void 0:X[X0])}function Q0(X){return yX(this,arguments,function(){var Q,B,G,Y;return _8(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 B0(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(t8(X))return JZ(X);if(o8(X))return MZ(X);if(s8(X))return LZ(X);if(r8(X))return iX(X);if(Z0(X))return IZ(X);if(B0(X))return wZ(X)}throw e8(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,u8)})}function IZ(X){return new C(function(Z){var Q,B;try{for(var G=_(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(Q0(X))}function TZ(X,Z){var Q,B,G,Y;return jX(this,void 0,void 0,function(){var W,H;return _8(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 $(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 G0(X,Z){if(Z===void 0)Z=0;return p(function(Q,B){Q.subscribe(r(B,function(G){return $(B,X,function(){return B.next(G)},Z)},function(){return $(B,X,function(){return B.complete()},Z)},function(G){return $(B,X,function(){return B.error(G)},Z)}))})}function Y0(X,Z){if(Z===void 0)Z=0;return p(function(Q,B){B.add(X.schedule(function(){return Q.subscribe(B)},Z))})}function aX(X,Z){return m(X).pipe(Y0(Z),G0(Z))}function oX(X,Z){return m(X).pipe(Y0(Z),G0(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 $(Q,Z,function(){B=X[X0](),$(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 W0(X,Z){if(!X)throw Error("Iterable cannot be null");return new C(function(Q){$(Q,Z,function(){var B=X[Symbol.asyncIterator]();$(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 W0(Q0(X),Z)}function eX(X,Z){if(X!=null){if(t8(X))return aX(X,Z);if(o8(X))return sX(X,Z);if(s8(X))return oX(X,Z);if(r8(X))return W0(X,Z);if(Z0(X))return tX(X,Z);if(B0(X))return rX(X,Z)}throw e8(X)}function I8(X,Z){return Z?eX(X,Z):m(X)}function X1(X,Z){return p(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)$(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 _0(X,Z,Q){if(Q===void 0)Q=1/0;if(w(Z))return _0(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 p(function(B,G){return Z1(B,G,X,Q)})}function Q1(X){if(X===void 0)X=1/0;return _0(i8,X)}function B1(){return Q1(1)}function b0(){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,l0=new TextEncoder;function CZ(X){return l0.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 k))return!1;return X.data.httpCode===401}function a5(X,Z){let Q=Z?.cache??j0(),B=null,G=KX({links:[N0({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 a8,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 k){if(A(x),x?.code==="ConnectionRefused")return[null,null];return[null,x]}return[null,k.from(x)]}}async function K8(x){let[n,w8]=x;if(w8||!n)return await Q.delete(I),[null,w8];let R=l0.encode(J8.stringify(n));return await Q.setBytes(I,R),[n,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,n]=await y();if(x)return await K8([x,null]);if(x=await V(I),x)return[x,null];return[null,n]}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 k){if(A(R),R?.code==="ConnectionRefused")return[null,null];return[null,R]}return[null,k.from(R)]}}async function K8(R){let[d,O]=R;if(O||!d)return await Q.delete(I),[null,O];let T8=l0.encode(J8.stringify(d));return await Q.setBytes(I,T8),[d,null]}async function*x(){if(J.strategy==="cache-first"||J.strategy==="cache-only"){let O=await V(I);if(O)yield[O,null];if(J.strategy==="cache-only")return}let[R,d]=await K8(await y());if(yield[R,d],d&&J?.strategy==="network-first")yield[await V(I),null]}let n=I8(x()),w8=new C((R)=>{let d=async()=>{let[O,T8]=await y();if(O&&!T8)R.next([O,T8])};return D.push([I,d]),()=>{for(let O=0;O<D.length;O++)if(D[O][1]===d){D.splice(O,1);return}}});return b0(n,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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sortsys/v2-client",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "main": "dist/index.js",
5
5
  "devDependencies": {
6
6
  "dts-bundle-generator": "^9.5.1"