wrong-notebook 2026.11.4-7 → 2026.11.4-9

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.
Files changed (80) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/server/app/_global-error.html +1 -1
  4. package/.next/server/app/_global-error.rsc +1 -1
  5. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  8. package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
  9. package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
  10. package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
  11. package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
  12. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  13. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  14. package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
  15. package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
  16. package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
  17. package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
  18. package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
  19. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
  20. package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
  21. package/.next/server/app/api/error-items/route.js.nft.json +1 -1
  22. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
  23. package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
  24. package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
  25. package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
  26. package/.next/server/app/api/exams/route.js.nft.json +1 -1
  27. package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
  28. package/.next/server/app/api/import/route.js.nft.json +1 -1
  29. package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
  30. package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
  31. package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
  32. package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
  33. package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
  34. package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
  35. package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
  36. package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
  37. package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
  38. package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
  39. package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
  40. package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
  41. package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
  42. package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
  43. package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
  44. package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
  45. package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
  46. package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
  47. package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
  48. package/.next/server/app/api/review/due/route.js.nft.json +1 -1
  49. package/.next/server/app/api/stats/repeated-mistakes/route.js.nft.json +1 -1
  50. package/.next/server/app/api/stats/weak-tags/route.js.nft.json +1 -1
  51. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  52. package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
  53. package/.next/server/app/api/user/route.js.nft.json +1 -1
  54. package/.next/server/app/import-batches/[id]/page.js.nft.json +1 -1
  55. package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
  57. package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app/page.js.nft.json +1 -1
  59. package/.next/server/app/page_client-reference-manifest.js +1 -1
  60. package/.next/server/chunks/_0tkov27xr068i._.js +5 -4
  61. package/.next/server/chunks/_1638xaazsmf2m._.js +5 -4
  62. package/.next/server/chunks/_1vddun9dxzaqo._.js +5 -4
  63. package/.next/server/chunks/ssr/{node_modules_115tsi2nro4tk._.js → node_modules_1-wb4967v48id._.js} +1 -1
  64. package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +3 -3
  65. package/.next/server/chunks/ssr/src_lib_0773v8b5gb93o._.js +5 -4
  66. package/.next/server/chunks/ssr/src_lib_1qhs590-z9xnh._.js +5 -4
  67. package/.next/server/chunks/ssr/src_lib_1z8akixo3j8ti._.js +5 -4
  68. package/.next/server/middleware-build-manifest.js +3 -3
  69. package/.next/server/pages/500.html +1 -1
  70. package/.next/static/chunks/{40t8efajfu_xz.js → 0et32jq7vmu34.js} +6 -5
  71. package/.next/static/chunks/1q3saz647fqri.js +6 -0
  72. package/.next/static/chunks/2gamhj4j8w-tp.js +16 -0
  73. package/.next/static/chunks/{05pa84fjsr-h8.js → 2r3xwds8ivfso.js} +7 -6
  74. package/package.json +1 -1
  75. package/prisma/seed.db +0 -0
  76. package/.next/static/chunks/0ppbk9n8iiwlv.js +0 -15
  77. package/.next/static/chunks/0wr5pvnu47q_0.js +0 -6
  78. /package/.next/static/{Rh_2qSdtR7MzUEFCrjWo3 → LrrgMzKoXDgDyWX4FhFLd}/_buildManifest.js +0 -0
  79. /package/.next/static/{Rh_2qSdtR7MzUEFCrjWo3 → LrrgMzKoXDgDyWX4FhFLd}/_clientMiddlewareManifest.js +0 -0
  80. /package/.next/static/{Rh_2qSdtR7MzUEFCrjWo3 → LrrgMzKoXDgDyWX4FhFLd}/_ssgManifest.js +0 -0
@@ -1,12 +1,13 @@
1
- (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,399847,e=>{var t=e.i(456420);let n={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"]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],399847)},13285,e=>{var t=e.i(456420);let n={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"]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],13285)},615568,168148,e=>{var t=e.i(456420);let n={name:"pencil-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],615568);var a=e.i(843476),r=e.i(271645),l=e.i(30030),o=e.i(248425),s=Object.defineProperty,h=(e,t)=>s(e,"name",{value:t,configurable:!0}),c="Progress",[u,d]=(0,l.f)(c),[g,m]=u(c),f=r.forwardRef(h(function(e,t){let{__scopeProgress:n,value:i=null,max:r,getValueLabel:l=w,...s}=e;(r||0===r)&&!b(r)&&console.error(C(`${r}`,"Progress"));let h=b(r)?r:100;null===i||v(i,h)||console.error(M(`${i}`,"Progress"));let c=v(i,h)?i:null,u=x(c)?l(c,h):void 0;return(0,a.jsx)(g,{scope:n,value:c,max:h,children:(0,a.jsx)(o.V.div,{"aria-valuemax":h,"aria-valuemin":0,"aria-valuenow":x(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":y(c,h),"data-value":c??void 0,"data-max":h,...s,ref:t})})},"Progress")),p=r.forwardRef(h(function(e,t){let{__scopeProgress:n,...i}=e,r=m("ProgressIndicator",n);return(0,a.jsx)(o.V.div,{"data-state":y(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...i,ref:t})},"ProgressIndicator"));function w(e,t){return`${Math.round(e/t*100)}%`}function y(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function x(e){return"number"==typeof e}function b(e){return x(e)&&!isNaN(e)&&e>0}function v(e,t){return x(e)&&!isNaN(e)&&e<=t&&e>=0}function C(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`}function M(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,399847,e=>{var t=e.i(456420);let n={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"]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],399847)},13285,e=>{var t=e.i(456420);let n={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"]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],13285)},615568,168148,e=>{var t=e.i(456420);let n={name:"pencil-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],615568);var a=e.i(843476),r=e.i(271645),l=e.i(30030),o=e.i(248425),s=Object.defineProperty,h=(e,t)=>s(e,"name",{value:t,configurable:!0}),u="Progress",[c,d]=(0,l.f)(u),[g,f]=c(u),m=r.forwardRef(h(function(e,t){let{__scopeProgress:n,value:i=null,max:r,getValueLabel:l=w,...s}=e;(r||0===r)&&!b(r)&&console.error(C(`${r}`,"Progress"));let h=b(r)?r:100;null===i||v(i,h)||console.error(M(`${i}`,"Progress"));let u=v(i,h)?i:null,c=x(u)?l(u,h):void 0;return(0,a.jsx)(g,{scope:n,value:u,max:h,children:(0,a.jsx)(o.V.div,{"aria-valuemax":h,"aria-valuemin":0,"aria-valuenow":x(u)?u:void 0,"aria-valuetext":c,role:"progressbar","data-state":y(u,h),"data-value":u??void 0,"data-max":h,...s,ref:t})})},"Progress")),p=r.forwardRef(h(function(e,t){let{__scopeProgress:n,...i}=e,r=f("ProgressIndicator",n);return(0,a.jsx)(o.V.div,{"data-state":y(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...i,ref:t})},"ProgressIndicator"));function w(e,t){return`${Math.round(e/t*100)}%`}function y(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function x(e){return"number"==typeof e}function b(e){return x(e)&&!isNaN(e)&&e>0}function v(e,t){return x(e)&&!isNaN(e)&&e<=t&&e>=0}function C(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`}function M(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
2
2
  - a positive number
3
3
  - less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
4
4
  - \`null\` or \`undefined\` if the progress is indeterminate.
5
5
 
6
- Defaulting to \`null\`.`}h(w,"defaultGetValueLabel"),h(y,"getProgressState"),h(x,"isNumber"),h(b,"isValidMaxNumber"),h(v,"isValidValueNumber"),h(C,"getInvalidMaxError"),h(M,"getInvalidValueError");var D=e.i(975157);let _=r.forwardRef(({className:e,value:t,...n},i)=>(0,a.jsx)(f,{ref:i,value:t,className:(0,D.f)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:(0,a.jsx)(p,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));_.displayName=f.displayName,e.s(["f",0,_],168148)},328623,e=>{var t=e.i(456420);let n={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"]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],328623)},232660,e=>{var t=e.i(271645),n={x:0,y:0,width:0,height:0,unit:"px"},i=(e,t,n)=>Math.min(Math.max(e,t),n),a=(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 r(e,t,i){return"%"===e.unit?{...n,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/i*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/i*100:0}}function l(e,t,i){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*i/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*i/100:0}:{...n,...e,unit:"px"}}function o(e,t,n,i,a,r=0,l=0,s=i,h=a){let c={...e},u=Math.min(r,i),d=Math.min(l,a),g=Math.min(s,i),m=Math.min(h,a);t&&(t>1?(d=(u=l?l*t:u)/t,g=s*t):(u=(d=r?r/t:d)*t,m=h/t)),c.y<0&&(c.height=Math.max(c.height+c.y,d),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,u),c.x=0);let f=i-(c.x+c.width);f<0&&(c.x=Math.min(c.x,i-u),c.width+=f);let p=a-(c.y+c.height);if(p<0&&(c.y=Math.min(c.y,a-d),c.height+=p),c.width<u&&(("sw"===n||"nw"==n)&&(c.x-=u-c.width),c.width=u),c.height<d&&(("nw"===n||"ne"==n)&&(c.y-=d-c.height),c.height=d),c.width>g&&(("sw"===n||"nw"==n)&&(c.x-=g-c.width),c.width=g),c.height>m&&(("nw"===n||"ne"==n)&&(c.y-=m-c.height),c.height=m),t){let e=c.width/c.height;if(e<t){let e=Math.max(c.width/t,d);("nw"===n||"ne"==n)&&(c.y-=e-c.height),c.height=e}else if(e>t){let e=Math.max(c.height*t,u);("sw"===n||"nw"==n)&&(c.x-=e-c.width),c.width=e}}return c}var s={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:n,width:i,height:a}=e.getBoundingClientRect();return{x:t,y:n,width:i,height:a}}componentDidUpdate(e){let{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){let{width:e,height:i}=this.getBox();e&&i&&n(l(t,e,i),r(t,e,i))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,s),this.document.addEventListener("pointerup",this.onDocPointerDone,s),this.document.addEventListener("pointercancel",this.onDocPointerDone,s),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,s),this.document.removeEventListener("pointerup",this.onDocPointerDone,s),this.document.removeEventListener("pointercancel",this.onDocPointerDone,s),!1)}onCropPointerDown=e=>{let{crop:t,disabled:n}=this.props,i=this.getBox();if(!t)return;let a=l(t,i.width,i.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let r=e.target.dataset.ord,o=e.clientX,s=e.clientY,h=a.x,c=a.y;if(r){let t=e.clientX-i.x,n=e.clientY-i.y,l=0,u=0;"ne"===r||"e"==r?(l=t-(a.x+a.width),u=n-a.y,h=a.x,c=a.y+a.height):"se"===r||"s"===r?(l=t-(a.x+a.width),u=n-(a.y+a.height),h=a.x,c=a.y):"sw"===r||"w"==r?(l=t-a.x,u=n-(a.y+a.height),h=a.x+a.width,c=a.y):("nw"===r||"n"==r)&&(l=t-a.x,u=n-a.y,h=a.x+a.width,c=a.y+a.height),o=h+i.x+l,s=c+i.y+u}this.evData={startClientX:o,startClientY:s,startCropX:h,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!!r,ord:r},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:n,locked:i,keepSelection:a,onChange:o}=this.props,s=this.getBox();if(n||i||a&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-s.x,c=e.clientY-s.y,u={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,o(l(u,s.width,s.height),r(u,s.width,s.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:n,disabled:i,onChange:o,onDragStart:s}=this.props,h=this.getBox();if(i||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));let{evData:c}=this;c.clientX=e.clientX,c.clientY=e.clientY,a(n,t=c.isResize?this.resizeCrop():this.dragCrop())||o(l(t,h.width,h.height),r(t,h.width,h.height))};onComponentKeyDown=t=>{let{crop:n,disabled:a,onChange:o,onComplete:s}=this.props;if(a)return;let h=t.key,c=!1;if(!n)return;let u=this.getBox(),d=this.makePixelCrop(u),g=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===h?(d.x-=g,c=!0):"ArrowRight"===h?(d.x+=g,c=!0):"ArrowUp"===h?(d.y-=g,c=!0):"ArrowDown"===h&&(d.y+=g,c=!0),c){t.cancelable&&t.preventDefault(),d.x=i(d.x,0,u.width-d.width),d.y=i(d.y,0,u.height-d.height);let e=l(d,u.width,u.height),n=r(d,u.width,u.height);o(e,n),s&&s(e,n)}};onHandlerKeyDown=(t,n)=>{var i,s;let h,{aspect:c=0,crop:u,disabled:d,minWidth:g=0,minHeight:m=0,maxWidth:f,maxHeight:p,onChange:w,onComplete:y}=this.props,x=this.getBox();if(d||!u||"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=o((i=l(u,x.width,x.height),s=t.key,h={...i},"ArrowLeft"===s?"nw"===n?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"w"===n?(h.x-=b,h.width+=b):"sw"===n?(h.x-=b,h.width+=b,h.height+=b):"ne"===n?(h.y+=b,h.width-=b,h.height-=b):"e"===n?h.width-=b:"se"===n&&(h.width-=b,h.height-=b):"ArrowRight"===s&&("nw"===n?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"w"===n?(h.x+=b,h.width-=b):"sw"===n?(h.x+=b,h.width-=b,h.height-=b):"ne"===n?(h.y-=b,h.width+=b,h.height+=b):"e"===n?h.width+=b:"se"===n&&(h.width+=b,h.height+=b)),"ArrowUp"===s?"nw"===n?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"n"===n?(h.y-=b,h.height+=b):"ne"===n?(h.y-=b,h.width+=b,h.height+=b):"sw"===n?(h.x+=b,h.width-=b,h.height-=b):"s"===n?h.height-=b:"se"===n&&(h.width-=b,h.height-=b):"ArrowDown"===s&&("nw"===n?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"n"===n?(h.y+=b,h.height-=b):"ne"===n?(h.y+=b,h.width-=b,h.height-=b):"sw"===n?(h.x-=b,h.width+=b,h.height+=b):"s"===n?h.height+=b:"se"===n&&(h.width+=b,h.height+=b)),h),c,n,x.width,x.height,g,m,f,p);if(!a(u,v)){let e=r(v,x.width,x.height);w(v,e),y&&y(v,e)}};onDocPointerDone=e=>{let{crop:t,disabled:n,onComplete:i,onDragEnd:a}=this.props,o=this.getBox();this.unbindDocMove(),!(n||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,a&&a(e),i&&i(l(t,o.width,o.height),r(t,o.width,o.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(),n=this.makePixelCrop(t),a=e.clientX-e.startClientX,r=e.clientY-e.startClientY;return n.x=i(e.startCropX+a,0,t.width-n.width),n.y=i(e.startCropY+r,0,t.height-n.height),n}getPointRegion(e,t,n,i){let{evData:a}=this,r=a.clientX-e.x,l=a.clientY-e.y,o;return o=i&&t?"nw"===t||"n"===t||"ne"===t:l<a.startCropY,(n&&t?"nw"===t||"w"===t||"sw"===t:r<a.startCropX)?o?"nw":"sw":o?"ne":"se"}resolveMinDimensions(e,t,n=0,i=0){let a=Math.min(n,e.width),r=Math.min(i,e.height);return t&&(a||r)?t>1?a?[a,a/t]:[r*t,r]:r?[r*t,r]:[a,a/t]:[a,r]}resizeCrop(){let{evData:t}=this,{aspect:n=0,maxWidth:a,maxHeight:r}=this.props,l=this.getBox(),[s,h]=this.resolveMinDimensions(l,n,this.props.minWidth,this.props.minHeight),c=this.makePixelCrop(l),u=this.getPointRegion(l,t.ord,s,h),d=t.ord||u,g=t.clientX-t.startClientX,m=t.clientY-t.startClientY;(s&&"nw"===d||"w"===d||"sw"===d)&&(g=Math.min(g,-s)),(h&&"nw"===d||"n"===d||"ne"===d)&&(m=Math.min(m,-h));let f={unit:"px",x:0,y:0,width:0,height:0};"ne"===u?(f.x=t.startCropX,f.width=g,n?f.height=f.width/n:f.height=Math.abs(m),f.y=t.startCropY-f.height):"se"===u?(f.x=t.startCropX,f.y=t.startCropY,f.width=g,n?f.height=f.width/n:f.height=m):"sw"===u?(f.x=t.startCropX+g,f.y=t.startCropY,f.width=Math.abs(g),n?f.height=f.width/n:f.height=m):"nw"===u&&(f.x=t.startCropX+g,f.width=Math.abs(g),n?(f.height=f.width/n,f.y=t.startCropY-f.height):(f.height=Math.abs(m),f.y=t.startCropY+m));let p=o(f,n,u,l.width,l.height,s,h,a,r);return n||e.xyOrds.indexOf(d)>-1?c=p:e.xOrds.indexOf(d)>-1?(c.x=p.x,c.width=p.width):e.yOrds.indexOf(d)>-1&&(c.y=p.y,c.height=p.height),c.x=i(c.x,0,l.width-c.width),c.y=i(c.y,0,l.height-c.height),c}renderCropSelection(){let{ariaLabels:n=e.defaultProps.ariaLabels,disabled:i,locked:a,renderSelectionAddon:r,ruleOfThirds:l,crop:o}=this.props,s=this.getCropStyle();if(o)return t.default.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":n.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!i&&!a&&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":n.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":n.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":n.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":n.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":n.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":n.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":n.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":n.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),r&&t.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},r(this.state)),l&&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 l({...n,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:n,circularCrop:i,className:a,crop:r,disabled:l,locked:o,style:s,ruleOfThirds:h}=this.props,{cropIsActive:c,newCropIsBeingDrawn:u}=this.state,d=r?this.renderCropSelection():null,g=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",a,c&&"ReactCrop--active",l&&"ReactCrop--disabled",o&&"ReactCrop--locked",u&&"ReactCrop--new-crop",r&&e&&"ReactCrop--fixed-aspect",r&&i&&"ReactCrop--circular-crop",r&&h&&"ReactCrop--rule-of-thirds",!this.dragStarted&&r&&!r.width&&!r.height&&"ReactCrop--invisible-crop",i&&"ReactCrop--no-animate");return t.default.createElement("div",{ref:this.componentRef,className:g,style:s},t.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),r?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"}),i?t.default.createElement("ellipse",{cx:`${r.x+r.width/2}${r.unit}`,cy:`${r.y+r.height/2}${r.unit}`,rx:`${r.width/2}${r.unit}`,ry:`${r.height/2}${r.unit}`,fill:"black"}):t.default.createElement("rect",{x:`${r.x}${r.unit}`,y:`${r.y}${r.unit}`,width:`${r.width}${r.unit}`,height:`${r.height}${r.unit}`,fill:"black"}))),t.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,d)}};e.s(["f",0,c])},213761,e=>{let t={maxLongEdge:4096,maxPixels:4915200,maxBytes:1572864,startQuality:.9,minQuality:.8};class n extends Error{code;format;constructor(e,t,n){super(e,void 0===n?void 0:{cause:n}),this.code=e,this.format=t,this.name="ImageDecodeError"}}let i=new Set(["heic","heix","heim","heis","hevc","hevx","hevm","hevs"]),a=new Set(["mif1","msf1","mif2"]),r=new Set(["avif","avis"]);function l(e,n,i=t){let a=Math.min(1,i.maxLongEdge/Math.max(e,n),Math.sqrt(i.maxPixels/Math.max(1,e*n)));return{width:Math.max(1,Math.floor(e*a)),height:Math.max(1,Math.floor(n*a)),scale:a}}async function o(e){let t,n;if("function"==typeof createImageBitmap)try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{}let i=await (t=URL.createObjectURL(e),(n=new Image).decoding="async",new Promise((e,i)=>{n.onload=()=>e(n),n.onerror=()=>i(Error("IMAGE_ELEMENT_DECODE_FAILED")),n.src=t}).finally(()=>URL.revokeObjectURL(t)));if(!i.naturalWidth||!i.naturalHeight)throw Error("IMAGE_EMPTY");return i}async function s(t){let{heicTo:n}=await e.A(462684);return n({blob:t,type:"image/jpeg",quality:.95})}function h(e,t){return new Promise((n,i)=>{e.toBlob(e=>e?n(e):i(Error("CANVAS_EMPTY")),"image/jpeg",t)})}function c(e,t,n,i,a,r,l){let o,s=((o=document.createElement("canvas")).width=r,o.height=l,o),h=s.getContext("2d");if(!h)throw Error("CANVAS_UNSUPPORTED");return h.fillStyle="#ffffff",h.fillRect(0,0,r,l),h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(e,t,n,i,a,0,0,r,l),s}async function u(e,t){var u;let d,g=performance.now(),m=await e.arrayBuffer(),f=performance.now()-g,p=function(e){let t=(t,n)=>String.fromCharCode(...e.subarray(t,n));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 n=Math.min(e.length,(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0||e.length),l=[t(8,12)];for(let e=16;e+4<=n;e+=4)l.push(t(e,e+4));if(l.some(e=>i.has(e)))return"heic";if(l.some(e=>r.has(e)))return"avif";if(l.some(e=>a.has(e)))return"heic"}return"unknown"}(new Uint8Array(m,0,Math.min(m.byteLength,64))),w=e.type||"",y=performance.now(),x="native",b=new Blob([m],{type:w||"application/octet-stream"});try{d=await o(b)}catch(e){if("heic"!==p)throw new n("unknown"===p?"UNSUPPORTED_IMAGE":"IMAGE_DECODE_FAILED",p,e);t?.();try{d=await o(await s(b)),x="heic"}catch(e){throw new n("HEIC_DECODE_FAILED",p,e)}}let{width:v,height:C}=(u=d)instanceof HTMLImageElement?{width:u.naturalWidth,height:u.naturalHeight}:{width:u.width,height:u.height};if(!v||!C)throw new n("IMAGE_DECODE_FAILED",p);let M=l(v,C,{maxLongEdge:1600,maxPixels:1/0}),D=await h(c(d,0,0,v,C,M.width,M.height),.85),_=URL.createObjectURL(D),k=performance.now()-y;return{source:d,width:v,height:C,format:p,decoder:x,previewUrl:_,sourceType:w,sourceBytes:e.size,timings:{read:Math.round(f),convert:Math.round(k)},dispose:()=>{URL.revokeObjectURL(_),d instanceof HTMLImageElement||d.close()}}}let d={x:0,y:0,width:1,height:1};async function g(e,n=d,i=t){var a;let r=performance.now(),o=e=>Math.min(1,Math.max(0,e)),s=Math.round(o(n.x)*e.width),u=Math.round(o(n.y)*e.height),m=Math.max(1,Math.min(e.width-s,Math.round(o(n.width)*e.width))),f=Math.max(1,Math.min(e.height-u,Math.round(o(n.height)*e.height))),p=l(m,f,i),w=c(e.source,s,u,m,f,p.width,p.height),y=performance.now()-r,x=performance.now(),b=i.startQuality,v=await h(w,b);for(let t=0;v.size>i.maxBytes&&t<12;t++)b-.05>=i.minQuality-1e-9?b=Math.round((b-.05)*100)/100:(p={width:Math.max(1,Math.floor(.85*p.width)),height:Math.max(1,Math.floor(.85*p.height)),scale:.85*p.scale},w=c(e.source,s,u,m,f,p.width,p.height)),v=await h(w,b);return{dataUrl:await (a=v,new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>t(n.error??Error("READ_FAILED")),n.readAsDataURL(a)})),width:p.width,height:p.height,bytes:v.size,quality:b,timings:{crop:Math.round(y),compress:Math.round(performance.now()-x)}}}e.s(["K",0,t,"o",0,n,"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,u,"X",0,g])},499930,e=>{var t=e.i(213761);function n(e,t=.008){let i=Math.max(0,e.x-t),a=Math.max(0,e.y-t);return{x:i,y:a,width:Math.min(1,e.x+e.width+t)-i,height:Math.min(1,e.y+e.height+t)-a}}async function i(e){let t=new Image;if(t.decoding="async",t.src=e,await t.decode(),!t.naturalWidth||!t.naturalHeight)throw Error("IMAGE_EMPTY");return t}async function a(e,n){let i=function(e,t=16,n=!1){let i=Math.max(...e.map(e=>e.width)),a=0,r=e.map(e=>{let r=n?i/e.width:e.scale??1,l={x:0,y:a,width:Math.round(e.width*r),height:Math.round(e.height*r)};return a+=l.height+t,l});return{width:Math.max(...r.map(e=>e.width)),height:a-t,rects:r}}(e.map(e=>({width:e.sw,height:e.sh,scale:e.scale})),16,n),a=document.createElement("canvas");a.width=i.width,a.height=i.height;let r=a.getContext("2d");if(!r)throw Error("CANVAS_UNSUPPORTED");r.fillStyle="#ffffff",r.fillRect(0,0,a.width,a.height),e.forEach((e,t)=>{let n=i.rects[t];r.drawImage(e.source,e.sx,e.sy,e.sw,e.sh,n.x,n.y,n.width,n.height)});let l=await createImageBitmap(a);try{return await (0,t.X)({source:l,width:a.width,height:a.height})}finally{l.close()}}async function r(e,i){let r=e.naturalWidth,l=e.naturalHeight,o=i.map(e=>n(e));return 1===o.length?(0,t.X)({source:e,width:r,height:l},o[0]):a(o.map(t=>({source:e,sx:Math.round(t.x*r),sy:Math.round(t.y*l),sw:Math.max(1,Math.round(t.width*r)),sh:Math.max(1,Math.round(t.height*l))})),!1)}async function l(e){return a((await Promise.all(e.map(i))).map(e=>({source:e,sx:0,sy:0,sw:e.naturalWidth,sh:e.naturalHeight})),!0)}async function o(e,t,i){let r=e.naturalWidth,l=e.naturalHeight,o=i.width/r,s=t.map(e=>n(e)).map(t=>({source:e,sx:Math.round(t.x*r),sy:Math.round(t.y*l),sw:Math.max(1,Math.round(t.width*r)),sh:Math.max(1,Math.round(t.height*l)),scale:o}));return s.push({source:i.source,sx:0,sy:0,sw:i.width,sh:i.height}),a(s,!1)}e.s(["y",0,i,"k",0,o,"M",0,r,"v",0,l])},119472,e=>{var t=e.i(41931),n=e.i(127175);async function i(e){let t;for(let n=0;n<3;n++)try{return await e()}catch(e){if(t=e,!function(e){let t=e?.status;return void 0===t||408===t||502===t||503===t||504===t}(e)||2===n)break;await new Promise(e=>setTimeout(e,1e3*(n+1)))}throw t}async function a(e,r=(0,n.c)()){let{batch:l}=await i(()=>t.k.post("/api/import-batches",{...e,clientRequestId:r,subjectId:e.subjectId||void 0,targetSubjectId:e.targetSubjectId||void 0,paperLevel:e.paperLevel||void 0,items:e.items?.map(e=>({...e})),origin:e.origin},{timeout:12e4}));return(0,n.P)(),l}async function r(e,n={}){let i=n.image?"?include=image":"",{batch:a}=await t.k.get(`/api/import-batches/${encodeURIComponent(e)}${i}`);return a}async function l(e,n,i){let{batch:a}=await t.k.patch(`/api/import-batches/${encodeURIComponent(e)}`,{version:n,draft:i});return a}async function o(e,a,r,l){let{batch:o}=await i(()=>t.k.post(`/api/import-batches/${encodeURIComponent(e)}/start`,{version:a,images:r,analysis:l},{timeout:12e4}));return(0,n.P)(),o}async function s(e){let{batch:i}=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/retry`,{});return(0,n.P)(),i}async function h(e){let i=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/confirm-all`,{});return(0,n.P)(),i}async function c(e){await t.k.delete(`/api/import-batches/${encodeURIComponent(e)}`),(0,n.P)()}async function u(e){await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/read`,{}),(0,n.P)()}async function d(e,n,i){return t.k.post(`/api/import-batches/${encodeURIComponent(e)}/fix-text`,{items:n},{timeout:6e5,recoverable:!0,requestId:i})}e.s(["J",0,h,"n",0,function(e){return e?.status===409?e.data?.details?.batch??null:null},"v",0,a,"o",0,c,"w",0,r,"$",0,d,"f",0,u,"s",0,s,"S",0,l,"g",0,o])},25197,e=>{var t=e.i(41931);function n(e){return e.trim()?e:""}async function i(){try{return!!(await t.k.get("/api/user")).confirmBeforeImport}catch{return!1}}async function a(e,i){let a=await t.k.post("/api/error-items",{questionText:e.questionText,answerText:n(e.answerText),analysis:n(e.analysis),wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",knowledgePoints:e.knowledgePoints||[],difficultyStars:e.difficultyStars??null,recognizedGradeSemester:e.gradeSemester??null,hasFigure:e.hasFigure??!1,figureSvg:e.figureSvg??null,questionType:e.questionType??null,subjectId:i.subjectId||void 0,subjectName:i.subjectId?void 0:e.subject,originalImageUrl:i.imageUrl||"",paperLevel:i.paperLevel||void 0});return{id:a.id,shortId:a.shortId??null,subjectId:a.subjectId??null,notebookName:a.subject?.name??null,duplicate:a.duplicate}}e.i(201276),e.s(["x",0,i,"a",0,a],25197)},825624,e=>{let t=/^[\s  ]+/,n="一二三四五六七八九十",i=[{family:"dot",pattern:/^(\d{1,3})\s*(?:.|\.(?!\d))\s*/},{family:"comma",pattern:/^(\d{1,3})\s*[、,,](?!\d)\s*/},{family:"paren",pattern:/^(\d{1,3})\s*[))]\s*/},{family:"colon",pattern:/^(\d{1,3})\s*[::](?!\d)\s*/},{family:"ti",pattern:/^第\s*(\d{1,3}|[一二三四五六七八九十]{1,3})\s*题\s*[..、::]?\s*/},{family:"example",pattern:/^(?:例题?|练习|习题)\s*(\d{1,3})\s*[..、::]?\s*/},{family:"q",pattern:/^(?:Q|Question|Problem|Exercise)\s*(\d{1,3})\s*[..::)]?\s+/i},{family:"cn",pattern:/^([一二三四五六七八九十]{1,3})\s*[、..]\s*/}];function a(e){let a=e.replace(t,"");for(let{family:e,pattern:t}of i){let i=a.match(t);if(!i||a.length<=i[0].length)continue;let r=function(e){if(/^\d+$/.test(e))return Number(e);if("十"===e)return 10;let t=e.indexOf("十");return -1===t?n.indexOf(e)+1:10*(0===t?1:n.indexOf(e[0])+1)+(t===e.length-1?0:n.indexOf(e[t+1])+1)}(i[1]);if(Number.isFinite(r)&&!(r<=0))return{value:r,family:e,prefixLength:i[0].length,label:i[1]}}return null}function r(e){let n=e.split("\n"),i=n[0]?.replace(t,"")??"",r=a(i);return r&&"cn"!==r.family&&(n[0]=i.slice(r.prefixLength)),n.join("\n")}function l(e){let t=[];for(let n of e)(n||0!==t.length&&""!==t[t.length-1])&&t.push(n);for(;t.length>0&&""===t[t.length-1];)t.pop();return t.join("\n")}let o=/(姓名|班级|学号|日期|得分|分数|评分|考号|座位号|家长签字|用时|Name\s*[::_]|Class\s*[::_]|Date\s*[::_]|Score\s*[::_])|_{3,}|共\s*\d+\s*(道|题|小题)|做完|答案(见|在)|最后一页|满分\s*\d+\s*分/i,s=/(阅读|材料|短文|文章|选文|诗歌|古诗|文言文|下[面列]的?(表格|图表|统计|信息)|根据.{0,20}(回答|完成)|passage|read the|according to the)/i,h=/^(参考答案|答案与解析|答案|Answers?|Answer Key)\s*[::]?$/i,c=/^(第[一二三四五六七八九十]+(部分|大题|节)|(Part|Section)\s+[A-Z0-9IVX]+\b)/i,u=/(选择|填空|判断|计算|解答|应用|解决问题|操作|作图|阅读|写作|作文|综合|口算|听力|单项|完形|题)/,d=/(\d{1,3})\s*[~~\-—–至到]\s*(\d{1,3})\s*(?:小?题|questions?)/i,g=/(小问|小题|下列问题|以下问题|下列各题|下面各题|完成下列|回答下列|回答以下|following questions|answer the following)/i;function m(e){let t=[],n=[];for(let i of e)i?n.push(i):n.length&&(t.push(n.join("\n")),n=[]);return n.length&&t.push(n.join("\n")),t}function f(e,t){let n=[];for(let i=0;i<e.length;i++){let a=e[i],r=[a];for(let n=i+1;n<e.length;n++){let i=e[n],l=r[r.length-1];if(i.family!==a.family)continue;let o=1===i.value&&[...t].some(e=>e>l.line&&e<i.line);(i.value===l.value+1||o)&&r.push(i)}r.length>n.length&&(n=r)}return n}function p(e,t,n){return!!c.test(e)||!!t&&"cn"===t.family&&"cn"!==n&&null!==n&&(e.length<=40||u.test(e.slice(0,20)))}function w(e){let t=e.match(d);if(!t)return null;let n=Number(t[1]),i=Number(t[2]);return n<=i?{from:n,to:i}:null}let y={answer:/^(?:【\s*(?:参考答案|答案)\s*】|(?:参考答案|答案)\s*[::]|Answer\s*[::])\s*(.*)$/i,analysis:/^(?:【\s*(?:解析|分析|详解|解答|点评)\s*】|(?:解析|分析|详解|解答|点评)\s*[::])\s*(.*)$/,knowledge:/^(?:【\s*(?:知识点|考点)\s*】|(?:知识点|考点)\s*[::])\s*(.*)$/,difficulty:/^(?:【\s*难度\s*】|难度\s*[::])\s*(.*)$/,questionType:/^(?:【\s*题型\s*】|题型\s*[::])\s*(.*)$/,wrongAnswer:/^(?:【\s*错答\s*】|我的答案\s*[::]|学生答案\s*[::])\s*(.*)$/},x={易:1,较易:2,中等:3,较难:4,难:5};function b(e){return e.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean)}function v(e){let t={answer:[],analysis:[],knowledge:[],difficulty:[],questionType:[],wrongAnswer:[]},n=[],i=null;for(let a of e){let e=null;for(let n of Object.keys(y)){let r=a.match(y[n]);if(!r)continue;e=n,i=n;let l=r[1].trim();l&&t[n].push(l);break}e||(i&&a.trim()?t[i].push(a.trim()):n.push(a))}let a={},r=t.answer.join("\n").trim();r&&(a.answer=r);let o=t.analysis.join("\n").trim();o&&(a.analysis=o);let s=t.knowledge.flatMap(b);s.length&&(a.knowledgePoints=s);let h=t.difficulty.join(" ").trim(),c=h?function(e){let t=e.trim();if(!t)return null;let n=t.match(/^(\d{1,2})\s*(?:星|级)?$/);if(n){let e=Number(n[1]);return e>=1&&e<=5?e:null}if(/^[★☆]{1,5}$/.test(t)){let e=(t.match(/★/g)??[]).length;return e>=1?e:null}return t in x?x[t]:null}(h):null;null!==c&&(a.difficultyStars=c);let u=t.questionType.join(" ").trim();u&&(a.questionType=u);let d=t.wrongAnswer.join("\n").trim();return d&&(a.wrongAnswer=d),{text:l(n),fields:a}}let C=/^(\d{1,3})\s*[..、,,)]\s*(\S[\s\S]*)$/,M=/^(\d{1,3})\s*[~~—–-]\s*(\d{1,3})\s*[::..、]?\s*([A-Za-z]+)$/;function D(e,t){let n=[],i=!1;for(let a of e){let e={value:!1},r=[];for(let n of a.split("\n")){let i=n.trim()?function(e){let t=e.trim();if(!t)return null;let n=function(e){let t=e.trim().match(M);if(!t)return null;let n=Number(t[1]),i=Number(t[2]),a=t[3];if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=n||i-n+1>60)return null;let r=i-n+1;return a.length!==r?null:Array.from({length:r},(e,t)=>({label:String(n+t),text:a[t]}))}(t);if(n)return n;let i=function(e){let t=e.trim(),n=[];for(let e of t.matchAll(/(\d{1,3})\s*[..、,,;;]\s*/g)){let i=e.index??0,a=t[i+e[0].length];a&&/\d/.test(a)||n.push({index:i,label:e[1],afterIndex:i+e[0].length})}if(n.length<2)return null;for(let e=1;e<n.length;e++)if(Number(n[e].label)<=Number(n[e-1].label))return null;let i=[];for(let e=0;e<n.length;e++){let a=n[e].afterIndex,r=e+1<n.length?n[e+1].index:t.length,l=t.slice(a,r).trim().replace(/[;;]+$/,"").trim();if(!l||l.length>30||/[。!?!?]/.test(l))return null;i.push({label:n[e].label,text:l})}return i}(t);if(i)return i.map(e=>({label:e.label??"",text:e.text})).filter(e=>e.label);let a=t.match(C);if(!a)return null;let r=Number(a[1]);return!Number.isFinite(r)||r<=0?null:[{label:a[1],text:a[2].trim()}]}(n):null;if(!i){n.trim()&&r.push(n);continue}let a=!1;for(let l of i){let i=t.find(e=>e.label===l.label);if(!i){r.push(n);break}a=!0,e.value=!0;let o=function(e){let t=e.match(/^(.*?)(?:【?\s*(?:解析|分析|详解|解答|点评)\s*】?\s*[::])([\s\S]*)$/);if(t){let n=t[1].replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim(),i=t[2].trim();return i?{answer:n,analysis:i}:{answer:e.trim()}}return{answer:e.replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim()||e.trim()}}(l.text);o.answer&&!i.answer&&(i.answer=o.answer),o.analysis&&(i.analysis=i.analysis?`${i.analysis}
7
- ${o.analysis}`:o.analysis)}!a&&!r.includes(n)&&n.trim()&&!r.includes(n)&&r.push(n)}i=i||e.value,e.value?r.length&&n.push(r.join("\n")):n.push(a)}return[n,i]}e.s(["k",0,2e3,"f",0,1e6,"S",0,60,"i",0,2e4,"J",0,function(e,n={}){let i,u=void 0===n.maxLength?2e4:Math.min(Math.max(n.maxLength,1e3),1e6),y=void 0===n.maxQuestions?60:Math.min(Math.max(n.maxQuestions,2),2e3),x=e.length>u,b=e.slice(0,u).replace(/\r\n?/g,"\n").split("\n").map(e=>e.replace(t,"").replace(/[\s ]+$/,"")),C=b.map(e=>e?a(e):null),M=b.length;for(let e=0;e<b.length;e++)if(h.test(b[e])){M=e;break}let _=[],k=[];for(let e=0;e<M;e++){let t=C[e];t&&("cn"===t.family?k:_).push({...t,line:e})}let E=new Set;for(let e=0;e<M;e++)(c.test(b[e])||C[e]?.family==="cn")&&E.add(e);let R=f(_,E);if(R.length<2){let e=f(k,new Set);e.length>=2&&(R=e)}let I=l(b.slice(0,M)),$=M<b.length?m(b.slice(M)):[],P=(i=a(b[R[0]?.line??0]??""))?i.label:null,S=e=>({questions:I?[{label:P,text:I,material:null,section:null,lineRange:{from:0,to:M}}]:[],ignored:$,detected:!1,ambiguous:e,candidateCount:e?R.length:+!!I,overflow:0,tooLong:x});if(R.length<2){if(!I)return S(!1);let e=v(I.split("\n")),t=S(!1);if(t.questions.length>0&&Object.keys(e.fields).length>0&&(t.questions[0]={...t.questions[0],text:r(e.text),...e.fields}),t.questions.length>0&&$.length){let[e,n]=D($,t.questions);t.ignored=e,n||(t.ignored=$)}return t}let A=R[0].family;if(!n.forceNumbered&&function(e,t,n,i){let a=null;for(let r=t-1;r>=0;r--)if(e[r]){a=p(e[r],i[r],n)?null:e[r];break}return!(!a||o.test(a)||d.test(a))&&("paren"===n?a.length>=15||/[。?!?!::,,;;]$/.test(a):/[::]$/.test(a)&&g.test(a))}(b,R[0].line,A,C)){let e=S(!0);if(e.questions.length>0&&I){let t=v(I.split("\n"));Object.keys(t.fields).length>0&&(e.questions[0]={...e.questions[0],text:r(t.text),...t.fields})}return e}let N=new Set(R.map(e=>e.line)),L=[],j=[],O=null,U=[],H=[],B=(e,t)=>{for(let n of m(e))(!o.test(n)||!(n.length<80))&&(s.test(n)||n.length>=80&&/[。!?.!?;;]/.test(n))?U.push({text:n,range:w(n)}):t?L.push(n):O&&!j.some(e=>e.section===O)?O=`${O}
8
- ${n}`:L.push(n)},T=R[0].line,X=[];for(let e=0;e<T;e++)b[e]&&p(b[e],C[e],A)?(B(X.splice(0),!0),O=b[e],H=[]):X.push(b[e]);B(X,!0);for(let e=0;e<R.length;e++){let t=R[e].line,n=e+1<R.length?R[e+1].line:M;U.length&&(H=[...H.filter(e=>e.range),...U],U=[]);let i=n,a=null;for(let e=t+1;e<n;e++)if(b[e]&&!N.has(e)&&p(b[e],C[e],A)){i=e,a=b[e];break}let o=b.slice(t,i),h=m(o),c=[];for(;h.length>1&&s.test(h[h.length-1].slice(0,30));)c.unshift(h.pop());let u=c.length?h.join("\n"):l(o),d=R[e].value,g=H.filter(e=>!e.range||d>=e.range.from&&d<=e.range.to),f=v(r(u).split("\n"));for(let i of(j.push({label:R[e].label,text:f.text,material:g.length?g.map(e=>e.text).join("\n\n"):null,section:O,lineRange:{from:t,to:n},...f.fields}),c))U.push({text:i,range:w(i)});null!==a&&(O=a,H=[],B(b.slice(i+1,n),!1))}let[z]=D($,j),Y=j.slice(y);return{questions:j.slice(0,y),ignored:[...L,...z,...Y.map(e=>{var t;let n,i,a,r;return n=(t=e).text.trim(),a=(i=t.material?.trim())?`${i}
6
+ Defaulting to \`null\`.`}h(w,"defaultGetValueLabel"),h(y,"getProgressState"),h(x,"isNumber"),h(b,"isValidMaxNumber"),h(v,"isValidValueNumber"),h(C,"getInvalidMaxError"),h(M,"getInvalidValueError");var D=e.i(975157);let _=r.forwardRef(({className:e,value:t,...n},i)=>(0,a.jsx)(m,{ref:i,value:t,className:(0,D.f)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:(0,a.jsx)(p,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));_.displayName=m.displayName,e.s(["f",0,_],168148)},328623,e=>{var t=e.i(456420);let n={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"]};n.node;let i=(0,t.f)(n);e.s(["f",0,i],328623)},232660,e=>{var t=e.i(271645),n={x:0,y:0,width:0,height:0,unit:"px"},i=(e,t,n)=>Math.min(Math.max(e,t),n),a=(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 r(e,t,i){return"%"===e.unit?{...n,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/i*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/i*100:0}}function l(e,t,i){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*i/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*i/100:0}:{...n,...e,unit:"px"}}function o(e,t,n,i,a,r=0,l=0,s=i,h=a){let u={...e},c=Math.min(r,i),d=Math.min(l,a),g=Math.min(s,i),f=Math.min(h,a);t&&(t>1?(d=(c=l?l*t:c)/t,g=s*t):(c=(d=r?r/t:d)*t,f=h/t)),u.y<0&&(u.height=Math.max(u.height+u.y,d),u.y=0),u.x<0&&(u.width=Math.max(u.width+u.x,c),u.x=0);let m=i-(u.x+u.width);m<0&&(u.x=Math.min(u.x,i-c),u.width+=m);let p=a-(u.y+u.height);if(p<0&&(u.y=Math.min(u.y,a-d),u.height+=p),u.width<c&&(("sw"===n||"nw"==n)&&(u.x-=c-u.width),u.width=c),u.height<d&&(("nw"===n||"ne"==n)&&(u.y-=d-u.height),u.height=d),u.width>g&&(("sw"===n||"nw"==n)&&(u.x-=g-u.width),u.width=g),u.height>f&&(("nw"===n||"ne"==n)&&(u.y-=f-u.height),u.height=f),t){let e=u.width/u.height;if(e<t){let e=Math.max(u.width/t,d);("nw"===n||"ne"==n)&&(u.y-=e-u.height),u.height=e}else if(e>t){let e=Math.max(u.height*t,c);("sw"===n||"nw"==n)&&(u.x-=e-u.width),u.width=e}}return u}var s={capture:!0,passive:!1},h=0,u=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:n,width:i,height:a}=e.getBoundingClientRect();return{x:t,y:n,width:i,height:a}}componentDidUpdate(e){let{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){let{width:e,height:i}=this.getBox();e&&i&&n(l(t,e,i),r(t,e,i))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,s),this.document.addEventListener("pointerup",this.onDocPointerDone,s),this.document.addEventListener("pointercancel",this.onDocPointerDone,s),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,s),this.document.removeEventListener("pointerup",this.onDocPointerDone,s),this.document.removeEventListener("pointercancel",this.onDocPointerDone,s),!1)}onCropPointerDown=e=>{let{crop:t,disabled:n}=this.props,i=this.getBox();if(!t)return;let a=l(t,i.width,i.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let r=e.target.dataset.ord,o=e.clientX,s=e.clientY,h=a.x,u=a.y;if(r){let t=e.clientX-i.x,n=e.clientY-i.y,l=0,c=0;"ne"===r||"e"==r?(l=t-(a.x+a.width),c=n-a.y,h=a.x,u=a.y+a.height):"se"===r||"s"===r?(l=t-(a.x+a.width),c=n-(a.y+a.height),h=a.x,u=a.y):"sw"===r||"w"==r?(l=t-a.x,c=n-(a.y+a.height),h=a.x+a.width,u=a.y):("nw"===r||"n"==r)&&(l=t-a.x,c=n-a.y,h=a.x+a.width,u=a.y+a.height),o=h+i.x+l,s=u+i.y+c}this.evData={startClientX:o,startClientY:s,startCropX:h,startCropY:u,clientX:e.clientX,clientY:e.clientY,isResize:!!r,ord:r},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:n,locked:i,keepSelection:a,onChange:o}=this.props,s=this.getBox();if(n||i||a&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-s.x,u=e.clientY-s.y,c={unit:"px",x:h,y:u,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:u,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(l(c,s.width,s.height),r(c,s.width,s.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:n,disabled:i,onChange:o,onDragStart:s}=this.props,h=this.getBox();if(i||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));let{evData:u}=this;u.clientX=e.clientX,u.clientY=e.clientY,a(n,t=u.isResize?this.resizeCrop():this.dragCrop())||o(l(t,h.width,h.height),r(t,h.width,h.height))};onComponentKeyDown=t=>{let{crop:n,disabled:a,onChange:o,onComplete:s}=this.props;if(a)return;let h=t.key,u=!1;if(!n)return;let c=this.getBox(),d=this.makePixelCrop(c),g=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===h?(d.x-=g,u=!0):"ArrowRight"===h?(d.x+=g,u=!0):"ArrowUp"===h?(d.y-=g,u=!0):"ArrowDown"===h&&(d.y+=g,u=!0),u){t.cancelable&&t.preventDefault(),d.x=i(d.x,0,c.width-d.width),d.y=i(d.y,0,c.height-d.height);let e=l(d,c.width,c.height),n=r(d,c.width,c.height);o(e,n),s&&s(e,n)}};onHandlerKeyDown=(t,n)=>{var i,s;let h,{aspect:u=0,crop:c,disabled:d,minWidth:g=0,minHeight:f=0,maxWidth:m,maxHeight:p,onChange:w,onComplete:y}=this.props,x=this.getBox();if(d||!c||"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=o((i=l(c,x.width,x.height),s=t.key,h={...i},"ArrowLeft"===s?"nw"===n?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"w"===n?(h.x-=b,h.width+=b):"sw"===n?(h.x-=b,h.width+=b,h.height+=b):"ne"===n?(h.y+=b,h.width-=b,h.height-=b):"e"===n?h.width-=b:"se"===n&&(h.width-=b,h.height-=b):"ArrowRight"===s&&("nw"===n?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"w"===n?(h.x+=b,h.width-=b):"sw"===n?(h.x+=b,h.width-=b,h.height-=b):"ne"===n?(h.y-=b,h.width+=b,h.height+=b):"e"===n?h.width+=b:"se"===n&&(h.width+=b,h.height+=b)),"ArrowUp"===s?"nw"===n?(h.x-=b,h.y-=b,h.width+=b,h.height+=b):"n"===n?(h.y-=b,h.height+=b):"ne"===n?(h.y-=b,h.width+=b,h.height+=b):"sw"===n?(h.x+=b,h.width-=b,h.height-=b):"s"===n?h.height-=b:"se"===n&&(h.width-=b,h.height-=b):"ArrowDown"===s&&("nw"===n?(h.x+=b,h.y+=b,h.width-=b,h.height-=b):"n"===n?(h.y+=b,h.height-=b):"ne"===n?(h.y+=b,h.width-=b,h.height-=b):"sw"===n?(h.x-=b,h.width+=b,h.height+=b):"s"===n?h.height+=b:"se"===n&&(h.width+=b,h.height+=b)),h),u,n,x.width,x.height,g,f,m,p);if(!a(c,v)){let e=r(v,x.width,x.height);w(v,e),y&&y(v,e)}};onDocPointerDone=e=>{let{crop:t,disabled:n,onComplete:i,onDragEnd:a}=this.props,o=this.getBox();this.unbindDocMove(),!(n||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,a&&a(e),i&&i(l(t,o.width,o.height),r(t,o.width,o.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(),n=this.makePixelCrop(t),a=e.clientX-e.startClientX,r=e.clientY-e.startClientY;return n.x=i(e.startCropX+a,0,t.width-n.width),n.y=i(e.startCropY+r,0,t.height-n.height),n}getPointRegion(e,t,n,i){let{evData:a}=this,r=a.clientX-e.x,l=a.clientY-e.y,o;return o=i&&t?"nw"===t||"n"===t||"ne"===t:l<a.startCropY,(n&&t?"nw"===t||"w"===t||"sw"===t:r<a.startCropX)?o?"nw":"sw":o?"ne":"se"}resolveMinDimensions(e,t,n=0,i=0){let a=Math.min(n,e.width),r=Math.min(i,e.height);return t&&(a||r)?t>1?a?[a,a/t]:[r*t,r]:r?[r*t,r]:[a,a/t]:[a,r]}resizeCrop(){let{evData:t}=this,{aspect:n=0,maxWidth:a,maxHeight:r}=this.props,l=this.getBox(),[s,h]=this.resolveMinDimensions(l,n,this.props.minWidth,this.props.minHeight),u=this.makePixelCrop(l),c=this.getPointRegion(l,t.ord,s,h),d=t.ord||c,g=t.clientX-t.startClientX,f=t.clientY-t.startClientY;(s&&"nw"===d||"w"===d||"sw"===d)&&(g=Math.min(g,-s)),(h&&"nw"===d||"n"===d||"ne"===d)&&(f=Math.min(f,-h));let m={unit:"px",x:0,y:0,width:0,height:0};"ne"===c?(m.x=t.startCropX,m.width=g,n?m.height=m.width/n:m.height=Math.abs(f),m.y=t.startCropY-m.height):"se"===c?(m.x=t.startCropX,m.y=t.startCropY,m.width=g,n?m.height=m.width/n:m.height=f):"sw"===c?(m.x=t.startCropX+g,m.y=t.startCropY,m.width=Math.abs(g),n?m.height=m.width/n:m.height=f):"nw"===c&&(m.x=t.startCropX+g,m.width=Math.abs(g),n?(m.height=m.width/n,m.y=t.startCropY-m.height):(m.height=Math.abs(f),m.y=t.startCropY+f));let p=o(m,n,c,l.width,l.height,s,h,a,r);return n||e.xyOrds.indexOf(d)>-1?u=p:e.xOrds.indexOf(d)>-1?(u.x=p.x,u.width=p.width):e.yOrds.indexOf(d)>-1&&(u.y=p.y,u.height=p.height),u.x=i(u.x,0,l.width-u.width),u.y=i(u.y,0,l.height-u.height),u}renderCropSelection(){let{ariaLabels:n=e.defaultProps.ariaLabels,disabled:i,locked:a,renderSelectionAddon:r,ruleOfThirds:l,crop:o}=this.props,s=this.getCropStyle();if(o)return t.default.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":n.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!i&&!a&&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":n.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":n.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":n.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":n.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":n.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":n.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":n.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":n.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),r&&t.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},r(this.state)),l&&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 l({...n,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:n,circularCrop:i,className:a,crop:r,disabled:l,locked:o,style:s,ruleOfThirds:h}=this.props,{cropIsActive:u,newCropIsBeingDrawn:c}=this.state,d=r?this.renderCropSelection():null,g=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",a,u&&"ReactCrop--active",l&&"ReactCrop--disabled",o&&"ReactCrop--locked",c&&"ReactCrop--new-crop",r&&e&&"ReactCrop--fixed-aspect",r&&i&&"ReactCrop--circular-crop",r&&h&&"ReactCrop--rule-of-thirds",!this.dragStarted&&r&&!r.width&&!r.height&&"ReactCrop--invisible-crop",i&&"ReactCrop--no-animate");return t.default.createElement("div",{ref:this.componentRef,className:g,style:s},t.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),r?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"}),i?t.default.createElement("ellipse",{cx:`${r.x+r.width/2}${r.unit}`,cy:`${r.y+r.height/2}${r.unit}`,rx:`${r.width/2}${r.unit}`,ry:`${r.height/2}${r.unit}`,fill:"black"}):t.default.createElement("rect",{x:`${r.x}${r.unit}`,y:`${r.y}${r.unit}`,width:`${r.width}${r.unit}`,height:`${r.height}${r.unit}`,fill:"black"}))),t.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,d)}};e.s(["f",0,u])},213761,e=>{let t={maxLongEdge:4096,maxPixels:4915200,maxBytes:1572864,startQuality:.9,minQuality:.8};class n extends Error{code;format;constructor(e,t,n){super(e,void 0===n?void 0:{cause:n}),this.code=e,this.format=t,this.name="ImageDecodeError"}}let i=new Set(["heic","heix","heim","heis","hevc","hevx","hevm","hevs"]),a=new Set(["mif1","msf1","mif2"]),r=new Set(["avif","avis"]);function l(e,n,i=t){let a=Math.min(1,i.maxLongEdge/Math.max(e,n),Math.sqrt(i.maxPixels/Math.max(1,e*n)));return{width:Math.max(1,Math.floor(e*a)),height:Math.max(1,Math.floor(n*a)),scale:a}}async function o(e){let t,n;if("function"==typeof createImageBitmap)try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch{}let i=await (t=URL.createObjectURL(e),(n=new Image).decoding="async",new Promise((e,i)=>{n.onload=()=>e(n),n.onerror=()=>i(Error("IMAGE_ELEMENT_DECODE_FAILED")),n.src=t}).finally(()=>URL.revokeObjectURL(t)));if(!i.naturalWidth||!i.naturalHeight)throw Error("IMAGE_EMPTY");return i}async function s(t){let{heicTo:n}=await e.A(462684);return n({blob:t,type:"image/jpeg",quality:.95})}function h(e,t){return new Promise((n,i)=>{e.toBlob(e=>e?n(e):i(Error("CANVAS_EMPTY")),"image/jpeg",t)})}function u(e,t,n,i,a,r,l){let o,s=((o=document.createElement("canvas")).width=r,o.height=l,o),h=s.getContext("2d");if(!h)throw Error("CANVAS_UNSUPPORTED");return h.fillStyle="#ffffff",h.fillRect(0,0,r,l),h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(e,t,n,i,a,0,0,r,l),s}async function c(e,t){var c;let d,g=performance.now(),f=await e.arrayBuffer(),m=performance.now()-g,p=function(e){let t=(t,n)=>String.fromCharCode(...e.subarray(t,n));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 n=Math.min(e.length,(e[0]<<24|e[1]<<16|e[2]<<8|e[3])>>>0||e.length),l=[t(8,12)];for(let e=16;e+4<=n;e+=4)l.push(t(e,e+4));if(l.some(e=>i.has(e)))return"heic";if(l.some(e=>r.has(e)))return"avif";if(l.some(e=>a.has(e)))return"heic"}return"unknown"}(new Uint8Array(f,0,Math.min(f.byteLength,64))),w=e.type||"",y=performance.now(),x="native",b=new Blob([f],{type:w||"application/octet-stream"});try{d=await o(b)}catch(e){if("heic"!==p)throw new n("unknown"===p?"UNSUPPORTED_IMAGE":"IMAGE_DECODE_FAILED",p,e);t?.();try{d=await o(await s(b)),x="heic"}catch(e){throw new n("HEIC_DECODE_FAILED",p,e)}}let{width:v,height:C}=(c=d)instanceof HTMLImageElement?{width:c.naturalWidth,height:c.naturalHeight}:{width:c.width,height:c.height};if(!v||!C)throw new n("IMAGE_DECODE_FAILED",p);let M=l(v,C,{maxLongEdge:1600,maxPixels:1/0}),D=await h(u(d,0,0,v,C,M.width,M.height),.85),_=URL.createObjectURL(D),k=performance.now()-y;return{source:d,width:v,height:C,format:p,decoder:x,previewUrl:_,sourceType:w,sourceBytes:e.size,timings:{read:Math.round(m),convert:Math.round(k)},dispose:()=>{URL.revokeObjectURL(_),d instanceof HTMLImageElement||d.close()}}}let d={x:0,y:0,width:1,height:1};async function g(e,n=d,i=t){var a;let r=performance.now(),o=e=>Math.min(1,Math.max(0,e)),s=Math.round(o(n.x)*e.width),c=Math.round(o(n.y)*e.height),f=Math.max(1,Math.min(e.width-s,Math.round(o(n.width)*e.width))),m=Math.max(1,Math.min(e.height-c,Math.round(o(n.height)*e.height))),p=l(f,m,i),w=u(e.source,s,c,f,m,p.width,p.height),y=performance.now()-r,x=performance.now(),b=i.startQuality,v=await h(w,b);for(let t=0;v.size>i.maxBytes&&t<12;t++)b-.05>=i.minQuality-1e-9?b=Math.round((b-.05)*100)/100:(p={width:Math.max(1,Math.floor(.85*p.width)),height:Math.max(1,Math.floor(.85*p.height)),scale:.85*p.scale},w=u(e.source,s,c,f,m,p.width,p.height)),v=await h(w,b);return{dataUrl:await (a=v,new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>t(n.error??Error("READ_FAILED")),n.readAsDataURL(a)})),width:p.width,height:p.height,bytes:v.size,quality:b,timings:{crop:Math.round(y),compress:Math.round(performance.now()-x)}}}e.s(["K",0,t,"o",0,n,"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,c,"X",0,g])},499930,e=>{var t=e.i(213761);function n(e,t=.008){let i=Math.max(0,e.x-t),a=Math.max(0,e.y-t);return{x:i,y:a,width:Math.min(1,e.x+e.width+t)-i,height:Math.min(1,e.y+e.height+t)-a}}async function i(e){let t=new Image;if(t.decoding="async",t.src=e,await t.decode(),!t.naturalWidth||!t.naturalHeight)throw Error("IMAGE_EMPTY");return t}async function a(e,n){let i=function(e,t=16,n=!1){let i=Math.max(...e.map(e=>e.width)),a=0,r=e.map(e=>{let r=n?i/e.width:e.scale??1,l={x:0,y:a,width:Math.round(e.width*r),height:Math.round(e.height*r)};return a+=l.height+t,l});return{width:Math.max(...r.map(e=>e.width)),height:a-t,rects:r}}(e.map(e=>({width:e.sw,height:e.sh,scale:e.scale})),16,n),a=document.createElement("canvas");a.width=i.width,a.height=i.height;let r=a.getContext("2d");if(!r)throw Error("CANVAS_UNSUPPORTED");r.fillStyle="#ffffff",r.fillRect(0,0,a.width,a.height),e.forEach((e,t)=>{let n=i.rects[t];r.drawImage(e.source,e.sx,e.sy,e.sw,e.sh,n.x,n.y,n.width,n.height)});let l=await createImageBitmap(a);try{return await (0,t.X)({source:l,width:a.width,height:a.height})}finally{l.close()}}async function r(e,i){let r=e.naturalWidth,l=e.naturalHeight,o=i.map(e=>n(e));return 1===o.length?(0,t.X)({source:e,width:r,height:l},o[0]):a(o.map(t=>({source:e,sx:Math.round(t.x*r),sy:Math.round(t.y*l),sw:Math.max(1,Math.round(t.width*r)),sh:Math.max(1,Math.round(t.height*l))})),!1)}async function l(e){return a((await Promise.all(e.map(i))).map(e=>({source:e,sx:0,sy:0,sw:e.naturalWidth,sh:e.naturalHeight})),!0)}async function o(e,t,i){let r=e.naturalWidth,l=e.naturalHeight,o=i.width/r,s=t.map(e=>n(e)).map(t=>({source:e,sx:Math.round(t.x*r),sy:Math.round(t.y*l),sw:Math.max(1,Math.round(t.width*r)),sh:Math.max(1,Math.round(t.height*l)),scale:o}));return s.push({source:i.source,sx:0,sy:0,sw:i.width,sh:i.height}),a(s,!1)}e.s(["y",0,i,"k",0,o,"M",0,r,"v",0,l])},119472,e=>{var t=e.i(41931),n=e.i(127175);async function i(e){let t;for(let n=0;n<3;n++)try{return await e()}catch(e){if(t=e,!function(e){let t=e?.status;return void 0===t||408===t||502===t||503===t||504===t}(e)||2===n)break;await new Promise(e=>setTimeout(e,1e3*(n+1)))}throw t}async function a(e,r=(0,n.c)()){let{batch:l}=await i(()=>t.k.post("/api/import-batches",{...e,clientRequestId:r,subjectId:e.subjectId||void 0,targetSubjectId:e.targetSubjectId||void 0,paperLevel:e.paperLevel||void 0,items:e.items?.map(e=>({...e})),origin:e.origin},{timeout:12e4}));return(0,n.P)(),l}async function r(e,n={}){let i=n.image?"?include=image":"",{batch:a}=await t.k.get(`/api/import-batches/${encodeURIComponent(e)}${i}`);return a}async function l(e,n,i){let{batch:a}=await t.k.patch(`/api/import-batches/${encodeURIComponent(e)}`,{version:n,draft:i});return a}async function o(e,a,r,l){let{batch:o}=await i(()=>t.k.post(`/api/import-batches/${encodeURIComponent(e)}/start`,{version:a,images:r,analysis:l},{timeout:12e4}));return(0,n.P)(),o}async function s(e){let{batch:i}=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/retry`,{});return(0,n.P)(),i}async function h(e){let i=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/confirm-all`,{});return(0,n.P)(),i}async function u(e){await t.k.delete(`/api/import-batches/${encodeURIComponent(e)}`),(0,n.P)()}async function c(e){await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/read`,{}),(0,n.P)()}async function d(e,n,i){return t.k.post(`/api/import-batches/${encodeURIComponent(e)}/fix-text`,{items:n},{timeout:6e5,recoverable:!0,requestId:i})}e.s(["J",0,h,"n",0,function(e){return e?.status===409?e.data?.details?.batch??null:null},"v",0,a,"o",0,u,"w",0,r,"$",0,d,"f",0,c,"s",0,s,"S",0,l,"g",0,o])},25197,e=>{var t=e.i(41931);function n(e){return e.trim()?e:""}async function i(){try{return!!(await t.k.get("/api/user")).confirmBeforeImport}catch{return!1}}async function a(e,i){let a=await t.k.post("/api/error-items",{questionText:e.questionText,answerText:n(e.answerText),analysis:n(e.analysis),wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",knowledgePoints:e.knowledgePoints||[],difficultyStars:e.difficultyStars??null,recognizedGradeSemester:e.gradeSemester??null,hasFigure:e.hasFigure??!1,figureSvg:e.figureSvg??null,questionType:e.questionType??null,subjectId:i.subjectId||void 0,subjectName:i.subjectId?void 0:e.subject,originalImageUrl:i.imageUrl||"",paperLevel:i.paperLevel||void 0});return{id:a.id,shortId:a.shortId??null,subjectId:a.subjectId??null,notebookName:a.subject?.name??null,duplicate:a.duplicate}}e.i(201276),e.s(["x",0,i,"a",0,a],25197)},825624,e=>{let t=/^[\s  ]+/,n="一二三四五六七八九十",i=[{family:"dot",pattern:/^(\d{1,3})\s*(?:.|\.(?!\d))\s*/},{family:"comma",pattern:/^(\d{1,3})\s*[、,,](?!\d)\s*/},{family:"paren",pattern:/^(\d{1,3})\s*[))]\s*/},{family:"colon",pattern:/^(\d{1,3})\s*[::](?!\d)\s*/},{family:"ti",pattern:/^第\s*(\d{1,3}|[一二三四五六七八九十]{1,3})\s*题\s*[..、::]?\s*/},{family:"example",pattern:/^(?:例题?|练习|习题)\s*(\d{1,3})\s*[..、::]?\s*/},{family:"q",pattern:/^(?:Q|Question|Problem|Exercise)\s*(\d{1,3})\s*[..::)]?\s+/i},{family:"cn",pattern:/^([一二三四五六七八九十]{1,3})\s*[、..]\s*/}];function a(e){let a=e.replace(t,"");for(let{family:e,pattern:t}of i){let i=a.match(t);if(!i||a.length<=i[0].length)continue;let r=function(e){if(/^\d+$/.test(e))return Number(e);if("十"===e)return 10;let t=e.indexOf("十");return -1===t?n.indexOf(e)+1:10*(0===t?1:n.indexOf(e[0])+1)+(t===e.length-1?0:n.indexOf(e[t+1])+1)}(i[1]);if(Number.isFinite(r)&&!(r<=0))return{value:r,family:e,prefixLength:i[0].length,label:i[1]}}return null}function r(e){let n=e.split("\n"),i=n[0]?.replace(t,"")??"",r=a(i);return r&&"cn"!==r.family&&(n[0]=i.slice(r.prefixLength)),n.join("\n")}function l(e){let t=[];for(let n of e)(n||0!==t.length&&""!==t[t.length-1])&&t.push(n);for(;t.length>0&&""===t[t.length-1];)t.pop();return t.join("\n")}let o=/(姓名|班级|学号|日期|得分|分数|评分|考号|座位号|家长签字|用时|Name\s*[::_]|Class\s*[::_]|Date\s*[::_]|Score\s*[::_])|_{3,}|共\s*\d+\s*(道|题|小题)|做完|答案(见|在)|最后一页|满分\s*\d+\s*分/i,s=/(阅读|材料|短文|文章|选文|诗歌|古诗|文言文|下[面列]的?(表格|图表|统计|信息)|根据.{0,20}(回答|完成)|passage|read the|according to the)/i,h=/^(参考答案|答案与解析|答案|Answers?|Answer Key)\s*[::]?$/i,u=/^(第[一二三四五六七八九十]+(部分|大题|节)|(Part|Section)\s+[A-Z0-9IVX]+\b)/i,c=/(选择|填空|判断|计算|解答|应用|解决问题|操作|作图|阅读|写作|作文|综合|口算|听力|单项|完形|题)/,d=/(\d{1,3})\s*[~~\-—–至到]\s*(\d{1,3})\s*(?:小?题|questions?)/i,g=/(小问|小题|下列问题|以下问题|下列各题|下面各题|完成下列|回答下列|回答以下|following questions|answer the following)/i;function f(e){let t=[],n=[];for(let i of e)i?n.push(i):n.length&&(t.push(n.join("\n")),n=[]);return n.length&&t.push(n.join("\n")),t}function m(e,t=[]){let n=e.trim();return!(!n||n.length>12||/[。!?!?,,、;;::..()()【】\[\]{}]$/.test(n)||/\d/.test(n)||/[。!?!?;;,,]/.test(n))&&!!(/(篇|章|节|部分|组)$/.test(n)||/^(Part|Section)\s+[A-Z0-9]+$/i.test(n))&&(!t.length||t.some(e=>{let t=a(e);return null!==t&&1===t.value}))}function p(e,t){let n=[];for(let i=0;i<e.length;i++){let a=e[i],r=[a];for(let n=i+1;n<e.length;n++){let i=e[n],l=r[r.length-1];if(i.family!==a.family)continue;let o=1===i.value&&[...t].some(e=>e>l.line&&e<i.line);(i.value===l.value+1||o)&&r.push(i)}r.length>n.length&&(n=r)}return n}function w(e,t,n){return!!u.test(e)||!!t&&"cn"===t.family&&"cn"!==n&&null!==n&&(e.length<=40||c.test(e.slice(0,20)))}function y(e,t,n,i,a){for(let r=e-1;r>=0;r--)if(t[r]){if(a.has(r)||w(t[r],n[r],i)||m(t[r]))return t[r];break}return null}function x(e){let t=e.match(d);if(!t)return null;let n=Number(t[1]),i=Number(t[2]);return n<=i?{from:n,to:i}:null}let b={answer:/^(?:【\s*(?:参考答案|答案)\s*】|(?:参考答案|答案)\s*[::]|Answer\s*[::])\s*(.*)$/i,analysis:/^(?:【\s*(?:解析|分析|详解|解答|点评)\s*】|(?:解析|分析|详解|解答|点评)\s*[::])\s*(.*)$/,knowledge:/^(?:【\s*(?:知识点|考点)\s*】|(?:知识点|考点)\s*[::])\s*(.*)$/,difficulty:/^(?:【\s*难度\s*】|难度\s*[::])\s*(.*)$/,questionType:/^(?:【\s*题型\s*】|题型\s*[::])\s*(.*)$/,wrongAnswer:/^(?:【\s*错答\s*】|我的答案\s*[::]|学生答案\s*[::])\s*(.*)$/},v={易:1,较易:2,中等:3,较难:4,难:5};function C(e){return e.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean)}function M(e){let t={answer:[],analysis:[],knowledge:[],difficulty:[],questionType:[],wrongAnswer:[]},n=[],i=null;for(let a of e){let e=null;for(let n of Object.keys(b)){let r=a.match(b[n]);if(!r)continue;e=n,i=n;let l=r[1].trim();l&&t[n].push(l);break}e||(i&&a.trim()?t[i].push(a.trim()):n.push(a))}let a={},r=t.answer.join("\n").trim();r&&(a.answer=r);let o=t.analysis.join("\n").trim();o&&(a.analysis=o);let s=t.knowledge.flatMap(C);s.length&&(a.knowledgePoints=s);let h=t.difficulty.join(" ").trim(),u=h?function(e){let t=e.trim();if(!t)return null;let n=t.match(/^(\d{1,2})\s*(?:星|级)?$/);if(n){let e=Number(n[1]);return e>=1&&e<=5?e:null}if(/^[★☆]{1,5}$/.test(t)){let e=(t.match(/★/g)??[]).length;return e>=1?e:null}return t in v?v[t]:null}(h):null;null!==u&&(a.difficultyStars=u);let c=t.questionType.join(" ").trim();c&&(a.questionType=c);let d=t.wrongAnswer.join("\n").trim();return d&&(a.wrongAnswer=d),{text:l(n),fields:a}}let D=/^(\d{1,3})\s*[..、,,)]\s*(\S[\s\S]*)$/,_=/^(\d{1,3})\s*[~~—–-]\s*(\d{1,3})\s*[::..、]?\s*([A-Za-z]+)$/;function k(e){let t=e.trim();if(!t)return null;let n=function(e){let t=e.trim().match(_);if(!t)return null;let n=Number(t[1]),i=Number(t[2]),a=t[3];if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=n||i-n+1>60)return null;let r=i-n+1;return a.length!==r?null:Array.from({length:r},(e,t)=>({label:String(n+t),text:a[t]}))}(t);if(n)return n;let i=function(e){let t=e.trim(),n=[];for(let e of t.matchAll(/(\d{1,3})\s*[..、,,;;]\s*/g)){let i=e.index??0,a=t[i+e[0].length];a&&/\d/.test(a)||n.push({index:i,label:e[1],afterIndex:i+e[0].length})}if(n.length<2)return null;for(let e=1;e<n.length;e++)if(Number(n[e].label)<=Number(n[e-1].label))return null;let i=[];for(let e=0;e<n.length;e++){let a=n[e].afterIndex,r=e+1<n.length?n[e+1].index:t.length,l=t.slice(a,r).trim().replace(/[;;]+$/,"").trim();if(!l||l.length>30||/[。!?!?]/.test(l))return null;i.push({label:n[e].label,text:l})}return i}(t);if(i)return i.map(e=>({label:e.label??"",text:e.text})).filter(e=>e.label);let a=t.match(D);if(!a)return null;let r=Number(a[1]);return!Number.isFinite(r)||r<=0?null:[{label:a[1],text:a[2].trim()}]}function E(e){let t=e.match(/^(.*?)(?:【?\s*(?:解析|分析|详解|解答|点评)\s*】?\s*[::])([\s\S]*)$/);if(t){let n=t[1].replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim(),i=t[2].trim();return i?{answer:n,analysis:i}:{answer:e.trim()}}return{answer:e.replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim()||e.trim()}}function R(e,t){let n=[],i=!1;for(let a of e){let e={value:!1},r=[];for(let n of a.split("\n")){let i=n.trim()?k(n):null;if(!i){n.trim()&&r.push(n);continue}let a=!1;for(let l of i){let i=t.find(e=>e.label===l.label);if(!i){r.push(n);break}a=!0,e.value=!0;let o=E(l.text);o.answer&&!i.answer&&(i.answer=o.answer),o.analysis&&(i.analysis=i.analysis?`${i.analysis}
7
+ ${o.analysis}`:o.analysis)}!a&&!r.includes(n)&&n.trim()&&!r.includes(n)&&r.push(n)}i=i||e.value,e.value?r.length&&n.push(r.join("\n")):n.push(a)}return[n,i]}e.s(["k",0,2e3,"f",0,1e6,"S",0,60,"i",0,2e4,"J",0,function(e,n={}){let i,c,b=void 0===n.maxLength?2e4:Math.min(Math.max(n.maxLength,1e3),1e6),v=void 0===n.maxQuestions?60:Math.min(Math.max(n.maxQuestions,2),2e3),C=e.length>b,D=e.slice(0,b).replace(/\r\n?/g,"\n").split("\n").map(e=>e.replace(t,"").replace(/[\s ]+$/,"")),_=D.map(e=>e?a(e):null),I=D.length;for(let e=0;e<D.length;e++)if(h.test(D[e])){I=e;break}let $=[],P=[];for(let e=0;e<I;e++){let t=_[e];t&&("cn"===t.family?P:$).push({...t,line:e})}let S=new Set;for(let e=0;e<I;e++)(u.test(D[e])||_[e]?.family==="cn"||m(D[e],D.slice(e+1,e+5)))&&S.add(e);let A=[],N=p($,S);if(N.length<2){let e=p(P,new Set);e.length>=2&&(A=[{chain:e,sectionHeading:null}])}else A=function(e,t,n,i){if(e.length<2)return[];let a=e[0].family,r=[0];for(let t=1;t<e.length;t++)1===e[t].value&&r.push(t);if(r.length<2){let r=y(e[0].line,t,n,a,i);return null!==r?[{chain:e,sectionHeading:r}]:[]}let l=[];for(let o=0;o<r.length;o++){let s=r[o],h=o+1<r.length?r[o+1]:e.length,u=e.slice(s,h),c=0===o?y(e[0].line,t,n,a,i):function(e,t,n,i,a,r){for(let l=e+1;l<t;l++)if(n[l]&&(r.has(l)||w(n[l],i[l],a)||m(n[l])))return n[l];return null}(e[s-1].line,e[s].line,t,n,a,i);if(null===c&&o>0){l[l.length-1].chain.push(...u);continue}l.push({chain:u,sectionHeading:c})}return l.filter(e=>e.chain.length>0)}(N,D,_,S);let j=A.length?A.flatMap(e=>e.chain):N,L=l(D.slice(0,I)),H=I<D.length?f(D.slice(I)):[],O=(c=a(D[j[0]?.line??0]??""))?c.label:null,U=e=>({questions:L?[{label:O,text:L,material:null,section:null,lineRange:{from:0,to:I}}]:[],ignored:H,detected:!1,ambiguous:e,candidateCount:e?j.length:+!!L,overflow:0,tooLong:C});if(j.length<2){if(!L)return U(!1);let e=M(L.split("\n")),t=U(!1);if(t.questions.length>0&&Object.keys(e.fields).length>0&&(t.questions[0]={...t.questions[0],text:r(e.text),...e.fields}),t.questions.length>0&&H.length){let[e,n]=R(H,t.questions);t.ignored=e,n||(t.ignored=H)}return t}let B=j[0].family;if(!n.forceNumbered&&function(e,t,n,i){let a=null;for(let r=t-1;r>=0;r--)if(e[r]){a=w(e[r],i[r],n)?null:e[r];break}return!(!a||o.test(a)||d.test(a))&&("paren"===n?a.length>=15||/[。?!?!::,,;;]$/.test(a):/[::]$/.test(a)&&g.test(a))}(D,j[0].line,B,_)){let e=U(!0);if(e.questions.length>0&&L){let t=M(L.split("\n"));Object.keys(t.fields).length>0&&(e.questions[0]={...e.questions[0],text:r(t.text),...t.fields})}return e}let T=new Set(j.map(e=>e.line)),X=[],z=[],Y=null,K=[],q=[],F=(e,t)=>{for(let n of f(e))(!o.test(n)||!(n.length<80))&&(s.test(n)||n.length>=80&&/[。!?.!?;;]/.test(n))?K.push({text:n,range:x(n)}):t?X.push(n):Y&&!z.some(e=>e.section===Y)?Y=`${Y}
8
+ ${n}`:X.push(n)},W=j[0].line,V=[];for(let e=0;e<W;e++)D[e]&&(w(D[e],_[e],B)||m(D[e],D.slice(e+1,e+5)))?(F(V.splice(0),!0),Y=D[e],q=[]):V.push(D[e]);F(V,!0);let G=A.length>1,Q=e=>{if(!G)return -1;let t=0;for(let n=0;n<A.length;n++)if(e<(t+=A[n].chain.length))return n;return A.length-1};for(let e=0;e<j.length;e++){let t=j[e].line,n=e+1<j.length?j[e+1].line:I,i=Q(e);if(G&&i>=0){let e=A[i].sectionHeading;null!==e&&(Y=e,q=[])}K.length&&(q=[...q.filter(e=>e.range),...K],K=[]);let a=n,o=null;for(let e=t+1;e<n;e++)if(D[e]&&!T.has(e)&&w(D[e],_[e],B)){a=e,o=D[e];break}let h=D.slice(t,a),u=f(h),c=[];for(;u.length>1&&s.test(u[u.length-1].slice(0,30));)c.unshift(u.pop());let d=c.length?u.join("\n"):l(h),g=j[e].value,m=q.filter(e=>!e.range||g>=e.range.from&&g<=e.range.to),p=M(r(d).split("\n"));for(let i of(z.push({label:j[e].label,text:p.text,material:m.length?m.map(e=>e.text).join("\n\n"):null,section:Y,lineRange:{from:t,to:n},...p.fields}),c))K.push({text:i,range:x(i)});null!==o&&(Y=o,q=[],F(D.slice(a+1,n),!1))}if(G&&H.length){let e=A.map(e=>e.sectionHeading).filter(e=>null!==e),t=H.join("\n");i=e.some(e=>t.includes(e))?function(e,t,n){let i=[],a=0,r=t.map(e=>{let t=n.slice(a,a+e.chain.length);return a+=e.chain.length,t}),l=-1;for(let a of e){let e=a.split("\n"),o=[],s=!1;for(let i of e){let e=i.trim();if(!e){o.push(i);continue}let a=t.findIndex(t=>t.sectionHeading&&e.includes(t.sectionHeading));if(a>=0){l=a;continue}let h=k(e);if(!h){o.push(i);continue}let u=l>=0?r[l]:n,c=!1;for(let e of h){let t=u.find(t=>t.label===e.label);if(!t){o.push(i);break}c=!0,s=!0;let n=E(e.text);n.answer&&!t.answer&&(t.answer=n.answer),n.analysis&&(t.analysis=t.analysis?`${t.analysis}
9
+ ${n.analysis}`:n.analysis)}c||o.includes(i)||o.push(i)}s?o.length&&i.push(o.join("\n")):i.push(a)}return i}(H,A,z):H}else i=R(H,z)[0];let Z=z.slice(v);return{questions:z.slice(0,v),ignored:[...X,...i,...Z.map(e=>{var t;let n,i,a,r;return n=(t=e).text.trim(),a=(i=t.material?.trim())?`${i}
9
10
 
10
11
  ${n}`:n,r=[],(t.answer?.trim()&&r.push(`参考答案:${t.answer.trim()}`),t.analysis?.trim()&&r.push(`参考解析:${t.analysis.trim()}`),t.wrongAnswer?.trim()&&r.push(`学生作答:${t.wrongAnswer.trim()}`),r.length)?`${a}
11
12
 
12
- ${r.join("\n\n")}`:a})],detected:!0,ambiguous:!1,candidateCount:j.length,overflow:Y.length,tooLong:x}}])},767077,e=>{var t=e.i(303163);e.s(["f",0,function(e,n){let i=n.common?.messages?.analysisFailed||"Analysis failed, please try again",a=(0,t.d)(e);if(a){let e=n.errors??{};if(!(a in e))return a;let t=e[a];return"string"==typeof t?t:i}let r=(0,t.Z)(e);if(r.includes("fetch")||r.includes("network"))return n.errors?.AI_CONNECTION_FAILED||"网络连接失败";if("object"==typeof e&&null!==e&&"data"in e&&"string"==typeof e.data){let t="status"in e&&"number"==typeof e.status?e.status:"Error";return`${i} (${t})`}return i}])},401280,e=>{let t={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"};e.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(e){if("string"!=typeof e)return null;let n=e.trim().toLowerCase();return n?t[n]??null:null}])}])})();
13
+ ${r.join("\n\n")}`:a})],detected:!0,ambiguous:!1,candidateCount:z.length,overflow:Z.length,tooLong:C}}])},767077,e=>{var t=e.i(303163);e.s(["f",0,function(e,n){let i=n.common?.messages?.analysisFailed||"Analysis failed, please try again",a=(0,t.d)(e);if(a){let e=n.errors??{};if(!(a in e))return a;let t=e[a];return"string"==typeof t?t:i}let r=(0,t.Z)(e);if(r.includes("fetch")||r.includes("network"))return n.errors?.AI_CONNECTION_FAILED||"网络连接失败";if("object"==typeof e&&null!==e&&"data"in e&&"string"==typeof e.data){let t="status"in e&&"number"==typeof e.status?e.status:"Error";return`${i} (${t})`}return i}])},401280,e=>{let t={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"};e.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(e){if("string"!=typeof e)return null;let n=e.trim().toLowerCase();return n?t[n]??null:null}])}])})();
@@ -0,0 +1,6 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,952683,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(618566),i=e.i(518515),a=e.i(456420);let o={name:"file-up",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]};o.node;let s=(0,a.f)(o);var l=e.i(325597),u=e.i(328623),c=e.i(747819),h=e.i(866531),f=e.i(515288),m=e.i(519455),d=e.i(624687),g=e.i(110204),p=e.i(856522),x=e.i(632781),y=e.i(772382),w=e.i(7891),w=w,b=e.i(395925),N=e.i(111110),v=e.i(511445),S=e.i(574041),T=e.i(438465),E=e.i(674166),A=e.i(967489),k=e.i(597138),M=e.i(294114);function I({onSubmit:e,defaultNotebookId:n,defaultNotebookName:i,isSaving:a}){let{t:o}=(0,N.b)(),[s,u]=(0,r.useState)(null),[c,h]=(0,r.useState)(""),[j,O]=(0,r.useState)(""),[_,$]=(0,r.useState)(""),[P,C]=(0,r.useState)(""),[L,D]=(0,r.useState)(""),[R,F]=(0,r.useState)("unknown"),[q,z]=(0,r.useState)([]),[U,G]=(0,r.useState)(n||""),[B,W]=(0,r.useState)(""),[V,X]=(0,r.useState)(""),Y=async()=>{if(c.trim()){if(!U)return void M.c.warning(o.editor.messages?.selectNotebook||"Please select a notebook");await e({questionText:c.trim(),answerText:j.trim(),analysis:_.trim(),wrongAnswerText:P.trim(),mistakeAnalysis:L.trim(),mistakeStatus:R,knowledgePoints:q,subjectId:U,gradeSemester:B||void 0,paperLevel:V||void 0})}},H=e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),c.trim()&&U&&!a&&Y())},Q=[{key:"question",label:o.editor?.question||"Question Text",value:c,setter:h,placeholder:o.directEntry.questionPlaceholder,minHeight:"min-h-[180px]",required:!0},{key:"answer",label:o.editor?.answer||"Answer",value:j,setter:O,placeholder:o.directEntry.answerPlaceholder,minHeight:"min-h-[120px]"},{key:"analysis",label:o.editor?.analysis||"Analysis / Explanation",value:_,setter:$,placeholder:o.directEntry.analysisPlaceholder,minHeight:"min-h-[150px]"},{key:"wrongAnswer",label:o.editor?.wrongAnswerText||"Wrong Answer / Work",value:P,setter:C,placeholder:o.directEntry.wrongAnswerPlaceholder,minHeight:"min-h-[100px]"},{key:"mistakeAnalysis",label:o.editor?.mistakeAnalysis||"Mistake Cause Analysis",value:L,setter:D,placeholder:o.directEntry.mistakeAnalysisPlaceholder,minHeight:"min-h-[100px]"}];return(0,t.jsx)(f.N,{className:"rounded-2xl",children:(0,t.jsxs)(f.O,{className:"p-6 space-y-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(l.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:o.directEntry.title})]}),(0,t.jsxs)(m.f,{variant:"ghost",size:"sm",onClick:()=>{h(""),O(""),$(""),C(""),D(""),F("unknown"),z([]),W(""),X("")},disabled:a,className:"text-muted-foreground hover:text-destructive",children:[(0,t.jsx)(b.f,{className:"h-4 w-4 mr-1"}),o.directEntry.reset]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(g.f,{children:[o.editor?.selectNotebook||"Select Notebook"," *"]}),(0,t.jsx)(T.f,{value:U,onChange:G})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.f,{children:o.editor?.gradeSemester||"Grade/Semester"}),(0,t.jsx)("input",{type:"text",value:B,onChange:e=>W(e.target.value),placeholder:o.directEntry.gradeSemesterPlaceholder,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.f,{children:o.editor?.paperLevel||"Paper Level"}),(0,t.jsx)(E.f,{value:V,onChange:X})]})]}),Q.map(e=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(g.f,{className:e.required?"text-primary font-semibold":"",children:[e.label," ",e.required&&"*"]}),(0,t.jsx)(m.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>u(s===e.key?null:e.key),disabled:!e.value,children:s===e.key?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.f,{className:"h-3 w-3 mr-1"}),o.directEntry.edit]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.f,{className:"h-3 w-3 mr-1"}),o.directEntry.preview]})})]}),s===e.key?(0,t.jsx)("div",{className:`rounded-md border bg-muted/30 p-4 ${e.minHeight} overflow-auto cursor-pointer`,onClick:()=>u(null),children:(0,t.jsx)(v.f,{content:e.value})}):(0,t.jsx)(d.f,{value:e.value,onChange:t=>e.setter(t.target.value),onKeyDown:H,placeholder:e.placeholder,className:`${e.minHeight} font-mono text-sm resize-y`,disabled:a})]},e.key)),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.f,{children:o.editor?.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(A.d,{value:R,onValueChange:e=>F(e),children:[(0,t.jsx)(A.P,{className:"w-[200px]",children:(0,t.jsx)(A.U,{})}),(0,t.jsxs)(A.r,{children:[(0,t.jsx)(A.T,{value:"not_attempted",children:o.editor?.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(A.T,{value:"wrong_attempt",children:o.editor?.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(A.T,{value:"unknown",children:o.editor?.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(g.f,{children:o.editor?.tags||"Knowledge Points (Press Enter to add)"}),(0,t.jsx)(S.f,{value:q,onChange:z,placeholder:o.editor?.tagsPlaceholder||"Enter knowledge tags, select from suggestions...",enterHint:o.editor?.createTagHint,subject:(0,k.f)(i||null)||void 0}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o.editor?.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 pt-2",children:[(0,t.jsx)(m.f,{onClick:Y,disabled:!c.trim()||!U||a,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 hover:from-indigo-700 hover:to-violet-600 text-white font-medium",size:"lg",children:a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),o.directEntry.saving]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.f,{className:"mr-2 h-4 w-4"}),o.directEntry.save]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:o.directEntry.hint})]})]})})}var j=e.i(226091);function O({fileName:e,done:r,total:n}){let{t:i}=(0,N.b)();return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 py-10 text-center",role:"status",children:[(0,t.jsx)(x.f,{className:"h-8 w-8 animate-spin text-primary"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i.fileImport.processingImages.replace("{name}",e).replace("{done}",String(r)).replace("{total}",String(n))})]})}function _({textKey:e,fileName:r,batchCount:n,rendered:i,total:a}){let o,{t:s}=(0,N.b)();return o="parsing"===e?s.fileImport.parsing.replace("{name}",r??""):"creating"===e?s.fileImport.creating.replace("{count}",String(n??0)):"rendering-pdf"===e?s.fileImport.pdfRendering.replace("{done}",String(i??0)).replace("{total}",String(a??0)):s.fileImport.pdfCreatingBatches.replace("{done}",String(i??0)).replace("{total}",String(a??0)),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 py-10 text-center",role:"status",children:[(0,t.jsx)(x.f,{className:"h-8 w-8 animate-spin text-primary"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:o})]})}let $={name:"file-spreadsheet",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]};$.node;let P=(0,a.f)($);var C=e.i(725981),L=e.i(310115),D=e.i(201276),R=e.i(303163),F=e.i(651304),q=e.i(407198);function z(e,t){let r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,n.click(),URL.revokeObjectURL(r)}function U({onFile:e}){let{t:r}=(0,N.b)(),n=F.b.map(e=>e.extensions.join(" / ")).join("、"),i=async()=>{try{let e=await (0,q.n)();z(e,"question-template.xlsx")}catch(e){D.V.error("[FileImport]","Build xlsx template failed",{error:(0,R.Z)(e)}),M.c.error(r.fileImport.templateFailed)}};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"rounded-xl border border-dashed p-6 text-center",children:[(0,t.jsx)(C.f,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),(0,t.jsx)("p",{className:"mb-1 text-sm font-medium",children:r.fileImport.pickHint}),(0,t.jsx)("p",{className:"mb-4 text-xs text-muted-foreground",children:r.fileImport.supportedFormats.replace("{formats}",n)}),(0,t.jsx)(L.f,{types:F.b,onFile:e})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:r.fileImport.templates}),(0,t.jsxs)("button",{type:"button",onClick:()=>void i(),className:"inline-flex items-center gap-1 underline hover:text-foreground",children:[(0,t.jsx)(P,{className:"h-3.5 w-3.5"}),r.fileImport.xlsxTemplate]}),(0,t.jsxs)("button",{type:"button",onClick:()=>{z(new Blob([(0,q.j)()],{type:"text/csv;charset=utf-8"}),"question-template.csv")},className:"inline-flex items-center gap-1 underline hover:text-foreground",children:[(0,t.jsx)(j.f,{className:"h-3.5 w-3.5"}),r.fileImport.csvTemplate]})]})]})}function G({fileName:e,summary:n,pdfHasGraphics:i,notebookId:a,onNotebookChange:o,onConfirm:s,onReset:l}){let{t:u}=(0,N.b)(),[c,h]=(0,r.useState)("all");return(0,t.jsxs)("div",{className:"space-y-4","data-testid":"file-import-summary",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:e}),(0,t.jsx)(m.f,{variant:"ghost",size:"sm",onClick:l,children:u.fileImport.repick})]}),(0,t.jsx)("p",{className:"text-sm",children:u.fileImport.totalQuestions.replace("{count}",String(n.total))}),n.errorCount>0&&(0,t.jsxs)("div",{className:"rounded-lg bg-destructive/10 p-3 text-sm text-destructive",role:"alert",children:[(0,t.jsx)("p",{className:"font-medium",children:u.fileImport.errorsFound.replace("{count}",String(n.errorCount))}),(0,t.jsx)("ul",{className:"mt-1 list-inside list-disc space-y-0.5",children:n.errors.map((e,r)=>(0,t.jsx)("li",{children:e.index>=0?u.fileImport.errorItem.replace("{index}",String(e.index+1)).replace("{message}",e.message):e.message},r))})]}),n.warnings.length>0&&(0,t.jsx)("div",{className:"rounded-lg bg-amber-500/10 p-3 text-sm text-amber-700 dark:text-amber-300",children:(0,t.jsx)("ul",{className:"list-inside list-disc space-y-0.5",children:n.warnings.map((e,r)=>(0,t.jsx)("li",{children:e},r))})}),n.ignoredFieldTexts.length>0&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:u.fileImport.ignoredFields.replace("{fields}",n.ignoredFieldTexts.join("、"))}),void 0!==i&&(0,t.jsxs)("div",{className:"space-y-2","data-testid":"pdf-image-option",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:u.fileImport.pdfImageOptionTitle}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("input",{type:"radio",name:"pdf-image-option",value:"with-graphics",checked:"with-graphics"===c,onChange:()=>h("with-graphics"),disabled:!i,"data-testid":"pdf-image-option-with-graphics"}),u.fileImport.pdfImageOptionWithGraphics]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("input",{type:"radio",name:"pdf-image-option",value:"all",checked:"all"===c,onChange:()=>h("all"),"data-testid":"pdf-image-option-all"}),u.fileImport.pdfImageOptionAll]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("input",{type:"radio",name:"pdf-image-option",value:"none",checked:"none"===c,onChange:()=>h("none"),"data-testid":"pdf-image-option-none"}),u.fileImport.pdfImageOptionNone]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",htmlFor:"file-import-notebook",children:u.fileImport.targetNotebook}),(0,t.jsx)(T.f,{value:a,onChange:o}),!a&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:u.fileImport.notebookRequired})]}),(0,t.jsx)(m.f,{onClick:()=>s(c),disabled:!a||0===n.total,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 font-medium text-white hover:from-indigo-700 hover:to-violet-600",size:"lg",children:u.fileImport.confirm.replace("{count}",String(n.total))})]})}let B={name:"file-exclamation-point",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["file-warning"]};B.node;let W=(0,a.f)(B);var V=e.i(213761);async function X(e,t){return new Promise((r,n)=>{e.toBlob(e=>{if(!e)return void n(Error("CANVAS_EMPTY"));let t=new FileReader;t.onload=()=>r(t.result),t.onerror=()=>n(t.error??Error("READ_FAILED")),t.readAsDataURL(e)},"image/jpeg",t)})}async function Y(e,t){let r=t.limits??V.K,n=[],i=t.pages.length,a=null,o=null;try{for(let s=0;s<i;s++){let l=t.pages[s],u=await e.getPage(l),c=u.getViewport({scale:1}),h=function(e,t,r=V.K){let n=function(e,t,r=V.K){return Math.min(1,r.maxLongEdge/Math.max(e,t),Math.sqrt(r.maxPixels/Math.max(1,e*t)))}(e,t,r);return{width:Math.max(1,Math.floor(e*n)),height:Math.max(1,Math.floor(t*n)),scale:n}}(c.width,c.height,r);if(!a||!o){let e=(a=document.createElement("canvas")).getContext("2d");if(!e)throw Error("CANVAS_UNSUPPORTED");o=e}a.width=h.width,a.height=h.height,o.fillStyle="#ffffff",o.fillRect(0,0,h.width,h.height);let f=u.getViewport({scale:h.scale});await u.render({canvasContext:o,viewport:f}).promise;let m=await X(a,r.startQuality);n.push({pageNumber:l,dataUrl:m,width:h.width,height:h.height,bytes:Math.floor(3*m.slice(m.indexOf(",")+1).length/4)}),a.width=0,a.height=0,t.onProgress?.(s+1,i)}}finally{a&&(a.width=0,a.height=0);try{await e.cleanup?.()}catch{}}return n}function H({fileName:e,pageCount:n,notebookId:i,onNotebookChange:a,onConfirm:o,onReset:s}){let{t:l}=(0,N.b)(),[u,c]=(0,r.useState)(""),[h,f]=(0,r.useState)(null),[d,g]=(0,r.useState)(!1),p=async()=>{let e=function(e,t){let r=e.trim();if(!r)return{ok:!1,error:{kind:"empty",message:"页码范围不能为空"}};let n=new Set,i=r.split(/[,,、]/).map(e=>e.trim()).filter(Boolean);if(0===i.length)return{ok:!1,error:{kind:"empty",message:"页码范围不能为空"}};for(let e of i){let r=e.match(/^(\d+)(?:\s*-\s*(\d+))?$/);if(!r)return{ok:!1,error:{kind:"invalid",message:`无法识别的页码段「${e}」,请使用如 1-3,5 的写法`}};let i=Number.parseInt(r[1],10),a=void 0!==r[2]?Number.parseInt(r[2],10):i;if(i<1||a<1||i>t||a>t)return{ok:!1,error:{kind:"out_of_range",message:`页码超出范围(共 ${t} 页)`}};if(a<i)return{ok:!1,error:{kind:"invalid",message:`页码段「${e}」起始页不能大于结束页`}};for(let e=i;e<=a;e++)n.add(e)}let a=Array.from(n).sort((e,t)=>e-t);return 0===a.length?{ok:!1,error:{kind:"empty",message:"页码范围不能为空"}}:a.length>20?{ok:!1,error:{kind:"invalid",message:`单次最多转换 20 页,当前选择了 ${a.length} 页,请缩小范围`}}:{ok:!0,pages:a}}(u.trim()?u:`1-${n}`,n);if(!e.ok)return void f(l.fileImport.pdfPageRangeInvalid.replace("{message}",e.error.message));f(null),g(!0);try{await o(e.pages)}finally{g(!1)}};return(0,t.jsxs)("div",{className:"space-y-4","data-testid":"file-import-scanned-pdf",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:e}),(0,t.jsx)(m.f,{variant:"ghost",size:"sm",onClick:s,children:l.fileImport.repick})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2 rounded-lg bg-amber-500/10 p-3 text-sm text-amber-700 dark:text-amber-300",children:[(0,t.jsx)(W,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"font-medium",children:l.fileImport.pdfScannedTitle.replace("{count}",String(n))}),(0,t.jsx)("p",{children:l.fileImport.pdfScannedHint})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",htmlFor:"scanned-pdf-range",children:l.fileImport.pdfPageRangeLabel.replace("{max}",String(20))}),(0,t.jsx)("input",{id:"scanned-pdf-range",type:"text",inputMode:"text",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:l.fileImport.pdfPageRangePlaceholder,value:u,onChange:e=>{c(e.target.value),h&&f(null)}}),h&&(0,t.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:h})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",htmlFor:"scanned-pdf-notebook",children:l.fileImport.targetNotebook}),(0,t.jsx)(T.f,{value:i,onChange:a}),!i&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:l.fileImport.notebookRequired})]}),(0,t.jsx)(m.f,{onClick:()=>void p(),disabled:!i||d||0===n,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 font-medium text-white hover:from-indigo-700 hover:to-violet-600",size:"lg",children:l.fileImport.pdfConfirm})]})}var Q=e.i(411382),K=e.i(54105),Z=e.i(772325),J=e.i(978056),ee=e.i(722219),ee=ee,et=ee,er=ee,en=e.i(398019);let ei="wrong-notebook-questions",ea=en.K,eo=Q.z.object({dataUrl:K.z.string().regex(/^data:image\/(png|jpeg|webp);base64,/,"INVALID_IMAGE_DATA_URL").max(5242880,"IMAGE_TOO_LARGE"),alt:K.z.string().max(200).optional()}),es=Q.z.object({text:K.z.string().max(2e4),material:K.z.string().max(2e4).optional(),section:K.z.string().max(500).optional(),label:K.z.string().max(20).optional(),answer:K.z.string().max(2e4).optional(),analysis:K.z.string().max(5e4).optional(),knowledgePoints:Z.z.array(K.z.string().max(200)).max(100).optional(),difficultyStars:J.z.number().int().min(1).max(5).optional(),wrongAnswer:K.z.string().max(2e4).optional(),subject:K.z.string().max(100).optional(),gradeSemester:K.z.string().max(100).optional(),source:K.z.string().max(200).optional(),questionType:K.z.string().max(100).optional(),figureSvg:K.z.string().max(ea).optional(),images:Z.z.array(eo).max(10).optional(),extensions:ee.record(K.z.string(),et.unknown()).optional()});Q.z.object({format:er.literal(ei),version:er.literal(1),exportedAt:K.z.string().optional(),generator:K.z.string().max(200).optional(),questions:Z.z.array(es).max(5e3)});let el="MISSING_FORMAT",eu="MISSING_VERSION",ec="INVALID_DIFFICULTY",eh="INVALID_QUESTION_SHAPE",ef=/[、,,;;]/;function em(e){if("string"!=typeof e)return;let t=e.trim();return t.length>0?t:void 0}function ed(e,t,r){if(void 0!==e&&e.length>t)return r}function eg(e){return e.filter(e=>e!==el&&e!==eu)}function ep(e){let t=[],r=[],n=null;if(Array.isArray(e))n=e,r.push(el,eu);else{if("object"!=typeof e||null===e||Array.isArray(e))return{questions:[],errors:[{index:-1,reason:eh}],warnings:r};{let t=e.format,i=e.version;void 0===t?r.push(el):t!==ei&&r.push("UNKNOWN_FORMAT"),void 0===i?r.push(eu):"number"==typeof i&&i>1&&r.push("UNSUPPORTED_VERSION");let a=e.questions;if(!Array.isArray(a))return{questions:[],errors:[{index:-1,reason:"QUESTIONS_REQUIRED"}],warnings:r};n=a}}let i=n;i.length>5e3&&(r.push("TOO_MANY_QUESTIONS"),i=i.slice(0,5e3));let a=[];return i.forEach((e,r)=>{let n=function(e){if("object"!=typeof e||null===e||Array.isArray(e))return{error:eh};let t="string"==typeof e.text?e.text.trim():"";if(!t)return{error:"TEXT_REQUIRED"};if(t.length>2e4)return{error:"TEXT_TOO_LONG"};let r=em(e.material),n=ed(r,2e4,"MATERIAL_TOO_LONG");if(n)return{error:n};let i=em(e.section),a=ed(i,500,"SECTION_TOO_LONG");if(a)return{error:a};let o=em(e.label),s=ed(o,20,"LABEL_TOO_LONG");if(s)return{error:s};let l=em(e.answer),u=ed(l,2e4,"ANSWER_TOO_LONG");if(u)return{error:u};let c=em(e.analysis),h=ed(c,5e4,"ANALYSIS_TOO_LONG");if(h)return{error:h};let f=em(e.wrongAnswer),m=ed(f,2e4,"WRONG_ANSWER_TOO_LONG");if(m)return{error:m};let d=em(e.subject),g=ed(d,100,"SUBJECT_TOO_LONG");if(g)return{error:g};let p=em(e.gradeSemester),x=ed(p,100,"GRADE_SEMESTER_TOO_LONG");if(x)return{error:x};let y=em(e.source),w=ed(y,200,"SOURCE_TOO_LONG");if(w)return{error:w};let b=em(e.questionType),N=ed(b,100,"QUESTION_TYPE_TOO_LONG");if(N)return{error:N};let v=em(e.figureSvg),S=ed(v,ea,"FIGURE_SVG_TOO_LONG");if(S)return{error:S};let T=function(e){if(null==e)return{points:[]};let t=[];if("string"==typeof e){let r=e.trim();if(!r)return{points:[]};t.push(...r.split(ef))}else{if(!Array.isArray(e))return{error:eh};t.push(...e)}let r=[];for(let e of t){if("string"!=typeof e)return{error:eh};let t=e.trim();if(t){if(t.length>200)return{error:"KNOWLEDGE_POINT_TOO_LONG"};r.push(t)}}return r.length>100?{error:"TOO_MANY_KNOWLEDGE_POINTS"}:{points:r}}(e.knowledgePoints);if("error"in T)return{error:T.error};let E=function(e){let t;if(null==e||""===e)return{stars:void 0};if("number"==typeof e)t=e;else{if("string"!=typeof e)return{error:ec};let r=e.trim();if(!r)return{stars:void 0};t=Number(r)}return!Number.isInteger(t)||t<1||t>5?{error:ec}:{stars:t}}(e.difficultyStars);if("error"in E)return{error:E.error};let A=function(e){if(null==e)return{images:[]};if(!Array.isArray(e))return{error:eh};if(e.length>10)return{error:"TOO_MANY_IMAGES"};let t=[];for(let r of e){if("object"!=typeof r||null===r)return{error:eh};let e=r.dataUrl;if("string"!=typeof e||!/^data:image\/(png|jpeg|webp);base64,/.test(e))return{error:"INVALID_IMAGE_DATA_URL"};if(e.length>5242880)return{error:"IMAGE_TOO_LARGE"};let n=em(r.alt);t.push(void 0===n?{dataUrl:e}:{dataUrl:e,alt:n})}return{images:t}}(e.images);if("error"in A)return{error:A.error};let k="object"!=typeof e.extensions||null===e.extensions||Array.isArray(e.extensions)?void 0:e.extensions,M={text:t};return void 0!==r&&(M.material=r),void 0!==i&&(M.section=i),void 0!==o&&(M.label=o),void 0!==l&&(M.answer=l),void 0!==c&&(M.analysis=c),T.points.length>0&&(M.knowledgePoints=T.points),void 0!==E.stars&&(M.difficultyStars=E.stars),void 0!==f&&(M.wrongAnswer=f),void 0!==d&&(M.subject=d),void 0!==p&&(M.gradeSemester=p),void 0!==y&&(M.source=y),void 0!==b&&(M.questionType=b),void 0!==v&&(M.figureSvg=v),A.images.length>0&&(M.images=A.images),void 0!==k&&(M.extensions=k),{question:M}}(e);"error"in n?t.push({index:r,reason:n.error}):a.push(n.question)}),{questions:a,errors:t,warnings:r}}async function ex(e){let t,{text:r}=(0,F.n)(e);try{t=JSON.parse(r)}catch{return{questions:[],errors:[{index:-1,reason:"INVALID_JSON"}],warnings:[]}}return ep(t)}var ey=e.i(825624),ew=e.i(229969);let eb=[208,207,17,224];function eN(e){return new TextDecoder("utf-8").decode(e)}function ev(e){let t=new DOMParser().parseFromString(e,"application/xml");if(t.getElementsByTagName("parsererror")[0])throw Error("INVALID_DOCX");return t}let eS="http://schemas.openxmlformats.org/wordprocessingml/2006/main";class eT{abstractLevels=new Map;instances=new Map;styleLinks=new Map;counters=new Map;constructor(e,t){e&&(this.loadAbstractNums(e),this.loadNums(e)),t&&this.loadStyleLinks(t)}loadAbstractNums(e){for(let t of Array.from(e.getElementsByTagNameNS(eS,"abstractNum"))){let e=t.getAttributeNS(eS,"abstractNumId");if(!e)continue;let r=new Map;for(let e of Array.from(t.getElementsByTagNameNS(eS,"lvl"))){let t=Number(e.getAttributeNS(eS,"ilvl")??"");if(!Number.isInteger(t))continue;let n=e.getElementsByTagNameNS(eS,"numFmt")[0]?.getAttributeNS(eS,"val")??"decimal",i=e.getElementsByTagNameNS(eS,"lvlText")[0]?.getAttributeNS(eS,"val")??"%1.",a=Number(e.getElementsByTagNameNS(eS,"start")[0]?.getAttributeNS(eS,"val")??"1");r.set(t,{numFmt:n,lvlText:i,start:Number.isFinite(a)?a:1})}this.abstractLevels.set(e,r)}}loadNums(e){for(let t of Array.from(e.getElementsByTagNameNS(eS,"num"))){let e=t.getAttributeNS(eS,"numId"),r=t.getElementsByTagNameNS(eS,"abstractNumId")[0]?.getAttributeNS(eS,"val");if(!e||!r)continue;let n=new Map;for(let e of Array.from(t.getElementsByTagNameNS(eS,"lvlOverride"))){let t=Number(e.getAttributeNS(eS,"ilvl")??"");if(!Number.isInteger(t))continue;let r={},i=e.getElementsByTagNameNS(eS,"startOverride")[0]?.getAttributeNS(eS,"val");if(null!=i){let e=Number(i);Number.isFinite(e)&&(r.start=e)}let a=e.getElementsByTagNameNS(eS,"lvl")[0];if(a){let e=a.getElementsByTagNameNS(eS,"numFmt")[0]?.getAttributeNS(eS,"val");e&&(r.numFmt=e);let t=a.getElementsByTagNameNS(eS,"lvlText")[0]?.getAttributeNS(eS,"val");t&&(r.lvlText=t)}n.set(t,r)}this.instances.set(e,{abstractId:r,overrides:n})}}loadStyleLinks(e){for(let t of Array.from(e.getElementsByTagNameNS(eS,"style"))){let e=t.getAttributeNS(eS,"styleId");if(!e)continue;let r=t.getElementsByTagNameNS(eS,"numPr")[0];if(!r)continue;let n=r.getElementsByTagNameNS(eS,"numId")[0]?.getAttributeNS(eS,"val");n&&this.styleLinks.set(e,n)}}resolveNumPr(e){let t=e.getElementsByTagNameNS(eS,"pPr")[0];if(!t)return null;let r=t.getElementsByTagNameNS(eS,"numPr")[0],n=null,i=0;if(r){n=r.getElementsByTagNameNS(eS,"numId")[0]?.getAttributeNS(eS,"val")??null;let e=r.getElementsByTagNameNS(eS,"ilvl")[0]?.getAttributeNS(eS,"val");if(null!=e){let t=Number(e);Number.isInteger(t)&&t>=0&&(i=t)}}if(!n){let e=t.getElementsByTagNameNS(eS,"pStyle")[0]?.getAttributeNS(eS,"val");e&&(n=this.styleLinks.get(e)??null)}return n&&"0"!==n?[n,i]:null}getLevel(e,t){let r=this.instances.get(e);if(!r)return null;let n=this.abstractLevels.get(r.abstractId)?.get(t);if(!n)return null;let i=r.overrides.get(t);return i?{numFmt:i.numFmt??n.numFmt,lvlText:i.lvlText??n.lvlText,start:i.start??n.start}:n}resetDeeperLevels(e,t){for(let r of this.counters.keys()){let[n,i]=r.split(":");n===e&&Number(i)>t&&this.counters.delete(r)}}take(e,t,r){let n=`${e}:${t}`,i=this.counters.get(n);return void 0===i?(this.counters.set(n,r+1),r):(this.counters.set(n,i+1),i)}format(e,t){switch(e){case"chineseCounting":case"chineseCountingThousand":case"ideographTraditional":return function e(t){if(!Number.isFinite(t)||t<=0||t>9999)return String(t);let r="零一二三四五六七八九";if(t<10)return r[t];if(10===t)return"十";if(t<20)return`十${r[t%10]}`;if(t<100){let e=Math.floor(t/10),n=t%10;return`${r[e]}十${n?r[n]:""}`}if(t<1e3){let n=Math.floor(t/100),i=t%100;return 0===i?`${r[n]}百`:i<10?`${r[n]}百零${r[i]}`:`${r[n]}百${e(i)}`}let n=Math.floor(t/1e3),i=t%1e3;return 0===i?`${r[n]}千`:i<100?`${r[n]}千零${e(i)}`:`${r[n]}千${e(i)}`}(t);case"upperLetter":if(t<1||t>26)return String(t);return String.fromCharCode(64+t);case"lowerLetter":if(t<1||t>26)return String(t);return String.fromCharCode(96+t);case"upperRoman":return eA(t).toUpperCase();case"lowerRoman":return eA(t);case"decimalEnclosedCircle":if(t>=1&&t<=20)return String.fromCharCode(9312+t-1);return String(t);default:return String(t)}}paragraphNumber(e,t){let r=this.getLevel(e,t);if(!r)return null;this.resetDeeperLevels(e,t);let n=this.take(e,t,r.start);return"bullet"===r.numFmt?r.lvlText:r.lvlText.replace(/%(\d+)/g,(i,a)=>{let o=Number(a)-1;if(o===t)return this.format(r.numFmt,n);let s=this.getLevel(e,o);if(!s)return"";let l=this.counters.get(`${e}:${o}`)??s.start;return this.format(s.numFmt,l-1)})}}let eE=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function eA(e){if(!Number.isFinite(e)||e<=0||e>=4e3)return String(e);let t=e,r="";for(let[e,n]of eE)for(;t>=e;)r+=n,t-=e;return r}let ek=[{prefix:"wingdings",table:{61472:"□",61473:"■",61474:"▲",61475:"▼",61476:"◆",61477:"●",61478:"○",61480:"▲",61481:"▼",61482:"◆",61483:"●",61484:"○",61486:"□",61488:"→",61489:"←",61490:"↑",61491:"↓",61492:"↔",61493:"↕",61494:"▶",61495:"◀",61496:"▲",61497:"▼",61498:"■",61499:"□",61500:"●",61501:"○",61502:"◆",61503:"◇",61504:"☆",61505:"★",61506:"♥",61507:"♦",61508:"♣",61509:"♠",61516:"✓",61517:"✗",61522:"•",61532:"○",61533:"●",61550:"√",61601:"•",61602:"◦",61603:"▪",61604:"–",61605:"—",61607:"⁃",61623:"•",61656:"➔",61692:"✓"}},{prefix:"symbol",table:{97:"α",98:"β",103:"γ",100:"δ",101:"ε",122:"ζ",104:"η",113:"θ",105:"ι",107:"κ",108:"λ",109:"μ",110:"ν",120:"ξ",112:"π",114:"ρ",115:"σ",116:"τ",117:"υ",102:"φ",99:"χ",121:"ψ",119:"ω",65:"Α",66:"Β",71:"Γ",68:"Δ",69:"Ε",90:"Ζ",72:"Η",81:"Θ",73:"Ι",75:"Κ",76:"Λ",77:"Μ",78:"Ν",88:"Ξ",80:"Π",82:"Ρ",83:"Σ",84:"Τ",85:"Υ",70:"Φ",67:"Χ",89:"Ψ",87:"Ω",180:"×",181:"÷",177:"±",178:"·",179:"∙",182:"∂",184:"≠",187:"≤",188:"≥",190:"≈",191:"≡",194:"∈",197:"∉",198:"∋",201:"∅",206:"∩",207:"∪",210:"⊂",211:"⊃",212:"⊄",213:"⊆",214:"⊇",219:"∧",220:"∨",221:"¬",222:"⇒",223:"⇔",224:"∀",225:"∃",226:"∄",227:"∅",228:"∆",229:"∇",230:"∏",231:"∑",232:"−",233:"∗",234:"√",235:"∞",236:"∠",237:"∥",238:"∧",239:"∨",240:"∩",241:"∪",242:"∫",243:"∬",244:"∴",245:"∵",246:"∶",247:"∷",248:"⊥",249:"∟",250:"⌒",251:"⊙",252:"○",253:"●",254:"□",255:"■"}}],eM="http://schemas.openxmlformats.org/wordprocessingml/2006/main",eI="http://schemas.openxmlformats.org/officeDocument/2006/math",ej="[图片]",eO="[公式]";function e_(e){return e.replace(/ /g," ")}function e$(e,t){let r=e.trim();return/^-?\d+(\.\d+)?$/.test(r)?`${t}${r}`:`${t}{${r}}`}function eP(e,t,r){return e.nodeType===e.ELEMENT_NODE&&e.localName===r&&e.namespaceURI===t}function eC(e){let t=e.getAttributeNS(eM,"val");if(null===t)return!0;let r=t.trim().toLowerCase();return"0"!==r&&"false"!==r&&"off"!==r}function eL(e){for(let t of"object"===e.localName&&e.namespaceURI===eM?[e]:Array.from(e.getElementsByTagNameNS(eM,"object"))){for(let e of Array.from(t.getElementsByTagName("*"))){let t=e.getAttribute("ProgID");if(t&&/Equation/i.test(t))return!0}if(t.getElementsByTagNameNS("urn:schemas-microsoft-com:vml","shapetype").length>0)for(let e of Array.from(t.getElementsByTagNameNS("urn:schemas-microsoft-com:vml","shapetype"))){let t=e.getAttribute("id")??"";if(/^_x0000_tole_/i.test(t))return!0}}return!1}function eD(e,t={},r={relationships:{},files:{}}){let n=[];return!function e(t,r,n){for(let i of Array.from(t.childNodes))if(i.nodeType===i.ELEMENT_NODE)if(eP(i,eM,"ins"))e(i,r,n);else{if(eP(i,eM,"del"))continue;eP(i,eM,"r")?n.push(function(e,t){let r=e.getElementsByTagNameNS(eM,"rPr")[0]??null,n={...t,skip:!1,vertAlign:"baseline"};if(!function(e,t){if(!e)return;let r=e.getElementsByTagNameNS(eM,"strike")[0];r&&eC(r)&&(t.skip=!0);let n=e.getElementsByTagNameNS(eM,"dstrike")[0];n&&eC(n)&&(t.skip=!0);let i=e.getElementsByTagNameNS(eM,"vanish")[0];i&&eC(i)&&(t.skip=!0);let a=e.getElementsByTagNameNS(eM,"vertAlign")[0];if(a){let e=a.getAttributeNS(eM,"val")??"";"superscript"===e?t.vertAlign="superscript":"subscript"===e&&(t.vertAlign="subscript")}}(r,n),n.skip)return"";let i=[];for(let t of Array.from(e.childNodes))t.nodeType!==t.TEXT_NODE&&eP(t,eM,"t")&&i.push(t.textContent??"");let a="";for(let r of Array.from(e.childNodes))if(eP(r,eM,"tab"))a+=" ";else if(eP(r,eM,"br")||eP(r,eM,"cr"))a+="\n";else if(eP(r,eM,"noBreakHyphen"))a+="‑";else if(eP(r,eM,"softHyphen"))a+="­";else if(eP(r,eM,"sym")){let e=r.getAttributeNS(eM,"font")??"",t=parseInt((r.getAttributeNS(eM,"char")??"").replace(/^0x/i,""),16);a+=Number.isFinite(t)?function(e,t){let r=e.trim().toLowerCase();for(let{prefix:e,table:n}of ek){if(!r.startsWith(e))continue;let i=n[t];if(void 0!==i)return i}return"[符号]"}(e,t):"[符号]"}else eP(r,eM,"drawing")||eP(r,eM,"pict")||eP(r,eM,"object")?(eL(r)&&t.docxContext.mathCollector&&(t.docxContext.mathCollector.oleCount+=1),a+=t.handlers.image?.(r,t.docxContext)??ej):(eP(r,eI,"oMath")||eP(r,eI,"oMathPara"))&&(a+=t.handlers.math?.(r,t.docxContext)??eO);if(0===i.length)return e_(a);let o=e_(i.join("")+a);return"superscript"===n.vertAlign?o=e$(o,"^"):"subscript"===n.vertAlign&&(o=e$(o,"_")),o}(i,r)):eP(i,eI,"oMath")||eP(i,eI,"oMathPara")?n.push(r.handlers.math?.(i,r.docxContext)??eO):eP(i,eM,"hyperlink")||eP(i,eM,"smartTag")?e(i,r,n):eP(i,eM,"pict")||eP(i,eM,"drawing")||eP(i,eM,"object")?(eL(i)&&r.docxContext.mathCollector&&(r.docxContext.mathCollector.oleCount+=1),n.push(r.handlers.image?.(i,r.docxContext)??ej)):e(i,r,n)}}(e,{skip:!1,vertAlign:"baseline",handlers:t,docxContext:r},n),n.join("")}let eR="http://schemas.openxmlformats.org/officeDocument/2006/math";function eF(e,t){return e.nodeType===e.ELEMENT_NODE&&e.localName===t&&e.namespaceURI===eR}function eq(e,t){return e.getAttributeNS(eR,t)??e.getAttribute(t)??e.getAttribute(`m:${t}`)}function ez(e,t){if(!e)return null;let r=eq(e,t);if(null!==r)return r;let n=eG(e,t);return n?eq(n,"val"):null}function eU(e){return e.textContent??""}function eG(e,t){for(let r of Array.from(e.children))if(eF(r,t))return r;return null}function eB(e,t){return Array.from(e.children).filter(e=>eF(e,t))}let eW={"\\":"\\backslash ","~":"\\sim ","^":"\\hat{\\ }"};function eV(e){return e.replace(/[#$%&_{}\\~^]/g,e=>eW[e]??`\\${e}`)}let eX={"×":"\\times","÷":"\\div","≤":"\\le","≥":"\\ge","≠":"\\ne","≈":"\\approx","≡":"\\equiv","±":"\\pm","∓":"\\mp","∝":"\\propto","∞":"\\infty",π:"\\pi","∠":"\\angle","△":"\\triangle","□":"\\square","⊥":"\\perp","∥":"\\parallel","°":"^\\circ","√":"\\sqrt{}","∴":"\\therefore","∵":"\\because","∈":"\\in","∉":"\\notin","∪":"\\cup","∩":"\\cap","⊂":"\\subset","⊆":"\\subseteq","⊃":"\\supset","∀":"\\forall","∃":"\\exists","∑":"\\sum","∏":"\\prod","∫":"\\int","∬":"\\iint","∮":"\\oint","→":"\\to","←":"\\leftarrow","↔":"\\leftrightarrow","⇒":"\\Rightarrow","⇔":"\\Leftrightarrow","⋅":"\\cdot","⊙":"\\odot","⊗":"\\otimes","∂":"\\partial","∇":"\\nabla",ℓ:"\\ell",ℏ:"\\hbar","′":"'","″":"''"},eY={α:"\\alpha",β:"\\beta",γ:"\\gamma",δ:"\\delta",ε:"\\varepsilon",ζ:"\\zeta",η:"\\eta",θ:"\\theta",ι:"\\iota",κ:"\\kappa",λ:"\\lambda",μ:"\\mu",ν:"\\nu",ξ:"\\xi",π:"\\pi",ρ:"\\rho",σ:"\\sigma",τ:"\\tau",υ:"\\upsilon",φ:"\\varphi",χ:"\\chi",ψ:"\\psi",ω:"\\omega",Α:"A",Β:"B",Γ:"\\Gamma",Δ:"\\Delta",Ε:"E",Ζ:"Z",Η:"H",Θ:"\\Theta",Ι:"I",Κ:"K",Λ:"\\Lambda",Μ:"M",Ν:"N",Ξ:"\\Xi",Ο:"O",Π:"\\Pi",Ρ:"P",Σ:"\\Sigma",Τ:"T",Υ:"Y",Φ:"\\Phi",Χ:"X",Ψ:"\\Psi",Ω:"\\Omega"},eH={"̂":"\\hat","^":"\\hat",ˇ:"\\check","˘":"\\breve","¯":"\\bar","‾":"\\overline","˙":"\\dot","¨":"\\ddot","⃛":"\\dddot","⃗":"\\vec","˜":"\\tilde","→":"\\vec","´":"\\acute","`":"\\grave"},eQ={"∑":"\\sum","∏":"\\prod","∐":"\\coprod","∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨂":"\\bigotimes","⨁":"\\bigoplus"},eK={sin:"\\sin",cos:"\\cos",tan:"\\tan",cot:"\\cot",sec:"\\sec",csc:"\\csc",arcsin:"\\arcsin",arccos:"\\arccos",arctan:"\\arctan",sinh:"\\sinh",cosh:"\\cosh",tanh:"\\tanh",log:"\\log",ln:"\\ln",lg:"\\lg",lim:"\\lim",max:"\\max",min:"\\min",sup:"\\sup",inf:"\\inf",det:"\\det",exp:"\\exp",deg:"\\deg",gcd:"\\gcd"};function eZ(e){let t=e.trim();return 1===t.length?t:/^\\[a-zA-Z]+$/.test(t)?` ${t} `:`{${t}}`}function eJ(e){let t="";for(let r of e)r in eY?t+=eY[r]:r in eX?t+=eX[r]:t+=eV(r);return t}function e0(e,t){let r=[];for(let n of Array.from(e.children))r.push(e4(n,t));return r.join("")}function e1(e,t,r){let n=eG(e,"e"),i=eG(e,"sup"),a=eG(e,"sub"),o=n?e0(n,t):"";if("sup"===r){let e=i?e0(i,t):"";return`${o}^${eZ(e)}`}if("sub"===r){let e=a?e0(a,t):"";return`${o}_${eZ(e)}`}let s=a?e0(a,t):"",l=i?e0(i,t):"";return`${o}_${eZ(s)}^${eZ(l)}`}function e2(e,t,r){let n=eG(e,"e"),i=eG(e,"lim"),a=n?e0(n,t):"",o=eK[a.trim()]??a,s=i?e0(i,t):"";return"low"===r?`${o}_{${s}}`:`${o}^{${s}}`}function e4(e,t){if(e.namespaceURI!==eR)return e.textContent??"";switch(e.localName){case"r":var r;let n="",i=null!==eG(e,"rPr")&&null!==eG(eG(e,"rPr"),"nor");for(let t of Array.from(e.childNodes))t.nodeType===t.ELEMENT_NODE&&(eF(t,"t")||"t"===t.localName&&t.namespaceURI!==eR?n+=eU(t):eF(t,"br")&&(n+=" "));let a=eJ(n);return i?`\\text{${n.replace(/\\/g,"\\\\").replace(/[#$%&_{}~^]/g,e=>`\\${e}`)}}`:a;case"t":return eJ(eU(e));case"f":let o,s,l,u,c;return o=ez(eG(e,"fPr"),"type")??"bar",s=eG(e,"num"),l=eG(e,"den"),u=s?e0(s,t):"",c=l?e0(l,t):"","lin"===o?`${u}/${c}`:"skw"===o?`${u}\\big/${c}`:"noBar"===o?`{${u} \\atop ${c}}`:`\\frac{${u}}{${c}}`;case"sSup":return e1(e,t,"sup");case"sSub":return e1(e,t,"sub");case"sSubSup":return e1(e,t,"subsup");case"sPre":let h,f,m;return h=eG(e,"e"),f=eG(e,"sup"),m=eG(e,"sub"),`${h?e0(h,t):""}_${m?eZ(e0(m,t)):""}^{${f?e0(f,t):""}}`;case"rad":let d=eG(e,"deg"),g=eG(e,"e"),p=g?e0(g,t):"";if("1"===(ez(eG(e,"radPr"),"degHide")??eq(e,"degHide"))||!d||0===d.children.length)return`\\sqrt{${p}}`;let x=e0(d,t);return`\\sqrt[${x}]{${p}}`;case"d":return function(e,t){var r;let n=eG(e,"dPr"),i=ez(n,"begChr")??"(",a=ez(n,"endChr")??")",o=eB(e,"e"),s=o.map(e=>Array.from(e.children).find(e=>eF(e,"eqArr"))).find(e=>void 0!==e);if(s&&"{"===i){let e=eB(s,"e").map(e=>e0(e,t)).join(" \\\\ ");return`\\begin{cases} ${e} \\end{cases}`}let l=o.length>0?o.map(e=>e0(e,t)).join(""):(r=Array.from(e.children).filter(e=>!eF(e,"dPr")),r.map(e=>e4(e,t)).join(""));return`${i}${l}${a}`}(e,t);case"nary":let y,w,b,N,v,S,T,E,A,k,M;return w=ez(y=eG(e,"naryPr"),"chr")??"∫",ez(y,"limLoc")??"undOvr",b=eQ[w]??eJ(w),N=eG(e,"sub"),v=eG(e,"sup"),S=eG(e,"e"),T=ez(y,"subHide"),E=ez(y,"supHide"),A=N&&"1"!==T?e0(N,t):"",k=v&&"1"!==E?e0(v,t):"",M=S?e0(S,t):"",`${b}${A?`_${eZ(A)}`:""}${k?`^${eZ(k)}`:""} ${M}`;case"func":return function(e,t){let r=eG(e,"fName"),n=eG(e,"e"),i="";if(r){let e=[];for(let t of Array.from(r.childNodes))if(t.nodeType===t.ELEMENT_NODE&&eF(t,"r"))for(let r of Array.from(t.getElementsByTagNameNS(eR,"t")))e.push(eU(r));i=e.join("")}let a=eK[i]??`\\operatorname{${eV(i)}}`,o=n?e0(n,t):"";return`${a}${o?`{${o}}`:""}`}(e,t);case"limLow":return e2(e,t,"low");case"limUpp":return e2(e,t,"upp");case"acc":let I,j,O,_;return I=ez(eG(e,"accPr"),"chr")??"̂",O=(j=eG(e,"e"))?e0(j,t):"",_=eH[I]??"\\hat",`${_}{${O}}`;case"bar":let $,P,C;return $=ez(eG(e,"barPr"),"pos")??"top",C=(P=eG(e,"e"))?e0(P,t):"","bot"===$?`\\underline{${C}}`:`\\overline{${C}}`;case"groupChr":let L,D,R,F,q;return D=ez(L=eG(e,"groupChrPr"),"chr")??"⏞",R=ez(L,"pos")??"top",q=(F=eG(e,"e"))?e0(F,t):"",`${"⏟"===D||"bot"===R?"\\underbrace":"\\overbrace"}{${q}}`;case"eqArr":let z;return z=eB(e,"e").map(e=>e0(e,t)).join(" \\\\ "),`\\begin{aligned} ${z} \\end{aligned}`;case"m":let U=[];for(let r of eB(e,"mr")){let e=eB(r,"e");U.push(e.map(e=>e0(e,t)).join(" & "))}if(0===U.length){let r=eB(e,"e");r.length>0&&U.push(r.map(e=>e0(e,t)).join(" & "))}return`\\begin{matrix} ${U.join(" \\\\ ")} \\end{matrix}`;case"box":case"borderBox":{let r=eG(e,"e");return r?e0(r,t):""}case"e":case"oMath":case"oMathPara":return e0(e,t);case"sty":case"scr":case"rPr":case"ctrlPr":case"dPr":case"naryPr":case"accPr":case"barPr":case"groupChrPr":case"fPr":case"radPr":case"sSupPr":case"sSubPr":case"sSubSupPr":case"sPrePr":case"limLowPr":case"limUppPr":case"mPr":case"mr":case"nor":return"";default:return r=e.localName,t.unsupportedSet.has(r)||(t.unsupportedSet.add(r),t.unsupported.push(r)),e0(e,t)}}function e5(e,t){return e.getInt16(t,!0)}function e6(e,t){return e.getUint16(t,!0)}function e8(e,t){return e.getUint32(t,!0)}function e3(e,t){let r=t?.charSet??0;if(2===r){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}try{return new TextDecoder({0:"windows-1252",1:"windows-1252",128:"shift_jis",129:"euc-kr",134:"gb18030",136:"big5",255:"utf-8"}[r]??"windows-1252",{fatal:!1}).decode(e)}catch{let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}}function e7(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0,n=null;if(e.byteLength>=4&&0x9ac6cdd7===e8(t,0)){if(e.byteLength<22)throw Error("WMF placeable 头长度不足");n={left:e5(t,6),top:e5(t,8),right:e5(t,10),bottom:e5(t,12)},r=22}if(e.byteLength-r<18)throw Error("WMF metafile 头长度不足");let i=e6(t,r+2);if(9!==i)throw Error(`WMF metafile 头长度字段异常:${i}`);r+=18;let a={windowOrgX:0,windowOrgY:0,windowExtX:1,windowExtY:1,viewportOrgX:0,viewportOrgY:0,viewportExtX:1,viewportExtY:1,mapMode:1,textAlign:0,textColor:0,bkMode:2,currentX:0,currentY:0,selectedFont:null,selectedPen:null},o=[],s=Array(10).fill(null),l=[],u=[],c=[],h=!1;function f(e){for(let t=0;t<s.length;t++)if(null===s[t]){s[t]=e;return}throw Error("WMF 对象表已满")}function m(){return a.selectedPen?.color??0}function d(){let e=a.selectedFont;if(!e)return 8;let t=.5*Math.abs(e.height);return Math.max(1,Math.round(e.bold?1.05*t:t))}function g(e,t,r,n){let i,o=a.selectedFont,s=a.textAlign,u=(1&s)!=0||0===t&&0===r,c=u?a.currentX:t,h=u?a.currentY:r,f=24&s,m=o?Math.abs(o.height):12;if(i=24===f?h-Math.round(.8*m):8===f?h-m:h,n.length>0){let t=c,r=6&s;6===r?t-=Math.round(n.reduce((e,t)=>e+t,0)/2):2===r&&(t-=n.reduce((e,t)=>e+t,0));for(let r=0;r<e.length;r++)l.push({x:t,y:i,text:e[r],font:o,color:a.textColor,align:s,bkMode:a.bkMode}),t+=n[r]??d();1&s&&(a.currentX=t)}else{let t=6&s,r=e.length*d(),n=c;6===t?n=c-Math.round(r/2):2===t&&(n=c-r),l.push({x:n,y:i,text:e,font:o,color:a.textColor,align:s,bkMode:a.bkMode}),1&s&&(a.currentX=c+r)}1&s&&(a.currentY=h)}let p=null;function x(){p=null}for(;r+6<=e.byteLength;){let n=e8(t,r),i=e6(t,r+4),l=r+2*n;if(n<3||l>e.byteLength)break;let d=r+6;switch(i){case 523:a.windowOrgY=e5(t,d),a.windowOrgX=e5(t,d+2);break;case 524:a.windowExtY=e5(t,d),a.windowExtX=e5(t,d+2);break;case 525:a.viewportOrgY=e5(t,d),a.viewportOrgX=e5(t,d+2);break;case 526:a.viewportExtY=e5(t,d),a.viewportExtX=e5(t,d+2);break;case 259:a.mapMode=e6(t,d);break;case 302:a.textAlign=e6(t,d),1&a.textAlign&&(h=!0);break;case 521:a.textColor=0xffffff&e8(t,d);break;case 258:a.bkMode=e6(t,d);break;case 30:o.push({...a});break;case 295:x();{let e=o.pop();e&&Object.assign(a,e)}break;case 532:x(),a.currentY=e5(t,d),a.currentX=e5(t,d+2);break;case 531:{let e=e5(t,d),r=e5(t,d+2),n=m();p&&p.color===n?p.points.push({x:r,y:e}):(x(),p={points:[{x:a.currentX,y:a.currentY},{x:r,y:e}],color:n},u.push(p)),a.currentX=r,a.currentY=e;break}case 763:{let r=e5(t,d),n=e5(t,d+8),i=0!==e[d+10],a=0!==e[d+11],o=0!==e[d+12];f({kind:"font",height:r,bold:n>=600,italic:i,underline:a,strikeOut:o,charSet:e[d+13],faceName:function(e){let t=e.length;for(let r=0;r<e.length;r++)if(0===e[r]){t=r;break}let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}(e.subarray(d+18,Math.min(d+18+32,l)))});break}case 762:{let e=e6(t,d);f({kind:"pen",style:e,width:e5(t,d+2),color:0xffffff&e8(t,d+6)});break}case 764:f({kind:"brush",style:e6(t,d),color:0xffffff&e8(t,d+2)});break;case 301:{x();let e=s[e6(t,d)]??null;e?.kind==="font"?a.selectedFont=e:e?.kind==="pen"&&(a.selectedPen=e);break}case 496:{let e=e6(t,d);e<s.length&&(s[e]=null);break}case 804:case 805:{x();let e=e6(t,d),r=[];for(let n=0;n<e;n++)r.push({x:e5(t,d+2+4*n),y:e5(t,d+4+4*n)});let n=m();805===i?u.push({points:r,color:n}):c.push({points:r,color:n});break}case 1051:{x();let e=e5(t,d),r=e5(t,d+2),n=e5(t,d+4),i=e5(t,d+6);c.push({points:[{x:i,y:n},{x:r,y:n},{x:r,y:e},{x:i,y:e}],color:m()});break}case 1313:{x();let r=e6(t,d),n=e.subarray(d+2,d+2+r),i=d+2+r;r%2==1&&(i+=1);let o=e5(t,i),s=e5(t,i+2);g(e3(n,a.selectedFont),s,o,[]);break}case 2610:{x();let r=e5(t,d),n=e5(t,d+2),i=e6(t,d+4),o=e6(t,d+6),s=d+8;(6&o)!=0&&(s+=8);let u=e.subarray(s,s+i),c=s+i;i%2==1&&(c+=1);let h=[];if(i>0&&c+2*i<=l)for(let e=0;e<i;e++)h.push(e6(t,c+2*e));g(e3(u,a.selectedFont),n,r,h)}}if(r=l,0===i)break}return{viewBox:n?{x:n.left,y:n.top,width:n.right-n.left,height:n.bottom-n.top}:{x:a.windowOrgX,y:a.windowOrgY,width:a.windowExtX,height:a.windowExtY},texts:l,polylines:u,polygons:c,usedUpdateCp:h}}let e9={97:"α",98:"β",103:"γ",100:"δ",101:"ε",122:"ζ",104:"η",113:"θ",105:"ι",107:"κ",108:"λ",109:"μ",110:"ν",120:"ξ",112:"π",114:"ρ",115:"σ",116:"τ",117:"υ",102:"φ",99:"χ",121:"ψ",119:"ω",65:"Α",66:"Β",71:"Γ",68:"Δ",69:"Ε",90:"Ζ",72:"Η",81:"Θ",73:"Ι",75:"Κ",76:"Λ",77:"Μ",78:"Ν",88:"Ξ",80:"Π",82:"Ρ",83:"Σ",84:"Τ",85:"Υ",70:"Φ",67:"Χ",89:"Ψ",87:"Ω",180:"×",181:"÷",177:"±",178:"·",179:"∙",182:"∂",184:"≠",187:"≤",188:"≥",190:"≈",191:"≡",194:"∈",197:"∉",198:"∋",201:"∅",206:"∩",207:"∪",210:"⊂",211:"⊃",212:"⊄",213:"⊆",214:"⊇",219:"∧",220:"∨",221:"¬",222:"⇒",223:"⇔",224:"∀",225:"∃",226:"∄",227:"∅",228:"∆",229:"∇",230:"∏",231:"∑",232:"−",233:"∗",234:"√",235:"∞",236:"∠",237:"∥",238:"∧",239:"∨",240:"∩",241:"∪",242:"∫",243:"∬",244:"∴",245:"∵",246:"∶",247:"∷",248:"⊥",249:"∟",250:"⌒",251:"⊙",252:"○",253:"●",254:"□",255:"■"},te={40:"(",41:")",91:"[",93:"]",123:"{",125:"}",45:"−",61:"=",43:"+",60:"<",62:">",8230:"…",224:"(",225:")",226:"[",227:"]",228:"{",229:"}",230:"⟨",231:"⟩",232:"⌈",233:"⌉",234:"⌊",235:"⌋",236:"…",237:"⋯",238:"⋮",239:"⋱",240:"←",241:"↑",242:"→",243:"↓",244:"↔",245:"↕",246:"⇐",247:"⇑",248:"⇒",249:"⇓",250:"⇔"};function tt(e,t){if(t&&(2===t.charSet||t.faceName.trim().toLowerCase().startsWith("symbol"))){let t=e9[e.charCodeAt(0)];return void 0!==t?t:e}if(t&&t.faceName.trim().toLowerCase().startsWith("mt extra")){let t=te[e.charCodeAt(0)];if(void 0!==t)return t}return e}function tr(e){return`#${e.toString(16).padStart(6,"0")}`}function tn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let ti={180:"\\times",181:"\\div",177:"\\pm",184:"\\ne",187:"\\le",188:"\\ge",190:"\\approx",191:"\\equiv",112:"\\pi",101:"\\varepsilon",102:"\\varphi",232:"-",236:"\\angle",237:"\\parallel",248:"\\perp",235:"\\infty",234:"\\sqrt{}",97:"\\alpha",98:"\\beta",103:"\\gamma",100:"\\delta",122:"\\zeta",104:"\\eta",113:"\\theta",105:"\\iota",107:"\\kappa",108:"\\lambda",109:"\\mu",110:"\\nu",120:"\\xi",114:"\\rho",115:"\\sigma",116:"\\tau",117:"\\upsilon",99:"\\chi",121:"\\psi",119:"\\omega"},ta={45:"-",240:"\\leftarrow",242:"\\rightarrow",244:"\\leftrightarrow",246:"\\Leftarrow",248:"\\Rightarrow",250:"\\Leftrightarrow"},to={"×":"\\times","÷":"\\div","≤":"\\le","≥":"\\ge","≠":"\\ne","≈":"\\approx","≡":"\\equiv","±":"\\pm","∓":"\\mp","∞":"\\infty",π:"\\pi","°":"^\\circ","∠":"\\angle","⊥":"\\perp","∥":"\\parallel","√":"\\sqrt{}","∴":"\\therefore","∵":"\\because","∈":"\\in","∉":"\\notin","∪":"\\cup","∩":"\\cap","⊂":"\\subset","⊆":"\\subseteq","⊃":"\\supset","∀":"\\forall","∃":"\\exists","∑":"\\sum","∏":"\\prod","∫":"\\int","∬":"\\iint","→":"\\to","←":"\\leftarrow","↔":"\\leftrightarrow","⇒":"\\Rightarrow","⇔":"\\Leftrightarrow","⋅":"\\cdot","⊙":"\\odot","⊗":"\\otimes","∂":"\\partial","∇":"\\nabla",α:"\\alpha",β:"\\beta",γ:"\\gamma",δ:"\\delta",ε:"\\varepsilon",ζ:"\\zeta",η:"\\eta",θ:"\\theta",ι:"\\iota",κ:"\\kappa",λ:"\\lambda",μ:"\\mu",ν:"\\nu",ξ:"\\xi",ρ:"\\rho",σ:"\\sigma",τ:"\\tau",υ:"\\upsilon",φ:"\\varphi",χ:"\\chi",ψ:"\\psi",ω:"\\omega",Γ:"\\Gamma",Δ:"\\Delta",Θ:"\\Theta",Λ:"\\Lambda",Ξ:"\\Xi",Π:"\\Pi",Σ:"\\Sigma",Φ:"\\Phi",Ψ:"\\Psi",Ω:"\\Omega"};function ts(e,t){let r=e.charCodeAt(0);if(t&&(2===t.charSet||t.faceName.trim().toLowerCase().startsWith("symbol"))){let e=ti[r];if(void 0!==e)return e}if(t&&t.faceName.trim().toLowerCase().startsWith("mt extra")){let e=ta[r];if(void 0!==e)return e}let n=tt(e,t),i=to[n];return void 0!==i?i:n}function tl(e){if(e.length<2)return!1;let t=e[0],r=e[e.length-1];return!(Math.abs(t.y-r.y)>2)&&Math.abs(r.x-t.x)>10}function tu(e,t,r){let n=e.op.x+e.width/2;return n>=t.x1-r&&n<=t.x2+r}function tc(e){if(0===e.length)return"";let t=new Map;for(let r of e){let e=r.op.font?Math.abs(r.op.font.height):12;t.set(e,(t.get(e)??0)+1)}let r=12,n=0;for(let[e,i]of t)(i>n||i===n&&e>r)&&(r=e,n=i);let i=[...e].sort((e,t)=>e.op.x-t.op.x),a="";for(let e=0;e<i.length;e++){let t=i[e],n=t.op.font?Math.abs(t.op.font.height):12,o=Array.from(t.op.text).map(e=>ts(e,t.op.font)).join("");if(n<.75*r&&e>0){let r=i[e-1],n=r.op.font?Math.abs(r.op.font.height):12,s=r.baseline;if(t.baseline<s-.15*n){a+=`^{${o}}`;continue}if(t.baseline>s+.15*n){a+=`_{${o}}`;continue}}a+=o}return a}let th="metafile;";function tf(e){try{var t;return t=new Uint8Array(e),function(e){let t=e.viewBox,r=Math.max(1,Math.abs(t.width)),n=Math.max(1,Math.abs(t.height)),i=t.width>=0?t.x:t.x+t.width,a=t.height>=0?t.y:t.y+t.height,o=[];for(let t of(o.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${i} ${a} ${r} ${n}" width="${r}" height="${n}">`),o.push('<rect x="-32768" y="-32768" width="65536" height="65536" fill="#ffffff"/>'),e.polygons)){let e=t.points.map(e=>`${e.x},${e.y}`).join(" ");o.push(`<polygon points="${e}" fill="none" stroke="${tr(t.color)}" stroke-width="1"/>`)}for(let t of e.polylines){let e=t.points.map(e=>`${e.x},${e.y}`).join(" ");o.push(`<polyline points="${e}" fill="none" stroke="${tr(t.color)}" stroke-width="1"/>`)}for(let t of e.texts){let e=Array.from(t.text).map(e=>tt(e,t.font)).join(""),r=t.x,n=t.font?Math.abs(t.font.height):12,i=t.y+Math.round(.8*n),a=6&t.align,s=6===a?' text-anchor="middle"':2===a?' text-anchor="end"':"";o.push(`<text x="${r}" y="${i}" fill="${tr(t.color)}"${s} ${function(e){var t;let r;if(!e)return'font-size="12"';let n=Math.abs(e.height),i=[`font-size="${n}"`];e.bold&&i.push('font-weight="bold"'),e.italic&&i.push('font-style="italic"');let a=tn((r=(t=e.faceName).trim().toLowerCase()).startsWith("times")?"'Times New Roman', 'Nimbus Roman', serif":r.startsWith("arial")||r.startsWith("helvetica")?"Arial, 'Helvetica Neue', sans-serif":r.startsWith("courier")?"'Courier New', Courier, monospace":r.startsWith("symbol")?"Symbol, 'Times New Roman', serif":r.startsWith("mt extra")?"'Times New Roman', serif":r.startsWith("宋")||r.includes("song")||r.includes("simsun")?"'SimSun', 'Songti SC', serif":r.includes("hei")||r.includes("simhei")?"'SimHei', 'Heiti SC', sans-serif":r.includes("kai")||r.includes("kaiti")?"'Kaiti SC', KaiTi, serif":`'${t}', serif`);return i.push(`font-family="${a}"`),i.join(" ")}(t.font)}>${tn(e)}</text>`)}return o.push("</svg>"),o.join("\n")}(e7(t))}catch{return null}}function tm(e){return e.startsWith("data:image/wmf;base64,")||e.startsWith("data:image/emf;base64,")}function td(e){return 96*e/72}async function tg(e){try{var t;let r=new XMLSerializer().serializeToString(e),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r)}`,i=await (t=n,new Promise((e,r)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>r(Error("METAFILE_IMAGE_LOAD_FAILED")),n.src=t}));try{let t=Math.max(1,Math.round(i.naturalWidth||tp(e.getAttribute("width"))||1)),r=Math.max(1,Math.round(i.naturalHeight||tp(e.getAttribute("height"))||1)),n=document.createElement("canvas");n.width=t,n.height=r;let a=n.getContext("2d");if(!a)return null;a.fillStyle="#ffffff",a.fillRect(0,0,t,r),a.drawImage(i,0,0,t,r);let o=n.toDataURL("image/png");return o.length<=5242880?o:null}finally{i.remove()}}catch{return null}}function tp(e){if(!e)return null;let t=/^(-?\d+(?:\.\d+)?)(px|pt)?$/.exec(e.trim());if(!t)return null;let r=Number.parseFloat(t[1]);return!Number.isFinite(r)||r<=0?null:"pt"===t[2]?96*r/72:r}async function tx(e,t,r,n={}){if("emf"===t)return null;let i=n.renderWmfSvg??tf,a=n.rasterize??tg;try{let t=i(e);if(null===t)return null;let r=function(e){let t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(!t||"svg"!==t.tagName.toLowerCase()||!t.getAttribute("viewBox"))throw Error("METAFILE_SVG_PARSE_FAILED");return t}(t);return await a(r)}catch{return null}}async function ty(e,t,r={}){let n=function(e){let t=e.startsWith("data:image/wmf;base64,")?"data:image/wmf;base64,":e.startsWith("data:image/emf;base64,")?"data:image/emf;base64,":null;if(!t)return null;let r=t.includes("/wmf")?"wmf":"emf";try{let n=e.slice(t.length),i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return{bytes:a,format:r}}catch{return null}}(e);return n?tx(n.bytes.buffer.slice(n.bytes.byteOffset,n.bytes.byteOffset+n.bytes.byteLength),n.format,t,r):null}let tw="http://schemas.openxmlformats.org/wordprocessingml/2006/main",tb="urn:schemas-microsoft-com:vml",tN={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp"},tv=new Set(["emf","wmf"]),tS=new Set(["tiff","tif","svg","ico","pcx","tga"]);function tT(e){for(let t of Array.from(e.getElementsByTagNameNS("http://schemas.openxmlformats.org/drawingml/2006/main","blip"))){let e=t.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","embed");if(e)return e}for(let t of Array.from(e.getElementsByTagNameNS("urn:schemas-microsoft-com:vml","imagedata"))){let e=t.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","id");if(e)return e}return null}function tE(e,t){let r=RegExp(`(?:^|;)\\s*${t}\\s*:\\s*(-?\\d+(?:\\.\\d+)?)(pt|px|in|cm|mm|pc)?`,"i").exec(e);if(!r)return null;let n=Number.parseFloat(r[1]);if(!Number.isFinite(n)||n<=0)return null;switch((r[2]??"pt").toLowerCase()){case"px":return n;case"in":return td(72*n);case"cm":return td(n/2.54*72);case"mm":return td(n/25.4*72);case"pc":return td(12*n);default:return td(n)}}function tA(e){for(let t of"object"===e.localName&&e.namespaceURI===tw?[e]:Array.from(e.getElementsByTagNameNS(tw,"object"))){for(let e of Array.from(t.getElementsByTagName("*"))){let t=e.getAttribute("ProgID");if(t&&/Equation/i.test(t))return!0}for(let e of Array.from(t.getElementsByTagNameNS(tb,"shapetype"))){let t=e.getAttribute("id")??"";if(/^_x0000_tole_/i.test(t))return!0}}return!1}function tk(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 tM(e,t={},r){var n;let i,a=new Uint8Array(e);if(!(a.length<eb.length)&&eb.every((e,t)=>a[t]===e))return{questions:[],errors:[{index:-1,reason:"LEGACY_DOC_NOT_SUPPORTED"}],warnings:[]};try{i=function(e){let t=function(e){let t=new Map;for(let[r,n]of Object.entries(e))t.set(r.toLowerCase(),n);return t}(function(e){let t;try{t=(0,ew.r)(e)}catch{throw Error("INVALID_DOCX")}return t}(e)),r=t.get("word/document.xml");if(!r)throw Error("INVALID_DOCX");let n=t.get("word/numbering.xml"),i=t.get("word/styles.xml");return{document:ev(eN(r)),numbering:n?ev(eN(n)):null,styles:i?ev(eN(i)):null,relationships:function(e){let t=e.get("word/_rels/document.xml.rels");if(!t)return{};let r=ev(eN(t)),n={};for(let e of Array.from(r.getElementsByTagNameNS("http://schemas.openxmlformats.org/package/2006/relationships","Relationship"))){let t=e.getAttribute("Id"),r=e.getAttribute("Target");t&&r&&(n[t]=r)}return n}(t),files:function(e){let t={};for(let[r,n]of e)t[r]=n;return t}(t)}}(a)}catch{return{questions:[],errors:[{index:-1,reason:"INVALID_DOCX"}],warnings:[]}}let o={unsupported:new Set,oleCount:0},s={images:[],unsupported:new Set,oleLatexCount:0},l=(e,t)=>{let r=tT(e);if(r&&tA(e)){let e=t.relationships[r];if(e){let r=`word/${e}`.toLowerCase(),n=t.files[r];if(n&&r.endsWith(".wmf")){let{latex:e,confidence:t}=function(e){try{let t=e7(e);return function(e){if(e.polygons.length>0)return{latex:"",confidence:"low"};let t=function(e){let t=[];for(let r of e.polylines){if(!tl(r.points))continue;let e=r.points[0],n=r.points[r.points.length-1];t.push({x1:Math.min(e.x,n.x),x2:Math.max(e.x,n.x),y:Math.round((e.y+n.y)/2)})}return t}(e);if(e.polylines.some(e=>!tl(e.points))||function(e){for(let t=0;t<e.length;t++)for(let r=t+1;r<e.length;r++){let n=e[t],i=e[r];if(Math.min(n.x2,i.x2)-Math.max(n.x1,i.x1)>0&&Math.abs(n.y-i.y)>=2)return!0}return!1}(t))return{latex:"",confidence:"low"};let r=e.texts.map(e=>{let t;return{op:e,baseline:e.y+Math.round((e.font?Math.abs(e.font.height):12)*.8),width:(t=e.font?Math.abs(e.font.height):12,e.text.length*t*.45)}}),n=[],i=new Set,a=!1;for(let e of t){let t=Math.max(6,(e.x2-e.x1)*.25),o=r.filter(r=>!i.has(r)&&tu(r,e,t)&&r.baseline<e.y-4),s=r.filter(r=>!i.has(r)&&tu(r,e,t)&&r.baseline>e.y+4);if(0===o.length||0===s.length){a=!0;continue}let l=tc(o),u=tc(s);if(!l||!u){a=!0;continue}for(let e of o)i.add(e);for(let e of s)i.add(e);n.push({x1:e.x1,x2:e.x2,baselineTop:Math.min(...o.map(e=>e.op.y)),baselineBottom:Math.max(...s.map(e=>e.baseline)),centerY:e.y,latex:`\\frac{${l}}{${u}}`})}let o=[];for(let e of r){if(i.has(e))continue;let t=e.op.font?Math.abs(e.op.font.height):12;o.push({x1:e.op.x,x2:e.op.x+e.width,yTop:e.op.y,baseline:e.baseline,latex:Array.from(e.op.text).map(t=>ts(t,e.op.font)).join(""),fontSize:t})}for(let e of n){let t=e.baselineBottom-e.baselineTop;o.push({x1:e.x1,x2:e.x2,yTop:e.baselineTop,baseline:e.baselineBottom,latex:e.latex,fontSize:Math.max(12,Math.round(.55*t))})}if(0===o.length)return{latex:"",confidence:"low"};let s=[...o].sort((e,t)=>e.baseline-t.baseline||e.x1-t.x1),l=[];for(let e of s){let t=l[l.length-1];if(t){let r=.35*Math.max(...t.map(e=>e.fontSize),e.fontSize);if(Math.abs(t[0].baseline-e.baseline)<=r){t.push(e);continue}}l.push([e])}let u=[];for(let e of l){e.sort((e,t)=>e.x1-t.x1);let t=Math.max(...e.map(e=>e.fontSize)),r="";for(let n=0;n<e.length;n++){let i=e[n];if(i.fontSize<.72*t&&n>0){let t=e[n-1];if(i.baseline<t.baseline-.18*t.fontSize){r+=`^{${i.latex}}`;continue}if(i.baseline>t.baseline+.18*t.fontSize){r+=`_{${i.latex}}`;continue}}r+=i.latex}u.push(r)}let c=u.join(" ").trim();return c?{latex:c,confidence:a?"low":"high"}:{latex:"",confidence:"low"}}(t)}catch{return{latex:"",confidence:"low"}}}(n);if("high"===t&&e)return s.oleLatexCount+=1,`$${e}$`}}}let n=function(e,t,r){let n=tT(e);if(!n)return null;let i=t.relationships[n];if(!i)return null;let a=`word/${i}`.toLowerCase(),o=t.files[a];if(!o)return null;let s=a.split(".").pop()?.toLowerCase()??"";if(tv.has(s)){var l,u;let t="wmf"===s?"wmf":"emf",r=function(e){let t=e.getElementsByTagNameNS("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","extent")[0];if(t){let e=Number.parseInt(t.getAttribute("cx")??"",10),r=Number.parseInt(t.getAttribute("cy")??"",10);if(Number.isFinite(e)&&e>0&&Number.isFinite(r)&&r>0)return{width:e/12700,height:r/12700}}let r=e.getElementsByTagNameNS(tb,"shape")[0],n=r?.getAttribute("style")??"";return{width:tE(n,"width")??300,height:tE(n,"height")??225}}(e),n=function(e,t){let r=Math.max(1,Math.round(e)),n=Math.max(1,Math.round(t));if(n<=120&&n>0){let e=Math.max(2,Math.ceil(120/n));r=Math.max(1,Math.round(r*e)),n=Math.max(1,Math.round(n*e))}let i=Math.max(r,n);if(i>1600){let e=1600/i;r=Math.max(1,Math.round(r*e)),n=Math.max(1,Math.round(n*e))}return{width:r,height:n}}(r.width,r.height);return{dataUrl:function(e,t){let r="";for(let t=0;t<e.length;t+=8192)r+=String.fromCharCode(...e.subarray(t,Math.min(t+8192,e.length)));return`data:image/${t};base64,${btoa(r)}`}(o,t),alt:(l=n.width,u=n.height,`${th}${Math.max(1,Math.round(l))}x${Math.max(1,Math.round(u))}`)}}if(tS.has(s))return r.unsupported.add(s),null;let c=tN[s];if(!c)return r.unsupported.add(s||"unknown"),null;let h="";for(let e=0;e<o.length;e+=8192)h+=String.fromCharCode(...o.subarray(e,Math.min(e+8192,o.length)));let f=btoa(h);return{dataUrl:`data:${c};base64,${f}`}}(e,t,s);if(null===n)return;let i=s.images.length;return s.images.push({...n,oleEquation:tA(e)}),`⟦IMG:${i}⟧`},u=t.image?(e,r)=>t.image(e,r)??l(e,r):l,c={math:e=>{let t,{latex:r,unsupported:n}=(t={unsupported:[],unsupportedSet:new Set},{latex:eF(e,"oMathPara")?function(e,t){let r=[];for(let n of Array.from(e.children))eF(n,"oMath")&&r.push(e4(n,t));return 0===r.length?e0(e,t):r.join(" \\quad ")}(e,t):e4(e,t),unsupported:t.unsupported});for(let e of n)o.unsupported.add(e);let i=r.trim();return i?"oMathPara"===e.localName?`
2
+ $$
3
+ ${i}
4
+ $$
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)}]);