wrong-notebook 2026.11.4-7 → 2026.11.4-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/review/due/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/repeated-mistakes/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/weak-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/api/user/route.js.nft.json +1 -1
- package/.next/server/app/import-batches/[id]/page.js.nft.json +1 -1
- package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/_0tkov27xr068i._.js +5 -4
- package/.next/server/chunks/_1638xaazsmf2m._.js +5 -4
- package/.next/server/chunks/_1vddun9dxzaqo._.js +5 -4
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_0773v8b5gb93o._.js +5 -4
- package/.next/server/chunks/ssr/src_lib_1qhs590-z9xnh._.js +5 -4
- package/.next/server/chunks/ssr/src_lib_1z8akixo3j8ti._.js +5 -4
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/{40t8efajfu_xz.js → 0et32jq7vmu34.js} +6 -5
- package/.next/static/chunks/{0wr5pvnu47q_0.js → 15v06m4dhwt02.js} +1 -1
- package/.next/static/chunks/2gamhj4j8w-tp.js +16 -0
- package/.next/static/chunks/{05pa84fjsr-h8.js → 2r3xwds8ivfso.js} +7 -6
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/static/chunks/0ppbk9n8iiwlv.js +0 -15
- /package/.next/static/{Rh_2qSdtR7MzUEFCrjWo3 → 0CDCOCiyrXDiDocNz5yLy}/_buildManifest.js +0 -0
- /package/.next/static/{Rh_2qSdtR7MzUEFCrjWo3 → 0CDCOCiyrXDiDocNz5yLy}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{Rh_2qSdtR7MzUEFCrjWo3 → 0CDCOCiyrXDiDocNz5yLy}/_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}),
|
|
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,
|
|
8
|
-
${n}`:
|
|
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:
|
|
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}])}])})();
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
$$
|
|
3
3
|
${i}
|
|
4
4
|
$$
|
|
5
|
-
`:`$${i}$`:eM},...t,image:u},m={relationships:i.relationships,files:i.files,mathCollector:s},d=new eT(i.numbering,i.styles),h=(function(e,t,r,n){let i=e.getElementsByTagNameNS(e5,"body")[0];if(!i)return[];let a=[],s=e=>{for(let i of Array.from(e.childNodes))if(i.nodeType===i.ELEMENT_NODE&&i.namespaceURI===e5)if("p"===i.localName){let e=eD(i,r,n),s=t.resolveNumPr(i),o=s?t.paragraphNumber(s[0],s[1]):null,l=o?.trim()??"",u=/[
|
|
5
|
+
`:`$${i}$`:eM},...t,image:u},m={relationships:i.relationships,files:i.files,mathCollector:s},d=new eT(i.numbering,i.styles),h=(function(e,t,r,n){let i=e.getElementsByTagNameNS(e5,"body")[0];if(!i)return[];let a=[],s=e=>{for(let i of Array.from(e.childNodes))if(i.nodeType===i.ELEMENT_NODE&&i.namespaceURI===e5)if("p"===i.localName){let e=eD(i,r,n),s=t.resolveNumPr(i),o=s?t.paragraphNumber(s[0],s[1]):null,l=o?.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(e5,"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&&e$(a,ej,"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(e$(a,ej,"p")){let e=eD(a,r,n);e.trim()&&i.push(e)}else if(e$(a,ej,"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&&e$(a,ej,"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&&s(i)};return s(i),a})(i.document,d,c,m).join("\n"),f=(0,ey.J)(h,r),g=[];if(f.ignored.length>0&&g.push((n=f.ignored.length,`IGNORED_PARAGRAPHS:${n}`)),f.detected||1!==f.questions.length||g.push("SINGLE_QUESTION"),s.unsupported.size>0){let e=Array.from(s.unsupported).slice(0,10).join(",");g.push(`MATH_UNSUPPORTED:${e}`)}if(s.oleCount>0&&g.push(`OLE_EQUATION:${s.oleCount}`),o.unsupported.size>0){let e=Array.from(o.unsupported).slice(0,10).join(",");g.push(`IMAGE_UNSUPPORTED:${e}`)}let p=ep(f.questions.map(e=>{var t;let r,n,i,a;return t=o.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);return i>=0&&i<t.length&&!r.includes(i)&&r.push(i),"[图片]"}),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=>({dataUrl: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}:{}}}).map(e3));return{questions:p.questions,errors:p.errors,warnings:[...g,...eg(p.warnings)]}}let e9="option_",te=["A","B","C","D","E","F"],tt={题干:"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 tr(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 tn(e,t,r){for(let n=0;n<e.length;n++)if(e[n].field===r)return tr(t[n]).trim();return""}function ti(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,s=Math.min(5,e.length);for(let t=0;t<s;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=tt[i];if(a){"text"===a&&(r=!0),t.push({field:a,rawName:e});continue}let s=function(e){let t=e.match(/^(?:选项|选择|choice|option)([a-f])$/);return t?te.indexOf(t[1].toUpperCase()):/^[a-f]$/.test(e)?te.indexOf(e.toUpperCase()):null}(i);if(null!==s&&s<6){t.push({field:`${e9}${s}`,rawName:e});continue}t.push({field:"unknown",rawName:e})}return r?t:null}(e[t].map(e=>tr(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 o=-1;for(let e of a)"string"==typeof e.field&&e.field.startsWith(e9)&&(o=Math.max(o,Number(e.field.slice(e9.length))));let l=[];for(let r=i+1;r<e.length;r++){let s=e[r];if(s.every(e=>""===tr(e).trim()))continue;let o=tn(a,s,"text");if(!o){n.push({index:r-i-1,reason:`TEXT_REQUIRED:row=${r-i}`});continue}let u={text:o},c=tn(a,s,"material");c&&(u.material=c);let m=tn(a,s,"section");m?u.section=m:t&&(u.section=t);let d=tn(a,s,"label");d&&(u.label=d);let h=tn(a,s,"answer");h&&(u.answer=h);let f=tn(a,s,"analysis");f&&(u.analysis=f);let g=tn(a,s,"knowledgePoints");g&&(u.knowledgePoints=g.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean));let p=tn(a,s,"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=tn(a,s,"wrongAnswer");x&&(u.wrongAnswer=x);let y=tn(a,s,"subject");y&&(u.subject=y);let N=tn(a,s,"gradeSemester");N&&(u.gradeSemester=N);let w=tn(a,s,"source");w&&(u.source=w);let b=tn(a,s,"questionType");b&&(u.questionType=b);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(e9)){let e=Number(i.slice(e9.length)),a=tr(t[n]).trim();a&&(r[e]=a)}}return r.filter(e=>void 0!==e&&""!==e)}(a,s);if(v.length>0){let e=v.map((e,t)=>{let r=te[t]??String(t+1);return`${r}.${e}`});u.text=`${o}
|
|
6
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 ta(t){let{default:r}=await e.A(84955),n=await r(t),i=[],a=[],s=[],o=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=ti(t,n.length>1&&!r?e.sheet:void 0);for(let e of l.errors)a.push({index:-1===e.index?-1:e.index+o,reason:e.reason});s.push(...l.warnings.map(t=>`[${e.sheet}] ${t}`)),i.push(...l.questions),o+=l.questions.length}return{questions:i,errors:a,warnings:s}}let ts=/^[\s\-–—·..]*\d{1,4}[\s\-–—·..]*$/;function to(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 tl(e){let t=e.trim();if(!t)return null;if(ts.test(t))return{key:"",isPageNumberOnly:!0};let r=t.replace(/\d+/g,"").trim();return r?{key:r,isPageNumberOnly:!1}:null}function tu(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 tc(){return{cMapUrl:"/pdfjs/cmaps/",cMapPacked:!0,standardFontDataUrl:"/pdfjs/standard_fonts/"}}let tm=null;function td(){return tm||(tm=(async()=>{let t=await e.A(825834);return t.GlobalWorkerOptions.workerSrc=new e.U(e.r(979463)).toString(),t})()),tm}function th(e){return e.x+Math.max(.5*e.height,1)}function tf(e,t){if(!t||0===t.boundaries.length)return 0;let r=e.x+(th(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 tg=[1,0,0,1,0,0];function tp(e,t,r){let[n,i,a,s,o,l]=e;return{x:n*t+a*r+o,y:i*t+s*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 tN(e,t={}){var r;let n,i=t.pdfjs??await td(),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,...tc(),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 s=[],o=[],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,m=0,d=[];try{c=n.numPages;for(let e=1;e<=c;e++){let t=await n.getPage(e),r=t.getViewport({scale:1});if(o.push({width:r.width,height:r.height}),u){let n=await t.getOperatorList(),i=function(e,t,r,n){let i=[],a=[...tg],s=[];for(let o=0;o<e.fnArray.length;o++){let l=e.fnArray[o],u=e.argsArray[o];if(l===n.save){s.push([...a]);continue}if(l===n.restore){let e=s.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,s,o]=e,[l,u,c,m,d,h]=t;return[r*l+i*u,n*l+a*u,r*c+i*m,n*c+a*m,r*d+i*h+s,n*d+a*h+o]}(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 s=function(e,t,r){let n=tp(e,0,0),i=tp(e,t,0),a=tp(e,0,r),s=tp(e,t,r),o=[n.x,i.x,a.x,s.x],l=[n.y,i.y,a.y,s.y],u=Math.min(...o),c=Math.min(...l);return{x:u,y:c,width:Math.max(...o)-u,height:Math.max(...l)-c}}(a,e,n);tx(s,t,r)&&i.push({kind:"image",rect:s});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 s=function(e,t){let[r,n,i,a]=t;return function(e,t,r,n,i){let a=tp(e,t,r),s=tp(e,n,r),o=tp(e,t,i),l=tp(e,n,i),u=[a.x,s.x,o.x,l.x],c=[a.y,s.y,o.y,l.y],m=Math.min(...u),d=Math.min(...c);return{x:m,y:d,width:Math.max(...u)-m,height:Math.max(...c)-d}}(e,r,n,i,a)}(a,[n[0],n[1],n[2],n[3]]);tx(s,t,r)&&i.push({kind:"vector",rect:s});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=to(t.str);if(!r.trim())continue;let[n,,,,i,o]=t.transform,l=Math.abs(n)||1;s.push({str:r,x:i,y:o,width:t.width*l,height:t.height,page:e});let u=r.trim().length;a+=u,m+=u}d.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||m/Math.max(c,1)<20)return{questions:[],errors:[{index:-1,reason:"PDF_NO_TEXT_LAYER"}],warnings:[`PAGES:${c}`]};let h=function(e,t){let r=e.map(e=>({...e,str:to(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,s=[...i].sort((e,t)=>e.y-t.y||e.x-t.x),o=[];for(let e of s){let t=o[o.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):o.push([e])}for(let t of o){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(" ")||tu(r[r.length-1])||tu(e.str[0])||(r+=" ")),r+=e.str,i=e;let s=t.reduce((e,t)=>Math.max(e,t.height),0),o=t.reduce((e,t)=>e+t.y,0)/t.length;n.push({text:r.trimEnd(),x:t[0].x,yTop:a-o-s,height:s,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,s=.06*n.width,o=i.filter(e=>e.x+e.width<=a+s).reduce((e,t)=>e+t.str.trim().length,0),l=i.filter(e=>e.x>=a-s).reduce((e,t)=>e+t.str.trim().length,0),u=o+l;!(u<1)&&!i.some(e=>e.x<a+s&&e.x+e.width>a-s)&&o>=.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,s=r.yTop>=.92*n;if(!a&&!s||r.text.length>100)continue;let o=tl(r.text);if(!o)continue;let l=`${a?"H":"F"}:${o.key}:${o.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:o.key,pages:new Set([r.page]),isPageNumberOnly:o.isPageNumberOnly,minYTop:r.yTop,maxYTopBottom:r.yTop})}return[...i.values()].filter(e=>e.pages.size>=n)}(n,t),s=new Set;for(let e of a)for(let t of n){if(t.page<1||!e.pages.has(t.page))continue;let r=tl(t.text);r?.key===e.key&&(!e.isPageNumberOnly||r.isPageNumberOnly)&&t.yTop>=e.minYTop&&t.yTop<=e.maxYTopBottom&&s.add(t)}return n.filter(e=>!s.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)}(s,o),f=h.map(e=>e.text).join("\n"),g=(0,ey.J)(f,t.splitOptions),p=[`PAGES:${c}`],x=d.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)),N=new Map(Array.from(l.entries()).map(([e,t])=>{let r=o[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}))]})),w=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,s=.06*r.width,o=i.filter(e=>th(e)<=a+s).reduce((e,t)=>e+t.text.trim().length,0),l=i.filter(e=>e.x>=a-s).reduce((e,t)=>e+t.text.trim().length,0),u=o+l;!(u<1)&&!i.some(e=>e.x<a+s&&th(e)>a-s)&&o>=.25*u&&l>=.25*u&&n.set(e,{boundaries:[a]})}return n}(t,r),s=(i=new Map,r.forEach((e,t)=>{e.height<=0||i.set(t+1,{top:.15*e.height,bottom:.92*e.height})}),i),o=e.map(e=>e?function(e,t,r){let n=t[e];if(!n)return e;let i=r.get(n.page)??null,a=tf(n,i),s=e;for(;s>0;){let e=t[s-1],r=t[s];if(e.page!==n.page||tf(e,i)!==a)break;let o=r.yTop-(e.yTop+e.height),l=e.x>n.x+2*n.height;if(o>.8*n.height||!l)break;s-=1}return s}(e.from,t,a):void 0);return e.map((e,i)=>{if(!e||e.from<0||e.from>=t.length)return null;let l=o[i]??e.from,u=o.slice(i+1).find(e=>void 0!==e);return function(e,t,r,n,i,a,s=new Map){if(e<0||e>=r.length)return[];let o=Math.min(t,r.length),l=Math.min(o,r.length),u=l<r.length?r[l]:null,c=r[e],m=(e,t,r)=>!!u&&u.page===e&&tf(u,r)===t,d=[],h=c.page,f=(r[o-1]??c).page;for(let t=h;t<=f;t++){let l=n.find((e,r)=>r+1===t);if(!l)continue;let f=a.get(t)??{top:0,bottom:l.height},y=i.get(t)??null,N=[];for(let n=e;n<o;n++){let e=r[n];e.page===t&&N.push(e)}if(0===N.length)continue;let w=new Map;for(let e of N){let t=tf(e,y),r=w.get(t)??[];r.push(e),w.set(t,r)}for(let[e,r]of Array.from(w.entries()).sort((e,t)=>e[0]-t[0])){let n,a=r[0],o=(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}),N=t===h&&e===tf(c,i.get(h)??null),w=Math.max(0,a.yTop-4);if(!N)for(let e of s.get(t)??[])e.x<o.right&&e.x+e.width>o.left&&e.yTop>=f.top&&e.yTop+e.height<=a.yTop&&(w=Math.min(w,Math.max(0,e.yTop-4)));if(m(t,e,y))n=u.yTop-4;else{let e=r[r.length-1],i=e.yTop+e.height;for(let e of s.get(t)??[])e.x<o.right&&e.x+e.width>o.left&&e.yTop>=w&&e.yTop<f.bottom&&(i=Math.max(i,e.yTop+e.height));n=i+4}(n=Math.min(n,l.height))<=w||d.push({page:t,rect:{x:o.left,yTop:w,width:o.right-o.left,height:n-w}})}}var g,p,x,y,N,w=d;if(w.length<=1)return w;let b=[];for(let e of w){let t=b[b.length-1];t&&t.page===e.page&&(y=t.rect,N=e.rect,y.x<N.x+N.width&&N.x<y.x+y.width&&y.yTop<N.yTop+N.height&&N.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):b.push({...e,rect:{...e.rect}})}return b}(l,void 0!==u&&u<e.to?u:e.to,t,r,a,s,n)})}(g.questions.map(e=>e.lineRange),h,o,N),b=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++)b.has(e)||v.push(w[e]??null);let S=l.size>0,T=Array.from({length:c},(e,t)=>l.get(t+1)??[]),A=o.map(e=>e.height);return{questions:y.questions,errors:y.errors,warnings:[...p,...eg(y.warnings)],pdfRegions:v,pdfHasGraphics:S,pdfPageGraphics:T,pdfPageHeights:A}}let tw={maxLength:ey.f,maxQuestions:ey.k},tb={maxLength:ey.f,maxQuestions:ey.k},tv={json:e=>ex(e.buffer),docx:e=>e7(e.buffer,{},tw),xlsx:e=>ta(e.buffer),csv:async function(e){let t,{text:r}=(0,q.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,s=0;for(65279===e.charCodeAt(0)&&(s=1);s<e.length;){let o=e[s];if(a){'"'===o?'"'===e[s+1]?(i+='"',s+=2):(a=!1,s+=1):(i+=o,s+=1);continue}if('"'===o&&""===i){a=!0,s+=1;continue}if(o===t){n.push(i),i="",s+=1;continue}if("\r"===o){"\n"===e[s+1]&&(s+=1),n.push(i),i="",r.push(n),n=[],s+=1;continue}if("\n"===o){n.push(i),i="",r.push(n),n=[],s+=1;continue}i+=o,s+=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 ti(n)},pdf:e=>tN(e.buffer,{splitOptions:tb})};function tS(){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 s=e(a.canvasWidth,a.canvasHeight),o=s.getContext("2d");if(!o)throw Error("CANVAS_UNSUPPORTED");t(o,a.canvasWidth,a.canvasHeight),o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high";for(let e=0;e<i.length;e++){let t=a.placements[e];o.drawImage(i[e].source,0,0,i[e].width,i[e].height,0,t.y,t.width,t.height)}let l=r(s,.85),u=1;for(;n(l)>1048576&&u>.1;){u*=.85;let n=Math.max(1,Math.round(a.canvasWidth*u)),s=Math.max(1,Math.round(a.canvasHeight*u)),o=e(n,s),c=o.getContext("2d");if(!c)throw Error("CANVAS_UNSUPPORTED");t(c,n,s),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(o,.85)}return l},async renderSingle(i,a,s){let o=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(o.width,o.height),u=l.getContext("2d");if(!u)throw Error("CANVAS_UNSUPPORTED");t(u,o.width,o.height),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(i.source,0,0,i.width,i.height,0,0,o.width,o.height);let c=r(l,.85),m=1;for(;n(c)>s&&m>.1;){m*=.85;let n=Math.max(1,Math.round(o.width*m)),a=Math.max(1,Math.round(o.height*m)),s=e(n,a),l=s.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(s,.85)}return c}}}async function tT(e,t=tS()){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 tA(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 tE(e){let t=await tA(e);return{source:t,width:t.width,height:t.height}}let tk=["subject","gradeSemester","source","figureSvg","extensions"],tj={subject:{zh:"学科",en:"subject"},gradeSemester:{zh:"年级学期",en:"gradeSemester"},source:{zh:"来源",en:"source"},figureSvg:{zh:"配图 SVG",en:"figureSvg"},extensions:{zh:"扩展字段",en:"extensions"}};async function tO(e,t={}){let{renderer:r,decodeFn:n,onProgress:i}=t,a=e.length,s=0,o=[];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=await Promise.all(t.images.map(e=>n(e.dataUrl)));e.image=await tT(i,r)}catch{e.image=null}o.push(e),s+=1,i?.(s,a)}return o}let tI={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"}},tM={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"}},t_={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"}},tP={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"}},t$={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}`},OLE_EQUATION:{zh:e=>`${e} 个 MathType 公式对象按图片导入`,en:e=>`${e} MathType equation object(s) imported as image(s)`},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`}};var tC=e.i(682638);async function tL(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 tD(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)),s=Math.max(1,Math.round(r.rect.height*t)),o=e.width-n,l=e.height-i,u=Math.min(a,o),c=Math.min(s,l);if(u<1||c<1)throw Error("CROP_OUT_OF_BOUNDS");return createImageBitmap(e,n,i,u,c)}async function tR(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),s=i.getViewport({scale:1}),o=Math.max(s.width,s.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,o,n),{canvas:c}=await tL(i,u);try{for(let e of r){let t=await tD(c,u,e);a.push({source:t,width:t.width,height:t.height})}}finally{c.width=0,c.height=0}}return await tT(a,r)}finally{for(let e of a)e.source instanceof ImageBitmap&&e.source.close()}}var tq=e.i(119472);async function tU(e,t,r={}){let n=r.createBatch??tq.v,i=[],a=[];for(let s=0;s<e.length;s++){let o=e[s];try{let e=await n({source:"image",imageBase64:o.dataUrl,imageInfo:{sourceType:"pdf-page",sourceBytes:o.bytes,sourceWidth:o.width,sourceHeight:o.height,outputWidth:o.width,outputHeight:o.height,outputBytes:o.bytes,quality:void 0},language:t.language,subjectId:t.notebookId,targetSubjectId:t.notebookId});i.push({pageNumber:o.pageNumber,batch:e})}catch(e){a.push({pageNumber:o.pageNumber,error:e})}r.onProgress?.(s+1,e.length)}return{successes:i,failures:a}}async function tz(e,t,r){let n=await td();return Q(await n.getDocument({data:new Uint8Array(e.slice(0)),...tc()}).promise,{pages:t,onProgress:r})}async function tF(e,t,r,n,i,a,s){let o=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 m=l.map((e,t)=>{let n=o[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}),d=m.filter(Boolean).length;if(0===d)return l;let h=a?.loadDocument??tG,f=a?.captureQuestion??((e,t)=>tR(e,t??[])),g=await h(e);try{let e=[],t=0;for(let r=0;r<l.length;r++){let a=l[r],u=o[r];if(!m[r]||!u||0===u.length){e.push(a);continue}try{let t=await f(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)}),s.push(`第 ${r+1} 题截图失败:${(0,R.Z)(t)}`),e.push(a)}t+=1,i(t,d)}return e}finally{try{await g.cleanup?.()}catch{}}}async function tG(e){let t=await td();return await t.getDocument({data:new Uint8Array(e.slice(0)),...tc()}).promise}function tB({defaultNotebookId:e}){let{t:i,language:a}=(0,b.b)(),[s,o]=(0,r.useState)(e??""),{phase:l,handleFile:u,handleConfirm:c,handleReset:m,handleScannedPdfConfirm:h}=function({language:e,notebookId:t,texts:i,scannedPdfDeps:a,pdfCaptureDeps:s}){let o=(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 j.c.error(i.notebookRequired);if(l.summary.total>tC.e)return void j.c.error(i.tooManyQuestions.replace("{max}",String(tC.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 tF(l.buffer,l.result,r,l.fileName,(e,t)=>{u({kind:"processingImages",fileName:l.fileName,done:e,total:t})},s,c));let m=a.some(e=>e.images?.length);try{if(m){let e=tS();n=await tO(a,{renderer:e,decodeFn:tE,onProgress:(e,t)=>{u({kind:"processingImages",fileName:l.fileName,done:e,total:t})}})}else n=await tO(a)}catch(e){D.V.error("[FileImport]","Process images failed",{error:(0,R.Z)(e)}),j.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)j.c.warning(e);u({kind:"creating",fileName:l.fileName,batchCount:Math.ceil(l.summary.total/60)});try{let{batches:r,failures:a}=await (0,tC.r)(n,{language:e,subjectId:t,targetSubjectId:t,origin:{fileName:l.fileName,format:l.fileType.key}});for(let e of(r.length>0&&(j.c.success(i.batchesCreated.replace("{count}",String(r.length))),o.push(1===r.length?`/import-batches/${r[0].id}`:"/import-tasks")),a))j.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)}),j.c.error((0,R.Z)(e)),u({kind:"summary",fileName:l.fileName,fileType:l.fileType,result:l.result,summary:l.summary,buffer:l.buffer})}},m=async r=>{let n;if("scanned-pdf"!==l.kind)return;if(!t)return void j.c.error(i.notebookRequired);let{fileName:s,buffer:c}=l;u({kind:"rendering-pdf",fileName:s,rendered:0,total:r.length});try{n=a?.renderPages?await a.renderPages(c,r,(e,t)=>{u({kind:"rendering-pdf",fileName:s,rendered:e,total:t})}):await tz(c,r,(e,t)=>{u({kind:"rendering-pdf",fileName:s,rendered:e,total:t})})}catch(e){D.V.error("[FileImport]","Render scanned PDF failed",{error:(0,R.Z)(e)}),j.c.error(i.pdfRenderFailed),u({kind:"scanned-pdf",fileName:s,buffer:c,pageCount:l.pageCount});return}u({kind:"creating-pdf-batches",fileName:s,created:0,total:n.length});let m=a?.createBatches??tU,{successes:d,failures:h}=await m(n,{language:e,notebookId:t},{onProgress:(e,t)=>{u({kind:"creating-pdf-batches",fileName:s,created:e,total:t})}});for(let e of h){var f;(f=e.error,f?.status===429)?j.c.error(i.pdfQuotaExceeded.replace("{page}",String(e.pageNumber))):j.c.error(i.pdfPageFailed.replace("{page}",String(e.pageNumber)).replace("{error}",(0,R.Z)(e.error)))}d.length>0?(j.c.success(i.batchesCreated.replace("{count}",String(d.length))),o.push(1===d.length?`/import-batches/${d[0].batch.id}`:"/import-tasks")):u({kind:"scanned-pdf",fileName:s,buffer:c,pageCount:l.pageCount})};return{phase:l,handleFile:async(t,r)=>{var n;let a,s,o,l,c,m=tv[r.key]??null;if(!m)return void j.c.error(i.unsupportedType);u({kind:"parsing",fileName:t.name});try{s=await t.arrayBuffer(),a=await m({name:t.name,buffer:s})}catch(e){D.V.error("[FileImport]","Parse file failed",{error:(0,R.Z)(e)}),j.c.error(i.parseFailed),u({kind:"pick"});return}let d=(o=(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&&tI[n])return tI[n][t](i);let a=t_[n]??tM[n];return a?a[t]:"zh"===t?`未知错误(${e})`:`Unknown error (${e})`}(t.reason,e)})),l=n.warnings.map(t=>(function(e,t){let r,n=e.match(/^(\[[^\]]*\])\s*(.*)$/),i=n?n[1]:"",a=n?n[2]:e,s=a.indexOf(":"),o=-1===s?a:a.slice(0,s),l=-1===s?"":a.slice(s+1);if(l&&t$[o])r=t$[o][t](l);else{let e=tP[o];r=e?e[t]:"zh"===t?`未知警告(${a})`:`Unknown warning (${a})`}return i?`${i} ${r}`:r})(t,e)),c=function(e){let t=new Map;for(let r of tk){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:o,warnings:l,ignoredFields:c,ignoredFieldTexts:c.map(({field:t,count:r})=>{let n=tj[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:d.total,errors:d.errorCount,warnings:d.warningCount}),0===d.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:s,pageCount:e});return}let e=d.errors[0]?.message;j.c.error(e??i.noQuestions),u({kind:"pick"});return}u({kind:"summary",fileName:t.name,fileType:r,result:a,summary:d,buffer:s})},handleConfirm:c,handleReset:()=>u({kind:"pick"}),handleScannedPdfConfirm:m}}({language:"en"===a?"en":"zh",notebookId:s,texts:i.fileImport});return(0,t.jsx)(d.N,{className:"rounded-2xl","data-testid":"file-import-panel",children:(0,t.jsxs)(d.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)(I.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:i.fileImport.title})]}),(0,t.jsx)(tV,{phase:l,notebookId:s,onNotebookChange:o,onFile:u,onConfirm:c,onReset:m,onScannedPdfConfirm:h})]})})}function tV({phase:e,notebookId:r,onNotebookChange:n,onFile:i,onConfirm:a,onReset:s,onScannedPdfConfirm:o}){switch(e.kind){case"parsing":return(0,t.jsx)(_,{textKey:"parsing",fileName:e.fileName});case"processingImages":return(0,t.jsx)(M,{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)(Y,{fileName:e.fileName,pageCount:e.pageCount,notebookId:r,onNotebookChange:n,onConfirm:o,onReset:s});case"summary":return(0,t.jsx)(G,{fileName:e.fileName,summary:e.summary,pdfHasGraphics:e.result.pdfHasGraphics,notebookId:r,onNotebookChange:n,onConfirm:a,onReset:s});default:return(0,t.jsx)(F,{onFile:i})}}var tH=e.i(522016),tW=e.i(217255),tQ=e.i(856423),tY=e.i(975153),tX=e.i(218964),tK=e.i(697886);let tZ=()=>()=>{};function tJ({href:e,icon:r,label:n,value:i}){return(0,t.jsxs)(tH.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 t0({notebookCount:e,itemCount:n,dueCount:i,targetNotebook:a}){let{t:s,language:o}=(0,b.b)(),{data:l}=(0,tW.useSession)(),u=(0,r.useSyncExternalStore)(tZ,()=>new Date().getHours(),()=>null),c=null===u?s.common.welcome.replace(/[,,\s]+$/,""):u<12?s.home.greetingMorning:u<18?s.home.greetingAfternoon:s.home.greetingEvening,m=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,m&&`${"zh"===o?",":", "}${m}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:s.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)(tK.f,{className:"h-3.5 w-3.5"}),s.home.targetNotebook.replace("{name}",a)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(tJ,{href:"/notebooks",icon:tQ.f,label:s.home.notebookCount,value:e}),(0,t.jsx)(tJ,{href:"/notebooks",icon:tX.f,label:s.home.itemCount,value:n}),(0,t.jsx)(tJ,{href:"/review",icon:tY.f,label:s.home.dueCount,value:i})]})]})]})}var t1=e.i(12130),t2=e.i(430634),t4=e.i(576019),t5=e.i(847483),t6=e.i(497346),t8=e.i(717448),t3=e.i(798469),t7=e.i(86963),t9=e.i(956738),re=e.i(185592),rt=e.i(41931),rr=e.i(35209),rn=e.i(598053),ri=e.i(315092);function ra(){let{t:e}=(0,b.b)();(0,rr.f)(e.pageTitle.home);let a=(0,n.useSearchParams)().get("notebook"),[s,d]=(0,r.useState)([]),[h,f]=(0,r.useState)(null),[g,p]=(0,r.useState)("image"),x=a?s.find(e=>e.id===a):void 0,y=(0,rn.f)({logPrefix:"[Home]",analyzeSubjectId:a,importSubjectId:a,textNotebook:x&&{id:x.id,name:x.name}});(0,r.useEffect)(()=>{rt.k.get("/api/notebooks").then(e=>d(e)).catch(e=>D.V.error("[Home]","Failed to fetch notebooks",{error:e})),rt.k.get("/api/review/due?pageSize=1").then(e=>f(e.total)).catch(e=>D.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let N=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")},w=s.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:o,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)(t9.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)(t6.f,{message:y.saveError,onDismiss:y.dismissSaveError}),"upload"===y.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(t0,{notebookCount:s.length,itemCount:w,dueCount:h,targetNotebook:a?x?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(re.f,{options:v,value:g,onChange:p}),y.pendingTask&&(0,t.jsx)(t4.f,{task:y.pendingTask,onRefresh:y.refreshPendingTask,onDismiss:y.dismissPendingTask}),y.lastImported&&(0,t.jsx)(t2.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)(t5.f,{parts:y.parts.map(e=>e.dataUrl),busy:y.isBusy,onFinish:()=>void y.finishParts(),onDiscard:y.discardParts}),(0,t.jsx)(t3.f,{onImageSelect:y.selectImage,isAnalyzing:y.isBusy})]}):"text"===g?(0,t.jsx)(t8.f,{onSubmit:y.submitText,isAnalyzing:y.isBusy,defaultNotebookName:x?.name,onCreateBatch:y.createTextBatch,creatingBatch:y.creatingBatch,onSwitchToFileImport:()=>p("file")}):"file"===g?(0,t.jsx)(tB,{defaultNotebookId:a||void 0}):(0,t.jsx)(O,{onSubmit:N,defaultNotebookId:a||void 0,defaultNotebookName:x?.name,isSaving:"saving"===y.analysisStep})]})]}),y.croppingImage&&(0,t.jsx)(t1.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<ri.u-1?y.addPart:void 0,partCount:y.parts.length}),"review"===y.step&&y.parsedData&&(0,t.jsx)(m.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)(t7.f,{}),children:(0,t.jsx)(ra,{})})}],952683)}]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,399847,e=>{var t=e.i(456420);let s={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"]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],399847)},13285,e=>{var t=e.i(456420);let s={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"]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],13285)},615568,168148,e=>{var t=e.i(456420);let s={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"}]]};s.node;let r=(0,t.f)(s);e.s(["f",0,r],615568);var n=e.i(843476),a=e.i(271645),i=e.i(30030),l=e.i(248425),o=Object.defineProperty,u=(e,t)=>o(e,"name",{value:t,configurable:!0}),d="Progress",[c,m]=(0,i.f)(d),[f,h]=c(d),g=a.forwardRef(u(function(e,t){let{__scopeProgress:s,value:r=null,max:a,getValueLabel:i=x,...o}=e;(a||0===a)&&!v(a)&&console.error(b(`${a}`,"Progress"));let u=v(a)?a:100;null===r||j(r,u)||console.error(k(`${r}`,"Progress"));let d=j(r,u)?r:null,c=w(d)?i(d,u):void 0;return(0,n.jsx)(f,{scope:s,value:d,max:u,children:(0,n.jsx)(l.V.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":w(d)?d:void 0,"aria-valuetext":c,role:"progressbar","data-state":y(d,u),"data-value":d??void 0,"data-max":u,...o,ref:t})})},"Progress")),p=a.forwardRef(u(function(e,t){let{__scopeProgress:s,...r}=e,a=h("ProgressIndicator",s);return(0,n.jsx)(l.V.div,{"data-state":y(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:t})},"ProgressIndicator"));function x(e,t){return`${Math.round(e/t*100)}%`}function y(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function w(e){return"number"==typeof e}function v(e){return w(e)&&!isNaN(e)&&e>0}function j(e,t){return w(e)&&!isNaN(e)&&e<=t&&e>=0}function b(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 k(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2
|
+
- a positive number
|
|
3
|
+
- less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
|
|
4
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5
|
+
|
|
6
|
+
Defaulting to \`null\`.`}u(x,"defaultGetValueLabel"),u(y,"getProgressState"),u(w,"isNumber"),u(v,"isValidMaxNumber"),u(j,"isValidValueNumber"),u(b,"getInvalidMaxError"),u(k,"getInvalidValueError");var S=e.i(975157);let N=a.forwardRef(({className:e,value:t,...s},r)=>(0,n.jsx)(g,{ref:r,value:t,className:(0,S.f)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...s,children:(0,n.jsx)(p,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));N.displayName=g.displayName,e.s(["f",0,N],168148)},866531,497346,183444,e=>{var t=e.i(843476),s=e.i(271645),r=e.i(632781),n=e.i(741120),a=e.i(856522),i=e.i(314381),l=e.i(3198),o=e.i(519455),u=e.i(111110),d=e.i(41931),c=e.i(294114),m=e.i(201276);function f({data:e,onChange:n}){let{t:a}=(0,u.b)(),[h,g]=(0,s.useState)(!1),[p,x]=(0,s.useState)(null),y=async()=>{if(!e.questionText.trim())return void c.c.warning(a.editor.enterQuestionFirst||"Please enter question text first");if(!e.answerText.trim())return void c.c.warning(a.geogebra.answerRequired);g(!0),x(null);try{let t=await d.k.post("/api/geogebra-analyze",{questionText:e.questionText,answerText:e.answerText,analysis:e.analysis},{timeout:18e4,recoverable:!0});t.suitable&&t.commands&&t.commands.length>0?n({geogebraCommands:JSON.stringify(t.commands)}):x(t.description||a.geogebra.notSuitable)}catch(e){m.V.error("[CorrectionEditor]","GeoGebra analysis failed",{error:e}),x(a.geogebra.analyzeFailed)}finally{g(!1)}};return e.geogebraCommands?(0,t.jsx)(l.f,{commands:e.geogebraCommands,height:350,onRegenerate:y,onDelete:async()=>n({geogebraCommands:void 0})}):e.questionText.trim()&&e.answerText.trim()?(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(i.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:a.geogebra.title})]}),(0,t.jsx)(o.f,{variant:"outline",size:"sm",onClick:y,disabled:h,children:h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.geogebra.analyzing]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),a.geogebra.generate]})})]}),p&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:p}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:a.geogebra.hint})]}):null}var h=e.i(469937),g=e.i(28342),p=e.i(438465),x=e.i(674166),y=e.i(110204),w=e.i(967489),v=e.i(401280);function j({data:e,paperLevel:s,onChange:r}){let{t:n}=(0,u.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:n.editor.selectNotebook||"Select Notebook"}),(0,t.jsx)(p.f,{value:e.subjectId,onChange:e=>r({subjectId:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:n.questionType.label||"Question Type"}),(0,t.jsxs)(w.d,{value:e.questionType||"",onValueChange:e=>r({questionType:e===v.O?null:e}),children:[(0,t.jsx)(w.P,{children:(0,t.jsx)(w.U,{placeholder:n.questionType.notSet||"Not set"})}),(0,t.jsxs)(w.r,{children:[(0,t.jsx)(w.T,{value:v.O,children:n.questionType.clear||"Clear"}),v.V.map(e=>(0,t.jsx)(w.T,{value:e,children:n.questionType.names?.[e]||e},e))]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{htmlFor:"correction-grade-semester",children:n.editor.gradeSemester||"Grade/Semester"}),(0,t.jsx)(g.f,{id:"correction-grade-semester",value:e.gradeSemester||"",onChange:e=>r({gradeSemester:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:n.editor.paperLevel||"Paper Level"}),(0,t.jsx)(x.f,{value:s,onChange:e=>r({paperLevel:e})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:n.difficulty.label}),(0,t.jsx)("div",{children:(0,t.jsx)(h.f,{size:"md",value:e.difficultyStars,onChange:e=>r({difficultyStars:e})})})]})]})}var b=e.i(141176),k=e.i(515288);function S({data:e,onChange:s}){let{t:r}=(0,u.b)();return(0,t.jsxs)(k.N,{children:[(0,t.jsx)(k.Y,{children:(0,t.jsx)(k.v,{children:r.editor.mistakeAnalysisTitle||"Mistake Analysis"})}),(0,t.jsxs)(k.O,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:r.editor.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(w.d,{value:e.mistakeStatus||"unknown",onValueChange:e=>s({mistakeStatus:e}),children:[(0,t.jsx)(w.P,{children:(0,t.jsx)(w.U,{})}),(0,t.jsxs)(w.r,{children:[(0,t.jsx)(w.T,{value:"not_attempted",children:r.editor.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(w.T,{value:"wrong_attempt",children:r.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(w.T,{value:"unknown",children:r.editor.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:r.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(b.f,{value:e.wrongAnswerText||"",onChange:t=>s({wrongAnswerText:t,mistakeStatus:t.trim()?"wrong_attempt":e.mistakeStatus}),className:"min-h-[100px] font-mono text-sm",placeholder:r.editor.wrongAnswerPlaceholder||"Leave blank if no wrong answer is visible"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:r.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(b.f,{value:e.mistakeAnalysis||"",onChange:e=>s({mistakeAnalysis:e}),className:"min-h-[140px] font-mono text-sm",placeholder:r.editor.mistakeAnalysisPlaceholder||"Explain where and why the mistake happened"})]})]})]})}var N=e.i(511445),T=e.i(149704);function A({title:e,children:s,className:r}){return(0,t.jsxs)(k.N,{children:[(0,t.jsx)(k.Y,{children:(0,t.jsx)(k.v,{children:e})}),(0,t.jsx)(k.O,{className:r,children:s})]})}function I({data:e,children:s}){let{t:r}=(0,u.b)(),n={wrong_attempt:r.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt",not_attempted:r.editor.mistakeStatuses?.notAttempted||"Not attempted",unknown:r.editor.mistakeStatuses?.unknown||"Unknown"};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(A,{title:r.editor.preview?.question||"Question Preview",children:[(0,t.jsx)(N.f,{content:e.questionText}),(0,t.jsx)(T.f,{svg:e.figureSvg})]}),s,(0,t.jsx)(A,{title:r.editor.preview?.answer||"Answer Preview",children:(0,t.jsx)(N.f,{content:e.answerText})}),(0,t.jsx)(A,{title:r.editor.preview?.analysis||"Analysis Preview",children:(0,t.jsx)(N.f,{content:e.analysis})}),(0,t.jsxs)(A,{title:r.editor.preview?.mistakeAnalysis||"Mistake Analysis Preview",className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"text-muted-foreground",children:[r.editor.mistakeStatus||"Attempt Status",r.common.colon,n[e.mistakeStatus]??n.unknown]}),e.wrongAnswerText&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:r.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(N.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:r.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(N.f,{content:e.mistakeAnalysis})]})]})]})}var E=e.i(574041),$=e.i(215519),_=e.i(306831);e.i(676167);var C=e.i(597138),M=e.i(991722),R=e.i(470279),q=e.i(303163);e.s(["f",0,function({initialData:e,onSave:i,onCancel:l,imagePreview:h,initialSubjectId:g,aiTimeout:p}){let{timeZone:x}=(0,$.M)(),{t:w,language:v}=(0,u.b)(),N=e=>e.trim()?e:"",[T,A]=(0,s.useState)({...e,answerText:N(e.answerText),analysis:N(e.analysis),wrongAnswerText:e.wrongAnswerText||"",mistakeAnalysis:e.mistakeAnalysis||"",mistakeStatus:e.mistakeStatus||"unknown",subjectId:g,gradeSemester:e.gradeSemester||""}),O=(0,s.useRef)(!1),P=e=>{"gradeSemester"in e&&(O.current=!0),A(t=>({...t,...e}))},{groups:U}=(0,R.f)(),L=(()=>{if(T.paperLevel)return T.paperLevel;let e="number"==typeof T.difficultyStars&&T.difficultyStars>=4?"b":"a";return U.find(t=>t.key===e&&t.isActive)?.id||""})(),V=T.paperLevel??L,[F,z]=(0,s.useState)(!1),[H,D]=(0,s.useState)(!1),[G,Q]=(0,s.useState)(!1),[W,B]=(0,s.useState)(void 0),[J,Z]=(0,s.useState)([]);(0,s.useEffect)(()=>{d.k.get("/api/notebooks").then(Z).catch(e=>m.V.error("[CorrectionEditor]","Failed to fetch notebooks",{error:e})),d.k.get("/api/user").then(e=>{if(Q(!!e?.enableGeogebra),e){let t=function(e,t=_.J){return"ai"===e.gradeRecognitionMode?null:e.fixedGradeSemester?e.fixedGradeSemester:e.educationStage&&e.enrollmentYear?function(e,t,s=new Date,r="en",n=_.J){let a=(0,_.c)(s,n),i=a.getFullYear(),l=a.getMonth()+1,o=i-t,u="2nd";l>=9?(o+=1,u="1st"):u=l<2?"1st":"2nd";let d="zh"===r,c=d?"1st"===u?"上期":"下期":"1st"===u?"1st Semester":"2nd Semester",m=(d?{primary:["一年级","二年级","三年级","四年级","五年级","六年级"],junior_high:["初一","初二","初三"],senior_high:["高一","高二","高三"],university:["大一","大二","大三","大四"]}:{primary:["Grade 1","Grade 2","Grade 3","Grade 4","Grade 5","Grade 6"],junior_high:["Junior High Grade 1","Junior High Grade 2","Junior High Grade 3"],senior_high:["Senior High Grade 1","Senior High Grade 2","Senior High Grade 3"],university:["Freshman","Sophomore","Junior","Senior"]})[e]||[],f=`${o}`;if(f=o>0&&o<=m.length?m[o-1]:o>m.length?d?"已毕业":"Graduated":d?"学前":"Pre-school",!d)return`${f}, ${c}`;{let e="1st"===u?"上":"下";return`${f}${e}`}}(e.educationStage,e.enrollmentYear,new Date,"zh",t):null}(e,x);A(e=>e.gradeSemester||O.current?e:{...e,gradeSemester:t||""}),B(e.educationStage||void 0)}}).catch(e=>m.V.error("[CorrectionEditor]","Failed to fetch user info for grade calculation",{error:e}))},[v,x]);let X=async()=>{if(!T.questionText.trim())return void c.c.warning(w.editor.enterQuestionFirst||"Please enter question text first");z(!0);try{let e=function({questionText:e,language:t,subject:s,imagePreview:r,gradeSemester:n,subjectId:a}){let i={questionText:e,language:t,subject:s};return r&&(i.imageBase64=r),n&&(i.gradeSemester=n),a&&(i.subjectId=a),i}({questionText:T.questionText,language:v,subject:T.subject,imagePreview:h,gradeSemester:T.gradeSemester??void 0,subjectId:T.subjectId});m.V.info("[Reanswer]",e.imageBase64?"Sending image + text (image available for mistake analysis)":"Sending text only (no image available)",{timeout:p});let t=await d.k.post("/api/reanswer",e,{timeout:p||18e4,recoverable:!0});A(e=>({...e,answerText:t.answerText,analysis:t.analysis,knowledgePoints:t.knowledgePoints,wrongAnswerText:t.wrongAnswerText||"",mistakeAnalysis:t.mistakeAnalysis||"",mistakeStatus:(0,M.x)(t.mistakeStatus,t.wrongAnswerText),difficultyStars:t.difficultyStars??e.difficultyStars,questionType:t.questionType??e.questionType})),c.c.success(w.editor.reanswerSuccess||"✅ Answer and analysis updated!")}catch(r){let e,t,s;m.V.error("[CorrectionEditor]","Reanswer failed",{error:r}),c.c.error((e=(0,q.d)(r)||"",s=(t=w.errors?.reanswer||{}).default||"Reanswer failed",e.includes("AI_AUTH_ERROR")?t.authError||w.errors?.AI_AUTH_ERROR||s:e.includes("AI_CONNECTION_FAILED")?t.connectionFailed||w.errors?.AI_CONNECTION_FAILED||s:e.includes("AI_RESPONSE_ERROR")&&(t.responseError||w.errors?.AI_RESPONSE_ERROR)||s))}finally{z(!1)}},Y=async()=>{if(!T.subjectId)return void c.c.warning(w.editor.messages?.selectNotebook||"Please select a notebook");if(!H){D(!0);try{await i({...T,paperLevel:V,mistakeStatus:(0,M.x)(T.mistakeStatus,T.wrongAnswerText)})}finally{D(!1)}}},K=w.editor.placeholder||"Supports Markdown and LaTeX...",ee=(0,C.f)(J.find(e=>e.id===T.subjectId)?.name||null)||(0,C.f)(T.subject||null)||void 0;return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold",children:w.editor.title}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(o.f,{variant:"outline",onClick:l,children:w.editor.cancel}),(0,t.jsxs)(o.f,{onClick:Y,disabled:H,children:[H?(0,t.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(a.f,{className:"mr-2 h-4 w-4"}),H?w.common?.pleaseWait||"Please wait...":w.editor.save]})]})]}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[h&&(0,t.jsx)(k.N,{children:(0,t.jsx)(k.O,{className:"p-4",children:(0,t.jsx)("img",{src:h,alt:"Original",className:"w-full rounded-md"})})}),(0,t.jsx)(j,{data:T,paperLevel:V,onChange:P}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:w.editor.question}),(0,t.jsx)(b.f,{value:T.questionText,onChange:e=>P({questionText:e}),className:"min-h-[150px] font-mono text-sm",placeholder:K}),(0,t.jsx)(o.f,{variant:"default",size:"sm",onClick:X,disabled:F||!T.questionText.trim(),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",children:F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),w.editor.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4"}),w.editor.reanswer||"🔄 Reanswer (based on corrected question)"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:w.editor.reanswerHint||"💡 If the question was misrecognized, correct it and click to regenerate answer"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:w.editor.tags}),(0,t.jsx)(E.f,{value:T.knowledgePoints,onChange:e=>P({knowledgePoints:e}),placeholder:w.editor.tagsPlaceholder||"Enter knowledge tags...",enterHint:w.editor.createTagHint,subject:ee,gradeStage:W}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:w.editor.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:w.editor.answer}),(0,t.jsx)(b.f,{value:T.answerText,onChange:e=>P({answerText:e}),className:"min-h-[100px] font-mono text-sm",placeholder:K})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(y.f,{children:w.editor.analysis}),(0,t.jsx)(b.f,{value:T.analysis,onChange:e=>P({analysis:e}),className:"min-h-[200px] font-mono text-sm",placeholder:K})]}),(0,t.jsx)(S,{data:T,onChange:P})]}),(0,t.jsx)(I,{data:T,children:G&&(0,t.jsx)(f,{data:T,onChange:P})})]})]})}],866531);var O=e.i(853138),P=e.i(263676);e.s(["f",0,function({message:e,onDismiss:s}){let{t:r}=(0,u.b)();return e?(0,t.jsxs)("div",{role:"alert",className:"flex items-start gap-3 rounded-xl border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive",children:[(0,t.jsx)(O.f,{"aria-hidden":"true",className:"mt-0.5 h-4 w-4 shrink-0"}),(0,t.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:e}),(0,t.jsx)("button",{type:"button",onClick:s,"aria-label":r.common.close,className:"shrink-0 rounded p-1 hover:bg-destructive/10",children:(0,t.jsx)(P.X,{"aria-hidden":"true",className:"h-4 w-4"})})]}):null}],497346);var U=e.i(618566);function L(e){return"object"!=typeof e||null===e||Array.isArray(e)?void 0:e}function V(e,t){if("string"!=typeof e||!/^(QUESTION_SAVE_|AI_)[A-Z_]+$/.test(e))return;let s=t.errors[e];return"string"==typeof s?s:void 0}e.s(["f",0,function(e){let{t}=(0,u.b)(),r=(0,U.useRouter)(),[n,a]=(0,s.useState)(null),i=async(s,n,i=!0)=>{a(null);try{let e=await s();return c.c.success(e.duplicate?t.importFlow.duplicate:t.common.messages.saveSuccess),i&&(e.duplicate?r.push(`/error-items/${e.id}`):n&&r.push(`/notebooks/${n}`)),!0}catch(r){m.V.error(e,"Save failed",{errorMessage:(0,q.d)(r)??(0,q.Z)(r)});let s=function(e,t){let s=L(e),r=L(s?.data),n="number"==typeof s?.status?s.status:void 0,a=(0,q.d)(e),i=V(a,t)??V(r?.code,t),l={400:t.errors.QUESTION_SAVE_INVALID_INPUT,401:t.errors.QUESTION_SAVE_UNAUTHORIZED,403:t.errors.QUESTION_SAVE_FORBIDDEN,408:t.errors.QUESTION_SAVE_TIMEOUT,409:t.errors.QUESTION_SAVE_CONFLICT,413:t.errors.QUESTION_SAVE_TOO_LARGE,429:t.errors.QUESTION_SAVE_RATE_LIMITED,502:t.errors.QUESTION_SAVE_SERVER_UNAVAILABLE,503:t.errors.QUESTION_SAVE_SERVER_UNAVAILABLE,504:t.errors.QUESTION_SAVE_TIMEOUT},o=i??(n?l[n]:void 0)??t.errors.QUESTION_SAVE_FAILED;!n&&(e instanceof TypeError||/fetch|network|load failed/i.test((0,q.Z)(e)))&&(o=t.errors.QUESTION_SAVE_NETWORK_ERROR);let u=L(r?.details);if("QUESTION_SAVE_GRADE_FAILED"===a){let e=V(u?.reason,t);e&&(o+=`
|
|
7
|
+
${e}`)}return 400===n&&(o+=(function(e,t){if(!Array.isArray(e))return[];let s={questionText:t.editor.question,answerText:t.editor.answer,analysis:t.editor.analysis,wrongAnswerText:t.editor.wrongAnswerText,mistakeAnalysis:t.editor.mistakeAnalysis,knowledgePoints:t.editor.tags,subjectId:t.editor.selectNotebook,gradeSemester:t.editor.gradeSemester,paperLevel:t.editor.paperLevel};return e.slice(0,3).flatMap(e=>{let r=L(e),n=r?.path,a=Array.isArray(n)&&"string"==typeof n[0]?s[n[0]]:void 0;if(!a)return[];let i=r?.maximum,l=t.questionSave.invalidField;return r?.code==="too_big"&&"number"==typeof i&&Number.isSafeInteger(i)&&i>=0&&(l="array"===r.origin?t.questionSave.tooMany:t.questionSave.tooLong),[l.replace("{field}",a).replace("{maximum}",String(i))]})})(r?.details,t).map(e=>`
|
|
8
|
+
${e}`).join("")),"string"==typeof u?.databaseCode&&/^P\d{4}$/.test(u.databaseCode)&&(o+=`
|
|
9
|
+
${t.questionSave.databaseCode.replace("{code}",u.databaseCode)}`),n&&(o+=` (HTTP ${n})`),o}(r,t);return a(s),"AI_DAILY_LIMIT_EXCEEDED"!==(0,q.d)(r)&&c.c.error(s),!1}};return{saveError:n,setSaveError:a,dismissSaveError:()=>a(null),run:i}}],183444)},731335,532377,339501,e=>{var t=e.i(843476),s=e.i(399847),r=e.i(551757),n=e.i(456420);let a={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};a.node;let i=(0,n.f)(a);var l=e.i(632781),o=e.i(615568),u=e.i(487486),d=e.i(519455),c=e.i(168148),m=e.i(111110),f=e.i(215519),h=e.i(306831);let g=["read","convert","crop","compress","upload"],p=["receive","analyze","save"];function x(e){if(!Number.isFinite(e)||e<0)return"-";if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(+(t<10))}s`;let s=Math.round(t);return`${Math.floor(s/60)}:${String(s%60).padStart(2,"0")}`}var y=e.i(975157);let w={analyzing:50,saving:90},v={analyzing:l.f,saving:l.f,review:o.f,saved:r.f,failed:s.f};e.s(["f",0,function({task:e,now:s,onReview:r,onViewItem:n,onRetry:a,onDiscard:l}){let{t:o}=(0,m.b)(),{timeZone:j}=(0,f.M)(),b=v[e.status],k="analyzing"===e.status||"saving"===e.status,S=o.errors,N=e.error?"string"==typeof S[e.error]?S[e.error]:e.error:null,T=function(e){let t=[];for(let s of g){let r=e?.client?.[s];"number"==typeof r&&t.push({stage:s,ms:r})}for(let s of p){let r=e?.server?.[s];"number"==typeof r&&t.push({stage:s,ms:r})}return t}(e.timings),A=k&&s?s-Date.parse(e.createdAt):null;return(0,t.jsxs)("div",{className:(0,y.f)("space-y-2 rounded-lg border p-3 text-sm",e.unread&&"border-primary/50 bg-primary/5"),"data-testid":"import-task-card","data-status":e.status,children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(b,{className:(0,y.f)("mt-0.5 h-4 w-4 shrink-0",k&&"animate-spin text-primary","saved"===e.status&&"text-green-600","failed"===e.status&&"text-destructive","review"===e.status&&"text-primary")}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium",children:o.importTasks.status[e.status]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o.importTasks.mode[e.mode]}),e.unread&&(0,t.jsx)(u.f,{children:o.importTasks.unread})]}),k&&(0,t.jsx)(c.f,{value:w[e.status],"aria-label":o.importTasks.stageEstimate,"aria-valuetext":o.common.progress.estimated.replace("{percent}",String(w[e.status])),className:"h-1.5"}),e.excerpt&&(0,t.jsx)("p",{className:"break-words text-muted-foreground",children:e.excerpt}),"saved"===e.status&&!e.errorItemId&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o.importTasks.itemDeleted}),"saved"===e.status&&e.errorItemId&&(0,t.jsx)("p",{className:"text-xs text-green-700 dark:text-green-300",children:e.duplicate?o.importTasks.duplicateSaved:o.importTasks.savedTo.replace("{notebook}",e.notebookName||"-").replace("{id}",e.errorItemShortId||"-")}),N&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:N}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(i,{className:"h-3 w-3"}),o.importTasks.createdAt.replace("{time}",(0,h.r)(e.createdAt,"MM-dd HH:mm",j))]}),null!==A&&(0,t.jsx)("span",{children:o.importTasks.elapsed.replace("{time}",x(A))}),e.attempts>1&&(0,t.jsx)("span",{children:o.importTasks.attempts.replace("{count}",String(e.attempts))})]}),T.length>0&&(0,t.jsx)("ul",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground tabular-nums","aria-label":"timings",children:T.map(({stage:e,ms:s})=>(0,t.jsxs)("li",{children:[o.importTasks.timings[e]," ",x(s)]},e))})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:["review"===e.status&&r&&(0,t.jsx)(d.f,{size:"sm",onClick:r,children:o.importTasks.continueReview}),"saved"===e.status&&e.errorItemId&&n&&(0,t.jsx)(d.f,{size:"sm",variant:"outline",onClick:n,children:o.importTasks.viewItem}),"failed"===e.status&&a&&(0,t.jsx)(d.f,{size:"sm",onClick:a,children:o.importTasks.retry}),"saving"!==e.status&&"saved"!==e.status&&l&&(0,t.jsx)(d.f,{size:"sm",variant:"ghost",onClick:l,children:o.importTasks.discard})]})]})}],731335);var j=e.i(618566),b=e.i(767077),k=e.i(294114),S=e.i(201276),N=e.i(127175);e.s(["f",0,function(e){let{t}=(0,m.b)(),s=(0,j.useRouter)(),r=e=>{e.unread&&(0,N.N)(e.id).catch(e=>S.V.warn("[ImportTasks]","Mark read failed",{error:e}))};return{openReview:e=>{r(e),s.push(`/import-tasks/${e.id}`)},viewItem:e=>{e.errorItemId&&(r(e),s.push(`/error-items/${e.errorItemId}`))},markRead:r,retry:async s=>{try{await (0,N.R)(s.id),k.c.info(t.importTasks.retried)}catch(e){k.c.error((0,b.f)(e,t))}e?.()},discard:async s=>{if(!await (0,k.u)(t.importTasks.discardConfirm))return!1;let r=!1;try{await (0,N.x)(s.id),k.c.success(t.importTasks.discarded),r=!0}catch(e){k.c.error((0,b.f)(e,t))}return e?.(),r}}}],532377);var T=e.i(271645);e.s(["f",0,function(e,t=1e3){let[s,r]=(0,T.useState)(()=>Date.now());return(0,T.useEffect)(()=>{if(!e)return;let s=setInterval(()=>r(Date.now()),t);return()=>clearInterval(s)},[e,t]),s}],339501)},499930,e=>{var t=e.i(213761);function s(e,t=.008){let r=Math.max(0,e.x-t),n=Math.max(0,e.y-t);return{x:r,y:n,width:Math.min(1,e.x+e.width+t)-r,height:Math.min(1,e.y+e.height+t)-n}}async function r(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 n(e,s){let r=function(e,t=16,s=!1){let r=Math.max(...e.map(e=>e.width)),n=0,a=e.map(e=>{let a=s?r/e.width:e.scale??1,i={x:0,y:n,width:Math.round(e.width*a),height:Math.round(e.height*a)};return n+=i.height+t,i});return{width:Math.max(...a.map(e=>e.width)),height:n-t,rects:a}}(e.map(e=>({width:e.sw,height:e.sh,scale:e.scale})),16,s),n=document.createElement("canvas");n.width=r.width,n.height=r.height;let a=n.getContext("2d");if(!a)throw Error("CANVAS_UNSUPPORTED");a.fillStyle="#ffffff",a.fillRect(0,0,n.width,n.height),e.forEach((e,t)=>{let s=r.rects[t];a.drawImage(e.source,e.sx,e.sy,e.sw,e.sh,s.x,s.y,s.width,s.height)});let i=await createImageBitmap(n);try{return await (0,t.X)({source:i,width:n.width,height:n.height})}finally{i.close()}}async function a(e,r){let a=e.naturalWidth,i=e.naturalHeight,l=r.map(e=>s(e));return 1===l.length?(0,t.X)({source:e,width:a,height:i},l[0]):n(l.map(t=>({source:e,sx:Math.round(t.x*a),sy:Math.round(t.y*i),sw:Math.max(1,Math.round(t.width*a)),sh:Math.max(1,Math.round(t.height*i))})),!1)}async function i(e){return n((await Promise.all(e.map(r))).map(e=>({source:e,sx:0,sy:0,sw:e.naturalWidth,sh:e.naturalHeight})),!0)}async function l(e,t,r){let a=e.naturalWidth,i=e.naturalHeight,l=r.width/a,o=t.map(e=>s(e)).map(t=>({source:e,sx:Math.round(t.x*a),sy:Math.round(t.y*i),sw:Math.max(1,Math.round(t.width*a)),sh:Math.max(1,Math.round(t.height*i)),scale:l}));return o.push({source:r.source,sx:0,sy:0,sw:r.width,sh:r.height}),n(o,!1)}e.s(["y",0,r,"k",0,l,"M",0,a,"v",0,i])},119472,e=>{var t=e.i(41931),s=e.i(127175);async function r(e){let t;for(let s=0;s<3;s++)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===s)break;await new Promise(e=>setTimeout(e,1e3*(s+1)))}throw t}async function n(e,a=(0,s.c)()){let{batch:i}=await r(()=>t.k.post("/api/import-batches",{...e,clientRequestId:a,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,s.P)(),i}async function a(e,s={}){let r=s.image?"?include=image":"",{batch:n}=await t.k.get(`/api/import-batches/${encodeURIComponent(e)}${r}`);return n}async function i(e,s,r){let{batch:n}=await t.k.patch(`/api/import-batches/${encodeURIComponent(e)}`,{version:s,draft:r});return n}async function l(e,n,a,i){let{batch:l}=await r(()=>t.k.post(`/api/import-batches/${encodeURIComponent(e)}/start`,{version:n,images:a,analysis:i},{timeout:12e4}));return(0,s.P)(),l}async function o(e){let{batch:r}=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/retry`,{});return(0,s.P)(),r}async function u(e){let r=await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/confirm-all`,{});return(0,s.P)(),r}async function d(e){await t.k.delete(`/api/import-batches/${encodeURIComponent(e)}`),(0,s.P)()}async function c(e){await t.k.post(`/api/import-batches/${encodeURIComponent(e)}/read`,{}),(0,s.P)()}async function m(e,s,r){return t.k.post(`/api/import-batches/${encodeURIComponent(e)}/fix-text`,{items:s},{timeout:6e5,recoverable:!0,requestId:r})}e.s(["J",0,u,"n",0,function(e){return e?.status===409?e.data?.details?.batch??null:null},"v",0,n,"o",0,d,"w",0,a,"$",0,m,"f",0,c,"s",0,o,"S",0,i,"g",0,l])},25197,e=>{var t=e.i(41931);function s(e){return e.trim()?e:""}async function r(){try{return!!(await t.k.get("/api/user")).confirmBeforeImport}catch{return!1}}async function n(e,r){let n=await t.k.post("/api/error-items",{questionText:e.questionText,answerText:s(e.answerText),analysis:s(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:r.subjectId||void 0,subjectName:r.subjectId?void 0:e.subject,originalImageUrl:r.imageUrl||"",paperLevel:r.paperLevel||void 0});return{id:n.id,shortId:n.shortId??null,subjectId:n.subjectId??null,notebookName:n.subject?.name??null,duplicate:n.duplicate}}e.i(201276),e.s(["x",0,r,"a",0,n],25197)},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:r}=(0,s.b)(),n=[r.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=n},[n])}])},825624,e=>{let t=/^[\s ]+/,s="一二三四五六七八九十",r=[{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 n(e){let n=e.replace(t,"");for(let{family:e,pattern:t}of r){let r=n.match(t);if(!r||n.length<=r[0].length)continue;let a=function(e){if(/^\d+$/.test(e))return Number(e);if("十"===e)return 10;let t=e.indexOf("十");return -1===t?s.indexOf(e)+1:10*(0===t?1:s.indexOf(e[0])+1)+(t===e.length-1?0:s.indexOf(e[t+1])+1)}(r[1]);if(Number.isFinite(a)&&!(a<=0))return{value:a,family:e,prefixLength:r[0].length,label:r[1]}}return null}function a(e){let s=e.split("\n"),r=s[0]?.replace(t,"")??"",a=n(r);return a&&"cn"!==a.family&&(s[0]=r.slice(a.prefixLength)),s.join("\n")}function i(e){let t=[];for(let s of e)(s||0!==t.length&&""!==t[t.length-1])&&t.push(s);for(;t.length>0&&""===t[t.length-1];)t.pop();return t.join("\n")}let l=/(姓名|班级|学号|日期|得分|分数|评分|考号|座位号|家长签字|用时|Name\s*[::_]|Class\s*[::_]|Date\s*[::_]|Score\s*[::_])|_{3,}|共\s*\d+\s*(道|题|小题)|做完|答案(见|在)|最后一页|满分\s*\d+\s*分/i,o=/(阅读|材料|短文|文章|选文|诗歌|古诗|文言文|下[面列]的?(表格|图表|统计|信息)|根据.{0,20}(回答|完成)|passage|read the|according to the)/i,u=/^(参考答案|答案与解析|答案|Answers?|Answer Key)\s*[::]?$/i,d=/^(第[一二三四五六七八九十]+(部分|大题|节)|(Part|Section)\s+[A-Z0-9IVX]+\b)/i,c=/(选择|填空|判断|计算|解答|应用|解决问题|操作|作图|阅读|写作|作文|综合|口算|听力|单项|完形|题)/,m=/(\d{1,3})\s*[~~\-—–至到]\s*(\d{1,3})\s*(?:小?题|questions?)/i,f=/(小问|小题|下列问题|以下问题|下列各题|下面各题|完成下列|回答下列|回答以下|following questions|answer the following)/i;function h(e){let t=[],s=[];for(let r of e)r?s.push(r):s.length&&(t.push(s.join("\n")),s=[]);return s.length&&t.push(s.join("\n")),t}function g(e,t=[]){let s=e.trim();return!(!s||s.length>12||/[。!?!?,,、;;::..()()【】\[\]{}]$/.test(s)||/\d/.test(s)||/[。!?!?;;,,]/.test(s))&&!!(/(篇|章|节|部分|组)$/.test(s)||/^(Part|Section)\s+[A-Z0-9]+$/i.test(s))&&(!t.length||t.some(e=>{let t=n(e);return null!==t&&1===t.value}))}function p(e,t){let s=[];for(let r=0;r<e.length;r++){let n=e[r],a=[n];for(let s=r+1;s<e.length;s++){let r=e[s],i=a[a.length-1];if(r.family!==n.family)continue;let l=1===r.value&&[...t].some(e=>e>i.line&&e<r.line);(r.value===i.value+1||l)&&a.push(r)}a.length>s.length&&(s=a)}return s}function x(e,t,s){return!!d.test(e)||!!t&&"cn"===t.family&&"cn"!==s&&null!==s&&(e.length<=40||c.test(e.slice(0,20)))}function y(e,t,s,r,n){for(let a=e-1;a>=0;a--)if(t[a]){if(n.has(a)||x(t[a],s[a],r)||g(t[a]))return t[a];break}return null}function w(e){let t=e.match(m);if(!t)return null;let s=Number(t[1]),r=Number(t[2]);return s<=r?{from:s,to:r}:null}let v={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*(.*)$/},j={易:1,较易:2,中等:3,较难:4,难:5};function b(e){return e.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean)}function k(e){let t={answer:[],analysis:[],knowledge:[],difficulty:[],questionType:[],wrongAnswer:[]},s=[],r=null;for(let n of e){let e=null;for(let s of Object.keys(v)){let a=n.match(v[s]);if(!a)continue;e=s,r=s;let i=a[1].trim();i&&t[s].push(i);break}e||(r&&n.trim()?t[r].push(n.trim()):s.push(n))}let n={},a=t.answer.join("\n").trim();a&&(n.answer=a);let l=t.analysis.join("\n").trim();l&&(n.analysis=l);let o=t.knowledge.flatMap(b);o.length&&(n.knowledgePoints=o);let u=t.difficulty.join(" ").trim(),d=u?function(e){let t=e.trim();if(!t)return null;let s=t.match(/^(\d{1,2})\s*(?:星|级)?$/);if(s){let e=Number(s[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 j?j[t]:null}(u):null;null!==d&&(n.difficultyStars=d);let c=t.questionType.join(" ").trim();c&&(n.questionType=c);let m=t.wrongAnswer.join("\n").trim();return m&&(n.wrongAnswer=m),{text:i(s),fields:n}}let S=/^(\d{1,3})\s*[..、,,)]\s*(\S[\s\S]*)$/,N=/^(\d{1,3})\s*[~~—–-]\s*(\d{1,3})\s*[::..、]?\s*([A-Za-z]+)$/;function T(e){let t=e.trim();if(!t)return null;let s=function(e){let t=e.trim().match(N);if(!t)return null;let s=Number(t[1]),r=Number(t[2]),n=t[3];if(!Number.isFinite(s)||!Number.isFinite(r)||s<=0||r<=s||r-s+1>60)return null;let a=r-s+1;return n.length!==a?null:Array.from({length:a},(e,t)=>({label:String(s+t),text:n[t]}))}(t);if(s)return s;let r=function(e){let t=e.trim(),s=[];for(let e of t.matchAll(/(\d{1,3})\s*[..、,,;;]\s*/g)){let r=e.index??0,n=t[r+e[0].length];n&&/\d/.test(n)||s.push({index:r,label:e[1],afterIndex:r+e[0].length})}if(s.length<2)return null;for(let e=1;e<s.length;e++)if(Number(s[e].label)<=Number(s[e-1].label))return null;let r=[];for(let e=0;e<s.length;e++){let n=s[e].afterIndex,a=e+1<s.length?s[e+1].index:t.length,i=t.slice(n,a).trim().replace(/[;;]+$/,"").trim();if(!i||i.length>30||/[。!?!?]/.test(i))return null;r.push({label:s[e].label,text:i})}return r}(t);if(r)return r.map(e=>({label:e.label??"",text:e.text})).filter(e=>e.label);let n=t.match(S);if(!n)return null;let a=Number(n[1]);return!Number.isFinite(a)||a<=0?null:[{label:n[1],text:n[2].trim()}]}function A(e){let t=e.match(/^(.*?)(?:【?\s*(?:解析|分析|详解|解答|点评)\s*】?\s*[::])([\s\S]*)$/);if(t){let s=t[1].replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim(),r=t[2].trim();return r?{answer:s,analysis:r}:{answer:e.trim()}}return{answer:e.replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim()||e.trim()}}function I(e,t){let s=[],r=!1;for(let n of e){let e={value:!1},a=[];for(let s of n.split("\n")){let r=s.trim()?T(s):null;if(!r){s.trim()&&a.push(s);continue}let n=!1;for(let i of r){let r=t.find(e=>e.label===i.label);if(!r){a.push(s);break}n=!0,e.value=!0;let l=A(i.text);l.answer&&!r.answer&&(r.answer=l.answer),l.analysis&&(r.analysis=r.analysis?`${r.analysis}
|
|
10
|
+
${l.analysis}`:l.analysis)}!n&&!a.includes(s)&&s.trim()&&!a.includes(s)&&a.push(s)}r=r||e.value,e.value?a.length&&s.push(a.join("\n")):s.push(n)}return[s,r]}e.s(["k",0,2e3,"f",0,1e6,"S",0,60,"i",0,2e4,"J",0,function(e,s={}){let r,c,v=void 0===s.maxLength?2e4:Math.min(Math.max(s.maxLength,1e3),1e6),j=void 0===s.maxQuestions?60:Math.min(Math.max(s.maxQuestions,2),2e3),b=e.length>v,S=e.slice(0,v).replace(/\r\n?/g,"\n").split("\n").map(e=>e.replace(t,"").replace(/[\s ]+$/,"")),N=S.map(e=>e?n(e):null),E=S.length;for(let e=0;e<S.length;e++)if(u.test(S[e])){E=e;break}let $=[],_=[];for(let e=0;e<E;e++){let t=N[e];t&&("cn"===t.family?_:$).push({...t,line:e})}let C=new Set;for(let e=0;e<E;e++)(d.test(S[e])||N[e]?.family==="cn"||g(S[e],S.slice(e+1,e+5)))&&C.add(e);let M=[],R=p($,C);if(R.length<2){let e=p(_,new Set);e.length>=2&&(M=[{chain:e,sectionHeading:null}])}else M=function(e,t,s,r){if(e.length<2)return[];let n=e[0].family,a=[0];for(let t=1;t<e.length;t++)1===e[t].value&&a.push(t);if(a.length<2){let a=y(e[0].line,t,s,n,r);return null!==a?[{chain:e,sectionHeading:a}]:[]}let i=[];for(let l=0;l<a.length;l++){let o=a[l],u=l+1<a.length?a[l+1]:e.length,d=e.slice(o,u),c=0===l?y(e[0].line,t,s,n,r):function(e,t,s,r,n,a){for(let i=e+1;i<t;i++)if(s[i]&&(a.has(i)||x(s[i],r[i],n)||g(s[i])))return s[i];return null}(e[o-1].line,e[o].line,t,s,n,r);if(null===c&&l>0){i[i.length-1].chain.push(...d);continue}i.push({chain:d,sectionHeading:c})}return i.filter(e=>e.chain.length>0)}(R,S,N,C);let q=M.length?M.flatMap(e=>e.chain):R,O=i(S.slice(0,E)),P=E<S.length?h(S.slice(E)):[],U=(c=n(S[q[0]?.line??0]??""))?c.label:null,L=e=>({questions:O?[{label:U,text:O,material:null,section:null,lineRange:{from:0,to:E}}]:[],ignored:P,detected:!1,ambiguous:e,candidateCount:e?q.length:+!!O,overflow:0,tooLong:b});if(q.length<2){if(!O)return L(!1);let e=k(O.split("\n")),t=L(!1);if(t.questions.length>0&&Object.keys(e.fields).length>0&&(t.questions[0]={...t.questions[0],text:a(e.text),...e.fields}),t.questions.length>0&&P.length){let[e,s]=I(P,t.questions);t.ignored=e,s||(t.ignored=P)}return t}let V=q[0].family;if(!s.forceNumbered&&function(e,t,s,r){let n=null;for(let a=t-1;a>=0;a--)if(e[a]){n=x(e[a],r[a],s)?null:e[a];break}return!(!n||l.test(n)||m.test(n))&&("paren"===s?n.length>=15||/[。?!?!::,,;;]$/.test(n):/[::]$/.test(n)&&f.test(n))}(S,q[0].line,V,N)){let e=L(!0);if(e.questions.length>0&&O){let t=k(O.split("\n"));Object.keys(t.fields).length>0&&(e.questions[0]={...e.questions[0],text:a(t.text),...t.fields})}return e}let F=new Set(q.map(e=>e.line)),z=[],H=[],D=null,G=[],Q=[],W=(e,t)=>{for(let s of h(e))(!l.test(s)||!(s.length<80))&&(o.test(s)||s.length>=80&&/[。!?.!?;;]/.test(s))?G.push({text:s,range:w(s)}):t?z.push(s):D&&!H.some(e=>e.section===D)?D=`${D}
|
|
11
|
+
${s}`:z.push(s)},B=q[0].line,J=[];for(let e=0;e<B;e++)S[e]&&(x(S[e],N[e],V)||g(S[e],S.slice(e+1,e+5)))?(W(J.splice(0),!0),D=S[e],Q=[]):J.push(S[e]);W(J,!0);let Z=M.length>1,X=e=>{if(!Z)return -1;let t=0;for(let s=0;s<M.length;s++)if(e<(t+=M[s].chain.length))return s;return M.length-1};for(let e=0;e<q.length;e++){let t=q[e].line,s=e+1<q.length?q[e+1].line:E,r=X(e);if(Z&&r>=0){let e=M[r].sectionHeading;null!==e&&(D=e,Q=[])}G.length&&(Q=[...Q.filter(e=>e.range),...G],G=[]);let n=s,l=null;for(let e=t+1;e<s;e++)if(S[e]&&!F.has(e)&&x(S[e],N[e],V)){n=e,l=S[e];break}let u=S.slice(t,n),d=h(u),c=[];for(;d.length>1&&o.test(d[d.length-1].slice(0,30));)c.unshift(d.pop());let m=c.length?d.join("\n"):i(u),f=q[e].value,g=Q.filter(e=>!e.range||f>=e.range.from&&f<=e.range.to),p=k(a(m).split("\n"));for(let r of(H.push({label:q[e].label,text:p.text,material:g.length?g.map(e=>e.text).join("\n\n"):null,section:D,lineRange:{from:t,to:s},...p.fields}),c))G.push({text:r,range:w(r)});null!==l&&(D=l,Q=[],W(S.slice(n+1,s),!1))}if(Z&&P.length){let e=M.map(e=>e.sectionHeading).filter(e=>null!==e),t=P.join("\n");r=e.some(e=>t.includes(e))?function(e,t,s){let r=[],n=0,a=t.map(e=>{let t=s.slice(n,n+e.chain.length);return n+=e.chain.length,t}),i=-1;for(let n of e){let e=n.split("\n"),l=[],o=!1;for(let r of e){let e=r.trim();if(!e){l.push(r);continue}let n=t.findIndex(t=>t.sectionHeading&&e.includes(t.sectionHeading));if(n>=0){i=n;continue}let u=T(e);if(!u){l.push(r);continue}let d=i>=0?a[i]:s,c=!1;for(let e of u){let t=d.find(t=>t.label===e.label);if(!t){l.push(r);break}c=!0,o=!0;let s=A(e.text);s.answer&&!t.answer&&(t.answer=s.answer),s.analysis&&(t.analysis=t.analysis?`${t.analysis}
|
|
12
|
+
${s.analysis}`:s.analysis)}c||l.includes(r)||l.push(r)}o?l.length&&r.push(l.join("\n")):r.push(n)}return r}(P,M,H):P}else r=I(P,H)[0];let Y=H.slice(j);return{questions:H.slice(0,j),ignored:[...z,...r,...Y.map(e=>{var t;let s,r,n,a;return s=(t=e).text.trim(),n=(r=t.material?.trim())?`${r}
|
|
13
|
+
|
|
14
|
+
${s}`:s,a=[],(t.answer?.trim()&&a.push(`参考答案:${t.answer.trim()}`),t.analysis?.trim()&&a.push(`参考解析:${t.analysis.trim()}`),t.wrongAnswer?.trim()&&a.push(`学生作答:${t.wrongAnswer.trim()}`),a.length)?`${n}
|
|
15
|
+
|
|
16
|
+
${a.join("\n\n")}`:n})],detected:!0,ambiguous:!1,candidateCount:H.length,overflow:Y.length,tooLong:b}}])},767077,e=>{var t=e.i(303163);e.s(["f",0,function(e,s){let r=s.common?.messages?.analysisFailed||"Analysis failed, please try again",n=(0,t.d)(e);if(n){let e=s.errors??{};if(!(n in e))return n;let t=e[n];return"string"==typeof t?t:r}let a=(0,t.Z)(e);if(a.includes("fetch")||a.includes("network"))return s.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`${r} (${t})`}return r}])}])})();
|