wrong-notebook 2026.11.5-3 → 2026.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/page.js.nft.json +1 -1
- package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__09g6pf6gfjb-i._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__0te5kr0_7nmrv._.js → [root-of-the-server]__1t2h6rz1x-gwk._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__1vj6th0gehszy._.js +3 -0
- package/.next/server/chunks/ssr/_0oo8k-upgx7hb._.js +3 -0
- package/.next/server/chunks/ssr/_117fl8dk5qci2._.js +4 -0
- package/.next/server/chunks/ssr/_1x-_hs_sw5z1x._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_1fwhuynv-5kcg._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_0mr1-2rg_ae47.js → node_modules_heic-to_dist_csp_heic-to_1klwivk06jo8p.js} +1 -1
- package/.next/server/chunks/ssr/src_0atwwo6buvs3b._.js +3 -0
- package/.next/server/chunks/ssr/src_app_exams_page_tsx_17_d4_gy2i1ds._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_add_page_tsx_179tow1ql6vc_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +1 -1
- package/.next/server/chunks/ssr/src_components_image-cropper_tsx_0pcp8-ifruyx-._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/0xze-7xwdgel2.js +8 -0
- package/.next/static/chunks/16c0c5ykflqpn.js +1 -0
- package/.next/static/chunks/1qb_yt4hvopfn.js +8 -0
- package/.next/static/chunks/1ziwji7xw98fj.js +9 -0
- package/.next/static/chunks/25jnmrgxyy1tx.js +1 -0
- package/.next/static/chunks/3_wki8y0qb28v.js +1 -0
- package/.next/static/chunks/{1q3saz647fqri.js → 3ios-g8cm_1vz.js} +1 -1
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0uezowk-9l0x4._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__12jk2bmesr4gc._.js +0 -3
- package/.next/server/chunks/ssr/_127aw5h992s9d._.js +0 -4
- package/.next/server/chunks/ssr/_1t-o815u40ng2._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_1m0t7n1f8dlgz._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_heic-to_dist_csp_heic-to_1m3ywmnbpcnde.js +0 -3
- package/.next/server/chunks/ssr/src_1nbi4yrww3r1m._.js +0 -3
- package/.next/static/chunks/0gu34v572tj7o.js +0 -1
- package/.next/static/chunks/0lnx4h7lv4ev5.js +0 -16
- package/.next/static/chunks/2bk5f71d5ke2y.js +0 -1
- package/.next/static/chunks/2lhxk-8dpncxq.js +0 -1
- package/.next/static/chunks/2n2hvugnmgoy3.js +0 -16
- package/.next/static/chunks/3_w-p8241f5rv.js +0 -1
- /package/.next/static/{T6hfqhqpSQ_GF78vCYl3P → vv9z38w24wHWYLUAbjtdk}/_buildManifest.js +0 -0
- /package/.next/static/{T6hfqhqpSQ_GF78vCYl3P → vv9z38w24wHWYLUAbjtdk}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{T6hfqhqpSQ_GF78vCYl3P → vv9z38w24wHWYLUAbjtdk}/_ssgManifest.js +0 -0
|
@@ -3,4 +3,4 @@ $$
|
|
|
3
3
|
${i}
|
|
4
4
|
$$
|
|
5
5
|
`:`$${i}$`:eO},...t,image:u},h={relationships:i.relationships,files:i.files,mathCollector:o},f=new eT(i.numbering,i.styles),m=(function(e,t,r,n){let i=e.getElementsByTagNameNS(tw,"body")[0];if(!i)return[];let a=[],o=e=>{for(let i of Array.from(e.childNodes))if(i.nodeType===i.ELEMENT_NODE&&i.namespaceURI===tw)if("p"===i.localName){let e=eD(i,r,n),o=t.resolveNumPr(i),s=o?t.paragraphNumber(o[0],o[1]):null,l=s?.trim()??"",u=/[、.。:))]$/.test(l)&&!/[.):]$/.test(l),c=l?u?l:`${l} `:"";a.push(`${c}${e}`)}else if("tbl"===i.localName)for(let e of Array.from(i.getElementsByTagNameNS(tw,"tr"))){let t=function e(t,r={},n={relationships:{},files:{}}){let i=[];for(let a of Array.from(t.childNodes))a.nodeType===a.ELEMENT_NODE&&eP(a,eM,"tc")&&i.push((function(t,r={},n={relationships:{},files:{}}){let i=[];for(let a of Array.from(t.childNodes))if(a.nodeType===a.ELEMENT_NODE){if(eP(a,eM,"p")){let e=eD(a,r,n);e.trim()&&i.push(e)}else if(eP(a,eM,"tbl"))for(let t of function(t,r={},n={relationships:{},files:{}}){let i=[];for(let a of Array.from(t.childNodes))a.nodeType===a.ELEMENT_NODE&&eP(a,eM,"tr")&&i.push(e(a,r,n));return i}(a,r,n))t.trim()&&i.push(t)}return i.join(" ")})(a,r,n).trim());return i.join(" ")}(e,r,n);t.trim()&&a.push(t)}else"sdt"===i.localName&&o(i)};return o(i),a})(i.document,f,c,h).join("\n"),d=(0,ey.J)(m,r),g=[];if(d.ignored.length>0&&g.push((n=d.ignored.length,`IGNORED_PARAGRAPHS:${n}`)),d.detected||1!==d.questions.length||g.push("SINGLE_QUESTION"),o.unsupported.size>0){let e=Array.from(o.unsupported).slice(0,10).join(",");g.push(`MATH_UNSUPPORTED:${e}`)}if(o.oleCount>0){let e=o.oleCount-s.oleLatexCount;s.oleLatexCount>0&&g.push(`OLE_EQUATION_LATEX:${s.oleLatexCount}`),e>0&&g.push(`OLE_EQUATION_IMAGE:${e}`)}if(s.unsupported.size>0){let e=Array.from(s.unsupported).slice(0,10).join(",");g.push(`IMAGE_UNSUPPORTED:${e}`)}let p=d.questions.map(e=>{var t;let r,n,i,a;return t=s.images,r=[e.text,e.material,e.answer,e.analysis],n=[],i=r.map(e=>{let r;if(!e)return e;let{text:i,usedIndexes:a}=(r=[],{text:e.replace(/⟦IMG:(\d+)⟧/g,(e,n)=>{let i=parseInt(n,10);i>=0&&i<t.length&&!r.includes(i)&&r.push(i);let a=i>=0&&i<t.length?t[i]:void 0;return a?.oleEquation?"[公式]":"[图片]"}),usedIndexes:r});return n.push(...a),i}),a=Array.from(new Set(n)).sort((e,t)=>e-t).filter(e=>e<t.length).map(e=>t[e]),{...e,text:i[0]??e.text,material:i[1]??e.material,answer:i[2]??e.answer,analysis:i[3]??e.analysis,...a.length>0?{images:a}:{}}}),x=ep(p.map(tk)),y=new Map;for(let e of p){let t=e.images;t?.length&&y.set(e,t)}return{questions:x.questions.map((e,t)=>{let r=p[t],n=r?y.get(r):void 0;return n?.length?{...e,images:n.map(({dataUrl:e,alt:t})=>void 0===t?{dataUrl:e}:{dataUrl:e,alt:t})}:e}),errors:x.errors,warnings:[...g,...eg(x.warnings)]}}let tI="option_",tj=["A","B","C","D","E","F"],tO={题干:"text",题目:"text",题目内容:"text",题目文本:"text",question:"text",text:"text",stem:"text",材料:"material",阅读材料:"material",material:"material",大题:"section",题型分组:"section",section:"section",题号:"label",序号:"label",no:"label",label:"label",number:"label",答案:"answer",参考答案:"answer",正确答案:"answer",answer:"answer",解析:"analysis",答案解析:"analysis",分析:"analysis",详解:"analysis",analysis:"analysis",explanation:"analysis",知识点:"knowledgePoints",考点:"knowledgePoints",knowledge:"knowledgePoints",knowledgepoints:"knowledgePoints",tags:"knowledgePoints",难度:"difficultyStars",难度星级:"difficultyStars",difficulty:"difficultyStars",difficultystars:"difficultyStars",错答:"wrongAnswer",我的答案:"wrongAnswer",学生答案:"wrongAnswer",wronganswer:"wrongAnswer",学科:"subject",科目:"subject",subject:"subject",年级:"gradeSemester",年级学期:"gradeSemester",grade:"gradeSemester",gradesemester:"gradeSemester",来源:"source",出处:"source",source:"source",题型:"questionType",type:"questionType",questiontype:"questionType"};function t_(e){return null==e?"":"string"==typeof e?e:"number"==typeof e?(Number.isInteger(e),String(e)):"boolean"==typeof e?e?"TRUE":"FALSE":e instanceof Date?e.toISOString().slice(0,10):String(e)}function t$(e,t,r){for(let n=0;n<e.length;n++)if(e[n].field===r)return t_(t[n]).trim();return""}function tP(e,t){let r=[],n=[];if(!e||0===e.length)return{questions:[],errors:[{index:-1,reason:"EMPTY_TABLE"}],warnings:r};let i=-1,a=null,o=Math.min(5,e.length);for(let t=0;t<o;t++){let r=function(e){let t=[],r=!1;for(let n of e){let e=String(n),i=function(e){let t=e.trim().toLowerCase();return(t=(t=t.replace(/[ ]/g,"")).replace(/[A-Za-z0-9]/g,e=>{let t=e.charCodeAt(0);return t>=65281&&t<=65374?String.fromCharCode(t-65248):e})).replace(/[\s ]+/g,"")}(e);if(!i)continue;let a=tO[i];if(a){"text"===a&&(r=!0),t.push({field:a,rawName:e});continue}let o=function(e){let t=e.match(/^(?:选项|选择|choice|option)([a-f])$/);return t?tj.indexOf(t[1].toUpperCase()):/^[a-f]$/.test(e)?tj.indexOf(e.toUpperCase()):null}(i);if(null!==o&&o<6){t.push({field:`${tI}${o}`,rawName:e});continue}t.push({field:"unknown",rawName:e})}return r?t:null}(e[t].map(e=>t_(e)));if(r){i=t,a=r;break}}if(-1===i||!a)return{questions:[],errors:[{index:-1,reason:"TEXT_COLUMN_NOT_FOUND"}],warnings:r};for(let e of a.filter(e=>"unknown"===e.field))r.push(`UNKNOWN_COLUMN:${e.rawName}`);let s=-1;for(let e of a)"string"==typeof e.field&&e.field.startsWith(tI)&&(s=Math.max(s,Number(e.field.slice(tI.length))));let l=[];for(let r=i+1;r<e.length;r++){let o=e[r];if(o.every(e=>""===t_(e).trim()))continue;let s=t$(a,o,"text");if(!s){n.push({index:r-i-1,reason:`TEXT_REQUIRED:row=${r-i}`});continue}let u={text:s},c=t$(a,o,"material");c&&(u.material=c);let h=t$(a,o,"section");h?u.section=h:t&&(u.section=t);let f=t$(a,o,"label");f&&(u.label=f);let m=t$(a,o,"answer");m&&(u.answer=m);let d=t$(a,o,"analysis");d&&(u.analysis=d);let g=t$(a,o,"knowledgePoints");g&&(u.knowledgePoints=g.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean));let p=t$(a,o,"difficultyStars");if(p){let e=function(e){let t=e.trim();if(!t)return null;let r=t.match(/^([★☆]+)$/);if(r){let e=r[1].split("").filter(e=>"★"===e).length;return e>=1&&e<=5?e:null}let n=Number(t);if(!Number.isNaN(n))return n>=1&&n<=5&&Number.isInteger(n)?n:n>=0&&n<=1?n>=.8?1:n>=.6?2:n>=.4?3:n>=.2?4:5:null;return({易:1,较易:2,容易:1,中等:3,中:3,较难:4,难:5,困难:5})[t]??null}(p);null!==e&&(u.difficultyStars=e)}let x=t$(a,o,"wrongAnswer");x&&(u.wrongAnswer=x);let y=t$(a,o,"subject");y&&(u.subject=y);let w=t$(a,o,"gradeSemester");w&&(u.gradeSemester=w);let b=t$(a,o,"source");b&&(u.source=b);let N=t$(a,o,"questionType");N&&(u.questionType=N);let v=function(e,t){let r=[];for(let n=0;n<e.length;n++){let i=e[n].field;if("string"==typeof i&&i.startsWith(tI)){let e=Number(i.slice(tI.length)),a=t_(t[n]).trim();a&&(r[e]=a)}}return r.filter(e=>void 0!==e&&""!==e)}(a,o);if(v.length>0){let e=v.map((e,t)=>{let r=tj[t]??String(t+1);return`${r}.${e}`});u.text=`${s}
|
|
6
|
-
${e.join("\n")}`}l.push({raw:u,index:r-i-1})}let u=ep({format:ei,version:1,questions:l.map(e=>e.raw)}),c=[...n,...u.errors.map(e=>{let t=l[e.index];return{index:t?t.index:e.index,reason:e.reason}})].sort((e,t)=>e.index-t.index);return{questions:u.questions,errors:c,warnings:[...r,...u.warnings]}}async function tC(t){let{default:r}=await e.A(84955),n=await r(t),i=[],a=[],o=[],s=0;for(let e of n){let t=e.data;if(!t||0===t.length)continue;let r=t.some(e=>e.map(e=>String(e??"").trim().toLowerCase()).some(e=>{let t=e.replace(/[\s ]+/g,"");return"section"===t||"大题"===t||"题型分组"===t})),l=tP(t,n.length>1&&!r?e.sheet:void 0);for(let e of l.errors)a.push({index:-1===e.index?-1:e.index+s,reason:e.reason});o.push(...l.warnings.map(t=>`[${e.sheet}] ${t}`)),i.push(...l.questions),s+=l.questions.length}return{questions:i,errors:a,warnings:o}}let tL=/^[\s\-–—·..]*\d{1,4}[\s\-–—·..]*$/;function tD(e){return e.replace(/\uFB00/g,"ff").replace(/\uFB01/g,"fi").replace(/\uFB02/g,"fl").replace(/\uFB03/g,"ffi").replace(/\uFB04/g,"ffl").replace(/\u00A0/g," ").replace(/\u3000/g," ")}function tR(e){let t=e.trim();if(!t)return null;if(tL.test(t))return{key:"",isPageNumberOnly:!0};let r=t.replace(/\d+/g,"").trim();return r?{key:r,isPageNumberOnly:!1}:null}function tF(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=11904&&t<=40959||t>=63744&&t<=64255||t>=12288&&t<=12351||t>=65280&&t<=65519}function tq(){return{cMapUrl:"/pdfjs/cmaps/",cMapPacked:!0,standardFontDataUrl:"/pdfjs/standard_fonts/"}}let tz=null;function tU(){return tz||(tz=(async()=>{let t=await e.A(825834);return t.GlobalWorkerOptions.workerSrc=new e.U(e.r(979463)).toString(),t})()),tz}function tG(e){return e.x+Math.max(.5*e.height,1)}function tB(e,t){if(!t||0===t.boundaries.length)return 0;let r=e.x+(tG(e)-e.x)/2;for(let e=0;e<t.boundaries.length;e++)if(r<t.boundaries[e])return e;return t.boundaries.length}let tW=[1,0,0,1,0,0];function tV(e,t,r){let[n,i,a,o,s,l]=e;return{x:n*t+a*r+s,y:i*t+o*r+l}}function tX(e,t,r){let n=e.width*e.height;if(n<4)return!1;let i=t*r;return!(i>0)||!(n>.8*i)}function tY(e){let t={text:e.text};return e.material&&(t.material=e.material),e.section&&(t.section=e.section),e.label&&(t.label=e.label),e.answer&&(t.answer=e.answer),e.analysis&&(t.analysis=e.analysis),e.knowledgePoints?.length&&(t.knowledgePoints=e.knowledgePoints),null!==e.difficultyStars&&void 0!==e.difficultyStars&&(t.difficultyStars=e.difficultyStars),e.wrongAnswer&&(t.wrongAnswer=e.wrongAnswer),e.questionType&&(t.questionType=e.questionType),t}async function tH(e,t={}){var r;let n,i=t.pdfjs??await tU(),a=new Uint8Array(e.slice(0));try{let e=t.pdfjs?t.standardFontDataUrl?{data:a,standardFontDataUrl:t.standardFontDataUrl,verbosity:0}:{data:a,verbosity:0}:{data:a,...tq(),verbosity:0};n=await i.getDocument(e).promise}catch(e){if("PasswordException"===(e instanceof Error?e.name:""))return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}let o=[],s=[],l=new Map,u=t.skipGraphicsDetection?null:function(e){let t=e.OPS;if(!t)return null;let r={};for(let e of["save","restore","transform","paintImageMaskXObject","paintImageMaskXObjectGroup","paintImageXObject","paintInlineImageXObject","paintInlineImageXObjectGroup","paintImageXObjectRepeat","paintImageMaskXObjectRepeat","paintSolidColorImageMask","constructPath"]){let n=t[e];if("number"!=typeof n)return null;r[e]=n}return r}(i),c=0,h=0,f=[];try{c=n.numPages;for(let e=1;e<=c;e++){let t=await n.getPage(e),r=t.getViewport({scale:1});if(s.push({width:r.width,height:r.height}),u){let n=await t.getOperatorList(),i=function(e,t,r,n){let i=[],a=[...tW],o=[];for(let s=0;s<e.fnArray.length;s++){let l=e.fnArray[s],u=e.argsArray[s];if(l===n.save){o.push([...a]);continue}if(l===n.restore){let e=o.pop();e&&(a=e);continue}if(l===n.transform){u&&"number"==typeof u.length&&u.length>=6&&(a=function(e,t){let[r,n,i,a,o,s]=e,[l,u,c,h,f,m]=t;return[r*l+i*u,n*l+a*u,r*c+i*h,n*c+a*h,r*f+i*m+o,n*f+a*m+s]}(a,[Number(u[0]),Number(u[1]),Number(u[2]),Number(u[3]),Number(u[4]),Number(u[5])]));continue}if(l===n.paintImageXObject||l===n.paintInlineImageXObject||l===n.paintImageMaskXObject||l===n.paintImageMaskXObjectGroup||l===n.paintInlineImageXObjectGroup){if(!u||"number"!=typeof u.length||u.length<2)continue;let e=Number(u[u.length-2]),n=Number(u[u.length-1]);if(!Number.isFinite(e)||!Number.isFinite(n)||e<=0||n<=0)continue;let o=function(e,t,r){let n=tV(e,0,0),i=tV(e,t,0),a=tV(e,0,r),o=tV(e,t,r),s=[n.x,i.x,a.x,o.x],l=[n.y,i.y,a.y,o.y],u=Math.min(...s),c=Math.min(...l);return{x:u,y:c,width:Math.max(...s)-u,height:Math.max(...l)-c}}(a,e,n);tX(o,t,r)&&i.push({kind:"image",rect:o});continue}if(l===n.constructPath){if(!u||"number"!=typeof u.length||u.length<3)continue;let e=u[2];if(!e||"number"!=typeof e.length||e.length<4)continue;let n=[0,1,2,3].map(t=>Number(e[t]));if(n.some(e=>!Number.isFinite(e)))continue;let o=function(e,t){let[r,n,i,a]=t;return function(e,t,r,n,i){let a=tV(e,t,r),o=tV(e,n,r),s=tV(e,t,i),l=tV(e,n,i),u=[a.x,o.x,s.x,l.x],c=[a.y,o.y,s.y,l.y],h=Math.min(...u),f=Math.min(...c);return{x:h,y:f,width:Math.max(...u)-h,height:Math.max(...c)-f}}(e,r,n,i,a)}(a,[n[0],n[1],n[2],n[3]]);tX(o,t,r)&&i.push({kind:"vector",rect:o});continue}}return i}(n,r.width,r.height,u);i.length>0&&l.set(e,i)}let i=await t.getTextContent(),a=0;for(let t of i.items){if(!("str"in t))continue;let r=tD(t.str);if(!r.trim())continue;let[n,,,,i,s]=t.transform,l=Math.abs(n)||1;o.push({str:r,x:i,y:s,width:t.width*l,height:t.height,page:e});let u=r.trim().length;a+=u,h+=u}f.push(a)}}catch(t){let e=t instanceof Error?t.name:"";if("PasswordException"===e)return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}finally{try{await n.cleanup()}catch{}}if(0===c||h/Math.max(c,1)<20)return{questions:[],errors:[{index:-1,reason:"PDF_NO_TEXT_LAYER"}],warnings:[`PAGES:${c}`]};let m=function(e,t){let r=e.map(e=>({...e,str:tD(e.str)})).filter(e=>e.str.trim().length>0),n=function(e,t){let r=new Map;for(let t of e){let e=r.get(t.page)??[];e.push(t),r.set(t.page,e)}let n=[];for(let[e,i]of r){let r=t.find((t,r)=>r+1===e),a=r?.height??0,o=[...i].sort((e,t)=>e.y-t.y||e.x-t.x),s=[];for(let e of o){let t=s[s.length-1],r=t?.[t.length-1],n=.5*Math.max(e.height,r?.height??0);t&&r&&Math.abs(e.y-r.y)<=n?t.push(e):s.push([e])}for(let t of s){t.sort((e,t)=>e.x-t.x);let r="",i=null;for(let e of t)i&&(!(e.x-(i.x+i.width)>.15*Math.max(e.height,i.height,1))||r.endsWith(" ")||e.str.startsWith(" ")||tF(r[r.length-1])||tF(e.str[0])||(r+=" ")),r+=e.str,i=e;let o=t.reduce((e,t)=>Math.max(e,t.height),0),s=t.reduce((e,t)=>e+t.y,0)/t.length;n.push({text:r.trimEnd(),x:t[0].x,yTop:a-s-o,height:o,page:e})}}return n}(r,t),i=function(e,t){let r=new Map,n=new Map;for(let t of e){let e=n.get(t.page)??[];e.push(t),n.set(t.page,e)}for(let[e,i]of n){let n=t.find((t,r)=>r+1===e);if(!n||n.width<=0)continue;let a=n.width/2,o=.06*n.width,s=i.filter(e=>e.x+e.width<=a+o).reduce((e,t)=>e+t.str.trim().length,0),l=i.filter(e=>e.x>=a-o).reduce((e,t)=>e+t.str.trim().length,0),u=s+l;!(u<1)&&!i.some(e=>e.x<a+o&&e.x+e.width>a-o)&&s>=.25*u&&l>=.25*u&&r.set(e,{width:n.width,height:n.height})}return r}(r,t),a=function(e,t){let r=[...new Set(e.map(e=>e.page))].filter(e=>e>=1);if(0===r.length)return[];let n=Math.max(2,Math.ceil(.5*(t.length||r.length))),i=new Map;for(let r of e){let e=t.find((e,t)=>t+1===r.page),n=e?.height??0;if(n<=0)continue;let a=r.yTop<=.15*n,o=r.yTop>=.92*n;if(!a&&!o||r.text.length>100)continue;let s=tR(r.text);if(!s)continue;let l=`${a?"H":"F"}:${s.key}:${s.isPageNumberOnly?"#":"*"}`,u=i.get(l);u?(u.pages.add(r.page),u.minYTop=Math.min(u.minYTop,r.yTop),u.maxYTopBottom=Math.max(u.maxYTopBottom,r.yTop)):i.set(l,{key:s.key,pages:new Set([r.page]),isPageNumberOnly:s.isPageNumberOnly,minYTop:r.yTop,maxYTopBottom:r.yTop})}return[...i.values()].filter(e=>e.pages.size>=n)}(n,t),o=new Set;for(let e of a)for(let t of n){if(t.page<1||!e.pages.has(t.page))continue;let r=tR(t.text);r?.key===e.key&&(!e.isPageNumberOnly||r.isPageNumberOnly)&&t.yTop>=e.minYTop&&t.yTop<=e.maxYTopBottom&&o.add(t)}return n.filter(e=>!o.has(e)).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x).map(e=>{let t=i.get(e.page);if(!t)return e;let r=t.width/2;return{...e,yTop:e.x>=r?e.yTop+t.height:e.yTop}}).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x)}(o,s),d=m.map(e=>e.text).join("\n"),g=(0,ey.J)(d,t.splitOptions),p=[`PAGES:${c}`],x=f.filter(e=>0===e).length;x>0&&p.push(`EMPTY_PAGES:${x}`),g.ignored.length>0&&p.push((r=g.ignored.length,`IGNORED_PARAGRAPHS:${r}`)),g.detected||1!==g.questions.length||p.push("SINGLE_QUESTION");let y=ep(g.questions.map(tY)),w=new Map(Array.from(l.entries()).map(([e,t])=>{let r=s[e-1]?.height??0;return[e,t.map(({rect:e})=>({x:e.x,yTop:r-e.y-e.height,width:e.width,height:e.height}))]})),b=function(e,t,r,n=new Map){let i,a=function(e,t){let r=new Map;for(let t of e){let e=r.get(t.page)??[];e.push(t),r.set(t.page,e)}let n=new Map;for(let[e,i]of r){let r=t.find((t,r)=>r+1===e);if(!r||r.width<=0)continue;let a=r.width/2,o=.06*r.width,s=i.filter(e=>tG(e)<=a+o).reduce((e,t)=>e+t.text.trim().length,0),l=i.filter(e=>e.x>=a-o).reduce((e,t)=>e+t.text.trim().length,0),u=s+l;!(u<1)&&!i.some(e=>e.x<a+o&&tG(e)>a-o)&&s>=.25*u&&l>=.25*u&&n.set(e,{boundaries:[a]})}return n}(t,r),o=(i=new Map,r.forEach((e,t)=>{e.height<=0||i.set(t+1,{top:.15*e.height,bottom:.92*e.height})}),i),s=e.map(e=>e?function(e,t,r){let n=t[e];if(!n)return e;let i=r.get(n.page)??null,a=tB(n,i),o=e;for(;o>0;){let e=t[o-1],r=t[o];if(e.page!==n.page||tB(e,i)!==a)break;let s=r.yTop-(e.yTop+e.height),l=e.x>n.x+2*n.height;if(s>.8*n.height||!l)break;o-=1}return o}(e.from,t,a):void 0);return e.map((e,i)=>{if(!e||e.from<0||e.from>=t.length)return null;let l=s[i]??e.from,u=s.slice(i+1).find(e=>void 0!==e);return function(e,t,r,n,i,a,o=new Map){if(e<0||e>=r.length)return[];let s=Math.min(t,r.length),l=Math.min(s,r.length),u=l<r.length?r[l]:null,c=r[e],h=(e,t,r)=>!!u&&u.page===e&&tB(u,r)===t,f=[],m=c.page,d=(r[s-1]??c).page;for(let t=m;t<=d;t++){let l=n.find((e,r)=>r+1===t);if(!l)continue;let d=a.get(t)??{top:0,bottom:l.height},y=i.get(t)??null,w=[];for(let n=e;n<s;n++){let e=r[n];e.page===t&&w.push(e)}if(0===w.length)continue;let b=new Map;for(let e of w){let t=tB(e,y),r=b.get(t)??[];r.push(e),b.set(t,r)}for(let[e,r]of Array.from(b.entries()).sort((e,t)=>e[0]-t[0])){let n,a=r[0],s=(g=y,p=e,x=l.width,g&&0!==g.boundaries.length?{left:p>0?g.boundaries[p-1]:0,right:p<g.boundaries.length?g.boundaries[p]:x}:{left:0,right:x}),w=t===m&&e===tB(c,i.get(m)??null),b=Math.max(0,a.yTop-4);if(!w)for(let e of o.get(t)??[])e.x<s.right&&e.x+e.width>s.left&&e.yTop>=d.top&&e.yTop+e.height<=a.yTop&&(b=Math.min(b,Math.max(0,e.yTop-4)));if(h(t,e,y))n=u.yTop-4;else{let e=r[r.length-1],i=e.yTop+e.height;for(let e of o.get(t)??[])e.x<s.right&&e.x+e.width>s.left&&e.yTop>=b&&e.yTop<d.bottom&&(i=Math.max(i,e.yTop+e.height));n=i+4}(n=Math.min(n,l.height))<=b||f.push({page:t,rect:{x:s.left,yTop:b,width:s.right-s.left,height:n-b}})}}var g,p,x,y,w,b=f;if(b.length<=1)return b;let N=[];for(let e of b){let t=N[N.length-1];t&&t.page===e.page&&(y=t.rect,w=e.rect,y.x<w.x+w.width&&w.x<y.x+y.width&&y.yTop<w.yTop+w.height&&w.yTop<y.yTop+y.height)?t.rect=function(e,t){let r=Math.min(e.x,t.x),n=Math.min(e.yTop,t.yTop);return{x:r,yTop:n,width:Math.max(e.x+e.width,t.x+t.width)-r,height:Math.max(e.yTop+e.height,t.yTop+t.height)-n}}(t.rect,e.rect):N.push({...e,rect:{...e.rect}})}return N}(l,void 0!==u&&u<e.to?u:e.to,t,r,a,o,n)})}(g.questions.map(e=>e.lineRange),m,s,w),N=new Set(y.errors.filter(e=>e.index>=0).map(e=>e.index)),v=[];for(let e=0;e<g.questions.length&&v.length<y.questions.length;e++)N.has(e)||v.push(b[e]??null);let S=l.size>0,T=Array.from({length:c},(e,t)=>l.get(t+1)??[]),E=s.map(e=>e.height);return{questions:y.questions,errors:y.errors,warnings:[...p,...eg(y.warnings)],pdfRegions:v,pdfHasGraphics:S,pdfPageGraphics:T,pdfPageHeights:E}}let tQ={maxLength:ey.f,maxQuestions:ey.k},tK={maxLength:ey.f,maxQuestions:ey.k},tZ={json:e=>ex(e.buffer),docx:e=>tM(e.buffer,{},tQ),xlsx:e=>tC(e.buffer),csv:async function(e){let t,{text:r}=(0,F.n)(e.buffer),{rows:n}=(t=function(e){let t=e.split(/\r?\n/,1)[0]??"",r=",",n=0;for(let e of[",",";"," "]){let i=t.split(e).length-1;i>n&&(n=i,r=e)}return r}(r),{rows:function(e,t){let r=[],n=[],i="",a=!1,o=0;for(65279===e.charCodeAt(0)&&(o=1);o<e.length;){let s=e[o];if(a){'"'===s?'"'===e[o+1]?(i+='"',o+=2):(a=!1,o+=1):(i+=s,o+=1);continue}if('"'===s&&""===i){a=!0,o+=1;continue}if(s===t){n.push(i),i="",o+=1;continue}if("\r"===s){"\n"===e[o+1]&&(o+=1),n.push(i),i="",r.push(n),n=[],o+=1;continue}if("\n"===s){n.push(i),i="",r.push(n),n=[],o+=1;continue}i+=s,o+=1}return(""!==i||n.length>0)&&(n.push(i),r.push(n)),r.filter(e=>e.some(e=>""!==e.trim()))}(r,t),delimiter:t});return tP(n)},pdf:e=>tH(e.buffer,{splitOptions:tK})};function tJ(){let e=(e,t)=>{let r=document.createElement("canvas");return r.width=e,r.height=t,r},t=(e,t,r)=>{e.fillStyle="#ffffff",e.fillRect(0,0,t,r)},r=(e,t)=>e.toDataURL("image/jpeg",t),n=e=>Math.floor(3*e.slice(e.indexOf(",")+1).length/4);return{async renderComposite(i,a){let o=e(a.canvasWidth,a.canvasHeight),s=o.getContext("2d");if(!s)throw Error("CANVAS_UNSUPPORTED");t(s,a.canvasWidth,a.canvasHeight),s.imageSmoothingEnabled=!0,s.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];s.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,t.y,t.width,t.height)}let l=r(o,.85),u=1;for(;n(l)>1048576&&u>.1;){u*=.85;let n=Math.max(1,Math.round(a.canvasWidth*u)),o=Math.max(1,Math.round(a.canvasHeight*u)),s=e(n,o),c=s.getContext("2d");if(!c)throw Error("CANVAS_UNSUPPORTED");t(c,n,o),c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];c.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,Math.round(t.y*u),Math.round(t.width*u),Math.round(t.height*u))}l=r(s,.85)}return l},async renderSingle(i,a,o){let s=function(e,t,r=1600){let n=Math.max(e,t);if(n<=r)return{width:e,height:t};let i=r/n;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}(i.width,i.height,a),l=e(s.width,s.height),u=l.getContext("2d");if(!u)throw Error("CANVAS_UNSUPPORTED");t(u,s.width,s.height),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(i.source,0,0,i.width,i.height,0,0,s.width,s.height);let c=r(l,.85),h=1;for(;n(c)>o&&h>.1;){h*=.85;let n=Math.max(1,Math.round(s.width*h)),a=Math.max(1,Math.round(s.height*h)),o=e(n,a),l=o.getContext("2d");if(!l)throw Error("CANVAS_UNSUPPORTED");t(l,n,a),l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(i.source,0,0,i.width,i.height,0,0,n,a),c=r(o,.85)}return c}}}async function t0(e,t=tJ()){if(0===e.length)throw Error("NO_IMAGES");if(1===e.length)return t.renderSingle(e[0],1600,1048576);let r=function(e,t=16){let r=e.map(t=>{var r,n,i;return r=t.width,n=t.height,i=Math.max(...e.map(e=>e.width)),r<=0?{width:i,height:0}:{width:i,height:Math.max(1,Math.round(i/r*n))}}),{width:n,height:i}=function(e,t=16){return 0===e.length?{width:0,height:0}:{width:Math.max(...e.map(e=>e.width)),height:e.reduce((e,t)=>e+t.height,0)+t*(e.length-1)}}(r,t),a=function(e,t=16){let r=[],n=0;for(let i of e)r.push(n),n+=i.height+t;return r}(r,t);return{canvasWidth:n,canvasHeight:i,placements:r.map((e,t)=>({...e,y:a[t]}))}}(e.map(e=>({width:e.width,height:e.height})));return t.renderComposite(e,r)}async function t1(e){let t=atob(e.slice(e.indexOf(",")+1)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return createImageBitmap(new Blob([r],{type:e.slice(5,e.indexOf(";"))}))}async function t2(e){let t=await t1(e);return{source:t,width:t.width,height:t.height}}let t4=["subject","gradeSemester","source","figureSvg","extensions"],t5={subject:{zh:"学科",en:"subject"},gradeSemester:{zh:"年级学期",en:"gradeSemester"},source:{zh:"来源",en:"source"},figureSvg:{zh:"配图 SVG",en:"figureSvg"},extensions:{zh:"扩展字段",en:"extensions"}};async function t6(e,t={}){let{renderer:r,decodeFn:n,onProgress:i,metafileDeps:a,metafileCounts:o,metafileTruncated:s}=t,l=e.length,u=0,c=[];for(let t of e){let e={text:t.text,material:t.material??null,section:t.section??null,label:t.label??null,answer:t.answer??null,analysis:t.analysis??null,knowledgePoints:t.knowledgePoints?.length?t.knowledgePoints:null,difficultyStars:t.difficultyStars??null,wrongAnswer:t.wrongAnswer??null,questionType:t.questionType??null};if(t.images?.length&&r&&n)try{let i=function(e){let t=0,r=0;return{images:e.filter(e=>!tm(e.dataUrl)||!((t+=1)>12)||(r+=1,!1)),truncatedMetafiles:r}}(t.images);s&&(s.count+=i.truncatedMetafiles);let l=await t8(i.images,a,o),u=await Promise.all(l.map(e=>n(e.dataUrl)));e.image=await t0(u,r)}catch{e.image=null}c.push(e),u+=1,i?.(u,l)}return c}async function t8(e,t,r){let n=[];for(let i of e){if(!tm(i.dataUrl)){n.push(i);continue}let e=function(e){if(!e||!e.startsWith(th))return null;let t=/^(\d+)x(\d+)$/.exec(e.slice(th.length));return t?{width:Number.parseInt(t[1],10),height:Number.parseInt(t[2],10)}:null}(i.alt)??{width:800,height:600},a=await ty(i.dataUrl,e,t??{});if(null===a){r&&(r.failed+=1);continue}r&&(r.rendered+=1),n.push({dataUrl:a})}return n}let t3={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},TEXT_REQUIRED:{zh:e=>e.startsWith("row=")?`第 ${e.slice(4)} 行缺少题干`:"缺少题干",en:e=>e.startsWith("row=")?`Row ${e.slice(4)} is missing question text`:"Question text is required"}},t7={INVALID_JSON:{zh:"不是合法的 JSON 文件,请检查文件内容",en:"Not a valid JSON file; please check the file content"},INVALID_DOCX:{zh:"无法读取该 Word 文件,文件可能已损坏或不是 .docx 格式",en:"Cannot read this Word file; it may be corrupted or not a .docx file"},LEGACY_DOC_NOT_SUPPORTED:{zh:"旧版 .doc 格式暂不支持,请在 Word 中另存为 .docx 后再导入",en:"Legacy .doc is not supported; please save it as .docx in Word and import again"},TEXT_COLUMN_NOT_FOUND:{zh:"未找到「题干」列,请使用题库模板或检查表头",en:'No "question text" column found; please use the question template or check the header row'},EMPTY_TABLE:{zh:"表格为空,没有可导入的题目",en:"The table is empty; there are no questions to import"},QUESTIONS_REQUIRED:{zh:"文件中没有题目(questions 为空)",en:"The file contains no questions (questions is empty)"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确(questions 应为题目数组)",en:'Invalid question format ("questions" should be an array of questions)'},PDF_NO_TEXT_LAYER:{zh:"这是扫描版 PDF(没有文字层),可在下方选择页码范围转为图片,由 AI 识别分题导入",en:"This is a scanned PDF (no text layer). You can select a page range below to convert it to images and import with AI recognition."},PDF_ENCRYPTED:{zh:"这是加密 PDF,暂不支持导入,请先去除密码后重试",en:"This PDF is password-protected and cannot be imported; please remove the password and try again"},INVALID_PDF:{zh:"无法读取该 PDF 文件,文件可能已损坏或不是有效的 PDF",en:"Cannot read this PDF file; it may be corrupted or not a valid PDF"}},t9={TEXT_REQUIRED:{zh:"缺少题干,已跳过",en:"Missing question text; skipped"},TEXT_TOO_LONG:{zh:"题干过长,已跳过",en:"Question text is too long; skipped"},MATERIAL_TOO_LONG:{zh:"公共材料过长,该题已跳过",en:"Shared material is too long; question skipped"},SECTION_TOO_LONG:{zh:"大题标题过长,该题已跳过",en:"Section title is too long; question skipped"},LABEL_TOO_LONG:{zh:"题号过长,该题已跳过",en:"Label is too long; question skipped"},ANSWER_TOO_LONG:{zh:"答案过长,该题已跳过",en:"Answer is too long; question skipped"},ANALYSIS_TOO_LONG:{zh:"解析过长,该题已跳过",en:"Analysis is too long; question skipped"},INVALID_DIFFICULTY:{zh:"难度值无效(应为 1~5),该题已跳过",en:"Invalid difficulty (should be 1–5); question skipped"},WRONG_ANSWER_TOO_LONG:{zh:"错答内容过长,该题已跳过",en:"Wrong answer is too long; question skipped"},SUBJECT_TOO_LONG:{zh:"学科字段过长,该题已跳过",en:"Subject is too long; question skipped"},GRADE_SEMESTER_TOO_LONG:{zh:"年级学期字段过长,该题已跳过",en:"Grade/semester is too long; question skipped"},SOURCE_TOO_LONG:{zh:"来源字段过长,该题已跳过",en:"Source is too long; question skipped"},QUESTION_TYPE_TOO_LONG:{zh:"题型字段过长,该题已跳过",en:"Question type is too long; question skipped"},KNOWLEDGE_POINT_TOO_LONG:{zh:"知识点过长,该题已跳过",en:"Knowledge point is too long; question skipped"},TOO_MANY_KNOWLEDGE_POINTS:{zh:"知识点数量超过上限,该题已跳过",en:"Too many knowledge points; question skipped"},INVALID_IMAGE_DATA_URL:{zh:"图片数据无效,该题已跳过",en:"Invalid image data; question skipped"},IMAGE_TOO_LARGE:{zh:"图片过大,该题已跳过",en:"Image is too large; question skipped"},TOO_MANY_IMAGES:{zh:"图片数量超过上限,该题已跳过",en:"Too many images; question skipped"},FIGURE_SVG_TOO_LONG:{zh:"配图 SVG 过长,该题已跳过",en:"Figure SVG is too long; question skipped"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确,该题已跳过",en:"Invalid question shape; skipped"}},re={MISSING_FORMAT:{zh:"文件缺少 format 字段,已按题目交换格式解析",en:'The file is missing the "format" field; parsed as the question exchange format'},UNKNOWN_FORMAT:{zh:"format 字段不是已知的题目交换格式,已尝试按 v1 解析",en:'The "format" field is not the known exchange format; tried parsing as v1'},MISSING_VERSION:{zh:"文件缺少 version 字段,已按 v1 解析",en:'The file is missing the "version" field; parsed as v1'},UNSUPPORTED_VERSION:{zh:"文件版本高于当前支持的 v1,已按 v1 宽松规则解析",en:"The file version is newer than the supported v1; parsed with v1 tolerant rules"},TOO_MANY_QUESTIONS:{zh:"题目数量超过文件上限,超出部分已截断",en:"Question count exceeds the per-file limit; the rest was truncated"},SINGLE_QUESTION:{zh:"只识别出一道题;如果文件里有多道题,请检查题号格式",en:"Only one question was recognized; if the file has more, check the question numbering"}},rt={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},IMAGE_UNSUPPORTED:{zh:e=>`以下格式的图片暂不支持导入,已跳过:${e}`,en:e=>`Image format(s) not supported, skipped: ${e}`},METAFILE_RENDERED:{zh:e=>`${e} 个公式预览图(WMF/EMF)已渲染为图片`,en:e=>`${e} equation preview image(s) (WMF/EMF) rendered`},METAFILE_FAILED:{zh:e=>`${e} 个公式预览图(WMF/EMF)渲染失败,未包含在题目原图中`,en:e=>`${e} equation preview image(s) (WMF/EMF) failed to render and were left out`},METAFILE_TRUNCATED:{zh:e=>`${e} 个公式小图超出单题拼接上限,未包含在题目原图中`,en:e=>`${e} small equation image(s) exceeded the per-question merge limit and were left out`},OLE_EQUATION_LATEX:{zh:e=>`${e} 个 MathType 公式对象已转为 LaTeX`,en:e=>`${e} MathType equation object(s) converted to LaTeX`},OLE_EQUATION_IMAGE:{zh:e=>`${e} 个 MathType 公式对象按图片保留(复杂公式无法可靠还原)`,en:e=>`${e} MathType equation object(s) kept as image(s) (complex formula could not be reliably converted)`},MATH_UNSUPPORTED:{zh:e=>`部分 OMML 结构未识别:${e}`,en:e=>`Some OMML structures not recognized: ${e}`},PAGES:{zh:e=>`共 ${e} 页`,en:e=>`${e} page${"1"===e?"":"s"} in total`},EMPTY_PAGES:{zh:e=>`其中 ${e} 页没有文字内容(空白页或纯图片页),未计入题目`,en:e=>`${e} page${"1"===e?" has":"s have"} no text content (blank or image-only) and were not counted as questions`}};function rr(e,t){let r,n=e.match(/^(\[[^\]]*\])\s*(.*)$/),i=n?n[1]:"",a=n?n[2]:e,o=a.indexOf(":"),s=-1===o?a:a.slice(0,o),l=-1===o?"":a.slice(o+1);if(l&&rt[s])r=rt[s][t](l);else{let e=re[s];r=e?e[t]:"zh"===t?`未知警告(${a})`:`Unknown warning (${a})`}return i?`${i} ${r}`:r}var rn=e.i(682638);async function ri(e,t){let r=e.getViewport({scale:t}),n=document.createElement("canvas");n.width=Math.max(1,Math.ceil(r.width)),n.height=Math.max(1,Math.ceil(r.height));let i=n.getContext("2d");if(!i)throw Error("CANVAS_UNSUPPORTED");return i.fillStyle="#ffffff",i.fillRect(0,0,n.width,n.height),await e.render({canvasContext:i,viewport:r}).promise,{canvas:n,width:n.width,height:n.height}}async function ra(e,t,r){let n=Math.max(0,Math.round(r.rect.x*t)),i=Math.max(0,Math.round(r.rect.yTop*t)),a=Math.max(1,Math.round(r.rect.width*t)),o=Math.max(1,Math.round(r.rect.height*t)),s=e.width-n,l=e.height-i,u=Math.min(a,s),c=Math.min(o,l);if(u<1||c<1)throw Error("CROP_OUT_OF_BOUNDS");return createImageBitmap(e,n,i,u,c)}async function ro(e,t,r,n=1600){if(0===t.length)throw Error("NO_REGIONS");let i=new Map;for(let e of t){let t=i.get(e.page)??[];t.push(e),i.set(e.page,t)}let a=[];try{for(let[t,r]of i){let i=await e.getPage(t),o=i.getViewport({scale:1}),s=Math.max(o.width,o.height),l=Math.max(...r.map(e=>Math.max(e.rect.width,e.rect.height))),u=function(e,t,r=1600){return e<=0||t<=0?1:Math.min(3,Math.max(1,r/e))}(l,s,n),{canvas:c}=await ri(i,u);try{for(let e of r){let t=await ra(c,u,e);a.push({source:t,width:t.width,height:t.height})}}finally{c.width=0,c.height=0}}return await t0(a,r)}finally{for(let e of a)e.source instanceof ImageBitmap&&e.source.close()}}var rs=e.i(119472);async function rl(e,t,r={}){let n=r.createBatch??rs.v,i=[],a=[];for(let o=0;o<e.length;o++){let s=e[o];try{let e=await n({source:"image",imageBase64:s.dataUrl,imageInfo:{sourceType:"pdf-page",sourceBytes:s.bytes,sourceWidth:s.width,sourceHeight:s.height,outputWidth:s.width,outputHeight:s.height,outputBytes:s.bytes,quality:void 0},language:t.language,subjectId:t.notebookId,targetSubjectId:t.notebookId});i.push({pageNumber:s.pageNumber,batch:e})}catch(e){a.push({pageNumber:s.pageNumber,error:e})}r.onProgress?.(o+1,e.length)}return{successes:i,failures:a}}async function ru(e,t,r){let n=await tU();return Y(await n.getDocument({data:new Uint8Array(e.slice(0)),...tq()}).promise,{pages:t,onProgress:r})}async function rc(e,t,r,n,i,a,o){let s=t.pdfRegions??[],l=t.questions,u=new Map;t.pdfPageGraphics&&t.pdfPageGraphics.forEach((e,t)=>{e.length>0&&u.set(t+1,e)});let c=new Map;t.pdfPageHeights&&t.pdfPageHeights.forEach((e,t)=>c.set(t+1,e));let h=l.map((e,t)=>{let n=s[t];if(!n||0===n.length)return!1;if("all"===r)return!0;if(!n)return!1;for(let e of n){let t=c.get(e.page)??0;if(function(e,t,r){let n=t.get(e.page)??[],i=r(e.page);for(let t of n){var a;let r=function(e,t){let r=t-(e.y+e.height);return{x:e.x,yTop:r,width:e.width,height:e.height}}(t.rect,i);if(a=e.rect,a.x<r.x+r.width&&r.x<a.x+a.width&&a.yTop<r.yTop+r.height&&r.yTop<a.yTop+a.height)return!0}return!1}(e,u,()=>t))return!0}return!1}),f=h.filter(Boolean).length;if(0===f)return l;let m=a?.loadDocument??rh,d=a?.captureQuestion??((e,t)=>ro(e,t??[])),g=await m(e);try{let e=[],t=0;for(let r=0;r<l.length;r++){let a=l[r],u=s[r];if(!h[r]||!u||0===u.length){e.push(a);continue}try{let t=await d(g,u);e.push({...a,images:[{dataUrl:t,alt:n}]})}catch(t){D.V.warn("[FileImport]","Capture question image failed",{fileName:n,index:r,error:(0,R.Z)(t)}),o.push(`第 ${r+1} 题截图失败:${(0,R.Z)(t)}`),e.push(a)}t+=1,i(t,f)}return e}finally{try{await g.cleanup?.()}catch{}}}async function rh(e){let t=await tU();return await t.getDocument({data:new Uint8Array(e.slice(0)),...tq()}).promise}function rf({defaultNotebookId:e}){let{t:i,language:a}=(0,N.b)(),[o,s]=(0,r.useState)(e??""),{phase:l,handleFile:u,handleConfirm:c,handleReset:h,handleScannedPdfConfirm:m}=function({language:e,notebookId:t,texts:i,scannedPdfDeps:a,pdfCaptureDeps:o}){let s=(0,n.useRouter)(),[l,u]=(0,r.useState)({kind:"pick"}),c=async(r="none")=>{let n;if("summary"!==l.kind)return;if(!t)return void M.c.error(i.notebookRequired);if(l.summary.total>rn.e)return void M.c.error(i.tooManyQuestions.replace("{max}",String(rn.e)));u({kind:"creating",fileName:l.fileName,batchCount:Math.ceil(l.summary.total/60)});let a=l.result.questions,c=[];"pdf"===l.fileType.key&&"none"!==r&&l.result.pdfRegions&&(a=await rc(l.buffer,l.result,r,l.fileName,(e,t)=>{u({kind:"processingImages",fileName:l.fileName,done:e,total:t})},o,c));let h=a.some(e=>e.images?.length),f={rendered:0,failed:0},m={count:0};try{if(h){let e=tJ();n=await t6(a,{renderer:e,decodeFn:t2,metafileCounts:f,metafileTruncated:m,onProgress:(e,t)=>{u({kind:"processingImages",fileName:l.fileName,done:e,total:t})}})}else n=await t6(a)}catch(e){D.V.error("[FileImport]","Process images failed",{error:(0,R.Z)(e)}),M.c.error(i.parseFailed),u({kind:"summary",fileName:l.fileName,fileType:l.fileType,result:l.result,summary:l.summary,buffer:l.buffer});return}for(let e of c)M.c.warning(e);let d=[];f.rendered>0&&d.push(rr(`METAFILE_RENDERED:${f.rendered}`,e)),f.failed>0&&d.push(rr(`METAFILE_FAILED:${f.failed}`,e)),m.count>0&&d.push(rr(`METAFILE_TRUNCATED:${m.count}`,e)),u({kind:"creating",fileName:l.fileName,batchCount:Math.ceil(l.summary.total/60)});try{let{batches:r,failures:a}=await (0,rn.r)(n,{language:e,subjectId:t,targetSubjectId:t,origin:{fileName:l.fileName,format:l.fileType.key}});for(let e of(r.length>0&&(M.c.success(i.batchesCreated.replace("{count}",String(r.length))),s.push(1===r.length?`/import-batches/${r[0].id}`:"/import-tasks")),a))M.c.error(i.batchFailed.replace("{index}",String(e.index+1)).replace("{error}",(0,R.Z)(e.error)));0===r.length&&a.length>0&&u({kind:"summary",fileName:l.fileName,fileType:l.fileType,result:l.result,summary:l.summary,buffer:l.buffer})}catch(e){D.V.error("[FileImport]","Create batches failed",{error:(0,R.Z)(e)}),M.c.error((0,R.Z)(e)),u({kind:"summary",fileName:l.fileName,fileType:l.fileType,result:l.result,summary:l.summary,buffer:l.buffer})}},h=async r=>{let n;if("scanned-pdf"!==l.kind)return;if(!t)return void M.c.error(i.notebookRequired);let{fileName:o,buffer:c}=l;u({kind:"rendering-pdf",fileName:o,rendered:0,total:r.length});try{n=a?.renderPages?await a.renderPages(c,r,(e,t)=>{u({kind:"rendering-pdf",fileName:o,rendered:e,total:t})}):await ru(c,r,(e,t)=>{u({kind:"rendering-pdf",fileName:o,rendered:e,total:t})})}catch(e){D.V.error("[FileImport]","Render scanned PDF failed",{error:(0,R.Z)(e)}),M.c.error(i.pdfRenderFailed),u({kind:"scanned-pdf",fileName:o,buffer:c,pageCount:l.pageCount});return}u({kind:"creating-pdf-batches",fileName:o,created:0,total:n.length});let h=a?.createBatches??rl,{successes:f,failures:m}=await h(n,{language:e,notebookId:t},{onProgress:(e,t)=>{u({kind:"creating-pdf-batches",fileName:o,created:e,total:t})}});for(let e of m){var d;(d=e.error,d?.status===429)?M.c.error(i.pdfQuotaExceeded.replace("{page}",String(e.pageNumber))):M.c.error(i.pdfPageFailed.replace("{page}",String(e.pageNumber)).replace("{error}",(0,R.Z)(e.error)))}f.length>0?(M.c.success(i.batchesCreated.replace("{count}",String(f.length))),s.push(1===f.length?`/import-batches/${f[0].batch.id}`:"/import-tasks")):u({kind:"scanned-pdf",fileName:o,buffer:c,pageCount:l.pageCount})};return{phase:l,handleFile:async(t,r)=>{var n;let a,o,s,l,c,h=tZ[r.key]??null;if(!h)return void M.c.error(i.unsupportedType);u({kind:"parsing",fileName:t.name});try{o=await t.arrayBuffer(),a=await h({name:t.name,buffer:o})}catch(e){D.V.error("[FileImport]","Parse file failed",{error:(0,R.Z)(e)}),M.c.error(i.parseFailed),u({kind:"pick"});return}let f=(s=(n=a).errors.slice().sort((e,t)=>e.index-t.index).slice(0,5).map(t=>({index:t.index,message:function(e,t){let r=e.indexOf(":"),n=-1===r?e:e.slice(0,r),i=-1===r?"":e.slice(r+1);if(i&&t3[n])return t3[n][t](i);let a=t9[n]??t7[n];return a?a[t]:"zh"===t?`未知错误(${e})`:`Unknown error (${e})`}(t.reason,e)})),l=n.warnings.map(t=>rr(t,e)),c=function(e){let t=new Map;for(let r of t4){let n=0;for(let t of e)(function(e,t){let r=e[t];return null!=r&&("string"==typeof r?r.trim().length>0:Array.isArray(r)?r.length>0:Object.keys(r).length>0)})(t,r)&&(n+=1);n>0&&t.set(r,n)}return Array.from(t.entries()).map(([e,t])=>({field:e,count:t}))}(n.questions),{total:n.questions.length,importable:n.questions.length,errorCount:n.errors.length,warningCount:n.warnings.length,errors:s,warnings:l,ignoredFields:c,ignoredFieldTexts:c.map(({field:t,count:r})=>{let n=t5[t][e];return"zh"===e?`${n}(${r} 题)`:`${n} (${r} question${r>1?"s":""})`})});if(D.V.info("[FileImport]","File parsed",{fileName:t.name,type:r.key,total:f.total,errors:f.errorCount,warnings:f.warningCount}),0===f.total){if("pdf"===r.key&&a.errors.some(e=>"PDF_NO_TEXT_LAYER"===e.reason)){let e=function(e){for(let t of e.warnings)if(t.startsWith("PAGES:")){let e=Number.parseInt(t.slice(6),10);return Number.isFinite(e)?e:null}return null}(a)??0;u({kind:"scanned-pdf",fileName:t.name,buffer:o,pageCount:e});return}let e=f.errors[0]?.message;M.c.error(e??i.noQuestions),u({kind:"pick"});return}u({kind:"summary",fileName:t.name,fileType:r,result:a,summary:f,buffer:o})},handleConfirm:c,handleReset:()=>u({kind:"pick"}),handleScannedPdfConfirm:h}}({language:"en"===a?"en":"zh",notebookId:o,texts:i.fileImport});return(0,t.jsx)(f.N,{className:"rounded-2xl","data-testid":"file-import-panel",children:(0,t.jsxs)(f.O,{className:"space-y-4 p-6",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(j.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:i.fileImport.title})]}),(0,t.jsx)(rm,{phase:l,notebookId:o,onNotebookChange:s,onFile:u,onConfirm:c,onReset:h,onScannedPdfConfirm:m})]})})}function rm({phase:e,notebookId:r,onNotebookChange:n,onFile:i,onConfirm:a,onReset:o,onScannedPdfConfirm:s}){switch(e.kind){case"parsing":return(0,t.jsx)(_,{textKey:"parsing",fileName:e.fileName});case"processingImages":return(0,t.jsx)(O,{fileName:e.fileName,done:e.done,total:e.total});case"creating":return(0,t.jsx)(_,{textKey:"creating",batchCount:e.batchCount});case"rendering-pdf":return(0,t.jsx)(_,{textKey:"rendering-pdf",rendered:e.rendered,total:e.total});case"creating-pdf-batches":return(0,t.jsx)(_,{textKey:"creating-pdf-batches",rendered:e.created,total:e.total});case"scanned-pdf":return(0,t.jsx)(H,{fileName:e.fileName,pageCount:e.pageCount,notebookId:r,onNotebookChange:n,onConfirm:s,onReset:o});case"summary":return(0,t.jsx)(G,{fileName:e.fileName,summary:e.summary,pdfHasGraphics:e.result.pdfHasGraphics,notebookId:r,onNotebookChange:n,onConfirm:a,onReset:o});default:return(0,t.jsx)(U,{onFile:i})}}var rd=e.i(522016),rg=e.i(217255),rp=e.i(856423),rx=e.i(975153),ry=e.i(218964),rw=e.i(697886);let rb=()=>()=>{};function rN({href:e,icon:r,label:n,value:i}){return(0,t.jsxs)(rd.default,{href:e,className:"rounded-xl bg-white/15 px-4 py-3 backdrop-blur-sm transition-colors hover:bg-white/20",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-white/75",children:[(0,t.jsx)(r,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:n})]}),(0,t.jsx)("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:i??"–"})]})}function rv({notebookCount:e,itemCount:n,dueCount:i,targetNotebook:a}){let{t:o,language:s}=(0,N.b)(),{data:l}=(0,rg.useSession)(),u=(0,r.useSyncExternalStore)(rb,()=>new Date().getHours(),()=>null),c=null===u?o.common.welcome.replace(/[,,\s]+$/,""):u<12?o.home.greetingMorning:u<18?o.home.greetingAfternoon:o.home.greetingEvening,h=l?.user?.name||l?.user?.email||"";return(0,t.jsxs)("section",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-indigo-600 via-indigo-500 to-violet-500 p-5 text-white shadow-lg shadow-indigo-500/20 md:p-7",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-12 h-44 w-44 rounded-full bg-white/10 blur-2xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-16 right-24 h-40 w-40 rounded-full bg-fuchsia-300/20 blur-2xl"}),(0,t.jsxs)("div",{className:"relative flex flex-col gap-5 md:flex-row md:items-end md:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("h1",{className:"text-xl font-bold tracking-tight md:text-2xl",children:[c,h&&`${"zh"===s?",":", "}${h}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:o.home.heroSubtitle}),a&&(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 px-3 py-1 text-xs font-medium",children:[(0,t.jsx)(rw.f,{className:"h-3.5 w-3.5"}),o.home.targetNotebook.replace("{name}",a)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(rN,{href:"/notebooks",icon:rp.f,label:o.home.notebookCount,value:e}),(0,t.jsx)(rN,{href:"/notebooks",icon:ry.f,label:o.home.itemCount,value:n}),(0,t.jsx)(rN,{href:"/review",icon:rx.f,label:o.home.dueCount,value:i})]})]})]})}var rS=e.i(12130),rT=e.i(430634),rE=e.i(576019),rA=e.i(847483),rk=e.i(497346),rM=e.i(717448),rI=e.i(798469),rj=e.i(86963),rO=e.i(956738),r_=e.i(185592),r$=e.i(41931),rP=e.i(35209),rC=e.i(598053),rL=e.i(315092);function rD(){let{t:e}=(0,N.b)();(0,rP.f)(e.pageTitle.home);let a=(0,n.useSearchParams)().get("notebook"),[o,f]=(0,r.useState)([]),[m,d]=(0,r.useState)(null),[g,p]=(0,r.useState)("image"),x=a?o.find(e=>e.id===a):void 0,y=(0,rC.f)({logPrefix:"[Home]",analyzeSubjectId:a,importSubjectId:a,textNotebook:x&&{id:x.id,name:x.name}});(0,r.useEffect)(()=>{r$.k.get("/api/notebooks").then(e=>f(e)).catch(e=>D.V.error("[Home]","Failed to fetch notebooks",{error:e})),r$.k.get("/api/review/due?pageSize=1").then(e=>d(e.total)).catch(e=>D.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let w=async e=>{y.setAnalysisStep("saving"),await y.saveQuestion({...e,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",originalImageUrl:""}),y.setAnalysisStep("idle")},b=o.reduce((e,t)=>e+(t._count?.errorItems||0),0),v=[{value:"image",icon:i.f,label:e.app?.uploadImage||"Take Photo"},{value:"text",icon:u.f,label:e.app?.manualInput||"Manual Input"},{value:"file",icon:s,label:e.app?.fileImport||"Import File"},{value:"direct",icon:l.f,label:e.app?.directInput||"Manual Entry"}];return(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(rO.f,{status:y.analysisStep,completed:y.completedStages}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===y.step?"max-w-6xl":"max-w-4xl"}`,children:[(0,t.jsx)(rk.f,{message:y.saveError,onDismiss:y.dismissSaveError}),"upload"===y.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(rv,{notebookCount:o.length,itemCount:b,dueCount:m,targetNotebook:a?x?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(r_.f,{options:v,value:g,onChange:p}),y.pendingTask&&(0,t.jsx)(rE.f,{task:y.pendingTask,onRefresh:y.refreshPendingTask,onDismiss:y.dismissPendingTask}),y.lastImported&&(0,t.jsx)(rT.f,{imported:y.lastImported,onDismiss:y.dismissImported}),y.batchImages?(0,t.jsx)(c.f,{images:y.batchImages,subjectId:a,onClose:y.closeBatch}):"image"===g?(0,t.jsxs)(t.Fragment,{children:[y.parts.length>0&&(0,t.jsx)(rA.f,{parts:y.parts.map(e=>e.dataUrl),busy:y.isBusy,onFinish:()=>void y.finishParts(),onDiscard:y.discardParts}),(0,t.jsx)(rI.f,{onImageSelect:y.selectImage,isAnalyzing:y.isBusy})]}):"text"===g?(0,t.jsx)(rM.f,{onSubmit:y.submitText,isAnalyzing:y.isBusy,defaultNotebookName:x?.name,onCreateBatch:y.createTextBatch,creatingBatch:y.creatingBatch,onSwitchToFileImport:()=>p("file")}):"file"===g?(0,t.jsx)(rf,{defaultNotebookId:a||void 0}):(0,t.jsx)(I,{onSubmit:w,defaultNotebookId:a||void 0,defaultNotebookName:x?.name,isSaving:"saving"===y.analysisStep})]})]}),y.croppingImage&&(0,t.jsx)(rS.f,{imageSrc:y.croppingImage,open:y.isCropperOpen,onClose:y.closeCropper,onRegionsSelected:y.cropRegions,allowMulti:0===y.parts.length,onAutoSplit:0===y.parts.length?y.autoSplitImage:void 0,onAddPart:y.parts.length<rL.u-1?y.addPart:void 0,partCount:y.parts.length}),"review"===y.step&&y.parsedData&&(0,t.jsx)(h.f,{initialData:y.parsedData,onSave:y.saveReviewed,onCancel:y.cancelReview,imagePreview:y.currentImage,initialSubjectId:a||void 0,aiTimeout:y.aiTimeout})]})]})}e.s(["default",0,function(){return(0,t.jsx)(r.Suspense,{fallback:(0,t.jsx)(rj.f,{}),children:(0,t.jsx)(rD,{})})}],952683)}]);
|
|
6
|
+
${e.join("\n")}`}l.push({raw:u,index:r-i-1})}let u=ep({format:ei,version:1,questions:l.map(e=>e.raw)}),c=[...n,...u.errors.map(e=>{let t=l[e.index];return{index:t?t.index:e.index,reason:e.reason}})].sort((e,t)=>e.index-t.index);return{questions:u.questions,errors:c,warnings:[...r,...u.warnings]}}async function tC(t){let{default:r}=await e.A(84955),n=await r(t),i=[],a=[],o=[],s=0;for(let e of n){let t=e.data;if(!t||0===t.length)continue;let r=t.some(e=>e.map(e=>String(e??"").trim().toLowerCase()).some(e=>{let t=e.replace(/[\s ]+/g,"");return"section"===t||"大题"===t||"题型分组"===t})),l=tP(t,n.length>1&&!r?e.sheet:void 0);for(let e of l.errors)a.push({index:-1===e.index?-1:e.index+s,reason:e.reason});o.push(...l.warnings.map(t=>`[${e.sheet}] ${t}`)),i.push(...l.questions),s+=l.questions.length}return{questions:i,errors:a,warnings:o}}let tL=/^[\s\-–—·..]*\d{1,4}[\s\-–—·..]*$/;function tD(e){return e.replace(/\uFB00/g,"ff").replace(/\uFB01/g,"fi").replace(/\uFB02/g,"fl").replace(/\uFB03/g,"ffi").replace(/\uFB04/g,"ffl").replace(/\u00A0/g," ").replace(/\u3000/g," ")}function tR(e){let t=e.trim();if(!t)return null;if(tL.test(t))return{key:"",isPageNumberOnly:!0};let r=t.replace(/\d+/g,"").trim();return r?{key:r,isPageNumberOnly:!1}:null}function tF(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=11904&&t<=40959||t>=63744&&t<=64255||t>=12288&&t<=12351||t>=65280&&t<=65519}function tq(){return{cMapUrl:"/pdfjs/cmaps/",cMapPacked:!0,standardFontDataUrl:"/pdfjs/standard_fonts/"}}let tz=null;function tU(){return tz||(tz=(async()=>{let t=await e.A(825834);return t.GlobalWorkerOptions.workerSrc=new e.U(e.r(979463)).toString(),t})()),tz}function tG(e){return e.x+Math.max(.5*e.height,1)}function tB(e,t){if(!t||0===t.boundaries.length)return 0;let r=e.x+(tG(e)-e.x)/2;for(let e=0;e<t.boundaries.length;e++)if(r<t.boundaries[e])return e;return t.boundaries.length}let tW=[1,0,0,1,0,0];function tV(e,t,r){let[n,i,a,o,s,l]=e;return{x:n*t+a*r+s,y:i*t+o*r+l}}function tX(e,t,r){let n=e.width*e.height;if(n<4)return!1;let i=t*r;return!(i>0)||!(n>.8*i)}function tY(e){let t={text:e.text};return e.material&&(t.material=e.material),e.section&&(t.section=e.section),e.label&&(t.label=e.label),e.answer&&(t.answer=e.answer),e.analysis&&(t.analysis=e.analysis),e.knowledgePoints?.length&&(t.knowledgePoints=e.knowledgePoints),null!==e.difficultyStars&&void 0!==e.difficultyStars&&(t.difficultyStars=e.difficultyStars),e.wrongAnswer&&(t.wrongAnswer=e.wrongAnswer),e.questionType&&(t.questionType=e.questionType),t}async function tH(e,t={}){var r;let n,i=t.pdfjs??await tU(),a=new Uint8Array(e.slice(0));try{let e=t.pdfjs?t.standardFontDataUrl?{data:a,standardFontDataUrl:t.standardFontDataUrl,verbosity:0}:{data:a,verbosity:0}:{data:a,...tq(),verbosity:0};n=await i.getDocument(e).promise}catch(e){if("PasswordException"===(e instanceof Error?e.name:""))return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}let o=[],s=[],l=new Map,u=t.skipGraphicsDetection?null:function(e){let t=e.OPS;if(!t)return null;let r={};for(let e of["save","restore","transform","paintImageMaskXObject","paintImageMaskXObjectGroup","paintImageXObject","paintInlineImageXObject","paintInlineImageXObjectGroup","paintImageXObjectRepeat","paintImageMaskXObjectRepeat","paintSolidColorImageMask","constructPath"]){let n=t[e];if("number"!=typeof n)return null;r[e]=n}return r}(i),c=0,h=0,f=[];try{c=n.numPages;for(let e=1;e<=c;e++){let t=await n.getPage(e),r=t.getViewport({scale:1});if(s.push({width:r.width,height:r.height}),u){let n=await t.getOperatorList(),i=function(e,t,r,n){let i=[],a=[...tW],o=[];for(let s=0;s<e.fnArray.length;s++){let l=e.fnArray[s],u=e.argsArray[s];if(l===n.save){o.push([...a]);continue}if(l===n.restore){let e=o.pop();e&&(a=e);continue}if(l===n.transform){u&&"number"==typeof u.length&&u.length>=6&&(a=function(e,t){let[r,n,i,a,o,s]=e,[l,u,c,h,f,m]=t;return[r*l+i*u,n*l+a*u,r*c+i*h,n*c+a*h,r*f+i*m+o,n*f+a*m+s]}(a,[Number(u[0]),Number(u[1]),Number(u[2]),Number(u[3]),Number(u[4]),Number(u[5])]));continue}if(l===n.paintImageXObject||l===n.paintInlineImageXObject||l===n.paintImageMaskXObject||l===n.paintImageMaskXObjectGroup||l===n.paintInlineImageXObjectGroup){if(!u||"number"!=typeof u.length||u.length<2)continue;let e=Number(u[u.length-2]),n=Number(u[u.length-1]);if(!Number.isFinite(e)||!Number.isFinite(n)||e<=0||n<=0)continue;let o=function(e,t,r){let n=tV(e,0,0),i=tV(e,t,0),a=tV(e,0,r),o=tV(e,t,r),s=[n.x,i.x,a.x,o.x],l=[n.y,i.y,a.y,o.y],u=Math.min(...s),c=Math.min(...l);return{x:u,y:c,width:Math.max(...s)-u,height:Math.max(...l)-c}}(a,e,n);tX(o,t,r)&&i.push({kind:"image",rect:o});continue}if(l===n.constructPath){if(!u||"number"!=typeof u.length||u.length<3)continue;let e=u[2];if(!e||"number"!=typeof e.length||e.length<4)continue;let n=[0,1,2,3].map(t=>Number(e[t]));if(n.some(e=>!Number.isFinite(e)))continue;let o=function(e,t){let[r,n,i,a]=t;return function(e,t,r,n,i){let a=tV(e,t,r),o=tV(e,n,r),s=tV(e,t,i),l=tV(e,n,i),u=[a.x,o.x,s.x,l.x],c=[a.y,o.y,s.y,l.y],h=Math.min(...u),f=Math.min(...c);return{x:h,y:f,width:Math.max(...u)-h,height:Math.max(...c)-f}}(e,r,n,i,a)}(a,[n[0],n[1],n[2],n[3]]);tX(o,t,r)&&i.push({kind:"vector",rect:o});continue}}return i}(n,r.width,r.height,u);i.length>0&&l.set(e,i)}let i=await t.getTextContent(),a=0;for(let t of i.items){if(!("str"in t))continue;let r=tD(t.str);if(!r.trim())continue;let[n,,,,i,s]=t.transform,l=Math.abs(n)||1;o.push({str:r,x:i,y:s,width:t.width*l,height:t.height,page:e});let u=r.trim().length;a+=u,h+=u}f.push(a)}}catch(t){let e=t instanceof Error?t.name:"";if("PasswordException"===e)return{questions:[],errors:[{index:-1,reason:"PDF_ENCRYPTED"}],warnings:[]};return{questions:[],errors:[{index:-1,reason:"INVALID_PDF"}],warnings:[]}}finally{try{await n.cleanup()}catch{}}if(0===c||h/Math.max(c,1)<20)return{questions:[],errors:[{index:-1,reason:"PDF_NO_TEXT_LAYER"}],warnings:[`PAGES:${c}`]};let m=function(e,t){let r=e.map(e=>({...e,str:tD(e.str)})).filter(e=>e.str.trim().length>0),n=function(e,t){let r=new Map;for(let t of e){let e=r.get(t.page)??[];e.push(t),r.set(t.page,e)}let n=[];for(let[e,i]of r){let r=t.find((t,r)=>r+1===e),a=r?.height??0,o=[...i].sort((e,t)=>e.y-t.y||e.x-t.x),s=[];for(let e of o){let t=s[s.length-1],r=t?.[t.length-1],n=.5*Math.max(e.height,r?.height??0);t&&r&&Math.abs(e.y-r.y)<=n?t.push(e):s.push([e])}for(let t of s){t.sort((e,t)=>e.x-t.x);let r="",i=null;for(let e of t)i&&(!(e.x-(i.x+i.width)>.15*Math.max(e.height,i.height,1))||r.endsWith(" ")||e.str.startsWith(" ")||tF(r[r.length-1])||tF(e.str[0])||(r+=" ")),r+=e.str,i=e;let o=t.reduce((e,t)=>Math.max(e,t.height),0),s=t.reduce((e,t)=>e+t.y,0)/t.length;n.push({text:r.trimEnd(),x:t[0].x,yTop:a-s-o,height:o,page:e})}}return n}(r,t),i=function(e,t){let r=new Map,n=new Map;for(let t of e){let e=n.get(t.page)??[];e.push(t),n.set(t.page,e)}for(let[e,i]of n){let n=t.find((t,r)=>r+1===e);if(!n||n.width<=0)continue;let a=n.width/2,o=.06*n.width,s=i.filter(e=>e.x+e.width<=a+o).reduce((e,t)=>e+t.str.trim().length,0),l=i.filter(e=>e.x>=a-o).reduce((e,t)=>e+t.str.trim().length,0),u=s+l;!(u<1)&&!i.some(e=>e.x<a+o&&e.x+e.width>a-o)&&s>=.25*u&&l>=.25*u&&r.set(e,{width:n.width,height:n.height})}return r}(r,t),a=function(e,t){let r=[...new Set(e.map(e=>e.page))].filter(e=>e>=1);if(0===r.length)return[];let n=Math.max(2,Math.ceil(.5*(t.length||r.length))),i=new Map;for(let r of e){let e=t.find((e,t)=>t+1===r.page),n=e?.height??0;if(n<=0)continue;let a=r.yTop<=.15*n,o=r.yTop>=.92*n;if(!a&&!o||r.text.length>100)continue;let s=tR(r.text);if(!s)continue;let l=`${a?"H":"F"}:${s.key}:${s.isPageNumberOnly?"#":"*"}`,u=i.get(l);u?(u.pages.add(r.page),u.minYTop=Math.min(u.minYTop,r.yTop),u.maxYTopBottom=Math.max(u.maxYTopBottom,r.yTop)):i.set(l,{key:s.key,pages:new Set([r.page]),isPageNumberOnly:s.isPageNumberOnly,minYTop:r.yTop,maxYTopBottom:r.yTop})}return[...i.values()].filter(e=>e.pages.size>=n)}(n,t),o=new Set;for(let e of a)for(let t of n){if(t.page<1||!e.pages.has(t.page))continue;let r=tR(t.text);r?.key===e.key&&(!e.isPageNumberOnly||r.isPageNumberOnly)&&t.yTop>=e.minYTop&&t.yTop<=e.maxYTopBottom&&o.add(t)}return n.filter(e=>!o.has(e)).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x).map(e=>{let t=i.get(e.page);if(!t)return e;let r=t.width/2;return{...e,yTop:e.x>=r?e.yTop+t.height:e.yTop}}).sort((e,t)=>e.page-t.page||e.yTop-t.yTop||e.x-t.x)}(o,s),d=m.map(e=>e.text).join("\n"),g=(0,ey.J)(d,t.splitOptions),p=[`PAGES:${c}`],x=f.filter(e=>0===e).length;x>0&&p.push(`EMPTY_PAGES:${x}`),g.ignored.length>0&&p.push((r=g.ignored.length,`IGNORED_PARAGRAPHS:${r}`)),g.detected||1!==g.questions.length||p.push("SINGLE_QUESTION");let y=ep(g.questions.map(tY)),w=new Map(Array.from(l.entries()).map(([e,t])=>{let r=s[e-1]?.height??0;return[e,t.map(({rect:e})=>({x:e.x,yTop:r-e.y-e.height,width:e.width,height:e.height}))]})),b=function(e,t,r,n=new Map){let i,a=function(e,t){let r=new Map;for(let t of e){let e=r.get(t.page)??[];e.push(t),r.set(t.page,e)}let n=new Map;for(let[e,i]of r){let r=t.find((t,r)=>r+1===e);if(!r||r.width<=0)continue;let a=r.width/2,o=.06*r.width,s=i.filter(e=>tG(e)<=a+o).reduce((e,t)=>e+t.text.trim().length,0),l=i.filter(e=>e.x>=a-o).reduce((e,t)=>e+t.text.trim().length,0),u=s+l;!(u<1)&&!i.some(e=>e.x<a+o&&tG(e)>a-o)&&s>=.25*u&&l>=.25*u&&n.set(e,{boundaries:[a]})}return n}(t,r),o=(i=new Map,r.forEach((e,t)=>{e.height<=0||i.set(t+1,{top:.15*e.height,bottom:.92*e.height})}),i),s=e.map(e=>e?function(e,t,r){let n=t[e];if(!n)return e;let i=r.get(n.page)??null,a=tB(n,i),o=e;for(;o>0;){let e=t[o-1],r=t[o];if(e.page!==n.page||tB(e,i)!==a)break;let s=r.yTop-(e.yTop+e.height),l=e.x>n.x+2*n.height;if(s>.8*n.height||!l)break;o-=1}return o}(e.from,t,a):void 0);return e.map((e,i)=>{if(!e||e.from<0||e.from>=t.length)return null;let l=s[i]??e.from,u=s.slice(i+1).find(e=>void 0!==e);return function(e,t,r,n,i,a,o=new Map){if(e<0||e>=r.length)return[];let s=Math.min(t,r.length),l=Math.min(s,r.length),u=l<r.length?r[l]:null,c=r[e],h=(e,t,r)=>!!u&&u.page===e&&tB(u,r)===t,f=[],m=c.page,d=(r[s-1]??c).page;for(let t=m;t<=d;t++){let l=n.find((e,r)=>r+1===t);if(!l)continue;let d=a.get(t)??{top:0,bottom:l.height},y=i.get(t)??null,w=[];for(let n=e;n<s;n++){let e=r[n];e.page===t&&w.push(e)}if(0===w.length)continue;let b=new Map;for(let e of w){let t=tB(e,y),r=b.get(t)??[];r.push(e),b.set(t,r)}for(let[e,r]of Array.from(b.entries()).sort((e,t)=>e[0]-t[0])){let n,a=r[0],s=(g=y,p=e,x=l.width,g&&0!==g.boundaries.length?{left:p>0?g.boundaries[p-1]:0,right:p<g.boundaries.length?g.boundaries[p]:x}:{left:0,right:x}),w=t===m&&e===tB(c,i.get(m)??null),b=Math.max(0,a.yTop-4);if(!w)for(let e of o.get(t)??[])e.x<s.right&&e.x+e.width>s.left&&e.yTop>=d.top&&e.yTop+e.height<=a.yTop&&(b=Math.min(b,Math.max(0,e.yTop-4)));if(h(t,e,y))n=u.yTop-4;else{let e=r[r.length-1],i=e.yTop+e.height;for(let e of o.get(t)??[])e.x<s.right&&e.x+e.width>s.left&&e.yTop>=b&&e.yTop<d.bottom&&(i=Math.max(i,e.yTop+e.height));n=i+4}(n=Math.min(n,l.height))<=b||f.push({page:t,rect:{x:s.left,yTop:b,width:s.right-s.left,height:n-b}})}}var g,p,x,y,w,b=f;if(b.length<=1)return b;let N=[];for(let e of b){let t=N[N.length-1];t&&t.page===e.page&&(y=t.rect,w=e.rect,y.x<w.x+w.width&&w.x<y.x+y.width&&y.yTop<w.yTop+w.height&&w.yTop<y.yTop+y.height)?t.rect=function(e,t){let r=Math.min(e.x,t.x),n=Math.min(e.yTop,t.yTop);return{x:r,yTop:n,width:Math.max(e.x+e.width,t.x+t.width)-r,height:Math.max(e.yTop+e.height,t.yTop+t.height)-n}}(t.rect,e.rect):N.push({...e,rect:{...e.rect}})}return N}(l,void 0!==u&&u<e.to?u:e.to,t,r,a,o,n)})}(g.questions.map(e=>e.lineRange),m,s,w),N=new Set(y.errors.filter(e=>e.index>=0).map(e=>e.index)),v=[];for(let e=0;e<g.questions.length&&v.length<y.questions.length;e++)N.has(e)||v.push(b[e]??null);let S=l.size>0,T=Array.from({length:c},(e,t)=>l.get(t+1)??[]),E=s.map(e=>e.height);return{questions:y.questions,errors:y.errors,warnings:[...p,...eg(y.warnings)],pdfRegions:v,pdfHasGraphics:S,pdfPageGraphics:T,pdfPageHeights:E}}let tQ={maxLength:ey.f,maxQuestions:ey.k},tK={maxLength:ey.f,maxQuestions:ey.k},tZ={json:e=>ex(e.buffer),docx:e=>tM(e.buffer,{},tQ),xlsx:e=>tC(e.buffer),csv:async function(e){let t,{text:r}=(0,F.n)(e.buffer),{rows:n}=(t=function(e){let t=e.split(/\r?\n/,1)[0]??"",r=",",n=0;for(let e of[",",";"," "]){let i=t.split(e).length-1;i>n&&(n=i,r=e)}return r}(r),{rows:function(e,t){let r=[],n=[],i="",a=!1,o=0;for(65279===e.charCodeAt(0)&&(o=1);o<e.length;){let s=e[o];if(a){'"'===s?'"'===e[o+1]?(i+='"',o+=2):(a=!1,o+=1):(i+=s,o+=1);continue}if('"'===s&&""===i){a=!0,o+=1;continue}if(s===t){n.push(i),i="",o+=1;continue}if("\r"===s){"\n"===e[o+1]&&(o+=1),n.push(i),i="",r.push(n),n=[],o+=1;continue}if("\n"===s){n.push(i),i="",r.push(n),n=[],o+=1;continue}i+=s,o+=1}return(""!==i||n.length>0)&&(n.push(i),r.push(n)),r.filter(e=>e.some(e=>""!==e.trim()))}(r,t),delimiter:t});return tP(n)},pdf:e=>tH(e.buffer,{splitOptions:tK})};function tJ(){let e=(e,t)=>{let r=document.createElement("canvas");return r.width=e,r.height=t,r},t=(e,t,r)=>{e.fillStyle="#ffffff",e.fillRect(0,0,t,r)},r=(e,t)=>e.toDataURL("image/jpeg",t),n=e=>Math.floor(3*e.slice(e.indexOf(",")+1).length/4);return{async renderComposite(i,a){let o=e(a.canvasWidth,a.canvasHeight),s=o.getContext("2d");if(!s)throw Error("CANVAS_UNSUPPORTED");t(s,a.canvasWidth,a.canvasHeight),s.imageSmoothingEnabled=!0,s.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];s.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,t.y,t.width,t.height)}let l=r(o,.85),u=1;for(;n(l)>1048576&&u>.1;){u*=.85;let n=Math.max(1,Math.round(a.canvasWidth*u)),o=Math.max(1,Math.round(a.canvasHeight*u)),s=e(n,o),c=s.getContext("2d");if(!c)throw Error("CANVAS_UNSUPPORTED");t(c,n,o),c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];c.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,Math.round(t.y*u),Math.round(t.width*u),Math.round(t.height*u))}l=r(s,.85)}return l},async renderSingle(i,a,o){let s=function(e,t,r=1600){let n=Math.max(e,t);if(n<=r)return{width:e,height:t};let i=r/n;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}(i.width,i.height,a),l=e(s.width,s.height),u=l.getContext("2d");if(!u)throw Error("CANVAS_UNSUPPORTED");t(u,s.width,s.height),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(i.source,0,0,i.width,i.height,0,0,s.width,s.height);let c=r(l,.85),h=1;for(;n(c)>o&&h>.1;){h*=.85;let n=Math.max(1,Math.round(s.width*h)),a=Math.max(1,Math.round(s.height*h)),o=e(n,a),l=o.getContext("2d");if(!l)throw Error("CANVAS_UNSUPPORTED");t(l,n,a),l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(i.source,0,0,i.width,i.height,0,0,n,a),c=r(o,.85)}return c}}}async function t0(e,t=tJ()){if(0===e.length)throw Error("NO_IMAGES");if(1===e.length)return t.renderSingle(e[0],1600,1048576);let r=function(e,t=16){let r=e.map(t=>{var r,n,i;return r=t.width,n=t.height,i=Math.max(...e.map(e=>e.width)),r<=0?{width:i,height:0}:{width:i,height:Math.max(1,Math.round(i/r*n))}}),{width:n,height:i}=function(e,t=16){return 0===e.length?{width:0,height:0}:{width:Math.max(...e.map(e=>e.width)),height:e.reduce((e,t)=>e+t.height,0)+t*(e.length-1)}}(r,t),a=function(e,t=16){let r=[],n=0;for(let i of e)r.push(n),n+=i.height+t;return r}(r,t);return{canvasWidth:n,canvasHeight:i,placements:r.map((e,t)=>({...e,y:a[t]}))}}(e.map(e=>({width:e.width,height:e.height})));return t.renderComposite(e,r)}async function t1(e){let t=atob(e.slice(e.indexOf(",")+1)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return createImageBitmap(new Blob([r],{type:e.slice(5,e.indexOf(";"))}))}async function t2(e){let t=await t1(e);return{source:t,width:t.width,height:t.height}}let t4=["subject","gradeSemester","source","figureSvg","extensions"],t5={subject:{zh:"学科",en:"subject"},gradeSemester:{zh:"年级学期",en:"gradeSemester"},source:{zh:"来源",en:"source"},figureSvg:{zh:"配图 SVG",en:"figureSvg"},extensions:{zh:"扩展字段",en:"extensions"}};async function t6(e,t={}){let{renderer:r,decodeFn:n,onProgress:i,metafileDeps:a,metafileCounts:o,metafileTruncated:s}=t,l=e.length,u=0,c=[];for(let t of e){let e={text:t.text,material:t.material??null,section:t.section??null,label:t.label??null,answer:t.answer??null,analysis:t.analysis??null,knowledgePoints:t.knowledgePoints?.length?t.knowledgePoints:null,difficultyStars:t.difficultyStars??null,wrongAnswer:t.wrongAnswer??null,questionType:t.questionType??null};if(t.images?.length&&r&&n)try{let i=function(e){let t=0,r=0;return{images:e.filter(e=>!tm(e.dataUrl)||!((t+=1)>12)||(r+=1,!1)),truncatedMetafiles:r}}(t.images);s&&(s.count+=i.truncatedMetafiles);let l=await t8(i.images,a,o),u=await Promise.all(l.map(e=>n(e.dataUrl)));e.image=await t0(u,r)}catch{e.image=null}c.push(e),u+=1,i?.(u,l)}return c}async function t8(e,t,r){let n=[];for(let i of e){if(!tm(i.dataUrl)){n.push(i);continue}let e=function(e){if(!e||!e.startsWith(th))return null;let t=/^(\d+)x(\d+)$/.exec(e.slice(th.length));return t?{width:Number.parseInt(t[1],10),height:Number.parseInt(t[2],10)}:null}(i.alt)??{width:800,height:600},a=await ty(i.dataUrl,e,t??{});if(null===a){r&&(r.failed+=1);continue}r&&(r.rendered+=1),n.push({dataUrl:a})}return n}let t3={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},TEXT_REQUIRED:{zh:e=>e.startsWith("row=")?`第 ${e.slice(4)} 行缺少题干`:"缺少题干",en:e=>e.startsWith("row=")?`Row ${e.slice(4)} is missing question text`:"Question text is required"}},t7={INVALID_JSON:{zh:"不是合法的 JSON 文件,请检查文件内容",en:"Not a valid JSON file; please check the file content"},INVALID_DOCX:{zh:"无法读取该 Word 文件,文件可能已损坏或不是 .docx 格式",en:"Cannot read this Word file; it may be corrupted or not a .docx file"},LEGACY_DOC_NOT_SUPPORTED:{zh:"旧版 .doc 格式暂不支持,请在 Word 中另存为 .docx 后再导入",en:"Legacy .doc is not supported; please save it as .docx in Word and import again"},TEXT_COLUMN_NOT_FOUND:{zh:"未找到「题干」列,请使用题库模板或检查表头",en:'No "question text" column found; please use the question template or check the header row'},EMPTY_TABLE:{zh:"表格为空,没有可导入的题目",en:"The table is empty; there are no questions to import"},QUESTIONS_REQUIRED:{zh:"文件中没有题目(questions 为空)",en:"The file contains no questions (questions is empty)"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确(questions 应为题目数组)",en:'Invalid question format ("questions" should be an array of questions)'},PDF_NO_TEXT_LAYER:{zh:"这是扫描版 PDF(没有文字层),可在下方选择页码范围转为图片,由 AI 识别分题导入",en:"This is a scanned PDF (no text layer). You can select a page range below to convert it to images and import with AI recognition."},PDF_ENCRYPTED:{zh:"这是加密 PDF,暂不支持导入,请先去除密码后重试",en:"This PDF is password-protected and cannot be imported; please remove the password and try again"},INVALID_PDF:{zh:"无法读取该 PDF 文件,文件可能已损坏或不是有效的 PDF",en:"Cannot read this PDF file; it may be corrupted or not a valid PDF"}},t9={TEXT_REQUIRED:{zh:"缺少题干,已跳过",en:"Missing question text; skipped"},TEXT_TOO_LONG:{zh:"题干过长,已跳过",en:"Question text is too long; skipped"},MATERIAL_TOO_LONG:{zh:"公共材料过长,该题已跳过",en:"Shared material is too long; question skipped"},SECTION_TOO_LONG:{zh:"大题标题过长,该题已跳过",en:"Section title is too long; question skipped"},LABEL_TOO_LONG:{zh:"题号过长,该题已跳过",en:"Label is too long; question skipped"},ANSWER_TOO_LONG:{zh:"答案过长,该题已跳过",en:"Answer is too long; question skipped"},ANALYSIS_TOO_LONG:{zh:"解析过长,该题已跳过",en:"Analysis is too long; question skipped"},INVALID_DIFFICULTY:{zh:"难度值无效(应为 1~5),该题已跳过",en:"Invalid difficulty (should be 1–5); question skipped"},WRONG_ANSWER_TOO_LONG:{zh:"错答内容过长,该题已跳过",en:"Wrong answer is too long; question skipped"},SUBJECT_TOO_LONG:{zh:"学科字段过长,该题已跳过",en:"Subject is too long; question skipped"},GRADE_SEMESTER_TOO_LONG:{zh:"年级学期字段过长,该题已跳过",en:"Grade/semester is too long; question skipped"},SOURCE_TOO_LONG:{zh:"来源字段过长,该题已跳过",en:"Source is too long; question skipped"},QUESTION_TYPE_TOO_LONG:{zh:"题型字段过长,该题已跳过",en:"Question type is too long; question skipped"},KNOWLEDGE_POINT_TOO_LONG:{zh:"知识点过长,该题已跳过",en:"Knowledge point is too long; question skipped"},TOO_MANY_KNOWLEDGE_POINTS:{zh:"知识点数量超过上限,该题已跳过",en:"Too many knowledge points; question skipped"},INVALID_IMAGE_DATA_URL:{zh:"图片数据无效,该题已跳过",en:"Invalid image data; question skipped"},IMAGE_TOO_LARGE:{zh:"图片过大,该题已跳过",en:"Image is too large; question skipped"},TOO_MANY_IMAGES:{zh:"图片数量超过上限,该题已跳过",en:"Too many images; question skipped"},FIGURE_SVG_TOO_LONG:{zh:"配图 SVG 过长,该题已跳过",en:"Figure SVG is too long; question skipped"},INVALID_QUESTION_SHAPE:{zh:"题目格式不正确,该题已跳过",en:"Invalid question shape; skipped"}},re={MISSING_FORMAT:{zh:"文件缺少 format 字段,已按题目交换格式解析",en:'The file is missing the "format" field; parsed as the question exchange format'},UNKNOWN_FORMAT:{zh:"format 字段不是已知的题目交换格式,已尝试按 v1 解析",en:'The "format" field is not the known exchange format; tried parsing as v1'},MISSING_VERSION:{zh:"文件缺少 version 字段,已按 v1 解析",en:'The file is missing the "version" field; parsed as v1'},UNSUPPORTED_VERSION:{zh:"文件版本高于当前支持的 v1,已按 v1 宽松规则解析",en:"The file version is newer than the supported v1; parsed with v1 tolerant rules"},TOO_MANY_QUESTIONS:{zh:"题目数量超过文件上限,超出部分已截断",en:"Question count exceeds the per-file limit; the rest was truncated"},SINGLE_QUESTION:{zh:"只识别出一道题;如果文件里有多道题,请检查题号格式",en:"Only one question was recognized; if the file has more, check the question numbering"}},rt={UNKNOWN_COLUMN:{zh:e=>`未识别的列「${e}」,该列内容已忽略`,en:e=>`Unrecognized column "${e}"; its content was ignored`},IGNORED_PARAGRAPHS:{zh:e=>`${e} 个段落未计入题目(标题、说明等)`,en:e=>`${e} paragraph(s) not counted as questions (titles, notes, etc.)`},IMAGE_UNSUPPORTED:{zh:e=>`以下格式的图片暂不支持导入,已跳过:${e}`,en:e=>`Image format(s) not supported, skipped: ${e}`},METAFILE_RENDERED:{zh:e=>`${e} 个公式预览图(WMF/EMF)已渲染为图片`,en:e=>`${e} equation preview image(s) (WMF/EMF) rendered`},METAFILE_FAILED:{zh:e=>`${e} 个公式预览图(WMF/EMF)渲染失败,未包含在题目原图中`,en:e=>`${e} equation preview image(s) (WMF/EMF) failed to render and were left out`},METAFILE_TRUNCATED:{zh:e=>`${e} 个公式小图超出单题拼接上限,未包含在题目原图中`,en:e=>`${e} small equation image(s) exceeded the per-question merge limit and were left out`},OLE_EQUATION_LATEX:{zh:e=>`${e} 个 MathType 公式对象已转为 LaTeX`,en:e=>`${e} MathType equation object(s) converted to LaTeX`},OLE_EQUATION_IMAGE:{zh:e=>`${e} 个 MathType 公式对象按图片保留(复杂公式无法可靠还原)`,en:e=>`${e} MathType equation object(s) kept as image(s) (complex formula could not be reliably converted)`},MATH_UNSUPPORTED:{zh:e=>`部分 OMML 结构未识别:${e}`,en:e=>`Some OMML structures not recognized: ${e}`},PAGES:{zh:e=>`共 ${e} 页`,en:e=>`${e} page${"1"===e?"":"s"} in total`},EMPTY_PAGES:{zh:e=>`其中 ${e} 页没有文字内容(空白页或纯图片页),未计入题目`,en:e=>`${e} page${"1"===e?" has":"s have"} no text content (blank or image-only) and were not counted as questions`}};function rr(e,t){let r,n=e.match(/^(\[[^\]]*\])\s*(.*)$/),i=n?n[1]:"",a=n?n[2]:e,o=a.indexOf(":"),s=-1===o?a:a.slice(0,o),l=-1===o?"":a.slice(o+1);if(l&&rt[s])r=rt[s][t](l);else{let e=re[s];r=e?e[t]:"zh"===t?`未知警告(${a})`:`Unknown warning (${a})`}return i?`${i} ${r}`:r}var rn=e.i(682638);async function ri(e,t){let r=e.getViewport({scale:t}),n=document.createElement("canvas");n.width=Math.max(1,Math.ceil(r.width)),n.height=Math.max(1,Math.ceil(r.height));let i=n.getContext("2d");if(!i)throw Error("CANVAS_UNSUPPORTED");return i.fillStyle="#ffffff",i.fillRect(0,0,n.width,n.height),await e.render({canvasContext:i,viewport:r}).promise,{canvas:n,width:n.width,height:n.height}}async function ra(e,t,r){let n=Math.max(0,Math.round(r.rect.x*t)),i=Math.max(0,Math.round(r.rect.yTop*t)),a=Math.max(1,Math.round(r.rect.width*t)),o=Math.max(1,Math.round(r.rect.height*t)),s=e.width-n,l=e.height-i,u=Math.min(a,s),c=Math.min(o,l);if(u<1||c<1)throw Error("CROP_OUT_OF_BOUNDS");return createImageBitmap(e,n,i,u,c)}async function ro(e,t,r,n=1600){if(0===t.length)throw Error("NO_REGIONS");let i=new Map;for(let e of t){let t=i.get(e.page)??[];t.push(e),i.set(e.page,t)}let a=[];try{for(let[t,r]of i){let i=await e.getPage(t),o=i.getViewport({scale:1}),s=Math.max(o.width,o.height),l=Math.max(...r.map(e=>Math.max(e.rect.width,e.rect.height))),u=function(e,t,r=1600){return e<=0||t<=0?1:Math.min(3,Math.max(1,r/e))}(l,s,n),{canvas:c}=await ri(i,u);try{for(let e of r){let t=await ra(c,u,e);a.push({source:t,width:t.width,height:t.height})}}finally{c.width=0,c.height=0}}return await t0(a,r)}finally{for(let e of a)e.source instanceof ImageBitmap&&e.source.close()}}var rs=e.i(119472);async function rl(e,t,r={}){let n=r.createBatch??rs.v,i=[],a=[];for(let o=0;o<e.length;o++){let s=e[o];try{let e=await n({source:"image",imageBase64:s.dataUrl,imageInfo:{sourceType:"pdf-page",sourceBytes:s.bytes,sourceWidth:s.width,sourceHeight:s.height,outputWidth:s.width,outputHeight:s.height,outputBytes:s.bytes,quality:void 0},language:t.language,subjectId:t.notebookId,targetSubjectId:t.notebookId});i.push({pageNumber:s.pageNumber,batch:e})}catch(e){a.push({pageNumber:s.pageNumber,error:e})}r.onProgress?.(o+1,e.length)}return{successes:i,failures:a}}async function ru(e,t,r){let n=await tU();return Y(await n.getDocument({data:new Uint8Array(e.slice(0)),...tq()}).promise,{pages:t,onProgress:r})}async function rc(e,t,r,n,i,a,o){let s=t.pdfRegions??[],l=t.questions,u=new Map;t.pdfPageGraphics&&t.pdfPageGraphics.forEach((e,t)=>{e.length>0&&u.set(t+1,e)});let c=new Map;t.pdfPageHeights&&t.pdfPageHeights.forEach((e,t)=>c.set(t+1,e));let h=l.map((e,t)=>{let n=s[t];if(!n||0===n.length)return!1;if("all"===r)return!0;if(!n)return!1;for(let e of n){let t=c.get(e.page)??0;if(function(e,t,r){let n=t.get(e.page)??[],i=r(e.page);for(let t of n){var a;let r=function(e,t){let r=t-(e.y+e.height);return{x:e.x,yTop:r,width:e.width,height:e.height}}(t.rect,i);if(a=e.rect,a.x<r.x+r.width&&r.x<a.x+a.width&&a.yTop<r.yTop+r.height&&r.yTop<a.yTop+a.height)return!0}return!1}(e,u,()=>t))return!0}return!1}),f=h.filter(Boolean).length;if(0===f)return l;let m=a?.loadDocument??rh,d=a?.captureQuestion??((e,t)=>ro(e,t??[])),g=await m(e);try{let e=[],t=0;for(let r=0;r<l.length;r++){let a=l[r],u=s[r];if(!h[r]||!u||0===u.length){e.push(a);continue}try{let t=await d(g,u);e.push({...a,images:[{dataUrl:t,alt:n}]})}catch(t){D.V.warn("[FileImport]","Capture question image failed",{fileName:n,index:r,error:(0,R.Z)(t)}),o.push(`第 ${r+1} 题截图失败:${(0,R.Z)(t)}`),e.push(a)}t+=1,i(t,f)}return e}finally{try{await g.cleanup?.()}catch{}}}async function rh(e){let t=await tU();return await t.getDocument({data:new Uint8Array(e.slice(0)),...tq()}).promise}function rf({defaultNotebookId:e}){let{t:i,language:a}=(0,N.b)(),[o,s]=(0,r.useState)(e??""),{phase:l,handleFile:u,handleConfirm:c,handleReset:h,handleScannedPdfConfirm:m}=function({language:e,notebookId:t,texts:i,scannedPdfDeps:a,pdfCaptureDeps:o}){let s=(0,n.useRouter)(),[l,u]=(0,r.useState)({kind:"pick"}),c=async(r="none")=>{let n;if("summary"!==l.kind)return;if(!t)return void M.c.error(i.notebookRequired);if(l.summary.total>rn.e)return void M.c.error(i.tooManyQuestions.replace("{max}",String(rn.e)));u({kind:"creating",fileName:l.fileName,batchCount:Math.ceil(l.summary.total/60)});let a=l.result.questions,c=[];"pdf"===l.fileType.key&&"none"!==r&&l.result.pdfRegions&&(a=await rc(l.buffer,l.result,r,l.fileName,(e,t)=>{u({kind:"processingImages",fileName:l.fileName,done:e,total:t})},o,c));let h=a.some(e=>e.images?.length),f={rendered:0,failed:0},m={count:0};try{if(h){let e=tJ();n=await t6(a,{renderer:e,decodeFn:t2,metafileCounts:f,metafileTruncated:m,onProgress:(e,t)=>{u({kind:"processingImages",fileName:l.fileName,done:e,total:t})}})}else n=await t6(a)}catch(e){D.V.error("[FileImport]","Process images failed",{error:(0,R.Z)(e)}),M.c.error(i.parseFailed),u({kind:"summary",fileName:l.fileName,fileType:l.fileType,result:l.result,summary:l.summary,buffer:l.buffer});return}for(let e of c)M.c.warning(e);let d=[];f.rendered>0&&d.push(rr(`METAFILE_RENDERED:${f.rendered}`,e)),f.failed>0&&d.push(rr(`METAFILE_FAILED:${f.failed}`,e)),m.count>0&&d.push(rr(`METAFILE_TRUNCATED:${m.count}`,e)),u({kind:"creating",fileName:l.fileName,batchCount:Math.ceil(l.summary.total/60)});try{let{batches:r,failures:a}=await (0,rn.r)(n,{language:e,subjectId:t,targetSubjectId:t,origin:{fileName:l.fileName,format:l.fileType.key}});for(let e of(r.length>0&&(M.c.success(i.batchesCreated.replace("{count}",String(r.length))),s.push(1===r.length?`/import-batches/${r[0].id}`:"/import-tasks")),a))M.c.error(i.batchFailed.replace("{index}",String(e.index+1)).replace("{error}",(0,R.Z)(e.error)));0===r.length&&a.length>0&&u({kind:"summary",fileName:l.fileName,fileType:l.fileType,result:l.result,summary:l.summary,buffer:l.buffer})}catch(e){D.V.error("[FileImport]","Create batches failed",{error:(0,R.Z)(e)}),M.c.error((0,R.Z)(e)),u({kind:"summary",fileName:l.fileName,fileType:l.fileType,result:l.result,summary:l.summary,buffer:l.buffer})}},h=async r=>{let n;if("scanned-pdf"!==l.kind)return;if(!t)return void M.c.error(i.notebookRequired);let{fileName:o,buffer:c}=l;u({kind:"rendering-pdf",fileName:o,rendered:0,total:r.length});try{n=a?.renderPages?await a.renderPages(c,r,(e,t)=>{u({kind:"rendering-pdf",fileName:o,rendered:e,total:t})}):await ru(c,r,(e,t)=>{u({kind:"rendering-pdf",fileName:o,rendered:e,total:t})})}catch(e){D.V.error("[FileImport]","Render scanned PDF failed",{error:(0,R.Z)(e)}),M.c.error(i.pdfRenderFailed),u({kind:"scanned-pdf",fileName:o,buffer:c,pageCount:l.pageCount});return}u({kind:"creating-pdf-batches",fileName:o,created:0,total:n.length});let h=a?.createBatches??rl,{successes:f,failures:m}=await h(n,{language:e,notebookId:t},{onProgress:(e,t)=>{u({kind:"creating-pdf-batches",fileName:o,created:e,total:t})}});for(let e of m){var d;(d=e.error,d?.status===429)?M.c.error(i.pdfQuotaExceeded.replace("{page}",String(e.pageNumber))):M.c.error(i.pdfPageFailed.replace("{page}",String(e.pageNumber)).replace("{error}",(0,R.Z)(e.error)))}f.length>0?(M.c.success(i.batchesCreated.replace("{count}",String(f.length))),s.push(1===f.length?`/import-batches/${f[0].batch.id}`:"/import-tasks")):u({kind:"scanned-pdf",fileName:o,buffer:c,pageCount:l.pageCount})};return{phase:l,handleFile:async(t,r)=>{var n;let a,o,s,l,c,h=tZ[r.key]??null;if(!h)return void M.c.error(i.unsupportedType);u({kind:"parsing",fileName:t.name});try{o=await t.arrayBuffer(),a=await h({name:t.name,buffer:o})}catch(e){D.V.error("[FileImport]","Parse file failed",{error:(0,R.Z)(e)}),M.c.error(i.parseFailed),u({kind:"pick"});return}let f=(s=(n=a).errors.slice().sort((e,t)=>e.index-t.index).slice(0,5).map(t=>({index:t.index,message:function(e,t){let r=e.indexOf(":"),n=-1===r?e:e.slice(0,r),i=-1===r?"":e.slice(r+1);if(i&&t3[n])return t3[n][t](i);let a=t9[n]??t7[n];return a?a[t]:"zh"===t?`未知错误(${e})`:`Unknown error (${e})`}(t.reason,e)})),l=n.warnings.map(t=>rr(t,e)),c=function(e){let t=new Map;for(let r of t4){let n=0;for(let t of e)(function(e,t){let r=e[t];return null!=r&&("string"==typeof r?r.trim().length>0:Array.isArray(r)?r.length>0:Object.keys(r).length>0)})(t,r)&&(n+=1);n>0&&t.set(r,n)}return Array.from(t.entries()).map(([e,t])=>({field:e,count:t}))}(n.questions),{total:n.questions.length,importable:n.questions.length,errorCount:n.errors.length,warningCount:n.warnings.length,errors:s,warnings:l,ignoredFields:c,ignoredFieldTexts:c.map(({field:t,count:r})=>{let n=t5[t][e];return"zh"===e?`${n}(${r} 题)`:`${n} (${r} question${r>1?"s":""})`})});if(D.V.info("[FileImport]","File parsed",{fileName:t.name,type:r.key,total:f.total,errors:f.errorCount,warnings:f.warningCount}),0===f.total){if("pdf"===r.key&&a.errors.some(e=>"PDF_NO_TEXT_LAYER"===e.reason)){let e=function(e){for(let t of e.warnings)if(t.startsWith("PAGES:")){let e=Number.parseInt(t.slice(6),10);return Number.isFinite(e)?e:null}return null}(a)??0;u({kind:"scanned-pdf",fileName:t.name,buffer:o,pageCount:e});return}let e=f.errors[0]?.message;M.c.error(e??i.noQuestions),u({kind:"pick"});return}u({kind:"summary",fileName:t.name,fileType:r,result:a,summary:f,buffer:o})},handleConfirm:c,handleReset:()=>u({kind:"pick"}),handleScannedPdfConfirm:h}}({language:"en"===a?"en":"zh",notebookId:o,texts:i.fileImport});return(0,t.jsx)(f.N,{className:"rounded-2xl","data-testid":"file-import-panel",children:(0,t.jsxs)(f.O,{className:"space-y-4 p-6",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(j.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:i.fileImport.title})]}),(0,t.jsx)(rm,{phase:l,notebookId:o,onNotebookChange:s,onFile:u,onConfirm:c,onReset:h,onScannedPdfConfirm:m})]})})}function rm({phase:e,notebookId:r,onNotebookChange:n,onFile:i,onConfirm:a,onReset:o,onScannedPdfConfirm:s}){switch(e.kind){case"parsing":return(0,t.jsx)(_,{textKey:"parsing",fileName:e.fileName});case"processingImages":return(0,t.jsx)(O,{fileName:e.fileName,done:e.done,total:e.total});case"creating":return(0,t.jsx)(_,{textKey:"creating",batchCount:e.batchCount});case"rendering-pdf":return(0,t.jsx)(_,{textKey:"rendering-pdf",rendered:e.rendered,total:e.total});case"creating-pdf-batches":return(0,t.jsx)(_,{textKey:"creating-pdf-batches",rendered:e.created,total:e.total});case"scanned-pdf":return(0,t.jsx)(H,{fileName:e.fileName,pageCount:e.pageCount,notebookId:r,onNotebookChange:n,onConfirm:s,onReset:o});case"summary":return(0,t.jsx)(G,{fileName:e.fileName,summary:e.summary,pdfHasGraphics:e.result.pdfHasGraphics,notebookId:r,onNotebookChange:n,onConfirm:a,onReset:o});default:return(0,t.jsx)(U,{onFile:i})}}var rd=e.i(522016),rg=e.i(217255),rp=e.i(856423),rx=e.i(975153),ry=e.i(218964),rw=e.i(697886);let rb=()=>()=>{};function rN({href:e,icon:r,label:n,value:i}){return(0,t.jsxs)(rd.default,{href:e,className:"rounded-xl bg-white/15 px-4 py-3 backdrop-blur-sm transition-colors hover:bg-white/20",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-white/75",children:[(0,t.jsx)(r,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:n})]}),(0,t.jsx)("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:i??"–"})]})}function rv({notebookCount:e,itemCount:n,dueCount:i,targetNotebook:a}){let{t:o,language:s}=(0,N.b)(),{data:l}=(0,rg.useSession)(),u=(0,r.useSyncExternalStore)(rb,()=>new Date().getHours(),()=>null),c=null===u?o.common.welcome.replace(/[,,\s]+$/,""):u<12?o.home.greetingMorning:u<18?o.home.greetingAfternoon:o.home.greetingEvening,h=l?.user?.name||l?.user?.email||"";return(0,t.jsxs)("section",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-indigo-600 via-indigo-500 to-violet-500 p-5 text-white shadow-lg shadow-indigo-500/20 md:p-7",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-12 h-44 w-44 rounded-full bg-white/10 blur-2xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-16 right-24 h-40 w-40 rounded-full bg-fuchsia-300/20 blur-2xl"}),(0,t.jsxs)("div",{className:"relative flex flex-col gap-5 md:flex-row md:items-end md:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("h1",{className:"text-xl font-bold tracking-tight md:text-2xl",children:[c,h&&`${"zh"===s?",":", "}${h}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:o.home.heroSubtitle}),a&&(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 px-3 py-1 text-xs font-medium",children:[(0,t.jsx)(rw.f,{className:"h-3.5 w-3.5"}),o.home.targetNotebook.replace("{name}",a)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(rN,{href:"/notebooks",icon:rp.f,label:o.home.notebookCount,value:e}),(0,t.jsx)(rN,{href:"/notebooks",icon:ry.f,label:o.home.itemCount,value:n}),(0,t.jsx)(rN,{href:"/review",icon:rx.f,label:o.home.dueCount,value:i})]})]})]})}var rS=e.i(12130),rT=e.i(430634),rE=e.i(576019),rA=e.i(847483),rk=e.i(497346),rM=e.i(717448),rI=e.i(798469),rj=e.i(86963),rO=e.i(956738),r_=e.i(185592),r$=e.i(41931),rP=e.i(35209),rC=e.i(598053),rL=e.i(315092),rD=e.i(804536),rR=e.i(271945);function rF(){let{t:e}=(0,N.b)();(0,rP.f)(e.pageTitle.home);let a=(0,n.useSearchParams)().get("notebook"),[o,f]=(0,r.useState)([]),[m,d]=(0,r.useState)(null),[g,p]=(0,rD.y)(rR.c,rR.S,"image"),x=a?o.find(e=>e.id===a):void 0,y=(0,rC.f)({logPrefix:"[Home]",analyzeSubjectId:a,importSubjectId:a,textNotebook:x&&{id:x.id,name:x.name}});(0,r.useEffect)(()=>{r$.k.get("/api/notebooks").then(e=>f(e)).catch(e=>D.V.error("[Home]","Failed to fetch notebooks",{error:e})),r$.k.get("/api/review/due?pageSize=1").then(e=>d(e.total)).catch(e=>D.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let w=async e=>{y.setAnalysisStep("saving"),await y.saveQuestion({...e,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",originalImageUrl:""}),y.setAnalysisStep("idle")},b=o.reduce((e,t)=>e+(t._count?.errorItems||0),0),v=[{value:"image",icon:i.f,label:e.app?.uploadImage||"Take Photo"},{value:"text",icon:u.f,label:e.app?.manualInput||"Manual Input"},{value:"file",icon:s,label:e.app?.fileImport||"Import File"},{value:"direct",icon:l.f,label:e.app?.directInput||"Manual Entry"}];return(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(rO.f,{status:y.analysisStep,completed:y.completedStages}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===y.step?"max-w-6xl":"max-w-4xl"}`,children:[(0,t.jsx)(rk.f,{message:y.saveError,onDismiss:y.dismissSaveError}),"upload"===y.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(rv,{notebookCount:o.length,itemCount:b,dueCount:m,targetNotebook:a?x?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(r_.f,{options:v,value:g,onChange:p}),y.pendingTask&&(0,t.jsx)(rE.f,{task:y.pendingTask,onRefresh:y.refreshPendingTask,onDismiss:y.dismissPendingTask}),y.lastImported&&(0,t.jsx)(rT.f,{imported:y.lastImported,onDismiss:y.dismissImported}),y.batchImages?(0,t.jsx)(c.f,{images:y.batchImages,subjectId:a,onClose:y.closeBatch}):"image"===g?(0,t.jsxs)(t.Fragment,{children:[y.parts.length>0&&(0,t.jsx)(rA.f,{parts:y.parts.map(e=>e.dataUrl),busy:y.isBusy,onFinish:()=>void y.finishParts(),onDiscard:y.discardParts}),(0,t.jsx)(rI.f,{onImageSelect:y.selectImage,isAnalyzing:y.isBusy})]}):"text"===g?(0,t.jsx)(rM.f,{onSubmit:y.submitText,isAnalyzing:y.isBusy,defaultNotebookName:x?.name,onCreateBatch:y.createTextBatch,creatingBatch:y.creatingBatch,onSwitchToFileImport:()=>p("file")}):"file"===g?(0,t.jsx)(rf,{defaultNotebookId:a||void 0}):(0,t.jsx)(I,{onSubmit:w,defaultNotebookId:a||void 0,defaultNotebookName:x?.name,isSaving:"saving"===y.analysisStep})]})]}),y.croppingImage&&(0,t.jsx)(rS.f,{imageSrc:y.croppingImage,open:y.isCropperOpen,onClose:y.closeCropper,onRegionsSelected:y.cropRegions,allowMulti:0===y.parts.length,onAutoSplit:0===y.parts.length?y.autoSplitImage:void 0,onAddPart:y.parts.length<rL.u-1?y.addPart:void 0,partCount:y.parts.length}),"review"===y.step&&y.parsedData&&(0,t.jsx)(h.f,{initialData:y.parsedData,onSave:y.saveReviewed,onCancel:y.cancelReview,imagePreview:y.currentImage,initialSubjectId:a||void 0,aiTimeout:y.aiTimeout})]})]})}e.s(["default",0,function(){return(0,t.jsx)(r.Suspense,{fallback:(0,t.jsx)(rj.f,{}),children:(0,t.jsx)(rF,{})})}],952683)}]);
|
package/package.json
CHANGED
package/prisma/seed.db
CHANGED
|
Binary file
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[[879675,a=>{var b=a.i(164831);let c={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],879675)},986708,a=>{var b=a.i(164831);let c={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],986708)},506376,a=>{var b=a.i(187924),c=a.i(875160);a.s(["f",0,function({label:a}){return(0,b.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,b.jsx)(c.f,{className:"h-7 w-7 animate-spin text-primary"}),a&&(0,b.jsx)("p",{className:"text-sm",children:a})]})}])},557999,a=>{var b=a.i(572131),c=a.i(550194);a.s(["f",0,function(...a){let{t:d}=(0,c.b)(),e=[d.pageTitle.base,...a.map(a=>"string"==typeof a?a.trim():"").filter(a=>a.length>0)].join("-");(0,b.useEffect)(()=>{document.title=e},[e])}])},391020,a=>{let b={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};a.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(a){if("string"!=typeof a)return null;let c=a.trim().toLowerCase();return c?b[c]??null:null}])}],750227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},59639,(a,b,c)=>{b.exports=a.x("node:process",()=>require("node:process"))},857764,(a,b,c)=>{b.exports=a.x("node:url",()=>require("node:url"))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0uezowk-9l0x4._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[[879675,a=>{var b=a.i(164831);let c={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],879675)},986708,a=>{var b=a.i(164831);let c={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],986708)},487410,a=>{var b=a.i(187924),c=a.i(368114);a.s(["f",0,function({options:a,value:d,onChange:e,className:f}){return(0,b.jsx)("div",{className:(0,c.f)("grid gap-1 rounded-xl bg-muted p-1",f),style:{gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`},role:"tablist",children:a.map(({value:a,label:f,icon:g})=>{let h=a===d;return(0,b.jsxs)("button",{type:"button",role:"tab","aria-selected":h,className:(0,c.f)("flex items-center justify-center gap-1.5 rounded-lg px-2 py-2.5 text-sm font-medium transition-all",h?"bg-card text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>e(a),children:[g&&(0,b.jsx)(g,{className:"h-4 w-4 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:f})]},a)})})}])},391020,a=>{let b={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};a.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(a){if("string"!=typeof a)return null;let c=a.trim().toLowerCase();return c?b[c]??null:null}])}],750227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},59639,(a,b,c)=>{b.exports=a.x("node:process",()=>require("node:process"))},857764,(a,b,c)=>{b.exports=a.x("node:url",()=>require("node:url"))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__12jk2bmesr4gc._.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
module.exports=[[97546,a=>{var b=a.i(164831);let c={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],97546)},308658,a=>{var b=a.i(164831);let c={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],308658)},62140,a=>{var b=a.i(164831);let c={name:"list-checks",size:24,node:[["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"}]]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],62140)},961664,a=>{var b=a.i(164831);let c={name:"target",size:24,node:[["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"}]]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],961664)},487410,a=>{var b=a.i(187924),c=a.i(368114);a.s(["f",0,function({options:a,value:d,onChange:e,className:f}){return(0,b.jsx)("div",{className:(0,c.f)("grid gap-1 rounded-xl bg-muted p-1",f),style:{gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`},role:"tablist",children:a.map(({value:a,label:f,icon:g})=>{let h=a===d;return(0,b.jsxs)("button",{type:"button",role:"tab","aria-selected":h,className:(0,c.f)("flex items-center justify-center gap-1.5 rounded-lg px-2 py-2.5 text-sm font-medium transition-all",h?"bg-card text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>e(a),children:[g&&(0,b.jsx)(g,{className:"h-4 w-4 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:f})]},a)})})}])},95508,a=>{let b=["题干","选项A","选项B","选项C","选项D","答案","解析","知识点","难度","题型","学科","年级学期","来源","大题","题号"],c=[["下列哪个选项是正确的?","选项一","选项二","选项三","选项四","A","这是解析内容。","知识点一、知识点二","3","单选题","数学","七年级上学期","2025 期中","第一大题","1"],["1+1=____。","","","","","2","基础加法运算。","基础运算","易","填空题","数学","一年级上学期","课堂练习","第一大题","2"]];async function d(){let{default:d}=await a.A(177190),e=[b,...c];return await d(e).toBlob()}a.s(["I",0,b,"j",0,function(){let a=a=>/[",\n\r]/.test(a)?`"${a.replace(/"/g,'""')}"`:a,d=[];for(let e of(d.push(b.map(a).join(",")),c))d.push(e.map(a).join(","));return`\uFEFF${d.join("\r\n")}\r
|
|
2
|
-
`},"n",0,d])}],979463,a=>{a.v("/_next/static/media/pdf.worker.min.0zcq5mj7t-qsr.mjs"+(globalThis.NEXT_CLIENT_ASSET_SUFFIX||""))}];
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=_127aw5h992s9d._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";module.exports=[986708,a=>{var b=a.i(164831);let c={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],986708)},579834,a=>{var b=a.i(187924),c=a.i(368114);a.s(["f",0,function({icon:a,title:d,description:e,action:f,className:g}){return(0,b.jsxs)("div",{className:(0,c.f)("flex flex-col items-center justify-center rounded-2xl border border-dashed bg-card/50 px-6 py-14 text-center",g),children:[(0,b.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-accent text-accent-foreground",children:(0,b.jsx)(a,{className:"h-7 w-7"})}),(0,b.jsx)("p",{className:"font-medium",children:d}),e&&(0,b.jsx)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:e}),f&&(0,b.jsx)("div",{className:"mt-5",children:f})]})}])},506376,a=>{var b=a.i(187924),c=a.i(875160);a.s(["f",0,function({label:a}){return(0,b.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,b.jsx)(c.f,{className:"h-7 w-7 animate-spin text-primary"}),a&&(0,b.jsx)("p",{className:"text-sm",children:a})]})}])},391020,a=>{let b={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};a.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(a){if("string"!=typeof a)return null;let c=a.trim().toLowerCase();return c?b[c]??null:null}])}]})();
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=_1t-o815u40ng2._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[627280,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_heic-to_dist_csp_heic-to_1a1i_ppryp81y.js"].map(b=>a.l(b))).then(()=>b(469425)))},61751,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_pdfjs-dist_build_pdf_mjs_0z37jkkqfce7_._.js"].map(b=>a.l(b))).then(()=>b(268062)))},279013,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_read-excel-file_universal_index_0ayslfrutmja5.js"].map(b=>a.l(b))).then(()=>b(459805)))},177190,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_write-excel-file_browser_index_0l2-di6rcng1b.js"].map(b=>a.l(b))).then(()=>b(884549)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=node_modules_1m0t7n1f8dlgz._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";module.exports=[726319,a=>{var b=a.i(187924),c=a.i(786304),d=a.i(550194);let e={generating:"bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-900",ready:"bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-300 border-indigo-200 dark:border-indigo-900",partial:"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-900",failed:"bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 border-red-200 dark:border-red-900",completed:"bg-green-100 dark:bg-green-900/40 text-green-700 dark:text-green-300 border-green-200 dark:border-green-900"};a.s(["f",0,function({status:a,recorded:f}){let{t:g}=(0,d.b)(),h=f&&("ready"===a||"partial"===a)?"completed":a;return(0,b.jsx)(c.f,{variant:"outline",className:e[h],children:g.exam.status[h]})}])},391020,a=>{let b={single_choice:"single_choice",singlechoice:"single_choice","single choice":"single_choice","single-choice":"single_choice",multiple_choice:"multiple_choice",multiplechoice:"multiple_choice","multiple choice":"multiple_choice","multiple-choice":"multiple_choice",multichoice:"multiple_choice","multi choice":"multiple_choice",true_false:"true_false",truefalse:"true_false","true/false":"true_false","true false":"true_false","true-false":"true_false","true / false":"true_false",fill_blank:"fill_blank",fillblank:"fill_blank","fill in the blank":"fill_blank","fill-in-the-blank":"fill_blank",fillintheblank:"fill_blank",calculation:"calculation",solution:"solution",reading:"reading",cloze:"cloze",writing:"writing",other:"other",选择题:"single_choice",单项选择:"single_choice",单选:"single_choice",单选题:"single_choice",不定项:"multiple_choice",不定项选择:"multiple_choice",多项选择:"multiple_choice",多选:"multiple_choice",多选题:"multiple_choice",判断:"true_false",判断题:"true_false",是非:"true_false",是非题:"true_false",填空:"fill_blank",填空题:"fill_blank",口算:"calculation",计算:"calculation",计算题:"calculation",解答:"solution",解答题:"solution",应用:"solution",应用题:"solution",证明:"solution",证明题:"solution",简答:"solution",简答题:"solution",阅读:"reading",阅读理解:"reading",完形:"cloze",完形填空:"cloze",作文:"writing",写作:"writing",书面表达:"writing",其他:"other"};a.s(["O",0,"__none__","V",0,["single_choice","multiple_choice","true_false","fill_blank","calculation","solution","reading","cloze","writing","other"],"u",0,{single_choice:"Single Choice",multiple_choice:"Multiple Choice",true_false:"True / False",fill_blank:"Fill in the Blank",calculation:"Calculation",solution:"Solution",reading:"Reading Comprehension",cloze:"Cloze",writing:"Writing",other:"Other"},"H",0,{single_choice:"单选题",multiple_choice:"多选题",true_false:"判断题",fill_blank:"填空题",calculation:"计算题",solution:"解答题",reading:"阅读理解",cloze:"完形填空",writing:"写作",other:"其他"},"P",0,function(a){if("string"!=typeof a)return null;let c=a.trim().toLowerCase();return c?b[c]??null:null}])}]})();
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=src_1nbi4yrww3r1m._.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,314381,3198,e=>{var t=e.i(456420);let r={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],314381);var i=e.i(843476),a=e.i(271645),o=e.i(632781);let s={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};s.node;let l=(0,t.f)(s),h={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};h.node;let c=(0,t.f)(h);var d=e.i(395925),u=e.i(741120),m=e.i(759659),g=e.i(519455),p=e.i(111110),f=e.i(294114),w=e.i(201276),x=e.i(113381);let y=null;function b(e,t,r){let n=e?.firstElementChild;n&&(n.style.width="100%",n.style.height=`${r}px`,t?.setSize(e?.offsetWidth||n.offsetWidth||800,r))}function v(e,t){let r=(0,x.L)(e,t);for(let e of r)w.V.warn("[GGB]","命令执行失败",{...e});return r.map(e=>e.command+":"+e.message).join("\n")||void 0}e.s(["f",0,function({commands:e,height:t=700,showToolBar:r=!1,showAlgebraInput:n=!1,showMenuBar:s=!1,className:h="",onRegenerate:C,onDelete:j}){let{t:k}=(0,p.b)(),D=(0,a.useRef)(null),E=(0,a.useRef)(null),M=(0,a.useRef)(void 0),N=(0,a.useId)(),R=(0,a.useRef)(`ggb-${N.replace(/[^a-zA-Z0-9_-]/g,"")}`),[S,L]=(0,a.useState)(!0),[I,_]=(0,a.useState)(null),[P,$]=(0,a.useState)(!0),[H,A]=(0,a.useState)(!1),[z,B]=(0,a.useState)(!1),Y=(0,a.useMemo)(()=>(0,x.i)(e),[e]);(0,a.useEffect)(()=>{if(0===Y.length)return;let e=!1,i=R.current,a=D.current;return(y||(y=new Promise((e,t)=>{if(window.GGBApplet)return void e();let r=document.createElement("script");r.src="https://www.geogebra.org/apps/deployggb.js",r.async=!0,r.onload=()=>e(),r.onerror=()=>{y=null,t(Error("Failed to load GeoGebra"))},document.head.appendChild(r)}))).then(()=>{if(e)return;let o=window.GGBApplet;if(!o){_(k.geogebra.notLoaded),L(!1);return}if(a){a.innerHTML=`<div id="${i}" style="width:100%;height:${t}px"></div>`;try{new o({appName:"classic",width:"100%",height:t,showToolBar:r,showAlgebraInput:n,showMenuBar:s,showResetIcon:!0,enableRightClick:!0,enableShiftDragZoom:!0,language:"zh",appletOnLoad:r=>{e||(E.current=r,b(a,r,t),M.current=v(r,Y),L(!1))}},!0).inject(i)}catch(t){w.V.error("[GGB]","Init failed",{error:t}),e||(_(k.geogebra.initFailed),L(!1))}}}).catch(t=>{w.V.error("[GGB]","Script load failed",{error:t}),e||(_(k.geogebra.scriptFailed),L(!1))}),()=>{e=!0;try{let e=E.current;e?.remove&&e.remove()}catch(e){w.V.warn("[GGB]","Cleanup failed",{error:e})}E.current=null,a&&(a.innerHTML="")}},[Y,r,n,s]),(0,a.useEffect)(()=>{b(D.current,E.current,P?700:t)},[P,t]);let X=(0,a.useCallback)(()=>{let e=E.current;if(e)try{e.resetConstruction(),setTimeout(()=>{E.current&&(M.current=v(E.current,Y))},300)}catch(e){w.V.warn("[GGB]","Reset failed",{error:e})}},[Y]),O=(0,a.useCallback)(async()=>{if(C&&!H){A(!0);try{await C(M.current)}finally{A(!1)}}},[C,H]),U=(0,a.useCallback)(async()=>{if(j&&!z&&await (0,f.u)(k.geogebra.confirmDelete,{destructive:!0})){B(!0);try{await j()}catch{f.c.error(k.geogebra.deleteFailed)}finally{B(!1)}}},[j,z,k]);return 0===Y.length?null:(0,i.jsxs)("div",{className:`relative rounded-lg border bg-card ${h}`,children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:k.geogebra.title}),S&&(0,i.jsx)(o.f,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[C&&(0,i.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:O,title:k.geogebra.regenerate,disabled:H||S,children:[H?(0,i.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(u.f,{className:"h-3.5 w-3.5"}),(0,i.jsx)("span",{children:k.geogebra.regenerate})]}),j&&(0,i.jsxs)(g.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1 text-destructive hover:text-destructive",onClick:U,title:k.geogebra.delete,disabled:z||H,children:[z?(0,i.jsx)(o.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(m.f,{className:"h-3.5 w-3.5"}),(0,i.jsx)("span",{children:k.geogebra.delete})]}),(0,i.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:X,title:k.geogebra.reset,disabled:S,children:(0,i.jsx)(d.f,{className:"h-3.5 w-3.5"})}),(0,i.jsx)(g.f,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>$(e=>!e),title:P?k.geogebra.shrink:k.geogebra.enlarge,children:P?(0,i.jsx)(c,{className:"h-3.5 w-3.5"}):(0,i.jsx)(l,{className:"h-3.5 w-3.5"})})]})]}),(0,i.jsx)("div",{ref:D,style:{width:"100%"}}),S&&(0,i.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/80 rounded-b-lg",style:{top:37},children:(0,i.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,i.jsx)(o.f,{className:"h-6 w-6 animate-spin text-primary"}),(0,i.jsx)("span",{className:"text-sm text-muted-foreground",children:k.geogebra.loading})]})}),I&&(0,i.jsx)("div",{className:"flex items-center justify-center text-sm text-destructive",style:{minHeight:t},children:I})]})}],3198)},856522,e=>{var t=e.i(456420);let r={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],856522)},786563,e=>{var t=e.i(456420);let r={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};r.node;let n=(0,t.f)(r);e.s(["f",0,n],786563)},232660,e=>{var t=e.i(271645),r={x:0,y:0,width:0,height:0,unit:"px"},n=(e,t,r)=>Math.min(Math.max(e,t),r),i=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function a(e,t,n){return"%"===e.unit?{...r,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function o(e,t,n){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...r,...e,unit:"px"}}function s(e,t,r,n,i,a=0,o=0,l=n,h=i){let c={...e},d=Math.min(a,n),u=Math.min(o,i),m=Math.min(l,n),g=Math.min(h,i);t&&(t>1?(u=(d=o?o*t:d)/t,m=l*t):(d=(u=a?a/t:u)*t,g=h/t)),c.y<0&&(c.height=Math.max(c.height+c.y,u),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,d),c.x=0);let p=n-(c.x+c.width);p<0&&(c.x=Math.min(c.x,n-d),c.width+=p);let f=i-(c.y+c.height);if(f<0&&(c.y=Math.min(c.y,i-u),c.height+=f),c.width<d&&(("sw"===r||"nw"==r)&&(c.x-=d-c.width),c.width=d),c.height<u&&(("nw"===r||"ne"==r)&&(c.y-=u-c.height),c.height=u),c.width>m&&(("sw"===r||"nw"==r)&&(c.x-=m-c.width),c.width=m),c.height>g&&(("nw"===r||"ne"==r)&&(c.y-=g-c.height),c.height=g),t){let e=c.width/c.height;if(e<t){let e=Math.max(c.width/t,u);("nw"===r||"ne"==r)&&(c.y-=e-c.height),c.height=e}else if(e>t){let e=Math.max(c.height*t,d);("sw"===r||"nw"==r)&&(c.x-=e-c.width),c.width=e}}return c}var l={capture:!0,passive:!1},h=0,c=class e extends t.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=(0,t.createRef)();mediaRef=(0,t.createRef)();resizeObserver;initChangeCalled=!1;instanceId=`rc-${h++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:r,width:n,height:i}=e.getBoundingClientRect();return{x:t,y:r,width:n,height:i}}componentDidUpdate(e){let{crop:t,onComplete:r}=this.props;if(r&&!e.crop&&t){let{width:e,height:n}=this.getBox();e&&n&&r(o(t,e,n),a(t,e,n))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,l),this.document.addEventListener("pointerup",this.onDocPointerDone,l),this.document.addEventListener("pointercancel",this.onDocPointerDone,l),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,l),this.document.removeEventListener("pointerup",this.onDocPointerDone,l),this.document.removeEventListener("pointercancel",this.onDocPointerDone,l),!1)}onCropPointerDown=e=>{let{crop:t,disabled:r}=this.props,n=this.getBox();if(!t)return;let i=o(t,n.width,n.height);if(r)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let a=e.target.dataset.ord,s=e.clientX,l=e.clientY,h=i.x,c=i.y;if(a){let t=e.clientX-n.x,r=e.clientY-n.y,o=0,d=0;"ne"===a||"e"==a?(o=t-(i.x+i.width),d=r-i.y,h=i.x,c=i.y+i.height):"se"===a||"s"===a?(o=t-(i.x+i.width),d=r-(i.y+i.height),h=i.x,c=i.y):"sw"===a||"w"==a?(o=t-i.x,d=r-(i.y+i.height),h=i.x+i.width,c=i.y):("nw"===a||"n"==a)&&(o=t-i.x,d=r-i.y,h=i.x+i.width,c=i.y+i.height),s=h+n.x+o,l=c+n.y+d}this.evData={startClientX:s,startClientY:l,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!!a,ord:a},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:r,locked:n,keepSelection:i,onChange:s}=this.props,l=this.getBox();if(r||n||i&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-l.x,c=e.clientY-l.y,d={unit:"px",x:h,y:c,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,s(o(d,l.width,l.height),a(d,l.width,l.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:r,disabled:n,onChange:s,onDragStart:l}=this.props,h=this.getBox();if(n||!r||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,l&&l(e));let{evData:c}=this;c.clientX=e.clientX,c.clientY=e.clientY,i(r,t=c.isResize?this.resizeCrop():this.dragCrop())||s(o(t,h.width,h.height),a(t,h.width,h.height))};onComponentKeyDown=t=>{let{crop:r,disabled:i,onChange:s,onComplete:l}=this.props;if(i)return;let h=t.key,c=!1;if(!r)return;let d=this.getBox(),u=this.makePixelCrop(d),m=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===h?(u.x-=m,c=!0):"ArrowRight"===h?(u.x+=m,c=!0):"ArrowUp"===h?(u.y-=m,c=!0):"ArrowDown"===h&&(u.y+=m,c=!0),c){t.cancelable&&t.preventDefault(),u.x=n(u.x,0,d.width-u.width),u.y=n(u.y,0,d.height-u.height);let e=o(u,d.width,d.height),r=a(u,d.width,d.height);s(e,r),l&&l(e,r)}};onHandlerKeyDown=(t,r)=>{var n,l;let h,{aspect:c=0,crop:d,disabled:u,minWidth:m=0,minHeight:g=0,maxWidth:p,maxHeight:f,onChange:w,onComplete:x}=this.props,y=this.getBox();if(u||!d||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let b=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,v=s((n=o(d,y.width,y.height),l=t.key,h={...n},"ArrowLeft"===l?"nw"===r?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"w"===r?(h.x-=b,h.width+=b):"sw"===r?(h.x-=b,h.width+=b,h.height+=b):"ne"===r?(h.y+=b,h.width-=b,h.height-=b):"e"===r?h.width-=b:"se"===r&&(h.width-=b,h.height-=b):"ArrowRight"===l&&("nw"===r?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"w"===r?(h.x+=b,h.width-=b):"sw"===r?(h.x+=b,h.width-=b,h.height-=b):"ne"===r?(h.y-=b,h.width+=b,h.height+=b):"e"===r?h.width+=b:"se"===r&&(h.width+=b,h.height+=b)),"ArrowUp"===l?"nw"===r?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"n"===r?(h.y-=b,h.height+=b):"ne"===r?(h.y-=b,h.width+=b,h.height+=b):"sw"===r?(h.x+=b,h.width-=b,h.height-=b):"s"===r?h.height-=b:"se"===r&&(h.width-=b,h.height-=b):"ArrowDown"===l&&("nw"===r?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"n"===r?(h.y+=b,h.height-=b):"ne"===r?(h.y+=b,h.width-=b,h.height-=b):"sw"===r?(h.x-=b,h.width+=b,h.height+=b):"s"===r?h.height+=b:"se"===r&&(h.width+=b,h.height+=b)),h),c,r,y.width,y.height,m,g,p,f);if(!i(d,v)){let e=a(v,y.width,y.height);w(v,e),x&&x(v,e)}};onDocPointerDone=e=>{let{crop:t,disabled:r,onComplete:n,onDragEnd:i}=this.props,s=this.getBox();this.unbindDocMove(),!(r||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,i&&i(e),n&&n(o(t,s.width,s.height),a(t,s.width,s.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),r=this.makePixelCrop(t),i=e.clientX-e.startClientX,a=e.clientY-e.startClientY;return r.x=n(e.startCropX+i,0,t.width-r.width),r.y=n(e.startCropY+a,0,t.height-r.height),r}getPointRegion(e,t,r,n){let{evData:i}=this,a=i.clientX-e.x,o=i.clientY-e.y,s;return s=n&&t?"nw"===t||"n"===t||"ne"===t:o<i.startCropY,(r&&t?"nw"===t||"w"===t||"sw"===t:a<i.startCropX)?s?"nw":"sw":s?"ne":"se"}resolveMinDimensions(e,t,r=0,n=0){let i=Math.min(r,e.width),a=Math.min(n,e.height);return t&&(i||a)?t>1?i?[i,i/t]:[a*t,a]:a?[a*t,a]:[i,i/t]:[i,a]}resizeCrop(){let{evData:t}=this,{aspect:r=0,maxWidth:i,maxHeight:a}=this.props,o=this.getBox(),[l,h]=this.resolveMinDimensions(o,r,this.props.minWidth,this.props.minHeight),c=this.makePixelCrop(o),d=this.getPointRegion(o,t.ord,l,h),u=t.ord||d,m=t.clientX-t.startClientX,g=t.clientY-t.startClientY;(l&&"nw"===u||"w"===u||"sw"===u)&&(m=Math.min(m,-l)),(h&&"nw"===u||"n"===u||"ne"===u)&&(g=Math.min(g,-h));let p={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(p.x=t.startCropX,p.width=m,r?p.height=p.width/r:p.height=Math.abs(g),p.y=t.startCropY-p.height):"se"===d?(p.x=t.startCropX,p.y=t.startCropY,p.width=m,r?p.height=p.width/r:p.height=g):"sw"===d?(p.x=t.startCropX+m,p.y=t.startCropY,p.width=Math.abs(m),r?p.height=p.width/r:p.height=g):"nw"===d&&(p.x=t.startCropX+m,p.width=Math.abs(m),r?(p.height=p.width/r,p.y=t.startCropY-p.height):(p.height=Math.abs(g),p.y=t.startCropY+g));let f=s(p,r,d,o.width,o.height,l,h,i,a);return r||e.xyOrds.indexOf(u)>-1?c=f:e.xOrds.indexOf(u)>-1?(c.x=f.x,c.width=f.width):e.yOrds.indexOf(u)>-1&&(c.y=f.y,c.height=f.height),c.x=n(c.x,0,o.width-c.width),c.y=n(c.y,0,o.height-c.height),c}renderCropSelection(){let{ariaLabels:r=e.defaultProps.ariaLabels,disabled:n,locked:i,renderSelectionAddon:a,ruleOfThirds:o,crop:s}=this.props,l=this.getCropStyle();if(s)return t.default.createElement("div",{style:l,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":r.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!i&&t.default.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":r.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":r.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":r.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":r.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":r.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":r.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":r.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":r.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&t.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},a(this.state)),o&&t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t.default.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return o({...r,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:r,circularCrop:n,className:i,crop:a,disabled:o,locked:s,style:l,ruleOfThirds:h}=this.props,{cropIsActive:c,newCropIsBeingDrawn:d}=this.state,u=a?this.renderCropSelection():null,m=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",i,c&&"ReactCrop--active",o&&"ReactCrop--disabled",s&&"ReactCrop--locked",d&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&n&&"ReactCrop--circular-crop",a&&h&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return t.default.createElement("div",{ref:this.componentRef,className:m,style:l},t.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},r),a?t.default.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},t.default.createElement("defs",null,t.default.createElement("mask",{id:`hole-${this.instanceId}`},t.default.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?t.default.createElement("ellipse",{cx:`${a.x+a.width/2}${a.unit}`,cy:`${a.y+a.height/2}${a.unit}`,rx:`${a.width/2}${a.unit}`,ry:`${a.height/2}${a.unit}`,fill:"black"}):t.default.createElement("rect",{x:`${a.x}${a.unit}`,y:`${a.y}${a.unit}`,width:`${a.width}${a.unit}`,height:`${a.height}${a.unit}`,fill:"black"}))),t.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,u)}};e.s(["f",0,c])},469937,e=>{var t=e.i(843476),r=e.i(786563),n=e.i(111110),i=e.i(975157);let a=[1,2,3,4,5];e.s(["f",0,function({value:e,onChange:o,disabled:s,size:l="sm",showUnrated:h=!0,className:c}){let{t:d}=(0,n.b)(),u=e??0,m="sm"===l?"h-3.5 w-3.5":"h-5 w-5",g=u?d.difficulty.starsLabel.replace("{n}",String(u)):d.difficulty.unrated;return o?(0,t.jsxs)("span",{className:(0,i.f)("inline-flex items-center gap-0.5",c),role:"group","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:d.difficulty.clearHint,children:[a.map(e=>(0,t.jsx)("button",{type:"button",disabled:s,onClick:()=>o(e===u?null:e),"aria-label":d.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=u,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(r.f,{className:(0,i.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!u&&h&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:d.difficulty.unrated})]}):u?(0,t.jsx)("span",{className:(0,i.f)("inline-flex items-center",c),role:"img","aria-label":`${d.difficulty.label}${d.common.colon}${g}`,title:g,children:a.map(e=>(0,t.jsx)(r.f,{className:(0,i.f)(m,e<=u?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):h?(0,t.jsx)("span",{className:(0,i.f)("text-xs text-muted-foreground",c),children:d.difficulty.unrated}):null}])},12130,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(232660),i=e.i(519455),a=e.i(776639),o=e.i(263676),s=e.i(111110);async function l(e,t){let{naturalWidth:r,naturalHeight:n}=e;return Promise.all(t.map(t=>new Promise((i,a)=>{let o=document.createElement("canvas"),s=Math.round(t.x*r),l=Math.round(t.y*n);o.width=Math.max(1,Math.round(t.width*r)),o.height=Math.max(1,Math.round(t.height*n));let h=o.getContext("2d");h?(h.drawImage(e,s,l,o.width,o.height,0,0,o.width,o.height),o.toBlob(e=>e?i(e):a(Error("Canvas is empty")),"image/jpeg",.95)):a(Error("Canvas is not supported"))})))}let h={maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},c=(0,r.forwardRef)(function({imageSrc:e,regions:n,onChange:i,imageStyle:a=h,onImageLoad:l},c){let{t:d}=(0,s.b)(),u=(0,r.useRef)(null),m=(0,r.useRef)(null),[g,p]=(0,r.useState)(null),f=e=>{let t=u.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height}},w=()=>{g&&g.width>=.02&&g.height>=.02&&i([...n,g]),m.current=null,p(null)},x=e=>({left:`${100*e.x}%`,top:`${100*e.y}%`,width:`${100*e.width}%`,height:`${100*e.height}%`});return(0,t.jsxs)("div",{className:"relative inline-block select-none",children:[(0,t.jsx)("img",{ref:c,src:e,alt:"",draggable:!1,style:a,onLoad:l,className:"block"}),(0,t.jsxs)("div",{ref:u,className:"absolute inset-0 cursor-crosshair",style:{touchAction:"none"},onPointerDown:e=>{0===e.button&&(u.current?.setPointerCapture(e.pointerId),m.current=f(e),p(null))},onPointerMove:e=>{var t,r,n,i;let a,o,s;if(!m.current)return;let l=f(e);p((t=m.current.x,r=m.current.y,n=l.x,i=l.y,o=(a=e=>Math.min(1,Math.max(0,e)))(Math.min(t,n)),s=a(Math.min(r,i)),{x:o,y:s,width:a(Math.max(t,n))-o,height:a(Math.max(r,i))-s}))},onPointerUp:w,onPointerCancel:w,children:[n.map((e,r)=>(0,t.jsxs)("div",{className:"absolute border-2 border-sky-400 bg-sky-400/15",style:x(e),children:[(0,t.jsx)("span",{className:"absolute left-0 top-0 bg-sky-500 px-1.5 text-xs font-bold text-white",children:r+1}),(0,t.jsx)("button",{type:"button",className:"absolute -right-3 -top-3 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white shadow","aria-label":d.batchImport.removeRegion.replace("{index}",String(r+1)),onPointerDown:e=>e.stopPropagation(),onClick:()=>i(n.filter((e,t)=>t!==r)),children:(0,t.jsx)(o.X,{className:"h-3 w-3"})})]},r)),g&&(0,t.jsx)("div",{className:"absolute border-2 border-dashed border-yellow-300 bg-yellow-300/10",style:x(g)})]})]})});var d=e.i(456420);let u={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};u.node;let m=(0,d.f)(u),g={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};g.node;let p=(0,d.f)(g);function f({zoom:e,onZoomIn:r,onZoomOut:n,onReset:i}){let{t:a}=(0,s.b)(),o="outline-none focus-visible:ring-2 focus-visible:ring-white/70",l=`flex h-9 w-9 items-center justify-center rounded-full text-white transition-colors hover:bg-white/20 disabled:opacity-40 disabled:hover:bg-transparent ${o}`;return(0,t.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full bg-black/60 p-1 shadow-lg backdrop-blur-sm",children:[(0,t.jsx)("button",{type:"button",className:l,onClick:n,disabled:e<=1,"aria-label":a.common.cropper.zoomOut,title:a.common.cropper.zoomOut,children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsxs)("button",{type:"button",className:`h-9 min-w-14 rounded-full px-2 text-center text-xs font-medium tabular-nums text-white hover:bg-white/20 ${o}`,onClick:i,"aria-label":a.common.cropper.resetZoom,title:a.common.cropper.resetZoom,children:[Math.round(100*e),"%"]}),(0,t.jsx)("button",{type:"button",className:l,onClick:r,disabled:e>=5,"aria-label":a.common.cropper.zoomIn,title:a.common.cropper.zoomIn,children:(0,t.jsx)(m,{className:"h-4 w-4"})})]})}var w=e.i(201276);let x={single:{maxHeight:"70vh",maxWidth:"100%",objectFit:"contain"},auto:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"},multi:{maxHeight:"65vh",maxWidth:"100%",objectFit:"contain"}};e.s(["f",0,function({imageSrc:e,open:o,onClose:h,onCropComplete:d,onMultiCropComplete:u,onRegionsSelected:m,allowMulti:g=!0,onAutoSplit:p,onAddPart:y,partCount:b=0}){let{t:v}=(0,s.b)(),C=/^(blob:|data:image\/)/i.test(e)?e:void 0,[j,k]=(0,r.useState)(),D=(0,r.useRef)(null),[E,M]=(0,r.useState)("single"),{containerRef:N,zoom:R,imageStyle:S,measureImage:L,zoomIn:I,zoomOut:_,reset:P}=function(e){let[t,n]=(0,r.useState)(null),i=(0,r.useRef)(null),a=(0,r.useCallback)(e=>{i.current=e,n(e)},[]),[o,s]=(0,r.useState)(1),l=(0,r.useRef)(1),[h,c]=(0,r.useState)(null),d=(0,r.useRef)(null),u=(0,r.useRef)(!1),m=(0,r.useCallback)((e,t,r)=>{let n=i.current,a=l.current,o=Math.min(5,Math.max(1,e));if(!n||o===a)return;if(1===a){let e=n.querySelector("img");e&&c(e.clientWidth)}let h=n.getBoundingClientRect(),u=(t??h.left+h.width/2)-h.left,m=(r??h.top+h.height/2)-h.top;d.current={viewX:u,viewY:m,contentX:n.scrollLeft+u,contentY:n.scrollTop+m,ratio:o/a},l.current=o,s(o)},[]);(0,r.useLayoutEffect)(()=>{let e=i.current,t=d.current;e&&t&&(e.scrollLeft=t.contentX*t.ratio-t.viewX,e.scrollTop=t.contentY*t.ratio-t.viewY,d.current=null)},[o]),(0,r.useEffect)(()=>{if(!t)return;let e=e=>{e.preventDefault(),m(l.current*Math.exp(-(.0015*e.deltaY)),e.clientX,e.clientY)},r=null,n=e=>{let[t,r]=[e[0],e[1]];return{distance:Math.hypot(t.clientX-r.clientX,t.clientY-r.clientY),centerX:(t.clientX+r.clientX)/2,centerY:(t.clientY+r.clientY)/2}},i=e=>{2===e.touches.length&&(r={distance:n(e.touches).distance,zoom:l.current},u.current=!0)},a=e=>{if(!r||2!==e.touches.length)return;e.preventDefault();let{distance:t,centerX:i,centerY:a}=n(e.touches);r.distance>0&&m(r.zoom*(t/r.distance),i,a)},o=e=>{e.touches.length<2&&(r=null,u.current=!1)},s=e=>{u.current&&e.stopPropagation()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("touchmove",a,{passive:!1}),t.addEventListener("touchend",o),t.addEventListener("touchcancel",o),t.addEventListener("pointermove",s,{capture:!0}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",i),t.removeEventListener("touchmove",a),t.removeEventListener("touchend",o),t.removeEventListener("touchcancel",o),t.removeEventListener("pointermove",s,{capture:!0})}},[t,m]);let g=(0,r.useCallback)(e=>{e&&1===l.current&&c(e.clientWidth)},[]),p=(0,r.useCallback)(()=>m(1.25*l.current),[m]),f=(0,r.useCallback)(()=>m(l.current/1.25),[m]),w=(0,r.useCallback)(()=>{l.current=1,d.current=null,s(1)},[]),x=1!==o&&h?{...e,width:h*o,height:"auto",maxWidth:"none",maxHeight:"none"}:e;return{containerRef:a,zoom:o,imageStyle:x,measureImage:g,zoomIn:p,zoomOut:f,reset:w}}(x[E]);(0,r.useEffect)(()=>{P()},[e,P]);let[$,H]=(0,r.useState)({src:e,regions:[]}),A=$.src===e?$.regions:[],z=t=>H({src:e,regions:t}),B=(0,r.useRef)(null),Y=["single",...p?["auto"]:[],...u||m&&g?["multi"]:[]],X={single:v.batchImport.singleMode,auto:v.batchImport.autoMode,multi:v.batchImport.multiMode},O=async()=>{if(0!==A.length){if(m){m(A,!0),z([]);return}if(B.current&&u)try{u(await l(B.current,A)),z([])}catch(e){w.V.error("[ImageCropper]","Multi-image crop failed",{error:e})}}},U=()=>j&&j.width>0&&j.height>0?{x:j.x/100,y:j.y/100,width:j.width/100,height:j.height/100}:{x:0,y:0,width:1,height:1},K=async()=>{let e=U();if("auto"===E&&p)return void p(e);if(m)return void m([e],!1);if(D.current&&d)try{let[t]=await l(D.current,[e]);d(t)}catch(e){w.V.error("[ImageCropper]","Crop failed",{error:e})}};return(0,t.jsx)(a.N,{open:o,onOpenChange:e=>!e&&h(),children:(0,t.jsxs)(a.d,{className:"max-w-3xl h-[90vh] flex flex-col p-0 gap-0",children:[(0,t.jsx)(a.s,{className:"p-4 border-b shrink-0",children:(0,t.jsx)(a.F,{children:v.common.cropper?.title||"Crop Image"})}),(0,t.jsxs)("div",{className:"relative min-h-0 flex-1 bg-black",children:[(0,t.jsx)("div",{ref:N,className:"flex h-full w-full overflow-auto p-4",children:(0,t.jsx)("div",{className:"m-auto",children:"multi"===E?(0,t.jsx)(c,{ref:B,imageSrc:C,regions:A,onChange:z,imageStyle:S,onImageLoad:e=>L(e.currentTarget)}):(0,t.jsx)(n.f,{crop:j,onChange:(e,t)=>k(t),children:(0,t.jsx)("img",{ref:D,alt:"Crop me",src:C,onLoad:function(e){k({unit:"%",x:0,y:0,width:100,height:100}),L(e.currentTarget)},style:S})})})}),(0,t.jsx)("div",{className:"absolute right-3 top-3",children:(0,t.jsx)(f,{zoom:R,onZoomIn:I,onZoomOut:_,onReset:P})})]}),(0,t.jsxs)("div",{className:"p-4 border-t bg-background shrink-0 space-y-3",children:[Y.length>1&&(0,t.jsx)("div",{className:`grid gap-1 rounded-md bg-muted p-1 ${3===Y.length?"grid-cols-3 sm:w-[28rem]":"grid-cols-2 sm:w-80"}`,children:Y.map(e=>(0,t.jsx)("button",{type:"button","aria-pressed":E===e,onClick:()=>{P(),M(e)},className:`rounded px-2 py-1.5 text-sm font-medium transition-colors ${E===e?"bg-background shadow-sm":"text-muted-foreground"}`,children:X[e]},e))}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"multi"===E?`${v.batchImport.hint} ${v.batchImport.regionCount.replace("{count}",String(A.length))}`:"auto"===E?v.batchImport.autoHint:b>0?v.upload.parts.cropHint.replace("{n}",String(b+1)):v.common.cropper?.hint||"💡 Drag to adjust crop area"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 justify-end",children:["multi"===E&&A.length>0&&(0,t.jsx)(i.f,{variant:"ghost",onClick:()=>z([]),children:v.batchImport.clear}),(0,t.jsx)(i.f,{variant:"outline",onClick:h,children:v.common.cancel||"Cancel"}),"multi"===E?(0,t.jsx)(i.f,{onClick:O,disabled:0===A.length,children:v.batchImport.start.replace("{count}",String(A.length))}):(0,t.jsxs)(t.Fragment,{children:["single"===E&&y&&(0,t.jsx)(i.f,{variant:"secondary",onClick:()=>y(U()),"data-testid":"crop-add-part",children:v.upload.parts.addNext}),(0,t.jsx)(i.f,{onClick:K,children:"auto"===E?v.batchImport.autoStart:b>0?v.upload.parts.confirm.replace("{count}",String(b+1)):v.common.confirm||"Confirm"})]})]})]})]})]})})}],12130)},141176,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(456420);let i={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};i.node;let a=(0,n.f)(i);var o=e.i(772382),s=e.i(511445),l=e.i(624687),h=e.i(111110),c=e.i(975157);e.s(["f",0,function({value:e,onChange:n,className:i,...d}){let{t:u}=(0,h.b)(),[m,g]=(0,r.useState)("source"),p=(0,r.useId)(),f=[{mode:"source",label:u.markdownEditor.source,icon:a},{mode:"preview",label:u.markdownEditor.preview,icon:o.f}];return(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("div",{role:"tablist","aria-label":u.markdownEditor.modeLabel,className:"flex justify-end",children:(0,t.jsx)("div",{className:"inline-flex rounded-md border bg-muted/40 p-0.5",children:f.map(({mode:e,label:r,icon:n})=>(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":m===e,"aria-controls":p,onClick:()=>g(e),className:(0,c.f)("flex items-center gap-1 rounded px-2.5 py-1 text-xs transition-colors",m===e?"bg-background font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(n,{className:"h-3.5 w-3.5"}),r]},e))})}),(0,t.jsx)("div",{id:p,role:"tabpanel",children:"source"===m?(0,t.jsx)(l.f,{value:e,onChange:e=>n(e.target.value),className:i,...d}):(0,t.jsx)("div",{className:"min-h-24 cursor-text rounded-md border bg-muted/20 px-3 py-2",onDoubleClick:()=>g("source"),title:u.markdownEditor.doubleClickToEdit,children:e.trim()?(0,t.jsx)(s.f,{content:e}):(0,t.jsx)("p",{className:"text-sm italic text-muted-foreground",children:u.markdownEditor.empty})})})]})}],141176)},438465,674166,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(967489),i=e.i(856423),a=e.i(41931),o=e.i(201276),s=e.i(111110);e.s(["f",0,function({value:e,onChange:l,className:h}){let[c,d]=(0,r.useState)([]),{t:u}=(0,s.b)();return(0,r.useEffect)(()=>{(async()=>{try{let e=await a.k.get("/api/notebooks");d(e)}catch(e){o.V.error("[NotebookSelector]","Failed to fetch notebooks",{error:e})}})()},[]),(0,t.jsxs)(n.d,{value:e,onValueChange:l,children:[(0,t.jsx)(n.P,{className:h,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.f,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)(n.U,{placeholder:u.notebooks?.selector?.placeholder||"Select Notebook"})]})}),(0,t.jsx)(n.r,{children:0===c.length?(0,t.jsx)("div",{className:"p-2 text-sm text-muted-foreground text-center",children:u.notebooks?.selector?.empty||"No notebooks available"}):c.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],438465);var l=e.i(470279);e.s(["f",0,function({value:e,onChange:r,disabled:i}){let{groups:a,loading:o}=(0,l.f)(),s=a.filter(e=>e.isActive);return(0,t.jsxs)(n.d,{value:e,onValueChange:r,disabled:i||o,children:[(0,t.jsx)(n.P,{children:(0,t.jsx)(n.U,{placeholder:"选择卷别"})}),(0,t.jsx)(n.r,{children:s.map(e=>(0,t.jsx)(n.T,{value:e.id,children:e.name},e.id))})]})}],674166)},149704,e=>{var t=e.i(843476),r=e.i(111110),n=e.i(398019),i=e.i(184110),a=e.i(975157);let o={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:s,align:l,className:h}){let{t:c}=(0,r.b)();if(!e)return null;let d=(0,i.V)(s),u=(0,i.o)(l);return(0,t.jsx)("figure",{className:(0,a.f)("question-figure my-3",h),children:(0,t.jsx)("img",{src:(0,n.d)(e),alt:c.figure.alt,className:(0,a.f)(o[u],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===u?{marginLeft:0,marginRight:"auto"}:"right"===u?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:d/100,maxWidth:`${Math.min(d,100)}%`}})})}])},574041,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(263676),i=e.i(487486),a=e.i(793479),o=e.i(41931),s=e.i(201276);e.s(["f",0,function({value:e=[],onChange:l,placeholder:h="Enter tags...",className:c="",enterHint:d,subject:u,gradeStage:m}){let[g,p]=(0,r.useState)(""),[f,w]=(0,r.useState)([]),[x,y]=(0,r.useState)(!1),[b,v]=(0,r.useState)(0),C=(0,r.useRef)(null),j=(0,r.useRef)(null),k=(0,r.useCallback)(async t=>{try{let r=new URLSearchParams({q:t});u&&r.append("subject",u),m&&r.append("stage",m);let n=((await o.k.get(`/api/tags/suggestions?${r.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));w(n.slice(0,20)),y(n.length>0),v(0)}catch(e){s.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[u,m,e]);(0,r.useEffect)(()=>{g.trim()&&k(g)},[g,k]);let D=t=>{t.trim()&&!e.includes(t.trim())&&(l([...e,t.trim()]),p(""),w([]),y(!1),v(0))},E=t=>{l(e.filter(e=>e!==t))};return(0,r.useEffect)(()=>{let e=e=>{!j.current||j.current.contains(e.target)||C.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${c}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(i.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>E(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(n.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(a.f,{ref:C,type:"text",value:g,onChange:e=>{p(e.target.value),e.target.value.trim()||(w([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&f[b]?D(f[b]):g.trim()&&D(g)):"ArrowDown"===t.key?(t.preventDefault(),v(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),v(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),v(0)):"Backspace"===t.key&&!g&&e.length>0&&E(e[e.length-1])},onFocus:()=>{f.length>0&&y(!0)},placeholder:0===e.length?h:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),x&&f.length>0&&(0,t.jsx)("div",{ref:j,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:f.map((e,r)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${r===b?"bg-accent":""}`,onClick:()=>D(e),onMouseEnter:()=>v(r),children:e},e))}),g&&!x&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:d?`${d} "${g}"`:`Press Enter to create "${g}"`})]})}])},184110,e=>{let t=["left","center","right"],r="center";function n(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,r,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,n,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:r},"V",0,function(e){return n(e)?e:100}])},398019,e=>{e.s(["K",0,1e5,"d",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},213761,e=>{let t={maxLongEdge:4096,maxPixels:4915200,maxBytes:1572864,startQuality:.9,minQuality:.8};class r extends Error{code;format;constructor(e,t,r){super(e,void 0===r?void 0:{cause:r}),this.code=e,this.format=t,this.name="ImageDecodeError"}}let n=new Set(["heic","heix","heim","heis","hevc","hevx","hevm","hevs"]),i=new Set(["mif1","msf1","mif2"]),a=new Set(["avif","avis"]);function o(e,r,n=t){let i=Math.min(1,n.maxLongEdge/Math.max(e,r),Math.sqrt(n.maxPixels/Math.max(1,e*r)));return{width:Math.max(1,Math.floor(e*i)),height:Math.max(1,Math.floor(r*i)),scale:i}}async function s(e){let t,r;if("function"==typeof createImageBitmap)try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{}let n=await (t=URL.createObjectURL(e),(r=new Image).decoding="async",new Promise((e,n)=>{r.onload=()=>e(r),r.onerror=()=>n(Error("IMAGE_ELEMENT_DECODE_FAILED")),r.src=t}).finally(()=>URL.revokeObjectURL(t)));if(!n.naturalWidth||!n.naturalHeight)throw Error("IMAGE_EMPTY");return n}async function l(t){let{heicTo:r}=await e.A(462684);return r({blob:t,type:"image/jpeg",quality:.95})}function h(e,t){return new Promise((r,n)=>{e.toBlob(e=>e?r(e):n(Error("CANVAS_EMPTY")),"image/jpeg",t)})}function c(e,t,r,n,i,a,o){let s,l=((s=document.createElement("canvas")).width=a,s.height=o,s),h=l.getContext("2d");if(!h)throw Error("CANVAS_UNSUPPORTED");return h.fillStyle="#ffffff",h.fillRect(0,0,a,o),h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(e,t,r,n,i,0,0,a,o),l}async function d(e,t){var d;let u,m=performance.now(),g=await e.arrayBuffer(),p=performance.now()-m,f=function(e){let t=(t,r)=>String.fromCharCode(...e.subarray(t,r));if(e.length>=3&&255===e[0]&&216===e[1]&&255===e[2])return"jpeg";if(e.length>=8&&137===e[0]&&"PNG"===t(1,4))return"png";if(e.length>=12&&"RIFF"===t(0,4)&&"WEBP"===t(8,12))return"webp";if(e.length>=6&&("GIF87a"===t(0,6)||"GIF89a"===t(0,6)))return"gif";if(e.length>=2&&"BM"===t(0,2))return"bmp";if(e.length>=12&&"ftyp"===t(4,8)){let r=Math.min(e.length,(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0||e.length),o=[t(8,12)];for(let e=16;e+4<=r;e+=4)o.push(t(e,e+4));if(o.some(e=>n.has(e)))return"heic";if(o.some(e=>a.has(e)))return"avif";if(o.some(e=>i.has(e)))return"heic"}return"unknown"}(new Uint8Array(g,0,Math.min(g.byteLength,64))),w=e.type||"",x=performance.now(),y="native",b=new Blob([g],{type:w||"application/octet-stream"});try{u=await s(b)}catch(e){if("heic"!==f)throw new r("unknown"===f?"UNSUPPORTED_IMAGE":"IMAGE_DECODE_FAILED",f,e);t?.();try{u=await s(await l(b)),y="heic"}catch(e){throw new r("HEIC_DECODE_FAILED",f,e)}}let{width:v,height:C}=(d=u)instanceof HTMLImageElement?{width:d.naturalWidth,height:d.naturalHeight}:{width:d.width,height:d.height};if(!v||!C)throw new r("IMAGE_DECODE_FAILED",f);let j=o(v,C,{maxLongEdge:1600,maxPixels:1/0}),k=await h(c(u,0,0,v,C,j.width,j.height),.85),D=URL.createObjectURL(k),E=performance.now()-x;return{source:u,width:v,height:C,format:f,decoder:y,previewUrl:D,sourceType:w,sourceBytes:e.size,timings:{read:Math.round(p),convert:Math.round(E)},dispose:()=>{URL.revokeObjectURL(D),u instanceof HTMLImageElement||u.close()}}}let u={x:0,y:0,width:1,height:1};async function m(e,r=u,n=t){var i;let a=performance.now(),s=e=>Math.min(1,Math.max(0,e)),l=Math.round(s(r.x)*e.width),d=Math.round(s(r.y)*e.height),g=Math.max(1,Math.min(e.width-l,Math.round(s(r.width)*e.width))),p=Math.max(1,Math.min(e.height-d,Math.round(s(r.height)*e.height))),f=o(g,p,n),w=c(e.source,l,d,g,p,f.width,f.height),x=performance.now()-a,y=performance.now(),b=n.startQuality,v=await h(w,b);for(let t=0;v.size>n.maxBytes&&t<12;t++)b-.05>=n.minQuality-1e-9?b=Math.round((b-.05)*100)/100:(f={width:Math.max(1,Math.floor(.85*f.width)),height:Math.max(1,Math.floor(.85*f.height)),scale:.85*f.scale},w=c(e.source,l,d,g,p,f.width,f.height)),v=await h(w,b);return{dataUrl:await (i=v,new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(r.error??Error("READ_FAILED")),r.readAsDataURL(i)})),width:f.width,height:f.height,bytes:v.size,quality:b,timings:{crop:Math.round(x),compress:Math.round(performance.now()-y)}}}e.s(["K",0,t,"o",0,r,"N",0,function(e,t){return{sourceType:e.sourceType||e.format,sourceBytes:e.sourceBytes,sourceWidth:e.width,sourceHeight:e.height,outputWidth:t.width,outputHeight:t.height,outputBytes:t.bytes,decoder:e.decoder,quality:t.quality}},"p",0,d,"X",0,m])},991722,e=>{function t(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["i",0,function(e,r="zh"){return("en"===r?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[t(e)]},"h",0,t,"x",0,function(e,r){return(r||"").trim()?"wrong_attempt":t(e)}])},597138,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])}])})();
|