@reddb-io/ui 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/_app/immutable/assets/0.DgbuWrJy.css +1 -0
- package/build/_app/immutable/assets/AnalyticsView.BLAJezw4.css +1 -0
- package/build/_app/immutable/assets/{Workspace.CvP5De7i.css → Workspace.DM2E1WiF.css} +1 -1
- package/build/_app/immutable/chunks/85-Fh5Zp.js +404 -0
- package/build/_app/immutable/chunks/{BHBXmd1Y.js → 8zg2gJwV.js} +1 -1
- package/build/_app/immutable/chunks/B5euRbKa.js +1 -0
- package/build/_app/immutable/chunks/BRIMmWzq.js +1 -0
- package/build/_app/immutable/chunks/BgOTHNR5.js +1 -0
- package/build/_app/immutable/chunks/Bq4DTWK2.js +2 -0
- package/build/_app/immutable/chunks/Btd6PFkC.js +1 -0
- package/build/_app/immutable/chunks/CGFL56WJ.js +1 -0
- package/build/_app/immutable/chunks/CJFJ501n.js +18 -0
- package/build/_app/immutable/chunks/CLBx21Hz.js +2 -0
- package/build/_app/immutable/chunks/CnD4hwxC.js +1106 -0
- package/build/_app/immutable/chunks/DCJ0QyYH.js +1 -0
- package/build/_app/immutable/chunks/DQCYUNtS.js +1 -0
- package/build/_app/immutable/chunks/DRlh90Cv.js +1 -0
- package/build/_app/immutable/chunks/{C278awGv.js → DV9PDoM3.js} +1 -1
- package/build/_app/immutable/entry/app.BDog2y0J.js +2 -0
- package/build/_app/immutable/entry/start.D1J45dq5.js +1 -0
- package/build/_app/immutable/nodes/0.BTrC4th2.js +1 -0
- package/build/_app/immutable/nodes/1.Ds1Tbjsm.js +1 -0
- package/build/_app/immutable/nodes/10.D_FCLs0Z.js +96 -0
- package/build/_app/immutable/nodes/12.DPE6v6Zf.js +3 -0
- package/build/_app/immutable/nodes/14.CAG5_cGP.js +1 -0
- package/build/_app/immutable/nodes/15.CcJlZGxa.js +60 -0
- package/build/_app/immutable/nodes/8.CAG5_cGP.js +1 -0
- package/build/_app/version.json +1 -1
- package/build/index.html +18 -15
- package/dist/embed/AnalyticsView-D8z1Nsed.js +23337 -0
- package/dist/embed/AnalyticsView-D8z1Nsed.js.map +1 -0
- package/dist/embed/RedUiEmbedRoot-CtqTd_FG.js +31302 -0
- package/dist/embed/RedUiEmbedRoot-CtqTd_FG.js.map +1 -0
- package/dist/embed/index-0hA141D2.js +85 -0
- package/dist/embed/index-0hA141D2.js.map +1 -0
- package/dist/embed/index-client-BeiP-va5.js +3303 -0
- package/dist/embed/index-client-BeiP-va5.js.map +1 -0
- package/dist/embed/index-w1Qo_uW0.js +677 -0
- package/dist/embed/index-w1Qo_uW0.js.map +1 -0
- package/dist/embed/index.js +1 -1
- package/dist/embed/{sigma.esm-C2pqg5JH.js → sigma.esm-qqKBpvin.js} +2 -2
- package/dist/embed/{sigma.esm-C2pqg5JH.js.map → sigma.esm-qqKBpvin.js.map} +1 -1
- package/package.json +5 -3
- package/src/app.css +86 -20
- package/src/lib/AnalyticsView.svelte +209 -0
- package/src/lib/AskView.svelte +255 -0
- package/src/lib/ClusterView.svelte +415 -95
- package/src/lib/CommandPalette.svelte +2 -0
- package/src/lib/GlobalProgressBar.svelte +9 -0
- package/src/lib/MetricChart.svelte +85 -0
- package/src/lib/QueryEditor.svelte +48 -7
- package/src/lib/ResultsPane.svelte +76 -8
- package/src/lib/SchemaTree.svelte +25 -1
- package/src/lib/SecurityView.svelte +176 -65
- package/src/lib/SettingsView.svelte +1137 -226
- package/src/lib/Topbar.svelte +29 -1
- package/src/lib/Workspace.svelte +18 -3
- package/src/lib/activity.svelte.ts +44 -35
- package/src/lib/collection-preview.ts +14 -0
- package/src/lib/connections.svelte.ts +73 -4
- package/src/lib/index.ts +3 -0
- package/src/lib/permission-gate.ts +120 -0
- package/src/lib/policies.ts +136 -0
- package/src/lib/query-tabs.svelte.ts +132 -53
- package/src/lib/reddb/analytics.ts +208 -0
- package/src/lib/reddb/ask.ts +123 -0
- package/src/lib/reddb/client.ts +159 -58
- package/src/lib/reddb/cluster-status.ts +306 -0
- package/src/lib/reddb/index.ts +3 -0
- package/src/lib/reddb/local-url-provider.ts +32 -1
- package/src/lib/reddb/redwire-ws-spike.ts +590 -0
- package/src/lib/router.svelte.ts +12 -0
- package/src/lib/settings-authoring-client.ts +336 -0
- package/src/lib/settings-sections.ts +294 -180
- package/build/_app/immutable/assets/0.DQDLkSdR.css +0 -1
- package/build/_app/immutable/chunks/65XjEwaF.js +0 -367
- package/build/_app/immutable/chunks/BGcIe2ep.js +0 -2
- package/build/_app/immutable/chunks/BMc_qoms.js +0 -973
- package/build/_app/immutable/chunks/BrvvOVaJ.js +0 -1
- package/build/_app/immutable/chunks/CwxFwvow.js +0 -1
- package/build/_app/immutable/chunks/D9CTkMjK.js +0 -1
- package/build/_app/immutable/chunks/oiO4RLqp.js +0 -1
- package/build/_app/immutable/entry/app.CGfmRH-N.js +0 -2
- package/build/_app/immutable/entry/start._LhFJimm.js +0 -1
- package/build/_app/immutable/nodes/0.BYhY6O5-.js +0 -1
- package/build/_app/immutable/nodes/1.4XYGRMul.js +0 -1
- package/build/_app/immutable/nodes/12.DXZfNPNK.js +0 -60
- package/build/_app/immutable/nodes/8.C7OOsMOJ.js +0 -134
- package/dist/embed/RedUiEmbedRoot-Dia9lxfb.js +0 -28570
- package/dist/embed/RedUiEmbedRoot-Dia9lxfb.js.map +0 -1
- package/dist/embed/index-Bq0TT7Ao.js +0 -577
- package/dist/embed/index-Bq0TT7Ao.js.map +0 -1
- package/dist/embed/index-client-ItCEU64C.js +0 -3087
- package/dist/embed/index-client-ItCEU64C.js.map +0 -1
- /package/build/_app/immutable/assets/{12.Dblyk0Kr.css → 15.Dblyk0Kr.css} +0 -0
- /package/build/_app/immutable/nodes/{10.CAG5_cGP.js → 13.CAG5_cGP.js} +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import"../chunks/Bzak7iHL.js";import{aj as z,aZ as Nt,aU as zt,aW as Lt,b9 as g,ae as It,$ as jt,a0 as l,am as o,b3 as s,bl as V,bi as m,aQ as Ve,bp as j,bv as ce}from"../chunks/oiO4RLqp.js";import{d as K,a as b,g as Mt,j as S,s as y,h as Y,i as Et,t as Ne}from"../chunks/BGcIe2ep.js";import{l as ne,s as oe,i as P,b as Gt}from"../chunks/D9CTkMjK.js";import{h as At,k as Rt}from"../chunks/BrvvOVaJ.js";import{I as re,U as ae,o as Ft,d as Pt,l as Ye,M as Ze,E as Tt,z as Ot,k as Ut,L as Dt,G as qt,r as Te,O as Bt,v as Oe}from"../chunks/65XjEwaF.js";import{p as Ht}from"../chunks/BHBXmd1Y.js";import"../chunks/69_IOA4Y.js";function Jt(e,t){const n=ne(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
2
|
-
* @license lucide-svelte v0.475.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* ISC License
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
7
|
-
*
|
|
8
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
10
|
-
* copyright notice and this permission notice appear in all copies.
|
|
11
|
-
*
|
|
12
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
13
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
14
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
15
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
16
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
17
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
18
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
*
|
|
20
|
-
*/const r=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];re(e,oe({name:"arrow-left"},()=>n,{get iconNode(){return r},children:(a,c)=>{var i=K(),u=z(i);ae(u,t,"default",{}),b(a,i)},$$slots:{default:!0}}))}function Vt(e,t){const n=ne(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
21
|
-
* @license lucide-svelte v0.475.0 - ISC
|
|
22
|
-
*
|
|
23
|
-
* ISC License
|
|
24
|
-
*
|
|
25
|
-
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
26
|
-
*
|
|
27
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
28
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
29
|
-
* copyright notice and this permission notice appear in all copies.
|
|
30
|
-
*
|
|
31
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
32
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
33
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
34
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
35
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
36
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
37
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
38
|
-
*
|
|
39
|
-
*/const r=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];re(e,oe({name:"box"},()=>n,{get iconNode(){return r},children:(a,c)=>{var i=K(),u=z(i);ae(u,t,"default",{}),b(a,i)},$$slots:{default:!0}}))}function ze(e,t){const n=ne(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
40
|
-
* @license lucide-svelte v0.475.0 - ISC
|
|
41
|
-
*
|
|
42
|
-
* ISC License
|
|
43
|
-
*
|
|
44
|
-
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
45
|
-
*
|
|
46
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
47
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
48
|
-
* copyright notice and this permission notice appear in all copies.
|
|
49
|
-
*
|
|
50
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
51
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
52
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
53
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
54
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
55
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
56
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
57
|
-
*
|
|
58
|
-
*/const r=[["path",{d:"m9 18 6-6-6-6"}]];re(e,oe({name:"chevron-right"},()=>n,{get iconNode(){return r},children:(a,c)=>{var i=K(),u=z(i);ae(u,t,"default",{}),b(a,i)},$$slots:{default:!0}}))}function Yt(e,t){const n=ne(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
59
|
-
* @license lucide-svelte v0.475.0 - ISC
|
|
60
|
-
*
|
|
61
|
-
* ISC License
|
|
62
|
-
*
|
|
63
|
-
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
64
|
-
*
|
|
65
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
66
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
67
|
-
* copyright notice and this permission notice appear in all copies.
|
|
68
|
-
*
|
|
69
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
70
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
71
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
72
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
73
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
74
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
75
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
76
|
-
*
|
|
77
|
-
*/const r=[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"12",r:"1"}]];re(e,oe({name:"circle-dot"},()=>n,{get iconNode(){return r},children:(a,c)=>{var i=K(),u=z(i);ae(u,t,"default",{}),b(a,i)},$$slots:{default:!0}}))}function Ke(e,t){const n=ne(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
78
|
-
* @license lucide-svelte v0.475.0 - ISC
|
|
79
|
-
*
|
|
80
|
-
* ISC License
|
|
81
|
-
*
|
|
82
|
-
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
83
|
-
*
|
|
84
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
85
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
86
|
-
* copyright notice and this permission notice appear in all copies.
|
|
87
|
-
*
|
|
88
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
89
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
90
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
91
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
92
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
93
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
94
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
95
|
-
*
|
|
96
|
-
*/const r=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"}]];re(e,oe({name:"file-json"},()=>n,{get iconNode(){return r},children:(a,c)=>{var i=K(),u=z(i);ae(u,t,"default",{}),b(a,i)},$$slots:{default:!0}}))}function Zt(e,t){const n=ne(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
97
|
-
* @license lucide-svelte v0.475.0 - ISC
|
|
98
|
-
*
|
|
99
|
-
* ISC License
|
|
100
|
-
*
|
|
101
|
-
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
102
|
-
*
|
|
103
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
104
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
105
|
-
* copyright notice and this permission notice appear in all copies.
|
|
106
|
-
*
|
|
107
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
108
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
109
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
110
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
111
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
112
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
113
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
114
|
-
*
|
|
115
|
-
*/const r=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12"}]];re(e,oe({name:"link-2"},()=>n,{get iconNode(){return r},children:(a,c)=>{var i=K(),u=z(i);ae(u,t,"default",{}),b(a,i)},$$slots:{default:!0}}))}function Kt(e,t){const n=ne(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
116
|
-
* @license lucide-svelte v0.475.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* ISC License
|
|
119
|
-
*
|
|
120
|
-
* Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
121
|
-
*
|
|
122
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
123
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
124
|
-
* copyright notice and this permission notice appear in all copies.
|
|
125
|
-
*
|
|
126
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
127
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
128
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
129
|
-
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
130
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
131
|
-
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
132
|
-
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
133
|
-
*
|
|
134
|
-
*/const r=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["polyline",{points:"17 8 12 3 7 8"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15"}]];re(e,oe({name:"upload"},()=>n,{get iconNode(){return r},children:(a,c)=>{var i=K(),u=z(i);ae(u,t,"default",{}),b(a,i)},$$slots:{default:!0}}))}const Le=1;class $ extends Error{constructor(t){super(t),this.name="GraphContractError"}}function te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Z(e,t){for(const n of t){const r=e[n];if(r!=null&&r!=="")return r}}function Qt(e){const t=Z(e,["version","schema_version","schemaVersion"]);if(typeof t!="string"||t.trim()==="")throw new $(`Graph export is missing a "version" string. This viewer supports the version ${Le}.x contract.`);const n=Number.parseInt(t.split(".")[0]??"",10);if(!Number.isFinite(n))throw new $(`Graph export declares an unparseable version "${t}". This viewer supports version ${Le}.x.`);if(n!==Le)throw new $(`Unsupported graph export version "${t}". This viewer supports version ${Le}.x.`);return t}function Wt(e,t){if(!te(e))throw new $(`Graph node at index ${t} is not an object.`);const n=Z(e,["id","rid","_id","uid"]);if(n===void 0)throw new $(`Graph node at index ${t} is missing the required "id" field.`);const r=String(n),a=Z(e,["label","name","title"]),c=Z(e,["type","node_type","kind"]),i=e.community;return{id:r,label:a!==void 0?String(a):r,type:c!==void 0?String(c):void 0,community:typeof i=="number"?i:void 0,data:e}}function Xt(e,t){if(!te(e))throw new $(`Graph edge at index ${t} is not an object.`);const n=Z(e,["source","from","src","start","from_rid"]);if(n===void 0)throw new $(`Graph edge at index ${t} is missing the required "source" field.`);const r=Z(e,["target","to","dst","end","to_rid"]);if(r===void 0)throw new $(`Graph edge at index ${t} is missing the required "target" field.`);const a=Z(e,["kind","type","label","rel"]),c=String(n),i=String(r),u=Z(e,["id","rid"]);return{id:u!==void 0?String(u):`${c}->${i}:${a??""}#${t}`,source:c,target:i,type:a!==void 0?String(a):void 0,data:e}}function en(e){if(e==null)return[];if(!Array.isArray(e))throw new $('Graph export "communities" must be an array when present.');return e.map((t,n)=>{if(!te(t))throw new $(`Community at index ${n} is not an object.`);if(typeof t.id!="number")throw new $(`Community at index ${n} is missing a numeric "id".`);const r=t.id;return{id:r,label:typeof t.label=="string"?t.label:`Community ${r}`,color:typeof t.color=="string"?t.color:Ft(r),size:typeof t.size=="number"?t.size:0}})}function tn(e,t){const n={};for(const a of e)n[a.id]={...a.data,id:a.id,label:a.label,...a.type!==void 0?{node_type:a.type}:{}};const r={};for(const a of t)r[a.id]={...a.data,source:a.source,target:a.target,...a.type!==void 0?{type:a.type}:{}};return{ok:!0,query:"",capability:"graph",record_count:e.length+t.length,result:{columns:["nodes","edges"],records:[{values:{},nodes:n,edges:r}]}}}function nn(e){if(!te(e))throw new $('Graph export must be a JSON object with "version" and graph data.');const t=te(e.contract)?e.contract:null,n=Qt(t??e),r=t??(te(e.graph)?e.graph:e),a=r.nodes,c=r.edges;if(!Array.isArray(a))throw new $('Graph export "nodes" must be an array.');if(!Array.isArray(c))throw new $('Graph export "edges" must be an array.');const i=a.map(Wt),u=c.map(Xt),v=en(e.communities??r.communities);return{version:n,model:{nodes:i,edges:u,communities:v},result:tn(i,u),meta:te(e.meta)?e.meta:{}}}function Xe(e){let t;try{t=JSON.parse(e)}catch(n){const r=n instanceof Error?n.message:String(n);throw new $(`Graph export is not valid JSON: ${r}`)}return nn(t)}async function on(e,t={}){const n=t.fetch??globalThis.fetch;if(typeof n!="function")throw new $("No fetch implementation available to load the graph.");let r;try{r=await n(e)}catch(c){const i=c instanceof Error?c.message:String(c);throw new $(`Failed to fetch graph from "${e}": ${i}`)}if(!r.ok)throw new $(`Failed to load graph from "${e}": HTTP ${r.status} ${r.statusText}`.trim());const a=await r.text();return Xe(a)}const rn=["layer","layer_name","layerName","layer_id","layerId","domain","namespace"],an=["community","community_name","communityName","community_id","communityId"],sn=["component","component_name","componentName","component_id","componentId","package","module","service","collection","file","path"],et={id:"unassigned",label:"Unassigned",color:"#94a3b8"},ln=/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%+-]+\)|hsla?\([\d\s.,%+-]+\)|oklch\([\d\s.%+-]+(?:\/\s*[\d.]+%?)?\))$/i;function cn(e){const t=e.trim();return ln.test(t)?t:et.color}function $e(e,t){for(const n of t){const r=e[n];if(!(r==null||r==="")&&(typeof r=="string"||typeof r=="number"))return String(r)}return null}function Ie(e,t){return`${e}:${t.toLowerCase().replace(/[^a-z0-9._:/-]+/g,"-")}`}function dn(e){return new Map(e.communities.map(t=>[t.id,{label:t.label,color:cn(t.color)}]))}function un(e,t){const n=$e(e.data,rn);if(n)return{id:Ie("layer",n),label:n,color:"#94a3b8"};if(typeof e.community=="number"){const a=t.get(e.community);return{id:`community:${e.community}`,label:(a==null?void 0:a.label)??`Community ${e.community}`,color:(a==null?void 0:a.color)??"#94a3b8"}}const r=$e(e.data,an);return r?{id:Ie("community",r),label:r,color:"#94a3b8"}:et}function pn(e){const t=$e(e.data,sn);if(t)return{id:Ie("component",t),label:t};const n=e.type??$e(e.data,["node_type","kind"]);return n?{id:Ie("type",n),label:`${n} nodes`}:{id:"component:unassigned",label:"Unassigned"}}function Qe(e,t){let n=0,r=0,a=0;for(const c of t){const i=e.has(c.source),u=e.has(c.target);!i&&!u||(n+=1,i&&u?r+=1:a+=1)}return{connectionCount:n,internalConnectionCount:r,externalConnectionCount:a}}function vn(e,t){let n=0,r=0;for(const a of t)a.source===e.id&&(r+=1),a.target===e.id&&(n+=1);return{id:e.id,label:e.label,type:e.type??$e(e.data,["node_type","kind"])??"node",degree:n+r,incoming:n,outgoing:r}}function We(e,t){const n=t.nodeCount-e.nodeCount;if(n!==0)return n;const r=t.connectionCount-e.connectionCount;if(r!==0)return r;const a=e.label.localeCompare(t.label);return a!==0?a:e.id.localeCompare(t.id)}function fn(e){const t=dn(e),n=new Map;for(const a of e.nodes){const c=un(a,t),i=n.get(c.id);i?i.nodes.push(a):n.set(c.id,{...c,nodes:[a]})}return{layers:[...n.values()].map(a=>{const c=a.nodes.map(w=>w.id),i=new Set(c),u=Qe(i,e.edges),v=new Map;for(const w of a.nodes){const _=pn(w),k=v.get(_.id);k?k.nodes.push(w):v.set(_.id,{..._,nodes:[w]})}const U=[...v.values()].map(w=>{const _=w.nodes.map(D=>D.id),k=Qe(new Set(_),e.edges);return{id:w.id,label:w.label,nodeCount:w.nodes.length,nodeIds:_,nodes:w.nodes.map(D=>vn(D,e.edges)).sort((D,de)=>de.degree-D.degree||D.label.localeCompare(de.label)),...k}}).sort(We);return{id:a.id,label:a.label,color:a.color,nodeCount:a.nodes.length,componentCount:U.length,nodeIds:c,components:U,...u}}).sort(We)}}function mn(e,t){const n=t===null?null:new Set(t),r=n?e.nodes.filter(v=>n.has(v.id)):e.nodes,a=new Set(r.map(v=>v.id)),c=e.edges.filter(v=>a.has(v.source)&&a.has(v.target)),i={};for(const v of r)i[v.id]={...v.data,id:v.id,label:v.label,...v.type!==void 0?{node_type:v.type}:{}};const u={};for(const v of c)u[v.id]={...v.data,source:v.source,target:v.target,...v.type!==void 0?{type:v.type}:{}};return{ok:!0,query:"",capability:"graph",record_count:r.length+c.length,result:{columns:["nodes","edges"],records:[{values:{},nodes:i,edges:u}]}}}var gn=S('<button type="button" aria-label="Back" class="inline-flex size-6 items-center justify-center rounded border border-line-1 text-fg-3 hover:border-line-2 hover:text-fg-1"><!></button>'),bn=S('<span class="inline-flex size-6 items-center justify-center rounded border border-line-1 text-fg-3"><!></span>'),xn=S('<!> <button type="button"> </button>',1),hn=S('<!> <span class="truncate rounded bg-bg-2 px-1.5 py-0.5 text-fg-0"> </span>',1),_n=S('<button type="button" class="w-full px-3 py-2.5 text-left hover:bg-bg-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"><div class="flex items-start gap-2.5"><span class="mt-1.5 size-2 rounded-full shrink-0"></span> <span class="min-w-0 flex-1"><span class="flex items-center gap-2"><span class="truncate text-[13px] font-medium text-fg-0"> </span> <span class="font-mono text-[10px] text-fg-3"> </span></span> <span class="mt-1 block font-mono text-[11px] text-fg-3"> </span></span> <!></div></button>'),yn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),$n=S('<button type="button" class="w-full px-3 py-2.5 text-left hover:bg-bg-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"><div class="flex items-start gap-2.5"><span class="mt-1 text-fg-3"><!></span> <span class="min-w-0 flex-1"><span class="block truncate text-[13px] font-medium text-fg-0"> </span> <span class="mt-1 block font-mono text-[11px] text-fg-3"> </span></span> <!></div></button>'),wn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),kn=S('<div class="px-3 py-2.5"><div class="flex items-start gap-2.5"><span class="mt-1 text-fg-3"><!></span> <span class="min-w-0 flex-1"><span class="block truncate text-[13px] font-medium text-fg-0"> </span> <span class="mt-1 block truncate font-mono text-[11px] text-fg-3"> </span></span></div></div>'),Cn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),Sn=S('<div class="flex-1 min-h-0 overflow-auto"><!></div>'),Nn=S('<div class="flex items-center justify-between gap-4 px-3 py-2 border-b border-line-1 bg-bg-1 shrink-0"><span class="flex items-center gap-2 min-w-0 text-fg-2 text-[13px]"><!> <span class="font-mono text-fg-1 truncate max-w-[38vw]"> </span> <span class="text-fg-3 whitespace-nowrap"> <!></span></span> <button type="button" class="flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-line-1 text-fg-2 text-[12px] hover:border-fg-3 hover:text-fg-1"><!> Load another</button></div> <div class="flex-1 min-h-0 flex"><aside class="w-[min(320px,48vw)] shrink-0 border-r border-line-1 bg-bg-1/80 flex flex-col min-h-0"><div class="px-3 py-2 border-b border-line-1"><div class="flex items-center gap-2 text-fg-1"><!> <div class="min-w-0"><div class="type-label"><!></div> <div class="truncate text-[12px] font-medium text-fg-0"> </div></div></div> <nav class="mt-2 flex min-w-0 items-center gap-1 text-[11px] font-mono text-fg-3"><button type="button">overview</button> <!> <!></nav></div> <!></aside> <div class="flex-1 min-w-0"><!></div></div>',1),zn=S('<p class="m-0 px-3 py-2 rounded-md text-accent text-[12px] leading-relaxed border border-accent/35 bg-accent/10"> </p>'),Ln=S('<div class="flex flex-col gap-3 w-[min(34rem,90vw)] text-left"><form class="flex gap-2"><div class="relative flex-1 flex items-center"><!> <input class="w-full pl-8 pr-2.5 py-2 bg-bg-2 border border-line-1 rounded-md text-fg-1 text-[13px] font-mono focus:outline-none focus:border-accent" type="text" placeholder="https://host/graph.json or /exports/memory.json" spellcheck="false" autocapitalize="off" autocorrect="off"/></div> <button class="px-4 py-2 bg-accent text-white rounded-md text-[13px] font-medium whitespace-nowrap disabled:opacity-50" type="submit"> </button></form> <div class="flex items-center gap-2 text-fg-3 text-[11px] uppercase tracking-wide"><span class="flex-1 h-px bg-line-1"></span> or <span class="flex-1 h-px bg-line-1"></span></div> <button type="button" class="flex items-center justify-center gap-2 px-3 py-2 bg-bg-2 border border-line-1 rounded-md text-fg-1 text-[13px] hover:border-fg-3 disabled:opacity-50"><!> Choose a local graph.json</button> <input type="file" accept="application/json,.json" class="hidden"/> <!></div>'),In=S('<div class="flex items-center justify-center h-full w-full p-8"><!></div>'),jn=S('<div class="flex h-screen w-full flex-col"><!></div>');function On(e,t){Nt(t,!0);let n=V(null),r=V(!1),a=V(null),c=V(null),i=V(null),u=V(null),v=V(""),U=V(null);const w=ce(()=>o(n)?fn(o(n).model):null),_=ce(()=>{var p;return o(i)?(p=o(w))==null?void 0:p.layers.find(x=>x.id===o(i)):void 0}),k=ce(()=>{var p;return o(u)?(p=o(_))==null?void 0:p.components.find(x=>x.id===o(u)):void 0}),D=ce(()=>o(k)?o(k).nodeIds:o(_)?o(_).nodeIds:null),de=ce(()=>o(n)?mn(o(n).model,o(D)):null),tt=ce(()=>`${o(c)??"graph"}:${o(i)??"overview"}:${o(u)??"all"}`);async function Ue(p){const x=p.trim();if(x){g(r,!0),g(a,null);try{g(n,await on(x,{fetch}),!0),g(c,x,!0),we()}catch(I){g(n,null),g(a,I instanceof Error?I.message:String(I),!0)}finally{g(r,!1)}}}async function nt(p){g(r,!0),g(a,null);try{g(n,Xe(await p.text()),!0),g(c,p.name,!0),we()}catch(x){g(n,null),g(a,x instanceof Error?x.message:String(x),!0)}finally{g(r,!1)}}function ot(p){p.preventDefault(),Ue(o(v))}function rt(p){var I;const x=(I=p.target.files)==null?void 0:I[0];x&&nt(x)}function at(){g(n,null),g(a,null),g(c,null),g(v,""),we(),o(U)&&(o(U).value="")}function we(){g(i,null),g(u,null)}function st(p){g(i,p.id,!0),g(u,null)}function it(p){g(u,p.id,!0)}function lt(){if(o(u)){g(u,null);return}g(i,null)}function T(p,x){return`${p.toLocaleString()} ${x}${p===1?"":"s"}`}function je(p){const x=T(p.connectionCount,"connection");return p.externalConnectionCount===0?x:`${x} · ${p.externalConnectionCount.toLocaleString()} external`}zt(()=>{const p=Ht.url.searchParams.get("src");p&&(g(v,p,!0),Ue(p))});var Me=jn();At("315y67",p=>{It(()=>{jt.title="Load graph · red-ui"})});var ct=l(Me);{var dt=p=>{var x=Nn(),I=z(x),ke=l(I),Ce=l(ke);Ke(Ce,{size:14});var Q=m(Ce,2),se=l(Q,!0);s(Q);var ie=m(Q,2),ue=l(ie),pe=m(ue);{var ve=d=>{var f=Ne();j(()=>y(f,`· ${o(n).model.communities.length??""} communities`)),b(d,f)};P(pe,d=>{o(n).model.communities.length&&d(ve)})}s(ie),s(ke);var fe=m(ke,2),W=l(fe);Pt(W,{size:13}),Ve(),s(fe),s(I);var Se=m(I,2),X=l(Se),me=l(X),ge=l(me),N=l(ge);{var be=d=>{var f=gn(),C=l(f);Jt(C,{size:13}),s(f),Y("click",f,lt),b(d,f)},Ee=d=>{var f=bn(),C=l(f);Dt(C,{size:13}),s(f),b(d,f)};P(N,d=>{o(_)?d(be):d(Ee,-1)})}var De=m(N,2),Ge=l(De),pt=l(Ge);{var vt=d=>{var f=Ne("nodes");b(d,f)},ft=d=>{var f=Ne("components");b(d,f)},mt=d=>{var f=Ne("overview");b(d,f)};P(pt,d=>{o(k)?d(vt):o(_)?d(ft,1):d(mt,-1)})}s(Ge);var qe=m(Ge,2),gt=l(qe,!0);s(qe),s(De),s(ge);var Be=m(ge,2),Ae=l(Be),He=m(Ae,2);{var bt=d=>{var f=xn(),C=z(f);ze(C,{size:12,class:"shrink-0"});var M=m(C,2),xe=l(M,!0);s(M),j(Re=>{Ze(M,1,Re),y(xe,o(_).label)},[()=>Ye(["truncate rounded px-1.5 py-0.5 hover:bg-bg-2 hover:text-fg-1",o(_)&&!o(k)?"text-fg-0 bg-bg-2":""].join(" "))]),Y("click",M,()=>g(u,null)),b(d,f)};P(He,d=>{o(_)&&d(bt)})}var xt=m(He,2);{var ht=d=>{var f=hn(),C=z(f);ze(C,{size:12,class:"shrink-0"});var M=m(C,2),xe=l(M,!0);s(M),j(()=>y(xe,o(k).label)),b(d,f)};P(xt,d=>{o(k)&&d(ht)})}s(Be),s(me);var _t=m(me,2);{var yt=d=>{var f=Sn(),C=l(f);{var M=O=>{var q=yn(),E=z(q),he=l(E);s(E);var B=m(E,2);Te(B,21,()=>o(w).layers,Oe,(G,h)=>{var L=_n(),H=l(L),R=l(H),ee=m(R,2),F=l(ee),A=l(F),_e=l(A,!0);s(A);var J=m(A,2),ye=l(J,!0);s(J),s(F);var le=m(F,2),Fe=l(le);s(le),s(ee);var Pe=m(ee,2);ze(Pe,{size:14,class:"mt-1 shrink-0 text-fg-3"}),s(H),s(L),j((kt,Ct,St)=>{Bt(R,`background:${o(h).color};box-shadow:0 0 8px ${o(h).color}`),y(_e,o(h).label),y(ye,kt),y(Fe,`${Ct??""} · ${St??""}`)},[()=>T(o(h).componentCount,"component"),()=>T(o(h).nodeCount,"node"),()=>je(o(h))]),Y("click",L,()=>st(o(h))),b(G,L)}),s(B),j((G,h)=>y(he,`${G??""} · ${h??""}`),[()=>T(o(w).layers.length,"group"),()=>T(o(n).model.nodes.length,"node")]),b(O,q)},xe=O=>{var q=wn(),E=z(q),he=l(E);s(E);var B=m(E,2);Te(B,21,()=>o(_).components,Oe,(G,h)=>{var L=$n(),H=l(L),R=l(H),ee=l(R);Vt(ee,{size:14}),s(R);var F=m(R,2),A=l(F),_e=l(A,!0);s(A);var J=m(A,2),ye=l(J);s(J),s(F);var le=m(F,2);ze(le,{size:14,class:"mt-1 shrink-0 text-fg-3"}),s(H),s(L),j((Fe,Pe)=>{y(_e,o(h).label),y(ye,`${Fe??""} · ${Pe??""}`)},[()=>T(o(h).nodeCount,"node"),()=>je(o(h))]),Y("click",L,()=>it(o(h))),b(G,L)}),s(B),j((G,h)=>y(he,`${G??""} · ${h??""}`),[()=>T(o(_).components.length,"component"),()=>T(o(_).nodeCount,"node")]),b(O,q)},Re=O=>{var q=Cn(),E=z(q),he=l(E);s(E);var B=m(E,2);Te(B,21,()=>o(k).nodes,Oe,(G,h)=>{var L=kn(),H=l(L),R=l(H),ee=l(R);Yt(ee,{size:13}),s(R);var F=m(R,2),A=l(F),_e=l(A,!0);s(A);var J=m(A,2),ye=l(J);s(J),s(F),s(H),s(L),j(le=>{y(_e,o(h).label),y(ye,`${o(h).type??""} · degree ${le??""} · ${o(h).id??""}`)},[()=>o(h).degree.toLocaleString()]),b(G,L)}),s(B),j((G,h)=>y(he,`${G??""} · ${h??""}`),[()=>T(o(k).nodes.length,"node"),()=>je(o(k))]),b(O,q)};P(C,O=>{o(_)?o(k)?O(Re,-1):O(xe,1):O(M)})}s(f),b(d,f)};P(_t,d=>{o(w)&&d(yt)})}s(X);var Je=m(X,2),$t=l(Je);{var wt=d=>{var f=K(),C=z(f);Rt(C,()=>o(tt),M=>{qt(M,{get result(){return o(de)}})}),b(d,f)};P($t,d=>{o(de)&&d(wt)})}s(Je),s(Se),j(d=>{var f,C;y(se,o(c)),y(ue,`${o(n).model.nodes.length??""} nodes · ${o(n).model.edges.length??""} edges`),y(gt,((f=o(k))==null?void 0:f.label)??((C=o(_))==null?void 0:C.label)??"Layers and communities"),Ze(Ae,1,d)},[()=>Ye(["truncate rounded px-1.5 py-0.5 hover:bg-bg-2 hover:text-fg-1",o(_)?"":"text-fg-0 bg-bg-2"].join(" "))]),Y("click",fe,at),Y("click",Ae,we),b(p,x)},ut=p=>{var x=In(),I=l(x);Tt(I,{title:"Load a graph",message:"Render any contract-conformant graph.json — memory exports, codebase graphs, or graphify output — from a URL, a path, or a local file. No connection required.",get icon(){return Ke},actions:Ce=>{var Q=Ln(),se=l(Q),ie=l(se),ue=l(ie);Zt(ue,{size:15,class:"absolute left-2.5 text-fg-3 pointer-events-none"});var pe=m(ue,2);Ot(pe),s(ie);var ve=m(ie,2),fe=l(ve,!0);s(ve),s(se);var W=m(se,4),Se=l(W);Kt(Se,{size:15}),Ve(),s(W);var X=m(W,2);Gt(X,N=>g(U,N),()=>o(U));var me=m(X,2);{var ge=N=>{var be=zn(),Ee=l(be,!0);s(be),j(()=>y(Ee,o(a))),b(N,be)};P(me,N=>{o(a)&&N(ge)})}s(Q),j(N=>{pe.disabled=o(r),ve.disabled=N,y(fe,o(r)?"Loading…":"Load"),W.disabled=o(r)},[()=>o(r)||!o(v).trim()]),Et("submit",se,ot),Ut(pe,()=>o(v),N=>g(v,N)),Y("click",W,()=>{var N;return(N=o(U))==null?void 0:N.click()}),Y("change",X,rt),b(Ce,Q)}}),s(x),b(p,x)};P(ct,p=>{o(n)?p(dt):p(ut,-1)})}s(Me),b(e,Me),Lt()}Mt(["click","change"]);export{On as component};
|