PageSourceSearch

https://superwise.chat/_next/static/chunks/4472.1c3b809e94dfc9a2.js

js superwise.chat collected 2026-10-04 01:56:43 UTC 8,835 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4472],{74472:(e,s,t)=>{t.r(s),t.d(s,{NexusRelayDialog:()=>v});var a=t(95155),l=t(12115),i=t(5917),n=t(85710),r=t(6191),d=t(90368),c=t(27937),x=t(4602),o=t(31166),m=t(3005),u=t(88376),h=t(43698),f=t(1559),y=t(61135),w=t(35181),b=t(94546);let j="__create__",p=["nexus","relay","fields","filename","confirm"],N={nexus:"Nexus",relay:"Relay",fields:"Fields",filename:"Filename",confirm:"Confirm"};function v(e){var s,t,v;let{open:C,onClose:k,collectionId:R,onAttached:S}=e,{showToast:A}=(0,f.d)(),[z,_]=(0,l.useState)(0),F=p[z],[E,q]=(0,l.useState)("wizard"),[$,D]=(0,l.useState)([]),[B,I]=(0,l.useState)(!1),[L,O]=(0,l.useState)(""),[T,V]=(0,l.useState)([]),[G,K]=(0,l.useState)(!1),[Q,W]=(0,l.useState)(""),[H,J]=(0,l.useState)({}),[M,P]=(0,l.useState)(""),[U,X]=(0,l.useState)(!1),Y=$.find(e=>e.id===L),Z=T.find(e=>e.id===Q),ee=Z?(0,w.IT)(Z.fields):[];(0,l.useEffect)(()=>{C&&(_(0),q("wizard"),O(""),V([]),W(""),J({}),P(""),X(!1))},[C]),(0,l.useEffect)(()=>{C&&(I(!0),b.listNexuses().then(e=>{let{connectors:s}=e;return D(s)}).catch(()=>A("Failed to load Nexuses.","error")).finally(()=>I(!1)))},[C,A]),(0,l.useEffect)(()=>{L&&(K(!0),V([]),W(""),b.listNexusRelays(L).then(e=>{let{pipelines:s}=e;return V(s)}).catch(()=>A("Failed to load Relays.","error")).finally(()=>K(!1)))},[L,A]),(0,l.useEffect)(()=>{Z&&(P(Z.relay_name||Z.name||""),J({}))},[Q]);let es=(0,l.useCallback)(e=>{q("wizard"),_(p.indexOf("relay")),K(!0),b.listNexusRelays(L).then(s=>{let{pipelines:t}=s;V(t),W(e.id)}).catch(()=>A("Relay created, but the list failed to refresh.","error")).finally(()=>K(!1))},[L,A]),et=ee.some(e=>{var s;return e.def.required&&!String(null!=(s=H[e.key])?s:"").trim()}),ea=(0,l.useCallback)(()=>{switch(F){case"nexus":return""!==L;case"relay":return""!==Q;case"fields":return!et;case"filename":return M.trim().length>0;default:return!1}},[F,L,Q,et,M]),el=(0,l.useCallback)(async()=>{if(Z){X(!0);try{await b.createNexusRelayAttachment(Z.id,{collection_id:R,name:M.trim(),field_values:(0,w.bS)(ee,H)}),A('"'.concat(M.trim(),'.txt" is being generated…'),"success"),S(),k()}catch(e){A(e instanceof Error?e.message:"Failed to attach Relay","error")}finally{X(!1)}}},[Z,R,M,H,ee,S,k,A]);return(0,a.jsx)(x.lG,{open:C,onOpenChange:e=>{e||k()},children:(0,a.jsxs)(x.Cf,{closeButton:!0,onCloseClick:k,className:"builder"===E?"h-[88vh] flex flex-col":"max-w-xl w-full",style:"builder"===E?{width:"80vw",maxWidth:"80vw"}:void 0,"aria-labelledby":"nexus-relay-dialog-title",children:[(0,a.jsxs)(x.c7,{children:[(0,a.jsx)("h2",{id:"nexus-relay-dialog-title",className:"text-sw-h3 font-semibold text-sw-text",children:"builder"===E?"Create New Relay":"Add Nexus Relay"}),(0,a.jsx)(x.rr,{className:"sr-only",children:"builder"===E?"Author a new Relay definition.":"Attach a Relay to this knowledge collection."})]}),"builder"===E?(0,a.jsx)(y.v,{nexusId:L,nexusName:null!=(s=null==Y?void 0:Y.name)?s:"",onCancel:()=>q("wizard"),onCreated:es}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex items-center gap-1 mt-4 mb-6",children:p.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-center gap-1 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center gap-0.5 flex-1",children:[(0,a.jsx)("div",{className:["w-7 h-7 rounded-sw-full flex items-center justify-center text-sw-caption font-semibold border transition-colors",s<z?"bg-sw-primary border-sw-primary text-white":s===z?"border-sw-primary text-sw-primary bg-sw-primary/10":"border-sw-border text-sw-text-disabled bg-sw-surface"].join(" "),children:s<z?(0,a.jsx)(i.A,{size:13}):s+1}),(0,a.jsx)("span",{className:["text-sw-caption hidden sm:block",s===z?"text-sw-text":"text-sw-text-disabled"].join(" "),children:N[e]})]}),s<p.length-1&&(0,a.jsx)("div",{className:["flex-1 h-px mb-3",s<z?"bg-sw-primary":"bg-sw-border"].join(" ")})]},e))}),(0,a.jsxs)("div",{className:"min-h-[200px]",children:["nexus"===F&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sw-body text-sw-text-muted",children:"Choose the Nexus whose data you want to add."}),B?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sw-text-muted",children:[(0,a.jsx)(m.y,{size:"sm"}),(0,a.jsx)("span",{className:"text-sw-body",children:"Loading Nexuses…"})]}):0===$.length?(0,a.jsx)(u.p,{icon:n.A,title:"No Nexuses available",description:"Ask an administrator to grant you access to a Nexus."}):(0,a.jsxs)(h.l6,{value:L,onValueChange:O,children:[(0,a.jsx)(h.bq,{"aria-label":"Select Nexus",children:(0,a.jsx)(h.yv,{placeholder:"Select a Nexus…"})}),(0,a.jsx)(h.gC,{children:$.map(e=>(0,a.jsxs)(h.eb,{value:e.id,children:[e.name," (",e.db_type,")"]},e.id))})]})]}),"relay"===F&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("p",{className:"text-sw-body text-sw-text-muted",children:["Choose a Relay for ",(0,a.jsx)("strong",{children:null==Y?void 0:Y.name}),"."]}),G?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sw-text-muted",children:[(0,a.jsx)(m.y,{size:"sm"}),(0,a.jsx)("span",{className:"text-sw-body",children:"Loading Relays…"})]}):0===T.length?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(u.p,{icon:n.A,title:"No Relays available",description:"No Relays have been created for this Nexus yet — create the first one."}),(0,a.jsxs)(o.$,{variant:"primary",className:"w-full",onClick:()=>q("builder"),children:[(0,a.jsx)(r.A,{size:15,className:"mr-1"}),"Create new Relay"]})]}):(0,a.jsxs)(h.l6,{value:Q,onValueChange:e=>e===j?q("builder"):W(e),children:[(0,a.jsx)(h.bq,{"aria-label":"Select Relay",children:(0,a.jsx)(h.yv,{placeholder:"Select a Relay…"})}),(0,a.jsxs)(h.gC,{children:[T.map(e=>(0,a.jsx)(h.eb,{value:e.id,children:e.name},e.id)),(0,a.jsx)(h.eb,{value:j,children:"+ Create new Relay"})]})]})]}),"fields"===F&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sw-body text-sw-text-muted",children:"Set the values for this Relay's fields."}),0===ee.length?(0,a.jsxs)("div",{className:"flex items-start gap-2 p-3 rounded-sw-md bg-sw-info/10 border border-sw-info/20",children:[(0,a.jsx)(i.A,{size:15,className:"text-sw-info-text shrink-0 mt-0.5"}),(0,a.jsxs)("span",{className:"text-sw-caption text-sw-info-text",children:["This Relay has no configurable fields — click ",(0,a.jsx)("strong",{children:"Next"}),"."]})]}):ee.map(e=>{var s;return(0,a.jsx)(w.Q1,{field:e.def,value:null!=(s=H[e.key])?s:"",onCh
1ange:s=>{let t;return t=e.key,J(e=>({...e,[t]:s}))}},e.key)})]}),"filename"===F&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("p",{className:"text-sw-body text-sw-text-muted",children:"Name the document that will be added to this collection."}),(0,a.jsx)("label",{className:"text-sw-caption font-medium text-sw-text-muted",htmlFor:"relay-filename",children:"Filename"}),(0,a.jsxs)("div",{className:"flex items-center sw-well px-3 h-10",children:[(0,a.jsx)("input",{id:"relay-filename",className:"flex-1 bg-transparent outline-none text-sw-body text-sw-text",value:M,onChange:e=>P(e.target.value),placeholder:"Document name","aria-label":"Document filename (without extension)",autoFocus:!0}),(0,a.jsx)("span",{className:"text-sw-body text-sw-text-muted select-none",children:".txt"})]}),0===M.trim().length&&(0,a.jsx)("p",{role:"alert",className:"text-sw-error text-sw-caption",children:"A filename is required."})]}),"confirm"===F&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sw-body text-sw-text-muted",children:"Review before adding this Relay to the collection."}),(0,a.jsxs)("div",{className:"sw-card p-4 space-y-2",children:[(0,a.jsx)(g,{label:"Nexus",value:null!=(t=null==Y?void 0:Y.name)?t:"—"}),(0,a.jsx)(g,{label:"Relay",value:null!=(v=null==Z?void 0:Z.name)?v:"—"}),ee.map(e=>{var s;return(0,a.jsx)(g,{label:e.def.name||e.fieldKey,value:String(null!=(s=H[e.key])?s:"—")},e.key)}),(0,a.jsx)(g,{label:"Filename",value:"".concat(M.trim(),".txt")})]}),(0,a.jsx)(o.$,{variant:"primary",className:"w-full",disabled:U,loading:U,onClick:()=>void el(),children:"Add to collection"})]})]}),z<p.length-1&&(0,a.jsxs)("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-sw-border-subtle",children:[(0,a.jsxs)(o.$,{variant:"ghost",size:"sm",onClick:()=>{z>0&&_(e=>e-1)},disabled:0===z,children:[(0,a.jsx)(d.A,{size:15,className:"mr-1"}),"Back"]}),(0,a.jsxs)(o.$,{variant:"primary",size:"sm",onClick:()=>{ea()&&z<p.length-1&&_(e=>e+1)},disabled:!ea(),children:["Next",(0,a.jsx)(c.A,{size:15,className:"ml-1"})]})]})]})]})})}function g(e){let{label:s,value:t}=e;return(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"sw-text-caption-muted w-28 shrink-0",children:s}),(0,a.jsx)("span",{className:"text-sw-caption text-sw-text flex-1 break-words",children:t})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.