PageSourceSearch

https://www.sariya.app/_next/static/chunks/6284.3bfe34a58674a07b.js

js sariya.app collected 2026-10-02 00:14:51 UTC 7,452 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6284],{6284:(e,t,a)=>{a.r(t),a.d(t,{DocumentsTool:()=>y});var r=a(95155),s=a(12115),l=a(48368),i=a(68459),o=a(6296),d=a(86901),n=a(94514),c=a(67635),p=a(51034),m=a(65849),u=a(84872),x=a(21319),b=a(2580);let h=[{id:"formal_letter",label:"Formal letter",description:"Leave requests, complaints, invitations"},{id:"application",label:"Application",description:"School, work, or official requests"},{id:"email",label:"Professional email",description:"Clear, respectful emails"}],y=({isPro:e,canRewrite:t,onRewriteUsed:a,onUpgradeClick:y,wordLimit:g})=>{let{text:f,setText:k,selectedLanguage:w,documentResults:j,setDocumentResults:v}=(0,u.h)(),[N,C]=(0,s.useState)(j.documentType),[A,T]=(0,s.useState)(!1),[_,D]=(0,s.useState)(null),[I,S]=(0,s.useState)(!1),M=(0,p.lr)(w),F=f.trim()?f.trim().split(/\s+/).length:0,H=(0,b.f)(),L=(0,s.useCallback)(async()=>{if(f.trim()&&!A){if(F>g){H({name:x.q4.LIMIT_HIT,tool:"documents",properties:{reason:"word_limit",bucket:"documents",limitType:"input",wordCount:F,wordLimit:g,plan:e?"pro":"free"}}),D(`Documents accept up to ${g.toLocaleString()} words on your plan. Upgrade for a larger input.`),y();return}if(!t){H({name:x.q4.LIMIT_HIT,tool:"documents",properties:{reason:"daily_limit",bucket:"documents",limitType:"bucket",plan:e?"pro":"free"}}),D("You have used today’s document. Upgrade to Pro for 20 documents per day."),y();return}T(!0),D(null),S(!1);try{let e=await (0,m.gn)({task:"document",text:f.trim(),language:w,documentType:N}),t=e.data.text?.trim();if(!t)throw Error("No document was generated.");v({output:t,documentType:N}),a()}catch(e){D((0,m.p4)(e,"Document generation failed. Please try again.")),(0,m.Y6)(e)&&y()}finally{T(!1)}}},[t,N,A,e,a,y,w,v,f,H,F,g]),q=(0,s.useCallback)(async()=>{if(j.output)try{await navigator.clipboard.writeText(j.output),S(!0),window.setTimeout(()=>S(!1),1800)}catch{D("Copy failed. Select the document text and copy it manually.")}},[j.output]),z=(0,s.useCallback)(()=>{j.output&&k(j.output)},[j.output,k]),E=(0,s.useCallback)(()=>{k(""),v({output:null,documentType:N}),D(null),S(!1)},[N,v,k]);return(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 w-full gap-2.5 overflow-y-auto pr-0.5",children:[(0,r.jsxs)("div",{className:"shrink-0 rounded-2xl border border-slate-200/80 dark:border-slate-800/80 bg-white/85 dark:bg-[#0B0F19]/85 backdrop-blur-2xl shadow-sm p-4 md:p-5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3 mb-4",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-xl bg-primary/10 text-primary flex items-center justify-center shrink-0",children:(0,r.jsx)(l.A,{className:"w-5 h-5"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-base font-bold text-slate-900 dark:text-white",children:"Documents"}),(0,r.jsxs)("p",{className:"text-xs text-slate-500 dark:text-slate-400 mt-0.5",children:["Describe what you need and Sariya will format it in ",M.label,"."]})]}),(0,r.jsx)("span",{className:"ml-auto text-[10px] font-semibold uppercase tracking-wider text-slate-400 whitespace-nowrap",children:e?"Pro":"AI tool"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 mb-4",role:"radiogroup","aria-label":"Document type",children:h.map(e=>(0,r.jsxs)("button",{type:"button","data-testid":`document-type-${e.id}`,"aria-pressed":N===e.id,onClick:()=>C(e.id),className:`text-left rounded-xl border px-3 py-2.5 transition-all ${N===e.id?"border-primary bg-primary/10 text-primary shadow-sm":"border-slate-200/80 dark:border-slate-700/80 text-slate-600 dark:text-slate-300 hover:border-primary/40 hover:bg-slate-50 dark:hover:bg-slate-800/70"}`,children:[(0,r.jsx)("span",{className:"block text-xs font-bold",children:e.label}),(0,r.jsx)("span",{className:"block text-[10px] leading-tight mt-1 opacity-70",children:e.description})]},e.id))}),(0,r.jsx)("label",{htmlFor:"documents-input",className:"sr-only",children:"Describe the document you need"}),(0,r.jsx)("textarea",{id:"documents-input","data-testid":"documents-input",value:f,onChange:e=>k(e.target.value),placeholder:"Example: Write a two-day leave letter to my manager because I have a family function.",className:"w-full min-h-[150px] resize-y rounded-xl border border-slate-200 dark:border-slate-700 bg-slate-50/70 dark:bg-slate-900/70 p-3.5 text-sm leading-relaxed text-slate-900 dark:text-slate-100 outline-none focus:border-primary/60 focus:ring-2 focus:ring-primary/10 placeholder:text-slate-400"}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 mt-3",children:[(0,r.jsxs)("span",{className:"text-[11px] text-slate-400",children:[F," words \xb7 ",M.nativeLabel]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[f.trim()&&(0,r.jsxs)("button",{type:"button",onClick:E,className:"inline-flex items-center gap-1.5 px-2.5 py-2 rounded-lg text-xs font-semibold text-slate-500 hover:text-slate-800 dark:hover:text-slate-200 transition-colors",children:[(0,r.jsx)(i.A,{className:"w-3.5 h-3.5"}),"Clear"]}),(0,r.jsxs)("button",{type:"button","data-testid":"documents-generate",onClick:L,disabled:!f.trim()||A,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-white text-xs font-bold shadow-sm hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[A?(0,r.jsx)(o.A,{className:"w-4 h-4 animate-spin"}):(0,r.jsx)(d.A,{className:"w-4 h-4"}),A?"Formatting…":"Generate document"]})]})]})]}),_&&(0,r.jsx)("div",{role:"alert",className:"shrink-0 rounded-xl border border-red-200 dark:border-red-900/60 bg-red-50 dark:bg-red-950/30 px-4 py-3 text-sm text-red-700 dark:text-red-300",children:_}),j.output&&(0,r.jsxs)("section",{"data-testid":"documents-output",className:"shrink-0 rounded-2xl border border-slate-200/80 dark:border-slate-800/80 bg-white/90 dark:bg-[#0B0F19]/90 backdrop-blur-2xl shadow-sm overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-b border-slate-100 dar
1k:border-slate-800/70",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-400",children:"Ready to use"}),(0,r.jsx)("h3",{className:"text-sm font-bold text-slate-800 dark:text-slate-100 mt-0.5",children:h.find(e=>e.id===j.documentType)?.label??"Document"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:q,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-semibold text-slate-500 hover:text-primary hover:bg-primary/5 transition-colors",children:[I?(0,r.jsx)(n.A,{className:"w-3.5 h-3.5"}):(0,r.jsx)(c.A,{className:"w-3.5 h-3.5"}),I?"Copied":"Copy"]}),(0,r.jsx)("button",{type:"button",onClick:z,className:"px-2.5 py-1.5 rounded-lg bg-primary/10 text-primary text-xs font-bold hover:bg-primary/15 transition-colors",children:"Use in editor"})]})]}),(0,r.jsx)("div",{className:"p-4 md:p-5 text-sm leading-7 text-slate-800 dark:text-slate-200 whitespace-pre-wrap",children:j.output})]})]})}},48368:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(78340).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])}}]);

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.