rivet-design 0.23.0 → 0.23.1

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.
Files changed (62) hide show
  1. package/dist/agent-variants/contracts.d.ts +330 -330
  2. package/dist/agent-variants/workItemInput.d.ts +192 -192
  3. package/dist/config/proxy.d.ts +0 -2
  4. package/dist/config/proxy.d.ts.map +1 -1
  5. package/dist/config/proxy.js +1 -10
  6. package/dist/config/proxy.js.map +1 -1
  7. package/dist/routes/git.d.ts +0 -1
  8. package/dist/routes/git.d.ts.map +1 -1
  9. package/dist/routes/git.js +2 -7
  10. package/dist/routes/git.js.map +1 -1
  11. package/dist/server.d.ts.map +1 -1
  12. package/dist/server.js +1 -5
  13. package/dist/server.js.map +1 -1
  14. package/dist/services/AuthService.d.ts +2 -2
  15. package/dist/services/CommitMessageGenerator.d.ts +1 -5
  16. package/dist/services/CommitMessageGenerator.d.ts.map +1 -1
  17. package/dist/services/CommitMessageGenerator.js +9 -38
  18. package/dist/services/CommitMessageGenerator.js.map +1 -1
  19. package/dist/services/IntegrationsClient.d.ts +3 -3
  20. package/dist/services/LocalGitService.d.ts +0 -3
  21. package/dist/services/LocalGitService.d.ts.map +1 -1
  22. package/dist/services/LocalGitService.js +0 -41
  23. package/dist/services/LocalGitService.js.map +1 -1
  24. package/dist/services/PRTitleGenerator.d.ts +2 -8
  25. package/dist/services/PRTitleGenerator.d.ts.map +1 -1
  26. package/dist/services/PRTitleGenerator.js +12 -74
  27. package/dist/services/PRTitleGenerator.js.map +1 -1
  28. package/dist/services/SessionService.d.ts +1 -4
  29. package/dist/services/SessionService.d.ts.map +1 -1
  30. package/dist/services/SessionService.js +5 -16
  31. package/dist/services/SessionService.js.map +1 -1
  32. package/dist/services/profiles/DesignProfiles.d.ts +30 -30
  33. package/dist/services/profiles/ProfileImports.d.ts +1 -1
  34. package/dist/services/profiles/ProfilePlanning.d.ts +4 -4
  35. package/dist/services/profiles/ReferenceReader.d.ts +3 -3
  36. package/dist/services/profiles/profileContext.d.ts +1 -1
  37. package/dist/storage/profiles/ProfilePlans.d.ts +15 -15
  38. package/dist/storage/profiles/ProfileRecords.d.ts +11 -11
  39. package/dist/storage/profiles/planSchema.d.ts +4 -4
  40. package/dist/storage/profiles/schema.d.ts +7 -7
  41. package/dist/types/cosmos-profile.d.ts +6 -6
  42. package/dist/types/cosmos.d.ts +10 -10
  43. package/dist/types/design-profile.d.ts +17 -17
  44. package/dist/types/guidance-references.d.ts +6 -6
  45. package/dist/types/guidance.d.ts +80 -80
  46. package/dist/types/reference-connectors.d.ts +10 -10
  47. package/dist/types/reference-onboarding.d.ts +63 -63
  48. package/dist/types/reference-pages.d.ts +10 -10
  49. package/dist/types/variant-reference.d.ts +4 -4
  50. package/package.json +2 -1
  51. package/src/ui/dist/assets/{LibraryEntry-B9ZkJUtN.js → LibraryEntry-BUwOgHmJ.js} +1 -1
  52. package/src/ui/dist/assets/main-DQKavyjz.js +435 -0
  53. package/src/ui/dist/index.html +1 -1
  54. package/dist/prompts/gitPrompts.d.ts +0 -4
  55. package/dist/prompts/gitPrompts.d.ts.map +0 -1
  56. package/dist/prompts/gitPrompts.js +0 -61
  57. package/dist/prompts/gitPrompts.js.map +0 -1
  58. package/dist/services/GatewayClient.d.ts +0 -44
  59. package/dist/services/GatewayClient.d.ts.map +0 -1
  60. package/dist/services/GatewayClient.js +0 -204
  61. package/dist/services/GatewayClient.js.map +0 -1
  62. package/src/ui/dist/assets/main-Dls3YqrM.js +0 -435
@@ -17,14 +17,14 @@ export declare const ReferenceContentsPageSchema: z.ZodObject<{
17
17
  hash: string;
18
18
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
19
19
  bytes: number;
20
- representation: "image" | "variant" | "video-cover" | "page";
20
+ representation: "variant" | "image" | "video-cover" | "page";
21
21
  page?: number | undefined;
22
22
  }, {
23
23
  hash: string;
24
24
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
25
25
  bytes: number;
26
26
  page?: number | undefined;
27
- representation?: "image" | "variant" | "video-cover" | "page" | undefined;
27
+ representation?: "variant" | "image" | "video-cover" | "page" | undefined;
28
28
  }>, "many">;
29
29
  remoteImages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
30
  remoteImageRepresentations: z.ZodOptional<z.ZodArray<z.ZodEnum<["image", "video-cover"]>, "many">>;
@@ -50,15 +50,15 @@ export declare const ReferenceContentsPageSchema: z.ZodObject<{
50
50
  } & {
51
51
  provider: z.ZodEnum<["cosmos", "pinterest", "arena", "x"]>;
52
52
  }, "strip", z.ZodTypeAny, {
53
+ provider: "arena" | "pinterest" | "x" | "cosmos";
53
54
  title: string;
54
55
  text: string;
55
- provider: "arena" | "pinterest" | "x" | "cosmos";
56
56
  remoteId: string;
57
57
  media: {
58
58
  hash: string;
59
59
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
60
60
  bytes: number;
61
- representation: "image" | "variant" | "video-cover" | "page";
61
+ representation: "variant" | "image" | "video-cover" | "page";
62
62
  page?: number | undefined;
63
63
  }[];
64
64
  url?: string | undefined;
@@ -73,16 +73,16 @@ export declare const ReferenceContentsPageSchema: z.ZodObject<{
73
73
  remoteImageRepresentations?: ("image" | "video-cover")[] | undefined;
74
74
  unsupportedReason?: string | undefined;
75
75
  }, {
76
+ provider: "arena" | "pinterest" | "x" | "cosmos";
76
77
  title: string;
77
78
  text: string;
78
- provider: "arena" | "pinterest" | "x" | "cosmos";
79
79
  remoteId: string;
80
80
  media: {
81
81
  hash: string;
82
82
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
83
83
  bytes: number;
84
84
  page?: number | undefined;
85
- representation?: "image" | "variant" | "video-cover" | "page" | undefined;
85
+ representation?: "variant" | "image" | "video-cover" | "page" | undefined;
86
86
  }[];
87
87
  url?: string | undefined;
88
88
  variant?: {
@@ -102,15 +102,15 @@ export declare const ReferenceContentsPageSchema: z.ZodObject<{
102
102
  }, "strip", z.ZodTypeAny, {
103
103
  accountId: string;
104
104
  references: {
105
+ provider: "arena" | "pinterest" | "x" | "cosmos";
105
106
  title: string;
106
107
  text: string;
107
- provider: "arena" | "pinterest" | "x" | "cosmos";
108
108
  remoteId: string;
109
109
  media: {
110
110
  hash: string;
111
111
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
112
112
  bytes: number;
113
- representation: "image" | "variant" | "video-cover" | "page";
113
+ representation: "variant" | "image" | "video-cover" | "page";
114
114
  page?: number | undefined;
115
115
  }[];
116
116
  url?: string | undefined;
@@ -132,16 +132,16 @@ export declare const ReferenceContentsPageSchema: z.ZodObject<{
132
132
  }, {
133
133
  accountId: string;
134
134
  references: {
135
+ provider: "arena" | "pinterest" | "x" | "cosmos";
135
136
  title: string;
136
137
  text: string;
137
- provider: "arena" | "pinterest" | "x" | "cosmos";
138
138
  remoteId: string;
139
139
  media: {
140
140
  hash: string;
141
141
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
142
142
  bytes: number;
143
143
  page?: number | undefined;
144
- representation?: "image" | "variant" | "video-cover" | "page" | undefined;
144
+ representation?: "variant" | "image" | "video-cover" | "page" | undefined;
145
145
  }[];
146
146
  url?: string | undefined;
147
147
  variant?: {
@@ -29,32 +29,32 @@ export declare const variantReferenceSchema: z.ZodEffects<z.ZodObject<{
29
29
  title: string;
30
30
  id: string;
31
31
  url?: string | undefined;
32
+ reason?: string | undefined;
32
33
  image?: {
33
34
  hash: string;
34
35
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "image/avif";
35
36
  } | undefined;
36
- reason?: string | undefined;
37
37
  }, {
38
38
  title: string;
39
39
  id: string;
40
40
  url?: string | undefined;
41
- image?: unknown;
42
41
  reason?: string | undefined;
42
+ image?: unknown;
43
43
  }>, {
44
44
  title: string;
45
45
  id: string;
46
46
  url?: string | undefined;
47
+ reason?: string | undefined;
47
48
  image?: {
48
49
  hash: string;
49
50
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "image/avif";
50
51
  } | undefined;
51
- reason?: string | undefined;
52
52
  }, {
53
53
  title: string;
54
54
  id: string;
55
55
  url?: string | undefined;
56
- image?: unknown;
57
56
  reason?: string | undefined;
57
+ image?: unknown;
58
58
  }>;
59
59
  export type VariantReference = z.infer<typeof variantReferenceSchema>;
60
60
  export declare const mergeVariantReferences: (...groups: Array<readonly unknown[] | undefined>) => VariantReference[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivet-design",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "Local visual web development tool with AI-powered code modification",
5
5
  "main": "dist/index.js",
6
6
  "workspaces": [
@@ -33,6 +33,7 @@
33
33
  "test:node": "yarn test --selectProjects node --silent",
34
34
  "test:ui": "yarn test --selectProjects jsdom --silent",
35
35
  "test:e2e-helpers": "node --import tsx --test e2e/helpers/*.test.ts",
36
+ "test:supabase": "node --import tsx --test supabase/functions/_shared/*.test.ts",
36
37
  "test:install": "yarn build && node scripts/test-host-install.mjs",
37
38
  "rivet:channel": "tsx src/install/channelCli.ts",
38
39
  "test:watch": "jest --config src/jest.config.ts --watch",
@@ -1,4 +1,4 @@
1
- var Be=s=>{throw TypeError(s)};var Ee=(s,t,r)=>t.has(s)||Be("Cannot "+r);var h=(s,t,r)=>(Ee(s,t,"read from private field"),r?r.call(s):t.get(s)),z=(s,t,r)=>t.has(s)?Be("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,r),L=(s,t,r,i)=>(Ee(s,t,"write to private field"),i?i.call(s,r):t.set(s,r),r),A=(s,t,r)=>(Ee(s,t,"access private method"),r);import{S as lt,s as ct,h as Ve,g as Kt,n as fe,r as Qt,Q as dt,u as _e,a as Bt,b as Vt,c as d,e as Gt,d as Yt,f as Wt,i as ut,j as Ge,k as Jt,l as Xt,m as Zt,o as ce,p as me,q as es,t as e,B as J,v as Pe,P as ts,w as ss,x as rs,y as is,z as as,X as ht,D as mt,A as pt,C as xt,E as ft,F as bt,G as yt,H as gt,I as Ye,J as ns,K as os,L as ls,M as cs,N as ne,O as Se,R as ds,T as vt,U as ee,V as Y,W as x,Y as re,Z as H,_ as wt,$ as us,a0 as hs,a1 as ms,a2 as ps,a3 as xs,a4 as fs,a5 as bs,a6 as ys,a7 as B,a8 as gs,a9 as vs,aa as We,ab as ws,ac as js,ad as Ns,ae as ks,af as Ss,ag as jt,ah as _s,ai as Is,aj as Rs,ak as Cs,al as Es,am as Ps}from"./main-Dls3YqrM.js";var ie,ae,U,ye,se,pe,Te,nt,Ts=(nt=class extends lt{constructor(t,r){super();z(this,se);z(this,ie);z(this,ae);z(this,U);z(this,ye);L(this,ie,t),this.setOptions(r),this.bindMethods(),A(this,se,pe).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var i;const r=this.options;this.options=h(this,ie).defaultMutationOptions(t),ct(this.options,r)||h(this,ie).getMutationCache().notify({type:"observerOptionsUpdated",mutation:h(this,U),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ve(r.mutationKey)!==Ve(this.options.mutationKey)?this.reset():((i=h(this,U))==null?void 0:i.state.status)==="pending"&&h(this,U).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&h(this,U)&&(h(this,U).addObserver(this),A(this,se,pe).call(this))}onUnsubscribe(){var t;this.hasListeners()||(t=h(this,U))==null||t.removeObserver(this)}onMutationUpdate(t){A(this,se,pe).call(this),A(this,se,Te).call(this,t)}getCurrentResult(){return h(this,ae)}reset(){var t;(t=h(this,U))==null||t.removeObserver(this),L(this,U,void 0),A(this,se,pe).call(this),A(this,se,Te).call(this)}mutate(t,r){var i;return L(this,ye,r),(i=h(this,U))==null||i.removeObserver(this),L(this,U,h(this,ie).getMutationCache().build(h(this,ie),this.options)),h(this,U).addObserver(this),h(this,U).execute(t)}},ie=new WeakMap,ae=new WeakMap,U=new WeakMap,ye=new WeakMap,se=new WeakSet,pe=function(){var r;const t=((r=h(this,U))==null?void 0:r.state)??Kt();L(this,ae,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Te=function(t){fe.batch(()=>{var i,n,o,a;const r=h(this,ye);if(r&&this.hasListeners()){const l=h(this,ae).variables,m=h(this,ae).context,f={client:h(this,ie),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(i=r.onSuccess)==null||i.call(r,t.data,l,m,f)}catch(b){Promise.reject(b)}try{(n=r.onSettled)==null||n.call(r,t.data,null,l,m,f)}catch(b){Promise.reject(b)}}else if((t==null?void 0:t.type)==="error"){try{(o=r.onError)==null||o.call(r,t.error,l,m,f)}catch(b){Promise.reject(b)}try{(a=r.onSettled)==null||a.call(r,void 0,t.error,l,m,f)}catch(b){Promise.reject(b)}}}this.listeners.forEach(l=>{l(h(this,ae))})})},nt);function Je(s,t){const r=new Set(t);return s.filter(i=>!r.has(i))}var ue,Q,he,oe,G,le,ge,ve,we,je,O,Le,Oe,Nt,Me,Ae,De,ot,Ls=(ot=class extends lt{constructor(t,r,i){super();z(this,O);z(this,ue);z(this,Q);z(this,he);z(this,oe);z(this,G);z(this,le);z(this,ge);z(this,ve);z(this,we);z(this,je,[]);L(this,ue,t),L(this,oe,i),L(this,he,[]),L(this,G,[]),L(this,Q,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&h(this,G).forEach(t=>{t.subscribe(r=>{A(this,O,Ae).call(this,t,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,h(this,G).forEach(t=>{t.destroy()})}setQueries(t,r){L(this,he,t),L(this,oe,r),fe.batch(()=>{const i=h(this,G),n=A(this,O,Me).call(this,h(this,he));n.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const o=n.map(p=>p.observer),a=o.map(p=>p.getCurrentResult()),l=i.length!==o.length,m=o.some((p,j)=>p!==i[j]),f=l||m,b=f?!0:a.some((p,j)=>{const N=h(this,Q)[j];return!N||!ct(p,N)});!f&&!b||(f&&(L(this,je,n),L(this,G,o)),L(this,Q,a),this.hasListeners()&&(f&&(Je(i,o).forEach(p=>{p.destroy()}),Je(o,i).forEach(p=>{p.subscribe(j=>{A(this,O,Ae).call(this,p,j)})})),A(this,O,De).call(this)))})}getCurrentResult(){return h(this,Q)}getQueries(){return h(this,G).map(t=>t.getCurrentQuery())}getObservers(){return h(this,G)}getOptimisticResult(t,r){const i=A(this,O,Me).call(this,t),n=i.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),o=i.map(a=>a.defaultedQueryOptions.queryHash);return[n,a=>A(this,O,Oe).call(this,a??n,r,o),()=>A(this,O,Le).call(this,n,i)]}},ue=new WeakMap,Q=new WeakMap,he=new WeakMap,oe=new WeakMap,G=new WeakMap,le=new WeakMap,ge=new WeakMap,ve=new WeakMap,we=new WeakMap,je=new WeakMap,O=new WeakSet,Le=function(t,r){const i=new Set;return r.map((n,o)=>{const a=t[o];return n.defaultedQueryOptions.notifyOnChangeProps?a:n.observer.trackResult(a,l=>{i.has(l)||(i.add(l),r.forEach(m=>{m.observer.trackProp(l)}))})})},Oe=function(t,r,i){if(r){const n=h(this,we),o=i!==void 0&&n!==void 0&&(n.length!==i.length||i.some((a,l)=>a!==n[l]));return(h(this,Q)!==h(this,ve)||o||r!==h(this,ge))&&(L(this,ge,r),L(this,ve,h(this,Q)),i!==void 0&&L(this,we,i),L(this,le,Qt(h(this,le),r(t)))),h(this,le)}return t},Nt=function(){var t;return!((t=h(this,oe))!=null&&t.combine)||h(this,G).some((r,i)=>{var n;return r.options.suspense&&((n=h(this,Q)[i])==null?void 0:n.data)===void 0})},Me=function(t){const r=new Map;h(this,G).forEach(n=>{const o=n.options.queryHash;if(!o)return;const a=r.get(o);a?a.push(n):r.set(o,[n])});const i=[];return t.forEach(n=>{var l;const o=h(this,ue).defaultQueryOptions(n),a=((l=r.get(o.queryHash))==null?void 0:l.shift())??new dt(h(this,ue),o);i.push({defaultedQueryOptions:o,observer:a})}),i},Ae=function(t,r){const i=h(this,G).indexOf(t);i!==-1&&(L(this,Q,h(this,Q).slice()),h(this,Q)[i]=r,A(this,O,De).call(this))},De=function(){var t;if(this.hasListeners()){const r=A(this,O,Nt).call(this),i=h(this,le),n=r?i:A(this,O,Oe).call(this,A(this,O,Le).call(this,h(this,Q),h(this,je)),(t=h(this,oe))==null?void 0:t.combine);(r||i!==n)&&fe.batch(()=>{this.listeners.forEach(o=>{o(h(this,Q))})})}},ot);function Os({queries:s,...t},r){const i=_e(),n=Bt(),o=Vt(),a=t.subscribed!==!1,l=d.useMemo(()=>s.map(S=>{const y=i.defaultQueryOptions(S);return y._optimisticResults=n?"isRestoring":a?"optimistic":void 0,y}),[s,i,n,a]);l.forEach(S=>{Gt(S);const y=i.getQueryCache().get(S.queryHash);Yt(S,o,y)}),Wt(o);const[m]=d.useState(()=>new Ls(i,l,t)),[f,b,p]=m.getOptimisticResult(l,t.combine),j=!n&&a;d.useSyncExternalStore(d.useCallback(S=>j?m.subscribe(fe.batchCalls(S)):ut,[m,j]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),d.useEffect(()=>{m.setQueries(l,t)},[l,t,m]);const N=f.some((S,y)=>Ge(l[y],S))?f.flatMap((S,y)=>{const k=l[y];if(k&&Ge(k,S)){const $=new dt(i,k);return Jt(k,$,o)}return[]}):[];if(N.length>0)throw Promise.all(N);const R=f.find((S,y)=>{const k=l[y];return k&&Xt({result:S,errorResetBoundary:o,throwOnError:k.throwOnError,query:i.getQueryCache().get(k.queryHash),suspense:k.suspense})});if(R)throw R.error;return b(p())}function xe(s,t){const r=_e(),[i]=d.useState(()=>new Ts(r,s));d.useEffect(()=>{i.setOptions(s)},[i,s]);const n=d.useSyncExternalStore(d.useCallback(a=>i.subscribe(fe.batchCalls(a)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=d.useCallback((...a)=>{i.mutate(a[0],a[1]).catch(ut)},[i]);if(n.error&&Zt(i.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}/**
1
+ var Be=s=>{throw TypeError(s)};var Ee=(s,t,r)=>t.has(s)||Be("Cannot "+r);var h=(s,t,r)=>(Ee(s,t,"read from private field"),r?r.call(s):t.get(s)),z=(s,t,r)=>t.has(s)?Be("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,r),L=(s,t,r,i)=>(Ee(s,t,"write to private field"),i?i.call(s,r):t.set(s,r),r),A=(s,t,r)=>(Ee(s,t,"access private method"),r);import{S as lt,s as ct,h as Ve,g as Kt,n as fe,r as Qt,Q as dt,u as _e,a as Bt,b as Vt,c as d,e as Gt,d as Yt,f as Wt,i as ut,j as Ge,k as Jt,l as Xt,m as Zt,o as ce,p as me,q as es,t as e,B as J,v as Pe,P as ts,w as ss,x as rs,y as is,z as as,X as ht,D as mt,A as pt,C as xt,E as ft,F as bt,G as yt,H as gt,I as Ye,J as ns,K as os,L as ls,M as cs,N as ne,O as Se,R as ds,T as vt,U as ee,V as Y,W as x,Y as re,Z as H,_ as wt,$ as us,a0 as hs,a1 as ms,a2 as ps,a3 as xs,a4 as fs,a5 as bs,a6 as ys,a7 as B,a8 as gs,a9 as vs,aa as We,ab as ws,ac as js,ad as Ns,ae as ks,af as Ss,ag as jt,ah as _s,ai as Is,aj as Rs,ak as Cs,al as Es,am as Ps}from"./main-DQKavyjz.js";var ie,ae,U,ye,se,pe,Te,nt,Ts=(nt=class extends lt{constructor(t,r){super();z(this,se);z(this,ie);z(this,ae);z(this,U);z(this,ye);L(this,ie,t),this.setOptions(r),this.bindMethods(),A(this,se,pe).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var i;const r=this.options;this.options=h(this,ie).defaultMutationOptions(t),ct(this.options,r)||h(this,ie).getMutationCache().notify({type:"observerOptionsUpdated",mutation:h(this,U),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ve(r.mutationKey)!==Ve(this.options.mutationKey)?this.reset():((i=h(this,U))==null?void 0:i.state.status)==="pending"&&h(this,U).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&h(this,U)&&(h(this,U).addObserver(this),A(this,se,pe).call(this))}onUnsubscribe(){var t;this.hasListeners()||(t=h(this,U))==null||t.removeObserver(this)}onMutationUpdate(t){A(this,se,pe).call(this),A(this,se,Te).call(this,t)}getCurrentResult(){return h(this,ae)}reset(){var t;(t=h(this,U))==null||t.removeObserver(this),L(this,U,void 0),A(this,se,pe).call(this),A(this,se,Te).call(this)}mutate(t,r){var i;return L(this,ye,r),(i=h(this,U))==null||i.removeObserver(this),L(this,U,h(this,ie).getMutationCache().build(h(this,ie),this.options)),h(this,U).addObserver(this),h(this,U).execute(t)}},ie=new WeakMap,ae=new WeakMap,U=new WeakMap,ye=new WeakMap,se=new WeakSet,pe=function(){var r;const t=((r=h(this,U))==null?void 0:r.state)??Kt();L(this,ae,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Te=function(t){fe.batch(()=>{var i,n,o,a;const r=h(this,ye);if(r&&this.hasListeners()){const l=h(this,ae).variables,m=h(this,ae).context,f={client:h(this,ie),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(i=r.onSuccess)==null||i.call(r,t.data,l,m,f)}catch(b){Promise.reject(b)}try{(n=r.onSettled)==null||n.call(r,t.data,null,l,m,f)}catch(b){Promise.reject(b)}}else if((t==null?void 0:t.type)==="error"){try{(o=r.onError)==null||o.call(r,t.error,l,m,f)}catch(b){Promise.reject(b)}try{(a=r.onSettled)==null||a.call(r,void 0,t.error,l,m,f)}catch(b){Promise.reject(b)}}}this.listeners.forEach(l=>{l(h(this,ae))})})},nt);function Je(s,t){const r=new Set(t);return s.filter(i=>!r.has(i))}var ue,Q,he,oe,G,le,ge,ve,we,je,O,Le,Oe,Nt,Me,Ae,De,ot,Ls=(ot=class extends lt{constructor(t,r,i){super();z(this,O);z(this,ue);z(this,Q);z(this,he);z(this,oe);z(this,G);z(this,le);z(this,ge);z(this,ve);z(this,we);z(this,je,[]);L(this,ue,t),L(this,oe,i),L(this,he,[]),L(this,G,[]),L(this,Q,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&h(this,G).forEach(t=>{t.subscribe(r=>{A(this,O,Ae).call(this,t,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,h(this,G).forEach(t=>{t.destroy()})}setQueries(t,r){L(this,he,t),L(this,oe,r),fe.batch(()=>{const i=h(this,G),n=A(this,O,Me).call(this,h(this,he));n.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const o=n.map(p=>p.observer),a=o.map(p=>p.getCurrentResult()),l=i.length!==o.length,m=o.some((p,j)=>p!==i[j]),f=l||m,b=f?!0:a.some((p,j)=>{const N=h(this,Q)[j];return!N||!ct(p,N)});!f&&!b||(f&&(L(this,je,n),L(this,G,o)),L(this,Q,a),this.hasListeners()&&(f&&(Je(i,o).forEach(p=>{p.destroy()}),Je(o,i).forEach(p=>{p.subscribe(j=>{A(this,O,Ae).call(this,p,j)})})),A(this,O,De).call(this)))})}getCurrentResult(){return h(this,Q)}getQueries(){return h(this,G).map(t=>t.getCurrentQuery())}getObservers(){return h(this,G)}getOptimisticResult(t,r){const i=A(this,O,Me).call(this,t),n=i.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),o=i.map(a=>a.defaultedQueryOptions.queryHash);return[n,a=>A(this,O,Oe).call(this,a??n,r,o),()=>A(this,O,Le).call(this,n,i)]}},ue=new WeakMap,Q=new WeakMap,he=new WeakMap,oe=new WeakMap,G=new WeakMap,le=new WeakMap,ge=new WeakMap,ve=new WeakMap,we=new WeakMap,je=new WeakMap,O=new WeakSet,Le=function(t,r){const i=new Set;return r.map((n,o)=>{const a=t[o];return n.defaultedQueryOptions.notifyOnChangeProps?a:n.observer.trackResult(a,l=>{i.has(l)||(i.add(l),r.forEach(m=>{m.observer.trackProp(l)}))})})},Oe=function(t,r,i){if(r){const n=h(this,we),o=i!==void 0&&n!==void 0&&(n.length!==i.length||i.some((a,l)=>a!==n[l]));return(h(this,Q)!==h(this,ve)||o||r!==h(this,ge))&&(L(this,ge,r),L(this,ve,h(this,Q)),i!==void 0&&L(this,we,i),L(this,le,Qt(h(this,le),r(t)))),h(this,le)}return t},Nt=function(){var t;return!((t=h(this,oe))!=null&&t.combine)||h(this,G).some((r,i)=>{var n;return r.options.suspense&&((n=h(this,Q)[i])==null?void 0:n.data)===void 0})},Me=function(t){const r=new Map;h(this,G).forEach(n=>{const o=n.options.queryHash;if(!o)return;const a=r.get(o);a?a.push(n):r.set(o,[n])});const i=[];return t.forEach(n=>{var l;const o=h(this,ue).defaultQueryOptions(n),a=((l=r.get(o.queryHash))==null?void 0:l.shift())??new dt(h(this,ue),o);i.push({defaultedQueryOptions:o,observer:a})}),i},Ae=function(t,r){const i=h(this,G).indexOf(t);i!==-1&&(L(this,Q,h(this,Q).slice()),h(this,Q)[i]=r,A(this,O,De).call(this))},De=function(){var t;if(this.hasListeners()){const r=A(this,O,Nt).call(this),i=h(this,le),n=r?i:A(this,O,Oe).call(this,A(this,O,Le).call(this,h(this,Q),h(this,je)),(t=h(this,oe))==null?void 0:t.combine);(r||i!==n)&&fe.batch(()=>{this.listeners.forEach(o=>{o(h(this,Q))})})}},ot);function Os({queries:s,...t},r){const i=_e(),n=Bt(),o=Vt(),a=t.subscribed!==!1,l=d.useMemo(()=>s.map(S=>{const y=i.defaultQueryOptions(S);return y._optimisticResults=n?"isRestoring":a?"optimistic":void 0,y}),[s,i,n,a]);l.forEach(S=>{Gt(S);const y=i.getQueryCache().get(S.queryHash);Yt(S,o,y)}),Wt(o);const[m]=d.useState(()=>new Ls(i,l,t)),[f,b,p]=m.getOptimisticResult(l,t.combine),j=!n&&a;d.useSyncExternalStore(d.useCallback(S=>j?m.subscribe(fe.batchCalls(S)):ut,[m,j]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),d.useEffect(()=>{m.setQueries(l,t)},[l,t,m]);const N=f.some((S,y)=>Ge(l[y],S))?f.flatMap((S,y)=>{const k=l[y];if(k&&Ge(k,S)){const $=new dt(i,k);return Jt(k,$,o)}return[]}):[];if(N.length>0)throw Promise.all(N);const R=f.find((S,y)=>{const k=l[y];return k&&Xt({result:S,errorResetBoundary:o,throwOnError:k.throwOnError,query:i.getQueryCache().get(k.queryHash),suspense:k.suspense})});if(R)throw R.error;return b(p())}function xe(s,t){const r=_e(),[i]=d.useState(()=>new Ts(r,s));d.useEffect(()=>{i.setOptions(s)},[i,s]);const n=d.useSyncExternalStore(d.useCallback(a=>i.subscribe(fe.batchCalls(a)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=d.useCallback((...a)=>{i.mutate(a[0],a[1]).catch(ut)},[i]);if(n.error&&Zt(i.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}/**
2
2
  * @license lucide-react v1.61.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.