PageSourceSearch

https://app.stopwriting.com/_next/static/chunks/4557.5ed24a80550dbc26.js

js stopwriting.com collected 2026-10-08 16:47:33 UTC 40,577 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aab9e8cf-11bc-4f04-b4d4-64cd0381c994",e._sentryDebugIdIdentifier="sentry-dbid-aab9e8cf-11bc-4f04-b4d4-64cd0381c994")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4557],{34557:function(e,t,n){n.r(t),n.d(t,{default:function(){return S}});var r=n(27573),o=n(7653),i=n(3458);function l(e){let{label:t,options:n,selected:i,onToggle:l,defaultOpen:s=!0}=e,[a,d]=(0,o.useState)(s),c=i.size;return(0,r.jsxs)("div",{style:{marginBottom:12},children:[(0,r.jsxs)("button",{onClick:()=>{c>0?i.forEach(e=>l(e)):d(e=>!e)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"4px 6px",border:"none",borderRadius:4,background:"transparent",cursor:"pointer",fontSize:10,fontWeight:600,color:"#999",textTransform:"uppercase",letterSpacing:"0.5px"},title:c>0?"Clear filters":a?"Collapse":"Expand",children:[(0,r.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4},children:[t,c>0&&(0,r.jsx)("span",{style:{fontSize:9,fontWeight:700,color:"#3366D4",background:"#EFF6FF",borderRadius:3,padding:"0 4px",lineHeight:"14px"},children:c})]}),(0,r.jsx)("span",{style:{fontSize:8,transition:"transform 0.15s",transform:a?"rotate(0deg)":"rotate(-90deg)",color:c>0?"#3366D4":"#ccc"},children:"▼"})]}),a&&(0,r.jsx)("div",{style:{marginTop:2},children:n.map(e=>{let{value:t,count:n}=e,o=i.has(t);return(0,r.jsxs)("button",{onClick:()=>l(t),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",textAlign:"left",padding:"3px 6px",fontSize:12,border:"none",borderRadius:4,background:o?"#EFF6FF":"transparent",color:o?"#3366D4":"#666",cursor:"pointer",fontWeight:o?600:400,marginBottom:1,transition:"background 0.1s"},children:[(0,r.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),(0,r.jsx)("span",{style:{fontSize:10,color:o?"#3366D4":"#ccc",flexShrink:0,marginLeft:4},children:n})]},t)})})]})}function s(e){let{entries:t,onSelectEntry:n,onDismiss:i,emptyMessage:s,hideFilters:a}=e,[d,c]=(0,o.useState)(""),[p,u]=(0,o.useState)(new Set),[g,h]=(0,o.useState)(new Set),[f,y]=(0,o.useState)(new Set),x=(0,o.useCallback)((e,t)=>{e(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),m=(0,o.useMemo)(()=>{let e=new Map;return t.forEach(t=>{var n,r;let o=null!==(n=t.format_medium)&&void 0!==n?n:[t.format,t.medium].filter(Boolean).join(" ");o&&e.set(o,(null!==(r=e.get(o))&&void 0!==r?r:0)+1)}),Array.from(e.entries()).map(e=>{let[t,n]=e;return{value:t,count:n}}).sort((e,t)=>t.count-e.count)},[t]),b=(0,o.useMemo)(()=>{let e=new Map;return t.forEach(t=>{var n;t.super_genre&&e.set(t.super_genre,(null!==(n=e.get(t.super_genre))&&void 0!==n?n:0)+1)}),Array.from(e.entries()).map(e=>{let[t,n]=e;return{value:t,count:n}}).sort((e,t)=>t.count-e.count)},[t]),v=(0,o.useMemo)(()=>{let e=new Map;return t.forEach(t=>{var n;t.genre&&e.set(t.genre,(null!==(n=e.get(t.genre))&&void 0!==n?n:0)+1)}),Array.from(e.entries()).map(e=>{let[t,n]=e;return{value:t,count:n}}).sort((e,t)=>t.count-e.count)},[t]),{deduped:S,variantCounts:w}=(0,o.useMemo)(()=>{let e=new Map;for(let r of t){var n;let t=r.title.toLowerCase(),o=null!==(n=e.get(t))&&void 0!==n?n:[];o.push(r),e.set(t,o)}let r=[],o={};return e.forEach(e=>{let t=e[0];r.push(t),o[t.id]=e.length}),{deduped:r,variantCounts:o}},[t]),j=(0,o.useMemo)(()=>S.filter(e=>{if(d){let t=d.toLowerCase();if(![e.title,e.genre,e.super_genre,e.sub_genre].filter(Boolean).join(" ").toLowerCase().includes(t))return!1}if(p.size>0){var t;let n=null!==(t=e.format_medium)&&void 0!==t?t:[e.format,e.medium].filter(Boolean).join(" ");if(!p.has(n))return!1}return!!((!(g.size>0)||e.super_genre&&g.has(e.super_genre))&&(!(f.size>0)||e.genre&&f.has(e.genre)))}),[S,d,p,g,f]),k=p.size>0||g.size>0||f.size>0||d.length>0;return(0,r.jsxs)("div",{style:{display:"flex",height:"100%"},children:[!a&&(0,r.jsxs)("div",{style:{width:190,borderRight:"1px solid #f0ede5",padding:"12px 10px",overflowY:"auto",flexShrink:0,background:"#faf9f5"},children:[(0,r.jsx)(l,{label:"Format / Medium",options:m,selected:p,onToggle:e=>x(u,e)}),(0,r.jsx)(l,{label:"Super Genre",options:b,selected:g,onToggle:e=>x(h,e)}),(0,r.jsx)(l,{label:"Genre",options:v,selected:f,onToggle:e=>x(y,e)}),k&&(0,r.jsx)("button",{onClick:()=>{u(new Set),h(new Set),y(new Set),c("")},style:{display:"block",width:"100%",padding:"6px 8px",fontSize:11,fontWeight:600,color:"#f28a7f",background:"transparent",border:"none",borderRadius:4,cursor:"pointer",textAlign:"center",marginTop:4},children:"Clear all filters"})]}),(0,r.jsxs)("div",{style:{flex:1,padding:16,overflowY:"auto"},children:[(0,r.jsx)("input",{type:"text",value:d,onChange:e=>c(e.target.value),placeholder:"Search by title, genre, or sub-genre...",style:{width:"100%",padding:"8px 12px",fontSize:13,border:"1px solid #e8e5dc",borderRadius:6,marginBottom:16,outline:"none",fontFamily:"inherit"}}),k&&j.length>0&&(0,r.jsxs)("div",{style:{fontSize:11,color:"#999",marginBottom:8},children:[j.length," ",1===j.length?"result":"results"]}),0===j.length?(0,r.jsx)("div",{style:{textAlign:"center",color:"#999",fontSize:13,marginTop:40},children:null!=s?s:"No entries match your filters."}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:12},children:j.map(e=>{var t,o;let l=null!==(t=w[e.id])&&void 0!==t?t:1,s=null!==(o=e.format_medium)&&void 0!==o?o:[e.format,e.medium].filter(
1Boolean).join(" "),a=[e.super_genre,e.genre,e.sub_genre].filter(Boolean).join(" • ");return(0,r.jsxs)("button",{onClick:()=>n(e),style:{textAlign:"left",padding:14,border:"1px solid #e8e5dc",borderRadius:8,background:"white",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},onMouseOver:e=>{e.currentTarget.style.borderColor="#3366D4",e.currentTarget.style.boxShadow="0 2px 8px rgba(51,102,212,0.1)";let t=e.currentTarget.querySelector(".dismiss-btn");t&&(t.style.opacity="1")},onMouseOut:e=>{e.currentTarget.style.borderColor="#e8e5dc",e.currentTarget.style.boxShadow="none";let t=e.currentTarget.querySelector(".dismiss-btn");t&&(t.style.opacity="0")},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:3},children:[(0,r.jsx)("span",{style:{fontSize:14,fontWeight:600,color:"#2F2C28",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),(0,r.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0,marginLeft:8},children:[l>1&&(0,r.jsxs)("span",{style:{fontSize:10,fontWeight:600,color:"#3366D4",background:"#EFF6FF",borderRadius:4,padding:"1px 6px"},children:[l," versions"]}),i&&(0,r.jsx)("span",{className:"dismiss-btn",onClick:t=>{t.stopPropagation(),i(e.id)},style:{fontSize:16,color:"#ccc",lineHeight:1,cursor:"pointer",opacity:0,transition:"opacity 0.15s"},title:"Remove from My Submissions",children:"\xd7"})]})]}),(0,r.jsxs)("div",{style:{fontSize:12,color:"#666",marginBottom:3},children:[s,e.year?" (".concat(e.year,")"):""]}),a&&(0,r.jsx)("div",{style:{fontSize:11,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),i&&"user_submitted"===e.source&&(0,r.jsxs)("div",{style:{marginTop:6},children:["pending"===e.status&&(0,r.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"#E5A50B",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Pending review"}),"approved"===e.status&&(0,r.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"#0F9D58",textTransform:"uppercase",letterSpacing:"0.5px"},children:"✓ Approved"}),"rejected"===e.status&&(0,r.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"#f28a7f",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Not approved"})]})]},e.id)})})]})]})}let a=[{num:1,label:"CHARACTER",subtitle:"trait + label",color:"#DB4437",keys:["character_trait","character_label"],subLabels:["Trait","Label"]},{num:2,label:"DISTURBANCE",subtitle:"inciting incident",color:"#CC7A00",keys:["disturbance"]},{num:3,label:"ENVIRONMENT",subtitle:"new world",color:"#F4B400",keys:["environment"]},{num:4,label:"FIGHT",subtitle:"the challenge",color:"#0F9D58",keys:["fight"]},{num:5,label:"GRASP",subtitle:"the plot",color:"#3366D4",keys:["grasp"]},{num:6,label:"ATTAIN",subtitle:"the motivation",color:"#5E35B1",keys:["attain"]},{num:7,label:"BECOME",subtitle:"transformation",color:"#9C5EC7",keys:["become"]}];function d(e){let t=e.trim();return t?t.split(/\s+/).length:0}function c(e){var t;let{entry:n,onUseAsReference:o}=e,i=e=>{var t;return null!==(t=n[e])&&void 0!==t?t:""};return(0,r.jsxs)("div",{style:{padding:20,overflowY:"auto",height:"100%"},children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:16},children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{fontSize:13,color:"#666",marginBottom:2},children:[null!==(t=n.format_medium)&&void 0!==t?t:[n.format,n.medium].filter(Boolean).join(" "),n.year?" (".concat(n.year,")"):""]}),(0,r.jsx)("div",{style:{fontSize:12,color:"#999",marginBottom:4},children:[n.super_genre,n.genre,n.sub_genre].filter(Boolean).join(" • ")}),"seed"===n.source&&(0,r.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"#0F9D58",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Verified"}),"admin"===n.source&&(0,r.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"#0F9D58",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Verified"}),"user_submitted"===n.source&&(0,r.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"#3366D4",textTransform:"uppercase",letterSpacing:"0.5px"},children:"User Submitted"})]}),(0,r.jsx)("button",{onClick:()=>o(n.title),style:{padding:"8px 16px",fontSize:13,fontWeight:600,background:"#3366D4",color:"white",border:"none",borderRadius:6,cursor:"pointer",whiteSpace:"nowrap"},children:"Use as reference in chat"})]}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20},children:a.map(e=>(0,r.jsxs)("div",{style:{display:"flex",gap:10},children:[(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[(0,r.jsx)("div",{style:{width:22,height:22,borderRadius:"50%",background:e.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700},children:e.num}),(0,r.jsx)("div",{style:{width:3,flex:1,borderRadius:2,background:e.color,marginTop:4,opacity:.3}})]}),(0,r.jsxs)("div",{style:{flex:1,minWidth:0,paddingBottom:4},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:4},children:[(0,r.jsx)("span",{style:{fontSize:11,fontWeight:700,color:e.color,textTransform:"uppercase",letterSpacing:"0.5px"},children:e.label}
1),(0,r.jsx)("span",{style:{fontSize:10,color:"#999"},children:e.subtitle})]}),1===e.keys.length?(0,r.jsx)("div",{style:{fontSize:14,color:"#2F2C28",lineHeight:"20px"},children:i(e.keys[0])||(0,r.jsx)("span",{style:{color:"#ccc",fontStyle:"italic"},children:"Empty"})}):(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:e.keys.map((t,n)=>{var o,l;return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{fontSize:10,fontWeight:600,color:"#999",textTransform:"uppercase",marginBottom:2},children:null!==(l=null===(o=e.subLabels)||void 0===o?void 0:o[n])&&void 0!==l?l:t}),(0,r.jsx)("div",{style:{fontSize:14,color:"#2F2C28",lineHeight:"20px"},children:i(t)||(0,r.jsx)("span",{style:{color:"#ccc",fontStyle:"italic"},children:"Empty"})})]},t)})})]})]},e.num+e.label))}),(0,r.jsxs)("div",{style:{borderTop:"1px solid #e8e5dc",paddingTop:16},children:[(0,r.jsx)("div",{style:{fontSize:11,fontWeight:600,color:"#999",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12},children:"Assembled Versions"}),i("logline")&&(0,r.jsxs)("div",{style:{marginBottom:14},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:4},children:[(0,r.jsx)("span",{style:{fontSize:11,fontWeight:700,color:"#666",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Your Logline"}),(0,r.jsxs)("span",{style:{fontSize:10,color:"#999"},children:["~",d(i("logline"))," words"]})]}),(0,r.jsx)("div",{style:{fontSize:14,color:"#2F2C28",lineHeight:"22px",padding:"10px 12px",background:"#faf9f5",borderRadius:6,borderLeft:"3px solid #3366D4"},children:i("logline")})]}),i("teaser")&&(0,r.jsxs)("div",{style:{marginBottom:14},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:4},children:[(0,r.jsx)("span",{style:{fontSize:11,fontWeight:700,color:"#666",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Teaser"}),(0,r.jsxs)("span",{style:{fontSize:10,color:"#999"},children:["~",d(i("teaser"))," words"]})]}),(0,r.jsx)("div",{style:{fontSize:14,color:"#2F2C28",lineHeight:"22px",padding:"10px 12px",background:"#faf9f5",borderRadius:6,borderLeft:"3px solid #5E35B1"},children:i("teaser")})]}),i("snapshot")&&(0,r.jsxs)("div",{style:{marginBottom:14},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:4},children:[(0,r.jsx)("span",{style:{fontSize:11,fontWeight:700,color:"#666",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Snapshot"}),(0,r.jsxs)("span",{style:{fontSize:10,color:"#999"},children:["~",d(i("snapshot"))," words"]})]}),(0,r.jsx)("div",{style:{fontSize:14,color:"#2F2C28",lineHeight:"22px",padding:"10px 12px",background:"#faf9f5",borderRadius:6,borderLeft:"3px solid #9C5EC7"},children:i("snapshot")})]}),!i("logline")&&!i("teaser")&&!i("snapshot")&&(0,r.jsx)("div",{style:{fontSize:13,color:"#999",fontStyle:"italic",padding:"12px 0"},children:"No assembled versions available for this entry."})]})]})}var p=n(68175);let u=["character_trait","character_label","disturbance","environment","fight","grasp","attain","become","logline","teaser","snapshot"];function g(e){return String(null!=e?e:"").trim()}function h(e,t){return e&&t?u.filter(n=>g(e[n])!==g(t[n])):[]}let f=[{key:"character_trait",label:"CHARACTER TRAIT",num:1,color:"#DB4437"},{key:"character_label",label:"CHARACTER LABEL",num:1,color:"#DB4437"},{key:"disturbance",label:"DISTURBANCE",num:2,color:"#CC7A00"},{key:"environment",label:"ENVIRONMENT",num:3,color:"#F4B400"},{key:"fight",label:"FIGHT",num:4,color:"#0F9D58"},{key:"grasp",label:"GRASP",num:5,color:"#3366D4"},{key:"attain",label:"ATTAIN",num:6,color:"#5E35B1"},{key:"become",label:"BECOME",num:7,color:"#9C5EC7"}],y=[{key:"logline",label:"Your Logline",color:"#3366D4"},{key:"teaser",label:"Teaser",color:"#5E35B1"},{key:"snapshot",label:"Snapshot",color:"#9C5EC7"}],x=[...f.map(e=>e.key),...y.map(e=>e.key)];function m(e){var t;let n={};for(let r of x)n[r]=String(null!==(t=e[r])&&void 0!==t?t:"");return n}function b(e){var t,n;let{breakdown:i,formData:l,confidence:s,evaluation:a,revisionHistory:d,onSubmitComplete:c,onUpdateBreakdown:u}=e,[g,b]=(0,o.useState)(()=>m(i)),[S,w]=(0,o.useState)([]),[j,k]=(0,o.useState)({}),[C,z]=(0,o.useState)(null),[T,F]=(0,o.useState)([]),[B,A]=(0,o.useState)(""),[E,R]=(0,o.useState)(!1),[I,W]=(0,o.useState)(!1),[D,_]=(0,o.useState)(""),[N,L]=(0,o.useState)(0),[H,P]=(0,o.useState)(0),[O,M]=(0,o.useState)([]),[Y,G]=(0,o.useState)(()=>{var e;return(function(e,t,n){let r=(Array.isArray(e)?e:[]).filter(e=>e&&e.breakdown).map((e,t)=>{var n,r;return{source:"generated",label:0===t?"First draft":"Pass ".concat(t+1),breakdown:e.breakdown,composite:null!==(r=null===(n=e.evaluation)||void 0===n?void 0:n.composite)&&void 0!==r?r:null}});return r.push({source:"generated",label:0===r.length?"First draft":"Pass ".concat(r.length+1),breakdown:t,composite:null!=n?n:null}),r})(d,i,null!==(e=null==a?void 0:a.composite)&&void 0!==e?e:null).slice(0,-1)}),[U,V]=(0,o.useState)(null);(0,o.useEffect)(()=>{b(m(i))},[i]);let J=(0,o.useMemo)(()=>({...i,...g}),[i,g]),q=e=>{var t;return g[e]!==String(null!==(t=i[e])&&void 0!==t?t:"")}
1,K=x.filter(q),Q=e=>{w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},X=(e,t)=>{k(n=>{let r={...n};return t.trim()?r[e]=t:delete r[e],r})},Z=Object.keys(j).length>0||B.trim().length>0||S.length>0,$=Z&&!E&&!I,ee=()=>{let e=[];for(let[t,n]of(K.length>0&&e.push("I rewrote ".concat(K.map(e=>e.replace(/_/g," ")).join(", ")," myself.")),Object.entries(j)))e.push("".concat(t.replace(/_/g," ").toUpperCase(),": ").concat(n.trim()));return B.trim()&&e.push(B.trim()),S.length>0&&e.push("Leave these as they are: ".concat(S.map(e=>e.replace(/_/g," ")).join(", "),".")),e.join("\n")},et=async()=>{if(!$)return;R(!0),_(""),M([]);let e=ee();try{var t,n;let r=await fetch("/api/logline-library/refine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({breakdown:J,feedback:B.trim()||void 0,pinned:S,partNotes:j,history:T.map(e=>({writer:e.writer,daivid:e.daivid})),title:l.title})}),o=await r.json();if(!r.ok){_(o.message||o.error||"That did not go through. Try again."),R(!1);return}G(e=>{var t;return[...e,{source:"refined",label:"Your round ".concat(e.filter(e=>"refined"===e.source).length+1),breakdown:J,composite:null!==(t=null==a?void 0:a.composite)&&void 0!==t?t:null}]}),V(null),F(t=>[...t,{writer:e,daivid:o.message||"",changed:Array.isArray(o.changes_made)?o.changes_made:[]}]),Array.isArray(o.ignoredPins)&&o.ignoredPins.length>0&&M(o.ignoredPins),u(null!==(t=o.breakdown)&&void 0!==t?t:J,null!==(n=o.evaluation)&&void 0!==n?n:a),k({}),z(null),A("")}catch(e){_("Network error. Try again.")}R(!1)},en=async()=>{if(0===N){_("Rate the breakdown before you add it.");return}W(!0),_("");try{var e;let t=await fetch("/api/logline-library/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:l.title,note:l.note||void 0,breakdown:J,confidence:s,rating:N,pinned:S,partNotes:j,thread:T.length>0?T:void 0,learning:function(e,t){var n,r,o,i,l,s,a,d;let c=null!==(l=null===(n=e[0])||void 0===n?void 0:n.breakdown)&&void 0!==l?l:null,p=null!==(s=null===(r=e.filter(e=>"generated"===e.source).slice(-1)[0])||void 0===r?void 0:r.breakdown)&&void 0!==s?s:c,u=h(c,p),g=h(p,t);return{passCount:e.length,firstPass:c,generatorChanged:u,writerChanged:g,stillWrongAfterRevision:g.filter(e=>u.includes(e)),compositeFirst:null!==(a=null===(o=e[0])||void 0===o?void 0:o.composite)&&void 0!==a?a:null,compositeLast:null!==(d=null===(i=e.slice(-1)[0])||void 0===i?void 0:i.composite)&&void 0!==d?d:null}}([...Y,{source:"refined",label:"Submitted",breakdown:J,composite:null!==(e=null==a?void 0:a.composite)&&void 0!==e?e:null}],J)})});if(t.ok)c();else{let e=await t.json();_(e.message||e.error||"That did not go through. Try again.")}}catch(e){_("Network error. Try again.")}W(!1)},er=String(null!==(t=J.format_medium)&&void 0!==t?t:""),eo=String(null!==(n=J.year)&&void 0!==n?n:""),ei=[J.super_genre,J.genre,J.sub_genre].filter(Boolean).map(String).join(" • ");return(0,r.jsxs)("div",{style:{padding:"16px 20px",overflowY:"auto",height:"100%"},children:[(0,r.jsxs)("div",{style:{marginBottom:10},children:[(0,r.jsxs)("div",{style:{fontSize:13,color:"#666",marginBottom:2},children:[er,eo?" (".concat(eo,")"):""]}),ei&&(0,r.jsx)("div",{style:{fontSize:12,color:"#999"},children:ei})]}),s<7&&(0,r.jsx)("div",{style:{padding:"7px 10px",marginBottom:10,borderRadius:6,background:"#FFF8EE",fontSize:12,color:"#2F2C28"},children:"dAIvid says he only half knows this story. Read the parts closely."}),Y.length>0&&(0,r.jsxs)("div",{style:{display:"flex",gap:4,marginBottom:10,flexWrap:"wrap",alignItems:"center"},children:[Y.map((e,t)=>(0,r.jsx)("button",{onClick:()=>V(U===t?null:t),style:{padding:"3px 10px",fontSize:11,fontWeight:600,borderRadius:12,cursor:"pointer",border:"1px solid ".concat(U===t?"#2F2C28":"#e8e5dc"),background:U===t?"#2F2C28":"white",color:U===t?"white":"#666"},children:e.label},t)),(0,r.jsx)("button",{onClick:()=>V(null),style:{padding:"3px 10px",fontSize:11,fontWeight:600,borderRadius:12,cursor:"pointer",border:"1px solid ".concat(null===U?"#2F2C28":"#e8e5dc"),background:null===U?"#2F2C28":"white",color:null===U?"white":"#666"},children:"Current"})]}),null!==U?(0,r.jsx)(v,{pass:Y[U],changed:h(Y[U].breakdown,J),onBack:()=>V(null)}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{style:{fontSize:12,color:"#999",marginTop:0,marginBottom:10},children:"Edit any part. Pin what dAIvid should leave alone. Add a note where he got it wrong, then refine."}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6,marginBottom:12},children:f.map(e=>{var t,n;let o=null!==(t=g[e.key])&&void 0!==t?t:"",i=(0,p.Ht)(o),l=p._x[e.key],s=!!l&&(0,p.sA)(i,l.budget,l.grace),a=S.includes(e.ke
1y),d=C===e.key||!!j[e.key];return(0,r.jsxs)("div",{style:{padding:"6px 10px",borderRadius:8,borderLeft:"3px solid ".concat(e.color),background:a?"#f4f9f5":"#faf9f5"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[(0,r.jsx)("div",{style:{width:18,height:18,borderRadius:"50%",background:e.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,flexShrink:0},children:e.num}),(0,r.jsx)("span",{style:{fontSize:10,fontWeight:700,color:e.color,textTransform:"uppercase",letterSpacing:"0.5px"},children:e.label}),i>0&&l&&(0,r.jsxs)("span",{style:{fontSize:10,color:s?"#f28a7f":"#999",fontWeight:s?600:"normal"},title:s?"About ".concat(l.budget," words fits here."):"Budget: about ".concat(l.budget," words"),children:[i,"/",l.budget]}),q(e.key)&&(0,r.jsx)("span",{style:{fontSize:10,color:"#3366D4"},children:"your words"}),(0,r.jsxs)("span",{style:{marginLeft:"auto",display:"flex",gap:8,flexShrink:0},children:[(0,r.jsx)("button",{onClick:()=>Q(e.key),disabled:E,title:a?"Pinned. Refining leaves this alone.":"Pin this part so refining leaves it alone.",style:{background:"none",border:"none",padding:0,cursor:E?"default":"pointer",fontSize:10,fontWeight:600,color:a?"#0F9D58":"#999"},children:a?"Pinned":"Pin"}),(0,r.jsx)("button",{onClick:()=>z(C===e.key?null:e.key),disabled:E,title:"Tell dAIvid what is wrong with this part.",style:{background:"none",border:"none",padding:0,cursor:E?"default":"pointer",fontSize:10,fontWeight:600,color:j[e.key]?"#CC7A00":"#999"},children:j[e.key]?"Note added":"Note"})]})]}),(0,r.jsx)("textarea",{value:o,onChange:t=>b(n=>({...n,[e.key]:t.target.value})),disabled:E,rows:o.length>70?2:1,style:{width:"100%",padding:"5px 8px",fontSize:13,lineHeight:"18px",color:"#2F2C28",background:"white",border:"1px solid #e8e5dc",borderRadius:4,outline:"none",resize:"vertical",fontFamily:"inherit"}}),d&&(0,r.jsx)("input",{type:"text",value:null!==(n=j[e.key])&&void 0!==n?n:"",onChange:t=>X(e.key,t.target.value),disabled:E,placeholder:"What is wrong with this part?",style:{width:"100%",marginTop:4,padding:"5px 8px",fontSize:12,color:"#2F2C28",background:"white",border:"1px solid #edba6d",borderRadius:4,outline:"none",fontFamily:"inherit"}})]},e.key)})}),(0,r.jsxs)("div",{style:{borderTop:"1px solid #e8e5dc",paddingTop:10,marginBottom:12},children:[(0,r.jsx)("div",{style:{fontSize:11,fontWeight:600,color:"#999",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},children:"Assembled Versions"}),y.map(e=>{var t,n;let o=null!==(t=g[e.key])&&void 0!==t?t:"",i=(0,p.Ht)(o),l=p.yO[e.key],s=i>l,a=S.includes(e.key);return(0,r.jsxs)("div",{style:{padding:"8px 10px",borderRadius:6,marginBottom:6,background:a?"#f4f9f5":"#faf9f5",borderLeft:"3px solid ".concat(e.color)},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,r.jsx)("span",{style:{fontSize:11,fontWeight:700,color:"#666",textTransform:"uppercase",letterSpacing:"0.5px"},children:e.label}),i>0&&(0,r.jsxs)("span",{style:{fontSize:10,color:s?"#f28a7f":"#999",fontWeight:s?600:"normal"},title:s?"Over the ".concat(l,"-word limit."):void 0,children:[i,"/",l]}),q(e.key)&&(0,r.jsx)("span",{style:{fontSize:10,color:"#3366D4"},children:"your words"}),(0,r.jsxs)("span",{style:{marginLeft:"auto",display:"flex",gap:8},children:[(0,r.jsx)("button",{onClick:()=>Q(e.key),disabled:E,style:{background:"none",border:"none",padding:0,cursor:E?"default":"pointer",fontSize:10,fontWeight:600,color:a?"#0F9D58":"#999"},children:a?"Pinned":"Pin"}),(0,r.jsx)("button",{onClick:()=>z(C===e.key?null:e.key),disabled:E,style:{background:"none",border:"none",padding:0,cursor:E?"default":"pointer",fontSize:10,fontWeight:600,color:j[e.key]?"#CC7A00":"#999"},children:j[e.key]?"Note added":"Note"})]})]}),(0,r.jsx)("textarea",{value:o,onChange:t=>b(n=>({...n,[e.key]:t.target.value})),disabled:E,rows:2,style:{width:"100%",padding:"6px 8px",fontSize:13,lineHeight:"19px",color:"#2F2C28",background:"white",border:"1px solid #e8e5dc",borderRadius:4,outline:"none",resize:"vertical",fontFamily:"inherit"}}
1),(C===e.key||j[e.key])&&(0,r.jsx)("input",{type:"text",value:null!==(n=j[e.key])&&void 0!==n?n:"",onChange:t=>X(e.key,t.target.value),disabled:E,placeholder:"What is wrong with this version?",style:{width:"100%",marginTop:4,padding:"5px 8px",fontSize:12,color:"#2F2C28",background:"white",border:"1px solid #edba6d",borderRadius:4,outline:"none",fontFamily:"inherit"}})]},e.key)})]}),T.length>0&&(0,r.jsxs)("div",{style:{borderTop:"1px solid #e8e5dc",paddingTop:10,marginBottom:12},children:[(0,r.jsx)("div",{style:{fontSize:11,fontWeight:600,color:"#999",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},children:"Your conversation"}),T.map((e,t)=>(0,r.jsxs)("div",{style:{marginBottom:10},children:[(0,r.jsx)("div",{style:{padding:"7px 10px",borderRadius:6,background:"#f5f3ed",fontSize:12,color:"#2F2C28",lineHeight:"17px",whiteSpace:"pre-wrap"},children:e.writer}),e.daivid&&(0,r.jsxs)("div",{style:{padding:"7px 10px",marginTop:4,borderRadius:6,background:"#f0f7ff",border:"1px solid #d0e3f7",fontSize:12,color:"#2F2C28",lineHeight:"17px"},children:[e.daivid,e.changed.length>0&&(0,r.jsxs)("div",{style:{fontSize:10,color:"#999",marginTop:4},children:["Changed: ",e.changed.map(e=>e.replace(/_/g," ")).join(", ")]})]})]},t))]}),O.length>0&&(0,r.jsxs)("div",{style:{padding:"8px 12px",marginBottom:10,borderRadius:6,background:"#f4f9f5",fontSize:12,color:"#2F2C28"},children:["dAIvid tried to change ",O.map(e=>e.replace(/_/g," ")).join(", "),". Your pinned wording was kept."]}),(0,r.jsx)("textarea",{value:B,onChange:e=>A(e.target.value),disabled:E,placeholder:"Anything else you want changed?",style:{width:"100%",padding:"8px 10px",fontSize:13,border:"1px solid #e8e5dc",borderRadius:6,marginBottom:12,minHeight:52,resize:"vertical",outline:"none",fontFamily:"inherit"}}),(0,r.jsxs)("div",{style:{textAlign:"center",marginBottom:12},children:[(0,r.jsx)("div",{style:{fontSize:11,fontWeight:600,color:"#999",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:6},children:"Your rating"}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"center",gap:4},children:[1,2,3,4,5].map(e=>(0,r.jsx)("button",{onClick:()=>L(e),onMouseEnter:()=>P(e),onMouseLeave:()=>P(0),style:{background:"none",border:"none",cursor:"pointer",fontSize:26,color:e<=(H||N)?"#E5A50B":"#ddd",padding:0,lineHeight:1,transition:"color 0.1s"},children:"★"},e))}),(0,r.jsx)("div",{style:{fontSize:11,color:"#999",marginTop:4,height:14},children:1===N?"Poor":2===N?"Fair":3===N?"Good":4===N?"Very good":5===N?"Excellent":"\xa0"})]}),D&&(0,r.jsx)("div",{style:{padding:"8px 12px",marginBottom:10,borderRadius:6,background:"#FFF0EE",color:"#DB4437",fontSize:12,textAlign:"center"},children:D})]}),(0,r.jsxs)("div",{style:{display:"flex",gap:10,maxWidth:440,margin:"0 auto"},children:[(0,r.jsx)("button",{onClick:et,disabled:!$,title:Z?void 0:"Pin a part, add a note, or write what you want changed.",style:{flex:1,padding:"10px 16px",fontSize:14,fontWeight:600,background:"white",color:$?"#2F2C28":"#999",border:"1.5px solid ".concat($?"#2F2C28":"#ddd"),borderRadius:6,cursor:$?"pointer":"default"},children:E?"Refining...":T.length>0?"Send to dAIvid":"Refine with dAIvid"}),(0,r.jsx)("button",{onClick:en,disabled:I||E,style:{flex:1,padding:"10px 16px",fontSize:14,fontWeight:600,background:I||E?"#999":"#0F9D58",color:"white",border:"none",borderRadius:6,cursor:I||E?"wait":"pointer"},children:I?"Adding...":"Add to Library"})]})]})}function v(e){let{pass:t,changed:n,onBack:o}=e,i=[...f.map(e=>({key:e.key,label:e.label,color:e.color})),...y.map(e=>({key:e.key,label:e.label.toUpperCase(),color:e.color}))];return(0,r.jsxs)("div",{style:{marginBottom:12},children:[(0,r.jsxs)("div",{style:{padding:"7px 10px",marginBottom:8,borderRadius:6,background:"#f5f3ed",fontSize:12,color:"#666"},children:[t.label,". ",0===n.length?"Nothing has changed since this version.":"".concat(n.length," part").concat(1===n.length?"":"s"," changed after this: ").concat(n.map(e=>e.replace(/_/g," ")).join(", "),".")," ",(0,r.jsx)("button",{onClick:o,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#3366D4",textDecoration:"underline",fontSize:12},children:"Back to current"})]}),i.map(e=>{var o;let i=String(null!==(o=t.breakdown[e.key])&&void 0!==o?o:""),l=n.includes(e.ke
1y);return(0,r.jsxs)("div",{style:{padding:"6px 10px",marginBottom:4,borderRadius:6,borderLeft:"3px solid ".concat(e.color),background:l?"#FFF8EE":"#faf9f5"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,r.jsx)("span",{style:{fontSize:10,fontWeight:700,color:e.color,textTransform:"uppercase",letterSpacing:"0.5px"},children:e.label}),l&&(0,r.jsx)("span",{style:{fontSize:10,color:"#CC7A00"},children:"changed since"})]}),(0,r.jsx)("div",{style:{fontSize:13,color:"#2F2C28",lineHeight:"18px"},children:i||(0,r.jsx)("span",{style:{color:"#ccc",fontStyle:"italic"},children:"Empty"})})]},e.key)})]})}function S(e){let{onClose:t,onUseAsReference:n}=e,[l,a]=(0,o.useState)({type:"browse"}),[d,p]=(0,o.useState)([]),[u,g]=(0,o.useState)([]),[h,f]=(0,o.useState)(!0),[y,x]=(0,o.useState)("library"),[m,v]=(0,o.useState)(null),S=(0,o.useCallback)(async()=>{try{let n=await fetch("/api/logline-library");if(n.ok){var e,t;let r=await n.json();p(null!==(e=r.approved)&&void 0!==e?e:[]),g(null!==(t=r.mySubmissions)&&void 0!==t?t:[])}}catch(e){}},[]);(0,o.useEffect)(()=>{let e=sessionStorage.getItem("sw-logline-proposal-result");if(e)try{let t=JSON.parse(e);if("ready"===t.status&&t.result){let{breakdown:e,confidence:n,correctedTitle:r,evaluation:o,revisionHistory:i}=t.result;a({type:"review",breakdown:e,formData:{title:r||t.title,note:""},confidence:n,evaluation:null!=o?o:null,revisionHistory:Array.isArray(i)?i:null}),sessionStorage.removeItem("sw-logline-proposal-result");return}}catch(e){}let t=sessionStorage.getItem("sw-logline-proposal");if(t)try{let{id:e,title:n}=JSON.parse(t);v({id:e,title:n}),a({type:"submit"})}catch(e){}},[]),(0,o.useEffect)(()=>{(async()=>{await S(),f(!1)})()},[S]),(0,o.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.preventDefault(),"browse"!==l.type&&"my-submissions"!==l.type?a({type:"my-submissions"===y?"my-submissions":"browse"}):t())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l.type,y,t]);let j=(0,o.useCallback)(e=>{a({type:"detail",entry:e})},[]),k=(0,o.useCallback)(e=>{null==n||n(e),t()},[n,t]),C=(0,o.useCallback)((e,t,n,r,o)=>{v(null),a({type:"review",breakdown:e,formData:t,confidence:n,evaluation:null!=r?r:null,revisionHistory:null!=o?o:null})},[]),z=(0,o.useCallback)(()=>{a({type:"confirmation"}),S()},[S]),T=(0,o.useCallback)((e,t)=>{a(n=>"review"!==n.type?n:{...n,breakdown:e,evaluation:t})},[]),F=(0,o.useCallback)(async e=>{let t=u.findIndex(t=>t.id===e),n=-1===t?void 0:u[t];g(t=>t.filter(t=>t.id!==e));try{let t=await fetch("/api/logline-library?id=".concat(e),{method:"DELETE"});if(!t.ok)throw Error("delete failed: ".concat(t.status))}catch(e){n&&g(e=>[...e.slice(0,t),n,...e.slice(t)])}},[u]);return(0,i.createPortal)((0,r.jsx)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>{("browse"===l.type||"my-submissions"===l.type||"confirmation"===l.type)&&t()},children:(0,r.jsx)("div",{className:"rounded-xl shadow-xl overflow-hidden",style:{background:"linear-gradient(to right, #DB4437, #CC7A00, #F4B400, #0F9D58, #3366D4, #5E35B1, #9C5EC7)",width:"90%",maxWidth:900,height:"85vh",maxHeight:760},onClick:e=>e.stopPropagation(),children:(0,r.jsxs)("div",{className:"bg-white flex flex-col",style:{margin:"5px 1px 1px 1px",height:"calc(100% - 6px)",borderRadius:"9px 9px 11px 11px"},children:[(0,r.jsxs)("div",{style:{padding:"16px 20px",borderBottom:"1px solid #e8e5dc",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12},children:["browse"!==l.type&&"my-submissions"!==l.type&&(0,r.jsx)("button",{onClick:()=>a({type:"my-submissions"===y?"my-submissions":"browse"}),style:{background:"none",border:"none",cursor:"pointer",fontSize:18,color:"#999",padding:"0 4px"},title:"my-submissions"===y?"Back to submissions":"Back to library",children:"←"}),(0,r.jsx)("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"#2F2C28"},children:"submit"===l.type?"Add a Story":"review"===l.type?l.formData.title:"confirmation"===l.type?"Added!":"detail"===l.type?l.entry.title:"Logline Library"})]}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12}
1,children:[("browse"===l.type||"my-submissions"===l.type)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{style:{display:"flex",gap:4,background:"#f5f3ed",borderRadius:6,padding:2},children:[(0,r.jsx)("button",{onClick:()=>{x("library"),a({type:"browse"})},style:{padding:"4px 10px",fontSize:12,fontWeight:500,border:"none",borderRadius:4,cursor:"pointer",background:"library"===y?"white":"transparent",color:"library"===y?"#2F2C28":"#999",boxShadow:"library"===y?"0 1px 2px rgba(0,0,0,0.08)":"none"},children:"Library"}),(0,r.jsxs)("button",{onClick:()=>{x("my-submissions"),a({type:"my-submissions"})},style:{padding:"4px 10px",fontSize:12,fontWeight:500,border:"none",borderRadius:4,cursor:"pointer",background:"my-submissions"===y?"white":"transparent",color:"my-submissions"===y?"#2F2C28":"#999",boxShadow:"my-submissions"===y?"0 1px 2px rgba(0,0,0,0.08)":"none"},children:["My Submissions",u.length>0?" (".concat(u.length,")"):""]})]}),(0,r.jsx)("button",{onClick:()=>a({type:"submit"}),style:{padding:"6px 14px",fontSize:12,fontWeight:600,background:"#2F2C28",color:"white",border:"none",borderRadius:6,cursor:"pointer"},children:"+ Add a Story"})]}),(0,r.jsx)("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:20,color:"#999",padding:"0 4px",lineHeight:1},children:"\xd7"})]})]}),(0,r.jsx)("div",{style:{flex:1,overflow:"hidden"},children:h?(0,r.jsx)("div",{style:{padding:40,textAlign:"center",color:"#999",fontSize:13},children:"Loading library..."}
1):"browse"===l.type?(0,r.jsx)(s,{entries:d,onSelectEntry:j}):"my-submissions"===l.type?(0,r.jsx)(s,{entries:u,onSelectEntry:j,onDismiss:F,emptyMessage:"You haven't added any stories yet.",hideFilters:!0}):"detail"===l.type?(0,r.jsx)(c,{entry:l.entry,onUseAsReference:k}):"submit"===l.type?(0,r.jsx)(w,{onResult:C,onClose:t,activeProposal:m}):"review"===l.type?(0,r.jsx)(b,{breakdown:l.breakdown,formData:l.formData,confidence:l.confidence,evaluation:l.evaluation,revisionHistory:l.revisionHistory,onSubmitComplete:z,onUpdateBreakdown:T}):"confirmation"===l.type?(0,r.jsxs)("div",{style:{padding:60,textAlign:"center"},children:[(0,r.jsx)("div",{style:{fontSize:40,marginBottom:16},children:"✓"}),(0,r.jsx)("h3",{style:{margin:"0 0 8px",fontSize:18,fontWeight:600,color:"#2F2C28"},children:"Story added"}),(0,r.jsx)("p",{style:{margin:"0 0 24px",fontSize:14,color:"#666",maxWidth:400,marginLeft:"auto",marginRight:"auto"},children:"dAIvid's logline breakdown is now in review. Once approved, it will appear in the library for all writers."}),(0,r.jsx)("button",{onClick:()=>{x("my-submissions"),a({type:"my-submissions"})},style:{padding:"8px 24px",fontSize:13,fontWeight:600,background:"#2F2C28",color:"white",border:"none",borderRadius:6,cursor:"pointer"},children:"View My Submissions"})]}):null})]})})}),document.body)}function w(e){var t,n;let{onResult:i,onClose:l,activeProposal:s}=e,[a,d]=(0,o.useState)(null!==(t=null==s?void 0:s.title)&&void 0!==t?t:""),[c,p]=(0,o.useState)(""),[u,g]=(0,o.useState)(""),[h,f]=(0,o.useState)(null!==(n=null==s?void 0:s.id)&&void 0!==n?n:null),[y,x]=(0,o.useState)(!!s),[m,b]=(0,o.useState)(""),v=(0,o.useRef)(null),S=()=>!!sessionStorage.getItem("sw-logline-proposal"),w=async()=>{if(!a.trim()){b("Title is required.");return}if(S()){b("An analysis is already in progress.");return}x(!0),b("");try{let e=await fetch("/api/logline-library/propose",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a.trim(),note:c.trim()||void 0,rawDescription:u.trim()||void 0})}),t=await e.json();if(!e.ok){b(t.error||t.message||"Failed to start analysis."),x(!1);return}f(t.proposalId),sessionStorage.setItem("sw-logline-proposal",JSON.stringify({id:t.proposalId,title:a.trim(),createdAt:new Date().toISOString()})),window.dispatchEvent(new Event("sw-logline-proposal-started"))}catch(e){b("Network error. Please try again."),x(!1)}};return(0,o.useEffect)(()=>{if(!h)return;let e=async()=>{try{let e=await fetch("/api/logline-library/proposal/".concat(h));if(!e.ok)return;let t=await e.json();if("ready"===t.status){v.current&&(clearInterval(v.current),v.current=null),x(!1),sessionStorage.removeItem("sw-logline-proposal"),sessionStorage.removeItem("sw-logline-proposal-result");let{breakdown:e,confidence:n,correctedTitle:r,evaluation:o,revisionHistory:l}=t.result;i(e,{title:r||a.trim(),note:c.trim()},n,null!=o?o:null,Array.isArray(l)?l:null)}else"failed"===t.status&&(v.current&&(clearInterval(v.current),v.current=null),x(!1),sessionStorage.removeItem("sw-logline-proposal"),b(t.error||"Analysis failed. Please try again."))}catch(e){}};return e(),v.current=setInterval(e,3e3),()=>{v.current&&(clearInterval(v.current),v.current=null)}},[h]),(0,r.jsxs)("div",{style:{padding:24,overflowY:"auto",height:"100%",maxWidth:520,margin:"0 auto"},children:[(0,r.jsx)("p",{style:{fontSize:13,color:"#666",marginTop:0,marginBottom:24},children:"Enter a story title and dAIvid will break down its logline using the 7-part formula. You can review the results before adding it to the library."}),(0,r.jsx)("label",{style:j,children:"Title *"}),(0,r.jsx)("input",{type:"text",value:a,onChange:e=>{d(e.target.value),m&&b("")},placeholder:"e.g. The Godfather, Fleabag, Hamilton...",style:k,autoFocus:!0,disabled:y}),(0,r.jsx)("label",{style:j,children:"Description (optional, and it helps)"}),(0,r.jsx)("textarea",{value:u,onChange:e=>g(e.target.value),placeholder:"Paste a summary or a logline from anywhere. dAIvid builds from it instead of from memory, and the breakdown comes back sharper.",style:{...k,minHeight:72,resize:"vertical"},disabled:y}),(0,r.jsx)("label",{style:j,children:"Context (optional)"}),(0,r.jsx)("textarea",{value:c,onChange:e=>p(e.target.value),placeholder:"Any context for dAIvid — e.g. 'it's the 2024 film', 'focus on the first book', 'the protagonist is the mother'...",style:{...k,minHeight:60,resize:"vertical"},disabled:y}),m&&(0,r.jsx)("div",{style:{padding:"8px 12px",marginBottom:12,borderRadius:6,background:"#FFF0EE",color:"#DB4437",fontSize:12},children:m}),(0,r.jsx)("button",{onClick:w,disabled:y,style:{width:"100%",padding:"10px 20px",fontSize:14,fontWeight:600,background:y?"#999":"#2F2C28",color:"white",border:"none",borderRadius:6,cursor:y?"wait":"pointer"},children:y?"Analyzing...":"Analyze Logline"}),y&&(0,r.jsxs)("div",{style:{textAlign:"center",marginTop:12},children:[(0,r.jsx)("p",{style:{fontSize:12,color:"#999",margin:0},children:"This usually takes 20-40 seconds."}),(0,r.jsx)("button",{onClick:l,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,color:"#0F9D58",textDecoration:"underline",marginTop:4,padding:0},children:"Close and keep working — we'll notify you when it's ready"})]})]})}let j={display:"block",fontSize:11,fontWeight:600,color:"#999",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:4},k={width:"100%",padding:"8px 10px",fontSize:13,border:"1px solid #e8e5dc",borderRadius:6,marginBottom:16,outline:"none",fontFamily:"inherit"}}}]);

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.