@trilogy-data/trilogy-studio-components 0.1.24 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +5 -0
  2. package/dist/AssetAutoImporter-CBzvBaOt.js +405 -0
  3. package/dist/ChatCreatorModal-CL-jBnc3.js +218 -0
  4. package/dist/ChatModelSelect-Do-VRUFc.js +40 -0
  5. package/dist/{CommunityModels-CsDDXyIL.js → CommunityModels-Cmro0hV3.js} +101 -70
  6. package/dist/{Dashboard-BJfgRfRy.js → Dashboard-BH9ZwMVJ.js} +8 -8
  7. package/dist/{DashboardCreatorInline-wAlx6oH7.js → DashboardCreatorInline-CDU7kLy3.js} +3 -3
  8. package/dist/{DashboardImportSelector-D6ufVZIk.js → DashboardImportSelector-DQSvu9T-.js} +1 -1
  9. package/dist/{DashboardMobile-DoOyBHN7.js → DashboardMobile-BUPtdN2V.js} +4 -4
  10. package/dist/{Editor-Bs-h7edF.js → Editor-DQsYpkwl.js} +6 -6
  11. package/dist/{GlobalChatPanel-YsDZGxg8.js → GlobalChatPanel-DhnOaige.js} +155 -119
  12. package/dist/{IDE-CLF-KH2r.js → IDE-HLa8vybk.js} +9 -9
  13. package/dist/{JobsView-D1pp2xi5.js → JobsView-B97HBoIE.js} +8 -8
  14. package/dist/{LLMChat-CwM_brSg.js → LLMChat-CxJcPLEG.js} +1 -1
  15. package/dist/{LLMView-BiwCZb3Q.js → LLMView-C1MUf0c2.js} +21 -21
  16. package/dist/{MobileIDE-DrWh_OlB.js → MobileIDE-BpqXoaMR.js} +258 -253
  17. package/dist/{ModelCard-CsW4UwZI.js → ModelCard-BhN25jaV.js} +10 -10
  18. package/dist/{ModelCreator-C2douDis.js → ModelCreator-CCdC7EXt.js} +1 -1
  19. package/dist/{ModelView-D7ENFV2U.js → ModelView-DUDA_PtZ.js} +3 -3
  20. package/dist/{PageLoading-C5WK5i5Y.js → PageLoading-BzniJM0C.js} +622 -619
  21. package/dist/{ResultComponent-1MQlbELb.js → ResultComponent-CAn_r3BL.js} +3 -3
  22. package/dist/{Results-DXIYS4iW.js → Results-BJtlwebY.js} +3 -3
  23. package/dist/{SymbolsPane-BM6dUN-h.js → SymbolsPane-KYSwN9Sv.js} +1 -1
  24. package/dist/{TutorialPage-HXbXCznh.js → TutorialPage-NRcee6Dx.js} +8 -8
  25. package/dist/{VegaLiteChart-CS4h_t-K.js → VegaLiteChart-D1slfOUY.js} +11227 -11195
  26. package/dist/{WelcomePage-CLKvAvk-.js → WelcomePage-D5mU2x1L.js} +1 -1
  27. package/dist/components/AssetAutoImporter.vue.d.ts.map +1 -1
  28. package/dist/components/TipsCTA.vue.d.ts +1 -1
  29. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
  30. package/dist/components/chartHelpers.d.ts +9 -1
  31. package/dist/components/chartHelpers.d.ts.map +1 -1
  32. package/dist/components/chartRenderManager.d.ts +4 -1
  33. package/dist/components/chartRenderManager.d.ts.map +1 -1
  34. package/dist/components/community/AddStoreModal.vue.d.ts +1 -1
  35. package/dist/components/community/AddStoreModal.vue.d.ts.map +1 -1
  36. package/dist/components/community/CommunityModelCard.vue.d.ts.map +1 -1
  37. package/dist/components/editor/Editor.vue.d.ts.map +1 -1
  38. package/dist/components/jobs/JobsAddStoreModal.vue.d.ts.map +1 -1
  39. package/dist/components/llm/ChatCreatorModal.vue.d.ts +17 -1
  40. package/dist/components/llm/ChatCreatorModal.vue.d.ts.map +1 -1
  41. package/dist/components/llm/ChatModelSelect.vue.d.ts +13 -0
  42. package/dist/components/llm/ChatModelSelect.vue.d.ts.map +1 -0
  43. package/dist/components/llm/GlobalChatPanel.vue.d.ts.map +1 -1
  44. package/dist/components/sidebar/CommunityModelList.vue.d.ts +33 -50
  45. package/dist/components/sidebar/CommunityModelList.vue.d.ts.map +1 -1
  46. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts.map +1 -1
  47. package/dist/components/sidebar/EditorList.vue.d.ts +32 -49
  48. package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -1
  49. package/dist/components/sidebar/Sidebar.vue.d.ts +65 -99
  50. package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  51. package/dist/dashboard.js +52 -52
  52. package/dist/{dashboardStore-BzmI4OCV.js → dashboardStore-ppM6nGks.js} +33 -33
  53. package/dist/dashboards/layerSpec.d.ts +38 -4
  54. package/dist/dashboards/layerSpec.d.ts.map +1 -1
  55. package/dist/dashboards/lineAreaSpec.d.ts +8 -80
  56. package/dist/dashboards/lineAreaSpec.d.ts.map +1 -1
  57. package/dist/dashboards/mapSpec.d.ts +1 -0
  58. package/dist/dashboards/mapSpec.d.ts.map +1 -1
  59. package/dist/dashboards/spec.d.ts.map +1 -1
  60. package/dist/data/tutorial/documentation.d.ts.map +1 -1
  61. package/dist/data/tutorial/startupScripts.d.ts +3 -0
  62. package/dist/data/tutorial/startupScripts.d.ts.map +1 -0
  63. package/dist/{demoSetup-vmiMeH4_.js → demoSetup-mwa-RDC6.js} +19 -18
  64. package/dist/{editorRefinementRuntime-hC3u8GMO.js → editorRefinementRuntime-DoP9P5J2.js} +892 -871
  65. package/dist/{editorRefinementToolExecutor-Bomrpmns.js → editorRefinementToolExecutor-CVY3FA7k.js} +392 -267
  66. package/dist/{editorStore-Bj3Qnatp.js → editorStore-BhhmXbi-.js} +230 -183
  67. package/dist/entry.dashboard.d.ts +1 -0
  68. package/dist/entry.dashboard.d.ts.map +1 -1
  69. package/dist/{globalChatRuntime-DXI2KyGn.js → globalChatRuntime-DWZxeS57.js} +13 -13
  70. package/dist/{helpers-CFp2QCvv.js → helpers-BLQAgX3C.js} +17 -16
  71. package/dist/llm/chatAgentPrompt.d.ts.map +1 -1
  72. package/dist/llm/data/constants.d.ts +1 -1
  73. package/dist/llm/data/constants.d.ts.map +1 -1
  74. package/dist/llm/data/trilogySyntax.generated.d.ts +7 -1
  75. package/dist/llm/data/trilogySyntax.generated.d.ts.map +1 -1
  76. package/dist/llm/docsIndex.d.ts.map +1 -1
  77. package/dist/llm/openai.d.ts +2 -1
  78. package/dist/llm/openai.d.ts.map +1 -1
  79. package/dist/{llm-BuEsqH9Q.js → llm-BBOVWb-F.js} +7 -5
  80. package/dist/llm.js +3 -3
  81. package/dist/{llmStore-x5lRrKgx.js → llmStore-DJM2JhzY.js} +2 -2
  82. package/dist/{localStorage-C-ZtI6YA.js → localStorage-D9uyOFEO.js} +14 -14
  83. package/dist/models/helpers.d.ts.map +1 -1
  84. package/dist/monaco.js +1 -1
  85. package/dist/{reconcile-E5LR5p_f.js → reconcile-Dyf4UZmj.js} +1 -1
  86. package/dist/{remoteStoreSync-MwuJpHHt.js → remoteStoreSync-Z-yjlYtI.js} +1 -1
  87. package/dist/remotes/displayHelpers.d.ts.map +1 -1
  88. package/dist/remotes/genericStoreMetadata.d.ts +1 -0
  89. package/dist/remotes/genericStoreMetadata.d.ts.map +1 -1
  90. package/dist/remotes/models.d.ts +37 -5
  91. package/dist/remotes/models.d.ts.map +1 -1
  92. package/dist/remotes/staticStorePresets.d.ts +22 -0
  93. package/dist/remotes/staticStorePresets.d.ts.map +1 -0
  94. package/dist/remotes/storeService.d.ts +25 -4
  95. package/dist/remotes/storeService.d.ts.map +1 -1
  96. package/dist/stores/communityApiStore.d.ts +32 -60
  97. package/dist/stores/communityApiStore.d.ts.map +1 -1
  98. package/dist/stores/connectionStore.d.ts.map +1 -1
  99. package/dist/stores/resolver.d.ts +5 -0
  100. package/dist/stores/resolver.d.ts.map +1 -1
  101. package/dist/stores/urlStore.d.ts +1 -0
  102. package/dist/stores/urlStore.d.ts.map +1 -1
  103. package/dist/{stores-D-gHjj-_.js → stores-BT9hTLny.js} +47 -47
  104. package/dist/stores.js +7 -7
  105. package/dist/trilogy-studio-components.css +1 -1
  106. package/dist/{urlStore-Dgmwx1YI.js → urlStore-52HG6lsX.js} +1 -0
  107. package/dist/{useChatWithTools-BlCJrJT7.js → useChatWithTools-B0HZ_DVh.js} +1 -1
  108. package/dist/{useDashboard-CVlbV17V.js → useDashboard-CdSnPe_6.js} +186 -186
  109. package/dist/{useGlobalChatPanel-CNARTFYu.js → useGlobalChatPanel-D_0luajQ.js} +2 -2
  110. package/dist/views/MobileIDE.vue.d.ts.map +1 -1
  111. package/dist/views/TutorialPage.vue.d.ts +32 -49
  112. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  113. package/dist/views.js +16 -16
  114. package/package.json +1 -1
  115. package/dist/AssetAutoImporter-BD1P91Hq.js +0 -403
  116. package/dist/ChatCreatorModal-BTqY06B6.js +0 -177
@@ -1,9 +1,9 @@
1
- import { on as e, sn as t } from "./editorRefinementToolExecutor-Bomrpmns.js";
2
- import { C as n, D as r, M as i, S as a, i as o, t as s, w as c, x as l } from "./editorRefinementRuntime-hC3u8GMO.js";
1
+ import { cn as e, ln as t } from "./editorRefinementToolExecutor-CVY3FA7k.js";
2
+ import { C as n, D as r, M as i, S as a, i as o, t as s, w as c, x as l } from "./editorRefinementRuntime-DoP9P5J2.js";
3
3
  import { s as u } from "./base-C8IuZWqY.js";
4
4
  import { r as d, t as f } from "./connections-CJSb1TZl.js";
5
5
  import { a as p, i as m, o as h, s as g, t as _ } from "./remoteWorker-Dkv3TJ0j.js";
6
- import "./llm-BuEsqH9Q.js";
6
+ import "./llm-BBOVWb-F.js";
7
7
  import { reactive as v } from "vue";
8
8
  import { defineStore as y } from "pinia";
9
9
  //#region stores/modelStore.ts
@@ -73,17 +73,17 @@ var b = y("models", {
73
73
  }
74
74
  async deleteProject(e) {}
75
75
  async clearProjects() {}
76
- }, S = (e) => new Promise((t) => setTimeout(t, e)), ee = /* @__PURE__ */ new Set(), te = /* @__PURE__ */ new Set(), ne = (e) => {
76
+ }, S = (e) => new Promise((t) => setTimeout(t, e)), ee = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), te = (e) => {
77
77
  if (ee.has(e)) return !0;
78
78
  let t = e;
79
79
  e.includes("://") || (t = `http://${e}`);
80
80
  try {
81
81
  let e = new URL(t), n = e.host, r = e.hostname;
82
- if (te.has(n) || te.has(r)) return !0;
82
+ if (C.has(n) || C.has(r)) return !0;
83
83
  } catch {}
84
84
  return !1;
85
- }, C = async (e, t, n = 5, r = 1e3) => {
86
- if (ne(e)) throw Error(`Cannot connect to ${e} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`);
85
+ }, w = async (e, t, n = 5, r = 1e3) => {
86
+ if (te(e)) throw Error(`Cannot connect to ${e} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`);
87
87
  let i = 0, a = r;
88
88
  for (;;) try {
89
89
  let r = await fetch(e, t);
@@ -94,41 +94,41 @@ var b = y("models", {
94
94
  }
95
95
  return r;
96
96
  } catch (t) {
97
- if (ne(e)) throw Error(`Cannot connect to ${e} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`);
97
+ if (te(e)) throw Error(`Cannot connect to ${e} - blocked by Content Security Policy. This URL is not allowed by the browser's security settings.`);
98
98
  let r = t instanceof Error ? t.message : String(t);
99
99
  if (t instanceof TypeError || r.includes("Failed to fetch") || r.includes("NetworkError") || r.includes("ERR_CONNECTION_REFUSED") || r.includes("Load failed") || r.includes("network connection was lost") || r.includes("Could not connect to the server") || r.includes("fetch failed") || i >= n) throw t;
100
100
  console.log(`Network error, retrying after ${a}ms (Attempt ${i + 1}/${n})`), await S(a), a = a * 2 * (.8 + Math.random() * .4), i++;
101
101
  }
102
- }, re = (e, t, n, r, i) => e.filter((e) => {
102
+ }, ne = (e, t, n, r, i) => e.filter((e) => {
103
103
  let a = e.name.toLowerCase().includes(t.toLowerCase()), o = !n || e.engine === n, s = !0;
104
104
  if (r !== "all") {
105
105
  let t = i(e.name);
106
106
  s = r === "imported" && t || r === "not-imported" && !t;
107
107
  }
108
108
  return a && o && s;
109
- }), ie = (e) => {
109
+ }), re = (e) => {
110
110
  switch (e) {
111
111
  case "bigquery": return "new-bigquery-oauth";
112
112
  case "duckdb": return "new-duckdb";
113
113
  default: return `new-${e}`;
114
114
  }
115
- }, ae = (e) => {
115
+ }, ie = (e) => {
116
116
  let t = /* @__PURE__ */ new Set();
117
117
  return e.forEach((e) => {
118
118
  e.engine && t.add(e.engine);
119
119
  }), Array.from(t).sort();
120
- }, w = (e) => {
120
+ }, T = (e) => {
121
121
  if (e) return { headers: { "X-Trilogy-Token": e } };
122
- }, T = async (e) => {
123
- let t = await C(`${e.baseUrl}/index.json`, w(e.token));
122
+ }, E = async (e) => {
123
+ let t = await w(`${e.baseUrl}/index.json`, T(e.token));
124
124
  if (!t.ok) throw Error(`Failed to fetch store index: ${t.status} ${t.statusText}`);
125
125
  return t.json();
126
- }, oe = async (e) => {
126
+ }, ae = async (e) => {
127
127
  let t = null, n = [];
128
128
  try {
129
- let t = (await T(e)).models.map(async (t) => {
129
+ let t = (await E(e)).models.map(async (t) => {
130
130
  try {
131
- let n = await C(t.url, w(e.token));
131
+ let n = await w(t.url, T(e.token));
132
132
  if (!n.ok) return console.warn(`Failed to fetch model ${t.name}: ${n.statusText}`), null;
133
133
  let r = await n.json();
134
134
  return r.downloadUrl = t.url, r.store = e, r;
@@ -144,38 +144,60 @@ var b = y("models", {
144
144
  files: n,
145
145
  error: t
146
146
  };
147
- }, se = async (e) => {
147
+ }, D = (e, t) => {
148
+ try {
149
+ return new URL(e, t).toString();
150
+ } catch {
151
+ return e;
152
+ }
153
+ }, oe = (e, t) => {
154
+ if (!e || typeof e != "object") throw Error("Store index is not a JSON object");
155
+ let n = e, r;
156
+ if (Array.isArray(n.models)) r = n.models;
157
+ else if (Array.isArray(n.files)) r = n.files.filter((e) => typeof e.filename == "string" && e.filename.endsWith(".json")).map((e) => ({
158
+ name: e.name || e.filename.replace(/\.json$/, ""),
159
+ url: e.filename,
160
+ engine: e.engine,
161
+ description: e.description,
162
+ tags: e.tags
163
+ }));
164
+ else throw Error("Store index has neither `models` nor `files`");
165
+ return {
166
+ name: typeof n.name == "string" ? n.name : void 0,
167
+ updated_at: typeof n.updated_at == "string" ? n.updated_at : void 0,
168
+ generation: typeof n.generation == "number" ? n.generation : void 0,
169
+ models: r.filter((e) => e && typeof e.url == "string").map((e) => ({
170
+ ...e,
171
+ url: D(e.url, t)
172
+ }))
173
+ };
174
+ }, O = (e, t) => (Array.isArray(e.components) && (e.components = e.components.map((e) => ({
175
+ ...e,
176
+ url: D(e.url, t)
177
+ }))), e), se = (e) => `${e.baseUrl.replace(/\/$/, "")}/index.json`, ce = async (e) => {
148
178
  let t = null, n = [];
149
179
  try {
150
- let t, r;
151
- e.owner === "trilogy-data" && e.repo === "trilogy-public-models" ? (t = "https://trilogy-data.github.io/trilogy-public-models/studio/index.json", r = "https://trilogy-data.github.io/trilogy-public-models/studio/") : (t = `https://api.github.com/repos/${e.owner}/${e.repo}/contents/studio/index.json?ref=${e.branch}`, r = `https://raw.githubusercontent.com/${e.owner}/${e.repo}/${e.branch}/studio/`);
152
- let i = await C(t);
153
- if (i.status !== 200) throw Error(`Error fetching community data: ${await i.text()}`);
154
- let a;
155
- if (e.owner === "trilogy-data" && e.repo === "trilogy-public-models") a = await i.json();
156
- else {
157
- let e = await i.json();
158
- a = JSON.parse(atob(e.content));
159
- }
160
- let o = a.files.filter((e) => e.filename.endsWith(".json")).map(async (t) => {
161
- let n = `${r}${t.filename}`, i = await C(n);
162
- if (!i.ok) throw Error(`Error fetching file ${t.filename}: ${i.statusText}`);
163
- let a = await i.json();
164
- return a.downloadUrl = n, a.store = e, a;
180
+ let t = se(e), r = await w(t);
181
+ if (!r.ok) throw Error(`Failed to fetch store index: ${r.status} ${r.statusText}`);
182
+ let i = oe(await r.json(), t).models.map(async (t) => {
183
+ let n = await w(t.url);
184
+ if (!n.ok) throw Error(`Error fetching model ${t.name}: ${n.statusText}`);
185
+ let r = O(await n.json(), t.url);
186
+ return r.downloadUrl = t.url, r.store = e, r;
165
187
  });
166
- n = await Promise.all(o);
188
+ n = await Promise.all(i);
167
189
  } catch (e) {
168
- t = e instanceof Error ? e.message : "Error fetching files", console.error("Error fetching from GitHub store:", e);
190
+ t = e instanceof Error ? e.message : "Error fetching files", console.error("Error fetching from static store:", e);
169
191
  }
170
192
  return {
171
193
  files: n,
172
194
  error: t
173
195
  };
174
- }, E = async (e) => e.type === "github" ? se(e) : oe(e), ce = async (e, t) => {
196
+ }, k = async (e) => e.type === "static" ? ce(e) : ae(e), le = async (e, t) => {
175
197
  let n = {}, r = {};
176
198
  return await Promise.all(e.map(async (e) => {
177
199
  try {
178
- let { files: i, error: a } = await E(e);
200
+ let { files: i, error: a } = await k(e);
179
201
  n[e.id] = i, a && (r[e.id] = a), t && t(e.id, {
180
202
  files: i,
181
203
  error: a
@@ -191,17 +213,17 @@ var b = y("models", {
191
213
  filesByStore: n,
192
214
  errors: r
193
215
  };
194
- }, le = {
216
+ }, ue = {
195
217
  stale: 3,
196
218
  unknown: 2,
197
219
  fresh: 1
198
- }, D = (e) => le[e] ?? 0, ue = (e) => e.observed_watermarks.reduce((e, t) => e ? t.probed_at > e.probed_at ? t : e : t, null), O = (e) => {
199
- let t = e.datasources.reduce((e, t) => !e || D(t.status) > D(e) ? t.status : e, null);
200
- return t && D(t) > D(e.status) ? t : e.status;
201
- }, de = (e) => e.partition_by.map((e) => e.column), fe = (e) => {
220
+ }, A = (e) => ue[e] ?? 0, de = (e) => e.observed_watermarks.reduce((e, t) => e ? t.probed_at > e.probed_at ? t : e : t, null), j = (e) => {
221
+ let t = e.datasources.reduce((e, t) => !e || A(t.status) > A(e) ? t.status : e, null);
222
+ return t && A(t) > A(e.status) ? t : e.status;
223
+ }, fe = (e) => e.partition_by.map((e) => e.column), pe = (e) => {
202
224
  let t = Object.entries(e.values).map(([e, t]) => `${e}=${t ?? "—"}`);
203
225
  return t.length ? t.join(", ") : e.partition_id;
204
- }, pe = (e) => {
226
+ }, me = (e) => {
205
227
  let t = {
206
228
  total: e.partitions.length,
207
229
  fresh: 0,
@@ -214,35 +236,35 @@ var b = y("models", {
214
236
  return e.partitions.forEach((e) => {
215
237
  e.status === "fresh" ? t.fresh += 1 : e.status === "stale" ? t.stale += 1 : t.unknown += 1, e.expected && !e.observed && (t.missing += 1), typeof e.row_count == "number" && (t.rowCount = (t.rowCount ?? 0) + e.row_count);
216
238
  }), t;
217
- }, me = (e) => [...e].sort((e, t) => {
218
- let n = D(t.status) - D(e.status);
239
+ }, he = (e) => [...e].sort((e, t) => {
240
+ let n = A(t.status) - A(e.status);
219
241
  if (n !== 0) return n;
220
242
  let r = Number(!e.observed) - Number(!t.observed);
221
243
  return r === 0 ? e.partition_id.localeCompare(t.partition_id) : -r;
222
- }), he = (e) => [...e].sort((e, t) => {
223
- let n = D(O(t)) - D(O(e));
244
+ }), ge = (e) => [...e].sort((e, t) => {
245
+ let n = A(j(t)) - A(j(e));
224
246
  return n === 0 ? e.address.localeCompare(t.address) : n;
225
- }), k = "::", ge = (e, t) => `${e}${k}${t || "."}`, _e = (e) => {
226
- let t = e.indexOf(k);
247
+ }), M = "::", _e = (e, t) => `${e}${M}${t || "."}`, ve = (e) => {
248
+ let t = e.indexOf(M);
227
249
  return t === -1 ? null : {
228
250
  storeId: e.slice(0, t),
229
251
  target: e.slice(t + 2)
230
252
  };
231
- }, A = (e) => e || ".", ve = (e, t) => {
232
- let n = A(e), r = A(t);
253
+ }, N = (e) => e || ".", ye = (e, t) => {
254
+ let n = N(e), r = N(t);
233
255
  return n === r || n === "." || r.startsWith(`${n}/`);
234
- }, j = class extends Error {
256
+ }, P = class extends Error {
235
257
  status;
236
258
  constructor(e, t) {
237
259
  super(e), this.name = "JobsServiceError", this.status = t;
238
260
  }
239
- }, M = (e, t = {}) => {
261
+ }, F = (e, t = {}) => {
240
262
  let n = new Headers(t.headers);
241
263
  return e && n.set("X-Trilogy-Token", e), {
242
264
  ...t,
243
265
  headers: n
244
266
  };
245
- }, N = (e) => e.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), P = async (e, t) => {
267
+ }, I = (e) => e.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/"), L = async (e, t) => {
246
268
  if (e.ok) return e;
247
269
  let n = "";
248
270
  try {
@@ -253,15 +275,15 @@ var b = y("models", {
253
275
  } catch {
254
276
  n = "";
255
277
  }
256
- throw new j(n || t, e.status);
257
- }, F = async (e) => {
258
- let t = await fetch(`${e.baseUrl}/files`, M(e.token, { method: "GET" }));
259
- return await P(t, `Failed to fetch files for ${e.name}`), t.json();
260
- }, ye = async (e, t) => {
261
- let n = N(t), r = await fetch(`${e.baseUrl}/files/${n}`, M(e.token, { method: "GET" }));
262
- return await P(r, `Failed to fetch ${t}`), r.text();
263
- }, I = async (e, t, n) => {
264
- let r = await fetch(`${e.baseUrl}/files`, M(e.token, {
278
+ throw new P(n || t, e.status);
279
+ }, R = async (e) => {
280
+ let t = await fetch(`${e.baseUrl}/files`, F(e.token, { method: "GET" }));
281
+ return await L(t, `Failed to fetch files for ${e.name}`), t.json();
282
+ }, be = async (e, t) => {
283
+ let n = I(t), r = await fetch(`${e.baseUrl}/files/${n}`, F(e.token, { method: "GET" }));
284
+ return await L(r, `Failed to fetch ${t}`), r.text();
285
+ }, z = async (e, t, n) => {
286
+ let r = await fetch(`${e.baseUrl}/files`, F(e.token, {
265
287
  method: "POST",
266
288
  headers: { "Content-Type": "application/json" },
267
289
  body: JSON.stringify({
@@ -270,18 +292,18 @@ var b = y("models", {
270
292
  })
271
293
  }));
272
294
  if (r.status === 409) {
273
- await L(e, t, n);
295
+ await B(e, t, n);
274
296
  return;
275
297
  }
276
- await P(r, `Failed to create ${t}`);
277
- }, L = async (e, t, n) => {
278
- let r = await fetch(`${e.baseUrl}/files/${N(t)}`, M(e.token, {
298
+ await L(r, `Failed to create ${t}`);
299
+ }, B = async (e, t, n) => {
300
+ let r = await fetch(`${e.baseUrl}/files/${I(t)}`, F(e.token, {
279
301
  method: "PUT",
280
302
  headers: { "Content-Type": "application/json" },
281
303
  body: JSON.stringify({ content: n })
282
304
  }));
283
305
  if (r.status === 404) {
284
- await P(await fetch(`${e.baseUrl}/files`, M(e.token, {
306
+ await L(await fetch(`${e.baseUrl}/files`, F(e.token, {
285
307
  method: "POST",
286
308
  headers: { "Content-Type": "application/json" },
287
309
  body: JSON.stringify({
@@ -291,42 +313,51 @@ var b = y("models", {
291
313
  })), `Failed to update ${t}`);
292
314
  return;
293
315
  }
294
- await P(r, `Failed to update ${t}`);
295
- }, R = async (e, t) => {
296
- let n = await fetch(`${e.baseUrl}/files/${N(t)}`, M(e.token, { method: "DELETE" }));
297
- n.status !== 404 && await P(n, `Failed to delete ${t}`);
298
- }, be = async (e, t, n = !1) => {
299
- let r = new URLSearchParams({ target: A(t) });
316
+ await L(r, `Failed to update ${t}`);
317
+ }, V = async (e, t) => {
318
+ let n = await fetch(`${e.baseUrl}/files/${I(t)}`, F(e.token, { method: "DELETE" }));
319
+ n.status !== 404 && await L(n, `Failed to delete ${t}`);
320
+ }, xe = async (e, t, n = !1) => {
321
+ let r = new URLSearchParams({ target: N(t) });
300
322
  n && r.set("refresh", "true");
301
- let i = await fetch(`${e.baseUrl}/state?${r.toString()}`, M(e.token, { method: "GET" }));
302
- await P(i, `Failed to fetch state for ${A(t)}`);
323
+ let i = await fetch(`${e.baseUrl}/state?${r.toString()}`, F(e.token, { method: "GET" }));
324
+ await L(i, `Failed to fetch state for ${N(t)}`);
303
325
  let a = i.headers.get("X-Trilogy-Cached");
304
326
  return {
305
327
  snapshot: await i.json(),
306
328
  cached: a === null ? null : a.toLowerCase() === "true",
307
329
  computedAt: i.headers.get("X-Trilogy-Computed-At")
308
330
  };
309
- }, xe = async (e, t, n) => {
310
- let r = await fetch(`${e.baseUrl}/${t}`, M(e.token, {
331
+ }, Se = async (e, t, n) => {
332
+ let r = await fetch(`${e.baseUrl}/${t}`, F(e.token, {
311
333
  method: "POST",
312
334
  headers: { "Content-Type": "application/json" },
313
335
  body: JSON.stringify({ target: n })
314
336
  }));
315
- return await P(r, `Failed to ${t} ${n}`), r.json();
316
- }, Se = async (e, t) => {
317
- let n = await fetch(`${e.baseUrl}/jobs/${t}`, M(e.token, { method: "GET" }));
318
- return await P(n, `Failed to fetch job ${t}`), n.json();
337
+ return await L(r, `Failed to ${t} ${n}`), r.json();
319
338
  }, Ce = async (e, t) => {
320
- let n = await fetch(`${e.baseUrl}/jobs/${t}/cancel`, M(e.token, { method: "POST" }));
321
- return await P(n, `Failed to cancel job ${t}`), n.json();
322
- }, z = (e) => e.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), B = (e) => e.replace(/\/$/, ""), V = (e) => B(e).replace(/^https?:\/\//, "").replace(/\//g, "-"), H = (e) => {
339
+ let n = await fetch(`${e.baseUrl}/jobs/${t}`, F(e.token, { method: "GET" }));
340
+ return await L(n, `Failed to fetch job ${t}`), n.json();
341
+ }, we = async (e, t) => {
342
+ let n = await fetch(`${e.baseUrl}/jobs/${t}/cancel`, F(e.token, { method: "POST" }));
343
+ return await L(n, `Failed to cancel job ${t}`), n.json();
344
+ }, H = (e) => e.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " "), U = (e) => e.replace(/\/$/, ""), W = (e) => U(e).replace(/^https?:\/\//, "").replace(/\//g, "-"), G = (e) => {
323
345
  try {
324
- let t = new URL(B(e));
325
- return z(t.hostname + (t.port ? `:${t.port}` : "") || t.host || e);
346
+ let t = new URL(U(e));
347
+ return H(t.hostname + (t.port ? `:${t.port}` : "") || t.host || e);
326
348
  } catch {
327
- return z(B(e));
349
+ return H(U(e));
328
350
  }
329
- }, U = (e) => z(e.name || H(e.baseUrl)), W = (e) => `${U(e)}-connection`, G = (e) => U(e), we = (e) => e.replace(/\.[^.]+$/, ""), Te = (e) => e.flatMap((e) => e.files.map((t) => e.directory ? `${e.directory}/${t}` : t)), Ee = class extends x {
351
+ }, Te = (e, t, n) => {
352
+ let r = U(e.trim());
353
+ return {
354
+ type: "generic",
355
+ id: W(r),
356
+ name: t || G(r),
357
+ baseUrl: r,
358
+ token: n || void 0
359
+ };
360
+ }, K = (e) => H(e.name || G(e.baseUrl)), Ee = (e) => `${K(e)}-connection`, De = (e) => K(e), Oe = (e) => e.replace(/\.[^.]+$/, ""), ke = (e) => e.flatMap((e) => e.files.map((t) => e.directory ? `${e.directory}/${t}` : t)), Ae = class extends x {
330
361
  type;
331
362
  communityStore;
332
363
  constructor(e) {
@@ -343,7 +374,7 @@ var b = y("models", {
343
374
  }
344
375
  async detectEngineForFallback(e) {
345
376
  try {
346
- return (await E(e)).files[0]?.engine || "duck_db";
377
+ return (await k(e)).files[0]?.engine || "duck_db";
347
378
  } catch {
348
379
  return "duck_db";
349
380
  }
@@ -390,10 +421,10 @@ var b = y("models", {
390
421
  editors: {},
391
422
  connections: {},
392
423
  models: {}
393
- }, [u, d] = await Promise.all([T(o).catch((e) => (console.warn(`Failed to fetch /index.json for store "${o.name}":`, e), null)), F(o)]), f = u?.connection ?? null, p = W(o), h = G(o), g = new Set(u?.startup_scripts ?? []), _ = Te(d.directories), y = _.filter((e) => n(e) !== null);
424
+ }, [u, d] = await Promise.all([E(o).catch((e) => (console.warn(`Failed to fetch /index.json for store "${o.name}":`, e), null)), R(o)]), f = u?.connection ?? null, p = Ee(o), h = De(o), g = new Set(u?.startup_scripts ?? []), _ = ke(d.directories), y = _.filter((e) => n(e) !== null);
394
425
  (await Promise.all(y.map(async (e) => ({
395
426
  path: e,
396
- content: await ye(o, e)
427
+ content: await be(o, e)
397
428
  })))).forEach(({ path: e, content: t }) => {
398
429
  let r = n(e);
399
430
  if (!r) return;
@@ -424,8 +455,8 @@ var b = y("models", {
424
455
  let S = v(new e({
425
456
  name: h,
426
457
  storage: "remote",
427
- description: `${U(o)} remote project`,
428
- sources: _.filter((e) => c(e) === ".preql").map((e) => new t(this.buildEditorId(o, e), we(e), [], []))
458
+ description: `${K(o)} remote project`,
459
+ sources: _.filter((e) => c(e) === ".preql").map((e) => new t(this.buildEditorId(o, e), Oe(e), [], []))
429
460
  }));
430
461
  return S.changed = !1, s.models[S.name] = S, s;
431
462
  }
@@ -439,10 +470,10 @@ var b = y("models", {
439
470
  if (!e) continue;
440
471
  let n = t.remotePath || t.name, r = t.remoteOriginalPath;
441
472
  if (t.deleted) {
442
- (t.remotePersisted || r) && await R(e, r || n), t.changed = !1;
473
+ (t.remotePersisted || r) && await V(e, r || n), t.changed = !1;
443
474
  continue;
444
475
  }
445
- t.changed &&= (r && r !== n ? (await I(e, n, t.contents), await R(e, r)) : t.remotePersisted ? await L(e, n, t.contents) : await I(e, n, t.contents), t.remotePath = n, t.remoteOriginalPath = null, t.remotePersisted = !0, !1);
476
+ t.changed &&= (r && r !== n ? (await z(e, n, t.contents), await V(e, r)) : t.remotePersisted ? await B(e, n, t.contents) : await z(e, n, t.contents), t.remotePath = n, t.remoteOriginalPath = null, t.remotePersisted = !0, !1);
446
477
  }
447
478
  }
448
479
  async loadEditors() {
@@ -494,35 +525,83 @@ var b = y("models", {
494
525
  }
495
526
  async deleteChat(e) {}
496
527
  async clearChats() {}
497
- }, K = {
498
- type: "github",
528
+ }, q = {
529
+ type: "static",
499
530
  id: "trilogy-data-trilogy-public-models-main",
500
531
  name: "Trilogy Public Models",
501
- owner: "trilogy-data",
502
- repo: "trilogy-public-models",
503
- branch: "main"
504
- }, q = "trilogy-community-stores", De = (e) => {
532
+ baseUrl: "https://trilogy-data.github.io/trilogy-public-models/studio",
533
+ origin: {
534
+ kind: "github",
535
+ owner: "trilogy-data",
536
+ repo: "trilogy-public-models",
537
+ branch: "main"
538
+ }
539
+ }, je = "trilogy-data", Me = "trilogy-public-models", Ne = (e, t, n) => e === je && t === Me ? `https://${je}.github.io/${Me}/studio` : `https://raw.githubusercontent.com/${e}/${t}/${n}/studio`, Pe = (e, t, n) => `${e}-${t}-${n}`, Fe = (e, t, n, r) => {
540
+ let i = {
541
+ kind: "github",
542
+ owner: e,
543
+ repo: t,
544
+ branch: n
545
+ };
546
+ return {
547
+ type: "static",
548
+ id: Pe(e, t, n),
549
+ name: r || `${e}/${t}`,
550
+ baseUrl: Ne(e, t, n),
551
+ origin: i
552
+ };
553
+ }, Ie = (e, t) => {
554
+ let n = U(e.trim());
555
+ return {
556
+ type: "static",
557
+ id: W(n),
558
+ name: t || G(n),
559
+ baseUrl: n
560
+ };
561
+ }, Le = (e) => {
562
+ if (!e || typeof e != "object") return null;
563
+ let t = e;
564
+ if (t.type === "github") {
565
+ let e = Fe(t.owner, t.repo, t.branch, t.name);
566
+ return {
567
+ ...e,
568
+ id: t.id || e.id
569
+ };
570
+ }
571
+ return t.type === "static" || t.type === "generic" ? t : null;
572
+ }, Re = (e) => {
573
+ if (e.type === "static" && e.origin?.kind === "github") return `${e.origin.owner}/${e.origin.repo}@${e.origin.branch}`;
574
+ try {
575
+ return new URL(e.baseUrl).host;
576
+ } catch {
577
+ return e.baseUrl;
578
+ }
579
+ }, ze = "trilogy-community-stores", Be = (e) => {
505
580
  let t = new URLSearchParams(window.location.search), n = t.get("store"), r = t.get("token");
506
581
  if (!n || !r) return;
507
- let i = B(n), a = e.find((e) => e.type === "generic" && B(e.baseUrl) === i);
582
+ let i = U(n), a = e.find((e) => e.type === "generic" && U(e.baseUrl) === i);
508
583
  a && !a.token && (a.token = r);
509
- }, Oe = y("communityApi", {
584
+ }, Ve = (e) => {
585
+ let t = new URLSearchParams(window.location.search), n = t.get("store");
586
+ if (!n || t.get("kind") !== "static") return null;
587
+ let r;
588
+ try {
589
+ let e = new URL(n);
590
+ if (e.protocol !== "https:" && e.protocol !== "http:") return null;
591
+ r = Ie(n);
592
+ } catch {
593
+ return null;
594
+ }
595
+ return e.some((e) => e.id === r.id || U(e.baseUrl) === r.baseUrl) ? null : r;
596
+ }, He = y("communityApi", {
510
597
  state: () => ({
511
- stores: [K],
598
+ stores: [q],
512
599
  filesByStore: {},
513
600
  errors: {},
514
- storeStatus: { [K.id]: "idle" },
601
+ storeStatus: { [q.id]: "idle" },
515
602
  loading: !1,
516
603
  showAddStoreModal: !1,
517
- addingStore: !1,
518
- newStore: {
519
- type: "generic",
520
- name: "",
521
- baseUrl: "",
522
- owner: "",
523
- repo: "",
524
- branch: "main"
525
- }
604
+ addingStore: !1
526
605
  }),
527
606
  getters: {
528
607
  allFiles: (e) => {
@@ -535,7 +614,7 @@ var b = y("models", {
535
614
  let t = [];
536
615
  return Object.values(e.filesByStore).forEach((e) => {
537
616
  t.push(...e);
538
- }), ae(t);
617
+ }), ie(t);
539
618
  },
540
619
  hasErrors: (e) => Object.keys(e.errors).length > 0,
541
620
  errorList: (e) => Object.entries(e.errors).map(([t, n]) => ({
@@ -547,10 +626,12 @@ var b = y("models", {
547
626
  actions: {
548
627
  loadStoresFromStorage() {
549
628
  try {
550
- let e = localStorage.getItem(q);
629
+ let e = localStorage.getItem(ze), t = !1;
551
630
  if (e) {
552
- let t = JSON.parse(e), n = new Map(this.stores.map((e) => [e.id, e])), r = [K, ...t.map((e) => {
553
- let t = n.get(e.id);
631
+ let n = JSON.parse(e), r = Array.isArray(n) ? n : [], i = r.map((e) => Le(e)).filter((e) => e !== null);
632
+ t = r.length !== i.length || r.some((e) => e?.type === "github");
633
+ let a = new Map(this.stores.map((e) => [e.id, e])), o = [q, ...i.map((e) => {
634
+ let t = a.get(e.id);
554
635
  if (!t || t.type !== e.type) return e;
555
636
  if (e.type === "generic") {
556
637
  let n = t.type === "generic" ? t : null;
@@ -565,19 +646,21 @@ var b = y("models", {
565
646
  ...t
566
647
  };
567
648
  })].filter((e, t, n) => t === n.findIndex((t) => t.id === e.id));
568
- De(r), this.stores = r, r.forEach((e) => {
649
+ Be(o), this.stores = o, o.forEach((e) => {
569
650
  this.storeStatus[e.id] || (this.storeStatus[e.id] = "idle");
570
651
  });
571
652
  }
572
- e || De(this.stores);
653
+ e || Be(this.stores);
654
+ let n = Ve(this.stores);
655
+ n && (this.stores.push(n), this.storeStatus[n.id] = "idle", t = !0), t && this.saveStoresToStorage();
573
656
  } catch (e) {
574
657
  console.error("Error loading stores from localStorage:", e);
575
658
  }
576
659
  },
577
660
  saveStoresToStorage() {
578
661
  try {
579
- let e = this.stores.filter((e) => e.id !== K.id);
580
- localStorage.setItem(q, JSON.stringify(e));
662
+ let e = this.stores.filter((e) => e.id !== q.id);
663
+ localStorage.setItem(ze, JSON.stringify(e));
581
664
  } catch (e) {
582
665
  console.error("Error saving stores to localStorage:", e);
583
666
  }
@@ -587,7 +670,7 @@ var b = y("models", {
587
670
  for (let e of this.stores) this.storeStatus[e.id] = "idle";
588
671
  try {
589
672
  console.log(`Fetching community model files from ${this.stores.map((e) => e.id).join(", ")}...`);
590
- let e = await ce(this.stores, (e, t) => {
673
+ let e = await le(this.stores, (e, t) => {
591
674
  this.filesByStore[e] = t.files, t.error ? (this.errors[e] = t.error, this.storeStatus[e] = "failed") : this.storeStatus[e] = "connected", console.log(`Store ${e} completed: ${t.error ? "failed" : "success"}`);
592
675
  });
593
676
  console.log("All stores fetched:", e);
@@ -605,7 +688,7 @@ var b = y("models", {
605
688
  if (t) {
606
689
  this.loading = !0, this.storeStatus[e] = "idle";
607
690
  try {
608
- let n = await E(t);
691
+ let n = await k(t);
609
692
  this.filesByStore[e] = n.files, n.error ? (this.errors[e] = n.error, this.storeStatus[e] = "failed") : (delete this.errors[e], this.storeStatus[e] = "connected");
610
693
  } finally {
611
694
  this.loading = !1;
@@ -614,7 +697,7 @@ var b = y("models", {
614
697
  },
615
698
  filteredFiles(e, t, n, r, i = null) {
616
699
  let a = (e) => e in r.models, o = this.allFiles;
617
- return i && (o = this.filesByStore[i]), o ? re(o, e, t, n, a) : [];
700
+ return i && (o = this.filesByStore[i]), o ? ne(o, e, t, n, a) : [];
618
701
  },
619
702
  getFilesByStore(e) {
620
703
  return this.filesByStore[e] || [];
@@ -623,11 +706,8 @@ var b = y("models", {
623
706
  this.loadStoresFromStorage(), await this.fetchAllFiles();
624
707
  },
625
708
  async addStore(e) {
626
- if (e.type === "generic") {
627
- if (!e.baseUrl) throw Error("Base URL is required for generic stores");
628
- e.baseUrl = B(e.baseUrl), e.id = e.id || V(e.baseUrl), e.name = e.name || H(e.baseUrl);
629
- } else if (e.type === "github" && (!e.owner || !e.repo || !e.branch)) throw Error("Owner, repo, and branch are required for GitHub stores");
630
- if (this.stores.some((t) => t.id === e.id)) throw Error("This store is already added");
709
+ if (!e.baseUrl) throw Error("Base URL is required");
710
+ if (e.baseUrl = U(e.baseUrl), e.id = e.id || W(e.baseUrl), e.name = e.name || G(e.baseUrl), this.stores.some((t) => t.id === e.id)) throw Error("This store is already added");
631
711
  this.addingStore = !0;
632
712
  try {
633
713
  return this.stores.push(e), this.saveStoresToStorage(), await this.fetchAllFiles(), !0;
@@ -648,49 +728,10 @@ var b = y("models", {
648
728
  !n || n.type !== "generic" || (n.token = t || void 0, this.saveStoresToStorage());
649
729
  },
650
730
  openAddStoreModal() {
651
- this.showAddStoreModal = !0, this.newStore = {
652
- type: "generic",
653
- name: "",
654
- baseUrl: "",
655
- owner: "",
656
- repo: "",
657
- branch: "main"
658
- };
731
+ this.showAddStoreModal = !0;
659
732
  },
660
733
  closeAddStoreModal() {
661
- this.showAddStoreModal = !1, this.newStore = {
662
- type: "generic",
663
- name: "",
664
- baseUrl: "",
665
- owner: "",
666
- repo: "",
667
- branch: "main"
668
- };
669
- },
670
- async handleAddStore() {
671
- let { type: e, name: t, baseUrl: n, owner: r, repo: i, branch: a } = this.newStore;
672
- if (e === "generic") {
673
- if (!n) throw Error("Please fill in all required fields");
674
- let e = B(n), r = {
675
- type: "generic",
676
- id: V(e),
677
- name: t || H(e),
678
- baseUrl: e
679
- };
680
- await this.addStore(r);
681
- } else {
682
- if (!t || !r || !i || !a) throw Error("Please fill in all required fields");
683
- let e = {
684
- type: "github",
685
- id: `${r}-${i}-${a}`,
686
- name: t,
687
- owner: r,
688
- repo: i,
689
- branch: a
690
- };
691
- await this.addStore(e);
692
- }
693
- this.closeAddStoreModal();
734
+ this.showAddStoreModal = !1;
694
735
  },
695
736
  clearErrors() {
696
737
  this.errors = {};
@@ -703,18 +744,18 @@ var b = y("models", {
703
744
  }
704
745
  }
705
746
  }), J = /* @__PURE__ */ new Map();
706
- async function ke(e) {
747
+ async function Ue(e) {
707
748
  let t = b();
708
749
  if (t.models[e]) return !0;
709
750
  let n = J.get(e);
710
751
  if (n) return n;
711
- let r = Oe();
752
+ let r = He();
712
753
  r.stores.length <= 1 && r.loadStoresFromStorage();
713
- let i = r.stores.find((t) => t.type === "generic" && G(t) === e);
754
+ let i = r.stores.find((t) => t.type === "generic" && De(t) === e);
714
755
  if (!i) return !1;
715
756
  let a = (async () => {
716
757
  try {
717
- let n = await new Ee(r).loadStore(i.id), a = $();
758
+ let n = await new Ae(r).loadStore(i.id), a = $();
718
759
  for (let e of Object.values(n.editors)) a.editors[e.id] || a.addEditor(e);
719
760
  for (let e of Object.values(n.models)) t.models[e.name] || t.addModelConfig(e);
720
761
  return !!t.models[e];
@@ -729,16 +770,22 @@ async function ke(e) {
729
770
  //#endregion
730
771
  //#region stores/connectionStore.ts
731
772
  var Y = /* @__PURE__ */ new Map(), X = 6e4;
732
- async function Ae(e) {
773
+ async function We(e) {
733
774
  let t = $().getConnectionEditors(e.id, [a.STARTUP_SCRIPT]);
734
775
  await Promise.all(t.map(async (t) => {
735
- console.log(`running startup script ${t.name}`), await e.runScript(t.contents);
776
+ console.log(`running startup script ${t.name}`);
777
+ try {
778
+ await e.runScript(t.contents);
779
+ } catch (n) {
780
+ let r = t.remotePath || t.name, i = n instanceof Error ? n.message : String(n);
781
+ throw Error(`Startup script "${r}" failed on connection "${e.name}":\n${i}`, { cause: n });
782
+ }
736
783
  }));
737
784
  }
738
785
  function Z(e) {
739
- if (e.model && !b().models[e.model]) return ke(e.model);
786
+ if (e.model && !b().models[e.model]) return Ue(e.model);
740
787
  }
741
- var je = [
788
+ var Ge = [
742
789
  {
743
790
  label: "DuckDB",
744
791
  value: "duckdb"
@@ -789,7 +836,7 @@ var je = [
789
836
  setTimeout(() => t(/* @__PURE__ */ Error(`Connection timed out after ${X / 1e3} seconds`)), X);
790
837
  }), r = Promise.race([(async () => {
791
838
  let t = Z(this.connections[e]);
792
- t && await t, await this.connections[e].reset(), await Ae(this.connections[e]);
839
+ t && await t, await this.connections[e].reset(), await We(this.connections[e]);
793
840
  })(), n]).catch((t) => {
794
841
  throw this.connections[e]?.setError?.(t instanceof Error ? t.message : String(t)), t;
795
842
  }).finally(() => {
@@ -803,7 +850,7 @@ var je = [
803
850
  if (Y.has(t)) return Y.get(t);
804
851
  let n = new Promise((e, t) => {
805
852
  setTimeout(() => t(/* @__PURE__ */ Error(`Reset operation timed out after ${X / 1e3} seconds`)), X);
806
- }), r = Z(this.connections[e]), i = (r ? r.then(() => this.connections[e].reset()) : this.connections[e].reset()).then(() => Ae(this.connections[e])), a = Promise.race([i, n]).catch((t) => {
853
+ }), r = Z(this.connections[e]), i = (r ? r.then(() => this.connections[e].reset()) : this.connections[e].reset()).then(() => We(this.connections[e])), a = Promise.race([i, n]).catch((t) => {
807
854
  throw this.connections[e]?.setError?.(t instanceof Error ? t.message : String(t)), t;
808
855
  }).finally(() => {
809
856
  Y.delete(t);
@@ -969,4 +1016,4 @@ var je = [
969
1016
  }
970
1017
  });
971
1018
  //#endregion
972
- export { he as C, ie as D, pe as E, x as O, O as S, ve as T, ge as _, K as a, _e as b, H as c, j as d, Ce as f, xe as g, be as h, Oe as i, b as k, V as l, Se as m, je as n, Ee as o, F as p, Q as r, W as s, $ as t, B as u, fe as v, me as w, de as x, ue as y };
1019
+ export { O as A, ve as C, he as D, ge as E, x as M, b as N, ye as O, de as S, j as T, Ce as _, Fe as a, _e as b, q as c, Ee as d, W as f, R as g, we as h, He as i, re as j, me as k, Ae as l, P as m, Ge as n, Ie as o, U as p, Q as r, Re as s, $ as t, Te as u, xe as v, fe as w, pe as x, Se as y };