PageSourceSearch

https://shelfy.so/_next/static/chunks/91120-424f27009dfe3b56.js

js shelfy.so collected 2026-10-09 22:42:45 UTC 7,371 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[52773,91120],{52773:(e,t,s)=>{s.r(t),s.d(t,{assistantApi:()=>n,useCreateChatFromMessageMutation:()=>u,useDeleteChatMutation:()=>c,useGetContextCollectionsQuery:()=>i,useGetResultSetQuery:()=>h,useLazyGetChatQuery:()=>g,useLazyGetChatsQuery:()=>o,useSendMessageMutation:()=>l,useSendMessageToChatMutation:()=>d});var a=s(61321),r=s(49973);let n=(0,a.xP)({reducerPath:"assistantApi",baseQuery:r.W,tagTypes:["Chat","ChatMessage","ContextCollections"],endpoints:e=>({getChats:e.query({query:()=>({url:"/assistant/chats",method:"GET"}),providesTags:["Chat"]}),getContextCollections:e.query({query:e=>{let{q:t}=e;return{url:"/assistant/context".concat(t?"?q=".concat(encodeURIComponent(t)):""),method:"GET"}},providesTags:["ContextCollections"]}),sendMessage:e.mutation({query:e=>({url:"/assistant/messages",method:"POST",body:e}),invalidatesTags:["Chat","ChatMessage"]}),createChatFromMessage:e.mutation({query:e=>({url:"/assistant/chat_from_message",method:"POST",body:e}),invalidatesTags:["Chat"]}),sendMessageToChat:e.mutation({query:e=>{let{chatId:t,content:s}=e;return{url:"/assistant/chats/".concat(t,"/message"),method:"POST",body:{content:s}}},invalidatesTags:(e,t,s)=>{let{chatId:a}=s;return[{type:"ChatMessage",id:a},"ChatMessage"]}}),deleteChat:e.mutation({query:e=>({url:"/assistant/chats/".concat(e),method:"DELETE"}),invalidatesTags:["Chat"]}),getChat:e.query({query:e=>({url:"/assistant/chats/".concat(e),method:"GET"}),providesTags:(e,t,s)=>[{type:"Chat",id:s}]}),getResultSet:e.query({query:e=>{let{chatId:t,resultSetId:s}=e;return{url:"/assistant/chats/".concat(t,"/result_sets/").concat(s),method:"GET"}}})})}),{useLazyGetChatsQuery:o,useGetContextCollectionsQuery:i,useSendMessageMutation:l,useCreateChatFromMessageMutation:u,useSendMessageToChatMutation:d,useDeleteChatMutation:c,useLazyGetChatQuery:g,useGetResultSetQuery:h}=n},67606:(e,t,s)=>{s.d(t,{P:()=>a});let a=[{text:"What can you help me with?",tileClass:"bg-indigo-100 text-indigo-600 dark:bg-indigo-900/40 dark:text-indigo-300"},{text:"Which resources I have saved last week?",tileClass:"bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-300"},{text:"Find untagged resources",tileClass:"bg-purple-100 text-purple-600 dark:bg-purple-900/40 dark:text-purple-300"},{text:"Suggest tags for untagged resources",tileClass:"bg-pink-100 text-pink-600 dark:bg-pink-900/40 dark:text-pink-300"},{text:"Suggest collections for unsorted resources",tileClass:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300"},{text:"Find resources discussing topic ... and add them to the reading list",tileClass:"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/40 dark:text-emerald-300"}]},91120:(e,t,s)=>{s.d(t,{A:()=>g});var a=s(95155),r=s(12115);s(91285);var n=s(63892),o=s(52773),i=s(38218),l=s(94994),u=s(67606);let d=[],c=(0,r.forwardRef)((e,t)=>{let{onSendMessage:s,disabled:c=!1,isFreePlan:g=!1,dropdownPortalContainer:h,defaultContext:x=d}=e,[m,p]=(0,r.useState)(""),[y,b]=(0,r.useState)(x),[f,C]=(0,r.useState)(!1),[k,v]=(0,r.useState)(!1),[w,j]=(0,r.useState)(!1),[S,T]=(0,r.useState)(""),[M,E]=(0,r.useState)(""),q=(0,r.useRef)(null),A=(0,r.useRef)(null),N=(0,i.a)(1024),{data:F,isLoading:L}=(0,o.useGetContextCollectionsQuery)({q:M},{skip:!k});(0,r.useEffect)(()=>{let e=setTimeout(()=>{E(S)},300);return()=>clearTimeout(e)},[S]),(0,r.useImperativeHandle)(t,()=>({focus:()=>{var e;null==(e=q.current)||e.focus()},setContextItems:e=>{b(e),C(!0)},resetToDefaultContext:()=>{b(x),C(!1)},setMessage:e=>{p(e),requestAnimationFrame(()=>{var e;return null==(e=q.current)?void 0:e.focus()})}}),[x]),(0,r.useEffect)(()=>{f||b(x)},[x,f]),(0,r.useEffect)(()=>{if(!N){var e;null==(e=q.current)||e.focus()}},[]),(0,r.useEffect)(()=>{q.current&&(q.current.style.height="auto",q.current.style.height="".concat(q.current.scrollHeight,"px"))},[m]),(0,r.useEffect)(()=>{let e=e=>{A.current&&!A.current.contains(e.target)&&v(!1)};return k&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[k]);let G=()=>{!m.trim()||c||g||(s(m,[]),p(""))};return n.A,n.A,(0,a.jsxs)("div",{className:"mx-2.5 mb-2.5 bg-white dark:bg-gray-700 rounded-[18px] border border-gray-200 dark:border-gray-600 focus-within:border-[#0D99FF] dark:focus-within:border-[#0D99FF] transition-colors p-3",style:{borderRadius:"22px"},children:[!1,(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("textarea",{ref:q,value:m,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||c||g||(e.preventDefault(),G())},placeholder:g?"Upgrade to use AI chat features...":"Ask Shelfy Assistant anything...",disabled:g,className:"w-full resize-none border-none outline-none bg-transparent text-sm font-normal text-gray-900 dark:text-gray-200 placeholder:text-gray-400 dark:placeholder:text-gray-500 placeholder:font-light min-h-[40px] max-h-[200px] pt-1.5 pl-1 ".concat(g?"cursor-not-allowed opacity-50":""),rows:1})}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[!1,(0,a.jsxs)("button",{type:"button",onClick:()=>j(!0),disabled:g,className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border border-gray-200 dark:border-gray-600 dark:bg-gray-600 text-gray-500 dark:text-gray-400 text-xs font-medium transition-colors ".concat(g?"cursor-not-allowed opacity-50":"hover:bg-gray-100 dark:hover:bg-gray-550 cursor-pointer"),title:g?"Upgrade to see suggested use-cases":"Suggested use-cases",children:[(0,a.jsx)(n.A,{name:"Spark",width:12,height:12,"aria-hidden":"true"}),"Suggested use-cases"]})]}),(0,a.jsx)("button",{onClick:G,disabled:!m.trim()||c||g,className:"w-8 h-8 rounded-full flex items-center justify-center transition-all cursor-pointer ".concat(!m.trim()||c||g?"bg-gray-200 dark:bg-gray-600 text-gray-400 dark:text-gray-500 cursor-not-allowed":"text-white hover:opacity-90"),style:!m.trim()||c||g?void 0:{backgroundColor:"#0D99FF"},"aria-label":g?"Upgrade to send messages":"Send message",title:g?"Upgrade to send messages":void 0,children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M8 12L8 4M8 4L4 8M8 4L12 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),w&&(0,a.jsxs)(l.A,{isOpen:!0,onClose:()=>j(!1),title:"Suggested use-cases",size:"lg",children:[(0,a.jsx)("ul",{className:"space-y-0.5",children:u.P.map(e=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>{p(e.text),j(!1),requestAnimationFrame(()=>{var e;return null==(e=q.current)?void 0:e.focus()})},className:"w-full text-left px-2 py-1.5 rounded-lg text-sm text-gray-800 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors cursor-pointer flex items-center gap-2.5",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"w-8 h-8 rounded-md flex items-center justify-center flex-shrink-0 ".concat(e.tileClass),children:(0,a.jsx)(n.A,{name:"Note",width:15,height:15})}),(0,a.jsx)("span",{children:e.text})]})},e.text))}),(0,a.jsx)("p",{className:"mt-4 px-3 text-xs italic text-gray-500 dark:text-gray-400",children:"This is just a small part of the Shelfy Assistant capabilities."})]})]})});c.displayName="AssistantChatInput";let g=c}}]);

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.