From ff0c103dc57395768d7fb5d48caa3dfd4904087e Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 28 Jun 2026 14:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=B1=80=E5=9F=9F=E7=BD=91?= =?UTF-8?q?=20GPU=20OCR=20=E6=9C=8D=E5=8A=A1=EF=BC=8C=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E7=B1=BB=E4=BC=BC=20Ollama=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 3 + backend/.env.example | 2 + backend/app/core/config.py | 3 + backend/app/models/user.py | 1 + backend/app/routers/admin.py | 3 + backend/app/routers/wrong_questions.py | 16 +- backend/app/schemas/__init__.py | 2 + backend/app/services/migrate.py | 2 + backend/app/services/ocr.py | 41 ++++- deploy/ocr-worker/app.py | 140 ++++++++++++++++++ deploy/ocr-worker/install.sh | 45 ++++++ deploy/ocr-worker/ocr-worker.service | 17 +++ deploy/ocr-worker/requirements.txt | 6 + deploy/ocr-worker/start.sh | 17 +++ .../{index-DzzkB1zh.js => index-19dlnnB9.js} | 2 +- frontend/dist/index.html | 2 +- frontend/src/api/client.ts | 1 + frontend/src/pages/SettingsPage.tsx | 10 ++ frontend/src/types/index.ts | 1 + 19 files changed, 305 insertions(+), 9 deletions(-) create mode 100644 deploy/ocr-worker/app.py create mode 100644 deploy/ocr-worker/install.sh create mode 100644 deploy/ocr-worker/ocr-worker.service create mode 100644 deploy/ocr-worker/requirements.txt create mode 100644 deploy/ocr-worker/start.sh rename frontend/dist/assets/{index-DzzkB1zh.js => index-19dlnnB9.js} (96%) diff --git a/.env.example b/.env.example index 87d8e10..efd4a50 100644 --- a/.env.example +++ b/.env.example @@ -16,6 +16,9 @@ CORS_ORIGINS=http://127.0.0.1:23566,http://localhost:23566 OLLAMA_BASE_URL=http://127.0.0.1:11434 OLLAMA_MODEL=qwen2.5:7b +# 局域网 GPU OCR 服务(deploy/ocr-worker),留空则本机 CPU 识别 +OCR_SERVICE_URL= +OCR_API_KEY= OPENAI_BASE_URL=https://api.openai.com/v1 OPENAI_MODEL=gpt-4o-mini FLUCTUATION_THRESHOLD=0.08 diff --git a/backend/.env.example b/backend/.env.example index aa8feeb..72a18be 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -5,4 +5,6 @@ UPLOAD_DIR=uploads API_PORT=23568 OLLAMA_BASE_URL=http://127.0.0.1:11434 OLLAMA_MODEL=qwen2.5:7b +OCR_SERVICE_URL= +OCR_API_KEY= FLUCTUATION_THRESHOLD=0.08 diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 61836d5..88e411b 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -25,6 +25,9 @@ class Settings(BaseSettings): OCR_MAX_SIDE: int = 1280 UPLOAD_MAX_SIDE: int = 2048 OCR_WARMUP: bool = True + OCR_SERVICE_URL: str = "" + OCR_API_KEY: str = "" + OCR_USE_GPU: bool = False class Config: env_file = ".env" diff --git a/backend/app/models/user.py b/backend/app/models/user.py index 0bc1500..88a164b 100644 --- a/backend/app/models/user.py +++ b/backend/app/models/user.py @@ -159,6 +159,7 @@ class SystemSettings(Base): openai_base_url: Mapped[str | None] = mapped_column(String(256), nullable=True) openai_model: Mapped[str | None] = mapped_column(String(128), nullable=True) openai_api_key: Mapped[str | None] = mapped_column(String(512), nullable=True) + ocr_service_url: Mapped[str | None] = mapped_column(String(256), nullable=True) updated_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), default=lambda: datetime.now(timezone.utc) ) diff --git a/backend/app/routers/admin.py b/backend/app/routers/admin.py index 19cd7b9..f77eec2 100644 --- a/backend/app/routers/admin.py +++ b/backend/app/routers/admin.py @@ -31,6 +31,7 @@ def settings_to_out(row: SystemSettings) -> SystemSettingsOut: openai_base_url=row.openai_base_url, openai_model=row.openai_model, openai_api_key_set=bool(row.openai_api_key), + ocr_service_url=row.ocr_service_url, updated_at=row.updated_at, ) @@ -74,6 +75,8 @@ def update_settings( row.openai_model = data.openai_model or None if data.openai_api_key is not None and data.openai_api_key.strip(): row.openai_api_key = data.openai_api_key.strip() + if data.ocr_service_url is not None: + row.ocr_service_url = data.ocr_service_url.strip() or None row.updated_at = datetime.now(timezone.utc) db.commit() db.refresh(row) diff --git a/backend/app/routers/wrong_questions.py b/backend/app/routers/wrong_questions.py index ed4ade7..11dea05 100644 --- a/backend/app/routers/wrong_questions.py +++ b/backend/app/routers/wrong_questions.py @@ -11,7 +11,7 @@ from sqlalchemy.orm import Session, joinedload from app.core.config import settings from app.core.database import SessionLocal, get_db from app.core.deps import get_current_user -from app.models.user import Subject, User, WrongQuestion, WrongQuestionCategory, WrongQuestionStatus +from app.models.user import Subject, SystemSettings, User, WrongQuestion, WrongQuestionCategory, WrongQuestionStatus from app.schemas import WrongQuestionCategoryEnum, WrongQuestionOut, WrongQuestionUpdate from app.services import annotation as annotation_service from app.services import llm as llm_service @@ -50,6 +50,13 @@ def _expire_stale_processing(wq: WrongQuestion, db: Session) -> None: db.commit() +def _ocr_service_url(db: Session) -> str | None: + row = db.get(SystemSettings, 1) + if row and row.ocr_service_url: + return row.ocr_service_url.strip() or None + return ocr_service.resolve_ocr_service_url() + + def _parse_mark_regions(raw: str | None) -> list[dict] | None: if not raw: return None @@ -140,9 +147,12 @@ def _process_wrong_question(question_id: uuid.UUID): wq.error_message = None image_full = Path(settings.UPLOAD_DIR) / wq.image_path + ocr_url = _ocr_service_url(db) try: with ThreadPoolExecutor(max_workers=1) as pool: - future = pool.submit(ocr_service.run_ocr_with_regions, str(image_full)) + future = pool.submit( + ocr_service.run_ocr_with_regions, str(image_full), ocr_url + ) ocr_result = future.result(timeout=settings.OCR_TIMEOUT_SECONDS) ocr_text = ocr_result["text"] ocr_lines = ocr_result["lines"] @@ -166,6 +176,8 @@ def _process_wrong_question(question_id: uuid.UUID): msg = _short_error(exc, "OCR 识别失败:") if "libGL" in str(exc): msg += " 请在服务器执行: sudo bash deploy/install-ocr-deps.sh && systemctl restart grade-archive" + elif ocr_url: + msg += f" 请检查 OCR 服务是否可达: {ocr_url} (可浏览器访问 {ocr_url.rstrip('/')}/health)" wq.error_message = msg db.commit() return diff --git a/backend/app/schemas/__init__.py b/backend/app/schemas/__init__.py index 7b015a7..4f429f3 100644 --- a/backend/app/schemas/__init__.py +++ b/backend/app/schemas/__init__.py @@ -74,6 +74,7 @@ class SystemSettingsOut(BaseModel): openai_base_url: str | None = None openai_model: str | None = None openai_api_key_set: bool = False + ocr_service_url: str | None = None updated_at: datetime model_config = {"from_attributes": True} @@ -87,6 +88,7 @@ class SystemSettingsUpdate(BaseModel): openai_base_url: str | None = None openai_model: str | None = None openai_api_key: str | None = None + ocr_service_url: str | None = None class AdminProfileUpdate(BaseModel): diff --git a/backend/app/services/migrate.py b/backend/app/services/migrate.py index 90a05e5..abe4a4b 100644 --- a/backend/app/services/migrate.py +++ b/backend/app/services/migrate.py @@ -61,6 +61,8 @@ def run_migrations() -> None: alters.append("ADD COLUMN openai_model VARCHAR(128)") if "openai_api_key" not in ss_columns: alters.append("ADD COLUMN openai_api_key VARCHAR(512)") + if "ocr_service_url" not in ss_columns: + alters.append("ADD COLUMN ocr_service_url VARCHAR(256)") if alters: with engine.begin() as conn: for clause in alters: diff --git a/backend/app/services/ocr.py b/backend/app/services/ocr.py index 493afaa..37f8c1d 100644 --- a/backend/app/services/ocr.py +++ b/backend/app/services/ocr.py @@ -5,6 +5,7 @@ import threading from io import BytesIO from pathlib import Path +import httpx from PIL import Image from app.core.config import settings @@ -23,22 +24,32 @@ def get_ocr_engine(): if _ocr_engine is None: from paddleocr import PaddleOCR + use_gpu = settings.OCR_USE_GPU _ocr_engine = PaddleOCR( use_angle_cls=False, lang="ch", show_log=False, - use_gpu=False, - enable_mkldnn=True, + use_gpu=use_gpu, + enable_mkldnn=not use_gpu, det_limit_side_len=min(settings.OCR_MAX_SIDE, 1280), rec_batch_num=8, ) return _ocr_engine +def resolve_ocr_service_url(service_url: str | None = None) -> str | None: + url = (service_url or settings.OCR_SERVICE_URL or "").strip() + return url or None + + +def uses_remote_ocr(service_url: str | None = None) -> bool: + return resolve_ocr_service_url(service_url) is not None + + def warmup_ocr_engine() -> None: """后台预加载 OCR 模型,避免首张图片等待数分钟。""" global _ocr_warmup_started - if _ocr_warmup_started or not settings.OCR_WARMUP: + if _ocr_warmup_started or not settings.OCR_WARMUP or uses_remote_ocr(): return _ocr_warmup_started = True @@ -110,8 +121,20 @@ def _prepare_ocr_image(image_path: str) -> tuple[str, float, float, int, int, Pa return str(tmp), scale_x, scale_y, orig_w, orig_h, tmp -def run_ocr_with_regions(image_path: str) -> dict: - """Return OCR text plus line-level bounding boxes for annotation.""" +def _run_remote_ocr(service_url: str, image_path: str) -> dict: + url = f"{service_url.rstrip('/')}/api/ocr/regions" + headers: dict[str, str] = {} + if settings.OCR_API_KEY: + headers["X-OCR-Key"] = settings.OCR_API_KEY + with open(image_path, "rb") as handle: + files = {"file": (Path(image_path).name, handle, "image/jpeg")} + with httpx.Client(timeout=settings.OCR_TIMEOUT_SECONDS) as client: + resp = client.post(url, files=files, headers=headers) + resp.raise_for_status() + return resp.json() + + +def _run_local_ocr(image_path: str) -> dict: engine = get_ocr_engine() ocr_path, scale_x, scale_y, orig_w, orig_h, tmp_path = _prepare_ocr_image(image_path) try: @@ -150,6 +173,14 @@ def run_ocr_with_regions(image_path: str) -> dict: } +def run_ocr_with_regions(image_path: str, service_url: str | None = None) -> dict: + """Return OCR text plus line-level bounding boxes for annotation.""" + remote = resolve_ocr_service_url(service_url) + if remote: + return _run_remote_ocr(remote, image_path) + return _run_local_ocr(image_path) + + def run_ocr(image_path: str) -> str: return run_ocr_with_regions(image_path)["text"] diff --git a/deploy/ocr-worker/app.py b/deploy/ocr-worker/app.py new file mode 100644 index 0000000..88a2a68 --- /dev/null +++ b/deploy/ocr-worker/app.py @@ -0,0 +1,140 @@ +"""局域网 OCR 服务:在带 NVIDIA 显卡的机器上运行,供成绩档案系统调用。""" + +import os +import tempfile +from pathlib import Path + +from fastapi import FastAPI, File, Header, HTTPException, UploadFile +from PIL import Image + +os.environ.setdefault("OPENCV_IO_ENABLE_OPENEXR", "0") + +OCR_MAX_SIDE = int(os.getenv("OCR_MAX_SIDE", "1280")) +OCR_API_KEY = os.getenv("OCR_API_KEY", "").strip() +OCR_USE_GPU = os.getenv("OCR_USE_GPU", "true").lower() in {"1", "true", "yes"} + +app = FastAPI(title="Grade Archive OCR Worker", version="1.0.0") +_engine = None + + +def _check_key(key: str | None) -> None: + if OCR_API_KEY and key != OCR_API_KEY: + raise HTTPException(status_code=401, detail="Invalid OCR API key") + + +def get_engine(): + global _engine + if _engine is None: + from paddleocr import PaddleOCR + + _engine = PaddleOCR( + use_angle_cls=False, + lang="ch", + show_log=False, + use_gpu=OCR_USE_GPU, + enable_mkldnn=not OCR_USE_GPU, + det_limit_side_len=min(OCR_MAX_SIDE, 1280), + rec_batch_num=8, + ) + return _engine + + +def _bbox_from_box(box: list) -> list[float]: + xs = [float(p[0]) for p in box] + ys = [float(p[1]) for p in box] + return [min(xs), min(ys), max(xs), max(ys)] + + +def _scale_box(box: list, scale_x: float, scale_y: float) -> list: + return [[float(p[0]) * scale_x, float(p[1]) * scale_y] for p in box] + + +def _prepare_image_bytes(content: bytes) -> tuple[bytes, float, float, int, int]: + with Image.open(__import__("io").BytesIO(content)) as img: + img = img.convert("RGB") + orig_w, orig_h = img.size + longest = max(orig_w, orig_h) + if longest <= OCR_MAX_SIDE: + buf = __import__("io").BytesIO() + img.save(buf, format="JPEG", quality=88) + return buf.getvalue(), 1.0, 1.0, orig_w, orig_h + + ratio = OCR_MAX_SIDE / longest + new_w = max(1, int(orig_w * ratio)) + new_h = max(1, int(orig_h * ratio)) + resized = img.resize((new_w, new_h), Image.Resampling.LANCZOS) + buf = __import__("io").BytesIO() + resized.save(buf, format="JPEG", quality=85) + scale_x = orig_w / new_w + scale_y = orig_h / new_h + return buf.getvalue(), scale_x, scale_y, orig_w, orig_h + + +def run_ocr_on_bytes(content: bytes) -> dict: + engine = get_engine() + image_bytes, scale_x, scale_y, orig_w, orig_h = _prepare_image_bytes(content) + with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as tmp: + tmp.write(image_bytes) + tmp_path = tmp.name + try: + result = engine.ocr(tmp_path, cls=False) + finally: + Path(tmp_path).unlink(missing_ok=True) + + lines: list[dict] = [] + if result and result[0]: + for item in result[0]: + if not item or len(item) < 2: + continue + box, rec = item[0], item[1] + text = rec[0] if rec else "" + conf = float(rec[1]) if rec and len(rec) > 1 else 0.0 + if not text: + continue + if scale_x != 1.0 or scale_y != 1.0: + box = _scale_box(box, scale_x, scale_y) + lines.append( + { + "text": text, + "confidence": conf, + "box": box, + "bbox": _bbox_from_box(box), + } + ) + + return { + "text": "\n".join(line["text"] for line in lines), + "lines": lines, + "width": orig_w, + "height": orig_h, + } + + +@app.on_event("startup") +def warmup(): + buf = __import__("io").BytesIO() + Image.new("RGB", (120, 40), color=(255, 255, 255)).save(buf, format="JPEG") + try: + run_ocr_on_bytes(buf.getvalue()) + except Exception: + pass + + +@app.get("/health") +def health(): + return {"status": "ok", "gpu": OCR_USE_GPU} + + +@app.post("/api/ocr/regions") +async def ocr_regions( + file: UploadFile = File(...), + x_ocr_key: str | None = Header(default=None, alias="X-OCR-Key"), +): + _check_key(x_ocr_key) + content = await file.read() + if not content: + raise HTTPException(status_code=400, detail="Empty image") + try: + return run_ocr_on_bytes(content) + except Exception as exc: + raise HTTPException(status_code=500, detail=str(exc)) from exc diff --git a/deploy/ocr-worker/install.sh b/deploy/ocr-worker/install.sh new file mode 100644 index 0000000..855d1b4 --- /dev/null +++ b/deploy/ocr-worker/install.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# 在带 NVIDIA 显卡(如 RTX 3060 Ti)的 Linux 机器上安装 OCR Worker +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")" && pwd)" +VENV="${ROOT}/.venv" +PORT="${OCR_PORT:-23567}" + +echo "==> OCR Worker 安装目录: ${ROOT}" + +if ! command -v python3 >/dev/null; then + echo "请先安装 python3" + exit 1 +fi + +python3 -m venv "${VENV}" +# shellcheck disable=SC1091 +source "${VENV}/bin/activate" +pip install -U pip wheel + +# Paddle GPU(CUDA 11.8,适配多数 3060 Ti 驱动) +pip install paddlepaddle-gpu==2.6.2 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/ +pip install -r "${ROOT}/requirements.txt" + +cat < to {if(!n._listeners)return;let t=n._listeners.length;for(;t-->0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new NO(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function uxe(e){return function(t){return e.apply(null,t)}}function dxe(e){return J.isObject(e)&&e.isAxiosError===!0}var sk={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(sk).forEach(([e,t])=>{sk[t]=e});function ck(e){let t=new ok(e),n=lye(ok.prototype.request,t);return J.extend(n,ok.prototype,t,{allOwnKeys:!0}),J.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return ck(VO(e,t))},n}var lk=ck(AO);lk.Axios=ok,lk.CanceledError=NO,lk.CancelToken=lxe,lk.isCancel=MO,lk.VERSION=GO,lk.toFormData=gO,lk.AxiosError=fO,lk.Cancel=lk.CanceledError,lk.all=function(e){return Promise.all(e)},lk.spread=uxe,lk.isAxiosError=dxe,lk.mergeConfig=VO,lk.AxiosHeaders=dO,lk.formToJSON=e=>OO(J.isHTMLForm(e)?new FormData(e):e),lk.getAdapter=$O.getAdapter,lk.HttpStatusCode=sk,lk.default=lk;var fxe=l(Qge(),1),uk=lk.create({baseURL:`/api`});uk.interceptors.request.use(e=>{let t=localStorage.getItem(`access_token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e}),uk.interceptors.response.use(e=>e,async e=>{let t=e.config;if(e.response?.status===401&&!t._retry){t._retry=!0;let e=localStorage.getItem(`refresh_token`);if(e)try{let{data:n}=await lk.post(`/api/auth/refresh`,{refresh_token:e});return localStorage.setItem(`access_token`,n.access_token),localStorage.setItem(`refresh_token`,n.refresh_token),t.headers.Authorization=`Bearer ${n.access_token}`,uk(t)}catch{localStorage.removeItem(`access_token`),localStorage.removeItem(`refresh_token`),window.location.href=`/login`}}return Promise.reject(e)});var dk={register:(e,t)=>uk.post(`/auth/register`,{username:e,password:t}),login:(e,t)=>uk.post(`/auth/login`,{username:e,password:t}),me:()=>uk.get(`/auth/me`)},pxe={public:()=>uk.get(`/settings/public`)},fk={getSettings:()=>uk.get(`/admin/settings`),updateSettings:e=>uk.patch(`/admin/settings`,e),updateProfile:e=>uk.patch(`/admin/profile`,e),listUsers:()=>uk.get(`/admin/users`),createUser:e=>uk.post(`/admin/users`,e),resetUserPassword:(e,t)=>uk.patch(`/admin/users/${e}`,{password:t}),deleteUser:e=>uk.delete(`/admin/users/${e}`)},pk={list:()=>uk.get(`/students`),create:e=>uk.post(`/students`,e),get:e=>uk.get(`/students/${e}`),update:(e,t)=>uk.patch(`/students/${e}`,t),remove:e=>uk.delete(`/students/${e}`)},mxe={list:()=>uk.get(`/subjects`)},mk={list:e=>uk.get(`/students/${e}/exams`),create:(e,t)=>uk.post(`/students/${e}/exams`,t),update:(e,t)=>uk.patch(`/exams/${e}`,t),remove:e=>uk.delete(`/exams/${e}`),trend:(e,t)=>uk.get(`/students/${e}/scores/trend`,{params:{subject_id:t}}),exportCsv:e=>uk.get(`/students/${e}/scores/export`,{responseType:`blob`})},hk={list:(e,t)=>uk.get(`/students/${e}/wrong-questions`,{params:t}),upload:(e,t,n,r=`regular`)=>{let i=new FormData;return i.append(`subject_id`,String(t)),i.append(`category`,r),i.append(`file`,n),uk.post(`/students/${e}/wrong-questions`,i)},get:e=>uk.get(`/wrong-questions/${e}`),update:(e,t)=>uk.patch(`/wrong-questions/${e}`,t),remove:e=>uk.delete(`/wrong-questions/${e}`),retryOcr:e=>uk.post(`/wrong-questions/${e}/retry-ocr`),regenerate:e=>uk.post(`/wrong-questions/${e}/regenerate-solution`),imageUrl:e=>`/api/wrong-questions/${e}/image`},hxe=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Y=o(((e,t)=>{t.exports=hxe()}))(),gk=(0,h.createContext)(null);function gxe({children:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!0);(0,h.useEffect)(()=>{if(!localStorage.getItem(`access_token`)){i(!1);return}dk.me().then(e=>n(e.data)).catch(()=>{localStorage.removeItem(`access_token`),localStorage.removeItem(`refresh_token`)}).finally(()=>i(!1))},[]);let a=async(e,t)=>{let{data:r}=await dk.login(e,t);localStorage.setItem(`access_token`,r.access_token),localStorage.setItem(`refresh_token`,r.refresh_token),n((await dk.me()).data)};return(0,Y.jsx)(gk.Provider,{value:{user:t,loading:r,login:a,register:async(e,t)=>{await dk.register(e,t),await a(e,t)},logout:()=>{localStorage.removeItem(`access_token`),localStorage.removeItem(`refresh_token`),n(null)}},children:e})}function _k(){let e=(0,h.useContext)(gk);if(!e)throw Error(`useAuth must be used within AuthProvider`);return e}var _xe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`arrow-left`,theme:`outlined`}}))());function vk(){return vk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,vk({},e,{ref:t,icon:_xe.default}))),yxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M864 248H728l-32.4-90.8a32.07 32.07 0 00-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z`}}]},name:`camera`,theme:`outlined`}}))());function yk(){return yk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,yk({},e,{ref:t,icon:yxe.default}))),xxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z`}}]},name:`lock`,theme:`outlined`}}))());function bk(){return bk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,bk({},e,{ref:t,icon:xxe.default}))),Sxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M868 732h-70.3c-4.8 0-9.3 2.1-12.3 5.8-7 8.5-14.5 16.7-22.4 24.5a353.84 353.84 0 01-112.7 75.9A352.8 352.8 0 01512.4 866c-47.9 0-94.3-9.4-137.9-27.8a353.84 353.84 0 01-112.7-75.9 353.28 353.28 0 01-76-112.5C167.3 606.2 158 559.9 158 512s9.4-94.2 27.8-137.8c17.8-42.1 43.4-80 76-112.5s70.5-58.1 112.7-75.9c43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 7.9 7.9 15.3 16.1 22.4 24.5 3 3.7 7.6 5.8 12.3 5.8H868c6.3 0 10.2-7 6.7-12.3C798 160.5 663.8 81.6 511.3 82 271.7 82.6 79.6 277.1 82 516.4 84.4 751.9 276.2 942 512.4 942c152.1 0 285.7-78.8 362.3-197.7 3.4-5.3-.4-12.3-6.7-12.3zm88.9-226.3L815 393.7c-5.3-4.2-13-.4-13 6.3v76H488c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h314v76c0 6.7 7.8 10.5 13 6.3l141.9-112a8 8 0 000-12.6z`}}]},name:`logout`,theme:`outlined`}}))());function Sk(){return Sk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Sk({},e,{ref:t,icon:Sxe.default}))),wxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z`}}]},name:`reload`,theme:`outlined`}}))());function Ck(){return Ck=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Ck({},e,{ref:t,icon:wxe.default}))),Exe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z`}}]},name:`setting`,theme:`outlined`}}))());function wk(){return wk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,wk({},e,{ref:t,icon:Exe.default}))),Dxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z`}}]},name:`upload`,theme:`outlined`}}))());function Ek(){return Ek=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Ek({},e,{ref:t,icon:Dxe.default}))),kxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z`}}]},name:`user`,theme:`outlined`}}))());function Dk(){return Dk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Dk({},e,{ref:t,icon:kxe.default})));function kk(e,t){if(lk.isAxiosError(e)){let t=e.response?.data?.detail;if(typeof t==`string`)return t;if(Array.isArray(t)&&t[0]?.msg)return t[0].msg}return t}function Axe(){let{user:e,login:t,register:n,loading:r}=_k(),i=vD(),[a]=ky.useForm(),[o]=ky.useForm(),[s,c]=(0,h.useState)(!0),[l,u]=(0,h.useState)(!0);if((0,h.useEffect)(()=>{pxe.public().then(e=>c(e.data.registration_enabled)).catch(()=>c(!0)).finally(()=>u(!1))},[]),!r&&e)return(0,Y.jsx)(wD,{to:`/`,replace:!0});let d=async e=>{try{await t(e.username,e.password),rx.success(`登录成功`),i(`/`)}catch(e){rx.error(kk(e,`用户名或密码错误`))}},f=async e=>{if(e.password!==e.confirm){rx.error(`两次密码不一致`);return}try{await n(e.username,e.password),rx.success(`注册成功`),i(`/`)}catch(e){rx.error(kk(e,`注册失败,请稍后重试`))}},p=[{key:`login`,label:`登录`,children:(0,Y.jsxs)(ky,{form:a,onFinish:d,layout:`vertical`,children:[(0,Y.jsx)(ky.Item,{name:`username`,rules:[{required:!0,message:`请输入用户名`}],children:(0,Y.jsx)(ib,{prefix:(0,Y.jsx)(Ok,{}),placeholder:`用户名`})}),(0,Y.jsx)(ky.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{}),placeholder:`密码`})}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,block:!0,children:`登录`})]})}];return s&&p.push({key:`register`,label:`注册`,children:(0,Y.jsxs)(ky,{form:o,onFinish:f,layout:`vertical`,children:[(0,Y.jsx)(ky.Item,{name:`username`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`至少3个字符`}],children:(0,Y.jsx)(ib,{prefix:(0,Y.jsx)(Ok,{}),placeholder:`用户名`})}),(0,Y.jsx)(ky.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`},{min:6,message:`至少6个字符`}],children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{}),placeholder:`密码`})}),(0,Y.jsx)(ky.Item,{name:`confirm`,rules:[{required:!0,message:`请确认密码`}],children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{}),placeholder:`确认密码`})}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,block:!0,children:`注册`})]})}),(0,Y.jsx)(`div`,{style:{minHeight:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #667eea 0%, #764ba2 100%)`,padding:16},children:(0,Y.jsxs)(lg,{style:{width:`100%`,maxWidth:420},title:`中学生成绩档案`,children:[(0,Y.jsx)(rE.Paragraph,{type:`secondary`,style:{textAlign:`center`},children:`成绩录入 · 趋势分析 · 错题管理`}),(0,Y.jsxs)(TS,{spinning:l,children:[!l&&!s&&(0,Y.jsx)(rE.Paragraph,{type:`secondary`,style:{textAlign:`center`,marginBottom:16},children:`注册已关闭,请联系管理员获取账号`}),(0,Y.jsx)(sg,{items:p})]}),(0,Y.jsx)(rE.Paragraph,{type:`secondary`,style:{textAlign:`center`,fontSize:12,marginTop:16,marginBottom:0},children:`© 马建军 · 微信 dekun03 · 18364911125`})]})})}function jxe(){let{user:e}=_k(),[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)([]),[a,o]=(0,h.useState)(!0),[s]=ky.useForm(),[c]=ky.useForm(),[l,u]=(0,h.useState)(!1),[d,f]=(0,h.useState)(null),[p]=ky.useForm(),[m]=ky.useForm(),g=ky.useWatch(`ai_provider`,m);if(!e?.is_superuser)return(0,Y.jsx)(wD,{to:`/`,replace:!0});let _=async()=>{o(!0);try{let[t,r]=await Promise.all([fk.getSettings(),fk.listUsers()]);n(t.data),i(r.data),s.setFieldsValue({username:e.username}),m.setFieldsValue({ai_provider:t.data.ai_provider,ollama_base_url:t.data.ollama_base_url||``,ollama_model:t.data.ollama_model||``,openai_base_url:t.data.openai_base_url||``,openai_model:t.data.openai_model||``,openai_api_key:``})}finally{o(!1)}};(0,h.useEffect)(()=>{_()},[]);let v=async e=>{let{data:t}=await fk.updateSettings({registration_enabled:e});n(t),rx.success(e?`已开放注册`:`已关闭注册`)},y=async t=>{if(t.password&&t.password!==t.confirm){rx.error(`两次密码不一致`);return}await fk.updateProfile({username:t.username===e?.username?void 0:t.username,current_password:t.password?t.current_password:void 0,password:t.password||void 0}),rx.success(`账号信息已更新,若修改了用户名或密码请重新登录`)},b=async e=>{await fk.createUser(e),rx.success(`用户已创建`),u(!1),c.resetFields(),_()},x=async e=>{d&&(await fk.resetUserPassword(d.id,e.password),rx.success(`密码已重置`),f(null),p.resetFields())},S=async e=>{await fk.deleteUser(e),rx.success(`用户已删除`),_()};return(0,Y.jsxs)(`div`,{className:`page-container`,children:[(0,Y.jsxs)(Py,{direction:`vertical`,size:`large`,style:{width:`100%`},children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(rE.Title,{level:3,style:{margin:0},children:`系统设置`}),(0,Y.jsxs)(rE.Text,{type:`secondary`,children:[`超级管理员 · `,(0,Y.jsx)(RD,{to:`/`,children:`返回首页`})]})]}),(0,Y.jsx)(sg,{items:[{key:`general`,label:`基本设置`,children:(0,Y.jsxs)(Py,{direction:`vertical`,size:`large`,style:{width:`100%`},children:[(0,Y.jsx)(lg,{title:`注册开关`,loading:a,children:(0,Y.jsxs)(Py,{children:[(0,Y.jsx)(Nde,{checked:t?.registration_enabled??!0,onChange:v}),(0,Y.jsx)(rE.Text,{children:t?.registration_enabled?`开放注册:用户可在登录页自行注册`:`关闭注册:仅超级管理员可添加用户`})]})}),(0,Y.jsx)(lg,{title:`管理员账号`,children:(0,Y.jsxs)(ky,{form:s,layout:`vertical`,onFinish:y,children:[(0,Y.jsx)(ky.Item,{name:`username`,label:`用户名`,rules:[{required:!0,min:3}],children:(0,Y.jsx)(ib,{prefix:(0,Y.jsx)(Ok,{})})}),(0,Y.jsx)(ky.Item,{name:`current_password`,label:`当前密码(修改密码时必填)`,children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{})})}),(0,Y.jsx)(ky.Item,{name:`password`,label:`新密码(留空则不修改)`,children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{})})}),(0,Y.jsx)(ky.Item,{name:`confirm`,label:`确认新密码`,children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{})})}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,icon:(0,Y.jsx)(Tk,{}),children:`保存`})]})})]})},{key:`ai`,label:`AI 模型`,children:(0,Y.jsx)(lg,{title:`解题 AI 配置`,loading:a,children:(0,Y.jsxs)(ky,{form:m,layout:`vertical`,onFinish:async e=>{let t={ai_provider:e.ai_provider,ollama_base_url:e.ollama_base_url||null,ollama_model:e.ollama_model||null,openai_base_url:e.openai_base_url||null,openai_model:e.openai_model||null};e.openai_api_key?.trim()&&(t.openai_api_key=e.openai_api_key.trim());let{data:r}=await fk.updateSettings(t);n(r),m.setFieldValue(`openai_api_key`,``),rx.success(`AI 模型配置已保存`)},children:[(0,Y.jsx)(ky.Item,{name:`ai_provider`,label:`AI 提供商`,rules:[{required:!0}],children:(0,Y.jsxs)(Tx.Group,{children:[(0,Y.jsx)(Tx.Button,{value:`ollama`,children:`本地 Ollama`}),(0,Y.jsx)(Tx.Button,{value:`openai`,children:`OpenAI 兼容 API`})]})}),(g||t?.ai_provider)===`ollama`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ky.Item,{name:`ollama_base_url`,label:`Ollama 地址`,children:(0,Y.jsx)(ib,{placeholder:`http://127.0.0.1:11434`})}),(0,Y.jsx)(ky.Item,{name:`ollama_model`,label:`Ollama 模型`,children:(0,Y.jsx)(ib,{placeholder:`qwen2.5:7b`})})]}),(g||t?.ai_provider)===`openai`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ky.Item,{name:`openai_base_url`,label:`API Base URL`,children:(0,Y.jsx)(ib,{placeholder:`https://api.openai.com/v1`})}),(0,Y.jsx)(ky.Item,{name:`openai_model`,label:`模型名称`,children:(0,Y.jsx)(ib,{placeholder:`gpt-4o-mini`})}),(0,Y.jsx)(ky.Item,{name:`openai_api_key`,label:`API Key`,extra:t?.openai_api_key_set?`已配置 Key,留空则不修改`:`请输入 API Key`,children:(0,Y.jsx)(ib.Password,{placeholder:`sk-...`})})]}),(0,Y.jsx)(rE.Paragraph,{type:`secondary`,children:`错题/奥数解法将按学生学段(初中/高中)生成,并严格禁止超纲解题。`}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,children:`保存 AI 配置`})]})})},{key:`users`,label:`用户管理`,children:(0,Y.jsx)(lg,{title:`用户列表`,extra:(0,Y.jsx)(_p,{type:`primary`,onClick:()=>u(!0),children:`添加用户`}),children:(0,Y.jsx)(OT,{rowKey:`id`,loading:a,dataSource:r,pagination:!1,columns:[{title:`用户名`,dataIndex:`username`},{title:`角色`,dataIndex:`is_superuser`,render:e=>e?`超级管理员`:`普通用户`},{title:`创建时间`,dataIndex:`created_at`,render:e=>new Date(e).toLocaleString()},{title:`操作`,render:(e,t)=>t.is_superuser?(0,Y.jsx)(rE.Text,{type:`secondary`,children:`—`}):(0,Y.jsxs)(Py,{children:[(0,Y.jsx)(_p,{size:`small`,onClick:()=>f(t),children:`重置密码`}),(0,Y.jsx)(xx,{title:`确定删除该用户?`,onConfirm:()=>S(t.id),children:(0,Y.jsx)(_p,{size:`small`,danger:!0,children:`删除`})})]})}]})})}]})]}),(0,Y.jsx)(yx,{title:`添加用户`,open:l,onCancel:()=>u(!1),onOk:()=>c.submit(),destroyOnHidden:!0,children:(0,Y.jsxs)(ky,{form:c,layout:`vertical`,onFinish:b,children:[(0,Y.jsx)(ky.Item,{name:`username`,label:`用户名`,rules:[{required:!0,min:3}],children:(0,Y.jsx)(ib,{})}),(0,Y.jsx)(ky.Item,{name:`password`,label:`密码`,rules:[{required:!0,min:6}],children:(0,Y.jsx)(ib.Password,{})})]})}),(0,Y.jsx)(yx,{title:`重置密码 — ${d?.username}`,open:!!d,onCancel:()=>f(null),onOk:()=>p.submit(),destroyOnHidden:!0,children:(0,Y.jsx)(ky,{form:p,layout:`vertical`,onFinish:x,children:(0,Y.jsx)(ky.Item,{name:`password`,label:`新密码`,rules:[{required:!0,min:6}],children:(0,Y.jsx)(ib.Password,{})})})})]})}var Ak={weekly:`周考`,monthly:`月考`,final:`期末`},jk={pending:`处理中`,ocr_done:`已识别`,solved:`已生成解法`,failed:`失败`};function Mxe({studentId:e,subjects:t,exams:n,onRefresh:r}){let[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(null),[c]=ky.useForm(),[l,u]=(0,h.useState)(!1);(0,h.useEffect)(()=>{i&&o?c.setFieldsValue({exam_type:o.exam_type,exam_date:(0,xg.default)(o.exam_date),title:o.title,scores:t.map(e=>{let t=o.scores.find(t=>t.subject_id===e.id);return t?{subject_id:e.id,total_score:t.total_score,obtained_score:t.obtained_score}:{subject_id:e.id,total_score:void 0,obtained_score:void 0}})}):i&&c.setFieldsValue({exam_type:`weekly`,exam_date:(0,xg.default)(),scores:t.map(e=>({subject_id:e.id}))})},[i,o,t,c]);let d=()=>{s(null),a(!0)},f=e=>{s(e),a(!0)},p=async()=>{try{let n=await c.validateFields(),i=(n.scores||[]).map((e,n)=>({subject_id:t[n]?.id??e.subject_id,total_score:e.total_score,obtained_score:e.obtained_score})).filter(e=>e.subject_id!=null&&e.total_score!=null&&e.obtained_score!=null&&e.total_score>0).map(e=>({subject_id:e.subject_id,total_score:Number(e.total_score),obtained_score:Number(e.obtained_score)}));if(i.length===0){rx.warning(`请至少录入一科成绩`);return}u(!0);let s={exam_type:n.exam_type,exam_date:n.exam_date.format(`YYYY-MM-DD`),title:n.title||void 0,scores:i};o?(await mk.update(o.id,s),rx.success(`已更新`)):(await mk.create(e,s),rx.success(`已添加`)),a(!1),r()}catch{}finally{u(!1)}},m=async e=>{yx.confirm({title:`确认删除该考试记录?`,onOk:async()=>{await mk.remove(e.id),rx.success(`已删除`),r()}})};return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(_p,{type:`primary`,onClick:d,style:{marginBottom:16},children:`录入成绩`}),(0,Y.jsx)(OT,{rowKey:`id`,columns:[{title:`日期`,dataIndex:`exam_date`,key:`exam_date`,width:110},{title:`类型`,dataIndex:`exam_type`,key:`exam_type`,width:80,render:e=>Ak[e]},{title:`标题`,dataIndex:`title`,key:`title`,ellipsis:!0},{title:`科目数`,key:`count`,width:80,render:(e,t)=>t.scores.length},{title:`平均占比`,key:`avg`,width:100,render:(e,t)=>t.scores.length?`${(t.scores.reduce((e,t)=>e+t.ratio,0)/t.scores.length*100).toFixed(1)}%`:`-`},{title:`操作`,key:`action`,width:120,render:(e,t)=>(0,Y.jsxs)(Py,{children:[(0,Y.jsx)(_p,{type:`link`,icon:(0,Y.jsx)(IT,{}),onClick:()=>f(t)}),(0,Y.jsx)(_p,{type:`link`,danger:!0,icon:(0,Y.jsx)(bE,{}),onClick:()=>m(t)})]})}],dataSource:n,pagination:{pageSize:10},scroll:{x:600}}),(0,Y.jsx)(yx,{title:o?`编辑考试`:`录入成绩`,open:i,onCancel:()=>a(!1),onOk:p,confirmLoading:l,width:720,destroyOnHidden:!0,children:(0,Y.jsxs)(ky,{form:c,layout:`vertical`,children:[(0,Y.jsxs)(Py,{style:{width:`100%`},size:`large`,children:[(0,Y.jsx)(ky.Item,{name:`exam_type`,label:`考试类型`,rules:[{required:!0}],children:(0,Y.jsx)(gS,{style:{width:120},options:Object.entries(Ak).map(([e,t])=>({value:e,label:t}))})}),(0,Y.jsx)(ky.Item,{name:`exam_date`,label:`考试日期`,rules:[{required:!0}],children:(0,Y.jsx)(Hv,{})}),(0,Y.jsx)(ky.Item,{name:`title`,label:`备注标题`,children:(0,Y.jsx)(ib,{placeholder:`可选`,style:{width:200}})})]}),(0,Y.jsx)(ky.List,{name:`scores`,children:e=>(0,Y.jsx)(OT,{size:`small`,pagination:!1,dataSource:e.map((e,n)=>({...e,subject:t[n]})),rowKey:`key`,columns:[{title:`科目`,render:(e,t)=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ky.Item,{name:[t.name,`subject_id`],hidden:!0,initialValue:t.subject?.id,children:(0,Y.jsx)(Tb,{})}),t.subject?.name]})},{title:`总分`,render:(e,t)=>(0,Y.jsx)(ky.Item,{name:[t.name,`total_score`],noStyle:!0,children:(0,Y.jsx)(Tb,{min:0,placeholder:`总分`,style:{width:100}})})},{title:`得分`,render:(e,t)=>(0,Y.jsx)(ky.Item,{name:[t.name,`obtained_score`],noStyle:!0,children:(0,Y.jsx)(Tb,{min:0,placeholder:`得分`,style:{width:100}})})},{title:`占比`,render:(e,t)=>{let n=c.getFieldValue([`scores`,t.name,`total_score`]),r=c.getFieldValue([`scores`,t.name,`obtained_score`]);return n>0&&r!=null?`${(r/n*100).toFixed(1)}%`:`-`}}]})})]})})]})}function Nxe({exams:e,subjectNames:t}){let n=new Set;e.forEach(e=>e.scores.forEach(e=>n.add(e.subject_id)));let r=[{title:`日期`,dataIndex:`exam_date`,key:`date`,width:110,fixed:`left`},{title:`类型`,dataIndex:`exam_type`,key:`type`,width:80,render:e=>(0,Y.jsx)(PT,{children:Ak[e]})},...[...n].sort((e,t)=>e-t).map(e=>({title:t[e]||`科目${e}`,key:`s${e}`,width:100,render:(t,n)=>{let r=n.scores.find(t=>t.subject_id===e);return r?`${r.obtained_score}/${r.total_score} (${(r.ratio*100).toFixed(1)}%)`:`-`}}))],i=e.filter(t=>t.scores.some(n=>{let r=e.filter(e=>e.exam_date<=t.exam_date).flatMap(e=>e.scores.filter(e=>e.subject_id===n.subject_id)).sort((t,n)=>{let r=e.find(e=>e.scores.includes(t)),i=e.find(e=>e.scores.includes(n));return(r?.exam_date||``).localeCompare(i?.exam_date||``)}),i=r.findIndex(e=>e.id===n.id);return i<=0?!1:Math.abs(r[i].ratio-r[i-1].ratio)>=.08}));return(0,Y.jsxs)(`div`,{children:[i.length>0&&(0,Y.jsxs)(`div`,{style:{marginBottom:16,padding:12,background:`#fff7e6`,borderRadius:8},children:[(0,Y.jsx)(`strong`,{children:`波动预警:`}),i.slice(0,5).map(e=>(0,Y.jsxs)(PT,{color:`orange`,style:{marginTop:4},children:[e.exam_date,` `,Ak[e.exam_type]]},e.id))]}),(0,Y.jsx)(OT,{rowKey:`id`,columns:r,dataSource:[...e].sort((e,t)=>t.exam_date.localeCompare(e.exam_date)),pagination:{pageSize:15},scroll:{x:`max-content`},size:`small`})]})}var Mk=function(e,t){return Mk=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Mk(e,t)};function Nk(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Mk(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Pk=function(){return Pk=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]`u`&&typeof self<`u`?Rk.worker=!0:!Rk.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Rk.node=!0,Rk.svgSupported=!0):Ixe(navigator.userAgent,Rk);function Ixe(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Lxe=`12px sans-serif`,Rxe=20,zxe=100,Bxe=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function Vxe(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;cQxe,HashMap:()=>RA,RADIAN_TO_DEGREE:()=>GA,assert:()=>MA,assignProps:()=>tA,bind:()=>fA,clone:()=>Qk,concatArray:()=>BA,createCanvas:()=>Jxe,createHashMap:()=>zA,createObject:()=>VA,curry:()=>pA,defaults:()=>nA,disableUserSelect:()=>HA,each:()=>Q,eqNaN:()=>EA,extend:()=>Z,filter:()=>lA,find:()=>uA,guid:()=>Xk,hasOwn:()=>UA,indexOf:()=>rA,inherits:()=>iA,isArray:()=>mA,isArrayLike:()=>oA,isBuiltInObject:()=>bA,isDom:()=>SA,isFunction:()=>hA,isGradientObject:()=>CA,isImagePatternObject:()=>wA,isNumber:()=>vA,isObject:()=>yA,isPrimitive:()=>IA,isRegExp:()=>TA,isString:()=>gA,isStringSafe:()=>_A,isTypedArray:()=>xA,keys:()=>dA,logError:()=>Zk,map:()=>sA,merge:()=>$k,mergeAll:()=>eA,mixin:()=>aA,noop:()=>WA,normalizeCssArray:()=>jA,reduce:()=>cA,retrieve:()=>DA,retrieve2:()=>OA,retrieve3:()=>kA,setAsPrimitive:()=>FA,slice:()=>AA,trim:()=>NA}),Vk=cA([`Function`,`RegExp`,`Date`,`Error`,`CanvasGradient`,`CanvasPattern`,`Image`,`Canvas`],function(e,t){return e[`[object `+t+`]`]=!0,e},{}),Hk=cA([`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`],function(e,t){return e[`[object `+t+`Array]`]=!0,e},{}),Uk=Object.prototype.toString,Wk=Array.prototype,Wxe=Wk.forEach,Gxe=Wk.filter,Gk=Wk.slice,Kxe=Wk.map,Kk=function(){}.constructor,qk=Kk?Kk.prototype:null,Jk=`__proto__`,Yk=2311,qxe=2**53-1;function Xk(){return Yk>=qxe&&(Yk=0),Yk++}function Zk(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function Qk(e){if(typeof e!=`object`||!e)return e;var t=e,n=Uk.call(e);if(n===`[object Array]`){if(!IA(e)){t=[];for(var r=0,i=e.length;rQA,applyTransform:()=>uj,clone:()=>XA,copy:()=>YA,create:()=>JA,dist:()=>oj,distSquare:()=>cj,distance:()=>aj,distanceSquare:()=>sj,div:()=>rSe,dot:()=>iSe,len:()=>tj,lenSquare:()=>nj,length:()=>eSe,lengthSquare:()=>tSe,lerp:()=>lj,max:()=>fj,min:()=>dj,mul:()=>nSe,negate:()=>aSe,normalize:()=>ij,scale:()=>rj,scaleAndAdd:()=>$A,set:()=>ZA,sub:()=>ej});function JA(e,t){return e??=0,t??=0,[e,t]}function YA(e,t){return e[0]=t[0],e[1]=t[1],e}function XA(e){return[e[0],e[1]]}function ZA(e,t,n){return e[0]=t,e[1]=n,e}function QA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function $A(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e}function ej(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function tj(e){return Math.sqrt(nj(e))}var eSe=tj;function nj(e){return e[0]*e[0]+e[1]*e[1]}var tSe=nj;function nSe(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}function rSe(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}function iSe(e,t){return e[0]*t[0]+e[1]*t[1]}function rj(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function ij(e,t){var n=tj(t);return n===0?(e[0]=0,e[1]=0):(e[0]=t[0]/n,e[1]=t[1]/n),e}function aj(e,t){return Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))}var oj=aj;function sj(e,t){return(e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])}var cj=sj;function aSe(e,t){return e[0]=-t[0],e[1]=-t[1],e}function lj(e,t,n,r){return e[0]=t[0]+r*(n[0]-t[0]),e[1]=t[1]+r*(n[1]-t[1]),e}function uj(e,t,n){var r=t[0],i=t[1];return e[0]=n[0]*r+n[2]*i+n[4],e[1]=n[1]*r+n[3]*i+n[5],e}function dj(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}function fj(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}var pj=function(){function e(e,t){this.target=e,this.topTarget=t&&t.topTarget}return e}(),oSe=function(){function e(e){this.handler=e,e.on(`mousedown`,this._dragStart,this),e.on(`mousemove`,this._drag,this),e.on(`mouseup`,this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new pj(t,e),`dragstart`,e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,r=e.offsetY,i=n-this._x,a=r-this._y;this._x=n,this._y=r,t.drift(i,a,e),this.handler.dispatchToElement(new pj(t,e),`drag`,e.event);var o=this.handler.findHover(n,r,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new pj(s,e),`dragleave`,e.event),o&&o!==s&&this.handler.dispatchToElement(new pj(o,e),`dragenter`,e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new pj(t,e),`dragend`,e.event),this._dropTarget&&this.handler.dispatchToElement(new pj(this._dropTarget,e),`drop`,e.event),this._draggingTarget=null,this._dropTarget=null},e}(),mj=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,r){this._$handlers||={};var i=this._$handlers;if(typeof t==`function`&&(r=n,n=t,t=null),!n||!e)return this;var a=this._$eventProcessor;t!=null&&a&&a.normalizeQuery&&(t=a.normalizeQuery(t)),i[e]||(i[e]=[]);for(var o=0;o>1)%2;s.cssText=[`position: absolute`,`visibility: hidden`,`padding: 0`,`margin: 0`,`border-width: 0`,`user-select: none`,`width:0`,`height:0`,r[c]+`:0`,i[l]+`:0`,r[1-c]+`:auto`,i[1-l]+`:auto`,``].join(`!important;`),e.appendChild(o),n.push(o)}return t.clearMarkers=function(){Q(n,function(e){e.parentNode&&e.parentNode.removeChild(e)})},n}function dSe(e,t,n){for(var r=n?`invTrans`:`trans`,i=t[r],a=t.srcCoords,o=[],s=[],c=!0,l=0;l<4;l++){var u=e[l].getBoundingClientRect(),d=2*l,f=u.left,p=u.top;o.push(f,p),c=c&&a&&f===a[d]&&p===a[d+1],s.push(e[l].offsetLeft,e[l].offsetTop)}return c&&i?i:(t.srcCoords=o,t[r]=n?gj(s,o):gj(o,s))}function bj(e){return e.nodeName.toUpperCase()===`CANVAS`}var fSe=/([&<>"'])/g,pSe={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function xj(e){return e==null?``:(e+``).replace(fSe,function(e,t){return pSe[t]})}var mSe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Sj=[],hSe=Rk.browser.firefox&&+Rk.browser.version.split(`.`)[0]<39;function Cj(e,t,n,r){return n||={},r?wj(e,t,n):hSe&&t.layerX!=null&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):t.offsetX==null?wj(e,t,n):(n.zrX=t.offsetX,n.zrY=t.offsetY),n}function wj(e,t,n){if(Rk.domSupported&&e.getBoundingClientRect){var r=t.clientX,i=t.clientY;if(bj(e)){var a=e.getBoundingClientRect();n.zrX=r-a.left,n.zrY=i-a.top;return}else if(yj(Sj,e,r,i)){n.zrX=Sj[0],n.zrY=Sj[1];return}}n.zrX=n.zrY=0}function Tj(e){return e||window.event}function Ej(e,t,n){if(t=Tj(t),t.zrX!=null)return t;var r=t.type;if(r&&r.indexOf(`touch`)>=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&Cj(e,i,t,n)}else{Cj(e,t,t,n);var a=gSe(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&mSe.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function gSe(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function Dj(e,t,n,r){e.addEventListener(t,n,r)}function _Se(e,t,n,r){e.removeEventListener(t,n,r)}var Oj=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function kj(e){return e.which===2||e.which===3}var vSe=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=Aj(r)/Aj(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=ySe(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},bSe=s({clone:()=>Bj,copy:()=>Pj,create:()=>Mj,identity:()=>Nj,invert:()=>zj,mul:()=>Fj,rotate:()=>Lj,scale:()=>Rj,translate:()=>Ij});function Mj(){return[1,0,0,1,0,0]}function Nj(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function Pj(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Fj(e,t,n){var r=t[0]*n[0]+t[2]*n[1],i=t[1]*n[0]+t[3]*n[1],a=t[0]*n[2]+t[2]*n[3],o=t[1]*n[2]+t[3]*n[3],s=t[0]*n[4]+t[2]*n[5]+t[4],c=t[1]*n[4]+t[3]*n[5]+t[5];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e}function Ij(e,t,n){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+n[0],e[5]=t[5]+n[1],e}function Lj(e,t,n,r){r===void 0&&(r=[0,0]);var i=t[0],a=t[2],o=t[4],s=t[1],c=t[3],l=t[5],u=Math.sin(n),d=Math.cos(n);return e[0]=i*d+s*u,e[1]=-i*u+s*d,e[2]=a*d+c*u,e[3]=-a*u+d*c,e[4]=d*(o-r[0])+u*(l-r[1])+r[0],e[5]=d*(l-r[1])-u*(o-r[0])+r[1],e}function Rj(e,t,n){var r=n[0],i=n[1];return e[0]=t[0]*r,e[1]=t[1]*i,e[2]=t[2]*r,e[3]=t[3]*i,e[4]=t[4]*r,e[5]=t[5]*i,e}function zj(e,t){var n=t[0],r=t[2],i=t[4],a=t[1],o=t[3],s=t[5],c=n*o-a*r;return c?(c=1/c,e[0]=o*c,e[1]=-a*c,e[2]=-r*c,e[3]=n*c,e[4]=(r*s-o*i)*c,e[5]=(a*i-n*s)*c,e):null}function Bj(e){var t=Mj();return Pj(t,e),t}var Vj=function(){function e(e,t){this.x=e||0,this.y=t||0}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(e,t){return this.x=e,this.y=t,this},e.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.scale=function(e){this.x*=e,this.y*=e},e.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},e.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},e.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},e.prototype.distanceSquare=function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(e){if(e){var t=this.x,n=this.y;return this.x=e[0]*t+e[2]*n+e[4],this.y=e[1]*t+e[3]*n+e[5],this}},e.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},e.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},e.set=function(e,t,n){e.x=t,e.y=n},e.copy=function(e,t){e.x=t.x,e.y=t.y},e.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},e.lenSquare=function(e){return e.x*e.x+e.y*e.y},e.dot=function(e,t){return e.x*t.x+e.y*t.y},e.add=function(e,t,n){e.x=t.x+n.x,e.y=t.y+n.y},e.sub=function(e,t,n){e.x=t.x-n.x,e.y=t.y-n.y},e.scale=function(e,t,n){e.x=t.x*n,e.y=t.y*n},e.scaleAndAdd=function(e,t,n,r){e.x=t.x+n.x*r,e.y=t.y+n.y*r},e.lerp=function(e,t,n,r){var i=1-r;e.x=i*t.x+r*n.x,e.y=i*t.y+r*n.y},e}(),Hj=Math.min,Uj=Math.max,Wj=Math.abs,Gj=[`x`,`y`],xSe=[`width`,`height`],Kj=new Vj,qj=new Vj,Jj=new Vj,Yj=new Vj,Xj=cM(),Zj=Xj.minTv,Qj=Xj.maxTv,$j=[0,0],eM=function(){function e(e,t,n,r){nM(this,e,t,n,r)}return e.set=function(e,t,n,r,i){return r<0&&(t+=r,r=-r),i<0&&(n+=i,i=-i),e.x=t,e.y=n,e.width=r,e.height=i,e},e.prototype.union=function(e){var t=Hj(e.x,this.x),n=Hj(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Uj(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Uj(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=t,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(e){return iM(Mj(),this,e)},e.prototype.intersect=function(t,n,r){return e.intersect(this,t,n,r)},e.intersect=function(t,n,r,i){r&&Vj.set(r,0,0);var a=i&&i.outIntersectRect||null,o=i&&i.clamp;if(a&&(a.x=a.y=a.width=a.height=NaN),!t||!n)return!1;t instanceof e||(t=nM(CSe,t.x,t.y,t.width,t.height)),n instanceof e||(n=nM(wSe,n.x,n.y,n.width,n.height));var s=!!r;Xj.reset(i,s);var c=Xj.touchThreshold,l=t.x+c,u=t.x+t.width-c,d=t.y+c,f=t.y+t.height-c,p=n.x+c,m=n.x+n.width-c,h=n.y+c,g=n.y+n.height-c;if(l>u||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){rM(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&rM(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Kj.x=Jj.x=t.x,Kj.y=Yj.y=t.y,qj.x=Yj.x=t.x+t.width,qj.y=Jj.y=t.y+t.height,Kj.transform(n),Yj.transform(n),qj.transform(n),Jj.transform(n),e.x=Hj(Kj.x,qj.x,Jj.x,Yj.x),e.y=Hj(Kj.y,qj.y,Jj.y,Yj.y);var s=Uj(Kj.x,qj.x,Jj.x,Yj.x),c=Uj(Kj.y,qj.y,Jj.y,Yj.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=Nj(e||[]),Ij(e,e,ZA(oM,-t.x,-t.y)),Rj(e,e,ZA(oM,r,i)),Ij(e,e,ZA(oM,n.x,n.y)),e},e}(),tM=eM.create,nM=eM.set,rM=eM.copy,iM=eM.calculateTransform,aM=eM.applyTransform,SSe=eM.contain,CSe=new eM(0,0,0,0),wSe=new eM(0,0,0,0),oM=[];function sM(e,t,n,r,i,a,o,s){var c=Wj(t-n),l=Wj(r-e),u=Hj(c,l),d=Gj[i],f=Gj[1-i],p=xSe[i];t=l||!Xj.bidirectional)&&(Zj[d]=-l,Zj[f]=0,Xj.useDir&&Xj.calcDirMTV())))}function cM(){var e=0,t=new Vj,n=new Vj,r={minTv:new Vj,maxTv:new Vj,useDir:!1,dirMinTv:new Vj,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Uj(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=0;l--){var u=r[l];u!==n&&!u.ignore&&!u.ignoreCoarsePointer&&(!u.parent||!u.parent.ignoreCoarsePointer)&&(dM.copy(u.getBoundingRect()),u.transform&&dM.applyTransform(u.transform),dM.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function kSe(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return i?lM:!0}return!1}function pM(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=kSe(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==lM)){t.target=o;break}}}function mM(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var hM=32,gM=7;function ASe(e){for(var t=0;e>=hM;)t|=e&1,e>>=1;return e+t}function _M(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function jSe(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function yM(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function bM(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function MSe(e,t){var n=gM,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=gM||m>=gM);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u];return}for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-yM(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=gM||g>=gM);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),vM(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}var SM=!1;function CM(){SM||(SM=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function wM(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var NSe=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=wM}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),TM=Rk.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)},EM={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:1024**(e-1)},exponentialOut:function(e){return e===1?1:1-2**(-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),-(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)))},elasticOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),n*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/r)+1)},elasticInOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?-.5*(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)):n*2**(-10*--e)*Math.sin((e-t)*(2*Math.PI)/r)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=1.70158*1.525;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-EM.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?EM.bounceIn(e*2)*.5:EM.bounceOut(e*2-1)*.5+.5}},DM=Math.pow,OM=Math.sqrt,kM=1e-8,AM=1e-4,jM=OM(3),MM=1/3,NM=JA(),PM=JA(),FM=JA();function IM(e){return e>-kM&&ekM||e<-kM}function RM(e,t,n,r,i){var a=1-i;return a*a*(a*e+3*i*t)+i*i*(i*r+3*a*n)}function zM(e,t,n,r,i){var a=1-i;return 3*(((t-e)*a+2*(n-t)*i)*a+(r-n)*i*i)}function BM(e,t,n,r,i,a){var o=r+3*(t-n)-e,s=3*(n-t*2+e),c=3*(t-e),l=e-i,u=s*s-3*o*c,d=s*c-9*o*l,f=c*c-3*s*l,p=0;if(IM(u)&&IM(d))if(IM(s))a[0]=0;else{var m=-c/s;m>=0&&m<=1&&(a[p++]=m)}else{var h=d*d-4*u*f;if(IM(h)){var g=d/u,m=-s/o+g,_=-g/2;m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_)}else if(h>0){var v=OM(h),y=u*s+1.5*o*(-d+v),b=u*s+1.5*o*(-d-v);y=y<0?-DM(-y,MM):DM(y,MM),b=b<0?-DM(-b,MM):DM(b,MM);var m=(-s-(y+b))/(3*o);m>=0&&m<=1&&(a[p++]=m)}else{var x=(2*u*s-3*o*d)/(2*OM(u*u*u)),S=Math.acos(x)/3,C=OM(u),w=Math.cos(S),m=(-s-2*C*w)/(3*o),_=(-s+C*(w+jM*Math.sin(S)))/(3*o),T=(-s+C*(w-jM*Math.sin(S)))/(3*o);m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_),T>=0&&T<=1&&(a[p++]=T)}}return p}function VM(e,t,n,r,i){var a=6*n-12*t+6*e,o=9*t+3*r-3*e-9*n,s=3*t-3*e,c=0;if(IM(o)){if(LM(a)){var l=-s/a;l>=0&&l<=1&&(i[c++]=l)}}else{var u=a*a-4*o*s;if(IM(u))i[0]=-a/(2*o);else if(u>0){var d=OM(u),l=(-a+d)/(2*o),f=(-a-d)/(2*o);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function HM(e,t,n,r,i,a){var o=(t-e)*i+e,s=(n-t)*i+t,c=(r-n)*i+n,l=(s-o)*i+o,u=(c-s)*i+s,d=(u-l)*i+l;a[0]=e,a[1]=o,a[2]=l,a[3]=d,a[4]=d,a[5]=u,a[6]=c,a[7]=r}function UM(e,t,n,r,i,a,o,s,c,l,u){var d,f=.005,p=1/0,m,h,g,_;NM[0]=c,NM[1]=l;for(var v=0;v<1;v+=.05)PM[0]=RM(e,n,i,o,v),PM[1]=RM(t,r,a,s,v),g=cj(NM,PM),g=0&&g=0&&l<=1&&(i[c++]=l)}}else{var u=o*o-4*a*s;if(IM(u)){var l=-o/(2*a);l>=0&&l<=1&&(i[c++]=l)}else if(u>0){var d=OM(u),l=(-o+d)/(2*a),f=(-o-d)/(2*a);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function KM(e,t,n){var r=e+n-2*t;return r===0?.5:(e-t)/r}function qM(e,t,n,r,i){var a=(t-e)*r+e,o=(n-t)*r+t,s=(o-a)*r+a;i[0]=e,i[1]=a,i[2]=s,i[3]=s,i[4]=o,i[5]=n}function JM(e,t,n,r,i,a,o,s,c){var l,u=.005,d=1/0;NM[0]=o,NM[1]=s;for(var f=0;f<1;f+=.05){PM[0]=WM(e,n,i,f),PM[1]=WM(t,r,a,f);var p=cj(NM,PM);p=0&&p=1?1:BM(0,r,a,1,e,s)&&RM(0,i,o,1,s[0])}}}var RSe=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||WA,this.ondestroy=e.ondestroy||WA,this.onrestart=e.onrestart||WA,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||=(this._startTime=e+this._delay,!0),this._paused){this._pausedTime+=t;return}var n=this._life,r=e-this._startTime-this._pausedTime,i=r/n;i<0&&(i=0),i=Math.min(i,1);var a=this.easingFunc,o=a?a(i):i;if(this.onframe(o),i===1)if(this.loop){var s=r%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}else return!0;return!1},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=hA(e)?e:EM[e]||YM(e)},e}(),XM=function(){function e(e){this.value=e}return e}(),zSe=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new XM(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),ZM=function(){function e(e){this._list=new zSe,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new XM(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),BSe=s({fastLerp:()=>pN,fastMapToColor:()=>WSe,lerp:()=>mN,lift:()=>fN,liftColor:()=>bN,lum:()=>vN,mapToColor:()=>GSe,modifyAlpha:()=>gN,modifyHSL:()=>hN,parse:()=>uN,parseCssFloat:()=>nN,parseCssInt:()=>tN,random:()=>KSe,stringify:()=>_N,toHex:()=>USe}),QM={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function $M(e){return e=Math.round(e),e<0?0:e>255?255:e}function VSe(e){return e=Math.round(e),e<0?0:e>360?360:e}function eN(e){return e<0?0:e>1?1:e}function tN(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?$M(parseFloat(t)/100*255):$M(parseInt(t,10))}function nN(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?eN(parseFloat(t)/100):eN(parseFloat(t))}function rN(e,t,n){return n<0?n+=1:n>1&&--n,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function iN(e,t,n){return e+(t-e)*n}function aN(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function oN(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var sN=new ZM(20),cN=null;function lN(e,t){cN&&oN(cN,t),cN=sN.put(e,cN||t.slice())}function uN(e,t){if(e){t||=[];var n=sN.get(e);if(n)return oN(t,n);e+=``;var r=e.replace(/ /g,``).toLowerCase();if(r in QM)return oN(t,QM[r]),lN(e,t),t;var i=r.length;if(r.charAt(0)===`#`){if(i===4||i===5){var a=parseInt(r.slice(1,4),16);if(!(a>=0&&a<=4095)){aN(t,0,0,0,1);return}return aN(t,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),lN(e,t),t}else if(i===7||i===9){var a=parseInt(r.slice(1,7),16);if(!(a>=0&&a<=16777215)){aN(t,0,0,0,1);return}return aN(t,(a&16711680)>>16,(a&65280)>>8,a&255,i===9?parseInt(r.slice(7),16)/255:1),lN(e,t),t}return}var o=r.indexOf(`(`),s=r.indexOf(`)`);if(o!==-1&&s+1===i){var c=r.substr(0,o),l=r.substr(o+1,s-(o+1)).split(`,`),u=1;switch(c){case`rgba`:if(l.length!==4)return l.length===3?aN(t,+l[0],+l[1],+l[2],1):aN(t,0,0,0,1);u=nN(l.pop());case`rgb`:if(l.length>=3)return aN(t,tN(l[0]),tN(l[1]),tN(l[2]),l.length===3?u:nN(l[3])),lN(e,t),t;aN(t,0,0,0,1);return;case`hsla`:if(l.length!==4){aN(t,0,0,0,1);return}return l[3]=nN(l[3]),dN(l,t),lN(e,t),t;case`hsl`:if(l.length!==3){aN(t,0,0,0,1);return}return dN(l,t),lN(e,t),t;default:return}}aN(t,0,0,0,1)}}function dN(e,t){var n=(parseFloat(e[0])%360+360)%360/360,r=nN(e[1]),i=nN(e[2]),a=i<=.5?i*(r+1):i+r-i*r,o=i*2-a;return t||=[],aN(t,$M(rN(o,a,n+1/3)*255),$M(rN(o,a,n)*255),$M(rN(o,a,n-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function HSe(e){if(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=(a+i)/2,c,l;if(o===0)c=0,l=0;else{l=s<.5?o/(a+i):o/(2-a-i);var u=((a-t)/6+o/2)/o,d=((a-n)/6+o/2)/o,f=((a-r)/6+o/2)/o;t===a?c=f-d:n===a?c=1/3+u-f:r===a&&(c=2/3+d-u),c<0&&(c+=1),c>1&&--c}var p=[c*360,l,s];return e[3]!=null&&p.push(e[3]),p}}function fN(e,t){var n=uN(e);if(n){for(var r=0;r<3;r++)t<0?n[r]=n[r]*(1-t)|0:n[r]=(255-n[r])*t+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return _N(n,n.length===4?`rgba`:`rgb`)}}function USe(e){var t=uN(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function pN(e,t,n){if(!(!(t&&t.length)||!(e>=0&&e<=1))){n||=[];var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=t[i],s=t[a],c=r-i;return n[0]=$M(iN(o[0],s[0],c)),n[1]=$M(iN(o[1],s[1],c)),n[2]=$M(iN(o[2],s[2],c)),n[3]=eN(iN(o[3],s[3],c)),n}}var WSe=pN;function mN(e,t,n){if(!(!(t&&t.length)||!(e>=0&&e<=1))){var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=uN(t[i]),s=uN(t[a]),c=r-i,l=_N([$M(iN(o[0],s[0],c)),$M(iN(o[1],s[1],c)),$M(iN(o[2],s[2],c)),eN(iN(o[3],s[3],c))],`rgba`);return n?{color:l,leftIndex:i,rightIndex:a,value:r}:l}}var GSe=mN;function hN(e,t,n,r){var i=uN(e);if(e)return i=HSe(i),t!=null&&(i[0]=VSe(hA(t)?t(i[0]):t)),n!=null&&(i[1]=nN(hA(n)?n(i[1]):n)),r!=null&&(i[2]=nN(hA(r)?r(i[2]):r)),_N(dN(i),`rgba`)}function gN(e,t){var n=uN(e);if(n&&t!=null)return n[3]=eN(t),_N(n,`rgba`)}function _N(e,t){if(!(!e||!e.length)){var n=e[0]+`,`+e[1]+`,`+e[2];return(t===`rgba`||t===`hsva`||t===`hsla`)&&(n+=`,`+e[3]),t+`(`+n+`)`}}function vN(e,t){var n=uN(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}function KSe(){return _N([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],`rgb`)}var yN=new ZM(100);function bN(e){if(gA(e)){var t=yN.get(e);return t||(t=fN(e,-.1),yN.put(e,t)),t}else if(CA(e)){var n=Z({},e);return n.colorStops=sA(e.colorStops,function(e){return{offset:e.offset,color:fN(e.color,-.1)}}),n}return e}var xN=Math.round;function SN(e){var t;if(!e||e===`transparent`)e=`none`;else if(typeof e==`string`&&e.indexOf(`rgba`)>-1){var n=uN(e);n&&(e=`rgb(`+n[0]+`,`+n[1]+`,`+n[2]+`)`,t=n[3])}return{color:e,opacity:t??1}}var CN=1e-4;function wN(e){return e-CN}function TN(e){return xN(e*1e3)/1e3}function EN(e){return xN(e*1e4)/1e4}function qSe(e){return`matrix(`+TN(e[0])+`,`+TN(e[1])+`,`+TN(e[2])+`,`+TN(e[3])+`,`+EN(e[4])+`,`+EN(e[5])+`)`}var JSe={left:`start`,right:`end`,center:`middle`,middle:`middle`};function YSe(e,t,n){return n===`top`?e+=t/2:n===`bottom`&&(e-=t/2),e}function XSe(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function ZSe(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(`,`)}function DN(e){return e&&!!e.image}function QSe(e){return e&&!!e.svgElement}function ON(e){return DN(e)||QSe(e)}function kN(e){return e.type===`linear`}function AN(e){return e.type===`radial`}function jN(e){return e&&(e.type===`linear`||e.type===`radial`)}function MN(e){return`url(#`+e+`)`}function NN(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function PN(e){var t=e.x||0,n=e.y||0,r=(e.rotation||0)*GA,i=OA(e.scaleX,1),a=OA(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,c=[];return(t||n)&&c.push(`translate(`+t+`px,`+n+`px)`),r&&c.push(`rotate(`+r+`)`),(i!==1||a!==1)&&c.push(`scale(`+i+`,`+a+`)`),(o||s)&&c.push(`skew(`+xN(o*GA)+`deg, `+xN(s*GA)+`deg)`),c.join(` `)}var $Se=(function(){return typeof Buffer<`u`&&typeof Buffer.from==`function`?function(e){return Buffer.from(e).toString(`base64`)}:typeof btoa==`function`&&typeof unescape==`function`&&typeof encodeURIComponent==`function`?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}})(),FN=Array.prototype.slice;function IN(e,t,n){return(t-e)*n+e}function LN(e,t,n,r){for(var i=t.length,a=0;ar?t:e,a=Math.min(n,r),o=i[a-1]||{color:[0,0,0,0],offset:0},s=a;so)r.length=o;else for(var s=a;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var r=this.keyframes,i=r.length,a=!1,o=JN,s=t;if(oA(t)){var c=rCe(t);o=c,(c===1&&!vA(t[0])||c===2&&!vA(t[0][0]))&&(a=!0)}else if(vA(t)&&!EA(t))o=HN;else if(gA(t))if(!isNaN(+t))o=HN;else{var l=uN(t);l&&(s=l,o=GN)}else if(CA(t)){var u=Z({},s);u.colorStops=sA(t.colorStops,function(e){return{offset:e.offset,color:uN(e.color)}}),kN(t)?o=KN:AN(t)&&(o=qN),s=u}i===0?this.valType=o:(o!==this.valType||o===JN)&&(a=!0),this.discrete=this.discrete||a;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=hA(n)?n:EM[n]||YM(n)),r.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort(function(e,t){return e.time-t.time});for(var r=this.valType,i=n.length,a=n[i-1],o=this.discrete,s=XN(r),c=YN(r),l=0;l=0&&!(a[l].percent<=t);l--);l=d(l,o-2)}else{for(l=u;lt);l++);l=d(l-1,o-2)}p=a[l+1],f=a[l]}if(f&&p){this._lastFr=l,this._lastFrP=t;var m=p.percent-f.percent,h=m===0?1:d((t-f.percent)/m,1);p.easingFunc&&(h=p.easingFunc(h));var g=n?this._additiveValue:c?ZN:e[s];if((XN(i)||c)&&!g&&(g=this._additiveValue=[]),this.discrete)e[s]=h<1?f.rawValue:p.rawValue;else if(XN(i))i===UN?LN(g,f[r],p[r],h):eCe(g,f[r],p[r],h);else if(YN(i)){var _=f[r],v=p[r],y=i===KN;e[s]={type:y?`linear`:`radial`,x:IN(_.x,v.x,h),y:IN(_.y,v.y,h),colorStops:sA(_.colorStops,function(e,t){var n=v.colorStops[t];return{offset:IN(e.offset,n.offset,h),color:VN(LN([],e.color,n.color,h))}}),global:v.global},y?(e[s].x2=IN(_.x2,v.x2,h),e[s].y2=IN(_.y2,v.y2,h)):e[s].r=IN(_.r,v.r,h)}else if(c)LN(g,f[r],p[r],h),n||(e[s]=VN(g));else{var b=IN(f[r],p[r],h);n?this._additiveValue=b:e[s]=b}n&&this._addToTarget(e)}}},e.prototype._addToTarget=function(e){var t=this.valType,n=this.propName,r=this._additiveValue;t===HN?e[n]=e[n]+r:t===GN?(uN(e[n],ZN),RN(ZN,ZN,r,1),e[n]=VN(ZN)):t===UN?RN(e[n],e[n],r,1):t===WN&&zN(e[n],e[n],r,1)},e}(),QN=function(){function e(e,t,n,r){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r){Zk(`Can' use additive animation on looped animation.`);return}this._additiveAnimators=r,this._allowDiscrete=n}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(e){this._target=e},e.prototype.when=function(e,t,n){return this.whenWithKeys(e,t,dA(t),n)},e.prototype.whenWithKeys=function(e,t,n,r){for(var i=this._tracks,a=0;a0&&s.addKeyframe(0,BN(c),r),this._trackKeys.push(o)}s.addKeyframe(e,BN(t[o]),r)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],r=this._maxTime||0,i=0;i1){var o=a.pop();i.addKeyframe(o.time,e[r]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}();function $N(){return new Date().getTime()}var aCe=function(e){qA(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=$N()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)?(r.ondestroy(),this.removeClip(r),r=i):r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(TM(t),!e._paused&&e.update())}TM(t)},t.prototype.start=function(){this._running||(this._time=$N(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=$N(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=$N()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new QN(e,t.loop);return this.addAnimator(n),n},t}(mj),oCe=300,eP=Rk.domSupported,tP=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:sA(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),nP={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},rP=!1;function iP(e){var t=e.pointerType;return t===`pen`||t===`touch`}function sCe(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function aP(e){e&&(e.zrByTouch=!0)}function cCe(e,t){return Ej(e.dom,new lCe(e,t),!0)}function oP(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var lCe=function(){function e(e,t){this.stopPropagation=WA,this.stopImmediatePropagation=WA,this.preventDefault=WA,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),sP={mousedown:function(e){e=Ej(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=Ej(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=Ej(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=Ej(this.dom,e);var t=e.toElement||e.relatedTarget;oP(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){rP=!0,e=Ej(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){rP||(e=Ej(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=Ej(this.dom,e),aP(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),sP.mousemove.call(this,e),sP.mousedown.call(this,e)},touchmove:function(e){e=Ej(this.dom,e),aP(e),this.handler.processGesture(e,`change`),sP.mousemove.call(this,e)},touchend:function(e){e=Ej(this.dom,e),aP(e),this.handler.processGesture(e,`end`),sP.mouseup.call(this,e),new Date-+this.__lastTouchMomentvP||e<-vP}var bP=[],xP=[],SP=Mj(),CP=Math.abs,wP=function(){function e(){}return e.prototype.getLocalTransform=function(e){return TP(this,e)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return yP(this.rotation)||yP(this.x)||yP(this.y)||yP(this.scaleX-1)||yP(this.scaleY-1)||yP(this.skewX)||yP(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;if(!(t||e)){n&&(_P(n),this.invTransform=null);return}n||=Mj(),t?this.getLocalTransform(n):_P(n),e&&(t?Fj(n,e,n):Pj(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||Mj(),zj(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(bP);var n=bP[0]<0?-1:1,r=bP[1]<0?-1:1,i=((bP[0]-n)*t+n)/bP[0]||0,a=((bP[1]-r)*t+r)/bP[1]||0;e[0]*=i,e[1]*=i,e[2]*=a,e[3]*=a}},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],r=Math.atan2(e[1],e[0]),i=Math.PI/2+r-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),t=Math.sqrt(t),this.skewX=i,this.skewY=0,this.rotation=-r,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||Mj(),Fj(xP,e.invTransform,t),t=xP);var n=this.originX,r=this.originY;(n||r)&&(SP[4]=n,SP[5]=r,Fj(xP,t,SP),xP[4]-=n,xP[5]-=r,t=xP),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e||=[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],r=this.invTransform;return r&&uj(n,n,r),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],r=this.transform;return r&&uj(n,n,r),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&CP(e[0]-1)>1e-10&&CP(e[3]-1)>1e-10?Math.sqrt(CP(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){OP(this,e)},e.getLocalTransform=function(e,t){t||=[];var n=e.originX||0,r=e.originY||0,i=e.scaleX,a=e.scaleY,o=e.anchorX,s=e.anchorY,c=e.rotation||0,l=e.x,u=e.y,d=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(n||r||o||s){var p=n+o,m=r+s;t[4]=-p*i-d*m*a,t[5]=-m*a-f*p*i}else t[4]=t[5]=0;return t[0]=i,t[3]=a,t[1]=f*i,t[2]=d*a,c&&Lj(t,t,c),t[4]+=n+l,t[5]+=r+u,t},e.initDefaultProps=(function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0})(),e}(),TP=wP.getLocalTransform;function EP(){return new wP}var DP=[`x`,`y`,`originX`,`originY`,`anchorX`,`anchorY`,`rotation`,`scaleX`,`scaleY`,`skewX`,`skewY`];function OP(e,t){return tA(e,t,DP)}function kP(e){AP||=new ZM(100),e||=`12px sans-serif`;var t=AP.get(e);return t||(t={font:e,strWidthCache:new ZM(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:zk.measureText(`国`,e).width,asciiCharWidth:zk.measureText(`a`,e).width},AP.put(e,t)),t}var AP;function mCe(e){if(!(jP>=MP)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=zk.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?jP=MP:i>2&&jP++,t}}var jP=0,MP=5;function NP(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=mCe(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function PP(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=zk.measureText(t,e.font).width,n.put(t,r)),r}function FP(e,t,n,r){var i=PP(kP(t),e),a=zP(t);return new eM(LP(0,i,n),RP(0,a,r),i,a)}function IP(e,t,n,r){var i=((e||``)+``).split(` +`+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=VO(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ik.assertOptions(n,{silentJSONParsing:ak.transitional(ak.boolean),forcedJSONParsing:ak.transitional(ak.boolean),clarifyTimeoutError:ak.transitional(ak.boolean),legacyInterceptorReqResOrdering:ak.transitional(ak.boolean),advertiseZstdAcceptEncoding:ak.transitional(ak.boolean),validateStatusUndefinedResolves:ak.transitional(ak.boolean)},!1),r!=null&&(J.isFunction(r)?t.paramsSerializer={serialize:r}:ik.assertOptions(r,{encode:ak.function,serialize:ak.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ik.assertOptions(t,{baseUrl:ak.spelling(`baseURL`),withXsrfToken:ak.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&J.merge(i.common,i[t.method]);i&&J.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=dO.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||SO;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[tk.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u{if(!n._listeners)return;let t=n._listeners.length;for(;t-->0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new NO(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function uxe(e){return function(t){return e.apply(null,t)}}function dxe(e){return J.isObject(e)&&e.isAxiosError===!0}var sk={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(sk).forEach(([e,t])=>{sk[t]=e});function ck(e){let t=new ok(e),n=lye(ok.prototype.request,t);return J.extend(n,ok.prototype,t,{allOwnKeys:!0}),J.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return ck(VO(e,t))},n}var lk=ck(AO);lk.Axios=ok,lk.CanceledError=NO,lk.CancelToken=lxe,lk.isCancel=MO,lk.VERSION=GO,lk.toFormData=gO,lk.AxiosError=fO,lk.Cancel=lk.CanceledError,lk.all=function(e){return Promise.all(e)},lk.spread=uxe,lk.isAxiosError=dxe,lk.mergeConfig=VO,lk.AxiosHeaders=dO,lk.formToJSON=e=>OO(J.isHTMLForm(e)?new FormData(e):e),lk.getAdapter=$O.getAdapter,lk.HttpStatusCode=sk,lk.default=lk;var fxe=l(Qge(),1),uk=lk.create({baseURL:`/api`});uk.interceptors.request.use(e=>{let t=localStorage.getItem(`access_token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e}),uk.interceptors.response.use(e=>e,async e=>{let t=e.config;if(e.response?.status===401&&!t._retry){t._retry=!0;let e=localStorage.getItem(`refresh_token`);if(e)try{let{data:n}=await lk.post(`/api/auth/refresh`,{refresh_token:e});return localStorage.setItem(`access_token`,n.access_token),localStorage.setItem(`refresh_token`,n.refresh_token),t.headers.Authorization=`Bearer ${n.access_token}`,uk(t)}catch{localStorage.removeItem(`access_token`),localStorage.removeItem(`refresh_token`),window.location.href=`/login`}}return Promise.reject(e)});var dk={register:(e,t)=>uk.post(`/auth/register`,{username:e,password:t}),login:(e,t)=>uk.post(`/auth/login`,{username:e,password:t}),me:()=>uk.get(`/auth/me`)},pxe={public:()=>uk.get(`/settings/public`)},fk={getSettings:()=>uk.get(`/admin/settings`),updateSettings:e=>uk.patch(`/admin/settings`,e),updateProfile:e=>uk.patch(`/admin/profile`,e),listUsers:()=>uk.get(`/admin/users`),createUser:e=>uk.post(`/admin/users`,e),resetUserPassword:(e,t)=>uk.patch(`/admin/users/${e}`,{password:t}),deleteUser:e=>uk.delete(`/admin/users/${e}`)},pk={list:()=>uk.get(`/students`),create:e=>uk.post(`/students`,e),get:e=>uk.get(`/students/${e}`),update:(e,t)=>uk.patch(`/students/${e}`,t),remove:e=>uk.delete(`/students/${e}`)},mxe={list:()=>uk.get(`/subjects`)},mk={list:e=>uk.get(`/students/${e}/exams`),create:(e,t)=>uk.post(`/students/${e}/exams`,t),update:(e,t)=>uk.patch(`/exams/${e}`,t),remove:e=>uk.delete(`/exams/${e}`),trend:(e,t)=>uk.get(`/students/${e}/scores/trend`,{params:{subject_id:t}}),exportCsv:e=>uk.get(`/students/${e}/scores/export`,{responseType:`blob`})},hk={list:(e,t)=>uk.get(`/students/${e}/wrong-questions`,{params:t}),upload:(e,t,n,r=`regular`)=>{let i=new FormData;return i.append(`subject_id`,String(t)),i.append(`category`,r),i.append(`file`,n),uk.post(`/students/${e}/wrong-questions`,i)},get:e=>uk.get(`/wrong-questions/${e}`),update:(e,t)=>uk.patch(`/wrong-questions/${e}`,t),remove:e=>uk.delete(`/wrong-questions/${e}`),retryOcr:e=>uk.post(`/wrong-questions/${e}/retry-ocr`),regenerate:e=>uk.post(`/wrong-questions/${e}/regenerate-solution`),imageUrl:e=>`/api/wrong-questions/${e}/image`},hxe=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Y=o(((e,t)=>{t.exports=hxe()}))(),gk=(0,h.createContext)(null);function gxe({children:e}){let[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!0);(0,h.useEffect)(()=>{if(!localStorage.getItem(`access_token`)){i(!1);return}dk.me().then(e=>n(e.data)).catch(()=>{localStorage.removeItem(`access_token`),localStorage.removeItem(`refresh_token`)}).finally(()=>i(!1))},[]);let a=async(e,t)=>{let{data:r}=await dk.login(e,t);localStorage.setItem(`access_token`,r.access_token),localStorage.setItem(`refresh_token`,r.refresh_token),n((await dk.me()).data)};return(0,Y.jsx)(gk.Provider,{value:{user:t,loading:r,login:a,register:async(e,t)=>{await dk.register(e,t),await a(e,t)},logout:()=>{localStorage.removeItem(`access_token`),localStorage.removeItem(`refresh_token`),n(null)}},children:e})}function _k(){let e=(0,h.useContext)(gk);if(!e)throw Error(`useAuth must be used within AuthProvider`);return e}var _xe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`arrow-left`,theme:`outlined`}}))());function vk(){return vk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,vk({},e,{ref:t,icon:_xe.default}))),yxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M864 248H728l-32.4-90.8a32.07 32.07 0 00-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z`}}]},name:`camera`,theme:`outlined`}}))());function yk(){return yk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,yk({},e,{ref:t,icon:yxe.default}))),xxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z`}}]},name:`lock`,theme:`outlined`}}))());function bk(){return bk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,bk({},e,{ref:t,icon:xxe.default}))),Sxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M868 732h-70.3c-4.8 0-9.3 2.1-12.3 5.8-7 8.5-14.5 16.7-22.4 24.5a353.84 353.84 0 01-112.7 75.9A352.8 352.8 0 01512.4 866c-47.9 0-94.3-9.4-137.9-27.8a353.84 353.84 0 01-112.7-75.9 353.28 353.28 0 01-76-112.5C167.3 606.2 158 559.9 158 512s9.4-94.2 27.8-137.8c17.8-42.1 43.4-80 76-112.5s70.5-58.1 112.7-75.9c43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 7.9 7.9 15.3 16.1 22.4 24.5 3 3.7 7.6 5.8 12.3 5.8H868c6.3 0 10.2-7 6.7-12.3C798 160.5 663.8 81.6 511.3 82 271.7 82.6 79.6 277.1 82 516.4 84.4 751.9 276.2 942 512.4 942c152.1 0 285.7-78.8 362.3-197.7 3.4-5.3-.4-12.3-6.7-12.3zm88.9-226.3L815 393.7c-5.3-4.2-13-.4-13 6.3v76H488c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h314v76c0 6.7 7.8 10.5 13 6.3l141.9-112a8 8 0 000-12.6z`}}]},name:`logout`,theme:`outlined`}}))());function Sk(){return Sk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Sk({},e,{ref:t,icon:Sxe.default}))),wxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z`}}]},name:`reload`,theme:`outlined`}}))());function Ck(){return Ck=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Ck({},e,{ref:t,icon:wxe.default}))),Exe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z`}}]},name:`setting`,theme:`outlined`}}))());function wk(){return wk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,wk({},e,{ref:t,icon:Exe.default}))),Dxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z`}}]},name:`upload`,theme:`outlined`}}))());function Ek(){return Ek=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Ek({},e,{ref:t,icon:Dxe.default}))),kxe=l(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z`}}]},name:`user`,theme:`outlined`}}))());function Dk(){return Dk=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(W,Dk({},e,{ref:t,icon:kxe.default})));function kk(e,t){if(lk.isAxiosError(e)){let t=e.response?.data?.detail;if(typeof t==`string`)return t;if(Array.isArray(t)&&t[0]?.msg)return t[0].msg}return t}function Axe(){let{user:e,login:t,register:n,loading:r}=_k(),i=vD(),[a]=ky.useForm(),[o]=ky.useForm(),[s,c]=(0,h.useState)(!0),[l,u]=(0,h.useState)(!0);if((0,h.useEffect)(()=>{pxe.public().then(e=>c(e.data.registration_enabled)).catch(()=>c(!0)).finally(()=>u(!1))},[]),!r&&e)return(0,Y.jsx)(wD,{to:`/`,replace:!0});let d=async e=>{try{await t(e.username,e.password),rx.success(`登录成功`),i(`/`)}catch(e){rx.error(kk(e,`用户名或密码错误`))}},f=async e=>{if(e.password!==e.confirm){rx.error(`两次密码不一致`);return}try{await n(e.username,e.password),rx.success(`注册成功`),i(`/`)}catch(e){rx.error(kk(e,`注册失败,请稍后重试`))}},p=[{key:`login`,label:`登录`,children:(0,Y.jsxs)(ky,{form:a,onFinish:d,layout:`vertical`,children:[(0,Y.jsx)(ky.Item,{name:`username`,rules:[{required:!0,message:`请输入用户名`}],children:(0,Y.jsx)(ib,{prefix:(0,Y.jsx)(Ok,{}),placeholder:`用户名`})}),(0,Y.jsx)(ky.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{}),placeholder:`密码`})}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,block:!0,children:`登录`})]})}];return s&&p.push({key:`register`,label:`注册`,children:(0,Y.jsxs)(ky,{form:o,onFinish:f,layout:`vertical`,children:[(0,Y.jsx)(ky.Item,{name:`username`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`至少3个字符`}],children:(0,Y.jsx)(ib,{prefix:(0,Y.jsx)(Ok,{}),placeholder:`用户名`})}),(0,Y.jsx)(ky.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`},{min:6,message:`至少6个字符`}],children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{}),placeholder:`密码`})}),(0,Y.jsx)(ky.Item,{name:`confirm`,rules:[{required:!0,message:`请确认密码`}],children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{}),placeholder:`确认密码`})}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,block:!0,children:`注册`})]})}),(0,Y.jsx)(`div`,{style:{minHeight:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #667eea 0%, #764ba2 100%)`,padding:16},children:(0,Y.jsxs)(lg,{style:{width:`100%`,maxWidth:420},title:`中学生成绩档案`,children:[(0,Y.jsx)(rE.Paragraph,{type:`secondary`,style:{textAlign:`center`},children:`成绩录入 · 趋势分析 · 错题管理`}),(0,Y.jsxs)(TS,{spinning:l,children:[!l&&!s&&(0,Y.jsx)(rE.Paragraph,{type:`secondary`,style:{textAlign:`center`,marginBottom:16},children:`注册已关闭,请联系管理员获取账号`}),(0,Y.jsx)(sg,{items:p})]}),(0,Y.jsx)(rE.Paragraph,{type:`secondary`,style:{textAlign:`center`,fontSize:12,marginTop:16,marginBottom:0},children:`© 马建军 · 微信 dekun03 · 18364911125`})]})})}function jxe(){let{user:e}=_k(),[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)([]),[a,o]=(0,h.useState)(!0),[s]=ky.useForm(),[c]=ky.useForm(),[l,u]=(0,h.useState)(!1),[d,f]=(0,h.useState)(null),[p]=ky.useForm(),[m]=ky.useForm(),g=ky.useWatch(`ai_provider`,m);if(!e?.is_superuser)return(0,Y.jsx)(wD,{to:`/`,replace:!0});let _=async()=>{o(!0);try{let[t,r]=await Promise.all([fk.getSettings(),fk.listUsers()]);n(t.data),i(r.data),s.setFieldsValue({username:e.username}),m.setFieldsValue({ai_provider:t.data.ai_provider,ollama_base_url:t.data.ollama_base_url||``,ollama_model:t.data.ollama_model||``,openai_base_url:t.data.openai_base_url||``,openai_model:t.data.openai_model||``,openai_api_key:``,ocr_service_url:t.data.ocr_service_url||``})}finally{o(!1)}};(0,h.useEffect)(()=>{_()},[]);let v=async e=>{let{data:t}=await fk.updateSettings({registration_enabled:e});n(t),rx.success(e?`已开放注册`:`已关闭注册`)},y=async t=>{if(t.password&&t.password!==t.confirm){rx.error(`两次密码不一致`);return}await fk.updateProfile({username:t.username===e?.username?void 0:t.username,current_password:t.password?t.current_password:void 0,password:t.password||void 0}),rx.success(`账号信息已更新,若修改了用户名或密码请重新登录`)},b=async e=>{await fk.createUser(e),rx.success(`用户已创建`),u(!1),c.resetFields(),_()},x=async e=>{d&&(await fk.resetUserPassword(d.id,e.password),rx.success(`密码已重置`),f(null),p.resetFields())},S=async e=>{await fk.deleteUser(e),rx.success(`用户已删除`),_()};return(0,Y.jsxs)(`div`,{className:`page-container`,children:[(0,Y.jsxs)(Py,{direction:`vertical`,size:`large`,style:{width:`100%`},children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(rE.Title,{level:3,style:{margin:0},children:`系统设置`}),(0,Y.jsxs)(rE.Text,{type:`secondary`,children:[`超级管理员 · `,(0,Y.jsx)(RD,{to:`/`,children:`返回首页`})]})]}),(0,Y.jsx)(sg,{items:[{key:`general`,label:`基本设置`,children:(0,Y.jsxs)(Py,{direction:`vertical`,size:`large`,style:{width:`100%`},children:[(0,Y.jsx)(lg,{title:`注册开关`,loading:a,children:(0,Y.jsxs)(Py,{children:[(0,Y.jsx)(Nde,{checked:t?.registration_enabled??!0,onChange:v}),(0,Y.jsx)(rE.Text,{children:t?.registration_enabled?`开放注册:用户可在登录页自行注册`:`关闭注册:仅超级管理员可添加用户`})]})}),(0,Y.jsx)(lg,{title:`管理员账号`,children:(0,Y.jsxs)(ky,{form:s,layout:`vertical`,onFinish:y,children:[(0,Y.jsx)(ky.Item,{name:`username`,label:`用户名`,rules:[{required:!0,min:3}],children:(0,Y.jsx)(ib,{prefix:(0,Y.jsx)(Ok,{})})}),(0,Y.jsx)(ky.Item,{name:`current_password`,label:`当前密码(修改密码时必填)`,children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{})})}),(0,Y.jsx)(ky.Item,{name:`password`,label:`新密码(留空则不修改)`,children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{})})}),(0,Y.jsx)(ky.Item,{name:`confirm`,label:`确认新密码`,children:(0,Y.jsx)(ib.Password,{prefix:(0,Y.jsx)(xk,{})})}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,icon:(0,Y.jsx)(Tk,{}),children:`保存`})]})})]})},{key:`ai`,label:`AI 模型`,children:(0,Y.jsx)(lg,{title:`解题 AI 配置`,loading:a,children:(0,Y.jsxs)(ky,{form:m,layout:`vertical`,onFinish:async e=>{let t={ai_provider:e.ai_provider,ollama_base_url:e.ollama_base_url||null,ollama_model:e.ollama_model||null,openai_base_url:e.openai_base_url||null,openai_model:e.openai_model||null,ocr_service_url:e.ocr_service_url?.trim()||null};e.openai_api_key?.trim()&&(t.openai_api_key=e.openai_api_key.trim());let{data:r}=await fk.updateSettings(t);n(r),m.setFieldValue(`openai_api_key`,``),rx.success(`AI 模型配置已保存`)},children:[(0,Y.jsx)(ky.Item,{name:`ai_provider`,label:`AI 提供商`,rules:[{required:!0}],children:(0,Y.jsxs)(Tx.Group,{children:[(0,Y.jsx)(Tx.Button,{value:`ollama`,children:`本地 Ollama`}),(0,Y.jsx)(Tx.Button,{value:`openai`,children:`OpenAI 兼容 API`})]})}),(g||t?.ai_provider)===`ollama`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ky.Item,{name:`ollama_base_url`,label:`Ollama 地址`,children:(0,Y.jsx)(ib,{placeholder:`http://127.0.0.1:11434`})}),(0,Y.jsx)(ky.Item,{name:`ollama_model`,label:`Ollama 模型`,children:(0,Y.jsx)(ib,{placeholder:`qwen2.5:7b`})})]}),(g||t?.ai_provider)===`openai`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ky.Item,{name:`openai_base_url`,label:`API Base URL`,children:(0,Y.jsx)(ib,{placeholder:`https://api.openai.com/v1`})}),(0,Y.jsx)(ky.Item,{name:`openai_model`,label:`模型名称`,children:(0,Y.jsx)(ib,{placeholder:`gpt-4o-mini`})}),(0,Y.jsx)(ky.Item,{name:`openai_api_key`,label:`API Key`,extra:t?.openai_api_key_set?`已配置 Key,留空则不修改`:`请输入 API Key`,children:(0,Y.jsx)(ib.Password,{placeholder:`sk-...`})})]}),(0,Y.jsx)(ky.Item,{name:`ocr_service_url`,label:`OCR 服务地址(局域网 GPU 机器)`,extra:`留空则在应用服务器本机 CPU 识别。填写后类似 Ollama,例如 http://192.168.8.100:23567`,children:(0,Y.jsx)(ib,{placeholder:`http://192.168.8.100:23567`})}),(0,Y.jsx)(rE.Paragraph,{type:`secondary`,children:`错题/奥数解法将按学生学段(初中/高中)生成,并严格禁止超纲解题。`}),(0,Y.jsx)(_p,{type:`primary`,htmlType:`submit`,children:`保存 AI 配置`})]})})},{key:`users`,label:`用户管理`,children:(0,Y.jsx)(lg,{title:`用户列表`,extra:(0,Y.jsx)(_p,{type:`primary`,onClick:()=>u(!0),children:`添加用户`}),children:(0,Y.jsx)(OT,{rowKey:`id`,loading:a,dataSource:r,pagination:!1,columns:[{title:`用户名`,dataIndex:`username`},{title:`角色`,dataIndex:`is_superuser`,render:e=>e?`超级管理员`:`普通用户`},{title:`创建时间`,dataIndex:`created_at`,render:e=>new Date(e).toLocaleString()},{title:`操作`,render:(e,t)=>t.is_superuser?(0,Y.jsx)(rE.Text,{type:`secondary`,children:`—`}):(0,Y.jsxs)(Py,{children:[(0,Y.jsx)(_p,{size:`small`,onClick:()=>f(t),children:`重置密码`}),(0,Y.jsx)(xx,{title:`确定删除该用户?`,onConfirm:()=>S(t.id),children:(0,Y.jsx)(_p,{size:`small`,danger:!0,children:`删除`})})]})}]})})}]})]}),(0,Y.jsx)(yx,{title:`添加用户`,open:l,onCancel:()=>u(!1),onOk:()=>c.submit(),destroyOnHidden:!0,children:(0,Y.jsxs)(ky,{form:c,layout:`vertical`,onFinish:b,children:[(0,Y.jsx)(ky.Item,{name:`username`,label:`用户名`,rules:[{required:!0,min:3}],children:(0,Y.jsx)(ib,{})}),(0,Y.jsx)(ky.Item,{name:`password`,label:`密码`,rules:[{required:!0,min:6}],children:(0,Y.jsx)(ib.Password,{})})]})}),(0,Y.jsx)(yx,{title:`重置密码 — ${d?.username}`,open:!!d,onCancel:()=>f(null),onOk:()=>p.submit(),destroyOnHidden:!0,children:(0,Y.jsx)(ky,{form:p,layout:`vertical`,onFinish:x,children:(0,Y.jsx)(ky.Item,{name:`password`,label:`新密码`,rules:[{required:!0,min:6}],children:(0,Y.jsx)(ib.Password,{})})})})]})}var Ak={weekly:`周考`,monthly:`月考`,final:`期末`},jk={pending:`处理中`,ocr_done:`已识别`,solved:`已生成解法`,failed:`失败`};function Mxe({studentId:e,subjects:t,exams:n,onRefresh:r}){let[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(null),[c]=ky.useForm(),[l,u]=(0,h.useState)(!1);(0,h.useEffect)(()=>{i&&o?c.setFieldsValue({exam_type:o.exam_type,exam_date:(0,xg.default)(o.exam_date),title:o.title,scores:t.map(e=>{let t=o.scores.find(t=>t.subject_id===e.id);return t?{subject_id:e.id,total_score:t.total_score,obtained_score:t.obtained_score}:{subject_id:e.id,total_score:void 0,obtained_score:void 0}})}):i&&c.setFieldsValue({exam_type:`weekly`,exam_date:(0,xg.default)(),scores:t.map(e=>({subject_id:e.id}))})},[i,o,t,c]);let d=()=>{s(null),a(!0)},f=e=>{s(e),a(!0)},p=async()=>{try{let n=await c.validateFields(),i=(n.scores||[]).map((e,n)=>({subject_id:t[n]?.id??e.subject_id,total_score:e.total_score,obtained_score:e.obtained_score})).filter(e=>e.subject_id!=null&&e.total_score!=null&&e.obtained_score!=null&&e.total_score>0).map(e=>({subject_id:e.subject_id,total_score:Number(e.total_score),obtained_score:Number(e.obtained_score)}));if(i.length===0){rx.warning(`请至少录入一科成绩`);return}u(!0);let s={exam_type:n.exam_type,exam_date:n.exam_date.format(`YYYY-MM-DD`),title:n.title||void 0,scores:i};o?(await mk.update(o.id,s),rx.success(`已更新`)):(await mk.create(e,s),rx.success(`已添加`)),a(!1),r()}catch{}finally{u(!1)}},m=async e=>{yx.confirm({title:`确认删除该考试记录?`,onOk:async()=>{await mk.remove(e.id),rx.success(`已删除`),r()}})};return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(_p,{type:`primary`,onClick:d,style:{marginBottom:16},children:`录入成绩`}),(0,Y.jsx)(OT,{rowKey:`id`,columns:[{title:`日期`,dataIndex:`exam_date`,key:`exam_date`,width:110},{title:`类型`,dataIndex:`exam_type`,key:`exam_type`,width:80,render:e=>Ak[e]},{title:`标题`,dataIndex:`title`,key:`title`,ellipsis:!0},{title:`科目数`,key:`count`,width:80,render:(e,t)=>t.scores.length},{title:`平均占比`,key:`avg`,width:100,render:(e,t)=>t.scores.length?`${(t.scores.reduce((e,t)=>e+t.ratio,0)/t.scores.length*100).toFixed(1)}%`:`-`},{title:`操作`,key:`action`,width:120,render:(e,t)=>(0,Y.jsxs)(Py,{children:[(0,Y.jsx)(_p,{type:`link`,icon:(0,Y.jsx)(IT,{}),onClick:()=>f(t)}),(0,Y.jsx)(_p,{type:`link`,danger:!0,icon:(0,Y.jsx)(bE,{}),onClick:()=>m(t)})]})}],dataSource:n,pagination:{pageSize:10},scroll:{x:600}}),(0,Y.jsx)(yx,{title:o?`编辑考试`:`录入成绩`,open:i,onCancel:()=>a(!1),onOk:p,confirmLoading:l,width:720,destroyOnHidden:!0,children:(0,Y.jsxs)(ky,{form:c,layout:`vertical`,children:[(0,Y.jsxs)(Py,{style:{width:`100%`},size:`large`,children:[(0,Y.jsx)(ky.Item,{name:`exam_type`,label:`考试类型`,rules:[{required:!0}],children:(0,Y.jsx)(gS,{style:{width:120},options:Object.entries(Ak).map(([e,t])=>({value:e,label:t}))})}),(0,Y.jsx)(ky.Item,{name:`exam_date`,label:`考试日期`,rules:[{required:!0}],children:(0,Y.jsx)(Hv,{})}),(0,Y.jsx)(ky.Item,{name:`title`,label:`备注标题`,children:(0,Y.jsx)(ib,{placeholder:`可选`,style:{width:200}})})]}),(0,Y.jsx)(ky.List,{name:`scores`,children:e=>(0,Y.jsx)(OT,{size:`small`,pagination:!1,dataSource:e.map((e,n)=>({...e,subject:t[n]})),rowKey:`key`,columns:[{title:`科目`,render:(e,t)=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ky.Item,{name:[t.name,`subject_id`],hidden:!0,initialValue:t.subject?.id,children:(0,Y.jsx)(Tb,{})}),t.subject?.name]})},{title:`总分`,render:(e,t)=>(0,Y.jsx)(ky.Item,{name:[t.name,`total_score`],noStyle:!0,children:(0,Y.jsx)(Tb,{min:0,placeholder:`总分`,style:{width:100}})})},{title:`得分`,render:(e,t)=>(0,Y.jsx)(ky.Item,{name:[t.name,`obtained_score`],noStyle:!0,children:(0,Y.jsx)(Tb,{min:0,placeholder:`得分`,style:{width:100}})})},{title:`占比`,render:(e,t)=>{let n=c.getFieldValue([`scores`,t.name,`total_score`]),r=c.getFieldValue([`scores`,t.name,`obtained_score`]);return n>0&&r!=null?`${(r/n*100).toFixed(1)}%`:`-`}}]})})]})})]})}function Nxe({exams:e,subjectNames:t}){let n=new Set;e.forEach(e=>e.scores.forEach(e=>n.add(e.subject_id)));let r=[{title:`日期`,dataIndex:`exam_date`,key:`date`,width:110,fixed:`left`},{title:`类型`,dataIndex:`exam_type`,key:`type`,width:80,render:e=>(0,Y.jsx)(PT,{children:Ak[e]})},...[...n].sort((e,t)=>e-t).map(e=>({title:t[e]||`科目${e}`,key:`s${e}`,width:100,render:(t,n)=>{let r=n.scores.find(t=>t.subject_id===e);return r?`${r.obtained_score}/${r.total_score} (${(r.ratio*100).toFixed(1)}%)`:`-`}}))],i=e.filter(t=>t.scores.some(n=>{let r=e.filter(e=>e.exam_date<=t.exam_date).flatMap(e=>e.scores.filter(e=>e.subject_id===n.subject_id)).sort((t,n)=>{let r=e.find(e=>e.scores.includes(t)),i=e.find(e=>e.scores.includes(n));return(r?.exam_date||``).localeCompare(i?.exam_date||``)}),i=r.findIndex(e=>e.id===n.id);return i<=0?!1:Math.abs(r[i].ratio-r[i-1].ratio)>=.08}));return(0,Y.jsxs)(`div`,{children:[i.length>0&&(0,Y.jsxs)(`div`,{style:{marginBottom:16,padding:12,background:`#fff7e6`,borderRadius:8},children:[(0,Y.jsx)(`strong`,{children:`波动预警:`}),i.slice(0,5).map(e=>(0,Y.jsxs)(PT,{color:`orange`,style:{marginTop:4},children:[e.exam_date,` `,Ak[e.exam_type]]},e.id))]}),(0,Y.jsx)(OT,{rowKey:`id`,columns:r,dataSource:[...e].sort((e,t)=>t.exam_date.localeCompare(e.exam_date)),pagination:{pageSize:15},scroll:{x:`max-content`},size:`small`})]})}var Mk=function(e,t){return Mk=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Mk(e,t)};function Nk(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Mk(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Pk=function(){return Pk=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]`u`&&typeof self<`u`?Rk.worker=!0:!Rk.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Rk.node=!0,Rk.svgSupported=!0):Ixe(navigator.userAgent,Rk);function Ixe(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Lxe=`12px sans-serif`,Rxe=20,zxe=100,Bxe=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function Vxe(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;cQxe,HashMap:()=>RA,RADIAN_TO_DEGREE:()=>GA,assert:()=>MA,assignProps:()=>tA,bind:()=>fA,clone:()=>Qk,concatArray:()=>BA,createCanvas:()=>Jxe,createHashMap:()=>zA,createObject:()=>VA,curry:()=>pA,defaults:()=>nA,disableUserSelect:()=>HA,each:()=>Q,eqNaN:()=>EA,extend:()=>Z,filter:()=>lA,find:()=>uA,guid:()=>Xk,hasOwn:()=>UA,indexOf:()=>rA,inherits:()=>iA,isArray:()=>mA,isArrayLike:()=>oA,isBuiltInObject:()=>bA,isDom:()=>SA,isFunction:()=>hA,isGradientObject:()=>CA,isImagePatternObject:()=>wA,isNumber:()=>vA,isObject:()=>yA,isPrimitive:()=>IA,isRegExp:()=>TA,isString:()=>gA,isStringSafe:()=>_A,isTypedArray:()=>xA,keys:()=>dA,logError:()=>Zk,map:()=>sA,merge:()=>$k,mergeAll:()=>eA,mixin:()=>aA,noop:()=>WA,normalizeCssArray:()=>jA,reduce:()=>cA,retrieve:()=>DA,retrieve2:()=>OA,retrieve3:()=>kA,setAsPrimitive:()=>FA,slice:()=>AA,trim:()=>NA}),Vk=cA([`Function`,`RegExp`,`Date`,`Error`,`CanvasGradient`,`CanvasPattern`,`Image`,`Canvas`],function(e,t){return e[`[object `+t+`]`]=!0,e},{}),Hk=cA([`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`],function(e,t){return e[`[object `+t+`Array]`]=!0,e},{}),Uk=Object.prototype.toString,Wk=Array.prototype,Wxe=Wk.forEach,Gxe=Wk.filter,Gk=Wk.slice,Kxe=Wk.map,Kk=function(){}.constructor,qk=Kk?Kk.prototype:null,Jk=`__proto__`,Yk=2311,qxe=2**53-1;function Xk(){return Yk>=qxe&&(Yk=0),Yk++}function Zk(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function Qk(e){if(typeof e!=`object`||!e)return e;var t=e,n=Uk.call(e);if(n===`[object Array]`){if(!IA(e)){t=[];for(var r=0,i=e.length;rQA,applyTransform:()=>uj,clone:()=>XA,copy:()=>YA,create:()=>JA,dist:()=>oj,distSquare:()=>cj,distance:()=>aj,distanceSquare:()=>sj,div:()=>rSe,dot:()=>iSe,len:()=>tj,lenSquare:()=>nj,length:()=>eSe,lengthSquare:()=>tSe,lerp:()=>lj,max:()=>fj,min:()=>dj,mul:()=>nSe,negate:()=>aSe,normalize:()=>ij,scale:()=>rj,scaleAndAdd:()=>$A,set:()=>ZA,sub:()=>ej});function JA(e,t){return e??=0,t??=0,[e,t]}function YA(e,t){return e[0]=t[0],e[1]=t[1],e}function XA(e){return[e[0],e[1]]}function ZA(e,t,n){return e[0]=t,e[1]=n,e}function QA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function $A(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e}function ej(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function tj(e){return Math.sqrt(nj(e))}var eSe=tj;function nj(e){return e[0]*e[0]+e[1]*e[1]}var tSe=nj;function nSe(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}function rSe(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}function iSe(e,t){return e[0]*t[0]+e[1]*t[1]}function rj(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function ij(e,t){var n=tj(t);return n===0?(e[0]=0,e[1]=0):(e[0]=t[0]/n,e[1]=t[1]/n),e}function aj(e,t){return Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))}var oj=aj;function sj(e,t){return(e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])}var cj=sj;function aSe(e,t){return e[0]=-t[0],e[1]=-t[1],e}function lj(e,t,n,r){return e[0]=t[0]+r*(n[0]-t[0]),e[1]=t[1]+r*(n[1]-t[1]),e}function uj(e,t,n){var r=t[0],i=t[1];return e[0]=n[0]*r+n[2]*i+n[4],e[1]=n[1]*r+n[3]*i+n[5],e}function dj(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}function fj(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}var pj=function(){function e(e,t){this.target=e,this.topTarget=t&&t.topTarget}return e}(),oSe=function(){function e(e){this.handler=e,e.on(`mousedown`,this._dragStart,this),e.on(`mousemove`,this._drag,this),e.on(`mouseup`,this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new pj(t,e),`dragstart`,e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,r=e.offsetY,i=n-this._x,a=r-this._y;this._x=n,this._y=r,t.drift(i,a,e),this.handler.dispatchToElement(new pj(t,e),`drag`,e.event);var o=this.handler.findHover(n,r,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new pj(s,e),`dragleave`,e.event),o&&o!==s&&this.handler.dispatchToElement(new pj(o,e),`dragenter`,e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new pj(t,e),`dragend`,e.event),this._dropTarget&&this.handler.dispatchToElement(new pj(this._dropTarget,e),`drop`,e.event),this._draggingTarget=null,this._dropTarget=null},e}(),mj=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,r){this._$handlers||={};var i=this._$handlers;if(typeof t==`function`&&(r=n,n=t,t=null),!n||!e)return this;var a=this._$eventProcessor;t!=null&&a&&a.normalizeQuery&&(t=a.normalizeQuery(t)),i[e]||(i[e]=[]);for(var o=0;o>1)%2;s.cssText=[`position: absolute`,`visibility: hidden`,`padding: 0`,`margin: 0`,`border-width: 0`,`user-select: none`,`width:0`,`height:0`,r[c]+`:0`,i[l]+`:0`,r[1-c]+`:auto`,i[1-l]+`:auto`,``].join(`!important;`),e.appendChild(o),n.push(o)}return t.clearMarkers=function(){Q(n,function(e){e.parentNode&&e.parentNode.removeChild(e)})},n}function dSe(e,t,n){for(var r=n?`invTrans`:`trans`,i=t[r],a=t.srcCoords,o=[],s=[],c=!0,l=0;l<4;l++){var u=e[l].getBoundingClientRect(),d=2*l,f=u.left,p=u.top;o.push(f,p),c=c&&a&&f===a[d]&&p===a[d+1],s.push(e[l].offsetLeft,e[l].offsetTop)}return c&&i?i:(t.srcCoords=o,t[r]=n?gj(s,o):gj(o,s))}function bj(e){return e.nodeName.toUpperCase()===`CANVAS`}var fSe=/([&<>"'])/g,pSe={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function xj(e){return e==null?``:(e+``).replace(fSe,function(e,t){return pSe[t]})}var mSe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Sj=[],hSe=Rk.browser.firefox&&+Rk.browser.version.split(`.`)[0]<39;function Cj(e,t,n,r){return n||={},r?wj(e,t,n):hSe&&t.layerX!=null&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):t.offsetX==null?wj(e,t,n):(n.zrX=t.offsetX,n.zrY=t.offsetY),n}function wj(e,t,n){if(Rk.domSupported&&e.getBoundingClientRect){var r=t.clientX,i=t.clientY;if(bj(e)){var a=e.getBoundingClientRect();n.zrX=r-a.left,n.zrY=i-a.top;return}else if(yj(Sj,e,r,i)){n.zrX=Sj[0],n.zrY=Sj[1];return}}n.zrX=n.zrY=0}function Tj(e){return e||window.event}function Ej(e,t,n){if(t=Tj(t),t.zrX!=null)return t;var r=t.type;if(r&&r.indexOf(`touch`)>=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&Cj(e,i,t,n)}else{Cj(e,t,t,n);var a=gSe(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&mSe.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function gSe(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function Dj(e,t,n,r){e.addEventListener(t,n,r)}function _Se(e,t,n,r){e.removeEventListener(t,n,r)}var Oj=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function kj(e){return e.which===2||e.which===3}var vSe=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=Aj(r)/Aj(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=ySe(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},bSe=s({clone:()=>Bj,copy:()=>Pj,create:()=>Mj,identity:()=>Nj,invert:()=>zj,mul:()=>Fj,rotate:()=>Lj,scale:()=>Rj,translate:()=>Ij});function Mj(){return[1,0,0,1,0,0]}function Nj(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function Pj(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Fj(e,t,n){var r=t[0]*n[0]+t[2]*n[1],i=t[1]*n[0]+t[3]*n[1],a=t[0]*n[2]+t[2]*n[3],o=t[1]*n[2]+t[3]*n[3],s=t[0]*n[4]+t[2]*n[5]+t[4],c=t[1]*n[4]+t[3]*n[5]+t[5];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e}function Ij(e,t,n){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+n[0],e[5]=t[5]+n[1],e}function Lj(e,t,n,r){r===void 0&&(r=[0,0]);var i=t[0],a=t[2],o=t[4],s=t[1],c=t[3],l=t[5],u=Math.sin(n),d=Math.cos(n);return e[0]=i*d+s*u,e[1]=-i*u+s*d,e[2]=a*d+c*u,e[3]=-a*u+d*c,e[4]=d*(o-r[0])+u*(l-r[1])+r[0],e[5]=d*(l-r[1])-u*(o-r[0])+r[1],e}function Rj(e,t,n){var r=n[0],i=n[1];return e[0]=t[0]*r,e[1]=t[1]*i,e[2]=t[2]*r,e[3]=t[3]*i,e[4]=t[4]*r,e[5]=t[5]*i,e}function zj(e,t){var n=t[0],r=t[2],i=t[4],a=t[1],o=t[3],s=t[5],c=n*o-a*r;return c?(c=1/c,e[0]=o*c,e[1]=-a*c,e[2]=-r*c,e[3]=n*c,e[4]=(r*s-o*i)*c,e[5]=(a*i-n*s)*c,e):null}function Bj(e){var t=Mj();return Pj(t,e),t}var Vj=function(){function e(e,t){this.x=e||0,this.y=t||0}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(e,t){return this.x=e,this.y=t,this},e.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.scale=function(e){this.x*=e,this.y*=e},e.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},e.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},e.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},e.prototype.distanceSquare=function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(e){if(e){var t=this.x,n=this.y;return this.x=e[0]*t+e[2]*n+e[4],this.y=e[1]*t+e[3]*n+e[5],this}},e.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},e.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},e.set=function(e,t,n){e.x=t,e.y=n},e.copy=function(e,t){e.x=t.x,e.y=t.y},e.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},e.lenSquare=function(e){return e.x*e.x+e.y*e.y},e.dot=function(e,t){return e.x*t.x+e.y*t.y},e.add=function(e,t,n){e.x=t.x+n.x,e.y=t.y+n.y},e.sub=function(e,t,n){e.x=t.x-n.x,e.y=t.y-n.y},e.scale=function(e,t,n){e.x=t.x*n,e.y=t.y*n},e.scaleAndAdd=function(e,t,n,r){e.x=t.x+n.x*r,e.y=t.y+n.y*r},e.lerp=function(e,t,n,r){var i=1-r;e.x=i*t.x+r*n.x,e.y=i*t.y+r*n.y},e}(),Hj=Math.min,Uj=Math.max,Wj=Math.abs,Gj=[`x`,`y`],xSe=[`width`,`height`],Kj=new Vj,qj=new Vj,Jj=new Vj,Yj=new Vj,Xj=cM(),Zj=Xj.minTv,Qj=Xj.maxTv,$j=[0,0],eM=function(){function e(e,t,n,r){nM(this,e,t,n,r)}return e.set=function(e,t,n,r,i){return r<0&&(t+=r,r=-r),i<0&&(n+=i,i=-i),e.x=t,e.y=n,e.width=r,e.height=i,e},e.prototype.union=function(e){var t=Hj(e.x,this.x),n=Hj(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Uj(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Uj(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=t,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(e){return iM(Mj(),this,e)},e.prototype.intersect=function(t,n,r){return e.intersect(this,t,n,r)},e.intersect=function(t,n,r,i){r&&Vj.set(r,0,0);var a=i&&i.outIntersectRect||null,o=i&&i.clamp;if(a&&(a.x=a.y=a.width=a.height=NaN),!t||!n)return!1;t instanceof e||(t=nM(CSe,t.x,t.y,t.width,t.height)),n instanceof e||(n=nM(wSe,n.x,n.y,n.width,n.height));var s=!!r;Xj.reset(i,s);var c=Xj.touchThreshold,l=t.x+c,u=t.x+t.width-c,d=t.y+c,f=t.y+t.height-c,p=n.x+c,m=n.x+n.width-c,h=n.y+c,g=n.y+n.height-c;if(l>u||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){rM(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&rM(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Kj.x=Jj.x=t.x,Kj.y=Yj.y=t.y,qj.x=Yj.x=t.x+t.width,qj.y=Jj.y=t.y+t.height,Kj.transform(n),Yj.transform(n),qj.transform(n),Jj.transform(n),e.x=Hj(Kj.x,qj.x,Jj.x,Yj.x),e.y=Hj(Kj.y,qj.y,Jj.y,Yj.y);var s=Uj(Kj.x,qj.x,Jj.x,Yj.x),c=Uj(Kj.y,qj.y,Jj.y,Yj.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=Nj(e||[]),Ij(e,e,ZA(oM,-t.x,-t.y)),Rj(e,e,ZA(oM,r,i)),Ij(e,e,ZA(oM,n.x,n.y)),e},e}(),tM=eM.create,nM=eM.set,rM=eM.copy,iM=eM.calculateTransform,aM=eM.applyTransform,SSe=eM.contain,CSe=new eM(0,0,0,0),wSe=new eM(0,0,0,0),oM=[];function sM(e,t,n,r,i,a,o,s){var c=Wj(t-n),l=Wj(r-e),u=Hj(c,l),d=Gj[i],f=Gj[1-i],p=xSe[i];t=l||!Xj.bidirectional)&&(Zj[d]=-l,Zj[f]=0,Xj.useDir&&Xj.calcDirMTV())))}function cM(){var e=0,t=new Vj,n=new Vj,r={minTv:new Vj,maxTv:new Vj,useDir:!1,dirMinTv:new Vj,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Uj(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=0;l--){var u=r[l];u!==n&&!u.ignore&&!u.ignoreCoarsePointer&&(!u.parent||!u.parent.ignoreCoarsePointer)&&(dM.copy(u.getBoundingRect()),u.transform&&dM.applyTransform(u.transform),dM.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function kSe(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return i?lM:!0}return!1}function pM(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=kSe(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==lM)){t.target=o;break}}}function mM(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var hM=32,gM=7;function ASe(e){for(var t=0;e>=hM;)t|=e&1,e>>=1;return e+t}function _M(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function jSe(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function yM(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function bM(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function MSe(e,t){var n=gM,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=gM||m>=gM);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u];return}for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-yM(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=gM||g>=gM);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),vM(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}var SM=!1;function CM(){SM||(SM=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function wM(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var NSe=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=wM}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),TM=Rk.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)},EM={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:1024**(e-1)},exponentialOut:function(e){return e===1?1:1-2**(-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),-(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)))},elasticOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),n*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/r)+1)},elasticInOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?-.5*(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)):n*2**(-10*--e)*Math.sin((e-t)*(2*Math.PI)/r)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=1.70158*1.525;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-EM.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?EM.bounceIn(e*2)*.5:EM.bounceOut(e*2-1)*.5+.5}},DM=Math.pow,OM=Math.sqrt,kM=1e-8,AM=1e-4,jM=OM(3),MM=1/3,NM=JA(),PM=JA(),FM=JA();function IM(e){return e>-kM&&ekM||e<-kM}function RM(e,t,n,r,i){var a=1-i;return a*a*(a*e+3*i*t)+i*i*(i*r+3*a*n)}function zM(e,t,n,r,i){var a=1-i;return 3*(((t-e)*a+2*(n-t)*i)*a+(r-n)*i*i)}function BM(e,t,n,r,i,a){var o=r+3*(t-n)-e,s=3*(n-t*2+e),c=3*(t-e),l=e-i,u=s*s-3*o*c,d=s*c-9*o*l,f=c*c-3*s*l,p=0;if(IM(u)&&IM(d))if(IM(s))a[0]=0;else{var m=-c/s;m>=0&&m<=1&&(a[p++]=m)}else{var h=d*d-4*u*f;if(IM(h)){var g=d/u,m=-s/o+g,_=-g/2;m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_)}else if(h>0){var v=OM(h),y=u*s+1.5*o*(-d+v),b=u*s+1.5*o*(-d-v);y=y<0?-DM(-y,MM):DM(y,MM),b=b<0?-DM(-b,MM):DM(b,MM);var m=(-s-(y+b))/(3*o);m>=0&&m<=1&&(a[p++]=m)}else{var x=(2*u*s-3*o*d)/(2*OM(u*u*u)),S=Math.acos(x)/3,C=OM(u),w=Math.cos(S),m=(-s-2*C*w)/(3*o),_=(-s+C*(w+jM*Math.sin(S)))/(3*o),T=(-s+C*(w-jM*Math.sin(S)))/(3*o);m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_),T>=0&&T<=1&&(a[p++]=T)}}return p}function VM(e,t,n,r,i){var a=6*n-12*t+6*e,o=9*t+3*r-3*e-9*n,s=3*t-3*e,c=0;if(IM(o)){if(LM(a)){var l=-s/a;l>=0&&l<=1&&(i[c++]=l)}}else{var u=a*a-4*o*s;if(IM(u))i[0]=-a/(2*o);else if(u>0){var d=OM(u),l=(-a+d)/(2*o),f=(-a-d)/(2*o);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function HM(e,t,n,r,i,a){var o=(t-e)*i+e,s=(n-t)*i+t,c=(r-n)*i+n,l=(s-o)*i+o,u=(c-s)*i+s,d=(u-l)*i+l;a[0]=e,a[1]=o,a[2]=l,a[3]=d,a[4]=d,a[5]=u,a[6]=c,a[7]=r}function UM(e,t,n,r,i,a,o,s,c,l,u){var d,f=.005,p=1/0,m,h,g,_;NM[0]=c,NM[1]=l;for(var v=0;v<1;v+=.05)PM[0]=RM(e,n,i,o,v),PM[1]=RM(t,r,a,s,v),g=cj(NM,PM),g=0&&g=0&&l<=1&&(i[c++]=l)}}else{var u=o*o-4*a*s;if(IM(u)){var l=-o/(2*a);l>=0&&l<=1&&(i[c++]=l)}else if(u>0){var d=OM(u),l=(-o+d)/(2*a),f=(-o-d)/(2*a);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function KM(e,t,n){var r=e+n-2*t;return r===0?.5:(e-t)/r}function qM(e,t,n,r,i){var a=(t-e)*r+e,o=(n-t)*r+t,s=(o-a)*r+a;i[0]=e,i[1]=a,i[2]=s,i[3]=s,i[4]=o,i[5]=n}function JM(e,t,n,r,i,a,o,s,c){var l,u=.005,d=1/0;NM[0]=o,NM[1]=s;for(var f=0;f<1;f+=.05){PM[0]=WM(e,n,i,f),PM[1]=WM(t,r,a,f);var p=cj(NM,PM);p=0&&p=1?1:BM(0,r,a,1,e,s)&&RM(0,i,o,1,s[0])}}}var RSe=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||WA,this.ondestroy=e.ondestroy||WA,this.onrestart=e.onrestart||WA,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||=(this._startTime=e+this._delay,!0),this._paused){this._pausedTime+=t;return}var n=this._life,r=e-this._startTime-this._pausedTime,i=r/n;i<0&&(i=0),i=Math.min(i,1);var a=this.easingFunc,o=a?a(i):i;if(this.onframe(o),i===1)if(this.loop){var s=r%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}else return!0;return!1},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=hA(e)?e:EM[e]||YM(e)},e}(),XM=function(){function e(e){this.value=e}return e}(),zSe=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new XM(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),ZM=function(){function e(e){this._list=new zSe,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new XM(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),BSe=s({fastLerp:()=>pN,fastMapToColor:()=>WSe,lerp:()=>mN,lift:()=>fN,liftColor:()=>bN,lum:()=>vN,mapToColor:()=>GSe,modifyAlpha:()=>gN,modifyHSL:()=>hN,parse:()=>uN,parseCssFloat:()=>nN,parseCssInt:()=>tN,random:()=>KSe,stringify:()=>_N,toHex:()=>USe}),QM={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function $M(e){return e=Math.round(e),e<0?0:e>255?255:e}function VSe(e){return e=Math.round(e),e<0?0:e>360?360:e}function eN(e){return e<0?0:e>1?1:e}function tN(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?$M(parseFloat(t)/100*255):$M(parseInt(t,10))}function nN(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?eN(parseFloat(t)/100):eN(parseFloat(t))}function rN(e,t,n){return n<0?n+=1:n>1&&--n,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function iN(e,t,n){return e+(t-e)*n}function aN(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function oN(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var sN=new ZM(20),cN=null;function lN(e,t){cN&&oN(cN,t),cN=sN.put(e,cN||t.slice())}function uN(e,t){if(e){t||=[];var n=sN.get(e);if(n)return oN(t,n);e+=``;var r=e.replace(/ /g,``).toLowerCase();if(r in QM)return oN(t,QM[r]),lN(e,t),t;var i=r.length;if(r.charAt(0)===`#`){if(i===4||i===5){var a=parseInt(r.slice(1,4),16);if(!(a>=0&&a<=4095)){aN(t,0,0,0,1);return}return aN(t,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),lN(e,t),t}else if(i===7||i===9){var a=parseInt(r.slice(1,7),16);if(!(a>=0&&a<=16777215)){aN(t,0,0,0,1);return}return aN(t,(a&16711680)>>16,(a&65280)>>8,a&255,i===9?parseInt(r.slice(7),16)/255:1),lN(e,t),t}return}var o=r.indexOf(`(`),s=r.indexOf(`)`);if(o!==-1&&s+1===i){var c=r.substr(0,o),l=r.substr(o+1,s-(o+1)).split(`,`),u=1;switch(c){case`rgba`:if(l.length!==4)return l.length===3?aN(t,+l[0],+l[1],+l[2],1):aN(t,0,0,0,1);u=nN(l.pop());case`rgb`:if(l.length>=3)return aN(t,tN(l[0]),tN(l[1]),tN(l[2]),l.length===3?u:nN(l[3])),lN(e,t),t;aN(t,0,0,0,1);return;case`hsla`:if(l.length!==4){aN(t,0,0,0,1);return}return l[3]=nN(l[3]),dN(l,t),lN(e,t),t;case`hsl`:if(l.length!==3){aN(t,0,0,0,1);return}return dN(l,t),lN(e,t),t;default:return}}aN(t,0,0,0,1)}}function dN(e,t){var n=(parseFloat(e[0])%360+360)%360/360,r=nN(e[1]),i=nN(e[2]),a=i<=.5?i*(r+1):i+r-i*r,o=i*2-a;return t||=[],aN(t,$M(rN(o,a,n+1/3)*255),$M(rN(o,a,n)*255),$M(rN(o,a,n-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function HSe(e){if(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=(a+i)/2,c,l;if(o===0)c=0,l=0;else{l=s<.5?o/(a+i):o/(2-a-i);var u=((a-t)/6+o/2)/o,d=((a-n)/6+o/2)/o,f=((a-r)/6+o/2)/o;t===a?c=f-d:n===a?c=1/3+u-f:r===a&&(c=2/3+d-u),c<0&&(c+=1),c>1&&--c}var p=[c*360,l,s];return e[3]!=null&&p.push(e[3]),p}}function fN(e,t){var n=uN(e);if(n){for(var r=0;r<3;r++)t<0?n[r]=n[r]*(1-t)|0:n[r]=(255-n[r])*t+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return _N(n,n.length===4?`rgba`:`rgb`)}}function USe(e){var t=uN(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function pN(e,t,n){if(!(!(t&&t.length)||!(e>=0&&e<=1))){n||=[];var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=t[i],s=t[a],c=r-i;return n[0]=$M(iN(o[0],s[0],c)),n[1]=$M(iN(o[1],s[1],c)),n[2]=$M(iN(o[2],s[2],c)),n[3]=eN(iN(o[3],s[3],c)),n}}var WSe=pN;function mN(e,t,n){if(!(!(t&&t.length)||!(e>=0&&e<=1))){var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=uN(t[i]),s=uN(t[a]),c=r-i,l=_N([$M(iN(o[0],s[0],c)),$M(iN(o[1],s[1],c)),$M(iN(o[2],s[2],c)),eN(iN(o[3],s[3],c))],`rgba`);return n?{color:l,leftIndex:i,rightIndex:a,value:r}:l}}var GSe=mN;function hN(e,t,n,r){var i=uN(e);if(e)return i=HSe(i),t!=null&&(i[0]=VSe(hA(t)?t(i[0]):t)),n!=null&&(i[1]=nN(hA(n)?n(i[1]):n)),r!=null&&(i[2]=nN(hA(r)?r(i[2]):r)),_N(dN(i),`rgba`)}function gN(e,t){var n=uN(e);if(n&&t!=null)return n[3]=eN(t),_N(n,`rgba`)}function _N(e,t){if(!(!e||!e.length)){var n=e[0]+`,`+e[1]+`,`+e[2];return(t===`rgba`||t===`hsva`||t===`hsla`)&&(n+=`,`+e[3]),t+`(`+n+`)`}}function vN(e,t){var n=uN(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}function KSe(){return _N([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],`rgb`)}var yN=new ZM(100);function bN(e){if(gA(e)){var t=yN.get(e);return t||(t=fN(e,-.1),yN.put(e,t)),t}else if(CA(e)){var n=Z({},e);return n.colorStops=sA(e.colorStops,function(e){return{offset:e.offset,color:fN(e.color,-.1)}}),n}return e}var xN=Math.round;function SN(e){var t;if(!e||e===`transparent`)e=`none`;else if(typeof e==`string`&&e.indexOf(`rgba`)>-1){var n=uN(e);n&&(e=`rgb(`+n[0]+`,`+n[1]+`,`+n[2]+`)`,t=n[3])}return{color:e,opacity:t??1}}var CN=1e-4;function wN(e){return e-CN}function TN(e){return xN(e*1e3)/1e3}function EN(e){return xN(e*1e4)/1e4}function qSe(e){return`matrix(`+TN(e[0])+`,`+TN(e[1])+`,`+TN(e[2])+`,`+TN(e[3])+`,`+EN(e[4])+`,`+EN(e[5])+`)`}var JSe={left:`start`,right:`end`,center:`middle`,middle:`middle`};function YSe(e,t,n){return n===`top`?e+=t/2:n===`bottom`&&(e-=t/2),e}function XSe(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function ZSe(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(`,`)}function DN(e){return e&&!!e.image}function QSe(e){return e&&!!e.svgElement}function ON(e){return DN(e)||QSe(e)}function kN(e){return e.type===`linear`}function AN(e){return e.type===`radial`}function jN(e){return e&&(e.type===`linear`||e.type===`radial`)}function MN(e){return`url(#`+e+`)`}function NN(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function PN(e){var t=e.x||0,n=e.y||0,r=(e.rotation||0)*GA,i=OA(e.scaleX,1),a=OA(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,c=[];return(t||n)&&c.push(`translate(`+t+`px,`+n+`px)`),r&&c.push(`rotate(`+r+`)`),(i!==1||a!==1)&&c.push(`scale(`+i+`,`+a+`)`),(o||s)&&c.push(`skew(`+xN(o*GA)+`deg, `+xN(s*GA)+`deg)`),c.join(` `)}var $Se=(function(){return typeof Buffer<`u`&&typeof Buffer.from==`function`?function(e){return Buffer.from(e).toString(`base64`)}:typeof btoa==`function`&&typeof unescape==`function`&&typeof encodeURIComponent==`function`?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}})(),FN=Array.prototype.slice;function IN(e,t,n){return(t-e)*n+e}function LN(e,t,n,r){for(var i=t.length,a=0;ar?t:e,a=Math.min(n,r),o=i[a-1]||{color:[0,0,0,0],offset:0},s=a;so)r.length=o;else for(var s=a;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var r=this.keyframes,i=r.length,a=!1,o=JN,s=t;if(oA(t)){var c=rCe(t);o=c,(c===1&&!vA(t[0])||c===2&&!vA(t[0][0]))&&(a=!0)}else if(vA(t)&&!EA(t))o=HN;else if(gA(t))if(!isNaN(+t))o=HN;else{var l=uN(t);l&&(s=l,o=GN)}else if(CA(t)){var u=Z({},s);u.colorStops=sA(t.colorStops,function(e){return{offset:e.offset,color:uN(e.color)}}),kN(t)?o=KN:AN(t)&&(o=qN),s=u}i===0?this.valType=o:(o!==this.valType||o===JN)&&(a=!0),this.discrete=this.discrete||a;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=hA(n)?n:EM[n]||YM(n)),r.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort(function(e,t){return e.time-t.time});for(var r=this.valType,i=n.length,a=n[i-1],o=this.discrete,s=XN(r),c=YN(r),l=0;l=0&&!(a[l].percent<=t);l--);l=d(l,o-2)}else{for(l=u;lt);l++);l=d(l-1,o-2)}p=a[l+1],f=a[l]}if(f&&p){this._lastFr=l,this._lastFrP=t;var m=p.percent-f.percent,h=m===0?1:d((t-f.percent)/m,1);p.easingFunc&&(h=p.easingFunc(h));var g=n?this._additiveValue:c?ZN:e[s];if((XN(i)||c)&&!g&&(g=this._additiveValue=[]),this.discrete)e[s]=h<1?f.rawValue:p.rawValue;else if(XN(i))i===UN?LN(g,f[r],p[r],h):eCe(g,f[r],p[r],h);else if(YN(i)){var _=f[r],v=p[r],y=i===KN;e[s]={type:y?`linear`:`radial`,x:IN(_.x,v.x,h),y:IN(_.y,v.y,h),colorStops:sA(_.colorStops,function(e,t){var n=v.colorStops[t];return{offset:IN(e.offset,n.offset,h),color:VN(LN([],e.color,n.color,h))}}),global:v.global},y?(e[s].x2=IN(_.x2,v.x2,h),e[s].y2=IN(_.y2,v.y2,h)):e[s].r=IN(_.r,v.r,h)}else if(c)LN(g,f[r],p[r],h),n||(e[s]=VN(g));else{var b=IN(f[r],p[r],h);n?this._additiveValue=b:e[s]=b}n&&this._addToTarget(e)}}},e.prototype._addToTarget=function(e){var t=this.valType,n=this.propName,r=this._additiveValue;t===HN?e[n]=e[n]+r:t===GN?(uN(e[n],ZN),RN(ZN,ZN,r,1),e[n]=VN(ZN)):t===UN?RN(e[n],e[n],r,1):t===WN&&zN(e[n],e[n],r,1)},e}(),QN=function(){function e(e,t,n,r){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r){Zk(`Can' use additive animation on looped animation.`);return}this._additiveAnimators=r,this._allowDiscrete=n}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(e){this._target=e},e.prototype.when=function(e,t,n){return this.whenWithKeys(e,t,dA(t),n)},e.prototype.whenWithKeys=function(e,t,n,r){for(var i=this._tracks,a=0;a0&&s.addKeyframe(0,BN(c),r),this._trackKeys.push(o)}s.addKeyframe(e,BN(t[o]),r)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],r=this._maxTime||0,i=0;i1){var o=a.pop();i.addKeyframe(o.time,e[r]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}();function $N(){return new Date().getTime()}var aCe=function(e){qA(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=$N()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)?(r.ondestroy(),this.removeClip(r),r=i):r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(TM(t),!e._paused&&e.update())}TM(t)},t.prototype.start=function(){this._running||(this._time=$N(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=$N(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=$N()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new QN(e,t.loop);return this.addAnimator(n),n},t}(mj),oCe=300,eP=Rk.domSupported,tP=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:sA(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),nP={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},rP=!1;function iP(e){var t=e.pointerType;return t===`pen`||t===`touch`}function sCe(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function aP(e){e&&(e.zrByTouch=!0)}function cCe(e,t){return Ej(e.dom,new lCe(e,t),!0)}function oP(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var lCe=function(){function e(e,t){this.stopPropagation=WA,this.stopImmediatePropagation=WA,this.preventDefault=WA,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),sP={mousedown:function(e){e=Ej(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=Ej(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=Ej(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=Ej(this.dom,e);var t=e.toElement||e.relatedTarget;oP(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){rP=!0,e=Ej(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){rP||(e=Ej(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=Ej(this.dom,e),aP(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),sP.mousemove.call(this,e),sP.mousedown.call(this,e)},touchmove:function(e){e=Ej(this.dom,e),aP(e),this.handler.processGesture(e,`change`),sP.mousemove.call(this,e)},touchend:function(e){e=Ej(this.dom,e),aP(e),this.handler.processGesture(e,`end`),sP.mouseup.call(this,e),new Date-+this.__lastTouchMomentvP||e<-vP}var bP=[],xP=[],SP=Mj(),CP=Math.abs,wP=function(){function e(){}return e.prototype.getLocalTransform=function(e){return TP(this,e)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return yP(this.rotation)||yP(this.x)||yP(this.y)||yP(this.scaleX-1)||yP(this.scaleY-1)||yP(this.skewX)||yP(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;if(!(t||e)){n&&(_P(n),this.invTransform=null);return}n||=Mj(),t?this.getLocalTransform(n):_P(n),e&&(t?Fj(n,e,n):Pj(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||Mj(),zj(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(bP);var n=bP[0]<0?-1:1,r=bP[1]<0?-1:1,i=((bP[0]-n)*t+n)/bP[0]||0,a=((bP[1]-r)*t+r)/bP[1]||0;e[0]*=i,e[1]*=i,e[2]*=a,e[3]*=a}},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],r=Math.atan2(e[1],e[0]),i=Math.PI/2+r-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),t=Math.sqrt(t),this.skewX=i,this.skewY=0,this.rotation=-r,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||Mj(),Fj(xP,e.invTransform,t),t=xP);var n=this.originX,r=this.originY;(n||r)&&(SP[4]=n,SP[5]=r,Fj(xP,t,SP),xP[4]-=n,xP[5]-=r,t=xP),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e||=[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],r=this.invTransform;return r&&uj(n,n,r),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],r=this.transform;return r&&uj(n,n,r),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&CP(e[0]-1)>1e-10&&CP(e[3]-1)>1e-10?Math.sqrt(CP(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){OP(this,e)},e.getLocalTransform=function(e,t){t||=[];var n=e.originX||0,r=e.originY||0,i=e.scaleX,a=e.scaleY,o=e.anchorX,s=e.anchorY,c=e.rotation||0,l=e.x,u=e.y,d=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(n||r||o||s){var p=n+o,m=r+s;t[4]=-p*i-d*m*a,t[5]=-m*a-f*p*i}else t[4]=t[5]=0;return t[0]=i,t[3]=a,t[1]=f*i,t[2]=d*a,c&&Lj(t,t,c),t[4]+=n+l,t[5]+=r+u,t},e.initDefaultProps=(function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0})(),e}(),TP=wP.getLocalTransform;function EP(){return new wP}var DP=[`x`,`y`,`originX`,`originY`,`anchorX`,`anchorY`,`rotation`,`scaleX`,`scaleY`,`skewX`,`skewY`];function OP(e,t){return tA(e,t,DP)}function kP(e){AP||=new ZM(100),e||=`12px sans-serif`;var t=AP.get(e);return t||(t={font:e,strWidthCache:new ZM(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:zk.measureText(`国`,e).width,asciiCharWidth:zk.measureText(`a`,e).width},AP.put(e,t)),t}var AP;function mCe(e){if(!(jP>=MP)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=zk.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?jP=MP:i>2&&jP++,t}}var jP=0,MP=5;function NP(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=mCe(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function PP(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=zk.measureText(t,e.font).width,n.put(t,r)),r}function FP(e,t,n,r){var i=PP(kP(t),e),a=zP(t);return new eM(LP(0,i,n),RP(0,a,r),i,a)}function IP(e,t,n,r){var i=((e||``)+``).split(` `);if(i.length===1)return FP(i[0],t,n,r);for(var a=new eM(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function VP(e,t,n){var r=t.position||`inside`,i=t.distance==null?5:t.distance,a=n.height,o=n.width,s=a/2,c=n.x,l=n.y,u=`left`,d=`top`;if(r instanceof Array)c+=BP(r[0],n.width),l+=BP(r[1],n.height),u=null,d=null;else switch(r){case`left`:c-=i,l+=s,u=`right`,d=`middle`;break;case`right`:c+=i+o,l+=s,d=`middle`;break;case`top`:c+=o/2,l-=i,u=`center`,d=`bottom`;break;case`bottom`:c+=o/2,l+=a+i,u=`center`;break;case`inside`:c+=o/2,l+=s,u=`center`,d=`middle`;break;case`insideLeft`:c+=i,l+=s,d=`middle`;break;case`insideRight`:c+=o-i,l+=s,u=`right`,d=`middle`;break;case`insideTop`:c+=o/2,l+=i,u=`center`;break;case`insideBottom`:c+=o/2,l+=a-i,u=`center`,d=`bottom`;break;case`insideTopLeft`:c+=i,l+=i;break;case`insideTopRight`:c+=o-i,l+=i,u=`right`;break;case`insideBottomLeft`:c+=i,l+=a-i,d=`bottom`;break;case`insideBottomRight`:c+=o-i,l+=a-i,u=`right`,d=`bottom`;break}return e||={},e.x=c,e.y=l,e.align=u,e.verticalAlign=d,e}var hCe=`__zr_normal__`,HP=DP.concat([`ignore`]),gCe=cA(DP,function(e,t){return e[t]=!0,e},{ignore:!1}),UP={},_Ce=new eM(0,0,0,0),WP=[],GP=function(){function e(e){this.id=Xk(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return e.prototype._init=function(e){this.attr(e)},e.prototype.drift=function(e,t,n){switch(this.draggable){case`horizontal`:t=0;break;case`vertical`:e=0;break}var r=this.transform;r||=this.transform=[1,0,0,1,0,0],r[4]+=e,r[5]+=t,this.decomposeTransform(),this.markRedraw()},e.prototype.beforeUpdate=function(){},e.prototype.afterUpdate=function(){},e.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},e.prototype.updateInnerText=function(e){var t=this._textContent;if(t&&(!t.ignore||e)){this.textConfig||={};var n=this.textConfig,r=n.local,i=t.innerTransformable,a=void 0,o=void 0,s=!1;i.parent=r?this:null;var c=!1;i.copyTransform(t);var l=n.position!=null,u=n.autoOverflowArea,d=void 0;if((u||l)&&(d=_Ce,n.layoutRect?d.copy(n.layoutRect):d.copy(this.getBoundingRect()),r||d.applyTransform(this.transform)),l){this.calculateTextPosition?this.calculateTextPosition(UP,n,d):VP(UP,n,d),i.x=UP.x,i.y=UP.y,a=UP.align,o=UP.verticalAlign;var f=n.origin;if(f&&n.rotation!=null){var p=void 0,m=void 0;f===`center`?(p=d.width*.5,m=d.height*.5):(p=BP(f[0],d.width),m=BP(f[1],d.height)),c=!0,i.originX=-i.x+p+(r?0:d.x),i.originY=-i.y+m+(r?0:d.y)}}n.rotation!=null&&(i.rotation=n.rotation);var h=n.offset;h&&(i.x+=h[0],i.y+=h[1],c||(i.originX=-h[0],i.originY=-h[1]));var g=this._innerTextDefaultStyle||={};if(u){var _=g.overflowRect=g.overflowRect||new eM(0,0,0,0);i.getLocalTransform(WP),zj(WP,WP),eM.copy(_,d),_.applyTransform(WP)}else g.overflowRect=null;var v=n.inside==null?typeof n.position==`string`&&n.position.indexOf(`inside`)>=0:n.inside,y=void 0,b=void 0,x=void 0;v&&this.canBeInsideText()?(y=n.insideFill,b=n.insideStroke,(y==null||y===`auto`)&&(y=this.getInsideTextFill()),(b==null||b===`auto`)&&(b=this.getInsideTextStroke(y),x=!0)):(y=n.outsideFill,b=n.outsideStroke,(y==null||y===`auto`)&&(y=this.getOutsideFill()),(b==null||b===`auto`)&&(b=this.getOutsideStroke(y),x=!0)),y||=`#000`,(y!==g.fill||b!==g.stroke||x!==g.autoStroke||a!==g.align||o!==g.verticalAlign)&&(s=!0,g.fill=y,g.stroke=b,g.autoStroke=x,g.align=a,g.verticalAlign=o,t.setDefaultTextStyle(g)),t.__dirty|=1,s&&t.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return`#fff`},e.prototype.getInsideTextStroke=function(e){return`#000`},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?gP:hP},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n=typeof t==`string`&&uN(t);n||=[255,255,255,1];for(var r=n[3],i=this.__zr.isDarkMode(),a=0;a<3;a++)n[a]=n[a]*r+(i?0:255)*(1-r);return n[3]=1,_N(n,`rgba`)},e.prototype.traverse=function(e,t){},e.prototype.attrKV=function(e,t){e===`textConfig`?this.setTextConfig(t):e===`textContent`?this.setTextContent(t):e===`clipPath`?this.setClipPath(t):e===`extra`?(this.extra=this.extra||{},Z(this.extra,t)):this[e]=t},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(e,t){if(typeof e==`string`)this.attrKV(e,t);else if(yA(e))for(var n=dA(e),r=0;r0},e.prototype.getState=function(e){return this.states[e]},e.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},e.prototype.clearStates=function(e){this.useState(hCe,!1,e)},e.prototype.useState=function(e,t,n,r){var i=e===hCe;if(!(!this.hasState()&&i)){var a=this.currentStates,o=this.stateTransition;if(!(rA(a,e)>=0&&(t||a.length===1))){var s;if(this.stateProxy&&!i&&(s=this.stateProxy(e)),s||=this.states&&this.states[e],!s&&!i){Zk(`State `+e+` not exists.`);return}i||this.saveCurrentToNormalState(s);var c=this._textContent,l=YP(this,c,s,r);l&&!this.__inHover&&(this.__inHover=l),this._applyStateObj(e,s,this._normalState,t,ZP(this,n,o),o);var u=this._textGuide;return c&&c.useState(e,t,n,!!l),u&&u.useState(e,t,n,!!l),i?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this.__inHover=0,this.__dirty&=-2),s}}},e.prototype.useStates=function(e,t,n){if(!e.length)this.clearStates();else{var r=[],i=this.currentStates,a=e.length,o=a===i.length;if(o){for(var s=0;s=0){var n=this.currentStates.slice();n.splice(t,1),this.useStates(n)}},e.prototype.replaceState=function(e,t,n){var r=this.currentStates.slice(),i=rA(r,e),a=rA(r,t)>=0;i>=0?a?r.splice(i,1):r[i]=t:n&&!a&&r.push(t),this.useStates(r)},e.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},e.prototype._mergeStates=function(e){for(var t={},n,r=0;r=0&&t.splice(n,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(e){this.markRedraw()},e.prototype.stopAnimation=function(e,t){for(var n=this.animators,r=n.length,i=[],a=0;a0&&n.during&&a[0].during(function(e,t){n.during(t)});for(var f=0;f0||i.force&&!o.length){var C=void 0,w=void 0,T=void 0;if(s){w={},f&&(C={});for(var b=0;b0}var QP=function(e){qA(t,e);function t(t){var n=e.call(this)||this;return n.isGroup=!0,n._children=[],n.attr(t),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.children=function(){return this._children.slice()},t.prototype.childAt=function(e){return this._children[e]},t.prototype.childOfName=function(e){for(var t=this._children,n=0;n=0&&(n.splice(r,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=rA(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,r=n[t];if(e&&e!==this&&e.parent!==this&&e!==r){n[t]=e,r.parent=null;var i=this.__zr;i&&r.removeSelfFromZr(i),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,r=rA(n,e);return r<0?this:(n.splice(r,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh(),this)},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;nECe,disposeAll:()=>DCe,getElementSSRData:()=>iF,getInstance:()=>OCe,init:()=>tF,registerPainter:()=>nF,registerSSRDataGetter:()=>aF,version:()=>kCe}),$P={},eF={};function CCe(e){delete eF[e]}function wCe(e){if(!e)return!1;if(typeof e==`string`)return vN(e,1)0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var yF=MCe;function MCe(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`;break}return bF(e,t,n)}function bF(e,t,n){return gA(e)?xF(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function NCe(e){return gA(e)&&xF(e)}function xF(e){return!!ACe(e).match(/%$/)}function SF(e,t,n){return isNaN(t)?n?``+e:+e:(t=cF(lF(0,t),sF),e=(+e).toFixed(t),n?e:+e)}function PCe(e,t,n){return t??=10,SF(e,t,n)}function CF(e){return e.sort(function(e,t){return e-t}),e}function wF(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(dF(e*t)/t===e)return n}return TF(e)}function TF(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return lF(0,(a<0?0:i-1-a)-r)}function FCe(e,t){var n=fF(hF(e[1]-e[0])/gF),r=dF(hF(uF(t[1]-t[0]))/gF),i=cF(lF(-n+r,0),sF);return isFinite(i)?i:sF}function EF(e,t,n){var r=uF(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=hF(2*uF(n||1)*uF(r))/gF,a=hF(uF(t))/gF,o=lF(0,pF(-i+a));return isFinite(o)||(o=NaN),o}function ICe(e,t,n){return e[t]&&DF(e,n)[t]||0}function DF(e,t){var n=cA(e,function(e,t){return e+(isNaN(t)?0:t)},0);if(n===0)return[];for(var r=mF(10,t),i=sA(e,function(e){return(isNaN(e)?0:e)/n*r*100}),a=r*100,o=sA(i,function(e){return fF(e)}),s=cA(o,function(e,t){return e+t},0),c=sA(i,function(e,t){return e-o[t]});sl&&(l=c[d],u=d);++o[u],c[u]=0,++s}return sA(o,function(e){return e/r})}function OF(e,t){var n=lF(wF(e),wF(t)),r=e+t;return n>sF?r:SF(r,n)}var kF=mF(2,53)-1;function AF(e){var t=_F*2;return(e%t+t)%t}function jF(e){return e>-oF&&e=10&&t++,t}function FF(e,t){var n=PF(e),r=mF(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,SF(e,-n)}function IF(e,t){var n=(e.length-1)*t+1,r=fF(n),i=+e[r-1],a=n-r;return a?i+a*(e[r]-i):i}function LF(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)?(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0):!1},e}();function cI(e){e.option=e.parentModel=e.ecModel=null}function lI(){return[1/0,-1/0]}function uI(e,t){dI(t)&&(te[1]&&(e[1]=t))}function dwe(e,t){dI(t)&&te[1]&&(e[1]=t)}function pwe(e,t){fI(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function dI(e){return e!=null&&isFinite(e)}function fI(e,t){return dI(e)&&dI(t)&&e<=t}function mwe(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function pI(e){fI(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function mI(){var e=`__ec_once_`+hwe++;return function(t,n){UA(t,e)||(t[e]=1,n())}}var hwe=BF();function hI(e,t,n){var r=zA(),i=0;Q(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function gwe(e){return e.value+``}function _we(e){return e+``}function gI(e,t){return OA(t,!0)?e.seriesIndex+2:0}function vwe(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function _I(e,t){return{seriesType:e,overallReset:t}}function vI(e){return{overallReset:e}}var ywe=`.`,yI=`___EC__COMPONENT__CONTAINER___`,bwe=`___EC__EXTENDED_CLASS___`;function bI(e){var t={main:``,sub:``};if(e){var n=e.split(ywe);t.main=n[0]||``,t.sub=n[1]||``}return t}function xwe(e){MA(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Swe(e){return!!(e&&e[bwe])}function xI(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Cwe(t)?n=function(e){X(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},iA(n,this)),Z(n.prototype,e),n[bwe]=!0,n.extend=this.extend,n.superCall=Dwe,n.superApply=Owe,n.superClass=t,n}}function Cwe(e){return hA(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function wwe(e,t){e.extend=t.extend}var Twe=Math.round(Math.random()*10);function Ewe(e){var t=[`__\0is_clz`,Twe++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Dwe(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function Owe(e,t,n){return this.superClass.prototype[t].apply(e,n)}function SI(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){xwe(r),e.prototype.type=r;var i=bI(r);if(!i.sub)t[i.main]=e;else if(i.sub!==yI){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[yI]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=bI(e),r=[],i=t[n.main];return i&&i[yI]?Q(i,function(e,t){t!==yI&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[bI(e).main]},e.getAllClassMainTypes=function(){var e=[];return Q(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[bI(e).main];return n&&n[yI]};function n(e){var n=t[e.main];return(!n||!n[yI])&&(n=t[e.main]={},n[yI]=!0),n}}function CI(e,t){for(var n=0;n=0||i&&rA(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var kwe=CI([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),Awe=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return kwe(this,e,t)},e}(),wI=new ZM(50);function jwe(e){if(typeof e==`string`){var t=wI.get(e);return t&&t.image}else return e}function TI(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=wI.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!EI(t)&&a.pending.push(o)):(t=zk.loadImage(e,Mwe,Mwe),t.__zrImageSrc=e,wI.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e}function Mwe(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=s;l++)c-=s;var u=PP(o,n);return u>c&&(n=``,u=0),c=e-u,i.ellipsis=n,i.ellipsisWidth=u,i.contentWidth=c,i.containerWidth=e,i}function Iwe(e,t,n){var r=n.containerWidth,i=n.contentWidth,a=n.fontMeasureInfo;if(!r){e.textLine=``,e.isTruncated=!1;return}var o=PP(a,t);if(o<=r){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=n.maxIterations){t+=n.ellipsis;break}var c=s===0?Lwe(t,i,a):o>0?Math.floor(t.length*i/o):0;t=t.substr(0,c),o=PP(a,t)}t===``&&(t=n.placeholder),e.textLine=t,e.isTruncated=!0}function Lwe(e,t,n){for(var r=0,i=0,a=e.length;i 中学成绩档案 - + diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index 427128b..3e39958 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -78,6 +78,7 @@ export const adminApi = { openai_base_url?: string | null openai_model?: string | null openai_api_key?: string + ocr_service_url?: string | null }) => api.patch('/admin/settings', data), updateProfile: (data: { username?: string diff --git a/frontend/src/pages/SettingsPage.tsx b/frontend/src/pages/SettingsPage.tsx index 5ecb34b..88da62a 100644 --- a/frontend/src/pages/SettingsPage.tsx +++ b/frontend/src/pages/SettingsPage.tsx @@ -52,6 +52,7 @@ export default function SettingsPage() { openai_base_url: settingsRes.data.openai_base_url || '', openai_model: settingsRes.data.openai_model || '', openai_api_key: '', + ocr_service_url: settingsRes.data.ocr_service_url || '', }) } finally { setLoading(false) @@ -115,6 +116,7 @@ export default function SettingsPage() { openai_base_url?: string openai_model?: string openai_api_key?: string + ocr_service_url?: string }) => { const payload: Parameters[0] = { ai_provider: values.ai_provider, @@ -122,6 +124,7 @@ export default function SettingsPage() { ollama_model: values.ollama_model || null, openai_base_url: values.openai_base_url || null, openai_model: values.openai_model || null, + ocr_service_url: values.ocr_service_url?.trim() || null, } if (values.openai_api_key?.trim()) { payload.openai_api_key = values.openai_api_key.trim() @@ -234,6 +237,13 @@ export default function SettingsPage() { )} + + + 错题/奥数解法将按学生学段(初中/高中)生成,并严格禁止超纲解题。 diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index c047739..e9b71e5 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -23,6 +23,7 @@ export interface SystemSettings { openai_base_url: string | null openai_model: string | null openai_api_key_set: boolean + ocr_service_url: string | null updated_at: string }