1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[18066],{6164:function(e,t,n){"use strict";var r=n(39349);function a(){}function i(){}i.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,i,o){if(o!==r){var l=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:a};return n.PropTypes=n,n}},71383:function(e,t,n){e.exports=n(6164)()},39349:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},54923:function(e,t,n){"use strict";var r=n(65724),a=n(2512),i=n(76205);t.Z=e=>{let{text:t,onRegenerate:n,disabled:o,className:l}=e,[s,u]=(0,a.useState)("idle"),c=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]);let d=(0,a.useCallback)(async()=>{let e=t.trim();if(!e)return;let n=!1;try{var r;await (null===(r=navigator.clipboard)||void 0===r?void 0:r.writeText(e)),n=!!navigator.clipboard}catch(e){n=!1}u(n?"copied":"failed"),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>u("idle"),2e3)},[t]),h=(0,i.cn)("rounded-full px-2 py-1 text-[12px] font-medium text-[rgb(83,100,113)] transition-colors","hover:bg-[rgb(247,249,249)] hover:text-[rgb(15,20,25)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#db1802]","disabled:cursor-not-allowed disabled:opacity-50");return(0,r.jsxs)("div",{className:(0,i.cn)("mt-1 flex items-center gap-0.5",l),children:[(0,r.jsx)("button",{type:"button",onClick:()=>void d(),disabled:o,className:h,"aria-live":"polite",children:"copied"===s?"Copied":"failed"===s?"Couldn't copy":"Copy"}),n&&(0,r.jsx)("button",{type:"button",onClick:n,disabled:o,className:h,children:"Try again"})]})}},10317:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(65724),a=n(2512),i=n(58454);let o=(0,a.memo)(i.D,(e,t)=>e.children===t.children&&e.className===t.className);var l=n(76205);let s=/^(https?:|mailto:|tel:)/i,u={p:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 last:mb-0",children:t})},strong:e=>{let{children:t}=e;return(0,r.jsx)("strong",{className:"font-semibold text-[rgb(15,20,25)]",children:t})},em:e=>{let{children:t}=e;return(0,r.jsx)("em",{className:"italic",children:t})},ul:e=>{let{children:t}=e;return(0,r.jsx)("ul",{className:"mb-2 list-disc space-y-1 pl-5 last:mb-0",children:t})},ol:e=>{let{children:t}=e;return(0,r.jsx)("ol",{className:"mb-2 list-decimal space-y-1 pl-5 last:mb-0",children:t})},li:e=>{let{children:t}=e;return(0,r.jsx)("li",{className:"pl-0.5",children:t})},h1:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 font-semibold last:mb-0",children:t})},h2:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 font-semibold last:mb-0",children:t})},h3:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 font-semibold last:mb-0",children:t})},h4:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 font-semibold last:mb-0",children:t})},h5:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 font-semibold last:mb-0",children:t})},h6:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 font-semibold last:mb-0",children:t})},a:e=>{let{href:t,children:n}=e,a=function(e){if(!e)return;let t=e.trim();return t.startsWith("/")||t.startsWith("#")?t:s.test(t)?t:void 0}(t);return a?(0,r.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer nofollow",className:"text-[#db1802] underline underline-offset-2 hover:no-underline",children:n}):(0,r.jsx)("span",{children:n})},code:e=>{let{inline:t,children:n}=e;return t?(0,r.jsx)("code",{className:"rounded bg-[rgb(239,243,244)] px-1 py-0.5 font-mono text-[13px]",children:n}):(0,r.jsx)("code",{className:"font-mono text-[13px]",children:n})},pre:e=>{let{children:t}=e;return(0,r.jsx)("pre",{className:"mb-2 overflow-x-auto rounded-lg bg-[rgb(247,249,249)] p-3 last:mb-0",children:t})},blockquote:e=>{let{children:t}=e;return(0,r.jsx)("blockquote",{className:"mb-2 border-l-2 border-[rgb(207,217,222)] pl-3 text-[rgb(83,100,113)] last:mb-0",children:t})},hr:()=>(0,r.jsx)("hr",{className:"my-3 border-[rgb(239,243,244)]"})};var c=e=>{let{children:t,className:n}=e;return(0,r.jsx)("div",{className:(0,l.cn)("break-words",n),children:(0,r.jsx)(o,{components:u,children:t})})}},87846:function(e,t,n){"use strict";n.d(t,{a:function(){return a}});let r=["not_configured","rate_limited","unauthenticated","upstream_failed","network"];async function a(e){let t="";try{let n=await fetch("/api/clarua/ask",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.signal,body:JSON.stringify(e.body)});if(!n.ok||!n.body){let e=null;try{e=await n.json()}catch(e){}return{status:"failed",reason:function(e,t){let n=t&&"object"==typeof t?t.error:void 0;return"string"==typeof n&&r.includes(n)?n:401===e?"unauthenticated":429===e?"rate_limited":503===e?"not_configured":"upstream_failed"}(n.status,e)}}let a=n.body.getReader(),i=new TextDecoder;for(;;){let{done:n,value:r}=await a.read();if(n)break;t+=i.decode(r,{stream:!0}),e.onChunk(t)}if(0===t.length)return{status:"failed",reason:"upstream_failed"};return{status:"complete",text:t}}catch(e){if((null==e?void 0:e.name)==="AbortError")return{status:"cancelled",text:t};if(t.length>0)return{status:"interrupted",text:t};return{status:"failed",reason:"network"}}}},68352:function(e,t,n){"use strict";n.d(t,{X:function(){return s}});var r=n(2512),a=n(64376),i=n(87846);let o=0,l=()=>"clarua-".concat(Date.now(),"-").concat(o+=1);function s(e){let[t,n]=(0,r.useState)([]),[o,s]=(0,r.useState)(!1),[u,c]=(0,r.useState)(null),d=(0,r.useRef)(null),h=(0,r.useRef)([]),p=(0,r.useCallback)(()=>{var e;null===(e=d.current)||void 0===e||e.abort(),d.current=null,s(!1)},[]),m=(0,r.useCallback)(()=>{p(),h.current=[],n([]),c(null)},[p]),f=(0,r.useCallback)(async t=>{let r=t.trim();if(!r||d.current)return;c(null);let o={id:l(),role:"user",content:r},u=l(),p=h.current;h.current=[...p,o],n(e=>[...e,o,{id:u,role:"assistant",content:""}]),s(!0);let m=new AbortController;d.current=m;try{let t=await (0,i.a)({body:{question:r,history:p.map(e=>{let{role:t,content:n}=e;return{role:t,content:n}}),post:e},signal:m.signal,onChunk:e=>{n(t=>t.map(t=>
1t.id===u?{...t,content:e}:t))}});if("failed"===t.status)c({reason:t.reason,message:a.I[t.reason]}),n(e=>e.filter(e=>e.id!==u&&e.id!==o.id)),h.current=p;else if(0===t.text.length)n(e=>e.filter(e=>e.id!==u&&e.id!==o.id)),h.current=p;else{let e="interrupted"===t.status;n(n=>n.map(n=>n.id===u?{...n,content:t.text,interrupted:e}:n)),h.current=[...h.current,{id:u,role:"assistant",content:t.text}]}}finally{d.current=null,s(!1)}},[e]),b=(0,r.useCallback)(()=>{if(d.current)return;let e=h.current,t=-1;for(let n=e.length-1;n>=0;n--)if("user"===e[n].role){t=n;break}if(-1===t)return;let r=e[t].content,a=new Set(e.slice(0,t).map(e=>e.id));h.current=e.slice(0,t),n(e=>e.filter(e=>a.has(e.id))),f(r)},[f]);return{messages:t,isStreaming:o,error:u,send:f,stop:p,reset:m,regenerate:b}}},42459:function(e,t,n){"use strict";n.d(t,{G:function(){return i}});let r=/\b(can'?t (check|verify|browse|look)|don'?t have (access|a way)|no (live )?internet|couldn'?t (check|verify)|as of my|not able to (check|verify))\b/i,a=/\b(probably|likely|might be|may be|i think|it depends|not sure|hard to say)\b/i;function i(e){var t,n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{hasPost:!1},o=e.trim();if(0===o.length)return[];if(i.interrupted)return[{id:"continue",label:"Finish that answer",prompt:"You stopped partway. Please finish what you were saying."}];let l=[];return r.test(o)&&l.push({id:"how-to-check",label:"How would I check?",prompt:"You said you couldn't verify that. What's the most reliable way for me to check it myself?"}),a.test(o)&&l.push({id:"what-would-change",label:"What would change your mind?",prompt:"You hedged there. What would have to be true for the opposite to be the better answer?"}),(null!==(t=o.match(/^\s*[-*]\s+/gm))&&void 0!==t?t:[]).length+(null!==(n=o.match(/^\s*\d+[.)]\s+/gm))&&void 0!==n?n:[]).length>=2&&l.push({id:"which-first",label:"Which one first?",prompt:"Of the things you listed, which should I do first, and why that one?"}),o.length>=700?l.push({id:"shorter",label:"Shorter version",prompt:"Give me that again in two sentences."}):l.push({id:"go-deeper",label:"Go deeper",prompt:"Go deeper on that â what am I missing?"}),i.hasPost&&l.push({id:"reply-draft",label:"Draft a reply",prompt:"Draft a short reply I could leave on this post, in my own voice. Keep it specific."}),l.slice(0,3)}},64376:function(e,t,n){"use strict";n.d(t,{I:function(){return r}});let r={not_configured:"Clarua isn't switched on for this environment yet. Nothing you did â the model credentials aren't set on the server.",rate_limited:"You've asked Clarua a lot in a short window. Give it a minute and try again.",unauthenticated:"Sign in to ask Clarua.",upstream_failed:"Clarua couldn't reach the model just now. Worth trying again in a moment.",network:"The connection dropped before Clarua finished. Your question wasn't lost â try sending it again."}},63019:function(e,t,n){"use strict";n.d(t,{fy:function(){return r},qz:function(){return a}});let r=[{id:"draft-post",label:"Help me write a post",prompt:"Help me write a post for my community. Ask me what it should be about first."},{id:"ideas",label:"Give me content ideas",prompt:"Give me five specific content ideas I could post this week. Ask what my community is about first."},{id:"grow",label:"How do I grow here?",prompt:"What actually works for growing an audience on a community platform like this one?"},{id:"explain",label:"Explain something",prompt:"Explain a concept to me clearly. I'll tell you which one."}];function a(e){var t,n,r;let a=[],i=null!==(n=null===(t=e.body)||void 0===t?void 0:t.length)&&void 0!==n?n:0,o=i>0||!!e.title;return i>=400&&a.push({id:"summarise",label:"Summarise this",prompt:"Summarise this post in a few clear sentences."}),o&&a.push({id:"explain",label:"Explain it simply",prompt:"Explain what this post is saying in plain language, as if I'm new to the topic."}),e.media.some(e=>"video"===e.kind||"youtube"===e.kind||"live"===e.kind)&&a.push({id:"video-context",label:"What's the context?",prompt:"This post has a video you can't watch. Based only on its text, what's the context, and what would be worth asking the creator?"}),(null!==(r=e.commentCount)&&void 0!==r?r:0)>0&&a.push({id:"discussion",label:"What are people saying?",prompt:"Read the comments on this post. What are people actually saying, and is there any disagreement worth knowing about?"}),o&&(a.push({id:"reply",label:"Draft a reply",prompt:"Draft a thoughtful reply I could leave on this post. Keep it short and specific."}),a.push({id:"dig-in",label:"What should I ask?",prompt:"What are the most useful follow-up questions I could ask about this post?"})),0===a.length&&a.push({id:"about-post",label:"What can you tell me?",prompt:"What can you tell me about this post from what you can see?"}),a.slice(0,4)}}}]);
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.