PageSourceSearch

https://heytiff.ai/assets/KnowledgePanel-DmRxYBvS.js

js heytiff.ai collected 2026-10-05 14:34:17 UTC 16,586 bytes, 5 lines download raw bytes

1import{r as i,j as e}from"./three-vendor-D2JqQ3u1.js";import{n as A,u as c,A as X,B as J,R as Z,h as ee,P as N,L as Y,E as te,j as re,C as se,k as oe,l as ne,X as ie,m as ae,T as le}from"./index-BPCB7YaN.js";const de=["all","admin","inner_circle","beta"],ce=["general","personal","research","creative","production","frequencies"],U=({children:s,style:a})=>e.jsx("div",{style:{background:"rgba(20,20,36,0.8)",backdropFilter:"blur(20px) saturate(140%)",WebkitBackdropFilter:"blur(20px) saturate(140%)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:20,padding:28,...a},children:s}),K={all:{bg:"rgba(0,209,196,0.1)",text:"#00D1C4",border:"rgba(0,209,196,0.25)"},admin:{bg:"rgba(233,30,140,0.1)",text:"#E91E8C",border:"rgba(233,30,140,0.25)"},inner_circle:{bg:"rgba(139,92,246,0.1)",text:"#8B5CF6",border:"rgba(139,92,246,0.25)"},beta:{bg:"rgba(245,166,35,0.1)",text:"#F5A623",border:"rgba(245,166,35,0.25)"}},pe=({tier:s})=>{const a=K[s]??K.all;return e.jsx("span",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",background:a.bg,color:a.text,border:`1px solid ${a.border}`,borderRadius:6,padding:"2px 7px",textTransform:"uppercase"},children:s})},ge=({category:s})=>e.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",background:"rgba(255,255,255,0.06)",color:"#9A9AAA",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,padding:"2px 7px",textTransform:"uppercase",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block"},children:s.replace(/^knowledge_/,"").replace(/_/g," ")}),y={width:"100%",background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:"10px 14px",color:"#F0F0F0",fontSize:14,outline:"none",boxSizing:"border-box"},k={fontSize:11,fontWeight:700,letterSpacing:"0.12em",textTransform:"uppercase",color:"rgba(154,154,170,0.65)",marginBottom:6,display:"block"},H=({initial:s,categories:a,onSave:z,onCancel:W,saving:h})=>{const[g,E]=i.useState((s==null?void 0:s.name)??""),[d,B]=i.useState((s==null?void 0:s.component_type)??"general"),[x,D]=i.useState(""),[w,C]=i.useState((s==null?void 0:s.content)??""),[F,b]=i.useState((s==null?void 0:s.tier)??"all"),[I,S]=i.useState((s==null?void 0:s.sort_order)??100),[u,j]=i.useState((s==null?void 0:s.is_active)!==!1),L=[...new Set([...ce,...a])],v=d==="__custom__"?x.trim()||"general":d,f=()=>{if(!g.trim()){c.error("Title is required");return}if(!w.trim()){c.error("Content is required");return}z({name:g.trim(),component_type:v,content:w.trim(),tier:F,sort_order:I,is_active:u})};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:k,children:"Title"}),e.jsx("input",{style:y,value:g,onChange:o=>E(o.target.value),placeholder:"What is this knowledge about?"})]}),e.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:2,minWidth:140},children:[e.jsx("label",{style:k,children:"Category"}),e.jsxs("select",{style:{...y,cursor:"pointer"},value:d,onChange:o=>B(o.target.value),children:[L.map(o=>e.jsx("option",{value:o,children:o.replace(/^knowledge_/,"").replace(/_/g," ")},o)),e.jsx("option",{value:"__custom__",children:"Custom…"})]})]}),d==="__custom__"&&e.jsxs("div",{style:{flex:2,minWidth:140},children:[e.jsx("label",{style:k,children:"Custom Category"}),e.jsx("input",{style:y,value:x,onChange:o=>D(o.target.value),placeholder:"my_category"})]}),e.jsxs("div",{style:{flex:1,minWidth:110},children:[e.jsx("label",{style:k,children:"Tier"}),e.jsx("select",{style:{...y,cursor:"pointer"},value:F,onChange:o=>b(o.target.value),children:de.map(o=>e.jsx("option",{value:o,children:o},o))})]}),e.jsxs("div",{style:{flex:0,minWidth:72},children:[e.jsx("label",{style:k,children:"Sort"}),e.jsx("input",{style:{...y,width:72},type:"number",value:I,onChange:o=>S(Number(o.target.value))})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:k,children:"Content"}),e.jsx("textarea",{style:{...y,minHeight:180,resize:"vertical",lineHeight:1.6,fontFamily:"var(--font-body)"},value:w,onChange:o=>C(o.target.value),placeholder:"Write the knowledge Tiff should know…"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{onClick:()=>j(o=>!o),style:{width:36,height:20,borderRadius:10,background:u?"rgba(233,30,140,0.8)":"rgba(255,255,255,0.1)",border:"none",cursor:"pointer",position:"relative",transition:"background 0.2s",flexShrink:0},children:e.jsx("div",{style:{width:14,height:14,borderRadius:"50%",background:"#fff",position:"absolute",top:3,left:u?18:3,transition:"left 0.2s"}})}),e.jsx("span",{style:{fontSize:13,color:u?"#F0F0F0":"#666"},children:u?"Active — Tiff will use this":"Inactive — hidden from Tiff"})]}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"flex-end",marginTop:4},children:[e.jsx("button",{onClick:W,style:{background:"none",border:"1px solid rgba(255,255,255,0.12)",borderRadius:9,padding:"9px 18px",color:"#9A9AAA",fontSize:13,fontWeight:600,cursor:"pointer"},children:"Cancel"}),e.jsxs("button",{onClick:f,disabled:h,style:{background:h?"rgba(233,30,140,0.4)":"rgba(233,30,140,0.9)",border:"none",borderRadius:9,padding:"9px 22px",color:"#fff",fontSize:13,fontWeight:700,cursor:h?"wait":"pointer",display:"flex",alignItems:"center",gap:7},children:[h&&e.jsx(Y,{size:14,className:"kb-spin"}),h?"Saving…":"Save"]})]})]})},fe=({onClose:s})=>{const[a,z]=i.useState([]),[W,h]=i.useState(!0),[g,E]=i.useState(!1),[d,B]=i.useState(""),[x,D]=i.useState("__all__"),[w,C]=i.useState(null),[F,b]=i.useState(null),[I,S]=i.useState(!1),[u,j]=i.useState(!1),[L,v]=i.useState(null),f=i.useCallback(async()=>{try{const{data:r,error:t}=await A.from("tiff_knowledge").select("id, component_type, name, content, tier, sort_order, is_active").order("sort_order",{ascending:!0});if(t)throw t;z(r??[])}catch(r){c.error("Failed to load knowledge: "+((r==null?void 0:r.message)??"unknown error"))}finally{h(!1),E(!1)}},[]);i.useEffect(()=>{f()},[f]);const o=()=>{E(!0),f()},T=[...new Set(a.map(r=>r.component_type))].sort(),O=a.filter(r=>{const t=d.toLowerCase(),n=!t||r.name.toLowerCase().includes(t)||r.content.toLowerCase().includes(t),l=x==="__all__"||r.component_type===x;return n&&l}),R=r=>{const t=r.replace(/^knowledge_?/,"");return t.startsWith("personal")?"Personal — B's life":t.startsWith("b_")||t==="b"?"B — catalog & craft":t.startsWith("chris")?"Chris Lopez":t==="circle"?"The Circle — his people":t.startsWith("music")||t==="frequencies"||t.startsWith("flow")||t.startsWith("lyrics")||t.startsWith("cowriting")||t.startsWith("voice")?"Music & writing craft":t.includes("director")||t.startsWith("visual")||t.startsWith("first_last")||t.startsWith("seedance")||t.startsWith("audio_visual")?"Visual & director refs":t.startsWith("creative")?"Creative technique":!t||t==="knowledge"||t==="general"?"General":t.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())},q=["Personal — B's life","B — catalog & craft","Chris Lopez","The Circle — his people","Music & writing craft","Creative technique","Visual & director refs"],P=[...O].sort((r,t)=>{const n=R(r.component_type),l=R(t.component_type);if(n!==l){const p=q.indexOf(n),m=q.indexOf(l);return p!==-1||m!==-1?(p===-1?99:p)-(m===-1?99:m):n.localeCompare(l)}return r.name.localeCompare(t.name)}),G=async r=>{j(!0);try{const{error:t}=await A.from("tiff_knowledge").insert([r]);if(t)throw t;c.success("Knowledge saved"),S(!1),await f()}catch(t){c.error("Save failed: "+((t==null?void 0:t.message)??"unknown error"))}finally{j(!1)}},$=async(r,t)=>{j(!0);try{const{error:n}=await A.from("tiff_knowledge").update(t).eq("id",r);
1if(n)throw n;c.success("Updated"),b(null),await f()}catch(n){c.error("Update failed: "+((n==null?void 0:n.message)??"unknown error"))}finally{j(!1)}},M=async r=>{try{const{error:t}=await A.from("tiff_knowledge").delete().eq("id",r);if(t)throw t;c.success("Deleted"),v(null),C(null),await f()}catch(t){c.error("Delete failed: "+((t==null?void 0:t.message)??"unknown error"))}},Q=async r=>{try{const{error:t}=await A.from("tiff_knowledge").update({is_active:!r.is_active}).eq("id",r.id);if(t)throw t;z(n=>n.map(l=>l.id===r.id?{...l,is_active:!l.is_active}:l))}catch(t){c.error("Toggle failed: "+((t==null?void 0:t.message)??"unknown error"))}};return e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:100,overflowY:"auto",background:"#0A0A14",color:"#F0F0F0"},children:[e.jsxs("nav",{style:{position:"sticky",top:0,zIndex:50,background:"rgba(10,10,20,0.94)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",borderBottom:"1px solid rgba(233,30,140,0.18)",padding:"14px 28px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("button",{onClick:s,className:"kb-back-btn",style:{display:"flex",alignItems:"center",gap:8,background:"none",border:"none",cursor:"pointer",color:"#9A9AAA",fontSize:13,fontWeight:600},children:[e.jsx(X,{size:16}),"Back to App"]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:1},children:[e.jsx("div",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.28em",color:"#E91E8C",textTransform:"uppercase"},children:"HEY TIFF"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:17,fontWeight:800,letterSpacing:"0.04em",color:"#F0F0F0"},children:[e.jsx(J,{size:18,color:"#E91E8C"}),"Knowledge Base"]})]}),e.jsxs("button",{onClick:o,disabled:g,style:{display:"flex",alignItems:"center",gap:7,background:"rgba(233,30,140,0.1)",border:"1px solid rgba(233,30,140,0.28)",borderRadius:9,padding:"8px 16px",color:"#E91E8C",fontSize:12,fontWeight:700,cursor:g?"wait":"pointer",letterSpacing:"0.06em"},children:[e.jsx(Z,{size:14,style:{animation:g?"kb-spin 0.9s linear infinite":"none"}}),g?"Loading…":"Refresh"]})]}),e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",padding:"32px 24px 100px"},children:[e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:24,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{style:{position:"relative",flex:1,minWidth:200},children:[e.jsx(ee,{size:15,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:"#666",pointerEvents:"none"}}),e.jsx("input",{style:{...y,paddingLeft:36},placeholder:"Search knowledge…",value:d,onChange:r=>B(r.target.value)})]}),e.jsxs("button",{onClick:()=>{S(!0),C(null),b(null)},style:{display:"flex",alignItems:"center",gap:7,background:"rgba(233,30,140,0.12)",border:"1px solid rgba(233,30,140,0.35)",borderRadius:10,padding:"10px 18px",color:"#E91E8C",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",transition:"background 0.15s"},children:[e.jsx(N,{size:16}),"Add Knowledge"]})]}),T.length>0&&e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:20},children:["__all__",...T].map(r=>e.jsx("button",{onClick:()=>D(r),style:{padding:"5px 14px",borderRadius:20,fontSize:11,fontWeight:600,letterSpacing:"0.06em",cursor:"pointer",transition:"all 0.15s",textTransform:"uppercase",background:x===r?"rgba(233,30,140,0.18)":"rgba(255,255,255,0.04)",border:`1px solid ${x===r?"rgba(233,30,140,0.5)":"rgba(255,255,255,0.1)"}`,color:x===r?"#E91E8C":"#9A9AAA"},children:r==="__all__"?"All":r.replace(/^knowledge_/,"").replace(/_/g," ")},r))}),e.jsx("div",{style:{marginBottom:20,fontSize:12,color:"#555"},children:W?"Loading…":e.jsxs(e.Fragment,{children:[O.length," of ",a.length," entries",d?` matching "${d}"`:""," · ",a.filter(r=>r.is_active).length," active"]})}),I&&e.jsxs(U,{style:{marginBottom:20,border:"1px solid rgba(233,30,140,0.25)"},children:[e.jsxs("div",{style:{fontSize:12,fontWeight:700,letterSpacing:"0.12em",textTransform:"uppercase",color:"#E91E8C",marginBottom:20,display:"flex",alignItems:"center",gap:8},children:[e.jsx(N,{size:13}),"Add Knowledge Entry"]}),e.jsx(H,{categories:T,onSave:G,onCancel:()=>S(!1),saving:u})]}),W?e.jsxs("div",{style:{textAlign:"center",padding:60,color:"#555"},children:[e.jsx(Y,{size:24,style:{animation:"kb-spin 0.8s linear infinite",margin:"0 auto 12px",display:"block"}}),"Loading knowledge…"]}):O.length===0?e.jsx("div",{style:{textAlign:"center",padding:60,color:"#555",fontSize:14}
1,children:d?"No entries match your search.":"No knowledge entries yet. Add one above."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:(()=>{let r="";return P.map(t=>{const n=R(t.component_type),l=n!==r;r=n;const p=w===t.id,m=F===t.id,V=L===t.id;return e.jsxs("div",{children:[l&&e.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:10,fontWeight:700,letterSpacing:"0.22em",textTransform:"uppercase",color:"rgba(233,30,140,0.75)",padding:"14px 4px 8px",borderBottom:"1px solid rgba(233,30,140,0.15)",marginBottom:10},children:[n," · ",P.filter(_=>R(_.component_type)===n).length]}),e.jsxs(U,{style:{padding:0,overflow:"hidden",opacity:t.is_active?1:.55,border:p?"1px solid rgba(233,30,140,0.3)":"1px solid rgba(255,255,255,0.06)",transition:"border-color 0.2s, opacity 0.2s"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",cursor:m?"default":"pointer"},onClick:()=>{m||(C(p?null:t.id),b(null),v(null))},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:"#F0F0F0"},children:t.name}),!t.is_active&&e.jsx("span",{style:{fontSize:10,color:"#555",fontStyle:"italic"},children:"inactive"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx(ge,{category:t.component_type}),e.jsx(pe,{tier:t.tier}),!p&&e.jsxs("span",{style:{fontSize:12,color:"#666",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:280},children:[t.content.slice(0,90),t.content.length>90?"…":""]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx("button",{onClick:_=>{_.stopPropagation(),Q(t)},title:t.is_active?"Deactivate":"Activate",style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,transition:"color 0.15s",display:"flex",alignItems:"center",color:t.is_active?"#00D1C4":"#555"},children:t.is_active?e.jsx(te,{size:15}):e.jsx(re,{size:15})}),p?e.jsx(se,{size:16,color:"#9A9AAA"}):e.jsx(oe,{size:16,color:"#9A9AAA"})]})]}),p&&e.jsx("div",{style:{borderTop:"1px solid rgba(255,255,255,0.06)",padding:"20px 20px"},children:m?e.jsx(H,{initial:t,categories:T,onSave:_=>$(t.id,_),onCancel:()=>b(null),saving:u}):e.jsxs(e.Fragment,{children:[e.jsx("pre",{style:{fontFamily:"var(--font-body)",fontSize:13,lineHeight:1.7,color:"#D0D0E8",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:"0 0 20px"},children:t.content}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",justifyContent:"flex-end"},children:[e.jsxs("span",{style:{fontSize:11,color:"#555",marginRight:"auto"},children:["sort: ",t.sort_order]}),V?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontSize:12,color:"#E91E8C"},children:"Delete this entry?"}),e.jsxs("button",{onClick:()=>M(t.id),style:{background:"rgba(233,30,140,0.15)",border:"1px solid rgba(233,30,140,0.4)",borderRadius:8,padding:"7px 14px",color:"#E91E8C",fontSize:12,fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",gap:6},children:[e.jsx(ne,{size:13})," Yes, delete"]}),e.jsxs("button",{onClick:()=>v(null),style:{background:"none",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,padding:"7px 14px",color:"#9A9AAA",fontSize:12,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:6},children:[e.jsx(ie,{size:13})," Cancel"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>b(t.id),style:{background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,padding:"7px 14px",color:"#9A9AAA",fontSize:12,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:6,transition:"all 0.15s"},children:[e.jsx(ae,{size:13})," Edit"]}),e.jsxs("button",{onClick:()=>v(t.id),style:{background:"none",border:"1px solid rgba(233,30,140,0.2)",borderRadius:8,padding:"7px 14px",color:"#E91E8C",fontSize:12,fontWeight:600,cursor:"pointer",opacity:.7,display:"flex",alignItems:"center",gap:6,transition:"opacity 0.15s"},children:[e.jsx(le,{size:13})," Delete"]})]})]})]})})]})]},t.id)})})()})]}),e.jsx("style",{children:`
2        @keyframes kb-spin { to { transform: rotate(360deg); } }
3        .kb-back-btn:hover { color: #F0F0F0 !important; }
4        .kb-spin { animation: kb-spin 0.8s linear infinite; }
5      `})]})};export{fe as default};

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.