agentroam-runtime-darwin-arm64 0.2.0-preview.37 → 0.2.0-preview.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/runtime/.next/BUILD_ID +1 -1
- package/runtime/.next/app-build-manifest.json +14 -14
- package/runtime/.next/app-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +6 -6
- package/runtime/.next/prerender-manifest.json +1 -1
- package/runtime/.next/react-loadable-manifest.json +12 -4
- package/runtime/.next/required-server-files.json +1 -1
- package/runtime/.next/routes-manifest.json +1 -1
- package/runtime/.next/server/app/_not-found/page.js +1 -1
- package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app/_not-found.html +1 -1
- package/runtime/.next/server/app/_not-found.rsc +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js +3 -3
- package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/client-logs/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
- package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
- package/runtime/.next/server/app/api/memory/route.js +1 -1
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/projects/check/route.js +1 -1
- package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
- package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
- package/runtime/.next/server/app/api/projects/route.js +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid.body +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -0
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/settings/route.js +1 -1
- package/runtime/.next/server/app/api/skills/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/update/check/route.js +1 -1
- package/runtime/.next/server/app/api/update/install/route.js +1 -1
- package/runtime/.next/server/app/api/update/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
- package/runtime/.next/server/app/web/page.js +2 -2
- package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app-paths-manifest.json +20 -19
- package/runtime/.next/server/chunks/1322.js +72 -69
- package/runtime/.next/server/chunks/1773.js +38 -38
- package/runtime/.next/server/chunks/2293.js +1 -1
- package/runtime/.next/server/chunks/366.js +1 -0
- package/runtime/.next/server/chunks/5303.js +1 -1
- package/runtime/.next/server/chunks/8532.js +1 -1
- package/runtime/.next/server/middleware-build-manifest.js +1 -1
- package/runtime/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/runtime/.next/server/pages/404.html +1 -1
- package/runtime/.next/server/pages/500.html +1 -1
- package/runtime/.next/server/server-reference-manifest.json +1 -1
- package/runtime/.next/static/chunks/326.567dcaf52a3fbf80.js +1 -0
- package/runtime/.next/static/chunks/693-41d7c8e27a8513d1.js +1 -0
- package/runtime/.next/static/chunks/784.1394d774230a5516.js +1 -0
- package/runtime/.next/static/chunks/834.801325c7f934eee6.js +1 -0
- package/runtime/.next/static/chunks/940.56137a61c838fa42.js +1 -0
- package/runtime/.next/static/chunks/95.ff2ef92ac2b1c909.js +1 -0
- package/runtime/.next/static/chunks/app/web/{error-7bdc841dab0f7345.js → error-f69dbd3718cb2107.js} +1 -1
- package/runtime/.next/static/chunks/app/web/layout-e0dd41d18df8ee9e.js +1 -0
- package/runtime/.next/static/chunks/app/web/page-f9926cbf4c1badd4.js +1 -0
- package/runtime/.next/static/chunks/{main-app-851d67ddcf02e2c2.js → main-app-d527fa0b25a0c755.js} +1 -1
- package/runtime/.next/static/chunks/webpack-d4e32619d2ce6d30.js +1 -0
- package/runtime/.next/static/css/e87416656ec8a57e.css +1 -0
- package/runtime/lib/remote-control/helper-manager.mjs +4 -1
- package/runtime/lib/remote-control/remote-authorization.mjs +21 -7
- package/runtime/native/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
- package/runtime/node_modules/.package-lock.json +11 -11
- package/runtime/node_modules/@agent/core/dist/index.js +123 -9
- package/runtime/node_modules/@agent/native-runtime/dist/index.js +141 -35
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +77 -76
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +48 -48
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2haqfy07.mjs +33 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-a92dt75k.mjs +40 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +17 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +19 -25
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +23 -29
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +12 -12
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +53 -53
- package/runtime/package-lock.json +35 -35
- package/runtime/server.js +1 -1
- package/runtime/webapp/dist/assets/App-COIcZZvf.js +487 -0
- package/runtime/webapp/dist/assets/{App-CMOzoP5A.css → App-iUeP1CBo.css} +1 -1
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-CEAlrV9-.js → abnfDiagram-VCTEODGH-d4urtMQU.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-CGetF_lO.js → arc-DiQEpEJQ.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BVksDtm9.js → architectureDiagram-5GKGNRK7-CWYKGqND.js} +1 -1
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-BvCo3epW.js → blockDiagram-I7D4REHJ-J2I0b5Zn.js} +1 -1
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DwUEj82r.js → c4Diagram-7LVT6UL2-C-0xWeN3.js} +1 -1
- package/runtime/webapp/dist/assets/channel-B6S3kcST.js +1 -0
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-BQmtZUl-.js → chunk-2Q5K7J3B-CqodmK6L.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-BXDY0cCC.js → chunk-5VM5RSS4-DClUnQcr.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-F27PBJKO-BPhfHsOp.js → chunk-F27PBJKO-CpaDg7Bg.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-Dw-LyvaC.js → chunk-IMKFNOWR-CTIf9EjK.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-Cdi61XTf.js → chunk-JWPE2WC7-DKalSWMm.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-eqgC5BfH.js → chunk-POPQ4Y6H-69MmeyRW.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-Dyzqf0xA.js → chunk-SVP7TREG-DCXWXzhU.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-DMy_FAyQ.js → chunk-TICWLB2K-B5nbTEng.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-Dc3ya8KM.js → chunk-XXDRQBXY-DsJvkUuN.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-CyUA2YaV.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-CyUA2YaV.js +1 -0
- package/runtime/webapp/dist/assets/codeSyntax-DJH88FPL.js +5 -0
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-8SpbJGQ_.js → cose-bilkent-JH36ORCC-BamzQ_e_.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-DZ8NcP4L.js → cynefin-OW5HDTMX-BI_j1tbW.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-C-g805uS.js → cynefinDiagram-5FMLGOSQ-DuxMrVM2.js} +1 -1
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-Cr8OiP_4.js → dagre-GXQ25YYZ-Y9_ne36w.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-Be71Foqh.js → diagram-S7CK7UJ4-DIIjO29m.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CeDsu1RS.js → diagram-UQ7AKVKN-C4m2VMIy.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-CObfkAwP.js → diagram-VSXAHHWV-Cw5aPZ0o.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-B6lAuke7.js → diagram-VX7I27RA-W8nmVcOl.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-8oGhKMeq.js → diagram-Z3DM3KII-TksnHlQo.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-DmiqrULj.js → ebnfDiagram-PWID7BFC-B3WM1b4a.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-BB_7Zdd4.js → erDiagram-RLTQ6QDP-BWctPuya.js} +1 -1
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-DbuKFxoO.js → flowDiagram-HODETNUW-BG5RMrLN.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-DAM3Gwd_.js → ganttDiagram-EL5Y4UJY-CPcR7Kn_.js} +1 -1
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-Ci91dL5m.js → gitGraphDiagram-WWUBYQGX-Sg6KChEd.js} +1 -1
- package/runtime/webapp/dist/assets/{index-NmsboYZi.css → index-CtJgsVah.css} +1 -1
- package/runtime/webapp/dist/assets/{index-ZpxfzUdy.js → index-tQnPGo1_.js} +4 -4
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-D717Ys7n.js → infoDiagram-27XIBGKW-BvrtvnrY.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-BF6gmyPX.js → ishikawaDiagram-5VMMS53U-Bz-dZQLJ.js} +1 -1
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-B6ZY-IXx.js → journeyDiagram-3NMN7TZE-Cb4s9jRE.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DH3FR2sI.js → kanban-definition-UXKFOSKX-IjMPUHg9.js} +1 -1
- package/runtime/webapp/dist/assets/{layout-BOnxGXiM.js → layout-DHjqr0PJ.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-M6pkDoQ3.js → linear-COctZkFy.js} +1 -1
- package/runtime/webapp/dist/assets/{mermaid.core-DxK9Epxh.js → mermaid.core-BnonXfHT.js} +5 -5
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-DpZ-X_Vf.js → mindmap-definition-YA3MSWOX-hxBlXJJE.js} +1 -1
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-ZxLpbtO1.js → pegDiagram-XKGWAZYB-D6KJ8Ftm.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-B26_pDmg.js → pieDiagram-E7YTZNPT-BzKWZmHN.js} +1 -1
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-C-qB9cbX.js → quadrantDiagram-AXDQQJYC-ZhiPKt96.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-C54V-8Ku.js → railroadDiagram-O6MQD6OU-BtKhiOPG.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-CaMYVKMk.js → requirementDiagram-BXWQKSXE-OFr_TA8V.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-DsrVKW_h.js → sankeyDiagram-P5KCCOFB-qNTDFxAX.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-C5ImABz1.js → sequenceDiagram-WJ2MYXX4-B7s5-R4s.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-wM9HJhkr.js → sizeCapture-INFHLROL-DdFabbN6.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-BY8hQ5ro.js → stateDiagram-D77RDMKH-CmAN4pX7.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DsxpCqde.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-OsTKRKJW.js → swimlanes-42K2YHIH-BQlIJAhf.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-tji3GZVz.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-DqyQVkVW.js → timeline-definition-24CTP7MA--Y1zJ9mc.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-Di3KXYdD.js → vennDiagram-4TSXK5OY-CUn6FScx.js} +1 -1
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-CnJpZdMd.js → wardleyDiagram-VM6X3IG4-Bbz-WBd5.js} +1 -1
- package/runtime/webapp/dist/assets/{web-BMb61xwV.js → web-DzBEnE5q.js} +1 -1
- package/runtime/webapp/dist/assets/{web-eq1eso0Y.js → web-harvpkJj.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-frC_Dy5B.js → xychartDiagram-S5SC5T6Z-RA9edGdQ.js} +1 -1
- package/runtime/webapp/dist/index.html +2 -2
- package/runtime/ws-server.mjs +5 -5
- package/runtime/.next/static/chunks/221.80fc551c3d6118e2.js +0 -1
- package/runtime/.next/static/chunks/326.c10c95f947d32ecb.js +0 -1
- package/runtime/.next/static/chunks/750-1766abd7e24fd1d6.js +0 -1
- package/runtime/.next/static/chunks/942.1dec0ce762e131a5.js +0 -1
- package/runtime/.next/static/chunks/app/web/layout-e5b1780d2961e7c0.js +0 -1
- package/runtime/.next/static/chunks/app/web/page-f5171cee114f2892.js +0 -1
- package/runtime/.next/static/chunks/webpack-3ff471b94db6b1b2.js +0 -1
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-reghh1vn.mjs +0 -33
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-tm6xdb2r.mjs +0 -40
- package/runtime/webapp/dist/assets/App-DQ5fJODJ.js +0 -476
- package/runtime/webapp/dist/assets/channel-BjAaNinW.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BA6foNu5.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BA6foNu5.js +0 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-D7wp4Sey.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-Dq79H5La.js +0 -8
- /package/runtime/.next/static/{ENg3PaHjA_727MHwcEIkE → BmUH3xLHQfGkG3yzEK37i}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{ENg3PaHjA_727MHwcEIkE → BmUH3xLHQfGkG3yzEK37i}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-COIcZZvf.js","./App-iUeP1CBo.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&o(g)}).observe(document,{childList:!0,subtree:!0});function n(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=n(c);fetch(c.href,f)}})();const Yv="modulepreload",Kv=function(e,t){return new URL(e,t).href},Gd={},Y1=function(t,n,o){let c=Promise.resolve();if(n&&n.length>0){const g=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),v=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=Promise.allSettled(n.map(x=>{if(x=Kv(x,o),x in Gd)return;Gd[x]=!0;const C=x.endsWith(".css"),A=C?'[rel="stylesheet"]':"";if(o)for(let O=g.length-1;O>=0;O--){const k=g[O];if(k.href===x&&(!C||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${x}"]${A}`))return;const I=document.createElement("link");if(I.rel=C?"stylesheet":Yv,C||(I.as="script"),I.crossOrigin="",I.href=x,v&&I.setAttribute("nonce",v),document.head.appendChild(I),C)return new Promise((O,k)=>{I.addEventListener("load",O),I.addEventListener("error",()=>k(Error(`Unable to preload CSS for ${x}`)))})}))}function f(g){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=g,window.dispatchEvent(m),!m.defaultPrevented)throw g}return c.then(g=>{for(const m of g||[])m.status==="rejected"&&f(m.reason);return t().catch(f)})};var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function o2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a2={exports:{}},au={},l2={exports:{}},Ce={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -55,7 +55,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-DQ5fJODJ.js","./
|
|
|
55
55
|
`).replace($R,"")}function za(e,t,n){if(t=qg(t),qg(e)!==t&&n)throw Error(Z(425))}function Ul(){}var l1=null,u1=null;function c1(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var f1=typeof setTimeout=="function"?setTimeout:void 0,VR=typeof clearTimeout=="function"?clearTimeout:void 0,Jg=typeof Promise=="function"?Promise:void 0,zR=typeof queueMicrotask=="function"?queueMicrotask:typeof Jg<"u"?function(e){return Jg.resolve(null).then(e).catch(HR)}:f1;function HR(e){setTimeout(function(){throw e})}function nf(e,t){var n=t,o=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"){if(o===0){e.removeChild(c),Bo(t);return}o--}else n!=="$"&&n!=="$?"&&n!=="$!"||o++;n=c}while(n);Bo(t)}function Hn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function ep(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ns=Math.random().toString(36).slice(2),rn="__reactFiber$"+Ns,Wo="__reactProps$"+Ns,vn="__reactContainer$"+Ns,d1="__reactEvents$"+Ns,GR="__reactListeners$"+Ns,XR="__reactHandles$"+Ns;function gi(e){var t=e[rn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[vn]||n[rn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ep(e);e!==null;){if(n=e[rn])return n;e=ep(e)}return t}e=n,n=e.parentNode}return null}function na(e){return e=e[rn]||e[vn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Z(33))}function _u(e){return e[Wo]||null}var h1=[],Ji=-1;function ti(e){return{current:e}}function ze(e){0>Ji||(e.current=h1[Ji],h1[Ji]=null,Ji--)}function We(e,t){Ji++,h1[Ji]=e.current,e.current=t}var Qn={},$t=ti(Qn),or=ti(!1),Ci=Qn;function vs(e,t){var n=e.type.contextTypes;if(!n)return Qn;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var c={},f;for(f in n)c[f]=t[f];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=c),c}function ar(e){return e=e.childContextTypes,e!=null}function jl(){ze(or),ze($t)}function tp(e,t,n){if($t.current!==Qn)throw Error(Z(168));We($t,t),We(or,n)}function sw(e,t,n){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return n;o=o.getChildContext();for(var c in o)if(!(c in t))throw Error(Z(108,NT(e)||"Unknown",c));return et({},n,o)}function Wl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Qn,Ci=$t.current,We($t,e),We(or,or.current),!0}function rp(e,t,n){var o=e.stateNode;if(!o)throw Error(Z(169));n?(e=sw(e,t,Ci),o.__reactInternalMemoizedMergedChildContext=e,ze(or),ze($t),We($t,e)):ze(or),We(or,n)}var fn=null,Ou=!1,sf=!1;function ow(e){fn===null?fn=[e]:fn.push(e)}function YR(e){Ou=!0,ow(e)}function ri(){if(!sf&&fn!==null){sf=!0;var e=0,t=Pe;try{var n=fn;for(Pe=1;e<n.length;e++){var o=n[e];do o=o(!0);while(o!==null)}fn=null,Ou=!1}catch(c){throw fn!==null&&(fn=fn.slice(e+1)),Nm(W0,ri),c}finally{Pe=t,sf=!1}}return null}var es=[],ts=0,$l=null,Vl=0,Ir=[],Tr=0,Ai=null,hn=1,gn="";function fi(e,t){es[ts++]=Vl,es[ts++]=$l,$l=e,Vl=t}function aw(e,t,n){Ir[Tr++]=hn,Ir[Tr++]=gn,Ir[Tr++]=Ai,Ai=e;var o=hn;e=gn;var c=32-jr(o)-1;o&=~(1<<c),n+=1;var f=32-jr(t)+c;if(30<f){var g=c-c%5;f=(o&(1<<g)-1).toString(32),o>>=g,c-=g,hn=1<<32-jr(t)+c|n<<c|o,gn=f+e}else hn=1<<f|n<<c|o,gn=e}function Z0(e){e.return!==null&&(fi(e,1),aw(e,1,0))}function Q0(e){for(;e===$l;)$l=es[--ts],es[ts]=null,Vl=es[--ts],es[ts]=null;for(;e===Ai;)Ai=Ir[--Tr],Ir[Tr]=null,gn=Ir[--Tr],Ir[Tr]=null,hn=Ir[--Tr],Ir[Tr]=null}var gr=null,hr=null,Ye=!1,Ur=null;function lw(e,t){var n=Rr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function np(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,gr=e,hr=Hn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,gr=e,hr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ai!==null?{id:hn,overflow:gn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,gr=e,hr=null,!0):!1;default:return!1}}function g1(e){return(e.mode&1)!==0&&(e.flags&128)===0}function p1(e){if(Ye){var t=hr;if(t){var n=t;if(!np(e,t)){if(g1(e))throw Error(Z(418));t=Hn(n.nextSibling);var o=gr;t&&np(e,t)?lw(o,n):(e.flags=e.flags&-4097|2,Ye=!1,gr=e)}}else{if(g1(e))throw Error(Z(418));e.flags=e.flags&-4097|2,Ye=!1,gr=e}}}function ip(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;gr=e}function Ha(e){if(e!==gr)return!1;if(!Ye)return ip(e),Ye=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!c1(e.type,e.memoizedProps)),t&&(t=hr)){if(g1(e))throw uw(),Error(Z(418));for(;t;)lw(e,t),t=Hn(t.nextSibling)}if(ip(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){hr=Hn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}hr=null}}else hr=gr?Hn(e.stateNode.nextSibling):null;return!0}function uw(){for(var e=hr;e;)e=Hn(e.nextSibling)}function ys(){hr=gr=null,Ye=!1}function q0(e){Ur===null?Ur=[e]:Ur.push(e)}var KR=Sn.ReactCurrentBatchConfig;function to(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Z(309));var o=n.stateNode}if(!o)throw Error(Z(147,e));var c=o,f=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===f?t.ref:(t=function(g){var m=c.refs;g===null?delete m[f]:m[f]=g},t._stringRef=f,t)}if(typeof e!="string")throw Error(Z(284));if(!n._owner)throw Error(Z(290,e))}return e}function Ga(e,t){throw e=Object.prototype.toString.call(t),Error(Z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function sp(e){var t=e._init;return t(e._payload)}function cw(e){function t(N,T){if(e){var _=N.deletions;_===null?(N.deletions=[T],N.flags|=16):_.push(T)}}function n(N,T){if(!e)return null;for(;T!==null;)t(N,T),T=T.sibling;return null}function o(N,T){for(N=new Map;T!==null;)T.key!==null?N.set(T.key,T):N.set(T.index,T),T=T.sibling;return N}function c(N,T){return N=Kn(N,T),N.index=0,N.sibling=null,N}function f(N,T,_){return N.index=_,e?(_=N.alternate,_!==null?(_=_.index,_<T?(N.flags|=2,T):_):(N.flags|=2,T)):(N.flags|=1048576,T)}function g(N){return e&&N.alternate===null&&(N.flags|=2),N}function m(N,T,_,U){return T===null||T.tag!==6?(T=df(_,N.mode,U),T.return=N,T):(T=c(T,_),T.return=N,T)}function v(N,T,_,U){var z=_.type;return z===Yi?C(N,T,_.props.children,U,_.key):T!==null&&(T.elementType===z||typeof z=="object"&&z!==null&&z.$$typeof===Pn&&sp(z)===T.type)?(U=c(T,_.props),U.ref=to(N,T,_),U.return=N,U):(U=vl(_.type,_.key,_.props,null,N.mode,U),U.ref=to(N,T,_),U.return=N,U)}function x(N,T,_,U){return T===null||T.tag!==4||T.stateNode.containerInfo!==_.containerInfo||T.stateNode.implementation!==_.implementation?(T=hf(_,N.mode,U),T.return=N,T):(T=c(T,_.children||[]),T.return=N,T)}function C(N,T,_,U,z){return T===null||T.tag!==7?(T=vi(_,N.mode,U,z),T.return=N,T):(T=c(T,_),T.return=N,T)}function A(N,T,_){if(typeof T=="string"&&T!==""||typeof T=="number")return T=df(""+T,N.mode,_),T.return=N,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case ka:return _=vl(T.type,T.key,T.props,null,N.mode,_),_.ref=to(N,null,T),_.return=N,_;case Xi:return T=hf(T,N.mode,_),T.return=N,T;case Pn:var U=T._init;return A(N,U(T._payload),_)}if(lo(T)||Zs(T))return T=vi(T,N.mode,_,null),T.return=N,T;Ga(N,T)}return null}function I(N,T,_,U){var z=T!==null?T.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return z!==null?null:m(N,T,""+_,U);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case ka:return _.key===z?v(N,T,_,U):null;case Xi:return _.key===z?x(N,T,_,U):null;case Pn:return z=_._init,I(N,T,z(_._payload),U)}if(lo(_)||Zs(_))return z!==null?null:C(N,T,_,U,null);Ga(N,_)}return null}function O(N,T,_,U,z){if(typeof U=="string"&&U!==""||typeof U=="number")return N=N.get(_)||null,m(T,N,""+U,z);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case ka:return N=N.get(U.key===null?_:U.key)||null,v(T,N,U,z);case Xi:return N=N.get(U.key===null?_:U.key)||null,x(T,N,U,z);case Pn:var j=U._init;return O(N,T,_,j(U._payload),z)}if(lo(U)||Zs(U))return N=N.get(_)||null,C(T,N,U,z,null);Ga(T,U)}return null}function k(N,T,_,U){for(var z=null,j=null,B=T,X=T=0,V=null;B!==null&&X<_.length;X++){B.index>X?(V=B,B=null):V=B.sibling;var oe=I(N,B,_[X],U);if(oe===null){B===null&&(B=V);break}e&&B&&oe.alternate===null&&t(N,B),T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe,B=V}if(X===_.length)return n(N,B),Ye&&fi(N,X),z;if(B===null){for(;X<_.length;X++)B=A(N,_[X],U),B!==null&&(T=f(B,T,X),j===null?z=B:j.sibling=B,j=B);return Ye&&fi(N,X),z}for(B=o(N,B);X<_.length;X++)V=O(B,N,X,_[X],U),V!==null&&(e&&V.alternate!==null&&B.delete(V.key===null?X:V.key),T=f(V,T,X),j===null?z=V:j.sibling=V,j=V);return e&&B.forEach(function(ye){return t(N,ye)}),Ye&&fi(N,X),z}function M(N,T,_,U){var z=Zs(_);if(typeof z!="function")throw Error(Z(150));if(_=z.call(_),_==null)throw Error(Z(151));for(var j=z=null,B=T,X=T=0,V=null,oe=_.next();B!==null&&!oe.done;X++,oe=_.next()){B.index>X?(V=B,B=null):V=B.sibling;var ye=I(N,B,oe.value,U);if(ye===null){B===null&&(B=V);break}e&&B&&ye.alternate===null&&t(N,B),T=f(ye,T,X),j===null?z=ye:j.sibling=ye,j=ye,B=V}if(oe.done)return n(N,B),Ye&&fi(N,X),z;if(B===null){for(;!oe.done;X++,oe=_.next())oe=A(N,oe.value,U),oe!==null&&(T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe);return Ye&&fi(N,X),z}for(B=o(N,B);!oe.done;X++,oe=_.next())oe=O(B,N,X,oe.value,U),oe!==null&&(e&&oe.alternate!==null&&B.delete(oe.key===null?X:oe.key),T=f(oe,T,X),j===null?z=oe:j.sibling=oe,j=oe);return e&&B.forEach(function(se){return t(N,se)}),Ye&&fi(N,X),z}function G(N,T,_,U){if(typeof _=="object"&&_!==null&&_.type===Yi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case ka:e:{for(var z=_.key,j=T;j!==null;){if(j.key===z){if(z=_.type,z===Yi){if(j.tag===7){n(N,j.sibling),T=c(j,_.props.children),T.return=N,N=T;break e}}else if(j.elementType===z||typeof z=="object"&&z!==null&&z.$$typeof===Pn&&sp(z)===j.type){n(N,j.sibling),T=c(j,_.props),T.ref=to(N,j,_),T.return=N,N=T;break e}n(N,j);break}else t(N,j);j=j.sibling}_.type===Yi?(T=vi(_.props.children,N.mode,U,_.key),T.return=N,N=T):(U=vl(_.type,_.key,_.props,null,N.mode,U),U.ref=to(N,T,_),U.return=N,N=U)}return g(N);case Xi:e:{for(j=_.key;T!==null;){if(T.key===j)if(T.tag===4&&T.stateNode.containerInfo===_.containerInfo&&T.stateNode.implementation===_.implementation){n(N,T.sibling),T=c(T,_.children||[]),T.return=N,N=T;break e}else{n(N,T);break}else t(N,T);T=T.sibling}T=hf(_,N.mode,U),T.return=N,N=T}return g(N);case Pn:return j=_._init,G(N,T,j(_._payload),U)}if(lo(_))return k(N,T,_,U);if(Zs(_))return M(N,T,_,U);Ga(N,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,T!==null&&T.tag===6?(n(N,T.sibling),T=c(T,_),T.return=N,N=T):(n(N,T),T=df(_,N.mode,U),T.return=N,N=T),g(N)):n(N,T)}return G}var Es=cw(!0),fw=cw(!1),zl=ti(null),Hl=null,rs=null,J0=null;function ed(){J0=rs=Hl=null}function td(e){var t=zl.current;ze(zl),e._currentValue=t}function x1(e,t,n){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===n)break;e=e.return}}function ds(e,t){Hl=e,J0=rs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(sr=!0),e.firstContext=null)}function _r(e){var t=e._currentValue;if(J0!==e)if(e={context:e,memoizedValue:t,next:null},rs===null){if(Hl===null)throw Error(Z(308));rs=e,Hl.dependencies={lanes:0,firstContext:e}}else rs=rs.next=e;return t}var pi=null;function rd(e){pi===null?pi=[e]:pi.push(e)}function dw(e,t,n,o){var c=t.interleaved;return c===null?(n.next=n,rd(t)):(n.next=c.next,c.next=n),t.interleaved=n,yn(e,o)}function yn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var kn=!1;function nd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Gn(e,t,n){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,_e&2){var c=o.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),o.pending=t,yn(e,n)}return c=o.interleaved,c===null?(t.next=t,rd(o)):(t.next=c.next,c.next=t),o.interleaved=t,yn(e,n)}function hl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,$0(e,n)}}function op(e,t){var n=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,n===o)){var c=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var g={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};f===null?c=f=g:f=f.next=g,n=n.next}while(n!==null);f===null?c=f=t:f=f.next=t}else c=f=t;n={baseState:o.baseState,firstBaseUpdate:c,lastBaseUpdate:f,shared:o.shared,effects:o.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Gl(e,t,n,o){var c=e.updateQueue;kn=!1;var f=c.firstBaseUpdate,g=c.lastBaseUpdate,m=c.shared.pending;if(m!==null){c.shared.pending=null;var v=m,x=v.next;v.next=null,g===null?f=x:g.next=x,g=v;var C=e.alternate;C!==null&&(C=C.updateQueue,m=C.lastBaseUpdate,m!==g&&(m===null?C.firstBaseUpdate=x:m.next=x,C.lastBaseUpdate=v))}if(f!==null){var A=c.baseState;g=0,C=x=v=null,m=f;do{var I=m.lane,O=m.eventTime;if((o&I)===I){C!==null&&(C=C.next={eventTime:O,lane:0,tag:m.tag,payload:m.payload,callback:m.callback,next:null});e:{var k=e,M=m;switch(I=t,O=n,M.tag){case 1:if(k=M.payload,typeof k=="function"){A=k.call(O,A,I);break e}A=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=M.payload,I=typeof k=="function"?k.call(O,A,I):k,I==null)break e;A=et({},A,I);break e;case 2:kn=!0}}m.callback!==null&&m.lane!==0&&(e.flags|=64,I=c.effects,I===null?c.effects=[m]:I.push(m))}else O={eventTime:O,lane:I,tag:m.tag,payload:m.payload,callback:m.callback,next:null},C===null?(x=C=O,v=A):C=C.next=O,g|=I;if(m=m.next,m===null){if(m=c.shared.pending,m===null)break;I=m,m=I.next,I.next=null,c.lastBaseUpdate=I,c.shared.pending=null}}while(!0);if(C===null&&(v=A),c.baseState=v,c.firstBaseUpdate=x,c.lastBaseUpdate=C,t=c.shared.interleaved,t!==null){c=t;do g|=c.lane,c=c.next;while(c!==t)}else f===null&&(c.shared.lanes=0);Ii|=g,e.lanes=g,e.memoizedState=A}}function ap(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var o=e[t],c=o.callback;if(c!==null){if(o.callback=null,o=n,typeof c!="function")throw Error(Z(191,c));c.call(o)}}}var ia={},sn=ti(ia),$o=ti(ia),Vo=ti(ia);function xi(e){if(e===ia)throw Error(Z(174));return e}function id(e,t){switch(We(Vo,t),We($o,e),We(sn,ia),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Zf(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Zf(t,e)}ze(sn),We(sn,t)}function Cs(){ze(sn),ze($o),ze(Vo)}function gw(e){xi(Vo.current);var t=xi(sn.current),n=Zf(t,e.type);t!==n&&(We($o,e),We(sn,n))}function sd(e){$o.current===e&&(ze(sn),ze($o))}var qe=ti(0);function Xl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var of=[];function od(){for(var e=0;e<of.length;e++)of[e]._workInProgressVersionPrimary=null;of.length=0}var gl=Sn.ReactCurrentDispatcher,af=Sn.ReactCurrentBatchConfig,Si=0,Je=null,vt=null,It=null,Yl=!1,Eo=!1,zo=0,ZR=0;function Ut(){throw Error(Z(321))}function ad(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!$r(e[n],t[n]))return!1;return!0}function ld(e,t,n,o,c,f){if(Si=f,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,gl.current=e===null||e.memoizedState===null?eb:tb,e=n(o,c),Eo){f=0;do{if(Eo=!1,zo=0,25<=f)throw Error(Z(301));f+=1,It=vt=null,t.updateQueue=null,gl.current=rb,e=n(o,c)}while(Eo)}if(gl.current=Kl,t=vt!==null&&vt.next!==null,Si=0,It=vt=Je=null,Yl=!1,t)throw Error(Z(300));return e}function ud(){var e=zo!==0;return zo=0,e}function tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?Je.memoizedState=It=e:It=It.next=e,It}function Or(){if(vt===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=vt.next;var t=It===null?Je.memoizedState:It.next;if(t!==null)It=t,vt=e;else{if(e===null)throw Error(Z(310));vt=e,e={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},It===null?Je.memoizedState=It=e:It=It.next=e}return It}function Ho(e,t){return typeof t=="function"?t(e):t}function lf(e){var t=Or(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var o=vt,c=o.baseQueue,f=n.pending;if(f!==null){if(c!==null){var g=c.next;c.next=f.next,f.next=g}o.baseQueue=c=f,n.pending=null}if(c!==null){f=c.next,o=o.baseState;var m=g=null,v=null,x=f;do{var C=x.lane;if((Si&C)===C)v!==null&&(v=v.next={lane:0,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null}),o=x.hasEagerState?x.eagerState:e(o,x.action);else{var A={lane:C,action:x.action,hasEagerState:x.hasEagerState,eagerState:x.eagerState,next:null};v===null?(m=v=A,g=o):v=v.next=A,Je.lanes|=C,Ii|=C}x=x.next}while(x!==null&&x!==f);v===null?g=o:v.next=m,$r(o,t.memoizedState)||(sr=!0),t.memoizedState=o,t.baseState=g,t.baseQueue=v,n.lastRenderedState=o}if(e=n.interleaved,e!==null){c=e;do f=c.lane,Je.lanes|=f,Ii|=f,c=c.next;while(c!==e)}else c===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function uf(e){var t=Or(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var o=n.dispatch,c=n.pending,f=t.memoizedState;if(c!==null){n.pending=null;var g=c=c.next;do f=e(f,g.action),g=g.next;while(g!==c);$r(f,t.memoizedState)||(sr=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,o]}function pw(){}function xw(e,t){var n=Je,o=Or(),c=t(),f=!$r(o.memoizedState,c);if(f&&(o.memoizedState=c,sr=!0),o=o.queue,cd(vw.bind(null,n,o,e),[e]),o.getSnapshot!==t||f||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,Go(9,ww.bind(null,n,o,c,t),void 0,null),Tt===null)throw Error(Z(349));Si&30||mw(n,t,c)}return c}function mw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ww(e,t,n,o){t.value=n,t.getSnapshot=o,yw(t)&&Ew(e)}function vw(e,t,n){return n(function(){yw(t)&&Ew(e)})}function yw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!$r(e,n)}catch{return!0}}function Ew(e){var t=yn(e,1);t!==null&&Wr(t,e,1,-1)}function lp(e){var t=tn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:e},t.queue=e,e=e.dispatch=JR.bind(null,Je,e),[t.memoizedState,e]}function Go(e,t,n,o){return e={tag:e,create:t,destroy:n,deps:o,next:null},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(o=n.next,n.next=e,e.next=o,t.lastEffect=e)),e}function Cw(){return Or().memoizedState}function pl(e,t,n,o){var c=tn();Je.flags|=e,c.memoizedState=Go(1|t,n,void 0,o===void 0?null:o)}function Nu(e,t,n,o){var c=Or();o=o===void 0?null:o;var f=void 0;if(vt!==null){var g=vt.memoizedState;if(f=g.destroy,o!==null&&ad(o,g.deps)){c.memoizedState=Go(t,n,f,o);return}}Je.flags|=e,c.memoizedState=Go(1|t,n,f,o)}function up(e,t){return pl(8390656,8,e,t)}function cd(e,t){return Nu(2048,8,e,t)}function Aw(e,t){return Nu(4,2,e,t)}function Sw(e,t){return Nu(4,4,e,t)}function Iw(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Tw(e,t,n){return n=n!=null?n.concat([e]):null,Nu(4,4,Iw.bind(null,t,e),n)}function fd(){}function Rw(e,t){var n=Or();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&ad(t,o[1])?o[0]:(n.memoizedState=[e,t],e)}function bw(e,t){var n=Or();t=t===void 0?null:t;var o=n.memoizedState;return o!==null&&t!==null&&ad(t,o[1])?o[0]:(e=e(),n.memoizedState=[e,t],e)}function _w(e,t,n){return Si&21?($r(n,t)||(n=Pm(),Je.lanes|=n,Ii|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,sr=!0),e.memoizedState=n)}function QR(e,t){var n=Pe;Pe=n!==0&&4>n?n:4,e(!0);var o=af.transition;af.transition={};try{e(!1),t()}finally{Pe=n,af.transition=o}}function Ow(){return Or().memoizedState}function qR(e,t,n){var o=Yn(e);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},Nw(e))Dw(t,n);else if(n=dw(e,t,n,o),n!==null){var c=Gt();Wr(n,e,o,c),Mw(n,t,o)}}function JR(e,t,n){var o=Yn(e),c={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(Nw(e))Dw(t,c);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var g=t.lastRenderedState,m=f(g,n);if(c.hasEagerState=!0,c.eagerState=m,$r(m,g)){var v=t.interleaved;v===null?(c.next=c,rd(t)):(c.next=v.next,v.next=c),t.interleaved=c;return}}catch{}finally{}n=dw(e,t,c,o),n!==null&&(c=Gt(),Wr(n,e,o,c),Mw(n,t,o))}}function Nw(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function Dw(e,t){Eo=Yl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Mw(e,t,n){if(n&4194240){var o=t.lanes;o&=e.pendingLanes,n|=o,t.lanes=n,$0(e,n)}}var Kl={readContext:_r,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},eb={readContext:_r,useCallback:function(e,t){return tn().memoizedState=[e,t===void 0?null:t],e},useContext:_r,useEffect:up,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pl(4194308,4,Iw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return pl(4,2,e,t)},useMemo:function(e,t){var n=tn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var o=tn();return t=n!==void 0?n(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=qR.bind(null,Je,e),[o.memoizedState,e]},useRef:function(e){var t=tn();return e={current:e},t.memoizedState=e},useState:lp,useDebugValue:fd,useDeferredValue:function(e){return tn().memoizedState=e},useTransition:function(){var e=lp(!1),t=e[0];return e=QR.bind(null,e[1]),tn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var o=Je,c=tn();if(Ye){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),Tt===null)throw Error(Z(349));Si&30||mw(o,t,n)}c.memoizedState=n;var f={value:n,getSnapshot:t};return c.queue=f,up(vw.bind(null,o,f,e),[e]),o.flags|=2048,Go(9,ww.bind(null,o,f,n,t),void 0,null),n},useId:function(){var e=tn(),t=Tt.identifierPrefix;if(Ye){var n=gn,o=hn;n=(o&~(1<<32-jr(o)-1)).toString(32)+n,t=":"+t+"R"+n,n=zo++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ZR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},tb={readContext:_r,useCallback:Rw,useContext:_r,useEffect:cd,useImperativeHandle:Tw,useInsertionEffect:Aw,useLayoutEffect:Sw,useMemo:bw,useReducer:lf,useRef:Cw,useState:function(){return lf(Ho)},useDebugValue:fd,useDeferredValue:function(e){var t=Or();return _w(t,vt.memoizedState,e)},useTransition:function(){var e=lf(Ho)[0],t=Or().memoizedState;return[e,t]},useMutableSource:pw,useSyncExternalStore:xw,useId:Ow,unstable_isNewReconciler:!1},rb={readContext:_r,useCallback:Rw,useContext:_r,useEffect:cd,useImperativeHandle:Tw,useInsertionEffect:Aw,useLayoutEffect:Sw,useMemo:bw,useReducer:uf,useRef:Cw,useState:function(){return uf(Ho)},useDebugValue:fd,useDeferredValue:function(e){var t=Or();return vt===null?t.memoizedState=e:_w(t,vt.memoizedState,e)},useTransition:function(){var e=uf(Ho)[0],t=Or().memoizedState;return[e,t]},useMutableSource:pw,useSyncExternalStore:xw,useId:Ow,unstable_isNewReconciler:!1};function Br(e,t){if(e&&e.defaultProps){t=et({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function m1(e,t,n,o){t=e.memoizedState,n=n(o,t),n=n==null?t:et({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Du={isMounted:function(e){return(e=e._reactInternals)?Oi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var o=Gt(),c=Yn(e),f=pn(o,c);f.payload=t,n!=null&&(f.callback=n),t=Gn(e,f,c),t!==null&&(Wr(t,e,c,o),hl(t,e,c))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var o=Gt(),c=Yn(e),f=pn(o,c);f.tag=1,f.payload=t,n!=null&&(f.callback=n),t=Gn(e,f,c),t!==null&&(Wr(t,e,c,o),hl(t,e,c))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gt(),o=Yn(e),c=pn(n,o);c.tag=2,t!=null&&(c.callback=t),t=Gn(e,c,o),t!==null&&(Wr(t,e,o,n),hl(t,e,o))}};function cp(e,t,n,o,c,f,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,f,g):t.prototype&&t.prototype.isPureReactComponent?!Fo(n,o)||!Fo(c,f):!0}function Pw(e,t,n){var o=!1,c=Qn,f=t.contextType;return typeof f=="object"&&f!==null?f=_r(f):(c=ar(t)?Ci:$t.current,o=t.contextTypes,f=(o=o!=null)?vs(e,c):Qn),t=new t(n,f),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Du,e.stateNode=t,t._reactInternals=e,o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=c,e.__reactInternalMemoizedMaskedChildContext=f),t}function fp(e,t,n,o){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,o),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,o),t.state!==e&&Du.enqueueReplaceState(t,t.state,null)}function w1(e,t,n,o){var c=e.stateNode;c.props=n,c.state=e.memoizedState,c.refs={},nd(e);var f=t.contextType;typeof f=="object"&&f!==null?c.context=_r(f):(f=ar(t)?Ci:$t.current,c.context=vs(e,f)),c.state=e.memoizedState,f=t.getDerivedStateFromProps,typeof f=="function"&&(m1(e,t,f,n),c.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(t=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),t!==c.state&&Du.enqueueReplaceState(c,c.state,null),Gl(e,n,c,o),c.state=e.memoizedState),typeof c.componentDidMount=="function"&&(e.flags|=4194308)}function As(e,t){try{var n="",o=t;do n+=OT(o),o=o.return;while(o);var c=n}catch(f){c=`
|
|
56
56
|
Error generating stack: `+f.message+`
|
|
57
57
|
`+f.stack}return{value:e,source:t,stack:c,digest:null}}function cf(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function v1(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var nb=typeof WeakMap=="function"?WeakMap:Map;function kw(e,t,n){n=pn(-1,n),n.tag=3,n.payload={element:null};var o=t.value;return n.callback=function(){Ql||(Ql=!0,_1=o),v1(e,t)},n}function Bw(e,t,n){n=pn(-1,n),n.tag=3;var o=e.type.getDerivedStateFromError;if(typeof o=="function"){var c=t.value;n.payload=function(){return o(c)},n.callback=function(){v1(e,t)}}var f=e.stateNode;return f!==null&&typeof f.componentDidCatch=="function"&&(n.callback=function(){v1(e,t),typeof o!="function"&&(Xn===null?Xn=new Set([this]):Xn.add(this));var g=t.stack;this.componentDidCatch(t.value,{componentStack:g!==null?g:""})}),n}function dp(e,t,n){var o=e.pingCache;if(o===null){o=e.pingCache=new nb;var c=new Set;o.set(t,c)}else c=o.get(t),c===void 0&&(c=new Set,o.set(t,c));c.has(n)||(c.add(n),e=mb.bind(null,e,t,n),t.then(e,e))}function hp(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function gp(e,t,n,o,c){return e.mode&1?(e.flags|=65536,e.lanes=c,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=pn(-1,1),t.tag=2,Gn(n,t,1))),n.lanes|=1),e)}var ib=Sn.ReactCurrentOwner,sr=!1;function Ht(e,t,n,o){t.child=e===null?fw(t,null,n,o):Es(t,e.child,n,o)}function pp(e,t,n,o,c){n=n.render;var f=t.ref;return ds(t,c),o=ld(e,t,n,o,f,c),n=ud(),e!==null&&!sr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,En(e,t,c)):(Ye&&n&&Z0(t),t.flags|=1,Ht(e,t,o,c),t.child)}function xp(e,t,n,o,c){if(e===null){var f=n.type;return typeof f=="function"&&!vd(f)&&f.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=f,Lw(e,t,f,o,c)):(e=vl(n.type,null,o,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!(e.lanes&c)){var g=f.memoizedProps;if(n=n.compare,n=n!==null?n:Fo,n(g,o)&&e.ref===t.ref)return En(e,t,c)}return t.flags|=1,e=Kn(f,o),e.ref=t.ref,e.return=t,t.child=e}function Lw(e,t,n,o,c){if(e!==null){var f=e.memoizedProps;if(Fo(f,o)&&e.ref===t.ref)if(sr=!1,t.pendingProps=o=f,(e.lanes&c)!==0)e.flags&131072&&(sr=!0);else return t.lanes=e.lanes,En(e,t,c)}return y1(e,t,n,o,c)}function Fw(e,t,n){var o=t.pendingProps,c=o.children,f=e!==null?e.memoizedState:null;if(o.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},We(is,dr),dr|=n;else{if(!(n&1073741824))return e=f!==null?f.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,We(is,dr),dr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=f!==null?f.baseLanes:n,We(is,dr),dr|=o}else f!==null?(o=f.baseLanes|n,t.memoizedState=null):o=n,We(is,dr),dr|=o;return Ht(e,t,c,n),t.child}function Uw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function y1(e,t,n,o,c){var f=ar(n)?Ci:$t.current;return f=vs(t,f),ds(t,c),n=ld(e,t,n,o,f,c),o=ud(),e!==null&&!sr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~c,En(e,t,c)):(Ye&&o&&Z0(t),t.flags|=1,Ht(e,t,n,c),t.child)}function mp(e,t,n,o,c){if(ar(n)){var f=!0;Wl(t)}else f=!1;if(ds(t,c),t.stateNode===null)xl(e,t),Pw(t,n,o),w1(t,n,o,c),o=!0;else if(e===null){var g=t.stateNode,m=t.memoizedProps;g.props=m;var v=g.context,x=n.contextType;typeof x=="object"&&x!==null?x=_r(x):(x=ar(n)?Ci:$t.current,x=vs(t,x));var C=n.getDerivedStateFromProps,A=typeof C=="function"||typeof g.getSnapshotBeforeUpdate=="function";A||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(m!==o||v!==x)&&fp(t,g,o,x),kn=!1;var I=t.memoizedState;g.state=I,Gl(t,o,g,c),v=t.memoizedState,m!==o||I!==v||or.current||kn?(typeof C=="function"&&(m1(t,n,C,o),v=t.memoizedState),(m=kn||cp(t,n,m,o,I,v,x))?(A||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(t.flags|=4194308)):(typeof g.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=o,t.memoizedState=v),g.props=o,g.state=v,g.context=x,o=m):(typeof g.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{g=t.stateNode,hw(e,t),m=t.memoizedProps,x=t.type===t.elementType?m:Br(t.type,m),g.props=x,A=t.pendingProps,I=g.context,v=n.contextType,typeof v=="object"&&v!==null?v=_r(v):(v=ar(n)?Ci:$t.current,v=vs(t,v));var O=n.getDerivedStateFromProps;(C=typeof O=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(m!==A||I!==v)&&fp(t,g,o,v),kn=!1,I=t.memoizedState,g.state=I,Gl(t,o,g,c);var k=t.memoizedState;m!==A||I!==k||or.current||kn?(typeof O=="function"&&(m1(t,n,O,o),k=t.memoizedState),(x=kn||cp(t,n,x,o,I,k,v)||!1)?(C||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(o,k,v),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(o,k,v)),typeof g.componentDidUpdate=="function"&&(t.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof g.componentDidUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=k),g.props=o,g.state=k,g.context=v,o=x):(typeof g.componentDidUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&I===e.memoizedState||(t.flags|=1024),o=!1)}return E1(e,t,n,o,f,c)}function E1(e,t,n,o,c,f){Uw(e,t);var g=(t.flags&128)!==0;if(!o&&!g)return c&&rp(t,n,!1),En(e,t,f);o=t.stateNode,ib.current=t;var m=g&&typeof n.getDerivedStateFromError!="function"?null:o.render();return t.flags|=1,e!==null&&g?(t.child=Es(t,e.child,null,f),t.child=Es(t,null,m,f)):Ht(e,t,m,f),t.memoizedState=o.state,c&&rp(t,n,!0),t.child}function jw(e){var t=e.stateNode;t.pendingContext?tp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tp(e,t.context,!1),id(e,t.containerInfo)}function wp(e,t,n,o,c){return ys(),q0(c),t.flags|=256,Ht(e,t,n,o),t.child}var C1={dehydrated:null,treeContext:null,retryLane:0};function A1(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ww(e,t,n){var o=t.pendingProps,c=qe.current,f=!1,g=(t.flags&128)!==0,m;if((m=g)||(m=e!==null&&e.memoizedState===null?!1:(c&2)!==0),m?(f=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(c|=1),We(qe,c&1),e===null)return p1(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(g=o.children,e=o.fallback,f?(o=t.mode,f=t.child,g={mode:"hidden",children:g},!(o&1)&&f!==null?(f.childLanes=0,f.pendingProps=g):f=ku(g,o,0,null),e=vi(e,o,n,null),f.return=t,e.return=t,f.sibling=e,t.child=f,t.child.memoizedState=A1(n),t.memoizedState=C1,e):dd(t,g));if(c=e.memoizedState,c!==null&&(m=c.dehydrated,m!==null))return sb(e,t,g,o,m,c,n);if(f){f=o.fallback,g=t.mode,c=e.child,m=c.sibling;var v={mode:"hidden",children:o.children};return!(g&1)&&t.child!==c?(o=t.child,o.childLanes=0,o.pendingProps=v,t.deletions=null):(o=Kn(c,v),o.subtreeFlags=c.subtreeFlags&14680064),m!==null?f=Kn(m,f):(f=vi(f,g,n,null),f.flags|=2),f.return=t,o.return=t,o.sibling=f,t.child=o,o=f,f=t.child,g=e.child.memoizedState,g=g===null?A1(n):{baseLanes:g.baseLanes|n,cachePool:null,transitions:g.transitions},f.memoizedState=g,f.childLanes=e.childLanes&~n,t.memoizedState=C1,o}return f=e.child,e=f.sibling,o=Kn(f,{mode:"visible",children:o.children}),!(t.mode&1)&&(o.lanes=n),o.return=t,o.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function dd(e,t){return t=ku({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Xa(e,t,n,o){return o!==null&&q0(o),Es(t,e.child,null,n),e=dd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sb(e,t,n,o,c,f,g){if(n)return t.flags&256?(t.flags&=-257,o=cf(Error(Z(422))),Xa(e,t,g,o)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(f=o.fallback,c=t.mode,o=ku({mode:"visible",children:o.children},c,0,null),f=vi(f,c,g,null),f.flags|=2,o.return=t,f.return=t,o.sibling=f,t.child=o,t.mode&1&&Es(t,e.child,null,g),t.child.memoizedState=A1(g),t.memoizedState=C1,f);if(!(t.mode&1))return Xa(e,t,g,null);if(c.data==="$!"){if(o=c.nextSibling&&c.nextSibling.dataset,o)var m=o.dgst;return o=m,f=Error(Z(419)),o=cf(f,o,void 0),Xa(e,t,g,o)}if(m=(g&e.childLanes)!==0,sr||m){if(o=Tt,o!==null){switch(g&-g){case 4:c=2;break;case 16:c=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:c=32;break;case 536870912:c=268435456;break;default:c=0}c=c&(o.suspendedLanes|g)?0:c,c!==0&&c!==f.retryLane&&(f.retryLane=c,yn(e,c),Wr(o,e,c,-1))}return wd(),o=cf(Error(Z(421))),Xa(e,t,g,o)}return c.data==="$?"?(t.flags|=128,t.child=e.child,t=wb.bind(null,e),c._reactRetry=t,null):(e=f.treeContext,hr=Hn(c.nextSibling),gr=t,Ye=!0,Ur=null,e!==null&&(Ir[Tr++]=hn,Ir[Tr++]=gn,Ir[Tr++]=Ai,hn=e.id,gn=e.overflow,Ai=t),t=dd(t,o.children),t.flags|=4096,t)}function vp(e,t,n){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),x1(e.return,t,n)}function ff(e,t,n,o,c){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:n,tailMode:c}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=o,f.tail=n,f.tailMode=c)}function $w(e,t,n){var o=t.pendingProps,c=o.revealOrder,f=o.tail;if(Ht(e,t,o.children,n),o=qe.current,o&2)o=o&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vp(e,n,t);else if(e.tag===19)vp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}o&=1}if(We(qe,o),!(t.mode&1))t.memoizedState=null;else switch(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&Xl(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),ff(t,!1,c,n,f);break;case"backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Xl(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}ff(t,!0,n,null,f);break;case"together":ff(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function xl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function En(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ii|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Z(153));if(t.child!==null){for(e=t.child,n=Kn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Kn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ob(e,t,n){switch(t.tag){case 3:jw(t),ys();break;case 5:gw(t);break;case 1:ar(t.type)&&Wl(t);break;case 4:id(t,t.stateNode.containerInfo);break;case 10:var o=t.type._context,c=t.memoizedProps.value;We(zl,o._currentValue),o._currentValue=c;break;case 13:if(o=t.memoizedState,o!==null)return o.dehydrated!==null?(We(qe,qe.current&1),t.flags|=128,null):n&t.child.childLanes?Ww(e,t,n):(We(qe,qe.current&1),e=En(e,t,n),e!==null?e.sibling:null);We(qe,qe.current&1);break;case 19:if(o=(n&t.childLanes)!==0,e.flags&128){if(o)return $w(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),We(qe,qe.current),o)break;return null;case 22:case 23:return t.lanes=0,Fw(e,t,n)}return En(e,t,n)}var Vw,S1,zw,Hw;Vw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};S1=function(){};zw=function(e,t,n,o){var c=e.memoizedProps;if(c!==o){e=t.stateNode,xi(sn.current);var f=null;switch(n){case"input":c=Gf(e,c),o=Gf(e,o),f=[];break;case"select":c=et({},c,{value:void 0}),o=et({},o,{value:void 0}),f=[];break;case"textarea":c=Kf(e,c),o=Kf(e,o),f=[];break;default:typeof c.onClick!="function"&&typeof o.onClick=="function"&&(e.onclick=Ul)}Qf(n,o);var g;n=null;for(x in c)if(!o.hasOwnProperty(x)&&c.hasOwnProperty(x)&&c[x]!=null)if(x==="style"){var m=c[x];for(g in m)m.hasOwnProperty(g)&&(n||(n={}),n[g]="")}else x!=="dangerouslySetInnerHTML"&&x!=="children"&&x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(No.hasOwnProperty(x)?f||(f=[]):(f=f||[]).push(x,null));for(x in o){var v=o[x];if(m=c!=null?c[x]:void 0,o.hasOwnProperty(x)&&v!==m&&(v!=null||m!=null))if(x==="style")if(m){for(g in m)!m.hasOwnProperty(g)||v&&v.hasOwnProperty(g)||(n||(n={}),n[g]="");for(g in v)v.hasOwnProperty(g)&&m[g]!==v[g]&&(n||(n={}),n[g]=v[g])}else n||(f||(f=[]),f.push(x,n)),n=v;else x==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,m=m?m.__html:void 0,v!=null&&m!==v&&(f=f||[]).push(x,v)):x==="children"?typeof v!="string"&&typeof v!="number"||(f=f||[]).push(x,""+v):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&(No.hasOwnProperty(x)?(v!=null&&x==="onScroll"&&Ve("scroll",e),f||m===v||(f=[])):(f=f||[]).push(x,v))}n&&(f=f||[]).push("style",n);var x=f;(t.updateQueue=x)&&(t.flags|=4)}};Hw=function(e,t,n,o){n!==o&&(t.flags|=4)};function ro(e,t){if(!Ye)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function jt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,o=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,o|=c.subtreeFlags&14680064,o|=c.flags&14680064,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,o|=c.subtreeFlags,o|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=o,e.childLanes=n,t}function ab(e,t,n){var o=t.pendingProps;switch(Q0(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(t),null;case 1:return ar(t.type)&&jl(),jt(t),null;case 3:return o=t.stateNode,Cs(),ze(or),ze($t),od(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(e===null||e.child===null)&&(Ha(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ur!==null&&(D1(Ur),Ur=null))),S1(e,t),jt(t),null;case 5:sd(t);var c=xi(Vo.current);if(n=t.type,e!==null&&t.stateNode!=null)zw(e,t,n,o,c),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(t.stateNode===null)throw Error(Z(166));return jt(t),null}if(e=xi(sn.current),Ha(t)){o=t.stateNode,n=t.type;var f=t.memoizedProps;switch(o[rn]=t,o[Wo]=f,e=(t.mode&1)!==0,n){case"dialog":Ve("cancel",o),Ve("close",o);break;case"iframe":case"object":case"embed":Ve("load",o);break;case"video":case"audio":for(c=0;c<co.length;c++)Ve(co[c],o);break;case"source":Ve("error",o);break;case"img":case"image":case"link":Ve("error",o),Ve("load",o);break;case"details":Ve("toggle",o);break;case"input":bg(o,f),Ve("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!f.multiple},Ve("invalid",o);break;case"textarea":Og(o,f),Ve("invalid",o)}Qf(n,f),c=null;for(var g in f)if(f.hasOwnProperty(g)){var m=f[g];g==="children"?typeof m=="string"?o.textContent!==m&&(f.suppressHydrationWarning!==!0&&za(o.textContent,m,e),c=["children",m]):typeof m=="number"&&o.textContent!==""+m&&(f.suppressHydrationWarning!==!0&&za(o.textContent,m,e),c=["children",""+m]):No.hasOwnProperty(g)&&m!=null&&g==="onScroll"&&Ve("scroll",o)}switch(n){case"input":Ba(o),_g(o,f,!0);break;case"textarea":Ba(o),Ng(o);break;case"select":case"option":break;default:typeof f.onClick=="function"&&(o.onclick=Ul)}o=c,t.updateQueue=o,o!==null&&(t.flags|=4)}else{g=c.nodeType===9?c:c.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=vm(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=g.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=g.createElement(n,{is:o.is}):(e=g.createElement(n),n==="select"&&(g=e,o.multiple?g.multiple=!0:o.size&&(g.size=o.size))):e=g.createElementNS(e,n),e[rn]=t,e[Wo]=o,Vw(e,t,!1,!1),t.stateNode=e;e:{switch(g=qf(n,o),n){case"dialog":Ve("cancel",e),Ve("close",e),c=o;break;case"iframe":case"object":case"embed":Ve("load",e),c=o;break;case"video":case"audio":for(c=0;c<co.length;c++)Ve(co[c],e);c=o;break;case"source":Ve("error",e),c=o;break;case"img":case"image":case"link":Ve("error",e),Ve("load",e),c=o;break;case"details":Ve("toggle",e),c=o;break;case"input":bg(e,o),c=Gf(e,o),Ve("invalid",e);break;case"option":c=o;break;case"select":e._wrapperState={wasMultiple:!!o.multiple},c=et({},o,{value:void 0}),Ve("invalid",e);break;case"textarea":Og(e,o),c=Kf(e,o),Ve("invalid",e);break;default:c=o}Qf(n,c),m=c;for(f in m)if(m.hasOwnProperty(f)){var v=m[f];f==="style"?Cm(e,v):f==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,v!=null&&ym(e,v)):f==="children"?typeof v=="string"?(n!=="textarea"||v!=="")&&Do(e,v):typeof v=="number"&&Do(e,""+v):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(No.hasOwnProperty(f)?v!=null&&f==="onScroll"&&Ve("scroll",e):v!=null&&B0(e,f,v,g))}switch(n){case"input":Ba(e),_g(e,o,!1);break;case"textarea":Ba(e),Ng(e);break;case"option":o.value!=null&&e.setAttribute("value",""+Zn(o.value));break;case"select":e.multiple=!!o.multiple,f=o.value,f!=null?ls(e,!!o.multiple,f,!1):o.defaultValue!=null&&ls(e,!!o.multiple,o.defaultValue,!0);break;default:typeof c.onClick=="function"&&(e.onclick=Ul)}switch(n){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}}o&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return jt(t),null;case 6:if(e&&t.stateNode!=null)Hw(e,t,e.memoizedProps,o);else{if(typeof o!="string"&&t.stateNode===null)throw Error(Z(166));if(n=xi(Vo.current),xi(sn.current),Ha(t)){if(o=t.stateNode,n=t.memoizedProps,o[rn]=t,(f=o.nodeValue!==n)&&(e=gr,e!==null))switch(e.tag){case 3:za(o.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&za(o.nodeValue,n,(e.mode&1)!==0)}f&&(t.flags|=4)}else o=(n.nodeType===9?n:n.ownerDocument).createTextNode(o),o[rn]=t,t.stateNode=o}return jt(t),null;case 13:if(ze(qe),o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ye&&hr!==null&&t.mode&1&&!(t.flags&128))uw(),ys(),t.flags|=98560,f=!1;else if(f=Ha(t),o!==null&&o.dehydrated!==null){if(e===null){if(!f)throw Error(Z(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(Z(317));f[rn]=t}else ys(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jt(t),f=!1}else Ur!==null&&(D1(Ur),Ur=null),f=!0;if(!f)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(o=o!==null,o!==(e!==null&&e.memoizedState!==null)&&o&&(t.child.flags|=8192,t.mode&1&&(e===null||qe.current&1?yt===0&&(yt=3):wd())),t.updateQueue!==null&&(t.flags|=4),jt(t),null);case 4:return Cs(),S1(e,t),e===null&&Uo(t.stateNode.containerInfo),jt(t),null;case 10:return td(t.type._context),jt(t),null;case 17:return ar(t.type)&&jl(),jt(t),null;case 19:if(ze(qe),f=t.memoizedState,f===null)return jt(t),null;if(o=(t.flags&128)!==0,g=f.rendering,g===null)if(o)ro(f,!1);else{if(yt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(g=Xl(e),g!==null){for(t.flags|=128,ro(f,!1),o=g.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),t.subtreeFlags=0,o=n,n=t.child;n!==null;)f=n,e=o,f.flags&=14680066,g=f.alternate,g===null?(f.childLanes=0,f.lanes=e,f.child=null,f.subtreeFlags=0,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=g.childLanes,f.lanes=g.lanes,f.child=g.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=g.memoizedProps,f.memoizedState=g.memoizedState,f.updateQueue=g.updateQueue,f.type=g.type,e=g.dependencies,f.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return We(qe,qe.current&1|2),t.child}e=e.sibling}f.tail!==null&&ut()>Ss&&(t.flags|=128,o=!0,ro(f,!1),t.lanes=4194304)}else{if(!o)if(e=Xl(g),e!==null){if(t.flags|=128,o=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ro(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!Ye)return jt(t),null}else 2*ut()-f.renderingStartTime>Ss&&n!==1073741824&&(t.flags|=128,o=!0,ro(f,!1),t.lanes=4194304);f.isBackwards?(g.sibling=t.child,t.child=g):(n=f.last,n!==null?n.sibling=g:t.child=g,f.last=g)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=ut(),t.sibling=null,n=qe.current,We(qe,o?n&1|2:n&1),t):(jt(t),null);case 22:case 23:return md(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?dr&1073741824&&(jt(t),t.subtreeFlags&6&&(t.flags|=8192)):jt(t),null;case 24:return null;case 25:return null}throw Error(Z(156,t.tag))}function lb(e,t){switch(Q0(t),t.tag){case 1:return ar(t.type)&&jl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Cs(),ze(or),ze($t),od(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return sd(t),null;case 13:if(ze(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));ys()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ze(qe),null;case 4:return Cs(),null;case 10:return td(t.type._context),null;case 22:case 23:return md(),null;case 24:return null;default:return null}}var Ya=!1,Wt=!1,ub=typeof WeakSet=="function"?WeakSet:Set,ie=null;function ns(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){ot(e,t,o)}else n.current=null}function I1(e,t,n){try{n()}catch(o){ot(e,t,o)}}var yp=!1;function cb(e,t){if(l1=Bl,e=Zm(),K0(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var c=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var g=0,m=-1,v=-1,x=0,C=0,A=e,I=null;t:for(;;){for(var O;A!==n||c!==0&&A.nodeType!==3||(m=g+c),A!==f||o!==0&&A.nodeType!==3||(v=g+o),A.nodeType===3&&(g+=A.nodeValue.length),(O=A.firstChild)!==null;)I=A,A=O;for(;;){if(A===e)break t;if(I===n&&++x===c&&(m=g),I===f&&++C===o&&(v=g),(O=A.nextSibling)!==null)break;A=I,I=A.parentNode}A=O}n=m===-1||v===-1?null:{start:m,end:v}}else n=null}n=n||{start:0,end:0}}else n=null;for(u1={focusedElem:e,selectionRange:n},Bl=!1,ie=t;ie!==null;)if(t=ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ie=e;else for(;ie!==null;){t=ie;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var M=k.memoizedProps,G=k.memoizedState,N=t.stateNode,T=N.getSnapshotBeforeUpdate(t.elementType===t.type?M:Br(t.type,M),G);N.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Z(163))}}catch(U){ot(t,t.return,U)}if(e=t.sibling,e!==null){e.return=t.return,ie=e;break}ie=t.return}return k=yp,yp=!1,k}function Co(e,t,n){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&e)===e){var f=c.destroy;c.destroy=void 0,f!==void 0&&I1(t,n,f)}c=c.next}while(c!==o)}}function Mu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var o=n.create;n.destroy=o()}n=n.next}while(n!==t)}}function T1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Gw(e){var t=e.alternate;t!==null&&(e.alternate=null,Gw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[rn],delete t[Wo],delete t[d1],delete t[GR],delete t[XR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Xw(e){return e.tag===5||e.tag===3||e.tag===4}function Ep(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function R1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ul));else if(o!==4&&(e=e.child,e!==null))for(R1(e,t,n),e=e.sibling;e!==null;)R1(e,t,n),e=e.sibling}function b1(e,t,n){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(b1(e,t,n),e=e.sibling;e!==null;)b1(e,t,n),e=e.sibling}var Dt=null,Lr=!1;function Mn(e,t,n){for(n=n.child;n!==null;)Yw(e,t,n),n=n.sibling}function Yw(e,t,n){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(Iu,n)}catch{}switch(n.tag){case 5:Wt||ns(n,t);case 6:var o=Dt,c=Lr;Dt=null,Mn(e,t,n),Dt=o,Lr=c,Dt!==null&&(Lr?(e=Dt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dt.removeChild(n.stateNode));break;case 18:Dt!==null&&(Lr?(e=Dt,n=n.stateNode,e.nodeType===8?nf(e.parentNode,n):e.nodeType===1&&nf(e,n),Bo(e)):nf(Dt,n.stateNode));break;case 4:o=Dt,c=Lr,Dt=n.stateNode.containerInfo,Lr=!0,Mn(e,t,n),Dt=o,Lr=c;break;case 0:case 11:case 14:case 15:if(!Wt&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){c=o=o.next;do{var f=c,g=f.destroy;f=f.tag,g!==void 0&&(f&2||f&4)&&I1(n,t,g),c=c.next}while(c!==o)}Mn(e,t,n);break;case 1:if(!Wt&&(ns(n,t),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(m){ot(n,t,m)}Mn(e,t,n);break;case 21:Mn(e,t,n);break;case 22:n.mode&1?(Wt=(o=Wt)||n.memoizedState!==null,Mn(e,t,n),Wt=o):Mn(e,t,n);break;default:Mn(e,t,n)}}function Cp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ub),t.forEach(function(o){var c=vb.bind(null,e,o);n.has(o)||(n.add(o),o.then(c,c))})}}function Pr(e,t){var n=t.deletions;if(n!==null)for(var o=0;o<n.length;o++){var c=n[o];try{var f=e,g=t,m=g;e:for(;m!==null;){switch(m.tag){case 5:Dt=m.stateNode,Lr=!1;break e;case 3:Dt=m.stateNode.containerInfo,Lr=!0;break e;case 4:Dt=m.stateNode.containerInfo,Lr=!0;break e}m=m.return}if(Dt===null)throw Error(Z(160));Yw(f,g,c),Dt=null,Lr=!1;var v=c.alternate;v!==null&&(v.return=null),c.return=null}catch(x){ot(c,t,x)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Kw(t,e),t=t.sibling}function Kw(e,t){var n=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pr(t,e),Jr(e),o&4){try{Co(3,e,e.return),Mu(3,e)}catch(M){ot(e,e.return,M)}try{Co(5,e,e.return)}catch(M){ot(e,e.return,M)}}break;case 1:Pr(t,e),Jr(e),o&512&&n!==null&&ns(n,n.return);break;case 5:if(Pr(t,e),Jr(e),o&512&&n!==null&&ns(n,n.return),e.flags&32){var c=e.stateNode;try{Do(c,"")}catch(M){ot(e,e.return,M)}}if(o&4&&(c=e.stateNode,c!=null)){var f=e.memoizedProps,g=n!==null?n.memoizedProps:f,m=e.type,v=e.updateQueue;if(e.updateQueue=null,v!==null)try{m==="input"&&f.type==="radio"&&f.name!=null&&mm(c,f),qf(m,g);var x=qf(m,f);for(g=0;g<v.length;g+=2){var C=v[g],A=v[g+1];C==="style"?Cm(c,A):C==="dangerouslySetInnerHTML"?ym(c,A):C==="children"?Do(c,A):B0(c,C,A,x)}switch(m){case"input":Xf(c,f);break;case"textarea":wm(c,f);break;case"select":var I=c._wrapperState.wasMultiple;c._wrapperState.wasMultiple=!!f.multiple;var O=f.value;O!=null?ls(c,!!f.multiple,O,!1):I!==!!f.multiple&&(f.defaultValue!=null?ls(c,!!f.multiple,f.defaultValue,!0):ls(c,!!f.multiple,f.multiple?[]:"",!1))}c[Wo]=f}catch(M){ot(e,e.return,M)}}break;case 6:if(Pr(t,e),Jr(e),o&4){if(e.stateNode===null)throw Error(Z(162));c=e.stateNode,f=e.memoizedProps;try{c.nodeValue=f}catch(M){ot(e,e.return,M)}}break;case 3:if(Pr(t,e),Jr(e),o&4&&n!==null&&n.memoizedState.isDehydrated)try{Bo(t.containerInfo)}catch(M){ot(e,e.return,M)}break;case 4:Pr(t,e),Jr(e);break;case 13:Pr(t,e),Jr(e),c=e.child,c.flags&8192&&(f=c.memoizedState!==null,c.stateNode.isHidden=f,!f||c.alternate!==null&&c.alternate.memoizedState!==null||(pd=ut())),o&4&&Cp(e);break;case 22:if(C=n!==null&&n.memoizedState!==null,e.mode&1?(Wt=(x=Wt)||C,Pr(t,e),Wt=x):Pr(t,e),Jr(e),o&8192){if(x=e.memoizedState!==null,(e.stateNode.isHidden=x)&&!C&&e.mode&1)for(ie=e,C=e.child;C!==null;){for(A=ie=C;ie!==null;){switch(I=ie,O=I.child,I.tag){case 0:case 11:case 14:case 15:Co(4,I,I.return);break;case 1:ns(I,I.return);var k=I.stateNode;if(typeof k.componentWillUnmount=="function"){o=I,n=I.return;try{t=o,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(M){ot(o,n,M)}}break;case 5:ns(I,I.return);break;case 22:if(I.memoizedState!==null){Sp(A);continue}}O!==null?(O.return=I,ie=O):Sp(A)}C=C.sibling}e:for(C=null,A=e;;){if(A.tag===5){if(C===null){C=A;try{c=A.stateNode,x?(f=c.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none"):(m=A.stateNode,v=A.memoizedProps.style,g=v!=null&&v.hasOwnProperty("display")?v.display:null,m.style.display=Em("display",g))}catch(M){ot(e,e.return,M)}}}else if(A.tag===6){if(C===null)try{A.stateNode.nodeValue=x?"":A.memoizedProps}catch(M){ot(e,e.return,M)}}else if((A.tag!==22&&A.tag!==23||A.memoizedState===null||A===e)&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===e)break e;for(;A.sibling===null;){if(A.return===null||A.return===e)break e;C===A&&(C=null),A=A.return}C===A&&(C=null),A.sibling.return=A.return,A=A.sibling}}break;case 19:Pr(t,e),Jr(e),o&4&&Cp(e);break;case 21:break;default:Pr(t,e),Jr(e)}}function Jr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Xw(n)){var o=n;break e}n=n.return}throw Error(Z(160))}switch(o.tag){case 5:var c=o.stateNode;o.flags&32&&(Do(c,""),o.flags&=-33);var f=Ep(e);b1(e,f,c);break;case 3:case 4:var g=o.stateNode.containerInfo,m=Ep(e);R1(e,m,g);break;default:throw Error(Z(161))}}catch(v){ot(e,e.return,v)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fb(e,t,n){ie=e,Zw(e)}function Zw(e,t,n){for(var o=(e.mode&1)!==0;ie!==null;){var c=ie,f=c.child;if(c.tag===22&&o){var g=c.memoizedState!==null||Ya;if(!g){var m=c.alternate,v=m!==null&&m.memoizedState!==null||Wt;m=Ya;var x=Wt;if(Ya=g,(Wt=v)&&!x)for(ie=c;ie!==null;)g=ie,v=g.child,g.tag===22&&g.memoizedState!==null?Ip(c):v!==null?(v.return=g,ie=v):Ip(c);for(;f!==null;)ie=f,Zw(f),f=f.sibling;ie=c,Ya=m,Wt=x}Ap(e)}else c.subtreeFlags&8772&&f!==null?(f.return=c,ie=f):Ap(e)}}function Ap(e){for(;ie!==null;){var t=ie;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Wt||Mu(5,t);break;case 1:var o=t.stateNode;if(t.flags&4&&!Wt)if(n===null)o.componentDidMount();else{var c=t.elementType===t.type?n.memoizedProps:Br(t.type,n.memoizedProps);o.componentDidUpdate(c,n.memoizedState,o.__reactInternalSnapshotBeforeUpdate)}var f=t.updateQueue;f!==null&&ap(t,f,o);break;case 3:var g=t.updateQueue;if(g!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ap(t,g,n)}break;case 5:var m=t.stateNode;if(n===null&&t.flags&4){n=m;var v=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":v.autoFocus&&n.focus();break;case"img":v.src&&(n.src=v.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var x=t.alternate;if(x!==null){var C=x.memoizedState;if(C!==null){var A=C.dehydrated;A!==null&&Bo(A)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Z(163))}Wt||t.flags&512&&T1(t)}catch(I){ot(t,t.return,I)}}if(t===e){ie=null;break}if(n=t.sibling,n!==null){n.return=t.return,ie=n;break}ie=t.return}}function Sp(e){for(;ie!==null;){var t=ie;if(t===e){ie=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ie=n;break}ie=t.return}}function Ip(e){for(;ie!==null;){var t=ie;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Mu(4,t)}catch(v){ot(t,n,v)}break;case 1:var o=t.stateNode;if(typeof o.componentDidMount=="function"){var c=t.return;try{o.componentDidMount()}catch(v){ot(t,c,v)}}var f=t.return;try{T1(t)}catch(v){ot(t,f,v)}break;case 5:var g=t.return;try{T1(t)}catch(v){ot(t,g,v)}}}catch(v){ot(t,t.return,v)}if(t===e){ie=null;break}var m=t.sibling;if(m!==null){m.return=t.return,ie=m;break}ie=t.return}}var db=Math.ceil,Zl=Sn.ReactCurrentDispatcher,hd=Sn.ReactCurrentOwner,br=Sn.ReactCurrentBatchConfig,_e=0,Tt=null,gt=null,kt=0,dr=0,is=ti(0),yt=0,Xo=null,Ii=0,Pu=0,gd=0,Ao=null,ir=null,pd=0,Ss=1/0,cn=null,Ql=!1,_1=null,Xn=null,Ka=!1,Wn=null,ql=0,So=0,O1=null,ml=-1,wl=0;function Gt(){return _e&6?ut():ml!==-1?ml:ml=ut()}function Yn(e){return e.mode&1?_e&2&&kt!==0?kt&-kt:KR.transition!==null?(wl===0&&(wl=Pm()),wl):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:Wm(e.type)),e):1}function Wr(e,t,n,o){if(50<So)throw So=0,O1=null,Error(Z(185));ta(e,n,o),(!(_e&2)||e!==Tt)&&(e===Tt&&(!(_e&2)&&(Pu|=n),yt===4&&Ln(e,kt)),lr(e,o),n===1&&_e===0&&!(t.mode&1)&&(Ss=ut()+500,Ou&&ri()))}function lr(e,t){var n=e.callbackNode;KT(e,t);var o=kl(e,e===Tt?kt:0);if(o===0)n!==null&&Pg(n),e.callbackNode=null,e.callbackPriority=0;else if(t=o&-o,e.callbackPriority!==t){if(n!=null&&Pg(n),t===1)e.tag===0?YR(Tp.bind(null,e)):ow(Tp.bind(null,e)),zR(function(){!(_e&6)&&ri()}),n=null;else{switch(km(o)){case 1:n=W0;break;case 4:n=Dm;break;case 16:n=Pl;break;case 536870912:n=Mm;break;default:n=Pl}n=iv(n,Qw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Qw(e,t){if(ml=-1,wl=0,_e&6)throw Error(Z(327));var n=e.callbackNode;if(hs()&&e.callbackNode!==n)return null;var o=kl(e,e===Tt?kt:0);if(o===0)return null;if(o&30||o&e.expiredLanes||t)t=Jl(e,o);else{t=o;var c=_e;_e|=2;var f=Jw();(Tt!==e||kt!==t)&&(cn=null,Ss=ut()+500,wi(e,t));do try{pb();break}catch(m){qw(e,m)}while(!0);ed(),Zl.current=f,_e=c,gt!==null?t=0:(Tt=null,kt=0,t=yt)}if(t!==0){if(t===2&&(c=n1(e),c!==0&&(o=c,t=N1(e,c))),t===1)throw n=Xo,wi(e,0),Ln(e,o),lr(e,ut()),n;if(t===6)Ln(e,o);else{if(c=e.current.alternate,!(o&30)&&!hb(c)&&(t=Jl(e,o),t===2&&(f=n1(e),f!==0&&(o=f,t=N1(e,f))),t===1))throw n=Xo,wi(e,0),Ln(e,o),lr(e,ut()),n;switch(e.finishedWork=c,e.finishedLanes=o,t){case 0:case 1:throw Error(Z(345));case 2:di(e,ir,cn);break;case 3:if(Ln(e,o),(o&130023424)===o&&(t=pd+500-ut(),10<t)){if(kl(e,0)!==0)break;if(c=e.suspendedLanes,(c&o)!==o){Gt(),e.pingedLanes|=e.suspendedLanes&c;break}e.timeoutHandle=f1(di.bind(null,e,ir,cn),t);break}di(e,ir,cn);break;case 4:if(Ln(e,o),(o&4194240)===o)break;for(t=e.eventTimes,c=-1;0<o;){var g=31-jr(o);f=1<<g,g=t[g],g>c&&(c=g),o&=~f}if(o=c,o=ut()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*db(o/1960))-o,10<o){e.timeoutHandle=f1(di.bind(null,e,ir,cn),o);break}di(e,ir,cn);break;case 5:di(e,ir,cn);break;default:throw Error(Z(329))}}}return lr(e,ut()),e.callbackNode===n?Qw.bind(null,e):null}function N1(e,t){var n=Ao;return e.current.memoizedState.isDehydrated&&(wi(e,t).flags|=256),e=Jl(e,t),e!==2&&(t=ir,ir=n,t!==null&&D1(t)),e}function D1(e){ir===null?ir=e:ir.push.apply(ir,e)}function hb(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var o=0;o<n.length;o++){var c=n[o],f=c.getSnapshot;c=c.value;try{if(!$r(f(),c))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ln(e,t){for(t&=~gd,t&=~Pu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-jr(t),o=1<<n;e[n]=-1,t&=~o}}function Tp(e){if(_e&6)throw Error(Z(327));hs();var t=kl(e,0);if(!(t&1))return lr(e,ut()),null;var n=Jl(e,t);if(e.tag!==0&&n===2){var o=n1(e);o!==0&&(t=o,n=N1(e,o))}if(n===1)throw n=Xo,wi(e,0),Ln(e,t),lr(e,ut()),n;if(n===6)throw Error(Z(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,di(e,ir,cn),lr(e,ut()),null}function xd(e,t){var n=_e;_e|=1;try{return e(t)}finally{_e=n,_e===0&&(Ss=ut()+500,Ou&&ri())}}function Ti(e){Wn!==null&&Wn.tag===0&&!(_e&6)&&hs();var t=_e;_e|=1;var n=br.transition,o=Pe;try{if(br.transition=null,Pe=1,e)return e()}finally{Pe=o,br.transition=n,_e=t,!(_e&6)&&ri()}}function md(){dr=is.current,ze(is)}function wi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,VR(n)),gt!==null)for(n=gt.return;n!==null;){var o=n;switch(Q0(o),o.tag){case 1:o=o.type.childContextTypes,o!=null&&jl();break;case 3:Cs(),ze(or),ze($t),od();break;case 5:sd(o);break;case 4:Cs();break;case 13:ze(qe);break;case 19:ze(qe);break;case 10:td(o.type._context);break;case 22:case 23:md()}n=n.return}if(Tt=e,gt=e=Kn(e.current,null),kt=dr=t,yt=0,Xo=null,gd=Pu=Ii=0,ir=Ao=null,pi!==null){for(t=0;t<pi.length;t++)if(n=pi[t],o=n.interleaved,o!==null){n.interleaved=null;var c=o.next,f=n.pending;if(f!==null){var g=f.next;f.next=c,o.next=g}n.pending=o}pi=null}return e}function qw(e,t){do{var n=gt;try{if(ed(),gl.current=Kl,Yl){for(var o=Je.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}Yl=!1}if(Si=0,It=vt=Je=null,Eo=!1,zo=0,hd.current=null,n===null||n.return===null){yt=1,Xo=t,gt=null;break}e:{var f=e,g=n.return,m=n,v=t;if(t=kt,m.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){var x=v,C=m,A=C.tag;if(!(C.mode&1)&&(A===0||A===11||A===15)){var I=C.alternate;I?(C.updateQueue=I.updateQueue,C.memoizedState=I.memoizedState,C.lanes=I.lanes):(C.updateQueue=null,C.memoizedState=null)}var O=hp(g);if(O!==null){O.flags&=-257,gp(O,g,m,f,t),O.mode&1&&dp(f,x,t),t=O,v=x;var k=t.updateQueue;if(k===null){var M=new Set;M.add(v),t.updateQueue=M}else k.add(v);break e}else{if(!(t&1)){dp(f,x,t),wd();break e}v=Error(Z(426))}}else if(Ye&&m.mode&1){var G=hp(g);if(G!==null){!(G.flags&65536)&&(G.flags|=256),gp(G,g,m,f,t),q0(As(v,m));break e}}f=v=As(v,m),yt!==4&&(yt=2),Ao===null?Ao=[f]:Ao.push(f),f=g;do{switch(f.tag){case 3:f.flags|=65536,t&=-t,f.lanes|=t;var N=kw(f,v,t);op(f,N);break e;case 1:m=v;var T=f.type,_=f.stateNode;if(!(f.flags&128)&&(typeof T.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Xn===null||!Xn.has(_)))){f.flags|=65536,t&=-t,f.lanes|=t;var U=Bw(f,m,t);op(f,U);break e}}f=f.return}while(f!==null)}tv(n)}catch(z){t=z,gt===n&&n!==null&&(gt=n=n.return);continue}break}while(!0)}function Jw(){var e=Zl.current;return Zl.current=Kl,e===null?Kl:e}function wd(){(yt===0||yt===3||yt===2)&&(yt=4),Tt===null||!(Ii&268435455)&&!(Pu&268435455)||Ln(Tt,kt)}function Jl(e,t){var n=_e;_e|=2;var o=Jw();(Tt!==e||kt!==t)&&(cn=null,wi(e,t));do try{gb();break}catch(c){qw(e,c)}while(!0);if(ed(),_e=n,Zl.current=o,gt!==null)throw Error(Z(261));return Tt=null,kt=0,yt}function gb(){for(;gt!==null;)ev(gt)}function pb(){for(;gt!==null&&!jT();)ev(gt)}function ev(e){var t=nv(e.alternate,e,dr);e.memoizedProps=e.pendingProps,t===null?tv(e):gt=t,hd.current=null}function tv(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lb(n,t),n!==null){n.flags&=32767,gt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{yt=6,gt=null;return}}else if(n=ab(n,t,dr),n!==null){gt=n;return}if(t=t.sibling,t!==null){gt=t;return}gt=t=e}while(t!==null);yt===0&&(yt=5)}function di(e,t,n){var o=Pe,c=br.transition;try{br.transition=null,Pe=1,xb(e,t,n,o)}finally{br.transition=c,Pe=o}return null}function xb(e,t,n,o){do hs();while(Wn!==null);if(_e&6)throw Error(Z(327));n=e.finishedWork;var c=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Z(177));e.callbackNode=null,e.callbackPriority=0;var f=n.lanes|n.childLanes;if(ZT(e,f),e===Tt&&(gt=Tt=null,kt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ka||(Ka=!0,iv(Pl,function(){return hs(),null})),f=(n.flags&15990)!==0,n.subtreeFlags&15990||f){f=br.transition,br.transition=null;var g=Pe;Pe=1;var m=_e;_e|=4,hd.current=null,cb(e,n),Kw(n,e),BR(u1),Bl=!!l1,u1=l1=null,e.current=n,fb(n),WT(),_e=m,Pe=g,br.transition=f}else e.current=n;if(Ka&&(Ka=!1,Wn=e,ql=c),f=e.pendingLanes,f===0&&(Xn=null),zT(n.stateNode),lr(e,ut()),t!==null)for(o=e.onRecoverableError,n=0;n<t.length;n++)c=t[n],o(c.value,{componentStack:c.stack,digest:c.digest});if(Ql)throw Ql=!1,e=_1,_1=null,e;return ql&1&&e.tag!==0&&hs(),f=e.pendingLanes,f&1?e===O1?So++:(So=0,O1=e):So=0,ri(),null}function hs(){if(Wn!==null){var e=km(ql),t=br.transition,n=Pe;try{if(br.transition=null,Pe=16>e?16:e,Wn===null)var o=!1;else{if(e=Wn,Wn=null,ql=0,_e&6)throw Error(Z(331));var c=_e;for(_e|=4,ie=e.current;ie!==null;){var f=ie,g=f.child;if(ie.flags&16){var m=f.deletions;if(m!==null){for(var v=0;v<m.length;v++){var x=m[v];for(ie=x;ie!==null;){var C=ie;switch(C.tag){case 0:case 11:case 15:Co(8,C,f)}var A=C.child;if(A!==null)A.return=C,ie=A;else for(;ie!==null;){C=ie;var I=C.sibling,O=C.return;if(Gw(C),C===x){ie=null;break}if(I!==null){I.return=O,ie=I;break}ie=O}}}var k=f.alternate;if(k!==null){var M=k.child;if(M!==null){k.child=null;do{var G=M.sibling;M.sibling=null,M=G}while(M!==null)}}ie=f}}if(f.subtreeFlags&2064&&g!==null)g.return=f,ie=g;else e:for(;ie!==null;){if(f=ie,f.flags&2048)switch(f.tag){case 0:case 11:case 15:Co(9,f,f.return)}var N=f.sibling;if(N!==null){N.return=f.return,ie=N;break e}ie=f.return}}var T=e.current;for(ie=T;ie!==null;){g=ie;var _=g.child;if(g.subtreeFlags&2064&&_!==null)_.return=g,ie=_;else e:for(g=T;ie!==null;){if(m=ie,m.flags&2048)try{switch(m.tag){case 0:case 11:case 15:Mu(9,m)}}catch(z){ot(m,m.return,z)}if(m===g){ie=null;break e}var U=m.sibling;if(U!==null){U.return=m.return,ie=U;break e}ie=m.return}}if(_e=c,ri(),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(Iu,e)}catch{}o=!0}return o}finally{Pe=n,br.transition=t}}return!1}function Rp(e,t,n){t=As(n,t),t=kw(e,t,1),e=Gn(e,t,1),t=Gt(),e!==null&&(ta(e,1,t),lr(e,t))}function ot(e,t,n){if(e.tag===3)Rp(e,e,n);else for(;t!==null;){if(t.tag===3){Rp(t,e,n);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Xn===null||!Xn.has(o))){e=As(n,e),e=Bw(t,e,1),t=Gn(t,e,1),e=Gt(),t!==null&&(ta(t,1,e),lr(t,e));break}}t=t.return}}function mb(e,t,n){var o=e.pingCache;o!==null&&o.delete(t),t=Gt(),e.pingedLanes|=e.suspendedLanes&n,Tt===e&&(kt&n)===n&&(yt===4||yt===3&&(kt&130023424)===kt&&500>ut()-pd?wi(e,0):gd|=n),lr(e,t)}function rv(e,t){t===0&&(e.mode&1?(t=Ua,Ua<<=1,!(Ua&130023424)&&(Ua=4194304)):t=1);var n=Gt();e=yn(e,t),e!==null&&(ta(e,t,n),lr(e,n))}function wb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rv(e,n)}function vb(e,t){var n=0;switch(e.tag){case 13:var o=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(Z(314))}o!==null&&o.delete(t),rv(e,n)}var nv;nv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||or.current)sr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return sr=!1,ob(e,t,n);sr=!!(e.flags&131072)}else sr=!1,Ye&&t.flags&1048576&&aw(t,Vl,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;xl(e,t),e=t.pendingProps;var c=vs(t,$t.current);ds(t,n),c=ld(null,t,o,e,c,n);var f=ud();return t.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ar(o)?(f=!0,Wl(t)):f=!1,t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,nd(t),c.updater=Du,t.stateNode=c,c._reactInternals=t,w1(t,o,e,n),t=E1(null,t,o,!0,f,n)):(t.tag=0,Ye&&f&&Z0(t),Ht(null,t,c,n),t=t.child),t;case 16:o=t.elementType;e:{switch(xl(e,t),e=t.pendingProps,c=o._init,o=c(o._payload),t.type=o,c=t.tag=Eb(o),e=Br(o,e),c){case 0:t=y1(null,t,o,e,n);break e;case 1:t=mp(null,t,o,e,n);break e;case 11:t=pp(null,t,o,e,n);break e;case 14:t=xp(null,t,o,Br(o.type,e),n);break e}throw Error(Z(306,o,""))}return t;case 0:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),y1(e,t,o,c,n);case 1:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),mp(e,t,o,c,n);case 3:e:{if(jw(t),e===null)throw Error(Z(387));o=t.pendingProps,f=t.memoizedState,c=f.element,hw(e,t),Gl(t,o,null,n);var g=t.memoizedState;if(o=g.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){c=As(Error(Z(423)),t),t=wp(e,t,o,n,c);break e}else if(o!==c){c=As(Error(Z(424)),t),t=wp(e,t,o,n,c);break e}else for(hr=Hn(t.stateNode.containerInfo.firstChild),gr=t,Ye=!0,Ur=null,n=fw(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ys(),o===c){t=En(e,t,n);break e}Ht(e,t,o,n)}t=t.child}return t;case 5:return gw(t),e===null&&p1(t),o=t.type,c=t.pendingProps,f=e!==null?e.memoizedProps:null,g=c.children,c1(o,c)?g=null:f!==null&&c1(o,f)&&(t.flags|=32),Uw(e,t),Ht(e,t,g,n),t.child;case 6:return e===null&&p1(t),null;case 13:return Ww(e,t,n);case 4:return id(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Es(t,null,o,n):Ht(e,t,o,n),t.child;case 11:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),pp(e,t,o,c,n);case 7:return Ht(e,t,t.pendingProps,n),t.child;case 8:return Ht(e,t,t.pendingProps.children,n),t.child;case 12:return Ht(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(o=t.type._context,c=t.pendingProps,f=t.memoizedProps,g=c.value,We(zl,o._currentValue),o._currentValue=g,f!==null)if($r(f.value,g)){if(f.children===c.children&&!or.current){t=En(e,t,n);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var m=f.dependencies;if(m!==null){g=f.child;for(var v=m.firstContext;v!==null;){if(v.context===o){if(f.tag===1){v=pn(-1,n&-n),v.tag=2;var x=f.updateQueue;if(x!==null){x=x.shared;var C=x.pending;C===null?v.next=v:(v.next=C.next,C.next=v),x.pending=v}}f.lanes|=n,v=f.alternate,v!==null&&(v.lanes|=n),x1(f.return,n,t),m.lanes|=n;break}v=v.next}}else if(f.tag===10)g=f.type===t.type?null:f.child;else if(f.tag===18){if(g=f.return,g===null)throw Error(Z(341));g.lanes|=n,m=g.alternate,m!==null&&(m.lanes|=n),x1(g,n,t),g=f.sibling}else g=f.child;if(g!==null)g.return=f;else for(g=f;g!==null;){if(g===t){g=null;break}if(f=g.sibling,f!==null){f.return=g.return,g=f;break}g=g.return}f=g}Ht(e,t,c.children,n),t=t.child}return t;case 9:return c=t.type,o=t.pendingProps.children,ds(t,n),c=_r(c),o=o(c),t.flags|=1,Ht(e,t,o,n),t.child;case 14:return o=t.type,c=Br(o,t.pendingProps),c=Br(o.type,c),xp(e,t,o,c,n);case 15:return Lw(e,t,t.type,t.pendingProps,n);case 17:return o=t.type,c=t.pendingProps,c=t.elementType===o?c:Br(o,c),xl(e,t),t.tag=1,ar(o)?(e=!0,Wl(t)):e=!1,ds(t,n),Pw(t,o,c),w1(t,o,c,n),E1(null,t,o,!0,e,n);case 19:return $w(e,t,n);case 22:return Fw(e,t,n)}throw Error(Z(156,t.tag))};function iv(e,t){return Nm(e,t)}function yb(e,t,n,o){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rr(e,t,n,o){return new yb(e,t,n,o)}function vd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Eb(e){if(typeof e=="function")return vd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===F0)return 11;if(e===U0)return 14}return 2}function Kn(e,t){var n=e.alternate;return n===null?(n=Rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function vl(e,t,n,o,c,f){var g=2;if(o=e,typeof e=="function")vd(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case Yi:return vi(n.children,c,f,t);case L0:g=8,c|=8;break;case $f:return e=Rr(12,n,t,c|2),e.elementType=$f,e.lanes=f,e;case Vf:return e=Rr(13,n,t,c),e.elementType=Vf,e.lanes=f,e;case zf:return e=Rr(19,n,t,c),e.elementType=zf,e.lanes=f,e;case gm:return ku(n,c,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dm:g=10;break e;case hm:g=9;break e;case F0:g=11;break e;case U0:g=14;break e;case Pn:g=16,o=null;break e}throw Error(Z(130,e==null?e:typeof e,""))}return t=Rr(g,n,t,c),t.elementType=e,t.type=o,t.lanes=f,t}function vi(e,t,n,o){return e=Rr(7,e,o,t),e.lanes=n,e}function ku(e,t,n,o){return e=Rr(22,e,o,t),e.elementType=gm,e.lanes=n,e.stateNode={isHidden:!1},e}function df(e,t,n){return e=Rr(6,e,null,t),e.lanes=n,e}function hf(e,t,n){return t=Rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cb(e,t,n,o,c){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gc(0),this.expirationTimes=Gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gc(0),this.identifierPrefix=o,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function yd(e,t,n,o,c,f,g,m,v){return e=new Cb(e,t,n,m,v),t===1?(t=1,f===!0&&(t|=8)):t=0,f=Rr(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nd(f),e}function Ab(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Xi,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}function sv(e){if(!e)return Qn;e=e._reactInternals;e:{if(Oi(e)!==e||e.tag!==1)throw Error(Z(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ar(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Z(171))}if(e.tag===1){var n=e.type;if(ar(n))return sw(e,n,t)}return t}function ov(e,t,n,o,c,f,g,m,v){return e=yd(n,o,!0,e,c,f,g,m,v),e.context=sv(null),n=e.current,o=Gt(),c=Yn(n),f=pn(o,c),f.callback=t??null,Gn(n,f,c),e.current.lanes=c,ta(e,c,o),lr(e,o),e}function Bu(e,t,n,o){var c=t.current,f=Gt(),g=Yn(c);return n=sv(n),t.context===null?t.context=n:t.pendingContext=n,t=pn(f,g),t.payload={element:e},o=o===void 0?null:o,o!==null&&(t.callback=o),e=Gn(c,t,g),e!==null&&(Wr(e,c,g,f),hl(e,c,g)),g}function eu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function bp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ed(e,t){bp(e,t),(e=e.alternate)&&bp(e,t)}function Sb(){return null}var av=typeof reportError=="function"?reportError:function(e){console.error(e)};function Cd(e){this._internalRoot=e}Lu.prototype.render=Cd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Z(409));Bu(e,t,null,null)};Lu.prototype.unmount=Cd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ti(function(){Bu(null,e,null,null)}),t[vn]=null}};function Lu(e){this._internalRoot=e}Lu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fm();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Bn.length&&t!==0&&t<Bn[n].priority;n++);Bn.splice(n,0,e),n===0&&jm(e)}};function Ad(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Fu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function _p(){}function Ib(e,t,n,o,c){if(c){if(typeof o=="function"){var f=o;o=function(){var x=eu(g);f.call(x)}}var g=ov(t,o,e,0,null,!1,!1,"",_p);return e._reactRootContainer=g,e[vn]=g.current,Uo(e.nodeType===8?e.parentNode:e),Ti(),g}for(;c=e.lastChild;)e.removeChild(c);if(typeof o=="function"){var m=o;o=function(){var x=eu(v);m.call(x)}}var v=yd(e,0,!1,null,null,!1,!1,"",_p);return e._reactRootContainer=v,e[vn]=v.current,Uo(e.nodeType===8?e.parentNode:e),Ti(function(){Bu(t,v,n,o)}),v}function Uu(e,t,n,o,c){var f=n._reactRootContainer;if(f){var g=f;if(typeof c=="function"){var m=c;c=function(){var v=eu(g);m.call(v)}}Bu(t,g,e,c)}else g=Ib(n,t,e,c,o);return eu(g)}Bm=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=uo(t.pendingLanes);n!==0&&($0(t,n|1),lr(t,ut()),!(_e&6)&&(Ss=ut()+500,ri()))}break;case 13:Ti(function(){var o=yn(e,1);if(o!==null){var c=Gt();Wr(o,e,1,c)}}),Ed(e,1)}};V0=function(e){if(e.tag===13){var t=yn(e,134217728);if(t!==null){var n=Gt();Wr(t,e,134217728,n)}Ed(e,134217728)}};Lm=function(e){if(e.tag===13){var t=Yn(e),n=yn(e,t);if(n!==null){var o=Gt();Wr(n,e,t,o)}Ed(e,t)}};Fm=function(){return Pe};Um=function(e,t){var n=Pe;try{return Pe=e,t()}finally{Pe=n}};e1=function(e,t,n){switch(t){case"input":if(Xf(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var o=n[t];if(o!==e&&o.form===e.form){var c=_u(o);if(!c)throw Error(Z(90));xm(o),Xf(o,c)}}}break;case"textarea":wm(e,n);break;case"select":t=n.value,t!=null&&ls(e,!!n.multiple,t,!1)}};Im=xd;Tm=Ti;var Tb={usingClientEntryPoint:!1,Events:[na,qi,_u,Am,Sm,xd]},no={findFiberByHostInstance:gi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Rb={bundleType:no.bundleType,version:no.version,rendererPackageName:no.rendererPackageName,rendererConfig:no.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Sn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=_m(e),e===null?null:e.stateNode},findFiberByHostInstance:no.findFiberByHostInstance||Sb,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{Iu=Za.inject(Rb),nn=Za}catch{}}wr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tb;wr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ad(t))throw Error(Z(200));return Ab(e,t,null,n)};wr.createRoot=function(e,t){if(!Ad(e))throw Error(Z(299));var n=!1,o="",c=av;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=yd(e,1,!1,null,null,n,!1,o,c),e[vn]=t.current,Uo(e.nodeType===8?e.parentNode:e),new Cd(t)};wr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Z(188)):(e=Object.keys(e).join(","),Error(Z(268,e)));return e=_m(t),e=e===null?null:e.stateNode,e};wr.flushSync=function(e){return Ti(e)};wr.hydrate=function(e,t,n){if(!Fu(t))throw Error(Z(200));return Uu(null,e,t,!0,n)};wr.hydrateRoot=function(e,t,n){if(!Ad(e))throw Error(Z(405));var o=n!=null&&n.hydratedSources||null,c=!1,f="",g=av;if(n!=null&&(n.unstable_strictMode===!0&&(c=!0),n.identifierPrefix!==void 0&&(f=n.identifierPrefix),n.onRecoverableError!==void 0&&(g=n.onRecoverableError)),t=ov(t,null,e,1,n??null,c,!1,f,g),e[vn]=t.current,Uo(e),o)for(e=0;e<o.length;e++)n=o[e],c=n._getVersion,c=c(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,c]:t.mutableSourceEagerHydrationData.push(n,c);return new Lu(t)};wr.render=function(e,t,n){if(!Fu(t))throw Error(Z(200));return Uu(null,e,t,!1,n)};wr.unmountComponentAtNode=function(e){if(!Fu(e))throw Error(Z(40));return e._reactRootContainer?(Ti(function(){Uu(null,null,e,!1,function(){e._reactRootContainer=null,e[vn]=null})}),!0):!1};wr.unstable_batchedUpdates=xd;wr.unstable_renderSubtreeIntoContainer=function(e,t,n,o){if(!Fu(n))throw Error(Z(200));if(e==null||e._reactInternals===void 0)throw Error(Z(38));return Uu(e,t,n,!1,o)};wr.version="18.3.1-next-f1338f8080-20240426";function lv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lv)}catch(e){console.error(e)}}lv(),lm.exports=wr;var uv=lm.exports;function bb({message:e,showGuidance:t,windows:n,onClose:o}){const c=ht.useRef(null);return ht.useEffect(()=>{var f;(f=c.current)==null||f.showModal()},[]),uv.createPortal(ee.jsx("dialog",{ref:c,"aria-label":"远程桌面提醒",onCancel:o,onClick:f=>{f.target===f.currentTarget&&o()},style:{margin:"auto",inset:0,width:"min(370px, calc(100vw - 32px))",maxHeight:"calc(100dvh - 32px)",overflowY:"auto",padding:0,borderRadius:12,border:"1px solid var(--border-default)",background:"var(--bg-surface, white)",color:"var(--text-primary)",fontSize:14,lineHeight:1.7},children:ee.jsxs("div",{style:{padding:20},children:[ee.jsx("strong",{children:"远程桌面提醒"}),ee.jsx("p",{children:e}),t&&ee.jsxs(ee.Fragment,{children:[ee.jsx("p",{children:"请在电脑上打开远程桌面授权页面,点击“远程授权”(盾牌图标)。"}),ee.jsx("p",{children:n?"在 Windows 电脑上点击“开启共享”,并保持用户已登录、桌面未锁定。完成后此处会自动更新。":"在系统设置中为 AgentRoam Remote Desktop 开启“屏幕录制”和“辅助功能”权限,然后点击“开启共享”。完成后此处会自动更新。"})]}),ee.jsx("button",{type:"button",className:"ui-quiet-button",onClick:o,autoFocus:!0,children:"知道了"})]})}),document.body)}function _b(){const[e,t]=ht.useState(null),[n,o]=ht.useState(!1),[c,f]=ht.useState(!1),[g,m]=ht.useState(""),v=["127.0.0.1","localhost","[::1]"].includes(location.hostname),x=!/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);ht.useEffect(()=>{let I=!0;const O=async()=>{try{const M=await fetch(x&&v?"/api/remote-authorization":"/api/remote-authorization/status",{credentials:"same-origin",cache:"no-store"});if(!M.ok)return;const G=await M.json();I&&t(G)}catch{}};O();const k=setInterval(O,2e3);return()=>{I=!1,clearInterval(k)}},[x,v]);const C=(e==null?void 0:e.platform)==="win32";if(!x){if(!e||e.online&&e.accessibility)return null;const I=e.supported?e.installed?e.enabled?C&&e.locked&&e.unlock==="available"?"Windows 已锁屏。打开「远程桌面」并选择本机桌面,即可唤醒屏幕或输入密码/PIN 解锁。":C&&e.locked?"Windows 已锁屏,但远程解锁服务尚未安装。请在电脑上运行 agentroam unlock-service install。":e.locked?"macOS 已锁屏。打开「远程桌面」并选择本机桌面会自动唤醒屏幕,随后可在锁屏画面输入密码。":!e.screen||!e.accessibility?C?"Windows 桌面暂不可用,请检查 UAC 提示或登录状态。":"电脑的远程桌面授权尚未完成。":"电脑桌面正在连接,请稍候。":"电脑尚未开启桌面共享,请在电脑上完成授权并开启共享。":"电脑缺少远程桌面组件,请在电脑上升级 CLI。":"这台电脑暂不支持远程桌面。";return ee.jsxs("div",{className:"remote-desktop-guidance",children:[ee.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"查看远程桌面提醒","aria-haspopup":"dialog","aria-expanded":n,onClick:()=>o(!0),style:{color:"var(--warning, #d97706)",minWidth:44,minHeight:44},children:ee.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ee.jsx("circle",{cx:"12",cy:"12",r:"9"}),ee.jsx("path",{d:"M12 7v6m0 4h.01"})]})}),n&&ee.jsx(bb,{windows:C,message:I,showGuidance:e.supported&&e.installed&&(!e.enabled||!e.screen||!e.accessibility),onClose:()=>o(!1)})]})}if(!v)return ee.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ee.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:ee.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ee.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ee.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&ee.jsxs("section",{"aria-label":"远程授权设置",style:{position:"absolute",top:40,left:0,width:"min(370px, 70vw)",zIndex:30,padding:18,borderRadius:12,background:"var(--bg-surface, white)",border:"1px solid var(--border-default)",boxShadow:"0 10px 40px #0003",fontSize:13},children:[ee.jsx("strong",{children:"远程授权"}),ee.jsx("p",{style:{lineHeight:1.6},children:"请在运行 CLI 的电脑上打开终端显示的本机地址,完成配对并开启桌面共享。"}),ee.jsxs("p",{children:["在电脑终端运行 ",ee.jsx("code",{children:"agentroam service status"})," 查看本机地址。"]}),ee.jsx("p",{style:{lineHeight:1.6},children:"如果你正在另一台电脑上查看,请到运行 CLI 的电脑操作。授权完成后,可回到当前页面查看画面。"})]})]});if(!(e!=null&&e.local))return null;const A=async(I,O)=>{f(!0),m("");try{const k=await fetch("/api/remote-authorization",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({action:I,permission:O})}),M=await k.json();if(!k.ok)throw new Error(M.error||"操作失败");t(M)}catch(k){m(k instanceof Error?k.message:"操作失败")}finally{f(!1)}};return ee.jsxs("div",{style:{position:"relative",marginLeft:12},children:[ee.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>o(!n),"aria-expanded":n,"aria-label":"远程授权",title:"远程授权",children:ee.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ee.jsx("path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"}),ee.jsx("path",{d:"m9 12 2 2 4-4"})]})}),n&&ee.jsxs("section",{"aria-label":"远程授权设置",style:{position:"absolute",top:40,left:0,width:"min(370px, 70vw)",zIndex:30,padding:18,borderRadius:12,background:"var(--bg-surface, white)",color:"var(--text-primary)",border:"1px solid var(--border-default)",boxShadow:"0 10px 40px #0003",fontSize:13},children:[ee.jsx("strong",{children:"远程授权"}),ee.jsx("p",{style:{lineHeight:1.6,margin:"10px 0"},children:C?"开启后,已配对设备可查看桌面;接管后可使用鼠标和键盘。":"在系统设置中允许「AgentRoam Remote Desktop」。屏幕录制用于手机查看,辅助功能用于鼠标键盘控制。"}),e.supported?e.installed?ee.jsxs(ee.Fragment,{children:[!C&&["screen","accessibility"].map(I=>ee.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,margin:"12px 0"},children:[ee.jsxs("span",{children:[I==="screen"?"屏幕录制":"辅助功能",":",e[I]?"已授权":"待授权"]}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("authorize",I),children:"去授权"})]},I)),ee.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A(e.enabled?"disable":"enable"),children:e.enabled?"停止共享":"开启共享"}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("recheck"),children:"重新检测"}),ee.jsx("button",{type:"button",className:"ui-icon-button ui-icon-button--auto",disabled:c,onClick:()=>void A("restart"),children:"重启授权组件"})]}),C&&ee.jsxs("p",{style:{fontSize:12,lineHeight:1.6},children:["远程解锁服务:",e.unlock==="available"?"已安装,可在锁屏后远程唤醒和解锁。":"未安装;在 Windows 终端运行 agentroam unlock-service install 后可启用。"]}),ee.jsx("p",{role:"status",style:{marginTop:12},children:e.online?"共享已开启,已配对手机可在直播列表选择本机桌面。":e.enabled?"等待桌面可用或首帧画面…":"尚未开启共享。"}),ee.jsx("p",{style:{fontSize:12,lineHeight:1.6},children:C?"Windows 锁屏后直播入口会保留,可唤醒屏幕或远程解锁;UAC 安全桌面和未登录状态仍不支持控制。":"授权后会自动继续。系统要求重新打开应用时,点击“重启授权组件”。"})]}):ee.jsx("p",{children:"当前 CLI 未包含远程授权组件,请升级 CLI。"}):ee.jsx("p",{children:"目前支持 Windows 10/11 x64 和 macOS 14 及以上的 Apple Silicon 电脑。"}),(g||e.error)&&ee.jsx("p",{role:"alert",style:{color:"var(--danger, #c33)"},children:g||e.error})]})]})}var cv,Op=uv;cv=Op.createRoot,Op.hydrateRoot;class Ob extends Error{constructor(){super("未登录或会话已过期"),this.name="UnauthorizedError"}}class Nb extends Error{constructor(t,n,o){super(n),this.status=t,this.code=o,this.name="ApiError"}}class Db{constructor(t=(...o)=>fetch(...o),n=""){this.transport=t,this.baseUrl=n}setBaseUrl(t){this.baseUrl=t.replace(/\/+$/,"")}resolve(t){return this.baseUrl+t}async get(t,n){return this.request(t,{method:"GET",headers:n==null?void 0:n.headers})}async post(t,n,o){return this.request(t,{method:"POST",headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)})}async patch(t,n,o){return this.request(t,{method:"PATCH",headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)})}async put(t,n,o){return this.request(t,{method:"PUT",headers:{"content-type":"application/json",...o==null?void 0:o.headers},body:n===void 0?void 0:JSON.stringify(n)})}async delete(t,n){return this.request(t,{method:"DELETE",headers:n==null?void 0:n.headers})}async request(t,n){var c;const o=await this.transport(this.resolve(t),{credentials:"same-origin",cache:"no-store",...n});if(o.status===401||o.status===423)throw window.dispatchEvent(new CustomEvent("webapp:unauthorized")),new Ob;if(!o.ok){let f=`请求失败 (${o.status})`,g;try{const m=await o.json();typeof m.error=="string"?f=m.error:(c=m.error)!=null&&c.message&&(f=m.error.message),typeof m.code=="string"&&(g=m.code)}catch{}throw new Nb(o.status,f,g)}if(o.status!==204)return await o.json()}}const Mb=30,Pb=20,kb=2e3;function Np(e){var t,n;if(e instanceof Error)return{name:e.name,message:e.message,stack:(t=e.stack)==null?void 0:t.slice(0,8e3)};if(typeof e=="string")return{name:"Error",message:e};try{return{name:"NonError",message:((n=JSON.stringify(e))==null?void 0:n.slice(0,2e3))??String(e)}}catch{return{name:"NonError",message:String(e)}}}function Bb(e={}){const t=e.source??"webapp",n=()=>((typeof e.baseUrl=="function"?e.baseUrl():e.baseUrl)??"").replace(/\/+$/,""),o=[];let c=null,f=!1,g=!1;const m=()=>{if(g||f||o.length===0)return;const I=o.splice(0,Pb);f=!0;const O=JSON.stringify({entries:I});fetch(`${n()}/api/client-logs`,{method:"POST",headers:{"content-type":"application/json"},body:O,keepalive:!0}).catch(()=>{}).finally(()=>{f=!1,o.length>0&&v()})},v=()=>{c!==null||g||(c=setTimeout(()=>{c=null,m()},kb))},x=I=>{g||(o.length>=Mb&&o.shift(),o.push(I),v())},C=I=>{var O;x({level:"error",message:I.message||"window error",source:t,error:{name:"Error",message:I.message||"window error",stack:[I.filename?`${I.filename}:${I.lineno}:${I.colno}`:"",((O=I.error)==null?void 0:O.stack)??""].filter(Boolean).join(`
|
|
58
|
-
`).slice(0,8e3)||void 0},data:{filename:I.filename,lineno:I.lineno,colno:I.colno}})},A=I=>{const O=Np(I.reason);x({level:"error",message:`unhandledRejection: ${O.message}`,source:t,error:O})};return window.addEventListener("error",C),window.addEventListener("unhandledrejection",A),{reportError:(I,O)=>{const k=Np(I);x({level:"error",message:k.message,source:t,error:k,data:O})},reportWarning:(I,O)=>{x({level:"warn",message:I,source:t,data:O})},uninstall:()=>{g=!0,c!==null&&(clearTimeout(c),c=null),window.removeEventListener("error",C),window.removeEventListener("unhandledrejection",A)}}}const gf="<think>",pf="</think>";function Dp(e,t){const n=Math.min(t.length-1,e.length);for(let o=n;o>0;o--)if(e.endsWith(t.slice(0,o)))return o;return 0}function io(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class Lb{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let n="";for(;;){if(this.dropping){const c=this.buffer.indexOf(pf);if(c===-1){const f=Dp(this.buffer,pf);return this.buffer=this.buffer.slice(this.buffer.length-f),n}this.buffer=this.buffer.slice(c+pf.length),this.dropping=!1;continue}const o=this.buffer.indexOf(gf);if(o===-1){const c=Dp(this.buffer,gf);return n+=this.buffer.slice(0,this.buffer.length-c),this.buffer=this.buffer.slice(this.buffer.length-c),n}n+=this.buffer.slice(0,o),this.buffer=this.buffer.slice(o+gf.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const Fb=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,Ub=50,jb=1e3,Wb=2e3;function Mp(e){return e instanceof Error&&e.name!=="AbortError"&&Fb.test(e.message.trim())}class $b{constructor(t,n,o,c=f=>new EventSource(f)){this.http=t,this.settings=n,this.projectBridge=o,this.createEventSource=c,this.streams=new Map,this.nativeStreamCursors=new Map,this.nativeFinalAnswerSnapshots=new Map,this.pendingRuns=new Map,this.listeners=new Set,this.thinkFilters=new Map,this.bufferedStreamText=new Map,this.ordinaryRunRecoveryTimers=new Map,this.ordinaryRunStreamText=new Map,this.nativeRunRecoveries=new Map,this.nativeRunIdentities=new Map}requireProjectBridge(){if(this.projectBridge)return this.projectBridge;throw Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"})}onEvent(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}async run(t,n,o,c,f,g){var O,k;const m=n.startsWith("runtime:"),v=this.streams.has(n),x=this.pendingRuns.has(n),C=this.nativeStreamCursors.get(n);m&&!x&&this.beginNativeRunRecovery(n,void 0,!0);let A=null,I=null;try{m||await this.openStream(n,this.nativeStreamCursors.get(n)),I=x?null:new Promise(G=>{A=G,this.pendingRuns.set(n,G)}),m||this.ordinaryRunStreamText.set(n,"");const M=await this.http.post("/api/agent/run",{input:t,sessionId:n,...f!=null&&f.length?{images:f}:{},...o!=null&&o.length?{agentIds:o}:{},...!m&&(g!=null&&g.profileId)?{profileId:g.profileId}:{},...(O=g==null?void 0:g.model)!=null&&O.id?{nativeModel:g.model}:{},...g!=null&&g.reasoningEffort?{nativeReasoningEffort:g.reasoningEffort}:{}});if(m||this.startOrdinaryRunRecovery(n),m){const G=this.nativeRunRecoveries.get(n);G&&(G.awaitingAdmission=!1,G.runId=typeof M.runId=="string"?M.runId:void 0);const N=typeof M.runId=="string"&&(C==null?void 0:C.runId)!==M.runId?{sequence:0,runId:M.runId}:C??{sequence:0,...typeof M.runId=="string"?{runId:M.runId}:{}};await this.openStream(n,N,{waitForOpen:!1})}this.dispatch(n,{type:"run_admitted",...typeof M.runId=="string"?{_nativeRunId:M.runId}:{}}),I&&await I}catch(M){const G=!x&&m&&Mp(M)?await this.recoverNativeAdmission(n,C):null;if(G){const U=this.nativeRunRecoveries.get(n);return U&&(U.awaitingAdmission=!1,U.runId=G.runId),await this.openStream(n,G,{waitForOpen:!1}),I&&await I,[]}const N=M.code,T=typeof N=="string"?N:M.status===409?"SESSION_OCCUPIED":void 0;m&&T==="SESSION_ALREADY_RUNNING"&&await this.openStream(n,C??{sequence:0},{waitForOpen:!1});const _=v||x||T==="SESSION_ALREADY_RUNNING";if(m&&_){const U=this.nativeRunRecoveries.get(n);U&&(U.awaitingAdmission=!1),this.startNativeRunRecovery(n,(k=this.nativeStreamCursors.get(n))==null?void 0:k.runId)}this.dispatch(n,{type:"error",message:Mp(M)?"网络连接中断,消息未确认发送,请重试":M instanceof Error?M.message:"无法启动运行",...T?{code:T}:{},..._?{_preserveActiveRun:!0}:{}}),_?A&&this.pendingRuns.get(n)===A&&this.pendingRuns.delete(n):(this.closeStream(n),this.settle(n))}return[]}async recoverNativeAdmission(t,n){const o=this.nativeStreamCursors.get(t);if(o!=null&&o.runId&&o.runId!==(n==null?void 0:n.runId))return this.dispatchRecoveredAdmission(t,o),o;try{const c=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`),f=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,g=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,m=!!(f&&(n!=null&&n.runId)&&f!==n.runId),v=!!(f&&!(n!=null&&n.runId)&&c.status==="running");return!m&&!v?null:(this.dispatchRecoveredAdmission(t,{runId:f,sequence:g}),{runId:f,sequence:0})}catch{return null}}dispatchRecoveredAdmission(t,n){this.dispatch(t,{type:"run_admitted",...n.runId?{_nativeRunId:n.runId}:{}})}async steer(t,n,o){return(await this.http.post("/api/agent/steer",{input:t,sessionId:n})).steered||this.run(t,n).catch(()=>{}),!0}async steerSessionMessage(t,n){const o=await this.http.post("/api/agent/steer",{sessionId:t,messageId:n});if(!o.steered)throw new Error("当前运行不支持插队消息");return o.state}async abort(t){try{await this.http.post("/api/agent/abort",t?{sessionId:t}:{})}finally{for(const n of[...this.pendingRuns.keys()])this.settle(n);for(const n of[...this.streams.keys()])this.closeStream(n);for(const n of[...this.nativeRunRecoveries.keys()])this.stopNativeRunRecovery(n)}}async answerQuestion(t,n,o){try{return await this.http.post("/api/agent/answer",{questionId:t,answer:n,selectedIndices:o}),!0}catch{return!1}}async listSessions(t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return this.http.get(`/api/sessions${n}`)}async listAgentWorkspaces(t,n={}){const o=new URLSearchParams({agentType:t});return n.cursor&&o.set("cursor",n.cursor),n.limit!==void 0&&o.set("limit",String(n.limit)),n.refresh&&o.set("refresh","1"),n.since&&o.set("since",n.since),this.http.get(`/api/agent-workspaces?${o.toString()}`)}async importAgentWorkspace(t,n,o){return this.http.post("/api/agent-workspaces",{agentType:t,path:n,...o?{name:o}:{}})}async listAgentWorkspaceSessions(t,n,o={}){const c=new URLSearchParams({agentType:t});return o.cursor&&c.set("cursor",o.cursor),o.limit!==void 0&&c.set("limit",String(o.limit)),o.refresh&&c.set("refresh","1"),this.http.get(`/api/agent-workspaces/${encodeURIComponent(n)}/sessions?${c.toString()}`)}async refreshSessions(t){const n=t?`?refresh=1&projectId=${encodeURIComponent(t)}`:"?refresh=1";return this.http.get(`/api/sessions${n}`)}async listChildSessions(t){return[]}async getSession(t,n){var f;const o=this.nativeRunRecoveries.get(t),c=o==null?void 0:o.runId;try{const g=new URLSearchParams;n!=null&&n.before&&g.set("before",n.before),n!=null&&n.after&&g.set("after",n.after),n!=null&&n.anchor&&g.set("anchor",n.anchor),(n==null?void 0:n.limit)!==void 0&&g.set("limit",String(n.limit)),n!=null&&n.view&&g.set("view",n.view),n!=null&&n.revision&&g.set("revision",n.revision),n!=null&&n.turnId&&g.set("turnId",n.turnId);const m=g.size>0?`?${g.toString()}`:"",v=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${m}`);Array.isArray(v.messages)&&(v.messages=v.messages.map(C=>typeof C.content=="string"?{...C,content:io(C.content)}:C)),Array.isArray(v.events)&&(v.events=v.events.map(C=>typeof C.text=="string"&&C.text.includes("<think>")?{...C,text:io(C.text)}:typeof C.finalText=="string"&&C.finalText.includes("<think>")?{...C,finalText:io(C.finalText)}:C));const x=o===this.nativeRunRecoveries.get(t)&&c===(o==null?void 0:o.runId);if(t.startsWith("runtime:")&&x&&typeof v.snapshotRevision=="number"){const C=typeof v.snapshotRunId=="string"?v.snapshotRunId:void 0;if(C&&((f=this.nativeRunIdentities.get(t))!=null&&f.retired.has(C)))return v;const A=v.history,I=(A==null?void 0:A.delivery)==="core"||(A==null?void 0:A.delivery)==="trace";if((A==null?void 0:A.delivery)==="core"&&C&&this.coreSnapshotContainsTailFinalAnswer(v.messages)&&this.rememberNativeFinalAnswerSnapshot(t,v.snapshotRevision,C),I||this.rememberNativeStreamCursor(t,v.snapshotRevision,C),v.status==="running"&&v.occupancy!=="owned-externally"){const O=this.nativeStreamCursors.get(t),k=I&&C&&(O==null?void 0:O.runId)!==C?{sequence:0,runId:C}:O??(I?{sequence:0,...C?{runId:C}:{}}:void 0);this.openStream(t,k).catch(()=>{})}o&&!(n!=null&&n.before)&&!(n!=null&&n.after)&&!(n!=null&&n.anchor)&&(n==null?void 0:n.view)!=="trace"&&await this.reconcileNativeRun(t,o,c,v)}else if(!t.startsWith("runtime:")&&v.status==="active"){const C=v.activeRun;(C==null?void 0:C.running)===!0&&typeof C.eventId=="number"&&this.openStream(t,{sequence:C.eventId}).catch(()=>{})}return v}catch(g){if(g.status===404)return null;throw g}}async getSessionToolResult(t,n){const o=new URLSearchParams(n);return this.http.get(`/api/sessions/${encodeURIComponent(t)}/tool-result?${o.toString()}`)}async getSessionQueryIndex(t){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/query-index`)}observeSession(t,n,o){const c=this.createEventSource(`/api/sessions/${encodeURIComponent(t)}/changes`);let f=!1;return c.onmessage=g=>{if(g.data)try{const m=JSON.parse(g.data);m.type==="session_history_changed"&&typeof m.revision=="number"&&n({type:m.type,revision:m.revision})}catch{}},c.onerror=()=>{f||(f=!0,c.close(),o==null||o())},()=>{f||(f=!0,c.close())}}async setSessionPermissionMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode:n})}async getSessionGoals(t){const n=await this.http.get(`/api/sessions/${encodeURIComponent(t)}/goals`);return n.active&&this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),n}async enqueueSessionGoal(t,n,o){var f;await this.openStream(t,this.nativeStreamCursors.get(t));const c=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{objective:n,sourceMessageId:o});return typeof((f=c.started)==null?void 0:f.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...c.started.runId?{_nativeRunId:c.started.runId}:{}}),c.state}async reorderSessionGoals(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{orderedIds:n})}async cancelSessionGoal(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?goalId=${encodeURIComponent(n)}`)}async getThreadGoal(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).goal??null}async setThreadGoal(t,n,o){const c=await this.http.put(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{objective:n,tokenBudget:o??null});return this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),c.goal}async updateThreadGoal(t,n){return(await this.http.patch(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{action:n})).goal}async clearThreadGoal(t){return(await this.http.delete(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).cleared}async enqueueSessionMessage(t,n){var c;await this.openStream(t,this.nativeStreamCursors.get(t));const o=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",objective:n.content,sourceMessageId:n.sourceMessageId,messagePayload:{images:n.images,agentIds:n.agentIds,agentName:n.agentName}});return typeof((c=o.started)==null?void 0:c.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...o.started.runId?{_nativeRunId:o.started.runId}:{}}),o.state}async updateSessionMessage(t,n,o){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",messageId:n,objective:o})}async reorderSessionMessages(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",orderedIds:n})}async cancelSessionMessage(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?kind=message&goalId=${encodeURIComponent(n)}`)}async createSession(t,n,o,c){return this.http.post("/api/sessions",{title:t,...n?{projectId:n}:{},...o&&o!=="customer-agent"?{agentType:o}:{},...c?{cwd:c}:{}})}async forkSession(t){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/fork`,{})}async releaseCodexSession(t){await this.http.post(`/api/sessions/${encodeURIComponent(t)}/release`,{})}async deleteSession(t){await this.http.delete(`/api/sessions/${encodeURIComponent(t)}`)}async getRuntimeHealth(){return this.http.get("/api/agent/runtime-health")}getUpdateStatus(){return this.http.get("/api/update/status")}checkForUpdate(){return this.http.post("/api/update/check",{})}installUpdate(){return this.http.post("/api/update/install",{})}onUpdateStatus(t){return()=>{}}async listAgentModels(t){return this.http.get(`/api/agent/models?agentType=${encodeURIComponent(t)}`)}async listProjects(){return this.projectBridge?(await this.requireProjectBridge().request("project:list")).projects??[]:this.http.get("/api/projects")}async getProject(t){return this.projectBridge?(await this.requireProjectBridge().request("project:get",{projectId:t})).project??null:this.http.get(`/api/projects/${encodeURIComponent(t)}`)}async createProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:create",{name:t,path:n??""})).project:this.http.post("/api/projects",{name:t,path:n??""})}async updateProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:rename",{projectId:t,name:n.name})).project:this.http.patch(`/api/projects/${encodeURIComponent(t)}`,n)}async deleteProject(t){if(!this.projectBridge){await this.http.delete(`/api/projects/${encodeURIComponent(t)}`);return}await this.requireProjectBridge().request("project:delete",{projectId:t})}async checkProjectPath(t){return this.projectBridge?(await this.requireProjectBridge().request("project:check",{path:t})).valid===!0:(await this.http.get(`/api/projects/check?path=${encodeURIComponent(t)}`)).valid===!0}async listProjectRoots(){return this.projectBridge?(await this.requireProjectBridge().request("project:roots")).roots??[]:this.http.get("/api/projects/roots")}async listProjectDirectories(t){return this.projectBridge?(await this.requireProjectBridge().request("project:directories",{path:t})).entries??[]:this.http.get(`/api/projects/directories?path=${encodeURIComponent(t)}`)}async setProjectWorkingDir(t){return await this.saveSettings({workingDirectory:t}),{ok:!0,path:t}}async getSettings(){return this.http.get("/api/settings")}async setSetting(t,n){const o=await this.getSettings();if(!(t in o)||t==="revision"||t==="settingsSpaceId")throw new Error("Unsupported setting");const c=typeof o[t]=="number"?Number(n):Array.isArray(o[t])?JSON.parse(n):n;await this.saveSettings({[t]:c,revision:o.revision})}async subscribe(){}async handoffSession(t){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/handoff`,{})}async saveSettings(t){return this.http.post("/api/settings",t)}async setActiveProfile(t){return this.http.post("/api/settings",{activeProfileId:t})}async refreshServerModel(){const t=await this.getSettings(),n=`webapp.sharedMigration.${t.settingsSpaceId}`;if(!t.settingsSpaceId||localStorage.getItem(n))return;const o=(f,g)=>{try{return JSON.parse(localStorage.getItem(f)||"null")??g}catch{return g}},c=o("webapp.settings.v1",{});await this.business("importLegacy",[{profiles:c.profiles||[],agents:o("webapp.agentDefs",[]),lsp:o("webapp.lspServers",[])}]),localStorage.setItem(n,"1")}business(t,n){return this.http.post("/api/business",{method:t,args:n})}async listMemories(){return this.business("listMemories",[])}async searchMemories(t){return this.business("searchMemories",[t])}async getMemory(t){return this.business("getMemory",[t])}async setMemory(t){return this.business("setMemory",[t])}async deleteMemory(t){return this.business("deleteMemory",[t])}async mcpList(){return this.business("mcpList",[])}async mcpSave(t){return this.business("mcpSave",[t])}async mcpDelete(t){return this.business("mcpDelete",[t])}async mcpSetEnabled(t,n){return this.business("mcpSetEnabled",[t,n])}async mcpProbe(t){return this.business("mcpProbe",[t])}async listSkills(){return this.business("listSkills",[])}async saveSkill(t){return this.business("saveSkill",[t])}async deleteSkill(t){return this.business("deleteSkill",[t])}async setSkillEnabled(t,n){return this.business("setSkillEnabled",[t,n])}async listAgentDefs(){return this.business("listAgentDefs",[])}async getAgentDef(t){return this.business("getAgentDef",[t])}async createAgentDef(t){return this.business("createAgentDef",[t])}async updateAgentDef(t,n){return this.business("updateAgentDef",[t,n])}async deleteAgentDef(t){return this.business("deleteAgentDef",[t])}async setActiveAgentDef(t){return this.business("setActiveAgentDef",[t])}async lspList(){return this.business("lspList",[])}async lspSave(t){return this.business("lspSave",[t])}async lspDelete(t){return this.business("lspDelete",[t])}async lspSetEnabled(t,n){return this.business("lspSetEnabled",[t,n])}async listUploads(){return this.business("listUploads",[])}async getUpload(t){return this.business("getUpload",[t])}async saveUpload(t){return this.business("saveUpload",[t])}async deleteUpload(t){return this.business("deleteUpload",[t])}async importSkill(){return null}async cronCreate(t,n,o){return this.business("cronCreate",[t,n,o])}async cronPause(t){return this.business("cronPause",[t])}async cronResume(t){return this.business("cronResume",[t])}async cronDelete(t){return this.business("cronDelete",[t])}async cronDeleteAll(){return this.business("cronDeleteAll",[])}async cronList(){return this.business("cronList",[])}async openFileDialog(){return null}async readFile(){throw new Error("Web 端不支持直接读取本地文件")}async writeFile(){throw new Error("Web 端不支持直接写入本地文件")}async hideWindow(){}async showWindow(){}async isWindowVisible(){return!0}async wakeStop(){return{ok:!0}}async wakeConversation(t){return{ok:!0,conversation:t}}async ttsSpeak(){return{ok:!1}}async ttsStop(){return{ok:!0}}async ttsPlaybackEnded(){return{ok:!0}}onTtsStart(){return()=>{}}onTtsPcm(){return()=>{}}onTtsStreamEnd(){return()=>{}}onTtsFlush(){return()=>{}}onTtsEnd(){return()=>{}}onWake(){return()=>{}}onWakeCommand(){return()=>{}}dispatch(t,n){const o={...n,_sid:t};for(const c of this.listeners)try{c(o)}catch{}}dispatchStreamEvent(t,n){if(!(t.startsWith("runtime:codex:")&&n.type==="text_chunk"&&n.messagePhase==="commentary"&&typeof n.text=="string")){this.flushBufferedStreamText(t),this.dispatch(t,n);return}const c=this.bufferedStreamText.get(t);if(c&&c.event._nativeRunId===n._nativeRunId&&c.event.turnId===n.turnId&&c.event.itemId===n.itemId){c.event={...c.event,...n,text:String(c.event.text??"")+n.text};return}this.flushBufferedStreamText(t);const g=setTimeout(()=>this.flushBufferedStreamText(t),Ub);this.bufferedStreamText.set(t,{event:{...n},timer:g})}flushBufferedStreamText(t){const n=this.bufferedStreamText.get(t);n&&(this.bufferedStreamText.delete(t),clearTimeout(n.timer),this.dispatch(t,n.event))}settle(t){this.stopOrdinaryRunRecovery(t),this.stopNativeRunRecovery(t);const n=this.pendingRuns.get(t);n&&(this.pendingRuns.delete(t),n())}beginNativeRunRecovery(t,n,o=!1){this.stopNativeRunRecovery(t);const c={runId:n,awaitingAdmission:o,inFlight:!1};return this.nativeRunRecoveries.set(t,c),c}startNativeRunRecovery(t,n){let o=this.nativeRunRecoveries.get(t);if(o!=null&&o.awaitingAdmission)return;if(n){const f=this.nativeRunIdentities.get(t);if(f!=null&&f.retired.has(n))return;f&&f.current!==n?(f.retired.add(f.current),f.current=n):f||this.nativeRunIdentities.set(t,{current:n,retired:new Set})}if((!o||n&&o.runId!==n)&&(o=this.beginNativeRunRecovery(t,n)),o.timer)return;const c=o;o.timer=setInterval(()=>{this.recoverNativeRun(t,c)},Wb)}stopNativeRunRecovery(t){const n=this.nativeRunRecoveries.get(t);n!=null&&n.timer&&clearInterval(n.timer),this.nativeRunRecoveries.delete(t)}async recoverNativeRun(t,n){if(!(n.inFlight||n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n)){n.inFlight=!0;try{await this.getSession(t,{limit:1,view:"core"})}catch{}finally{n.inFlight=!1}}}async reconcileNativeRun(t,n,o,c){var k;if(n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n||n.runId!==o||!o&&this.pendingRuns.has(t)||o&&typeof c.snapshotRunId!="string"&&c.snapshotRunId!==null||!["idle","completed","failed","aborted"].includes(String(c.status)))return;let f=n,g=o;if(typeof c.snapshotRunId=="string"&&c.snapshotRunId!==o){if((k=this.nativeRunIdentities.get(t))!=null&&k.retired.has(c.snapshotRunId))return;this.startNativeRunRecovery(t,c.snapshotRunId);const M=this.nativeRunRecoveries.get(t);if(!M||M.runId!==c.snapshotRunId)return;f=M,g=c.snapshotRunId}let m=Array.isArray(c.events)?c.events:[],v=c.status,x=[...m].reverse().find(M=>M.type==="done"||M.type==="error"||M.type==="turn_aborted");if(!x&&typeof c.snapshotRunId=="string")try{const M=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`);if(M.snapshotRunId!==c.snapshotRunId||!["idle","completed","failed","aborted"].includes(String(M.status)))return;v=M.status,m=Array.isArray(M.events)?M.events:[],x=[...m].reverse().find(G=>G.type==="done"||G.type==="error"||G.type==="turn_aborted")}catch{return}if(this.nativeRunRecoveries.get(t)!==f||f.runId!==g||f.awaitingAdmission)return;const C=(x==null?void 0:x.type)??(v==="failed"?"error":v==="aborted"?"turn_aborted":"done"),{_nativeSequence:A,_nativeRunId:I,...O}=x??{};this.closeStream(t),this.settle(t),this.dispatch(t,{...O,type:C,...C==="error"?{message:(x==null?void 0:x.message)||"运行失败,但未记录具体错误"}:{},...C==="done"?{finalText:"",...(x==null?void 0:x.durationMs)===void 0?{}:{durationMs:x.durationMs}}:{},...g??c.snapshotRunId?{_nativeRunId:g??c.snapshotRunId}:{},_nativeRecoveredFromSnapshot:!0})}startOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n);const o=setInterval(()=>{this.recoverSettledOrdinaryRun(t)},jb);this.ordinaryRunRecoveryTimers.set(t,o)}stopOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n),this.ordinaryRunRecoveryTimers.delete(t),this.ordinaryRunStreamText.delete(t)}async recoverSettledOrdinaryRun(t){var n;if(!this.pendingRuns.has(t)){this.stopOrdinaryRunRecovery(t);return}try{const o=await this.getSession(t,{limit:50});if(!o||o.status==="active"||o.status==="running"||o.status!=="completed"&&o.status!=="failed"&&o.status!=="aborted")return;const c=o.messages??[],f=c.map(x=>x.role).lastIndexOf("user"),g=io(c.slice(f+1).filter(x=>x.role==="assistant"&&(x.content??"").trim()).map(x=>x.content.trim()).join(`
|
|
58
|
+
`).slice(0,8e3)||void 0},data:{filename:I.filename,lineno:I.lineno,colno:I.colno}})},A=I=>{const O=Np(I.reason);x({level:"error",message:`unhandledRejection: ${O.message}`,source:t,error:O})};return window.addEventListener("error",C),window.addEventListener("unhandledrejection",A),{reportError:(I,O)=>{const k=Np(I);x({level:"error",message:k.message,source:t,error:k,data:O})},reportWarning:(I,O)=>{x({level:"warn",message:I,source:t,data:O})},uninstall:()=>{g=!0,c!==null&&(clearTimeout(c),c=null),window.removeEventListener("error",C),window.removeEventListener("unhandledrejection",A)}}}const gf="<think>",pf="</think>";function Dp(e,t){const n=Math.min(t.length-1,e.length);for(let o=n;o>0;o--)if(e.endsWith(t.slice(0,o)))return o;return 0}function io(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}class Lb{constructor(){this.buffer="",this.dropping=!1}push(t){this.buffer+=t;let n="";for(;;){if(this.dropping){const c=this.buffer.indexOf(pf);if(c===-1){const f=Dp(this.buffer,pf);return this.buffer=this.buffer.slice(this.buffer.length-f),n}this.buffer=this.buffer.slice(c+pf.length),this.dropping=!1;continue}const o=this.buffer.indexOf(gf);if(o===-1){const c=Dp(this.buffer,gf);return n+=this.buffer.slice(0,this.buffer.length-c),this.buffer=this.buffer.slice(this.buffer.length-c),n}n+=this.buffer.slice(0,o),this.buffer=this.buffer.slice(o+gf.length),this.dropping=!0}}flush(){const t=this.buffer;return this.buffer="",t}}const Fb=/^(?:load failed|failed to fetch|network request failed|networkerror when attempting to fetch resource\.?|the network connection was lost\.?|fetch failed)$/i,Ub=50,jb=1e3,Wb=2e3;function Mp(e){return e instanceof Error&&e.name!=="AbortError"&&Fb.test(e.message.trim())}class $b{constructor(t,n,o,c=f=>new EventSource(f)){this.http=t,this.settings=n,this.projectBridge=o,this.createEventSource=c,this.streams=new Map,this.nativeStreamCursors=new Map,this.nativeFinalAnswerSnapshots=new Map,this.pendingRuns=new Map,this.listeners=new Set,this.thinkFilters=new Map,this.bufferedStreamText=new Map,this.ordinaryRunRecoveryTimers=new Map,this.ordinaryRunStreamText=new Map,this.nativeRunRecoveries=new Map,this.nativeRunIdentities=new Map}requireProjectBridge(){if(this.projectBridge)return this.projectBridge;throw Object.assign(new Error("请从 AgentRoam Web 控制台打开项目"),{code:"WEB_SHELL_REQUIRED"})}onEvent(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}async run(t,n,o,c,f,g){var O,k;const m=n.startsWith("runtime:"),v=this.streams.has(n),x=this.pendingRuns.has(n),C=this.nativeStreamCursors.get(n);m&&!x&&this.beginNativeRunRecovery(n,void 0,!0);let A=null,I=null;try{m||await this.openStream(n,this.nativeStreamCursors.get(n)),I=x?null:new Promise(G=>{A=G,this.pendingRuns.set(n,G)}),m||this.ordinaryRunStreamText.set(n,"");const M=await this.http.post("/api/agent/run",{input:t,sessionId:n,...f!=null&&f.length?{images:f}:{},...o!=null&&o.length?{agentIds:o}:{},...!m&&(g!=null&&g.profileId)?{profileId:g.profileId}:{},...(O=g==null?void 0:g.model)!=null&&O.id?{nativeModel:g.model}:{},...g!=null&&g.reasoningEffort?{nativeReasoningEffort:g.reasoningEffort}:{}});if(m||this.startOrdinaryRunRecovery(n),m){const G=this.nativeRunRecoveries.get(n);G&&(G.awaitingAdmission=!1,G.runId=typeof M.runId=="string"?M.runId:void 0);const N=typeof M.runId=="string"&&(C==null?void 0:C.runId)!==M.runId?{sequence:0,runId:M.runId}:C??{sequence:0,...typeof M.runId=="string"?{runId:M.runId}:{}};await this.openStream(n,N,{waitForOpen:!1})}this.dispatch(n,{type:"run_admitted",...typeof M.runId=="string"?{_nativeRunId:M.runId}:{}}),I&&await I}catch(M){const G=!x&&m&&Mp(M)?await this.recoverNativeAdmission(n,C):null;if(G){const U=this.nativeRunRecoveries.get(n);return U&&(U.awaitingAdmission=!1,U.runId=G.runId),await this.openStream(n,G,{waitForOpen:!1}),I&&await I,[]}const N=M.code,T=typeof N=="string"?N:M.status===409?"SESSION_OCCUPIED":void 0;m&&T==="SESSION_ALREADY_RUNNING"&&await this.openStream(n,C??{sequence:0},{waitForOpen:!1});const _=v||x||T==="SESSION_ALREADY_RUNNING";if(m&&_){const U=this.nativeRunRecoveries.get(n);U&&(U.awaitingAdmission=!1),this.startNativeRunRecovery(n,(k=this.nativeStreamCursors.get(n))==null?void 0:k.runId)}this.dispatch(n,{type:"error",message:Mp(M)?"网络连接中断,消息未确认发送,请重试":M instanceof Error?M.message:"无法启动运行",...T?{code:T}:{},..._?{_preserveActiveRun:!0}:{}}),_?A&&this.pendingRuns.get(n)===A&&this.pendingRuns.delete(n):(this.closeStream(n),this.settle(n))}return[]}async recoverNativeAdmission(t,n){const o=this.nativeStreamCursors.get(t);if(o!=null&&o.runId&&o.runId!==(n==null?void 0:n.runId))return this.dispatchRecoveredAdmission(t,o),o;try{const c=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`),f=typeof c.snapshotRunId=="string"?c.snapshotRunId:void 0,g=typeof c.snapshotRevision=="number"?c.snapshotRevision:0,m=!!(f&&(n!=null&&n.runId)&&f!==n.runId),v=!!(f&&!(n!=null&&n.runId)&&c.status==="running");return!m&&!v?null:(this.dispatchRecoveredAdmission(t,{runId:f,sequence:g}),{runId:f,sequence:0})}catch{return null}}dispatchRecoveredAdmission(t,n){this.dispatch(t,{type:"run_admitted",...n.runId?{_nativeRunId:n.runId}:{}})}async steer(t,n,o){return(await this.http.post("/api/agent/steer",{input:t,sessionId:n})).steered||this.run(t,n).catch(()=>{}),!0}async steerSessionMessage(t,n){const o=await this.http.post("/api/agent/steer",{sessionId:t,messageId:n});if(!o.steered)throw new Error("当前运行不支持插队消息");return o.state}async abort(t){try{await this.http.post("/api/agent/abort",t?{sessionId:t}:{})}finally{for(const n of[...this.pendingRuns.keys()])this.settle(n);for(const n of[...this.streams.keys()])this.closeStream(n);for(const n of[...this.nativeRunRecoveries.keys()])this.stopNativeRunRecovery(n)}}async answerQuestion(t,n,o){try{return await this.http.post("/api/agent/answer",{questionId:t,answer:n,selectedIndices:o}),!0}catch{return!1}}async listSessions(t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return this.http.get(`/api/sessions${n}`)}async listAgentWorkspaces(t,n={}){const o=new URLSearchParams({agentType:t});return n.cursor&&o.set("cursor",n.cursor),n.limit!==void 0&&o.set("limit",String(n.limit)),n.refresh&&o.set("refresh","1"),n.since&&o.set("since",n.since),this.http.get(`/api/agent-workspaces?${o.toString()}`)}async importAgentWorkspace(t,n,o){return this.http.post("/api/agent-workspaces",{agentType:t,path:n,...o?{name:o}:{}})}async listAgentWorkspaceSessions(t,n,o={}){const c=new URLSearchParams({agentType:t});return o.cursor&&c.set("cursor",o.cursor),o.limit!==void 0&&c.set("limit",String(o.limit)),o.refresh&&c.set("refresh","1"),this.http.get(`/api/agent-workspaces/${encodeURIComponent(n)}/sessions?${c.toString()}`)}async refreshSessions(t){const n=t?`?refresh=1&projectId=${encodeURIComponent(t)}`:"?refresh=1";return this.http.get(`/api/sessions${n}`)}async listChildSessions(t){return[]}async getSession(t,n){var f;const o=this.nativeRunRecoveries.get(t),c=o==null?void 0:o.runId;try{const g=new URLSearchParams;n!=null&&n.before&&g.set("before",n.before),n!=null&&n.after&&g.set("after",n.after),n!=null&&n.anchor&&g.set("anchor",n.anchor),(n==null?void 0:n.limit)!==void 0&&g.set("limit",String(n.limit)),n!=null&&n.view&&g.set("view",n.view),n!=null&&n.revision&&g.set("revision",n.revision),n!=null&&n.turnId&&g.set("turnId",n.turnId);const m=g.size>0?`?${g.toString()}`:"",v=await this.http.get(`/api/sessions/${encodeURIComponent(t)}${m}`);Array.isArray(v.messages)&&(v.messages=v.messages.map(C=>typeof C.content=="string"?{...C,content:io(C.content)}:C)),Array.isArray(v.events)&&(v.events=v.events.map(C=>typeof C.text=="string"&&C.text.includes("<think>")?{...C,text:io(C.text)}:typeof C.finalText=="string"&&C.finalText.includes("<think>")?{...C,finalText:io(C.finalText)}:C));const x=o===this.nativeRunRecoveries.get(t)&&c===(o==null?void 0:o.runId);if(t.startsWith("runtime:")&&x&&typeof v.snapshotRevision=="number"){const C=typeof v.snapshotRunId=="string"?v.snapshotRunId:void 0;if(C&&((f=this.nativeRunIdentities.get(t))!=null&&f.retired.has(C)))return v;const A=v.history,I=(A==null?void 0:A.delivery)==="core"||(A==null?void 0:A.delivery)==="trace";if((A==null?void 0:A.delivery)==="core"&&C&&this.coreSnapshotContainsTailFinalAnswer(v.messages)&&this.rememberNativeFinalAnswerSnapshot(t,v.snapshotRevision,C),I||this.rememberNativeStreamCursor(t,v.snapshotRevision,C),v.status==="running"&&v.occupancy!=="owned-externally"){const O=this.nativeStreamCursors.get(t),k=I&&C&&(O==null?void 0:O.runId)!==C?{sequence:0,runId:C}:O??(I?{sequence:0,...C?{runId:C}:{}}:void 0);this.openStream(t,k).catch(()=>{})}o&&!(n!=null&&n.before)&&!(n!=null&&n.after)&&!(n!=null&&n.anchor)&&(n==null?void 0:n.view)!=="trace"&&await this.reconcileNativeRun(t,o,c,v)}else if(!t.startsWith("runtime:")&&v.status==="active"){const C=v.activeRun;(C==null?void 0:C.running)===!0&&typeof C.eventId=="number"&&this.openStream(t,{sequence:C.eventId}).catch(()=>{})}return v}catch(g){if(g.status===404)return null;throw g}}async getSessionToolResult(t,n){const o=new URLSearchParams(n);return this.http.get(`/api/sessions/${encodeURIComponent(t)}/tool-result?${o.toString()}`)}async getSessionQueryIndex(t){return this.http.get(`/api/sessions/${encodeURIComponent(t)}/query-index`)}observeSession(t,n,o){const c=this.createEventSource(`/api/sessions/${encodeURIComponent(t)}/changes`);let f=!1;return c.onmessage=g=>{if(g.data)try{const m=JSON.parse(g.data);m.type==="session_history_changed"&&typeof m.revision=="number"&&n({type:m.type,revision:m.revision})}catch{}},c.onerror=()=>{f||(f=!0,c.close(),o==null||o())},()=>{f||(f=!0,c.close())}}async setSessionPermissionMode(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}`,{permissionMode:n})}async getSessionGoals(t){const n=await this.http.get(`/api/sessions/${encodeURIComponent(t)}/goals`);return n.active&&this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),n}async enqueueSessionGoal(t,n,o){var f;await this.openStream(t,this.nativeStreamCursors.get(t));const c=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{objective:n,sourceMessageId:o});return typeof((f=c.started)==null?void 0:f.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...c.started.runId?{_nativeRunId:c.started.runId}:{}}),c.state}async reorderSessionGoals(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{orderedIds:n})}async cancelSessionGoal(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?goalId=${encodeURIComponent(n)}`)}async getThreadGoal(t){return(await this.http.get(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).goal??null}async setThreadGoal(t,n,o){const c=await this.http.put(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{objective:n,tokenBudget:o??null});return this.openStream(t,this.nativeStreamCursors.get(t)).catch(()=>{}),c.goal}async updateThreadGoal(t,n){return(await this.http.patch(`/api/sessions/${encodeURIComponent(t)}/thread-goal`,{action:n})).goal}async clearThreadGoal(t){return(await this.http.delete(`/api/sessions/${encodeURIComponent(t)}/thread-goal`)).cleared}async enqueueSessionMessage(t,n){var c;await this.openStream(t,this.nativeStreamCursors.get(t));const o=await this.http.post(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",objective:n.content,sourceMessageId:n.sourceMessageId,messagePayload:{images:n.images,agentIds:n.agentIds,agentName:n.agentName}});return typeof((c=o.started)==null?void 0:c.snapshotRevision)=="number"&&this.dispatch(t,{type:"run_admitted",...o.started.runId?{_nativeRunId:o.started.runId}:{}}),o.state}async updateSessionMessage(t,n,o){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",messageId:n,objective:o})}async reorderSessionMessages(t,n){return this.http.patch(`/api/sessions/${encodeURIComponent(t)}/goals`,{kind:"message",orderedIds:n})}async cancelSessionMessage(t,n){return this.http.delete(`/api/sessions/${encodeURIComponent(t)}/goals?kind=message&goalId=${encodeURIComponent(n)}`)}async createSession(t,n,o,c){return this.http.post("/api/sessions",{title:t,...n?{projectId:n}:{},...o&&o!=="customer-agent"?{agentType:o}:{},...c?{cwd:c}:{}})}async forkSession(t,n){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/${n?"fork-at":"fork"}`,n?{point:n}:{})}async releaseCodexSession(t){await this.http.post(`/api/sessions/${encodeURIComponent(t)}/release`,{})}async deleteSession(t){await this.http.delete(`/api/sessions/${encodeURIComponent(t)}`)}async getRuntimeHealth(){return this.http.get("/api/agent/runtime-health")}getUpdateStatus(){return this.http.get("/api/update/status")}checkForUpdate(){return this.http.post("/api/update/check",{})}installUpdate(){return this.http.post("/api/update/install",{})}onUpdateStatus(t){return()=>{}}async listAgentModels(t){return this.http.get(`/api/agent/models?agentType=${encodeURIComponent(t)}`)}async listProjects(){return this.projectBridge?(await this.requireProjectBridge().request("project:list")).projects??[]:this.http.get("/api/projects")}async getProject(t){return this.projectBridge?(await this.requireProjectBridge().request("project:get",{projectId:t})).project??null:this.http.get(`/api/projects/${encodeURIComponent(t)}`)}async createProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:create",{name:t,path:n??""})).project:this.http.post("/api/projects",{name:t,path:n??""})}async updateProject(t,n){return this.projectBridge?(await this.requireProjectBridge().request("project:rename",{projectId:t,name:n.name})).project:this.http.patch(`/api/projects/${encodeURIComponent(t)}`,n)}async deleteProject(t){if(!this.projectBridge){await this.http.delete(`/api/projects/${encodeURIComponent(t)}`);return}await this.requireProjectBridge().request("project:delete",{projectId:t})}async checkProjectPath(t){return this.projectBridge?(await this.requireProjectBridge().request("project:check",{path:t})).valid===!0:(await this.http.get(`/api/projects/check?path=${encodeURIComponent(t)}`)).valid===!0}async listProjectRoots(){return this.projectBridge?(await this.requireProjectBridge().request("project:roots")).roots??[]:this.http.get("/api/projects/roots")}async listProjectDirectories(t){return this.projectBridge?(await this.requireProjectBridge().request("project:directories",{path:t})).entries??[]:this.http.get(`/api/projects/directories?path=${encodeURIComponent(t)}`)}async setProjectWorkingDir(t){return await this.saveSettings({workingDirectory:t}),{ok:!0,path:t}}async getSettings(){return this.http.get("/api/settings")}async setSetting(t,n){const o=await this.getSettings();if(!(t in o)||t==="revision"||t==="settingsSpaceId")throw new Error("Unsupported setting");const c=typeof o[t]=="number"?Number(n):Array.isArray(o[t])?JSON.parse(n):n;await this.saveSettings({[t]:c,revision:o.revision})}async subscribe(){}async handoffSession(t){return this.http.post(`/api/sessions/${encodeURIComponent(t)}/handoff`,{})}async saveSettings(t){return this.http.post("/api/settings",t)}async setActiveProfile(t){return this.http.post("/api/settings",{activeProfileId:t})}async refreshServerModel(){const t=await this.getSettings(),n=`webapp.sharedMigration.${t.settingsSpaceId}`;if(!t.settingsSpaceId||localStorage.getItem(n))return;const o=(f,g)=>{try{return JSON.parse(localStorage.getItem(f)||"null")??g}catch{return g}},c=o("webapp.settings.v1",{});await this.business("importLegacy",[{profiles:c.profiles||[],agents:o("webapp.agentDefs",[]),lsp:o("webapp.lspServers",[])}]),localStorage.setItem(n,"1")}business(t,n){return this.http.post("/api/business",{method:t,args:n})}async listMemories(){return this.business("listMemories",[])}async searchMemories(t){return this.business("searchMemories",[t])}async getMemory(t){return this.business("getMemory",[t])}async setMemory(t){return this.business("setMemory",[t])}async deleteMemory(t){return this.business("deleteMemory",[t])}async mcpList(){return this.business("mcpList",[])}async mcpSave(t){return this.business("mcpSave",[t])}async mcpDelete(t){return this.business("mcpDelete",[t])}async mcpSetEnabled(t,n){return this.business("mcpSetEnabled",[t,n])}async mcpProbe(t){return this.business("mcpProbe",[t])}async listSkills(){return this.business("listSkills",[])}async saveSkill(t){return this.business("saveSkill",[t])}async deleteSkill(t){return this.business("deleteSkill",[t])}async setSkillEnabled(t,n){return this.business("setSkillEnabled",[t,n])}async listAgentDefs(){return this.business("listAgentDefs",[])}async getAgentDef(t){return this.business("getAgentDef",[t])}async createAgentDef(t){return this.business("createAgentDef",[t])}async updateAgentDef(t,n){return this.business("updateAgentDef",[t,n])}async deleteAgentDef(t){return this.business("deleteAgentDef",[t])}async setActiveAgentDef(t){return this.business("setActiveAgentDef",[t])}async lspList(){return this.business("lspList",[])}async lspSave(t){return this.business("lspSave",[t])}async lspDelete(t){return this.business("lspDelete",[t])}async lspSetEnabled(t,n){return this.business("lspSetEnabled",[t,n])}async listUploads(){return this.business("listUploads",[])}async getUpload(t){return this.business("getUpload",[t])}async saveUpload(t){return this.business("saveUpload",[t])}async deleteUpload(t){return this.business("deleteUpload",[t])}async importSkill(){return null}async cronCreate(t,n,o){return this.business("cronCreate",[t,n,o])}async cronPause(t){return this.business("cronPause",[t])}async cronResume(t){return this.business("cronResume",[t])}async cronDelete(t){return this.business("cronDelete",[t])}async cronDeleteAll(){return this.business("cronDeleteAll",[])}async cronList(){return this.business("cronList",[])}async openFileDialog(){return null}async readFile(){throw new Error("Web 端不支持直接读取本地文件")}async writeFile(){throw new Error("Web 端不支持直接写入本地文件")}async hideWindow(){}async showWindow(){}async isWindowVisible(){return!0}async wakeStop(){return{ok:!0}}async wakeConversation(t){return{ok:!0,conversation:t}}async ttsSpeak(){return{ok:!1}}async ttsStop(){return{ok:!0}}async ttsPlaybackEnded(){return{ok:!0}}onTtsStart(){return()=>{}}onTtsPcm(){return()=>{}}onTtsStreamEnd(){return()=>{}}onTtsFlush(){return()=>{}}onTtsEnd(){return()=>{}}onWake(){return()=>{}}onWakeCommand(){return()=>{}}dispatch(t,n){const o={...n,_sid:t};for(const c of this.listeners)try{c(o)}catch{}}dispatchStreamEvent(t,n){if(!(t.startsWith("runtime:codex:")&&n.type==="text_chunk"&&n.messagePhase==="commentary"&&typeof n.text=="string")){this.flushBufferedStreamText(t),this.dispatch(t,n);return}const c=this.bufferedStreamText.get(t);if(c&&c.event._nativeRunId===n._nativeRunId&&c.event.turnId===n.turnId&&c.event.itemId===n.itemId){c.event={...c.event,...n,text:String(c.event.text??"")+n.text};return}this.flushBufferedStreamText(t);const g=setTimeout(()=>this.flushBufferedStreamText(t),Ub);this.bufferedStreamText.set(t,{event:{...n},timer:g})}flushBufferedStreamText(t){const n=this.bufferedStreamText.get(t);n&&(this.bufferedStreamText.delete(t),clearTimeout(n.timer),this.dispatch(t,n.event))}settle(t){this.stopOrdinaryRunRecovery(t),this.stopNativeRunRecovery(t);const n=this.pendingRuns.get(t);n&&(this.pendingRuns.delete(t),n())}beginNativeRunRecovery(t,n,o=!1){this.stopNativeRunRecovery(t);const c={runId:n,awaitingAdmission:o,inFlight:!1};return this.nativeRunRecoveries.set(t,c),c}startNativeRunRecovery(t,n){let o=this.nativeRunRecoveries.get(t);if(o!=null&&o.awaitingAdmission)return;if(n){const f=this.nativeRunIdentities.get(t);if(f!=null&&f.retired.has(n))return;f&&f.current!==n?(f.retired.add(f.current),f.current=n):f||this.nativeRunIdentities.set(t,{current:n,retired:new Set})}if((!o||n&&o.runId!==n)&&(o=this.beginNativeRunRecovery(t,n)),o.timer)return;const c=o;o.timer=setInterval(()=>{this.recoverNativeRun(t,c)},Wb)}stopNativeRunRecovery(t){const n=this.nativeRunRecoveries.get(t);n!=null&&n.timer&&clearInterval(n.timer),this.nativeRunRecoveries.delete(t)}async recoverNativeRun(t,n){if(!(n.inFlight||n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n)){n.inFlight=!0;try{await this.getSession(t,{limit:1,view:"core"})}catch{}finally{n.inFlight=!1}}}async reconcileNativeRun(t,n,o,c){var k;if(n.awaitingAdmission||this.nativeRunRecoveries.get(t)!==n||n.runId!==o||!o&&this.pendingRuns.has(t)||o&&typeof c.snapshotRunId!="string"&&c.snapshotRunId!==null||!["idle","completed","failed","aborted"].includes(String(c.status)))return;let f=n,g=o;if(typeof c.snapshotRunId=="string"&&c.snapshotRunId!==o){if((k=this.nativeRunIdentities.get(t))!=null&&k.retired.has(c.snapshotRunId))return;this.startNativeRunRecovery(t,c.snapshotRunId);const M=this.nativeRunRecoveries.get(t);if(!M||M.runId!==c.snapshotRunId)return;f=M,g=c.snapshotRunId}let m=Array.isArray(c.events)?c.events:[],v=c.status,x=[...m].reverse().find(M=>M.type==="done"||M.type==="error"||M.type==="turn_aborted");if(!x&&typeof c.snapshotRunId=="string")try{const M=await this.http.get(`/api/sessions/${encodeURIComponent(t)}?limit=1`);if(M.snapshotRunId!==c.snapshotRunId||!["idle","completed","failed","aborted"].includes(String(M.status)))return;v=M.status,m=Array.isArray(M.events)?M.events:[],x=[...m].reverse().find(G=>G.type==="done"||G.type==="error"||G.type==="turn_aborted")}catch{return}if(this.nativeRunRecoveries.get(t)!==f||f.runId!==g||f.awaitingAdmission)return;const C=(x==null?void 0:x.type)??(v==="failed"?"error":v==="aborted"?"turn_aborted":"done"),{_nativeSequence:A,_nativeRunId:I,...O}=x??{};this.closeStream(t),this.settle(t),this.dispatch(t,{...O,type:C,...C==="error"?{message:(x==null?void 0:x.message)||"运行失败,但未记录具体错误"}:{},...C==="done"?{finalText:"",...(x==null?void 0:x.durationMs)===void 0?{}:{durationMs:x.durationMs}}:{},...g??c.snapshotRunId?{_nativeRunId:g??c.snapshotRunId}:{},_nativeRecoveredFromSnapshot:!0})}startOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n);const o=setInterval(()=>{this.recoverSettledOrdinaryRun(t)},jb);this.ordinaryRunRecoveryTimers.set(t,o)}stopOrdinaryRunRecovery(t){const n=this.ordinaryRunRecoveryTimers.get(t);n&&clearInterval(n),this.ordinaryRunRecoveryTimers.delete(t),this.ordinaryRunStreamText.delete(t)}async recoverSettledOrdinaryRun(t){var n;if(!this.pendingRuns.has(t)){this.stopOrdinaryRunRecovery(t);return}try{const o=await this.getSession(t,{limit:50});if(!o||o.status==="active"||o.status==="running"||o.status!=="completed"&&o.status!=="failed"&&o.status!=="aborted")return;const c=o.messages??[],f=c.map(x=>x.role).lastIndexOf("user"),g=io(c.slice(f+1).filter(x=>x.role==="assistant"&&(x.content??"").trim()).map(x=>x.content.trim()).join(`
|
|
59
59
|
|
|
60
60
|
`)),m=this.ordinaryRunStreamText.get(t)??"",v=g.startsWith(m)?g.slice(m.length):g;if(v&&this.dispatch(t,{type:"text_chunk",text:v}),o.status==="completed")this.dispatch(t,{type:"done",finalText:""});else{const x=(n=[...o.events??[]].reverse().find(C=>{var A;return C.type==="error"&&((A=C.message)==null?void 0:A.trim())}))==null?void 0:n.message;this.dispatch(t,{type:"error",message:x||(o.status==="aborted"?"运行已中止":"运行失败,但未记录具体错误")})}this.closeStream(t),this.settle(t)}catch{}}openStream(t,n,o={}){if(t.startsWith("runtime:")&&this.startNativeRunRecovery(t,n==null?void 0:n.runId),this.streams.has(t))return Promise.resolve();this.thinkFilters.set(t,new Lb);const c=new URLSearchParams({sessionId:t});Number.isSafeInteger(n==null?void 0:n.sequence)&&c.set(t.startsWith("runtime:")?"afterSequence":"afterEventId",String(n.sequence)),t.startsWith("runtime:")&&(n!=null&&n.runId)&&c.set("afterRunId",n.runId);const f=this.createEventSource(`/api/agent/stream?${c.toString()}`);let g=!1;this.streams.set(t,f);const m=o.waitForOpen!==!1;let v=m,x=null,C=null,A=null;const I=m?new Promise((O,k)=>{C=O,A=k,x=setTimeout(()=>{v=!1,k(new Error("事件流连接超时"))},8e3)}):Promise.resolve();return f.onopen=()=>{v&&(v=!1,x&&clearTimeout(x),C==null||C())},f.onmessage=O=>{var M,G;if(this.streams.get(t)!==f||!O.data)return;let k;try{k=JSON.parse(O.data)}catch{return}if(typeof k._nativeSequence=="number"){const N=typeof k._nativeRunId=="string"?k._nativeRunId:void 0,T=this.nativeRunRecoveries.get(t),_=k.type==="done"||k.type==="error"||k.type==="turn_aborted";if(N&&((M=this.nativeRunIdentities.get(t))!=null&&M.retired.has(N))||N&&(T!=null&&T.runId)&&T.runId!==N&&this.pendingRuns.has(t)||_&&N&&(T!=null&&T.runId)&&T.runId!==N||!this.acceptNativeStreamEvent(t,k._nativeSequence,N)||_&&(T!=null&&T.awaitingAdmission)||(this.startNativeRunRecovery(t,N),this.isNativeFinalAnswerCoveredBySnapshot(t,k,k._nativeSequence,N)))return}if(k.type==="text_chunk"&&typeof k.text=="string"&&(k.text=this.thinkFilters.get(t).push(k.text),!t.startsWith("runtime:")&&k.text&&this.ordinaryRunStreamText.set(t,(this.ordinaryRunStreamText.get(t)??"")+k.text)),k.type==="done"||k.type==="error"||k.type==="turn_aborted"){const N=((G=this.thinkFilters.get(t))==null?void 0:G.flush())??"";N&&k.type==="done"&&typeof k.finalText=="string"&&(k.finalText=k.finalText+N),g=!0}k.type==="text_chunk"&&k.text===""||(this.dispatchStreamEvent(t,k),(k.type==="done"||k.type==="error"||k.type==="turn_aborted")&&(this.closeStream(t),this.settle(t)))},f.onerror=()=>{if(this.streams.get(t)===f){if(t.startsWith("runtime:")){const O=this.nativeRunRecoveries.get(t);f.readyState===EventSource.CLOSED&&(v&&(v=!1,x&&clearTimeout(x),A==null||A(new Error("事件流连接失败"))),this.closeStream(t)),O&&this.recoverNativeRun(t,O);return}if(v&&f.readyState===EventSource.CLOSED){v=!1,x&&clearTimeout(x),A==null||A(new Error("事件流连接失败"));return}if(f.readyState===EventSource.CLOSED){if(this.closeStream(t),g){this.settle(t);return}(async()=>{let O="";for(let k=0;k<8&&!O;k++){k>0&&await new Promise(M=>setTimeout(M,750));try{const M=await this.getSession(t,{limit:50}),G=(M==null?void 0:M.messages)??[],N=G.map(_=>_.role).lastIndexOf("user"),T=G.slice(N+1).filter(_=>_.role==="assistant"&&(_.content??"").trim()).map(_=>_.content.trim()).join(`
|
|
61
61
|
|
|
@@ -78,7 +78,7 @@ Error generating stack: `+f.message+`
|
|
|
78
78
|
`),r.append(`>>
|
|
79
79
|
`),r.toString()}setMode(r){this.mode=r}setECLevel(r){this.ecLevel=r}setVersion(r){this.version=r}setMaskPattern(r){this.maskPattern=r}setMatrix(r){this.matrix=r}static isValidMaskPattern(r){return r>=0&&r<li.NUM_MASK_PATTERNS}}li.NUM_MASK_PATTERNS=8;class Le extends x{}Le.kind="WriterException";class fe{constructor(){}static clearMatrix(r){r.clear(255)}static buildMatrix(r,i,s,a,l){fe.clearMatrix(l),fe.embedBasicPatterns(s,l),fe.embedTypeInfo(i,a,l),fe.maybeEmbedVersionInfo(s,l),fe.embedDataBits(r,a,l)}static embedBasicPatterns(r,i){fe.embedPositionDetectionPatternsAndSeparators(i),fe.embedDarkDotAtLeftBottomCorner(i),fe.maybeEmbedPositionAdjustmentPatterns(r,i),fe.embedTimingPatterns(i)}static embedTypeInfo(r,i,s){const a=new U;fe.makeTypeInfoBits(r,i,a);for(let l=0,u=a.getSize();l<u;++l){const d=a.get(a.getSize()-1-l),h=fe.TYPE_INFO_COORDINATES[l],p=h[0],w=h[1];if(s.setBoolean(p,w,d),l<8){const E=s.getWidth()-l-1;s.setBoolean(E,8,d)}else{const S=s.getHeight()-7+(l-8);s.setBoolean(8,S,d)}}}static maybeEmbedVersionInfo(r,i){if(r.getVersionNumber()<7)return;const s=new U;fe.makeVersionInfoBits(r,s);let a=6*3-1;for(let l=0;l<6;++l)for(let u=0;u<3;++u){const d=s.get(a);a--,i.setBoolean(l,i.getHeight()-11+u,d),i.setBoolean(i.getHeight()-11+u,l,d)}}static embedDataBits(r,i,s){let a=0,l=-1,u=s.getWidth()-1,d=s.getHeight()-1;for(;u>0;){for(u===6&&(u-=1);d>=0&&d<s.getHeight();){for(let h=0;h<2;++h){const p=u-h;if(!fe.isEmpty(s.get(p,d)))continue;let w;a<r.getSize()?(w=r.get(a),++a):w=!1,i!==255&&it.getDataMaskBit(i,p,d)&&(w=!w),s.setBoolean(p,d,w)}d+=l}l=-l,d+=l,u-=2}if(a!==r.getSize())throw new Le("Not all bits consumed: "+a+"/"+r.getSize())}static findMSBSet(r){return 32-_.numberOfLeadingZeros(r)}static calculateBCHCode(r,i){if(i===0)throw new A("0 polynomial");const s=fe.findMSBSet(i);for(r<<=s-1;fe.findMSBSet(r)>=s;)r^=i<<fe.findMSBSet(r)-s;return r}static makeTypeInfoBits(r,i,s){if(!li.isValidMaskPattern(i))throw new Le("Invalid mask pattern");const a=r.getBits()<<3|i;s.appendBits(a,5);const l=fe.calculateBCHCode(a,fe.TYPE_INFO_POLY);s.appendBits(l,10);const u=new U;if(u.appendBits(fe.TYPE_INFO_MASK_PATTERN,15),s.xor(u),s.getSize()!==15)throw new Le("should not happen but we got: "+s.getSize())}static makeVersionInfoBits(r,i){i.appendBits(r.getVersionNumber(),6);const s=fe.calculateBCHCode(r.getVersionNumber(),fe.VERSION_INFO_POLY);if(i.appendBits(s,12),i.getSize()!==18)throw new Le("should not happen but we got: "+i.getSize())}static isEmpty(r){return r===255}static embedTimingPatterns(r){for(let i=8;i<r.getWidth()-8;++i){const s=(i+1)%2;fe.isEmpty(r.get(i,6))&&r.setNumber(i,6,s),fe.isEmpty(r.get(6,i))&&r.setNumber(6,i,s)}}static embedDarkDotAtLeftBottomCorner(r){if(r.get(8,r.getHeight()-8)===0)throw new Le;r.setNumber(8,r.getHeight()-8,1)}static embedHorizontalSeparationPattern(r,i,s){for(let a=0;a<8;++a){if(!fe.isEmpty(s.get(r+a,i)))throw new Le;s.setNumber(r+a,i,0)}}static embedVerticalSeparationPattern(r,i,s){for(let a=0;a<7;++a){if(!fe.isEmpty(s.get(r,i+a)))throw new Le;s.setNumber(r,i+a,0)}}static embedPositionAdjustmentPattern(r,i,s){for(let a=0;a<5;++a){const l=fe.POSITION_ADJUSTMENT_PATTERN[a];for(let u=0;u<5;++u)s.setNumber(r+u,i+a,l[u])}}static embedPositionDetectionPattern(r,i,s){for(let a=0;a<7;++a){const l=fe.POSITION_DETECTION_PATTERN[a];for(let u=0;u<7;++u)s.setNumber(r+u,i+a,l[u])}}static embedPositionDetectionPatternsAndSeparators(r){const i=fe.POSITION_DETECTION_PATTERN[0].length;fe.embedPositionDetectionPattern(0,0,r),fe.embedPositionDetectionPattern(r.getWidth()-i,0,r),fe.embedPositionDetectionPattern(0,r.getWidth()-i,r);const s=8;fe.embedHorizontalSeparationPattern(0,s-1,r),fe.embedHorizontalSeparationPattern(r.getWidth()-s,s-1,r),fe.embedHorizontalSeparationPattern(0,r.getWidth()-s,r);const a=7;fe.embedVerticalSeparationPattern(a,0,r),fe.embedVerticalSeparationPattern(r.getHeight()-a-1,0,r),fe.embedVerticalSeparationPattern(a,r.getHeight()-a,r)}static maybeEmbedPositionAdjustmentPatterns(r,i){if(r.getVersionNumber()<2)return;const s=r.getVersionNumber()-1,a=fe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[s];for(let l=0,u=a.length;l!==u;l++){const d=a[l];if(d>=0)for(let h=0;h!==u;h++){const p=a[h];p>=0&&fe.isEmpty(i.get(p,d))&&fe.embedPositionAdjustmentPattern(p-2,d-2,i)}}}}fe.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),fe.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),fe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),fe.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),fe.VERSION_INFO_POLY=7973,fe.TYPE_INFO_POLY=1335,fe.TYPE_INFO_MASK_PATTERN=21522;class Fv{constructor(r,i){this.dataBytes=r,this.errorCorrectionBytes=i}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class $e{constructor(){}static calculateMaskPenalty(r){return it.applyMaskPenaltyRule1(r)+it.applyMaskPenaltyRule2(r)+it.applyMaskPenaltyRule3(r)+it.applyMaskPenaltyRule4(r)}static encode(r,i,s=null){let a=$e.DEFAULT_BYTE_MODE_ENCODING;const l=s!==null&&s.get(mt.CHARACTER_SET)!==void 0;l&&(a=s.get(mt.CHARACTER_SET).toString());const u=this.chooseMode(r,a),d=new U;if(u===ce.BYTE&&(l||$e.DEFAULT_BYTE_MODE_ENCODING!==a)){const q=V.getCharacterSetECIByName(a);q!==void 0&&this.appendECI(q,d)}this.appendModeInfo(u,d);const h=new U;this.appendBytes(r,u,h,a);let p;if(s!==null&&s.get(mt.QR_VERSION)!==void 0){const q=Number.parseInt(s.get(mt.QR_VERSION).toString(),10);p=ue.getVersionForNumber(q);const K=this.calculateBitsNeeded(u,d,h,p);if(!this.willFit(K,p,i))throw new Le("Data too big for requested version")}else p=this.recommendVersion(i,u,d,h);const w=new U;w.appendBitArray(d);const E=u===ce.BYTE?h.getSizeInBytes():r.length;this.appendLengthInfo(E,p,u,w),w.appendBitArray(h);const S=p.getECBlocksForLevel(i),b=p.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(b,w);const D=this.interleaveWithECBytes(w,p.getTotalCodewords(),b,S.getNumBlocks()),P=new li;P.setECLevel(i),P.setMode(u),P.setVersion(p);const L=p.getDimensionForVersion(),$=new xa(L,L),Q=this.chooseMaskPattern(D,i,p,$);return P.setMaskPattern(Q),fe.buildMatrix(D,i,p,Q,$),P.setMatrix($),P}static recommendVersion(r,i,s,a){const l=this.calculateBitsNeeded(i,s,a,ue.getVersionForNumber(1)),u=this.chooseVersion(l,r),d=this.calculateBitsNeeded(i,s,a,u);return this.chooseVersion(d,r)}static calculateBitsNeeded(r,i,s,a){return i.getSize()+r.getCharacterCountBits(a)+s.getSize()}static getAlphanumericCode(r){return r<$e.ALPHANUMERIC_TABLE.length?$e.ALPHANUMERIC_TABLE[r]:-1}static chooseMode(r,i=null){if(V.SJIS.getName()===i&&this.isOnlyDoubleByteKanji(r))return ce.KANJI;let s=!1,a=!1;for(let l=0,u=r.length;l<u;++l){const d=r.charAt(l);if($e.isDigit(d))s=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)a=!0;else return ce.BYTE}return a?ce.ALPHANUMERIC:s?ce.NUMERIC:ce.BYTE}static isOnlyDoubleByteKanji(r){let i;try{i=ye.encode(r,V.SJIS)}catch{return!1}const s=i.length;if(s%2!==0)return!1;for(let a=0;a<s;a+=2){const l=i[a]&255;if((l<129||l>159)&&(l<224||l>235))return!1}return!0}static chooseMaskPattern(r,i,s,a){let l=Number.MAX_SAFE_INTEGER,u=-1;for(let d=0;d<li.NUM_MASK_PATTERNS;d++){fe.buildMatrix(r,i,s,d,a);let h=this.calculateMaskPenalty(a);h<l&&(l=h,u=d)}return u}static chooseVersion(r,i){for(let s=1;s<=40;s++){const a=ue.getVersionForNumber(s);if($e.willFit(r,a,i))return a}throw new Le("Data too big")}static willFit(r,i,s){const a=i.getTotalCodewords(),u=i.getECBlocksForLevel(s).getTotalECCodewords(),d=a-u,h=(r+7)/8;return d>=h}static terminateBits(r,i){const s=r*8;if(i.getSize()>s)throw new Le("data bits cannot fit in the QR Code"+i.getSize()+" > "+s);for(let u=0;u<4&&i.getSize()<s;++u)i.appendBit(!1);const a=i.getSize()&7;if(a>0)for(let u=a;u<8;u++)i.appendBit(!1);const l=r-i.getSizeInBytes();for(let u=0;u<l;++u)i.appendBits(u&1?17:236,8);if(i.getSize()!==s)throw new Le("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(r,i,s,a,l,u){if(a>=s)throw new Le("Block ID too large");const d=r%s,h=s-d,p=Math.floor(r/s),w=p+1,E=Math.floor(i/s),S=E+1,b=p-E,D=w-S;if(b!==D)throw new Le("EC bytes mismatch");if(s!==h+d)throw new Le("RS blocks mismatch");if(r!==(E+b)*h+(S+D)*d)throw new Le("Total bytes mismatch");a<h?(l[0]=E,u[0]=b):(l[0]=S,u[0]=D)}static interleaveWithECBytes(r,i,s,a){if(r.getSizeInBytes()!==s)throw new Le("Number of bits and data bytes does not match");let l=0,u=0,d=0;const h=new Array;for(let w=0;w<a;++w){const E=new Int32Array(1),S=new Int32Array(1);$e.getNumDataBytesAndNumECBytesForBlockID(i,s,a,w,E,S);const b=E[0],D=new Uint8Array(b);r.toBytes(8*l,D,0,b);const P=$e.generateECBytes(D,S[0]);h.push(new Fv(D,P)),u=Math.max(u,b),d=Math.max(d,P.length),l+=E[0]}if(s!==l)throw new Le("Data bytes does not match offset");const p=new U;for(let w=0;w<u;++w)for(const E of h){const S=E.getDataBytes();w<S.length&&p.appendBits(S[w],8)}for(let w=0;w<d;++w)for(const E of h){const S=E.getErrorCorrectionBytes();w<S.length&&p.appendBits(S[w],8)}if(i!==p.getSizeInBytes())throw new Le("Interleaving error: "+i+" and "+p.getSizeInBytes()+" differ.");return p}static generateECBytes(r,i){const s=r.length,a=new Int32Array(s+i);for(let u=0;u<s;u++)a[u]=r[u]&255;new tc(Oe.QR_CODE_FIELD_256).encode(a,i);const l=new Uint8Array(i);for(let u=0;u<i;u++)l[u]=a[s+u];return l}static appendModeInfo(r,i){i.appendBits(r.getBits(),4)}static appendLengthInfo(r,i,s,a){const l=s.getCharacterCountBits(i);if(r>=1<<l)throw new Le(r+" is bigger than "+((1<<l)-1));a.appendBits(r,l)}static appendBytes(r,i,s,a){switch(i){case ce.NUMERIC:$e.appendNumericBytes(r,s);break;case ce.ALPHANUMERIC:$e.appendAlphanumericBytes(r,s);break;case ce.BYTE:$e.append8BitBytes(r,s,a);break;case ce.KANJI:$e.appendKanjiBytes(r,s);break;default:throw new Le("Invalid mode: "+i)}}static getDigit(r){return r.charCodeAt(0)-48}static isDigit(r){const i=$e.getDigit(r);return i>=0&&i<=9}static appendNumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=$e.getDigit(r.charAt(a));if(a+2<s){const u=$e.getDigit(r.charAt(a+1)),d=$e.getDigit(r.charAt(a+2));i.appendBits(l*100+u*10+d,10),a+=3}else if(a+1<s){const u=$e.getDigit(r.charAt(a+1));i.appendBits(l*10+u,7),a+=2}else i.appendBits(l,4),a++}}static appendAlphanumericBytes(r,i){const s=r.length;let a=0;for(;a<s;){const l=$e.getAlphanumericCode(r.charCodeAt(a));if(l===-1)throw new Le;if(a+1<s){const u=$e.getAlphanumericCode(r.charCodeAt(a+1));if(u===-1)throw new Le;i.appendBits(l*45+u,11),a+=2}else i.appendBits(l,6),a++}}static append8BitBytes(r,i,s){let a;try{a=ye.encode(r,s)}catch(l){throw new Le(l)}for(let l=0,u=a.length;l!==u;l++){const d=a[l];i.appendBits(d,8)}}static appendKanjiBytes(r,i){let s;try{s=ye.encode(r,V.SJIS)}catch(l){throw new Le(l)}const a=s.length;for(let l=0;l<a;l+=2){const u=s[l]&255,d=s[l+1]&255,h=u<<8&4294967295|d;let p=-1;if(h>=33088&&h<=40956?p=h-33088:h>=57408&&h<=60351&&(p=h-49472),p===-1)throw new Le("Invalid byte sequence");const w=(p>>8)*192+(p&255);i.appendBits(w,13)}}static appendECI(r,i){i.appendBits(ce.ECI.getBits(),4),i.appendBits(r.getValue(),8)}}$e.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),$e.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class ui{write(r,i,s,a=null){if(r.length===0)throw new A("Found empty contents");if(i<0||s<0)throw new A("Requested dimensions are too small: "+i+"x"+s);let l=je.L,u=ui.QUIET_ZONE_SIZE;a!==null&&(a.get(mt.ERROR_CORRECTION)!==void 0&&(l=je.fromString(a.get(mt.ERROR_CORRECTION).toString())),a.get(mt.MARGIN)!==void 0&&(u=Number.parseInt(a.get(mt.MARGIN).toString(),10)));const d=$e.encode(r,l,a);return this.renderResult(d,i,s,u)}writeToDom(r,i,s,a,l=null){typeof r=="string"&&(r=document.querySelector(r));const u=this.write(i,s,a,l);r&&r.appendChild(u)}renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Hr;const u=l.getWidth(),d=l.getHeight(),h=u+a*2,p=d+a*2,w=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(w/h),Math.floor(E/p)),b=Math.floor((w-u*S)/2),D=Math.floor((E-d*S)/2),P=this.createSVGElement(w,E);for(let L=0,$=D;L<d;L++,$+=S)for(let Q=0,q=b;Q<u;Q++,q+=S)if(l.get(Q,L)===1){const K=this.createSvgRectElement(q,$,S,S);P.appendChild(K)}return P}createSVGElement(r,i){const s=document.createElementNS(ui.SVG_NS,"svg");return s.setAttributeNS(null,"height",r.toString()),s.setAttributeNS(null,"width",i.toString()),s}createSvgRectElement(r,i,s,a){const l=document.createElementNS(ui.SVG_NS,"rect");return l.setAttributeNS(null,"x",r.toString()),l.setAttributeNS(null,"y",i.toString()),l.setAttributeNS(null,"height",s.toString()),l.setAttributeNS(null,"width",a.toString()),l.setAttributeNS(null,"fill","#000000"),l}}ui.QUIET_ZONE_SIZE=4,ui.SVG_NS="http://www.w3.org/2000/svg";class Li{encode(r,i,s,a,l){if(r.length===0)throw new A("Found empty contents");if(i!==le.QR_CODE)throw new A("Can only encode QR_CODE, but got "+i);if(s<0||a<0)throw new A(`Requested dimensions are too small: ${s}x${a}`);let u=je.L,d=Li.QUIET_ZONE_SIZE;l!==null&&(l.get(mt.ERROR_CORRECTION)!==void 0&&(u=je.fromString(l.get(mt.ERROR_CORRECTION).toString())),l.get(mt.MARGIN)!==void 0&&(d=Number.parseInt(l.get(mt.MARGIN).toString(),10)));const h=$e.encode(r,u,l);return Li.renderResult(h,s,a,d)}static renderResult(r,i,s,a){const l=r.getMatrix();if(l===null)throw new Hr;const u=l.getWidth(),d=l.getHeight(),h=u+a*2,p=d+a*2,w=Math.max(i,h),E=Math.max(s,p),S=Math.min(Math.floor(w/h),Math.floor(E/p)),b=Math.floor((w-u*S)/2),D=Math.floor((E-d*S)/2),P=new Te(w,E);for(let L=0,$=D;L<d;L++,$+=S)for(let Q=0,q=b;Q<u;Q++,q+=S)l.get(Q,L)===1&&P.setRegion(q,$,S,S);return P}}Li.QUIET_ZONE_SIZE=4;class Uv{encode(r,i,s,a,l){let u;switch(i){case le.QR_CODE:u=new Li;break;default:throw new A("No encoder available for format "+i)}return u.encode(r,i,s,a,l)}}class Kr extends te{constructor(r,i,s,a,l,u,d,h){if(super(u,d),this.yuvData=r,this.dataWidth=i,this.dataHeight=s,this.left=a,this.top=l,a+u>i||l+d>s)throw new A("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(u,d)}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("Requested row is outside the image: "+r);const s=this.getWidth();(i==null||i.length<s)&&(i=new Uint8ClampedArray(s));const a=(r+this.top)*this.dataWidth+this.left;return M.arraycopy(this.yuvData,a,i,0,s),i}getMatrix(){const r=this.getWidth(),i=this.getHeight();if(r===this.dataWidth&&i===this.dataHeight)return this.yuvData;const s=r*i,a=new Uint8ClampedArray(s);let l=this.top*this.dataWidth+this.left;if(r===this.dataWidth)return M.arraycopy(this.yuvData,l,a,0,s),a;for(let u=0;u<i;u++){const d=u*r;M.arraycopy(this.yuvData,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new Kr(this.yuvData,this.dataWidth,this.dataHeight,this.left+r,this.top+i,s,a,!1)}renderThumbnail(){const r=this.getWidth()/Kr.THUMBNAIL_SCALE_FACTOR,i=this.getHeight()/Kr.THUMBNAIL_SCALE_FACTOR,s=new Int32Array(r*i),a=this.yuvData;let l=this.top*this.dataWidth+this.left;for(let u=0;u<i;u++){const d=u*r;for(let h=0;h<r;h++){const p=a[l+h*Kr.THUMBNAIL_SCALE_FACTOR]&255;s[d+h]=4278190080|p*65793}l+=this.dataWidth*Kr.THUMBNAIL_SCALE_FACTOR}return s}getThumbnailWidth(){return this.getWidth()/Kr.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Kr.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(r,i){const s=this.yuvData;for(let a=0,l=this.top*this.dataWidth+this.left;a<i;a++,l+=this.dataWidth){const u=l+r/2;for(let d=l,h=l+r-1;d<u;d++,h--){const p=s[d];s[d]=s[h],s[h]=p}}}invert(){return new de(this)}}Kr.THUMBNAIL_SCALE_FACTOR=2;class rc extends te{constructor(r,i,s,a,l,u,d){if(super(i,s),this.dataWidth=a,this.dataHeight=l,this.left=u,this.top=d,r.BYTES_PER_ELEMENT===4){const h=i*s,p=new Uint8ClampedArray(h);for(let w=0;w<h;w++){const E=r[w],S=E>>16&255,b=E>>7&510,D=E&255;p[w]=(S+b+D)/4&255}this.luminances=p}else this.luminances=r;if(a===void 0&&(this.dataWidth=i),l===void 0&&(this.dataHeight=s),u===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+i>this.dataWidth||this.top+s>this.dataHeight)throw new A("Crop rectangle does not fit within image data.")}getRow(r,i){if(r<0||r>=this.getHeight())throw new A("Requested row is outside the image: "+r);const s=this.getWidth();(i==null||i.length<s)&&(i=new Uint8ClampedArray(s));const a=(r+this.top)*this.dataWidth+this.left;return M.arraycopy(this.luminances,a,i,0,s),i}getMatrix(){const r=this.getWidth(),i=this.getHeight();if(r===this.dataWidth&&i===this.dataHeight)return this.luminances;const s=r*i,a=new Uint8ClampedArray(s);let l=this.top*this.dataWidth+this.left;if(r===this.dataWidth)return M.arraycopy(this.luminances,l,a,0,s),a;for(let u=0;u<i;u++){const d=u*r;M.arraycopy(this.luminances,l,a,d,r),l+=this.dataWidth}return a}isCropSupported(){return!0}crop(r,i,s,a){return new rc(this.luminances,s,a,this.dataWidth,this.dataHeight,this.left+r,this.top+i)}invert(){return new de(this)}}class Wd extends V{static forName(r){return this.getCharacterSetECIByName(r)}}class nc{}nc.ISO_8859_1=V.ISO8859_1;class $d{isCompact(){return this.compact}setCompact(r){this.compact=r}getSize(){return this.size}setSize(r){this.size=r}getLayers(){return this.layers}setLayers(r){this.layers=r}getCodeWords(){return this.codeWords}setCodeWords(r){this.codeWords=r}getMatrix(){return this.matrix}setMatrix(r){this.matrix=r}}class Vd{static singletonList(r){return[r]}static min(r,i){return r.sort(i)[0]}}class jv{constructor(r){this.previous=r}getPrevious(){return this.previous}}class Fi extends jv{constructor(r,i,s){super(r),this.value=i,this.bitCount=s}appendTo(r,i){r.appendBits(this.value,this.bitCount)}add(r,i){return new Fi(this,r,i)}addBinaryShift(r,i){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Fi(this,r,i)}toString(){let r=this.value&(1<<this.bitCount)-1;return r|=1<<this.bitCount,"<"+_.toBinaryString(r|1<<this.bitCount).substring(1)+">"}}class ic extends Fi{constructor(r,i,s){super(r,0,0),this.binaryShiftStart=i,this.binaryShiftByteCount=s}appendTo(r,i){for(let s=0;s<this.binaryShiftByteCount;s++)(s===0||s===31&&this.binaryShiftByteCount<=62)&&(r.appendBits(31,5),this.binaryShiftByteCount>62?r.appendBits(this.binaryShiftByteCount-31,16):s===0?r.appendBits(Math.min(this.binaryShiftByteCount,31),5):r.appendBits(this.binaryShiftByteCount-31,5)),r.appendBits(i[this.binaryShiftStart+s],8)}addBinaryShift(r,i){return new ic(this,r,i)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Wv(y,r,i){return new ic(y,r,i)}function $s(y,r,i){return new Fi(y,r,i)}const $v=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Dn=0,ma=1,Sr=2,zd=3,Zr=4,Vv=new Fi(null,0,0),sc=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function zv(y){for(let r of y)T.fill(r,-1);return y[Dn][Zr]=0,y[ma][Zr]=0,y[ma][Dn]=28,y[zd][Zr]=0,y[Sr][Zr]=0,y[Sr][Dn]=15,y}const Hd=zv(T.createInt32Array(6,6));class Qr{constructor(r,i,s,a){this.token=r,this.mode=i,this.binaryShiftByteCount=s,this.bitCount=a}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(r,i){let s=this.bitCount,a=this.token;if(r!==this.mode){let u=sc[this.mode][r];a=$s(a,u&65535,u>>16),s+=u>>16}let l=r===Sr?4:5;return a=$s(a,i,l),new Qr(a,r,0,s+l)}shiftAndAppend(r,i){let s=this.token,a=this.mode===Sr?4:5;return s=$s(s,Hd[this.mode][r],a),s=$s(s,i,5),new Qr(s,this.mode,0,this.bitCount+a+5)}addBinaryShiftChar(r){let i=this.token,s=this.mode,a=this.bitCount;if(this.mode===Zr||this.mode===Sr){let d=sc[s][Dn];i=$s(i,d&65535,d>>16),a+=d>>16,s=Dn}let l=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,u=new Qr(i,s,this.binaryShiftByteCount+1,a+l);return u.binaryShiftByteCount===2078&&(u=u.endBinaryShift(r+1)),u}endBinaryShift(r){if(this.binaryShiftByteCount===0)return this;let i=this.token;return i=Wv(i,r-this.binaryShiftByteCount,this.binaryShiftByteCount),new Qr(i,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(r){let i=this.bitCount+(sc[this.mode][r.mode]>>16);return this.binaryShiftByteCount<r.binaryShiftByteCount?i+=Qr.calculateBinaryShiftCost(r)-Qr.calculateBinaryShiftCost(this):this.binaryShiftByteCount>r.binaryShiftByteCount&&r.binaryShiftByteCount>0&&(i+=10),i<=r.bitCount}toBitArray(r){let i=[];for(let a=this.endBinaryShift(r.length).token;a!==null;a=a.getPrevious())i.unshift(a);let s=new U;for(const a of i)a.appendTo(s,r);return s}toString(){return se.format("%s bits=%d bytes=%d",$v[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(r){return r.binaryShiftByteCount>62?21:r.binaryShiftByteCount>31?20:r.binaryShiftByteCount>0?10:0}}Qr.INITIAL_STATE=new Qr(Vv,Dn,0,0);function Hv(y){const r=se.getCharCode(" "),i=se.getCharCode("."),s=se.getCharCode(",");y[Dn][r]=1;const a=se.getCharCode("Z"),l=se.getCharCode("A");for(let S=l;S<=a;S++)y[Dn][S]=S-l+2;y[ma][r]=1;const u=se.getCharCode("z"),d=se.getCharCode("a");for(let S=d;S<=u;S++)y[ma][S]=S-d+2;y[Sr][r]=1;const h=se.getCharCode("9"),p=se.getCharCode("0");for(let S=p;S<=h;S++)y[Sr][S]=S-p+2;y[Sr][s]=12,y[Sr][i]=13;const w=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
80
80
|
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<w.length;S++)y[zd][se.getCharCode(w[S])]=S;const E=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<E.length;S++)se.getCharCode(E[S])>0&&(y[Zr][se.getCharCode(E[S])]=S);return y}const oc=Hv(T.createInt32Array(5,256));class Vs{constructor(r){this.text=r}encode(){const r=se.getCharCode(" "),i=se.getCharCode(`
|
|
81
|
-
`);let s=Vd.singletonList(Qr.INITIAL_STATE);for(let l=0;l<this.text.length;l++){let u,d=l+1<this.text.length?this.text[l+1]:0;switch(this.text[l]){case se.getCharCode("\r"):u=d===i?2:0;break;case se.getCharCode("."):u=d===r?3:0;break;case se.getCharCode(","):u=d===r?4:0;break;case se.getCharCode(":"):u=d===r?5:0;break;default:u=0}u>0?(s=Vs.updateStateListForPair(s,l,u),l++):s=this.updateStateListForChar(s,l)}return Vd.min(s,(l,u)=>l.getBitCount()-u.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,i){const s=[];for(let a of r)this.updateStateForChar(a,i,s);return Vs.simplifyStates(s)}updateStateForChar(r,i,s){let a=this.text[i]&255,l=oc[r.getMode()][a]>0,u=null;for(let d=0;d<=Zr;d++){let h=oc[d][a];if(h>0){if(u==null&&(u=r.endBinaryShift(i)),!l||d===r.getMode()||d===Sr){const p=u.latchAndAppend(d,h);s.push(p)}if(!l&&Hd[r.getMode()][d]>=0){const p=u.shiftAndAppend(d,h);s.push(p)}}}if(r.getBinaryShiftByteCount()>0||oc[r.getMode()][a]===0){let d=r.addBinaryShiftChar(i);s.push(d)}}static updateStateListForPair(r,i,s){const a=[];for(let l of r)this.updateStateForPair(l,i,s,a);return this.simplifyStates(a)}static updateStateForPair(r,i,s,a){let l=r.endBinaryShift(i);if(a.push(l.latchAndAppend(Zr,s)),r.getMode()!==Zr&&a.push(l.shiftAndAppend(Zr,s)),s===3||s===4){let u=l.latchAndAppend(Sr,16-s).latchAndAppend(Sr,1);a.push(u)}if(r.getBinaryShiftByteCount()>0){let u=r.addBinaryShiftChar(i).addBinaryShiftChar(i+1);a.push(u)}}static simplifyStates(r){let i=[];for(const s of r){let a=!0;for(const l of i){if(l.isBetterThanOrEqualTo(s)){a=!1;break}s.isBetterThanOrEqualTo(l)&&(i=i.filter(u=>u!==l))}a&&i.push(s)}return i}}class be{constructor(){}static encodeBytes(r){return be.encode(r,be.DEFAULT_EC_PERCENT,be.DEFAULT_AZTEC_LAYERS)}static encode(r,i,s){let a=new Vs(r).encode(),l=_.truncDivision(a.getSize()*i,100)+11,u=a.getSize()+l,d,h,p,w,E;if(s!==be.DEFAULT_AZTEC_LAYERS){if(d=s<0,h=Math.abs(s),h>(d?be.MAX_NB_BITS_COMPACT:be.MAX_NB_BITS))throw new A(se.format("Illegal value %s for layers",s));p=be.totalBitsInLayer(h,d),w=be.WORD_SIZE[h];let K=p-p%w;if(E=be.stuffBits(a,w),E.getSize()+l>K)throw new A("Data to large for user specified layer");if(d&&E.getSize()>w*64)throw new A("Data to large for user specified layer")}else{w=0,E=null;for(let K=0;;K++){if(K>be.MAX_NB_BITS)throw new A("Data too large for an Aztec code");if(d=K<=3,h=d?K+1:K,p=be.totalBitsInLayer(h,d),u>p)continue;(E==null||w!==be.WORD_SIZE[h])&&(w=be.WORD_SIZE[h],E=be.stuffBits(a,w));let Ae=p-p%w;if(!(d&&E.getSize()>w*64)&&E.getSize()+l<=Ae)break}}let S=be.generateCheckWords(E,p,w),b=E.getSize()/w,D=be.generateModeMessage(d,h,b),P=(d?11:14)+h*4,L=new Int32Array(P),$;if(d){$=P;for(let K=0;K<L.length;K++)L[K]=K}else{$=P+1+2*_.truncDivision(_.truncDivision(P,2)-1,15);let K=_.truncDivision(P,2),Ae=_.truncDivision($,2);for(let me=0;me<K;me++){let er=me+_.truncDivision(me,15);L[K-me-1]=Ae-er-1,L[K+me]=Ae+er+1}}let Q=new Te($);for(let K=0,Ae=0;K<h;K++){let me=(h-K)*4+(d?9:12);for(let er=0;er<me;er++){let Mr=er*2;for(let tr=0;tr<2;tr++)S.get(Ae+Mr+tr)&&Q.set(L[K*2+tr],L[K*2+er]),S.get(Ae+me*2+Mr+tr)&&Q.set(L[K*2+er],L[P-1-K*2-tr]),S.get(Ae+me*4+Mr+tr)&&Q.set(L[P-1-K*2-tr],L[P-1-K*2-er]),S.get(Ae+me*6+Mr+tr)&&Q.set(L[P-1-K*2-er],L[K*2+tr])}Ae+=me*8}if(be.drawModeMessage(Q,d,$,D),d)be.drawBullsEye(Q,_.truncDivision($,2),5);else{be.drawBullsEye(Q,_.truncDivision($,2),7);for(let K=0,Ae=0;K<_.truncDivision(P,2)-1;K+=15,Ae+=16)for(let me=_.truncDivision($,2)&1;me<$;me+=2)Q.set(_.truncDivision($,2)-Ae,me),Q.set(_.truncDivision($,2)+Ae,me),Q.set(me,_.truncDivision($,2)-Ae),Q.set(me,_.truncDivision($,2)+Ae)}let q=new $d;return q.setCompact(d),q.setSize($),q.setLayers(h),q.setCodeWords(b),q.setMatrix(Q),q}static drawBullsEye(r,i,s){for(let a=0;a<s;a+=2)for(let l=i-a;l<=i+a;l++)r.set(l,i-a),r.set(l,i+a),r.set(i-a,l),r.set(i+a,l);r.set(i-s,i-s),r.set(i-s+1,i-s),r.set(i-s,i-s+1),r.set(i+s,i-s),r.set(i+s,i-s+1),r.set(i+s,i+s-1)}static generateModeMessage(r,i,s){let a=new U;return r?(a.appendBits(i-1,2),a.appendBits(s-1,6),a=be.generateCheckWords(a,28,4)):(a.appendBits(i-1,5),a.appendBits(s-1,11),a=be.generateCheckWords(a,40,4)),a}static drawModeMessage(r,i,s,a){let l=_.truncDivision(s,2);if(i)for(let u=0;u<7;u++){let d=l-3+u;a.get(u)&&r.set(d,l-5),a.get(u+7)&&r.set(l+5,d),a.get(20-u)&&r.set(d,l+5),a.get(27-u)&&r.set(l-5,d)}else for(let u=0;u<10;u++){let d=l-5+u+_.truncDivision(u,5);a.get(u)&&r.set(d,l-7),a.get(u+10)&&r.set(l+7,d),a.get(29-u)&&r.set(d,l+7),a.get(39-u)&&r.set(l-7,d)}}static generateCheckWords(r,i,s){let a=r.getSize()/s,l=new tc(be.getGF(s)),u=_.truncDivision(i,s),d=be.bitsToWords(r,s,u);l.encode(d,u-a);let h=i%s,p=new U;p.appendBits(0,h);for(const w of Array.from(d))p.appendBits(w,s);return p}static bitsToWords(r,i,s){let a=new Int32Array(s),l,u;for(l=0,u=r.getSize()/i;l<u;l++){let d=0;for(let h=0;h<i;h++)d|=r.get(l*i+h)?1<<i-h-1:0;a[l]=d}return a}static getGF(r){switch(r){case 4:return Oe.AZTEC_PARAM;case 6:return Oe.AZTEC_DATA_6;case 8:return Oe.AZTEC_DATA_8;case 10:return Oe.AZTEC_DATA_10;case 12:return Oe.AZTEC_DATA_12;default:throw new A("Unsupported word size "+r)}}static stuffBits(r,i){let s=new U,a=r.getSize(),l=(1<<i)-2;for(let u=0;u<a;u+=i){let d=0;for(let h=0;h<i;h++)(u+h>=a||r.get(u+h))&&(d|=1<<i-1-h);(d&l)===l?(s.appendBits(d&l,i),u--):d&l?s.appendBits(d,i):(s.appendBits(d|1,i),u--)}return s}static totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}be.DEFAULT_EC_PERCENT=33,be.DEFAULT_AZTEC_LAYERS=0,be.MAX_NB_BITS=32,be.MAX_NB_BITS_COMPACT=4,be.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class wa{encode(r,i,s,a){return this.encodeWithHints(r,i,s,a,null)}encodeWithHints(r,i,s,a,l){let u=nc.ISO_8859_1,d=be.DEFAULT_EC_PERCENT,h=be.DEFAULT_AZTEC_LAYERS;return l!=null&&(l.has(mt.CHARACTER_SET)&&(u=Wd.forName(l.get(mt.CHARACTER_SET).toString())),l.has(mt.ERROR_CORRECTION)&&(d=_.parseInt(l.get(mt.ERROR_CORRECTION).toString())),l.has(mt.AZTEC_LAYERS)&&(h=_.parseInt(l.get(mt.AZTEC_LAYERS).toString()))),wa.encodeLayers(r,i,s,a,u,d,h)}static encodeLayers(r,i,s,a,l,u,d){if(i!==le.AZTEC)throw new A("Can only encode AZTEC, but got "+i);let h=be.encode(se.getBytes(r,l),u,d);return wa.renderResult(h,s,a)}static renderResult(r,i,s){let a=r.getMatrix();if(a==null)throw new Hr;let l=a.getWidth(),u=a.getHeight(),d=Math.max(i,l),h=Math.max(s,u),p=Math.min(d/l,h/u),w=(d-l*p)/2,E=(h-u*p)/2,S=new Te(d,h);for(let b=0,D=E;b<u;b++,D+=p)for(let P=0,L=w;P<l;P++,L+=p)a.get(P,b)&&S.setRegion(L,D,p,p);return S}}n.AbstractExpandedDecoder=Hu,n.ArgumentException=C,n.ArithmeticException=oa,n.AztecCode=$d,n.AztecCodeReader=ua,n.AztecCodeWriter=wa,n.AztecDecoder=Ue,n.AztecDetector=bd,n.AztecDetectorResult=Td,n.AztecEncoder=be,n.AztecHighLevelEncoder=Vs,n.AztecPoint=Vt,n.BarcodeFormat=le,n.Binarizer=k,n.BinaryBitmap=I,n.BitArray=U,n.BitMatrix=Te,n.BitSource=Ku,n.BrowserAztecCodeReader=mv,n.BrowserBarcodeReader=Cv,n.BrowserCodeReader=yr,n.BrowserDatamatrixCodeReader=Sv,n.BrowserMultiFormatReader=kv,n.BrowserPDF417Reader=Bv,n.BrowserQRCodeReader=Lv,n.BrowserQRCodeSvgWriter=ui,n.CharacterSetECI=V,n.ChecksumException=O,n.Code128Reader=J,n.Code39Reader=pt,n.DataMatrixDecodedBitStreamParser=bn,n.DataMatrixReader=_n,n.DecodeHintType=j,n.DecoderResult=Ds,n.DefaultGridSampler=Rd,n.DetectorResult=la,n.EAN13Reader=ii,n.EncodeHintType=mt,n.Exception=x,n.FormatException=B,n.GenericGF=Oe,n.GenericGFPoly=Zt,n.GlobalHistogramBinarizer=tt,n.GridSampler=Wu,n.GridSamplerInstance=Tn,n.HTMLCanvasElementLuminanceSource=pe,n.HybridBinarizer=xe,n.ITFReader=Be,n.IllegalArgumentException=A,n.IllegalStateException=Hr,n.InvertedLuminanceSource=de,n.LuminanceSource=te,n.MathUtils=Re,n.MultiFormatOneDReader=ki,n.MultiFormatReader=jd,n.MultiFormatWriter=Uv,n.NotFoundException=H,n.OneDReader=dt,n.PDF417DecodedBitStreamParser=W,n.PDF417DecoderErrorCorrection=Pd,n.PDF417Reader=_t,n.PDF417ResultMetadata=Bd,n.PerspectiveTransform=Nr,n.PlanarYUVLuminanceSource=Kr,n.QRCodeByteMatrix=xa,n.QRCodeDataMask=Cr,n.QRCodeDecodedBitStreamParser=Ze,n.QRCodeDecoderErrorCorrectionLevel=je,n.QRCodeDecoderFormatInformation=Ft,n.QRCodeEncoder=$e,n.QRCodeEncoderQRCode=li,n.QRCodeMaskUtil=it,n.QRCodeMatrixUtil=fe,n.QRCodeMode=ce,n.QRCodeReader=On,n.QRCodeVersion=ue,n.QRCodeWriter=Li,n.RGBLuminanceSource=rc,n.RSS14Reader=nt,n.RSSExpandedReader=Y,n.ReaderException=pa,n.ReedSolomonDecoder=Ps,n.ReedSolomonEncoder=tc,n.ReedSolomonException=Ni,n.Result=Ke,n.ResultMetadataType=Ct,n.ResultPoint=ae,n.StringUtils=se,n.UnsupportedOperationException=oe,n.VideoInputDevice=He,n.WhiteRectangleDetector=an,n.WriterException=Le,n.ZXingArrays=T,n.ZXingCharset=Wd,n.ZXingInteger=_,n.ZXingStandardCharsets=nc,n.ZXingStringBuilder=ge,n.ZXingStringEncoding=ye,n.ZXingSystem=M,n.createAbstractExpandedDecoder=Dd,Object.defineProperty(n,"__esModule",{value:!0})})})(P1,P1.exports);var Qe=P1.exports;const F_=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var $p=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,Qe.BarcodeFormat.QR_CODE],[re.AZTEC,Qe.BarcodeFormat.AZTEC],[re.CODABAR,Qe.BarcodeFormat.CODABAR],[re.CODE_39,Qe.BarcodeFormat.CODE_39],[re.CODE_93,Qe.BarcodeFormat.CODE_93],[re.CODE_128,Qe.BarcodeFormat.CODE_128],[re.DATA_MATRIX,Qe.BarcodeFormat.DATA_MATRIX],[re.MAXICODE,Qe.BarcodeFormat.MAXICODE],[re.ITF,Qe.BarcodeFormat.ITF],[re.EAN_13,Qe.BarcodeFormat.EAN_13],[re.EAN_8,Qe.BarcodeFormat.EAN_8],[re.PDF_417,Qe.BarcodeFormat.PDF_417],[re.RSS_14,Qe.BarcodeFormat.RSS_14],[re.RSS_EXPANDED,Qe.BarcodeFormat.RSS_EXPANDED],[re.UPC_A,Qe.BarcodeFormat.UPC_A],[re.UPC_E,Qe.BarcodeFormat.UPC_E],[re.UPC_EAN_EXTENSION,Qe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!F_)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=o;var c=this.createZXingFormats(t),f=new Map;f.set(Qe.DecodeHintType.POSSIBLE_FORMATS,c),f.set(Qe.DecodeHintType.TRY_HARDER,!1),this.hints=f}return e.prototype.decodeAsync=function(t){var n=this;return new Promise(function(o,c){try{o(n.decode(t))}catch(f){c(f)}})},e.prototype.decode=function(t){var n=new Qe.MultiFormatReader(this.verbose,this.hints),o=new Qe.HTMLCanvasElementLuminanceSource(t),c=new Qe.BinaryBitmap(new Qe.HybridBinarizer(o)),f=n.decode(c);return{text:f.text,format:dv.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createZXingFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return n},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),U_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},j_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Vp=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,"qr_code"],[re.AZTEC,"aztec"],[re.CODABAR,"codabar"],[re.CODE_39,"code_39"],[re.CODE_93,"code_93"],[re.CODE_128,"code_128"],[re.DATA_MATRIX,"data_matrix"],[re.ITF,"itf"],[re.EAN_13,"ean_13"],[re.EAN_8,"ean_8"],[re.PDF_417,"pdf417"],[re.UPC_A,"upc_a"],[re.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=o;var c=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(c),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var t=new BarcodeDetector({formats:["qr_code"]});return typeof t<"u"},e.prototype.decodeAsync=function(t){return U_(this,void 0,void 0,function(){var n,o;return j_(this,function(c){switch(c.label){case 0:return[4,this.detector.detect(t)];case 1:if(n=c.sent(),!n||n.length===0)throw"No barcode or QR code detected.";return o=this.selectLargestBarcode(n),[2,{text:o.rawValue,format:dv.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var n=null,o=0,c=0,f=t;c<f.length;c++){var g=f[c],m=g.boundingBox.width*g.boundingBox.height;m>o&&(o=m,n=g)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:n}},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),zp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Hp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},W_=function(){function e(t,n,o,c){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=o,n&&Vp.isSupported()?(this.primaryDecoder=new Vp(t,o,c),this.secondaryDecoder=new $p(t,o,c)):this.primaryDecoder=new $p(t,o,c)}return e.prototype.decodeAsync=function(t){return zp(this,void 0,void 0,function(){var n;return Hp(this,function(o){switch(o.label){case 0:n=performance.now(),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,o.sent()];case 3:return this.possiblyLogPerformance(n),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(t){return zp(this,void 0,void 0,function(){var n,o;return Hp(this,function(c){switch(c.label){case 0:n=performance.now(),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(t)];case 2:return[2,c.sent()];case 3:if(o=c.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw o;case 4:return this.possiblyLogPerformance(n),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(t){if(this.verbose){var n=performance.now()-t;this.executionResults.push(n),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,n=0,o=this.executionResults;n<o.length;n++){var c=o[n];t+=c}var f=t/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),Sd=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),ru=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},nu=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},gv=function(){function e(t,n){this.name=t,this.track=n}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(t){var n={};n[this.name]=t;var o={advanced:[n]};return this.track.applyConstraints(o)},e.prototype.value=function(){var t=this.track.getSettings();if(this.name in t){var n=t[this.name];return n}return null},e}(),$_=function(e){Sd(t,e);function t(n,o){return e.call(this,n,o)||this}return t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(n){var o={};o[this.name]=n;var c={advanced:[o]};return this.track.applyConstraints(c)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var n=this.track.getCapabilities(),o=n[this.name];return{min:o.min,max:o.max,step:o.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(gv),V_=function(e){Sd(t,e);function t(n){return e.call(this,"zoom",n)||this}return t}($_),z_=function(e){Sd(t,e);function t(n){return e.call(this,"torch",n)||this}return t}(gv),H_=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new V_(this.track)},e.prototype.torchFeature=function(){return new z_(this.track)},e}(),G_=function(){function e(t,n,o){this.isClosed=!1,this.parentElement=t,this.mediaStream=n,this.callbacks=o,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return e.prototype.createVideoElement=function(t){var n=document.createElement("video");return n.style.width="".concat(t,"px"),n.style.display="block",n.muted=!0,n.setAttribute("muted","true"),n.playsInline=!0,n},e.prototype.setupSurface=function(){var t=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var n=function(){var o=t.surface.clientWidth,c=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(o,c),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,o,c){return ru(this,void 0,void 0,function(){var f,g;return nu(this,function(m){switch(m.label){case 0:return f=new e(t,n,c),o.aspectRatio?(g={aspectRatio:o.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(g)]):[3,2];case 1:m.sent(),m.label=2;case 2:return f.setupSurface(),[2,f]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(t){this.failIfClosed();var n=this,o=function(){setTimeout(t,200),n.surface.removeEventListener("playing",o)};this.surface.addEventListener("playing",o),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(t){return ru(this,void 0,void 0,function(){return nu(this,function(n){if("aspectRatio"in t)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(t)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var t=this;return new Promise(function(n,o){var c=t.mediaStream.getVideoTracks(),f=c.length,g=0;t.mediaStream.getVideoTracks().forEach(function(m){t.mediaStream.removeTrack(m),m.stop(),++g,g>=f&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new H_(this.getFirstTrackOrFail())},e}(),X_=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,o){return ru(this,void 0,void 0,function(){return nu(this,function(c){return[2,G_.create(t,this.mediaStream,n,o)]})})},e.create=function(t){return ru(this,void 0,void 0,function(){var n,o;return nu(this,function(c){switch(c.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return o=c.sent(),[2,new e(o)]}})})},e}(),Gp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Xp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Y_=function(){function e(){}return e.failIfNotSupported=function(){return Gp(this,void 0,void 0,function(){return Xp(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return Gp(this,void 0,void 0,function(){return Xp(this,function(n){return[2,X_.create(t)]})})},e}(),K_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Z_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Q_=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=ss.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=ss.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var t=location.host.split(":")[0];return t==="127.0.0.1"||t==="localhost"},e.getCamerasFromMediaDevices=function(){return K_(this,void 0,void 0,function(){var t,n,o,c,f,g,m;return Z_(this,function(v){switch(v.label){case 0:return t=function(x){for(var C=x.getVideoTracks(),A=0,I=C;A<I.length;A++){var O=I[A];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=v.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(o=v.sent(),c=[],f=0,g=o;f<g.length;f++)m=g[f],m.kind==="videoinput"&&c.push({id:m.deviceId,label:m.label});return t(n),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,n){var o=function(f){for(var g=[],m=0,v=f;m<v.length;m++){var x=v[m];x.kind==="video"&&g.push({id:x.id,label:x.label})}t(g)},c=MediaStreamTrack;c.getSources(o)})},e}(),st;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(st||(st={}));var q_=function(){function e(){this.state=st.NOT_STARTED,this.onGoingTransactionNewState=st.UNKNOWN}return e.prototype.directTransition=function(t){this.failIfTransitionOngoing(),this.validateTransition(t),this.state=t},e.prototype.startTransition=function(t){return this.failIfTransitionOngoing(),this.validateTransition(t),this.onGoingTransactionNewState=t,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===st.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=st.UNKNOWN,this.directTransition(t)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===st.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=st.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==st.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(t){switch(this.state){case st.UNKNOWN:throw"Transition from unknown is not allowed";case st.NOT_STARTED:this.failIfNewStateIs(t,[st.PAUSED]);break;case st.SCANNING:break;case st.PAUSED:break}},e.prototype.failIfNewStateIs=function(t,n){for(var o=0,c=n;o<c.length;o++){var f=c[o];if(t===f)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),J_=function(){function e(t){this.stateManager=t}return e.prototype.startTransition=function(t){return this.stateManager.startTransition(t)},e.prototype.directTransition=function(t){this.stateManager.directTransition(t)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===st.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==st.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===st.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===st.PAUSED},e}(),eO=function(){function e(){}return e.create=function(){return new J_(new q_)},e}(),tO=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),fr=function(e){tO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(k_),rO=function(){function e(t,n){this.logger=n,this.fps=fr.SCAN_DEFAULT_FPS,t?(t.fps&&(this.fps=t.fps),this.disableFlip=t.disableFlip===!0,this.qrbox=t.qrbox,this.aspectRatio=t.aspectRatio,this.videoConstraints=t.videoConstraints):this.disableFlip=fr.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?hv.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!ln(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),bO=function(){function e(t,n){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(t))throw"HTML Element with id=".concat(t," not found");this.elementId=t,this.verbose=!1;var o;typeof n=="boolean"?this.verbose=n===!0:n&&(o=n,this.verbose=o.verbose===!0,o.experimentalFeatures),this.logger=new L_(this.verbose),this.qrcode=new W_(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=eO.create()}return e.prototype.start=function(t,n,o,c){var f=this;if(!t)throw"cameraIdOrConfig is required";if(!o||typeof o!="function")throw"qrCodeSuccessCallback is required and should be a function.";var g;c?g=c:g=this.verbose?this.logger.log:function(){};var m=rO.create(n,this.logger);this.clearElement();var v=!1;m.videoConstraints&&(m.isMediaStreamConstraintsValid()?v=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=v,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:fr.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var A=this,I=this.stateManagerProxy.startTransition(st.SCANNING);return new Promise(function(O,k){var M=x?m.videoConstraints:A.createVideoConstraints(t);if(!M){I.cancel(),k("videoConstraints should be defined");return}var G={};(!x||m.aspectRatio)&&(G.aspectRatio=m.aspectRatio);var N={onRenderSurfaceReady:function(T,_){A.setupUi(T,_,m),A.isScanning=!0,A.foreverScan(m,o,g)}};Y_.failIfNotSupported().then(function(T){T.create(M).then(function(_){return _.render(f.element,G,N).then(function(U){A.renderedCamera=U,I.execute(),O(null)}).catch(function(U){I.cancel(),k(U)})}).catch(function(_){I.cancel(),k(ss.errorGettingUserMedia(_))})}).catch(function(T){I.cancel(),k(ss.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(st.PAUSED),this.showPausedState(),(ln(t)||t!==!0)&&(t=!1),t&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var t=this,n=function(){t.stateManagerProxy.directTransition(st.SCANNING),t.hidePausedState()};if(!this.renderedCamera.isPaused()){n();return}this.renderedCamera.resume(function(){n()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var t=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var n=this.stateManagerProxy.startTransition(st.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var o=function(){if(t.element){var f=document.getElementById(fr.SHADED_REGION_ELEMENT_ID);f&&t.element.removeChild(f)}},c=this;return this.renderedCamera.close().then(function(){return c.renderedCamera=null,c.element&&(c.element.removeChild(c.canvasElement),c.canvasElement=null),o(),c.qrRegion&&(c.qrRegion=null),c.context&&(c.context=null),n.execute(),c.hidePausedState(),c.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(t,n){return this.scanFileV2(t,n).then(function(o){return o.decodedText})},e.prototype.scanFileV2=function(t,n){var o=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(ln(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,f){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var g=new Image;g.onload=function(){var m=g.width,v=g.height,x=document.getElementById(o.elementId),C=x.clientWidth?x.clientWidth:fr.DEFAULT_WIDTH,A=Math.max(x.clientHeight?x.clientHeight:v,fr.FILE_SCAN_MIN_HEIGHT),I=o.computeCanvasDrawConfig(m,v,C,A);if(n){var O=o.createCanvasElement(C,A,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var k=O.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=A,k.drawImage(g,0,0,m,v,I.x,I.y,I.width,I.height)}var M=fr.FILE_SCAN_HIDDEN_CANVAS_PADDING,G=Math.max(g.width,I.width),N=Math.max(g.height,I.height),T=G+2*M,_=N+2*M,U=o.createCanvasElement(T,_);x.appendChild(U);var z=U.getContext("2d");if(!z)throw"Unable to get 2d context from canvas";z.canvas.width=T,z.canvas.height=_,z.drawImage(g,0,0,m,v,M,M,G,N);try{o.qrcode.decodeRobustlyAsync(U).then(function(j){c(Wp.createFromQrcodeResult(j))}).catch(f)}catch(j){f("QR code parse error, error = ".concat(j))}},g.onerror=f,g.onabort=f,g.onstalled=f,g.onsuspend=f,g.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Q_.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(t){if(t){if(!hv.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(t)},e.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(t){var n=[re.QR_CODE,re.AZTEC,re.CODABAR,re.CODE_39,re.CODE_93,re.CODE_128,re.DATA_MATRIX,re.MAXICODE,re.ITF,re.EAN_13,re.EAN_8,re.PDF_417,re.RSS_14,re.RSS_EXPANDED,re.UPC_A,re.UPC_E,re.UPC_EAN_EXTENSION];if(!t||typeof t=="boolean"||!t.formatsToSupport)return n;if(!Array.isArray(t.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(t.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var o=[],c=0,f=t.formatsToSupport;c<f.length;c++){var g=f[c];P_(g)?o.push(g):this.logger.warn("Invalid format: ".concat(g," passed in config, ignoring."))}if(o.length===0)throw"None of formatsToSupport match supported values.";return o},e.prototype.getUseBarCodeDetectorIfSupported=function(t){if(ln(t))return!0;if(!ln(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(ln(t.experimentalFeatures))return!0;var n=t.experimentalFeatures;return ln(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,n,o){var c=this,f=o.qrbox;this.validateQrboxConfig(f);var g=this.toQrdimensions(t,n,f),m=function(x){if(x<fr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(fr.MIN_QR_BOX_SIZE,"px.")},v=function(x){return x>t&&(c.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),x=t),x};m(g.width),m(g.height),g.width=v(g.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,o){if(typeof o=="number")return{width:o,height:o};if(typeof o=="function")try{return o(t,n)}catch(c){throw new Error("qrbox config was passed as a function but it failed with unknown error"+c)}return o},e.prototype.setupUi=function(t,n,o){o.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,o);var c=ln(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(c);var f=this.toQrdimensions(t,n,c);f.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var g=o.isShadedBoxEnabled()&&f.height<=n,m={x:0,y:0,width:t,height:n},v=g?this.getShadedRegionBounds(t,n,f):m,x=this.createCanvasElement(v.width,v.height),C={willReadFrequently:!0},A=x.getContext("2d",C);A.canvas.width=v.width,A.canvas.height=v.height,this.element.append(x),g&&this.possiblyInsertShadingElement(this.element,t,n,f),this.createScannerPausedUiElement(this.element),this.qrRegion=v,this.context=A,this.canvasElement=x},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=ss.scannerPaused(),n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="rgba(9, 9, 9, 0.46)",n.style.color="#FFECEC",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var o=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(c){return t(c.text,Wp.createFromQrcodeResult(c)),o.possiblyUpdateShaders(!0),!0}).catch(function(c){o.possiblyUpdateShaders(!1);var f=ss.codeParseError(c);return n(f,B_.createFrom(f)),!1})},e.prototype.foreverScan=function(t,n,o){var c=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),g=f.videoWidth/f.clientWidth,m=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var v=this.qrRegion.width*g,x=this.qrRegion.height*m,C=this.qrRegion.x*g,A=this.qrRegion.y*m;this.context.drawImage(f,C,A,v,x,0,0,this.qrRegion.width,this.qrRegion.height);var I=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,n,o)},c.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(O){!O&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(n,o).finally(function(){I()})):I()}).catch(function(O){c.logger.logError("Error happend while scanning context",O),I()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",o="deviceId",c={user:!0,environment:!0},f="exact",g=function(k){if(k in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},m=Object.keys(t);if(m.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(m.length," keys");var v=Object.keys(t)[0];if(v!==n&&v!==o)throw"Only '".concat(n,"' and '").concat(o,"' ")+" are supported for 'cameraIdOrConfig'";if(v===n){var x=t.facingMode;if(typeof x=="string"){if(g(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(g(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var A=t.deviceId;if(typeof A=="string")return{deviceId:A};if(typeof A=="object"){if(f in A)return{deviceId:{exact:A["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var I=typeof A;throw"Invalid type of 'deviceId' = ".concat(I)}}}var O=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},e.prototype.computeCanvasDrawConfig=function(t,n,o,c){if(t<=o&&n<=c){var f=(o-t)/2,g=(c-n)/2;return{x:f,y:g,width:t,height:n}}else{var m=t,v=n;return t>o&&(n=o/t*n,t=o),n>c&&(t=c/n*t,n=c),this.logger.log("Image downsampled from "+"".concat(m,"X").concat(v)+" to ".concat(t,"X").concat(n,".")),this.computeCanvasDrawConfig(t,n,o,c)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?fr.BORDER_SHADER_MATCH_COLOR:fr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,o){var c=t,f=n,g=document.createElement("canvas");return g.style.width="".concat(c,"px"),g.style.height="".concat(f,"px"),g.style.display="none",g.id=ln(o)?"qr-canvas":o,g},e.prototype.getShadedRegionBounds=function(t,n,o){if(o.width>t||o.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-o.width)/2,y:(n-o.height)/2,width:o.width,height:o.height}},e.prototype.possiblyInsertShadingElement=function(t,n,o,c){if(!(n-c.width<1||o-c.height<1)){var f=document.createElement("div");f.style.position="absolute";var g=(n-c.width)/2,m=(o-c.height)/2;if(f.style.borderLeft="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(fr.SHADED_REGION_ELEMENT_ID),n-c.width<11||o-c.height<11)this.hasBorderShaders=!1;else{var v=5,x=40;this.insertShaderBorders(f,x,v,-v,null,0,!0),this.insertShaderBorders(f,x,v,-v,null,0,!1),this.insertShaderBorders(f,x,v,null,-v,0,!0),this.insertShaderBorders(f,x,v,null,-v,0,!1),this.insertShaderBorders(f,v,x+v,-v,null,-v,!0),this.insertShaderBorders(f,v,x+v,null,-v,-v,!0),this.insertShaderBorders(f,v,x+v,-v,null,-v,!1),this.insertShaderBorders(f,v,x+v,null,-v,-v,!1),this.hasBorderShaders=!0}t.append(f)}},e.prototype.insertShaderBorders=function(t,n,o,c,f,g,m){var v=document.createElement("div");v.style.position="absolute",v.style.backgroundColor=fr.BORDER_SHADER_DEFAULT_COLOR,v.style.width="".concat(n,"px"),v.style.height="".concat(o,"px"),c!==null&&(v.style.top="".concat(c,"px")),f!==null&&(v.style.bottom="".concat(f,"px")),m?v.style.left="".concat(g,"px"):v.style.right="".concat(g,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(v),t.appendChild(v)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),Yp;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Yp||(Yp={}));var k1;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(k1||(k1={}));var B1;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(B1||(B1={}));var L1;(function(e){e[e.ALL=17]="ALL"})(L1||(L1={}));const nO=Object.assign(Object.assign({},re),L1);var Kp;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(Kp||(Kp={}));const iO=[{selector:".scanner-container-display",css:"display: block;"},{selector:".scanner-dialog",css:"display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"},{selector:".scanner-dialog-inner",css:"background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;"},{selector:".close-button",css:"color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;"},{selector:".close-button:hover",css:"color: #222;"},{selector:".scanner-container-full-width",css:"width: 100%;"}];function sO(e){const t="custom-style-os-cap-barcode";let n=document.getElementById(t);if(n||(n=document.createElement("style"),n.type="text/css",n.id=t,document.head.appendChild(n)),n.sheet){for(;n.sheet.cssRules.length;)n.sheet.deleteRule(0);for(const{selector:o,css:c}of e)n.sheet.insertRule(`${o} { ${c} }`)}else{n.textContent="";for(const{selector:o,css:c}of e)n.textContent+=`${o} { ${c} }`}}const oO=sa("CapacitorBarcodeScanner",{web:()=>(sO(iO),Y1(()=>import("./web-BMb61xwV.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class aO{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||k1.BACK,t.scanOrientation=t.scanOrientation||B1.ADAPTIVE,oO.scanBarcode(t)}}const vf=sa("SecureStoragePlugin",{web:()=>Y1(()=>import("./web-eq1eso0Y.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function lO(e){try{if(e.length>2048)throw new Error;if(!e.startsWith("{")){const c=new URL(e);if(!["http:","https:"].includes(c.protocol)||c.username||c.password||c.pathname!=="/pair"||c.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(c.hash))throw new Error;const f=qn.parse(c.origin);if(!f)throw new Error;return{endpoint:f,grant:c.hash.slice(6)}}const t=JSON.parse(e);if(t.type!=="agentroam-pair"||t.version!==1||typeof t.server!="string"||typeof t.grant!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t.grant))throw new Error;const n=new URL(t.server);if(n.username||n.password||n.search||n.hash||n.pathname!=="/")throw new Error;const o=qn.parse(t.server);if(!o)throw new Error;return{endpoint:o,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class uO{ready(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await vf.get({key:`agentroam-device:${t}`})).value}catch(n){if(String(n).includes("does not exist"))return null;throw new Error("无法读取设备凭证,请重试。")}}async set(t,n){this.ready(),await vf.set({key:`agentroam-device:${t}`,value:n})}async remove(t){this.ready();try{await vf.remove({key:`agentroam-device:${t}`})}catch(n){if(!String(n).includes("does not exist"))throw n}}}async function cO(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await aO.scanBarcode({hint:nO.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class fO{constructor(t,n=(...c)=>fetch(...c),o=()=>window.dispatchEvent(new CustomEvent("webapp:unauthorized"))){this.storage=t,this.transport=n,this.onRevoked=o,this.session=null,this.fetch=async(c,f={})=>{const g=this.session,m=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),v=new Headers(f.headers??(c instanceof Request?c.headers:void 0));g&&m.origin===g.origin&&v.set("authorization",`Bearer ${g.token}`);const x=await this.transport(c,{...f,headers:v,credentials:"omit",redirect:"error"});if(g&&this.session===g&&m.origin===g.origin&&(x.status===401||x.status===423)){this.session=null;try{await this.storage.remove(g.origin)}finally{this.onRevoked()}}return x}}async resume(t){const n=await this.storage.get(t.url);this.session=n?{origin:t.url,token:n}:null}async pair(t){const{endpoint:n,grant:o}=lO(t),c=await this.transport(n.api("/api/pairing/qr-exchange"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant:o,name:"我的 App"}),credentials:"omit",redirect:"error",signal:AbortSignal.timeout(1e4)});if(!c.ok)throw new Error(c.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":c.status===410?"二维码已使用或已过期,请在电脑上重新生成。":"扫码连接失败,请检查服务器地址和网络后重试。");const f=await c.json();if(typeof f.token!="string"||!/^[A-Za-z0-9_-]{43}$/.test(f.token))throw new Error("服务器返回了无效的设备凭证。");try{await this.storage.set(n.url,f.token)}catch{throw await this.transport(n.api("/api/pairing/logout"),{method:"POST",headers:{authorization:`Bearer ${f.token}`},credentials:"omit",redirect:"error",signal:AbortSignal.timeout(5e3)}).catch(()=>{}),new Error("无法安全保存设备凭证,请在电脑上重新生成二维码后重试。")}return this.session={origin:n.url,token:f.token},n}async checkAuthorization(){const t=this.session;if(!t)return;const n=await this.fetch(`${t.origin}/api/web-auth/status`,{signal:AbortSignal.timeout(5e3)});if(!n.ok)return;const o=await n.json();if(this.session===t&&(o.locked||o.authenticated===!1)){this.session=null;try{await this.storage.remove(t.origin)}finally{this.onRevoked()}}}}var iu;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(iu||(iu={}));var Zp;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(Zp||(Zp={}));const yf=sa("StatusBar");function dO(e){const t=/^#([a-f\d]{6})$/i.exec(e.trim());if(!t)return null;const n=[0,2,4].map(c=>{const f=parseInt(t[1].slice(c,c+2),16)/255;return f<=.04045?f/12.92:((f+.055)/1.055)**2.4}),o=.2126*n[0]+.7152*n[1]+.0722*n[2];return{color:`#${t[1]}`,style:o>.179?iu.Light:iu.Dark}}function hO(){if(Ts.getPlatform()!=="android")return()=>{};const e=document.documentElement;e.dataset.skin=Ol.getState().skin;let t=!1,n=yf.setOverlaysWebView({overlay:!1}).catch(()=>{});const o=()=>{const g=dO(getComputedStyle(e).getPropertyValue("--bg-deepest"));g&&(n=n.then(async()=>{t||(await yf.setBackgroundColor({color:g.color}),await yf.setStyle({style:g.style}))}).catch(()=>{console.warn("Unable to update the Android status bar.")}))},c=new MutationObserver(o);c.observe(e,{attributes:!0,attributeFilter:["data-skin"]});const f=()=>{document.hidden||o()};return document.addEventListener("visibilitychange",f),window.addEventListener("focus",o),o(),()=>{t=!0,c.disconnect(),document.removeEventListener("visibilitychange",f),window.removeEventListener("focus",o)}}const gO="/service-worker.js";function pO(){return typeof window<"u"&&window.isSecureContext===!0&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function xO(e){const t="=".repeat((4-e.length%4)%4),n=`${e}${t}`.replace(/-/g,"+").replace(/_/g,"/"),o=atob(n),c=new Uint8Array(new ArrayBuffer(o.length));for(let f=0;f<o.length;f+=1)c[f]=o.charCodeAt(f);return c}async function Qp(e){const{publicKey:t}=await e.get("/api/push/vapid");if(!t)return;const n=await navigator.serviceWorker.register(gO),c=await n.pushManager.getSubscription()??await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:xO(t)});await e.post("/api/push/subscribe",c.toJSON())}function mO(e){pO()&&(async()=>{try{if(Notification.permission==="granted"){await Qp(e);return}if(Notification.permission!=="default")return;const t=()=>{(async()=>{try{await Notification.requestPermission()==="granted"&&await Qp(e)}catch{}})()};document.addEventListener("pointerdown",t,{once:!0})}catch{}})()}class Ef extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const qp=10,wO=13,ci=32;function Cf(e){}function vO(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:t=Cf,onError:n=Cf,onRetry:o=Cf,onComment:c,maxBufferSize:f}=e,g=[];let m=0,v=!0,x,C="",A=0,I,O=!1;function k(z){if(O)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(v&&(v=!1,z.charCodeAt(0)===239&&z.charCodeAt(1)===187&&z.charCodeAt(2)===191&&(z=z.slice(3))),g.length===0){const X=G(z);X!==""&&(g.push(X),m=X.length),M();return}if(z.indexOf(`
|
|
81
|
+
`);let s=Vd.singletonList(Qr.INITIAL_STATE);for(let l=0;l<this.text.length;l++){let u,d=l+1<this.text.length?this.text[l+1]:0;switch(this.text[l]){case se.getCharCode("\r"):u=d===i?2:0;break;case se.getCharCode("."):u=d===r?3:0;break;case se.getCharCode(","):u=d===r?4:0;break;case se.getCharCode(":"):u=d===r?5:0;break;default:u=0}u>0?(s=Vs.updateStateListForPair(s,l,u),l++):s=this.updateStateListForChar(s,l)}return Vd.min(s,(l,u)=>l.getBitCount()-u.getBitCount()).toBitArray(this.text)}updateStateListForChar(r,i){const s=[];for(let a of r)this.updateStateForChar(a,i,s);return Vs.simplifyStates(s)}updateStateForChar(r,i,s){let a=this.text[i]&255,l=oc[r.getMode()][a]>0,u=null;for(let d=0;d<=Zr;d++){let h=oc[d][a];if(h>0){if(u==null&&(u=r.endBinaryShift(i)),!l||d===r.getMode()||d===Sr){const p=u.latchAndAppend(d,h);s.push(p)}if(!l&&Hd[r.getMode()][d]>=0){const p=u.shiftAndAppend(d,h);s.push(p)}}}if(r.getBinaryShiftByteCount()>0||oc[r.getMode()][a]===0){let d=r.addBinaryShiftChar(i);s.push(d)}}static updateStateListForPair(r,i,s){const a=[];for(let l of r)this.updateStateForPair(l,i,s,a);return this.simplifyStates(a)}static updateStateForPair(r,i,s,a){let l=r.endBinaryShift(i);if(a.push(l.latchAndAppend(Zr,s)),r.getMode()!==Zr&&a.push(l.shiftAndAppend(Zr,s)),s===3||s===4){let u=l.latchAndAppend(Sr,16-s).latchAndAppend(Sr,1);a.push(u)}if(r.getBinaryShiftByteCount()>0){let u=r.addBinaryShiftChar(i).addBinaryShiftChar(i+1);a.push(u)}}static simplifyStates(r){let i=[];for(const s of r){let a=!0;for(const l of i){if(l.isBetterThanOrEqualTo(s)){a=!1;break}s.isBetterThanOrEqualTo(l)&&(i=i.filter(u=>u!==l))}a&&i.push(s)}return i}}class be{constructor(){}static encodeBytes(r){return be.encode(r,be.DEFAULT_EC_PERCENT,be.DEFAULT_AZTEC_LAYERS)}static encode(r,i,s){let a=new Vs(r).encode(),l=_.truncDivision(a.getSize()*i,100)+11,u=a.getSize()+l,d,h,p,w,E;if(s!==be.DEFAULT_AZTEC_LAYERS){if(d=s<0,h=Math.abs(s),h>(d?be.MAX_NB_BITS_COMPACT:be.MAX_NB_BITS))throw new A(se.format("Illegal value %s for layers",s));p=be.totalBitsInLayer(h,d),w=be.WORD_SIZE[h];let K=p-p%w;if(E=be.stuffBits(a,w),E.getSize()+l>K)throw new A("Data to large for user specified layer");if(d&&E.getSize()>w*64)throw new A("Data to large for user specified layer")}else{w=0,E=null;for(let K=0;;K++){if(K>be.MAX_NB_BITS)throw new A("Data too large for an Aztec code");if(d=K<=3,h=d?K+1:K,p=be.totalBitsInLayer(h,d),u>p)continue;(E==null||w!==be.WORD_SIZE[h])&&(w=be.WORD_SIZE[h],E=be.stuffBits(a,w));let Ae=p-p%w;if(!(d&&E.getSize()>w*64)&&E.getSize()+l<=Ae)break}}let S=be.generateCheckWords(E,p,w),b=E.getSize()/w,D=be.generateModeMessage(d,h,b),P=(d?11:14)+h*4,L=new Int32Array(P),$;if(d){$=P;for(let K=0;K<L.length;K++)L[K]=K}else{$=P+1+2*_.truncDivision(_.truncDivision(P,2)-1,15);let K=_.truncDivision(P,2),Ae=_.truncDivision($,2);for(let me=0;me<K;me++){let er=me+_.truncDivision(me,15);L[K-me-1]=Ae-er-1,L[K+me]=Ae+er+1}}let Q=new Te($);for(let K=0,Ae=0;K<h;K++){let me=(h-K)*4+(d?9:12);for(let er=0;er<me;er++){let Mr=er*2;for(let tr=0;tr<2;tr++)S.get(Ae+Mr+tr)&&Q.set(L[K*2+tr],L[K*2+er]),S.get(Ae+me*2+Mr+tr)&&Q.set(L[K*2+er],L[P-1-K*2-tr]),S.get(Ae+me*4+Mr+tr)&&Q.set(L[P-1-K*2-tr],L[P-1-K*2-er]),S.get(Ae+me*6+Mr+tr)&&Q.set(L[P-1-K*2-er],L[K*2+tr])}Ae+=me*8}if(be.drawModeMessage(Q,d,$,D),d)be.drawBullsEye(Q,_.truncDivision($,2),5);else{be.drawBullsEye(Q,_.truncDivision($,2),7);for(let K=0,Ae=0;K<_.truncDivision(P,2)-1;K+=15,Ae+=16)for(let me=_.truncDivision($,2)&1;me<$;me+=2)Q.set(_.truncDivision($,2)-Ae,me),Q.set(_.truncDivision($,2)+Ae,me),Q.set(me,_.truncDivision($,2)-Ae),Q.set(me,_.truncDivision($,2)+Ae)}let q=new $d;return q.setCompact(d),q.setSize($),q.setLayers(h),q.setCodeWords(b),q.setMatrix(Q),q}static drawBullsEye(r,i,s){for(let a=0;a<s;a+=2)for(let l=i-a;l<=i+a;l++)r.set(l,i-a),r.set(l,i+a),r.set(i-a,l),r.set(i+a,l);r.set(i-s,i-s),r.set(i-s+1,i-s),r.set(i-s,i-s+1),r.set(i+s,i-s),r.set(i+s,i-s+1),r.set(i+s,i+s-1)}static generateModeMessage(r,i,s){let a=new U;return r?(a.appendBits(i-1,2),a.appendBits(s-1,6),a=be.generateCheckWords(a,28,4)):(a.appendBits(i-1,5),a.appendBits(s-1,11),a=be.generateCheckWords(a,40,4)),a}static drawModeMessage(r,i,s,a){let l=_.truncDivision(s,2);if(i)for(let u=0;u<7;u++){let d=l-3+u;a.get(u)&&r.set(d,l-5),a.get(u+7)&&r.set(l+5,d),a.get(20-u)&&r.set(d,l+5),a.get(27-u)&&r.set(l-5,d)}else for(let u=0;u<10;u++){let d=l-5+u+_.truncDivision(u,5);a.get(u)&&r.set(d,l-7),a.get(u+10)&&r.set(l+7,d),a.get(29-u)&&r.set(d,l+7),a.get(39-u)&&r.set(l-7,d)}}static generateCheckWords(r,i,s){let a=r.getSize()/s,l=new tc(be.getGF(s)),u=_.truncDivision(i,s),d=be.bitsToWords(r,s,u);l.encode(d,u-a);let h=i%s,p=new U;p.appendBits(0,h);for(const w of Array.from(d))p.appendBits(w,s);return p}static bitsToWords(r,i,s){let a=new Int32Array(s),l,u;for(l=0,u=r.getSize()/i;l<u;l++){let d=0;for(let h=0;h<i;h++)d|=r.get(l*i+h)?1<<i-h-1:0;a[l]=d}return a}static getGF(r){switch(r){case 4:return Oe.AZTEC_PARAM;case 6:return Oe.AZTEC_DATA_6;case 8:return Oe.AZTEC_DATA_8;case 10:return Oe.AZTEC_DATA_10;case 12:return Oe.AZTEC_DATA_12;default:throw new A("Unsupported word size "+r)}}static stuffBits(r,i){let s=new U,a=r.getSize(),l=(1<<i)-2;for(let u=0;u<a;u+=i){let d=0;for(let h=0;h<i;h++)(u+h>=a||r.get(u+h))&&(d|=1<<i-1-h);(d&l)===l?(s.appendBits(d&l,i),u--):d&l?s.appendBits(d,i):(s.appendBits(d|1,i),u--)}return s}static totalBitsInLayer(r,i){return((i?88:112)+16*r)*r}}be.DEFAULT_EC_PERCENT=33,be.DEFAULT_AZTEC_LAYERS=0,be.MAX_NB_BITS=32,be.MAX_NB_BITS_COMPACT=4,be.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class wa{encode(r,i,s,a){return this.encodeWithHints(r,i,s,a,null)}encodeWithHints(r,i,s,a,l){let u=nc.ISO_8859_1,d=be.DEFAULT_EC_PERCENT,h=be.DEFAULT_AZTEC_LAYERS;return l!=null&&(l.has(mt.CHARACTER_SET)&&(u=Wd.forName(l.get(mt.CHARACTER_SET).toString())),l.has(mt.ERROR_CORRECTION)&&(d=_.parseInt(l.get(mt.ERROR_CORRECTION).toString())),l.has(mt.AZTEC_LAYERS)&&(h=_.parseInt(l.get(mt.AZTEC_LAYERS).toString()))),wa.encodeLayers(r,i,s,a,u,d,h)}static encodeLayers(r,i,s,a,l,u,d){if(i!==le.AZTEC)throw new A("Can only encode AZTEC, but got "+i);let h=be.encode(se.getBytes(r,l),u,d);return wa.renderResult(h,s,a)}static renderResult(r,i,s){let a=r.getMatrix();if(a==null)throw new Hr;let l=a.getWidth(),u=a.getHeight(),d=Math.max(i,l),h=Math.max(s,u),p=Math.min(d/l,h/u),w=(d-l*p)/2,E=(h-u*p)/2,S=new Te(d,h);for(let b=0,D=E;b<u;b++,D+=p)for(let P=0,L=w;P<l;P++,L+=p)a.get(P,b)&&S.setRegion(L,D,p,p);return S}}n.AbstractExpandedDecoder=Hu,n.ArgumentException=C,n.ArithmeticException=oa,n.AztecCode=$d,n.AztecCodeReader=ua,n.AztecCodeWriter=wa,n.AztecDecoder=Ue,n.AztecDetector=bd,n.AztecDetectorResult=Td,n.AztecEncoder=be,n.AztecHighLevelEncoder=Vs,n.AztecPoint=Vt,n.BarcodeFormat=le,n.Binarizer=k,n.BinaryBitmap=I,n.BitArray=U,n.BitMatrix=Te,n.BitSource=Ku,n.BrowserAztecCodeReader=mv,n.BrowserBarcodeReader=Cv,n.BrowserCodeReader=yr,n.BrowserDatamatrixCodeReader=Sv,n.BrowserMultiFormatReader=kv,n.BrowserPDF417Reader=Bv,n.BrowserQRCodeReader=Lv,n.BrowserQRCodeSvgWriter=ui,n.CharacterSetECI=V,n.ChecksumException=O,n.Code128Reader=J,n.Code39Reader=pt,n.DataMatrixDecodedBitStreamParser=bn,n.DataMatrixReader=_n,n.DecodeHintType=j,n.DecoderResult=Ds,n.DefaultGridSampler=Rd,n.DetectorResult=la,n.EAN13Reader=ii,n.EncodeHintType=mt,n.Exception=x,n.FormatException=B,n.GenericGF=Oe,n.GenericGFPoly=Zt,n.GlobalHistogramBinarizer=tt,n.GridSampler=Wu,n.GridSamplerInstance=Tn,n.HTMLCanvasElementLuminanceSource=pe,n.HybridBinarizer=xe,n.ITFReader=Be,n.IllegalArgumentException=A,n.IllegalStateException=Hr,n.InvertedLuminanceSource=de,n.LuminanceSource=te,n.MathUtils=Re,n.MultiFormatOneDReader=ki,n.MultiFormatReader=jd,n.MultiFormatWriter=Uv,n.NotFoundException=H,n.OneDReader=dt,n.PDF417DecodedBitStreamParser=W,n.PDF417DecoderErrorCorrection=Pd,n.PDF417Reader=_t,n.PDF417ResultMetadata=Bd,n.PerspectiveTransform=Nr,n.PlanarYUVLuminanceSource=Kr,n.QRCodeByteMatrix=xa,n.QRCodeDataMask=Cr,n.QRCodeDecodedBitStreamParser=Ze,n.QRCodeDecoderErrorCorrectionLevel=je,n.QRCodeDecoderFormatInformation=Ft,n.QRCodeEncoder=$e,n.QRCodeEncoderQRCode=li,n.QRCodeMaskUtil=it,n.QRCodeMatrixUtil=fe,n.QRCodeMode=ce,n.QRCodeReader=On,n.QRCodeVersion=ue,n.QRCodeWriter=Li,n.RGBLuminanceSource=rc,n.RSS14Reader=nt,n.RSSExpandedReader=Y,n.ReaderException=pa,n.ReedSolomonDecoder=Ps,n.ReedSolomonEncoder=tc,n.ReedSolomonException=Ni,n.Result=Ke,n.ResultMetadataType=Ct,n.ResultPoint=ae,n.StringUtils=se,n.UnsupportedOperationException=oe,n.VideoInputDevice=He,n.WhiteRectangleDetector=an,n.WriterException=Le,n.ZXingArrays=T,n.ZXingCharset=Wd,n.ZXingInteger=_,n.ZXingStandardCharsets=nc,n.ZXingStringBuilder=ge,n.ZXingStringEncoding=ye,n.ZXingSystem=M,n.createAbstractExpandedDecoder=Dd,Object.defineProperty(n,"__esModule",{value:!0})})})(P1,P1.exports);var Qe=P1.exports;const F_=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var $p=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,Qe.BarcodeFormat.QR_CODE],[re.AZTEC,Qe.BarcodeFormat.AZTEC],[re.CODABAR,Qe.BarcodeFormat.CODABAR],[re.CODE_39,Qe.BarcodeFormat.CODE_39],[re.CODE_93,Qe.BarcodeFormat.CODE_93],[re.CODE_128,Qe.BarcodeFormat.CODE_128],[re.DATA_MATRIX,Qe.BarcodeFormat.DATA_MATRIX],[re.MAXICODE,Qe.BarcodeFormat.MAXICODE],[re.ITF,Qe.BarcodeFormat.ITF],[re.EAN_13,Qe.BarcodeFormat.EAN_13],[re.EAN_8,Qe.BarcodeFormat.EAN_8],[re.PDF_417,Qe.BarcodeFormat.PDF_417],[re.RSS_14,Qe.BarcodeFormat.RSS_14],[re.RSS_EXPANDED,Qe.BarcodeFormat.RSS_EXPANDED],[re.UPC_A,Qe.BarcodeFormat.UPC_A],[re.UPC_E,Qe.BarcodeFormat.UPC_E],[re.UPC_EAN_EXTENSION,Qe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!F_)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=o;var c=this.createZXingFormats(t),f=new Map;f.set(Qe.DecodeHintType.POSSIBLE_FORMATS,c),f.set(Qe.DecodeHintType.TRY_HARDER,!1),this.hints=f}return e.prototype.decodeAsync=function(t){var n=this;return new Promise(function(o,c){try{o(n.decode(t))}catch(f){c(f)}})},e.prototype.decode=function(t){var n=new Qe.MultiFormatReader(this.verbose,this.hints),o=new Qe.HTMLCanvasElementLuminanceSource(t),c=new Qe.BinaryBitmap(new Qe.HybridBinarizer(o)),f=n.decode(c);return{text:f.text,format:dv.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createZXingFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return n},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),U_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},j_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Vp=function(){function e(t,n,o){if(this.formatMap=new Map([[re.QR_CODE,"qr_code"],[re.AZTEC,"aztec"],[re.CODABAR,"codabar"],[re.CODE_39,"code_39"],[re.CODE_93,"code_93"],[re.CODE_128,"code_128"],[re.DATA_MATRIX,"data_matrix"],[re.ITF,"itf"],[re.EAN_13,"ean_13"],[re.EAN_8,"ean_8"],[re.PDF_417,"pdf417"],[re.UPC_A,"upc_a"],[re.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=o;var c=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(c),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var t=new BarcodeDetector({formats:["qr_code"]});return typeof t<"u"},e.prototype.decodeAsync=function(t){return U_(this,void 0,void 0,function(){var n,o;return j_(this,function(c){switch(c.label){case 0:return[4,this.detector.detect(t)];case 1:if(n=c.sent(),!n||n.length===0)throw"No barcode or QR code detected.";return o=this.selectLargestBarcode(n),[2,{text:o.rawValue,format:dv.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var n=null,o=0,c=0,f=t;c<f.length;c++){var g=f[c],m=g.boundingBox.width*g.boundingBox.height;m>o&&(o=m,n=g)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],o=0,c=t;o<c.length;o++){var f=c[o];this.formatMap.has(f)?n.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:n}},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,o,c){t.set(n,o)}),t},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),zp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Hp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},W_=function(){function e(t,n,o,c){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=o,n&&Vp.isSupported()?(this.primaryDecoder=new Vp(t,o,c),this.secondaryDecoder=new $p(t,o,c)):this.primaryDecoder=new $p(t,o,c)}return e.prototype.decodeAsync=function(t){return zp(this,void 0,void 0,function(){var n;return Hp(this,function(o){switch(o.label){case 0:n=performance.now(),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,o.sent()];case 3:return this.possiblyLogPerformance(n),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(t){return zp(this,void 0,void 0,function(){var n,o;return Hp(this,function(c){switch(c.label){case 0:n=performance.now(),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(t)];case 2:return[2,c.sent()];case 3:if(o=c.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw o;case 4:return this.possiblyLogPerformance(n),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(t){if(this.verbose){var n=performance.now()-t;this.executionResults.push(n),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,n=0,o=this.executionResults;n<o.length;n++){var c=o[n];t+=c}var f=t/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),Sd=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),ru=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},nu=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},gv=function(){function e(t,n){this.name=t,this.track=n}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(t){var n={};n[this.name]=t;var o={advanced:[n]};return this.track.applyConstraints(o)},e.prototype.value=function(){var t=this.track.getSettings();if(this.name in t){var n=t[this.name];return n}return null},e}(),$_=function(e){Sd(t,e);function t(n,o){return e.call(this,n,o)||this}return t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(n){var o={};o[this.name]=n;var c={advanced:[o]};return this.track.applyConstraints(c)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var n=this.track.getCapabilities(),o=n[this.name];return{min:o.min,max:o.max,step:o.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(gv),V_=function(e){Sd(t,e);function t(n){return e.call(this,"zoom",n)||this}return t}($_),z_=function(e){Sd(t,e);function t(n){return e.call(this,"torch",n)||this}return t}(gv),H_=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new V_(this.track)},e.prototype.torchFeature=function(){return new z_(this.track)},e}(),G_=function(){function e(t,n,o){this.isClosed=!1,this.parentElement=t,this.mediaStream=n,this.callbacks=o,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return e.prototype.createVideoElement=function(t){var n=document.createElement("video");return n.style.width="".concat(t,"px"),n.style.display="block",n.muted=!0,n.setAttribute("muted","true"),n.playsInline=!0,n},e.prototype.setupSurface=function(){var t=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var n=function(){var o=t.surface.clientWidth,c=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(o,c),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,o,c){return ru(this,void 0,void 0,function(){var f,g;return nu(this,function(m){switch(m.label){case 0:return f=new e(t,n,c),o.aspectRatio?(g={aspectRatio:o.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(g)]):[3,2];case 1:m.sent(),m.label=2;case 2:return f.setupSurface(),[2,f]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(t){this.failIfClosed();var n=this,o=function(){setTimeout(t,200),n.surface.removeEventListener("playing",o)};this.surface.addEventListener("playing",o),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(t){return ru(this,void 0,void 0,function(){return nu(this,function(n){if("aspectRatio"in t)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(t)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var t=this;return new Promise(function(n,o){var c=t.mediaStream.getVideoTracks(),f=c.length,g=0;t.mediaStream.getVideoTracks().forEach(function(m){t.mediaStream.removeTrack(m),m.stop(),++g,g>=f&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new H_(this.getFirstTrackOrFail())},e}(),X_=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,o){return ru(this,void 0,void 0,function(){return nu(this,function(c){return[2,G_.create(t,this.mediaStream,n,o)]})})},e.create=function(t){return ru(this,void 0,void 0,function(){var n,o;return nu(this,function(c){switch(c.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return o=c.sent(),[2,new e(o)]}})})},e}(),Gp=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Xp=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Y_=function(){function e(){}return e.failIfNotSupported=function(){return Gp(this,void 0,void 0,function(){return Xp(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return Gp(this,void 0,void 0,function(){return Xp(this,function(n){return[2,X_.create(t)]})})},e}(),K_=function(e,t,n,o){function c(f){return f instanceof n?f:new n(function(g){g(f)})}return new(n||(n=Promise))(function(f,g){function m(C){try{x(o.next(C))}catch(A){g(A)}}function v(C){try{x(o.throw(C))}catch(A){g(A)}}function x(C){C.done?f(C.value):c(C.value).then(m,v)}x((o=o.apply(e,t||[])).next())})},Z_=function(e,t){var n={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,c,f,g;return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(x){return function(C){return v([x,C])}}function v(x){if(o)throw new TypeError("Generator is already executing.");for(;g&&(g=0,x[0]&&(n=0)),n;)try{if(o=1,c&&(f=x[0]&2?c.return:x[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,x[1])).done)return f;switch(c=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return n.label++,{value:x[1],done:!1};case 5:n.label++,c=x[1],x=[0];continue;case 7:x=n.ops.pop(),n.trys.pop();continue;default:if(f=n.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){n=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){n.label=x[1];break}if(x[0]===6&&n.label<f[1]){n.label=f[1],f=x;break}if(f&&n.label<f[2]){n.label=f[2],n.ops.push(x);break}f[2]&&n.ops.pop(),n.trys.pop();continue}x=t.call(e,n)}catch(C){x=[6,C],c=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Q_=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=ss.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=ss.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var t=location.host.split(":")[0];return t==="127.0.0.1"||t==="localhost"},e.getCamerasFromMediaDevices=function(){return K_(this,void 0,void 0,function(){var t,n,o,c,f,g,m;return Z_(this,function(v){switch(v.label){case 0:return t=function(x){for(var C=x.getVideoTracks(),A=0,I=C;A<I.length;A++){var O=I[A];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=v.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(o=v.sent(),c=[],f=0,g=o;f<g.length;f++)m=g[f],m.kind==="videoinput"&&c.push({id:m.deviceId,label:m.label});return t(n),[2,c]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,n){var o=function(f){for(var g=[],m=0,v=f;m<v.length;m++){var x=v[m];x.kind==="video"&&g.push({id:x.id,label:x.label})}t(g)},c=MediaStreamTrack;c.getSources(o)})},e}(),st;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(st||(st={}));var q_=function(){function e(){this.state=st.NOT_STARTED,this.onGoingTransactionNewState=st.UNKNOWN}return e.prototype.directTransition=function(t){this.failIfTransitionOngoing(),this.validateTransition(t),this.state=t},e.prototype.startTransition=function(t){return this.failIfTransitionOngoing(),this.validateTransition(t),this.onGoingTransactionNewState=t,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===st.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=st.UNKNOWN,this.directTransition(t)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===st.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=st.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==st.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(t){switch(this.state){case st.UNKNOWN:throw"Transition from unknown is not allowed";case st.NOT_STARTED:this.failIfNewStateIs(t,[st.PAUSED]);break;case st.SCANNING:break;case st.PAUSED:break}},e.prototype.failIfNewStateIs=function(t,n){for(var o=0,c=n;o<c.length;o++){var f=c[o];if(t===f)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),J_=function(){function e(t){this.stateManager=t}return e.prototype.startTransition=function(t){return this.stateManager.startTransition(t)},e.prototype.directTransition=function(t){this.stateManager.directTransition(t)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===st.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==st.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===st.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===st.PAUSED},e}(),eO=function(){function e(){}return e.create=function(){return new J_(new q_)},e}(),tO=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(o[f]=c[f])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function o(){this.constructor=t}t.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),fr=function(e){tO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(k_),rO=function(){function e(t,n){this.logger=n,this.fps=fr.SCAN_DEFAULT_FPS,t?(t.fps&&(this.fps=t.fps),this.disableFlip=t.disableFlip===!0,this.qrbox=t.qrbox,this.aspectRatio=t.aspectRatio,this.videoConstraints=t.videoConstraints):this.disableFlip=fr.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?hv.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!ln(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),bO=function(){function e(t,n){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(t))throw"HTML Element with id=".concat(t," not found");this.elementId=t,this.verbose=!1;var o;typeof n=="boolean"?this.verbose=n===!0:n&&(o=n,this.verbose=o.verbose===!0,o.experimentalFeatures),this.logger=new L_(this.verbose),this.qrcode=new W_(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=eO.create()}return e.prototype.start=function(t,n,o,c){var f=this;if(!t)throw"cameraIdOrConfig is required";if(!o||typeof o!="function")throw"qrCodeSuccessCallback is required and should be a function.";var g;c?g=c:g=this.verbose?this.logger.log:function(){};var m=rO.create(n,this.logger);this.clearElement();var v=!1;m.videoConstraints&&(m.isMediaStreamConstraintsValid()?v=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=v,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:fr.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var A=this,I=this.stateManagerProxy.startTransition(st.SCANNING);return new Promise(function(O,k){var M=x?m.videoConstraints:A.createVideoConstraints(t);if(!M){I.cancel(),k("videoConstraints should be defined");return}var G={};(!x||m.aspectRatio)&&(G.aspectRatio=m.aspectRatio);var N={onRenderSurfaceReady:function(T,_){A.setupUi(T,_,m),A.isScanning=!0,A.foreverScan(m,o,g)}};Y_.failIfNotSupported().then(function(T){T.create(M).then(function(_){return _.render(f.element,G,N).then(function(U){A.renderedCamera=U,I.execute(),O(null)}).catch(function(U){I.cancel(),k(U)})}).catch(function(_){I.cancel(),k(ss.errorGettingUserMedia(_))})}).catch(function(T){I.cancel(),k(ss.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(st.PAUSED),this.showPausedState(),(ln(t)||t!==!0)&&(t=!1),t&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var t=this,n=function(){t.stateManagerProxy.directTransition(st.SCANNING),t.hidePausedState()};if(!this.renderedCamera.isPaused()){n();return}this.renderedCamera.resume(function(){n()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var t=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var n=this.stateManagerProxy.startTransition(st.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var o=function(){if(t.element){var f=document.getElementById(fr.SHADED_REGION_ELEMENT_ID);f&&t.element.removeChild(f)}},c=this;return this.renderedCamera.close().then(function(){return c.renderedCamera=null,c.element&&(c.element.removeChild(c.canvasElement),c.canvasElement=null),o(),c.qrRegion&&(c.qrRegion=null),c.context&&(c.context=null),n.execute(),c.hidePausedState(),c.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(t,n){return this.scanFileV2(t,n).then(function(o){return o.decodedText})},e.prototype.scanFileV2=function(t,n){var o=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(ln(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(c,f){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(t);var g=new Image;g.onload=function(){var m=g.width,v=g.height,x=document.getElementById(o.elementId),C=x.clientWidth?x.clientWidth:fr.DEFAULT_WIDTH,A=Math.max(x.clientHeight?x.clientHeight:v,fr.FILE_SCAN_MIN_HEIGHT),I=o.computeCanvasDrawConfig(m,v,C,A);if(n){var O=o.createCanvasElement(C,A,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var k=O.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=A,k.drawImage(g,0,0,m,v,I.x,I.y,I.width,I.height)}var M=fr.FILE_SCAN_HIDDEN_CANVAS_PADDING,G=Math.max(g.width,I.width),N=Math.max(g.height,I.height),T=G+2*M,_=N+2*M,U=o.createCanvasElement(T,_);x.appendChild(U);var z=U.getContext("2d");if(!z)throw"Unable to get 2d context from canvas";z.canvas.width=T,z.canvas.height=_,z.drawImage(g,0,0,m,v,M,M,G,N);try{o.qrcode.decodeRobustlyAsync(U).then(function(j){c(Wp.createFromQrcodeResult(j))}).catch(f)}catch(j){f("QR code parse error, error = ".concat(j))}},g.onerror=f,g.onabort=f,g.onstalled=f,g.onsuspend=f,g.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Q_.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(t){if(t){if(!hv.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(t)},e.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(t){var n=[re.QR_CODE,re.AZTEC,re.CODABAR,re.CODE_39,re.CODE_93,re.CODE_128,re.DATA_MATRIX,re.MAXICODE,re.ITF,re.EAN_13,re.EAN_8,re.PDF_417,re.RSS_14,re.RSS_EXPANDED,re.UPC_A,re.UPC_E,re.UPC_EAN_EXTENSION];if(!t||typeof t=="boolean"||!t.formatsToSupport)return n;if(!Array.isArray(t.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(t.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var o=[],c=0,f=t.formatsToSupport;c<f.length;c++){var g=f[c];P_(g)?o.push(g):this.logger.warn("Invalid format: ".concat(g," passed in config, ignoring."))}if(o.length===0)throw"None of formatsToSupport match supported values.";return o},e.prototype.getUseBarCodeDetectorIfSupported=function(t){if(ln(t))return!0;if(!ln(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(ln(t.experimentalFeatures))return!0;var n=t.experimentalFeatures;return ln(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,n,o){var c=this,f=o.qrbox;this.validateQrboxConfig(f);var g=this.toQrdimensions(t,n,f),m=function(x){if(x<fr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(fr.MIN_QR_BOX_SIZE,"px.")},v=function(x){return x>t&&(c.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),x=t),x};m(g.width),m(g.height),g.width=v(g.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,o){if(typeof o=="number")return{width:o,height:o};if(typeof o=="function")try{return o(t,n)}catch(c){throw new Error("qrbox config was passed as a function but it failed with unknown error"+c)}return o},e.prototype.setupUi=function(t,n,o){o.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,o);var c=ln(o.qrbox)?{width:t,height:n}:o.qrbox;this.validateQrboxConfig(c);var f=this.toQrdimensions(t,n,c);f.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var g=o.isShadedBoxEnabled()&&f.height<=n,m={x:0,y:0,width:t,height:n},v=g?this.getShadedRegionBounds(t,n,f):m,x=this.createCanvasElement(v.width,v.height),C={willReadFrequently:!0},A=x.getContext("2d",C);A.canvas.width=v.width,A.canvas.height=v.height,this.element.append(x),g&&this.possiblyInsertShadingElement(this.element,t,n,f),this.createScannerPausedUiElement(this.element),this.qrRegion=v,this.context=A,this.canvasElement=x},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=ss.scannerPaused(),n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="rgba(9, 9, 9, 0.46)",n.style.color="#FFECEC",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var o=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(c){return t(c.text,Wp.createFromQrcodeResult(c)),o.possiblyUpdateShaders(!0),!0}).catch(function(c){o.possiblyUpdateShaders(!1);var f=ss.codeParseError(c);return n(f,B_.createFrom(f)),!1})},e.prototype.foreverScan=function(t,n,o){var c=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),g=f.videoWidth/f.clientWidth,m=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var v=this.qrRegion.width*g,x=this.qrRegion.height*m,C=this.qrRegion.x*g,A=this.qrRegion.y*m;this.context.drawImage(f,C,A,v,x,0,0,this.qrRegion.width,this.qrRegion.height);var I=function(){c.foreverScanTimeout=setTimeout(function(){c.foreverScan(t,n,o)},c.getTimeoutFps(t.fps))};this.scanContext(n,o).then(function(O){!O&&t.disableFlip!==!0?(c.context.translate(c.context.canvas.width,0),c.context.scale(-1,1),c.scanContext(n,o).finally(function(){I()})):I()}).catch(function(O){c.logger.logError("Error happend while scanning context",O),I()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",o="deviceId",c={user:!0,environment:!0},f="exact",g=function(k){if(k in c)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},m=Object.keys(t);if(m.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(m.length," keys");var v=Object.keys(t)[0];if(v!==n&&v!==o)throw"Only '".concat(n,"' and '").concat(o,"' ")+" are supported for 'cameraIdOrConfig'";if(v===n){var x=t.facingMode;if(typeof x=="string"){if(g(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(g(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var A=t.deviceId;if(typeof A=="string")return{deviceId:A};if(typeof A=="object"){if(f in A)return{deviceId:{exact:A["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var I=typeof A;throw"Invalid type of 'deviceId' = ".concat(I)}}}var O=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},e.prototype.computeCanvasDrawConfig=function(t,n,o,c){if(t<=o&&n<=c){var f=(o-t)/2,g=(c-n)/2;return{x:f,y:g,width:t,height:n}}else{var m=t,v=n;return t>o&&(n=o/t*n,t=o),n>c&&(t=c/n*t,n=c),this.logger.log("Image downsampled from "+"".concat(m,"X").concat(v)+" to ".concat(t,"X").concat(n,".")),this.computeCanvasDrawConfig(t,n,o,c)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?fr.BORDER_SHADER_MATCH_COLOR:fr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,o){var c=t,f=n,g=document.createElement("canvas");return g.style.width="".concat(c,"px"),g.style.height="".concat(f,"px"),g.style.display="none",g.id=ln(o)?"qr-canvas":o,g},e.prototype.getShadedRegionBounds=function(t,n,o){if(o.width>t||o.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-o.width)/2,y:(n-o.height)/2,width:o.width,height:o.height}},e.prototype.possiblyInsertShadingElement=function(t,n,o,c){if(!(n-c.width<1||o-c.height<1)){var f=document.createElement("div");f.style.position="absolute";var g=(n-c.width)/2,m=(o-c.height)/2;if(f.style.borderLeft="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(g,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(fr.SHADED_REGION_ELEMENT_ID),n-c.width<11||o-c.height<11)this.hasBorderShaders=!1;else{var v=5,x=40;this.insertShaderBorders(f,x,v,-v,null,0,!0),this.insertShaderBorders(f,x,v,-v,null,0,!1),this.insertShaderBorders(f,x,v,null,-v,0,!0),this.insertShaderBorders(f,x,v,null,-v,0,!1),this.insertShaderBorders(f,v,x+v,-v,null,-v,!0),this.insertShaderBorders(f,v,x+v,null,-v,-v,!0),this.insertShaderBorders(f,v,x+v,-v,null,-v,!1),this.insertShaderBorders(f,v,x+v,null,-v,-v,!1),this.hasBorderShaders=!0}t.append(f)}},e.prototype.insertShaderBorders=function(t,n,o,c,f,g,m){var v=document.createElement("div");v.style.position="absolute",v.style.backgroundColor=fr.BORDER_SHADER_DEFAULT_COLOR,v.style.width="".concat(n,"px"),v.style.height="".concat(o,"px"),c!==null&&(v.style.top="".concat(c,"px")),f!==null&&(v.style.bottom="".concat(f,"px")),m?v.style.left="".concat(g,"px"):v.style.right="".concat(g,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(v),t.appendChild(v)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),Yp;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Yp||(Yp={}));var k1;(function(e){e[e.BACK=1]="BACK",e[e.FRONT=2]="FRONT"})(k1||(k1={}));var B1;(function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.LANDSCAPE=2]="LANDSCAPE",e[e.ADAPTIVE=3]="ADAPTIVE"})(B1||(B1={}));var L1;(function(e){e[e.ALL=17]="ALL"})(L1||(L1={}));const nO=Object.assign(Object.assign({},re),L1);var Kp;(function(e){e.ZXING="zxing",e.MLKIT="mlkit"})(Kp||(Kp={}));const iO=[{selector:".scanner-container-display",css:"display: block;"},{selector:".scanner-dialog",css:"display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4);"},{selector:".scanner-dialog-inner",css:"background-color: #fefefe; margin: 2% auto; padding: 20px; border: 1px solid #888; width: 96%;"},{selector:".close-button",css:"color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;"},{selector:".close-button:hover",css:"color: #222;"},{selector:".scanner-container-full-width",css:"width: 100%;"}];function sO(e){const t="custom-style-os-cap-barcode";let n=document.getElementById(t);if(n||(n=document.createElement("style"),n.type="text/css",n.id=t,document.head.appendChild(n)),n.sheet){for(;n.sheet.cssRules.length;)n.sheet.deleteRule(0);for(const{selector:o,css:c}of e)n.sheet.insertRule(`${o} { ${c} }`)}else{n.textContent="";for(const{selector:o,css:c}of e)n.textContent+=`${o} { ${c} }`}}const oO=sa("CapacitorBarcodeScanner",{web:()=>(sO(iO),Y1(()=>import("./web-DzBEnE5q.js"),[],import.meta.url).then(e=>new e.CapacitorBarcodeScannerWeb))});class aO{static async scanBarcode(t){return t.scanInstructions=t.scanInstructions||" ",t.scanButton=t.scanButton||!1,t.scanText=t.scanText||" ",t.cameraDirection=t.cameraDirection||k1.BACK,t.scanOrientation=t.scanOrientation||B1.ADAPTIVE,oO.scanBarcode(t)}}const vf=sa("SecureStoragePlugin",{web:()=>Y1(()=>import("./web-harvpkJj.js"),[],import.meta.url).then(e=>new e.SecureStoragePluginWeb)});function lO(e){try{if(e.length>2048)throw new Error;if(!e.startsWith("{")){const c=new URL(e);if(!["http:","https:"].includes(c.protocol)||c.username||c.password||c.pathname!=="/pair"||c.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(c.hash))throw new Error;const f=qn.parse(c.origin);if(!f)throw new Error;return{endpoint:f,grant:c.hash.slice(6)}}const t=JSON.parse(e);if(t.type!=="agentroam-pair"||t.version!==1||typeof t.server!="string"||typeof t.grant!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t.grant))throw new Error;const n=new URL(t.server);if(n.username||n.password||n.search||n.hash||n.pathname!=="/")throw new Error;const o=qn.parse(t.server);if(!o)throw new Error;return{endpoint:o,grant:t.grant}}catch{throw new Error("这不是 AgentRoam 授权二维码,请扫描电脑终端上新生成的二维码。")}}class uO{ready(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中扫码连接。")}async get(t){this.ready();try{return(await vf.get({key:`agentroam-device:${t}`})).value}catch(n){if(String(n).includes("does not exist"))return null;throw new Error("无法读取设备凭证,请重试。")}}async set(t,n){this.ready(),await vf.set({key:`agentroam-device:${t}`,value:n})}async remove(t){this.ready();try{await vf.remove({key:`agentroam-device:${t}`})}catch(n){if(!String(n).includes("does not exist"))throw n}}}async function cO(){if(!Ts.isNativePlatform())throw new Error("请在 AgentRoam App 中使用相机扫码。");try{return(await aO.scanBarcode({hint:nO.QR_CODE,scanInstructions:"扫描电脑上的 AgentRoam 授权二维码",cameraDirection:1})).ScanResult||null}catch(e){if(/cancel/i.test(String(e)))return null;throw new Error("无法打开相机,请在系统设置中允许 AgentRoam 使用相机后重试。")}}class fO{constructor(t,n=(...c)=>fetch(...c),o=()=>window.dispatchEvent(new CustomEvent("webapp:unauthorized"))){this.storage=t,this.transport=n,this.onRevoked=o,this.session=null,this.fetch=async(c,f={})=>{const g=this.session,m=new URL(typeof c=="string"?c:c instanceof URL?c.href:c.url),v=new Headers(f.headers??(c instanceof Request?c.headers:void 0));g&&m.origin===g.origin&&v.set("authorization",`Bearer ${g.token}`);const x=await this.transport(c,{...f,headers:v,credentials:"omit",redirect:"error"});if(g&&this.session===g&&m.origin===g.origin&&(x.status===401||x.status===423)){this.session=null;try{await this.storage.remove(g.origin)}finally{this.onRevoked()}}return x}}async resume(t){const n=await this.storage.get(t.url);this.session=n?{origin:t.url,token:n}:null}async pair(t){const{endpoint:n,grant:o}=lO(t),c=await this.transport(n.api("/api/pairing/qr-exchange"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant:o,name:"我的 App"}),credentials:"omit",redirect:"error",signal:AbortSignal.timeout(1e4)});if(!c.ok)throw new Error(c.status===423?"电脑已锁定远程访问,请先在电脑上解锁。":c.status===410?"二维码已使用或已过期,请在电脑上重新生成。":"扫码连接失败,请检查服务器地址和网络后重试。");const f=await c.json();if(typeof f.token!="string"||!/^[A-Za-z0-9_-]{43}$/.test(f.token))throw new Error("服务器返回了无效的设备凭证。");try{await this.storage.set(n.url,f.token)}catch{throw await this.transport(n.api("/api/pairing/logout"),{method:"POST",headers:{authorization:`Bearer ${f.token}`},credentials:"omit",redirect:"error",signal:AbortSignal.timeout(5e3)}).catch(()=>{}),new Error("无法安全保存设备凭证,请在电脑上重新生成二维码后重试。")}return this.session={origin:n.url,token:f.token},n}async checkAuthorization(){const t=this.session;if(!t)return;const n=await this.fetch(`${t.origin}/api/web-auth/status`,{signal:AbortSignal.timeout(5e3)});if(!n.ok)return;const o=await n.json();if(this.session===t&&(o.locked||o.authenticated===!1)){this.session=null;try{await this.storage.remove(t.origin)}finally{this.onRevoked()}}}}var iu;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(iu||(iu={}));var Zp;(function(e){e.None="NONE",e.Slide="SLIDE",e.Fade="FADE"})(Zp||(Zp={}));const yf=sa("StatusBar");function dO(e){const t=/^#([a-f\d]{6})$/i.exec(e.trim());if(!t)return null;const n=[0,2,4].map(c=>{const f=parseInt(t[1].slice(c,c+2),16)/255;return f<=.04045?f/12.92:((f+.055)/1.055)**2.4}),o=.2126*n[0]+.7152*n[1]+.0722*n[2];return{color:`#${t[1]}`,style:o>.179?iu.Light:iu.Dark}}function hO(){if(Ts.getPlatform()!=="android")return()=>{};const e=document.documentElement;e.dataset.skin=Ol.getState().skin;let t=!1,n=yf.setOverlaysWebView({overlay:!1}).catch(()=>{});const o=()=>{const g=dO(getComputedStyle(e).getPropertyValue("--bg-deepest"));g&&(n=n.then(async()=>{t||(await yf.setBackgroundColor({color:g.color}),await yf.setStyle({style:g.style}))}).catch(()=>{console.warn("Unable to update the Android status bar.")}))},c=new MutationObserver(o);c.observe(e,{attributes:!0,attributeFilter:["data-skin"]});const f=()=>{document.hidden||o()};return document.addEventListener("visibilitychange",f),window.addEventListener("focus",o),o(),()=>{t=!0,c.disconnect(),document.removeEventListener("visibilitychange",f),window.removeEventListener("focus",o)}}const gO="/service-worker.js";function pO(){return typeof window<"u"&&window.isSecureContext===!0&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function xO(e){const t="=".repeat((4-e.length%4)%4),n=`${e}${t}`.replace(/-/g,"+").replace(/_/g,"/"),o=atob(n),c=new Uint8Array(new ArrayBuffer(o.length));for(let f=0;f<o.length;f+=1)c[f]=o.charCodeAt(f);return c}async function Qp(e){const{publicKey:t}=await e.get("/api/push/vapid");if(!t)return;const n=await navigator.serviceWorker.register(gO),c=await n.pushManager.getSubscription()??await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:xO(t)});await e.post("/api/push/subscribe",c.toJSON())}function mO(e){pO()&&(async()=>{try{if(Notification.permission==="granted"){await Qp(e);return}if(Notification.permission!=="default")return;const t=()=>{(async()=>{try{await Notification.requestPermission()==="granted"&&await Qp(e)}catch{}})()};document.addEventListener("pointerdown",t,{once:!0})}catch{}})()}class Ef extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const qp=10,wO=13,ci=32;function Cf(e){}function vO(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:t=Cf,onError:n=Cf,onRetry:o=Cf,onComment:c,maxBufferSize:f}=e,g=[];let m=0,v=!0,x,C="",A=0,I,O=!1;function k(z){if(O)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(v&&(v=!1,z.charCodeAt(0)===239&&z.charCodeAt(1)===187&&z.charCodeAt(2)===191&&(z=z.slice(3))),g.length===0){const X=G(z);X!==""&&(g.push(X),m=X.length),M();return}if(z.indexOf(`
|
|
82
82
|
`)===-1&&z.indexOf("\r")===-1){g.push(z),m+=z.length,M();return}g.push(z);const j=g.join("");g.length=0,m=0;const B=G(j);B!==""&&(g.push(B),m=B.length),M()}function M(){f!==void 0&&(m+C.length<=f||(O=!0,g.length=0,m=0,x=void 0,C="",A=0,I=void 0,n(new Ef(`Buffered data exceeded max buffer size of ${f} characters`,{type:"max-buffer-size-exceeded"}))))}function G(z){let j=0;if(z.indexOf("\r")===-1){let B=z.indexOf(`
|
|
83
83
|
`,j);for(;B!==-1;){if(j===B){A>0&&t({id:x,event:I,data:C}),x=void 0,C="",A=0,I=void 0,j=B+1,B=z.indexOf(`
|
|
84
84
|
`,j);continue}const X=z.charCodeAt(j);if(Jp(z,j,X)){const V=z.charCodeAt(j+5)===ci?j+6:j+5,oe=z.slice(V,B);if(A===0&&z.charCodeAt(B+1)===qp){t({id:x,event:I,data:oe}),x=void 0,C="",I=void 0,j=B+2,B=z.indexOf(`
|
|
@@ -87,4 +87,4 @@ ${oe}`,A++}else e2(z,j,X)?I=z.slice(z.charCodeAt(j+6)===ci?j+7:j+6,B)||void 0:N(
|
|
|
87
87
|
`,j)}return z.slice(j)}for(;j<z.length;){const B=z.indexOf("\r",j),X=z.indexOf(`
|
|
88
88
|
`,j);let V=-1;if(B!==-1&&X!==-1?V=B<X?B:X:B!==-1?B===z.length-1?V=-1:V=B:X!==-1&&(V=X),V===-1)break;N(z,j,V),j=V+1,z.charCodeAt(j-1)===wO&&z.charCodeAt(j)===qp&&j++}return z.slice(j)}function N(z,j,B){if(j===B){_();return}const X=z.charCodeAt(j);if(Jp(z,j,X)){const Te=z.charCodeAt(j+5)===ci?j+6:j+5,H=z.slice(Te,B);C=A===0?H:`${C}
|
|
89
89
|
${H}`,A++;return}if(e2(z,j,X)){I=z.slice(z.charCodeAt(j+6)===ci?j+7:j+6,B)||void 0;return}if(X===105&&z.charCodeAt(j+1)===100&&z.charCodeAt(j+2)===58){const Te=z.slice(z.charCodeAt(j+3)===ci?j+4:j+3,B);Te.includes("\0")||(x=Te);return}if(X===58){if(c){const Te=z.slice(j,B);c(Te.slice(z.charCodeAt(j+1)===ci?2:1))}return}const V=z.slice(j,B),oe=V.indexOf(":");if(oe===-1){T(V,"",V);return}const ye=V.slice(0,oe),se=V.charCodeAt(oe+1)===ci?2:1,ge=V.slice(oe+se);T(ye,ge,V)}function T(z,j,B){switch(z){case"event":I=j||void 0;break;case"data":C=A===0?j:`${C}
|
|
90
|
-
${j}`,A++;break;case"id":j.includes("\0")||(x=j);break;case"retry":/^\d+$/.test(j)?o(parseInt(j,10)):n(new Ef(`Invalid \`retry\` value: "${j}"`,{type:"invalid-retry",value:j,line:B}));break;default:n(new Ef(`Unknown field "${z.length>20?`${z.slice(0,20)}…`:z}"`,{type:"unknown-field",field:z,value:j,line:B}));break}}function _(){A>0&&t({id:x,event:I,data:C}),x=void 0,C="",A=0,I=void 0}function U(z={}){if(z.consume&&g.length>0){const j=g.join("");N(j,0,j.length)}v=!0,x=void 0,C="",A=0,I=void 0,g.length=0,m=0,O=!1}return{feed:k,reset:U}}function Jp(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function e2(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class t2 extends Event{constructor(t,n){var o,c;super(t),this.code=(o=n==null?void 0:n.code)!=null?o:void 0,this.message=(c=n==null?void 0:n.message)!=null?c:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,o){return o(r2(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(r2(this),n)}}function yO(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function F1(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(F1).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${F1(e.cause)}`:e.message:`${e}`}function r2(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var pv=e=>{throw TypeError(e)},Id=(e,t,n)=>t.has(e)||pv("Cannot "+n),Ee=(e,t,n)=>(Id(e,t,"read from private field"),n?n.call(e):t.get(e)),wt=(e,t,n)=>t.has(e)?pv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Xe=(e,t,n,o)=>(Id(e,t,"write to private field"),t.set(e,n),n),un=(e,t,n)=>(Id(e,t,"access private method"),n),rr,hi,Vi,yl,su,Io,os,To,Fn,zi,gs,Hi,fo,kr,U1,j1,W1,n2,$1,V1,ho,z1,H1;let El=class extends EventTarget{constructor(t,n){var o,c;super(),wt(this,kr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,wt(this,rr),wt(this,hi),wt(this,Vi),wt(this,yl),wt(this,su),wt(this,Io),wt(this,os),wt(this,To,null),wt(this,Fn),wt(this,zi),wt(this,gs,null),wt(this,Hi,null),wt(this,fo,null),wt(this,j1,async f=>{var g;Ee(this,zi).reset();const{body:m,redirected:v,status:x,headers:C}=f;if(x===204){un(this,kr,ho).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(v?Xe(this,Vi,new URL(f.url)):Xe(this,Vi,void 0),x!==200){un(this,kr,ho).call(this,`Non-200 status code (${x})`,x);return}if(!(C.get("content-type")||"").startsWith("text/event-stream")){un(this,kr,ho).call(this,'Invalid content type, expected "text/event-stream"',x);return}if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.OPEN);const A=new Event("open");if((g=Ee(this,fo))==null||g.call(this,A),this.dispatchEvent(A),typeof m!="object"||!m||!("getReader"in m)){un(this,kr,ho).call(this,"Invalid response body, expected a web ReadableStream",x),this.close();return}const I=new TextDecoder,O=m.getReader();let k=!0;do{const{done:M,value:G}=await O.read();G&&Ee(this,zi).feed(I.decode(G,{stream:!M})),M&&(k=!1,Ee(this,zi).reset(),un(this,kr,z1).call(this))}while(k)}),wt(this,W1,f=>{Xe(this,Fn,void 0),!(f.name==="AbortError"||f.type==="aborted")&&un(this,kr,z1).call(this,F1(f))}),wt(this,$1,f=>{typeof f.id=="string"&&Xe(this,To,f.id);const g=new MessageEvent(f.event||"message",{data:f.data,origin:Ee(this,Vi)?Ee(this,Vi).origin:Ee(this,hi).origin,lastEventId:f.id||""});Ee(this,Hi)&&(!f.event||f.event==="message")&&Ee(this,Hi).call(this,g),this.dispatchEvent(g)}),wt(this,V1,f=>{Xe(this,Io,f)}),wt(this,H1,()=>{Xe(this,os,void 0),Ee(this,rr)===this.CONNECTING&&un(this,kr,U1).call(this)});try{if(t instanceof URL)Xe(this,hi,t);else if(typeof t=="string")Xe(this,hi,new URL(t,EO()));else throw new Error("Invalid URL")}catch{throw yO("An invalid or illegal string was specified")}Xe(this,zi,vO({onEvent:Ee(this,$1),onRetry:Ee(this,V1)})),Xe(this,rr,this.CONNECTING),Xe(this,Io,3e3),Xe(this,su,(o=n==null?void 0:n.fetch)!=null?o:globalThis.fetch),Xe(this,yl,(c=n==null?void 0:n.withCredentials)!=null?c:!1),un(this,kr,U1).call(this)}get readyState(){return Ee(this,rr)}get url(){return Ee(this,hi).href}get withCredentials(){return Ee(this,yl)}get onerror(){return Ee(this,gs)}set onerror(t){Xe(this,gs,t)}get onmessage(){return Ee(this,Hi)}set onmessage(t){Xe(this,Hi,t)}get onopen(){return Ee(this,fo)}set onopen(t){Xe(this,fo,t)}addEventListener(t,n,o){const c=n;super.addEventListener(t,c,o)}removeEventListener(t,n,o){const c=n;super.removeEventListener(t,c,o)}close(){Ee(this,os)&&clearTimeout(Ee(this,os)),Ee(this,rr)!==this.CLOSED&&(Ee(this,Fn)&&Ee(this,Fn).abort(),Xe(this,rr,this.CLOSED),Xe(this,Fn,void 0))}};rr=new WeakMap,hi=new WeakMap,Vi=new WeakMap,yl=new WeakMap,su=new WeakMap,Io=new WeakMap,os=new WeakMap,To=new WeakMap,Fn=new WeakMap,zi=new WeakMap,gs=new WeakMap,Hi=new WeakMap,fo=new WeakMap,kr=new WeakSet,U1=function(){Xe(this,rr,this.CONNECTING),Xe(this,Fn,new AbortController),Ee(this,su)(Ee(this,hi),un(this,kr,n2).call(this)).then(Ee(this,j1)).catch(Ee(this,W1))},j1=new WeakMap,W1=new WeakMap,n2=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ee(this,To)?{"Last-Event-ID":Ee(this,To)}:void 0},cache:"no-store",signal:(e=Ee(this,Fn))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},$1=new WeakMap,V1=new WeakMap,ho=function(e,t){var n;Ee(this,rr)!==this.CLOSED&&Xe(this,rr,this.CLOSED);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o)},z1=function(e,t){var n;if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.CONNECTING);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o),Xe(this,os,setTimeout(Ee(this,H1),Ee(this,Io)))},H1=new WeakMap,El.CONNECTING=0,El.OPEN=1,El.CLOSED=2;function EO(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}j6();Gb();Zb();Jb();r_();Bb({baseUrl:()=>ou,source:"webapp"});document.body.dataset.webShell="1";const ju=new y_;ju.isNativeApp()&&(document.body.dataset.nativeApp="1");hO();if(!ju.isNativeApp()&&window.parent===window){const e=document.createElement("link");e.rel="manifest",e.href="/manifest.webmanifest",document.head.append(e);const t=document.querySelector('link[rel="apple-touch-icon"]');t&&(t.href="/pwa/icon-192.png");const n=document.createElement("script");n.src="/pwa/install.js",document.head.append(n)}if(window.parent===window){const e=()=>{const t=Sg.find(o=>o.id===Ol.getState().skin)??Sg[0];document.body.style.background=t.preview[0];let n=document.querySelector('meta[name="theme-color"]');n||(n=document.createElement("meta"),n.name="theme-color",document.head.append(n)),n.content=t.preview[0]};e(),Ol.subscribe(e)}const Mt=ju.isNativeApp()?new fO(new uO):null,G1=new Db(Mt==null?void 0:Mt.fetch),CO=window.parent===window?void 0:new u_,AO=window.parent===window?void 0:new w_;let ou="";const i2=new $b(G1,new Vb,CO,e=>Mt?new El(ou+e,{fetch:Mt.fetch}):new EventSource(ou+e));window.browserLiveApi=AO;const xv=document.getElementById("root");if(!xv)throw new Error("#root missing");const X1=cv(xv);function SO(){return ht.useEffect(()=>{i_()},[]),null}(async()=>{Mt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new v_(ju,new Bp,new C_(Mt?async(n,o)=>{const c=qn.parse(String(n));return c&&await Mt.resume(c),Mt.fetch(n,o)}:void 0)),t=await e.planStartup();if(t.mode==="setup"){X1.render(ee.jsx(S_,{service:e,savedEndpoint:t.endpoint,initialFailure:t.failure,onScan:Mt?async()=>{const n=await cO();if(!n)return null;const o=await Mt.pair(n);return new Bp().save(o),o}:void 0,onConnected:n=>void s2(n)}));return}await s2(t.mode==="ready"?t.endpoint:null)})();async function s2(e){try{e&&(await(Mt==null?void 0:Mt.resume(e)),G1.setBaseUrl(e.url),ou=e.url),window.agentApi=i2,await i2.refreshServerModel(),!Mt&&window.parent===window&&mO(G1);const{default:t}=await Y1(async()=>{const{default:n}=await import("./App-
|
|
90
|
+
${j}`,A++;break;case"id":j.includes("\0")||(x=j);break;case"retry":/^\d+$/.test(j)?o(parseInt(j,10)):n(new Ef(`Invalid \`retry\` value: "${j}"`,{type:"invalid-retry",value:j,line:B}));break;default:n(new Ef(`Unknown field "${z.length>20?`${z.slice(0,20)}…`:z}"`,{type:"unknown-field",field:z,value:j,line:B}));break}}function _(){A>0&&t({id:x,event:I,data:C}),x=void 0,C="",A=0,I=void 0}function U(z={}){if(z.consume&&g.length>0){const j=g.join("");N(j,0,j.length)}v=!0,x=void 0,C="",A=0,I=void 0,g.length=0,m=0,O=!1}return{feed:k,reset:U}}function Jp(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function e2(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class t2 extends Event{constructor(t,n){var o,c;super(t),this.code=(o=n==null?void 0:n.code)!=null?o:void 0,this.message=(c=n==null?void 0:n.message)!=null?c:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,o){return o(r2(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(r2(this),n)}}function yO(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function F1(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(F1).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${F1(e.cause)}`:e.message:`${e}`}function r2(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var pv=e=>{throw TypeError(e)},Id=(e,t,n)=>t.has(e)||pv("Cannot "+n),Ee=(e,t,n)=>(Id(e,t,"read from private field"),n?n.call(e):t.get(e)),wt=(e,t,n)=>t.has(e)?pv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Xe=(e,t,n,o)=>(Id(e,t,"write to private field"),t.set(e,n),n),un=(e,t,n)=>(Id(e,t,"access private method"),n),rr,hi,Vi,yl,su,Io,os,To,Fn,zi,gs,Hi,fo,kr,U1,j1,W1,n2,$1,V1,ho,z1,H1;let El=class extends EventTarget{constructor(t,n){var o,c;super(),wt(this,kr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,wt(this,rr),wt(this,hi),wt(this,Vi),wt(this,yl),wt(this,su),wt(this,Io),wt(this,os),wt(this,To,null),wt(this,Fn),wt(this,zi),wt(this,gs,null),wt(this,Hi,null),wt(this,fo,null),wt(this,j1,async f=>{var g;Ee(this,zi).reset();const{body:m,redirected:v,status:x,headers:C}=f;if(x===204){un(this,kr,ho).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(v?Xe(this,Vi,new URL(f.url)):Xe(this,Vi,void 0),x!==200){un(this,kr,ho).call(this,`Non-200 status code (${x})`,x);return}if(!(C.get("content-type")||"").startsWith("text/event-stream")){un(this,kr,ho).call(this,'Invalid content type, expected "text/event-stream"',x);return}if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.OPEN);const A=new Event("open");if((g=Ee(this,fo))==null||g.call(this,A),this.dispatchEvent(A),typeof m!="object"||!m||!("getReader"in m)){un(this,kr,ho).call(this,"Invalid response body, expected a web ReadableStream",x),this.close();return}const I=new TextDecoder,O=m.getReader();let k=!0;do{const{done:M,value:G}=await O.read();G&&Ee(this,zi).feed(I.decode(G,{stream:!M})),M&&(k=!1,Ee(this,zi).reset(),un(this,kr,z1).call(this))}while(k)}),wt(this,W1,f=>{Xe(this,Fn,void 0),!(f.name==="AbortError"||f.type==="aborted")&&un(this,kr,z1).call(this,F1(f))}),wt(this,$1,f=>{typeof f.id=="string"&&Xe(this,To,f.id);const g=new MessageEvent(f.event||"message",{data:f.data,origin:Ee(this,Vi)?Ee(this,Vi).origin:Ee(this,hi).origin,lastEventId:f.id||""});Ee(this,Hi)&&(!f.event||f.event==="message")&&Ee(this,Hi).call(this,g),this.dispatchEvent(g)}),wt(this,V1,f=>{Xe(this,Io,f)}),wt(this,H1,()=>{Xe(this,os,void 0),Ee(this,rr)===this.CONNECTING&&un(this,kr,U1).call(this)});try{if(t instanceof URL)Xe(this,hi,t);else if(typeof t=="string")Xe(this,hi,new URL(t,EO()));else throw new Error("Invalid URL")}catch{throw yO("An invalid or illegal string was specified")}Xe(this,zi,vO({onEvent:Ee(this,$1),onRetry:Ee(this,V1)})),Xe(this,rr,this.CONNECTING),Xe(this,Io,3e3),Xe(this,su,(o=n==null?void 0:n.fetch)!=null?o:globalThis.fetch),Xe(this,yl,(c=n==null?void 0:n.withCredentials)!=null?c:!1),un(this,kr,U1).call(this)}get readyState(){return Ee(this,rr)}get url(){return Ee(this,hi).href}get withCredentials(){return Ee(this,yl)}get onerror(){return Ee(this,gs)}set onerror(t){Xe(this,gs,t)}get onmessage(){return Ee(this,Hi)}set onmessage(t){Xe(this,Hi,t)}get onopen(){return Ee(this,fo)}set onopen(t){Xe(this,fo,t)}addEventListener(t,n,o){const c=n;super.addEventListener(t,c,o)}removeEventListener(t,n,o){const c=n;super.removeEventListener(t,c,o)}close(){Ee(this,os)&&clearTimeout(Ee(this,os)),Ee(this,rr)!==this.CLOSED&&(Ee(this,Fn)&&Ee(this,Fn).abort(),Xe(this,rr,this.CLOSED),Xe(this,Fn,void 0))}};rr=new WeakMap,hi=new WeakMap,Vi=new WeakMap,yl=new WeakMap,su=new WeakMap,Io=new WeakMap,os=new WeakMap,To=new WeakMap,Fn=new WeakMap,zi=new WeakMap,gs=new WeakMap,Hi=new WeakMap,fo=new WeakMap,kr=new WeakSet,U1=function(){Xe(this,rr,this.CONNECTING),Xe(this,Fn,new AbortController),Ee(this,su)(Ee(this,hi),un(this,kr,n2).call(this)).then(Ee(this,j1)).catch(Ee(this,W1))},j1=new WeakMap,W1=new WeakMap,n2=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ee(this,To)?{"Last-Event-ID":Ee(this,To)}:void 0},cache:"no-store",signal:(e=Ee(this,Fn))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},$1=new WeakMap,V1=new WeakMap,ho=function(e,t){var n;Ee(this,rr)!==this.CLOSED&&Xe(this,rr,this.CLOSED);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o)},z1=function(e,t){var n;if(Ee(this,rr)===this.CLOSED)return;Xe(this,rr,this.CONNECTING);const o=new t2("error",{code:t,message:e});(n=Ee(this,gs))==null||n.call(this,o),this.dispatchEvent(o),Xe(this,os,setTimeout(Ee(this,H1),Ee(this,Io)))},H1=new WeakMap,El.CONNECTING=0,El.OPEN=1,El.CLOSED=2;function EO(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}j6();Gb();Zb();Jb();r_();Bb({baseUrl:()=>ou,source:"webapp"});document.body.dataset.webShell="1";const ju=new y_;ju.isNativeApp()&&(document.body.dataset.nativeApp="1");hO();if(!ju.isNativeApp()&&window.parent===window){const e=document.createElement("link");e.rel="manifest",e.href="/manifest.webmanifest",document.head.append(e);const t=document.querySelector('link[rel="apple-touch-icon"]');t&&(t.href="/pwa/icon-192.png");const n=document.createElement("script");n.src="/pwa/install.js",document.head.append(n)}if(window.parent===window){const e=()=>{const t=Sg.find(o=>o.id===Ol.getState().skin)??Sg[0];document.body.style.background=t.preview[0];let n=document.querySelector('meta[name="theme-color"]');n||(n=document.createElement("meta"),n.name="theme-color",document.head.append(n)),n.content=t.preview[0]};e(),Ol.subscribe(e)}const Mt=ju.isNativeApp()?new fO(new uO):null,G1=new Db(Mt==null?void 0:Mt.fetch),CO=window.parent===window?void 0:new u_,AO=window.parent===window?void 0:new w_;let ou="";const i2=new $b(G1,new Vb,CO,e=>Mt?new El(ou+e,{fetch:Mt.fetch}):new EventSource(ou+e));window.browserLiveApi=AO;const xv=document.getElementById("root");if(!xv)throw new Error("#root missing");const X1=cv(xv);function SO(){return ht.useEffect(()=>{i_()},[]),null}(async()=>{Mt&&window.addEventListener("webapp:unauthorized",()=>location.reload());const e=new v_(ju,new Bp,new C_(Mt?async(n,o)=>{const c=qn.parse(String(n));return c&&await Mt.resume(c),Mt.fetch(n,o)}:void 0)),t=await e.planStartup();if(t.mode==="setup"){X1.render(ee.jsx(S_,{service:e,savedEndpoint:t.endpoint,initialFailure:t.failure,onScan:Mt?async()=>{const n=await cO();if(!n)return null;const o=await Mt.pair(n);return new Bp().save(o),o}:void 0,onConnected:n=>void s2(n)}));return}await s2(t.mode==="ready"?t.endpoint:null)})();async function s2(e){try{e&&(await(Mt==null?void 0:Mt.resume(e)),G1.setBaseUrl(e.url),ou=e.url),window.agentApi=i2,await i2.refreshServerModel(),!Mt&&window.parent===window&&mO(G1);const{default:t}=await Y1(async()=>{const{default:n}=await import("./App-COIcZZvf.js").then(o=>o.A);return{default:n}},__vite__mapDeps([0,1]),import.meta.url);X1.render(ee.jsxs(ht.StrictMode,{children:[ee.jsx(W6.Provider,{value:ee.jsx(_b,{}),children:ee.jsx(t,{})}),ee.jsx(SO,{})]})),Mt&&setInterval(()=>{Mt.checkAuthorization().catch(()=>{})},1e4),e||(window.addEventListener("webapp:unauthorized",()=>location.reload()),IO())}catch(t){X1.render(ee.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f5f6fa",boxSizing:"border-box"},children:ee.jsxs("div",{style:{maxWidth:560,background:"#fff",borderRadius:12,padding:20,boxShadow:"0 4px 16px rgba(0,0,0,0.08)"},children:[ee.jsx("h2",{style:{margin:"0 0 8px",fontSize:16,color:"#dc2626"},children:"界面启动失败"}),ee.jsx("p",{style:{margin:"0 0 12px",fontSize:13,color:"#374151",wordBreak:"break-all"},children:t instanceof Error?`${t.name}: ${t.message}`:String(t)}),ee.jsx("button",{type:"button",onClick:()=>location.reload(),style:{padding:"8px 20px",fontSize:14,borderRadius:8,border:"1px solid #d6d9e0",background:"#fff",cursor:"pointer"},children:"重试"})]})}))}}function IO(){const e=[...document.scripts].map(n=>n.src).join(",").match(/index-([^/]+)\.js/),t=e?e[1]:null;t&&setInterval(async()=>{try{const n=await fetch("/api/agent/model",{credentials:"same-origin",cache:"no-store"});if(n.status===401||n.status===423){location.reload();return}const c=((await n.json()).buildId||"").replace(/^index-|\.js$/g,"");c&&c!==t&&location.reload()}catch{}},6e4)}export{W6 as B,B1 as C,bO as H,RO as L,e_ as O,fy as R,Sg as S,fv as W,Y1 as _,nO as a,uv as b,dn as c,gT as d,TO as e,o2 as g,ET as i,ee as j,ht as r,Ol as u};
|