@shiftengineering/folio 0.0.76 → 0.0.78

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.
@@ -38,7 +38,7 @@ var tt;
38
38
  function Or() {
39
39
  return tt || (tt = 1, process.env.NODE_ENV !== "production" && function() {
40
40
  var e = bt, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), l = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), x = Symbol.iterator, P = "@@iterator";
41
- function U(o) {
41
+ function L(o) {
42
42
  if (o === null || typeof o != "object")
43
43
  return null;
44
44
  var c = x && o[x] || o[P];
@@ -49,10 +49,10 @@ function Or() {
49
49
  {
50
50
  for (var c = arguments.length, d = new Array(c > 1 ? c - 1 : 0), y = 1; y < c; y++)
51
51
  d[y - 1] = arguments[y];
52
- Ut("error", o, d);
52
+ Lt("error", o, d);
53
53
  }
54
54
  }
55
- function Ut(o, c, d) {
55
+ function Lt(o, c, d) {
56
56
  {
57
57
  var y = j.ReactDebugCurrentFrame, E = y.getStackAddendum();
58
58
  E !== "" && (c += "%s", d = d.concat([E]));
@@ -127,9 +127,9 @@ function Or() {
127
127
  return null;
128
128
  }
129
129
  var $ = Object.assign, B = 0, je, Ae, Ie, Fe, De, $e, Ne;
130
- function Le() {
130
+ function Ue() {
131
131
  }
132
- Le.__reactDisabledLog = !0;
132
+ Ue.__reactDisabledLog = !0;
133
133
  function Yt() {
134
134
  {
135
135
  if (B === 0) {
@@ -137,7 +137,7 @@ function Or() {
137
137
  var o = {
138
138
  configurable: !0,
139
139
  enumerable: !0,
140
- value: Le,
140
+ value: Ue,
141
141
  writable: !0
142
142
  };
143
143
  Object.defineProperties(console, {
@@ -207,7 +207,7 @@ function Or() {
207
207
  var Gt = typeof WeakMap == "function" ? WeakMap : Map;
208
208
  te = new Gt();
209
209
  }
210
- function Ue(o, c) {
210
+ function Le(o, c) {
211
211
  if (!o || le)
212
212
  return "";
213
213
  {
@@ -279,7 +279,7 @@ function Or() {
279
279
  return typeof o == "function" && te.set(o, N), N;
280
280
  }
281
281
  function Xt(o, c, d) {
282
- return Ue(o, !1);
282
+ return Le(o, !1);
283
283
  }
284
284
  function Jt(o) {
285
285
  var c = o.prototype;
@@ -289,7 +289,7 @@ function Or() {
289
289
  if (o == null)
290
290
  return "";
291
291
  if (typeof o == "function")
292
- return Ue(o, Jt(o));
292
+ return Le(o, Jt(o));
293
293
  if (typeof o == "string")
294
294
  return ee(o);
295
295
  switch (o) {
@@ -525,7 +525,7 @@ Check the top-level render call using <` + d + ">.");
525
525
  else if (pe(o))
526
526
  o._store && (o._store.validated = !0);
527
527
  else if (o) {
528
- var E = U(o);
528
+ var E = L(o);
529
529
  if (typeof E == "function" && E !== o.entries)
530
530
  for (var R = E.call(o), v; !(v = R.next()).done; )
531
531
  pe(v.value) && Xe(v.value, c);
@@ -897,14 +897,14 @@ function oe(e, t, r) {
897
897
  writable: !0
898
898
  }) : e[t] = r, e;
899
899
  }
900
- function Lr(e) {
900
+ function Ur(e) {
901
901
  return e instanceof F || /**
902
902
  * @deprecated
903
903
  * Delete in next major
904
904
  */
905
905
  e instanceof Error && e.name === "TRPCClientError";
906
906
  }
907
- function Ur(e) {
907
+ function Lr(e) {
908
908
  return X(e) && X(e.error) && typeof e.error.code == "number" && typeof e.error.message == "string";
909
909
  }
910
910
  function Vr(e, t) {
@@ -913,10 +913,10 @@ function Vr(e, t) {
913
913
  class F extends Error {
914
914
  static from(t, r = {}) {
915
915
  const n = t;
916
- return Lr(n) ? (r.meta && (n.meta = {
916
+ return Ur(n) ? (r.meta && (n.meta = {
917
917
  ...n.meta,
918
918
  ...r.meta
919
- }), n) : Ur(n) ? new F(n.error.message, {
919
+ }), n) : Lr(n) ? new F(n.error.message, {
920
920
  ...r,
921
921
  result: n
922
922
  }) : new F(Vr(n, "Unknown error"), {
@@ -1106,11 +1106,11 @@ function at(e) {
1106
1106
  e.fetch(f.items.map((p) => p.key)).then(async (p) => {
1107
1107
  var h;
1108
1108
  await Promise.all(p.map(async (b, x) => {
1109
- var U, j;
1109
+ var L, j;
1110
1110
  const P = f.items[x];
1111
1111
  try {
1112
1112
  const S = await Promise.resolve(b);
1113
- (U = P.resolve) == null || U.call(P, S);
1113
+ (L = P.resolve) == null || L.call(P, S);
1114
1114
  } catch (S) {
1115
1115
  (j = P.reject) == null || j.call(P, S);
1116
1116
  }
@@ -1470,7 +1470,7 @@ async function mn(e) {
1470
1470
  const n = `${t.includes("?") ? "&" : "?"}connectionParams=1`;
1471
1471
  return t + n;
1472
1472
  }
1473
- function L(e, t, r) {
1473
+ function U(e, t, r) {
1474
1474
  return t in e ? Object.defineProperty(e, t, {
1475
1475
  value: r,
1476
1476
  enumerable: !0,
@@ -1552,12 +1552,12 @@ class se {
1552
1552
  }
1553
1553
  }
1554
1554
  constructor(t) {
1555
- if (L(this, "id", ++se.connectCount), L(this, "WebSocketPonyfill", void 0), L(this, "urlOptions", void 0), L(this, "keepAliveOpts", void 0), L(this, "wsObservable", Ar(null)), L(this, "openPromise", null), this.WebSocketPonyfill = t.WebSocketPonyfill ?? WebSocket, !this.WebSocketPonyfill)
1555
+ if (U(this, "id", ++se.connectCount), U(this, "WebSocketPonyfill", void 0), U(this, "urlOptions", void 0), U(this, "keepAliveOpts", void 0), U(this, "wsObservable", Ar(null)), U(this, "openPromise", null), this.WebSocketPonyfill = t.WebSocketPonyfill ?? WebSocket, !this.WebSocketPonyfill)
1556
1556
  throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");
1557
1557
  this.urlOptions = t.urlOptions, this.keepAliveOpts = t.keepAlive;
1558
1558
  }
1559
1559
  }
1560
- L(se, "connectCount", 0);
1560
+ U(se, "connectCount", 0);
1561
1561
  class hn {
1562
1562
  constructor() {
1563
1563
  this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
@@ -1895,12 +1895,12 @@ function Se(e, t, r = []) {
1895
1895
  Se(s, t, [...r, ...G(u)]);
1896
1896
  }), t(n, r);
1897
1897
  }
1898
- function Ln(e, t, r) {
1898
+ function Un(e, t, r) {
1899
1899
  return Se(t, (n, i) => {
1900
1900
  e = Oe(e, i, (s) => $n(s, n, r));
1901
1901
  }), e;
1902
1902
  }
1903
- function Un(e, t) {
1903
+ function Ln(e, t) {
1904
1904
  function r(n, i) {
1905
1905
  const s = Nn(e, G(i));
1906
1906
  n.map(G).forEach((u) => {
@@ -1960,8 +1960,8 @@ const Dt = (e, t, r, n, i = [], s = [], u = /* @__PURE__ */ new Map()) => {
1960
1960
  if (x === "__proto__" || x === "constructor" || x === "prototype")
1961
1961
  throw new Error(`Detected property ${x}. This is a prototype pollution risk, please remove it from your object.`);
1962
1962
  const P = Dt(b, t, r, n, [...i, x], [...s, e], u);
1963
- m[x] = P.transformedValue, D(P.annotations) ? p[x] = P.annotations : J(P.annotations) && M(P.annotations, (U, j) => {
1964
- p[St(x) + "." + j] = U;
1963
+ m[x] = P.transformedValue, D(P.annotations) ? p[x] = P.annotations : J(P.annotations) && M(P.annotations, (L, j) => {
1964
+ p[St(x) + "." + j] = L;
1965
1965
  });
1966
1966
  });
1967
1967
  const h = Te(p) ? {
@@ -2031,7 +2031,7 @@ class w {
2031
2031
  deserialize(t) {
2032
2032
  const { json: r, meta: n } = t;
2033
2033
  let i = xe(r);
2034
- return n != null && n.values && (i = Ln(i, n.values, this)), n != null && n.referentialEqualities && (i = Un(i, n.referentialEqualities)), i;
2034
+ return n != null && n.values && (i = Un(i, n.values, this)), n != null && n.referentialEqualities && (i = Ln(i, n.referentialEqualities)), i;
2035
2035
  }
2036
2036
  stringify(t) {
2037
2037
  return JSON.stringify(this.serialize(t));
@@ -2110,7 +2110,8 @@ function Yn(e, t) {
2110
2110
  projectId: n,
2111
2111
  mimeType: _e.PDF,
2112
2112
  // Adjust as needed
2113
- path: u.path,
2113
+ path: u.blobUrl,
2114
+ // Map blobUrl back to path for API
2114
2115
  name: u.name,
2115
2116
  size: 0,
2116
2117
  // You might need to calculate or pass size
@@ -2120,7 +2121,8 @@ function Yn(e, t) {
2120
2121
  }
2121
2122
  });
2122
2123
  s.push({
2123
- path: l.path,
2124
+ blobUrl: l.path,
2125
+ // Map path from API to blobUrl for client
2124
2126
  name: l.name,
2125
2127
  id: l.id
2126
2128
  });
@@ -2130,7 +2132,8 @@ function Yn(e, t) {
2130
2132
  getFilesForProject: async (n) => (await r.fileRouter.getFilesByProject.query({
2131
2133
  projectId: n
2132
2134
  })).map((s) => ({
2133
- path: s.path,
2135
+ blobUrl: s.path,
2136
+ // Map path from API to blobUrl for client
2134
2137
  name: s.name,
2135
2138
  id: s.id
2136
2139
  }))
@@ -2148,7 +2151,7 @@ function Zn({
2148
2151
  s(l);
2149
2152
  }, [t, r, n]), /* @__PURE__ */ Re.jsx(Nt.Provider, { value: { host: t, port: r, client: i }, children: e });
2150
2153
  }
2151
- function Lt() {
2154
+ function Ut() {
2152
2155
  const e = Rr(Nt);
2153
2156
  if (!e)
2154
2157
  throw new Error("useFolioContext must be used within a FolioProvider");
@@ -2163,7 +2166,7 @@ function Qn({
2163
2166
  className: i = "",
2164
2167
  iframeProps: s = {}
2165
2168
  }) {
2166
- const { host: u, port: l } = Lt(), a = Gn(null), [f, m] = Xn();
2169
+ const { host: u, port: l } = Ut(), a = Gn(null), [f, m] = Xn();
2167
2170
  return Hn(() => {
2168
2171
  m(`${u}:${l}`);
2169
2172
  }, [u, l]), f ? /* @__PURE__ */ Re.jsx(
@@ -2198,7 +2201,7 @@ function Qn({
2198
2201
  ) : null;
2199
2202
  }
2200
2203
  function eo() {
2201
- const { client: e } = Lt(), [t, r] = Ee(!1), [n, i] = Ee(null);
2204
+ const { client: e } = Ut(), [t, r] = Ee(!1), [n, i] = Ee(null);
2202
2205
  return {
2203
2206
  isLoading: t,
2204
2207
  error: n,
@@ -14,21 +14,21 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ce;function Mt(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){var e=j,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),x=Symbol.iterator,P="@@iterator";function W(o){if(o===null||typeof o!="object")return null;var c=x&&o[x]||o[P];return typeof c=="function"?c:null}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(o){{for(var c=arguments.length,d=new Array(c>1?c-1:0),y=1;y<c;y++)d[y-1]=arguments[y];yn("error",o,d)}}function yn(o,c,d){{var y=A.ReactDebugCurrentFrame,E=y.getStackAddendum();E!==""&&(c+="%s",d=d.concat([E]));var R=d.map(function(v){return String(v)});R.unshift("Warning: "+c),Function.prototype.apply.call(console[o],console,R)}}var hn=!1,gn=!1,bn=!1,wn=!1,vn=!1,pt;pt=Symbol.for("react.module.reference");function En(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===s||vn||o===i||o===f||o===m||wn||o===w||hn||gn||bn||typeof o=="object"&&o!==null&&(o.$$typeof===h||o.$$typeof===p||o.$$typeof===u||o.$$typeof===l||o.$$typeof===a||o.$$typeof===pt||o.getModuleId!==void 0))}function Pn(o,c,d){var y=o.displayName;if(y)return y;var E=c.displayName||c.name||"";return E!==""?d+"("+E+")":d}function yt(o){return o.displayName||"Context"}function L(o){if(o==null)return null;if(typeof o.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case m:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case l:var c=o;return yt(c)+".Consumer";case u:var d=o;return yt(d._context)+".Provider";case a:return Pn(o,o.render,"ForwardRef");case p:var y=o.displayName||null;return y!==null?y:L(o.type)||"Memo";case h:{var E=o,R=E._payload,v=E._init;try{return L(v(R))}catch{return null}}}return null}var V=Object.assign,ee=0,ht,gt,bt,wt,vt,Et,Pt;function Rt(){}Rt.__reactDisabledLog=!0;function Rn(){{if(ee===0){ht=console.log,gt=console.info,bt=console.warn,wt=console.error,vt=console.group,Et=console.groupCollapsed,Pt=console.groupEnd;var o={configurable:!0,enumerable:!0,value:Rt,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}ee++}}function Tn(){{if(ee--,ee===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:V({},o,{value:ht}),info:V({},o,{value:gt}),warn:V({},o,{value:bt}),error:V({},o,{value:wt}),group:V({},o,{value:vt}),groupCollapsed:V({},o,{value:Et}),groupEnd:V({},o,{value:Pt})})}ee<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Pe=A.ReactCurrentDispatcher,Re;function se(o,c,d){{if(Re===void 0)try{throw Error()}catch(E){var y=E.stack.trim().match(/\n( *(at )?)/);Re=y&&y[1]||""}return`
17
+ */var Ce;function Mt(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){var e=j,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),x=Symbol.iterator,P="@@iterator";function W(o){if(o===null||typeof o!="object")return null;var c=x&&o[x]||o[P];return typeof c=="function"?c:null}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(o){{for(var c=arguments.length,d=new Array(c>1?c-1:0),y=1;y<c;y++)d[y-1]=arguments[y];yn("error",o,d)}}function yn(o,c,d){{var y=A.ReactDebugCurrentFrame,E=y.getStackAddendum();E!==""&&(c+="%s",d=d.concat([E]));var R=d.map(function(v){return String(v)});R.unshift("Warning: "+c),Function.prototype.apply.call(console[o],console,R)}}var hn=!1,gn=!1,bn=!1,wn=!1,vn=!1,pt;pt=Symbol.for("react.module.reference");function En(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===s||vn||o===i||o===f||o===m||wn||o===w||hn||gn||bn||typeof o=="object"&&o!==null&&(o.$$typeof===h||o.$$typeof===p||o.$$typeof===u||o.$$typeof===l||o.$$typeof===a||o.$$typeof===pt||o.getModuleId!==void 0))}function Pn(o,c,d){var y=o.displayName;if(y)return y;var E=c.displayName||c.name||"";return E!==""?d+"("+E+")":d}function yt(o){return o.displayName||"Context"}function U(o){if(o==null)return null;if(typeof o.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case m:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case l:var c=o;return yt(c)+".Consumer";case u:var d=o;return yt(d._context)+".Provider";case a:return Pn(o,o.render,"ForwardRef");case p:var y=o.displayName||null;return y!==null?y:U(o.type)||"Memo";case h:{var E=o,R=E._payload,v=E._init;try{return U(v(R))}catch{return null}}}return null}var V=Object.assign,ee=0,ht,gt,bt,wt,vt,Et,Pt;function Rt(){}Rt.__reactDisabledLog=!0;function Rn(){{if(ee===0){ht=console.log,gt=console.info,bt=console.warn,wt=console.error,vt=console.group,Et=console.groupCollapsed,Pt=console.groupEnd;var o={configurable:!0,enumerable:!0,value:Rt,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}ee++}}function Tn(){{if(ee--,ee===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:V({},o,{value:ht}),info:V({},o,{value:gt}),warn:V({},o,{value:bt}),error:V({},o,{value:wt}),group:V({},o,{value:vt}),groupCollapsed:V({},o,{value:Et}),groupEnd:V({},o,{value:Pt})})}ee<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Pe=A.ReactCurrentDispatcher,Re;function se(o,c,d){{if(Re===void 0)try{throw Error()}catch(E){var y=E.stack.trim().match(/\n( *(at )?)/);Re=y&&y[1]||""}return`
18
18
  `+Re+o}}var Te=!1,ae;{var On=typeof WeakMap=="function"?WeakMap:Map;ae=new On}function Tt(o,c){if(!o||Te)return"";{var d=ae.get(o);if(d!==void 0)return d}var y;Te=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var R;R=Pe.current,Pe.current=null,Rn();try{if(c){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(k){y=k}Reflect.construct(o,[],v)}else{try{v.call()}catch(k){y=k}o.call(v.prototype)}}else{try{throw Error()}catch(k){y=k}o()}}catch(k){if(k&&y&&typeof k.stack=="string"){for(var g=k.stack.split(`
19
19
  `),_=y.stack.split(`
20
20
  `),T=g.length-1,O=_.length-1;T>=1&&O>=0&&g[T]!==_[O];)O--;for(;T>=1&&O>=0;T--,O--)if(g[T]!==_[O]){if(T!==1||O!==1)do if(T--,O--,O<0||g[T]!==_[O]){var C=`
21
- `+g[T].replace(" at new "," at ");return o.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",o.displayName)),typeof o=="function"&&ae.set(o,C),C}while(T>=1&&O>=0);break}}}finally{Te=!1,Pe.current=R,Tn(),Error.prepareStackTrace=E}var K=o?o.displayName||o.name:"",$=K?se(K):"";return typeof o=="function"&&ae.set(o,$),$}function Sn(o,c,d){return Tt(o,!1)}function xn(o){var c=o.prototype;return!!(c&&c.isReactComponent)}function ue(o,c,d){if(o==null)return"";if(typeof o=="function")return Tt(o,xn(o));if(typeof o=="string")return se(o);switch(o){case f:return se("Suspense");case m:return se("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case a:return Sn(o.render);case p:return ue(o.type,c,d);case h:{var y=o,E=y._payload,R=y._init;try{return ue(R(E),c,d)}catch{}}}return""}var te=Object.prototype.hasOwnProperty,Ot={},St=A.ReactDebugCurrentFrame;function ce(o){if(o){var c=o._owner,d=ue(o.type,o._source,c?c.type:null);St.setExtraStackFrame(d)}else St.setExtraStackFrame(null)}function _n(o,c,d,y,E){{var R=Function.call.bind(te);for(var v in o)if(R(o,v)){var g=void 0;try{if(typeof o[v]!="function"){var _=Error((y||"React class")+": "+d+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}g=o[v](c,v,y,d,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){g=T}g&&!(g instanceof Error)&&(ce(E),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",y||"React class",d,v,typeof g),ce(null)),g instanceof Error&&!(g.message in Ot)&&(Ot[g.message]=!0,ce(E),S("Failed %s type: %s",d,g.message),ce(null))}}}var kn=Array.isArray;function Oe(o){return kn(o)}function jn(o){{var c=typeof Symbol=="function"&&Symbol.toStringTag,d=c&&o[Symbol.toStringTag]||o.constructor.name||"Object";return d}}function Cn(o){try{return xt(o),!1}catch{return!0}}function xt(o){return""+o}function _t(o){if(Cn(o))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jn(o)),xt(o)}var kt=A.ReactCurrentOwner,An={key:!0,ref:!0,__self:!0,__source:!0},jt,Ct;function In(o){if(te.call(o,"ref")){var c=Object.getOwnPropertyDescriptor(o,"ref").get;if(c&&c.isReactWarning)return!1}return o.ref!==void 0}function Fn(o){if(te.call(o,"key")){var c=Object.getOwnPropertyDescriptor(o,"key").get;if(c&&c.isReactWarning)return!1}return o.key!==void 0}function Dn(o,c){typeof o.ref=="string"&&kt.current}function Nn(o,c){{var d=function(){jt||(jt=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};d.isReactWarning=!0,Object.defineProperty(o,"key",{get:d,configurable:!0})}}function Ln(o,c){{var d=function(){Ct||(Ct=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};d.isReactWarning=!0,Object.defineProperty(o,"ref",{get:d,configurable:!0})}}var Un=function(o,c,d,y,E,R,v){var g={$$typeof:t,type:o,key:c,ref:d,props:v,_owner:R};return g._store={},Object.defineProperty(g._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(g,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(g,"_source",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.freeze&&(Object.freeze(g.props),Object.freeze(g)),g};function Vn(o,c,d,y,E){{var R,v={},g=null,_=null;d!==void 0&&(_t(d),g=""+d),Fn(c)&&(_t(c.key),g=""+c.key),In(c)&&(_=c.ref,Dn(c,E));for(R in c)te.call(c,R)&&!An.hasOwnProperty(R)&&(v[R]=c[R]);if(o&&o.defaultProps){var T=o.defaultProps;for(R in T)v[R]===void 0&&(v[R]=T[R])}if(g||_){var O=typeof o=="function"?o.displayName||o.name||"Unknown":o;g&&Nn(v,O),_&&Ln(v,O)}return Un(o,g,_,E,y,kt.current,v)}}var Se=A.ReactCurrentOwner,At=A.ReactDebugCurrentFrame;function B(o){if(o){var c=o._owner,d=ue(o.type,o._source,c?c.type:null);At.setExtraStackFrame(d)}else At.setExtraStackFrame(null)}var xe;xe=!1;function _e(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function It(){{if(Se.current){var o=L(Se.current.type);if(o)return`
21
+ `+g[T].replace(" at new "," at ");return o.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",o.displayName)),typeof o=="function"&&ae.set(o,C),C}while(T>=1&&O>=0);break}}}finally{Te=!1,Pe.current=R,Tn(),Error.prepareStackTrace=E}var K=o?o.displayName||o.name:"",$=K?se(K):"";return typeof o=="function"&&ae.set(o,$),$}function Sn(o,c,d){return Tt(o,!1)}function xn(o){var c=o.prototype;return!!(c&&c.isReactComponent)}function ue(o,c,d){if(o==null)return"";if(typeof o=="function")return Tt(o,xn(o));if(typeof o=="string")return se(o);switch(o){case f:return se("Suspense");case m:return se("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case a:return Sn(o.render);case p:return ue(o.type,c,d);case h:{var y=o,E=y._payload,R=y._init;try{return ue(R(E),c,d)}catch{}}}return""}var te=Object.prototype.hasOwnProperty,Ot={},St=A.ReactDebugCurrentFrame;function ce(o){if(o){var c=o._owner,d=ue(o.type,o._source,c?c.type:null);St.setExtraStackFrame(d)}else St.setExtraStackFrame(null)}function _n(o,c,d,y,E){{var R=Function.call.bind(te);for(var v in o)if(R(o,v)){var g=void 0;try{if(typeof o[v]!="function"){var _=Error((y||"React class")+": "+d+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}g=o[v](c,v,y,d,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){g=T}g&&!(g instanceof Error)&&(ce(E),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",y||"React class",d,v,typeof g),ce(null)),g instanceof Error&&!(g.message in Ot)&&(Ot[g.message]=!0,ce(E),S("Failed %s type: %s",d,g.message),ce(null))}}}var kn=Array.isArray;function Oe(o){return kn(o)}function jn(o){{var c=typeof Symbol=="function"&&Symbol.toStringTag,d=c&&o[Symbol.toStringTag]||o.constructor.name||"Object";return d}}function Cn(o){try{return xt(o),!1}catch{return!0}}function xt(o){return""+o}function _t(o){if(Cn(o))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jn(o)),xt(o)}var kt=A.ReactCurrentOwner,An={key:!0,ref:!0,__self:!0,__source:!0},jt,Ct;function In(o){if(te.call(o,"ref")){var c=Object.getOwnPropertyDescriptor(o,"ref").get;if(c&&c.isReactWarning)return!1}return o.ref!==void 0}function Fn(o){if(te.call(o,"key")){var c=Object.getOwnPropertyDescriptor(o,"key").get;if(c&&c.isReactWarning)return!1}return o.key!==void 0}function Dn(o,c){typeof o.ref=="string"&&kt.current}function Nn(o,c){{var d=function(){jt||(jt=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};d.isReactWarning=!0,Object.defineProperty(o,"key",{get:d,configurable:!0})}}function Un(o,c){{var d=function(){Ct||(Ct=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};d.isReactWarning=!0,Object.defineProperty(o,"ref",{get:d,configurable:!0})}}var Ln=function(o,c,d,y,E,R,v){var g={$$typeof:t,type:o,key:c,ref:d,props:v,_owner:R};return g._store={},Object.defineProperty(g._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(g,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(g,"_source",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.freeze&&(Object.freeze(g.props),Object.freeze(g)),g};function Vn(o,c,d,y,E){{var R,v={},g=null,_=null;d!==void 0&&(_t(d),g=""+d),Fn(c)&&(_t(c.key),g=""+c.key),In(c)&&(_=c.ref,Dn(c,E));for(R in c)te.call(c,R)&&!An.hasOwnProperty(R)&&(v[R]=c[R]);if(o&&o.defaultProps){var T=o.defaultProps;for(R in T)v[R]===void 0&&(v[R]=T[R])}if(g||_){var O=typeof o=="function"?o.displayName||o.name||"Unknown":o;g&&Nn(v,O),_&&Un(v,O)}return Ln(o,g,_,E,y,kt.current,v)}}var Se=A.ReactCurrentOwner,At=A.ReactDebugCurrentFrame;function B(o){if(o){var c=o._owner,d=ue(o.type,o._source,c?c.type:null);At.setExtraStackFrame(d)}else At.setExtraStackFrame(null)}var xe;xe=!1;function _e(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function It(){{if(Se.current){var o=U(Se.current.type);if(o)return`
22
22
 
23
23
  Check the render method of \``+o+"`."}return""}}function $n(o){return""}var Ft={};function zn(o){{var c=It();if(!c){var d=typeof o=="string"?o:o.displayName||o.name;d&&(c=`
24
24
 
25
- Check the top-level render call using <`+d+">.")}return c}}function Dt(o,c){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var d=zn(c);if(Ft[d])return;Ft[d]=!0;var y="";o&&o._owner&&o._owner!==Se.current&&(y=" It was passed a child from "+L(o._owner.type)+"."),B(o),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',d,y),B(null)}}function Nt(o,c){{if(typeof o!="object")return;if(Oe(o))for(var d=0;d<o.length;d++){var y=o[d];_e(y)&&Dt(y,c)}else if(_e(o))o._store&&(o._store.validated=!0);else if(o){var E=W(o);if(typeof E=="function"&&E!==o.entries)for(var R=E.call(o),v;!(v=R.next()).done;)_e(v.value)&&Dt(v.value,c)}}}function Mn(o){{var c=o.type;if(c==null||typeof c=="string")return;var d;if(typeof c=="function")d=c.propTypes;else if(typeof c=="object"&&(c.$$typeof===a||c.$$typeof===p))d=c.propTypes;else return;if(d){var y=L(c);_n(d,o.props,"prop",y,o)}else if(c.PropTypes!==void 0&&!xe){xe=!0;var E=L(c);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof c.getDefaultProps=="function"&&!c.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function qn(o){{for(var c=Object.keys(o.props),d=0;d<c.length;d++){var y=c[d];if(y!=="children"&&y!=="key"){B(o),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),B(null);break}}o.ref!==null&&(B(o),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}var Lt={};function Ut(o,c,d,y,E,R){{var v=En(o);if(!v){var g="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(g+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=$n();_?g+=_:g+=It();var T;o===null?T="null":Oe(o)?T="array":o!==void 0&&o.$$typeof===t?(T="<"+(L(o.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):T=typeof o,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,g)}var O=Vn(o,c,d,E,R);if(O==null)return O;if(v){var C=c.children;if(C!==void 0)if(y)if(Oe(C)){for(var K=0;K<C.length;K++)Nt(C[K],o);Object.freeze&&Object.freeze(C)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Nt(C,o)}if(te.call(c,"key")){var $=L(o),k=Object.keys(c).filter(function(Gn){return Gn!=="key"}),ke=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!Lt[$+ke]){var Hn=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+d+">.")}return c}}function Dt(o,c){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var d=zn(c);if(Ft[d])return;Ft[d]=!0;var y="";o&&o._owner&&o._owner!==Se.current&&(y=" It was passed a child from "+U(o._owner.type)+"."),B(o),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',d,y),B(null)}}function Nt(o,c){{if(typeof o!="object")return;if(Oe(o))for(var d=0;d<o.length;d++){var y=o[d];_e(y)&&Dt(y,c)}else if(_e(o))o._store&&(o._store.validated=!0);else if(o){var E=W(o);if(typeof E=="function"&&E!==o.entries)for(var R=E.call(o),v;!(v=R.next()).done;)_e(v.value)&&Dt(v.value,c)}}}function Mn(o){{var c=o.type;if(c==null||typeof c=="string")return;var d;if(typeof c=="function")d=c.propTypes;else if(typeof c=="object"&&(c.$$typeof===a||c.$$typeof===p))d=c.propTypes;else return;if(d){var y=U(c);_n(d,o.props,"prop",y,o)}else if(c.PropTypes!==void 0&&!xe){xe=!0;var E=U(c);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof c.getDefaultProps=="function"&&!c.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function qn(o){{for(var c=Object.keys(o.props),d=0;d<c.length;d++){var y=c[d];if(y!=="children"&&y!=="key"){B(o),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),B(null);break}}o.ref!==null&&(B(o),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}var Ut={};function Lt(o,c,d,y,E,R){{var v=En(o);if(!v){var g="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(g+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=$n();_?g+=_:g+=It();var T;o===null?T="null":Oe(o)?T="array":o!==void 0&&o.$$typeof===t?(T="<"+(U(o.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):T=typeof o,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,g)}var O=Vn(o,c,d,E,R);if(O==null)return O;if(v){var C=c.children;if(C!==void 0)if(y)if(Oe(C)){for(var K=0;K<C.length;K++)Nt(C[K],o);Object.freeze&&Object.freeze(C)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Nt(C,o)}if(te.call(c,"key")){var $=U(o),k=Object.keys(c).filter(function(Gn){return Gn!=="key"}),ke=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!Ut[$+ke]){var Hn=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,ke,$,Hn,$),Lt[$+ke]=!0}}return o===n?qn(O):Mn(O),O}}function Wn(o,c,d){return Ut(o,c,d,!0)}function Bn(o,c,d){return Ut(o,c,d,!1)}var Kn=Bn,Yn=Wn;H.Fragment=n,H.jsx=Kn,H.jsxs=Yn}()),H}process.env.NODE_ENV==="production"?le.exports=zt():le.exports=Mt();var fe=le.exports,de=(e=>(e.PDF="application/pdf",e.TXT="text/plain",e.CSV="text/csv",e))(de||{});const me=4e3*1024*1024;Object.entries({"application/pdf":{extensions:[".pdf"],maxSize:me},"text/plain":{extensions:[".txt",".json",".py",".ts",".tsx"],maxSize:me},"text/csv":{extensions:[".csv"],maxSize:me}}).reduce((e,[t,r])=>({...e,[t]:r.extensions}),{}),new Set(Object.values(de));function z(e){const t={subscribe(r){let n=null,i=!1,s=!1,u=!1;function l(){if(n===null){u=!0;return}s||(s=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=e({next(a){var f;i||(f=r.next)==null||f.call(r,a)},error(a){var f;i||(i=!0,(f=r.error)==null||f.call(r,a),l())},complete(){var a;i||(i=!0,(a=r.complete)==null||a.call(r),l())}}),u&&l(),{unsubscribe:l}},pipe(...r){return r.reduce(qt,t)}};return t}function qt(e,t){return t(e)}function Wt(e){const t=new AbortController;return new Promise((n,i)=>{let s=!1;function u(){s||(s=!0,l.unsubscribe())}t.signal.addEventListener("abort",()=>{i(t.signal.reason)});const l=e.subscribe({next(a){s=!0,n(a),u()},error(a){i(a)},complete(){t.abort(),u()}})})}function Bt(e){return t=>{let r=0,n=null;const i=[];function s(){n||(n=t.subscribe({next(l){var a;for(const f of i)(a=f.next)==null||a.call(f,l)},error(l){var a;for(const f of i)(a=f.error)==null||a.call(f,l)},complete(){var l;for(const a of i)(l=a.complete)==null||l.call(a)}}))}function u(){if(r===0&&n){const l=n;n=null,l.unsubscribe()}}return z(l=>(r++,i.push(l),s(),{unsubscribe(){r--,u();const a=i.findIndex(f=>f===l);a>-1&&i.splice(a,1)}}))}}function Kt(e){return t=>z(r=>t.subscribe({next(n){var i;(i=e.next)==null||i.call(e,n),r.next(n)},error(n){var i;(i=e.error)==null||i.call(e,n),r.error(n)},complete(){var n;(n=e.complete)==null||n.call(e),r.complete()}}))}function Yt(e){let t=e;const r=[],n=u=>{t!==void 0&&u.next(t),r.push(u)},i=u=>{r.splice(r.indexOf(u),1)},s=z(u=>(n(u),()=>{i(u)}));return s.next=u=>{if(t!==u){t=u;for(const l of r)l.next(u)}},s.get=()=>t,s}function Ht(e){return z(t=>{function r(i=0,s=e.op){const u=e.links[i];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:s,next(a){return r(i+1,a)}})}return r().subscribe(t)})}const Ae=()=>{},Ie=e=>{Object.freeze&&Object.freeze(e)};function Fe(e,t,r){var n,i;const s=t.join(".");return(n=r)[i=s]??(n[i]=new Proxy(Ae,{get(u,l){if(!(typeof l!="string"||l==="then"))return Fe(e,[...t,l],r)},apply(u,l,a){const f=t[t.length-1];let m={args:a,path:t};return f==="call"?m={args:a.length>=2?[a[1]]:[],path:t.slice(0,-1)}:f==="apply"&&(m={args:a.length>=2?a[1]:[],path:t.slice(0,-1)}),Ie(m.args),Ie(m.path),e(m)}})),r[s]}const Gt=e=>Fe(e,[],Object.create(null)),Xt=e=>new Proxy(Ae,{get(t,r){if(r!=="then")return e(r)}});function G(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function Jt(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:{...e,error:n}}}return{ok:!0,result:{...e.result,...(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)}}}}class pe extends Error{constructor(){super("Unable to transform response from server")}}function Zt(e,t){let r;try{r=Jt(e,t)}catch{throw new pe}if(!r.ok&&(!G(r.error.error)||typeof r.error.error.code!="number"))throw new pe;if(r.ok&&!G(r.result))throw new pe;return r}var De,Ne;(De=Symbol).dispose??(De.dispose=Symbol()),(Ne=Symbol).asyncDispose??(Ne.asyncDispose=Symbol()),typeof window>"u"||"Deno"in window||((ct=(ut=globalThis.process)==null?void 0:ut.env)==null?void 0:ct.NODE_ENV)==="test"||(ft=(lt=globalThis.process)==null?void 0:lt.env)!=null&&ft.JEST_WORKER_ID||(mt=(dt=globalThis.process)==null?void 0:dt.env)!=null&&mt.VITEST_WORKER_ID;function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qt(e){return e instanceof D||e instanceof Error&&e.name==="TRPCClientError"}function er(e){return G(e)&&G(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function tr(e,t){return typeof e=="string"?e:G(e)&&typeof e.message=="string"?e.message:t}class D extends Error{static from(t,r={}){const n=t;return Qt(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):er(n)?new D(n.error.message,{...r,result:n}):new D(tr(n,"Unknown error"),{...r,cause:n})}constructor(t,r){var i,s;const n=r==null?void 0:r.cause;super(t,{cause:n}),re(this,"cause",void 0),re(this,"shape",void 0),re(this,"data",void 0),re(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=n,this.shape=(i=r==null?void 0:r.result)==null?void 0:i.error,this.data=(s=r==null?void 0:r.result)==null?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,D.prototype)}}function ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class rr{$request(t){return Ht({links:this.links,op:{...t,context:t.context??{},id:++this.requestId}}).pipe(Bt())}async requestAsPromise(t){try{const r=this.$request(t);return(await Wt(r)).result.data}catch(r){throw D.from(r)}}query(t,r,n){return this.requestAsPromise({type:"query",path:t,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(t,r,n){return this.requestAsPromise({type:"mutation",path:t,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(t,r,n){return this.$request({type:"subscription",path:t,input:r,context:n.context,signal:n.signal}).subscribe({next(s){var u,l,a,f;switch(s.result.type){case"state":{(u=n.onConnectionStateChange)==null||u.call(n,s.result);break}case"started":{(l=n.onStarted)==null||l.call(n,{context:s.context});break}case"stopped":{(a=n.onStopped)==null||a.call(n);break}case"data":case void 0:{(f=n.onData)==null||f.call(n,s.result.data);break}}},error(s){var u;(u=n.onError)==null||u.call(n,s)},complete(){var s;(s=n.onComplete)==null||s.call(n)}})}constructor(t){ye(this,"links",void 0),ye(this,"runtime",void 0),ye(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(r=>r(this.runtime))}}const nr=Symbol.for("trpc_untypedClient"),or={query:"query",mutate:"mutation",subscribe:"subscription"},ir=e=>or[e];function sr(e){const t=Gt(({path:r,args:n})=>{const i=[...r],s=ir(i.pop()),u=i.join(".");return e[s](u,...n)});return Xt(r=>r===nr?e:t[r])}function ar(e){const t=new rr(e);return sr(t)}const Le=e=>typeof e=="function";function ur(e){if(e)return e;if(typeof window<"u"&&Le(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Le(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const Ue=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Ve(e){let t=null,r=null;const n=()=>{clearTimeout(r),r=null,t=null};function i(l){var m,p;const a=[[]];let f=0;for(;;){const h=l[f];if(!h)break;const w=a[a.length-1];if(h.aborted){(m=h.reject)==null||m.call(h,new Error("Aborted")),f++;continue}if(e.validate(w.concat(h).map(P=>P.key))){w.push(h),f++;continue}if(w.length===0){(p=h.reject)==null||p.call(h,new Error("Input is too big for a single dispatch")),f++;continue}a.push([])}return a}function s(){const l=i(t);n();for(const a of l){if(!a.length)continue;const f={items:a};for(const p of a)p.batch=f;e.fetch(f.items.map(p=>p.key)).then(async p=>{var h;await Promise.all(p.map(async(w,x)=>{var W,A;const P=f.items[x];try{const S=await Promise.resolve(w);(W=P.resolve)==null||W.call(P,S)}catch(S){(A=P.reject)==null||A.call(P,S)}P.batch=null,P.reject=null,P.resolve=null}));for(const w of f.items)(h=w.reject)==null||h.call(w,new Error("Missing result")),w.batch=null}).catch(p=>{var h;for(const w of f.items)(h=w.reject)==null||h.call(w,p),w.batch=null})}}function u(l){const a={aborted:!1,key:l,batch:null,resolve:Ue,reject:Ue},f=new Promise((m,p)=>{a.reject=p,a.resolve=m,t||(t=[]),t.push(a)});return r||(r=setTimeout(s)),f}return{load:u}}function cr(...e){const t=new AbortController,r=e.length;let n=0;const i=()=>{++n===r&&t.abort()};for(const s of e)s!=null&&s.aborted?i():s==null||s.addEventListener("abort",i,{once:!0});return t.signal}function lr(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}function fr(e){return{url:e.url.toString(),fetch:e.fetch,transformer:lr(e.transformer),methodOverride:e.methodOverride}}function dr(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[r]=n}return t}const mr={query:"GET",mutation:"POST",subscription:"PATCH"};function $e(e){return"input"in e?e.transformer.input.serialize(e.input):dr(e.inputs.map(t=>e.transformer.input.serialize(t)))}const ze=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const i=[];if(t[1]&&i.push(t[1]),"inputs"in e&&i.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=$e(e);s!==void 0&&e.methodOverride!=="POST"&&i.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return i.length&&(n+="?"+i.join("&")),n},pr=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=$e(e);return t!==void 0?JSON.stringify(t):void 0},yr=e=>wr({...e,contentTypeHeader:"application/json",getUrl:ze,getBody:pr});class hr extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}}const gr=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new hr};async function br(e){gr(e.signal);const t=e.getUrl(e),r=e.getBody(e),{type:n}=e,i=await(async()=>{const u=await e.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),s={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0,...i};return ur(e.fetch)(t,{method:e.methodOverride??mr[n],signal:e.signal,body:r,headers:s})}async function wr(e){const t={},r=await br(e);t.response=r;const n=await r.json();return t.responseJSON=n,{json:n,meta:t}}function vr(e){const t=fr(e),r=e.maxURLLength??1/0;return()=>{const n=l=>({validate(a){if(r===1/0)return!0;const f=a.map(h=>h.path).join(","),m=a.map(h=>h.input);return ze({...t,type:l,path:f,inputs:m,signal:null}).length<=r},async fetch(a){const f=a.map(P=>P.path).join(","),m=a.map(P=>P.input),p=cr(...a.map(P=>P.signal)),h=await yr({...t,path:f,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:a}):e.headers:{}},signal:p});return(Array.isArray(h.json)?h.json:a.map(()=>h.json)).map(P=>({meta:h.meta,json:P}))}}),i=Ve(n("query")),s=Ve(n("mutation")),u={query:i,mutation:s};return({op:l})=>z(a=>{/* istanbul ignore if -- @preserve */if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const m=u[l.type].load(l);let p;return m.then(h=>{p=h;const w=Zt(h.json,t.transformer.output);if(!w.ok){a.error(D.from(w.error,{meta:h.meta}));return}a.next({context:h.meta,result:w.result}),a.complete()}).catch(h=>{a.error(D.from(h,{meta:p==null?void 0:p.meta}))}),()=>{}})}}function Er(e){return typeof FormData>"u"?!1:e instanceof FormData}const he={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function Pr(e){const{direction:t,type:r,withContext:n,path:i,id:s,input:u}=e,l=[],a=[];if(e.colorMode==="none")l.push(t==="up"?">>":"<<",r,`#${s}`,i);else if(e.colorMode==="ansi"){const[f,m]=he.ansi.regular[r],[p,h]=he.ansi.bold[r];l.push(t==="up"?f:m,t==="up"?">>":"<<",r,t==="up"?p:h,`#${s}`,i,"\x1B[0m")}else{const[f,m]=he.css[r],p=`
30
+ <%s key={someKey} {...props} />`,ke,$,Hn,$),Ut[$+ke]=!0}}return o===n?qn(O):Mn(O),O}}function Wn(o,c,d){return Lt(o,c,d,!0)}function Bn(o,c,d){return Lt(o,c,d,!1)}var Kn=Bn,Yn=Wn;H.Fragment=n,H.jsx=Kn,H.jsxs=Yn}()),H}process.env.NODE_ENV==="production"?le.exports=zt():le.exports=Mt();var fe=le.exports,de=(e=>(e.PDF="application/pdf",e.TXT="text/plain",e.CSV="text/csv",e))(de||{});const me=4e3*1024*1024;Object.entries({"application/pdf":{extensions:[".pdf"],maxSize:me},"text/plain":{extensions:[".txt",".json",".py",".ts",".tsx"],maxSize:me},"text/csv":{extensions:[".csv"],maxSize:me}}).reduce((e,[t,r])=>({...e,[t]:r.extensions}),{}),new Set(Object.values(de));function z(e){const t={subscribe(r){let n=null,i=!1,s=!1,u=!1;function l(){if(n===null){u=!0;return}s||(s=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=e({next(a){var f;i||(f=r.next)==null||f.call(r,a)},error(a){var f;i||(i=!0,(f=r.error)==null||f.call(r,a),l())},complete(){var a;i||(i=!0,(a=r.complete)==null||a.call(r),l())}}),u&&l(),{unsubscribe:l}},pipe(...r){return r.reduce(qt,t)}};return t}function qt(e,t){return t(e)}function Wt(e){const t=new AbortController;return new Promise((n,i)=>{let s=!1;function u(){s||(s=!0,l.unsubscribe())}t.signal.addEventListener("abort",()=>{i(t.signal.reason)});const l=e.subscribe({next(a){s=!0,n(a),u()},error(a){i(a)},complete(){t.abort(),u()}})})}function Bt(e){return t=>{let r=0,n=null;const i=[];function s(){n||(n=t.subscribe({next(l){var a;for(const f of i)(a=f.next)==null||a.call(f,l)},error(l){var a;for(const f of i)(a=f.error)==null||a.call(f,l)},complete(){var l;for(const a of i)(l=a.complete)==null||l.call(a)}}))}function u(){if(r===0&&n){const l=n;n=null,l.unsubscribe()}}return z(l=>(r++,i.push(l),s(),{unsubscribe(){r--,u();const a=i.findIndex(f=>f===l);a>-1&&i.splice(a,1)}}))}}function Kt(e){return t=>z(r=>t.subscribe({next(n){var i;(i=e.next)==null||i.call(e,n),r.next(n)},error(n){var i;(i=e.error)==null||i.call(e,n),r.error(n)},complete(){var n;(n=e.complete)==null||n.call(e),r.complete()}}))}function Yt(e){let t=e;const r=[],n=u=>{t!==void 0&&u.next(t),r.push(u)},i=u=>{r.splice(r.indexOf(u),1)},s=z(u=>(n(u),()=>{i(u)}));return s.next=u=>{if(t!==u){t=u;for(const l of r)l.next(u)}},s.get=()=>t,s}function Ht(e){return z(t=>{function r(i=0,s=e.op){const u=e.links[i];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:s,next(a){return r(i+1,a)}})}return r().subscribe(t)})}const Ae=()=>{},Ie=e=>{Object.freeze&&Object.freeze(e)};function Fe(e,t,r){var n,i;const s=t.join(".");return(n=r)[i=s]??(n[i]=new Proxy(Ae,{get(u,l){if(!(typeof l!="string"||l==="then"))return Fe(e,[...t,l],r)},apply(u,l,a){const f=t[t.length-1];let m={args:a,path:t};return f==="call"?m={args:a.length>=2?[a[1]]:[],path:t.slice(0,-1)}:f==="apply"&&(m={args:a.length>=2?a[1]:[],path:t.slice(0,-1)}),Ie(m.args),Ie(m.path),e(m)}})),r[s]}const Gt=e=>Fe(e,[],Object.create(null)),Xt=e=>new Proxy(Ae,{get(t,r){if(r!=="then")return e(r)}});function G(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function Jt(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:{...e,error:n}}}return{ok:!0,result:{...e.result,...(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)}}}}class pe extends Error{constructor(){super("Unable to transform response from server")}}function Zt(e,t){let r;try{r=Jt(e,t)}catch{throw new pe}if(!r.ok&&(!G(r.error.error)||typeof r.error.error.code!="number"))throw new pe;if(r.ok&&!G(r.result))throw new pe;return r}var De,Ne;(De=Symbol).dispose??(De.dispose=Symbol()),(Ne=Symbol).asyncDispose??(Ne.asyncDispose=Symbol()),typeof window>"u"||"Deno"in window||((ct=(ut=globalThis.process)==null?void 0:ut.env)==null?void 0:ct.NODE_ENV)==="test"||(ft=(lt=globalThis.process)==null?void 0:lt.env)!=null&&ft.JEST_WORKER_ID||(mt=(dt=globalThis.process)==null?void 0:dt.env)!=null&&mt.VITEST_WORKER_ID;function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qt(e){return e instanceof D||e instanceof Error&&e.name==="TRPCClientError"}function er(e){return G(e)&&G(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function tr(e,t){return typeof e=="string"?e:G(e)&&typeof e.message=="string"?e.message:t}class D extends Error{static from(t,r={}){const n=t;return Qt(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):er(n)?new D(n.error.message,{...r,result:n}):new D(tr(n,"Unknown error"),{...r,cause:n})}constructor(t,r){var i,s;const n=r==null?void 0:r.cause;super(t,{cause:n}),re(this,"cause",void 0),re(this,"shape",void 0),re(this,"data",void 0),re(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=n,this.shape=(i=r==null?void 0:r.result)==null?void 0:i.error,this.data=(s=r==null?void 0:r.result)==null?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,D.prototype)}}function ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class rr{$request(t){return Ht({links:this.links,op:{...t,context:t.context??{},id:++this.requestId}}).pipe(Bt())}async requestAsPromise(t){try{const r=this.$request(t);return(await Wt(r)).result.data}catch(r){throw D.from(r)}}query(t,r,n){return this.requestAsPromise({type:"query",path:t,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(t,r,n){return this.requestAsPromise({type:"mutation",path:t,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(t,r,n){return this.$request({type:"subscription",path:t,input:r,context:n.context,signal:n.signal}).subscribe({next(s){var u,l,a,f;switch(s.result.type){case"state":{(u=n.onConnectionStateChange)==null||u.call(n,s.result);break}case"started":{(l=n.onStarted)==null||l.call(n,{context:s.context});break}case"stopped":{(a=n.onStopped)==null||a.call(n);break}case"data":case void 0:{(f=n.onData)==null||f.call(n,s.result.data);break}}},error(s){var u;(u=n.onError)==null||u.call(n,s)},complete(){var s;(s=n.onComplete)==null||s.call(n)}})}constructor(t){ye(this,"links",void 0),ye(this,"runtime",void 0),ye(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(r=>r(this.runtime))}}const nr=Symbol.for("trpc_untypedClient"),or={query:"query",mutate:"mutation",subscribe:"subscription"},ir=e=>or[e];function sr(e){const t=Gt(({path:r,args:n})=>{const i=[...r],s=ir(i.pop()),u=i.join(".");return e[s](u,...n)});return Xt(r=>r===nr?e:t[r])}function ar(e){const t=new rr(e);return sr(t)}const Ue=e=>typeof e=="function";function ur(e){if(e)return e;if(typeof window<"u"&&Ue(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Ue(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const Le=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Ve(e){let t=null,r=null;const n=()=>{clearTimeout(r),r=null,t=null};function i(l){var m,p;const a=[[]];let f=0;for(;;){const h=l[f];if(!h)break;const w=a[a.length-1];if(h.aborted){(m=h.reject)==null||m.call(h,new Error("Aborted")),f++;continue}if(e.validate(w.concat(h).map(P=>P.key))){w.push(h),f++;continue}if(w.length===0){(p=h.reject)==null||p.call(h,new Error("Input is too big for a single dispatch")),f++;continue}a.push([])}return a}function s(){const l=i(t);n();for(const a of l){if(!a.length)continue;const f={items:a};for(const p of a)p.batch=f;e.fetch(f.items.map(p=>p.key)).then(async p=>{var h;await Promise.all(p.map(async(w,x)=>{var W,A;const P=f.items[x];try{const S=await Promise.resolve(w);(W=P.resolve)==null||W.call(P,S)}catch(S){(A=P.reject)==null||A.call(P,S)}P.batch=null,P.reject=null,P.resolve=null}));for(const w of f.items)(h=w.reject)==null||h.call(w,new Error("Missing result")),w.batch=null}).catch(p=>{var h;for(const w of f.items)(h=w.reject)==null||h.call(w,p),w.batch=null})}}function u(l){const a={aborted:!1,key:l,batch:null,resolve:Le,reject:Le},f=new Promise((m,p)=>{a.reject=p,a.resolve=m,t||(t=[]),t.push(a)});return r||(r=setTimeout(s)),f}return{load:u}}function cr(...e){const t=new AbortController,r=e.length;let n=0;const i=()=>{++n===r&&t.abort()};for(const s of e)s!=null&&s.aborted?i():s==null||s.addEventListener("abort",i,{once:!0});return t.signal}function lr(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}function fr(e){return{url:e.url.toString(),fetch:e.fetch,transformer:lr(e.transformer),methodOverride:e.methodOverride}}function dr(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[r]=n}return t}const mr={query:"GET",mutation:"POST",subscription:"PATCH"};function $e(e){return"input"in e?e.transformer.input.serialize(e.input):dr(e.inputs.map(t=>e.transformer.input.serialize(t)))}const ze=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const i=[];if(t[1]&&i.push(t[1]),"inputs"in e&&i.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=$e(e);s!==void 0&&e.methodOverride!=="POST"&&i.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return i.length&&(n+="?"+i.join("&")),n},pr=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=$e(e);return t!==void 0?JSON.stringify(t):void 0},yr=e=>wr({...e,contentTypeHeader:"application/json",getUrl:ze,getBody:pr});class hr extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}}const gr=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new hr};async function br(e){gr(e.signal);const t=e.getUrl(e),r=e.getBody(e),{type:n}=e,i=await(async()=>{const u=await e.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),s={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0,...i};return ur(e.fetch)(t,{method:e.methodOverride??mr[n],signal:e.signal,body:r,headers:s})}async function wr(e){const t={},r=await br(e);t.response=r;const n=await r.json();return t.responseJSON=n,{json:n,meta:t}}function vr(e){const t=fr(e),r=e.maxURLLength??1/0;return()=>{const n=l=>({validate(a){if(r===1/0)return!0;const f=a.map(h=>h.path).join(","),m=a.map(h=>h.input);return ze({...t,type:l,path:f,inputs:m,signal:null}).length<=r},async fetch(a){const f=a.map(P=>P.path).join(","),m=a.map(P=>P.input),p=cr(...a.map(P=>P.signal)),h=await yr({...t,path:f,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:a}):e.headers:{}},signal:p});return(Array.isArray(h.json)?h.json:a.map(()=>h.json)).map(P=>({meta:h.meta,json:P}))}}),i=Ve(n("query")),s=Ve(n("mutation")),u={query:i,mutation:s};return({op:l})=>z(a=>{/* istanbul ignore if -- @preserve */if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const m=u[l.type].load(l);let p;return m.then(h=>{p=h;const w=Zt(h.json,t.transformer.output);if(!w.ok){a.error(D.from(w.error,{meta:h.meta}));return}a.next({context:h.meta,result:w.result}),a.complete()}).catch(h=>{a.error(D.from(h,{meta:p==null?void 0:p.meta}))}),()=>{}})}}function Er(e){return typeof FormData>"u"?!1:e instanceof FormData}const he={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function Pr(e){const{direction:t,type:r,withContext:n,path:i,id:s,input:u}=e,l=[],a=[];if(e.colorMode==="none")l.push(t==="up"?">>":"<<",r,`#${s}`,i);else if(e.colorMode==="ansi"){const[f,m]=he.ansi.regular[r],[p,h]=he.ansi.bold[r];l.push(t==="up"?f:m,t==="up"?">>":"<<",r,t==="up"?p:h,`#${s}`,i,"\x1B[0m")}else{const[f,m]=he.css[r],p=`
31
31
  background-color: #${t==="up"?f:m};
32
32
  color: ${t==="up"?"black":"white"};
33
33
  padding: 2px;
34
- `;l.push("%c",t==="up"?">>":"<<",r,`#${s}`,`%c${i}%c`,"%O"),a.push(p,`${p}; font-weight: bold;`,`${p}; font-weight: normal;`)}return t==="up"?a.push(n?{input:u,context:e.context}:{input:u}):a.push({input:u,result:e.result,elapsedMs:e.elapsedMs,...n&&{context:e.context}}),{parts:l,args:a}}const Rr=({c:e=console,colorMode:t="css",withContext:r})=>n=>{const i=n.input,s=Er(i)?Object.fromEntries(i):i,{parts:u,args:l}=Pr({...n,colorMode:t,input:s,withContext:r}),a=n.direction==="down"&&n.result&&(n.result instanceof Error||"error"in n.result.result&&n.result.result.error)?"error":"log";e[a].apply(null,[u.join(" ")].concat(l))};function Tr(e={}){const{enabled:t=()=>!0}=e,r=e.colorMode??(typeof window>"u"?"ansi":"css"),n=e.withContext??r==="css",{logger:i=Rr({c:e.console,colorMode:r,withContext:n})}=e;return()=>({op:s,next:u})=>z(l=>{t({...s,direction:"up"})&&i({...s,direction:"up"});const a=Date.now();function f(m){const p=Date.now()-a;t({...s,direction:"down",result:m})&&i({...s,direction:"down",elapsedMs:p,result:m})}return u(s).pipe(Kt({next(m){f(m)},error(m){f(m)}})).subscribe(l)})}const Or=(e,...t)=>typeof e=="function"?e(...t):e;function Sr(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}async function xr(e){const t=await Or(e.url);if(!e.connectionParams)return t;const n=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+n}function U(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _r(e){const{promise:t,resolve:r,reject:n}=Sr();return e.addEventListener("open",()=>{e.removeEventListener("error",n),r()}),e.addEventListener("error",n),t}function kr(e,{intervalMs:t,pongTimeoutMs:r}){let n,i;function s(){n=setTimeout(()=>{e.send("PING"),i=setTimeout(()=>{e.close()},r)},t)}function u(){clearTimeout(n),s()}function l(){clearTimeout(i),u()}e.addEventListener("open",s),e.addEventListener("message",({data:a})=>{clearTimeout(n),s(),a==="PONG"&&l()}),e.addEventListener("close",()=>{clearTimeout(n),clearTimeout(i)})}class ne{get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++ne.connectCount;const t=xr(this.urlOptions).then(r=>new this.WebSocketPonyfill(r));this.openPromise=t.then(_r),this.ws=await t,this.ws.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&kr(this.ws,this.keepAliveOpts),this.ws.addEventListener("close",()=>{this.ws=null});try{await this.openPromise}finally{this.openPromise=null}}async close(){var t;try{await this.openPromise}finally{(t=this.ws)==null||t.close()}}constructor(t){if(U(this,"id",++ne.connectCount),U(this,"WebSocketPonyfill",void 0),U(this,"urlOptions",void 0),U(this,"keepAliveOpts",void 0),U(this,"wsObservable",Yt(null)),U(this,"openPromise",null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}}U(ne,"connectCount",0);class jr{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(t,r){this.keyToValue.set(t,r),this.valueToKey.set(r,t)}getByKey(t){return this.keyToValue.get(t)}getByValue(t){return this.valueToKey.get(t)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class Me{constructor(t){this.generateIdentifier=t,this.kv=new jr}register(t,r){this.kv.getByValue(t)||(r||(r=this.generateIdentifier(t)),this.kv.set(r,t))}clear(){this.kv.clear()}getIdentifier(t){return this.kv.getByValue(t)}getValue(t){return this.kv.getByKey(t)}}class Cr extends Me{constructor(){super(t=>t.name),this.classToAllowedProps=new Map}register(t,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(t,r.allowProps),super.register(t,r.identifier)):super.register(t,r)}getAllowedProps(t){return this.classToAllowedProps.get(t)}}function Ar(e){if("values"in Object)return Object.values(e);const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}function Ir(e,t){const r=Ar(e);if("find"in r)return r.find(t);const n=r;for(let i=0;i<n.length;i++){const s=n[i];if(t(s))return s}}function M(e,t){Object.entries(e).forEach(([r,n])=>t(n,r))}function oe(e,t){return e.indexOf(t)!==-1}function qe(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(t(n))return n}}class Fr{constructor(){this.transfomers={}}register(t){this.transfomers[t.name]=t}findApplicable(t){return Ir(this.transfomers,r=>r.isApplicable(t))}findByName(t){return this.transfomers[t]}}const Dr=e=>Object.prototype.toString.call(e).slice(8,-1),We=e=>typeof e>"u",Nr=e=>e===null,X=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,ge=e=>X(e)&&Object.keys(e).length===0,N=e=>Array.isArray(e),Lr=e=>typeof e=="string",Ur=e=>typeof e=="number"&&!isNaN(e),Vr=e=>typeof e=="boolean",$r=e=>e instanceof RegExp,J=e=>e instanceof Map,Z=e=>e instanceof Set,Be=e=>Dr(e)==="Symbol",zr=e=>e instanceof Date&&!isNaN(e.valueOf()),Mr=e=>e instanceof Error,Ke=e=>typeof e=="number"&&isNaN(e),qr=e=>Vr(e)||Nr(e)||We(e)||Ur(e)||Lr(e)||Be(e),Wr=e=>typeof e=="bigint",Br=e=>e===1/0||e===-1/0,Kr=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Yr=e=>e instanceof URL,Ye=e=>e.replace(/\./g,"\\."),be=e=>e.map(String).map(Ye).join("."),Q=e=>{const t=[];let r="";for(let i=0;i<e.length;i++){let s=e.charAt(i);if(s==="\\"&&e.charAt(i+1)==="."){r+=".",i++;continue}if(s==="."){t.push(r),r="";continue}r+=s}const n=r;return t.push(n),t};function I(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}const He=[I(We,"undefined",()=>null,()=>{}),I(Wr,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),I(zr,"Date",e=>e.toISOString(),e=>new Date(e)),I(Mr,"Error",(e,t)=>{const r={name:e.name,message:e.message};return t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r},(e,t)=>{const r=new Error(e.message);return r.name=e.name,r.stack=e.stack,t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r}),I($r,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),r=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,r)}),I(Z,"set",e=>[...e.values()],e=>new Set(e)),I(J,"map",e=>[...e.entries()],e=>new Map(e)),I(e=>Ke(e)||Br(e),"number",e=>Ke(e)?"NaN":e>0?"Infinity":"-Infinity",Number),I(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),I(Yr,"URL",e=>e.toString(),e=>new URL(e))];function ie(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}const Ge=ie((e,t)=>Be(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,r)=>{const n=r.symbolRegistry.getValue(t[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),Hr=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Xe=ie(Kr,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const r=Hr[t[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(e)});function Je(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}const Ze=ie(Je,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const r=t.classRegistry.getAllowedProps(e.constructor);if(!r)return{...e};const n={};return r.forEach(i=>{n[i]=e[i]}),n},(e,t,r)=>{const n=r.classRegistry.getValue(t[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),e)}),Qe=ie((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,r)=>{const n=r.customTransformerRegistry.findByName(t[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(e)}),Gr=[Ze,Ge,Qe,Xe],et=(e,t)=>{const r=qe(Gr,i=>i.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};const n=qe(He,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},tt={};He.forEach(e=>{tt[e.annotation]=e});const Xr=(e,t,r)=>{if(N(t))switch(t[0]){case"symbol":return Ge.untransform(e,t,r);case"class":return Ze.untransform(e,t,r);case"custom":return Qe.untransform(e,t,r);case"typed-array":return Xe.untransform(e,t,r);default:throw new Error("Unknown transformation: "+t)}else{const n=tt[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,r)}},q=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const r=e.keys();for(;t>0;)r.next(),t--;return r.next().value};function rt(e){if(oe(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(oe(e,"prototype"))throw new Error("prototype is not allowed as a property");if(oe(e,"constructor"))throw new Error("constructor is not allowed as a property")}const Jr=(e,t)=>{rt(t);for(let r=0;r<t.length;r++){const n=t[r];if(Z(e))e=q(e,+n);else if(J(e)){const i=+n,s=+t[++r]==0?"key":"value",u=q(e,i);switch(s){case"key":e=u;break;case"value":e=e.get(u);break}}else e=e[n]}return e},we=(e,t,r)=>{if(rt(t),t.length===0)return r(e);let n=e;for(let s=0;s<t.length-1;s++){const u=t[s];if(N(n)){const l=+u;n=n[l]}else if(X(n))n=n[u];else if(Z(n)){const l=+u;n=q(n,l)}else if(J(n)){if(s===t.length-2)break;const a=+u,f=+t[++s]==0?"key":"value",m=q(n,a);switch(f){case"key":n=m;break;case"value":n=n.get(m);break}}}const i=t[t.length-1];if(N(n)?n[+i]=r(n[+i]):X(n)&&(n[i]=r(n[i])),Z(n)){const s=q(n,+i),u=r(s);s!==u&&(n.delete(s),n.add(u))}if(J(n)){const s=+t[t.length-2],u=q(n,s);switch(+i==0?"key":"value"){case"key":{const a=r(u);n.set(a,n.get(u)),a!==u&&n.delete(u);break}case"value":{n.set(u,r(n.get(u)));break}}}return e};function ve(e,t,r=[]){if(!e)return;if(!N(e)){M(e,(s,u)=>ve(s,t,[...r,...Q(u)]));return}const[n,i]=e;i&&M(i,(s,u)=>{ve(s,t,[...r,...Q(u)])}),t(n,r)}function Zr(e,t,r){return ve(t,(n,i)=>{e=we(e,i,s=>Xr(s,n,r))}),e}function Qr(e,t){function r(n,i){const s=Jr(e,Q(i));n.map(Q).forEach(u=>{e=we(e,u,()=>s)})}if(N(t)){const[n,i]=t;n.forEach(s=>{e=we(e,Q(s),()=>e)}),i&&M(i,r)}else M(t,r);return e}const en=(e,t)=>X(e)||N(e)||J(e)||Z(e)||Je(e,t);function tn(e,t,r){const n=r.get(e);n?n.push(t):r.set(e,[t])}function rn(e,t){const r={};let n;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(l=>l.map(String)).sort((l,a)=>l.length-a.length));const[s,...u]=i;s.length===0?n=u.map(be):r[be(s)]=u.map(be)}),n?ge(r)?[n]:[n,r]:ge(r)?void 0:r}const nt=(e,t,r,n,i=[],s=[],u=new Map)=>{const l=qr(e);if(!l){tn(e,i,t);const w=u.get(e);if(w)return n?{transformedValue:null}:w}if(!en(e,r)){const w=et(e,r),x=w?{transformedValue:w.value,annotations:[w.type]}:{transformedValue:e};return l||u.set(e,x),x}if(oe(s,e))return{transformedValue:null};const a=et(e,r),f=(a==null?void 0:a.value)??e,m=N(f)?[]:{},p={};M(f,(w,x)=>{if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(`Detected property ${x}. This is a prototype pollution risk, please remove it from your object.`);const P=nt(w,t,r,n,[...i,x],[...s,e],u);m[x]=P.transformedValue,N(P.annotations)?p[x]=P.annotations:X(P.annotations)&&M(P.annotations,(W,A)=>{p[Ye(x)+"."+A]=W})});const h=ge(p)?{transformedValue:m,annotations:a?[a.type]:void 0}:{transformedValue:m,annotations:a?[a.type,p]:p};return l||u.set(e,h),h};function ot(e){return Object.prototype.toString.call(e).slice(8,-1)}function it(e){return ot(e)==="Array"}function nn(e){if(ot(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function on(e,t,r,n,i){const s={}.propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";s==="enumerable"&&(e[t]=r),i&&s==="nonenumerable"&&Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0})}function Ee(e,t={}){if(it(e))return e.map(i=>Ee(i,t));if(!nn(e))return e;const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols(e);return[...r,...n].reduce((i,s)=>{if(it(t.props)&&!t.props.includes(s))return i;const u=e[s],l=Ee(u,t);return on(i,s,l,e,t.nonenumerable),i},{})}class b{constructor({dedupe:t=!1}={}){this.classRegistry=new Cr,this.symbolRegistry=new Me(r=>r.description??""),this.customTransformerRegistry=new Fr,this.allowedErrorProps=[],this.dedupe=t}serialize(t){const r=new Map,n=nt(t,r,this,this.dedupe),i={json:n.transformedValue};n.annotations&&(i.meta={...i.meta,values:n.annotations});const s=rn(r,this.dedupe);return s&&(i.meta={...i.meta,referentialEqualities:s}),i}deserialize(t){const{json:r,meta:n}=t;let i=Ee(r);return n!=null&&n.values&&(i=Zr(i,n.values,this)),n!=null&&n.referentialEqualities&&(i=Qr(i,n.referentialEqualities)),i}stringify(t){return JSON.stringify(this.serialize(t))}parse(t){return this.deserialize(JSON.parse(t))}registerClass(t,r){this.classRegistry.register(t,r)}registerSymbol(t,r){this.symbolRegistry.register(t,r)}registerCustom(t,r){this.customTransformerRegistry.register({name:r,...t})}allowErrorProps(...t){this.allowedErrorProps.push(...t)}}b.defaultInstance=new b,b.serialize=b.defaultInstance.serialize.bind(b.defaultInstance),b.deserialize=b.defaultInstance.deserialize.bind(b.defaultInstance),b.stringify=b.defaultInstance.stringify.bind(b.defaultInstance),b.parse=b.defaultInstance.parse.bind(b.defaultInstance),b.registerClass=b.defaultInstance.registerClass.bind(b.defaultInstance),b.registerSymbol=b.defaultInstance.registerSymbol.bind(b.defaultInstance),b.registerCustom=b.defaultInstance.registerCustom.bind(b.defaultInstance),b.allowErrorProps=b.defaultInstance.allowErrorProps.bind(b.defaultInstance),b.serialize,b.deserialize,b.stringify,b.parse,b.registerClass,b.registerCustom,b.registerSymbol,b.allowErrorProps;const sn="dev-jwt-token-for-testing",an=async()=>sn,st=j.createContext(null);function un(e,t){const r=ar({links:[Tr({enabled:n=>process.env.NODE_ENV==="development"&&typeof window<"u"||n.direction==="down"&&n.result instanceof Error}),vr({url:`${e}/trpc`,headers:async()=>({Authorization:`Bearer ${await t()}`}),transformer:b})]});return{getProjectsForUser:async()=>(await r.projectRouter.getAllProjects.query()).map(i=>({name:i.name,id:i.id})),addProjectForUser:async n=>{const i=await r.projectRouter.createProject.mutate({name:n});return{name:i.name,id:i.id}},addFilesToProject:async(n,i)=>{const s=[];for(const u of i){const l=await r.fileRouter.createFile.mutate({file:{projectId:n,mimeType:de.PDF,path:u.path,name:u.name,size:0,metadata:null,isArtifact:!1,summary:null}});s.push({path:l.path,name:l.name,id:l.id})}return s},getFilesForProject:async n=>(await r.fileRouter.getFilesByProject.query({projectId:n})).map(s=>({path:s.path,name:s.name,id:s.id}))}}function cn({children:e,host:t="http://localhost",port:r=5174,getToken:n=an}){const[i,s]=j.useState(null);return j.useEffect(()=>{const u=`${t}:${r}`,l=un(u,n);s(l)},[t,r,n]),fe.jsx(st.Provider,{value:{host:t,port:r,client:i},children:e})}function at(){const e=j.useContext(st);if(!e)throw new Error("useFolioContext must be used within a FolioProvider");return e}const{useEffect:ln,useRef:fn,useState:dn}=$t;function mn({width:e="100%",height:t="100vh",allow:r="camera; microphone; clipboard-read; clipboard-write; fullscreen",style:n,className:i="",iframeProps:s={}}){const{host:u,port:l}=at(),a=fn(null),[f,m]=dn();return ln(()=>{m(`${u}:${l}`)},[u,l]),f?fe.jsx("div",{className:`folio-embed-container ${i}`,style:{width:e,height:t,overflow:"hidden",...n},children:fe.jsx("iframe",{ref:a,src:f,width:"100%",height:"100%",style:{border:"none",width:"100%",height:"100%",overflow:"auto"},allow:r,allowFullScreen:!0,...s})}):null}function pn(){const{client:e}=at(),[t,r]=j.useState(!1),[n,i]=j.useState(null);return{isLoading:t,error:n,getProjectsForUser:async()=>{for(;!e;)await new Promise(f=>setTimeout(f,100));r(!0),i(null);try{return await e.getProjectsForUser()}catch(f){return i(f instanceof Error?f:new Error(String(f))),[]}finally{r(!1)}},addProjectForUser:async f=>{for(;!e;)await new Promise(m=>setTimeout(m,100));r(!0),i(null);try{return await e.addProjectForUser(f)}catch(m){return i(m instanceof Error?m:new Error(String(m))),null}finally{r(!1)}},addFilesToProject:async(f,m)=>{for(;!e;)await new Promise(p=>setTimeout(p,100));r(!0),i(null);try{return await e.addFilesToProject(f,m)}catch(p){return i(p instanceof Error?p:new Error(String(p))),null}finally{r(!1)}},getFilesForProject:async f=>{for(;!e;)await new Promise(m=>setTimeout(m,100));r(!0),i(null);try{return await e.getFilesForProject(f)}catch(m){return i(m instanceof Error?m:new Error(String(m))),[]}finally{r(!1)}}}}F.FolioEmbed=mn,F.FolioProvider=cn,F.useFolio=pn,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
34
+ `;l.push("%c",t==="up"?">>":"<<",r,`#${s}`,`%c${i}%c`,"%O"),a.push(p,`${p}; font-weight: bold;`,`${p}; font-weight: normal;`)}return t==="up"?a.push(n?{input:u,context:e.context}:{input:u}):a.push({input:u,result:e.result,elapsedMs:e.elapsedMs,...n&&{context:e.context}}),{parts:l,args:a}}const Rr=({c:e=console,colorMode:t="css",withContext:r})=>n=>{const i=n.input,s=Er(i)?Object.fromEntries(i):i,{parts:u,args:l}=Pr({...n,colorMode:t,input:s,withContext:r}),a=n.direction==="down"&&n.result&&(n.result instanceof Error||"error"in n.result.result&&n.result.result.error)?"error":"log";e[a].apply(null,[u.join(" ")].concat(l))};function Tr(e={}){const{enabled:t=()=>!0}=e,r=e.colorMode??(typeof window>"u"?"ansi":"css"),n=e.withContext??r==="css",{logger:i=Rr({c:e.console,colorMode:r,withContext:n})}=e;return()=>({op:s,next:u})=>z(l=>{t({...s,direction:"up"})&&i({...s,direction:"up"});const a=Date.now();function f(m){const p=Date.now()-a;t({...s,direction:"down",result:m})&&i({...s,direction:"down",elapsedMs:p,result:m})}return u(s).pipe(Kt({next(m){f(m)},error(m){f(m)}})).subscribe(l)})}const Or=(e,...t)=>typeof e=="function"?e(...t):e;function Sr(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}async function xr(e){const t=await Or(e.url);if(!e.connectionParams)return t;const n=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+n}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _r(e){const{promise:t,resolve:r,reject:n}=Sr();return e.addEventListener("open",()=>{e.removeEventListener("error",n),r()}),e.addEventListener("error",n),t}function kr(e,{intervalMs:t,pongTimeoutMs:r}){let n,i;function s(){n=setTimeout(()=>{e.send("PING"),i=setTimeout(()=>{e.close()},r)},t)}function u(){clearTimeout(n),s()}function l(){clearTimeout(i),u()}e.addEventListener("open",s),e.addEventListener("message",({data:a})=>{clearTimeout(n),s(),a==="PONG"&&l()}),e.addEventListener("close",()=>{clearTimeout(n),clearTimeout(i)})}class ne{get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++ne.connectCount;const t=xr(this.urlOptions).then(r=>new this.WebSocketPonyfill(r));this.openPromise=t.then(_r),this.ws=await t,this.ws.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&kr(this.ws,this.keepAliveOpts),this.ws.addEventListener("close",()=>{this.ws=null});try{await this.openPromise}finally{this.openPromise=null}}async close(){var t;try{await this.openPromise}finally{(t=this.ws)==null||t.close()}}constructor(t){if(L(this,"id",++ne.connectCount),L(this,"WebSocketPonyfill",void 0),L(this,"urlOptions",void 0),L(this,"keepAliveOpts",void 0),L(this,"wsObservable",Yt(null)),L(this,"openPromise",null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}}L(ne,"connectCount",0);class jr{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(t,r){this.keyToValue.set(t,r),this.valueToKey.set(r,t)}getByKey(t){return this.keyToValue.get(t)}getByValue(t){return this.valueToKey.get(t)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class Me{constructor(t){this.generateIdentifier=t,this.kv=new jr}register(t,r){this.kv.getByValue(t)||(r||(r=this.generateIdentifier(t)),this.kv.set(r,t))}clear(){this.kv.clear()}getIdentifier(t){return this.kv.getByValue(t)}getValue(t){return this.kv.getByKey(t)}}class Cr extends Me{constructor(){super(t=>t.name),this.classToAllowedProps=new Map}register(t,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(t,r.allowProps),super.register(t,r.identifier)):super.register(t,r)}getAllowedProps(t){return this.classToAllowedProps.get(t)}}function Ar(e){if("values"in Object)return Object.values(e);const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}function Ir(e,t){const r=Ar(e);if("find"in r)return r.find(t);const n=r;for(let i=0;i<n.length;i++){const s=n[i];if(t(s))return s}}function M(e,t){Object.entries(e).forEach(([r,n])=>t(n,r))}function oe(e,t){return e.indexOf(t)!==-1}function qe(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(t(n))return n}}class Fr{constructor(){this.transfomers={}}register(t){this.transfomers[t.name]=t}findApplicable(t){return Ir(this.transfomers,r=>r.isApplicable(t))}findByName(t){return this.transfomers[t]}}const Dr=e=>Object.prototype.toString.call(e).slice(8,-1),We=e=>typeof e>"u",Nr=e=>e===null,X=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,ge=e=>X(e)&&Object.keys(e).length===0,N=e=>Array.isArray(e),Ur=e=>typeof e=="string",Lr=e=>typeof e=="number"&&!isNaN(e),Vr=e=>typeof e=="boolean",$r=e=>e instanceof RegExp,J=e=>e instanceof Map,Z=e=>e instanceof Set,Be=e=>Dr(e)==="Symbol",zr=e=>e instanceof Date&&!isNaN(e.valueOf()),Mr=e=>e instanceof Error,Ke=e=>typeof e=="number"&&isNaN(e),qr=e=>Vr(e)||Nr(e)||We(e)||Lr(e)||Ur(e)||Be(e),Wr=e=>typeof e=="bigint",Br=e=>e===1/0||e===-1/0,Kr=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Yr=e=>e instanceof URL,Ye=e=>e.replace(/\./g,"\\."),be=e=>e.map(String).map(Ye).join("."),Q=e=>{const t=[];let r="";for(let i=0;i<e.length;i++){let s=e.charAt(i);if(s==="\\"&&e.charAt(i+1)==="."){r+=".",i++;continue}if(s==="."){t.push(r),r="";continue}r+=s}const n=r;return t.push(n),t};function I(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}const He=[I(We,"undefined",()=>null,()=>{}),I(Wr,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),I(zr,"Date",e=>e.toISOString(),e=>new Date(e)),I(Mr,"Error",(e,t)=>{const r={name:e.name,message:e.message};return t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r},(e,t)=>{const r=new Error(e.message);return r.name=e.name,r.stack=e.stack,t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r}),I($r,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),r=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,r)}),I(Z,"set",e=>[...e.values()],e=>new Set(e)),I(J,"map",e=>[...e.entries()],e=>new Map(e)),I(e=>Ke(e)||Br(e),"number",e=>Ke(e)?"NaN":e>0?"Infinity":"-Infinity",Number),I(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),I(Yr,"URL",e=>e.toString(),e=>new URL(e))];function ie(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}const Ge=ie((e,t)=>Be(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,r)=>{const n=r.symbolRegistry.getValue(t[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),Hr=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Xe=ie(Kr,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const r=Hr[t[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(e)});function Je(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}const Ze=ie(Je,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const r=t.classRegistry.getAllowedProps(e.constructor);if(!r)return{...e};const n={};return r.forEach(i=>{n[i]=e[i]}),n},(e,t,r)=>{const n=r.classRegistry.getValue(t[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),e)}),Qe=ie((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,r)=>{const n=r.customTransformerRegistry.findByName(t[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(e)}),Gr=[Ze,Ge,Qe,Xe],et=(e,t)=>{const r=qe(Gr,i=>i.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};const n=qe(He,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},tt={};He.forEach(e=>{tt[e.annotation]=e});const Xr=(e,t,r)=>{if(N(t))switch(t[0]){case"symbol":return Ge.untransform(e,t,r);case"class":return Ze.untransform(e,t,r);case"custom":return Qe.untransform(e,t,r);case"typed-array":return Xe.untransform(e,t,r);default:throw new Error("Unknown transformation: "+t)}else{const n=tt[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,r)}},q=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const r=e.keys();for(;t>0;)r.next(),t--;return r.next().value};function rt(e){if(oe(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(oe(e,"prototype"))throw new Error("prototype is not allowed as a property");if(oe(e,"constructor"))throw new Error("constructor is not allowed as a property")}const Jr=(e,t)=>{rt(t);for(let r=0;r<t.length;r++){const n=t[r];if(Z(e))e=q(e,+n);else if(J(e)){const i=+n,s=+t[++r]==0?"key":"value",u=q(e,i);switch(s){case"key":e=u;break;case"value":e=e.get(u);break}}else e=e[n]}return e},we=(e,t,r)=>{if(rt(t),t.length===0)return r(e);let n=e;for(let s=0;s<t.length-1;s++){const u=t[s];if(N(n)){const l=+u;n=n[l]}else if(X(n))n=n[u];else if(Z(n)){const l=+u;n=q(n,l)}else if(J(n)){if(s===t.length-2)break;const a=+u,f=+t[++s]==0?"key":"value",m=q(n,a);switch(f){case"key":n=m;break;case"value":n=n.get(m);break}}}const i=t[t.length-1];if(N(n)?n[+i]=r(n[+i]):X(n)&&(n[i]=r(n[i])),Z(n)){const s=q(n,+i),u=r(s);s!==u&&(n.delete(s),n.add(u))}if(J(n)){const s=+t[t.length-2],u=q(n,s);switch(+i==0?"key":"value"){case"key":{const a=r(u);n.set(a,n.get(u)),a!==u&&n.delete(u);break}case"value":{n.set(u,r(n.get(u)));break}}}return e};function ve(e,t,r=[]){if(!e)return;if(!N(e)){M(e,(s,u)=>ve(s,t,[...r,...Q(u)]));return}const[n,i]=e;i&&M(i,(s,u)=>{ve(s,t,[...r,...Q(u)])}),t(n,r)}function Zr(e,t,r){return ve(t,(n,i)=>{e=we(e,i,s=>Xr(s,n,r))}),e}function Qr(e,t){function r(n,i){const s=Jr(e,Q(i));n.map(Q).forEach(u=>{e=we(e,u,()=>s)})}if(N(t)){const[n,i]=t;n.forEach(s=>{e=we(e,Q(s),()=>e)}),i&&M(i,r)}else M(t,r);return e}const en=(e,t)=>X(e)||N(e)||J(e)||Z(e)||Je(e,t);function tn(e,t,r){const n=r.get(e);n?n.push(t):r.set(e,[t])}function rn(e,t){const r={};let n;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(l=>l.map(String)).sort((l,a)=>l.length-a.length));const[s,...u]=i;s.length===0?n=u.map(be):r[be(s)]=u.map(be)}),n?ge(r)?[n]:[n,r]:ge(r)?void 0:r}const nt=(e,t,r,n,i=[],s=[],u=new Map)=>{const l=qr(e);if(!l){tn(e,i,t);const w=u.get(e);if(w)return n?{transformedValue:null}:w}if(!en(e,r)){const w=et(e,r),x=w?{transformedValue:w.value,annotations:[w.type]}:{transformedValue:e};return l||u.set(e,x),x}if(oe(s,e))return{transformedValue:null};const a=et(e,r),f=(a==null?void 0:a.value)??e,m=N(f)?[]:{},p={};M(f,(w,x)=>{if(x==="__proto__"||x==="constructor"||x==="prototype")throw new Error(`Detected property ${x}. This is a prototype pollution risk, please remove it from your object.`);const P=nt(w,t,r,n,[...i,x],[...s,e],u);m[x]=P.transformedValue,N(P.annotations)?p[x]=P.annotations:X(P.annotations)&&M(P.annotations,(W,A)=>{p[Ye(x)+"."+A]=W})});const h=ge(p)?{transformedValue:m,annotations:a?[a.type]:void 0}:{transformedValue:m,annotations:a?[a.type,p]:p};return l||u.set(e,h),h};function ot(e){return Object.prototype.toString.call(e).slice(8,-1)}function it(e){return ot(e)==="Array"}function nn(e){if(ot(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function on(e,t,r,n,i){const s={}.propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";s==="enumerable"&&(e[t]=r),i&&s==="nonenumerable"&&Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0})}function Ee(e,t={}){if(it(e))return e.map(i=>Ee(i,t));if(!nn(e))return e;const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols(e);return[...r,...n].reduce((i,s)=>{if(it(t.props)&&!t.props.includes(s))return i;const u=e[s],l=Ee(u,t);return on(i,s,l,e,t.nonenumerable),i},{})}class b{constructor({dedupe:t=!1}={}){this.classRegistry=new Cr,this.symbolRegistry=new Me(r=>r.description??""),this.customTransformerRegistry=new Fr,this.allowedErrorProps=[],this.dedupe=t}serialize(t){const r=new Map,n=nt(t,r,this,this.dedupe),i={json:n.transformedValue};n.annotations&&(i.meta={...i.meta,values:n.annotations});const s=rn(r,this.dedupe);return s&&(i.meta={...i.meta,referentialEqualities:s}),i}deserialize(t){const{json:r,meta:n}=t;let i=Ee(r);return n!=null&&n.values&&(i=Zr(i,n.values,this)),n!=null&&n.referentialEqualities&&(i=Qr(i,n.referentialEqualities)),i}stringify(t){return JSON.stringify(this.serialize(t))}parse(t){return this.deserialize(JSON.parse(t))}registerClass(t,r){this.classRegistry.register(t,r)}registerSymbol(t,r){this.symbolRegistry.register(t,r)}registerCustom(t,r){this.customTransformerRegistry.register({name:r,...t})}allowErrorProps(...t){this.allowedErrorProps.push(...t)}}b.defaultInstance=new b,b.serialize=b.defaultInstance.serialize.bind(b.defaultInstance),b.deserialize=b.defaultInstance.deserialize.bind(b.defaultInstance),b.stringify=b.defaultInstance.stringify.bind(b.defaultInstance),b.parse=b.defaultInstance.parse.bind(b.defaultInstance),b.registerClass=b.defaultInstance.registerClass.bind(b.defaultInstance),b.registerSymbol=b.defaultInstance.registerSymbol.bind(b.defaultInstance),b.registerCustom=b.defaultInstance.registerCustom.bind(b.defaultInstance),b.allowErrorProps=b.defaultInstance.allowErrorProps.bind(b.defaultInstance),b.serialize,b.deserialize,b.stringify,b.parse,b.registerClass,b.registerCustom,b.registerSymbol,b.allowErrorProps;const sn="dev-jwt-token-for-testing",an=async()=>sn,st=j.createContext(null);function un(e,t){const r=ar({links:[Tr({enabled:n=>process.env.NODE_ENV==="development"&&typeof window<"u"||n.direction==="down"&&n.result instanceof Error}),vr({url:`${e}/trpc`,headers:async()=>({Authorization:`Bearer ${await t()}`}),transformer:b})]});return{getProjectsForUser:async()=>(await r.projectRouter.getAllProjects.query()).map(i=>({name:i.name,id:i.id})),addProjectForUser:async n=>{const i=await r.projectRouter.createProject.mutate({name:n});return{name:i.name,id:i.id}},addFilesToProject:async(n,i)=>{const s=[];for(const u of i){const l=await r.fileRouter.createFile.mutate({file:{projectId:n,mimeType:de.PDF,path:u.blobUrl,name:u.name,size:0,metadata:null,isArtifact:!1,summary:null}});s.push({blobUrl:l.path,name:l.name,id:l.id})}return s},getFilesForProject:async n=>(await r.fileRouter.getFilesByProject.query({projectId:n})).map(s=>({blobUrl:s.path,name:s.name,id:s.id}))}}function cn({children:e,host:t="http://localhost",port:r=5174,getToken:n=an}){const[i,s]=j.useState(null);return j.useEffect(()=>{const u=`${t}:${r}`,l=un(u,n);s(l)},[t,r,n]),fe.jsx(st.Provider,{value:{host:t,port:r,client:i},children:e})}function at(){const e=j.useContext(st);if(!e)throw new Error("useFolioContext must be used within a FolioProvider");return e}const{useEffect:ln,useRef:fn,useState:dn}=$t;function mn({width:e="100%",height:t="100vh",allow:r="camera; microphone; clipboard-read; clipboard-write; fullscreen",style:n,className:i="",iframeProps:s={}}){const{host:u,port:l}=at(),a=fn(null),[f,m]=dn();return ln(()=>{m(`${u}:${l}`)},[u,l]),f?fe.jsx("div",{className:`folio-embed-container ${i}`,style:{width:e,height:t,overflow:"hidden",...n},children:fe.jsx("iframe",{ref:a,src:f,width:"100%",height:"100%",style:{border:"none",width:"100%",height:"100%",overflow:"auto"},allow:r,allowFullScreen:!0,...s})}):null}function pn(){const{client:e}=at(),[t,r]=j.useState(!1),[n,i]=j.useState(null);return{isLoading:t,error:n,getProjectsForUser:async()=>{for(;!e;)await new Promise(f=>setTimeout(f,100));r(!0),i(null);try{return await e.getProjectsForUser()}catch(f){return i(f instanceof Error?f:new Error(String(f))),[]}finally{r(!1)}},addProjectForUser:async f=>{for(;!e;)await new Promise(m=>setTimeout(m,100));r(!0),i(null);try{return await e.addProjectForUser(f)}catch(m){return i(m instanceof Error?m:new Error(String(m))),null}finally{r(!1)}},addFilesToProject:async(f,m)=>{for(;!e;)await new Promise(p=>setTimeout(p,100));r(!0),i(null);try{return await e.addFilesToProject(f,m)}catch(p){return i(p instanceof Error?p:new Error(String(p))),null}finally{r(!1)}},getFilesForProject:async f=>{for(;!e;)await new Promise(m=>setTimeout(m,100));r(!0),i(null);try{return await e.getFilesForProject(f)}catch(m){return i(m instanceof Error?m:new Error(String(m))),[]}finally{r(!1)}}}}F.FolioEmbed=mn,F.FolioProvider=cn,F.useFolio=pn,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
@@ -7,7 +7,7 @@ export type FolioProject = {
7
7
  id: number;
8
8
  };
9
9
  export type FolioFile = {
10
- path: string;
10
+ blobUrl: string;
11
11
  name: string;
12
12
  id: number;
13
13
  };
@@ -24,9 +24,6 @@ export declare function useFolio(): {
24
24
  error: Error | null;
25
25
  getProjectsForUser: () => Promise<FolioProject[]>;
26
26
  addProjectForUser: (projectName: string) => Promise<FolioProject | null>;
27
- addFilesToProject: (projectId: number, files: Array<{
28
- path: string;
29
- name: string;
30
- }>) => Promise<FolioFile[] | null>;
27
+ addFilesToProject: (projectId: number, files: Omit<FolioFile, "id">[]) => Promise<FolioFile[] | null>;
31
28
  getFilesForProject: (projectId: number) => Promise<FolioFile[]>;
32
29
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shiftengineering/folio",
3
3
  "private": false,
4
- "version": "0.0.76",
4
+ "version": "0.0.78",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShiftEngineering/folio.git"
@@ -19,29 +19,6 @@
19
19
  "import": "./dist-embed-component/folio-embed.js"
20
20
  }
21
21
  },
22
- "scripts": {
23
- "dev": "pnpm dev:client & pnpm dev:api",
24
- "dev:client": "pnpm generate-pwa-assets && vite --host",
25
- "dev:api": "tsx --env-file .env.local --watch src/api/main.ts",
26
- "dev:combined": "concurrently -k -n \"CLIENT,API\" \"pnpm generate-pwa-assets && vite build --watch\" \"SERVE_STATIC=true tsx --env-file .env.docker --watch src/api/main.ts\"",
27
- "build": "pnpm build:client && pnpm build:server",
28
- "build:client": "pnpm generate-pwa-assets && tsc -b && vite build",
29
- "build:server": "esbuild --format=cjs --platform=node --bundle --outfile=dist/server/main.cjs --sourcemap --target=node20 src/api/main.ts",
30
- "build:combined": "pnpm build:client && esbuild --format=cjs --platform=node --bundle --outfile=dist/server/combined-main.cjs --sourcemap --target=node20 --define:process.env.SERVE_STATIC=\\\"true\\\" src/api/main.ts",
31
- "build:embed-component": "vite build --config vite.embed-component.config.ts",
32
- "lint": "eslint .",
33
- "lint:fix": "eslint . --fix",
34
- "format": "prettier --write .",
35
- "preview:client": "vite preview --config vite.config.ts",
36
- "preview:server": "node --env-file .env.local dist/server/main.cjs",
37
- "preview:combined": "SERVE_STATIC=true node --env-file .env.local dist/server/combined-main.cjs",
38
- "preview": "pnpm preview:client & pnpm preview:server",
39
- "test": "vitest run",
40
- "test:watch": "vitest watch",
41
- "coverage": "vitest run --coverage",
42
- "prepare": "husky",
43
- "generate-pwa-assets": "pwa-assets-generator"
44
- },
45
22
  "lint-staged": {
46
23
  "*.{js,jsx,ts,tsx,json,jsonc,md,css,scss,html}": [
47
24
  "eslint --fix",
@@ -176,29 +153,30 @@
176
153
  "zod": "^3.24.1",
177
154
  "zustand": "^5.0.3"
178
155
  },
179
- "packageManager": "pnpm@10.2.0",
180
- "pnpm": {
181
- "supportedArchitectures": {
182
- "os": [
183
- "linux",
184
- "darwin"
185
- ],
186
- "cpu": [
187
- "x64",
188
- "arm64"
189
- ]
190
- },
191
- "onlyBuiltDependencies": [
192
- "sharp",
193
- "@cdktf/node-pty-prebuilt-multiarch",
194
- "@clerk/shared",
195
- "@swc/core",
196
- "canvas",
197
- "esbuild"
198
- ]
199
- },
200
156
  "peerDependencies": {
201
157
  "react": "^18.3.1",
202
158
  "react-dom": "^18.3.1"
159
+ },
160
+ "scripts": {
161
+ "dev": "pnpm dev:client & pnpm dev:api",
162
+ "dev:client": "pnpm generate-pwa-assets && vite --host",
163
+ "dev:api": "tsx --env-file .env.local --watch src/api/main.ts",
164
+ "dev:combined": "concurrently -k -n \"CLIENT,API\" \"pnpm generate-pwa-assets && vite build --watch\" \"SERVE_STATIC=true tsx --env-file .env.docker --watch src/api/main.ts\"",
165
+ "build": "pnpm build:client && pnpm build:server",
166
+ "build:client": "pnpm generate-pwa-assets && tsc -b && vite build",
167
+ "build:server": "esbuild --format=cjs --platform=node --bundle --outfile=dist/server/main.cjs --sourcemap --target=node20 src/api/main.ts",
168
+ "build:combined": "pnpm build:client && esbuild --format=cjs --platform=node --bundle --outfile=dist/server/combined-main.cjs --sourcemap --target=node20 --define:process.env.SERVE_STATIC=\\\"true\\\" src/api/main.ts",
169
+ "build:embed-component": "vite build --config vite.embed-component.config.ts",
170
+ "lint": "eslint .",
171
+ "lint:fix": "eslint . --fix",
172
+ "format": "prettier --write .",
173
+ "preview:client": "vite preview --config vite.config.ts",
174
+ "preview:server": "node --env-file .env.local dist/server/main.cjs",
175
+ "preview:combined": "SERVE_STATIC=true node --env-file .env.local dist/server/combined-main.cjs",
176
+ "preview": "pnpm preview:client & pnpm preview:server",
177
+ "test": "vitest run",
178
+ "test:watch": "vitest watch",
179
+ "coverage": "vitest run --coverage",
180
+ "generate-pwa-assets": "pwa-assets-generator"
203
181
  }
204
- }
182
+ }