PageSourceSearch

https://www.k-startup.ai/_next/static/chunks/14602.a1391159b3058798.js

js k-startup.ai collected 2026-10-05 12:23:20 UTC 111,825 bytes, 31 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[14602,63821],{127:(e,t,i)=>{i.d(t,{A:()=>a});let a=(0,i(78340).A)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]])},484:(e,t,i)=>{i.d(t,{A:()=>a});let a=(0,i(78340).A)("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]])},1933:(e,t,i)=>{i.d(t,{jH:()=>s});var a=i(12115);i(95155);var l=a.createContext(void 0);function s(e){let t=a.useContext(l);return e||t||"ltr"}},18349:(e,t,i)=>{i.d(t,{T:()=>s});var a=i(95155);i(12115);var l=i(40980);function s({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,l.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}},18837:(e,t,i)=>{i.d(t,{A:()=>a});let a=(0,i(78340).A)("table-2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]])},35942:(e,t,i)=>{i.d(t,{F:()=>r});var a=i(95155);i(12115);var l=i(89349),s=i(40980);function r({className:e,children:t,...i}){return(0,a.jsxs)(l.Root,{"data-slot":"scroll-area",className:(0,s.cn)("relative",e),...i,children:[(0,a.jsx)(l.Viewport,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),(0,a.jsx)(n,{}),(0,a.jsx)(l.Corner,{})]})}function n({className:e,orientation:t="vertical",...i}){return(0,a.jsx)(l.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,s.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...i,children:(0,a.jsx)(l.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}},49374:(e,t,i)=>{i.d(t,{Nv:()=>l,O4:()=>a,XL:()=>n,Yy:()=>r,eA:()=>s});let a=[".png",".jpg",".jpeg",".webp"],l=[".pdf",".docx",".txt",".md",".hwp",".hwpx",...a],s=l.join(","),r="PDF, DOCX, HWP, HWPX, TXT, MD, 이미지",n=e=>{let t=e.toLowerCase();return l.some(e=>t.endsWith(e))}},56558:(e,t,i)=>{i.d(t,{A:()=>a});let a=(0,i(78340).A)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]])},63821:(e,t,i)=>{i.r(t),i.d(t,{captureInfographicAsPng:()=>s,copyInfographicAsPng:()=>n,downloadInfographicAsPng:()=>r});var a=i(91992),l=i(6253);async function s(e){let t=(await i.e(69691).then(i.bind(i,55678))).default,l=document.createElement("div");l.style.cssText="position:fixed;top:0;left:0;width:640px;z-index:-9999;opacity:0;pointer-events:none;background:#ffffff;",l.innerHTML=a.default.sanitize(e,{ADD_TAGS:["img"],ADD_ATTR:["style","data-field-type","data-infographic-type","data-infographic-config","src"]}),document.body.appendChild(l),await new Promise(e=>setTimeout(e,120));try{let e=l.firstElementChild;return(await t(e,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff"})).toDataURL("image/png")}finally{document.body.removeChild(l)}}async function r(e,t){let i=await s(e);(0,l.P)(i,t)}async function n(e){let t=await s(e),i=await fetch(t),a=await i.blob();await navigator.clipboard.write([new ClipboardItem({"image/png":a})])}},66088:(e,t,i)=>{i.d(t,{A:()=>a});let a=(0,i(78340).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},77074:(e,t,i)=>{i.r(t),i.d(t,{AIChatSidebar:()=>eo});var a=i(95155),l=i(37206),s=i(12115),r=i(33210),n=i(56558),o=i(127),d=i(6296),c=i(48368),u=i(53961),m=i(66088),p=i(89123),h=i(14780),g=i(18837),f=i(484),b=i(94514),x=i(67635),y=i(34220),v=i(6962),w=i(56204),j=i(89239),k=i(18349),N=i(35942),$=i(70872),I=i(80642),_=i(82293),C=i(28713),A=i(92506),S=i(97444),D=i(13159),M=i(30926),q=i(94719),P=i(34193);let T=[/^budget/i,/^schedule/i,/기간$/,/일정/,/금액$/,/비용$/,/예산/,/^retry-.*count/,/지원.*분야/,/분야.*택/,/해당여부/],O=e=>T.some(t=>t.test(e)),K=e=>e.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim();async function L(e,t,i,a,l,s,r,n,o){let d,c,u,m=e.map(e=>e.fieldHint).filter(e=>!!e);if(m.length>0){let e=new Set(m);for(let t of m){let i=t.split("-")[0],a=`${i}-content`;l.includes(a)&&e.add(a)}d=l.filter(t=>e.has(t)),c=s.filter(t=>e.has(t.fieldId)),u=Object.fromEntries(Object.entries(r).filter(([t])=>e.has(t))),0===d.length&&(d=l,c=s,u=r)}else d=l,c=s,u=r;let p=function(e,t,i,a){let l="functional"===t?3e3:1500,s="functional"===t?2:3,r=new Set(e.map(e=>e.fieldHint).filter(e=>!!e)),n=e.map((e,i)=>{let a="enhancement"===t&&"functional"===e.subtype,l=a?"[⚡ 단순 수정]":"functional"===t?"":"[✨ 내용 보강]",s=`${i+1}. ${l?l+" ":""}${e.issue}`;return e.fieldHint&&(s+=`
2   → 대상 필드: ${e.fieldHint}`),e.snippet&&(s+=`
3   → 원문에서 찾을 텍스트: "${e.snippet}"`),a&&(s+=`
4   ⚠️ 이 이슈는 단순 수정입니다: 해당 텍스트를 삭제/교정만 하세요. 새 내용 추가나 풀어쓰기 금지.`),s}),o=i.filter(e=>e.strengths&&e.strengths.length>0).map(e=>`### ${e.sectionName}
5${e.strengths?.map(e=>`- ${e}`).join("\n")||""}`).join("\n\n"),d="",c="";if(r.size>0){let i=Object.entries(a).filter(([e])=>r.has(e)),n=i.filter(([e])=>!e.endsWith("-content"));n.length>0&&(d=n.map(([t,i])=>{let l=i&&i.trim().length>0?i.trim():"(현재 비어있음)",s=e.find(e=>e.fieldHint===t),r=s?.snippet?`
6   원문 스니펫: "${s.snippet}"`:"",n=t.split("-"),o="";if(n.length>=3){let e=n.slice(0,-1).join("-"),i=Object.entries(a).filter(([i,a])=>i!==t&&i.startsWith(e)&&!i.endsWith("-content")&&a&&a.trim().length>0).slice(0,5);i.length>0&&(o="\n   \uD83D\uDCCE 같은 행의 참조 데이터:\n"+i.map(([e,t])=>`      - ${e}: "${t.trim()}"`).join("\n"))}return`- **${t}**: "${l}"${r}${o}`}).join("\n")),c="functional"===t?i.filter(([e,t])=>e.endsWith("-content")&&t&&t.trim().length>0).slice(0,s).map(([t,i])=>{let a=e.filter(e=>e.fieldHint===t&&e.snippet).map(e=>e.snippet);if(a.length>0){let e=a.map(e=>{let t=i.indexOf(e);if(-1===t)return`(스니펫 위치 불명)
7전체 원문 (처음 2000자):
8${i.slice(0,2e3)}`;let a=Math.max(0,t-150),l=Math.min(i.length,t+e.length+150);return`...${i.slice(a,l)}...`});return`### ${t}
9원문 스니펫 주변 컨텍스트:
10${e.join("\n---\n")}`}return`### ${t}
11${i.slice(0,2e3)}${i.length>2e3?"\n...(이하 생략)":""}`}).join("\n\n"):i.filter(([e,t])=>e.endsWith("-content")&&t&&t.trim().length>0).slice(0,s).map(([e,t])=>`### ${e}
12${t.slice(0,l)}${t.length>l?"\n...(이하 생략)":""}`).join("\n\n")}else c=Object.entries(a).filter(([e,t])=>t&&t.trim().length>0&&e.endsWith("-content")).slice(0,2).map(([e,t])=>`### ${e}
13${t.slice(0,l)}${t.length>l?"\n...(이하 생략)":""}`).join("\n\n");return[`## ★ 수정 모드: ${"functional"===t?"기능적 수정 (단순 삭제/교정만)":"내용 보강 (텍스트 품질 향상)"}`,"",...o?[`## ★ 현재 문서의 강점 (절대 삭제/약화 금지!)`,`아래는 현재 문서에서 **점수에 긍정적으로 기여한 구체적 요소**입니다.`,`⛔ **개선 과정에서 이 강점들을 절대 손상시키지 마세요.**`,`⛔ 강점에 명시된 요소(구체적 수치, 출처, 근거 등)를 삭제하거나 약화시키면 안 됩니다.`,"",o,""]:[],...n.length>0?[`## ★ 이번에 수정해야 할 지적사항 (이것만 수정하세요!)`,...o?[`위 강점은 유지하면서, 아래 지적사항만 수정하세요.`]:[`아래 나열된 지적사항만 수정하세요. 이 목록에 없는 문제는 절대 수정하지 마세요.`],...r.size>0?[`각 지적사항의 "대상 필드"와 "원문에서 찾을 텍스트"가 명시되어 있으니 해당 위치만 정확히 수정하세요.`]:[],n.join("\n"),""]:[],...d?[`## ★ 표(table) 필드 수정 대상 (개별 셀 값)`,`아래는 표(table) 안의 개별 셀 값입니다. 각 필드 ID와 현재 값이 표시되어 있습니다.`,..."functional"===t?[`⚠️ 지적사항에 해당하는 값만 수정하세요. 잘못된 값을 올바른 값
13으로 교체하거나 부적절한 값을 삭제하세요.`,`⛔ 지적사항과 무관한 셀은 절대 변경하지 마세요.`,`⛔ 기존 값을 풀어쓰거나 설명을 추가하거나 확장하면 안 됩니다. 교체/삭제만 허용됩니다.`]:[`⚠️ 지적사항에 해당하는 값만 보강하세요. 기존 내용은 최대한 유지합니다.`],d,""]:[],...c?[`## ★ 본문(richtext) 필드 수정 대상`,..."functional"===t?[`아래는 수정 대상 본문 필드의 **스니펫 주변 컨텍스트**입니다.`,`⚠️ richtext 필드는 "_functional_ops"로 find/replace 지시를 출력하세요. 전체 텍스트를 복사하지 마세요.`,`⚠️ "find"에는 아래 원문에서 정확히 일치하는 텍스트를 사용하세요.`]:[`아래는 수정해야 할 본문 필드의 **현재 원문**입니다.`,`⚠️ 각 지적사항이 '추가/보충(A)', '재작성(B)', '부분 수정(C)' 중 어느 유형인지 먼저 판단하세요.`,`📌 추가/보충(A): 기존 원문 전체 유지 + 관련 위치에 새 내용 삽입. 기존 대계층(□) 삭제 금지.`,`📌 재작성(B): 해당 대계층(□)/중계층(ㅇ) 범위만 재작성. 다른 대계층은 원문 유지.`,`📌 부분 수정(C): 해당 문장/문단만 수정. 나머지 원문 유지.`],c,""]:[]].join("\n")}(e,t,i,a),h=await o.buildAuthHeaders(),g=await fetch("/api/quick-fill",{method:"POST",headers:h,body:JSON.stringify({programId:o.programId,programName:o.programName,sectionKey:n.join("+"),sectionLabel:"functional"===t?"기능적 수정":"내용 보강",variants:["A"],fieldIds:d,fieldDefs:c,checkboxOptionsByFieldId:u,existingContent:"",selectedPreview:"",improvementContext:p,improvementMode:t})}),f=await g.json().catch(()=>({}));if(!g.ok)return 401===g.status?{ok:!1,fieldMap:{},changeReasons:{},error:{type:"auth_error"}}:429===g.status?{ok:!1,fieldMap:{},changeReasons:{},error:{type:"quota_error",data:{day:f.day??null,generationLimitPerDay:Number(f.generationLimitPerDay||1),chatLimitPerDay:Number(f.chatLimitPerDay||3),interviewCount:Number(f.interviewCount||0),quickCount:Number(f.quickCount||0),chatCount:Number(f.chatCount||0),exceeded:"generation"===f.exceeded?"generation":"chat",canRedeemFeedback:!!f.canRedeemFeedback}}}:{ok:!1,fieldMap:{},changeReasons:{},error:{type:"error",message:"string"==typeof f?.error?f.error:"오류가 발생했습니다."}};let b=f?.fieldMapByVariant?.A||f?.fieldMap||{},x=f?.functionalOps&&"object"==typeof f.functionalOps?f.functionalOps:{};if("functional"===t&&Object.keys(x).length>0)for(let[e,t]of Object.entries(x)){if(!Array.isArray(t)||0===t.length)continue;let i=a[e];if(!i||0===i.trim().length)continue;let l=i;for(let e of t)if("string"==typeof e.find&&"string"==typeof e.replace&&0!==e.find.length)if(l.includes(e.find))l=l.replace(e.find,e.replace);else{let t=e.find.replace(/\s+/g,"\\s+");try{let i=RegExp(t,"g");l=l.replace(i,e.replace)}catch{}}K(l=l.replace(/\n{3,}/g,"\n\n").replace(/ {2,}/g," ").trim())!==K(i)&&(b[e]=l)}let y=Object.keys(b).filter(e=>d.includes(e)&&"string"==typeof b[e]),v=f?.changeReasons&&"object"==typeof f.changeReasons?f.changeReasons:{},w=Object.keys(v).length>0,j=new Set(e.map(e=>e.fieldHint).filter(e=>!!e)),k=new Set(Object.keys(x)),N={},$={};for(let t of y){if(O(t)&&!j.has(t))continue;let i=K(a[t]||""),l=K(b[t]||"");if((0!==i.length||!(l.length>0)||j.has(t))&&i!==l&&0!==l.length&&(!w||v[t]||k.has(t))&&(N[t]=b[t],v[t]&&($[t]=v[t]),!v[t]&&k.has(t))){let i=e.filter(e=>e.fieldHint===t).map(e=>e.issue).join("; ");$[t]=`[유형A] 기능적 수정: ${i.slice(0,100)}`}}return{ok:!0,fieldMap:N,changeReasons:$}}async function z(e,t){let i,a=e.issues.filter(e=>"improve"===e.type),l=new Set(a.filter(e=>"functional"!==e.subtype).map(e=>e.fieldHint).filter(e=>!!e)),s=[],r=[];for(let e of a.filter(e=>"functional"===e.subtype))e.fieldHint&&l.has(e.fieldHint)?r.push(e):s.push(e);let n=[...a.filter(e=>"functional"!==e.subtype),...r],o=function(e,t,i){let a=new Set(e.map(e=>e.sectionId).filter(e=>!!e));for(let t of e)if(t.fieldHint){let e=t.fieldHint.split("-")[0];e&&a.add(e)}let l=a.size>0?t.filter(e=>a.has(e.sectionId)):t.filter(e=>e.score/e.maxScore<.8),s=i.quickActions.length>0?i.quickActions:[],r=new Set(l.map(e=>e.sectionId)),n=s.filter(e=>e.sectionKeys.some(e=>r.has(e))),o=n.length>0?n:s,d=Array.from(new Set(o.flatMap(e=>e.sectionKeys))),c=Array.from(new Set(o.flatMap(e=>
13e.fieldIds||[]))),u={id:"improvement_merged",label:"합격 가능성 개선",prompt:o.map(e=>e.prompt).join(" "),sectionKeys:d,fieldIds:c},{fieldIds:m,fieldDefs:p,labelMap:h,checkboxOptionsByFieldId:g}=i.collectFieldsForAction(u),f=i.extractBeforeMap(m,p);return{sectionsToImprove:l,mergedSectionKeys:d,baseFieldIds:m,fieldDefs:p,labelMap:h,checkboxOptionsByFieldId:g,beforeMap:f}}(a,e.allSections,t);if(!o.baseFieldIds||0===o.baseFieldIds.length)return{type:"no_fields"};let d={},c={},u={};if(s.length>0){let e=await L(s,"functional",o.sectionsToImprove,o.beforeMap,o.baseFieldIds,o.fieldDefs,o.checkboxOptionsByFieldId,o.mergedSectionKeys,t);if(!e.ok&&e.error)return e.error;for(let t of(Object.assign(d,e.fieldMap),Object.assign(c,e.changeReasons),Object.keys(e.fieldMap)))u[t]="functional"}if(n.length>0){let e=await L(n,"enhancement",o.sectionsToImprove,o.beforeMap,o.baseFieldIds,o.fieldDefs,o.checkboxOptionsByFieldId,o.mergedSectionKeys,t);if(!e.ok&&e.error)return e.error;for(let t of(Object.assign(d,e.fieldMap),Object.assign(c,e.changeReasons),Object.keys(e.fieldMap)))u[t]="enhancement"}let m=Object.keys(d),p=Math.max(5*a.length,10);if(m.length>p)return{type:"success",fieldMap:{},beforeMap:{},labelMap:{},changeReasons:{},fieldDefs:[],sections:o.sectionsToImprove.map(e=>({sectionId:e.sectionId,sectionName:e.sectionName,score:e.score,maxScore:e.maxScore,isImproveTarget:!0})),summary:`지적사항(${a.length}개) 대비 변경 범위가 너무 넓어(${m.length}개) 자동 적용하지 않았습니다.`};let h={},g={};for(let e of m)h[e]=o.beforeMap[e]||"",g[e]=o.labelMap[e]||t.deriveLabelFromFieldId(e);let f=m.slice(0,10).map(e=>{let t=c[e];return t?`- ${g[e]}: ${t}`:`- ${g[e]}: ${(d[e]||"").slice(0,80)}`}).join("\n");if(m.length>0){let e=a.filter(e=>"functional"===e.subtype).length,t=a.filter(e=>"functional"!==e.subtype).length,l=e>0&&t>0?` (단순 수정 ${e}건 + 내용 보강 ${t}건)`:e>0?` (단순 수정 ${e}건)`:` (내용 보강 ${t}건)`;i=`${m.length}개 필드가 개선되었습니다.${l}
14${f}`}else i="개선할 수 있는 항목이 없습니다. 문서 내용을 확인한 후 다시 시도해주세요.";return{type:"success",fieldMap:d,beforeMap:h,labelMap:g,changeReasons:c,fieldModes:u,fieldDefs:o.fieldDefs.filter(e=>m.includes(e.fieldId)),sections:o.sectionsToImprove.map(e=>({sectionId:e.sectionId,sectionName:e.sectionName,score:e.score,maxScore:e.maxScore,isImproveTarget:!0})),summary:i}}async function E(e,t){let i=t.quickActions.length>0?t.quickActions:[],a=Array.from(new Set(i.flatMap(e=>e.sectionKeys))),l=Array.from(new Set(i.flatMap(e=>e.fieldIds||[]))),s={id:"data_supplement",label:"추가 정보 반영",prompt:i.map(e=>e.prompt).join(" "),sectionKeys:a,fieldIds:l},{fieldIds:r,fieldDefs:n,labelMap:o,checkboxOptionsByFieldId:d}=t.collectFieldsForAction(s),c=t.extractBeforeMap(r,n);if(!r||0===r.length)return{type:"no_fields"};let u=Object.entries(c).filter(([,e])=>e&&e.trim().length>0).slice(0,40).map(([e,t])=>`- ${e}: ${t.slice(0,300)}`).join("\n"),m=[`## 사용자 답변`,e.userAnswersText,"",...u?[`## 현재 필드 값 (변경하지 마세요 — 답변 관련 필드만 수정)`,u]:[]].join("\n"),p=await t.buildAuthHeaders(),h=await fetch("/api/quick-fill",{method:"POST",headers:p,body:JSON.stringify({programId:t.programId,programName:t.programName,sectionKey:a.join("+"),sectionLabel:"추가 정보 반영",variants:["A"],fieldIds:r,fieldDefs:n,checkboxOptionsByFieldId:d,existingContent:t.buildMeaningfulContext([]),selectedPreview:"",dataSupplementContext:m})}),g=await h.json().catch(()=>({}));if(!h.ok)return 401===h.status?{type:"auth_error"}:429===h.status?{type:"quota_error",data:{day:g.day??null,generationLimitPerDay:Number(g.generationLimitPerDay||1),chatLimitPerDay:Number(g.chatLimitPerDay||3),interviewCount:Number(g.interviewCount||0),quickCount:Number(g.quickCount||0),chatCount:Number(g.chatCount||0),exceeded:"generation"===g.exceeded?"generation":"chat",canRedeemFeedback:!!g.canRedeemFeedback}}:{type:"error",message:"string"==typeof g?.error?g.error:"오류가 발생했습니다. 다시 시도해주세요."};let f=g?.fieldMapByVariant?.A||g?.fieldMap||{},b=Object.keys(f).filter(e=>r.includes(e)&&"string"==typeof f[e]),x=e=>e.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim(),y=b.filter(e=>{let t=x(c[e]||""),i=x(f[e]||"");return t!==i&&i.length>0}),v={},w={},j={};for(let e of y)v[e]=f[e],w[e]=c[e]||"",j[e]=o[e]||t.deriveLabelFromFieldId(e);let k=y.slice(0,10).map(e=>`- ${j[e]}: ${(f[e]||"").slice(0,80)}`).join("\n"),N=`${y.length}개 필드가 보완되었습니다.
15${k||"(변경 없음)"}`;return{type:"success",fieldMap:v,beforeMap:w,labelMap:j,fieldDefs:n.filter(e=>y.includes(e.fieldId)),summary:N,changedCount:y.length,questions:e.questions}}var F=i(91992),B=i(66609),H=i(41242),R=i(59120),W=i(63821),V=i(63310),X=i(49374);let G=(0,l.default)(()=>Promise.all([i.e(64831),i.e(42695),i.e(88613),i.e(74133)]).then(i.bind(i,74133)).then(e=>
15e.BusinessAssetInsertPanel),{loadableGenerated:{webpack:()=>[74133]},ssr:!1}),U={"tam-sam-som":"시장 규모","competitive-matrix":"경쟁 포지셔닝",roadmap:"실행 로드맵","tech-architecture":"기술 구성"},J={ADD_TAGS:["img"],ADD_ATTR:["alt","aria-label","class","data-field-type","data-infographic-caption","data-infographic-config","data-infographic-editable","data-infographic-type","role","src","style"]},Z={"tam-sam-som":{type:"tam-sam-som",version:1,layout:"horizontal",theme:"blue",tam:{label:"전체 시장",value:"12조",description:"지원하려는 산업의 전체 수요"},sam:{label:"진입 가능 시장",value:"1.8조",description:"초기 타깃 고객과 채널 기준"},som:{label:"첫 목표 시장",value:"120억",description:"1차 사업화 기간 내 확보 목표"}},"competitive-matrix":{type:"competitive-matrix",version:1,layout:"quadrant",theme:"blue",xAxis:{label:"실행 가능성",lowLabel:"낮음",highLabel:"높음"},yAxis:{label:"차별성",lowLabel:"낮음",highLabel:"높음"},competitors:[{id:"legacy",name:"기존 대안",x:62,y:48,isUs:!1},{id:"offline",name:"오프라인 방식",x:35,y:38,isUs:!1},{id:"us",name:"우리 아이템",x:78,y:76,isUs:!0}]},roadmap:{type:"roadmap",version:1,layout:"compact",theme:"blue",milestones:[{id:"mvp",period:"1개월",title:"MVP 정리",description:"핵심 기능과 고객 검증 범위를 확정",status:"planned"},{id:"pilot",period:"2개월",title:"파일럿 검증",description:"초기 고객 반응과 전환 지표 수집",status:"planned"},{id:"scale",period:"3개월",title:"사업화 확장",description:"제휴/마케팅 채널을 통한 반복 판매 구조 검증",status:"planned"}]},"tech-architecture":{type:"tech-architecture",version:1,layout:"grid",theme:"blue",components:[{id:"user",componentType:"user",name:"사용자",description:"고객 입력과 피드백"},{id:"service",componentType:"service",name:"서비스",description:"핵심 기능 제공"},{id:"data",componentType:"data",name:"데이터",description:"운영 지표와 학습 데이터"}]}};function Q(e){if("welcome"===e.id)return null;let t="";switch(e.kind){case"text":t=e.content;break;case"blocks":t=[e.title,...e.blocks.map(e=>`${e.label}: ${e.content}`)].join("\n");break;case"quick_options":{let i=e.options.filter(t=>t.applied||t.id===e.appliedOptionId),a=Array.from(new Map((i.length>0?i:e.options).map(e=>[e.id,e])).values());t=[e.title,...a.map(e=>`${e.title}: ${e.content}`)].join("\n");break}case"data_questions":t=e.questions.map(e=>`${e.issue}: ${e.question}`).join("\n");break;case"cell_results":t=e.cells.map(e=>`표 ${e.row+1}행 ${e.col+1}열: ${e.content}`).join("\n");break;case"table_structure":t=e.rows.map(e=>e.map(e=>e.content).join(" | ")).join("\n");break;case"infographic":{let i=e.html.match(/data-infographic-type=["']([^"']+)["']/i)?.[1],a=i&&i in U?U[i]:"사업 시각화",l=e.html.replace(/<(script|style|template|noscript)\b[^>]*>[\s\S]*?<\/\1\s*>/gi," ").replace(/<br\s*\/?>/gi,"\n").replace(/<\/p>|<\/div>|<\/li>|<\/tr>/gi,"\n").replace(/<[^>]+>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/&amp;|&#38;/gi,"&").replace(/&lt;|&#60;/gi,"<").replace(/&gt;|&#62;/gi,">").replace(/&quot;|&#34;/gi,'"').replace(/\r\n?/g,"\n").replace(/[ \t]+/g," ").replace(/\n{3,}/g,"\n\n").trim();t=l?`${a}
16${l}`:a}}let i=t.trim();return i?{role:e.role,content:i}:null}let Y=[{id:"pre_general",label:"일반현황",sectionKeys:["general-info"],fieldIds:["item-name","deliverables","occupation","company-name","team-1-position","team-1-role","team-1-capability","team-1-status","team-2-position","team-2-role","team-2-capability","team-2-status","team-3-position","team-3-role","team-3-capability","team-3-status"],prompt:"예비창업패키지 '일반현황'을 채워주세요. 창업아이템명/산출물/기업(예정)명/직업/팀 구성(역할\xb7역량\xb7구성상태)을 자연스럽고 설득력 있게 작성해주세요."},{id:"pre_overview",label:"아이템 개요(요약)",sectionKeys:["item-overview"],fieldIds:["item-title","item-category","item-description","overview-problem","overview-solution","overview-scaleup","overview-team"],prompt:"예비창업패키지 '창업 아이템 개요(요약)'을 작성해주세요. Problem/Solution/Scale-up/Team이 서로 논리적으로 이어지게 해주세요."},{id:"pre_problem",label:"문제 인식(전반)",sectionKeys:["problem"],prompt:"예비창업패키지 '문제 인식(Problem)' 섹션을 작성해주세요. 시장 현황/문제점과 창업아이템 필요성을 근거 중심으로 정리해주세요."},{id:"pre_solution",label:"실현 가능성(전반)",sectionKeys:["solution"],fieldIds:["solution-content","schedule-1-task","schedule-1-period","schedule-1-detail","schedule-2-task","schedule-2-period","schedule-2-detail","schedule-3-task","schedule-3-period","schedule-3-detail","schedule-4-task","schedule-4-period","schedule-4-detail","budget1-row-1-item","budget1-row-1-basis","budget1-row-1-amount","budget1-row-2-item","budget1-row-2-basis","budget1-row-2-amount","budget1-row-3-item","budget1-row-3-basis","budget1-row-3-amount","budget1-row-4-item","budget1-row-4-basis","budget1-row-4-amount","budget1-total","budget2-row-1-item","budget2-row-1-basis","budget2-row-1-amount","budget2-row-2-item","budget2-row-2-basis","budget2-row-2-amount","budget2-row-3-item","budget2-row-3-basis","budget2-row-3-amount","budget2-row-4-item","budget2-row-4-basis","budget2-row-4-amount","budget2-total"],prompt:"예비창업패키지 '실현 가능성(Solution)' 섹션을 작성해주세요. 개발 계획/차별성/협약기간 일정/정부지원금 집행 근거를 포함해주세요."},{id:"pre_scaleup",label:"성장전략(전반)",sectionKeys:["scaleup"],fieldIds:["scaleup-content","schedule-full-1-task","schedule-full-1-period","schedule-full-1-detail","schedule-full-2-task","schedule-full-2-period","schedule-full-2-detail","schedule-full-3-task","schedule-full-3-period","schedule-full-3-detail","schedule-full-4-task","schedule-full-4-period","schedule-full-4-detail"],prompt:"예비창업패키지 '성장전략(Scale-up)' 섹션을 작성해주세요. 경쟁사 비교, GTM, 수익모델, 로드맵(전체 사업단계 일정 포함), 자금확보 전략을 한 흐름으로 작성해주세요."},{id:"pre_team",label:"팀 구성(전반)",sectionKeys:["team"],fieldIds:["team-content","team-full-1-position","team-full-1-role","team-full-1-capability","team-full-1-status","team-full-2-position","team-full-2-role","team-full-2-capability","team-full-2-status","team-full-3-position","team-full-3-role","team-full-3-capability","team-full-3-status","partner-1-name","partner-1-capability","partner-1-collaboration","partner-1-timing","partner-2-name","partner-2-capability","partner-2-collaboration","partner-2-timing","partner-3-name","partner-3-capability","partner-3-collaboration","partner-3-timing"],prompt:"예비창업패키지 '팀 구성(Team)' 섹션을 작성해주세요. 대표/팀원의 역량이 리스크를 어떻게 줄이는지 중심으로 작성하고, 팀 구성(안)ê³¼ 협력기관 현황/협업방안 표도 함께 자연스럽게 채워주세요."}],ee=[{id:"modoo_basic",label:"아이디어명",sectionKeys:["basic"],fieldIds:["idea-name"],prompt:"모두의 창업 권역별오디션 '아이디어명'만 정리해주세요. 대표자명/닉네임은 작성하지 말고, 아이디어명은 ì§§ê³  기억하기 쉽게 제안해주세요."},{id:"modoo_problem",label:"문제인식",sectionKeys:["problem"],fieldIds:["problem-content"],prompt:"모두의 창업 권역별오디션 '문제인식(Problem)' 섹션을 ◆ 주장형 소제목과 근거 문단으로 작성해주세요. 개발 동기, 고객 문제, 기존 대안의 한계, 아이디어의 목적과 차별성을 연결하고 근거가 없으면 보강 필요로 표시해주세요."},{id:"modoo_solution",label:"실현가능성",sectionKeys:["solution"],fieldIds:["solution-content"],prompt:"모두의 창업 권역별오디션 '실현가능성(Solution)' 섹션을 작성해주세요. ì
16µœì¢… 산출물, 개발 방법, 준비 단계, 시장분석, 사업화 전략을 구체적으로 정리하되 기존 시장/경쟁 인포그래픽은 변경하지 마세요."},{id:"modoo_scaleup",label:"성장전략",sectionKeys:["scaleup"],fieldIds:["scaleup-content","capital-plan-content","budget-row-1-category","budget-row-1-item","budget-row-1-basis","budget-row-1-amount","budget-row-2-category","budget-row-2-item","budget-row-2-basis","budget-row-2-amount","budget-row-3-category","budget-row-3-item","budget-row-3-basis","budget-row-3-amount","budget-row-4-category","budget-row-4-item","budget-row-4-basis","budget-row-4-amount","budget-total"],prompt:"모두의 창업 권역별오디션 '성장전략(Scale-up)' 섹션을 작성해주세요. 창업자금 소요와 조달계획, 사업비 산출근거, 기타 자본 조달 계획을 마일스톤과 연결하되, 사용자 근거가 있는 금액만 사용하고 부족한 단가\xb7수량은 입력 필요로 표시해주세요."},{id:"modoo_team",label:"팀",sectionKeys:["team"],fieldIds:["team-content","team-1-role","team-1-task","team-1-capability","team-1-status","team-2-role","team-2-task","team-2-capability","team-2-status","team-3-role","team-3-task","team-3-capability","team-3-status"],prompt:"모두의 창업 권역별오디션 '팀(Team)' 섹션을 작성해주세요. 대표자와 팀원의 역할, 담당 업무, 보유 역량, 구성 상태를 과장 없이 구체적으로 표에 맞게 정리해주세요."}],et=[{id:"modoo_general_problem",label:"문제인식",sectionKeys:["problem"],fieldIds:["problem-content"],prompt:"모두의 창업 일반트랙 '문제인식(Problem)' 섹션을 ◆ 주장형 소제목과 근거 문단으로 작성해주세요. 아이디어의 개발 동기, 해결하려는 고객 문제, 기존 대안의 한계, 목표 시장을 하나의 논리로 연결하고 확인되지 않은 사실이나 성과는 만들지 마세요. 문장은 개조식(~함/~임)이 아니라 '~합니다/입니다'로 끝나는 자연스러운 서술체로 작성해주세요."},{id:"modoo_general_solution",label:"실현가능성",sectionKeys:["solution"],fieldIds:["solution-content"],prompt:"모두의 창업 일반트랙 '실현가능성(Solution)' 섹션을 작성해주세요. 아이디어의 개발 방안, 현재 준비 정도, 검증 계획, 경쟁 대안과의 차별화 방안을 구체적으로 연결하되 기존 시장\xb7로드맵 인포그래픽은 변경하지 마세요. 문장은 개조식(~함/~임)이 아니라 '~합니다/입니다'로 끝나는 자연스러운 서술체로 작성해주세요."},{id:"modoo_general_scaleup",label:"성장전략",sectionKeys:["scaleup"],fieldIds:["scaleup-content"],prompt:"모두의 창업 일반트랙 '성장전략(Scale-up)' 섹션을 작성해주세요. 사업화 계획, 단계별 추진 일정, 고객 확보와 수익 구조, 자금 소요 및 조달 방향을 실행 순서와 검증 지표 중심으로 정리하고 근거 없는 금액\xb7계약\xb7매출은 만들지 마세요. 문장은 개조식(~함/~임)이 아니라 '~합니다/입니다'로 끝나는 자연스러운 서술체로 작성해주세요."},{id:"modoo_general_development",label:"향후 발전방안",sectionKeys:["development"],fieldIds:["development-content"],prompt:"모두의 창업 일반트랙 '향후 발전방안(Development)' 섹션을 작성해주세요. 멘토링에서 점검할 핵심 가설, 반영할 주요 개선점, 단기\xb7중기 개발 방향과 다음 검증 계획을 PSSD 흐름에 맞춰 구체적으로 정리해주세요. 팀 구성 섹션으로 바꾸지 마세요. 문장은 개조식(~함/~임)이 아니라 '~합니다/입니다'로 끝나는 자연스러운 서술체로 작성해주세요."}],ei=[{id:"in_general",label:"일반현황(기업정보)",sectionKeys:["general-info"],fieldIds:["company-name","establishment-date","business-type","ceo-type","business-registration-number","business-address","item-name","deliverables","team-1-position","team-1-role","team-1-capability","team-1-status","team-2-position","team-2-role","team-2-capability","team-2-status","team-3-position","team-3-role","team-3-capability","team-3-status","team-4-position","team-4-role","team-4-capability","team-4-status"],prompt:"초기창업패키지 '일반현황'을 작성해주세요. 기업 기본정보(기업명/개업연월일/사업자구분/대표자유형/등록번호/주소)와 창업아이템/산출물/팀 구성을 자연스럽게 정리해주세요."},{id:"in_overview",label:"아이템 개요(요약)",sectionKeys:["item-overview"],fieldIds:["item-title","item-category","item-description","overview-problem","overview-solution","overview-scaleup","overview-team"],prompt:"초기창업패키지 '창업 아이템 개요(요약)'을 작성해주세요. 현재까지의 진행/검증(있다면)을 반영해 요약의 설득력을 높여주세요."},{id:"in_problem",label:"문제 인식(전반)",sectionKeys:["problem"],prompt:"초기창업패키지 '문제 인식(Problem)' 섹션을 작성해주세요. 시장/고객 문제와 우리가 확인한 신호(인터뷰/PoC/지표 등)를 엮어주세요."},{id:"in_solution",label:"실현 가능성(전반)",sectionKeys:["solution"],fieldIds:["solution-content","budget-gov","budget-self-cash","budget-self-kind","budget-total","schedule-1-task","schedule-1-period","schedule-1-detail","schedule-2-task","schedule-2-period","schedule-2-detail","schedule-3-task","schedule-3-period","schedule-3-detail","schedule-4-task","schedule-4-period","schedule-4-detail","schedule-5-task","schedule-5-period","schedule-5-detail","schedule-6-task","schedule-6-period","schedule-6-detail","budget-labor","budget-labor-gov","budget-labor-cash","budget-labor-inkind","budget-labor-total","budget-outsourcing","budget-outsourcing-gov","budget-outsourcing-cash","budget-outsourcing-inkind","budget-outsourcing-total","budget-advertising","budget-advertising-gov","budget-advertising-cash","budget-advertising-inkind","budget-advertising-total","budget-material","budget-material-gov","budget-material-cash","budget-material-inkind","budget-material-total","budget-fee","budget-fee-gov","budget-fee-cash","budget-fee-inkind","budget-fee-total","schedule-full-1-task","schedule-full-1-period","schedule-full-1-detail","schedule-full-2-task","schedule-full-2-period","schedule-full-2-detail","schedule-full-3-task","schedule-full-3-period","schedule-full-3-detail","schedule-full-4-task","schedule-full-4-period","schedule-full-4-detail","schedule-full-5-task","schedule-full-5-period","schedule-full-5-detail","schedule-full-6-task","schedule-full-6-period","schedule-full-6-detail"],prompt:"초기창업패키지 '실현 가능성(Solution)' 섹션을 작성해주세요. 기존 진척 + 협약기간 내 고도화 계획 + 차별성 + 일정 + 사업비(정부+자기부담) 근거를 포함해주세요."},{id:"in_scaleup",label:"성장전략(전반)",sectionKeys:["scaleup"],fieldIds:["scaleup-content"],prompt:"초기창업패키지 '성장전략(Scale-up)' 섹션을 작성해주세요. 세일즈 파이프라인, 유통/채널, 가격/패키징, KPI 중심으로 작성해주세요."},{id:"in_team",label:"팀 구성(전반)",sectionKeys:["team"],fieldIds:["team-content","team-full-1-position","team-full-1-role","team-full-1-capability","team-full-1-status","team-full-2-position","team-full-2-role","team-full-2-capability","team-full-2-status","team-full-3-position","team-full-3-role","team-full-3-capability","team-full-3-status","team-full-4-position","team-full-4-role","team-full-4-capability","team-full-4-status"],prompt:"초기창업패키지 '팀 구성(Team)' 섹션을 작성해주세요. 운영/채용 계획과 스케일업 가능한 조직 구성 관점으로 작성해주세요."}],ea=[{id:"gr_general",label:"일반현황(기업정보)",sectionKeys:["general-info"],prompt:"창업도약패키지 '일반현황'을 작성해주세요. 기업 기본정보(기업명/설립일/사업자구분/대표자유형/등록번호/소재지)ì
16™€ 창업아이템명, 지원분야/기술분야, 사업비(정부+자부담) 개요를 명확히 정리해주세요. 지원분야/기술분야는 선택형 항목이라면 중복 없이 가장 적합한 조합으로 채워주세요."},{id:"gr_overview",label:"아이템 개요/로드맵",sectionKeys:["item-overview"],prompt:"창업도약패키지 '창업아이템 개요'를 작성해주세요. 아이템 개요/제품 이미지 설명을 구체적으로 작성하고, 장기 로드맵과 협약기간 내 로드맵을 단계적으로 연결해 주세요. 협약기간 산출물은 로드맵 단계와 1:1로 매칭되게 정리해주세요."},{id:"gr_problem",label:"문제 인식(시장\xb7고객)",sectionKeys:["problem"],prompt:"창업도약패키지 '문제 인식' 섹션을 작성해주세요. 시장 규모/트렌드, 고객 pain point, 기존 솔루션 한계를 근거 중심으로 정리해주세요. 각 소항목은 수치 또는 출처(기관명/보고서/연도)를 포함해 신뢰성을 높여주세요."},{id:"gr_solution",label:"실현가능성(아이템\xb7시장\xb7성과)",sectionKeys:["solution"],prompt:"창업도약패키지 '실현가능성(2장)' 섹션을 작성해주세요. 2-1-1 창업아이템 소개 및 개선과제, 2-1-2 목표시장(고객) 분석, 2-2 창업아이템 사업화 추진 성과 순서로 작성하고, 수치/근거를 포함해 각 하위 항목이 서로 연결되도록 정리해주세요."},{id:"gr_scaleup",label:"성장전략(스케일업)",sectionKeys:["scaleup"],prompt:"창업도약패키지 '성장전략' 섹션을 작성해주세요. 성장 전략을 먼저 요약하고, 매출 계획(시장/제품/기간/수량/단가/매출)을 표 항목에 맞게 채워주세요. 추정 매출 계획은 보수/기준/공격 시나리오처럼 간단한 가정 근거를 포함해 작성해주세요. 협약기간 일정과 집행 계획은 매출\xb7성장 전략과 정렬되게 구성해주세요."},{id:"gr_team",label:"팀 구성(역량\xb7협업)",sectionKeys:["team"],prompt:"창업도약패키지 '팀 구성' 섹션을 작성해주세요. 대표/팀원 역량과 역할, 인력 계획, 외부 협업/파트너십을 포함해 실행력을 강조해주세요. 인력 구성은 역할-성과 연결(무엇을 해결하는지)까지 드러나게 작성해주세요."}],el=[{id:"gtv_general",label:"일반현황(기업정보)",sectionKeys:["general-info"],fieldIds:["gtv-ceo-name","gtv-ceo-birth","gtv-ceo-gender","gtv-co-ceo-name","gtv-co-ceo-birth","gtv-co-ceo-gender","gtv-company-name","gtv-hq-location","gtv-biz-number","gtv-corp-number","gtv-open-date","gtv-corp-establish-date","gtv-application-type","gtv-investment-stage","gtv-fasttrack-history","gtv-fasttrack-year-1","gtv-fasttrack-year-2","gtv-business-name","gtv-one-liner","gtv-kpi","gtv-target-revenue","gtv-target-investment","gtv-target-employment","gtv-past-revenue-2023","gtv-past-revenue-2024","gtv-past-revenue-2025","gtv-past-invest-2023","gtv-past-invest-2024","gtv-past-invest-2025","gtv-past-employ-2023","gtv-past-employ-2024","gtv-past-employ-2025"],prompt:"성장관광벤처 '일반현황'을 작성해주세요. 대표자 정보(성명/생년월일/성별), 기업 정보(기업명/소재지/사업자번호), 신청유형, 투자단계, 패스트트랙 이력, 사업명, 한줄설명, 성과지표(KPI), 협약목표(매출/투자유치/신규고용), 3개년 주요성과(매출/투자유치/신규고용)를 정리해주세요."},{id:"gtv_overview",label:"사업개요 및 특징(2장)",sectionKeys:["section1"],prompt:"성장관광벤처 '1. 사업개요 및 특징' 섹션을 작성해주세요. 1-1 사업개발 동기 및 배경에서는 관광산업 내 문제 인식과 해결하고자 하는 시장가치를, 1-2 사업의 특장점에서는 차별성\xb7융합성\xb7혁신성 관점에서 기존 관광 서비스 대비 핵심 경쟁력과 보유기술/특별기능을 구체적으로 서술해주세요."},{id:"gtv_market",label:"시장 및 사업모델(4장)",sectionKeys:["section2"],prompt:"성장관광벤처 '2. 시장 및 사업모델' 섹션을 작성해주세요. 2-1 시장현황 및 목표고객에서는 관광시장 규모\xb7트렌드와 타겟 고객층을, 2-2 사업모델에서는 수익창출 구조를 도식화 관점으로, 2-3 시장성에서는 현재까지 정량적 성과(판매량/고객수 등)를, 2-4 잠재리스크에서는 관광산업 특유의 리스크(계절성/규제/경기변동 등)와 ë
16Œ€ì‘방안을 서술해주세요."},{id:"gtv_strategy",label:"사업전략(6장)",sectionKeys:["section3"],prompt:"성장관광벤처 '3. 사업전략' 섹션을 작성해주세요. 3-1 상품\xb7서비스\xb7인프라 개발 및 고도화 계획, 3-2 홍보 및 판로개척(박람회/B2B 등 관광업 채널 포함), 3-3 자금조달 및 집행계획(정부지원금 1억원 한도 포함 표1), 3-4 사업추진 일정계획(전체+협약기간 내), 3-5 수익성\xb7성장성 전망 및 재무상태(최근 3년 실적+향후 5년 예상 매출)를 구체적으로 작성해주세요."},{id:"gtv_tourism",label:"관광산업 연계\xb7확장(3장)",sectionKeys:["section4"],prompt:"성장관광벤처 '4. 관광산업 연계\xb7확장 가능성' 섹션을 작성해주세요. 4-1 관광산업 및 시장에 대한 이해에서는 K-관광\xb7지역관광\xb7인바운드/아웃바운드 트렌드를, 4-2 사업과 관광산업 간 연계 및 확장 가능성에서는 실제 적용\xb7활용 시나리오를, 4-3 관광산업 내 성과발생 가능성 및 기대효과에서는 계량적/비계량적 성과와 관광산업 발전 기여도를 구체적으로 서술해주세요."},{id:"gtv_team",label:"팀 역량(3장)",sectionKeys:["section5"],prompt:"성장관광벤처 '5. 팀 역량' 섹션을 작성해주세요. 5-1 사업자의 전문성에서는 대표자의 관광/여행 분야 경험\xb7경력\xb7수상실적을, 5-2 사업운영 능력에서는 사업화 의지\xb7도전정신\xb7보유 자원(장비/시설/특허/파트너십)을, 5-3 운영조직 및 일자리 창출계획에서는 현재 팀 구성과 신규 채용 계획\xb7대내외 협력 네트워크를 구체적으로 작성해주세요."}],es=[{id:"yo_general",label:"일반현황(기업정보)",sectionKeys:["business-plan-general"],fieldIds:["youth-task-title","youth-applicant-name","youth-applicant-name-2","youth-gender","youth-company-name","youth-biz-reg-no","youth-corp-reg-no","youth-open-date","youth-biz-type","youth-rep-type","youth-budget-gov","youth-budget-cash","youth-budget-inkind","youth-budget-total","youth-kpi-employment-last","youth-kpi-employment-this","youth-kpi-sales-last","youth-kpi-sales-this","youth-kpi-export-last","youth-kpi-export-this","youth-kpi-invest-last","youth-kpi-invest-this"],prompt:"청년창업사관학교 '일반현황'을 작성해주세요. 사업화 과제명/신청인 정보/기업명/사업자등록번호/사업비 구성/성과지표를 자연스럽게 정리해주세요. 성과지표는 합리적인 전년/금년 수치를 제시해주세요."},{id:"yo_overview",label:"사업화 과제 개요(요약)",sectionKeys:["business-plan-summary"],fieldIds:["youth-summary-intro","youth-summary-diff","youth-summary-market","youth-summary-goals"],prompt:"청년창업사관학교 '사업화 과제 개요(요약)'을 간결한 줄글 형태로 작성해주세요. 각 항목당 2~3문장으로 핵심만 요약합니다. 불릿포인트나 복잡한 구조 없이 명사형 문장으로 간단히 작성해주세요."},{id:"yo_problem",label:"문제인식(Problem)",sectionKeys:["problem"],fieldIds:["youth-problem-1-1","youth-problem-1-2"],prompt:"청년창업사관학교 '문제인식(Problem)' 섹션을 작성해주세요. 1-1 창업아이템의 개발동기 및 필요성, 1-2 창업아이템의 사업성 및 기술 개발 필요성을 시장 근거/수치와 함께 작성해주세요."},{id:"yo_solution",label:"실현가능성(Solution)",sectionKeys:["solution"],fieldIds:["youth-solution-2-1","youth-solution-2-2","youth-schedule-1-content","youth-schedule-1-period","youth-schedule-1-detail","youth-schedule-2-content","youth-schedule-2-period","youth-schedule-2-detail","youth-schedule-3-content","youth-schedule-3-period","youth-schedule-3-detail","youth-schedule-4-content","youth-schedule-4-period","youth-schedule-4-detail","youth-schedule-5-content","youth-schedule-5-period","youth-schedule-5-detail"],prompt:"청년창업사관학교 '실현가능성(Solution)' 섹션을 작성해주세요. 2-1 창업아이템 실현 및 사업화 역량, 2-2 창업아이템 차별성 및 경쟁력 확보 방안, 사업 추진일정을 구체적으로 작성해주세요."},{id:"yo_scaleup",label:"성장전략(Scale-up)",sectionKeys:["scale-up"],fieldIds:["youth-scale-3-1","youth-scale-3-2-1","youth-scale-3-2-2","youth-scale-3-2-3","youth-budget-item1-name","youth-budget-item1-desc","youth-budget-item1-gov","youth-budget-item1-cash","youth-budget-item1-inkind","youth-budget-item2-name","youth-budget-item2-desc","youth-budget-item2-gov","youth-budget-item2-cash","youth-budget-item2-inkind","youth-budget-item3-name","youth-budget-item3-desc","youth-budget-item3-gov","youth-budget-item3-cash","youth-budget-item3-inkind","youth-budget-item4-name","youth-budget-item4-desc","youth-budget-item4-gov","youth-budget-item4-cash","youth-budget-item4-inkind"],prompt:"청년창업사관학교 '성장전략(Scale-up)' 섹션을 작성해주세요. 3-1 자금소요 및 조달계획, 3-2 사업화 추진전략(내수시장/해외시장/협약기간 내 목표), 사업비 세부내역을 구체적으로 작성해주세요."},{id:"yo_team",label:"팀 구성(Team)",sectionKeys:["team"],fieldIds:["youth-team-ceo","youth-team-employment-plan","youth-tech-protection","youth-social-value","youth-regional","youth-employee-1-name","youth-employee-1-position","youth-employee-1-duty","youth-employee-1-career","youth-employee-2-name","youth-employee-2-position","youth-employee-2-duty","youth-employee-2-career","youth-employee-3-name","youth-employee-3-position","youth-employee-3-duty","youth-employee-3-career","youth-
16hire-1-position","youth-hire-1-duty","youth-hire-1-method","youth-hire-1-career","youth-hire-2-position","youth-hire-2-duty","youth-hire-2-method","youth-hire-2-career"],prompt:"청년창업사관학교 '팀 구성(Team)' 섹션을 작성해주세요. 대표자 현황 및 역량, 현재 재직인원 및 고용계획, 기술보호 노력, 사회적 가치 실천계획, 지역특화 산업 기반 사업추진계획, 직원 현황/추가 고용계획 표를 구체적으로 채워주세요."}],er=[{id:"rt_application",label:"신청현황",sectionKeys:["application-status"],prompt:"재도전성공패키지 '신청현황'을 작성해주세요. 신청 주관기관명, 신청 구분(예비재창업자/재창업기업), 사업 분야/기술 분야 체크박스를 적합하게 선택하고, 사업비 구성(정부/현금/현물/합계)은 백만원 단위로 현실적인 금액으로 채워주세요."},{id:"rt_general",label:"일반현황",sectionKeys:["general-info"],prompt:"재도전성공패키지 '일반현황'을 작성해주세요. 창업아이템명, 산출물(협약기간 내 목표 2~3줄), 기업명, 개업연월일, 사업자 구분, 소재지, 사업자등록/법인등록번호, 기업 구성(직위/담당업무/보유역량)을 자연스럽고 구체적으로 채워주세요."},{id:"rt_item_overview",label:"아이템 개요(요약)",sectionKeys:["item-overview"],prompt:"재도전성공패키지 '신청과제 아이템 개요(요약)'을 작성해주세요. 아이템 개요/ë°°ê²½ 및 필요성/현황 및 구체화 방안/목표시장 및 사업화 전략을 각각 2~3문장으로 구체화하고, 이미지 캡션 2개도 함께 채워주세요."},{id:"rt_closed_detail",label:"폐업기업 세부내용",sectionKeys:["closed-company-detail"],prompt:"재도전성공패키지 '폐업기업 세부내용'을 작성해주세요. 기업명/소재지/개업연월일/기업 구분/운영기간/아이템명/아이템 개요를 구체적으로 작성하고, 사업분야/기술분야 체크박스를 적합하게 선택한 뒤 폐업 원인 및 사유는 수치와 근거를 포함해 설득력 있게 작성해주세요."},{id:"rt_problem",label:"문제인식(Problem)",sectionKeys:["problem"],prompt:"재도전성공패키지 '문제인식(Problem)' 섹션을 작성해주세요. 폐업기업 사업개요, 폐업 원인 분석(외적/내적), 개선 방안, 창업아이템 ë°°ê²½ 및 필요성, 목표시장 현황 분석을 불릿 구조(□/ㅇ/-)로 작성하고, 각 소항목에 수치/기관명/연도를 포함해주세요."},{id:"rt_solution",label:"실현 및 구체화",sectionKeys:["solution"],prompt:"재도전성공패키지 '실현 및 구체화 방안' 섹션을 작성해주세요. 창업아이템 현황(준비 정도)ê³¼ 실현/구체화 방안을 불릿 구조로 정리하고, 협약기간 일정 및 사업비 집행계획 표 항목도 논리적으로 채워주세요."},{id:"rt_scaleup",label:"성장전략(Scale-up)",sectionKeys:["scaleup"],prompt:"재도전성공패키지 '성장전략(Scale-up)' 섹션을 작성해주세요. 비즈니스 모델 및 추진성과, 사업화 추진 전략, 사업 전체 로드맵, 협약기간 내 목표/달성 방안, 사업비 집행계획, 자금 조달계획을 불릿 구조로 정리하고, 매출/추정매출 표는 시장/제품/기간/수량/단가/매출 항목에 맞게 구체적으로 채워주세요."},{id:"rt_team",label:"팀 구성(Team)",sectionKeys:["team"],prompt:"재도전성공패키지 '기업 구성(Team)' 섹션을 작성해주세요. 대표자 및 기업 현황, 인력 고용 및 활용 계획, 외부 협력 현황, ESG 경영을 불릿 구조로 작성하고, 재직 인원/추가 고용/협력 기관 표도 구체적으로 채워주세요."}],en=[{id:"rt26_task_overview",label:"과제 개요",sectionKeys:["task-overview"],prompt:"재도전성공패키지 2026 '과제 개요' 섹션을 작성해주세요. 과제명(아이템명)은 핵심 기술\xb7차별점이 드러나는 명칭으로, 아이템(서비스) 개요는 재창업 경험을 바탕으로 한 문제 해결 방향과 핵심 가치를 2~4문장으로 구체적으로 작성해주세요."},{id:"rt26_closed_history",label:"폐업 이력",sectionKeys:["closed-history"],prompt:"재도전성공패키지 2026 '폐업 이력' 섹션을 작성해주세요. 폐업기업 1의 기업명\xb7기업 구분(개인/법인)\xb7사업기간\xb7아이템 개요\xb7폐업 원인을 수치와 구체적 근거를 포함해 작ì
16„±í•˜ê³ , 폐업기업 2\xb73은 해당 없으면 '-'로 처리해주세요."},{id:"rt26_problem",label:"문제인식",sectionKeys:["problem"],prompt:"재도전성공패키지 2026 '문제인식' 섹션을 작성해주세요. ① 폐업 원인 분석 및 개선 방안: 외적\xb7내적 폐업 원인과 구체적 개선 방안을, ② 목표시장(고객) 현황 및 필요성: 시장 규모\xb7성장률\xb7목표 고객군을 불릿 구조(□/ㅇ/-)로 각 3세트 이상 작성하고, 각 소항목에 수치\xb7기관명\xb7정책명을 포함해주세요."},{id:"rt26_solution",label:"실현 및 구체화",sectionKeys:["solution"],prompt:"재도전성공패키지 2026 '실현 및 구체화' 섹션을 작성해주세요. ① 재창업 아이템 준비 현황: 개발 단계\xb7검증 ê²°ê³¼\xb7보유 역량을, ② 실현 및 구체화 방안: 기술 고도화\xb7사업화 추진 계획을 불릿 구조(□/ㅇ/-)로 각 3세트 이상 작성해주세요. 협약기간 일정 표(4행)와 사업비 표(정부지원금/현금/현물/합계)도 현실적인 금액으로 채워주세요."},{id:"rt26_scaleup",label:"성장전략(Scale-up)",sectionKeys:["scaleup"],prompt:"재도전성공패키지 2026 '성장전략(Scale-up)' 섹션을 작성해주세요. ① 비즈니스 모델: 수익 구조\xb7핵심 KPI\xb7중장기 매출 목표를, ② 사업화 추진 전략: 시장 진입 전략\xb7마케팅 방법을 불릿 구조(□/ㅇ/-)로 각 3세트 이상 작성하고, 각 소항목에 구체적 수치와 전략을 포함해주세요."},{id:"rt26_team",label:"팀 구성(Team)",sectionKeys:["team"],prompt:"재도전성공패키지 2026 '팀 구성(Team)' 섹션을 작성해주세요. ① 대표자 역량: 도메인 경험\xb7사업 수행 역량\xb7재창업 준비 현황을, ② 조직 구성 계획: 핵심 인력 채용 계획\xb7중장기 조직 발전 방향을 불릿 구조(□/ㅇ/-)로 각 3세트 이상 작성하고, 재직 인원\xb7추가 고용 계획\xb7직원 역량 표도 구체적으로 채워주세요."}],eo=(0,s.memo)(function({isOpen:e,onClose:t,onApplyContent:i,onApplyFieldMap:l,programId:T,programName:O="사업계획서",documentId:K=null,currentContent:L="",currentSection:eo,interviewData:ed,onGenerateSection:ec,variant:eu="drawer",hideHeader:em=!1,selectedContext:ep=null,onClearSelectedContext:eh,improvementRequest:eg=null,onImprovementConsumed:ef,onScrollToField:eb,onApplyCells:ex,onReplaceTable:ey,referenceFiles:ev=[],onReferenceFilesChange:ew,onReferenceFilesConsumed:ej,onTextTranscriptChange:ek,externalDraft:eN=null}){let e$=(0,s.useMemo)(()=>(0,C.createClient)(),[]),eI=(0,s.useRef)(ev.find(e=>e.requestId)?.requestId??null),e_=(0,s.useRef)(!1),eC=(0,s.useRef)(ev),eA=(0,s.useRef)(ev.length);eC.current=ev,(0,s.useEffect)(()=>{let e=ev.find(e=>e.requestId)?.requestId;e&&(eI.current=e),eA.current>0&&0===ev.length&&(eI.current=null),eA.current=ev.length},[ev]);let eS=(0,s.useMemo)(()=>0===ev.length?null:1===ev.length?ev[0].text:ev.map(e=>`[${e.filename}]
17${e.text}`).join("\n\n---\n\n"),[ev]),eD=(0,s.useCallback)(async()=>{try{let{data:e}=await e$.auth.getSession();return e.session?.access_token||""}catch{return""}},[e$]),eM=async()=>{let e=await eD(),t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t},eq=(0,s.useCallback)(async e=>{if(e_.current)return;let t=eC.current;if(t.length>=3)return void B.o.error(`참고자료는 최대 3개까지 첨부할 수 있습니다.`);if(t.some(t=>t.filename===e.name))return void B.o.error("이미 같은 이름의 파일이 첨부되어 있습니다.");if(e.size>4194304)return void B.o.error(`파일 크기가 너무 큽니다 (최대 4MB). 현재: ${(e.size/1024/1024).toFixed(1)}MB`);if(!(0,X.XL)(e.name))return void B.o.error(`지원하지 않는 파일 형식입니다. 지원 형식: ${X.Nv.join(", ")}`);e_.current=!0,tA(!0);try{let t=await eD(),i=new FormData;i.append("file",e),T&&i.append("programId",T),eI.current||(eI.current=crypto.randomUUID()),i.append("requestId",eI.current),i.append("requestType","chat");let a={};t&&(a.Authorization=`Bearer ${t}`);let l=await fetch("/api/extract-text",{method:"POST",headers:a,body:i}),s=await l.json();if(!l.ok||!s.success)return void B.o.error(s.error||"텍스트 추출에 실패했습니다.");let r=eC.current;if(r.reduce((e,t)=>
17e+t.text.length,0)+s.charCount>1e5)return void B.o.error("참고자료 총 용량을 초과했습니다. 파일을 줄여주세요.");let n=[...r,{text:s.text,filename:s.filename,requestId:"string"==typeof s.requestId?s.requestId:eI.current??void 0,attachmentId:"string"==typeof s.attachmentId?s.attachmentId:null,archiveStatus:"stored"===s.archiveStatus?"stored":"unavailable"}];eC.current=n,ew?.(n),B.o.success(`참고자료 로드 완료: ${s.filename}`)}catch{B.o.error("파일 업로드에 실패했습니다.")}finally{e_.current=!1,tA(!1)}},[eD,ew,T]),eP=(0,s.useCallback)(async e=>{let t=e.target.files?.[0];t&&(e.target.value="",await eq(t))},[eq]),[eT,eO]=(0,s.useState)(!1),eK=(0,s.useRef)(0),eL=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eK.current+=1,e.dataTransfer.types.includes("Files")&&eO(!0)},[]),ez=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),eK.current-=1,0===eK.current&&eO(!1)},[]),eE=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),eF=(0,s.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),eO(!1),eK.current=0;let t=e.dataTransfer.files?.[0];t&&await eq(t)}
17,[eq]),[eB,eH]=(0,s.useState)([{kind:"text",id:"welcome",role:"assistant",content:`안녕하세요! ${O} 작성을 도와드릴 AI 도우미입니다.
18
19빠른 작성 도우미를 사용하거나, 원하시는 내용을 직접 입력해주세요.
20
21**💡 Tip**: 빠른 작성은 AI 인터뷰나 빠른 생성으로 초안을 작성한 후 사용하면 더욱 효과적입니다.`,timestamp:new Date}]),eR=(0,s.useRef)(ek);(0,s.useEffect)(()=>{eR.current=ek},[ek]),(0,s.useEffect)(()=>{eR.current?.(function(e){let t=e.map(Q).filter(e=>!!e).slice(-12),i=[],a=12e3;for(let e=t.length-1;e>=0&&a>0;e-=1){let l=t[e],s=l.content.trim().slice(0,a);s&&(i.unshift({role:l.role,content:s}),a-=s.length)}return i}(eB))},[eB]);let[eW,eV]=(0,s.useState)(""),[eX,eG]=(0,s.useState)(!1),[eU,eJ]=(0,s.useState)(null),[eZ,eQ]=(0,s.useState)(!0),[eY,e0]=(0,s.useState)(!1),[e1,e2]=(0,s.useState)(!0),[e3,e5]=(0,s.useState)(null),[e4,e6]=(0,s.useState)(!1),[e8,e9]=(0,s.useState)(!1),[e7,te]=(0,s.useState)(!1),[tt,ti]=(0,s.useState)(!1),ta=(0,s.useRef)(null),[tl,ts]=(0,s.useState)({}),[tr,tn]=(0,s.useState)({}
21),[to,td]=(0,s.useState)(new Set),[tc,tu]=(0,s.useState)(null),[tm,tp]=(0,s.useState)(!1),[th,tg]=(0,s.useState)(new Set),[tf,tb]=(0,s.useState)(null),[tx,ty]=(0,s.useState)(null),[tv,tw]=(0,s.useState)(null),tj=(0,s.useCallback)(e=>{tw(e??"gallery")},[]),[tk,tN]=(0,s.useState)({}),t$=(0,s.useRef)(null),tI=(0,s.useRef)(null),t_=(0,s.useRef)(null),[tC,tA]=(0,s.useState)(!1),tS=(0,s.useRef)({messageCount:1,hadLoading:!1}),tD=(0,s.useMemo)(()=>tc?(0,H.t1)(Z[tc]):null,[tc]);(0,s.useEffect)(()=>{eN&&(eV(eN.text.slice(0,500)),eQ(!1),window.requestAnimationFrame(()=>tI.current?.focus()))},[eN]);let tM=(0,s.useCallback)((e,t="chat",i="chat",a)=>{if(e?.code==="owner_quota_exceeded")return e9(!0===e.ownerNotified),e6(!0),null;let l=(0,q._)(e,{programId:T??null,programName:O??null,source:"ai_chat",mode:i,retryLabel:a?"다시 요청하기":void 0},t);return ta.current=a??null,ti(!!a),e5(l),l},[T,O]),tq=async()=>{if(K&&!e7&&!e8){te(!0);try{let e=await eM();(await fetch(`/api/collab/documents/${encodeURIComponent(K)}/ai-quota-alert`,{method:"POST",headers:e})).ok&&e9(!0)}catch{}finally{te(!1)}}},tP=(0,s.useCallback)(()=>{e6(!1)},[]),tT=(0,s.useCallback)(()=>{let e=ta.current;ta.current=null,ti(!1),e?.()},[]),tO=e=>{let t="number"==typeof e?.generationLimitPerDay?e.generationLimitPerDay:1,i="number"==typeof e?.chatLimitPerDay?e.chatLimitPerDay:3,a="number"==typeof e?.interviewCount?e.interviewCount:0,l="number"==typeof e?.quickCount?e.quickCount:0,s="number"==typeof e?.chatCount?e.chatCount:0,r=`
22(생성: ${a+l}/${t}, AI 도우미: ${s}/${i})`;eH(e=>[...e,{kind:"text",id:tz(),role:"assistant",content:`일일한도 제한으로 생성이 중단되었습니다.${r}`,timestamp:new Date}])},tK=()=>{let e=t$.current;return e?e.querySelector("[data-radix-scroll-area-viewport]"):null},tL=async()=>{if(eo&&ec){e0(!0);try{let e=await eM(),t=await fetch("/api/generate-section",{method:"POST",headers:e,body:JSON.stringify({programId:T,programName:O,...K?{documentId:K}:{},sectionId:eo.id,sectionTitle:eo.title,subsectionId:eo.subsectionId,subsectionTitle:eo.subsectionTitle,interviewData:ed||{},existingContent:tF()})});if(!t.ok){let e=await t.json().catch(()=>null);if(401===t.status)return void eH(e=>[...e,{kind:"text",id:tz(),role:"assistant",content:"로그인이 필요합니다.",timestamp:new Date}]);if(429===t.status){let t=tM(e,"chat","chat",()=>{tL()});t&&tO({generationLimitPerDay:t.generationLimitPerDay,chatLimitPerDay:t.chatLimitPerDay,interviewCount:t.interviewCount,quickCount:t.quickCount,chatCount:t.chatCount});return}throw Error("Generation failed")}let i=await t.json();ec(eo.id,i.content);let a={kind:"text",id:tz(),role:"assistant",content:`"${eo.title}" 섹션 내용을 생성했습니다:
23
24${i.content}`,timestamp:new Date};eH(e=>[...e,a])}catch(t){console.error(t);let e={kind:"text",id:tz(),role:"assistant",content:"섹션 생성 중 오류가 발생했습니다. 다시 시도해주세요.",timestamp:new Date};eH(t=>[...t,e])}finally{e0(!1)}}};(0,s.useEffect)(()=>{if(!e1)return;let e=tS.current,t=eB.length,i=t>e.messageCount;requestAnimationFrame(()=>((e="auto")=>{let t=tK();if(!t)return;let i=t.scrollHeight;try{t.scrollTo({top:i,behavior:e})}catch{t.scrollTop=i}})(i?"smooth":"auto")),tS.current={messageCount:t,hadLoading:eX}},[eB.length,eX,e1]),(0,s.useEffect)(()=>{if(!e)return;let t=tK();if(!t)return;let i=()=>{e2(t.scrollHeight-t.scrollTop-t.clientHeight<=48)};return t.addEventListener("scroll",i,{passive:!0}),i(),()=>{t.removeEventListener("scroll",i)}},[e]),(0,s.useEffect)(()=>{e&&tI.current&&tI.current.focus()},[e]);let tz=()=>Math.random().toString(36).substr(2,9),tE="modoo-general-track-2026"===T?et:"modoo-regional-audition-2026"===T?ee:"growth-tourism-venture"===T?el:"initial"===T?ei:"growth"===T?ea:"retry"===T?er:"retry-2026"===T?en:"youth-2026"===T||"youth-2025"===T?es:Y,tF=(e=[])=>{let t=L||"";if(!t)return"";try{let i=new DOMParser().parseFromString(t,"text/html"),a=new Set(e),l=Array.from(i.querySelectorAll("[data-field]")),s=new Set,r=[];return l.forEach(e=>{let t,i,l,n=e.getAttribute("data-field")||"";if(!n||a.has(n)||s.has(n))return;s.add(n);let o=(e.closest("tr")?.querySelector("th")?.textContent||"").replace(/\s+/g," ").trim()||tB(n),d=(t=(e.getAttribute("data-field-type")||"").toLowerCase(),i=(e.textContent||"").replace(/\u00A0/g," ").replace(/\s+\n/g,"\n").trim(),"richtext"===t?i.slice(0,800).trim():i);if(!(l=d.trim())||l.length<=2||l.includes("※")||l.includes("예:")||/(^|\s)OO+(\s|$)/.test(l)||/○|■|\*{2,}/.test(l)||/OO\.OO\.OO|00\.00\.00|00\.0|00년|00월|00일/.test(l)||/^(□|ㅇ|-)\s*$/.test(l))return;let c=d.length>220?`${d.slice(0,220)}…`:d;r.push(`- ${o}: ${c}`)}),r.join("\n").slice(0,2200)}catch(e){return console.error("buildMeaningfulContext failed:",e),""}},tB=e=>{let t=e.match(/^schedule-(\d+)-(.+)$/);if(t){let e=t[1],i=t[2];return`사업추진 일정 ${e}
24 - ${"task"===i?"추진내용":"period"===i?"기간":"detail"===i?"세부 내용":i}`}let i=e.match(/^schedule-full-(\d+)-(.+)$/);if(i){let e=i[1],t=i[2];return`전체 일정 ${e} - ${"task"===t?"추진내용":"period"===t?"기간":"detail"===t?"세부 내용":t}`}let a=e.match(/^budget(\d)-row-(\d+)-(.+)$/);if(a){let e=a[1],t=a[2],i=a[3];return`예산(단계${e}) ${t}행 - ${"item"===i?"비목":"basis"===i?"산출근거":"amount"===i?"금액":i}`}let l=e.match(/^team-(\d+)-(.+)$/);if(l){let e=l[1],t=l[2];return`팀 구성 ${e} - ${"position"===t?"직위":"role"===t?"담당 업무":"capability"===t?"보유 역량":"status"===t?"구성 상태":t}`}return e.endsWith("-content")?"본문":e},tH=e=>{let t=(e||"").trim();if(!t)return"";if(!(t.startsWith("<")&&t.endsWith(">")))return t;try{return(new DOMParser().parseFromString(t,"text/html").body.textContent||"").replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}catch{return t}},tR=e=>{let t=[],i={},a={},l=new Set;return e.sectionKeys.forEach(e=>{let s=(e=>{let t=L||"";if(!t)return{fieldIds:[],fieldDefs:[],labelMap:{},checkboxOptionsByFieldId:{}};try{let i=new DOMParser().parseFromString(t,"text/html").querySelector(`div[data-section="${e}"]`);if(!i)return{fieldIds:[],fieldDefs:[],labelMap:{},checkboxOptionsByFieldId:{}};let a=new Set,l=[],s={},r={};return Array.from(i.querySelectorAll("[data-field]")).forEach(e=>{let t,i=e.getAttribute("data-field")||"";if(!i||a.has(i))return;a.add(i);let n=(t=(e.getAttribute("data-field-type")||"").toLowerCase(),"richtext"===t?"richtext":"select"===t?"select":"image"===t?"image":"table-row"===t?"table-row":"textarea"===t?"textarea":"text");l.push({fieldId:i,fieldType:n});let o=(e=>{let t=e.closest("td,th"),i=t?.closest("tr");if(!t||!i)return"";let a=Array.from(i.children),l=a.indexOf(t);if(l<=0)return"";for(let e=l-1;e>=0;e--){let t=a[e];if("TH"===t.tagName){let e=(t.textContent||"").replace(/\s+/g," ").trim();if(e)return e}}return""})(e);s[i]=o||tB(i);let d=(e=>{let t=e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim();if(!t.includes("☐")&&!t.includes("☑"))return[];let i=/[☐☑]\s*([^☐☑]+)/g,a=[],l=null;for(;l=i.exec(t);){let e=(l[1]||"").replace(/\s+/g," ").trim();if(!e)continue;let t=e.replace(/(&nbsp;|·|\||,)+$/g,"").trim();t&&!a.includes(t)&&a.push(t)}return a})(e.textContent||"");d.length>=2&&(r[i]=d)}),{fieldIds:l.map(e=>e.fieldId),fieldDefs:l,labelMap:s,checkboxOptionsByFieldId:r}}catch(e){return console.error("collectSectionFields failed:",e),{fieldIds:[],fieldDefs:[],labelMap:{},checkboxOptionsByFieldId:{}}}})(e);s.fieldDefs.forEach(e=>{l.has(e.fieldId)||(l.add(e.fieldId),t.push(e))}),Object.entries(s.labelMap).forEach(([e,t])=>{i[e]||(i[e]=t)}),Object.entries(s.checkboxOptionsByFieldId).forEach(([e,t])=>{!a[e]&&Array.isArray(t)&&t.length>0&&(a[e]=t)})}),(Array.isArray(e.fieldIds)?e.fieldIds:[]).forEach(e=>{e&&!l.has(e)&&(l.add(e),t.push({fieldId:e,fieldType:e.endsWith("-content")?"richtext":e.startsWith("image-")?"image":"text"}),i[e]||(i[e]=tB(e)))}),{fieldIds:t.map(e=>e.fieldId),fieldDefs:t,labelMap:i,checkboxOptionsByFieldId:a}},tW=(e,t)=>{let i=L||"";if(!i)return{};try{let a=new DOMParser().parseFromString(i,"text/html"),l=new Map;t.forEach(e=>l.set(e.fieldId,e.fieldType));let s=e=>e.replace(/\u00A0/g," ").replace(/[ \t]+\n/g,"\n").trim(),r={};return e.forEach(e=>{r[e]=(e=>{let t=a.querySelector(`[data-field="${e}"]`);if(!t)return"";let i=String(l.get(e)||"");if("richtext"===i){let e=[];return t.querySelectorAll("p").forEach(t=>{let i=t.getAttribute("class")||"",a=(t.textContent||"").replace(/\s+/g," ").trim();a&&(i.includes("bullet-top")?e.push(`□ ${a.replace(/^□\s*/,"")}`):i.includes("bullet-mid")?e.push(`ㅇ ${a.replace(/^ㅇ\s*/,"")}`):i.includes("bullet-sub")?e.push(`- ${a.replace(/^-?\s*/,"")}`):e.push(a))}),s(e.join("\n"))}return s(t.textContent||"")})(e)}),r}catch(e){return console.error("extractBeforeMap failed:",e),{}}},tV=async e=>{let t=e||eW,i=t.trim();if(!i)return;if(i.length>500)return void eV(i.slice(0,500));e2(!0);let a=eB.filter(e=>"text"===e.kind).slice(-6).map(e=>({role:e.role,content:e.content})),l={kind:"text",id:tz(),role:"user",content:t,timestamp:new Date};eH(e=>[...e,l]),eV(""),eG(!0),eQ(!1);let s=ev.find(e=>e.requestId)?.requestId;ev.length>0&&(ej?.(ev),ew?.([]),eI.current=null);try{let e=await eM(),i=!!(ep?.preview&&ep.preview.trim().length>0);T&&(0,P.dA)(T,t.length,i);let l=await fetch("/api/chat",{method:"POST",headers:e,body:JSON.stringify({programName:O,programId:T,...K?{documentId:K}:{},message:t,context:tF(),history:a,mode:i?"selection":"plain",selectionContext:i?ep:null,...eS?{referenceText:eS}:{},...s?{requestId:s}:{}})});if(!l.ok){let e=await l.json().catch(()=>null);if(401===l.status)return void eH(e=>[...e,{kind:"text",id:tz(),role:"assistant",content:"로그인이 필요합니다.",timestamp:new Date}]);if(429===l.status){let t=tM(e,"chat");t&&tO({generationLimitPerDay:t.generationLimitPerDay,chatLimitPerDay:t.chatLimitPerDay,interviewCount:t.interviewCount,quickCount:t.quickCount,chatCount:t.chatCount});return}throw Error("Failed")}let r=await l.json();if(r?.mode==="table_structure"){let e="string"==typeof r.html&&r.html.trim().length>0,t=Array.isArray(r.rows)&&r.rows.length>0;if(e||t)return void eH(t=>[...t,{kind:"table_structure",id:tz(),role:"assistant",rows:r.rows??[],html:e?r.html.trim():void 0,timestamp:new Date}])}if(r?.mode==="table_cells"&&Array.isArray(r.cells)&&r.cells.length>0)return void eH(e=>[...e,{kind:"cell_results",id:tz(),role:"assistant",cells:r.cells,timestamp:new Date}]);if(Array.isArray(r?.blocks)&&r.blocks.length>0){let e=r.blocks.filter(e=>!!e&&"object"==typeof e).map(e=>({id:"string"==typeof e.id?e.id:tz(),label:"string"==typeof e.label?e.label:"블록",content:"string"==typeof e.content?e.content:""})).filter(e=>e.content.trim().length>0),t={kind:"blocks",id:tz(),role:"assistant",title:i?"선택 영역 수정 제안":"추천 결과",blocks:e,timestamp:new Date};eH(e=>[...e,t])}else if(r?.mode==="infographic"&&"string"==typeof r.html){let e={kind:"infographic",id:tz(),role:"assistant",html:r.html,timestamp:new Date};eH(t=>[...t,e])}else{let e={kind:"text",id:tz(),role:"assistant",content:String(r?.content||""),timestamp:new Date};eH(t=>[...t,e])}}catch(t){console.error(t);let e={kind:"text",id:tz(),role:"assistant",content:"죄송합니다. 오류가 발생했습니다. 다시 시도해주세요.",timestamp:new Date};eH(t=>[...t,e])}finally{eG(!1)}};function tX(e,t){let i=function(e){try{let t=document.createElement("div");t.innerHTML=e;let i=t.querySelector("[data-infographic-config]");if(!i)return null;let a=i.getAttribute("data-infographic-config");if(!a)return null;return(0,R.Mb)(a)}catch{return null}}(e.html);
24if(!i)return;let a=t.currentTarget.getBoundingClientRect();tb(e.id),ty({config:i,rect:a,availableWidth:Math.max(560,Math.round(a.width||560)),from:0,to:0})}let tG=(0,s.useCallback)(e=>{tf&&eH(t=>t.map(t=>t.id===tf&&"infographic"===t.kind?{...t,html:e}:t))},[tf]),tU=async e=>{let t=U[e];tu(null),tp(!1);let i={kind:"text",id:tz(),role:"user",content:`${t} 시각화 자료를 생성해주세요.`,timestamp:new Date};eH(e=>[...e,i]),eG(!0),eQ(!1);try{let i=await eM(),a=await fetch("/api/chat",{method:"POST",headers:i,body:JSON.stringify({programName:O,programId:T,...K?{documentId:K}:{},message:`${t} 시각화`,context:tF(),history:[],infographicType:e,...eS?{referenceText:eS}:{},...ev.find(e=>e.requestId)?.requestId?{requestId:ev.find(e=>e.requestId)?.requestId}:{}})});if(!a.ok){if(401===a.status)return void eH(e=>[...e,{kind:"text",id:tz(),role:"assistant",content:"로그인이 필요합니다.",timestamp:new Date}]);if(429===a.status){let t=await a.json().catch(()=>null);tM(t?.quotaData??t,"chat","chat",()=>{tU(e)});return}throw Error("API 오류")}let l=await a.json();if(l?.mode==="infographic"&&"string"==typeof l.html)eH(e=>[...e,{kind:"infographic",id:tz(),role:"assistant",html:l.html,timestamp:new Date}]);else throw Error("인포그래픽 생성 실패")}catch{eH(e=>[...e,{kind:"text",id:tz(),role:"assistant",content:"시각화 자료 생성 중 오류가 발생했습니다. 다시 시도해주세요.",timestamp:new Date}])}finally{eG(!1)}},tJ=async(e,t)=>{await navigator.clipboard.writeText(e),eJ(t),setTimeout(()=>eJ(null),2e3)},tZ=(0,s.useMemo)(()=>{if(!ep||"table"!==ep.kind||!ep.cells?.length)return null;let e=new Map;ep.cells.forEach(t=>{let i=e.get(t.row)||[];i.push({col:t.col,text:t.text,isHeader:t.isHeader}),e.set(t.row,i)});let t=Array.from(e.keys()).sort((e,t)=>e-t).map(t=>(e.get(t)||[]).sort((e,t)=>e.col-t.col)),i=Math.min(...ep.cells.map(e=>e.col)),a=t.map(e=>e.map(e=>e.text||"").join("	").trimEnd()).join("\n").trim(),l=t.flatMap(e=>e.map(e=>e.text||"").filter(Boolean)).join("\n").trim(),s=t.map(e=>{let t=e[0],a=e[1];return t&&a&&t.text&&a.text&&(t.isHeader||t.col===i)?`${t.text}: ${a.text}`:null}).filter(Boolean);return{tsv:a,values:l,pairs:s.join("\n").trim(),isPairable:s.length>0&&s.length===t.length,hasValues:!!l,hasTable:!!a}},[ep]),tQ=async e=>{if(eX)return;e2(!0);let{fieldIds:t,fieldDefs:i,labelMap:a,checkboxOptionsByFieldId:l}=tR(e),s=tW(t,i);if(!t||0===t.length)return void eH(e=>[...e,{kind:"text",id:tz(),role:"assistant",content:"해당 섹션에서 채울 필드를 찾지 못했습니다. (data-section/data-field 확인 필요)",timestamp:new Date}]);let r=`quick_${tz()}`,n=`optA_${tz()}`,o=`optB_${tz()}`,d={kind:"quick_options",id:r,role:"assistant",title:`${e.label} (2가지 옵션)`,options:[{id:n,title:"옵션 A",content:"생성 중...",applied:!1},{id:o,title:"옵션 B",content:"생성 중...",applied:!1}],timestamp:new Date};eH(t=>[...t,{kind:"text",id:tz(),role:"user",content:`빠른 작성: ${e.label}`,timestamp:new Date},d]),eG(!0),eQ(!1);try{let d=await eM(),c=await fetch("/api/quick-fill",{method:"POST",headers:d,body:JSON.stringify({programId:T,programName:O,...K?{documentId:K}:{},sectionKey:e.sectionKeys.join("+"),sectionLabel:e.label,variants:["A","B"],fieldIds:t,fieldDefs:i,checkboxOptionsByFieldId:l,existingContent:tF(t),selectedPreview:ep?.preview||"",...eS?{referenceText:eS}:{}})}),u=await c.json().catch(()=>({}));if(!c.ok){if(401===c.status){eH(e=>e.map(e=>"quick_options"!==e.kind||e.id!==r?e:{...e,options:[{id:n,title:"옵션 A",content:"로그인이 필요합니다.",applied:!1},{id:o,title:"옵션 B",content:"로그인이 필요합니다.",applied:!1}]})),eH(e=>[...e,{kind:"text",id:tz(),role:"assistant",content:"로그인이 필요합니다.",timestamp:new Date}]);return}if(429===c.status){let t=tM(u,"chat","chat",()=>{tQ(e)});eH(e=>e.map(e=>"quick_options"!==e.kind||e.id!==r?e:{...e,options:[{id:n,title:"옵션 A",content:"일일한도 제한으로 생성이 중단되었습니다.",applied:!1},{id:o,title:"옵션 B",content:"일일한도 제한으로 생성이 중단되었습니다.",applied:!1}]})),t&&tO({generationLimitPerDay:t.generationLimitPerDay,chatLimitPerDay:t.chatLimitPerDay,interviewCount:t.interviewCount,quickCount:t.quickCount,chatCount:t.chatCount});return}if(500===c.status&&"string"==typeof u.hint){let e=u.hint;eH(t=>t.map(t=>"quick_options"!==t.kind||t.id!==r?t:{...t,options:[{id:n,title:"옵션 A",content:e,applied:!1},{id:o,title:"옵션 B",content:e,applied:!1}]})),eH(t=>[...t,{kind:"text",id:tz(),role:"assistant",content:e,timestamp:new Date}]);return}let t="string"==typeof u?.error?u.error:"오류가 발생했습니다. 다시 시도해주세요.";throw Error(t)}let m=u?.fieldMapByVariant?.A||u?.fieldMap||{},p=u?.fieldMapByVariant?.B||{},h=e=>{let i=t.filter(t=>"string"==typeof e[t]&&e[t].trim().length>0),l=i.map(t=>({id:t,v:e[t]})).slice(0,10).map(e=>`- ${a[e.id]||tB(e.id)}: ${e.v.slice(0,80)}`).join("\n"),s=`총 ${t.length}개 중 ${i.length}개 채움`;return`${s}
25${l||"(생성된 내용이 비어 있습니다)"}`},g=h(m),f=h(p);eH(e=>e.map(e=>"quick_options"!==e.kind||e.id!==r?e:{...e,options:[{id:n,title:"옵션 A",content:g||"(내용 없음)",fieldMap:m,fieldDefs:i,labelMap:a,beforeMap:s,applied:!1},{id:o,title:"옵션 B",content:f||"(내용 없음)",fieldMap:p,fieldDefs:i,labelMap:a,beforeMap:s,applied:!1}]}))}catch(t){console.error(t);let e=t instanceof Error&&t.message?t.message:"오류가 발생했습니다. 다시 시도해주세요.";eH(t=>t.map(t=>"quick_options"!==t.kind||t.id!==r?t:{...t,options:[{id:n,title:"옵션 A",content:e,applied:!1},{id:o,title:"옵션 B",content:e,applied:!1}]}))}finally{eG(!1)}},tY=(0,s.useMemo)(()=>({programName:O||"",programId:T,quickActions:tE,collectFieldsForAction:tR,extractBeforeMap:tW,buildAuthHeaders:eM,buildMeaningfulContext:tF,deriveLabelFromFieldId:tB}),[O,T,tE,L]),t0=(e,t,i,a)=>{eH(l=>l.map(l=>"quick_options"!==l.kind||l.id!==e?l:{...l,options:[{id:t,title:i,content:a,applied:!1},{id:`${t}_placeholder`,title:"참고",content:a,applied:!1}]}))},t1=async e=>{var t;let i;if(eX)return;e2(!0);let a=e.issues.filter(e=>"data_needed"===e.type),l=e.issues.filter(e=>"improve"===e.type);if(a.length>0){let t={kind:"data_questions",id:`dq_${tz()}`,role:"assistant",questions:a.map(e=>({issue:e.issue,question:e.question||e.issue})),_pendingImproveIssues:l,_allSections:e.allSections,answered:!1,timestamp:new Date};eH(i=>[...i,{kind:"text",id:tz(),role:"user",content:`[합격 가능성 분석 > 정보 보완 요청]
26이슈: ${e.issues.map(e=>e.issue).join(", ")}`,timestamp:new Date},t]);return}let s=`improve_${tz()}`,r=`imp_${tz()}`,n=(t=e.allSections,i=new Set((e.issues||[]).map(e=>e.sectionId).filter(e=>!!e)),t.filter(e=>e.score/e.maxScore<.8||i.has(e.sectionId)).map(e=>e.sectionName).join(", "));eH(t=>[...t,{kind:"text",id:tz(),role:"user",content:[`[합격 가능성 분석 > 개선 요청]`,`개선 대상: ${n||"전체"}`,"",...e.issues.filter(e=>"improve"===e.type).map((e,t)=>{let i="functional"===e.subtype?"\uD83D\uDD27 단순 수정":"✨ 내용 보강",a=[`${t+1}. [${i}] ${e.issue}`];return e.fieldHint&&a.push(`   📍 대상 필드: ${e.fieldHint}`),e.snippet&&a.push(`   📌 원문: "${e.snippet}"`),a.join("\n")}),...e.issues.some(e=>"data_needed"===e.type)?["",`📋 정보 보완 필요:`,...e.issues.filter(e=>"data_needed"===e.type).map((e,t)=>`${t+1}. ${e.issue}`)]:[]].join("\n"),timestamp:new Date},{kind:"quick_options",id:s,role:"assistant",title:"합격 가능성 개선안",options:[{id:r,title:"개선안",content:"생성 중...",applied:!1},{id:`${r}_placeholder`,title:"참고",content:"합격 가능성 분석 결과를 바탕으로 개선안을 생성합니다.",applied:!1}],timestamp:new Date}]),eG(!0),eQ(!1);try{let t=await z(e,tY);if("no_fields"===t.type)return void eH(e=>e.filter(e=>e.id!==s).concat({kind:"text",id:tz(),role:"assistant",content:"개선 요청에 해당하는 필드를 찾지 못했습니다. 다른 섹션을 먼저 작성해주세요.",timestamp:new Date}));if("auth_error"===t.type)return void t0(s,r,"개선안","로그인이 필요합니다.");if("quota_error"===t.type){let i=tM(t.data,t.data.exceeded,"chat",()=>{t1(e)});t0(s,r,"개선안","일일한도 제한으로 생성이 중단되었습니다."),i&&tO({generationLimitPerDay:i.generationLimitPerDay,chatLimitPerDay:i.chatLimitPerDay,interviewCount:i.interviewCount,quickCount:i.quickCount,chatCount:i.chatCount});return}if("error"===t.type)throw Error(t.message);Object.keys(t.fieldMap).length>0?eH(i=>i.map(i=>"quick_options"!==i.kind||i.id!==s?i:{...i,options:[{id:r,title:"개선안",content:t.summary||"(내용 없음)",fieldMap:t.fieldMap,fieldDefs:t.fieldDefs,labelMap:t.labelMap,beforeMap:t.beforeMap,changeReasons:t.changeReasons,fieldModes:t.fieldModes,applied:!1,improvementMeta:{sections:t.sections}},{id:`${r}_placeholder`,title:"개선 요약",content:`개선 대상: ${n||"전체"}
27이슈: ${e.issues.map(e=>e.issue).join(", ")}`,applied:!1}]})):eH(e=>[...e.filter(e=>"quick_options"!==e.kind||e.id!==s),{kind:"text",id:tz(),role:"assistant",content:t.summary||"개선할 수 있는 항목이 없습니다. 문서 내용을 확인한 후 다시 시도해주세요.",timestamp:new Date}])}catch(e){console.error(e),t0(s,r,"개선안",e instanceof Error&&e.message?e.message:"오류가 발생했습니다. 다시 시도해주세요.")}finally{eG(!1)}},t2=async(e,t)=>{if(eX)return;e2(!0);let i=`datasup_${tz()}`,a=`ds_${tz()}`;eH(e=>[...e,{kind:"text",id:tz(),role:"user",content:`[추가 정보 반영]
28
29${t}`,timestamp:new Date},{kind:"quick_options",id:i,role:"assistant",title:"추가 정보 반영 결과",options:[{id:a,title:"보완안",content:"생성 중...",applied:!1},{id:`${a}_placeholder`,title:"참고",content:"답변 내용을 바탕으로 관련 필드만 보완합니다.",applied:!1}],timestamp:new Date}]),eG(!0),eQ(!1);try{let l=await E({questions:e,userAnswersText:t},tY);if("no_fields"===l.type)return void eH(e=>e.filter(e=>e.id!==i).concat({kind:"text",id:tz(),role:"assistant",content:"보완에 해당하는 필드를 찾지 못했습니다.",timestamp:new Date}));if("auth_error"===l.type)return void t0(i,a,"보완안","로그인이 필요합니다.");if("quota_error"===l.type){let s=tM(l.data,l.data.exceeded,"chat",()=>{t2(e,t)});t0(i,a,"보완안","일일한도 제한으로 생성이 중단되었습니다."),s&&tO({generationLimitPerDay:s.generationLimitPerDay,chatLimitPerDay:s.chatLimitPerDay,interviewCount:s.interviewCount,quickCount:s.quickCount,chatCount:s.chatCount});return}if("error"===l.type)throw Error(l.message);eH(e=>e.map(e=>"quick_options"!==e.kind||e.id!==i?e:{...e,options:[{id:a,title:"보완안",content:l.summary||"(변경 없음)",fieldMap:l.fieldMap,fieldDefs:l.fieldDefs,labelMap:l.labelMap,beforeMap:l.beforeMap,applied:!1},{id:`${a}_placeholder`,title:"보완 요약",content:`답변 기반 ${l.changedCount}개 필드 보완
30${l.questions.map(e=>`• ${e.issue}`).join("\n")}`,applied:!1}]}))}catch(e){console.error(e),t0(i,a,"보완안",e instanceof Error&&e.message?e.message:"오류가 발생했습니다. 다시 시도해주세요.")}finally{eG(!1)}};(0,s.useEffect)(()=>{eg&&!eX&&(t1(eg),ef?.())},[eg]);let t3="dock"===eu;return e?(0,a.jsx)(I.N,{children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A.X,{data:e3,onClose:()=>{e5(null),eH(e=>e.map(e=>{if("quick_options"!==e.kind||!e.options.some(e=>"생성 중..."===e.content))return e;let t=e.options.map(e=>"생성 중..."===e.content?{...e,content:"일일한도 제한으로 생성이 중단되었습니다.",applied:!1}:e);return{...e,options:t}}))},onRetry:tt?tT:void 0}),(0,a.jsx)(S.c,{open:e4,onClose:tP,context:"owner_quota",programId:T??null,programName:O,onNotifyOwner:K?()=>void tq():void 0,ownerNotified:e8,notifyOwnerPending:e7}),tx&&(0,a.jsx)(V.H,{active:tx,onClose:()=>{ty(null),tb(null)},onChange:tG},`${tf??"chat"}-${tx.availableWidth??"auto"}`),null!==tv&&(0,a.jsx)(G,{onClose:()=>tw(null),onInsertHtml:i,initialType:"gallery"===tv?void 0:tv}),tm&&tc&&tD&&(0,a.jsx)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/40 px-4 py-6",children:(0,a.jsxs)("div",{className:"flex max-h-[calc(100vh-48px)] w-[min(960px,calc(100vw-32px))] flex-col overflow-hidden rounded-3xl bg-white shadow-2xl",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4 border-b border-gray-100 px-5 py-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-base font-semibold text-gray-900",children:[U[tc]," 미리보기"]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"실제 내용은 현재 문서와 요청에 맞춰 바뀝니다."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>tp(!1),className:"rounded-full p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700","aria-label":"미리보기 닫기",children:(0,a.jsx)(r.A,{className:"h-5 w-5"})})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden bg-gray-50 p-5",children:(0,a.jsx)("div",{className:"mx-auto w-full max-w-[680px] rounded-2xl bg-white p-4 shadow-sm",children:(0,a.jsx)("div",{className:"infographic-chat-preview-surface w-full overflow-hidden",dangerouslySetInnerHTML:{__html:F.default.sanitize(tD,J)}})})}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-gray-100 px-5 py-4",children:[(0,a.jsx)(j.$,{type:"button",variant:"outline",onClick:()=>tp(!1),children:"닫기"}),(0,a.jsx)(j.$,{type:"button",disabled:eX,onClick:()=>void tU(tc),className:"bg-indigo-600 text-white hover:bg-indigo-700",children:"이 형식으로 생성"})]})]})}),t3?null:(0,a.jsx)(_.P.div,{initial:{opacity:0}
30,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/20 z-40 lg:hidden",onClick:t}),(0,a.jsxs)(_.P.div,{initial:t3?{x:0,opacity:1}:{x:"100%",opacity:0},animate:{x:0,opacity:1},exit:t3?{x:0,opacity:0}:{x:"100%",opacity:0},transition:{type:"spring",damping:25,stiffness:200},className:t3?"relative h-full w-full bg-white flex flex-col min-h-0 border-l border-gray-100":"relative fixed top-0 right-0 h-full w-full sm:w-[520px] bg-white shadow-xl z-50 flex flex-col min-h-0 border-l border-gray-200",onDragEnter:eL,onDragLeave:ez,onDragOver:eE,onDrop:eF,children:[eT&&(0,a.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-blue-50/90 border-2 border-dashed border-blue-400 rounded-lg pointer-events-none",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2 text-blue-600",children:[(0,a.jsx)(n.A,{className:"w-8 h-8"}),(0,a.jsx)("p",{className:"text-sm font-medium",children:"참고자료 파일을 놓으세요"}),(0,a.jsx)("p",{className:"text-xs text-blue-400",children:"PDF, TXT, DOCX, MD (최대 4MB)"})]})}),em?null:(0,a.jsxs)("div",{className:"px-5 py-4 flex items-center justify-between bg-blue-600 sticky top-0 z-10",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-11 h-11 rounded-full overflow-hidden ring-2 ring-white/30 shadow-lg",children:(0,a.jsx)("img",{src:"/logo.svg",alt:"AI 도우미",className:"w-full h-full object-cover bg-white"})}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-semibold text-white text-base leading-tight",children:"AI 도우미"}),(0,a.jsxs)("span",{className:"text-xs text-blue-100 mt-0.5 flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-full bg-green-400 animate-pulse"}),"Online"]})]})]}),(0,a.jsx)(j.$,{variant:"ghost",size:"icon",onClick:t,className:"text-white/80 hover:text-white hover:bg-white/10 rounded-full h-9 w-9 transition-colors","aria-label":"닫기",children:(0,a.jsx)(r.A,{className:"w-5 h-5"})})]}),(0,a.jsx)(N.F,{className:"flex-1 min-h-0 bg-gray-50",ref:t$,children:(0,a.jsxs)("div",{className:"p-5 pb-8 space-y-5",children:[eo?(0,a.jsx)("div",{className:"rounded-2xl bg-white p-4 border border-gray-100 shadow-sm",children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)(o.A,{className:"w-4 h-4 text-blue-600"}),(0,a.jsx)("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"현재 작성 중"})]}),(0,a.jsx)("p",{className:"text-[15px] font-semibold text-gray-900 truncate leading-snug",children:eo.title}),eo.subsectionTitle?(0,a.jsx)("p",{className:"text-sm text-gray-500 truncate mt-0.5",children:eo.subsectionTitle}):null]}),(0,a.jsxs)(j.$,{size:"sm",onClick:tL,disabled:eY,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm h-9 px-4 rounded-full font-semibold shadow-md transition-all active:scale-95 shrink-0",children:[eY?(0,a.jsx)(d.A,{className:"w-4 h-4 animate-spin mr-1.5"}):(0,a.jsx)(c.A,{className:"w-4 h-4 mr-1.5"}),"자동 작성"]})]})}):null,(0,a.jsxs)("div",{className:"space-y-3 bg-white rounded-2xl p-4 border border-gray-100 shadow-sm",children:[(0,a.jsxs)("button",{onClick:()=>eQ(!eZ),className:"w-full flex items-center justify-between text-sm group",type:"button",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 font-semibold text-gray-900",children:[(0,a.jsx)(u.A,{className:"w-4 h-4 text-blue-600"}),"빠른 작성 도우미"]}),(0,a.jsx)(m.A,{className:`w-4 h-4 text-gray-400 transition-transform duration-200 group-hover:text-blue-600 ${eZ?"rotate-180":""}`})]}),(0,a.jsx)(I.N,{initial:!1,children:eZ?(0,a.jsx)(_.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 pt-2",children:tE.map(e=>(0,a.jsx)("button",{onClick:()=>void tQ(e),disabled:eX,className:"px-3.5 py-2.5 text-sm font-medium bg-gray-50 border border-gray-100 rounded-xl hover:border-blue-500 hover:bg-blue-50 hover:text-blue-600 transition-all disabled:opacity-50 disabled:cursor-not-allowed text-left text-gray-700",type:"button",children:e.label},e.id))})}):null})]}),(0,a.jsxs)("div",{className:"bg-white rounded-2xl p-4 border border-gray-100 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-3",children:[(0,a.jsx)(p.A,{className:"w-4 h-4 text-indigo-500 shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"인포그래픽 생성"})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:["tam-sam-som","competitive-matrix","roadmap","tech-architecture"].map(e=>(0,a.jsx)("button",{type:"button",disabled:eX,onClick:()=>{tu(e),tp(!0)},className:`px-3.5 py-2.5 text-sm font-medium rounded-xl border transition-all disabled:opacity-50 disabled:cursor-not-allowed text-left ${tc===e?"border-indigo-400 bg-indigo-50 text-indigo-700":"border-gray-100 bg-gray-50 text-gray-700 hover:border-indigo-400 hover:bg-indigo-50 hover:text-indigo-700"}`,children:U[e]},e))}),(0,a.jsx)(I.N,{initial:!1,children:tc&&tD?(0,a.jsx)(_.P.div,{initial:{opacity:0,height:0}
30,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"mt-3 rounded-2xl border border-indigo-100 bg-indigo-50/40 p-3",children:[(0,a.jsxs)("p",{className:"text-xs font-semibold text-indigo-700",children:[U[tc]," 선택됨"]}),(0,a.jsx)("p",{className:"mt-0.5 text-[11px] text-gray-500",children:"실제 내용은 현재 문서와 요청에 맞춰 바뀝니다."}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,a.jsx)(j.$,{type:"button",size:"sm",variant:"outline",disabled:eX,onClick:()=>tp(!0),className:"border-indigo-100 bg-white text-indigo-700 hover:bg-indigo-50",children:"미리보기"}),(0,a.jsx)(j.$,{type:"button",size:"sm",disabled:eX,onClick:()=>void tU(tc),className:"bg-indigo-600 text-white hover:bg-indigo-700",children:"생성"})]}),(0,a.jsx)(j.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>tu(null),className:"mt-2 h-7 w-full text-xs text-gray-400 hover:bg-transparent hover:text-gray-700",children:"선택 취소"})]})}):null}),(0,a.jsxs)("div",{className:"mt-3 border-t border-gray-100 pt-3",children:[(0,a.jsxs)("p",{className:"flex items-center gap-1.5 px-1 text-xs font-semibold text-gray-500",children:[(0,a.jsx)(h.A,{className:"h-3.5 w-3.5"}),D.CA.sectionName]}),(0,a.jsxs)("div",{className:"mt-2 rounded-xl border border-gray-100 bg-gray-50 p-2.5",children:[(0,a.jsx)("button",{type:"button",disabled:eX,onClick:()=>tj(),"aria-describedby":"business-asset-entry-note",className:"flex w-full items-start gap-3 rounded-lg px-1 py-1 text-left transition-colors hover:bg-white disabled:cursor-not-allowed disabled:opacity-50",children:(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block text-sm font-semibold text-gray-900",children:D.CA.entryTitle}),(0,a.jsx)("span",{className:"mt-0.5 block text-xs leading-5 text-gray-500",children:D.CA.entryDescription})]})}),(0,a.jsx)("div",{className:"mt-2 grid gap-1.5 sm:grid-cols-2",children:D.gX.map(e=>{let t=(0,M.S)(e);return t?(0,a.jsxs)("button",{type:"button",disabled:eX,onClick:()=>tj(e),title:t.bestFor,className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-2.5 py-2 text-left text-xs font-medium text-gray-800 transition-colors hover:border-emerald-300 hover:bg-emerald-50 focus-visible:border-emerald-500 focus-visible:ring-2 focus-visible:ring-emerald-200 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:["comparison-table"===e?(0,a.jsx)(g.A,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600"}):(0,a.jsx)(f.A,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600"}),(0,a.jsx)("span",{className:"min-w-0 truncate",children:(0,D.wf)(e)})]},e):null})}),(0,a.jsx)("p",{id:"business-asset-entry-note",className:"mt-2 px-1 text-[11px] text-gray-400",children:D.CA.entryNote})]})]})]}),(0,a.jsxs)("div",{className:"space-y-6 pt-2",children:[eB.map(e=>{let t,s,r;return(0,a.jsxs)("div",{className:`flex flex-col ${"user"===e.role?"items-end":"items-start"}`,children:["assistant"===e.role&&(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2.5",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-full overflow-hidden shrink-0 shadow-md ring-2 ring-white",children:(0,a.jsx)("img",{src:"/ai-helper-profile.png",alt:"AI 도우미",className:"w-full h-full object-cover"})}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-[15px] font-semibold text-gray-900",children:"AI 도우미"}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]}),"text"===e.kind?(0,a.jsxs)("div",{className:`relative max-w-[85%] px-4 py-3 text-[15px] leading-relaxed ${"user"===e.role?"bg-blue-600 text-white rounded-[20px] rounded-tr-[4px] shadow-md":"bg-white text-gray-900 rounded-[20px] rounded-tl-[4px] shadow-sm border border-gray-100"}`,children:[(s=(t=String(e.content||"")).startsWith("일일한도 제한으로 생성이 중단되었습니다.")?t.replace(" (","\n("):t,(0,a.jsx)("div",{className:"whitespace-pre-wrap",children:s.split(/(\*\*[^*]+\*\*)/g).map((e,t)=>e.startsWith("**")&&e.endsWith("**")&&e.length>4?(0,a.jsx)("strong",{children:e.slice(2,-2)},t):e)})),"assistant"===e.role&&"welcome"!==e.id&&!String(e.content||"").startsWith("일일한도 제한으로 생성이 중단되었습니다.")&&(0,a.jsx)("div",{className:"mt-4 pt-3 border-t border-gray-200 flex gap-2",children:(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",className:"h-7 text-xs text-gray-500 hover:text-gray-900 hover:bg-gray-200 px-2.5 rounded-full transition-colors",onClick:()=>tJ(e.content,`copy_text:${e.id}`),children:[eU===`copy_text:${e.id}`?(0,a.jsx)(b.A,{className:"w-3 h-3 mr-1 text-green-500"}):(0,a.jsx)(x.A,{className:"w-3 h-3 mr-1"}),eU===`copy_text:${e.id}`?"복사됨":"복사"]})})]}):"blocks"===e.kind?(0,a.jsxs)("div",{className:"max-w-[90%] w-full rounded-2xl rounded-tl-sm bg-gray-100 p-1 shadow-sm",children:[(0,a.jsx)("div",{className:"px-4 py-3 text-sm font-bold text-gray-800 border-b border-gray-200/50 bg-white/50 rounded-t-[12px]",children:e.title}),(0,a.jsx)("div",{className:"p-3 space-y-3",children:e.blocks.map(t=>{let l=`copy_block:${e.id}:${t.id}`;return(0,a.jsxs)("div",{className:"rounded-xl border border-gray-100 bg-white p-4 shadow-sm hover:shadow-md transition-shadow",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-gray-700",children:t.label}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(j.$,{size:"sm",variant:"outline",className:"h-8 border-blue-200 text-blue-700 hover:bg-blue-50",onClick:()=>i(t.content),"aria-label":`${t.label} 적용`,children:"적용"}),(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",className:"h-7 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100 px-2",onClick:()=>tJ(t.content,l),"aria-label":`${t.label}
30 복사`,children:[eU===l?(0,a.jsx)(b.A,{className:"w-3 h-3 mr-1 text-emerald-500"}):(0,a.jsx)(x.A,{className:"w-3 h-3 mr-1"}),eU===l?"복사됨":"복사"]})]})]}),(0,a.jsx)("div",{className:"mt-2 whitespace-pre-wrap text-sm text-gray-700",children:t.content})]},t.id)})})]}):"cell_results"===e.kind?(0,a.jsxs)("div",{className:"rounded-xl border border-blue-200 bg-white overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 border-b border-blue-100 bg-blue-50 px-4 py-3",children:[(0,a.jsx)(y.A,{className:"h-4 w-4 text-blue-600"}),(0,a.jsxs)("span",{className:"text-sm font-semibold text-blue-900",children:["셀별 교체 결과 (",e.cells.length,"셀)"]})]}),(0,a.jsxs)("div",{className:"p-4 space-y-3",children:[e.cells.map(e=>(0,a.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3",children:[(0,a.jsxs)("div",{className:"text-xs font-semibold text-blue-700 mb-1",children:["행",e.row+1," / 열",e.col+1]}),(0,a.jsx)("div",{className:"text-sm text-gray-700 whitespace-pre-wrap break-words line-clamp-3",children:e.content})]},`${e.row}-${e.col}`)),(0,a.jsx)(j.$,{type:"button",size:"sm",variant:"outline",disabled:to.has(e.id),onClick:()=>{!to.has(e.id)&&(td(t=>new Set(t).add(e.id)),ex&&ex(e.cells))},className:"w-full h-8 border-blue-200 text-blue-700 hover:bg-blue-50 disabled:opacity-50 disabled:cursor-not-allowed",children:to.has(e.id)?"적용됨":"전체 셀에 적용"})]})]},e.id):"table_structure"===e.kind?(0,a.jsxs)("div",{className:"rounded-xl border border-indigo-200 bg-white overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 border-b border-indigo-100 bg-indigo-50 px-4 py-3",children:[(0,a.jsx)(y.A,{className:"h-4 w-4 text-indigo-600"}),(0,a.jsxs)("span",{className:"text-sm font-semibold text-indigo-900",children:["테이블 구조 변경",e.html?"":` (${e.rows.length}행)`]})]}),(0,a.jsxs)("div",{className:"p-4 space-y-2",children:[e.html?(0,a.jsx)("div",{className:"table-preview overflow-auto text-[11px] leading-snug",style:{maxHeight:320},dangerouslySetInnerHTML:{__html:F.default.sanitize(e.html,{ALLOWED_TAGS:["table","thead","tbody","tfoot","tr","th","td","colgroup","col","p","br","span","strong","em"],ALLOWED_ATTR:["class","style","colspan","rowspan","data-colwidth","data-background-color"]})}}):(0,a.jsx)("div",{className:"overflow-auto rounded-lg border border-gray-200",style:{maxHeight:320},children:(0,a.jsx)("table",{className:"min-w-full text-xs",children:(0,a.jsx)("tbody",{children:e.rows.map((e,t)=>(0,a.jsx)("tr",{className:t%2==0?"bg-gray-50":"bg-white",children:e.map((e,t)=>{let i=e.isHeader?"th":"td";return(0,a.jsx)(i,{className:"border border-gray-200 px-2 py-1 text-left font-normal break-words",children:e.content},t)})},t))})})}),(0,a.jsx)(j.$,{type:"button",size:"sm",variant:"outline",disabled:to.has(e.id),onClick:()=>{!to.has(e.id)&&(td(t=>new Set(t).add(e.id)),ey&&ey(e.rows,e.html))},className:"w-full h-8 border-indigo-200 text-indigo-700 hover:bg-indigo-50 disabled:opacity-50 disabled:cursor-not-allowed",children:to.has(e.id)?"적용됨":"테이블 교체"})]})]},e.id):"data_questions"===e.kind?(0,a.jsxs)("div",{className:"max-w-[90%] w-full rounded-2xl rounded-tl-sm bg-amber-50 border border-amber-200 px-4 py-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-amber-100 text-amber-600 text-xs font-bold",children:"?"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-amber-800",children:"추가 정보가 필요합니다"})]}),(0,a.jsx)("p",{className:"text-xs text-amber-700 mb-4",children:"아래 질문에 답변해주시면, 답변 내용을 바탕으로 사업계획서를 보완합니다."}),e.answered?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"space-y-2",children:e.questions.map((t,i)=>{let l=tk[e.id]||{},s=l[String(i)]?.trim();return s?(0,a.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-white p-3",children:[(0,a.jsxs)("p",{className:"text-xs text-gray-600 font-medium mb-1",children:["Q: ",t.question]}),(0,a.jsxs)("p",{className:"text-sm text-gray-700",children:["A: ",s]})]},i):null})}),(0,a.jsx)("div",{className:"rounded-lg bg-white border border-gray-200 p-3 text-center",children:(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"답변이 반영되었습니다. 개선안을 생성 중입니다..."})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-3",children:e.questions.map((t,i)=>{let l=(tk[e.id]||{})[String(i)]??"";return(0,a.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-white p-3 shadow-sm",children:[(0,a.jsx)("p",{className:"text-xs text-amber-600 mb-1",children:t.issue}),(0,a.jsx)("p",{className:"text-sm font-medium text-gray-800 mb
30-2",children:t.question}),(0,a.jsx)("textarea",{className:"w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-800 focus:outline-none focus:ring-2 focus:ring-amber-400 resize-none",rows:2,placeholder:"여기에 답변을 입력하세요...",value:l,onChange:t=>{let a=t.target.value;tN(t=>({...t,[e.id]:{...t[e.id]||{},[String(i)]:a}}))},"aria-label":t.question})]},i)})}),(0,a.jsxs)("div",{className:"mt-4 flex gap-2",children:[(0,a.jsxs)(j.$,{size:"sm",className:"flex-1 h-9 text-sm bg-amber-500 hover:bg-amber-600 text-white rounded-lg",onClick:()=>(e=>{let t=eB.find(t=>t.id===e);if(!t)return;let i=tk[e]||{};eH(t=>t.map(t=>t.id===e?{...t,answered:!0}:t));let a=t.questions.map((e,t)=>{let a=i[String(t)]?.trim();return a?`Q: ${e.question}
31A: ${a}`:null}).filter(Boolean).join("\n\n");a?t2(t.questions,a):t._pendingImproveIssues.length>0&&t1({issues:t._pendingImproveIssues,allSections:t._allSections})})(e.id),disabled:eX,children:[(0,a.jsx)(y.A,{className:"w-3.5 h-3.5 mr-1.5"}),"답변 완료 → 개선 시작"]}),(0,a.jsx)(j.$,{variant:"ghost",size:"sm",className:"h-9 text-sm text-gray-500 hover:text-gray-700",onClick:()=>{eH(t=>t.map(t=>t.id===e.id?{...t,answered:!0}:t)),e._pendingImproveIssues.length>0&&t1({issues:e._pendingImproveIssues,allSections:e._allSections})},disabled:eX,children:"건너뛰기"})]})]})]}):"quick_options"===e.kind?(r=(e,t,i)=>{if(!l||!t.fieldMap||!t.fieldDefs)return;l({[i]:t.fieldMap[i]},t.fieldDefs.filter(e=>e.fieldId===i));let a=`${e.id}:${t.id}`;tn(e=>{let t=e[a]||new Set;return{...e,[a]:new Set([...t,i])}})},(0,a.jsxs)("div",{className:"max-w-[90%] w-full rounded-2xl rounded-tl-sm bg-gray-100 px-4 py-3",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-800",children:e.title}),(0,a.jsx)("div",{className:"mt-3 grid grid-cols-1 gap-2",children:e.options.filter(t=>!e.appliedOptionId||t.id===e.appliedOptionId).map(t=>{let i,s,n=e.appliedOptionId===t.id,o=e.options[0],c=t.fieldMap||o?.fieldMap,u=t.fieldDefs||o?.fieldDefs,m=!!(l&&c&&u&&u.length),p=t.fieldMap?t:{...t,fieldMap:c,fieldDefs:u};return(0,a.jsxs)("div",{className:"rounded-lg bg-white p-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-gray-700",children:t.title}),n?(0,a.jsx)("span",{className:"text-xs font-medium text-emerald-600 bg-emerald-50 border border-emerald-200 rounded-full px-2 py-0.5",children:"적용완료"}):(0,a.jsx)(j.$,{size:"sm",className:"h-7 text-xs bg-blue-500 hover:bg-blue-600 text-white rounded-lg",disabled:!m,onClick:()=>{m&&((e,t)=>{if(!l||!t.fieldMap||!t.fieldDefs)return;l(t.fieldMap,t.fieldDefs),eH(i=>i.map(i=>"quick_options"!==i.kind||i.id!==e.id?i:{...i,appliedOptionId:t.id}));let i=`${e.id}:${t.id}`,a=t.fieldDefs.map(e=>e.fieldId);tn(e=>({...e,[i]:new Set(a)}))})(e,p)},"aria-label":`${t.title} 전체 적용`,children:"전체 적용"})]}),"생성 중..."===t.content?(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-blue-500",children:[(0,a.jsx)(d.A,{className:"w-3.5 h-3.5 animate-spin"}),(s=(i=e.title.replace(" (2가지 옵션)","")).charAt(i.length-1).charCodeAt(0),`${i}${s>=44032&&s<=55203&&(s-44032)%28!=0?"을":"를"} 생성 중...`)]}),(0,a.jsxs)("div",{className:"mt-4 space-y-2.5 animate-pulse",children:[(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-11/12"}),(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-10/12"}),(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-9/12"}),(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-8/12"})]}),(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2 animate-pulse",children:[(0,a.jsx)("div",{className:"h-9 rounded-xl bg-gray-200"}),(0,a.jsx)("div",{className:"h-9 rounded-xl bg-gray-200"})]})]}):(0,a.jsx)("div",{className:"mt-3 whitespace-pre-wrap text-sm text-gray-700 leading-relaxed",children:t.content}),t.beforeMap&&t.fieldDefs&&t.fieldMap?(()=>{let i=`${e.id}:${t.id}`,l=!!tl[i],s=t.labelMap||{},o=t.fieldDefs.map(e=>e.fieldId).map(e=>{let i=tH((t.beforeMap?.[e]||"").trim()),a=tH((t.fieldMap?.[e]||"").trim());return{id:e,before:i,after:a}}).filter(e=>e.before!==e.after&&e.after.length>0);if(0===o.length)return null;let d=t.improvementMeta?.sections||[],c=d.map(e=>e.sectionId),u=e=>{for(let t of c){let i=t.replace(/_/g,"-");if(e.startsWith(i+"-"))return t}if(e.startsWith("overview-")){let t=e.slice(9);for(let e of c){let i=e.replace(/_/g,"-");if(t.startsWith(i))return e}}return null},m=new Map;for(let e of o){let t=u(e.id)||"_etc";m.has(t)||m.set(t,[]),m.get(t).push(e)}let p=[...d.filter(e=>e.isImproveTarget).map(e=>e.sectionId),...d.filter(e=>!e.isImproveTarget).map(e=>e.sectionId),"_etc"].filter(e=>m.has(e)).flatMap(e=>m.get(e));return l?p.length:p.length,(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1",children:[(0,a.jsxs)("div",{className:"text-sm font-semibold text-gray-700",children:["변경사항"," ",(0,a.jsxs)("span",{className:"text-blue-600",children:["(",o.length,"개)"]})]}),p.length>6?(0,a.jsx)("button",{type:"button",onClick:()=>ts(e=>({...e,[i]:!l})),className:"text-sm font-medium text-blue-600 hover:text-blue-700 transition-colors","aria-label":l?"변경 미리보기 접기":"변경 미리보기 더보기",children:l?"접기":"더보기"}):null]}),(l?o:o.slice(0,6)).map(i=>{let l=s[i.id]||tB(i.id),o=tH(i.before)||"(비어 있음)",d=tH(i.after)||"(생성 결과 없음)",c=(tr[`${e.id}:${t.id}`]||new Set).has(i.id);return(0,a.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,a.jsxs)("div",{className:"text-sm font-semibold text-gray-800 flex items-center gap-1.5",children:[l,c&&(0,a.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold bg-emerald-100 text-emerald-700",children:"적용완료"})]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-gray-500 mb-1.5 uppercase tracking-wide",children:"Before"}),(0,a.jsx)("div",{className:"whitespace-pre-wrap text-sm text-gray-600 leading-relaxed",children:o})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-blue-600 mb-1.5 uppercase tracking-wide",children:"After"}),(0,a.jsx)("div",{className:"whitespace-pre-wrap text-sm text-gray-800 leading-relaxed",children:d})]})]}),!n&&!c&&(0,a.jsx)("div",{className:"mt-3 flex justify-end",children:(0,a.jsx)(j.$,{size:"sm",variant:"outline",className:"h-7 text-xs bg-white hover:bg-blue-50 text-blue-600 border-blue-300",onClick:()=>r(e,t,i.id),children:"적용"})})]},i.id)})]})})():null,n?null:(0,a.jsx)("div",{className:"mt-4 flex gap-2",children:(0,a.jsxs)(j.$,{variant:"ghost",size:"sm",className:"h-8 text-xs text-gray-400 hover:text-gray-700 hover:bg-gray-50 px-3 rounded-full",onClick:()=>tJ(t.content,`${e.id}_${t.id}`),children:[(0,a.jsx)(x.A,{className:"w-3.5 h-3.5 mr-1.5"}),"복사"]})})]},t.id)})})]})):"infographic"===e.kind?(0,a.jsxs)("div",{className:"w-full max-w-full rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden",children:[(0,a.jsx)("div",{role:"button",tabIndex:0,className:"relative h-[260px] overflow-hidden bg-gray-50 p-3 cursor-pointer hover:opacity-90 transition-opacity",title:"클릭하여 수정",onClick:t=>tX(e,t),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&tX(e,t)},children:(0,a.jsx)("div",{className:"pointer-events-none absolute left-3 top-3 w-[560px] max-w-none origin-top-left scale-[0.55] sm:scale-[0.6]",dangerouslySetInnerHTML:{__html:F.default.sanitize(e.html,J)}
31})}),(0,a.jsxs)("div",{className:"px-3 py-2.5 border-t border-gray-100 flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"클릭하여 수정"}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsxs)($.Bc,{children:[(0,a.jsxs)($.m_,{children:[(0,a.jsx)($.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:async()=>{try{await (0,W.copyInfographicAsPng)(e.html),B.o.success("복사됨")}catch{B.o.error("복사 실패")}},className:"h-7 w-7 flex items-center justify-center rounded border border-gray-200 text-gray-500 hover:bg-gray-50 hover:text-gray-700 transition-colors",children:(0,a.jsx)(x.A,{className:"w-3.5 h-3.5"})})}),(0,a.jsx)($.ZI,{side:"top",children:"이미지 복사"})]}),(0,a.jsxs)($.m_,{children:[(0,a.jsx)($.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",disabled:th.has(e.id),onClick:async()=>{if(!th.has(e.id)){tg(t=>new Set(t).add(e.id));try{await (0,W.downloadInfographicAsPng)(e.html,"infographic.png")}catch{B.o.error("다운로드 실패")}finally{tg(t=>{let i=new Set(t);return i.delete(e.id),i})}}},className:"h-7 w-7 flex items-center justify-center rounded border border-gray-200 text-gray-500 hover:bg-gray-50 hover:text-gray-700 transition-colors disabled:opacity-40",children:th.has(e.id)?(0,a.jsx)(d.A,{className:"w-3.5 h-3.5 animate-spin"}):(0,a.jsx)(v.A,{className:"w-3.5 h-3.5"})})}),(0,a.jsx)($.ZI,{side:"top",children:"이미지 다운로드"})]})]}),(0,a.jsx)(j.$,{type:"button",size:"sm",disabled:to.has(e.id),onClick:()=>{if(to.has(e.id))return;let t=F.default.sanitize(e.html,J);td(t=>new Set(t).add(e.id)),i(t)},className:"h-7 px-3 text-xs bg-indigo-600 hover:bg-indigo-700 text-white",children:to.has(e.id)?"삽입됨":"에디터에 삽입"})]})]})]}):null]},e.id)}),eX&&eB[eB.length-1]?.role==="user"&&(0,a.jsx)("div",{className:"flex justify-start",children:(0,a.jsxs)("div",{className:"max-w-[85%] w-full rounded-2xl px-5 py-4 bg-gray-100 rounded-tl-sm shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs font-semibold text-blue-600 mb-3",children:[(0,a.jsx)(d.A,{className:"w-3.5 h-3.5 animate-spin"}),"AI가 답변을 생성하고 있어요…"]}),(0,a.jsxs)("div",{className:"space-y-2.5 animate-pulse",children:[(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-full"}),(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-[92%]"}),(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-[85%]"}),(0,a.jsx)("div",{className:"h-3 rounded-full bg-gray-200 w-[70%]"})]})]})})]}),!eX&&eB.length>1&&(0,a.jsx)(_.P.div,{initial:{opacity:0}
31,animate:{opacity:1},className:"mt-4 text-center px-4",children:(0,a.jsx)("p",{className:"text-[11px] text-gray-400",children:"AI는 실수를 할 수 있습니다. 핵심 정보는 별도로 확인해 주세요."})})]})}),ep?(0,a.jsx)("div",{className:"border-t border-gray-100 bg-white px-4 py-3 max-h-[600px] overflow-y-auto",children:(0,a.jsx)("div",{className:"rounded-xl bg-gradient-to-r from-blue-50 to-indigo-50 border border-blue-100 p-3",children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-5 h-5 rounded-md bg-blue-600",children:(0,a.jsx)(o.A,{className:"w-3 h-3 text-white"})}),(0,a.jsx)("span",{className:"text-xs font-semibold text-blue-700",children:"에디터에서 선택됨"})]}),(0,a.jsx)("p",{className:"text-sm font-medium text-gray-900 leading-snug",children:ep.label}),"table"!==ep.kind?(0,a.jsx)("p",{className:"mt-1.5 text-xs text-gray-600 whitespace-pre-wrap line-clamp-2 leading-relaxed",children:ep.preview}):null,tZ?(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap rounded-lg border border-blue-200 bg-white/80 px-3 py-2 text-xs text-gray-700 font-mono max-h-[240px] overflow-y-auto",children:tZ.isPairable?tZ.pairs:tZ.hasTable?tZ.tsv:tZ.values})}):null]}),eh?(0,a.jsx)("button",{type:"button",onClick:eh,"aria-label":"선택 해제",className:"shrink-0 rounded-full p-1 text-gray-400 hover:bg-white hover:text-gray-600 hover:shadow-sm transition-all",children:(0,a.jsx)(r.A,{className:"w-4 h-4"})}):null]})})}):null,(0,a.jsxs)("div",{className:"p-4 border-t border-gray-100 bg-white",children:[ev.length>0&&(0,a.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-1.5 px-1",children:ev.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-1.5 rounded-full bg-blue-50 border border-blue-200 px-3 py-1 text-xs text-blue-700",children:[(0,a.jsx)(n.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"max-w-[140px] truncate",children:e.filename}),(0,a.jsx)("button",{type:"button",onClick:()=>ew?.(ev.filter(t=>t.filename!==e.filename)),className:"ml-0.5 rounded-full p-0.5 hover:bg-blue-100 transition-colors","aria-label":"참고자료 제거",children:(0,a.jsx)(r.A,{className:"w-3 h-3"})})]},e.filename))}),(0,a.jsxs)("div",{className:"relative flex items-end bg-white rounded-2xl border border-gray-200",children:[(0,a.jsx)(k.T,{ref:tI,value:eW,onChange:e=>eV(e.target.value.slice(0,500)),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),tV())},placeholder:"메시지를 입력하세요...",className:"min-h-[48px] max-h-[120px] flex-1 resize-none border-0 bg-transparent rounded-2xl text-[15px] text-gray-900 placeholder:text-gray-400 py-3 px-4 ring-0! outline-none! shadow-none! focus:ring-0! focus:outline-none! focus-visible:ring-0! focus-visible:border-0!",disabled:eX,maxLength:500}),(0,a.jsxs)("div",{className:"flex items-center gap-1 pr-2 pb-2",children:[(0,a.jsx)("input",{ref:t_,type:"file",accept:X.eA,className:"hidden",onChange:eP}),(0,a.jsx)($.Bc,{children:(0,a.jsxs)($.m_,{children:[(0,a.jsx)($.k$,{asChild:!0,children:(0,a.jsx)(j.$,{size:"icon",variant:"ghost","aria-label":"참고자료 업로드 (PDF, TXT, DOCX, MD)",className:`h-8 w-8 rounded-full transition-colors ${eS?"text-blue-600 bg-blue-50":"text-gray-400 hover:text-blue-600 hover:bg-blue-50"}`,disabled:eX||tC||ev.length>=3,onClick:()=>t_.current?.click(),children:tC?(0,a.jsx)(d.A,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(n.A,{className:"w-4 h-4"})})}),(0,a.jsx)($.ZI,{side:"top",children:(0,a.jsx)("p",{children:ev.length>0?`참고자료 ${ev.length}/3개 첨부됨`:`참고자료 첨부 (최대 3개)`})})]})}),(0,a.jsx)(j.$,{size:"icon",variant:"ghost",className:"h-8 w-8 rounded-full text-gray-400 hover:text-blue-600 hover:bg-blue-50 transition-colors",disabled:eX||!eW.trim(),onClick:()=>tV(),children:(0,a.jsx)(w.A,{className:"w-4 h-4"})})]})]}),(0,a.jsx)("div",{className:"mt-2 flex justify-end text-xs text-gray-400 px-1",children:(0,a.jsxs)("span",{children:[eW.length,"/",500]})})]})]})]})}):null})},89123:(e,t,i)=>{i.d(t,{A:()=>a});let a=(0,i(78340).A)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])}}]);

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.