wiki-viewer 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +7 -0
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +32 -3
- package/.next/standalone/.next/routes-manifest.json +46 -0
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/agent/activity/route.js +6 -6
- package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js +6 -6
- package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js +6 -6
- package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/approve/route.js +7 -7
- package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/approve/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/deny/route.js +5 -5
- package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/deny/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/admin/registrations/route.js +5 -5
- package/.next/standalone/.next/server/app/api/agent/admin/registrations/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +8 -7
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +9 -8
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +8 -7
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js +7 -7
- package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +6 -5
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +7 -6
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +6 -5
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/settings/route.js +7 -7
- package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +8 -7
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js +2 -2
- package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/assets/[...path]/route.js +8 -2
- package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/[...all]/route.js +5 -5
- package/.next/standalone/.next/server/app/api/auth/[...all]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/admins/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/system/admins/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/system/admins/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/system/admins/route.js +14 -0
- package/.next/standalone/.next/server/app/api/system/admins/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/system/admins/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/system/admins/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/system/auth-config/route.js +6 -6
- package/.next/standalone/.next/server/app/api/system/auth-config/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/auth-settings/route.js +4 -4
- package/.next/standalone/.next/server/app/api/system/auth-settings/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/browse/route.js +4 -4
- package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/clear-root/route.js +5 -5
- package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/config/route.js +6 -6
- package/.next/standalone/.next/server/app/api/system/config/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/pins/route.js +4 -4
- package/.next/standalone/.next/server/app/api/system/pins/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/reveal/route.js +6 -6
- package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/root-status/route.js +5 -5
- package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/set-root/route.js +6 -6
- package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/users/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/system/users/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/system/users/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/system/users/route.js +14 -0
- package/.next/standalone/.next/server/app/api/system/users/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/system/users/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/system/users/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js +14 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js +14 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js +14 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/system/workspaces/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/upload/[...path]/route.js +8 -2
- package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js +5 -5
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/content/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/download/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/file/route.js +8 -2
- package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/folder/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/move/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/new-file/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/page/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/presence/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/search/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/wiki/search/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/wiki/search/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/wiki/search/route.js +15 -0
- package/.next/standalone/.next/server/app/api/wiki/search/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/wiki/search/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/wiki/slugs/route.js +6 -6
- package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js +7 -7
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/watch/route.js +7 -9
- package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +5 -5
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/manifest.webmanifest/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route.js +9 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route.js.map +5 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest.body +1 -0
- package/.next/standalone/.next/server/app/manifest.webmanifest.meta +1 -0
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/signin/page.js +1 -1
- package/.next/standalone/.next/server/app/signin/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +7 -0
- package/.next/standalone/.next/server/chunks/0p91_next_dist_1195ub1._.js +18 -0
- package/.next/standalone/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0d2jbo5.js +1 -1
- package/.next/standalone/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0ytral2.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-244bv._.js +16 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0xz-_0v._.js → [root-of-the-server]__0-inabx._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-ao6a_._.js → [root-of-the-server]__0.-9jt0._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0~-r-8f._.js → [root-of-the-server]__00c1-dr._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00lep-u._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00mtevo._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00qu86p._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__012753j._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01hp8ax._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0jhr.ex._.js → [root-of-the-server]__02n6z97._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__036mhjp._.js +5 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__03p0ob1._.js +16 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__05t~v6l._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__068ni_k._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06yp.08._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__082nhm6._.js → [root-of-the-server]__07vphbd._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0pg6dn-._.js → [root-of-the-server]__08lkuwa._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__09cqzem._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0p_ox-k._.js → [root-of-the-server]__09k4q9e._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0_601._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ae3dk6._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0s28.4-._.js → [root-of-the-server]__0af-x45._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cqu-wm._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d75a5q._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d7x3e1._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d7zxm_._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e7vs98._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fxzg4v._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gda_iu._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hu~q20._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jk1uf4._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l-8clq._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lhka0x._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0kdn1le._.js → [root-of-the-server]__0na11h0._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nd.b_c._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0otb8ra._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0p0-p__._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0piofm3._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rrf-jr._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s6_lzw._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sh13v5._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ta~flu._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0v4im4p._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0qn8e~s._.js → [root-of-the-server]__0v_kyp-._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vatqe-._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vdb2nr._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wdh63w._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z3wg9x._.js +12 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0mzo03s._.js → [root-of-the-server]__0~.-3yk._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__123._fe._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12800b1._.js → [root-of-the-server]__12ee_s6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__12onytt._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__04udrya._.js → [root-of-the-server]__12q8ch8._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1377.79._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1378-ox._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13aid91._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13hp4tw._.js +12 -0
- package/.next/standalone/.next/server/chunks/_079xuln._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0dr1r1g._.js +452 -0
- package/.next/standalone/.next/server/chunks/_101exke._.js +452 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_system_admins_route_actions_0dsm7cx.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_system_users_route_actions_0whj5cy.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_system_workspaces_[id]_open_route_actions_1087xu7.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_system_workspaces_[id]_route_actions_0~h7-8s.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_system_workspaces_route_actions_0mkalc3.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wiki_search_route_actions_0inxu93.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_manifest_webmanifest_route_actions_04wfv0d.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules__pnpm_0aj5g-w._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_search_0d-_j3u._.js +46 -0
- package/.next/standalone/.next/server/chunks/src_lib_search_0ymmp0c._.js +46 -0
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_042apsk.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_08q3u1e.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_0nflz3~.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0p91_next_dist_esm_build_templates_app-page_0p5k29e.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_0b8ra51._.js → 0~w0_katex_dist_katex_mjs_04mhawr._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_erDiagram-TEJ5UH35_mjs_0v6rnqy._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_mermaid_core_mjs_0hj_n-~._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0btcd4o._.js → [root-of-the-server]__02twzph._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ytvlzs._.js → [root-of-the-server]__09~x2v~._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hvvps3._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +18 -18
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c71i8a._.js → node_modules__pnpm_0.96tmo._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0lm8e2c._.js → node_modules__pnpm_011vy_q._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ezm2us._.js → node_modules__pnpm_01o_5qt._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0j3mvgg._.js → node_modules__pnpm_04n0h6.._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0~ln0by._.js → node_modules__pnpm_093dp2q._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11e~j49._.js → node_modules__pnpm_09ej62_._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0de8xt-._.js → node_modules__pnpm_09ljbdz._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0-x6zex._.js → node_modules__pnpm_09~_ob2._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0yq5z.h._.js → node_modules__pnpm_0a01ng7._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0kwc-vs._.js → node_modules__pnpm_0b8qx0g._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hrbz84._.js → node_modules__pnpm_0bbc---._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hobcbs._.js → node_modules__pnpm_0c.309.._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0rw91-f._.js → node_modules__pnpm_0c8aunj._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0o.c1z8._.js → node_modules__pnpm_0hk6xys._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0dboa_e._.js → node_modules__pnpm_0hlzy8f._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0j53hti._.js → node_modules__pnpm_0nw5ou2._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xrmzh1._.js → node_modules__pnpm_0o.dn8o._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0cxwhfd._.js → node_modules__pnpm_0s0ur~d._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_07rxv2x._.js → node_modules__pnpm_0shlang._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0i.pw_m._.js → node_modules__pnpm_0sq3c2r._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ajzar9._.js → node_modules__pnpm_0t9jb7d._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_012nt.s._.js → node_modules__pnpm_0wmx9kq._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0z~h2ow._.js → node_modules__pnpm_0xfx0sf._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0cbsnwf._.js → node_modules__pnpm_0yiz.-t._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0bum3-3._.js → node_modules__pnpm_11sut1u._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0mdo4i3._.js → node_modules__pnpm_124u4o2._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0il8j.j._.js → node_modules__pnpm_13tajgx._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/src_app_signin_00yk0vm._.js +2 -2
- package/.next/standalone/.next/server/edge/chunks/{08yl_next_dist_esm_build_templates_edge-wrapper_0o9h3w_.js → 08yl_next_dist_esm_build_templates_edge-wrapper_0xbpts6.js} +2 -2
- package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__0.pmgt2._.js +3 -0
- package/.next/standalone/.next/server/functions-config-manifest.json +6 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware-manifest.json +8 -8
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/0c_~zevf2n0r4.css +2 -0
- package/.next/standalone/.next/static/chunks/0l4842ez-0_66.js +129 -0
- package/.next/standalone/README.md +46 -2
- package/.next/standalone/docs/workspacing-plan.md +364 -0
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/packages/wiki-viewer-mcp/package.json +1 -1
- package/.next/standalone/public/icon-192.png +0 -0
- package/.next/standalone/public/icon-512.png +0 -0
- package/.next/standalone/public/icon-maskable-512.png +0 -0
- package/.next/standalone/src/app/api/agent/activity/route.ts +9 -8
- package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +20 -8
- package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +16 -9
- package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +28 -18
- package/.next/standalone/src/app/api/agent/fs/ls/[[...path]]/route.ts +12 -7
- package/.next/standalone/src/app/api/agent/fs/move/route.ts +16 -11
- package/.next/standalone/src/app/api/agent/fs/search/route.ts +49 -13
- package/.next/standalone/src/app/api/agent/internal/span/route.ts +9 -5
- package/.next/standalone/src/app/api/agent/register/route.ts +9 -1
- package/.next/standalone/src/app/api/agent/settings/route.ts +7 -3
- package/.next/standalone/src/app/api/agent/sidecar/[...path]/route.ts +8 -4
- package/.next/standalone/src/app/api/assets/[...path]/route.ts +9 -4
- package/.next/standalone/src/app/api/system/admins/route.ts +103 -0
- package/.next/standalone/src/app/api/system/reveal/route.ts +7 -6
- package/.next/standalone/src/app/api/system/set-root/route.ts +24 -1
- package/.next/standalone/src/app/api/system/users/route.ts +120 -0
- package/.next/standalone/src/app/api/system/workspaces/[id]/open/route.ts +34 -0
- package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +74 -0
- package/.next/standalone/src/app/api/system/workspaces/route.ts +67 -0
- package/.next/standalone/src/app/api/upload/[...path]/route.ts +10 -5
- package/.next/standalone/src/app/api/wiki/app/route.ts +10 -9
- package/.next/standalone/src/app/api/wiki/content/route.ts +14 -14
- package/.next/standalone/src/app/api/wiki/download/route.ts +7 -6
- package/.next/standalone/src/app/api/wiki/file/route.ts +7 -2
- package/.next/standalone/src/app/api/wiki/folder/route.ts +6 -5
- package/.next/standalone/src/app/api/wiki/move/route.ts +7 -7
- package/.next/standalone/src/app/api/wiki/new-file/route.ts +7 -6
- package/.next/standalone/src/app/api/wiki/page/route.ts +6 -5
- package/.next/standalone/src/app/api/wiki/presence/route.ts +8 -7
- package/.next/standalone/src/app/api/wiki/route.ts +13 -11
- package/.next/standalone/src/app/api/wiki/search/route.ts +44 -0
- package/.next/standalone/src/app/api/wiki/slugs/route.ts +8 -8
- package/.next/standalone/src/app/api/wiki/upload/route.ts +6 -5
- package/.next/standalone/src/app/api/wiki/watch/route.ts +16 -40
- package/.next/standalone/src/app/globals.css +484 -484
- package/.next/standalone/src/app/layout.tsx +15 -1
- package/.next/standalone/src/app/manifest.ts +30 -0
- package/.next/standalone/src/app/page.tsx +163 -49
- package/.next/standalone/src/components/auth-settings-sheet.tsx +171 -2
- package/.next/standalone/src/components/dir-picker.tsx +8 -6
- package/.next/standalone/src/components/editor/comment-thread.tsx +2 -1
- package/.next/standalone/src/components/editor/csv-viewer.tsx +3 -2
- package/.next/standalone/src/components/editor/editor-toolbar.tsx +2 -2
- package/.next/standalone/src/components/editor/editor.tsx +6 -5
- package/.next/standalone/src/components/editor/file-fallback-viewer.tsx +3 -2
- package/.next/standalone/src/components/editor/folder-index.tsx +2 -1
- package/.next/standalone/src/components/editor/image-viewer.tsx +2 -1
- package/.next/standalone/src/components/editor/media-popover.tsx +2 -1
- package/.next/standalone/src/components/editor/media-viewer.tsx +2 -1
- package/.next/standalone/src/components/editor/mermaid-viewer.tsx +3 -2
- package/.next/standalone/src/components/editor/node-app-viewer.tsx +4 -3
- package/.next/standalone/src/components/editor/notebook-viewer.tsx +3 -2
- package/.next/standalone/src/components/editor/office/docx-viewer.tsx +2 -1
- package/.next/standalone/src/components/editor/office/office-chrome.tsx +3 -2
- package/.next/standalone/src/components/editor/office/pptx-viewer.tsx +2 -1
- package/.next/standalone/src/components/editor/office/xlsx-viewer.tsx +2 -1
- package/.next/standalone/src/components/editor/pdf-viewer.tsx +2 -1
- package/.next/standalone/src/components/editor/proof-span-popover.tsx +2 -1
- package/.next/standalone/src/components/editor/source-viewer.tsx +3 -2
- package/.next/standalone/src/components/editor/suggest-edit-popover.tsx +2 -1
- package/.next/standalone/src/components/editor/suggestion-card.tsx +2 -1
- package/.next/standalone/src/components/editor/website-viewer.tsx +2 -1
- package/.next/standalone/src/components/editor/wiki-link-create-dialog.tsx +2 -1
- package/.next/standalone/src/components/search/search-command-dialog.tsx +109 -0
- package/.next/standalone/src/components/search/sidebar-search-box.tsx +121 -0
- package/.next/standalone/src/components/search/snippet-text.tsx +48 -0
- package/.next/standalone/src/components/ui/command.tsx +3 -2
- package/.next/standalone/src/lib/auth/admin.ts +112 -0
- package/.next/standalone/src/lib/auth/server.ts +13 -2
- package/.next/standalone/src/lib/config.ts +56 -4
- package/.next/standalone/src/lib/proof/audit.ts +19 -10
- package/.next/standalone/src/lib/proof/auth.ts +11 -0
- package/.next/standalone/src/lib/proof/collab-state.ts +4 -2
- package/.next/standalone/src/lib/proof/file-lock.ts +5 -0
- package/.next/standalone/src/lib/proof/idempotency.ts +5 -0
- package/.next/standalone/src/lib/proof/lease.ts +40 -27
- package/.next/standalone/src/lib/proof/mutex.ts +4 -0
- package/.next/standalone/src/lib/proof/raw-fs.ts +2 -3
- package/.next/standalone/src/lib/proof/registry.ts +5 -0
- package/.next/standalone/src/lib/search/indexable-exts.ts +25 -0
- package/.next/standalone/src/lib/search/indexer.ts +567 -0
- package/.next/standalone/src/lib/search/sanitize.ts +35 -0
- package/.next/standalone/src/lib/search/search-db.ts +57 -0
- package/.next/standalone/src/lib/search/watcher-pool.ts +79 -0
- package/.next/standalone/src/lib/workspace-client.ts +82 -0
- package/.next/standalone/src/lib/workspace-context.ts +142 -0
- package/.next/standalone/src/lib/workspaces.ts +196 -0
- package/.next/standalone/src/stores/ai-panel-store.ts +3 -2
- package/.next/standalone/src/stores/editor-store.ts +4 -3
- package/.next/standalone/src/stores/proof-store.ts +4 -3
- package/.next/standalone/src/stores/search-store.ts +86 -0
- package/.next/standalone/src/stores/wiki-slugs-store.ts +2 -1
- package/.next/standalone/src/tests/proof/admin-create-user.test.ts +43 -0
- package/.next/standalone/src/tests/proof/agent-workspace-scope.test.ts +134 -0
- package/.next/standalone/src/tests/proof/collab-state.test.ts +43 -41
- package/.next/standalone/src/tests/proof/preload.ts +21 -0
- package/.next/standalone/src/tests/proof/search-index.test.ts +339 -0
- package/.next/standalone/src/tests/proof/workspace-isolation.test.ts +87 -0
- package/.next/standalone/src/tests/proof/workspaces-api.test.ts +227 -0
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/README.md +46 -2
- package/package.json +2 -2
- package/.next/standalone/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0o~h4zq.js +0 -5
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.hb9q2._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.uux34._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0092hkp._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__05f6x0i._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__05idwm9._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06-dtd0._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06sek6_._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__07fpqks._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__094q5bj._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0awzyon._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d_da6q._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hhhvm7._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kk26wc._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0km8suj._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kur4ro._.js +0 -15
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0mkwoul._.js +0 -12
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qc2~6l._.js +0 -15
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qyd-o8._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rkve~v._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rzo40z._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sjocwy._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ssj9~d._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s~i040._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0t220d-._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0t5mg.n._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0trsqf4._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0xq124z._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__106uw_c._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__10w2q~o._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13w-0iy._.js +0 -3
- package/.next/standalone/.next/server/chunks/src_lib_auth_server_ts_00f4e0h._.js +0 -452
- package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__0ug2rvl._.js +0 -3
- package/.next/standalone/.next/static/chunks/0vwkqw_rofm-c.js +0 -129
- package/.next/standalone/.next/static/chunks/0zay6349~v_wc.css +0 -2
- /package/.next/standalone/.next/static/{H0E5wVJm9tAuN5CrU6zG2 → t7B6nXaoD1jo9f61t3aeK}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{H0E5wVJm9tAuN5CrU6zG2 → t7B6nXaoD1jo9f61t3aeK}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{H0E5wVJm9tAuN5CrU6zG2 → t7B6nXaoD1jo9f61t3aeK}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,804150,(e,t,n)=>{"use strict";var r=e.r(101685),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=o({inst:{value:n,getSnapshot:t}}),i=r[0].inst,d=r[1];return a(function(){i.value=n,i.getSnapshot=t,c(i)&&d({inst:i})},[e,n,t]),s(function(){return c(i)&&d({inst:i}),e(function(){c(i)&&d({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d},3909,(e,t,n)=>{"use strict";t.exports=e.r(804150)},757890,(e,t,n)=>{"use strict";var r=e.r(101685),i=e.r(3909),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,a=r.useRef,l=r.useEffect,c=r.useMemo,d=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var u=a(null);if(null===u.current){var p={hasValue:!1,value:null};u.current=p}else p=u.current;var h=s(e,(u=c(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&p.hasValue){var t=p.value;if(i(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]))[0],u[1]);return l(function(){p.hasValue=!0,p.value=h},[h]),d(h),h}},383835,(e,t,n)=>{"use strict";t.exports=e.r(757890)},975609,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(t in e);return void 0===t||r.call(e,t)},c=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},d=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(s)return s(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,o,s,u=arguments[0],p=1,h=arguments.length,f=!1;for("boolean"==typeof u&&(f=u,u=arguments[1]||{},p=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});p<h;++p)if(t=arguments[p],null!=t)for(n in t)r=d(u,n),u!==(i=d(t,n))&&(f&&i&&(l(i)||(o=a(i)))?(o?(o=!1,s=r&&a(r)?r:[]):s=r&&l(r)?r:{},c(u,{name:n,newValue:e(f,s,i)})):void 0!==i&&c(u,{name:n,newValue:i}));return u}},454184,(e,t,n)=>{class r{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}class s{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!e.scope)return;let t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){e.scope&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}let a=(e={})=>{let t={children:[]};return Object.assign(t,e),t};class l{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=a({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){"string"==typeof e||e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{l._collapse(e)}))}}class c extends l{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(e){return e?"string"==typeof e?e:e.source:null}function u(e){return f("(?=",e,")")}function p(e){return f("(?:",e,")*")}function h(e){return f("(?:",e,")?")}function f(...e){return e.map(e=>d(e)).join("")}function m(...e){let t;return"("+(("object"==typeof(t=e[e.length-1])&&t.constructor===Object?(e.splice(e.length-1,1),t):{}).capture?"":"?:")+e.map(e=>d(e)).join("|")+")"}function g(e){return RegExp(e.toString()+"|").exec("").length-1}let b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function y(e,{joinWith:t}){let n=0;return e.map(e=>{let t=n+=1,r=d(e),i="";for(;r.length>0;){let e=b.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i}).map(e=>`(${e})`).join(t)}let x="[a-zA-Z]\\w*",v="[a-zA-Z_]\\w*",E="\\b\\d+(\\.\\d+)?",w="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",k="\\b(0b[01]+)",T={begin:"\\\\[\\s\\S]",relevance:0},N=function(e,t,n={}){let r=o({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:f(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},A=N("//","$"),S=N("/\\*","\\*/"),C=N("#","$");var _=Object.freeze({__proto__:null,APOS_STRING_MODE:{scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[T]},BACKSLASH_ESCAPE:T,BINARY_NUMBER_MODE:{scope:"number",begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:N,C_BLOCK_COMMENT_MODE:S,C_LINE_COMMENT_MODE:A,C_NUMBER_MODE:{scope:"number",begin:w,relevance:0},C_NUMBER_RE:w,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:C,IDENT_RE:x,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+v,relevance:0},NUMBER_MODE:{scope:"number",begin:E,relevance:0},NUMBER_RE:E,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:{scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[T]},REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[T,{begin:/\[/,end:/\]/,relevance:0,contains:[T]}]},RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),o({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:{scope:"title",begin:x,relevance:0},UNDERSCORE_IDENT_RE:v,UNDERSCORE_TITLE_MODE:{scope:"title",begin:v,relevance:0}});function M(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function O(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function I(e,t){!t||e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=M,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function D(e,t){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function R(e,t){if(e.match){if(e.begin||e.end)throw Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function L(e,t){void 0===e.relevance&&(e.relevance=1)}let P=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,u(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},j=["of","and","for","in","not","or","if","then","parent","list","value"],B={},F=e=>{console.error(e)},H=(e,...t)=>{console.log(`WARN: ${e}`,...t)},U=(e,t)=>{B[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),B[`${e}/${t}`]=!0)},z=Error();function $(e,t,{key:n}){let r=0,i=e[n],o={},s={};for(let e=1;e<=t.length;e++)s[e+r]=i[e],o[e+r]=!0,r+=g(t[e-1]);e[n]=s,e[n]._emit=o,e[n]._multi=!0}function G(e){if(e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw F("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),z;if("object"!=typeof e.beginScope||null===e.beginScope)throw F("beginScope must be object"),z;$(e,e.begin,{key:"beginScope"}),e.begin=y(e.begin,{joinWith:""})}if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw F("skip, excludeEnd, returnEnd not compatible with endScope: {}"),z;if("object"!=typeof e.endScope||null===e.endScope)throw F("endScope must be object"),z;$(e,e.end,{key:"endScope"}),e.end=y(e.end,{joinWith:""})}}class q extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}let V=Symbol("nomatch"),W=function(e){let t=Object.create(null),n=Object.create(null),s=[],a=!0,l="Could not find the language '{}', did you forget to load/include a language module?",b={disableAutodetect:!0,name:"Plain text",contains:[]},x={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:c};function v(e){return x.noHighlightRe.test(e)}function E(e,t,n){let r="",i="";"object"==typeof t?(r=e,n=t.ignoreIllegals,i=t.language):(U("10.7.0","highlight(lang, code, ...args) has been deprecated."),U("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),i=e,r=t),void 0===n&&(n=!0);let o={code:r,language:i};B("before:highlight",o);let s=o.result?o.result:w(o.language,o.code,n);return s.code=o.code,B("after:highlight",s),s}function w(e,n,s,c){let u=Object.create(null);function p(){if(!C.keywords)return void M.addText(H);let e=0;C.keywordPatternRe.lastIndex=0;let t=C.keywordPatternRe.exec(H),n="";for(;t;){n+=H.substring(e,t.index);let r=T.case_insensitive?t[0].toLowerCase():t[0],i=C.keywords[r];if(i){let[e,o]=i;if(M.addText(n),n="",u[r]=(u[r]||0)+1,u[r]<=7&&(U+=o),e.startsWith("_"))n+=t[0];else{let n=T.classNameAliases[e]||e;f(t[0],n)}}else n+=t[0];e=C.keywordPatternRe.lastIndex,t=C.keywordPatternRe.exec(H)}n+=H.substring(e),M.addText(n)}function h(){null!=C.subLanguage?function(){if(""===H)return;let e=null;if("string"==typeof C.subLanguage){if(!t[C.subLanguage])return M.addText(H);e=w(C.subLanguage,H,!0,_[C.subLanguage]),_[C.subLanguage]=e._top}else e=k(H,C.subLanguage.length?C.subLanguage:null);C.relevance>0&&(U+=e.relevance),M.__addSublanguage(e._emitter,e.language)}():p(),H=""}function f(e,t){""!==e&&(M.startScope(t),M.addText(e),M.endScope())}function m(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=T.classNameAliases[e[n]]||e[n],i=t[n];r?f(i,r):(H=i,p(),H=""),n++}}function b(e,t){return e.scope&&"string"==typeof e.scope&&M.openNode(T.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(f(H,T.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),H=""):e.beginScope._multi&&(m(e.beginScope,t),H="")),C=Object.create(e,{parent:{value:C}})}let v={};function E(t,i){let o=i&&i[0];if(H+=t,null==o)return h(),0;if("begin"===v.type&&"end"===i.type&&v.index===i.index&&""===o){if(H+=n.slice(i.index,i.index+1),!a){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=v.rule,t}return 1}if(v=i,"begin"===i.type){let e=i[0],t=i.rule,n=new r(t);for(let r of[t.__beforeBegin,t["on:begin"]])if(r&&(r(i,n),n.isMatchIgnored))return 0===C.matcher.regexIndex?(H+=e[0],1):(q=!0,0);return t.skip?H+=e:(t.excludeBegin&&(H+=e),h(),t.returnBegin||t.excludeBegin||(H=e)),b(t,i),t.returnBegin?0:e.length}if("illegal"!==i.type||s){if("end"===i.type){let e=function(e){let t=e[0],i=n.substring(e.index),o=function e(t,n,i){var o;let s,a=(o=t.endRe,(s=o&&o.exec(i))&&0===s.index);if(a){if(t["on:end"]){let e=new r(t);t["on:end"](n,e),e.isMatchIgnored&&(a=!1)}if(a){for(;t.endsParent&&t.parent;)t=t.parent;return t}}if(t.endsWithParent)return e(t.parent,n,i)}(C,e,i);if(!o)return V;let s=C;C.endScope&&C.endScope._wrap?(h(),f(t,C.endScope._wrap)):C.endScope&&C.endScope._multi?(h(),m(C.endScope,e)):s.skip?H+=t:(s.returnEnd||s.excludeEnd||(H+=t),h(),s.excludeEnd&&(H=t));do C.scope&&M.closeNode(),C.skip||C.subLanguage||(U+=C.relevance),C=C.parent;while(C!==o.parent)return o.starts&&b(o.starts,e),s.returnEnd?0:t.length}(i);if(e!==V)return e}}else{let e=Error('Illegal lexeme "'+o+'" for mode "'+(C.scope||"<unnamed>")+'"');throw e.mode=C,e}if("illegal"===i.type&&""===o)return H+="\n",1;if($>1e5&&$>3*i.index)throw Error("potential infinite loop, way more iterations than matches");return H+=o,o.length}let T=S(e);if(!T)throw F(l.replace("{}",e)),Error('Unknown language: "'+e+'"');let N=function(e){function t(t,n){return RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=g(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(y(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&void 0!==e),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=o(e.classNameAliases||{}),function n(i,s){let a;if(i.isCompiled)return i;[O,R,G,P].forEach(e=>e(i,s)),e.compilerExtensions.forEach(e=>e(i,s)),i.__beforeBegin=null,[I,D,L].forEach(e=>e(i,s)),i.isCompiled=!0;let l=null;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),l=i.keywords.$pattern,delete i.keywords.$pattern),l=l||/\w+/,i.keywords&&(i.keywords=function e(t,n,r="keyword"){let i=Object.create(null);return"string"==typeof t?o(r,t.split(" ")):Array.isArray(t)?o(r,t):Object.keys(t).forEach(function(r){Object.assign(i,e(t[r],n,r))}),i;function o(e,t){n&&(t=t.map(e=>e.toLowerCase())),t.forEach(function(t){var n,r,o;let s=t.split("|");i[s[0]]=[e,(n=s[0],(r=s[1])?Number(r):+(o=n,!j.includes(o.toLowerCase())))]})}}(i.keywords,e.case_insensitive)),i.keywordPatternRe=t(l,!0),s&&(i.begin||(i.begin=/\B|\b/),i.beginRe=t(i.begin),i.end||i.endsWithParent||(i.end=/\B|\b/),i.end&&(i.endRe=t(i.end)),i.terminatorEnd=d(i.end)||"",i.endsWithParent&&s.terminatorEnd&&(i.terminatorEnd+=(i.end?"|":"")+s.terminatorEnd)),i.illegal&&(i.illegalRe=t(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map(function(e){var t;return((t="self"===e?i:e).variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return o(t,{variants:null},e)})),t.cachedVariants)?t.cachedVariants:!function e(t){return!!t&&(t.endsWithParent||e(t.starts))}(t)?Object.isFrozen(t)?o(t):t:o(t,{starts:t.starts?o(t.starts):null})})),i.contains.forEach(function(e){n(e,i)}),i.starts&&n(i.starts,s),a=new r,i.contains.forEach(e=>a.addRule(e.begin,{rule:e,type:"begin"})),i.terminatorEnd&&a.addRule(i.terminatorEnd,{type:"end"}),i.illegal&&a.addRule(i.illegal,{type:"illegal"}),i.matcher=a,i}(e)}(T),A="",C=c||N,_={},M=new x.__emitter(x),B=[];for(let e=C;e!==T;e=e.parent)e.scope&&B.unshift(e.scope);B.forEach(e=>M.openNode(e));let H="",U=0,z=0,$=0,q=!1;try{if(T.__emitTokens)T.__emitTokens(n,M);else{for(C.matcher.considerAll();;){$++,q?q=!1:C.matcher.considerAll(),C.matcher.lastIndex=z;let e=C.matcher.exec(n);if(!e)break;let t=n.substring(z,e.index),r=E(t,e);z=e.index+r}E(n.substring(z))}return M.finalize(),A=M.toHTML(),{language:e,value:A,relevance:U,illegal:!1,_emitter:M,_top:C}}catch(t){if(t.message&&t.message.includes("Illegal"))return{language:e,value:i(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:z,context:n.slice(z-100,z+100),mode:t.mode,resultSoFar:A},_emitter:M};if(a)return{language:e,value:i(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:C};throw t}}function k(e,n){let r;n=n||x.languages||Object.keys(t);let o=((r={value:i(e),illegal:!1,relevance:0,_top:b,_emitter:new x.__emitter(x)})._emitter.addText(e),r),s=n.filter(S).filter(M).map(t=>w(t,e,!1));s.unshift(o);let[a,l]=s.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(S(e.language).supersetOf===t.language)return 1;else if(S(t.language).supersetOf===e.language)return -1}return 0});return a.secondBest=l,a}function T(e){var t;let r,i=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";let n=x.languageDetectRe.exec(t);if(n){let t=S(n[1]);return t||(H(l.replace("{}",n[1])),H("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>v(e)||S(e))}(e);if(v(i))return;if(B("before:highlightElement",{el:e,language:i}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(x.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),x.throwUnescapedHTML))throw new q("One of your code blocks includes unescaped HTML.",e.innerHTML);let o=e.textContent,s=i?E(o,{language:i,ignoreIllegals:!0}):k(o);e.innerHTML=s.value,e.dataset.highlighted="yes",t=s.language,r=i&&n[i]||t,e.classList.add("hljs"),e.classList.add(`language-${r}`),e.result={language:s.language,re:s.relevance,relevance:s.relevance},s.secondBest&&(e.secondBest={language:s.secondBest.language,relevance:s.secondBest.relevance}),B("after:highlightElement",{el:e,result:s,text:o})}let N=!1;function A(){if("loading"===document.readyState){N||window.addEventListener("DOMContentLoaded",function(){A()},!1),N=!0;return}document.querySelectorAll(x.cssSelector).forEach(T)}function S(e){return t[e=(e||"").toLowerCase()]||t[n[e]]}function C(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{n[e.toLowerCase()]=t})}function M(e){let t=S(e);return t&&!t.disableAutodetect}function B(e,t){s.forEach(function(n){n[e]&&n[e](t)})}for(let r in Object.assign(e,{highlight:E,highlightAuto:k,highlightAll:A,highlightElement:T,highlightBlock:function(e){return U("10.7.0","highlightBlock will be removed entirely in v12.0"),U("10.7.0","Please use highlightElement now."),T(e)},configure:function(e){x=o(x,e)},initHighlighting:()=>{A(),U("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){A(),U("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,r){let i=null;try{i=r(e)}catch(e){if(F("Language definition for '{}' could not be registered.".replace("{}",n)),a)F(e);else throw e;i=b}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&C(i.aliases,{languageName:n})},unregisterLanguage:function(e){for(let r of(delete t[e],Object.keys(n)))n[r]===e&&delete n[r]},listLanguages:function(){return Object.keys(t)},getLanguage:S,registerAliases:C,autoDetection:M,inherit:o,addPlugin:function(e){var t;(t=e)["before:highlightBlock"]&&!t["before:highlightElement"]&&(t["before:highlightElement"]=e=>{t["before:highlightBlock"](Object.assign({block:e.el},e))}),t["after:highlightBlock"]&&!t["after:highlightElement"]&&(t["after:highlightElement"]=e=>{t["after:highlightBlock"](Object.assign({block:e.el},e))}),s.push(e)},removePlugin:function(e){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.11.1",e.regex={concat:f,lookahead:u,either:m,optional:h,anyNumberOfTimes:p},_)"object"==typeof _[r]&&function e(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(n=>{let r=t[n],i=typeof r;"object"!==i&&"function"!==i||Object.isFrozen(r)||e(r)}),t}(_[r]);return Object.assign(e,_),e},K=W({});K.newInstance=()=>W({}),t.exports=K,K.HighlightJS=K,K.default=K},952683,e=>{"use strict";let t,n,r,i,o,s,a;var l,c,d,u,p,h,f,m,g,b,y,x,v,E,w,k,T,N,A,S,C,_,M,O,I,D,R,L,P,j,B,F,H,U,z,$,G,q,V,W,K,Y,X=e.i(44501),Q=e.i(101685);let J=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},Z=(...e)=>e.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim();var ee={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let et=(0,Q.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...a},l)=>(0,Q.createElement)("svg",{ref:l,...ee,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:Z("lucide",i),...!o&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(a)&&{"aria-hidden":"true"},...a},[...s.map(([e,t])=>(0,Q.createElement)(e,t)),...Array.isArray(o)?o:[o]])),en=(e,t)=>{let n=(0,Q.forwardRef)(({className:n,...r},i)=>(0,Q.createElement)(et,{ref:i,iconNode:t,className:Z(`lucide-${J(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...r}));return n.displayName=J(e),n},er=en("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),ei=en("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),eo=en("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),es=en("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),ea=en("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),el=en("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),ec=en("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),ed=en("file-plus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),eu=en("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),ep=en("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),eh=en("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),ef=en("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),em=en("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),eg=en("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),eb=en("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ey=en("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),ex=en("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),ev=en("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),eE=en("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),ew=en("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ek=en("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),eT=en("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),eN=en("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),eA=en("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),eS=en("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),eC=en("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function e_(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function eM(...e){return t=>{let n=!1,r=e.map(e=>{let r=e_(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():e_(e[t],null)}}}}function eO(...e){return Q.useCallback(eM(...e),e)}var eI=Symbol.for("react.lazy"),eD=Q[" use ".trim().toString()];function eR(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===eI&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function eL(e){var t;let n,r=(t=e,(n=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(eR(n)&&"function"==typeof eD&&(n=eD(n._payload)),Q.isValidElement(n)){var i;let e,o,s=(i=n,(o=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(o=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==Q.Fragment&&(a.ref=t?eM(t,s):s),Q.cloneElement(n,a)}return Q.Children.count(n)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,n),i=Q.forwardRef((e,t)=>{let{children:n,...i}=e;eR(n)&&"function"==typeof eD&&(n=eD(n._payload));let o=Q.Children.toArray(n),s=o.find(eB);if(s){let e=s.props.children,n=o.map(t=>t!==s?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,X.jsx)(r,{...i,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,n):null})}return(0,X.jsx)(r,{...i,ref:t,children:n})});return i.displayName=`${e}.Slot`,i}var eP=eL("Slot"),ej=Symbol("radix.slottable");function eB(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ej}function eF(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r)}else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}(e))&&(r&&(r+=" "),r+=t);return r}let eH=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,eU=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return eF(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(e=>{let t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;let s=eH(t)||eH(r);return i[e][s]}),a=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return eF(e,s,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...a}[t]):({...o,...a})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)},ez=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),e$=[],eG=(e,t,n)=>{if(0==e.length-t)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=eG(e,t+1,i);if(n)return n}let o=n.validators;if(null===o)return;let s=0===t?e.join("-"):e.slice(t).join("-"),a=o.length;for(let e=0;e<a;e++){let t=o[e];if(t.validator(s))return t.classGroupId}},eq=(e,t)=>{let n=ez();for(let r in e)eV(e[r],n,r,t);return n},eV=(e,t,n,r)=>{let i=e.length;for(let o=0;o<i;o++)eW(e[o],t,n,r)},eW=(e,t,n,r)=>{"string"==typeof e?eK(e,t,n):"function"==typeof e?eY(e,t,n,r):eX(e,t,n,r)},eK=(e,t,n)=>{(""===e?t:eQ(t,e)).classGroupId=n},eY=(e,t,n,r)=>{eJ(e)?eV(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:n,validator:e}))},eX=(e,t,n,r)=>{let i=Object.entries(e),o=i.length;for(let e=0;e<o;e++){let[o,s]=i[e];eV(s,eQ(t,o),n,r)}},eQ=(e,t)=>{let n=e,r=t.split("-"),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=ez(),n.nextPart.set(t,i)),n=i}return n},eJ=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,eZ=[],e0=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),e1=/\s+/,e2=e=>{let t;if("string"==typeof e)return e;let n="";for(let r=0;r<e.length;r++)e[r]&&(t=e2(e[r]))&&(n&&(n+=" "),n+=t);return n},e3=[],e5=e=>{let t=t=>t[e]||e3;return t.isThemeGetter=!0,t},e4=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,e6=/^\((?:(\w[\w-]*):)?(.+)\)$/i,e9=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,e7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e8=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,te=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tr=e=>e9.test(e),ti=e=>!!e&&!Number.isNaN(Number(e)),to=e=>!!e&&Number.isInteger(Number(e)),ts=e=>e.endsWith("%")&&ti(e.slice(0,-1)),ta=e=>e7.test(e),tl=()=>!0,tc=e=>e8.test(e)&&!te.test(e),td=()=>!1,tu=e=>tt.test(e),tp=e=>tn.test(e),th=e=>!tg(e)&&!tT(e),tf=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),tm=e=>tI(e,tP,td),tg=e=>e4.test(e),tb=e=>tI(e,tj,tc),ty=e=>tI(e,tB,ti),tx=e=>tI(e,tH,tl),tv=e=>tI(e,tF,td),tE=e=>tI(e,tR,td),tw=e=>tI(e,tL,tp),tk=e=>tI(e,tU,tu),tT=e=>e6.test(e),tN=e=>tD(e,tj),tA=e=>tD(e,tF),tS=e=>tD(e,tR),tC=e=>tD(e,tP),t_=e=>tD(e,tL),tM=e=>tD(e,tU,!0),tO=e=>tD(e,tH,!0),tI=(e,t,n)=>{let r=e4.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},tD=(e,t,n=!1)=>{let r=e6.exec(e);return!!r&&(r[1]?t(r[1]):n)},tR=e=>"position"===e||"percentage"===e,tL=e=>"image"===e||"url"===e,tP=e=>"length"===e||"size"===e||"bg-size"===e,tj=e=>"length"===e,tB=e=>"number"===e,tF=e=>"family-name"===e,tH=e=>"number"===e||"weight"===e,tU=e=>"shadow"===e,tz=((e,...t)=>{let n,r,i,o,s=e=>{let t=r(e);if(t)return t;let o=((e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o,postfixLookupClassGroupIds:s}=t,a=[],l=e.trim().split(e1),c="";for(let e=l.length-1;e>=0;e-=1){let t,d=l[e],{isExternal:u,modifiers:p,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:m}=n(d);if(u){c=d+(c.length>0?" "+c:c);continue}let g=!!m;if(g){let e=(t=r(f.substring(0,m)))&&s[t]?r(f):void 0;e&&e!==t&&(t=e,g=!1)}else t=r(f);if(!t){if(!g||!(t=r(f))){c=d+(c.length>0?" "+c:c);continue}g=!1}let b=0===p.length?"":1===p.length?p[0]:o(p).join(":"),y=h?b+"!":b,x=y+t;if(a.indexOf(x)>-1)continue;a.push(x);let v=i(t,g);for(let e=0;e<v.length;++e){let t=v[e];a.push(y+t)}c=d+(c.length>0?" "+c:c)}return c})(e,n);return i(e,o),o};return o=a=>{var l;let c;return r=(n={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,o)=>{n[i]=o,++t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(i(e,t),t):void 0},set(e,t){e in n?n[e]=t:i(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t,n=[],r=0,i=0,o=0,s=e.length;for(let a=0;a<s;a++){let s=e[a];if(0===r&&0===i){if(":"===s){n.push(e.slice(o,a)),o=a+1;continue}if("/"===s){t=a;continue}}"["===s?r++:"]"===s?r--:"("===s?i++:")"===s&&i--}let a=0===n.length?e:e.slice(o),l=a,c=!1;return a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0),e0(n,c,l,t&&t>o?t-o:void 0)};if(t){let e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):e0(eZ,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r})(l),sortModifiers:(c=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r],o="["===i[0],s=c.has(i);o||s?(n.length>0&&(n.sort(),t.push(...n),n=[]),t.push(i)):n.push(i)}return n.length>0&&(n.sort(),t.push(...n)),t}),postfixLookupClassGroupIds:(e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t})(l),...(e=>{let t=(e=>{let{theme:t,classGroups:n}=e;return eq(n,t)})(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var n;let t,r,i;return -1===(n=e).slice(1,-1).indexOf(":")?void 0:(r=(t=n.slice(1,-1)).indexOf(":"),(i=t.slice(0,r))?"arbitrary.."+i:void 0)}let r=e.split("-"),i=+(""===r[0]&&r.length>1);return eG(r,i,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];if(t){if(i){let e=Array(i.length+t.length);for(let t=0;t<i.length;t++)e[t]=i[t];for(let n=0;n<t.length;n++)e[i.length+n]=t[n];return e}return t}return i||e$}return n[e]||e$}}})(l)}).cache.get,i=n.cache.set,o=s,s(a)},(...e)=>o(((...e)=>{let t,n,r=0,i="";for(;r<e.length;)(t=e[r++])&&(n=e2(t))&&(i&&(i+=" "),i+=n);return i})(...e))})(()=>{let e=e5("color"),t=e5("font"),n=e5("text"),r=e5("font-weight"),i=e5("tracking"),o=e5("leading"),s=e5("breakpoint"),a=e5("container"),l=e5("spacing"),c=e5("radius"),d=e5("shadow"),u=e5("inset-shadow"),p=e5("text-shadow"),h=e5("drop-shadow"),f=e5("blur"),m=e5("perspective"),g=e5("aspect"),b=e5("ease"),y=e5("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...v(),tT,tg],w=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],T=()=>[tT,tg,l],N=()=>[tr,"full","auto",...T()],A=()=>[to,"none","subgrid",tT,tg],S=()=>["auto",{span:["full",to,tT,tg]},to,tT,tg],C=()=>[to,"auto",tT,tg],_=()=>["auto","min","max","fr",tT,tg],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...T()],D=()=>[tr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],R=()=>[tr,"screen","full","dvw","lvw","svw","min","max","fit",...T()],L=()=>[tr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],P=()=>[e,tT,tg],j=()=>[...v(),tS,tE,{position:[tT,tg]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",tC,tm,{size:[tT,tg]}],H=()=>[ts,tN,tb],U=()=>["","none","full",c,tT,tg],z=()=>["",ti,tN,tb],$=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[ti,ts,tS,tE],V=()=>["","none",f,tT,tg],W=()=>["none",ti,tT,tg],K=()=>["none",ti,tT,tg],Y=()=>[ti,tT,tg],X=()=>[tr,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ta],breakpoint:[ta],color:[tl],container:[ta],"drop-shadow":[ta],ease:["in","out","in-out"],font:[th],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ta],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ta],shadow:[ta],spacing:["px",ti],text:[ta],"text-shadow":[ta],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",tr,tg,tT,g]}],container:["container"],"container-type":[{"@container":["","normal","size",tT,tg]}],"container-named":[tf],columns:[{columns:[ti,tg,tT,a]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[to,"auto",tT,tg]}],basis:[{basis:[tr,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ti,tr,"auto","initial","none",tg]}],grow:[{grow:["",ti,tT,tg]}],shrink:[{shrink:["",ti,tT,tg]}],order:[{order:[to,"first","last","none",tT,tg]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...L()]}],"min-block-size":[{"min-block":["auto",...L()]}],"max-block-size":[{"max-block":["none",...L()]}],w:[{w:[a,"screen",...D()]}],"min-w":[{"min-w":[a,"screen","none",...D()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,tN,tb]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tO,tx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ts,tg]}],"font-family":[{font:[tA,tv,t]}],"font-features":[{"font-features":[tg]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,tT,tg]}],"line-clamp":[{"line-clamp":[ti,"none",tT,ty]}],leading:[{leading:[o,...T()]}],"list-image":[{"list-image":["none",tT,tg]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tT,tg]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[ti,"from-font","auto",tT,tb]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[ti,"auto",tT,tg]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[to,tT,tg]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tT,tg]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",tT,tg]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},to,tT,tg],radial:["",tT,tg],conic:[to,tT,tg]},t_,tw]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ti,tT,tg]}],"outline-w":[{outline:["",ti,tN,tb]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,tM,tk]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,tM,tk]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[ti,tb]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",p,tM,tk]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[ti,tT,tg]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ti]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[tT,tg]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":v()}],"mask-image-conic-pos":[{"mask-conic":[ti]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tT,tg]}],filter:[{filter:["","none",tT,tg]}],blur:[{blur:V()}],brightness:[{brightness:[ti,tT,tg]}],contrast:[{contrast:[ti,tT,tg]}],"drop-shadow":[{"drop-shadow":["","none",h,tM,tk]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",ti,tT,tg]}],"hue-rotate":[{"hue-rotate":[ti,tT,tg]}],invert:[{invert:["",ti,tT,tg]}],saturate:[{saturate:[ti,tT,tg]}],sepia:[{sepia:["",ti,tT,tg]}],"backdrop-filter":[{"backdrop-filter":["","none",tT,tg]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[ti,tT,tg]}],"backdrop-contrast":[{"backdrop-contrast":[ti,tT,tg]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ti,tT,tg]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ti,tT,tg]}],"backdrop-invert":[{"backdrop-invert":["",ti,tT,tg]}],"backdrop-opacity":[{"backdrop-opacity":[ti,tT,tg]}],"backdrop-saturate":[{"backdrop-saturate":[ti,tT,tg]}],"backdrop-sepia":[{"backdrop-sepia":["",ti,tT,tg]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tT,tg]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ti,"initial",tT,tg]}],ease:[{ease:["linear","initial",b,tT,tg]}],delay:[{delay:[ti,tT,tg]}],animate:[{animate:["none",y,tT,tg]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,tT,tg]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:Y()}],"skew-x":[{"skew-x":Y()}],"skew-y":[{"skew-y":Y()}],transform:[{transform:[tT,tg,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:X()}],"translate-x":[{"translate-x":X()}],"translate-y":[{"translate-y":X()}],"translate-z":[{"translate-z":X()}],"translate-none":["translate-none"],zoom:[{zoom:[to,tT,tg]}],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",tT,tg]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",tT,tg]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[ti,tN,tb,ty]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function t$(...e){return tz(eF(e))}let tG=eU("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium normal-case transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-e-1 hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-e-1 hover:bg-destructive/90",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-e-1 hover:bg-secondary/80",ghost:"bg-transparent hover:bg-accent/10 text-foreground",link:"text-foreground underline underline-offset-4 hover:text-accent"},size:{default:"h-10 p-3 rounded-full",sm:"h-8 rounded-full px-3 text-xs",lg:"h-10 rounded-full px-8",icon:"h-9 w-9 rounded-full"}},defaultVariants:{variant:"default",size:"default"}}),tq=Q.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>(0,X.jsx)(r?eP:"button",{className:t$(tG({variant:t,size:n,className:e})),ref:o,...i}));function tV(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function tW(e,t=[]){let n=[],r=()=>{let t=n.map(e=>Q.createContext(e));return function(n){let r=n?.[e]||t;return Q.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){let i=Q.createContext(r),o=n.length;n=[...n,r];let s=t=>{let{scope:n,children:r,...s}=t,a=n?.[e]?.[o]||i,l=Q.useMemo(()=>s,Object.values(s));return(0,X.jsx)(a.Provider,{value:l,children:r})};return s.displayName=t+"Provider",[s,function(n,s){let a=s?.[e]?.[o]||i,l=Q.useContext(a);if(l)return l;if(void 0!==r)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Q.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}(r,...t)]}tq.displayName="Button","u">typeof window&&window.document&&window.document.createElement;var tK=globalThis?.document?Q.useLayoutEffect:()=>{},tY=Q[" useId ".trim().toString()]||(()=>void 0),tX=0;function tQ(e){let[t,n]=Q.useState(tY());return tK(()=>{e||n(e=>e??String(tX++))},[e]),e||(t?`radix-${t}`:"")}Q[" useEffectEvent ".trim().toString()],Q[" useInsertionEffect ".trim().toString()];var tJ=Q[" useInsertionEffect ".trim().toString()]||tK;function tZ({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,o,s]=function({defaultProp:e,onChange:t}){let[n,r]=Q.useState(e),i=Q.useRef(n),o=Q.useRef(t);return tJ(()=>{o.current=t},[t]),Q.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}({defaultProp:t,onChange:n}),a=void 0!==e,l=a?e:i;{let t=Q.useRef(void 0!==e);Q.useEffect(()=>{let e=t.current;if(e!==a){let t=a?"controlled":"uncontrolled";console.warn(`${r} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=a},[a,r])}return[l,Q.useCallback(t=>{if(a){let n="function"==typeof t?t(e):t;n!==e&&s.current?.(n)}else o(t)},[a,e,o,s])]}Symbol("RADIX:SYNC_STATE");var t0=e.i(380560);function t1(e){var t;let n,r=(t=e,(n=Q.forwardRef((e,t)=>{let{children:n,...r}=e;if(Q.isValidElement(n)){var i;let e,o,s=(i=n,(o=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(o=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==Q.Fragment&&(a.ref=t?eM(t,s):s),Q.cloneElement(n,a)}return Q.Children.count(n)>1?Q.Children.only(null):null})).displayName=`${t}.SlotClone`,n),i=Q.forwardRef((e,t)=>{let{children:n,...i}=e,o=Q.Children.toArray(n),s=o.find(t3);if(s){let e=s.props.children,n=o.map(t=>t!==s?t:Q.Children.count(e)>1?Q.Children.only(null):Q.isValidElement(e)?e.props.children:null);return(0,X.jsx)(r,{...i,ref:t,children:Q.isValidElement(e)?Q.cloneElement(e,void 0,n):null})}return(0,X.jsx)(r,{...i,ref:t,children:n})});return i.displayName=`${e}.Slot`,i}var t2=Symbol("radix.slottable");function t3(e){return Q.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===t2}var t5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=t1(`Primitive.${t}`),r=Q.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,X.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function t4(e,t){e&&t0.flushSync(()=>e.dispatchEvent(t))}function t6(e){let t=Q.useRef(e);return Q.useEffect(()=>{t.current=e}),Q.useMemo(()=>(...e)=>t.current?.(...e),[])}var t9="dismissableLayer.update",t7=Q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),t8=Q.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=e,c=Q.useContext(t7),[d,u]=Q.useState(null),p=d?.ownerDocument??globalThis?.document,[,h]=Q.useState({}),f=eO(t,e=>u(e)),m=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(g),y=d?m.indexOf(d):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,v=y>=b,E=function(e,t=globalThis?.document){let n=t6(e),r=Q.useRef(!1),i=Q.useRef(()=>{});return Q.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){nt("dismissableLayer.pointerDownOutside",n,o,{discrete:!0})},o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=r,t.addEventListener("click",i.current,{once:!0})):r()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{let t=e.target,n=[...c.branches].some(e=>e.contains(t));v&&!n&&(i?.(e),s?.(e),e.defaultPrevented||a?.())},p),w=function(e,t=globalThis?.document){let n=t6(e),r=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{e.target&&!r.current&&nt("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{let t=e.target;![...c.branches].some(e=>e.contains(t))&&(o?.(e),s?.(e),e.defaultPrevented||a?.())},p);return!function(e,t=globalThis?.document){let n=t6(e);Q.useEffect(()=>{let e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===c.layers.size-1&&(r?.(e),!e.defaultPrevented&&a&&(e.preventDefault(),a()))},p),Q.useEffect(()=>{if(d)return n&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(O=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),ne(),()=>{n&&1===c.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=O)}},[d,p,n,c]),Q.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),ne())},[d,c]),Q.useEffect(()=>{let e=()=>h({});return document.addEventListener(t9,e),()=>document.removeEventListener(t9,e)},[]),(0,X.jsx)(t5.div,{...l,ref:f,style:{pointerEvents:x?v?"auto":"none":void 0,...e.style},onFocusCapture:tV(e.onFocusCapture,w.onFocusCapture),onBlurCapture:tV(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:tV(e.onPointerDownCapture,E.onPointerDownCapture)})});function ne(){let e=new CustomEvent(t9);document.dispatchEvent(e)}function nt(e,t,n,{discrete:r}){let i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?t4(i,o):i.dispatchEvent(o)}t8.displayName="DismissableLayer",Q.forwardRef((e,t)=>{let n=Q.useContext(t7),r=Q.useRef(null),i=eO(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,X.jsx)(t5.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var nn="focusScope.autoFocusOnMount",nr="focusScope.autoFocusOnUnmount",ni={bubbles:!1,cancelable:!0},no=Q.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,l]=Q.useState(null),c=t6(i),d=t6(o),u=Q.useRef(null),p=eO(t,e=>l(e)),h=Q.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Q.useEffect(()=>{if(r){let e=function(e){if(h.paused||!a)return;let t=e.target;a.contains(t)?u.current=t:nl(u.current,{select:!0})},t=function(e){if(h.paused||!a)return;let t=e.relatedTarget;null!==t&&(a.contains(t)||nl(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&nl(a)});return a&&n.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[r,a,h.paused]),Q.useEffect(()=>{if(a){nc.add(h);let e=document.activeElement;if(!a.contains(e)){let t=new CustomEvent(nn,ni);a.addEventListener(nn,c),a.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(nl(r,{select:t}),document.activeElement!==n)return}(ns(a).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&nl(a))}return()=>{a.removeEventListener(nn,c),setTimeout(()=>{let t=new CustomEvent(nr,ni);a.addEventListener(nr,d),a.dispatchEvent(t),t.defaultPrevented||nl(e??document.body,{select:!0}),a.removeEventListener(nr,d),nc.remove(h)},0)}}},[a,c,d,h]);let f=Q.useCallback(e=>{if(!n&&!r||h.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){var o;let t,r=e.currentTarget,[s,a]=[na(t=ns(o=r),o),na(t.reverse(),o)];s&&a?e.shiftKey||i!==a?e.shiftKey&&i===s&&(e.preventDefault(),n&&nl(a,{select:!0})):(e.preventDefault(),n&&nl(s,{select:!0})):i===r&&e.preventDefault()}},[n,r,h.paused]);return(0,X.jsx)(t5.div,{tabIndex:-1,...s,ref:p,onKeyDown:f})});function ns(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function na(e,t){for(let n of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n,{upTo:t}))return n}function nl(e,{select:t=!1}={}){if(e&&e.focus){var n;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(n=e)instanceof HTMLInputElement&&"select"in n&&t&&e.select()}}no.displayName="FocusScope";var nc=(a=[],{add(e){let t=a[0];e!==t&&t?.pause(),(a=nd(a,e)).unshift(e)},remove(e){a=nd(a,e),a[0]?.resume()}});function nd(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}var nu=Q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,o]=Q.useState(!1);tK(()=>o(!0),[]);let s=n||i&&globalThis?.document?.body;return s?t0.default.createPortal((0,X.jsx)(t5.div,{...r,ref:t}),s):null});nu.displayName="Portal";var np=e=>{var t;let n,r,{present:i,children:o}=e,s=function(e){var t,n;let[r,i]=Q.useState(),o=Q.useRef(null),s=Q.useRef(e),a=Q.useRef("none"),[l,c]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},Q.useReducer((e,t)=>n[e][t]??e,t));return Q.useEffect(()=>{let e=nh(o.current);a.current="mounted"===l?e:"none"},[l]),tK(()=>{let t=o.current,n=s.current;if(n!==e){let r=a.current,i=nh(t);e?c("MOUNT"):"none"===i||t?.display==="none"?c("UNMOUNT"):n&&r!==i?c("ANIMATION_OUT"):c("UNMOUNT"),s.current=e}},[e,c]),tK(()=>{if(r){let e,t=r.ownerDocument.defaultView??window,n=n=>{let i=nh(o.current).includes(CSS.escape(n.animationName));if(n.target===r&&i&&(c("ANIMATION_END"),!s.current)){let n=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=n)})}},i=e=>{e.target===r&&(a.current=nh(o.current))};return r.addEventListener("animationstart",i),r.addEventListener("animationcancel",n),r.addEventListener("animationend",n),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",i),r.removeEventListener("animationcancel",n),r.removeEventListener("animationend",n)}}c("ANIMATION_END")},[r,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:Q.useCallback(e=>{o.current=e?getComputedStyle(e):null,i(e)},[])}}(i),a="function"==typeof o?o({present:s.isPresent}):Q.Children.only(o),l=eO(s.ref,(t=a,(r=(n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.ref:(r=(n=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof o||s.isPresent?Q.cloneElement(a,{ref:l}):null};function nh(e){return e?.animationName||"none"}np.displayName="Presence";var nf=0;function nm(){Q.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ng()),document.body.insertAdjacentElement("beforeend",e[1]??ng()),nf++,()=>{1===nf&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),nf--}},[])}function ng(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var nb=e.i(824627),ny="right-scroll-bar-position",nx="width-before-scroll-bar";function nv(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var nE="u">typeof window?Q.useLayoutEffect:Q.useEffect,nw=new WeakMap,nk=(void 0===l&&(l={}),(void 0===c&&(c=function(e){return e}),d=[],u=!1,p={read:function(){if(u)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return d.length?d[d.length-1]:null},useMedium:function(e){var t=c(e,u);return d.push(t),function(){d=d.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(u=!0;d.length;){var t=d;d=[],t.forEach(e)}d={push:function(t){return e(t)},filter:function(){return d}}},assignMedium:function(e){u=!0;var t=[];if(d.length){var n=d;d=[],n.forEach(e),t=d}var r=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(r)};i(),d={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),d}}}}).options=(0,nb.__assign)({async:!0,ssr:!1},l),p),nT=function(){},nN=Q.forwardRef(function(e,t){var n,r,i,o,s=Q.useRef(null),a=Q.useState({onScrollCapture:nT,onWheelCapture:nT,onTouchMoveCapture:nT}),l=a[0],c=a[1],d=e.forwardProps,u=e.children,p=e.className,h=e.removeScrollBar,f=e.enabled,m=e.shards,g=e.sideCar,b=e.noRelative,y=e.noIsolation,x=e.inert,v=e.allowPinchZoom,E=e.as,w=e.gapMode,k=(0,nb.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=(n=[s,t],r=function(e){return n.forEach(function(t){return nv(t,e)})},(i=(0,Q.useState)(function(){return{value:null,callback:r,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=r,o=i.facade,nE(function(){var e=nw.get(o);if(e){var t=new Set(e),r=new Set(n),i=o.current;t.forEach(function(e){r.has(e)||nv(e,null)}),r.forEach(function(e){t.has(e)||nv(e,i)})}nw.set(o,n)},[n]),o),N=(0,nb.__assign)((0,nb.__assign)({},k),l);return Q.createElement(Q.Fragment,null,f&&Q.createElement(g,{sideCar:nk,removeScrollBar:h,shards:m,noRelative:b,noIsolation:y,inert:x,setCallbacks:c,allowPinchZoom:!!v,lockRef:s,gapMode:w}),d?Q.cloneElement(Q.Children.only(u),(0,nb.__assign)((0,nb.__assign)({},N),{ref:T})):Q.createElement(void 0===E?"div":E,(0,nb.__assign)({},N,{className:p,ref:T}),u))});nN.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nN.classNames={fullWidth:nx,zeroRight:ny};var nA=function(e){var t=e.sideCar,n=(0,nb.__rest)(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return Q.createElement(r,(0,nb.__assign)({},n))};nA.isSideCarExport=!0;var nS=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=I||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var r,i;(r=t).styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nC=function(){var e=nS();return function(t,n){Q.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},n_=function(){var e=nC();return function(t){return e(t.styles,t.dynamic),null}},nM={left:0,top:0,right:0,gap:0},nO=function(e){return parseInt(e||"",10)||0},nI=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[nO(n),nO(r),nO(i)]},nD=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return nM;var t=nI(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},nR=n_(),nL="data-scroll-locked",nP=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(nL,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(ny," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(nx," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(ny," .").concat(ny," {\n right: 0 ").concat(r,";\n }\n \n .").concat(nx," .").concat(nx," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(nL,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},nj=function(){var e=parseInt(document.body.getAttribute(nL)||"0",10);return isFinite(e)?e:0},nB=function(){Q.useEffect(function(){return document.body.setAttribute(nL,(nj()+1).toString()),function(){var e=nj()-1;e<=0?document.body.removeAttribute(nL):document.body.setAttribute(nL,e.toString())}},[])},nF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;nB();var o=Q.useMemo(function(){return nD(i)},[i]);return Q.createElement(nR,{styles:nP(o,!t,i,n?"":"!important")})},nH=!1;if("u">typeof window)try{var nU=Object.defineProperty({},"passive",{get:function(){return nH=!0,!0}});window.addEventListener("test",nU,nU),window.removeEventListener("test",nU,nU)}catch(e){nH=!1}var nz=!!nH&&{passive:!1},n$=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},nG=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),nq(e,r)){var i=nV(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body)return!1},nq=function(e,t){return"v"===e?n$(t,"overflowY"):n$(t,"overflowX")},nV=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},nW=function(e,t,n,r,i){var o,s=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),a=s*r,l=n.target,c=t.contains(l),d=!1,u=a>0,p=0,h=0;do{if(!l)break;var f=nV(e,l),m=f[0],g=f[1]-f[2]-s*m;(m||g)&&nq(e,l)&&(p+=g,h+=m);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l))return u&&(i&&1>Math.abs(p)||!i&&a>p)?d=!0:!u&&(i&&1>Math.abs(h)||!i&&-a>h)&&(d=!0),d},nK=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nY=function(e){return[e.deltaX,e.deltaY]},nX=function(e){return e&&"current"in e?e.current:e},nQ=0,nJ=[];let nZ=(h=function(e){var t=Q.useRef([]),n=Q.useRef([0,0]),r=Q.useRef(),i=Q.useState(nQ++)[0],o=Q.useState(n_)[0],s=Q.useRef(e);Q.useEffect(function(){s.current=e},[e]),Q.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(0,nb.__spreadArray)([e.lockRef.current],(e.shards||[]).map(nX),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=Q.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var i,o=nK(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-o[0],c="deltaY"in e?e.deltaY:a[1]-o[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var p=window.getSelection(),h=p&&p.anchorNode;if(h&&(h===d||h.contains(d)))return!1;var f=nG(u,d);if(!f)return!0;if(f?i=u:(i="v"===u?"h":"v",f=nG(u,d)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=i),!i)return!0;var m=r.current||i;return nW(m,t,e,"h"===m?l:c,!0)},[]),l=Q.useCallback(function(e){if(nJ.length&&nJ[nJ.length-1]===o){var n="deltaY"in e?nY(e):nK(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var i=(s.current.shards||[]).map(nX).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=Q.useCallback(function(e,n,r,i){var o={name:e,delta:n,target:r,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),d=Q.useCallback(function(e){n.current=nK(e),r.current=void 0},[]),u=Q.useCallback(function(t){c(t.type,nY(t),t.target,a(t,e.lockRef.current))},[]),p=Q.useCallback(function(t){c(t.type,nK(t),t.target,a(t,e.lockRef.current))},[]);Q.useEffect(function(){return nJ.push(o),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:p}),document.addEventListener("wheel",l,nz),document.addEventListener("touchmove",l,nz),document.addEventListener("touchstart",d,nz),function(){nJ=nJ.filter(function(e){return e!==o}),document.removeEventListener("wheel",l,nz),document.removeEventListener("touchmove",l,nz),document.removeEventListener("touchstart",d,nz)}},[]);var h=e.removeScrollBar,f=e.inert;return Q.createElement(Q.Fragment,null,f?Q.createElement(o,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,h?Q.createElement(nF,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},nk.useMedium(h),nA);var n0=Q.forwardRef(function(e,t){return Q.createElement(nN,(0,nb.__assign)({},e,{ref:t,sideCar:nZ}))});n0.classNames=nN.classNames;var n1=new WeakMap,n2=new WeakMap,n3={},n5=0,n4=function(e){return e&&(e.host||n4(e.parentNode))},n6=function(e,t,n,r){var i=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=n4(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});n3[n]||(n3[n]=new WeakMap);var o=n3[n],s=[],a=new Set,l=new Set(i),c=function(e){!e||a.has(e)||(a.add(e),c(e.parentNode))};i.forEach(c);var d=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(a.has(e))d(e);else try{var t=e.getAttribute(r),i=null!==t&&"false"!==t,l=(n1.get(e)||0)+1,c=(o.get(e)||0)+1;n1.set(e,l),o.set(e,c),s.push(e),1===l&&i&&n2.set(e,!0),1===c&&e.setAttribute(n,"true"),i||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),a.clear(),n5++,function(){s.forEach(function(e){var t=n1.get(e)-1,i=o.get(e)-1;n1.set(e,t),o.set(e,i),t||(n2.has(e)||e.removeAttribute(r),n2.delete(e)),i||e.removeAttribute(n)}),--n5||(n1=new WeakMap,n1=new WeakMap,n2=new WeakMap,n3={})}},n9=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),n6(r,i,n,"aria-hidden")):function(){return null}},n7="Dialog",[n8,re]=tW(n7),[rt,rn]=n8(n7),rr=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=Q.useRef(null),l=Q.useRef(null),[c,d]=tZ({prop:r,defaultProp:i??!1,onChange:o,caller:n7});return(0,X.jsx)(rt,{scope:t,triggerRef:a,contentRef:l,contentId:tQ(),titleId:tQ(),descriptionId:tQ(),open:c,onOpenChange:d,onOpenToggle:Q.useCallback(()=>d(e=>!e),[d]),modal:s,children:n})};rr.displayName=n7;var ri="DialogTrigger";Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=rn(ri,n),o=eO(t,i.triggerRef);return(0,X.jsx)(t5.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":rT(i.open),...r,ref:o,onClick:tV(e.onClick,i.onOpenToggle)})}).displayName=ri;var ro="DialogPortal",[rs,ra]=n8(ro,{forceMount:void 0}),rl=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=rn(ro,t);return(0,X.jsx)(rs,{scope:t,forceMount:n,children:Q.Children.map(r,e=>(0,X.jsx)(np,{present:n||o.open,children:(0,X.jsx)(nu,{asChild:!0,container:i,children:e})}))})};rl.displayName=ro;var rc="DialogOverlay",rd=Q.forwardRef((e,t)=>{let n=ra(rc,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=rn(rc,e.__scopeDialog);return o.modal?(0,X.jsx)(np,{present:r||o.open,children:(0,X.jsx)(rp,{...i,ref:t})}):null});rd.displayName=rc;var ru=t1("DialogOverlay.RemoveScroll"),rp=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=rn(rc,n);return(0,X.jsx)(n0,{as:ru,allowPinchZoom:!0,shards:[i.contentRef],children:(0,X.jsx)(t5.div,{"data-state":rT(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),rh="DialogContent",rf=Q.forwardRef((e,t)=>{let n=ra(rh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=rn(rh,e.__scopeDialog);return(0,X.jsx)(np,{present:r||o.open,children:o.modal?(0,X.jsx)(rm,{...i,ref:t}):(0,X.jsx)(rg,{...i,ref:t})})});rf.displayName=rh;var rm=Q.forwardRef((e,t)=>{let n=rn(rh,e.__scopeDialog),r=Q.useRef(null),i=eO(t,n.contentRef,r);return Q.useEffect(()=>{let e=r.current;if(e)return n9(e)},[]),(0,X.jsx)(rb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tV(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:tV(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:tV(e.onFocusOutside,e=>e.preventDefault())})}),rg=Q.forwardRef((e,t)=>{let n=rn(rh,e.__scopeDialog),r=Q.useRef(!1),i=Q.useRef(!1);return(0,X.jsx)(rb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let o=t.target;n.triggerRef.current?.contains(o)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),rb=Q.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=rn(rh,n),l=Q.useRef(null),c=eO(t,l);return nm(),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(no,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:(0,X.jsx)(t8,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":rT(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(rC,{titleId:a.titleId}),(0,X.jsx)(r_,{contentRef:l,descriptionId:a.descriptionId})]})]})}),ry="DialogTitle",rx=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=rn(ry,n);return(0,X.jsx)(t5.h2,{id:i.titleId,...r,ref:t})});rx.displayName=ry;var rv="DialogDescription",rE=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=rn(rv,n);return(0,X.jsx)(t5.p,{id:i.descriptionId,...r,ref:t})});rE.displayName=rv;var rw="DialogClose",rk=Q.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=rn(rw,n);return(0,X.jsx)(t5.button,{type:"button",...r,ref:t,onClick:tV(e.onClick,()=>i.onOpenChange(!1))})});function rT(e){return e?"open":"closed"}rk.displayName=rw;var rN="DialogTitleWarning",[rA,rS]=(f={contentName:rh,titleName:ry,docsSlug:"dialog"},o=Q.createContext(f),(s=e=>{let{children:t,...n}=e,r=Q.useMemo(()=>n,Object.values(n));return(0,X.jsx)(o.Provider,{value:r,children:t})}).displayName=rN+"Provider",[s,function(e){let t=Q.useContext(o);if(t)return t;if(void 0!==f)return f;throw Error(`\`${e}\` must be used within \`${rN}\``)}]),rC=({titleId:e})=>{let t=rS(rN),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
+
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return Q.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},r_=({contentRef:e,descriptionId:t})=>{let n=rS("DialogDescriptionWarning"),r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return Q.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null};let rM=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rd,{ref:n,className:t$("fixed inset-0 z-40 bg-[#0c0a09]/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));rM.displayName=rd.displayName;let rO=Q.forwardRef(({className:e,children:t,...n},r)=>(0,X.jsxs)(rl,{children:[(0,X.jsx)(rM,{}),(0,X.jsxs)(rf,{ref:r,className:t$("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-card p-6 shadow-golden rounded-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...n,children:[t,(0,X.jsxs)(rk,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,X.jsx)(eC,{className:"h-4 w-4"}),(0,X.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));function rI({className:e,...t}){return(0,X.jsx)("div",{className:t$("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function rD({className:e,...t}){return(0,X.jsx)("div",{className:t$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}rO.displayName=rf.displayName,rI.displayName="DialogHeader",rD.displayName="DialogFooter";let rR=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rx,{ref:n,className:t$("text-lg font-normal leading-none tracking-tight",e),...t}));rR.displayName=rx.displayName;let rL=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rE,{ref:n,className:t$("text-sm text-muted-foreground",e),...t}));function rP({open:e,onOpenChange:t,title:n,description:r,confirmLabel:i="Delete",onConfirm:o,variant:s="destructive"}){return(0,X.jsx)(rr,{open:e,onOpenChange:t,children:(0,X.jsxs)(rO,{className:"sm:max-w-sm",children:[(0,X.jsxs)(rI,{children:[(0,X.jsx)(rR,{children:n}),(0,X.jsx)(rL,{children:r})]}),(0,X.jsxs)(rD,{className:"gap-2 sm:gap-0",children:[(0,X.jsx)(tq,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,X.jsx)(tq,{variant:s,onClick:()=>{o(),t(!1)},children:i})]})]})})}rL.displayName=rE.displayName;let rj=en("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),rB=en("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),rF=["/api/wiki","/api/assets/","/api/upload/","/api/system/reveal"],rH=["/api/agent/admin","/api/agent/register","/api/agents"];function rU(){return new URLSearchParams(window.location.search).get("ws")}function rz(e){let t=rU();if(!t)return e;let n=e.indexOf("?"),r=-1===n?e:e.slice(0,n),i=-1===n?"":e.slice(n+1);if(!function(e){for(let t of rH)if(e===t||e.startsWith(t+"/"))return!1;if(e.startsWith("/api/agent/"))return!0;for(let t of rF)if(e.startsWith(t))return!0;return!1}(r))return e;let o=new URLSearchParams(i);return o.has("ws")?e:(o.set("ws",t),`${r}?${o.toString()}`)}function r$(e,t){return fetch(rz(e),t)}function rG({path:e,badge:t,sublabel:n,showBreadcrumb:r=!0,leading:i,children:o,className:s}){return(0,X.jsxs)("div",{className:t$("flex shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-4 py-2",s),children:[(0,X.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[i,e&&(0,X.jsx)("span",{className:"text-xs text-muted-foreground truncate",title:e,children:e.split("/").pop()??e}),t&&(0,X.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground/50",children:t}),n&&(0,X.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground/40",children:n})]}),(0,X.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:o})]})}function rq(e){let t=[],n="",r=!1,i=[];for(let o=0;o<e.length;o++){let s=e[o],a=e[o+1];r?'"'===s&&'"'===a?(n+='"',o++):'"'===s?r=!1:n+=s:'"'===s?r=!0:","===s?(i.push(n),n=""):"\n"===s||"\r"===s&&"\n"===a?(i.push(n),n="",i.length>0&&t.push(i),i=[],"\r"===s&&o++):n+=s}return i.push(n),i.some(e=>""!==e)&&t.push(i),t}function rV(e){return e.map(e=>e.map(e=>e.includes(",")||e.includes('"')||e.includes("\n")?`"${e.replace(/"/g,'""')}"`:e).join(",")).join("\n")}function rW({path:e}){let[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(""),[o,s]=(0,Q.useState)(!1),[a,l]=(0,Q.useState)(!1),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(null),h=`/api/assets/${e}`;(0,Q.useEffect)(()=>{r$(h).then(e=>e.text()).then(e=>{i(e),n(rq(e)),l(!1)})},[h]);let f=(0,Q.useCallback)((e,t,r)=>{n(n=>{let i=n.map(e=>[...e]);for(;i.length<=e;)i.push([]);for(;i[e].length<=t;)i[e].push("");return i[e][t]=r,i}),l(!0)},[]),m=async()=>{d(!0);let s=o?r:rV(t);try{await r$(`/api/assets/${e}`,{method:"PUT",headers:{"Content-Type":"text/plain"},body:s}),o?n(rq(r)):i(s),l(!1)}catch(e){console.error("Failed to save CSV:",e)}d(!1)},g=t[0]||[],b=t.slice(1);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rG,{path:e,badge:`CSV${t.length>0?` (${t.length-1} rows)`:""}`,children:[a&&(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:m,disabled:c,children:[(0,X.jsx)(rB,{className:"h-3.5 w-3.5"}),c?"Saving...":"Save"]}),(0,X.jsxs)("button",{onClick:()=>{o?n(rq(r)):i(rV(t)),s(!o)},className:`flex items-center gap-1.5 px-2.5 py-1 text-[11px] rounded-md transition-colors border border-border ${o?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`,children:[(0,X.jsx)(rj,{className:"h-3 w-3"}),o?"Table":"Source"]}),(0,X.jsx)("button",{onClick:()=>window.open(h,"_blank"),className:"inline-flex items-center justify-center rounded-md h-8 w-8 hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",title:"Download CSV",children:(0,X.jsx)(el,{className:"h-4 w-4"})})]}),o?(0,X.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,X.jsx)("textarea",{value:r,onChange:e=>{i(e.target.value),l(!0)},className:"w-full h-full min-h-[calc(100vh-12rem)] bg-transparent font-mono text-[13px] leading-relaxed resize-none focus:outline-none",spellCheck:!1})}):(0,X.jsxs)("div",{className:"flex-1 overflow-auto",children:[(0,X.jsxs)("table",{className:"w-full border-collapse text-[13px]",children:[(0,X.jsx)("thead",{className:"sticky top-0 z-10",children:(0,X.jsxs)("tr",{className:"bg-muted/80 backdrop-blur-sm",children:[(0,X.jsx)("th",{className:"border border-border px-1 py-1 text-center text-[10px] text-muted-foreground w-8",children:"#"}),g.map((e,t)=>(0,X.jsx)("th",{className:"border border-border px-3 py-1.5 text-left font-medium text-foreground min-w-[100px]",children:u?.r===0&&u?.c===t?(0,X.jsx)("input",{autoFocus:!0,className:"w-full bg-transparent outline-none",value:e,onChange:e=>f(0,t,e.target.value),onBlur:()=>p(null),onKeyDown:e=>{("Enter"===e.key||"Escape"===e.key)&&p(null),"Tab"===e.key&&(e.preventDefault(),p({r:0,c:t+1<g.length?t+1:0}))}}):(0,X.jsx)("span",{className:"cursor-text",onDoubleClick:()=>p({r:0,c:t}),children:e||" "})},t))]})}),(0,X.jsx)("tbody",{children:b.map((e,t)=>{let r=t+1;return(0,X.jsxs)("tr",{className:"hover:bg-accent/30 transition-colors group",children:[(0,X.jsxs)("td",{className:"border border-border px-1 py-1 text-center text-[10px] text-muted-foreground/50",children:[(0,X.jsx)("span",{className:"group-hover:hidden",children:t+1}),(0,X.jsx)("button",{className:"hidden group-hover:inline text-red-400 hover:text-red-300 text-[10px]",onClick:()=>{n(e=>e.filter((e,t)=>t!==r)),l(!0)},title:"Delete row",children:"×"})]}),g.map((t,n)=>{let i=e[n]??"",o=u?.r===r&&u?.c===n;return(0,X.jsx)("td",{className:"border border-border px-3 py-1.5",children:o?(0,X.jsx)("input",{autoFocus:!0,className:"w-full bg-transparent outline-none",value:i,onChange:e=>f(r,n,e.target.value),onBlur:()=>p(null),onKeyDown:e=>{"Escape"===e.key&&p(null),"Enter"===e.key&&p({r:r+1,c:n}),"Tab"===e.key&&(e.preventDefault(),e.shiftKey?p({r,c:Math.max(0,n-1)}):p({r:n+1>=g.length?r+1:r,c:n+1>=g.length?0:n+1}))}}):(0,X.jsx)("span",{className:"cursor-text",onDoubleClick:()=>p({r,c:n}),children:i||" "})},n)})]},t)})})]}),(0,X.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-t border-border",children:[(0,X.jsx)("button",{onClick:()=>{let e=t[0]?.length||1;n(t=>[...t,Array(e).fill("")]),l(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-accent",children:"+ Add row"}),(0,X.jsx)("button",{onClick:()=>{n(e=>e.map(e=>[...e,""])),l(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-accent",children:"+ Add column"})]})]})]})}function rK(e){this.content=e}rK.prototype={constructor:rK,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return -1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new rK(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new rK(n)},addToStart:function(e,t){return new rK([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new rK(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new rK(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=rK.from(e)).size?new rK(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=rK.from(e)).size?new rK(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=rK.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},rK.from=function(e){if(e instanceof rK)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new rK(t)};class rY{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,i||null,o)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new rY(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],a=o+s.nodeSize;a>e&&((o<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=a}return new rY(n,r)}cutByIndex(e,t){return e==t?rY.empty:0==e&&t==this.content.length?this:new rY(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new rY(r,i)}addToStart(e){return new rY([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new rY(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)r++;return r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let a=t.child(--o),l=n.child(--s),c=a.nodeSize;if(a==l){r-=c,i-=c;continue}if(!a.sameMarkup(l))return{a:r,b:i};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(a.content.size||l.content.size){let t=e(a.content,l.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return rQ(0,e);if(e==this.size)return rQ(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return rQ(t+1,r);return rQ(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return rY.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return rY.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return rY.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new rY(t||e,n)}static from(e){if(!e)return rY.empty;if(e instanceof rY)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new rY([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}rY.empty=new rY([],0);let rX={index:0,offset:0};function rQ(e,t){return rX.index=e,rX.offset=t,rX}function rJ(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!rJ(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!rJ(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class rZ{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&rJ(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return rZ.none;if(e instanceof rZ)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}rZ.none=[];class r0 extends Error{}class r1{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i,o,s){let{index:a,offset:l}=t.findIndex(n),c=t.maybeChild(a);if(l==n||c.isText)return s&&i<=0&&o<=0&&!s.canReplace(a,a,r)?null:t.cut(0,n).append(r).append(t.cut(n));let d=e(c.content,n-l-1,r,0==a?i-1:0,a==t.childCount-1?o-1:0,c);return d&&t.replaceChild(a,c.copy(d))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new r1(n,this.openStart,this.openEnd)}removeBetween(e,t){return new r1(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:a,offset:l}=t.findIndex(r);if(o==n||s.isText){if(l!=r&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=a)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return r1.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new r1(rY.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new r1(e,n,r)}}function r2(e,t){if(!t.type.compatibleContent(e.type))throw new r0("Cannot join "+t.type.name+" onto "+e.type.name)}function r3(e,t,n){let r=e.node(n);return r2(r,t.node(n)),r}function r5(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function r4(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(r5(e.nodeAfter,r),o++));for(let e=o;e<s;e++)r5(i.child(e),r);t&&t.depth==n&&t.textOffset&&r5(t.nodeBefore,r)}function r6(e,t){return e.type.checkContent(t),e.copy(t)}function r9(e,t,n){let r=[];return r4(null,e,n,r),e.depth>n&&r5(r6(r3(e,t,n+1),r9(e,t,n+1)),r),r4(t,null,n,r),new rY(r)}r1.empty=new r1(rY.empty,0,0);class r7{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return rZ.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ir(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new r7(t,n,i)}static resolveCached(e,t){let n=it.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else it.set(e,n=new r8);let r=n.elts[n.i]=r7.resolve(e,t);return n.i=(n.i+1)%ie,r}}class r8{constructor(){this.elts=[],this.i=0}}let ie=12,it=new WeakMap;class ir{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let ii=Object.create(null);class io{constructor(e,t,n,r=rZ.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||rY.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&rJ(this.attrs,t||e.defaultAttrs||ii)&&rZ.sameSet(this.marks,n||rZ.none)}copy(e=null){return e==this.content?this:new io(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new io(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return r1.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new r1(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),i=this.resolve(t);if(n.openStart>r.depth)throw new r0("Inserted content deeper than insertion position");if(r.depth-n.openStart!=i.depth-n.openEnd)throw new r0("Inconsistent open depths");return function e(t,n,r,i){let o=t.index(i),s=t.node(i);if(o==n.index(i)&&i<t.depth-r.openStart){let a=e(t,n,r,i+1);return s.copy(s.content.replaceChild(o,a))}if(!r.content.size)return r6(s,r9(t,n,i));if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){let{start:e,end:o}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(rY.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return r6(s,function e(t,n,r,i,o){let s=t.depth>o&&r3(t,n,o+1),a=i.depth>o&&r3(r,i,o+1),l=[];return r4(null,t,o,l),s&&a&&n.index(o)==r.index(o)?(r2(s,a),r5(r6(s,e(t,n,r,i,o+1)),l)):(s&&r5(r6(s,r9(t,n,o+1)),l),r4(n,r,o,l),a&&r5(r6(a,r9(r,i,o+1)),l)),r4(i,null,o,l),new rY(l)}(t,e,o,n,i))}{let e=t.parent,i=e.content;return r6(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,i,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return r7.resolveCached(this,e)}resolveNoCache(e){return r7.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ia(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=rY.empty,r=0,i=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,i),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=rZ.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!rZ.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=rY.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}io.prototype.text=void 0;class is extends io{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ia(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new is(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new is(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ia(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class il{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new ic(e,t);if(null==i.next)return il.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=id(e),r=n;return e.eat(",")&&(r="}"!=e.next?id(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);ip(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new il(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(iu);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(ip(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(o,s){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return rY.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=i(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}il.empty=new il(!0);class ic{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function id(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function iu(e,t){return t-e}function ip(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(iu)}function ih(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function im(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function ig(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function ib(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ix(e,r,t[r]);return n}class iy{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=ib(e,n.attrs),this.defaultAttrs=ih(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==il.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:im(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new io(this,this.computeAttrs(e),rY.from(t),rZ.setFrom(n))}createChecked(e=null,t,n){return t=rY.from(t),this.checkContent(t),new io(this,this.computeAttrs(e),t,rZ.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=rY.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(rY.empty,!0);return i?new io(this,e,t.append(i),rZ.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ig(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:rZ.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new iy(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class ix{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class iv{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=ib(e,r.attrs),this.excluded=null;let i=ih(this.attrs);this.instance=i?new rZ(this,i):null}create(e=null){return!e&&this.instance?this.instance:new rZ(this,im(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new iv(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ig(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class iE{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=rK.from(e.nodes),t.marks=rK.from(e.marks||{}),this.nodes=iy.compile(this.spec.nodes,this),this.marks=iv.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=il.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?iw(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:iw(this,n.split(" "))}this.nodeFromJSON=e=>io.fromJSON(this,e),this.markFromJSON=e=>rZ.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof iy){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new is(n,n.defaultAttrs,e,rZ.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function iw(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class ik{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new i_(this,t,!1);return n.addAll(e,rZ.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new i_(this,t,!0);return n.addAll(e,rZ.none,t.from,t.to),r1.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=iM(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=iM(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ik(e,ik.schemaRules(e)))}}let iT={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},iN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},iA={ol:!0,ul:!0};function iS(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class iC{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=rZ.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(rY.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=rY.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(rY.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!iT.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class i_{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=iS(null,t.preserveWhitespace,0)|4*!!n;i=r?new iC(r.type,r.attrs,rZ.none,!0,t.topMatch||r.type.contentMatch,o):n?new iC(null,null,rZ.none,!0,null,o):new iC(e.schema.topNodeType,null,rZ.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;iA.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&iA.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(a?a.ignore:iN.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(iT.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let s=a&&a.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+o)&&(r=a,i=s,!a.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=rZ.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):iO(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=iS(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let a=rZ.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!iO(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new iC(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function iM(e){let t={};for(let n in e)t[n]=e[n];return t}function iO(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class iI{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=iR(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return iR(t).createTextNode(e.text);let{dom:n,contentDOM:r}=iP(iR(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&iP(iR(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:iP(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new iI(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=iD(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return iD(e.marks)}}function iD(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function iR(e){return e.document||window.document}let iL=new WeakMap;function iP(e,t,n,r){let i,o,s;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let a=t[0],l;if("string"!=typeof a)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=iL.get(r))&&iL.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),l=o)&&l.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=a.indexOf(" ");c>0&&(n=a.slice(0,c),a=a.slice(c+1));let d=n?e.createElementNS(n,a):e.createElement(a),u=t[1],p=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in p=2,u)if(null!=u[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),u[e]):"style"==e&&d.style?d.style.cssText=u[e]:d.setAttribute(e,u[e])}}for(let o=p;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>p)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}if("string"==typeof s)d.appendChild(e.createTextNode(s));else{let{dom:t,contentDOM:o}=iP(e,s,n,r);if(d.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:d,contentDOM:i}}class ij{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class iB{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&iB.empty)return iB.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+i],c=this.ranges[s+o],d=a+l;if(e<=d){let i=l?e==a?-1:e==d?1:t:t,o=a+r+(i<0?0:c);if(n)return o;let u=e==(t<0?a:d)?null:s/3+(e-a)*65536,p=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(p|=8),new ij(o,p,u)}r+=c-l}return n?e+r:new ij(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),i+=c-l}}invert(){return new iB(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?iB.empty:new iB(e<0?[0,-e,0]:[0,0,e])}}iB.empty=new iB([]);class iF{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new iF(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new iF;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new ij(e,r,null)}}let iH=Object.create(null);class iU{getMap(){return iB.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=iH[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in iH)throw RangeError("Duplicate use of step JSON ID "+e);return iH[e]=t,t.prototype.jsonID=e,t}}class iz{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new iz(e,null)}static fail(e){return new iz(null,e)}static fromReplace(e,t,n,r){try{return iz.ok(e.replace(t,n,r))}catch(e){if(e instanceof r0)return iz.fail(e.message);throw e}}}function i$(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(i$(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return rY.fromArray(r)}class iG extends iU{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new r1(i$(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return iz.fromReplace(e,this.from,this.to,i)}invert(){return new iq(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new iG(t.pos,n.pos,this.mark)}merge(e){return e instanceof iG&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new iG(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new iG(t.from,t.to,e.markFromJSON(t.mark))}}iU.jsonID("addMark",iG);class iq extends iU{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r1(i$(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return iz.fromReplace(e,this.from,this.to,n)}invert(){return new iG(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new iq(t.pos,n.pos,this.mark)}merge(e){return e instanceof iq&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new iq(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new iq(t.from,t.to,e.markFromJSON(t.mark))}}iU.jsonID("removeMark",iq);class iV extends iU{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return iz.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return iz.fromReplace(e,this.pos,this.pos+1,new r1(rY.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new iV(this.pos,t.marks[n]);return new iV(this.pos,this.mark)}}return new iW(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new iV(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new iV(t.pos,e.markFromJSON(t.mark))}}iU.jsonID("addNodeMark",iV);class iW extends iU{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return iz.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return iz.fromReplace(e,this.pos,this.pos+1,new r1(rY.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new iV(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new iW(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new iW(t.pos,e.markFromJSON(t.mark))}}iU.jsonID("removeNodeMark",iW);class iK extends iU{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&iX(e,this.from,this.to)?iz.fail("Structure replace would overwrite content"):iz.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new iB([this.from,this.to-this.from,this.slice.size])}invert(e){return new iK(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&iK.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new iK(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof iK)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?r1.empty:new r1(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new iK(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?r1.empty:new r1(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new iK(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new iK(t.from,t.to,r1.fromJSON(e,t.slice),!!t.structure)}}iK.MAP_BIAS=1,iU.jsonID("replace",iK);class iY extends iU{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(iX(e,this.from,this.gapFrom)||iX(e,this.gapTo,this.to)))return iz.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return iz.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?iz.fromReplace(e,this.from,this.to,n):iz.fail("Content does not fit in gap")}getMap(){return new iB([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new iY(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new iY(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new iY(t.from,t.to,t.gapFrom,t.gapTo,r1.fromJSON(e,t.slice),t.insert,!!t.structure)}}function iX(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function iQ(e,t,n,r=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<o.childCount;t++){let l=o.child(t),c=a+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new iq(a,c,l.marks[t]));if(i&&l.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(l.text);)r||(r=new r1(rY.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new iK(a+e.index,a+e.index+e[0].length,r))}}else s.push(new iK(a,c,r1.empty));a=c}if(!r.validEnd){let t=r.fillBefore(rY.empty,!0);e.replace(a,a,new r1(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function iJ(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(a==o.childCount||o.canReplace(0,a))))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function iZ(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return o?i.map(i0).concat({type:t,attrs:n}).concat(o.map(i0)):null}function i0(e){return{type:e,attrs:null}}function i1(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function i2(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function i3(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function i5(e,t){let n=e.resolve(t),r=n.index();return i4(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function i4(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function i6(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&i4(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function i9(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function i7(e,t,n=t,r=r1.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return i8(i,o,r)?new iK(t,n,r):new oe(i,o,r).fit()}function i8(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}iU.jsonID("replaceAround",iY);class oe{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=rY.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=rY.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let a=new r1(i,o,s);return e>-1?new iY(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new iK(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=or(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:o,match:s}=this.frontier[i],a,l=null;if(1==t&&(r?s.matchType(r.type)||(l=s.fillBefore(rY.from(r),!1)):e&&o.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:i,parent:e,inject:l};if(2==t&&r&&(a=s.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:i,parent:e,wrap:a};if(e&&s.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=or(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new r1(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=or(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new r1(ot(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new r1(ot(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let o=this.unplaced,s=n?n.content:o.content,a=o.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let p=s.size+e-(o.content.size-o.openEnd);for(;l<s.childCount;){let e=s.child(l),t=d.matchType(e.type);if(!t)break;(++l>1||0==a||e.content.size)&&(d=t,c.push(function e(t,n,r){if(n<=0)return t;let i=t.content;return n>1&&(i=i.replaceChild(0,e(i.firstChild,n-1,1==i.childCount?r-1:0))),n>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(rY.empty,!0)))),t.copy(i)}(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?p:-1)))}let h=l==s.childCount;h||(p=-1),this.placed=on(this.placed,t,rY.from(c)),this.frontier[t].match=d,h&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?0==e?r1.empty:new r1(ot(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new r1(ot(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!oi(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=oi(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=oi(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=on(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=on(this.placed,this.depth,rY.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(rY.empty,!0);e.childCount&&(this.placed=on(this.placed,this.frontier.length,e))}}function ot(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ot(e.firstChild.content,t-1,n)))}function on(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(on(e.lastChild.content,t-1,n)))}function or(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function oi(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function oo(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class oa extends iU{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return iz.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return iz.fromReplace(e,this.pos,this.pos+1,new r1(rY.from(r),0,+!t.isLeaf))}getMap(){return iB.empty}invert(e){return new oa(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new oa(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new oa(t.pos,t.attr,t.value)}}iU.jsonID("attr",oa);class ol extends iU{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return iz.ok(n)}getMap(){return iB.empty}invert(e){return new ol(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new ol(t.attr,t.value)}}iU.jsonID("docAttr",ol);let oc=class extends Error{};(oc=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),oc.prototype.constructor=oc,oc.prototype.name="TransformError";class od{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new iF}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new oc(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=r1.empty){let r=i7(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new r1(rY.from(n),0,0))}delete(e,t){return this.replace(e,t,r1.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(i8(i,o,r))return e.step(new iK(t,n,r));let s=oo(i,o);0==s[s.length-1]&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:i.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){var u;let t=c[e],n=(u=t.type).spec.defining||u.spec.definingForContent;if(n&&!t.sameMarkup(i.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+d+1)%(r.openStart+1),u=c[a];if(u)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],d=!0;c<0&&(d=!1,c=-c);let p=i.node(c-1),h=i.index(c-1);if(p.canReplaceWith(h,h,u.type,u.marks))return e.replace(i.before(c),d?o.after(c):n,new r1(function e(t,n,r,i,o){if(n<r){let o=t.firstChild;t=t.replaceChild(0,o.copy(e(o.content,n+1,r,i,o)))}if(n>i){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(rY.empty,!0))}return t}(r.content,0,r.openStart,a),a,r.openEnd))}}let p=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>p));a--){let e=s[a];e<0||(t=i.before(e),n=o.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,i=t;if(!n.isInline&&r==i&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=i=e)}return this.replaceRange(r,i,new r1(rY.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=oo(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:i,depth:o}=t,s=r.before(o+1),a=i.after(o+1),l=s,c=a,d=rY.empty,u=0;for(let e=o,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=rY.from(r.node(e).copy(d)),u++):l--;let p=rY.empty,h=0;for(let e=o,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,p=rY.from(i.node(e).copy(p)),h++):c++;e.step(new iY(l,c,s,a,new r1(d.append(p),u,h),d.size-u,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);i2(e,r.node(),r.before(),a)}s.inlineContent&&iQ(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new iK(c,l.map(t+n,-1),r1.empty,!0)),!0===r){let t=e.doc.resolve(c);i1(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=rY.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=rY.from(n[e].type.create(n[e].attrs,r))}let i=t.start,o=t.end;e.step(new iY(i,o,i,o,new r1(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var i=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var s,a,l;let c,d,u="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,u)&&(s=i.doc,a=i.mapping.slice(o).map(t),l=n,d=(c=s.resolve(a)).index(),c.parent.canReplaceWith(d,d+1,l))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&i2(i,e,t,o),iQ(i,i.mapping.slice(o).map(t,1),n,void 0,null===r);let s=i.mapping.slice(o),a=s.map(t,1),l=s.map(t+e.nodeSize,1);return i.step(new iY(a,l,a+1,l-1,new r1(rY.from(n.create(u,null,e.marks)),0,0),1,!0)),!0===r&&i1(i,e,t,o),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw RangeError("Invalid content for node type "+n.name);e.step(new iY(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new r1(rY.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new oa(e,t,n)),this}setDocAttribute(e,t){return this.step(new ol(e,t)),this}addNodeMark(e,t){return this.step(new iV(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof rZ)t.isInSet(n.marks)&&this.step(new iW(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new iW(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let i=e.doc.resolve(t),o=rY.empty,s=rY.empty;for(let e=i.depth,t=i.depth-n,a=n-1;e>t;e--,a--){o=rY.from(i.node(e).copy(o));let t=r&&r[a];s=rY.from(t?t.type.create(t.attrs,s):i.node(e).copy(s))}e.step(new iK(t,t,new r1(o.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,a;return r=this,s=[],a=[],r.doc.nodesBetween(e,t,(r,l,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,e),u=Math.min(l+r.nodeSize,t),p=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(p)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:s.push(i=new iq(c,u,d[e])));o&&o.to==c?o.to=u:a.push(o=new iG(c,u,n))}}),s.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let a=null;if(n instanceof iv){let e=r.marks,t;for(;t=n.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<a.length;t++){let r=a[t],l;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(l=t)}l?(l.to=n,l.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}),i.forEach(e=>r.step(new iq(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return iQ(this,e,t,n),this}}let ou=Object.create(null);class op{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new oh(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=r1.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),s?r1.empty:t),0==s&&ok(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n),l=a.map(o.pos),c=a.map(s.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),ok(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new og(e):ow(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?ow(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):ow(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ov(e.node(0))}static atStart(e){return ow(e,e,0,0,1)||new ov(e)}static atEnd(e){return ow(e,e,e.content.size,e.childCount,-1)||new ov(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=ou[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ou)throw RangeError("Duplicate use of selection JSON ID "+e);return ou[e]=t,t.prototype.jsonID=e,t}getBookmark(){return og.between(this.$anchor,this.$head).getBookmark()}}op.prototype.visible=!0;class oh{constructor(e,t){this.$from=e,this.$to=t}}let of=!1;function om(e){of||e.parent.inlineContent||(of=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class og extends op{constructor(e,t=e){om(e),om(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return op.near(n);let r=e.resolve(t.map(this.anchor));return new og(r.parent.inlineContent?r:n,n)}replace(e,t=r1.empty){if(super.replace(e,t),t==r1.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof og&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ob(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new og(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=op.findFrom(t,n,!0)||op.findFrom(t,-n,!0);if(!e)return op.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(op.findFrom(e,-n,!0)||op.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new og(e,t)}}op.jsonID("text",og);class ob{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ob(e.map(this.anchor),e.map(this.head))}resolve(e){return og.between(e.resolve(this.anchor),e.resolve(this.head))}}class oy extends op{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?op.near(i):new oy(i)}content(){return new r1(rY.from(this.node),0,0)}eq(e){return e instanceof oy&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ox(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new oy(e.resolve(t.anchor))}static create(e,t){return new oy(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}oy.prototype.visible=!1,op.jsonID("node",oy);class ox{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new ob(n,n):new ox(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&oy.isSelectable(n)?new oy(t):op.near(t)}}class ov extends op{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=r1.empty){if(t==r1.empty){e.delete(0,e.doc.content.size);let t=op.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ov(e)}map(e){return new ov(e)}eq(e){return e instanceof ov}getBookmark(){return oE}}op.jsonID("all",ov);let oE={map(){return this},resolve:e=>new ov(e)};function ow(e,t,n,r,i,o=!1){if(t.inlineContent)return og.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&oy.isSelectable(r))return oy.create(e,n-(i<0?r.nodeSize:0))}else{let t=ow(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function ok(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof iK||o instanceof iY)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(op.near(e.doc.resolve(r),n)))}class oT extends od{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return rZ.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||rZ.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(op.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function oN(e,t){return t&&e?e.bind(t):e}class oA{constructor(e,t,n){this.name=e,this.init=oN(t.init,n),this.apply=oN(t.apply,n)}}let oS=[new oA("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new oA("selection",{init:(e,t)=>e.selection||op.atStart(t.doc),apply:e=>e.selection}),new oA("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new oA("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class oC{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=oS.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new oA(e.key,e.spec.state,e))})}}class o_{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let a=r?r[o].n:0,l=r?r[o].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new o_(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new oT(this)}static create(e){let t=new oC(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new o_(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new oC(this.schema,e.plugins),n=t.fields,r=new o_(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new oC(e.schema,e.plugins),i=new o_(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=io.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=op.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=a.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class oM{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:oI("plugin")}getState(e){return e[this.key]}}let oO=Object.create(null);function oI(e){return e in oO?e+"$"+ ++oO[e]:(oO[e]=0,e+"$")}class oD{constructor(e="key"){this.key=oI(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let oR=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},oL=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},oP=null,oj=function(e,t,n){let r=oP||(oP=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},oB=function(){oP=null},oF=function(e,t,n,r){return n&&(oU(e,t,n,r,-1)||oU(e,t,n,r,1))},oH=/^(img|br|input|textarea|hr)$/i;function oU(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:oz(e))){let n=e.parentNode;if(!n||1!=n.nodeType||o$(e)||oH.test(e.nodeName)||"false"==e.contentEditable)return!1;t=oR(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?oz(e):0}}}function oz(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function o$(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let oG=function(e){return e.focusNode&&oF(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function oq(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let oV="u">typeof navigator?navigator:null,oW="u">typeof document?document:null,oK=oV&&oV.userAgent||"",oY=/Edge\/(\d+)/.exec(oK),oX=/MSIE \d/.exec(oK),oQ=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(oK),oJ=!!(oX||oQ||oY),oZ=oX?document.documentMode:oQ?+oQ[1]:oY?+oY[1]:0,o0=!oJ&&/gecko\/(\d+)/i.test(oK);o0&&(/Firefox\/(\d+)/.exec(oK)||[0,0])[1];let o1=!oJ&&/Chrome\/(\d+)/.exec(oK),o2=!!o1,o3=o1?+o1[1]:0,o5=!oJ&&!!oV&&/Apple Computer/.test(oV.vendor),o4=o5&&(/Mobile\/\w+/.test(oK)||!!oV&&oV.maxTouchPoints>2),o6=o4||!!oV&&/Mac/.test(oV.platform),o9=!!oV&&/Win/.test(oV.platform),o7=/Android \d/.test(oK),o8=!!oW&&"webkitFontSmoothing"in oW.documentElement.style,se=o8?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function st(e,t){return"number"==typeof e?e:e[t]}function sn(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=oL(s);continue}let e=s,n=e==o.body,a=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(o):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),l=0,c=0;if(t.top<a.top+st(r,"top")?c=-(a.top-t.top+st(i,"top")):t.bottom>a.bottom-st(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+st(i,"top")-a.top:t.bottom-a.bottom+st(i,"bottom")),t.left<a.left+st(r,"left")?l=-(a.left-t.left+st(i,"left")):t.right>a.right-st(r,"right")&&(l=t.right-a.right+st(i,"right")),l||c)if(n)o.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:oL(s)}}function sr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=oL(r));return t}function si(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let so=null;function ss(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function sa(e){return e.top<e.bottom||e.left<e.right}function sl(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(sa(e))return e}return Array.prototype.find.call(n,sa)||e.getBoundingClientRect()}let sc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function sd(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=o8||o0;if(3==r.nodeType)if(s&&(sc.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=sl(oj(r,i,i),n);if(o0&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=sl(oj(r,i-1,i-1),-1);if(t.top==e.top){let n=sl(oj(r,i,i+1),-1);if(n.top!=e.top)return su(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,su(sl(oj(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==oz(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return sp(e.getBoundingClientRect(),!1)}if(null==o&&i<oz(r)){let e=r.childNodes[i];if(1==e.nodeType)return sp(e.getBoundingClientRect(),!0)}return sp(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==oz(r))){let e=r.childNodes[i-1],t=3==e.nodeType?oj(e,oz(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return su(sl(t,1),!1)}if(null==o&&i<oz(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?oj(e,0,+!s):1==e.nodeType?e:null:null;if(t)return su(sl(t,-1),!0)}return su(sl(3==r.nodeType?oj(r):r,-n),n>=0)}function su(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function sp(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function sh(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let sf=/[\u0590-\u08ac]/,sm=null,sg=null,sb=!1;class sy{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>oR(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof sN){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof sx&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?oR(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?oR(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],a=o+n.size;if(-1==r&&e<=a){let i=o+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=oR(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=oR(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(i>a&&o<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((o0||o5)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:oR(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(o0&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&o5)&&oF(s.node,s.offset,c.anchorNode,c.anchorOffset)&&oF(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&!(d&&o0)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class sx extends sy{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class sv extends sy{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class sE extends sy{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=iI.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new sE(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=sE.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=sP(i,t,o,n)),e>0&&(i=sP(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class sw extends sy{constructor(e,t,n,r,i,o,s,a,l){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],a,l=s&&s(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:o,n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=iI.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return(c=sO(c,n,t),l)?a=new sA(e,t,n,r,c,d||null,u,l,i,o+1):t.isText?new sT(e,t,n,r,c,u,i):new sw(e,t,n,r,c,d||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>rY.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&sI(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,a=new sR(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u,p,h;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(sL);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)h=-1,p=l,l=null;else if(c<e.childCount)h=c,p=e.child(c++);else break;for(let e=0;e<a.length;e++)a[e].to<=o&&a.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+p.nodeSize;if(p.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=p.cut(e-o),p=p.cut(0,e-o),f=e,h=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=p.isInline&&!p.isLeaf?a.filter(e=>!e.inline):a.slice();r(p,m,t.forChild(o,p),h),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?rZ.none:this.node.child(i).marks,n,e,i),a.placeWidget(t,e,r)},(t,o,l,c)=>{let d;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,o,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,l,d,e)||a.updateNextNode(t,o,l,e,c,r)||a.addNode(t,o,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let a=n[s],l=a.dom;if(l.parentNode==t){for(;l!=i;)i=sD(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(a instanceof sE){let n=i?i.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=sD(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),o4&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof og)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;l+=t.text}if(o>=n){if(o>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new sv(this,i,t,r);e.input.compositionNodes.push(o),this.children=sP(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(sI(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=sM(this.dom,this.nodeDOM,s_(this.outerDeco,this.node,t),s_(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function sk(e,t,n,r,i){sO(r,t,e);let o=new sw(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class sT extends sw{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new sT(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class sN extends sy{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class sA extends sw{constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r,i,o,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let sS=function(e){e&&(this.nodeName=e)};sS.prototype=Object.create(null);let sC=[new sS];function s_(e,t,n){if(0==e.length)return sC;let r=n?sC[0]:new sS,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new sS(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new sS(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function sM(e,t,n,r){if(n==sC&&r==sC)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=sC[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,s||sC[0],o)}return i}function sO(e,t,n){return sM(e,e,sC,s_(t,n,1!=e.nodeType))}function sI(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function sD(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class sR{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];n:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(e instanceof sE)n=e,r=e.children.length;else{a=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let l=a.node;if(l){if(l!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=sE.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof sw){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let c=a.dom,d,u=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&sI(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,o+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!sI(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=sw.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=sw.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new sx(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof sE;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof sT)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((o5||o2)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new sN(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function sL(e,t){return e.type.side-t.type.side}function sP(e,t,n,r,i){let o=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function sj(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(oG(n)){for(l=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&oy.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==oz(e);r||i;){if(e==n)return!0;let t=oR(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==oz(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new oy(s==e?a:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[l,s]=i==e.state.selection.anchor?[i,t]:[t,i],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let n="pointer"==t||e.state.selection.head<a.pos&&!o?1:-1;c=sV(e,d,a,n)}return c}function sB(e){return e.editable?e.hasFocus():sK(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function sF(e,t=!1){let n=e.state.selection;if(sG(e,n),sB(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&o2){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&oF(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,oR(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&oJ&&oZ<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,o,s,a,{anchor:l,head:c}=n,d,u;sH&&!(n instanceof og)&&(n.$from.parent.inlineContent||(d=sU(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=sU(e,n.to))),e.docView.setSelection(l,c,e,t),sH&&(d&&s$(d),u&&s$(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),s=(o=r.domSelectionRange()).anchorNode,a=o.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=a)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!sB(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let sH=o5||o2&&o3<63;function sU(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(o5&&i&&"false"==i.contentEditable)return sz(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return sz(i);else if(o)return sz(o)}}function sz(e){return e.contentEditable="true",o5&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function s$(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function sG(e,t){if(t instanceof oy){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(sq(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else sq(e)}function sq(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function sV(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||og.between(t,n,r)}function sW(e){return(!e.editable||!!e.hasFocus())&&sK(e)}function sK(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function sY(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&op.findFrom(o,t)}function sX(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function sQ(e,t,n){let r=e.state.selection;if(r instanceof og){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return sX(e,new og(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=sY(e.state,t);return!!n&&n instanceof oy&&sX(e,n)}else if(!(o6&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(oy.isSelectable(i)?sX(e,new oy(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!o8&&sX(e,new og(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof oy&&r.node.isInline)return sX(e,new og(t>0?r.$to:r.$from));let n=sY(e.state,t);return!!n&&sX(e,n)}}function sJ(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function sZ(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function s0(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(o0&&1==n.nodeType&&r<sJ(n)&&sZ(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(sZ(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(s1(n))break;else{let t=n.previousSibling;for(;t&&sZ(t,-1);)i=n.parentNode,o=oR(t),t=t.previousSibling;if(t)r=sJ(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?s2(e,n,r):i&&s2(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=sJ(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(sZ(i.childNodes[o],1))t=i,n=++o;else break}else if(s1(i))break;else{let r=i.nextSibling;for(;r&&sZ(r,1);)t=r.parentNode,n=oR(r)+1,r=r.nextSibling;if(r)o=0,s=sJ(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&s2(e,t,n)}(e)}function s1(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function s2(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!o$(e);)t=oR(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!o$(e);)t=oR(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(oG(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&sF(e)},50)}function s3(e,t){let n=e.state.doc.resolve(t);if(!(o2||o9)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function s5(e,t,n){let r=e.state.selection;if(r instanceof og&&!r.empty||n.indexOf("s")>-1||o6&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=sY(e.state,t);if(n&&n instanceof oy)return sX(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof ov?op.near(n,t):op.findFrom(n,t);return!!s&&sX(e,s)}return!1}function s4(e,t){if(!(e.state.selection instanceof og))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function s6(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function s9(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||iI.fromSchema(e.state.schema),a=ao(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&1==c.nodeType&&(d=ar[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function s7(e,t,n,r,i){let o,s,a=i.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new r1(rY.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,s=iI.fromSchema(r);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),o=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=ao().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&ar[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(as||(as=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),as.createHTML(t)):t),s)for(let e=0;e<s.length;e++)i=i.querySelector(s[e])||i;return i}(n),o8&&function(e){let t=e.querySelectorAll(o2?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||ik.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||s8.test(e.parentNode.nodeName)?null:{ignore:!0}})),d)s=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:s}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=rY.from(t.create(r[e+1],i)),o++,s++}return new r1(i,o,s)}(an(s,+d[1],+d[2]),d[4]);else if((s=r1.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,o=[];if(e.forEach(e=>{if(!o)return;let t=r.findWrapping(e.type),n;if(!t)return o=null;if(n=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){let s=e(t,n,r,i.lastChild,o+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(rY.from(ae(r,t,o+1))))}}(t,i,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(rY.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));let n=ae(e,t);o.push(n),r=r.matchType(n.type),i=t}}),o)return rY.from(o)}return e}(s.content,i),!0)).openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=an(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}let s8=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ae(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,rY.from(e));return e}function at(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(o=0),i<r-1&&(a=at(a,t,n,r,i+1,o)),i>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(rY.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function an(e,t,n){return t<e.openStart&&(e=new r1(at(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new r1(at(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let ar={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},ai=null;function ao(){return ai||(ai=document.implementation.createHTMLDocument("title"))}let as=null,aa={},al={},ac={touchstart:!0,touchmove:!0};class ad{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function au(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ap(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>ah(e,t))})}function ah(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function af(e){return{left:e.clientX,top:e.clientY}}function am(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function ag(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}al.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!ax(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!o7||!o2||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!o4||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||o6&&72==r&&"c"==i)return s4(e,-1)||s0(e,-1);if(46==r&&!t.shiftKey||o6&&68==r&&"c"==i)return s4(e,1)||s0(e,1);if(13==r||27==r)return!0;if(37==r||o6&&66==r&&"c"==i){let t=37==r?"ltr"==s3(e,e.state.selection.from)?-1:1:-1;return sQ(e,t,i)||s0(e,t)}if(39==r||o6&&70==r&&"c"==i){let t=39==r?"ltr"==s3(e,e.state.selection.from)?1:-1:1;return sQ(e,t,i)||s0(e,t)}else if(38==r||o6&&80==r&&"c"==i)return s5(e,-1,i)||s0(e,-1);else if(40==r||o6&&78==r&&"c"==i)return function(e){if(!o5||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;s6(e,n,"true"),setTimeout(()=>s6(e,n,"false"),20)}return!1}(e)||s5(e,1,i)||s0(e,1);else if(i==(o6?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():au(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,oq(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},al.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},al.keypress=(e,t)=>{if(ax(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||o6&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof og)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let ab=o6?"metaKey":"ctrlKey";aa.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=ak(e),s=Date.now(),a="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[ab]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:a,button:t.button};let l=e.posAtCoords(af(t));l&&("singleClick"==a?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new ay(e,l,t,!!o)):("doubleClick"==a?function(e,t,n,r){return am(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return am(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(ag(e,og.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)ag(e,og.create(r,o+1,o+1+n.content.size),"pointer");else{if(!oy.isSelectable(n))continue;ag(e,oy.create(r,o),"pointer")}return!0}}(e,n,r)})(e,l.pos,l.inside,t)?t.preventDefault():au(e,"pointer"))};class ay{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ab],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof oy&&l.from<=o&&l.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&o0&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),au(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>sF(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(af(e))),this.updateAllowDefault(e),this.allowDefault||!t)au(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,am(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof oy&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(oy.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(ag(e,oy.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&oy.isSelectable(r))&&(ag(e,new oy(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||o5&&this.mightDrag&&!this.mightDrag.node.isAtom||o2&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(ag(this.view,op.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):au(this.view,"pointer")}}move(e){this.updateAllowDefault(e),au(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function ax(e,t){return!!e.composing||!!(o5&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}aa.touchstart=e=>{e.input.lastTouch=Date.now(),ak(e),au(e,"pointer")},aa.touchmove=e=>{e.input.lastTouch=Date.now(),au(e,"pointer")},aa.contextmenu=e=>ak(e);let av=o7?5e3:-1;function aE(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>ak(e),t))}function aw(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function ak(e,t=!1){if(!o7||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),aw(e),t||e.docView&&e.docView.dirty){let n=sj(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}al.compositionstart=al.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof og&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||o2&&o9&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),ak(e,!0),e.markCursor=null;else if(ak(e,!t.selection.empty),o0&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}aE(e,av)},al.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,aE(e,20))};let aT=oJ&&oZ<15||o4&&se<604;function aN(e,t,n,r,i){let o=s7(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||r1.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function aA(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}aa.copy=al.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=aT?null:t.clipboardData,{dom:o,text:s}=s9(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},al.paste=(e,t)=>{if(e.composing&&!o7)return;let n=aT?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&aN(e,aA(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?aN(e,r.value,null,i,t):aN(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class aS{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let aC=o6?"altKey":"ctrlKey";function a_(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[aC]}for(let e in aa.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(af(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof oy?i.to-1:i.to));else if(r&&r.mightDrag)n=oy.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=oy.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:a,text:l,slice:c}=s9(e,s);t.dataTransfer.files.length&&o2&&!(o3>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(aT?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",aT||t.dataTransfer.setData("text/plain",l),e.dragging=new aS(c,a_(e,t),n)},aa.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},al.dragover=al.dragenter=(e,t)=>t.preventDefault(),al.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(af(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=s7(e,aA(t.dataTransfer),aT?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&a_(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||r1.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let a=o?i9(e.state.doc,i.pos,o):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(u))return;let p=l.doc.resolve(c);if(d&&oy.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new oy(p));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(sV(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},aa.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&sF(e)},20))},aa.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},aa.beforeinput=(e,t)=>{if(o2&&o7&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,oq(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},al)aa[e]=al[e];function aM(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class aO{constructor(e,t){this.toDOM=e,this.spec=t||aP,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new aR(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof aO&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&aM(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class aI{constructor(e,t){this.attrs=e,this.spec=t||aP}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new aR(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof aI&&aM(this.attrs,e.attrs)&&aM(this.spec,e.spec)}static is(e){return e.type instanceof aI}destroy(){}}class aD{constructor(e,t){this.attrs=e,this.spec=t||aP}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new aR(i.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof aD&&aM(this.attrs,e.attrs)&&aM(this.spec,e.spec)}destroy(){}}class aR{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new aR(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new aR(e,e,new aO(t,n))}static inline(e,t,n,r){return new aR(e,t,new aI(n,r))}static node(e,t,n,r){return new aR(e,t,new aD(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof aI}get widget(){return this.type instanceof aO}}let aL=[],aP={};class aj{constructor(e,t){this.local=e.length?e:aL,this.children=t.length?t:aL}static create(e,t){return t.length?a$(t,e,0,aP):aB}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==aB||0==e.maps.length?this:this.mapInner(e,t,0,0,n||aP)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let a=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<a.length;i+=3){let o=a[i+1];if(o<0||e>o+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&s&&(a[i]+=s,a[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:p,offset:h}=r.content.findIndex(d),f=r.maybeChild(p);if(f&&h==d&&h+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=aB?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=a$(function(e,t,n,r,i,o,s){for(let a=0;a<e.length;a+=3)-1==e[a+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let a=t.local[e].map(r,i,o);a?n.push(a):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[a+2],t[a]+o+1);return n}(a,e,t,n,i,o,s),r,0,s);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let n=l.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new aj(t.sort(aG),a)}(this.children,o||[],e,t,n,r,i):o?new aj(o.sort(aG),aL):aB}add(e,t){return t.length?this==aB?aj.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,a;if(a=aU(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,a,s+1):r.splice(i,0,o,o+e.nodeSize,a$(a,e,s+1,aP)),i+=3}});let o=aH(i?az(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new aj(o.length?this.local.concat(o).sort(aG):this.local,r||this.children)}remove(e){return 0==e.length||this==aB?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,o+1);a!=aB?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new aj(r,n):aB}forChild(e,t){let n,r;if(this==aB)return this;if(t.isLeaf)return aj.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof aI){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new aj(r.sort(aG),aL);return n?new aF([e,n]):e}return n||aB}eq(e){if(this==e)return!0;if(!(e instanceof aj)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return aq(this.localsInner(e))}localsInner(e){if(this==aB)return aL;if(e.inlineContent||!this.local.some(aI.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof aI||t.push(this.local[e]);return t}forEachSet(e){e(this)}}aj.empty=new aj([],[]),aj.removeOverlap=aq;let aB=aj.empty;class aF{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,aP));return aF.from(n)}forChild(e,t){if(t.isLeaf)return aj.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=aB&&(i instanceof aF?n=n.concat(i.members):n.push(i))}return aF.from(n)}eq(e){if(!(e instanceof aF)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?aq(n?t:t.sort(aG)):aL}static from(e){switch(e.length){case 0:return aB;case 1:return e[0];default:return new aF(e.every(e=>e instanceof aj)?e:e.reduce((e,t)=>e.concat(t instanceof aj?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function aH(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new aR(i.from+t,i.to+t,i.type))}return n}function aU(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function az(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function a$(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let a=aU(e,t,s+n);if(a){o=!0;let e=a$(a,t,n+s+1,r);e!=aB&&i.push(s,s+t.nodeSize,e)}});let s=aH(o?az(e):e,-n).sort(aG);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new aj(s,i):aB}function aG(e,t){return e.from-t.from||e.to-t.to}function aq(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),aV(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),aV(t,i,r.copy(o.from,r.to)));break}}return t}function aV(e,t,n){for(;t<e.length&&aG(n,e[t])>0;)t++;e.splice(t,0,n)}function aW(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=aB&&t.push(r)}),e.cursorWrapper&&t.push(aj.create(e.state.doc,[e.cursorWrapper.deco])),aF.from(t)}let aK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},aY=oJ&&oZ<=11;class aX{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class aQ{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new aX,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);oJ&&oZ<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():o5&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),aY&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,aK)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(sW(this.view)){if(this.suppressingSelectionUpdates)return sF(this.view);if(oJ&&oZ<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&oF(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=oL(n))t.add(n);for(let r=e.anchorNode;r;r=oL(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&sW(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],l);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(a=!0))}if(l.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(o0&&l.length){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&oG(r)&&(c=sj(t))&&c.eq(op.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,sF(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!aJ.has(e)&&(aJ.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=o0,aZ||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),aZ=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,l)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||sF(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(oJ&&oZ<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?oR(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?oR(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let aJ=new WeakMap,aZ=!1;function a0(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return oF(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function a1(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(o5&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||o5&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let a2=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function a3(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:sV(e,t.resolve(n.anchor),t.resolve(n.head))}function a5(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function a4(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class a6{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ad,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(lt),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=a8(this),a7(this),this.nodeViews=le(this),this.docView=sk(this.state.doc,a9(this),aW(this),this.dom,this),this.domObserver=new aQ(this,(e,t,n,r)=>(function(e,t,n,r,i){let o,s,a,l=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=sj(e,t);if(n&&!e.state.selection.eq(n)){if(o2&&o7&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,oq(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),l&&r.setMeta("composition",l),e.dispatch(r)}return}let c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);let u=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],oG(c)||r.push({node:c.focusNode,offset:c.focusOffset})),o2&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,p=e.someProp("domParser")||ik.fromSchema(e.state.schema),h=u.resolve(a),f=null,m=p.parse(i,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:r,ruleFromNode:a1,context:h});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),h=e.state.doc,f=h.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(o=e.state.selection.to,s="end"):(o=e.state.selection.from,s="start"),e.input.lastKeyCode=null;let m=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,o-Math.min(s,a));r-=s+e-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;(o-=e)&&o<t.size&&a4(t.textBetween(o-1,o+1))&&(o+=e?1:-1),a=o+(a-s),s=o}else if(a<o){let t=r<=o&&r>=a?o-r:0;(o-=t)&&o<e.size&&a4(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}(f.content,p.doc.content,p.from,o,s);if(m&&e.input.domChangeCount++,(o4&&e.input.lastIOSEnter>Date.now()-225||o7)&&i.some(e=>1==e.nodeType&&!a2.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,oq(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&u instanceof og&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))m={start:u.from,endA:u.to,endB:u.to};else{if(p.sel){let t=a3(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);l&&n.setMeta("composition",l),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof og&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),oJ&&oZ<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>p.from&&" "==p.doc.textBetween(m.start-p.from-1,m.start-p.from+1)&&(m.start--,m.endA--,m.endB--);let g=p.doc.resolveNoCache(m.start-p.from),b=p.doc.resolveNoCache(m.endB-p.from),y=h.resolve(m.start),x=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA;if((o4&&e.input.lastIOSEnter>Date.now()-225&&(!x||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!x&&g.pos<p.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(p.doc.textBetween(g.pos,b.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,oq(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||a5(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(a5(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||a5(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(h,m.start,m.endA,g,b)&&e.someProp("handleKeyDown",t=>t(e,oq(8,"Backspace")))){o7&&o2&&e.domObserver.suppressSelectionUpdates();return}o2&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),o7&&!x&&g.start()!=b.start()&&0==b.parentOffset&&g.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==m.endA&&(m.endB-=2,b=p.doc.resolveNoCache(m.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,oq(13,"Enter"))})},20));let v=m.start,E=m.endA,w=t=>{let n=t||e.state.tr.replace(v,E,p.doc.slice(m.start-p.from,m.endB-p.from));if(p.sel){let t=a3(e,n.doc,p.sel);t&&!(o2&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==v||t.head==n.mapping.map(E)-1)||oJ&&t.empty&&t.head==v)&&n.setSelection(t)}return l&&n.setMeta("composition",l),n.scrollIntoView()};if(x)if(g.pos==b.pos){oJ&&oZ<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>sF(e),20));let t=w(e.state.tr.delete(v,E)),n=h.resolve(m.start).marksAcross(h.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(a=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,s,a,l;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(1==i.length&&0==o.length)a=i[0],s="add",l=e=>e.mark(a.addToSet(e.marks));else{if(0!=i.length||1!=o.length)return null;a=o[0],s="remove",l=e=>e.mark(a.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(l(t.child(e)));if(rY.from(c).eq(e))return{mark:a,type:s}}(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let t=w(e.state.tr);"add"==a.type?t.addMark(v,E,a.mark):t.removeMark(v,E,a.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-!b.textOffset){let t=g.parent.textBetween(g.parentOffset,b.parentOffset),n=()=>w(e.state.tr.insertText(t,v,E));e.someProp("handleTextInput",r=>r(e,v,E,t,n))||e.dispatch(n())}else e.dispatch(w());else e.dispatch(w())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in aa){let n=aa[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||ah(e,t)||!e.editable&&t.type in al||n(e,t)},ac[t]?{passive:!0}:void 0)}o5&&e.dom.addEventListener("input",()=>null),ap(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ap(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(lt),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(aw(this),a=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=le(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ap(this),this.editable=a8(this),a7(this);let c=aW(this),d=a9(this),u=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",p=s||!this.docView.matchesNode(e.doc,d,c);(p||!e.selection.eq(o.selection))&&(a=!0);let h="preserve"==u&&a&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:sr(e.dom)}}(this);if(a){let t,n,a;this.domObserver.stop();let l=p&&(oJ||o2)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,a=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(a)!=i.$anchor.start(a));if(p){let t=o2?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=oz(e=e.childNodes[t-1])}else{if(!e.parentNode||o$(e))return null;t=oR(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||o$(e))return null;t=oR(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=sk(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(l=!0)}l||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),oF(t.node,t.offset,n.anchorNode,n.anchorOffset)))?sF(this,l):(sG(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;si(n,0==r?0:r-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof oy){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&sn(this,t.getBoundingClientRect(),e)}else sn(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new aS(e.slice,e.move,r<0?void 0:oy.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(oJ){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(so)return e.focus(so);let t=sr(e);e.focus(null==so?{get preventScroll(){return so={preventScroll:!0},!0}}:void 0),so||(so=!1,si(t,0))}(this.dom),sF(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,a=0,l=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(oz(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(oz(r.startContainer),r.startOffset)}}}(o,t.left,t.top);l&&({node:s,offset:a}=l);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!ss(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(ss(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(o5)for(let e=c;s&&e;e=oL(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(o0&&1==s.nodeType&&(a=Math.min(a,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[a],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&a++}o8&&a&&1==s.nodeType&&1==(n=s.childNodes[a-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&a--,s==e.dom&&a==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==a||1!=s.nodeType||"BR"!=s.childNodes[a-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,a,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,a,l=0,c=n.top,d=n.top;for(let e=t.firstChild,u=0;e;e=e.nextSibling,u++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=oj(e).getClientRects()}for(let p=0;p<t.length;p++){let h=t[p];if(h.top<=c&&h.bottom>=d){c=Math.max(h.bottom,c),d=Math.min(h.top,d);let t=h.left>n.left?h.left-n.left:h.right<n.left?n.left-h.right:0;if(t<s){o=e,s=t,a=t&&3==o.nodeType?{left:h.right<n.left?h.right:h.left,top:n.top}:n,1==e.nodeType&&t&&(l=u+ +(n.left>=(h.left+h.right)/2));continue}}else h.top>n.top&&!r&&h.left<=n.left&&h.right>=n.left&&(r=e,i={left:Math.max(h.left,Math.min(h.right,n.left)),top:h.top});!o&&(n.left>=h.right&&n.top>=h.top||n.left>=h.left&&n.top>=h.bottom)&&(l=u+1)}}return(!o&&r&&(o=r,a=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=sl(r,1);if(n.top!=n.bottom&&ss(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,a):!o||s&&1==o.nodeType?{node:t,offset:l}:e(o,a)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return sd(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return sm==t&&sg==n?sb:(sm=t,sg=n,sb="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,sh(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=sd(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=oj(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?sf.test(r.parent.textContent)&&s.modify?sh(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:a}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),p=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==u;try{s.collapse(o,a),t&&(t!=o||i!=a)&&s.extend&&s.extend(t,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),p}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return aN(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return aN(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return s9(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],aW(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,oB()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!ah(this,e)&&aa[e.type]&&(this.editable||!(e.type in al))&&aa[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?o5&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return a0(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?a0(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function a9(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[aR.node(0,e.state.doc.content.size,t)]}function a7(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:aR.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function a8(e){return!e.someProp("editable",t=>!1===t(e.state))}function le(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function lt(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}a6.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var ln={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},lr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},li="u">typeof navigator&&/Mac/.test(navigator.platform),lo="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ls=0;ls<10;ls++)ln[48+ls]=ln[96+ls]=String(ls);for(var ls=1;ls<=24;ls++)ln[ls+111]="F"+ls;for(var ls=65;ls<=90;ls++)ln[ls]=String.fromCharCode(ls+32),lr[ls]=String.fromCharCode(ls);for(var la in ln)lr.hasOwnProperty(la)||(lr[la]=ln[la]);let ll="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lc="u">typeof navigator&&/Win/.test(navigator.platform);function ld(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function lu(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))ll?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(li&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||lo&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?lr:ln)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[ld(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[ld(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(lc&&n.ctrlKey&&n.altKey)&&(o=ln[n.keyCode])&&o!=i){let r=t[ld(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}if("u">typeof WeakMap){let e=new WeakMap;t=t=>e.get(t),n=(t,n)=>(e.set(t,n),n)}else{let e=[],r=0;t=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},n=(t,n)=>(10==r&&(r=0),e[r++]=t,e[r++]=n)}var lp=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,o=r+1,s=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:i,right:o,bottom:s}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:o,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?0==o:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let o=r*this.width+i,s=this.map[o];!n[s]&&(n[s]=!0,i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?o-1:this.map[n]}i=o}}static get(e){return t(e)||n(e,function(e){if("table"!=e.type.spec.tableRole)throw RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),o=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(o+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);o+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=o:t!=o&&(t=Math.max(t,o))}return t}(e),n=e.childCount,r=[],i=0,o=null,s=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,l=0;a<n;a++){let c=e.child(a);l++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==c.childCount)break;let d=c.child(e),{colspan:u,rowspan:p,colwidth:h}=d.attrs;for(let e=0;e<p;e++){if(e+a>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:l,n:p-e});break}let c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(o||(o=[])).push({type:"collision",row:a,pos:l,n:u-e});let n=h&&h[e];if(n){let r=(c+e)%t*2,i=s[r];null==i||i!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):i==n&&s[r+1]++}}}i+=u,l+=d.nodeSize}let d=(a+1)*t,u=0;for(;i<d;)0==r[i++]&&u++;u&&(o||(o=[])).push({type:"missing",row:a,n:u}),l++}(0===t||0===n)&&(o||(o=[])).push({type:"zero_sized"});let a=new lp(t,n,r,o),l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);return l&&function(e,t,n){e.problems||(e.problems=[]);let r={};for(let i=0;i<e.map.length;i++){let o=e.map[i];if(r[o])continue;r[o]=!0;let s=n.nodeAt(o);if(!s)throw RangeError(`No cell with offset ${o} found`);let a=null,l=s.attrs;for(let n=0;n<l.colspan;n++){let r=t[(i+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=function(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,s,e),a}(e))}};function lh(e){let t=e.cached.tableNodeTypes;if(!t)for(let n in t=e.cached.tableNodeTypes={},e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}return t}let lf=new oD("selectingCells");function lm(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function lg(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function lb(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;let n=lm(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function ly(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function lx(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function lv(e,t,n){let r=e.node(-1),i=lp.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return null==s?null:e.node(0).resolve(o+s)}function lE(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function lw(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var lk=class e extends op{constructor(e,t=e){const n=e.node(-1),r=lp.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),s=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const l=a.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new oh(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ly(r)&&ly(i)&&lx(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return og.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=lp.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},o=[];for(let n=r.top;n<r.bottom;n++){let s=[];for(let o=n*t.width+r.left,a=r.left;a<r.right;a++,o++){let n=t.map[o];if(i[n])continue;i[n]=!0;let a=t.findCell(n),l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);let c=r.left-a.left,d=a.right-r.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=lE(e,0,c)),d>0&&(e=lE(e,e.colspan-d,d)),a.left<r.left){if(!(l=l.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(a.top<r.top||a.bottom>r.bottom){let e={...l.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};l=a.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}s.push(l)}o.push(e.child(n).copy(rY.from(s)))}let s=this.isColSelection()&&this.isRowSelection()?e:o;return new r1(rY.from(s),1,1)}replace(e,t=r1.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(s.pos),i?r1.empty:t)}let i=op.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new r1(rY.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=lp.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);return!(Math.min(e,t)>0)&&Math.max(e+this.$anchorCell.nodeAfter.attrs.rowspan,t+this.$headCell.nodeAfter.attrs.rowspan)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=lp.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(t=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=lp.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);return!(Math.min(r,i)>0)&&Math.max(r+this.$anchorCell.nodeAfter.attrs.colspan,i+this.$headCell.nodeAfter.attrs.colspan)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=lp.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(t=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new lT(this.$anchorCell.pos,this.$headCell.pos)}};lk.prototype.visible=!1,op.jsonID("cell",lk);var lT=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&lx(t,n)?new lk(t,n):op.near(n,1)}};function lN(e){if(!(e.selection instanceof lk))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(aR.node(n,n+e.nodeSize,{class:"selectedCell"}))}),aj.create(e.doc,t)}let lA=new oD("fix-tables");function lS(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let i,o,s=lp.get(t);if(!s.problems)return r;r||(r=e.tr);let a=[];for(let e=0;e<s.height;e++)a.push(0);for(let e=0;e<s.problems.length;e++){let i=s.problems[e];if("collision"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;let o=e.attrs;for(let e=0;e<o.rowspan;e++)a[i.row+e]+=i.n;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,lE(o,o.colspan-i.n,i.n))}else if("missing"==i.type)a[i.row]+=i.n;else if("overlong_rowspan"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-i.n})}else if("colwidth mismatch"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,colwidth:i.colwidth})}else if("zero_sized"==i.type){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}for(let e=0;e<a.length;e++)a[e]&&(null==i&&(i=e),o=e);for(let l=0,c=n+1;l<s.height;l++){let n=t.child(l),s=c+n.nodeSize,d=a[l];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<d;n++){let n=lh(e.schema)[t].createAndFill();n&&a.push(n)}let u=(0==l||i==l-1)&&o==l?c+1:s-1;r.insert(r.mapping.map(u),a)}c=s}return r.setMeta(lA,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,i){let o=t.childCount,s=n.childCount;n:for(let a=0,l=0;a<s;a++){let s=n.child(a);for(let e=l,n=Math.min(o,a+3);e<n;e++)if(t.child(e)==s){l=e+1,r+=s.nodeSize;continue n}i(s,r),l<o&&t.child(l).sameMarkup(s)?e(t.child(l),s,r+1,i):s.nodesBetween(0,s.content.size,i,r+1),r+=s.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function lC(e){let t=lp.get(e),n=[],r=t.height,i=t.width;for(let o=0;o<r;o++){let r=[];for(let n=0;n<i;n++){let s=o*i+n,a=t.map[s];if(o>0){let e=s-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){let e=s-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function l_(e,t){let n=[],r=lp.get(e),i=r.height,o=r.width;for(let s=0;s<i;s++){let i=e.child(s),a=[];for(let n=0;n<o;n++){let i=t[s][n];if(!i)continue;let o=r.map[s*r.width+n],l=e.nodeAt(o);if(!l)continue;let c=l.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}let l=i.type.createChecked(i.attrs,a,i.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function lM(e,t,n,r){let i,o=t[0]>n[0]?-1:1,s=e.splice(t[0],t.length),a=+(s.length%2==0);return i=-1===r&&1===o?n[0]-1:1===r&&-1===o?n[n.length-1]-a+1:-1===o?n[0]:n[n.length-1]-a,e.splice(i,0,...s),e}function lO(e){var t=e;for(let e=t.depth;e>=0;e-=1){let n=t.node(e);if((e=>"table"===e.type.spec.tableRole)(n))return{node:n,pos:0===e?0:t.before(e),start:t.start(e),depth:e}}return null}function lI(e,t){let n=lO(t.$from);if(!n)return;let r=lp.get(n.node);if(!(e<0)&&!(e>r.width-1))return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function lD(e,t){let n=lO(t.$from);if(!n)return;let r=lp.get(n.node);if(!(e<0)&&!(e>r.height-1))return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function lR(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=lI(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=lI(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>o&&(o=t)})}let s=[];for(let t=i;t<=o;t++){let n=lI(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=lI(i,e.selection),l=lD(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=lI(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function lL(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=lD(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=lD(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>o&&(o=t)})}let s=[];for(let t=i;t<=o;t++){let n=lD(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=lD(i,e.selection),l=lI(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=lD(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function lP(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function lj(e){let t=e.selection,n=lb(e),r=n.node(-1),i=n.start(-1),o=lp.get(r);return{...t instanceof lk?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function lB(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){let r=lh(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+o)&&(o=0==i||i==t.width?null:0);for(let s=0;s<t.height;s++){let a=s*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){let o=t.map[a],l=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,lw(l.attrs,i-t.colCount(o))),s+=l.attrs.rowspan-1}else{let l=null==o?lh(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(s,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function lF(e,{map:t,tableStart:n,table:r},i){let o=n;for(let e=0;e<i;e++)o+=r.child(e).nodeSize;let s=[],a=i>0?-1:0;(function(e,t,n){var r;let i=lh(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if((null==(r=t.nodeAt(e.map[o+n*e.width]))?void 0:r.type)!=i)return!1;return!0})(t,r,i+a)&&(a=0==i||i==t.height?null:0);for(let o=0,c=t.width*i;o<t.width;o++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],s=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...s,rowspan:s.rowspan+1}),o+=s.colspan-1}else{var l;let e=null==a?lh(r.type.schema).cell:null==(l=r.nodeAt(t.map[c+a*t.width]))?void 0:l.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(o,lh(r.type.schema).row.create(null,s)),e}function lH(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function lU(e,t){let n=e.selection;if(!(n instanceof lk)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=lj(e),{map:i}=r;if(function({width:e,height:t,map:n},r){let i=r.top*e+r.left,o=i,s=(r.bottom-1)*e+r.left,a=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[a]==n[a+1])return!0;o+=e,a+=e}for(let o=r.left;o<r.right;o++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[s]==n[s+e])return!0;i++,s++}return!1}(i,r))return!1;if(t){let n,o,s=e.tr,a={},l=rY.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let c=i.map[e*i.width+t],d=r.table.nodeAt(c);if(!a[c]&&d)if(a[c]=!0,null==n)n=c,o=d;else{lH(d)||(l=l.append(d.content));let e=s.mapping.map(c+r.tableStart);s.delete(e,e+d.nodeSize)}}if(null==n||null==o)return!0;if(s.setNodeMarkup(n+r.tableStart,null,{...lw(o.attrs,o.attrs.colspan,r.right-r.left-o.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){let e=n+1+o.content.size,t=lH(o)?n+1:e;s.replaceWith(t+r.tableStart,e+r.tableStart,l)}s.setSelection(new lk(s.doc.resolve(n+r.tableStart))),t(s)}return!0}function lz(e,t){var n;let r=lh(e.schema);return(n=({node:e})=>r[e.type.spec.tableRole],(e,t)=>{let r,i,o=e.selection;if(o instanceof lk){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(!(r=function(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(o.$from)))return!1;i=null==(s=lm(o.$from))?void 0:s.pos}if(null==r||null==i||1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(t){let s,a=r.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=lj(e),u=e.tr;for(let e=0;e<d.right-d.left;e++)l.push(c?{...a,colwidth:c&&c[e]?[c[e]]:null}:a);for(let e=d.top;e<d.bottom;e++){let t=d.map.positionAt(e,d.left,d.table);e==d.top&&(t+=r.nodeSize);for(let i=d.left,o=0;i<d.right;i++,o++)(i!=d.left||e!=d.top)&&u.insert(s=u.mapping.map(t+d.tableStart,1),n({node:r,row:e,col:i}).createAndFill(l[o]))}u.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),l[0]),o instanceof lk&&u.setSelection(new lk(u.doc.resolve(o.$anchorCell.pos),s?u.doc.resolve(s):void 0)),t(u)}return!0})(e,t)}function l$(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function lG(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!lg(t))return!1;if(n){let r=lh(t.schema),i=lj(t),o=t.tr,s=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(e=>i.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[e],r.cell,a[e].attrs);if(0===o.steps.length)for(let e=0;e<s.length;e++)o.setNodeMarkup(i.tableStart+s[e],r.header_cell,a[e].attrs);n(o)}return!0};return function(t,n){if(!lg(t))return!1;if(n){let r=lh(t.schema),i=lj(t),o=t.tr,s=l$("row",i,r),a=l$("column",i,r),l=+("column"===e?!!s:"row"===e&&!!a),c="column"==e?{left:0,top:l,right:1,bottom:i.map.height}:"row"==e?{left:l,top:0,right:i.map.width,bottom:1}:i,d="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{let t=e+i.tableStart,n=o.doc.nodeAt(t);n&&o.setNodeMarkup(t,d,n.attrs)}),n(o)}return!0}}lG("row",{useDeprecatedLogic:!0}),lG("column",{useDeprecatedLogic:!0});let lq=lG("cell",{useDeprecatedLogic:!0});function lV(e){return function(t,n){if(!lg(t))return!1;let r=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(lb(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(og.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}}function lW(e,t){let n=e.selection;if(!(n instanceof lk))return!1;if(t){let r=e.tr,i=lh(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new r1(i,0,0))}),r.docChanged&&t(r)}return!0}function lK(e,t){let n=e.createAndFill();return new od(n).replace(0,n.content.size,t).doc}function lY(e,t,n,r,i,o,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=i;c<o;c++){let i=s*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){l=!0;let i=n.nodeAt(o),{top:d,left:u}=t.findCell(o);e.setNodeMarkup(e.mapping.slice(a).map(o+r),null,{...i.attrs,rowspan:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-s})),c+=i.attrs.colspan-1}}return l}function lX(e,t,n,r,i,o,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=i;c<o;c++){let i=c*t.width+s,o=t.map[i];if(t.map[i-1]==o){l=!0;let i=n.nodeAt(o),d=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,lE(i.attrs,s-d,i.attrs.colspan-(s-d))),e.insert(u+i.nodeSize,i.type.createAndFill(lE(i.attrs,0,s-d))),c+=i.attrs.rowspan-1}}return l}function lQ(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw Error("No table found");let s=lp.get(o),{top:a,left:l}=r,c=l+i.width,d=a+i.height,u=e.tr,p=0;function h(){if(!(o=n?u.doc.nodeAt(n-1):u.doc))throw Error("No table found");s=lp.get(o),p=u.mapping.maps.length}(function(e,t,n,r,i,o){let s,a,l=lh(e.doc.type.schema);if(i>t.width)for(let o=0,c=0;o<t.height;o++){let d,u=n.child(o);c+=u.nodeSize;let p=[];d=null==u.lastChild||u.lastChild.type==l.cell?s||(s=l.cell.createAndFill()):a||(a=l.header_cell.createAndFill());for(let e=t.width;e<i;e++)p.push(d);e.insert(e.mapping.slice(0).map(c-1+r),p)}if(o>t.height){let c=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==l.header_cell;c.push(i?a||(a=l.header_cell.createAndFill()):s||(s=l.cell.createAndFill()))}let d=l.row.create(null,rY.from(c)),u=[];for(let e=t.height;e<o;e++)u.push(d);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),u)}return!!(s||a)})(u,s,o,n,c,d)&&h(),lY(u,s,o,n,l,c,a,p)&&h(),lY(u,s,o,n,l,c,d,p)&&h(),lX(u,s,o,n,a,d,l,p)&&h(),lX(u,s,o,n,a,d,c,p)&&h();for(let e=a;e<d;e++){let t=s.positionAt(e,l,o),r=s.positionAt(e,c,o);u.replace(u.mapping.slice(p).map(t+n),u.mapping.slice(p).map(r+n),new r1(i.rows[e-a],0,0))}h(),u.setSelection(new lk(u.doc.resolve(n+s.positionAt(a,l,o)),u.doc.resolve(n+s.positionAt(d-1,c-1,o)))),t(u)}let lJ=lu({ArrowLeft:l0("horiz",-1),ArrowRight:l0("horiz",1),ArrowUp:l0("vert",-1),ArrowDown:l0("vert",1),"Shift-ArrowLeft":l1("horiz",-1),"Shift-ArrowRight":l1("horiz",1),"Shift-ArrowUp":l1("vert",-1),"Shift-ArrowDown":l1("vert",1),Backspace:lW,"Mod-Backspace":lW,Delete:lW,"Mod-Delete":lW});function lZ(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function l0(e,t){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof lk)return lZ(n,r,op.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;let s=l4(i,e,t);if(null==s)return!1;if("horiz"==e)return lZ(n,r,op.near(n.doc.resolve(o.head+t),t));{let i,o=n.doc.resolve(s),a=lv(o,e,t);return i=a?op.near(a,1):t<0?op.near(n.doc.resolve(o.before(-1)),-1):op.near(n.doc.resolve(o.after(-1)),1),lZ(n,r,i)}}}function l1(e,t){return(n,r,i)=>{let o;if(!i)return!1;let s=n.selection;if(s instanceof lk)o=s;else{let r=l4(i,e,t);if(null==r)return!1;o=new lk(n.doc.resolve(r))}let a=lv(o.$headCell,e,t);return!!a&&lZ(n,r,new lk(o.$anchorCell,a))}}function l2(e,t){let n=lm(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new lk(n))),!0)}function l3(e,t,n){if(!lg(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;let i=t.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if("row"==o)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,o=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,r-1);(o||l)&&(i=lK(lh(s).row,new r1(i,o,l)).content),a.push(i)}else{if("cell"!=o&&"header_cell"!=o)return null;a.push(n||r?lK(lh(s).row,new r1(t,n,r)).content:t)}return function(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:o}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+o}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(rY.empty),n[i]<r){let o=lh(e).cell.createAndFill(),s=[];for(let e=n[i];e<r;e++)s.push(o);t[i]=t[i].append(rY.from(s))}return{height:t.length,width:r,rows:t}}(s,a)}(n),i=e.state.selection;if(i instanceof lk){r||(r={width:1,height:1,rows:[rY.from(lK(lh(e.state.schema).cell,n))]});let t=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),s=lp.get(t).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let o=n[e],s=[];for(let n=t[e]||0,i=0;n<r;i++){let a=o.child(i%o.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked(lE(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}i.push(rY.from(s))}n=i,e=r}if(t!=i){let e=[];for(let r=0,o=0;r<i;r++,o++){let s=[],a=n[o%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),s.push(t)}e.push(rY.from(s))}n=e,t=i}return{width:e,height:t,rows:n}}(r,s.right-s.left,s.bottom-s.top),lQ(e.state,e.dispatch,o,s,r),!0}if(!r)return!1;{let t=lb(e.state),n=t.start(-1);return lQ(e.state,e.dispatch,n,lp.get(t.node(-1)).findCell(t.pos-n),r),!0}}function l5(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=l6(e,t.target);if(t.shiftKey&&e.state.selection instanceof lk)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=lm(e.state.selection.$anchor))&&(null==(n=l9(e,t))?void 0:n.pos)!=r.pos)o(r,t),t.preventDefault();else if(!i)return;function o(t,n){let r=l9(e,n),i=null==lf.getState(e.state);if(!r||!lx(t,r))if(!i)return;else r=t;let o=new lk(t,r);if(i||!e.state.selection.eq(o)){let n=e.state.tr.setSelection(o);i&&n.setMeta(lf,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=lf.getState(e.state)&&e.dispatch(e.state.tr.setMeta(lf,-1))}function a(n){let r,a=lf.getState(e.state);if(null!=a)r=e.state.doc.resolve(a);else if(l6(e,n.target)!=i&&!(r=l9(e,t)))return s();r&&o(r,n)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function l4(e,t,n){if(!(e.state.selection instanceof og))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))break;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){let o=r.before(i),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?o:null}}return null}function l6(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function l9(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&lm(e.state.doc.resolve(r))||lm(e.state.doc.resolve(i))}var l7=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),l8(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,l8(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function l8(e,t,n,r,i,o){let s=0,a=!0,l=t.firstChild,c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){let{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){let c=i==n?o:u&&u[e],d=c?c+"px":"";if(s+=c||r,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;let e=l.nextSibling;null==(d=l.parentNode)||d.removeChild(l),l=e}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}let ce=new oD("tableColumnResizing");var ct=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(ce);if(n&&null!=n.setHandle)return new e(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new e(this.activeHandle,n.setDragging);if(this.activeHandle>-1&&t.docChanged){let n=t.mapping.map(this.activeHandle,-1);return ly(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function cn(e,t,n,r){let i=e.posAtCoords({left:t.clientX+("right"==n?-r:r),top:t.clientY});if(!i)return -1;let{pos:o}=i,s=lm(e.state.doc.resolve(o));if(!s)return -1;if("right"==n)return s.pos;let a=lp.get(s.node(-1)),l=s.start(-1),c=a.map.indexOf(s.pos-l);return c%a.width==0?-1:l+a.map[c-1]}function cr(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function ci(e,t){e.dispatch(e.state.tr.setMeta(ce,{setHandle:t}))}function co(e,t,n,r){let i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),a=lp.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=e.domAtPos(i.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&l8(o,l.firstChild,l,r,a,n)}e.i(335884);var cs=Q,ca=e.i(3909);let cl=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function cc(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let cd=(e,t,n)=>{let r=cc(e,n);if(!r)return!1;let i=cf(r);if(!i){let n=r.blockRange(),i=n&&iJ(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(cT(e,i,t,-1))return!0;if(0==r.parent.content.size&&(cp(o,"end")||oy.isSelectable(o)))for(let n=r.depth;;n--){let s=i7(e.doc,r.before(n),r.after(n),r1.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(cp(o,"end")?op.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):oy.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)};function cu(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=t.nodeAfter,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let a=i7(e.doc,i,s,r1.empty);if(!a||a.from!=i||a instanceof iK&&a.slice.size>=s-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(og.create(t.doc,i)),n(t.scrollIntoView())}return!0}function cp(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let ch=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=cf(r)}let s=o&&o.nodeBefore;return!!s&&!!oy.isSelectable(s)&&(t&&t(e.tr.setSelection(oy.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function cf(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function cm(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let cg=(e,t,n)=>{let r=cm(e,n);if(!r)return!1;let i=cy(r);if(!i)return!1;let o=i.nodeAfter;if(cT(e,i,t,1))return!0;if(0==r.parent.content.size&&(cp(o,"start")||oy.isSelectable(o))){let n=i7(e.doc,r.before(),r.after(),r1.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(cp(o,"start")?op.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):oy.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},cb=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=cy(r)}let s=o&&o.nodeAfter;return!!s&&!!oy.isSelectable(s)&&(t&&t(e.tr.setSelection(oy.create(e.doc,o.pos)).scrollIntoView()),!0)};function cy(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}let cx=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function cv(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let cE=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=cv(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(op.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},cw=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof ov||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=cv(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(og.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},ck=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(i3(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&iJ(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function cT(e,t,n,r){let i,o,s,a=t.nodeBefore,l=t.nodeAfter,c,d,u=a.type.spec.isolating||l.type.spec.isolating;if(!u&&(i=t.nodeBefore,o=t.nodeAfter,s=t.index(),i&&o&&i.type.compatibleContent(o.type)&&(!i.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(s,s+1)&&!!(o.isTextblock||i5(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let p=!u&&t.parent.canReplace(t.index(),t.index()+1);if(p&&(c=(d=a.contentMatchAt(a.childCount)).findWrapping(l.type))&&d.matchType(c[0]||l.type).validEnd){if(n){let r=t.pos+l.nodeSize,i=rY.empty;for(let e=c.length-1;e>=0;e--)i=rY.from(c[e].create(null,i));i=rY.from(a.copy(i));let o=e.tr.step(new iY(t.pos-1,r,t.pos,r,new r1(i,1,0),c.length,!0)),s=o.doc.resolve(r+2*c.length);s.nodeAfter&&s.nodeAfter.type==a.type&&i5(o.doc,s.pos)&&o.join(s.pos),n(o.scrollIntoView())}return!0}let h=l.type.spec.isolating||r>0&&u?null:op.findFrom(t,1),f=h&&h.$from.blockRange(h.$to),m=f&&iJ(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(p&&cp(l,"start",!0)&&cp(a,"end")){let r=a,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=l,s=1;for(;!o.isTextblock;o=o.firstChild)s++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=rY.empty;for(let e=i.length-1;e>=0;e--)r=rY.from(i[e].copy(r));n(e.tr.step(new iY(t.pos-i.length,t.pos+l.nodeSize,t.pos+s,t.pos+l.nodeSize-s,new r1(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function cN(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(og.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let cA=cN(-1),cS=cN(1);function cC(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function c_(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let cM=c_(cl,cd,ch),cO=c_(cl,cg,cb),cI={Enter:c_(cx,cw,ck,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof oy&&e.selection.node.isBlock)return!!n.parentOffset&&!!i3(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,s,a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),s=cv(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&s?{type:s}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof og||e.selection instanceof ov)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=i3(c.doc,d,i.length,i);if(u||(i[0]=s?{type:s}:null,u=i3(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&l&&n.node(o).type!=s){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);s&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&c.setNodeMarkup(c.mapping.map(n.before(o)),s)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":cE,Backspace:cM,"Mod-Backspace":cM,"Shift-Backspace":cM,Delete:cO,"Mod-Delete":cO,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new ov(e.doc))),!0)},cD={"Ctrl-h":cI.Backspace,"Alt-Backspace":cI["Mod-Backspace"],"Ctrl-d":cI.Delete,"Ctrl-Alt-Backspace":cI["Mod-Delete"],"Alt-Delete":cI["Mod-Delete"],"Alt-d":cI["Mod-Delete"],"Ctrl-a":cA,"Ctrl-e":cS};for(let e in cI)cD[e]=cI[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();var cR=Object.defineProperty,cL=(e,t)=>{for(var n in t)cR(e,n,{get:t[n],enumerable:!0})};function cP(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var cj=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!e,l=e||i.tr,c=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(l),s.every(e=>!0===e)),d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),i=n(...e)(r);return s.push(i),d}])),run:c};return d}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:cP({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},cB={};cL(cB,{blur:()=>cF,clearContent:()=>cH,clearNodes:()=>cU,command:()=>cz,createParagraphNear:()=>c$,cut:()=>cG,deleteCurrentNode:()=>cq,deleteNode:()=>cW,deleteRange:()=>cK,deleteSelection:()=>cX,enter:()=>cQ,exitCode:()=>cJ,extendMarkRange:()=>c4,first:()=>c6,focus:()=>dn,forEach:()=>dr,insertContent:()=>di,insertContentAt:()=>dc,joinBackward:()=>dp,joinDown:()=>du,joinForward:()=>dh,joinItemBackward:()=>df,joinItemForward:()=>dm,joinTextblockBackward:()=>dg,joinTextblockForward:()=>db,joinUp:()=>dd,keyboardShortcut:()=>dx,lift:()=>dE,liftEmptyBlock:()=>dw,liftListItem:()=>dk,newlineInCode:()=>dT,resetAttributes:()=>dS,scrollIntoView:()=>dC,selectAll:()=>d_,selectNodeBackward:()=>dM,selectNodeForward:()=>dO,selectParentNode:()=>dI,selectTextblockEnd:()=>dD,selectTextblockStart:()=>dR,setContent:()=>dP,setMark:()=>ud,setMeta:()=>uu,setNode:()=>up,setNodeSelection:()=>uh,setTextDirection:()=>uf,setTextSelection:()=>um,sinkListItem:()=>ug,splitBlock:()=>uy,splitListItem:()=>ux,toggleList:()=>uw,toggleMark:()=>uk,toggleNode:()=>uT,toggleWrap:()=>uN,undoInputRule:()=>uA,unsetAllMarks:()=>uS,unsetMark:()=>uC,unsetTextDirection:()=>u_,updateAttributes:()=>uM,wrapIn:()=>uO,wrapInList:()=>uI});var cF=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),cH=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),cU=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),a=o.blockRange(s);if(!a)return;let l=iJ(a);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},cz=e=>t=>e(t),c$=()=>({state:e,dispatch:t})=>cw(e,t),cG=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new og(r.doc.resolve(Math.max(s-1,0)))),!0},cq=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function cV(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var cW=e=>({tr:t,state:n,dispatch:r})=>{let i=cV(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},cK=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},cY=(e,t,n)=>{var r;return!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()?e.pos:(r=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?e.start()-1:e.end()+1:e.pos},cX=()=>({state:e,dispatch:t})=>{var n;let{$from:r,$to:i}=e.selection;if(e.selection.empty)return!1;let{from:o,to:s}={from:cY(r,n=e.schema,"left"),to:cY(i,n,"right")};return t&&(e.tr.deleteRange(o,s).scrollIntoView(),t(e.tr)),!0},cQ=()=>({commands:e})=>e.keyboardShortcut("Enter"),cJ=()=>({state:e,dispatch:t})=>cE(e,t);function cZ(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function c0(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:cZ(t[r])?t[r].test(e[r]):t[r]===e[r])}function c1(e,t,n={}){return e.find(e=>e.type===t&&c0(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function c2(e,t,n={}){return!!c1(e,t,n)}function c3(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!c1([...r.node.marks],t,n))return;let i=r.index,o=e.start()+r.offset,s=i+1,a=o+r.node.nodeSize;for(;i>0&&c2([...e.parent.child(i-1).marks],t,n);)i-=1,o-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&c2([...e.parent.child(s).marks],t,n);)a+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:a}}function c5(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var c4=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=c5(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){let e=c3(l,o,t);if(e&&e.from<=c&&e.to>=d){let t=og.create(s,e.from,e.to);n.setSelection(t)}}return!0},c6=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function c9(e){return e instanceof og}function c7(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function c8(e,t=null){if(!t)return null;let n=op.atStart(e),r=op.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?og.create(e,c7(0,i,o),c7(e.content.size,i,o)):og.create(e,c7(t,i,o),c7(t,i,o))}function de(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function dt(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var dn=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(dt()||de())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!dt()&&!de()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!c9(n.state.selection))return s(),!0;let a=c8(i.doc,e)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},dr=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),di=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),ds=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&ds(r)}return e};function da(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return ds(new window.DOMParser().parseFromString(t,"text/html").body)}function dl(e,t,n){if(e instanceof io||e instanceof rY)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,i="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return rY.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),dl("",t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i="",o=new iE({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?ik.fromSchema(o).parseSlice(da(e),n.parseOptions):ik.fromSchema(o).parse(da(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=ik.fromSchema(t);return n.slice?r.parseSlice(da(e),n.parseOptions).content:r.parse(da(e),n.parseOptions)}return dl("",t,n)}var dc=(e,t,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){let i,a;n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l=e=>{o.emit("contentError",{editor:o,error:e,disableCollaboration:()=>{"collaboration"in o.storage&&"object"==typeof o.storage.collaboration&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{dl(t,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){l(e)}try{i=dl(t,o.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:o.options.enableContentCheck})}catch(e){return l(e),!1}let{from:d,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,h=!0;if((!("type"in i)?i:[i]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,h=!!h&&e.isBlock}),d===u&&h){let{parent:e}=r.doc.resolve(d);!e.isTextblock||e.type.spec.code||e.childCount||(d-=1,u+=1)}if(p){if(Array.isArray(t))a=t.map(e=>e.text||"").join("");else if(t instanceof rY){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),a=e}else a="object"==typeof t&&t&&t.text?t.text:t;r.insertText(a,d,u)}else{a=i;let e=r.doc.resolve(d),t=e.node(),n=0===e.parentOffset,o=t.isText||t.isTextblock,s=t.content.size>0;n&&o&&s&&h&&(d=Math.max(0,d-1)),r.replaceWith(d,u,a)}n.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof iK||r instanceof iY))return;let i=e.mapping.maps[n],o=0;i.forEach((e,t,n,r)=>{0===o&&(o=r)}),e.setSelection(op.near(e.doc.resolve(o),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:a}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:a})}return!0},dd=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof oy,i;if(r){if(n.node.isTextblock||!i5(e.doc,n.from))return!1;i=n.from}else if(null==(i=i6(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(oy.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),du=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof oy){if(n.node.isTextblock||!i5(e.doc,n.to))return!1;r=n.to}else if(null==(r=i6(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),dp=()=>({state:e,dispatch:t})=>cd(e,t),dh=()=>({state:e,dispatch:t})=>cg(e,t),df=()=>({state:e,dispatch:t,tr:n})=>{try{let r=i6(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},dm=()=>({state:e,dispatch:t,tr:n})=>{try{let r=i6(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},dg=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=cc(e,n);if(!r)return!1;let i=cf(r);return!!i&&cu(e,i,t)})(e,t),db=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=cm(e,n);if(!r)return!1;let i=cy(r);return!!i&&cu(e,i,t)})(e,t);function dy(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var dx=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))dt()||dy()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function dv(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?cV(t,e.schema):null,a=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);a.push({node:e,from:n,to:o})});let l=i-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>c0(e.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=l}var dE=(e,t={})=>({state:n,dispatch:r})=>{let i=cV(e,n.schema);return!!dv(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&iJ(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r)},dw=()=>({state:e,dispatch:t})=>ck(e,t),dk=e=>({state:t,dispatch:n})=>{var r;return(r=cV(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);return!!o&&(!t||(n.node(o.depth-1).type==r?function(e,t,n,r){let i=e.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new iY(o-1,s,o,s,new r1(rY.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ir(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let a=iJ(r);if(null==a)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return i5(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}(e,t,r,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+ +!a,d+1,s.content.append(l?rY.empty:rY.from(i))))return!1;let u=o.pos,p=u+s.nodeSize;return r.step(new iY(u-!!a,p+ +!!l,u+1,p-1,new r1((a?rY.empty:rY.from(i.copy(rY.empty))).append(l?rY.empty:rY.from(i.copy(rY.empty))),+!a,+!l),+!a)),t(r.scrollIntoView()),!0}(e,t,o)))})(t,n)},dT=()=>({state:e,dispatch:t})=>cx(e,t);function dN(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function dA(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var dS=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=dN("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=cV(e,r.schema)),"mark"===a&&(s=c5(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,dA(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(l=!0,i&&n.addMark(r,r+e.nodeSize,s.create(dA(o.attrs,t))))})})}),l},dC=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),d_=()=>({tr:e,dispatch:t})=>{if(t){let t=new ov(e.doc);e.setSelection(t)}return!0},dM=()=>({state:e,dispatch:t})=>ch(e,t),dO=()=>({state:e,dispatch:t})=>cb(e,t),dI=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(oy.create(e.doc,i))),!0)})(e,t),dD=()=>({state:e,dispatch:t})=>cS(e,t),dR=()=>({state:e,dispatch:t})=>cA(e,t);function dL(e,t,n={},r={}){return dl(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var dP=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{let{doc:l}=o;if("full"!==r.preserveWhitespace){let a=dL(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function dj(e,t){let n=c5(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function dB(e,t){let n=new od(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function dF(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function dH(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function dU(e){return t=>dH(t.$from,e)}function dz(e,t,n){return void 0===e.config[t]&&e.parent?dz(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?dz(e.parent,t,n):null}):e.config[t]}function d$(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=dz(e,"addExtensions",t);return n?[e,...d$(n())]:e}).flat(10)}function dG(e,t){let n=iI.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function dq(e){return"function"==typeof e}function dV(e,t,...n){return dq(e)?t?e.bind(t)(...n):e(...n):e}function dW(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function dK(e){let t=[],{nodeExtensions:n,markExtensions:r}=dW(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=dz(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=dz(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function dY(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,o=0,s=e.length;for(let a=0;a<s;a+=1){let s=e[a];if("'"===s&&!i){r=!r,n+=s;continue}if('"'===s&&!r){i=!i,n+=s;continue}if(!r&&!i){if("("===s){o+=1,n+=s;continue}if(")"===s&&o>0){o-=1,n+=s;continue}if(";"===s&&0===o){t.push(n),n="";continue}}n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&s&&t.push([o,s])}return t}function dX(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=new Map([...dY(n[e]),...dY(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function dQ(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>dX(e,t),{})}function dJ(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function dZ(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function d0(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function d1(e){return e.sort((e,t)=>{let n=dz(e,"priority")||100,r=dz(t,"priority")||100;return n>r?-1:+(n<r)})}function d2(e){var t;let n=d1(d$(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function d3(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},a="";return e.nodesBetween(r,i,(e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=o);let u=null==s?void 0:s[e.type.name];if(u)return l&&(a+=u({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,i-n))}),a}function d5(e,t){let n={from:0,to:e.content.size};return d3(e,n,t)}function d4(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function d6(e,t){let n=dN("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=cV(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?dj(e,t):{}}function d9(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),a=n.invert().map(o,-1),l=n.invert().map(s);i.push({oldRange:{from:a,to:l},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function d7(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=c3(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function d8(e,t){return t.nodes[e]||t.marks[e]||null}function ue(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function ut(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?c5(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>c0(e.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(i,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;let l=a.filter(e=>!o||o.name===e.mark.type.name).filter(e=>c0(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function un(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function ur(e,t){let{nodeExtensions:n}=dW(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=dV(dz(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function ui(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(ui(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function uo(e){return e instanceof oy}var us=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function ua(e,t){let n=t.mapping.mapResult(e.position);return{position:new us(n.pos),mapResult:n}}function ul(e){return new us(e)}function uc(e,t,n){let r=e.state.doc.content.size,i=c7(t,0,r),o=c7(n,0,r),s=e.coordsAtPos(i),a=e.coordsAtPos(o,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),d=Math.min(s.left,a.left),u=Math.max(s.right,a.right),p={top:l,bottom:c,left:d,right:u,width:u-d,height:c-l,x:d,y:l};return{...p,toJSON:()=>p}}var ud=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=c5(e,r.schema);if(i)if(s){let e=dj(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),a=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;if(c9(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,l)},uu=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),up=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=cV(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!cC(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>cC(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},uh=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=c7(e,0,n.content.size),i=oy.create(n,r);t.setSelection(i)}return!0},uf=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:a}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},um=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=og.atStart(n).from,s=og.atEnd(n).to,a=c7(r,o,s),l=c7(i,o,s),c=og.create(n,a,l);t.setSelection(c)}return!0},ug=e=>({state:t,dispatch:n})=>{var r;return(r=cV(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=r)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,i=rY.from(n?r.create():null),s=new r1(rY.from(r.create(null,rY.from(a.type.create(null,i)))),n?3:1,0),c=o.start,d=o.end;t(e.tr.step(new iY(c-(n?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0})(t,n)};function ub(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var uy=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:a,$to:l}=o,c=ue(i.extensionManager.attributes,a.node().type.name,a.node().attrs);if(o instanceof oy&&o.node.isBlock)return!!a.parentOffset&&!!i3(s,a.pos)&&(r&&(e&&ub(n,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;let d=l.parentOffset===l.parent.content.size,u=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=d&&u?[{type:u,attrs:c}]:void 0,h=i3(t.doc,t.mapping.map(a.pos),1,p);if(!p&&!h&&i3(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)&&(h=!0,p=u?[{type:u,attrs:c}]:void 0),r){if(h&&(o instanceof og&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,p),u&&!d&&!a.parentOffset&&a.parent.type!==u)){let e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&t.setNodeMarkup(t.mapping.map(a.before()),u)}e&&ub(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return h},ux=(e,t={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let a=cV(e,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;let u=l.node(-1);if(u.type!==a)return!1;let p=o.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=rY.empty,r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=rY.from(l.node(t).copy(e));let i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,o={...ue(p,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(o))||void 0;e=e.append(rY.from(a.createAndFill(null,c)||void 0));let d=l.before(l.depth-(r-1));n.replace(d,l.after(-i),new r1(e,4-r,0));let u=-1;n.doc.nodesBetween(d,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=t+1)}),u>-1&&n.setSelection(og.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let h=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,f={...ue(p,u.type.name,u.attrs),...t},m={...ue(p,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);let g=h?[{type:a,attrs:f},{type:h,attrs:m}]:[{type:a,attrs:f}];if(!i3(n.doc,l.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:s}=o.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!i)return!0;let c=a.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0},uv=(e,t)=>{let n=dU(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&i5(e.doc,n.pos))||(e.join(n.pos),!0)},uE=(e,t)=>{let n=dU(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&i5(e.doc,r))||(e.join(r),!0)},uw=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:p}=i.extensionManager,h=cV(e,s.schema),f=cV(t,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:y}=m,x=b.blockRange(y),v=g||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;let E=dU(e=>ur(e.type.name,u))(m),w=0===m.from&&m.to===s.doc.content.size,k=s.doc.content.content,T=1===k.length?k[0]:null,N=w&&T&&ur(T.type.name,u)?{node:T,pos:0,depth:0}:null,A=null!=E?E:N,S=!!E&&x.depth>=1&&x.depth-E.depth<=1,C=!!N;if((S||C)&&A){if(A.node.type===h)return w&&C?l().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return og.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(ur(A.node.type.name,u)&&h.validContent(A.node.content))return l().command(()=>(o.setNodeMarkup(A.pos,h),!0)).command(()=>uv(o,h)).command(()=>uE(o,h)).run()}return n&&v&&a?l().command(()=>{let e=d().wrapInList(h,r),t=v.filter(e=>p.includes(e.type.name));return o.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(h,r).command(()=>uv(o,h)).command(()=>uE(o,h)).run():l().command(()=>!!d().wrapInList(h,r)||c.clearNodes()).wrapInList(h,r).command(()=>uv(o,h)).command(()=>uE(o,h)).run()},uk=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=c5(e,r.schema);return ut(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},uT=(e,t,n={})=>({state:r,commands:i})=>{let o,s=cV(e,r.schema),a=cV(t,r.schema),l=dv(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),l)?i.setNode(a,o):i.setNode(s,{...o,...n})},uN=(e,t={})=>({state:n,commands:r})=>{let i=cV(e,n.schema);return dv(n,i,t)?r.lift(i):r.wrapIn(i,t)},uA=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},uS=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},uC=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=c5(e,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:e,to:t}=a,r=null==(o=c.marks().find(e=>e.type===l))?void 0:o.attrs,i=c3(c,l,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},u_=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},uM=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=dN("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=cV(e,r.schema)),"mark"===a&&(s=c5(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let a,c,d,u,p=e.$from.pos,h=e.$to.pos;n.selection.empty?r.doc.nodesBetween(p,h,(e,t)=>{o&&o===e.type&&(l=!0,d=Math.max(t,p),u=Math.min(t+e.nodeSize,h),a=t,c=e)}):r.doc.nodesBetween(p,h,(e,r)=>{r<p&&o&&o===e.type&&(l=!0,d=Math.max(r,p),u=Math.min(r+e.nodeSize,h),a=r,c=e),r>=p&&r<=h&&(o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(l=!0,i)){let i=Math.max(r,p),a=Math.min(r+e.nodeSize,h);n.addMark(i,a,s.create({...o.attrs,...t}))}}))}),c&&(void 0!==a&&i&&n.setNodeMarkup(a,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach(e=>{s===e.type&&i&&n.addMark(d,u,s.create({...e.attrs,...t}))}))}),l},uO=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&iZ(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}})(cV(e,n.schema),t)(n,r),uI=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let i=!1,o=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);o=new ir(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ir(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let a=iZ(o,n,r,t);return!!a&&(e&&function(e,t,n,r,i){let o=rY.empty;for(let e=n.length-1;e>=0;e--)o=rY.from(n[e].type.create(n[e].attrs,o));e.step(new iY(t.start-2*!!r,t.end,t.start,t.end,new r1(o,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==i&&(s=e+1);let a=n.length-s,l=t.start+n.length-2*!!r,c=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&i3(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(n).nodeSize}(e,t,a,i,n),!0)}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}})(cV(e,n.schema),t)(n,r),uD=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},uR=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function uL(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;let c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1,u=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,a;let l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+o;return s.forEach(e=>{if(d)return;let t=((e,t)=>{if(cZ(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!t)return;let s=l.state.tr,c=cP({state:l.state,transaction:s}),p={from:r-(t[0].length-o.length),to:i},{commands:h,chain:f,can:m}=new cj({editor:n,state:c});null!==e.handler({state:c,range:p,match:t,commands:h,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:i,text:o}),l.dispatch(s),d=!0)}),d}function uP(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var uj=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...dV(dz(this,"addOptions",{name:this.name}))}}get storage(){return{...dV(dz(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return uP(t)&&uP(n)&&Object.keys(n).forEach(i=>{uP(n[i])&&uP(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},uB=class e extends uj{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},uF=class{constructor(e){this.find=e.find,this.handler=e.handler}},uH=null,uU=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=d2(e),this.schema=function(e,t){var n;let r=dK(e),{nodeExtensions:i,markExtensions:o}=dW(e),s=null==(n=i.find(e=>dz(e,"topNode")))?void 0:n.name;return new iE({topNode:s,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=dZ({...e.reduce((e,t)=>{let r=dz(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:dV(dz(n,"content",o)),marks:dV(dz(n,"marks",o)),group:dV(dz(n,"group",o)),inline:dV(dz(n,"inline",o)),atom:dV(dz(n,"atom",o)),selectable:dV(dz(n,"selectable",o)),draggable:dV(dz(n,"draggable",o)),code:dV(dz(n,"code",o)),whitespace:dV(dz(n,"whitespace",o)),linebreakReplacement:dV(dz(n,"linebreakReplacement",o)),defining:dV(dz(n,"defining",o)),isolating:dV(dz(n,"isolating",o)),attrs:Object.fromEntries(i.map(d0))}),a=dV(dz(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>dJ(e,i)));let l=dz(n,"renderHTML",o);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:dQ(e,i)}));let c=dz(n,"renderText",o);return c&&(s.toText=c),[n.name,s]})),marks:Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=dZ({...e.reduce((e,t)=>{let r=dz(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:dV(dz(n,"inclusive",o)),excludes:dV(dz(n,"excludes",o)),group:dV(dz(n,"group",o)),spanning:dV(dz(n,"spanning",o)),code:dV(dz(n,"code",o)),attrs:Object.fromEntries(i.map(d0))}),a=dV(dz(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>dJ(e,i)));let l=dz(n,"renderHTML",o);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:dQ(e,i)})),[n.name,s]}))})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:d8(t.name,this.schema)},r=dz(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return d1([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:d8(t.name,this.schema)},r=[],i=dz(t,"addKeyboardShortcuts",n),o={};if("mark"===t.type&&dz(t,"exitable",n)&&(o.ArrowRight=()=>uB.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));o={...o,...t}}let s=new oM({props:{handleKeyDown:lu(o)}});r.push(s);let a=dz(t,"addInputRules",n);if(un(t,e.options.enableInputRules)&&a){let t=a();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new oM({state:{init:()=>null,apply(e,i,o){let s=e.getMeta(r);if(s)return s;let a=e.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=dG(rY.from(e),o.schema));let{from:i}=a,s=i+e.length;uL({editor:t,from:i,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,o,s)=>uL({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&uL({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&uL({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let l=dz(t,"addPasteRules",n);if(un(t,e.options.enablePasteRules)&&l){let t=l();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,i=null,o=!1,s=!1,a="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let l=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let l=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new cj({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,i,(e,t)=>{var p,h,f,m,g;if((null==(h=null==(p=e.type)?void 0:p.spec)?void 0:h.code)||!(e.isText||e.isTextblock||e.isInline))return;let b=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,y=Math.max(r,t),x=Math.min(i,t+b);y>=x||((e,t,n)=>{if(cZ(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(y-t,x-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=y+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=o.handler({state:n,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(p)})}),u.every(e=>null!==e)}({editor:n,state:cP({state:e,transaction:l}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&l.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return a="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return r.map(e=>new oM({view(e){let t=t=>{var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(uH=n)},r=()=>{uH&&(uH=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(s=i===e.dom.parentElement,t=n,!s){let e=uH;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],c="paste"===i.getMeta("uiEvent")&&!o,d="drop"===i.getMeta("uiEvent")&&!s,u=i.getMeta("applyPasteRules"),p=!!u;if(!c&&!d&&!p)return;if(p){var h,f;let t,{text:n}=u;"string"==typeof n||(n=dG(rY.from(n),r.schema));let{from:i}=u,o=i+n.length;return l({rule:e,state:r,from:i,to:{b:o},pasteEvt:(h=n,null==(f=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||f.setData("text/html",h),t)})}let m=n.doc.content.findDiffStart(r.doc.content),g=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof m&&g&&m!==g.b)return l({rule:e,state:r,from:m,to:g,pasteEvt:a})}}))}({editor:e,rules:t});r.push(...n)}}let c=dz(t,"addProseMirrorPlugins",n);if(c){let e=c();r.push(...e)}return r})}get attributes(){return dK(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=dW(this.extensions);return Object.fromEntries(t.filter(e=>!!dz(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:cV(t.name,this.schema)},i=dz(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,a,l)=>{let c=dQ(r,n);return o({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return d1([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:d8(n.name,this.schema)},i=dz(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return d1([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:d8(n.name,this.schema)},i=dz(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=dW(this.extensions);return Object.fromEntries(t.filter(e=>!!dz(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:c5(t.name,this.schema)},i=dz(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let a=dQ(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){let{state:r}=t,{doc:i,tr:o}=r;i.descendants((t,r)=>{let i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,a=null;if(t.marks.forEach(t=>{if(t!==e)return!1;a=t}),!a)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==a.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});o.removeMark(i,s,e.type),o.addMark(i,s,t)}}),o.docChanged&&t.view.dispatch(o)}(r,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:d8(e.name,this.schema)};"mark"===e.type&&(null==(t=dV(dz(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=dz(e,"onBeforeCreate",n),i=dz(e,"onCreate",n),o=dz(e,"onUpdate",n),s=dz(e,"onSelectionUpdate",n),a=dz(e,"onTransaction",n),l=dz(e,"onFocus",n),c=dz(e,"onBlur",n),d=dz(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};uU.resolve=d2,uU.sort=d1,uU.flatten=d$,cL({},{ClipboardTextSerializer:()=>u$,Commands:()=>uG,Delete:()=>uq,Drop:()=>uV,Editable:()=>uW,FocusEvents:()=>uY,Keymap:()=>uX,Paste:()=>uQ,Tabindex:()=>uJ,TextDirection:()=>uZ,focusEventsPluginKey:()=>uK});var uz=class e extends uj{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},u$=uz.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new oM({key:new oD("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),a=Math.max(...o.map(e=>e.$to.pos)),l=d4(n);return d3(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),uG=uz.create({name:"commands",addCommands:()=>({...cB})}),uq=uz.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let o=()=>{var n,r,i,o;if(null!=(o=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,e))?o:e.getMeta("y-sync$"))return;let s=dB(e.before,[e,...t]);d9(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:s.mapping.map(r),newTo:s.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:s})})});let a=s.mapping;s.steps.forEach((t,n)=>{var r,i;if(t instanceof iq){let o=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(o,-1),d=a.invert().map(l),u=o>0&&(null==(r=s.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(t.mark))),p=null==(i=s.doc.nodeAt(l))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:o,to:l},partial:!!(p||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(o,0):o()}}),uV=uz.create({name:"drop",addProseMirrorPlugins(){return[new oM({key:new oD("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),uW=uz.create({name:"editable",addProseMirrorPlugins(){return[new oM({key:new oD("editable"),props:{editable:()=>this.editor.options.editable}})]}}),uK=new oD("focusEvents"),uY=uz.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new oM({key:uK,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),uX=uz.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:o}=n,{pos:s,parent:a}=o,l=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,c=l.parent.type.spec.isolating,d=o.pos-o.parentOffset,u=c&&1===l.parent.childCount?d===o.pos:op.atStart(r).from===s;return!!i&&!!a.type.isTextblock&&!a.textContent.length&&!!u&&(!u||"paragraph"!==o.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return dt()||dy()?i:r},addProseMirrorPlugins(){return[new oM({key:new oD("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:a}=t.selection,l=op.atStart(t.doc).from,c=op.atEnd(t.doc).to;if(o||s!==l||a!==c||!ui(n.doc))return;let d=n.tr,u=cP({state:n,transaction:d}),{commands:p}=new cj({editor:this.editor,state:u});if(p.clearNodes(),d.steps.length)return d}})]}}),uQ=uz.create({name:"paste",addProseMirrorPlugins(){return[new oM({key:new oD("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),uJ=uz.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new oM({key:new oD("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),uZ=uz.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=dW(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new oM({key:new oD("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),u0=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+ +!o;if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(a);if(!i&&!s&&l.depth<=this.depth)return;let c=new e(l,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},u1=`.ProseMirror {
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ProseMirror {
|
|
10
|
+
word-wrap: break-word;
|
|
11
|
+
white-space: pre-wrap;
|
|
12
|
+
white-space: break-spaces;
|
|
13
|
+
-webkit-font-variant-ligatures: none;
|
|
14
|
+
font-variant-ligatures: none;
|
|
15
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ProseMirror [contenteditable="false"] {
|
|
19
|
+
white-space: normal;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
23
|
+
white-space: pre-wrap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ProseMirror pre {
|
|
27
|
+
white-space: pre-wrap;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
img.ProseMirror-separator {
|
|
31
|
+
display: inline !important;
|
|
32
|
+
border: none !important;
|
|
33
|
+
margin: 0 !important;
|
|
34
|
+
width: 0 !important;
|
|
35
|
+
height: 0 !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ProseMirror-gapcursor {
|
|
39
|
+
display: none;
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
position: absolute;
|
|
42
|
+
margin: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ProseMirror-gapcursor:after {
|
|
46
|
+
content: "";
|
|
47
|
+
display: block;
|
|
48
|
+
position: absolute;
|
|
49
|
+
top: -2px;
|
|
50
|
+
width: 20px;
|
|
51
|
+
border-top: 1px solid black;
|
|
52
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes ProseMirror-cursor-blink {
|
|
56
|
+
to {
|
|
57
|
+
visibility: hidden;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ProseMirror-hideselection *::selection {
|
|
62
|
+
background: transparent;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
66
|
+
background: transparent;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ProseMirror-hideselection * {
|
|
70
|
+
caret-color: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
74
|
+
display: block;
|
|
75
|
+
}`,u2=class extends uD{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:ua,createMappablePosition:ul},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=c8(t,this.options.autofocus);this.editorState=o_.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(u1,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=dq(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t,n,r;let i=[...this.options.enableCoreExtensions?[uW,u$.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),uG,uY,uX,uJ.configure({value:null==(r=null==(n=this.options.coreExtensionOptions)?void 0:n.tabindex)?void 0:r.value}),uV,uQ,uq,uZ.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new uU(i,this)}createCommandManager(){this.commandManager=new cj({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=dL(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=dL(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new a6(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||o.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return d6(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return dv(e,null,n)||ut(e,null,n);let r=dN(t,e.schema);return"node"===r?dv(e,t,n):"mark"===r&&ut(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return dG(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return d5(this.state.doc,{blockSeparator:t,textSerializers:{...d4(this.schema),...n}})}get isEmpty(){return ui(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new u0(t,this,!1,n)}get $doc(){return this.$pos(0)}};function u3(e){return new uR({find:e.find,handler:({state:t,range:n,match:r})=>{let i=dV(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],a=r[0];if(s){let r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(d7(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;c<n.to&&o.delete(c,n.to),l>n.from&&o.delete(n.from+r,l);let d=n.from+r+s.length;o.addMark(n.from+r,d,e.type.create(i||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function u5(e){return new uR({find:e.find,handler:({state:t,range:n,match:r})=>{let i=dV(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,a=n.to,l=e.type.create(i);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;let t=r[0][r[0].length-1];o.insertText(t,s+r[0].length-1),o.replaceWith(e,a,l)}else if(r[0]){let t=e.type.isInline?s:s-1;o.insert(t,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()},undoable:e.undoable})}function u4(e){return new uR({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=dV(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function u6(e){return new uR({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let o=dV(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&iZ(a,e.type,o);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>i.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,o).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&i5(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}var u9=class{constructor(e){var t,n,r,i,o,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==(r=null==e?void 0:e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(i=e.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(o=e.options)?void 0:o.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(s=e.options)?void 0:s.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),o=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),o&&(e.style.right="0"),("top"===t||"bottom"===t)&&(e.style.left="0",e.style.right="0"),("left"===t||"right"===t)&&(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;(t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e))instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),o=this.applyConstraints(r,i,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,o=e.includes("right"),s=e.includes("left"),a=e.includes("bottom"),l=e.includes("top");return(o?r=this.startWidth+t:s&&(r=this.startWidth-t),a?i=this.startHeight+n:l&&(i=this.startHeight-n),("right"===e||"left"===e)&&(r=this.startWidth+(o?t:-t)),("top"===e||"bottom"===e)&&(i=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed)?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){var r,i,o,s;if(!n){let n=Math.max(this.minSize.width,e),o=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(i=this.maxSize)?void 0:i.height)&&(o=Math.min(this.maxSize.height,o)),{width:n,height:o}}let a=e,l=t;return a<this.minSize.width&&(l=(a=this.minSize.width)/this.aspectRatio),l<this.minSize.height&&(a=(l=this.minSize.height)*this.aspectRatio),(null==(o=this.maxSize)?void 0:o.width)&&a>this.maxSize.width&&(l=(a=this.maxSize.width)/this.aspectRatio),(null==(s=this.maxSize)?void 0:s.height)&&l>this.maxSize.height&&(a=(l=this.maxSize.height)*this.aspectRatio),{width:a,height:l}}applyAspectRatio(e,t,n){return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:"top"===n||"bottom"===n?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function u7(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(t.id=o[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var i;let o=n[parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];o&&(t[e]=o.slice(1,-1))});let s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function u8(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function pe(e){let{nodeName:t,name:n,parseAttributes:r=u7,serializeAttributes:i=u8,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{let r={...o,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,i){let o=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(o);if(!a)return;let c=r(a[1]||"");if(!s.find(e=>!(e in c)))return{type:t,raw:a[0],attributes:c}}},renderMarkdown:e=>{let t=i((e=>{if(!a)return e;let t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${l}${n} :::`}}}function pt(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=u7,serializeAttributes:o=u8,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let o={...s,...e.attributes};return n.createNode(t,o,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var o;let s=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;let[d,u=""]=l,p=i(u),h=1,f=d.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,b=e.slice(f);for(g.lastIndex=0;;){let n=g.exec(b);if(null===n)break;let i=n.index,s=n[1];if(null==(o=n[2])||!o.endsWith(":::")){if(s)h+=1;else if(0==(h-=1)){let o=b.slice(0,i);m=o.trim();let s=e.slice(0,f+i+n[0].length),l=[];if(m)if("block"===a)for((l=r.blockTokens(o)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});l.length>0;){let e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:p,content:m,tokens:l}}}}}},renderMarkdown:(e,t)=>{let n=o((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${c}${r}
|
|
76
|
+
|
|
77
|
+
${i}
|
|
78
|
+
|
|
79
|
+
:::`}}}function pn(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,o,s]=r;t[i]=o||s,r=n.exec(e)}return t}function pr(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function pi(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=pn,serializeAttributes:o=pr,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let i={...s,...e.attributes};if(a)return n.createNode(t,i);let o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=a?RegExp(`\\[${d}\\s*[^\\]]*\\]`):RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let o=a?RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),s=e.match(o);if(!s)return;let l="",c="";if(a){let[,e]=s;c=e}else{let[,e,t]=s;c=e,l=t||""}let u=i(c.trim());return{type:t,raw:s[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=o((e=>{if(!l)return e;let t={};return l.forEach(n=>{let r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==i&&n===i)return;t[r]=n}}),t})(e.attrs||{})),i=n?` ${n}`:"";return a?`[${c}${i}]`:`[${c}${i}]${t}[/${c}]`}}}function po(e,t,n){var r,i,o,s;let a=e.split("\n"),l=[],c="",d=0,u=t.baseIndentSize||2;for(;d<a.length;){let e,p=a[d],h=p.match(t.itemPattern);if(!h)if(l.length>0)break;else{if(""!==p.trim())return;d+=1,c=`${c}${p}
|
|
80
|
+
`;continue}let f=t.extractItemData(h),{indentLevel:m,mainContent:g}=f;c=`${c}${p}
|
|
81
|
+
`;let b=[g];for(d+=1;d<a.length;){let e=a[d];if(""===e.trim()){let t=a.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(i=null==(r=a[d+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>m){b.push(e),c=`${c}${e}
|
|
82
|
+
`,d+=1;continue}break}if(((null==(s=null==(o=e.match(/^(\s*)/))?void 0:o[1])?void 0:s.length)||0)>m)b.push(e),c=`${c}${e}
|
|
83
|
+
`,d+=1;else break}let y=b.slice(1);if(y.length>0){let r=y.map(e=>e.slice(m+u)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let x=t.createToken(f,e);l.push(x)}if(0!==l.length)return{items:l,raw:c}}function ps(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[o,...s]=e.content,a=t.renderChildren([o]),l=`${i}${a}`;return s&&s.length>0&&s.forEach((e,n)=>{var r,i;let o=null!=(i=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?i:t.renderChildren([e]);if(null!=o){let n=o.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?`
|
|
84
|
+
|
|
85
|
+
${n}`:`
|
|
86
|
+
${n}`}}),l}cL({},{createAtomBlockMarkdownSpec:()=>pe,createBlockMarkdownSpec:()=>pt,createInlineMarkdownSpec:()=>pi,parseAttributes:()=>u7,parseIndentedBlocks:()=>po,renderNestedMarkdownContent:()=>ps,serializeAttributes:()=>u8});var pa=class e extends uj{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},pl=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,i,o,s,a;let{view:l}=this.editor,c=e.target,d=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!d)return;let u=0,p=0;if(this.dom!==d){let t=this.dom.getBoundingClientRect(),n=d.getBoundingClientRect(),a=null!=(i=e.offsetX)?i:null==(r=e.nativeEvent)?void 0:r.offsetX,l=null!=(s=e.offsetY)?s:null==(o=e.nativeEvent)?void 0:o.offsetY;u=n.x-t.x+a,p=n.y-t.y+l}let h=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();h.style.width=`${Math.round(e.width)}px`,h.style.height=`${Math.round(e.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let f=null;try{(f=document.createElement("div")).style.position="absolute",f.style.top="-9999px",f.style.left="-9999px",f.style.pointerEvents="none",f.appendChild(h),document.body.appendChild(f),null==(a=e.dataTransfer)||a.setDragImage(h,u,p)}finally{f&&setTimeout(()=>{try{null==f||f.remove()}catch{}},0)}let m=this.getPos();if("number"!=typeof m)return;let g=oy.create(l.state.doc,m),b=l.state.tr.setSelection(g);l.dispatch(b)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!(null==(t=this.contentDOM)?void 0:t.contains(n))))return!1;let r=e.type.startsWith("drag"),i="dragover"===e.type||"dragenter"===e.type,o="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;let{isEditable:s}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,c=oy.isSelectable(this.node),d="copy"===e.type,u="paste"===e.type,p="cut"===e.type,h="mousedown"===e.type;if(!l&&c&&r&&e.target===this.dom&&e.preventDefault(),l&&r&&!a&&e.target===this.dom)return e.preventDefault(),!1;if(l&&s&&!a&&h){let e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!a&&!i&&!o&&!d&&!u&&!p&&(!h||!c)&&!0}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&(dt()||de())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if("number"!=typeof e)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function pc(e){return new uF({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=dV(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,a=r[r.length-1],l=r[0],c=n.to;if(a){let i=l.search(/\S/),d=n.from+l.indexOf(a),u=d+a.length;if(d7(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>d).length)return null;u<n.to&&s.delete(u,n.to),d>n.from&&s.delete(n.from+i,d),c=n.from+i+a.length,s.addMark(n.from+i,c,e.type.create(o||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||s.removeStoredMark(e.type)}}})}let{getOwnPropertyNames:pd,getOwnPropertySymbols:pu}=Object,{hasOwnProperty:pp}=Object.prototype;function ph(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function pf(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);let{cache:i}=r,o=i.get(t),s=i.get(n);if(o&&s)return o===n&&s===t;i.set(t,n),i.set(n,t);let a=e(t,n,r);return i.delete(t),i.delete(n),a}}function pm(e){return pd(e).concat(pu(e))}let pg=Object.hasOwn||((e,t)=>pp.call(e,t));function pb(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:py,keys:px}=Object;function pv(e,t){return e.byteLength===t.byteLength&&pI(new Uint8Array(e),new Uint8Array(t))}function pE(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function pw(e,t){return e.byteLength===t.byteLength&&pI(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function pk(e,t){return pb(e.getTime(),t.getTime())}function pT(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function pN(e,t){return e===t}function pA(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),a=e.entries(),l=0;for(;(r=a.next())&&!r.done;){let o=t.entries(),a=!1,c=0;for(;(i=o.next())&&!i.done;){if(s[c]){c++;continue}let o=r.value,d=i.value;if(n.equals(o[0],d[0],l,c,e,t,n)&&n.equals(o[1],d[1],o[0],d[0],e,t,n)){a=s[c]=!0;break}c++}if(!a)return!1;l++}return!0}function pS(e,t,n){let r=px(e),i=r.length;if(px(t).length!==i)return!1;for(;i-- >0;)if(!pR(e,t,n,r[i]))return!1;return!0}function pC(e,t,n){let r,i,o,s=pm(e),a=s.length;if(pm(t).length!==a)return!1;for(;a-- >0;)if(!pR(e,t,n,r=s[a])||(i=py(e,r),o=py(t,r),(i||o)&&(!i||!o||i.configurable!==o.configurable||i.enumerable!==o.enumerable||i.writable!==o.writable)))return!1;return!0}function p_(e,t){return pb(e.valueOf(),t.valueOf())}function pM(e,t){return e.source===t.source&&e.flags===t.flags}function pO(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),a=e.values();for(;(r=a.next())&&!r.done;){let o=t.values(),a=!1,l=0;for(;(i=o.next())&&!i.done;){if(!s[l]&&n.equals(r.value,i.value,r.value,i.value,e,t,n)){a=s[l]=!0;break}l++}if(!a)return!1}return!0}function pI(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function pD(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function pR(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||pg(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let pL={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},pP=Object.prototype.toString,pj=pB();function pB(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:u,areTypedArraysEqual:p,areUrlsEqual:h,unknownTagComparators:f}){return function(m,g,b){if(m===g)return!0;if(null==m||null==g)return!1;let y=typeof m;if(y!==typeof g)return!1;if("object"!==y)return"number"===y?a(m,g,b):"function"===y&&o(m,g,b);let x=m.constructor;if(x!==g.constructor)return!1;if(x===Object)return l(m,g,b);if(Array.isArray(m))return t(m,g,b);if(x===Date)return r(m,g,b);if(x===RegExp)return d(m,g,b);if(x===Map)return s(m,g,b);if(x===Set)return u(m,g,b);let v=pP.call(m);if("[object Date]"===v)return r(m,g,b);if("[object RegExp]"===v)return d(m,g,b);if("[object Map]"===v)return s(m,g,b);if("[object Set]"===v)return u(m,g,b);if("[object Object]"===v)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,b);if("[object URL]"===v)return h(m,g,b);if("[object Error]"===v)return i(m,g,b);if("[object Arguments]"===v)return l(m,g,b);if(pL[v])return p(m,g,b);if("[object ArrayBuffer]"===v)return e(m,g,b);if("[object DataView]"===v)return n(m,g,b);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return c(m,g,b);if(f){let e=f[v];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,b)}return!1}}(function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:pv,areArraysEqual:n?pC:pE,areDataViewsEqual:pw,areDatesEqual:pk,areErrorsEqual:pT,areFunctionsEqual:pN,areMapsEqual:n?ph(pA,pC):pA,areNumbersEqual:pb,areObjectsEqual:n?pC:pS,arePrimitiveWrappersEqual:p_,areRegExpsEqual:pM,areSetsEqual:n?ph(pO,pC):pO,areTypedArraysEqual:n?ph(pI,pC):pI,areUrlsEqual:pD,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=pf(r.areArraysEqual),t=pf(r.areMapsEqual),n=pf(r.areObjectsEqual),i=pf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}(e)),s=n?n(o):function(e,t,n,r,i,s,a){return o(e,t,a)};return function({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(o,s){let{cache:a=e?new WeakMap:void 0,meta:l}=n();return t(o,s,{cache:a,equals:r,meta:l,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let o={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,o)}}({circular:t,comparator:o,createState:r,equals:s,strict:i})}pB({strict:!0}),pB({circular:!0}),pB({circular:!0,strict:!0}),pB({createInternalComparator:()=>pb}),pB({strict:!0,createInternalComparator:()=>pb}),pB({circular:!0,createInternalComparator:()=>pb}),pB({circular:!0,createInternalComparator:()=>pb,strict:!0});var pF=e.i(383835),pH=({contentComponent:e})=>{let t=(0,ca.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,X.jsx)(X.Fragment,{children:Object.values(t)})},pU=class extends cs.default.Component{constructor(e){super(e),this.editorContentRef=cs.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,n;if(t.contentComponent)return;let r=this.editorContentRef.current;r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r}),e=new Set,n={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(t,r){n={...n,[t]:t0.default.createPortal(r.reactElement,r.element,t)},e.forEach(e=>e())},removeRenderer(t){let r={...n};delete r[t],n=r,e.forEach(e=>e())}},t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,X.jsx)(pH,{contentComponent:e.contentComponent})]})}},pz=(0,cs.forwardRef)((e,t)=>{let n=cs.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return cs.default.createElement(pU,{key:n,innerRef:t,...e})}),p$=cs.default.memo(pz),pG="u">typeof window?cs.useLayoutEffect:cs.useEffect,pq=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}},pV="u"<typeof window,pW=pV||!!("u">typeof window&&window.next),pK=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=null==e||e;return pV?t=!1:pW&&void 0===e&&(t=!1),t?this.createEditor():null}createEditor(){return new u2({...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}},pY=(0,cs.createContext)({editor:null});pY.Consumer;var pX=()=>(0,cs.useContext)(pY),pQ=(0,cs.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),pJ=cs.default.forwardRef((e,t)=>{let{onDragStart:n}=(0,cs.useContext)(pQ),r=e.as||"div";return(0,X.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function pZ(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function p0(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}var p1=class{constructor(e,{editor:t,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?(0,t0.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=function(){try{if(cs.version)return parseInt(cs.version.split(".")[0],10)>=19}catch{}return!1}(),o=function(e){if(pZ(e)||p0(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return pZ(t)||p0(t)}return!1}(t),s={...n};s.ref&&!(i||o)&&delete s.ref,!s.ref&&(i||o)&&(s.ref=e=>{this.ref=e}),this.reactElement=(0,X.jsx)(t,{...s}),null==(e=null==r?void 0:r.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==(e=null==t?void 0:t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};cs.default.createContext({markViewContentRef:()=>{}});var p2=class extends pl{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();"number"==typeof e&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),"function"==typeof this.options.attrs&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");if(!e)return;e.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){var o;return"storage"===r?null!=(o=e.storage[t.name])?o:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,cs.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper"),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,cs.memo)(e=>(0,X.jsx)(pQ.Provider,{value:t,children:(0,cs.createElement)(n,e)}));r.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new p1(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let e=this.currentPos;if("number"==typeof e)if(function({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:o}=e;return!!(i<=t&&o>=t+n||r&&c9(e)&&i>t&&o<t+n)}({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,o=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:o,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let o={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(o.getPos=()=>this.getPos()),r(o),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,n=dQ(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}},p3=(0,cs.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function p5({editor:e,instance:t,children:n}){let r=null!=e?e:t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,cs.useMemo)(()=>({editor:r}),[r]),o=(0,cs.useMemo)(()=>({editor:r}),[r]);return(0,X.jsx)(pY.Provider,{value:o,children:(0,X.jsx)(p3.Provider,{value:i,children:n})})}function p4({...e}){let{editor:t}=(0,cs.useContext)(p3);return(0,X.jsx)(p$,{editor:t,...e})}p3.displayName="TiptapContext",p5.displayName="Tiptap",p4.displayName="Tiptap.Content",Object.assign(p5,{Content:p4});let p6=en("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);function p9(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=p9(n.children,t);if(e)return e}}return null}function p7(){}class p8{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function he(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new p8(n,r,t)}function ht(e){return e.toLowerCase()}p8.prototype.normal={},p8.prototype.property={},p8.prototype.space=void 0;class hn{constructor(e,t){this.attribute=t,this.property=e}}hn.prototype.attribute="",hn.prototype.booleanish=!1,hn.prototype.boolean=!1,hn.prototype.commaOrSpaceSeparated=!1,hn.prototype.commaSeparated=!1,hn.prototype.defined=!1,hn.prototype.mustUseProperty=!1,hn.prototype.number=!1,hn.prototype.overloadedBoolean=!1,hn.prototype.property="",hn.prototype.spaceSeparated=!1,hn.prototype.space=void 0;let hr=0,hi=hu(),ho=hu(),hs=hu(),ha=hu(),hl=hu(),hc=hu(),hd=hu();function hu(){return 2**++hr}e.s(["boolean",0,hi,"booleanish",0,ho,"commaOrSpaceSeparated",0,hd,"commaSeparated",0,hc,"number",0,ha,"overloadedBoolean",0,hs,"spaceSeparated",0,hl],383954);var hp=e.i(383954);let hh=Object.keys(hp);class hf extends hn{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<hh.length;){const e=hh[i];!function(e,t,n){n&&(e[t]=n)}(this,hh[i],(n&hp[e])===hp[e])}}}function hm(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let o=new hf(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[ht(r)]=r,n[ht(o.attribute)]=r}return new p8(t,n,e.space)}hf.prototype.defined=!0;let hg=hm({properties:{ariaActiveDescendant:null,ariaAtomic:ho,ariaAutoComplete:null,ariaBusy:ho,ariaChecked:ho,ariaColCount:ha,ariaColIndex:ha,ariaColSpan:ha,ariaControls:hl,ariaCurrent:null,ariaDescribedBy:hl,ariaDetails:null,ariaDisabled:ho,ariaDropEffect:hl,ariaErrorMessage:null,ariaExpanded:ho,ariaFlowTo:hl,ariaGrabbed:ho,ariaHasPopup:null,ariaHidden:ho,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:hl,ariaLevel:ha,ariaLive:null,ariaModal:ho,ariaMultiLine:ho,ariaMultiSelectable:ho,ariaOrientation:null,ariaOwns:hl,ariaPlaceholder:null,ariaPosInSet:ha,ariaPressed:ho,ariaReadOnly:ho,ariaRelevant:null,ariaRequired:ho,ariaRoleDescription:hl,ariaRowCount:ha,ariaRowIndex:ha,ariaRowSpan:ha,ariaSelected:ho,ariaSetSize:ha,ariaSort:null,ariaValueMax:ha,ariaValueMin:ha,ariaValueNow:ha,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function hb(e,t){return t in e?e[t]:t}function hy(e,t){return hb(e,t.toLowerCase())}let hx=hm({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:hc,acceptCharset:hl,accessKey:hl,action:null,allow:null,allowFullScreen:hi,allowPaymentRequest:hi,allowUserMedia:hi,alt:null,as:null,async:hi,autoCapitalize:null,autoComplete:hl,autoFocus:hi,autoPlay:hi,blocking:hl,capture:null,charSet:null,checked:hi,cite:null,className:hl,cols:ha,colSpan:null,content:null,contentEditable:ho,controls:hi,controlsList:hl,coords:ha|hc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:hi,defer:hi,dir:null,dirName:null,disabled:hi,download:hs,draggable:ho,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:hi,formTarget:null,headers:hl,height:ha,hidden:hs,high:ha,href:null,hrefLang:null,htmlFor:hl,httpEquiv:hl,id:null,imageSizes:null,imageSrcSet:null,inert:hi,inputMode:null,integrity:null,is:null,isMap:hi,itemId:null,itemProp:hl,itemRef:hl,itemScope:hi,itemType:hl,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:hi,low:ha,manifest:null,max:null,maxLength:ha,media:null,method:null,min:null,minLength:ha,multiple:hi,muted:hi,name:null,nonce:null,noModule:hi,noValidate:hi,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:hi,optimum:ha,pattern:null,ping:hl,placeholder:null,playsInline:hi,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:hi,referrerPolicy:null,rel:hl,required:hi,reversed:hi,rows:ha,rowSpan:ha,sandbox:hl,scope:null,scoped:hi,seamless:hi,selected:hi,shadowRootClonable:hi,shadowRootDelegatesFocus:hi,shadowRootMode:null,shape:null,size:ha,sizes:null,slot:null,span:ha,spellCheck:ho,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ha,step:null,style:null,tabIndex:ha,target:null,title:null,translate:null,type:null,typeMustMatch:hi,useMap:null,value:ho,width:ha,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:hl,axis:null,background:null,bgColor:null,border:ha,borderColor:null,bottomMargin:ha,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:hi,declare:hi,event:null,face:null,frame:null,frameBorder:null,hSpace:ha,leftMargin:ha,link:null,longDesc:null,lowSrc:null,marginHeight:ha,marginWidth:ha,noResize:hi,noHref:hi,noShade:hi,noWrap:hi,object:null,profile:null,prompt:null,rev:null,rightMargin:ha,rules:null,scheme:null,scrolling:ho,standby:null,summary:null,text:null,topMargin:ha,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ha,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:hi,disableRemotePlayback:hi,prefix:null,property:null,results:ha,security:null,unselectable:null},space:"html",transform:hy}),hv=hm({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:hd,accentHeight:ha,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ha,amplitude:ha,arabicForm:null,ascent:ha,attributeName:null,attributeType:null,azimuth:ha,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ha,by:null,calcMode:null,capHeight:ha,className:hl,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ha,diffuseConstant:ha,direction:null,display:null,dur:null,divisor:ha,dominantBaseline:null,download:hi,dx:null,dy:null,edgeMode:null,editable:null,elevation:ha,enableBackground:null,end:null,event:null,exponent:ha,externalResourcesRequired:null,fill:null,fillOpacity:ha,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:hc,g2:hc,glyphName:hc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ha,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ha,horizOriginX:ha,horizOriginY:ha,id:null,ideographic:ha,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ha,k:ha,k1:ha,k2:ha,k3:ha,k4:ha,kernelMatrix:hd,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ha,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ha,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ha,overlineThickness:ha,paintOrder:null,panose1:null,path:null,pathLength:ha,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:hl,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ha,pointsAtY:ha,pointsAtZ:ha,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:hd,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:hd,rev:hd,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:hd,requiredFeatures:hd,requiredFonts:hd,requiredFormats:hd,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ha,specularExponent:ha,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ha,strikethroughThickness:ha,string:null,stroke:null,strokeDashArray:hd,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ha,strokeOpacity:ha,strokeWidth:null,style:null,surfaceScale:ha,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:hd,tabIndex:ha,tableValues:null,target:null,targetX:ha,targetY:ha,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:hd,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ha,underlineThickness:ha,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ha,values:null,vAlphabetic:ha,vMathematical:ha,vectorEffect:null,vHanging:ha,vIdeographic:ha,version:null,vertAdvY:ha,vertOriginX:ha,vertOriginY:ha,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ha,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hb}),hE=hm({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),hw=hm({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hy}),hk=hm({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),hT=he([hg,hx,hE,hw,hk],"html"),hN=he([hg,hv,hE,hw,hk],"svg");function hA(e){let t=[],n=String(e||""),r=n.indexOf(","),i=0,o=!1;for(;!o;){-1===r&&(r=n.length,o=!0);let e=n.slice(i,r).trim();(e||!o)&&t.push(e),i=r+1,r=n.indexOf(",",i)}return t}function hS(e,t){let n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}let hC=/[#.]/g,h_=/[A-Z]/g,hM=/-[a-z]/g,hO=/^data[-\w.:]+$/i;function hI(e,t){let n=ht(t),r=t,i=hn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&hO.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(hM,hR);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!hM.test(e)){let n=e.replace(h_,hD);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=hf}return new i(r,t)}function hD(e){return"-"+e.toLowerCase()}function hR(e){return e.charAt(1).toUpperCase()}function hL(e){let t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function hP(e){return e.join(" ").trim()}function hj(e,t,n){let r=n?function(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}(n):void 0;return function(n,i,...o){let s;if(null==n)s={type:"root",children:[]},o.unshift(i);else{let a=(s=function(e,t){let n,r,i=e||"",o={},s=0;for(;s<i.length;){hC.lastIndex=s;let e=hC.exec(i),t=i.slice(s,e?e.index:i.length);t&&(n?"#"===n?o.id=t:Array.isArray(o.className)?o.className.push(t):o.className=[t]:r=t,s+=t.length),e&&(n=e[0],s++)}return{type:"element",tagName:r||t||"div",properties:o,children:[]}}(n,t)).tagName.toLowerCase(),l=r?r.get(a):void 0;if(s.tagName=l||a,function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!0;if("string"!=typeof e.type)return!1;for(let t of Object.keys(e)){let n=e[t];if(n&&"object"==typeof n){if(!Array.isArray(n))return!0;for(let e of n)if("number"!=typeof e&&"string"!=typeof e)return!0}}return!!("children"in e&&Array.isArray(e.children))}(i))o.unshift(i);else for(let[t,n]of Object.entries(i))!function(e,t,n,r){let i,o=hI(e,n);if(null!=r){if("number"==typeof r){if(Number.isNaN(r))return;i=r}else i="boolean"==typeof r?r:"string"==typeof r?o.spaceSeparated?hL(r):o.commaSeparated?hA(r):o.commaOrSpaceSeparated?hL(hA(r).join(" ")):hB(o,o.property,r):Array.isArray(r)?[...r]:"style"===o.property?function(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}(r):String(r);if(Array.isArray(i)){let e=[];for(let t of i)e.push(hB(o,o.property,t));i=e}"className"===o.property&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[o.property]=i}}(e,s.properties,t,n)}for(let e of o)!function e(t,n){if(null==n);else if("number"==typeof n||"string"==typeof n)t.push({type:"text",value:String(n)});else if(Array.isArray(n))for(let r of n)e(t,r);else if("object"==typeof n&&"type"in n)"root"===n.type?e(t,n.children):t.push(n);else throw Error("Expected node, nodes, or string, got `"+n+"`")}(s.children,e);return"element"===s.type&&"template"===s.tagName&&(s.content={type:"root",children:s.children},s.children=[]),s}}function hB(e,t,n){if("string"==typeof n){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(""===n||ht(n)===ht(t)))return!0}return n}let hF=hj(hT,"div"),hH=hj(hN,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]);function hU(e,t){let n=e.indexOf("\r",t),r=e.indexOf("\n",t);return -1===r?n:-1===n||n+1===r?r:n<r?n:r}let hz={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},h$={}.hasOwnProperty,hG=Object.prototype;function hq(e,t){let n=t||{};return hV({file:n.file||void 0,location:!1,schema:"svg"===n.space?hN:hT,verbose:n.verbose||!1},e)}function hV(e,t){let n;switch(t.nodeName){case"#comment":return n={type:"comment",value:t.data},hK(e,t,n),n;case"#document":case"#document-fragment":{let r="mode"in t&&("quirks"===t.mode||"limited-quirks"===t.mode);if(n={type:"root",children:hW(e,t.childNodes),data:{quirksMode:r}},e.file&&e.location){let t,r,i=String(e.file),o=(t=String(i),r=[],{toOffset:function(e){if(e&&"number"==typeof e.line&&"number"==typeof e.column&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;r.length<e.line;){let e=r[r.length-1],n=hU(t,e),i=-1===n?t.length+1:n+1;if(e===i)break;r.push(i)}let n=(e.line>1?r[e.line-2]:0)+e.column-1;if(n<r[e.line-1])return n}},toPoint:function(e){if("number"==typeof e&&e>-1&&e<=t.length){let n=0;for(;;){let i=r[n];if(void 0===i){let e=hU(t,r[n-1]);i=-1===e?t.length+1:e+1,r[n]=i}if(i>e)return{line:n+1,column:e-(n>0?r[n-1]:0)+1,offset:e};n++}}}}),s=o.toPoint(0),a=o.toPoint(i.length);p7(s,"expected `start`"),p7(a,"expected `end`"),n.position={start:s,end:a}}return n}case"#documentType":return hK(e,t,n={type:"doctype"}),n;case"#text":return n={type:"text",value:t.value},hK(e,t,n),n;default:return function(e,t){let n=e.schema;e.schema=t.namespaceURI===hz.svg?hN:hT;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+":":"")+e.name;h$.call(hG,n)||(i[n]=e.value)}let o=("svg"===e.schema.space?hH:hF)(t.tagName,i,hW(e,t.childNodes));if(hK(e,t,o),"template"===o.tagName){let n=t.sourceCodeLocation,r=n&&n.startTag&&hY(n.startTag),i=n&&n.endTag&&hY(n.endTag),s=hV(e,t.content);r&&i&&e.file&&(s.position={start:r.end,end:i.start}),o.content=s}return e.schema=n,o}(e,t)}}function hW(e,t){let n=-1,r=[];for(;++n<t.length;){let i=hV(e,t[n]);r.push(i)}return r}function hK(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){let r=function(e,t,n){let r=hY(n);if("element"===t.type){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r,i={};if(n.attrs)for(r in n.attrs)h$.call(n.attrs,r)&&(i[hI(e.schema,r).property]=hY(n.attrs[r]));p7(n.startTag,"a start tag should exist");let o=hY(n.startTag),s=n.endTag?hY(n.endTag):void 0,a={opening:o};s&&(a.closing=s),a.properties=i,t.data={position:a}}}return r}(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function hY(e){let t=hX({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=hX({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function hX(e){return e.line&&e.column?e:void 0}let hQ=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]);(m=D||(D={}))[m.EOF=-1]="EOF",m[m.NULL=0]="NULL",m[m.TABULATION=9]="TABULATION",m[m.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",m[m.LINE_FEED=10]="LINE_FEED",m[m.FORM_FEED=12]="FORM_FEED",m[m.SPACE=32]="SPACE",m[m.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",m[m.QUOTATION_MARK=34]="QUOTATION_MARK",m[m.AMPERSAND=38]="AMPERSAND",m[m.APOSTROPHE=39]="APOSTROPHE",m[m.HYPHEN_MINUS=45]="HYPHEN_MINUS",m[m.SOLIDUS=47]="SOLIDUS",m[m.DIGIT_0=48]="DIGIT_0",m[m.DIGIT_9=57]="DIGIT_9",m[m.SEMICOLON=59]="SEMICOLON",m[m.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",m[m.EQUALS_SIGN=61]="EQUALS_SIGN",m[m.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",m[m.QUESTION_MARK=63]="QUESTION_MARK",m[m.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",m[m.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",m[m.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",m[m.GRAVE_ACCENT=96]="GRAVE_ACCENT",m[m.LATIN_SMALL_A=97]="LATIN_SMALL_A",m[m.LATIN_SMALL_Z=122]="LATIN_SMALL_Z";let hJ="[CDATA[",hZ="doctype",h0="script";function h1(e){return e>=55296&&e<=57343}function h2(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159}function h3(e){return e>=64976&&e<=65007||hQ.has(e)}(g=R||(R={})).controlCharacterInInputStream="control-character-in-input-stream",g.noncharacterInInputStream="noncharacter-in-input-stream",g.surrogateInInputStream="surrogate-in-input-stream",g.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",g.endTagWithAttributes="end-tag-with-attributes",g.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",g.unexpectedSolidusInTag="unexpected-solidus-in-tag",g.unexpectedNullCharacter="unexpected-null-character",g.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",g.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",g.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",g.missingEndTagName="missing-end-tag-name",g.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",g.unknownNamedCharacterReference="unknown-named-character-reference",g.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",g.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",g.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",g.eofBeforeTagName="eof-before-tag-name",g.eofInTag="eof-in-tag",g.missingAttributeValue="missing-attribute-value",g.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",g.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",g.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",g.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",g.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",g.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",g.missingDoctypePublicIdentifier="missing-doctype-public-identifier",g.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",g.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",g.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",g.cdataInHtmlContent="cdata-in-html-content",g.incorrectlyOpenedComment="incorrectly-opened-comment",g.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",g.eofInDoctype="eof-in-doctype",g.nestedComment="nested-comment",g.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",g.eofInComment="eof-in-comment",g.incorrectlyClosedComment="incorrectly-closed-comment",g.eofInCdata="eof-in-cdata",g.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",g.nullCharacterReference="null-character-reference",g.surrogateCharacterReference="surrogate-character-reference",g.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",g.controlCharacterReference="control-character-reference",g.noncharacterCharacterReference="noncharacter-character-reference",g.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",g.missingDoctypeName="missing-doctype-name",g.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",g.duplicateAttribute="duplicate-attribute",g.nonConformingDoctype="non-conforming-doctype",g.missingDoctype="missing-doctype",g.misplacedDoctype="misplaced-doctype",g.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",g.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",g.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",g.openElementsLeftAfterEof="open-elements-left-after-eof",g.abandonedHeadElementChild="abandoned-head-element-child",g.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",g.nestedNoscriptInHead="nested-noscript-in-head",g.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text";class h5{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,o=r+t,s=i+t;return{code:e,startLine:n,endLine:n,startCol:o,endCol:o,startOffset:s,endOffset:s}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(t>=56320&&t<=57343)return this.pos++,this._addGap(),(e-55296)*1024+9216+t}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,D.EOF;return this._err(R.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((32|this.html.charCodeAt(this.pos+t))!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,D.EOF;let n=this.html.charCodeAt(t);return n===D.CARRIAGE_RETURN?D.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,D.EOF;let e=this.html.charCodeAt(this.pos);return e===D.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,D.LINE_FEED):e===D.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,h1(e)&&(e=this._processSurrogate(e)),null===this.handler.onParseError||e>31&&e<127||e===D.LINE_FEED||e===D.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){h2(e)?this._err(R.controlCharacterInInputStream):h3(e)&&this._err(R.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}function h4(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}(b=L||(L={}))[b.CHARACTER=0]="CHARACTER",b[b.NULL_CHARACTER=1]="NULL_CHARACTER",b[b.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",b[b.START_TAG=3]="START_TAG",b[b.END_TAG=4]="END_TAG",b[b.COMMENT=5]="COMMENT",b[b.DOCTYPE=6]="DOCTYPE",b[b.EOF=7]="EOF",b[b.HIBERNATION=8]="HIBERNATION",e.s(["TokenType",0,L,"getTokenAttr",0,h4],743820);let h6=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),h9=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function h7(e){return e>=j.ZERO&&e<=j.NINE}P=String.fromCodePoint,(y=j||(j={}))[y.NUM=35]="NUM",y[y.SEMI=59]="SEMI",y[y.EQUALS=61]="EQUALS",y[y.ZERO=48]="ZERO",y[y.NINE=57]="NINE",y[y.LOWER_A=97]="LOWER_A",y[y.LOWER_F=102]="LOWER_F",y[y.LOWER_X=120]="LOWER_X",y[y.LOWER_Z=122]="LOWER_Z",y[y.UPPER_A=65]="UPPER_A",y[y.UPPER_F=70]="UPPER_F",y[y.UPPER_Z=90]="UPPER_Z",(x=B||(B={}))[x.VALUE_LENGTH=49152]="VALUE_LENGTH",x[x.BRANCH_LENGTH=16256]="BRANCH_LENGTH",x[x.JUMP_TABLE=127]="JUMP_TABLE",(v=F||(F={}))[v.EntityStart=0]="EntityStart",v[v.NumericStart=1]="NumericStart",v[v.NumericDecimal=2]="NumericDecimal",v[v.NumericHex=3]="NumericHex",v[v.NamedEntity=4]="NamedEntity",(E=H||(H={}))[E.Legacy=0]="Legacy",E[E.Strict=1]="Strict",E[E.Attribute=2]="Attribute";class h8{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=F.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=H.Strict}startEntity(e){this.decodeMode=e,this.state=F.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case F.EntityStart:if(e.charCodeAt(t)===j.NUM)return this.state=F.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1);return this.state=F.NamedEntity,this.stateNamedEntity(e,t);case F.NumericStart:return this.stateNumericStart(e,t);case F.NumericDecimal:return this.stateNumericDecimal(e,t);case F.NumericHex:return this.stateNumericHex(e,t);case F.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(32|e.charCodeAt(t))===j.LOWER_X?(this.state=F.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=F.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*Math.pow(r,i)+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){var r;let i=e.charCodeAt(t);if(!h7(i)&&(!((r=i)>=j.UPPER_A)||!(r<=j.UPPER_F))&&(!(r>=j.LOWER_A)||!(r<=j.LOWER_F)))return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(i,3);t+=1}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(!h7(r))return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2);t+=1}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n,r,i;if(this.consumed<=t)return null==(n=this.errors)||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===j.SEMI)this.consumed+=1;else if(this.decodeMode===H.Strict)return 0;return this.emitCodePoint((r=this.result)>=55296&&r<=57343||r>1114111?65533:null!=(i=h9.get(r))?i:r,this.consumed),this.errors&&(e!==j.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&B.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let o=e.charCodeAt(t);if(this.treeIndex=function(e,t,n,r){let i=(t&B.BRANCH_LENGTH)>>7,o=t&B.JUMP_TABLE;if(0===i)return 0!==o&&r===o?n:-1;if(o){let t=r-o;return t<0||t>=i?-1:e[n+t]-1}let s=n,a=s+i-1;for(;s<=a;){let t=s+a>>>1,n=e[t];if(n<r)s=t+1;else{if(!(n>r))return e[t+i];a=t-1}}return -1}(n,r,this.treeIndex+Math.max(1,i),o),this.treeIndex<0)return 0===this.result||this.decodeMode===H.Attribute&&(0===i||function(e){var t;return e===j.EQUALS||(t=e)>=j.UPPER_A&&t<=j.UPPER_Z||t>=j.LOWER_A&&t<=j.LOWER_Z||h7(t)}(o))?0:this.emitNotTerminatedNamedEntity();if(0!=(i=((r=n[this.treeIndex])&B.VALUE_LENGTH)>>14)){if(o===j.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==H.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return -1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&B.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),null==(e=this.errors)||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(1===t?r[e]&~B.VALUE_LENGTH:r[e+1],n),3===t&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case F.NamedEntity:return 0!==this.result&&(this.decodeMode!==H.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case F.NumericDecimal:return this.emitNumericEntity(0,2);case F.NumericHex:return this.emitNumericEntity(0,3);case F.NumericStart:return null==(e=this.errors)||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case F.EntityStart:return 0}}}(w=U||(U={})).HTML="http://www.w3.org/1999/xhtml",w.MATHML="http://www.w3.org/1998/Math/MathML",w.SVG="http://www.w3.org/2000/svg",w.XLINK="http://www.w3.org/1999/xlink",w.XML="http://www.w3.org/XML/1998/namespace",w.XMLNS="http://www.w3.org/2000/xmlns/",(k=z||(z={})).TYPE="type",k.ACTION="action",k.ENCODING="encoding",k.PROMPT="prompt",k.NAME="name",k.COLOR="color",k.FACE="face",k.SIZE="size",(T=$||($={})).NO_QUIRKS="no-quirks",T.QUIRKS="quirks",T.LIMITED_QUIRKS="limited-quirks",(N=G||(G={})).A="a",N.ADDRESS="address",N.ANNOTATION_XML="annotation-xml",N.APPLET="applet",N.AREA="area",N.ARTICLE="article",N.ASIDE="aside",N.B="b",N.BASE="base",N.BASEFONT="basefont",N.BGSOUND="bgsound",N.BIG="big",N.BLOCKQUOTE="blockquote",N.BODY="body",N.BR="br",N.BUTTON="button",N.CAPTION="caption",N.CENTER="center",N.CODE="code",N.COL="col",N.COLGROUP="colgroup",N.DD="dd",N.DESC="desc",N.DETAILS="details",N.DIALOG="dialog",N.DIR="dir",N.DIV="div",N.DL="dl",N.DT="dt",N.EM="em",N.EMBED="embed",N.FIELDSET="fieldset",N.FIGCAPTION="figcaption",N.FIGURE="figure",N.FONT="font",N.FOOTER="footer",N.FOREIGN_OBJECT="foreignObject",N.FORM="form",N.FRAME="frame",N.FRAMESET="frameset",N.H1="h1",N.H2="h2",N.H3="h3",N.H4="h4",N.H5="h5",N.H6="h6",N.HEAD="head",N.HEADER="header",N.HGROUP="hgroup",N.HR="hr",N.HTML="html",N.I="i",N.IMG="img",N.IMAGE="image",N.INPUT="input",N.IFRAME="iframe",N.KEYGEN="keygen",N.LABEL="label",N.LI="li",N.LINK="link",N.LISTING="listing",N.MAIN="main",N.MALIGNMARK="malignmark",N.MARQUEE="marquee",N.MATH="math",N.MENU="menu",N.META="meta",N.MGLYPH="mglyph",N.MI="mi",N.MO="mo",N.MN="mn",N.MS="ms",N.MTEXT="mtext",N.NAV="nav",N.NOBR="nobr",N.NOFRAMES="noframes",N.NOEMBED="noembed",N.NOSCRIPT="noscript",N.OBJECT="object",N.OL="ol",N.OPTGROUP="optgroup",N.OPTION="option",N.P="p",N.PARAM="param",N.PLAINTEXT="plaintext",N.PRE="pre",N.RB="rb",N.RP="rp",N.RT="rt",N.RTC="rtc",N.RUBY="ruby",N.S="s",N.SCRIPT="script",N.SEARCH="search",N.SECTION="section",N.SELECT="select",N.SOURCE="source",N.SMALL="small",N.SPAN="span",N.STRIKE="strike",N.STRONG="strong",N.STYLE="style",N.SUB="sub",N.SUMMARY="summary",N.SUP="sup",N.TABLE="table",N.TBODY="tbody",N.TEMPLATE="template",N.TEXTAREA="textarea",N.TFOOT="tfoot",N.TD="td",N.TH="th",N.THEAD="thead",N.TITLE="title",N.TR="tr",N.TRACK="track",N.TT="tt",N.U="u",N.UL="ul",N.SVG="svg",N.VAR="var",N.WBR="wbr",N.XMP="xmp",(A=q||(q={}))[A.UNKNOWN=0]="UNKNOWN",A[A.A=1]="A",A[A.ADDRESS=2]="ADDRESS",A[A.ANNOTATION_XML=3]="ANNOTATION_XML",A[A.APPLET=4]="APPLET",A[A.AREA=5]="AREA",A[A.ARTICLE=6]="ARTICLE",A[A.ASIDE=7]="ASIDE",A[A.B=8]="B",A[A.BASE=9]="BASE",A[A.BASEFONT=10]="BASEFONT",A[A.BGSOUND=11]="BGSOUND",A[A.BIG=12]="BIG",A[A.BLOCKQUOTE=13]="BLOCKQUOTE",A[A.BODY=14]="BODY",A[A.BR=15]="BR",A[A.BUTTON=16]="BUTTON",A[A.CAPTION=17]="CAPTION",A[A.CENTER=18]="CENTER",A[A.CODE=19]="CODE",A[A.COL=20]="COL",A[A.COLGROUP=21]="COLGROUP",A[A.DD=22]="DD",A[A.DESC=23]="DESC",A[A.DETAILS=24]="DETAILS",A[A.DIALOG=25]="DIALOG",A[A.DIR=26]="DIR",A[A.DIV=27]="DIV",A[A.DL=28]="DL",A[A.DT=29]="DT",A[A.EM=30]="EM",A[A.EMBED=31]="EMBED",A[A.FIELDSET=32]="FIELDSET",A[A.FIGCAPTION=33]="FIGCAPTION",A[A.FIGURE=34]="FIGURE",A[A.FONT=35]="FONT",A[A.FOOTER=36]="FOOTER",A[A.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",A[A.FORM=38]="FORM",A[A.FRAME=39]="FRAME",A[A.FRAMESET=40]="FRAMESET",A[A.H1=41]="H1",A[A.H2=42]="H2",A[A.H3=43]="H3",A[A.H4=44]="H4",A[A.H5=45]="H5",A[A.H6=46]="H6",A[A.HEAD=47]="HEAD",A[A.HEADER=48]="HEADER",A[A.HGROUP=49]="HGROUP",A[A.HR=50]="HR",A[A.HTML=51]="HTML",A[A.I=52]="I",A[A.IMG=53]="IMG",A[A.IMAGE=54]="IMAGE",A[A.INPUT=55]="INPUT",A[A.IFRAME=56]="IFRAME",A[A.KEYGEN=57]="KEYGEN",A[A.LABEL=58]="LABEL",A[A.LI=59]="LI",A[A.LINK=60]="LINK",A[A.LISTING=61]="LISTING",A[A.MAIN=62]="MAIN",A[A.MALIGNMARK=63]="MALIGNMARK",A[A.MARQUEE=64]="MARQUEE",A[A.MATH=65]="MATH",A[A.MENU=66]="MENU",A[A.META=67]="META",A[A.MGLYPH=68]="MGLYPH",A[A.MI=69]="MI",A[A.MO=70]="MO",A[A.MN=71]="MN",A[A.MS=72]="MS",A[A.MTEXT=73]="MTEXT",A[A.NAV=74]="NAV",A[A.NOBR=75]="NOBR",A[A.NOFRAMES=76]="NOFRAMES",A[A.NOEMBED=77]="NOEMBED",A[A.NOSCRIPT=78]="NOSCRIPT",A[A.OBJECT=79]="OBJECT",A[A.OL=80]="OL",A[A.OPTGROUP=81]="OPTGROUP",A[A.OPTION=82]="OPTION",A[A.P=83]="P",A[A.PARAM=84]="PARAM",A[A.PLAINTEXT=85]="PLAINTEXT",A[A.PRE=86]="PRE",A[A.RB=87]="RB",A[A.RP=88]="RP",A[A.RT=89]="RT",A[A.RTC=90]="RTC",A[A.RUBY=91]="RUBY",A[A.S=92]="S",A[A.SCRIPT=93]="SCRIPT",A[A.SEARCH=94]="SEARCH",A[A.SECTION=95]="SECTION",A[A.SELECT=96]="SELECT",A[A.SOURCE=97]="SOURCE",A[A.SMALL=98]="SMALL",A[A.SPAN=99]="SPAN",A[A.STRIKE=100]="STRIKE",A[A.STRONG=101]="STRONG",A[A.STYLE=102]="STYLE",A[A.SUB=103]="SUB",A[A.SUMMARY=104]="SUMMARY",A[A.SUP=105]="SUP",A[A.TABLE=106]="TABLE",A[A.TBODY=107]="TBODY",A[A.TEMPLATE=108]="TEMPLATE",A[A.TEXTAREA=109]="TEXTAREA",A[A.TFOOT=110]="TFOOT",A[A.TD=111]="TD",A[A.TH=112]="TH",A[A.THEAD=113]="THEAD",A[A.TITLE=114]="TITLE",A[A.TR=115]="TR",A[A.TRACK=116]="TRACK",A[A.TT=117]="TT",A[A.U=118]="U",A[A.UL=119]="UL",A[A.SVG=120]="SVG",A[A.VAR=121]="VAR",A[A.WBR=122]="WBR",A[A.XMP=123]="XMP";let fe=new Map([[G.A,q.A],[G.ADDRESS,q.ADDRESS],[G.ANNOTATION_XML,q.ANNOTATION_XML],[G.APPLET,q.APPLET],[G.AREA,q.AREA],[G.ARTICLE,q.ARTICLE],[G.ASIDE,q.ASIDE],[G.B,q.B],[G.BASE,q.BASE],[G.BASEFONT,q.BASEFONT],[G.BGSOUND,q.BGSOUND],[G.BIG,q.BIG],[G.BLOCKQUOTE,q.BLOCKQUOTE],[G.BODY,q.BODY],[G.BR,q.BR],[G.BUTTON,q.BUTTON],[G.CAPTION,q.CAPTION],[G.CENTER,q.CENTER],[G.CODE,q.CODE],[G.COL,q.COL],[G.COLGROUP,q.COLGROUP],[G.DD,q.DD],[G.DESC,q.DESC],[G.DETAILS,q.DETAILS],[G.DIALOG,q.DIALOG],[G.DIR,q.DIR],[G.DIV,q.DIV],[G.DL,q.DL],[G.DT,q.DT],[G.EM,q.EM],[G.EMBED,q.EMBED],[G.FIELDSET,q.FIELDSET],[G.FIGCAPTION,q.FIGCAPTION],[G.FIGURE,q.FIGURE],[G.FONT,q.FONT],[G.FOOTER,q.FOOTER],[G.FOREIGN_OBJECT,q.FOREIGN_OBJECT],[G.FORM,q.FORM],[G.FRAME,q.FRAME],[G.FRAMESET,q.FRAMESET],[G.H1,q.H1],[G.H2,q.H2],[G.H3,q.H3],[G.H4,q.H4],[G.H5,q.H5],[G.H6,q.H6],[G.HEAD,q.HEAD],[G.HEADER,q.HEADER],[G.HGROUP,q.HGROUP],[G.HR,q.HR],[G.HTML,q.HTML],[G.I,q.I],[G.IMG,q.IMG],[G.IMAGE,q.IMAGE],[G.INPUT,q.INPUT],[G.IFRAME,q.IFRAME],[G.KEYGEN,q.KEYGEN],[G.LABEL,q.LABEL],[G.LI,q.LI],[G.LINK,q.LINK],[G.LISTING,q.LISTING],[G.MAIN,q.MAIN],[G.MALIGNMARK,q.MALIGNMARK],[G.MARQUEE,q.MARQUEE],[G.MATH,q.MATH],[G.MENU,q.MENU],[G.META,q.META],[G.MGLYPH,q.MGLYPH],[G.MI,q.MI],[G.MO,q.MO],[G.MN,q.MN],[G.MS,q.MS],[G.MTEXT,q.MTEXT],[G.NAV,q.NAV],[G.NOBR,q.NOBR],[G.NOFRAMES,q.NOFRAMES],[G.NOEMBED,q.NOEMBED],[G.NOSCRIPT,q.NOSCRIPT],[G.OBJECT,q.OBJECT],[G.OL,q.OL],[G.OPTGROUP,q.OPTGROUP],[G.OPTION,q.OPTION],[G.P,q.P],[G.PARAM,q.PARAM],[G.PLAINTEXT,q.PLAINTEXT],[G.PRE,q.PRE],[G.RB,q.RB],[G.RP,q.RP],[G.RT,q.RT],[G.RTC,q.RTC],[G.RUBY,q.RUBY],[G.S,q.S],[G.SCRIPT,q.SCRIPT],[G.SEARCH,q.SEARCH],[G.SECTION,q.SECTION],[G.SELECT,q.SELECT],[G.SOURCE,q.SOURCE],[G.SMALL,q.SMALL],[G.SPAN,q.SPAN],[G.STRIKE,q.STRIKE],[G.STRONG,q.STRONG],[G.STYLE,q.STYLE],[G.SUB,q.SUB],[G.SUMMARY,q.SUMMARY],[G.SUP,q.SUP],[G.TABLE,q.TABLE],[G.TBODY,q.TBODY],[G.TEMPLATE,q.TEMPLATE],[G.TEXTAREA,q.TEXTAREA],[G.TFOOT,q.TFOOT],[G.TD,q.TD],[G.TH,q.TH],[G.THEAD,q.THEAD],[G.TITLE,q.TITLE],[G.TR,q.TR],[G.TRACK,q.TRACK],[G.TT,q.TT],[G.U,q.U],[G.UL,q.UL],[G.SVG,q.SVG],[G.VAR,q.VAR],[G.WBR,q.WBR],[G.XMP,q.XMP]]);function ft(e){var t;return null!=(t=fe.get(e))?t:q.UNKNOWN}let fn=q,fr={[U.HTML]:new Set([fn.ADDRESS,fn.APPLET,fn.AREA,fn.ARTICLE,fn.ASIDE,fn.BASE,fn.BASEFONT,fn.BGSOUND,fn.BLOCKQUOTE,fn.BODY,fn.BR,fn.BUTTON,fn.CAPTION,fn.CENTER,fn.COL,fn.COLGROUP,fn.DD,fn.DETAILS,fn.DIR,fn.DIV,fn.DL,fn.DT,fn.EMBED,fn.FIELDSET,fn.FIGCAPTION,fn.FIGURE,fn.FOOTER,fn.FORM,fn.FRAME,fn.FRAMESET,fn.H1,fn.H2,fn.H3,fn.H4,fn.H5,fn.H6,fn.HEAD,fn.HEADER,fn.HGROUP,fn.HR,fn.HTML,fn.IFRAME,fn.IMG,fn.INPUT,fn.LI,fn.LINK,fn.LISTING,fn.MAIN,fn.MARQUEE,fn.MENU,fn.META,fn.NAV,fn.NOEMBED,fn.NOFRAMES,fn.NOSCRIPT,fn.OBJECT,fn.OL,fn.P,fn.PARAM,fn.PLAINTEXT,fn.PRE,fn.SCRIPT,fn.SECTION,fn.SELECT,fn.SOURCE,fn.STYLE,fn.SUMMARY,fn.TABLE,fn.TBODY,fn.TD,fn.TEMPLATE,fn.TEXTAREA,fn.TFOOT,fn.TH,fn.THEAD,fn.TITLE,fn.TR,fn.TRACK,fn.UL,fn.WBR,fn.XMP]),[U.MATHML]:new Set([fn.MI,fn.MO,fn.MN,fn.MS,fn.MTEXT,fn.ANNOTATION_XML]),[U.SVG]:new Set([fn.TITLE,fn.FOREIGN_OBJECT,fn.DESC]),[U.XLINK]:new Set,[U.XML]:new Set,[U.XMLNS]:new Set},fi=new Set([fn.H1,fn.H2,fn.H3,fn.H4,fn.H5,fn.H6]),fo=new Set([G.STYLE,G.SCRIPT,G.XMP,G.IFRAME,G.NOEMBED,G.NOFRAMES,G.PLAINTEXT]);e.s(["ATTRS",0,z,"DOCUMENT_MODE",0,$,"NS",0,U,"NUMBERED_HEADERS",0,fi,"SPECIAL_ELEMENTS",0,fr,"TAG_ID",0,q,"TAG_NAMES",0,G,"getTagID",0,ft,"hasUnescapedText",0,function(e,t){return fo.has(e)||t&&e===G.NOSCRIPT}],113515),(S=V||(V={}))[S.DATA=0]="DATA",S[S.RCDATA=1]="RCDATA",S[S.RAWTEXT=2]="RAWTEXT",S[S.SCRIPT_DATA=3]="SCRIPT_DATA",S[S.PLAINTEXT=4]="PLAINTEXT",S[S.TAG_OPEN=5]="TAG_OPEN",S[S.END_TAG_OPEN=6]="END_TAG_OPEN",S[S.TAG_NAME=7]="TAG_NAME",S[S.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",S[S.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",S[S.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",S[S.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",S[S.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",S[S.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",S[S.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",S[S.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",S[S.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",S[S.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",S[S.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",S[S.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",S[S.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",S[S.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",S[S.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",S[S.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",S[S.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",S[S.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",S[S.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",S[S.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",S[S.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",S[S.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",S[S.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",S[S.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",S[S.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",S[S.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",S[S.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",S[S.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",S[S.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",S[S.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",S[S.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",S[S.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",S[S.BOGUS_COMMENT=40]="BOGUS_COMMENT",S[S.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",S[S.COMMENT_START=42]="COMMENT_START",S[S.COMMENT_START_DASH=43]="COMMENT_START_DASH",S[S.COMMENT=44]="COMMENT",S[S.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",S[S.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",S[S.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",S[S.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",S[S.COMMENT_END_DASH=49]="COMMENT_END_DASH",S[S.COMMENT_END=50]="COMMENT_END",S[S.COMMENT_END_BANG=51]="COMMENT_END_BANG",S[S.DOCTYPE=52]="DOCTYPE",S[S.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",S[S.DOCTYPE_NAME=54]="DOCTYPE_NAME",S[S.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",S[S.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",S[S.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",S[S.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",S[S.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",S[S.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",S[S.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",S[S.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",S[S.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",S[S.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",S[S.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",S[S.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",S[S.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",S[S.CDATA_SECTION=68]="CDATA_SECTION",S[S.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",S[S.CDATA_SECTION_END=70]="CDATA_SECTION_END",S[S.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",S[S.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND";let fs={DATA:V.DATA,RCDATA:V.RCDATA,RAWTEXT:V.RAWTEXT,SCRIPT_DATA:V.SCRIPT_DATA,PLAINTEXT:V.PLAINTEXT,CDATA_SECTION:V.CDATA_SECTION};function fa(e){return e>=D.LATIN_CAPITAL_A&&e<=D.LATIN_CAPITAL_Z}function fl(e){return e>=D.LATIN_SMALL_A&&e<=D.LATIN_SMALL_Z||fa(e)}function fc(e){return fl(e)||e>=D.DIGIT_0&&e<=D.DIGIT_9}function fd(e){return e===D.SPACE||e===D.LINE_FEED||e===D.TABULATION||e===D.FORM_FEED}function fu(e){return fd(e)||e===D.SOLIDUS||e===D.GREATER_THAN_SIGN}class fp{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=V.DATA,this.returnState=V.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new h5(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new h8(h6,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(R.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(R.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=function(e){if(e===D.NULL)return R.nullCharacterReference;if(e>1114111)return R.characterReferenceOutsideUnicodeRange;if(h1(e))return R.surrogateCharacterReference;if(h3(e))return R.noncharacterCharacterReference;if(h2(e)||e===D.CARRIAGE_RETURN)return R.controlCharacterReference;return null}(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;null==(r=(n=this.handler).onParseError)||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||null==e||e())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||null==n||n()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return!!this.preprocessor.endOfChunkHit&&(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0)}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return!!this.preprocessor.startsWith(e,t)&&(this._advanceBy(e.length-1),!0)}_createStartTagToken(){this.currentToken={type:L.START_TAG,tagName:"",tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:L.END_TAG,tagName:"",tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:L.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:L.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;let n=this.currentToken;null===h4(n,this.currentAttr.name)?(n.attrs.push(this.currentAttr),n.location&&this.currentLocation&&((null!=(e=(t=n.location).attrs)?e:t.attrs=Object.create(null))[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue())):this._err(R.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=ft(e.tagName),e.type===L.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(R.endTagWithAttributes),e.selfClosing&&this._err(R.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case L.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case L.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case L.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:L.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=fd(e)?L.WHITESPACE_CHARACTER:e===D.NULL?L.NULL_CHARACTER:L.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(L.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=V.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?H.Attribute:H.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===V.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case V.DATA:this._stateData(e);break;case V.RCDATA:this._stateRcdata(e);break;case V.RAWTEXT:this._stateRawtext(e);break;case V.SCRIPT_DATA:this._stateScriptData(e);break;case V.PLAINTEXT:this._statePlaintext(e);break;case V.TAG_OPEN:this._stateTagOpen(e);break;case V.END_TAG_OPEN:this._stateEndTagOpen(e);break;case V.TAG_NAME:this._stateTagName(e);break;case V.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case V.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case V.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case V.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case V.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case V.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case V.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case V.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case V.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case V.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case V.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case V.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case V.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case V.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case V.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case V.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case V.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case V.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case V.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case V.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case V.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case V.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case V.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case V.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case V.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case V.BOGUS_COMMENT:this._stateBogusComment(e);break;case V.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case V.COMMENT_START:this._stateCommentStart(e);break;case V.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case V.COMMENT:this._stateComment(e);break;case V.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case V.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case V.COMMENT_END:this._stateCommentEnd(e);break;case V.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case V.DOCTYPE:this._stateDoctype(e);break;case V.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case V.DOCTYPE_NAME:this._stateDoctypeName(e);break;case V.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case V.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case V.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case V.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case V.CDATA_SECTION:this._stateCdataSection(e);break;case V.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case V.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case V.CHARACTER_REFERENCE:this._stateCharacterReference();break;case V.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error("Unknown state")}}_stateData(e){switch(e){case D.LESS_THAN_SIGN:this.state=V.TAG_OPEN;break;case D.AMPERSAND:this._startCharacterReference();break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitCodePoint(e);break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case D.AMPERSAND:this._startCharacterReference();break;case D.LESS_THAN_SIGN:this.state=V.RCDATA_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case D.LESS_THAN_SIGN:this.state=V.RAWTEXT_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(fl(e))this._createStartTagToken(),this.state=V.TAG_NAME,this._stateTagName(e);else switch(e){case D.EXCLAMATION_MARK:this.state=V.MARKUP_DECLARATION_OPEN;break;case D.SOLIDUS:this.state=V.END_TAG_OPEN;break;case D.QUESTION_MARK:this._err(R.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e);break;case D.EOF:this._err(R.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break;default:this._err(R.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=V.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(fl(e))this._createEndTagToken(),this.state=V.TAG_NAME,this._stateTagName(e);else switch(e){case D.GREATER_THAN_SIGN:this._err(R.missingEndTagName),this.state=V.DATA;break;case D.EOF:this._err(R.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break;default:this._err(R.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_ATTRIBUTE_NAME;break;case D.SOLIDUS:this.state=V.SELF_CLOSING_START_TAG;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentTagToken();break;case D.NULL:this._err(R.unexpectedNullCharacter),t.tagName+="�";break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(fa(e)?e+32:e)}}_stateRcdataLessThanSign(e){e===D.SOLIDUS?this.state=V.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=V.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){fl(e)?(this.state=V.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=V.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();switch(this._createEndTagToken(),this.currentToken.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=V.BEFORE_ATTRIBUTE_NAME,!1;case D.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=V.SELF_CLOSING_START_TAG,!1;case D.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=V.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===D.SOLIDUS?this.state=V.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){fl(e)?(this.state=V.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case D.SOLIDUS:this.state=V.SCRIPT_DATA_END_TAG_OPEN;break;case D.EXCLAMATION_MARK:this.state=V.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break;default:this._emitChars("<"),this.state=V.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){fl(e)?(this.state=V.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===D.HYPHEN_MINUS?(this.state=V.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===D.HYPHEN_MINUS?(this.state=V.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=V.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case D.HYPHEN_MINUS:this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case D.GREATER_THAN_SIGN:this.state=V.SCRIPT_DATA,this._emitChars(">");break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===D.SOLIDUS?this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:fl(e)?(this._emitChars("<"),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){fl(e)?(this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(h0,!1)&&fu(this.preprocessor.peek(h0.length))){this._emitCodePoint(e);for(let e=0;e<h0.length;e++)this._emitCodePoint(this._consume());this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case D.NULL:this._err(R.unexpectedNullCharacter),this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case D.HYPHEN_MINUS:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case D.HYPHEN_MINUS:this._emitChars("-");break;case D.LESS_THAN_SIGN:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case D.GREATER_THAN_SIGN:this.state=V.SCRIPT_DATA,this._emitChars(">");break;case D.NULL:this._err(R.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case D.EOF:this._err(R.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===D.SOLIDUS?(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(h0,!1)&&fu(this.preprocessor.peek(h0.length))){this._emitCodePoint(e);for(let e=0;e<h0.length;e++)this._emitCodePoint(this._consume());this.state=V.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.SOLIDUS:case D.GREATER_THAN_SIGN:case D.EOF:this.state=V.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case D.EQUALS_SIGN:this._err(R.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=V.ATTRIBUTE_NAME;break;default:this._createAttr(""),this.state=V.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:case D.SOLIDUS:case D.GREATER_THAN_SIGN:case D.EOF:this._leaveAttrName(),this.state=V.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case D.EQUALS_SIGN:this._leaveAttrName(),this.state=V.BEFORE_ATTRIBUTE_VALUE;break;case D.QUOTATION_MARK:case D.APOSTROPHE:case D.LESS_THAN_SIGN:this._err(R.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.name+="�";break;default:this.currentAttr.name+=String.fromCodePoint(fa(e)?e+32:e)}}_stateAfterAttributeName(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.SOLIDUS:this.state=V.SELF_CLOSING_START_TAG;break;case D.EQUALS_SIGN:this.state=V.BEFORE_ATTRIBUTE_VALUE;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentTagToken();break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this._createAttr(""),this.state=V.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.QUOTATION_MARK:this.state=V.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case D.APOSTROPHE:this.state=V.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingAttributeValue),this.state=V.DATA,this.emitCurrentTagToken();break;default:this.state=V.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case D.QUOTATION_MARK:this.state=V.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case D.AMPERSAND:this._startCharacterReference();break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.value+="�";break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case D.APOSTROPHE:this.state=V.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case D.AMPERSAND:this._startCharacterReference();break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.value+="�";break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this._leaveAttrValue(),this.state=V.BEFORE_ATTRIBUTE_NAME;break;case D.AMPERSAND:this._startCharacterReference();break;case D.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=V.DATA,this.emitCurrentTagToken();break;case D.NULL:this._err(R.unexpectedNullCharacter),this.currentAttr.value+="�";break;case D.QUOTATION_MARK:case D.APOSTROPHE:case D.LESS_THAN_SIGN:case D.EQUALS_SIGN:case D.GRAVE_ACCENT:this._err(R.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this._leaveAttrValue(),this.state=V.BEFORE_ATTRIBUTE_NAME;break;case D.SOLIDUS:this._leaveAttrValue(),this.state=V.SELF_CLOSING_START_TAG;break;case D.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=V.DATA,this.emitCurrentTagToken();break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this._err(R.missingWhitespaceBetweenAttributes),this.state=V.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case D.GREATER_THAN_SIGN:this.currentToken.selfClosing=!0,this.state=V.DATA,this.emitCurrentTagToken();break;case D.EOF:this._err(R.eofInTag),this._emitEOFToken();break;default:this._err(R.unexpectedSolidusInTag),this.state=V.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentComment(t);break;case D.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case D.NULL:this._err(R.unexpectedNullCharacter),t.data+="�";break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch("--",!0)?(this._createCommentToken(3),this.state=V.COMMENT_START):this._consumeSequenceIfMatch(hZ,!1)?(this.currentLocation=this.getCurrentLocation(hZ.length+1),this.state=V.DOCTYPE):this._consumeSequenceIfMatch(hJ,!0)?this.inForeignNode?this.state=V.CDATA_SECTION:(this._err(R.cdataInHtmlContent),this._createCommentToken(hJ.length+1),this.currentToken.data="[CDATA[",this.state=V.BOGUS_COMMENT):this._ensureHibernation()||(this._err(R.incorrectlyOpenedComment),this._createCommentToken(2),this.state=V.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_START_DASH;break;case D.GREATER_THAN_SIGN:{this._err(R.abruptClosingOfEmptyComment),this.state=V.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=V.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_END;break;case D.GREATER_THAN_SIGN:this._err(R.abruptClosingOfEmptyComment),this.state=V.DATA,this.emitCurrentComment(t);break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=V.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_END_DASH;break;case D.LESS_THAN_SIGN:t.data+="<",this.state=V.COMMENT_LESS_THAN_SIGN;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.data+="�";break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case D.EXCLAMATION_MARK:t.data+="!",this.state=V.COMMENT_LESS_THAN_SIGN_BANG;break;case D.LESS_THAN_SIGN:t.data+="<";break;default:this.state=V.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===D.HYPHEN_MINUS?this.state=V.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=V.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===D.HYPHEN_MINUS?this.state=V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=V.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==D.GREATER_THAN_SIGN&&e!==D.EOF&&this._err(R.nestedComment),this.state=V.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:this.state=V.COMMENT_END;break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=V.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentComment(t);break;case D.EXCLAMATION_MARK:this.state=V.COMMENT_END_BANG;break;case D.HYPHEN_MINUS:t.data+="-";break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--",this.state=V.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case D.HYPHEN_MINUS:t.data+="--!",this.state=V.COMMENT_END_DASH;break;case D.GREATER_THAN_SIGN:this._err(R.incorrectlyClosedComment),this.state=V.DATA,this.emitCurrentComment(t);break;case D.EOF:this._err(R.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--!",this.state=V.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_DOCTYPE_NAME;break;case D.GREATER_THAN_SIGN:this.state=V.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case D.EOF:{this._err(R.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(R.missingWhitespaceBeforeDoctypeName),this.state=V.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(fa(e))this._createDoctypeToken(String.fromCharCode(e+32)),this.state=V.DOCTYPE_NAME;else switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.NULL:this._err(R.unexpectedNullCharacter),this._createDoctypeToken("�"),this.state=V.DOCTYPE_NAME;break;case D.GREATER_THAN_SIGN:{this._err(R.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=V.DATA;break}case D.EOF:{this._err(R.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=V.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.AFTER_DOCTYPE_NAME;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.NULL:this._err(R.unexpectedNullCharacter),t.name+="�";break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(fa(e)?e+32:e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch("public",!1)?this.state=V.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch("system",!1)?this.state=V.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(R.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case D.QUOTATION_MARK:this._err(R.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:this._err(R.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.QUOTATION_MARK:t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:t.publicId="",this.state=V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case D.QUOTATION_MARK:this.state=V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.publicId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case D.APOSTROPHE:this.state=V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.publicId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case D.GREATER_THAN_SIGN:this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.QUOTATION_MARK:this._err(R.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:this._err(R.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.QUOTATION_MARK:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:this.state=V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case D.QUOTATION_MARK:this._err(R.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:this._err(R.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.QUOTATION_MARK:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case D.APOSTROPHE:t.systemId="",this.state=V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case D.GREATER_THAN_SIGN:this._err(R.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.DATA,this.emitCurrentDoctype(t);break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case D.QUOTATION_MARK:this.state=V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.systemId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case D.APOSTROPHE:this.state=V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case D.NULL:this._err(R.unexpectedNullCharacter),t.systemId+="�";break;case D.GREATER_THAN_SIGN:this._err(R.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case D.SPACE:case D.LINE_FEED:case D.TABULATION:case D.FORM_FEED:break;case D.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.EOF:this._err(R.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(R.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=V.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case D.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=V.DATA;break;case D.NULL:this._err(R.unexpectedNullCharacter);break;case D.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case D.RIGHT_SQUARE_BRACKET:this.state=V.CDATA_SECTION_BRACKET;break;case D.EOF:this._err(R.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===D.RIGHT_SQUARE_BRACKET?this.state=V.CDATA_SECTION_END:(this._emitChars("]"),this.state=V.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case D.GREATER_THAN_SIGN:this.state=V.DATA;break;case D.RIGHT_SQUARE_BRACKET:this._emitChars("]");break;default:this._emitChars("]]"),this.state=V.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}0===e?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(D.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&fc(this.preprocessor.peek(1))?V.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){fc(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===D.SEMICOLON&&this._err(R.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}let fh=new Set([q.DD,q.DT,q.LI,q.OPTGROUP,q.OPTION,q.P,q.RB,q.RP,q.RT,q.RTC]),ff=new Set([...fh,q.CAPTION,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]),fm=new Set([q.APPLET,q.CAPTION,q.HTML,q.MARQUEE,q.OBJECT,q.TABLE,q.TD,q.TEMPLATE,q.TH]),fg=new Set([...fm,q.OL,q.UL]),fb=new Set([...fm,q.BUTTON]),fy=new Set([q.ANNOTATION_XML,q.MI,q.MN,q.MO,q.MS,q.MTEXT]),fx=new Set([q.DESC,q.FOREIGN_OBJECT,q.TITLE]),fv=new Set([q.TR,q.TEMPLATE,q.HTML]),fE=new Set([q.TBODY,q.TFOOT,q.THEAD,q.TEMPLATE,q.HTML]),fw=new Set([q.TABLE,q.TEMPLATE,q.HTML]),fk=new Set([q.TD,q.TH]);class fT{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=q.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===q.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===U.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&void 0!==this.currentTagId&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==U.HTML)this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(fi,U.HTML)}popUntilTableCellPopped(){this.popUntilPopped(fk,U.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return -1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(fw,U.HTML)}clearBackToTableBodyContext(){this.clearBackTo(fE,U.HTML)}clearBackToTableRowContext(){this.clearBackTo(fv,U.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===q.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.tagIDs[0]===q.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case U.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case U.SVG:if(fx.has(r))return!1;break;case U.MATHML:if(fy.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,fm)}hasInListItemScope(e){return this.hasInDynamicScope(e,fg)}hasInButtonScope(e){return this.hasInDynamicScope(e,fb)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case U.HTML:if(fi.has(t))return!0;if(fm.has(t))return!1;break;case U.SVG:if(fx.has(t))return!1;break;case U.MATHML:if(fy.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===U.HTML)switch(this.tagIDs[t]){case e:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===U.HTML)switch(this.tagIDs[e]){case q.TBODY:case q.THEAD:case q.TFOOT:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===U.HTML)switch(this.tagIDs[t]){case e:return!0;case q.OPTION:case q.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;void 0!==this.currentTagId&&fh.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;void 0!==this.currentTagId&&ff.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;void 0!==this.currentTagId&&this.currentTagId!==e&&ff.has(this.currentTagId);)this.pop()}}(C=W||(W={}))[C.Marker=0]="Marker",C[C.Element=1]="Element";let fN={type:W.Marker};class fA{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),o=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===W.Marker)break;let{element:s}=t;if(this.treeAdapter.getTagName(s)===i&&this.treeAdapter.getNamespaceURI(s)===o){let t=this.treeAdapter.getAttrList(s);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<3)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<3)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1)>=3&&this.entries.splice(t.idx,1)}}insertMarker(){this.entries.unshift(fN)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:W.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:W.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);-1!==t&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(fN);-1===e?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===W.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===W.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===W.Element&&t.element===e)}}let fS={createDocument:()=>({nodeName:"#document",mode:$.NO_QUIRKS,childNodes:[]}),createDocumentFragment:()=>({nodeName:"#document-fragment",childNodes:[]}),createElement:(e,t,n)=>({nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}),createCommentNode:e=>({nodeName:"#comment",data:e,parentNode:null}),createTextNode:e=>({nodeName:"#text",value:e,parentNode:null}),appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent:e=>e.content,setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>"#documentType"===e.nodeName);i?(i.name=t,i.publicId=n,i.systemId=r):fS.appendChild(e,{nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null})},setDocumentMode(e,t){e.mode=t},getDocumentMode:e=>e.mode,detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(fS.isTextNode(n)){n.value+=t;return}}fS.appendChild(e,fS.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&fS.isTextNode(r)?r.value+=t:fS.insertBefore(e,fS.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild:e=>e.childNodes[0],getChildNodes:e=>e.childNodes,getParentNode:e=>e.parentNode,getAttrList:e=>e.attrs,getTagName:e=>e.tagName,getNamespaceURI:e=>e.namespaceURI,getTextNodeContent:e=>e.value,getCommentNodeContent:e=>e.data,getDocumentTypeNodeName:e=>e.name,getDocumentTypeNodePublicId:e=>e.publicId,getDocumentTypeNodeSystemId:e=>e.systemId,isTextNode:e=>"#text"===e.nodeName,isCommentNode:e=>"#comment"===e.nodeName,isDocumentTypeNode:e=>"#documentType"===e.nodeName,isElementNode:e=>Object.prototype.hasOwnProperty.call(e,"tagName"),setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation:e=>e.sourceCodeLocation,updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},fC="html",f_=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],fM=[...f_,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],fO=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),fI=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],fD=[...fI,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function fR(e,t){return t.some(t=>e.startsWith(t))}let fL=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),fP=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:U.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:U.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:U.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:U.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:U.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:U.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:U.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:U.XML}],["xml:space",{prefix:"xml",name:"space",namespace:U.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:U.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:U.XMLNS}]]),fj=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),fB=new Set([q.B,q.BIG,q.BLOCKQUOTE,q.BODY,q.BR,q.CENTER,q.CODE,q.DD,q.DIV,q.DL,q.DT,q.EM,q.EMBED,q.H1,q.H2,q.H3,q.H4,q.H5,q.H6,q.HEAD,q.HR,q.I,q.IMG,q.LI,q.LISTING,q.MENU,q.META,q.NOBR,q.OL,q.P,q.PRE,q.RUBY,q.S,q.SMALL,q.SPAN,q.STRONG,q.STRIKE,q.SUB,q.SUP,q.TABLE,q.TT,q.U,q.UL,q.VAR]);function fF(e){for(let t=0;t<e.attrs.length;t++)if("definitionurl"===e.attrs[t].name){e.attrs[t].name="definitionURL";break}}function fH(e){for(let t=0;t<e.attrs.length;t++){let n=fL.get(e.attrs[t].name);null!=n&&(e.attrs[t].name=n)}}function fU(e){for(let t=0;t<e.attrs.length;t++){let n=fP.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}(_=K||(K={}))[_.INITIAL=0]="INITIAL",_[_.BEFORE_HTML=1]="BEFORE_HTML",_[_.BEFORE_HEAD=2]="BEFORE_HEAD",_[_.IN_HEAD=3]="IN_HEAD",_[_.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",_[_.AFTER_HEAD=5]="AFTER_HEAD",_[_.IN_BODY=6]="IN_BODY",_[_.TEXT=7]="TEXT",_[_.IN_TABLE=8]="IN_TABLE",_[_.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",_[_.IN_CAPTION=10]="IN_CAPTION",_[_.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",_[_.IN_TABLE_BODY=12]="IN_TABLE_BODY",_[_.IN_ROW=13]="IN_ROW",_[_.IN_CELL=14]="IN_CELL",_[_.IN_SELECT=15]="IN_SELECT",_[_.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",_[_.IN_TEMPLATE=17]="IN_TEMPLATE",_[_.AFTER_BODY=18]="AFTER_BODY",_[_.IN_FRAMESET=19]="IN_FRAMESET",_[_.AFTER_FRAMESET=20]="AFTER_FRAMESET",_[_.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",_[_.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET";let fz={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},f$=new Set([q.TABLE,q.TBODY,q.TFOOT,q.THEAD,q.TR]),fG={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:fS,onParseError:null};class fq{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=K.INITIAL,this.originalInsertionMode=K.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...fG,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=null!=t?t:this.treeAdapter.createDocument(),this.tokenizer=new fp(this.options,this),this.activeFormattingElements=new fA(this.treeAdapter),this.fragmentContextID=n?ft(this.treeAdapter.getTagName(n)):q.UNKNOWN,this._setContextModes(null!=n?n:this.document,this.fragmentContextID),this.openElements=new fT(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...fG,...t};null!=e||(e=n.treeAdapter.createElement(G.TEMPLATE,U.HTML,[]));let r=n.treeAdapter.createElement("documentmock",U.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===q.TEMPLATE&&i.tmplInsertionModeStack.unshift(K.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){var r;if(!this.onParseError)return;let i=null!=(r=e.location)?r:fz,o={code:t,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:n?i.startLine:i.endLine,endCol:n?i.startCol:i.endCol,endOffset:n?i.startOffset:i.endOffset};this.onParseError(o)}onItemPush(e,t,n){var r,i;null==(i=(r=this.treeAdapter).onItemPush)||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),null==(r=(n=this.treeAdapter).onItemPop)||r.call(n,e,this.openElements.current),t){let e,t;0===this.openElements.stackTop&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===U.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&void 0!==e&&void 0!==t&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,U.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=K.TEXT}switchToPlaintextParsing(){this.insertionMode=K.TEXT,this.originalInsertionMode=K.IN_BODY,this.tokenizer.state=fs.PLAINTEXT}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===G.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===U.HTML)switch(this.fragmentContextID){case q.TITLE:case q.TEXTAREA:this.tokenizer.state=fs.RCDATA;break;case q.STYLE:case q.XMP:case q.IFRAME:case q.NOEMBED:case q.NOFRAMES:case q.NOSCRIPT:this.tokenizer.state=fs.RAWTEXT;break;case q.SCRIPT:this.tokenizer.state=fs.SCRIPT_DATA;break;case q.PLAINTEXT:this.tokenizer.state=fs.PLAINTEXT}}_setDocumentType(e){let t=e.name||"",n=e.publicId||"",r=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(null!=t?t:this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,U.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,U.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(G.HTML,U.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,q.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=n?r.lastIndexOf(n):r.length,o=r[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===L.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){let t,n;return!!this.currentNotInHTML&&(0===this.openElements.stackTop&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,(e.tagID!==q.SVG||this.treeAdapter.getTagName(t)!==G.ANNOTATION_XML||this.treeAdapter.getNamespaceURI(t)!==U.MATHML)&&(this.tokenizer.inForeignNode||(e.tagID===q.MGLYPH||e.tagID===q.MALIGNMARK)&&void 0!==n&&!this._isIntegrationPoint(n,t,U.HTML)))}_processToken(e){switch(e.type){case L.CHARACTER:this.onCharacter(e);break;case L.NULL_CHARACTER:this.onNullCharacter(e);break;case L.COMMENT:this.onComment(e);break;case L.DOCTYPE:this.onDoctype(e);break;case L.START_TAG:this._processStartTag(e);break;case L.END_TAG:this.onEndTag(e);break;case L.EOF:this.onEof(e);break;case L.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){let r=this.treeAdapter.getNamespaceURI(t),i=this.treeAdapter.getAttrList(t);return(!n||n===U.HTML)&&function(e,t,n){if(t===U.MATHML&&e===q.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===z.ENCODING){let t=n[e].value.toLowerCase();return"text/html"===t||"application/xhtml+xml"===t}}return t===U.SVG&&(e===q.FOREIGN_OBJECT||e===q.DESC||e===q.TITLE)}(e,r,i)||(!n||n===U.MATHML)&&r===U.MATHML&&(e===q.MI||e===q.MO||e===q.MN||e===q.MS||e===q.MTEXT)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===W.Marker||this.openElements.contains(e.element)),n=-1===t?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=K.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(q.P),this.openElements.popUntilTagNamePopped(q.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(0===e&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case q.TR:this.insertionMode=K.IN_ROW;return;case q.TBODY:case q.THEAD:case q.TFOOT:this.insertionMode=K.IN_TABLE_BODY;return;case q.CAPTION:this.insertionMode=K.IN_CAPTION;return;case q.COLGROUP:this.insertionMode=K.IN_COLUMN_GROUP;return;case q.TABLE:this.insertionMode=K.IN_TABLE;return;case q.BODY:this.insertionMode=K.IN_BODY;return;case q.FRAMESET:this.insertionMode=K.IN_FRAMESET;return;case q.SELECT:return void this._resetInsertionModeForSelect(e);case q.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case q.HTML:this.insertionMode=this.headElement?K.AFTER_HEAD:K.BEFORE_HEAD;return;case q.TD:case q.TH:if(e>0){this.insertionMode=K.IN_CELL;return}break;case q.HEAD:if(e>0){this.insertionMode=K.IN_HEAD;return}}this.insertionMode=K.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===q.TEMPLATE)break;if(e===q.TABLE){this.insertionMode=K.IN_SELECT_IN_TABLE;return}}this.insertionMode=K.IN_SELECT}_isElementCausesFosterParenting(e){return f$.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&void 0!==this.openElements.currentTagId&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case q.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===U.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case q.TABLE:{let n=this.treeAdapter.getParentNode(t);if(n)return{parent:n,beforeElement:t};return{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return fr[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){var t,n;return void(t=this,n=e,t._insertCharacters(n),t.framesetOk=!1)}switch(this.insertionMode){case K.INITIAL:fY(this,e);break;case K.BEFORE_HTML:fX(this,e);break;case K.BEFORE_HEAD:fQ(this,e);break;case K.IN_HEAD:f0(this,e);break;case K.IN_HEAD_NO_SCRIPT:f1(this,e);break;case K.AFTER_HEAD:f2(this,e);break;case K.IN_BODY:case K.IN_CAPTION:case K.IN_CELL:case K.IN_TEMPLATE:f4(this,e);break;case K.TEXT:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case K.IN_TABLE:case K.IN_TABLE_BODY:case K.IN_ROW:mi(this,e);break;case K.IN_TABLE_TEXT:mc(this,e);break;case K.IN_COLUMN_GROUP:mh(this,e);break;case K.AFTER_BODY:mw(this,e);break;case K.AFTER_AFTER_BODY:mk(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){var t,n;return void(t=this,(n=e).chars="�",t._insertCharacters(n))}switch(this.insertionMode){case K.INITIAL:fY(this,e);break;case K.BEFORE_HTML:fX(this,e);break;case K.BEFORE_HEAD:fQ(this,e);break;case K.IN_HEAD:f0(this,e);break;case K.IN_HEAD_NO_SCRIPT:f1(this,e);break;case K.AFTER_HEAD:f2(this,e);break;case K.TEXT:this._insertCharacters(e);break;case K.IN_TABLE:case K.IN_TABLE_BODY:case K.IN_ROW:mi(this,e);break;case K.IN_COLUMN_GROUP:mh(this,e);break;case K.AFTER_BODY:mw(this,e);break;case K.AFTER_AFTER_BODY:mk(this,e)}}onComment(e){var t,n,r,i;if(this.skipNextNewLine=!1,this.currentNotInHTML)return void fW(this,e);switch(this.insertionMode){case K.INITIAL:case K.BEFORE_HTML:case K.BEFORE_HEAD:case K.IN_HEAD:case K.IN_HEAD_NO_SCRIPT:case K.AFTER_HEAD:case K.IN_BODY:case K.IN_TABLE:case K.IN_CAPTION:case K.IN_COLUMN_GROUP:case K.IN_TABLE_BODY:case K.IN_ROW:case K.IN_CELL:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:case K.IN_TEMPLATE:case K.IN_FRAMESET:case K.AFTER_FRAMESET:fW(this,e);break;case K.IN_TABLE_TEXT:md(this,e);break;case K.AFTER_BODY:t=this,n=e,t._appendCommentNode(n,t.openElements.items[0]);break;case K.AFTER_AFTER_BODY:case K.AFTER_AFTER_FRAMESET:r=this,i=e,r._appendCommentNode(i,r.document)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case K.INITIAL:!function(e,t){e._setDocumentType(t);let n=t.forceQuirks?$.QUIRKS:function(e){if(e.name!==fC)return $.QUIRKS;let{systemId:t}=e;if(t&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===t.toLowerCase())return $.QUIRKS;let{publicId:n}=e;if(null!==n){if(n=n.toLowerCase(),fO.has(n))return $.QUIRKS;let e=null===t?fM:f_;if(fR(n,e))return $.QUIRKS;if(fR(n,e=null===t?fI:fD))return $.LIMITED_QUIRKS}return $.NO_QUIRKS}(t);(t.name!==fC||null!==t.publicId||null!==t.systemId&&"about:legacy-compat"!==t.systemId)&&e._err(t,R.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=K.BEFORE_HTML}(this,e);break;case K.BEFORE_HEAD:case K.IN_HEAD:case K.IN_HEAD_NO_SCRIPT:case K.AFTER_HEAD:this._err(e,R.misplacedDoctype);break;case K.IN_TABLE_TEXT:md(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,R.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?function(e,t){let n;if((n=t.tagID)===q.FONT&&t.attrs.some(({name:e})=>e===z.COLOR||e===z.SIZE||e===z.FACE)||fB.has(n))mT(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);if(r===U.MATHML)fF(t);else if(r===U.SVG){let e;null!=(e=fj.get(t.tagName))&&(t.tagName=e,t.tagID=ft(t.tagName)),fH(t)}fU(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case K.INITIAL:fY(this,e);break;case K.BEFORE_HTML:t=this,(n=e).tagID===q.HTML?(t._insertElement(n,U.HTML),t.insertionMode=K.BEFORE_HEAD):fX(t,n);break;case K.BEFORE_HEAD:var t,n,r,i,o,s,a,l,c,d,u,p,h=this,f=e;switch(f.tagID){case q.HTML:me(h,f);break;case q.HEAD:h._insertElement(f,U.HTML),h.headElement=h.openElements.current,h.insertionMode=K.IN_HEAD;break;default:fQ(h,f)}break;case K.IN_HEAD:fJ(this,e);break;case K.IN_HEAD_NO_SCRIPT:var m=this,g=e;switch(g.tagID){case q.HTML:me(m,g);break;case q.BASEFONT:case q.BGSOUND:case q.HEAD:case q.LINK:case q.META:case q.NOFRAMES:case q.STYLE:fJ(m,g);break;case q.NOSCRIPT:m._err(g,R.nestedNoscriptInHead);break;default:f1(m,g)}break;case K.AFTER_HEAD:var b=this,y=e;switch(y.tagID){case q.HTML:me(b,y);break;case q.BODY:b._insertElement(y,U.HTML),b.framesetOk=!1,b.insertionMode=K.IN_BODY;break;case q.FRAMESET:b._insertElement(y,U.HTML),b.insertionMode=K.IN_FRAMESET;break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:b._err(y,R.abandonedHeadElementChild),b.openElements.push(b.headElement,q.HEAD),fJ(b,y),b.openElements.remove(b.headElement);break;case q.HEAD:b._err(y,R.misplacedStartTagForHeadElement);break;default:f2(b,y)}break;case K.IN_BODY:me(this,e);break;case K.IN_TABLE:mo(this,e);break;case K.IN_TABLE_TEXT:md(this,e);break;case K.IN_CAPTION:let x;r=this,x=(i=e).tagID,mu.has(x)?r.openElements.hasInTableScope(q.CAPTION)&&(r.openElements.generateImpliedEndTags(),r.openElements.popUntilTagNamePopped(q.CAPTION),r.activeFormattingElements.clearToLastMarker(),r.insertionMode=K.IN_TABLE,mo(r,i)):me(r,i);break;case K.IN_COLUMN_GROUP:mp(this,e);break;case K.IN_TABLE_BODY:mf(this,e);break;case K.IN_ROW:mg(this,e);break;case K.IN_CELL:let v;o=this,v=(s=e).tagID,mu.has(v)?(o.openElements.hasInTableScope(q.TD)||o.openElements.hasInTableScope(q.TH))&&(o._closeTableCell(),mg(o,s)):me(o,s);break;case K.IN_SELECT:my(this,e);break;case K.IN_SELECT_IN_TABLE:let E;a=this,(E=(l=e).tagID)===q.CAPTION||E===q.TABLE||E===q.TBODY||E===q.TFOOT||E===q.THEAD||E===q.TR||E===q.TD||E===q.TH?(a.openElements.popUntilTagNamePopped(q.SELECT),a._resetInsertionMode(),a._processStartTag(l)):my(a,l);break;case K.IN_TEMPLATE:var w=this,k=e;switch(k.tagID){case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:fJ(w,k);break;case q.CAPTION:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:w.tmplInsertionModeStack[0]=K.IN_TABLE,w.insertionMode=K.IN_TABLE,mo(w,k);break;case q.COL:w.tmplInsertionModeStack[0]=K.IN_COLUMN_GROUP,w.insertionMode=K.IN_COLUMN_GROUP,mp(w,k);break;case q.TR:w.tmplInsertionModeStack[0]=K.IN_TABLE_BODY,w.insertionMode=K.IN_TABLE_BODY,mf(w,k);break;case q.TD:case q.TH:w.tmplInsertionModeStack[0]=K.IN_ROW,w.insertionMode=K.IN_ROW,mg(w,k);break;default:w.tmplInsertionModeStack[0]=K.IN_BODY,w.insertionMode=K.IN_BODY,me(w,k)}break;case K.AFTER_BODY:c=this,(d=e).tagID===q.HTML?me(c,d):mw(c,d);break;case K.IN_FRAMESET:var T=this,N=e;switch(N.tagID){case q.HTML:me(T,N);break;case q.FRAMESET:T._insertElement(N,U.HTML);break;case q.FRAME:T._appendElement(N,U.HTML),N.ackSelfClosing=!0;break;case q.NOFRAMES:fJ(T,N)}break;case K.AFTER_FRAMESET:var A=this,S=e;switch(S.tagID){case q.HTML:me(A,S);break;case q.NOFRAMES:fJ(A,S)}break;case K.AFTER_AFTER_BODY:u=this,(p=e).tagID===q.HTML?me(u,p):mk(u,p);break;case K.AFTER_AFTER_FRAMESET:var C=this,_=e;switch(_.tagID){case q.HTML:me(C,_);break;case q.NOFRAMES:fJ(C,_)}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?function(e,t){if(t.tagID===q.P||t.tagID===q.BR){mT(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===U.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case K.INITIAL:fY(this,e);break;case K.BEFORE_HTML:let t;r=this,((t=(i=e).tagID)===q.HTML||t===q.HEAD||t===q.BODY||t===q.BR)&&fX(r,i);break;case K.BEFORE_HEAD:let n;o=this,(n=(s=e).tagID)===q.HEAD||n===q.BODY||n===q.HTML||n===q.BR?fQ(o,s):o._err(s,R.endTagWithoutMatchingOpenElement);break;case K.IN_HEAD:var r,i,o,s,a,l,c,d,u,p,h,f,m=this,g=e;switch(g.tagID){case q.HEAD:m.openElements.pop(),m.insertionMode=K.AFTER_HEAD;break;case q.BODY:case q.BR:case q.HTML:f0(m,g);break;case q.TEMPLATE:fZ(m,g);break;default:m._err(g,R.endTagWithoutMatchingOpenElement)}break;case K.IN_HEAD_NO_SCRIPT:var b=this,y=e;switch(y.tagID){case q.NOSCRIPT:b.openElements.pop(),b.insertionMode=K.IN_HEAD;break;case q.BR:f1(b,y);break;default:b._err(y,R.endTagWithoutMatchingOpenElement)}break;case K.AFTER_HEAD:var x=this,v=e;switch(v.tagID){case q.BODY:case q.HTML:case q.BR:f2(x,v);break;case q.TEMPLATE:fZ(x,v);break;default:x._err(v,R.endTagWithoutMatchingOpenElement)}break;case K.IN_BODY:mn(this,e);break;case K.TEXT:a=this,e.tagID===q.SCRIPT&&(null==(l=a.scriptHandler)||l.call(a,a.openElements.current)),a.openElements.pop(),a.insertionMode=a.originalInsertionMode;break;case K.IN_TABLE:ms(this,e);break;case K.IN_TABLE_TEXT:md(this,e);break;case K.IN_CAPTION:var E=this,w=e;let k=w.tagID;switch(k){case q.CAPTION:case q.TABLE:E.openElements.hasInTableScope(q.CAPTION)&&(E.openElements.generateImpliedEndTags(),E.openElements.popUntilTagNamePopped(q.CAPTION),E.activeFormattingElements.clearToLastMarker(),E.insertionMode=K.IN_TABLE,k===q.TABLE&&ms(E,w));break;case q.BODY:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:mn(E,w)}break;case K.IN_COLUMN_GROUP:var T=this,N=e;switch(N.tagID){case q.COLGROUP:T.openElements.currentTagId===q.COLGROUP&&(T.openElements.pop(),T.insertionMode=K.IN_TABLE);break;case q.TEMPLATE:fZ(T,N);break;case q.COL:break;default:mh(T,N)}break;case K.IN_TABLE_BODY:mm(this,e);break;case K.IN_ROW:mb(this,e);break;case K.IN_CELL:var A=this,S=e;let C=S.tagID;switch(C){case q.TD:case q.TH:A.openElements.hasInTableScope(C)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(C),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=K.IN_ROW);break;case q.TABLE:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:A.openElements.hasInTableScope(C)&&(A._closeTableCell(),mb(A,S));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:break;default:mn(A,S)}break;case K.IN_SELECT:mx(this,e);break;case K.IN_SELECT_IN_TABLE:let _;c=this,(_=(d=e).tagID)===q.CAPTION||_===q.TABLE||_===q.TBODY||_===q.TFOOT||_===q.THEAD||_===q.TR||_===q.TD||_===q.TH?c.openElements.hasInTableScope(_)&&(c.openElements.popUntilTagNamePopped(q.SELECT),c._resetInsertionMode(),c.onEndTag(d)):mx(c,d);break;case K.IN_TEMPLATE:u=this,(p=e).tagID===q.TEMPLATE&&fZ(u,p);break;case K.AFTER_BODY:mE(this,e);break;case K.IN_FRAMESET:h=this,e.tagID===q.FRAMESET&&!h.openElements.isRootHtmlElementCurrent()&&(h.openElements.pop(),h.fragmentContext||h.openElements.currentTagId===q.FRAMESET||(h.insertionMode=K.AFTER_FRAMESET));break;case K.AFTER_FRAMESET:f=this,e.tagID===q.HTML&&(f.insertionMode=K.AFTER_AFTER_FRAMESET);break;case K.AFTER_AFTER_BODY:mk(this,e)}}onEof(e){switch(this.insertionMode){case K.INITIAL:fY(this,e);break;case K.BEFORE_HTML:fX(this,e);break;case K.BEFORE_HEAD:fQ(this,e);break;case K.IN_HEAD:f0(this,e);break;case K.IN_HEAD_NO_SCRIPT:f1(this,e);break;case K.AFTER_HEAD:f2(this,e);break;case K.IN_BODY:case K.IN_TABLE:case K.IN_CAPTION:case K.IN_COLUMN_GROUP:case K.IN_TABLE_BODY:case K.IN_ROW:case K.IN_CELL:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:mr(this,e);break;case K.TEXT:var t,n;t=this,n=e,t._err(n,R.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(n);break;case K.IN_TABLE_TEXT:md(this,e);break;case K.IN_TEMPLATE:mv(this,e);break;case K.AFTER_BODY:case K.IN_FRAMESET:case K.AFTER_FRAMESET:case K.AFTER_AFTER_BODY:case K.AFTER_AFTER_FRAMESET:fK(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===D.LINE_FEED)){if(1===e.chars.length)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode)return void this._insertCharacters(e);switch(this.insertionMode){case K.IN_HEAD:case K.IN_HEAD_NO_SCRIPT:case K.AFTER_HEAD:case K.TEXT:case K.IN_COLUMN_GROUP:case K.IN_SELECT:case K.IN_SELECT_IN_TABLE:case K.IN_FRAMESET:case K.AFTER_FRAMESET:this._insertCharacters(e);break;case K.IN_BODY:case K.IN_CAPTION:case K.IN_CELL:case K.IN_TEMPLATE:case K.AFTER_BODY:case K.AFTER_AFTER_BODY:case K.AFTER_AFTER_FRAMESET:f5(this,e);break;case K.IN_TABLE:case K.IN_TABLE_BODY:case K.IN_ROW:mi(this,e);break;case K.IN_TABLE_TEXT:ml(this,e)}}}function fV(e,t){for(let n=0;n<8;n++){let n=function(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):mt(e,t),n}(e,t);if(!n)break;let r=function(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=function(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let o=0,s=i;s!==n;o++,s=i){i=e.openElements.getCommonAncestor(s);let n=e.activeFormattingElements.getElementEntry(s),a=n&&o>=3;!n||a?(a&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(s)):(s=function(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(s,r),r=s)}return r}(e,r,n.element),o=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),o&&function(e,t,n){let r=ft(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===q.TEMPLATE&&i===U.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}(e,o,i),function(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,o=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,o),e.treeAdapter.appendChild(t,o),e.activeFormattingElements.insertElementAfterBookmark(o,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,o,i.tagID)}(e,r,n)}}function fW(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function fK(e,t){if(e.stopped=!0,t.location){let n=2*!e.fragmentContext;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function fY(e,t){e._err(t,R.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,$.QUIRKS),e.insertionMode=K.BEFORE_HTML,e._processToken(t)}function fX(e,t){e._insertFakeRootElement(),e.insertionMode=K.BEFORE_HEAD,e._processToken(t)}function fQ(e,t){e._insertFakeElement(G.HEAD,q.HEAD),e.headElement=e.openElements.current,e.insertionMode=K.IN_HEAD,e._processToken(t)}function fJ(e,t){switch(t.tagID){case q.HTML:me(e,t);break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.TITLE:e._switchToTextParsing(t,fs.RCDATA);break;case q.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,fs.RAWTEXT):(e._insertElement(t,U.HTML),e.insertionMode=K.IN_HEAD_NO_SCRIPT);break;case q.NOFRAMES:case q.STYLE:e._switchToTextParsing(t,fs.RAWTEXT);break;case q.SCRIPT:e._switchToTextParsing(t,fs.SCRIPT_DATA);break;case q.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=K.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(K.IN_TEMPLATE);break;case q.HEAD:e._err(t,R.misplacedStartTagForHeadElement);break;default:f0(e,t)}}function fZ(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==q.TEMPLATE&&e._err(t,R.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,R.endTagWithoutMatchingOpenElement)}function f0(e,t){e.openElements.pop(),e.insertionMode=K.AFTER_HEAD,e._processToken(t)}function f1(e,t){let n=t.type===L.EOF?R.openElementsLeftAfterEof:R.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=K.IN_HEAD,e._processToken(t)}function f2(e,t){e._insertFakeElement(G.BODY,q.BODY),e.insertionMode=K.IN_BODY,f3(e,t)}function f3(e,t){switch(t.type){case L.CHARACTER:f4(e,t);break;case L.WHITESPACE_CHARACTER:f5(e,t);break;case L.COMMENT:fW(e,t);break;case L.START_TAG:me(e,t);break;case L.END_TAG:mn(e,t);break;case L.EOF:mr(e,t)}}function f5(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function f4(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function f6(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,U.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function f9(e){let t=h4(e,z.TYPE);return null!=t&&"hidden"===t.toLowerCase()}function f7(e,t){e._switchToTextParsing(t,fs.RAWTEXT)}function f8(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML)}function me(e,t){switch(t.tagID){case q.I:case q.S:case q.B:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.SMALL:case q.STRIKE:case q.STRONG:e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);break;case q.A:let n;(n=e.activeFormattingElements.getElementEntryInScopeWithTagName(G.A))&&(fV(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),void 0!==e.openElements.currentTagId&&fi.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,U.HTML);break;case q.P:case q.DL:case q.OL:case q.UL:case q.DIV:case q.DIR:case q.NAV:case q.MAIN:case q.MENU:case q.ASIDE:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.DETAILS:case q.ADDRESS:case q.ARTICLE:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML);break;case q.LI:case q.DD:case q.DT:e.framesetOk=!1;let r=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let n=e.openElements.tagIDs[t];if(r===q.LI&&n===q.LI||(r===q.DD||r===q.DT)&&(n===q.DD||n===q.DT)){e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n);break}if(n!==q.ADDRESS&&n!==q.DIV&&n!==q.P&&e._isSpecialElement(e.openElements.items[t],n))break}e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML);break;case q.BR:case q.IMG:case q.WBR:case q.AREA:case q.EMBED:case q.KEYGEN:f6(e,t);break;case q.HR:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._appendElement(t,U.HTML),e.framesetOk=!1,t.ackSelfClosing=!0;break;case q.RB:case q.RTC:e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,U.HTML);break;case q.RT:case q.RP:e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(q.RTC),e._insertElement(t,U.HTML);break;case q.PRE:case q.LISTING:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),e.skipNextNewLine=!0,e.framesetOk=!1;break;case q.XMP:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,fs.RAWTEXT);break;case q.SVG:e._reconstructActiveFormattingElements(),fH(t),fU(t),t.selfClosing?e._appendElement(t,U.SVG):e._insertElement(t,U.SVG),t.ackSelfClosing=!0;break;case q.HTML:0===e.openElements.tmplCount&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs);break;case q.BASE:case q.LINK:case q.META:case q.STYLE:case q.TITLE:case q.SCRIPT:case q.BGSOUND:case q.BASEFONT:case q.TEMPLATE:fJ(e,t);break;case q.BODY:let i;(i=e.openElements.tryPeekProperlyNestedBodyElement())&&0===e.openElements.tmplCount&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(i,t.attrs));break;case q.FORM:let o;o=e.openElements.tmplCount>0,(!e.formElement||o)&&(e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),o||(e.formElement=e.openElements.current));break;case q.NOBR:e._reconstructActiveFormattingElements(),e.openElements.hasInScope(q.NOBR)&&(fV(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,U.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t);break;case q.MATH:e._reconstructActiveFormattingElements(),fF(t),fU(t),t.selfClosing?e._appendElement(t,U.MATHML):e._insertElement(t,U.MATHML),t.ackSelfClosing=!0;break;case q.TABLE:e.treeAdapter.getDocumentMode(e.document)!==$.QUIRKS&&e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),e.framesetOk=!1,e.insertionMode=K.IN_TABLE;break;case q.INPUT:e._reconstructActiveFormattingElements(),e._appendElement(t,U.HTML),f9(t)||(e.framesetOk=!1),t.ackSelfClosing=!0;break;case q.PARAM:case q.TRACK:case q.SOURCE:e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.IMAGE:t.tagName=G.IMG,t.tagID=q.IMG,f6(e,t);break;case q.BUTTON:e.openElements.hasInScope(q.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.framesetOk=!1;break;case q.APPLET:case q.OBJECT:case q.MARQUEE:e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1;break;case q.IFRAME:e.framesetOk=!1,e._switchToTextParsing(t,fs.RAWTEXT);break;case q.SELECT:e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===K.IN_TABLE||e.insertionMode===K.IN_CAPTION||e.insertionMode===K.IN_TABLE_BODY||e.insertionMode===K.IN_ROW||e.insertionMode===K.IN_CELL?K.IN_SELECT_IN_TABLE:K.IN_SELECT;break;case q.OPTION:case q.OPTGROUP:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,U.HTML);break;case q.NOEMBED:case q.NOFRAMES:f7(e,t);break;case q.FRAMESET:let s;s=e.openElements.tryPeekProperlyNestedBodyElement(),e.framesetOk&&s&&(e.treeAdapter.detachNode(s),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_FRAMESET);break;case q.TEXTAREA:e._insertElement(t,U.HTML),e.skipNextNewLine=!0,e.tokenizer.state=fs.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=K.TEXT;break;case q.NOSCRIPT:e.options.scriptingEnabled?f7(e,t):f8(e,t);break;case q.PLAINTEXT:e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,U.HTML),e.tokenizer.state=fs.PLAINTEXT;break;case q.COL:case q.TH:case q.TD:case q.TR:case q.HEAD:case q.FRAME:case q.TBODY:case q.TFOOT:case q.THEAD:case q.CAPTION:case q.COLGROUP:break;default:f8(e,t)}}function mt(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],o=e.openElements.tagIDs[t];if(r===o&&(r!==q.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,o))break}}function mn(e,t){switch(t.tagID){case q.A:case q.B:case q.I:case q.S:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.NOBR:case q.SMALL:case q.STRIKE:case q.STRONG:fV(e,t);break;case q.P:e.openElements.hasInButtonScope(q.P)||e._insertFakeElement(G.P,q.P),e._closePElement();break;case q.DL:case q.UL:case q.OL:case q.DIR:case q.DIV:case q.NAV:case q.PRE:case q.MAIN:case q.MENU:case q.ASIDE:case q.BUTTON:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.ADDRESS:case q.ARTICLE:case q.DETAILS:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.LISTING:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:let n;n=t.tagID,e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n));break;case q.LI:e.openElements.hasInListItemScope(q.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(q.LI),e.openElements.popUntilTagNamePopped(q.LI));break;case q.DD:case q.DT:let r;r=t.tagID,e.openElements.hasInScope(r)&&(e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r));break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped());break;case q.BR:e._reconstructActiveFormattingElements(),e._insertFakeElement(G.BR,q.BR),e.openElements.pop(),e.framesetOk=!1;break;case q.BODY:if(e.openElements.hasInScope(q.BODY)&&(e.insertionMode=K.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}break;case q.HTML:e.openElements.hasInScope(q.BODY)&&(e.insertionMode=K.AFTER_BODY,mE(e,t));break;case q.FORM:!function(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(q.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(q.FORM):n&&e.openElements.remove(n))}(e);break;case q.APPLET:case q.OBJECT:case q.MARQUEE:let i;i=t.tagID,e.openElements.hasInScope(i)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i),e.activeFormattingElements.clearToLastMarker());break;case q.TEMPLATE:fZ(e,t);break;default:mt(e,t)}}function mr(e,t){e.tmplInsertionModeStack.length>0?mv(e,t):fK(e,t)}function mi(e,t){if(void 0!==e.openElements.currentTagId&&f$.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=K.IN_TABLE_TEXT,t.type){case L.CHARACTER:mc(e,t);break;case L.WHITESPACE_CHARACTER:ml(e,t)}else ma(e,t)}function mo(e,t){switch(t.tagID){case q.TD:case q.TH:case q.TR:e.openElements.clearBackToTableContext(),e._insertFakeElement(G.TBODY,q.TBODY),e.insertionMode=K.IN_TABLE_BODY,mf(e,t);break;case q.STYLE:case q.SCRIPT:case q.TEMPLATE:fJ(e,t);break;case q.COL:e.openElements.clearBackToTableContext(),e._insertFakeElement(G.COLGROUP,q.COLGROUP),e.insertionMode=K.IN_COLUMN_GROUP,mp(e,t);break;case q.FORM:e.formElement||0!==e.openElements.tmplCount||(e._insertElement(t,U.HTML),e.formElement=e.openElements.current,e.openElements.pop());break;case q.TABLE:e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode(),e._processStartTag(t));break;case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.clearBackToTableContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_TABLE_BODY;break;case q.INPUT:f9(t)?e._appendElement(t,U.HTML):ma(e,t),t.ackSelfClosing=!0;break;case q.CAPTION:e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_CAPTION;break;case q.COLGROUP:e.openElements.clearBackToTableContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_COLUMN_GROUP;break;default:ma(e,t)}}function ms(e,t){switch(t.tagID){case q.TABLE:e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode());break;case q.TEMPLATE:fZ(e,t);break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:ma(e,t)}}function ma(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,f3(e,t),e.fosterParentingEnabled=n}function ml(e,t){e.pendingCharacterTokens.push(t)}function mc(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function md(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)ma(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}let mu=new Set([q.CAPTION,q.COL,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]);function mp(e,t){switch(t.tagID){case q.HTML:me(e,t);break;case q.COL:e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.TEMPLATE:fJ(e,t);break;default:mh(e,t)}}function mh(e,t){e.openElements.currentTagId===q.COLGROUP&&(e.openElements.pop(),e.insertionMode=K.IN_TABLE,e._processToken(t))}function mf(e,t){switch(t.tagID){case q.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_ROW;break;case q.TH:case q.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(G.TR,q.TR),e.insertionMode=K.IN_ROW,mg(e,t);break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE,mo(e,t));break;default:mo(e,t)}}function mm(e,t){let n=t.tagID;switch(t.tagID){case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE);break;case q.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE,ms(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:case q.TR:break;default:ms(e,t)}}function mg(e,t){switch(t.tagID){case q.TH:case q.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,U.HTML),e.insertionMode=K.IN_CELL,e.activeFormattingElements.insertMarker();break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY,mf(e,t));break;default:mo(e,t)}}function mb(e,t){switch(t.tagID){case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY);break;case q.TABLE:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY,mm(e,t));break;case q.TBODY:case q.TFOOT:case q.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(q.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=K.IN_TABLE_BODY,mm(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:break;default:ms(e,t)}}function my(e,t){switch(t.tagID){case q.HTML:me(e,t);break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._insertElement(t,U.HTML);break;case q.OPTGROUP:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._insertElement(t,U.HTML);break;case q.HR:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._appendElement(t,U.HTML),t.ackSelfClosing=!0;break;case q.INPUT:case q.KEYGEN:case q.TEXTAREA:case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),t.tagID!==q.SELECT&&e._processStartTag(t));break;case q.SCRIPT:case q.TEMPLATE:fJ(e,t)}}function mx(e,t){switch(t.tagID){case q.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===q.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===q.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop();break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop();break;case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode());break;case q.TEMPLATE:fZ(e,t)}}function mv(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):fK(e,t)}function mE(e,t){var n;if(t.tagID===q.HTML){if(e.fragmentContext||(e.insertionMode=K.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===q.HTML){e._setEndLocation(e.openElements.items[0],t);let r=e.openElements.items[1];!r||(null==(n=e.treeAdapter.getNodeSourceCodeLocation(r))?void 0:n.endTag)||e._setEndLocation(r,t)}}else mw(e,t)}function mw(e,t){e.insertionMode=K.IN_BODY,f3(e,t)}function mk(e,t){e.insertionMode=K.IN_BODY,f3(e,t)}function mT(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==U.HTML&&void 0!==e.openElements.currentTagId&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function mN(e,t){return fq.parse(e,t)}function mA(e,t,n){"string"==typeof e&&(n=t,t=e,e=null);let r=fq.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}function mS(e){return e&&"object"==typeof e?"position"in e||"type"in e?m_(e.position):"start"in e||"end"in e?m_(e):"line"in e||"column"in e?mC(e):"":""}function mC(e){return mM(e&&e.line)+":"+mM(e&&e.column)}function m_(e){return mC(e&&e.start)+"-"+mC(e&&e.end)}function mM(e){return e&&"number"==typeof e?e:1}G.AREA,G.BASE,G.BASEFONT,G.BGSOUND,G.BR,G.COL,G.EMBED,G.FRAME,G.HR,G.IMG,G.INPUT,G.KEYGEN,G.LINK,G.META,G.PARAM,G.SOURCE,G.TRACK,G.WBR;class mO extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},o=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(o=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=s?s.line:void 0,this.name=mS(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}mO.prototype.file="",mO.prototype.name="",mO.prototype.reason="",mO.prototype.message="",mO.prototype.stack="",mO.prototype.column=void 0,mO.prototype.line=void 0,mO.prototype.ancestors=void 0,mO.prototype.cause=void 0,mO.prototype.fatal=void 0,mO.prototype.place=void 0,mO.prototype.ruleId=void 0,mO.prototype.source=void 0;let mI=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');mP(e);let r=0,i=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else s<0&&(n=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(i=o):(a=-1,i=s));return r===i?i=s:i<0&&(i=e.length),e.slice(r,i)},mD=function(e){let t;if(mP(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},mR=function(e){let t;mP(e);let n=e.length,r=-1,i=0,o=-1,s=0;for(;n--;){let a=e.codePointAt(n);if(47===a){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===a?o<0?o=n:1!==s&&(s=1):o>-1&&(s=-1)}return o<0||r<0||0===s||1===s&&o===r-1&&o===i+1?"":e.slice(o,r)},mL=function(...e){var t;let n,r,i,o=-1;for(;++o<e.length;)mP(e[o]),e[o]&&(i=void 0===i?e[o]:i+"/"+e[o]);return void 0===i?".":(mP(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",o=0,s=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(i.length<2||2!==o||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",o=0):o=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),s=l,a=0;continue}}else if(i.length>0){i="",o=0,s=l,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function mP(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function mj(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let mB=["history","path","basename","stem","extname","dirname"];class mF{constructor(e){let t,n;t=e?mj(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<mB.length;){const e=mB[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)mB.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?mI(this.path):void 0}set basename(e){mU(e,"basename"),mH(e,"basename"),this.path=mL(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?mD(this.path):void 0}set dirname(e){mz(this.basename,"dirname"),this.path=mL(e||"",this.basename)}get extname(){return"string"==typeof this.path?mR(this.path):void 0}set extname(e){if(mH(e,"extname"),mz(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=mL(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){mj(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!mj(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),mU(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?mI(this.path,this.extname):void 0}set stem(e){mU(e,"stem"),mH(e,"stem"),this.path=mL(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new mO(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function mH(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function mU(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function mz(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let m$={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},mG=/-[a-z]/g,mq=/%c(?:([-+])(\d+))?/g,mV=/%x/g,mW={2:!0,1:!1,0:null};function mK(e){return e.charAt(1).toUpperCase()}let mY="object"==typeof self?self:globalThis,mX=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+e)}return new mY[e](t)},mQ=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[o,s]=e[i];switch(o){case 0:case -1:return n(s,i);case 1:{let e=n([],i);for(let t of s)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of s)e[r(t)]=r(n);return e}case 3:return n(new Date(s),i);case 4:{let{source:e,flags:t}=s;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of s)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of s)e.add(r(t));return e}case 7:{let{name:e,message:t}=s;return n(mX(e,t),i)}case 8:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{let{buffer:e}=new Uint8Array(s);return n(new DataView(e),s)}}return n(mX(o,s),i)})(0)},{toString:mJ}={},{keys:mZ}=Object,m0=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=mJ.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},m1=([e,t])=>0===e&&("function"===t||"symbol"===t),m2=(e,{json:t,lossy:n}={})=>{var r,i,o;let s,a,l=[];return(r=!(t||n),i=!!t,o=new Map,s=(e,t)=>{let n=l.push(e)-1;return o.set(t,n),n},a=e=>{if(o.has(e))return o.get(e);let[t,n]=m0(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return s([-1],e)}return s([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),s([n,[...t]],e)}let r=[],i=s([t,r],e);for(let t of e)r.push(a(t));return i}case 2:{if(n)switch(n){case"BigInt":return s([n,e.toString()],e);case"Boolean":case"Number":case"String":return s([n,e.valueOf()],e)}if(i&&"toJSON"in e)return a(e.toJSON());let o=[],l=s([t,o],e);for(let t of mZ(e))(r||!m1(m0(e[t])))&&o.push([a(t),a(e[t])]);return l}case 3:return s([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return s([t,{source:n,flags:r}],e)}case 5:{let n=[],i=s([t,n],e);for(let[t,i]of e)(r||!(m1(m0(t))||m1(m0(i))))&&n.push([a(t),a(i)]);return i}case 6:{let n=[],i=s([t,n],e);for(let t of e)(r||!m1(m0(t)))&&n.push(a(t));return i}}let{message:l}=e;return s([t,{name:n,message:l}],e)})(e),l},m3="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?mQ(m2(e,t)):structuredClone(e):(e,t)=>mQ(m2(e,t)),m5={}.hasOwnProperty;function m4(e,t){let n=t||{};function r(t,...n){let i=r.invalid,o=r.handlers;if(t&&m5.call(t,e)){let n=String(t[e]);i=m5.call(o,n)?o[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}let m6={}.hasOwnProperty,m9=m4("type",{handlers:{root:function(e,t){let n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=m7(e.children,n,t),m8(e,n),n},element:function(e,t){var n,r;let i,o,s=t;"element"===e.type&&"svg"===e.tagName.toLowerCase()&&"html"===t.space&&(s=hN);let a=[];if(e.properties){for(i in e.properties)if("children"!==i&&m6.call(e.properties,i)){let t=function(e,t,n){let r=hI(e,t);if(!1===n||null==n||"number"==typeof n&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?hS(n):hP(n));let i={name:r.attribute,value:!0===n?"":String(n)};if(r.space&&"html"!==r.space&&"svg"!==r.space){let e=i.name.indexOf(":");e<0?i.prefix="":(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=hz[r.space]}return i}(s,i,e.properties[i]);t&&a.push(t)}}let l=s.space;p7(l);let c={nodeName:e.tagName,tagName:e.tagName,attrs:a,namespaceURI:hz[l],childNodes:[],parentNode:null};return c.childNodes=m7(e.children,c,s),m8(e,c),"template"===e.tagName&&e.content&&(n=e.content,r=s,(o={nodeName:"#document-fragment",childNodes:[]}).childNodes=m7(n.children,o,r),m8(n,o),c.content=o),c},text:function(e){let t={nodeName:"#text",value:e.value,parentNode:null};return m8(e,t),t},comment:function(e){let t={nodeName:"#comment",data:e.value,parentNode:null};return m8(e,t),t},doctype:function(e){let t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return m8(e,t),t}}});function m7(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let o=m9(e[r],n);o.parentNode=t,i.push(o)}return i}function m8(e,t){let n=e.position;n&&n.start&&n.end&&(p7("number"==typeof n.start.offset),p7("number"==typeof n.end.offset),t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}let ge=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var gt=e.i(743820),gt=gt,gn=e.i(113515),gn=gn;let gr=go("end"),gi=go("start");function go(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function gs(e){let t=gi(e),n=gr(e);if(t&&n)return{start:t,end:n}}let ga=function(e){var t,n;if(null==e)return gc;if("function"==typeof e)return gl(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=ga(e[n]);return gl(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,gl(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,gl(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function gl(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function gc(){return!0}let gd=[];function gu(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let o=ga(i),s=r?-1:1;(function e(i,a,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(d,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return d;function d(){var c;let d,u,p,h=gd;if((!t||o(i,a,l[l.length-1]||void 0))&&!1===(h=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?gd:[c])[0])return h;if("children"in i&&i.children&&i.children&&"skip"!==h[0])for(u=(r?i.children.length:-1)+s,p=l.concat(i);u>-1&&u<i.children.length;){if(!1===(d=e(i.children[u],u,p)())[0])return d;u="number"==typeof d[1]?d[1]:u+s}return h}})(e,void 0,[])()}function gp(e,t,n,r){let i,o,s;"function"==typeof t&&"function"!=typeof n?(o=void 0,s=t,i=n):(o=t,s=n,i=r),gu(e,o,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return s(e,r,n)},i)}let gh=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,gf=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),gm={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function gg(e,t){var n;let r,i=!!((r="root"===(n=e).type?n.children[0]:n)&&("doctype"===r.type||"element"===r.type&&"html"===r.tagName.toLowerCase())),o=m4("type",{handlers:{root:gy,element:gx,text:gv,comment:gw,doctype:gE,raw:gk},unknown:gT}),s={parser:i?new fq(gm):fq.getFragmentParser(void 0,gm),handle(e){o(e,s)},stitches:!1,options:t||{}};o(e,s),gN(s,gi());let a=hq(i?s.parser.document:s.parser.getFragment(),{file:s.options.file});return(s.stitches&&gp(a,"comment",function(e,t,n){if(e.value.stitch&&n&&void 0!==t)return n.children[t]=e.value.stitch,t}),"root"===a.type&&1===a.children.length&&a.children[0].type===e.type)?a.children[0]:a}function gb(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function gy(e,t){gb(e.children,t)}function gx(e,t){(function(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===fs.PLAINTEXT)return;gN(t,gi(e));let r=t.parser.openElements.current,i="namespaceURI"in r?r.namespaceURI:hz.html;i===hz.html&&"svg"===n&&(i=hz.svg);let o=m9({...e,children:[]},"svg"===({space:i===hz.svg?"svg":"html"}).space?hN:hT),s={type:gt.TokenType.START_TAG,tagName:n,tagID:gn.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in o?o.attrs:[],location:gS(e)};t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n})(e,t),gb(e.children,t),function(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&ge.includes(n)||t.parser.tokenizer.state===fs.PLAINTEXT)return;gN(t,gr(e));let r={type:gt.TokenType.END_TAG,tagName:n,tagID:gn.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:gS(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===fs.RCDATA||t.parser.tokenizer.state===fs.RAWTEXT||t.parser.tokenizer.state===fs.SCRIPT_DATA)&&(t.parser.tokenizer.state=fs.DATA)}(e,t)}function gv(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:gt.TokenType.CHARACTER,chars:e.value,location:gS(e)};gN(t,gi(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function gE(e,t){let n={type:gt.TokenType.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:gS(e)};gN(t,gi(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function gw(e,t){let n=e.value,r={type:gt.TokenType.COMMENT,data:n,location:gS(e)};gN(t,gi(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function gk(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,gA(t,gi(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(gh,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),72===t.parser.tokenizer.state||78===t.parser.tokenizer.state){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function gT(e,t){if(t.options.passThrough&&t.options.passThrough.includes(e.type)){var n;let r;t.stitches=!0,r="children"in(n=e)?m3({...n,children:[]}):m3(n),"children"in e&&"children"in r&&(r.children=gg({type:"root",children:e.children},t.options).children),gw({type:"comment",value:{stitch:r}},t)}else{let t="";throw gf.has(e.type)&&(t=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+e.type+"` node"+t)}}function gN(e,t){gA(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=fs.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function gA(e,t){if(t&&void 0!==t.offset){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function gS(e){let t=gi(e)||{line:void 0,column:void 0,offset:void 0},n=gr(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}let gC=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],g_={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...gC,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...gC],h2:[["className","sr-only"]],img:[...gC,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...gC,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...gC],table:[...gC],ul:[...gC,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},gM={}.hasOwnProperty;function gO(e,t){if(t&&"object"==typeof t)switch("string"==typeof t.type?t.type:""){case"comment":var n,r,i=e,o=t;if(i.schema.allowComments){let e="string"==typeof o.value?o.value:"",t=e.indexOf("-->"),n={type:"comment",value:t<0?e:e.slice(0,t)};return gL(n,o),n}return;case"doctype":var s=e,a=t;if(s.schema.allowDoctypes){let e={type:"doctype"};return gL(e,a),e}return;case"element":return function(e,t){let n="string"==typeof t.tagName?t.tagName:"";e.stack.push(n);let r=gI(e,t.children),i=function(e,t){let n,r=e.stack[e.stack.length-1],i=e.schema.attributes,o=e.schema.required,s=i&&gM.call(i,r)?i[r]:void 0,a=i&&gM.call(i,"*")?i["*"]:void 0,l=t&&"object"==typeof t?t:{},c={};for(n in l)if(gM.call(l,n)){let t=l[n],r=gD(e,gP(s,n),n,t);null==r&&(r=gD(e,gP(a,n),n,t)),null!=r&&(c[n]=r)}if(o&&gM.call(o,r)){let e=o[r];for(n in e)gM.call(e,n)&&!gM.call(c,n)&&(c[n]=e[n])}return c}(e,t.properties);e.stack.pop();let o=!1;if(n&&"*"!==n&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&gM.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(o=!1;++r<t.length;)e.stack.includes(t[r])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let s={type:"element",tagName:n,properties:i,children:r};return gL(s,t),s}(e,t);case"root":let l;return gL(l={type:"root",children:gI(e,(n=t).children)},n),l;case"text":let c;return gL(c={type:"text",value:"string"==typeof(r=t).value?r.value:""},r),c}}function gI(e,t){let n=[];if(Array.isArray(t)){let r=-1;for(;++r<t.length;){let i=gO(e,t[r]);i&&(Array.isArray(i)?n.push(...i):n.push(i))}}return n}function gD(e,t,n,r){return t?Array.isArray(r)?function(e,t,n,r){let i=-1,o=[];for(;++i<r.length;){let s=gR(e,t,n,r[i]);("number"==typeof s||"string"==typeof s)&&o.push(s)}return o}(e,t,n,r):gR(e,t,n,r):void 0}function gR(e,t,n,r){if(("boolean"==typeof r||"number"==typeof r||"string"==typeof r)&&function(e,t,n){let r=e.schema.protocols&&gM.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||0===r.length)return!0;let i=String(n),o=i.indexOf(":"),s=i.indexOf("?"),a=i.indexOf("#"),l=i.indexOf("/");if(o<0||l>-1&&o>l||s>-1&&o>s||a>-1&&o>a)return!0;let c=-1;for(;++c<r.length;){let e=r[c];if(o===e.length&&i.slice(0,e.length)===e)return!0}return!1}(e,n,r)){if("object"==typeof t&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&"object"==typeof i&&"flags"in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function gL(e,t){let n=gs(t);t.data&&(e.data=m3(t.data)),n&&(e.position=n)}function gP(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],o="string"==typeof i?i:i[0];if(o===t)return i;"data*"===o&&(n=i)}if(t.length>4&&"data"===t.slice(0,4).toLowerCase())return n}let gj=/["&'<>`]/g,gB=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,gF=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,gH=/[|\\{}()[\]^$+*?.]/g,gU=new WeakMap,gz=/[\dA-Fa-f]/,g$=/\d/,gG=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],gq={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},gV=["cent","copy","divide","gt","lt","not","para","times"],gW={}.hasOwnProperty,gK={};for(r in gq)gW.call(gq,r)&&(gK[gq[r]]=r);let gY=/[^\dA-Za-z]/;function gX(e,t,n){var r,i;let o,s,a=(r=n.omitOptionalSemicolons,o="&#x"+e.toString(16).toUpperCase(),r&&t&&!gz.test(String.fromCharCode(t))?o:o+";");if((n.useNamedReferences||n.useShortestReferences)&&(s=function(e,t,n,r){let i=String.fromCharCode(e);if(gW.call(gK,i)){let e=gK[i],o="&"+e;return n&&gG.includes(e)&&!gV.includes(e)&&(!r||t&&61!==t&&gY.test(String.fromCharCode(t)))?o:o+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){let r,o=(i=n.omitOptionalSemicolons,r="&#"+String(e),i&&t&&!g$.test(String.fromCharCode(t))?r:r+";");o.length<a.length&&(a=o)}return s&&(!n.useShortestReferences||s.length<a.length)?s:a}function gQ(e,t){let n;var r,i=e,o=Object.assign({format:gX},t);if(i=i.replace(o.subset?(r=o.subset,(n=gU.get(r))||(n=function(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(gH,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(r),gU.set(r,n)),n):gj,s),o.subset||o.escapeOnly)return i;return i.replace(gB,function(e,t,n){return o.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,n.charCodeAt(t+2),o)}).replace(gF,s);function s(e,t,n){return o.format(e.charCodeAt(0),n.charCodeAt(t+1),o)}}let gJ=/^>|^->|<!--|-->|--!>|<!-$/g,gZ=[">"],g0=["<",">"];function g1(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}let g2=/[ \t\n\f\r]/g;function g3(e){return"object"==typeof e?"text"===e.type&&g5(e.value):g5(e)}function g5(e){return""===e.replace(g2,"")}let g4=g7(1),g6=g7(-1),g9=[];function g7(e){return function(t,n,r){let i=t?t.children:g9,o=(n||0)+e,s=i[o];if(!r)for(;s&&g3(s);)o+=e,s=i[o];return s}}let g8={}.hasOwnProperty;function be(e){return function(t,n,r){return g8.call(e,t.tagName)&&e[t.tagName](t,n,r)}}let bt=be({body:function(e,t,n){let r=g4(n,t);return!r||"comment"!==r.type},caption:bn,colgroup:bn,dd:function(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){let r=g4(n,t);return!!(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:bn,html:function(e,t,n){let r=g4(n,t);return!r||"comment"!==r.type},li:function(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){let r=g4(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||"element"!==n.type||"a"!==n.tagName&&"audio"!==n.tagName&&"del"!==n.tagName&&"ins"!==n.tagName&&"map"!==n.tagName&&"noscript"!==n.tagName&&"video"!==n.tagName},rp:br,rt:br,tbody:function(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:bi,tfoot:function(e,t,n){return!g4(n,t)},th:bi,thead:function(e,t,n){let r=g4(n,t);return!!(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function bn(e,t,n){let r=g4(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&g3(r.value.charAt(0)))}function br(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function bi(e,t,n){let r=g4(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}let bo=be({body:function(e){let t=g4(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&g3(t.value.charAt(0)))&&("element"!==t.type||"meta"!==t.tagName&&"link"!==t.tagName&&"script"!==t.tagName&&"style"!==t.tagName&&"template"!==t.tagName)},colgroup:function(e,t,n){let r=g6(n,t),i=g4(e,-1,!0);return!(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&bt(r,n.children.indexOf(r),n))&&!!(i&&"element"===i.type&&"col"===i.tagName)},head:function(e){let t=new Set;for(let n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||"element"===n.type},html:function(e){let t=g4(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){let r=g6(n,t),i=g4(e,-1);return!(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&bt(r,n.children.indexOf(r),n))&&!!(i&&"element"===i.type&&"tr"===i.tagName)}}),bs={name:[[" \n\f\r &/=>".split("")," \n\f\r \"&'/=>`".split("")],["\0 \n\f\r \"&'/<=>".split(""),"\0 \n\f\r \"&'/<=>`".split("")]],unquoted:[[" \n\f\r &>".split(""),"\0 \n\f\r \"&'<=>`".split("")],["\0 \n\f\r \"&'<=>`".split(""),"\0 \n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},ba=["<","&"];function bl(e,t,n,r){return n&&"element"===n.type&&("script"===n.tagName||"style"===n.tagName)?e.value:gQ(e.value,Object.assign({},r.settings.characterReferences,{subset:ba}))}let bc=m4("type",{invalid:function(e){throw Error("Expected node, not `"+e+"`")},unknown:function(e){throw Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+gQ(e.value,Object.assign({},r.settings.characterReferences,{subset:gZ}))+">":"<!--"+e.value.replace(gJ,function(e){return gQ(e,Object.assign({},r.settings.characterReferences,{subset:g0}))})+"-->"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){let i,o=r.schema,s="svg"!==o.space&&r.settings.omitOptionalTags,a="svg"===o.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===o.space&&"svg"===e.tagName&&(r.schema=hN);let c=function(e,t){let n,r=[],i=-1;if(t){for(n in t)if(null!==t[n]&&void 0!==t[n]){let i=function(e,t,n){let r,i=hI(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=+!e.settings.allowDangerousCharacters,a=e.quote;if(i.overloadedBoolean&&(n===i.attribute||""===n)?n=!0:(i.boolean||i.overloadedBoolean)&&("string"!=typeof n||n===i.attribute||""===n)&&(n=!!n),null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";let l=gQ(i.attribute,Object.assign({},e.settings.characterReferences,{subset:bs.name[o][s]}));return!0===n||(n=Array.isArray(n)?(i.commaSeparated?hS:hP)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(r=gQ(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:bs.unquoted[o][s]}))),r!==n&&(e.settings.quoteSmart&&g1(n,a)>g1(n,e.alternative)&&(a=e.alternative),r=a+gQ(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?bs.single:bs.double)[o][s],attribute:!0}))+a),l+(r?"="+r:r))}(e,n,t[n]);i&&r.push(i)}}for(;++i<r.length;){let t=e.settings.tightAttributes?r[i].charAt(r[i].length-1):void 0;i!==r.length-1&&'"'!==t&&"'"!==t&&(r[i]+=" ")}return r.join("")}(r,e.properties),d=r.all("html"===o.space&&"template"===e.tagName?e.content:e);return r.schema=o,d&&(a=!1),!c&&s&&bo(e,t,n)||(l.push("<",e.tagName,c?" "+c:""),a&&("svg"===o.space||r.settings.closeSelfClosing)&&(i=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===i||i&&'"'!==i&&"'"!==i)&&l.push(" "),l.push("/")),l.push(">")),l.push(d),a||s&&bt(e,t,n)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:bl(e,t,n,r)},root:function(e,t,n,r){return r.all(e)},text:bl}}),bd={},bu={},bp=[];function bh(e,t){let n=t||bd,r=n.quote||'"';if('"'!==r&&"'"!==r)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return({one:bf,all:bm,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||ge,characterReferences:n.characterReferences||bu,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?hN:hT,quote:r,alternative:'"'===r?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function bf(e,t,n){return bc(e,t,n,this)}function bm(e){let t=[],n=e&&e.children||bp,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function bg(e){let t={...this.data("settings"),...e};this.compiler=function(e){return bh(e,t)}}let bb=b_(/[A-Za-z]/),by=b_(/[\dA-Za-z]/),bx=b_(/[#-'*+\--9=?A-Z^-~]/);function bv(e){return null!==e&&(e<32||127===e)}let bE=b_(/\d/),bw=b_(/[\dA-Fa-f]/),bk=b_(/[!-/:-@[-`{-~]/);function bT(e){return null!==e&&e<-2}function bN(e){return null!==e&&(e<0||32===e)}function bA(e){return -2===e||-1===e||32===e}let bS=b_(/\p{P}|\p{S}/u),bC=b_(/\s/);function b_(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let bM="phrasing",bO=["autolink","link","image","label"];function bI(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bD(e){this.config.enter.autolinkProtocol.call(this,e)}function bR(e){this.config.exit.autolinkProtocol.call(this,e)}function bL(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];p7("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function bP(e){this.config.exit.autolinkEmail.call(this,e)}function bj(e){this.exit(e)}function bB(e){!function(e,t,n){let r=ga((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),o=-1;for(;++o<i.length;)gu(e,"text",s);function s(e,t){let n,s=-1;for(;++s<t.length;){let e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[o][0],s=i[o][1],a=0,l=n.children.indexOf(e),c=!1,d=[];r.lastIndex=0;let u=r.exec(e.value);for(;u;){let n=u.index,i={index:u.index,input:u.input,stack:[...t,e]},o=s(...u,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(a!==n&&d.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(o)?d.push(...o):o&&d.push(o),a=n+u[0].length,c=!0),!r.global)break;u=r.exec(e.value)}return c?(a<e.value.length&&d.push({type:"text",value:e.value.slice(a)}),n.children.splice(l,1,...d)):d=[e],l+d.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bF],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bH]],{ignore:["link","linkReference"]})}function bF(e,t,n,r,i){let o,s="";if(!bU(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",s="http://"),(o=n.split(".")).length<2||o[o.length-1]&&(/_/.test(o[o.length-1])||!/[a-zA-Z\d]/.test(o[o.length-1]))||o[o.length-2]&&(/_/.test(o[o.length-2])||!/[a-zA-Z\d]/.test(o[o.length-2])))return!1;let a=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=g1(e,"("),o=g1(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),o++;return[e,n]}(n+r);if(!a[0])return!1;let l={type:"link",title:null,url:s+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function bH(e,t,n,r){return!(!bU(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bU(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||bC(n)||bS(n))&&(!t||47!==n)}function bz(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function b$(){this.buffer()}function bG(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bq(){this.buffer()}function bV(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bW(e){let t=this.resume(),n=this.stack[this.stack.length-1];p7("footnoteReference"===n.type),n.identifier=bz(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bK(e){this.exit(e)}function bY(e){let t=this.resume(),n=this.stack[this.stack.length-1];p7("footnoteDefinition"===n.type),n.identifier=bz(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bX(e){this.exit(e)}function bQ(e,t,n,r){let i=n.createTracker(r),o=i.move("[^"),s=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),a(),s(),o+=i.move("]")}function bJ(e,t,n){return 0===t?e:bZ(e,t,n)}function bZ(e,t,n){return(n?"":" ")+e}bQ.peek=function(){return"["};let b0=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function b1(e){this.enter({type:"delete",children:[]},e)}function b2(e){this.exit(e)}function b3(e,t,n,r){let i=n.createTracker(r),o=n.enter("strikethrough"),s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function b5(e){return e.length}function b4(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}b3.peek=function(){return"~"};function b6(e){return null===e||bN(e)||bC(e)?1:bS(e)?2:void 0}let b9={};function b7(e,t){let n=t||b9;return b8(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function b8(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ye(e.children,t,n)}return Array.isArray(e)?ye(e,t,n):""}function ye(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=b8(e[i],t,n);return r.join("")}function yt(e,t,n){let r=e.value||"",i="`",o=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){let e,t=n.unsafe[o],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}yt.peek=function(){return"`"};ga(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let yn=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),o=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));let a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?o:o+" ".repeat(s-o.length))+e});return l(),c};function yr(e){let t=e._align;p7(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function yi(e){this.exit(e),this.data.inTable=void 0}function yo(e){this.enter({type:"tableRow",children:[]},e)}function ys(e){this.exit(e)}function ya(e){this.enter({type:"tableCell",children:[]},e)}function yl(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yc));let n=this.stack[this.stack.length-1];p7("inlineCode"===n.type),n.value=t,this.exit(e)}function yc(e,t){return"|"===t?t:e}function yd(e){let t=this.stack[this.stack.length-2];p7("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function yu(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];p7("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,o=-1;for(;++o<i.length;){let e=i[o];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function yp(e,t,n,r){let i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);o&&a.move(s);let l=yn(e,t,n,{...r,...a.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+s})),l}function yh(e,t,n,r){let i,o=e.length,s=0;if(t=t<0?-t>o?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)(i=r.slice(s,s+1e4)).unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function yf(e,t){return e.length>0?(yh(e,e.length,0,t),e):t}let ym={}.hasOwnProperty;function yg(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(ym.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];if(o)for(r in o){ym.call(i,r)||(i[r]=[]);let e=o[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);yh(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}let yb={tokenize:function(e,t,n){let r=0;return function t(o){return(87===o||119===o)&&r<3?(r++,e.consume(o),t):46===o&&3===r?(e.consume(o),i):n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},yy={tokenize:function(e,t,n){let r,i,o;return s;function s(t){return 46===t||95===t?e.check(yv,l,a)(t):null===t||bN(t)||bC(t)||45!==t&&bS(t)?l(t):(o=!0,e.consume(t),s)}function a(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),s}function l(e){return i||r||!o?n(e):t(e)}},partial:!0},yx={tokenize:function(e,t){let n=0,r=0;return i;function i(s){return 40===s?(n++,e.consume(s),i):41===s&&r<n?o(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(yv,t,o)(s):null===s||bN(s)||bC(s)?t(s):(e.consume(s),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},yv={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),o):93===s?(e.consume(s),i):60===s||null===s||bN(s)||bC(s)?t(s):n(s)}function i(e){return null===e||40===e||91===e||bN(e)||bC(e)?t(e):r(e)}function o(t){return bb(t)?function t(i){return 59===i?(e.consume(i),r):bb(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},yE={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return by(e)?n(e):t(e)}},partial:!0},yw={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!yS.call(r,r.previous)||yO(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(yb,e.attempt(yy,e.attempt(yx,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:yS},yk={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",o=!1;return function(t){return(72===t||104===t)&&yC.call(r,r.previous)&&!yO(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),s):n(t)};function s(t){if(bb(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),a}return n(t)}function a(t){return 47===t?(e.consume(t),o)?l:(o=!0,a):n(t)}function l(t){return null===t||bv(t)||bN(t)||bC(t)||bS(t)?n(t):e.attempt(yy,e.attempt(yx,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:yC},yT={name:"emailAutolink",tokenize:function(e,t,n){let r,i,o=this;return function(t){return!yM(t)||!y_.call(o,o.previous)||yO(o.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return yM(r)?(e.consume(r),t):64===r?(e.consume(r),s):n(r)}(t))};function s(t){return 46===t?e.check(yE,l,a)(t):45===t||95===t||by(t)?(i=!0,e.consume(t),s):l(t)}function a(t){return e.consume(t),r=!0,s}function l(s){return i&&r&&bb(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:y_},yN={},yA=48;for(;yA<123;)yN[yA]=yT,58==++yA?yA=65:91===yA&&(yA=97);function yS(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||bN(e)}function yC(e){return!bb(e)}function y_(e){return!(47===e||yM(e))}function yM(e){return 43===e||45===e||46===e||95===e||by(e)}function yO(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function yI(e,t,n,r){let i=r?r-1:1/0,o=0;return function(r){return bA(r)?(e.enter(n),function r(s){return bA(s)&&o++<i?(e.consume(s),r):(e.exit(n),t(s))}(r)):t(r)}}yN[43]=yT,yN[45]=yT,yN[46]=yT,yN[95]=yT,yN[72]=[yT,yk],yN[104]=[yT,yk],yN[87]=[yT,yw],yN[119]=[yT,yw];let yD={partial:!0,tokenize:function(e,t,n){return function(t){return bA(t)?yI(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||bT(e)?t(e):n(e)}}},yR={tokenize:function(e,t,n){let r=this;return yI(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function yL(e,t,n){let r,i=this,o=i.events.length,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;o--;){let e=i.events[o][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(o){if(!r||!r._balanced)return n(o);let a=bz(i.sliceSerialize({start:r.end,end:i.now()}));return 94===a.codePointAt(0)&&s.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o)):n(o)}}function yP(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function yj(e,t,n){let r,i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(s>999||93===a&&!r||null===a||91===a||bN(a))return n(a);if(93===a){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return o.includes(bz(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(a)}return bN(a)||(r=!0),s++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function yB(e,t,n){let r,i,o=this,s=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(a>999||93===t&&!i||null===t||91===t||bN(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=bz(o.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),u}return bN(t)||(i=!0),a++,e.consume(t),92===t?d:c}function d(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function u(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s.includes(r)||s.push(r),yI(e,p,"gfmFootnoteDefinitionWhitespace")):n(t)}function p(e){return t(e)}}function yF(e,t,n){return e.check(yD,t,e.attempt(yR,t,n))}function yH(e){e.exit("gfmFootnoteDefinition")}function yU(e,t,n){let r=[],i=-1;for(;++i<e.length;){let o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}class yz{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function y$(e,t,n){let r,i=this,o=0,s=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,o="tableHead"===r||"tableRow"===r?y:a;return o===y&&i.parser.lazy[i.now().line]?n(e):o(e)};function a(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,s+=1),l(n)}function l(t){return null===t?n(t):bT(t)?s>1?(s=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),u):n(t):bA(t)?yI(e,l,"whitespace")(t):(s+=1,r&&(r=!1,o+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,l):(e.enter("data"),c(t))}function c(t){return null===t||124===t||bN(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?d:c)}function d(t){return 92===t||124===t?(e.consume(t),c):c(t)}function u(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,bA(t))?yI(e,p,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?f(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),h):n(t)}function h(t){return bA(t)?yI(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(s+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(s+=1,m(t)):null===t||bT(t)?b(t):n(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(n))}(t)):n(t)}function g(t){return bA(t)?yI(e,b,"whitespace")(t):b(t)}function b(i){if(124===i)return p(i);if(null===i||bT(i))return r&&o===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function y(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||bT(n)?(e.exit("tableRow"),t(n)):bA(n)?yI(e,x,"whitespace")(n):(e.enter("data"),v(n))}function v(t){return null===t||124===t||bN(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?E:v)}function E(t){return 92===t||124===t?(e.consume(t),v):v(t)}}function yG(e,t){let n,r,i,o=-1,s=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],d=!1,u=0,p=new yz;for(;++o<e.length;){let h=e[o],f=h[1];"enter"===h[0]?"tableHead"===f.type?(d=!1,0!==u&&(yV(p,t,u,n,r),r=void 0,u=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(o,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(s=!0,i=void 0,l=[0,0,0,0],c=[0,o+1,0,0],d&&(d=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(o,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(s=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=yq(p,t,l,a,void 0,i),l=[0,0,0,0]),c[2]=o)):"tableCellDivider"===f.type&&(s?s=!1:(0!==l[1]&&(c[0]=c[1],i=yq(p,t,l,a,void 0,i)),c=[(l=c)[1],o,0,0])):"tableHead"===f.type?(d=!0,u=o):"tableRow"===f.type||"tableDelimiterRow"===f.type?(u=o,0!==l[1]?(c[0]=c[1],i=yq(p,t,l,a,o,i)):0!==c[1]&&(i=yq(p,t,c,a,o,i)),a=0):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(c[3]=o)}for(0!==u&&yV(p,t,u,n,r),p.consume(t.events),o=-1;++o<t.events.length;){let e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,o))}return e}function yq(e,t,n,r,i,o){0!==n[0]&&(o.end=Object.assign({},yW(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));let s=yW(t.events,n[1]);if(o={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){let i=yW(t.events,n[2]),o=yW(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(o.end=Object.assign({},yW(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function yV(e,t,n,r,i){let o=[],s=yW(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function yW(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let yK={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return bN(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return bT(r)?t(r):bA(r)?e.check({tokenize:yY},t,n)(r):n(r)}}};function yY(e,t,n){return yI(e,function(e){return null===e?n(e):t(e)},"whitespace")}let yX={},yQ={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yI(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return bT(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},yJ={tokenize:function(e){let t,n,r,i=this,o=[],s=0;return a;function a(t){if(s<o.length){let n=o[s];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(s++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&b();let r=i.events.length,o=r;for(;o--;)if("exit"===i.events[o][0]&&"chunkFlow"===i.events[o][1].type){n=i.events[o][1].end;break}g(s);let a=r;for(;a<i.events.length;)i.events[a][1].end={...n},a++;return yh(i.events,o+1,0,i.events.slice(r)),i.events.length=a,c(e)}return a(e)}function c(n){if(s===o.length){if(!t)return p(n);if(t.currentConstruct&&t.currentConstruct.concrete)return f(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(yZ,d,u)(n)}function d(e){return t&&b(),g(s),p(e)}function u(e){return i.parser.lazy[i.now().line]=s!==o.length,r=i.now().offset,f(e)}function p(t){return i.containerState={},e.attempt(yZ,h,f)(t)}function h(e){return s++,o.push([i.currentConstruct,i.containerState]),p(e)}function f(r){if(null===r){t&&b(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return bT(n)?(e.consume(n),m(e.exit("chunkFlow")),s=0,i.interrupt=void 0,a):(e.consume(n),t)}(r)}function m(e,o){let a=i.sliceStream(e);if(o&&a.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(a),i.parser.lazy[e.start.line]){let e,n,o=t.events.length;for(;o--;)if(t.events[o][1].start.offset<r&&(!t.events[o][1].end||t.events[o][1].end.offset>r))return;let a=i.events.length,l=a;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(g(s),o=a;o<i.events.length;)i.events[o][1].end={...n},o++;yh(i.events,l+1,0,i.events.slice(a)),i.events.length=o}}function g(t){let n=o.length;for(;n-- >t;){let t=o[n];i.containerState=t[1],t[0].exit.call(i,e)}o.length=t}function b(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},yZ={tokenize:function(e,t,n){return yI(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};class y0{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&y1(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),y1(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),y1(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);y1(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);y1(this.left,t.reverse())}}}function y1(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function y2(e){let t,n,r,i,o,s,a,l={},c=-1,d=new y0(e);for(;++c<d.length;){for(;c in l;)c=l[c];if(t=d.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===d.get(c-1)[1].type&&((r=0)<(s=t[1]._tokenizer.events).length&&"lineEndingBlank"===s[r][1].type&&(r+=2),r<s.length&&"content"===s[r][1].type))for(;++r<s.length&&"content"!==s[r][1].type;)"chunkText"===s[r][1].type&&(s[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],o=e.get(t)[2],s=t-1,a=[],l=i._tokenizer;!l&&(l=o.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,d=[],u={},p=-1,h=i,f=0,m=0,g=[0];for(;h;){for(;e.get(++s)[1]!==h;);a.push(s),!h._tokenizer&&(n=o.sliceStream(h),h.next||n.push(null),r&&l.defineSkip(h.start),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=h,h=h.next}for(h=i;++p<c.length;)"exit"===c[p][0]&&"enter"===c[p-1][0]&&c[p][1].type===c[p-1][1].type&&c[p][1].start.line!==c[p][1].end.line&&(m=p+1,g.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(l.events=[],h?(h._tokenizer=void 0,h.previous=void 0):g.pop(),p=g.length;p--;){let t=c.slice(g[p],g[p+1]),n=a.pop();d.push([n,n+t.length-1]),e.splice(n,2,t)}for(d.reverse(),p=-1;++p<d.length;)u[f+d[p][0]]=f+d[p][1],f+=d[p][1]-d[p][0]-1;return u}(d,c)),c=l[c],a=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=d.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(d.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...d.get(n)[1].start},(o=d.slice(n,c)).unshift(t),d.splice(n,c-n+1,o))}}return yh(e,0,1/0,d.slice(0)),!a}let y3={resolve:function(e){return y2(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):bT(t)?e.check(y5,o,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},y5={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yI(e,i,"linePrefix")};function i(i){if(null===i||bT(i))return n(i);let o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},y4={tokenize:function(e){let t=this,n=e.attempt(yD,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,yI(e,e.attempt(this.parser.constructs.flow,r,e.attempt(y3,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},y6={resolveAll:xe()},y9=y8("string"),y7=y8("text");function y8(e){return{resolveAll:xe("text"===e?xt:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,o,s);return o;function o(e){return l(e)?i(e):s(e)}function s(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),a)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function xe(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function xt(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],o=t.sliceStream(i),s=o.length,a=-1,l=0;for(;s--;){let e=o[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let o={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:i.start._bufferIndex+a,_index:i.start._index+s,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...o.start},i.start.offset===i.end.offset?Object.assign(i,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}let xn={name:"attention",resolveAll:function(e,t){let n,r,i,o,s,a,l,c,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close){for(n=d;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[n][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;let u={...e[n][1].end},p={...e[d][1].start};xr(u,-a),xr(p,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[d][1].start},end:p},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[d][1].start}},r={type:a>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[n][1].end={...o.start},e[d][1].start={...s.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=yf(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=yf(l,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),l=yf(l,yU(t.parser.constructs.insideSpan.null,e.slice(n+1,d),t)),l=yf(l,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[d][1].end.offset-e[d][1].start.offset?(c=2,l=yf(l,[["enter",e[d][1],t],["exit",e[d][1],t]])):c=0,yh(e,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,o=b6(i);return function(s){return n=s,e.enter("attentionSequence"),function s(a){if(a===n)return e.consume(a),s;let l=e.exit("attentionSequence"),c=b6(a),d=!c||2===c&&o||r.includes(a),u=!o||2===o&&c||r.includes(i);return l._open=!!(42===n?d:d&&(o||!u)),l._close=!!(42===n?u:u&&(c||!d)),t(a)}(s)}}};function xr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let xi={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return bA(t)?yI(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(xi,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return bA(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},xo={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return bk(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},xs=document.createElement("i");function xa(e){let t="&"+e+";";xs.innerHTML=t;let n=xs.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let xl={name:"characterReference",tokenize:function(e,t,n){let r,i,o=this,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=by,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=bw,c):(e.enter("characterReferenceValue"),r=7,i=bE,c(t))}function c(a){if(59===a&&s){let r=e.exit("characterReferenceValue");return i!==by||xa(o.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&s++<r?(e.consume(a),c):n(a)}}},xc={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xd={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,o={partial:!0,tokenize:function(e,t,n){let o=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),bA(t)?yI(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(o++,e.consume(i),t):o>=a?(e.exit("codeFencedFenceSequence"),bA(i)?yI(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||bT(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},s=0,a=0;return function(t){var o;let c;return o=t,s=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=o,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a<3?n(i):(e.exit("codeFencedFenceSequence"),bA(i)?yI(e,l,"whitespace")(i):l(i))}(o)};function l(o){return null===o||bT(o)?(e.exit("codeFencedFence"),i.interrupt?t(o):e.check(xc,d,f)(o)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||bT(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):bA(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yI(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(o))}function c(t){return null===t||bT(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||bT(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function d(t){return e.attempt(o,f,u)(t)}function u(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),p}function p(t){return s>0&&bA(t)?yI(e,h,"linePrefix",s+1)(t):h(t)}function h(t){return null===t||bT(t)?e.check(xc,d,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||bT(n)?(e.exit("codeFlowValue"),h(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}}},xu={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),yI(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?o(n):bT(n)?e.attempt(xp,t,o)(n):(e.enter("codeFlowValue"),function n(r){return null===r||bT(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function o(n){return e.exit("codeIndented"),t(n)}}},xp={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):bT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):yI(e,o,"linePrefix",5)(t)}function o(e){let o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):bT(e)?i(e):n(e)}}};function xh(e,t,n,r,i,o,s,a,l){let c=l||1/0,d=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),u):null===t||32===t||41===t||bv(t)?n(t):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t))};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(a),u(t)):null===t||60===t||bT(t)?n(t):(e.consume(t),92===t?h:p)}function h(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function f(i){return!d&&(null===i||41===i||bN(i))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(i)):d<c&&40===i?(e.consume(i),d++,f):41===i?(e.consume(i),d--,f):null===i||32===i||40===i||bv(i)?n(i):(e.consume(i),92===i?m:f)}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function xf(e,t,n,r,i,o){let s,a=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(u){return l>999||null===u||91===u||93===u&&!s||94===u&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):93===u?(e.exit(o),e.enter(i),e.consume(u),e.exit(i),e.exit(r),t):bT(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(u))}function d(t){return null===t||91===t||93===t||bT(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),s||(s=!bA(t)),92===t?u:d)}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,d):d(t)}}function xm(e,t,n,r,i,o){let s;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,a):n(t)};function a(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),l(n))}function l(t){return t===s?(e.exit(o),a(s)):null===t?n(t):bT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yI(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||bT(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?d:c)}function d(t){return t===s||92===t?(e.consume(t),c):c(t)}}function xg(e,t){let n;return function r(i){return bT(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):bA(i)?yI(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}let xb={partial:!0,tokenize:function(e,t,n){return function(t){return bN(t)?xg(e,r)(t):n(t)};function r(t){return xm(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return bA(t)?yI(e,o,"whitespace")(t):o(t)}function o(e){return null===e||bT(e)?t(e):n(e)}}},xy=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xx=["pre","script","style","textarea"],xv={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(yD,t,n)}}},xE={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return bT(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xw={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&yh(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,o,s=e.length,a=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=s);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return o=yf(o=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+a+3)),o=yf(o,[["enter",d,t]]),o=yf(o,yU(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),o=yf(o,[["exit",d,t],e[i-2],e[i-1],["exit",c,t]]),o=yf(o,e.slice(i+1)),o=yf(o,[["exit",l,t]]),yh(e,r,e.length,o),e},tokenize:function(e,t,n){let r,i,o=this,s=o.events.length;for(;s--;)if(("labelImage"===o.events[s][1].type||"labelLink"===o.events[s][1].type)&&!o.events[s][1]._balanced){r=o.events[s][1];break}return function(t){return r?r._inactive?d(t):(i=o.parser.defined.includes(bz(o.sliceSerialize({start:r.end,end:o.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(xk,c,i?c:d)(t):91===t?e.attempt(xT,c,i?l:d)(t):i?c(t):d(t)}function l(t){return e.attempt(xN,c,d)(t)}function c(e){return t(e)}function d(e){return r._balanced=!0,n(e)}}},xk={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return bN(t)?xg(e,i)(t):i(t)}function i(t){return 41===t?c(t):xh(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return bN(t)?xg(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?xm(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return bN(t)?xg(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},xT={tokenize:function(e,t,n){let r=this;return function(t){return xf.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(bz(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},xN={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},xA={name:"labelStartImage",resolveAll:xw.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},xS={name:"labelStartLink",resolveAll:xw.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},xC={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),yI(e,t,"linePrefix")}}},x_={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(o){var s;return e.enter("thematicBreak"),r=s=o,function o(s){return s===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),bA(n)?yI(e,o,"whitespace")(n):o(n))}(s)):i>=3&&(null===s||bT(s))?(e.exit("thematicBreak"),t(s)):n(s)}(s)}}},xM={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(yD,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,yI(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!bA(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xI,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,yI(e,e.attempt(xM,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:bE(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(x_,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return bE(i)&&++s<10?(e.consume(i),t):(!r.interrupt||s<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),a(i)):n(i)}(t)}return n(t)};function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(yD,r.interrupt?n:l,e.attempt(xO,d,c))}function l(e){return r.containerState.initialBlankLine=!0,o++,d(e)}function c(t){return bA(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},xO={partial:!0,tokenize:function(e,t,n){let r=this;return yI(e,function(e){let i=r.events[r.events.length-1];return!bA(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},xI={partial:!0,tokenize:function(e,t,n){let r=this;return yI(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},xD={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);let s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=s,e.push(["exit",s,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var s;let a,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){a="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||a)?(e.enter("setextHeadingLine"),r=t,s=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),bA(n)?yI(e,o,"lineSuffix")(n):o(n))}(s)):n(t)};function o(r){return null===r||bT(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,xf.call(i,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function o(t){return(r=bz(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return bN(t)?xg(e,a)(t):a(t)}function a(t){return xh(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(xb,c,c)(t)}function c(t){return bA(t)?yI(e,d,"whitespace")(t):d(t)}function d(o){return null===o||bT(o)?(e.exit("definition"),i.parser.defined.push(r),t(o)):n(o)}}}},"disable",0,{null:[]},"document",0,{42:xM,43:xM,45:xM,48:xM,49:xM,50:xM,51:xM,52:xM,53:xM,54:xM,55:xM,56:xM,57:xM,62:xi},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,o=3;return"whitespace"===e[3][1].type&&(o+=2),i-2>o&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4),i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},yh(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var o;return e.enter("atxHeading"),o=i,e.enter("atxHeadingSequence"),function i(o){return 35===o&&r++<6?(e.consume(o),i):null===o||bN(o)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||bT(r)?(e.exit("atxHeading"),t(r)):bA(r)?yI(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||bN(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(o)):n(o)}(o)}}},42:x_,45:[xD,x_],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,o,s,a,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(s){return 33===s?(e.consume(s),d):47===s?(e.consume(s),i=!0,h):63===s?(e.consume(s),r=3,l.interrupt?t:I):bb(s)?(e.consume(s),o=String.fromCharCode(s),f):n(s)}function d(i){return 45===i?(e.consume(i),r=2,u):91===i?(e.consume(i),r=5,s=0,p):bb(i)?(e.consume(i),r=4,l.interrupt?t:I):n(i)}function u(r){return 45===r?(e.consume(r),l.interrupt?t:I):n(r)}function p(r){let i="CDATA[";return r===i.charCodeAt(s++)?(e.consume(r),s===i.length)?l.interrupt?t:T:p:n(r)}function h(t){return bb(t)?(e.consume(t),o=String.fromCharCode(t),f):n(t)}function f(s){if(null===s||47===s||62===s||bN(s)){let a=47===s,c=o.toLowerCase();return!a&&!i&&xx.includes(c)?(r=1,l.interrupt?t(s):T(s)):xy.includes(o.toLowerCase())?(r=6,a)?(e.consume(s),m):l.interrupt?t(s):T(s):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(s):i?function t(n){return bA(n)?(e.consume(n),t):w(n)}(s):g(s))}return 45===s||by(s)?(e.consume(s),o+=String.fromCharCode(s),f):n(s)}function m(r){return 62===r?(e.consume(r),l.interrupt?t:T):n(r)}function g(t){return 47===t?(e.consume(t),w):58===t||95===t||bb(t)?(e.consume(t),b):bA(t)?(e.consume(t),g):w(t)}function b(t){return 45===t||46===t||58===t||95===t||by(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),x):bA(t)?(e.consume(t),y):g(t)}function x(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,v):bA(t)?(e.consume(t),x):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||bN(n)?y(n):(e.consume(n),t)}(t)}function v(t){return t===a?(e.consume(t),a=null,E):null===t||bT(t)?n(t):(e.consume(t),v)}function E(e){return 47===e||62===e||bA(e)?g(e):n(e)}function w(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||bT(t)?T(t):bA(t)?(e.consume(t),k):n(t)}function T(t){return 45===t&&2===r?(e.consume(t),C):60===t&&1===r?(e.consume(t),_):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),I):93===t&&5===r?(e.consume(t),O):bT(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(xv,R,N)(t)):null===t||bT(t)?(e.exit("htmlFlowData"),N(t)):(e.consume(t),T)}function N(t){return e.check(xE,A,R)(t)}function A(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||bT(t)?N(t):(e.enter("htmlFlowData"),T(t))}function C(t){return 45===t?(e.consume(t),I):T(t)}function _(t){return 47===t?(e.consume(t),o="",M):T(t)}function M(t){if(62===t){let n=o.toLowerCase();return xx.includes(n)?(e.consume(t),D):T(t)}return bb(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):T(t)}function O(t){return 93===t?(e.consume(t),I):T(t)}function I(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),I):T(t)}function D(t){return null===t||bT(t)?(e.exit("htmlFlowData"),R(t)):(e.consume(t),D)}function R(n){return e.exit("htmlFlow"),t(n)}}},61:xD,95:x_,96:xd,126:xd},"flowInitial",0,{[-2]:xu,[-1]:xu,32:xu},"insideSpan",0,{null:[xn,y6]},"string",0,{38:xl,92:xo},"text",0,{[-5]:xC,[-4]:xC,[-3]:xC,33:xA,38:xl,42:xn,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return bb(t)?(e.consume(t),o):64===t?n(t):a(t)}function o(t){return 43===t||45===t||46===t||by(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,s):(43===n||45===n||46===n||by(n))&&r++<32?(e.consume(n),t):(r=0,a(n))}(t)):a(t)}function s(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||bv(r)?n(r):(e.consume(r),s)}function a(t){return 64===t?(e.consume(t),l):bx(t)?(e.consume(t),a):n(t)}function l(i){return by(i)?function i(o){return 46===o?(e.consume(o),r=0,l):62===o?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(o),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(o){if((45===o||by(o))&&r++<63){let n=45===o?t:i;return e.consume(o),n}return n(o)}(o)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,o,s=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),v):63===t?(e.consume(t),y):bb(t)?(e.consume(t),w):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,h):bb(t)?(e.consume(t),b):n(t)}function c(t){return 45===t?(e.consume(t),p):n(t)}function d(t){return null===t?n(t):45===t?(e.consume(t),u):bT(t)?(o=d,M(t)):(e.consume(t),d)}function u(t){return 45===t?(e.consume(t),p):d(t)}function p(e){return 62===e?_(e):45===e?u(e):d(e)}function h(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?f:h):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):bT(t)?(o=f,M(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?_(t):93===t?(e.consume(t),g):f(t)}function b(t){return null===t||62===t?_(t):bT(t)?(o=b,M(t)):(e.consume(t),b)}function y(t){return null===t?n(t):63===t?(e.consume(t),x):bT(t)?(o=y,M(t)):(e.consume(t),y)}function x(e){return 62===e?_(e):y(e)}function v(t){return bb(t)?(e.consume(t),E):n(t)}function E(t){return 45===t||by(t)?(e.consume(t),E):function t(n){return bT(n)?(o=t,M(n)):bA(n)?(e.consume(n),t):_(n)}(t)}function w(t){return 45===t||by(t)?(e.consume(t),w):47===t||62===t||bN(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),_):58===t||95===t||bb(t)?(e.consume(t),T):bT(t)?(o=k,M(t)):bA(t)?(e.consume(t),k):_(t)}function T(t){return 45===t||46===t||58===t||95===t||by(t)?(e.consume(t),T):function t(n){return 61===n?(e.consume(n),N):bT(n)?(o=t,M(n)):bA(n)?(e.consume(n),t):k(n)}(t)}function N(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,A):bT(t)?(o=N,M(t)):bA(t)?(e.consume(t),N):(e.consume(t),S)}function A(t){return t===r?(e.consume(t),r=void 0,C):null===t?n(t):bT(t)?(o=A,M(t)):(e.consume(t),A)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||bN(t)?k(t):(e.consume(t),S)}function C(e){return 47===e||62===e||bN(e)?k(e):n(e)}function _(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function M(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),O}function O(t){return bA(t)?yI(e,I,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):I(t)}function I(t){return e.enter("htmlTextData"),o(t)}}}],91:xS,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return bT(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},xo],93:xw,95:xn,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),o++,t):(e.exit("codeTextSequence"),s(n))}(t)};function s(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),s):96===l?(i=e.enter("codeTextSequence"),r=0,function n(s){return 96===s?(e.consume(s),r++,n):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(s)):(i.type="codeTextData",a(s))}(l)):bT(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):(e.enter("codeTextData"),a(l))}function a(t){return null===t||32===t||96===t||bT(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),a)}}}}],119210);var xR=e.i(119210);let xL=/[\0\t\n\r]/g;function xP(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let xj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xB(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return xP(n.slice(t?2:1),t?16:10)}return xa(n)||e}let xF={}.hasOwnProperty;function xH(e){return{line:e.line,column:e.column,offset:e.offset}}function xU(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+mS({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+mS({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+mS({start:t.start,end:t.end})+") is still open")}function xz(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let o=e.charCodeAt(n),s="";if(37===o&&by(e.charCodeAt(n+1))&&by(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){let t=e.charCodeAt(n+1);o<56320&&t>56319&&t<57344?(s=String.fromCharCode(o,t),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function x$(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function xG(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function xq(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift({type:"text",value:"["});let s=i[i.length-1];return s&&"text"===s.type?s.value+=r:i.push({type:"text",value:r}),i}function xV(e){let t=e.spread;return null==t?e.children.length>1:t}function xW(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let xK={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o={type:"element",tagName:"pre",properties:{},children:[o=e.applyData(t,o)]},e.patch(t,o),o},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),o=xz(i.toLowerCase()),s=e.footnoteOrder.indexOf(i),a=e.footnoteCounts.get(i);void 0===a?(a=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=s+1,a+=1,e.footnoteCounts.set(i,a);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xq(e,t);let i={src:xz(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){let n={src:xz(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xq(e,t);let i={href:xz(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){let n={href:xz(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=xV(n[r])}return t}(n):xV(t),o={},s=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){let e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&s.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?s.push(e):s.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&s.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=gi(t.children[1]),s=gr(t.children[t.children.length-1]);o&&s&&(r.position={start:o,end:s}),i.push(r)}let o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,s=o?o.length:t.children.length,a=-1,l=[];for(;++a<s;){let n=t.children[a],r={},s=o?o[a]:void 0;s&&(r.align=s);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,o=[];for(;r;)o.push(xW(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(xW(t.slice(i),i>0,!1)),o.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:xY,yaml:xY,definition:xY,footnoteDefinition:xY};function xY(){}let xX={}.hasOwnProperty,xQ={};function xJ(e,t){e.position&&(t.position=gs(e))}function xZ(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,m3(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function x0(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function x1(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function x2(e,t){let n,r,i,o,s=(n=t||xQ,r=new Map,i=new Map,o={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=o.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=x1(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=x1(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:xZ,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...xK,...n.handlers},one:function(e,t){let n=e.type,r=o.handlers[n];if(xX.call(o.handlers,n)&&r)return r(o,e,t);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=m3(n);return r.children=o.all(e),r}return m3(e)}return(o.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(xX.call(n,"hProperties")||xX.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(o,e,t)},options:n,patch:xJ,wrap:x0},gp(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o),a=s.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||x$,r=e.options.footnoteBackLabel||xG,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let o=e.all(i),s=String(i.identifier).toUpperCase(),c=xz(s.toLowerCase()),d=0,u=[],p=e.footnoteCounts.get(s);for(;void 0!==p&&++d<=p;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,d);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let h=o[o.length-1];if(h&&"element"===h.type&&"p"===h.tagName){let e=h.children[h.children.length-1];e&&"text"===e.type?e.value+=" ":h.children.push({type:"text",value:" "}),h.children.push(...u)}else o.push(...u);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(o,!0)};e.patch(i,f),a.push(f)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...m3(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(s),c=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&(p7("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function x3(e){if(e)throw e}var x5=e.i(975609);function x4(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let x6=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},x9={}.hasOwnProperty;class x7 extends x6{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(o,...s){let a=e[++n],l=-1;if(o)return void r(o);for(;++l<t.length;)(null===s[l]||void 0===s[l])&&(s[l]=t[l]);t=s,a?(function(e,t){let n;return function(...t){let o,s=e.length>t.length;s&&t.push(r);try{o=e.apply(this,t)}catch(e){if(s&&n)throw e;return r(e)}s||(o&&o.then&&"function"==typeof o.then?o.then(i,r):o instanceof Error?r(o):i(o))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(a,i)(...s):r(null,...s)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new x7,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,x5.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(vn("data",this.frozen),this.namespace[e]=t,this):x9.call(this.namespace,e)&&this.namespace[e]||void 0:e?(vn("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=vo(e),n=this.parser||this.Parser;return ve("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),ve("process",this.parser||this.Parser),vt("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let o=vo(e),s=n.parse(o);function a(e,n){e||!n?i(e):r?r(n):(p7(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(s,o,function(e,t,r){var i,o;if(e||!t||!r)return a(e);let s=n.stringify(t,r);"string"==typeof(i=s)||(o=i)&&"object"==typeof o&&"byteLength"in o&&"byteOffset"in o?r.value=s:r.result=s,a(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),ve("processSync",this.parser||this.Parser),vt("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,x3(e),t=r}),vi("processSync","process",n),p7(t,"we either bailed on an error or have a tree"),t}run(e,t,n){vr(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,o){p7("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let s=vo(t);r.run(e,s,function(t,r,s){let a=r||e;t?o(t):i?i(a):(p7(n,"`done` is defined if `resolve` is not"),n(void 0,a,s))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){x3(e),n=t,r=!0}),vi("runSync","run",r),p7(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=vo(t),r=this.compiler||this.Compiler;return vt("stringify",r),vr(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(vn("use",this.frozen),null==e);else if("function"==typeof e)s(e,t);else if("object"==typeof e)Array.isArray(e)?o(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,x5.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)s(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...o]=t,s=n[i][1];x4(s)&&x4(r)&&(r=(0,x5.default)(!0,s,r)),n[i]=[e,r,...o]}}}}let x8=new x7().freeze();function ve(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function vt(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function vn(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vr(e){if(!x4(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function vi(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function vo(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new mF(e)}let vs=/(?:youtube\.com\/(?:watch\?v=|shorts\/|embed\/|v\/)|youtu\.be\/)([A-Za-z0-9_-]{6,})/,va=/vimeo\.com\/(?:video\/)?(\d+)/,vl=/loom\.com\/share\/([A-Za-z0-9]+)/,vc=/^https?:\/\/(?:twitter\.com|x\.com)\/[^/]+\/status\/(\d+)/,vd=/^https?:\/\/(?:www\.)?facebook\.com\/.+/,vu=/^https?:\/\/(?:www\.)?instagram\.com\/(?:p|reel|tv)\/([^/?#]+)/,vp=/^https?:\/\/(?:www\.)?tiktok\.com\/@[^/]+\/video\/(\d+)/,vh=/^https?:\/\/open\.spotify\.com\/(track|album|playlist|episode|show)\/([A-Za-z0-9]+)/,vf=/\.(mp4|webm|ogg|mov|m4v)(\?|$)/i;function vm(e){let t=e.trim();if(!t)return null;let n=t.match(vs);if(n)return{provider:"youtube",embedUrl:`https://www.youtube.com/embed/${n[1]}`,originalUrl:t,aspectRatio:16/9};let r=t.match(va);if(r)return{provider:"vimeo",embedUrl:`https://player.vimeo.com/video/${r[1]}`,originalUrl:t,aspectRatio:16/9};let i=t.match(vl);if(i)return{provider:"loom",embedUrl:`https://www.loom.com/embed/${i[1]}`,originalUrl:t,aspectRatio:16/9};if(vc.test(t))return{provider:"twitter",embedUrl:t,originalUrl:t};if(vu.test(t))return{provider:"instagram",embedUrl:t.replace(/\/?(\?.*)?$/,"/embed"),originalUrl:t};let o=t.match(vp);if(o)return{provider:"tiktok",embedUrl:`https://www.tiktok.com/embed/v2/${o[1]}`,originalUrl:t,aspectRatio:9/16};let s=t.match(vh);return s?{provider:"spotify",embedUrl:`https://open.spotify.com/embed/${s[1]}/${s[2]}`,originalUrl:t}:vd.test(t)?{provider:"facebook",embedUrl:`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true`,originalUrl:t}:vf.test(t)||t.startsWith("/api/assets/")?{provider:"video",embedUrl:t,originalUrl:t}:/^https?:\/\//.test(t)?{provider:"iframe",embedUrl:t,originalUrl:t}:null}let vg={...g_,tagNames:Array.from(new Set([...g_.tagNames??[],"table","thead","tbody","tfoot","tr","th","td","colgroup","col","label","iframe","video"])),attributes:{...g_.attributes,table:[...g_.attributes?.table??[],"className","style"],th:[...g_.attributes?.th??[],"colSpan","rowSpan","style","className"],td:[...g_.attributes?.td??[],"colSpan","rowSpan","style","className"],col:["span","style","className"],colgroup:["span","style","className"],tr:["style","className"],a:[...g_.attributes?.a??[],"className",["dataWikiLink","true"],"dataSlug","dataAlias","dataAnchor",["dataBroken","true"],["dataPdfLink","true"]],input:["type","checked","disabled"],label:["className"],iframe:["src","allow","allowFullScreen","frameBorder","loading","referrerPolicy","dataEmbedProvider"],div:[...g_.attributes?.div??[],"className",["dataEmbed","true"],"dataProvider","dataSrc","dataOriginalUrl","dataAspectRatio"],li:[...g_.attributes?.li??[],"className","dataType","dataChecked"],ul:[...g_.attributes?.ul??[],"className","dataType"],"*":[...g_.attributes?.["*"]??[],"className","id"]},protocols:{...g_.protocols,src:[...g_.protocols?.src??[],"https"]}},vb=/\[\[([^\]|#]+)(?:\|([^\]]*)|#([^\]]*))?\]\]/g,vy=/^[a-z0-9-]+$/,vx=x8().use(function(e){let t=this;t.parser=function(n){var r,i;let o,s,a,l;return"object"==typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(b),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(f),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(h),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(h,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:c,htmlText:r(g,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(b),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(f),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:s(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:s(),autolinkEmail:function(e){d.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){d.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:s(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=xP(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=xa(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=xH(e.end)},codeFenced:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:d,codeIndented:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:d,data:d,definition:s(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=bz(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:s(),hardBreakEscape:s(u),hardBreakTrailing:s(u),htmlFlow:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:d,htmlText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:d,image:s(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(xj,xB),n.identifier=bz(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=xH(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),d.call(this,e))},link:s(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=bz(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:s(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:s(),thematicBreak:s()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(xF.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},s={stack:[r],tokenStack:[],config:t,enter:o,exit:a,buffer:i,resume:l,data:n},c=[],d=-1;for(;++d<e.length;)("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)&&("enter"===e[d][0]?c.push(d):d=function(e,t,n){let r,i,o,s,a=t-1,l=-1,c=!1;for(;++a<=n;){let t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,s=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||s||l||o||(o=a),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(i=void 0;s--;){let t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=s}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,o=void 0,s=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];xF.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},s),e[d][1])}if(s.tokenStack.length>0){let e=s.tokenStack[s.tokenStack.length-1];(e[1]||xU).call(s,void 0,e[0])}for(r.position={start:xH(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:xH(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r};function r(e,t){return function(n){o.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function o(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:xH(t.start),end:void 0}}function s(e){return function(t){e&&e.call(this,t),a.call(this,t)}}function a(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||xU).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+mS({start:e.start,end:e.end})+"): it’s not open");n.position.end=xH(e.end)}function l(){return b7(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:xH(e.start),end:void 0},t.push(n)),this.stack.push(n)}function d(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=xH(e.end)}function u(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function h(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function b(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!y2(e););return e}((function(e){let t={constructs:yg([xR,...(e||{}).extensions||[]]),content:n(yQ),defined:[],document:n(yJ),flow:n(y4),lazy:{},string:n(y9),text:n(y7)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},o=[],s=[],a=[],l={attempt:f(function(e,t){m(e,t.from)}),check:f(h),consume:function(e){bT(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,g()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=p(),c.events.push(["enter",n,c]),a.push(n),n},exit:function(e){let t=a.pop();return t.end=p(),c.events.push(["exit",t,c]),t},interrupt:f(h,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let o,s=e[r];if("string"==typeof s)o=s;else switch(s){case -5:o="\r";break;case -4:o="\n";break;case -3:o="\r\n";break;case -2:o=t?" ":" ";break;case -1:if(!t&&n)continue;o=" ";break;default:o=String.fromCharCode(s)}n=-2===s,i.push(o)}return i.join("")}(u(e),t)},sliceStream:u,write:function(e){return(s=yf(s,e),function(){let e;for(;r._index<s.length;){let n=s[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),d=d(t)}else d=d(n)}}(),null!==s[s.length-1])?[]:(m(t,0),c.events=yU(o,c.events,c),c.events)}},d=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function u(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;if(r===o)n=[e[r].slice(i,s)];else{if(n=e.slice(r,o),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[o].slice(0,s))}return n}(s,e)}function p(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:o}}function h(e,t){t.restore()}function f(e,t){return function(n,i,o){var s;let d,u,h,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(s=n,function(e){let t=null!==e&&s[e],n=null!==e&&s.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function m(e){return(d=e,u=0,0===e.length)?o:b(e[u])}function b(e){return function(n){let i,o,s,d,u;return(i=p(),o=c.previous,s=c.currentConstruct,d=c.events.length,u=Array.from(a),f={from:d,restore:function(){r=i,c.previous=o,c.currentConstruct=s,c.events.length=d,a=u,g()}},h=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?x(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,y,x)(n)}}function y(t){return e(h,f),i}function x(e){return(f.restore(),++u<d.length)?b(d[u]):o}}}function m(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&yh(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function g(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((s=1,a="",l=!0,function(e,t,n){let r,i,c,d,u,p=[];for(e=a+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,a="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(xL.lastIndex=c,d=(r=xL.exec(e))&&void 0!==r.index?r.index:e.length,u=e.charCodeAt(d),!r){a=e.slice(c);break}if(10===u&&c===d&&o)p.push(-3),o=void 0;else switch(o&&(p.push(-5),o=void 0),c<d&&(p.push(e.slice(c,d)),s+=d-c),u){case 0:p.push(65533),s++;break;case 9:for(i=4*Math.ceil(s/4),p.push(-2);s++<i;)p.push(-1);break;case 10:p.push(-4),s=1;break;default:o=!0,s=1}c=d+1}return n&&(o&&p.push(-5),a&&p.push(a),p.push(null)),p})(n,r,!0))))}}).use(function(e){let t,n,r,i=e||yX,o=this.data(),s=o.micromarkExtensions||(o.micromarkExtensions=[]),a=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),l=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);s.push(yg([{text:yN},{document:{91:{name:"gfmFootnoteDefinition",tokenize:yB,continuation:{tokenize:yF},exit:yH}},text:{91:{name:"gfmFootnoteCall",tokenize:yj},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:yL,resolveTo:yP}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,o=this.events,s=0;return function(a){return 126===i&&"characterEscape"!==o[o.length-1][1].type?r(a):(e.enter("strikethroughSequenceTemporary"),function o(a){let l=b6(i);if(126===a)return s>1?r(a):(e.consume(a),s++,o);if(s<2&&!t)return r(a);let c=e.exit("strikethroughSequenceTemporary"),d=b6(a);return c._open=!d||2===d&&!!l,c._close=!l||2===l&&!!d,n(a)}(a))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],a=t.parser.constructs.insideSpan.null;a&&yh(s,s.length,0,yU(a,e.slice(r+1,n),t)),yh(s,s.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),yh(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:y$,resolveAll:yG}}},{text:{91:yK}}])),a.push([{transforms:[bB],enter:{literalAutolink:bI,literalAutolinkEmail:bD,literalAutolinkHttp:bD,literalAutolinkWww:bD},exit:{literalAutolink:bj,literalAutolinkEmail:bP,literalAutolinkHttp:bR,literalAutolinkWww:bL}},{enter:{gfmFootnoteCallString:b$,gfmFootnoteCall:bG,gfmFootnoteDefinitionLabelString:bq,gfmFootnoteDefinition:bV},exit:{gfmFootnoteCallString:bW,gfmFootnoteCall:bK,gfmFootnoteDefinitionLabelString:bY,gfmFootnoteDefinition:bX}},{canContainEols:["delete"],enter:{strikethrough:b1},exit:{strikethrough:b2}},{enter:{table:yr,tableData:ya,tableHeader:ya,tableRow:yo},exit:{codeText:yl,table:yi,tableData:ys,tableHeader:ys,tableRow:ys}},{exit:{taskListCheckValueChecked:yd,taskListCheckValueUnchecked:yd,paragraph:yu}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bM,notInConstruct:bO},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bM,notInConstruct:bO},{character:":",before:"[ps]",after:"\\/",inConstruct:bM,notInConstruct:bO}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let o=n.createTracker(i),s=o.move("[^"),a=n.enter("footnoteDefinition"),l=n.enter("label");return s+=o.move(n.safe(n.associationId(e),{before:s,after:"]"})),l(),s+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),s+=o.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,o.current()),r?bZ:bJ))),a(),s},footnoteReference:bQ},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:b0}],handlers:{delete:b3}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=yt(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return a(function(e,t,n){let r=e.children,i=-1,o=[],s=t.enter("table");for(;++i<r.length;)o[i]=l(r[i],t,n);return s(),o}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){let i=a([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function s(e,t,n,r){let i=n.enter("tableCell"),s=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:o,after:o});return s(),i(),a}function a(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||b5,o=[],s=[],a=[],l=[],c=0,d=-1;for(;++d<e.length;){let t=[],r=[],o=-1;for(e[d].length>c&&(c=e[d].length);++o<e[d].length;){var u;let s=null==(u=e[d][o])?"":String(u);if(!1!==n.alignDelimiters){let e=i(s);r[o]=e,(void 0===l[o]||e>l[o])&&(l[o]=e)}t.push(s)}s[d]=t,a[d]=r}let p=-1;if("object"==typeof r&&"length"in r)for(;++p<c;)o[p]=b4(r[p]);else{let e=b4(r);for(;++p<c;)o[p]=e}p=-1;let h=[],f=[];for(;++p<c;){let e=o[p],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[p]-t.length-r.length),s=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[p]&&(l[p]=i),f[p]=i),h[p]=s}s.splice(1,0,h),a.splice(1,0,f),d=-1;let m=[];for(;++d<s.length;){let e=s[d],t=a[d];p=-1;let r=[];for(;++p<c;){let i=e[p]||"",s="",a="";if(!1!==n.alignDelimiters){let e=l[p]-(t[p]||0),n=o[p];114===n?s=" ".repeat(e):99===n?e%2?(s=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):a=s=" ".repeat(e/2):a=" ".repeat(e)}!1===n.delimiterStart||p||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||p)&&r.push(" "),!1!==n.alignDelimiters&&r.push(s),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||p!==c-1)&&r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,o=[],a=t.enter("tableRow");for(;++i<r.length;)o[i]=s(r[i],e,t,n);return a(),o}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:yp}}]})}).use(function(e,t){return e&&"run"in e?async function(n,r){let i=x2(n,{file:r,...t});await e.run(i,r)}:function(n,r){return x2(n,{file:r,...e||t})}},{allowDangerousHtml:!0}).use(bg,{allowDangerousHtml:!0}).freeze(),vv=x8().use(function(e){let{emitParseErrors:t,...n}={...this.data("settings"),...e};this.parser=function(e,r){let i,o,s,a,l;return o=(i={...n,onerror:t?function(e){r.path&&(e.name=r.path+":"+e.name,e.file=r.path),r.messages.push(e)}:void 0}).onerror,s=e instanceof mF?e:new mF(e),a=i.fragment?mA:mN,hq(a(l=String(s),{sourceCodeLocationInfo:!0,onParseError:i.onerror?function(e){let t=e.code,n=t.replace(mG,mK),r=i[n],a=null==r||r,c="number"==typeof a?a:+!!a;if(c){let r=m$[n];p7(r,"expected known error from `parse5`");let i=new mO(d(r.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:"hast-util-from-html"});s.path&&(i.file=s.path,i.name=s.path+":"+i.name),i.fatal=mW[c],i.note=d(r.description),i.url=!1===r.url?void 0:"https://html.spec.whatwg.org/multipage/parsing.html#parse-error-"+t,p7(o,"`internalOnerror` is not passed if `onerror` is not set"),o(i)}function d(t){return t.replace(mq,function(t,n,r){var i;let o=(r?Number.parseInt(r,10):0)*("-"===n?-1:1);return"`"===(i=l.charAt(e.startOffset+o))?"` ` `":i}).replace(mV,function(){return"0x"+l.charCodeAt(e.startOffset).toString(16).toUpperCase()})}}:null,scriptingEnabled:!1}),{file:s,space:i.space,verbose:i.verbose})}},{fragment:!0}).use(function(e){return function(t,n){return gg(t,{...e,file:n})}}).use(function(e){return function(t){let n,r;return n={type:"root",children:[]},(r=gO({schema:e?{...g_,...e}:g_,stack:[]},t))&&(Array.isArray(r)?1===r.length?n=r[0]:n.children=r:n=r),n}},vg).use(bg).freeze();async function vE(e,t){var n,r;let i="string"==typeof t?{pagePath:t}:t??{},o=e.replace(vb,(e,t,n,r)=>{let i=t.trim();if(!vy.test(i))return e;let o=n??(r?`${i}#${r}`:i),s=r?`#wiki:${i}#${r}`:`#wiki:${i}`,a=void 0!==n?` data-alias="${n}"`:"",l=void 0!==r?` data-anchor="${r}"`:"";return`<a data-wiki-link="true" data-slug="${i}"${a}${l} href="${s}" class="wiki-link">${o}</a>`}),s=String(await vx.process(o));return s=(s=s.replace(/<ul class="contains-task-list">/g,'<ul data-type="taskList" class="task-list">').replace(/<li class="task-list-item">\s*<input type="checkbox"([^>]*)>\s*([\s\S]*?)(?=<\/li>)/g,(e,t,n)=>{let r=t.includes("checked"),i=n.trim();return`<li data-type="taskItem" data-checked="${r}"><label><input type="checkbox"${r?" checked":""}></label><div><p>${i}</p></div>`})).replace(/<video\b([^>]*)\bsrc="([^"]+)"([^>]*)><\/video>/gi,(e,t,n,r)=>{let i=vm(n);if(!i||"video"===i.provider)return e;let o=i.aspectRatio?` data-aspect-ratio="${i.aspectRatio}"`:"";return`<div data-embed="true" data-provider="${i.provider}" data-src="${i.embedUrl}" data-original-url="${i.originalUrl}"${o}><iframe src="${i.embedUrl}" data-embed-provider="${i.provider}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>`}),i.pagePath&&(n=s,r=i.pagePath,s=n=(n=(n=(n=n.replace(/href="\.\/([^"]+)"/g,(e,t)=>`href="/api/assets/${r}/${t}"`)).replace(/src="\.\/([^"]+)"/g,(e,t)=>`src="/api/assets/${r}/${t}"`)).replace(/data-src="\.\/([^"]+)"/g,(e,t)=>`data-src="/api/assets/${r}/${t}"`)).replace(/<a([^>]*?)href="(\/api\/assets\/[^"]+\.pdf)"([^>]*?)>/gi,(e,t,n,r)=>`<a${t}href="${n}"${r} data-pdf-link="true">`)),i.sanitize&&(s=String(await vv.process(s))),s}function vw(e,t){return Array(t+1).join(e)}function vk(e){return e.replace(/^\n*/,"")}function vT(e){for(var t=e.length;t>0&&"\n"===e[t-1];)t--;return e.substring(0,t)}var vN=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function vA(e){return vM(e,vN)}var vS=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function vC(e){return vM(e,vS)}var v_=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function vM(e,t){return t.indexOf(e.nodeName)>=0}function vO(e,t){return e.getElementsByTagName&&t.some(function(t){return e.getElementsByTagName(t).length})}var vI=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function vD(e){return vI.reduce(function(e,t){return e.replace(t[0],t[1])},e)}var vR={};function vL(e){return e?e.replace(/(\n+\s*)+/g,"\n"):""}function vP(e){var t=e.replace(/([<>()])/g,"\\$1");return t.indexOf(" ")>=0?"<"+t+">":t}function vj(e){return e.replace(/"/g,'\\"')}function vB(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}function vF(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(function(e,t,n){var r=e.filter;if("string"==typeof r){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if("function"==typeof r){if(r.call(e,t,n))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}(i,t,n))return i}}function vH(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function vU(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}vR.paragraph={filter:"p",replacement:function(e){return"\n\n"+e+"\n\n"}},vR.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+"\n"}},vR.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if("setext"!==n.headingStyle||!(r<3))return"\n\n"+vw("#",r)+" "+e+"\n\n";var i=vw(1===r?"=":"-",e.length);return"\n\n"+e+"\n"+i+"\n\n"}},vR.blockquote={filter:"blockquote",replacement:function(e){return"\n\n"+(e=vT(vk(e)).replace(/^/gm,"> "))+"\n\n"}},vR.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return"LI"===n.nodeName&&n.lastElementChild===t?"\n"+e:"\n\n"+e+"\n\n"}},vR.listItem={filter:"li",replacement:function(e,t,n){var r=n.bulletListMarker+" ",i=t.parentNode;if("OL"===i.nodeName){var o=i.getAttribute("start"),s=Array.prototype.indexOf.call(i.children,t);r=(o?Number(o)+s:s+1)+". "}var a=/\n$/.test(e);return e=(e=vT(vk(e))+(a?"\n":"")).replace(/\n/gm,"\n"+" ".repeat(r.length)),r+e+(t.nextSibling?"\n":"")}},vR.indentedCodeBlock={filter:function(e,t){return"indented"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){return"\n\n "+t.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},vR.fencedCodeBlock={filter:function(e,t){return"fenced"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){for(var r,i=((t.firstChild.getAttribute("class")||"").match(/language-(\S+)/)||[null,""])[1],o=t.firstChild.textContent,s=n.fence.charAt(0),a=3,l=RegExp("^"+s+"{3,}","gm");r=l.exec(o);)r[0].length>=a&&(a=r[0].length+1);var c=vw(s,a);return"\n\n"+c+i+"\n"+o.replace(/\n$/,"")+"\n"+c+"\n\n"}},vR.horizontalRule={filter:"hr",replacement:function(e,t,n){return"\n\n"+n.hr+"\n\n"}},vR.inlineLink={filter:function(e,t){return"inlined"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t){var n=vP(t.getAttribute("href")),r=vj(vL(t.getAttribute("title")));return"["+e+"]("+n+(r?' "'+r+'"':"")+")"}},vR.referenceLink={filter:function(e,t){return"referenced"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t,n){var r,i,o=vP(t.getAttribute("href")),s=vL(t.getAttribute("title"));switch(s&&(s=' "'+vj(s)+'"'),n.linkReferenceStyle){case"collapsed":r="["+e+"][]",i="["+e+"]: "+o+s;break;case"shortcut":r="["+e+"]",i="["+e+"]: "+o+s;break;default:var a=this.references.length+1;r="["+e+"]["+a+"]",i="["+a+"]: "+o+s}return this.references.push(i),r},references:[],append:function(e){var t="";return this.references.length&&(t="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),t}},vR.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}},vR.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}},vR.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n="PRE"===e.parentNode.nodeName&&!t;return"CODE"===e.nodeName&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];-1!==r.indexOf(n);)n+="`";return n+t+e+t+n}},vR.image={filter:"img",replacement:function(e,t){var n=vD(vL(t.getAttribute("alt"))),r=vP(t.getAttribute("src")||""),i=vL(t.getAttribute("title")),o=i?' "'+vj(i)+'"':"";return r?"":""}},vB.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){var t;return e.isBlank?this.blankRule:(t=vF(this.array,e,this.options))||(t=vF(this._keep,e,this.options))||(t=vF(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};var vz="u">typeof window?window:{},v$=!function(){var e=vz.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch(e){}return t}()?(M=function(){},!function(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){vz.ActiveXObject&&(e=!0)}return e}()?M.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),t}:M.prototype.parseFromString=function(e){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(e),t.close(),t},M):vz.DOMParser;function vG(e,t){var n;return!function(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(e){return"PRE"===e.nodeName};if(!(!t.firstChild||i(t))){for(var o=null,s=!1,a=null,l=vU(null,t,i);l!==t;){if(3===l.nodeType||4===l.nodeType){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!s&&" "===c[0]&&(c=c.substr(1)),!c){l=vH(l);continue}l.data=c,o=l}else if(1===l.nodeType)n(l)||"BR"===l.nodeName?(o&&(o.data=o.data.replace(/ $/,"")),o=null,s=!1):r(l)||i(l)?(o=null,s=!0):o&&(s=!1);else{l=vH(l);continue}var d=vU(a,l,i);a=l,l=d}o&&(o.data=o.data.replace(/ $/,""),o.data||vH(o))}}({element:n="string"==typeof e?(Y=Y||new v$).parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html").getElementById("turndown-root"):e.cloneNode(!0),isBlock:vA,isVoid:vC,isPre:t.preformattedCode?vq:null}),n}function vq(e){return"PRE"===e.nodeName||"CODE"===e.nodeName}function vV(e,t){var n;return e.isBlock=vA(e),e.isCode="CODE"===e.nodeName||e.parentNode.isCode,e.isBlank=!vC(n=e)&&!vM(n,v_)&&/^\s*$/i.test(n.textContent)&&!vO(n,vS)&&!vO(n,v_),e.flankingWhitespace=function(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n,r={leading:(n=e.textContent.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/))[1],leadingAscii:n[2],leadingNonAscii:n[3],trailing:n[4],trailingNonAscii:n[5],trailingAscii:n[6]};return r.leadingAscii&&vW("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&vW("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}(e,t),e}function vW(e,t,n){var r,i,o;return"left"===e?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(3===r.nodeType?o=i.test(r.nodeValue):n.preformattedCode&&"CODE"===r.nodeName?o=!1:1!==r.nodeType||vA(r)||(o=i.test(r.textContent))),o}var vK=Array.prototype.reduce;function vY(e){if(!(this instanceof vY))return new vY(e);this.options=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}({},{rules:vR,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(e,t){return t.isBlock?"\n\n":""},keepReplacement:function(e,t){return t.isBlock?"\n\n"+t.outerHTML+"\n\n":t.outerHTML},defaultReplacement:function(e,t){return t.isBlock?"\n\n"+e+"\n\n":e}},e),this.rules=new vB(this.options)}function vX(e){var t=this;return vK.call(e.childNodes,function(e,n){n=new vV(n,t.options);var r="";return 3===n.nodeType?r=n.isCode?n.nodeValue:t.escape(n.nodeValue):1===n.nodeType&&(r=vJ.call(t,n)),vZ(e,r)},"")}function vQ(e){var t=this;return this.rules.forEach(function(n){"function"==typeof n.append&&(e=vZ(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function vJ(e){var t=this.rules.forNode(e),n=vX.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function vZ(e,t){var n=vT(e),r=vk(t),i=Math.max(e.length-n.length,t.length-r.length);return n+"\n\n".substring(0,i)+r}vY.prototype={turndown:function(e){var t;if(!(null!=(t=e)&&("string"==typeof t||t.nodeType&&(1===t.nodeType||9===t.nodeType||11===t.nodeType))))throw TypeError(e+" is not a string, or an element/document/fragment node.");return""===e?"":vQ.call(this,vX.call(this,new vG(e,this.options)))},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if("function"==typeof e)e(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return vD(e)}};var v0=/highlight-(?:text|source)-([a-z0-9]+)/;function v1(e){e.addRule("highlightedCodeBlock",{filter:function(e){var t=e.firstChild;return"DIV"===e.nodeName&&v0.test(e.className)&&t&&"PRE"===t.nodeName},replacement:function(e,t,n){var r=((t.className||"").match(v0)||[null,""])[1];return"\n\n"+n.fence+r+"\n"+t.firstChild.textContent+"\n"+n.fence+"\n\n"}})}function v2(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~"+e+"~"}})}var v3=Array.prototype.indexOf,v5=Array.prototype.every,v4={};function v6(e){var t,n,r=e.parentNode;return"THEAD"===r.nodeName||r.firstChild===e&&("TABLE"===r.nodeName||(n=(t=r).previousSibling,"TBODY"===t.nodeName&&(!n||"THEAD"===n.nodeName&&/^\s*$/i.test(n.textContent))))&&v5.call(e.childNodes,function(e){return"TH"===e.nodeName})}function v9(e,t){var n=v3.call(t.parentNode.childNodes,t),r=" ";return 0===n&&(r="| "),r+e+" |"}function v7(e){for(var t in e.keep(function(e){return"TABLE"===e.nodeName&&!v6(e.rows[0])}),v4)e.addRule(t,v4[t])}function v8(e){e.addRule("taskListItems",{filter:function(e){return"checkbox"===e.type&&"LI"===e.parentNode.nodeName},replacement:function(e,t){return(t.checked?"[x]":"[ ]")+" "}})}v4.tableCell={filter:["th","td"],replacement:function(e,t){return v9(e,t)}},v4.tableRow={filter:"tr",replacement:function(e,t){var n="",r={left:":--",right:"--:",center:":-:"};if(v6(t))for(var i=0;i<t.childNodes.length;i++){var o="---",s=(t.childNodes[i].getAttribute("align")||"").toLowerCase();s&&(o=r[s]||o),n+=v9(o,t.childNodes[i])}return"\n"+e+(n?"\n"+n:"")}},v4.table={filter:function(e){return"TABLE"===e.nodeName&&v6(e.rows[0])},replacement:function(e){return"\n\n"+(e=e.replace("\n\n","\n"))+"\n\n"}},v4.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};let Ee=new vY({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**"});for(let e of(Ee.use(function(e){e.use([v1,v2,v7,v8])}),Ee.addRule("codeBlock",{filter:e=>"PRE"===e.nodeName&&null!==e.firstChild&&"CODE"===e.firstChild.nodeName,replacement:(e,t)=>{let n=t.firstChild,r=n.getAttribute("class")?.replace("language-","")||"",i=n.textContent||"";return`
|
|
87
|
+
\`\`\`${r}
|
|
88
|
+
${i}
|
|
89
|
+
\`\`\`
|
|
90
|
+
`}}),Ee.addRule("wikiLink",{filter:e=>"A"===e.nodeName&&"true"===e.getAttribute("data-wiki-link"),replacement:(e,t)=>{let n=t.getAttribute("data-slug")??"",r=t.getAttribute("data-alias"),i=t.getAttribute("data-anchor");return r?`[[${n}|${r}]]`:i?`[[${n}#${i}]]`:`[[${n}]]`}}),Ee.addRule("proofSpan",{filter:e=>"PROOF-SPAN"===e.nodeName,replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,""")}"`);return`<proof-span${n.length?" "+n.join(" "):""}>${e}</proof-span>`}}),Ee.addRule("styledSpan",{filter:e=>"SPAN"===e.nodeName&&!!e.getAttribute("style"),replacement:(e,t)=>{let n=t.getAttribute("style")??"";return`<span style="${n}">${e}</span>`}}),Ee.addRule("lucideIcon",{filter:e=>"SPAN"===e.nodeName&&e.hasAttribute("data-lucide"),replacement:(e,t)=>{let n=t.getAttribute("data-lucide")??"file",r=t.getAttribute("data-color")??"gray";return`<span data-lucide="${n}" data-color="${r}"> </span>`}}),Ee.addRule("mark",{filter:"mark",replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,""")}"`);return`<mark${n.length?` ${n.join(" ")}`:""}>${e}</mark>`}}),["u","sub","sup"]))Ee.addRule(e,{filter:e,replacement:t=>`<${e}>${t}</${e}>`});function Et(e){return Ee.turndown(e)}Ee.addRule("video",{filter:"video",replacement:(e,t)=>{let n=t.getAttribute("src")??"",r=n?vm(n):null;if(r&&"video"!==r.provider){let e=r.aspectRatio?` data-aspect-ratio="${r.aspectRatio}"`:"";return`
|
|
91
|
+
<div data-embed="true" data-provider="${r.provider}" data-src="${r.embedUrl}" data-original-url="${r.originalUrl}"${e}><iframe src="${r.embedUrl}" data-embed-provider="${r.provider}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>
|
|
92
|
+
`}let i=[];for(let e of Array.from(t.attributes))i.push(`${e.name}="${e.value.replace(/"/g,""")}"`);return`<video${i.length?` ${i.join(" ")}`:""}></video>`}}),Ee.addRule("embedBlock",{filter:e=>"DIV"===e.nodeName&&"true"===e.getAttribute("data-embed"),replacement:(e,t)=>{let n=t.getAttribute("data-provider")??"iframe",r=t.getAttribute("data-src")??"",i=t.getAttribute("data-original-url")??"",o=t.getAttribute("data-aspect-ratio")??"";if("video"===n)return`
|
|
93
|
+
<video src="${r}" controls></video>
|
|
94
|
+
`;let s=['data-embed="true"',`data-provider="${n}"`,`data-src="${r}"`,i?`data-original-url="${i}"`:"",o?`data-aspect-ratio="${o}"`:""].filter(Boolean).join(" ");return`
|
|
95
|
+
<div ${s}><iframe src="${r}" data-embed-provider="${n}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>
|
|
96
|
+
`}}),Ee.addRule("twitterEmbed",{filter:e=>"BLOCKQUOTE"===e.nodeName&&e.classList.contains("twitter-tweet"),replacement:(e,t)=>{let n=t.querySelector("a"),r=n?.getAttribute("href")??"";return`
|
|
97
|
+
<blockquote class="twitter-tweet" data-theme="auto"><a href="${r}">${r}</a></blockquote>
|
|
98
|
+
`}}),Ee.addRule("sizedImage",{filter:e=>{if("IMG"!==e.nodeName)return!1;let t=e.getAttribute("width")??e.style.width,n=e.getAttribute("data-align");return!!(t||n)},replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,""")}"`);return`<img ${n.join(" ")} />`}}),Ee.addRule("resizableImageWrapper",{filter:e=>"DIV"===e.nodeName&&e.classList.contains("resizable-image"),replacement:e=>e}),Ee.addRule("inlineMath",{filter:e=>{if("SPAN"!==e.nodeName)return!1;let t=e.getAttribute("data-type");return"inline-math"===t||"inlineMath"===t},replacement:(e,t)=>{let n=t.getAttribute("data-latex")??"";return`$${n}$`}}),Ee.addRule("alignedBlock",{filter:e=>{if(!["P","H1","H2","H3","H4","H5","H6"].includes(e.nodeName))return!1;let t=e.getAttribute("style")??"";return/text-align:\s*(center|right|justify)/.test(t)},replacement:(e,t)=>{let n=t.nodeName.toLowerCase(),r=t.getAttribute("style")??"";return`
|
|
99
|
+
<${n} style="${r}">${e}</${n}>
|
|
100
|
+
`}});let En=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,o);return o},Er=e=>{let t=e?En(e):En,n=e=>(function(e,t=e=>e){let n=Q.default.useSyncExternalStore(e.subscribe,Q.default.useCallback(()=>t(e.getState()),[e,t]),Q.default.useCallback(()=>t(e.getInitialState()),[e,t]));return Q.default.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},Ei=e=>e?Er(e):Er,Eo=Ei(e=>({isOpen:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),toggle:()=>e(e=>({isOpen:!e.isOpen})),clearMessages:()=>{},activity:[],connections:[],hasToken:!1,pollIntervalMs:1e4,rateLimit:null,loadActivity:async()=>{let t=localStorage.getItem("wiki-agent-token")??null,n=!!(t&&t.trim());try{let t=await r$("/api/agent/activity?limit=50",{headers:{}});if(!t.ok)return void e({hasToken:n});let r=(await t.json()).events??[],i=function(e){let t=new Date(Date.now()-3e5).toISOString(),n=new Map;for(let r of e){if(r.at<t)continue;let e=n.get(r.by);e?n.set(r.by,{opCount:e.opCount+1,lastSeen:r.at>e.lastSeen?r.at:e.lastSeen}):n.set(r.by,{opCount:1,lastSeen:r.at})}return Array.from(n.entries()).map(([e,t])=>({by:e,...t})).sort((e,t)=>e.lastSeen<t.lastSeen?1:-1)}(r),o=null;try{let e=await r$("/api/agent/settings",{headers:{}});e.ok&&(o=(await e.json()).rateLimit??null)}catch{}e({activity:r,connections:i,hasToken:n,rateLimit:o})}catch{e({hasToken:n})}}}));class Es extends Error{status;constructor(e,t){super(e),this.status=t,this.name="FetchPageError"}}async function Ea(e){let t=await r$(`/api/wiki/content?path=${encodeURIComponent(e)}`);if(!t.ok)throw new Es(`Failed to fetch page: ${e}`,t.status);let n=await t.json(),r=t.headers.get("X-Wiki-Revision"),i=null!==r?Number(r):null;return{path:e,content:n.content,frontmatter:null,revision:i}}class El extends Error{currentRevision;serverContent;constructor(e,t){super("File was modified externally. Reloaded with latest content."),this.currentRevision=e,this.serverContent=t,this.name="StaleRevisionError"}}async function Ec(e,t,n){let r={path:e,content:t};null!==n&&(r.baseRevision=n);let i=await r$("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(409===i.status){let n=await i.json(),r=await r$(`/api/wiki/content?path=${encodeURIComponent(e)}`),o=r.ok?(await r.json()).content:t;throw new El(n.currentRevision??0,o)}if(!i.ok)throw Error("Failed to save page");return{revision:(await i.json()).revision??null}}async function Ed(e,t=""){await Ec(e,t,null)}let Eu="kb-page-cache";function Ep(e){try{localStorage.setItem(Eu,JSON.stringify(e))}catch{}}let Eh="kb-edit-mode",Ef=null,Em=null,Eg=Ei((e,t)=>({currentPath:null,content:"",frontmatter:null,saveStatus:"idle",loadStatus:"idle",isDirty:!1,isLoading:!1,lastSavedAt:null,currentRevision:null,editMode:"suggesting"===localStorage.getItem(Eh)?"suggesting":"editing",setEditMode:t=>{localStorage.setItem(Eh,t),e({editMode:t})},loadPage:async n=>{let r=t();r.isDirty&&r.currentPath&&r.currentPath!==n&&await t().save(),e({currentPath:n,isLoading:!0,loadStatus:"loading",isDirty:!1,content:"",currentRevision:null});let i=function(e){try{let t=localStorage.getItem(Eu);if(!t)return null;let n=JSON.parse(t);if(n.path!==e)return null;return n}catch{return null}}(n);i&&e({content:i.content,frontmatter:i.frontmatter,isLoading:!1,loadStatus:"ok"});try{let r=await Ea(n);if(t().currentPath!==n)return;e({content:r.content,frontmatter:r.frontmatter,isLoading:!1,loadStatus:"ok",currentRevision:r.revision}),Ep({path:n,content:r.content,frontmatter:r.frontmatter})}catch(r){if(t().currentPath!==n)return;r instanceof Es&&404===r.status?e({isLoading:!1,loadStatus:"missing",content:""}):e({isLoading:!1,loadStatus:"error"})}},updateContent:n=>{"suggesting"===t().editMode?e({content:n}):(e({content:n,isDirty:!0}),Ef&&clearTimeout(Ef),Ef=setTimeout(()=>{t().save()},500))},updateFrontmatter:n=>{e({frontmatter:{...t().frontmatter,...n},isDirty:!0}),Ef&&clearTimeout(Ef),Ef=setTimeout(()=>{t().save()},500)},save:async()=>{let{currentPath:n,content:r,isDirty:i,currentRevision:o,editMode:s}=t();if(n&&i&&"suggesting"!==s){e({saveStatus:"saving"});try{let i=await Ec(n,r,o);e({saveStatus:"saved",isDirty:!1,lastSavedAt:Date.now(),currentRevision:i.revision??o}),Ep({path:n,content:r,frontmatter:t().frontmatter}),Em&&clearTimeout(Em),Em=setTimeout(()=>{"saved"===t().saveStatus&&e({saveStatus:"idle"})},2e3)}catch(r){r instanceof El?(e({content:r.serverContent,isDirty:!1,saveStatus:"error",currentRevision:r.currentRevision}),Ep({path:n,content:r.serverContent,frontmatter:t().frontmatter})):e({saveStatus:"error"})}}},createMissingPage:async n=>{let{currentPath:r}=t();if(!r)return;let i=`# ${n}
|
|
101
|
+
|
|
102
|
+
`;try{await Ed(`${r}/index.md`,i),e({content:i,isDirty:!1,loadStatus:"ok"}),Ep({path:r,content:i,frontmatter:null})}catch{}},clear:()=>{Ef&&clearTimeout(Ef),Em&&clearTimeout(Em),e({currentPath:null,content:"",frontmatter:null,saveStatus:"idle",loadStatus:"idle",isDirty:!1,isLoading:!1,lastSavedAt:null,currentRevision:null})},syncRevision:t=>{e({currentRevision:t})}})),Eb=Ei((e,t)=>({nodes:[],selectedPath:null,expandedPaths:new Set,loadTree:async()=>{},selectPage:t=>{e({selectedPath:t})},expandPath:n=>{let{expandedPaths:r}=t();if(!r.has(n)){let t=new Set(r);t.add(n),e({expandedPaths:t})}},focusPath:n=>{let{expandedPaths:r}=t(),i=new Set(r),o=n.split("/");for(let e=1;e<o.length;e++)i.add(o.slice(0,e).join("/"));e({selectedPath:n,expandedPaths:i})}})),Ey="wiki-view-width",Ex={narrow:"max-w-2xl",normal:"max-w-4xl",wide:"max-w-screen-xl"},Ev={narrow:"42rem",normal:"56rem",wide:"80rem"},EE={narrow:"Narrow",normal:"Normal",wide:"Wide"},Ew=["narrow","normal","wide"],Ek=Ei(e=>{let t;return{width:"narrow"===(t=localStorage.getItem(Ey))||"normal"===t||"wide"===t?t:"normal",setWidth:t=>{localStorage.setItem(Ey,t),e({width:t})},cycle:()=>e(e=>{let t=Ew.indexOf(e.width),n=Ew[(t+1)%Ew.length];return localStorage.setItem(Ey,n),{width:n}})}}),ET=Ei((e,t)=>({slugs:new Set,slugDir:new Map,loadedAt:null,loading:!1,load:async()=>{let{loadedAt:n,loading:r}=t();if(!r&&!(null!==n&&Date.now()-n<1e4)){e({loading:!0});try{let t=await r$("/api/wiki/slugs");if(!t.ok)throw Error("Failed to fetch wiki slugs");let n=await t.json(),r=new Set,i=new Map;for(let e of["entities","concepts","comparisons","root"])for(let t of n[e])r.add(t),i.has(t)||i.set(t,e);e({slugs:r,slugDir:i,loadedAt:Date.now(),loading:!1})}catch{e({loading:!1})}}},has:e=>t().slugs.has(e),getDir:e=>t().slugDir.get(e)??null,invalidate(){e({loadedAt:null})}}));function EN(){return{sidecar:null,snapshotRevision:0,lastEventId:0,snapshotBlocks:[]}}let EA=Ei((e,t)=>({byPath:{},loadSidecar:async t=>{let n=encodeURIComponent(t).replace(/%2F/g,"/");try{let r=await r$(`/api/agent/sidecar/${n}`,{headers:{}});if(!r.ok)return;let i=await r.json();e(e=>({byPath:{...e.byPath,[t]:{...e.byPath[t]??EN(),sidecar:i,snapshotRevision:i.revision,lastEventId:i.nextEventId-1}}}))}catch{}},loadSnapshot:async t=>{let n=encodeURIComponent(t).replace(/%2F/g,"/");try{let r=await r$(`/api/agent/files/${n}`,{headers:{}});if(!r.ok)return;let i=await r.json();e(e=>({byPath:{...e.byPath,[t]:{...e.byPath[t]??EN(),snapshotBlocks:i.blocks,snapshotRevision:i.revision}}}));let o=Eg.getState();o.currentPath===t&&o.syncRevision(i.revision)}catch{}},pollEvents:async e=>{let n=t().byPath[e]??EN(),r=encodeURIComponent(e).replace(/%2F/g,"/");try{let i=await r$(`/api/agent/events/${r}?after=${n.lastEventId}`,{headers:{}});if(!i.ok)return;for(let n of(await i.json()).events)t().applyEvent(e,n)}catch{}},applyEvent:(t,n)=>{e(e=>{let r=e.byPath[t]??EN();return{byPath:{...e.byPath,[t]:{...r,lastEventId:Math.max(r.lastEventId,n.id)}}}})},reset:t=>{e(e=>{let n={...e.byPath};return delete n[t],{byPath:n}})}}));async function ES(e,t,n){let r=encodeURIComponent(e).replace(/%2F/g,"/"),i=await fetch(`/api/agent/files/${r}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:"human",ops:[n]})});if(409===i.status){let e=await i.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return{ok:i.ok,stale:!1}}async function EC(e){let{path:t,ref:n,kind:r,markdown:i,basisDetail:o,getRevision:s,refresh:a}=e,l={type:"suggestion.add",ref:n,kind:r,basis:"suggested"};"delete"!==r&&(l.markdown=i??""),o&&(l.basisDetail=o);let c=await ES(t,s(),l);return!c.ok&&c.stale&&void 0!==c.newRevision&&(await a(),c=await ES(t,c.newRevision,l)),c.ok}let E_=["top","right","bottom","left"],EM=E_.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),EO=Math.min,EI=Math.max,ED=Math.round,ER=Math.floor,EL=e=>({x:e,y:e}),EP={left:"right",right:"left",bottom:"top",top:"bottom"};function Ej(e,t){return"function"==typeof e?e(t):e}function EB(e){return e.split("-")[0]}function EF(e){return e.split("-")[1]}function EH(e){return"x"===e?"y":"x"}function EU(e){return"y"===e?"height":"width"}function Ez(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function E$(e,t,n){void 0===n&&(n=!1);let r=EF(e),i=EH(Ez(e)),o=EU(i),s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=EY(s)),[s,EY(s)]}function EG(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let Eq=["left","right"],EV=["right","left"],EW=["top","bottom"],EK=["bottom","top"];function EY(e){let t=EB(e);return EP[t]+e.slice(t.length)}function EX(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function EQ(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function EJ(e,t,n){let r,{reference:i,floating:o}=e,s=Ez(t),a=EH(Ez(t)),l=EU(a),c=EB(t),d="y"===s,u=i.x+i.width/2-o.width/2,p=i.y+i.height/2-o.height/2,h=i[l]/2-o[l]/2;switch(c){case"top":r={x:u,y:i.y-o.height};break;case"bottom":r={x:u,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:p};break;case"left":r={x:i.x-o.width,y:p};break;default:r={x:i.x,y:i.y}}switch(EF(t)){case"start":r[a]-=h*(n&&d?-1:1);break;case"end":r[a]+=h*(n&&d?-1:1)}return r}async function EZ(e,t){var n;void 0===t&&(t={});let{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:h=0}=Ej(t,e),f=EX(h),m=a[p?"floating"===u?"reference":"floating":u],g=EQ(await o.getClippingRect({element:null==(n=await (null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await (null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),x=await (null==o.isElement?void 0:o.isElement(y))&&await (null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},v=EQ(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:y,strategy:l}):b);return{top:(g.top-v.top+f.top)/x.y,bottom:(v.bottom-g.bottom+f.bottom)/x.y,left:(g.left-v.left+f.left)/x.x,right:(v.right-g.right+f.right)/x.x}}let E0=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:EZ},l=await (null==s.isRTL?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=EJ(c,r,l),p=r,h=0,f={};for(let n=0;n<o.length;n++){let m=o[n];if(!m)continue;let{name:g,fn:b}=m,{x:y,y:x,data:v,reset:E}=await b({x:d,y:u,initialPlacement:r,placement:p,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=y?y:d,u=null!=x?x:u,f[g]={...f[g],...v},E&&h<50&&(h++,"object"==typeof E&&(E.placement&&(p=E.placement),E.rects&&(c=!0===E.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):E.rects),{x:d,y:u}=EJ(c,p,l)),n=-1)}return{x:d,y:u,placement:p,strategy:i,middlewareData:f}};function E1(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function E2(e){return E_.some(t=>e[t]>=0)}function E3(e){let t=EO(...e.map(e=>e.left)),n=EO(...e.map(e=>e.top));return{x:t,y:n,width:EI(...e.map(e=>e.right))-t,height:EI(...e.map(e=>e.bottom))-n}}let E5=new Set(["left","top"]);async function E4(e,t){let{placement:n,platform:r,elements:i}=e,o=await (null==r.isRTL?void 0:r.isRTL(i.floating)),s=EB(n),a=EF(n),l="y"===Ez(n),c=E5.has(s)?-1:1,d=o&&l?-1:1,u=Ej(t,e),{mainAxis:p,crossAxis:h,alignmentAxis:f}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof f&&(h="end"===a?-1*f:f),l?{x:h*d,y:p*c}:{x:p*c,y:h*d}}function E6(){return"u">typeof window}function E9(e){return we(e)?(e.nodeName||"").toLowerCase():"#document"}function E7(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function E8(e){var t;return null==(t=(we(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function we(e){return!!E6()&&(e instanceof Node||e instanceof E7(e).Node)}function wt(e){return!!E6()&&(e instanceof Element||e instanceof E7(e).Element)}function wn(e){return!!E6()&&(e instanceof HTMLElement||e instanceof E7(e).HTMLElement)}function wr(e){return!(!E6()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof E7(e).ShadowRoot)}function wi(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=wp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function wo(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let ws=/transform|translate|scale|rotate|perspective|filter/,wa=/paint|layout|strict|content/,wl=e=>!!e&&"none"!==e;function wc(e){let t=wt(e)?wp(e):e;return wl(t.transform)||wl(t.translate)||wl(t.scale)||wl(t.rotate)||wl(t.perspective)||!wd()&&(wl(t.backdropFilter)||wl(t.filter))||ws.test(t.willChange||"")||wa.test(t.contain||"")}function wd(){return null==i&&(i="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),i}function wu(e){return/^(html|body|#document)$/.test(E9(e))}function wp(e){return E7(e).getComputedStyle(e)}function wh(e){return wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wf(e){if("html"===E9(e))return e;let t=e.assignedSlot||e.parentNode||wr(e)&&e.host||E8(e);return wr(t)?t.host:t}function wm(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let i=function e(t){let n=wf(t);return wu(n)?t.ownerDocument?t.ownerDocument.body:t.body:wn(n)&&wi(n)?n:e(n)}(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=E7(i);if(!o)return t.concat(i,wm(i,[],n));{let e=wg(s);return t.concat(s,s.visualViewport||[],wi(i)?i:[],e&&n?wm(e):[])}}function wg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wb(e){let t=wp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=wn(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=ED(n)!==o||ED(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function wy(e){return wt(e)?e:e.contextElement}function wx(e){let t=wy(e);if(!wn(t))return EL(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:o}=wb(t),s=(o?ED(n.width):n.width)/r,a=(o?ED(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}let wv=EL(0);function wE(e){let t=E7(e);return wd()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:wv}function ww(e,t,n,r){var i;void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),s=wy(e),a=EL(1);t&&(r?wt(r)&&(a=wx(r)):a=wx(e));let l=(void 0===(i=n)&&(i=!1),r&&(!i||r===E7(s))&&i)?wE(s):EL(0),c=(o.left+l.x)/a.x,d=(o.top+l.y)/a.y,u=o.width/a.x,p=o.height/a.y;if(s){let e=E7(s),t=r&&wt(r)?E7(r):r,n=e,i=wg(n);for(;i&&r&&t!==n;){let e=wx(i),t=i.getBoundingClientRect(),r=wp(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,d*=e.y,u*=e.x,p*=e.y,c+=o,d+=s,i=wg(n=E7(i))}}return EQ({width:u,height:p,x:c,y:d})}function wk(e,t){let n=wh(e).scrollLeft;return t?t.left+n:ww(E8(e)).left+n}function wT(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-wk(e,n),y:n.top+t.scrollTop}}function wN(e,t,n){var r;let i;if("viewport"===t)i=function(e,t){let n=E7(e),r=E8(e),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;let e=wd();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}let c=wk(r);if(c<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t){let t,n,o,s,a,l,c;r=E8(e),t=E8(r),n=wh(r),o=r.ownerDocument.body,s=EI(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=EI(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight),l=-n.scrollLeft+wk(r),c=-n.scrollTop,"rtl"===wp(o).direction&&(l+=EI(t.clientWidth,o.clientWidth)-s),i={width:s,height:a,x:l,y:c}}else if(wt(t)){let e,r,o,s,a,l;r=(e=ww(t,!0,"fixed"===n)).top+t.clientTop,o=e.left+t.clientLeft,s=wn(t)?wx(t):EL(1),a=t.clientWidth*s.x,l=t.clientHeight*s.y,i={width:a,height:l,x:o*s.x,y:r*s.y}}else{let n=wE(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return EQ(i)}function wA(e){return"static"===wp(e).position}function wS(e,t){if(!wn(e)||"fixed"===wp(e).position)return null;if(t)return t(e);let n=e.offsetParent;return E8(e)===n&&(n=n.ownerDocument.body),n}function wC(e,t){var n;let r=E7(e);if(wo(e))return r;if(!wn(e)){let t=wf(e);for(;t&&!wu(t);){if(wt(t)&&!wA(t))return t;t=wf(t)}return r}let i=wS(e,t);for(;i&&(n=i,/^(table|td|th)$/.test(E9(n)))&&wA(i);)i=wS(i,t);return i&&wu(i)&&wA(i)&&!wc(i)?r:i||function(e){let t=wf(e);for(;wn(t)&&!wu(t);){if(wc(t))return t;if(wo(t))break;t=wf(t)}return null}(e)||r}let w_=async function(e){let t=this.getOffsetParent||wC,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=wn(t),i=E8(t),o="fixed"===n,s=ww(e,!0,o,t),a={scrollLeft:0,scrollTop:0},l=EL(0);if(r||!r&&!o)if(("body"!==E9(t)||wi(i))&&(a=wh(t)),r){let e=ww(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=wk(i));o&&!r&&i&&(l.x=wk(i));let c=!i||r||o?EL(0):wT(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},wM={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,o="fixed"===i,s=E8(r),a=!!t&&wo(t.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=EL(1),d=EL(0),u=wn(r);if((u||!u&&!o)&&(("body"!==E9(r)||wi(s))&&(l=wh(r)),u)){let e=ww(r);c=wx(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=!s||u||o?EL(0):wT(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}},getDocumentElement:E8,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,o=[..."clippingAncestors"===n?wo(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=wm(e,[],!1).filter(e=>wt(e)&&"body"!==E9(e)),i=null,o="fixed"===wp(e).position,s=o?wf(e):e;for(;wt(s)&&!wu(s);){let t=wp(s),n=wc(s);n||"fixed"!==t.position||(i=null),(o?n||i:!(!n&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||wi(s)&&!n&&function e(t,n){let r=wf(t);return!(r===n||!wt(r)||wu(r))&&("fixed"===wp(r).position||e(r,n))}(e,s)))?i=t:r=r.filter(e=>e!==s),s=wf(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=wN(t,o[0],i),a=s.top,l=s.right,c=s.bottom,d=s.left;for(let e=1;e<o.length;e++){let n=wN(t,o[e],i);a=EI(n.top,a),l=EO(n.right,l),c=EO(n.bottom,c),d=EI(n.left,d)}return{width:l-d,height:c-a,x:d,y:a}},getOffsetParent:wC,getElementRects:w_,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=wb(e);return{width:t,height:n}},getScale:wx,isElement:wt,isRTL:function(e){return"rtl"===wp(e).direction}};function wO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let wI=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:i,y:o,placement:s,middlewareData:a}=t,l=await E4(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},wD=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i,o;let{rects:s,middlewareData:a,placement:l,platform:c,elements:d}=t,{crossAxis:u=!1,alignment:p,allowedPlacements:h=EM,autoAlignment:f=!0,...m}=Ej(e,t),g=void 0!==p||h===EM?((o=p||null)?[...h.filter(e=>EF(e)===o),...h.filter(e=>EF(e)!==o)]:h.filter(e=>EB(e)===e)).filter(e=>!o||EF(e)===o||!!f&&EG(e)!==e):h,b=await c.detectOverflow(t,m),y=(null==(n=a.autoPlacement)?void 0:n.index)||0,x=g[y];if(null==x)return{};let v=E$(x,s,await (null==c.isRTL?void 0:c.isRTL(d.floating)));if(l!==x)return{reset:{placement:g[0]}};let E=[b[EB(x)],b[v[0]],b[v[1]]],w=[...(null==(r=a.autoPlacement)?void 0:r.overflows)||[],{placement:x,overflows:E}],k=g[y+1];if(k)return{data:{index:y+1,overflows:w},reset:{placement:k}};let T=w.map(e=>{let t=EF(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),N=(null==(i=T.filter(e=>e[2].slice(0,EF(e[0])?2:3).every(e=>e<=0))[0])?void 0:i[0])||T[0][0];return N!==l?{data:{index:y+1,overflows:w},reset:{placement:N}}:{}}}},wR=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Ej(e,t),d={x:n,y:r},u=await o.detectOverflow(t,c),p=Ez(EB(i)),h=EH(p),f=d[h],m=d[p];if(s){let e="y"===h?"top":"left",t="y"===h?"bottom":"right",n=f+u[e],r=f-u[t];f=EI(n,EO(f,r))}if(a){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",n=m+u[e],r=m-u[t];m=EI(n,EO(m,r))}let g=l.fn({...t,[h]:f,[p]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:s,[p]:a}}}}}},wL=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r,i,o,s;let a,l,c,{placement:d,middlewareData:u,rects:p,initialPlacement:h,platform:f,elements:m}=t,{mainAxis:g=!0,crossAxis:b=!0,fallbackPlacements:y,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:E=!0,...w}=Ej(e,t);if(null!=(n=u.arrow)&&n.alignmentOffset)return{};let k=EB(d),T=Ez(h),N=EB(h)===h,A=await (null==f.isRTL?void 0:f.isRTL(m.floating)),S=y||(N||!E?[EY(h)]:(a=EY(h),[EG(h),a,EG(a)])),C="none"!==v;!y&&C&&S.push(...(l=EF(h),c=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?EV:Eq;return t?Eq:EV;case"left":case"right":return t?EW:EK;default:return[]}}(EB(h),"start"===v,A),l&&(c=c.map(e=>e+"-"+l),E&&(c=c.concat(c.map(EG)))),c));let _=[h,...S],M=await f.detectOverflow(t,w),O=[],I=(null==(r=u.flip)?void 0:r.overflows)||[];if(g&&O.push(M[k]),b){let e=E$(d,p,A);O.push(M[e[0]],M[e[1]])}if(I=[...I,{placement:d,overflows:O}],!O.every(e=>e<=0)){let e=((null==(i=u.flip)?void 0:i.index)||0)+1,t=_[e];if(t&&("alignment"!==b||T===Ez(t)||I.every(e=>Ez(e.placement)!==T||e.overflows[0]>0)))return{data:{index:e,overflows:I},reset:{placement:t}};let n=null==(o=I.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:o.placement;if(!n)switch(x){case"bestFit":{let e=null==(s=I.filter(e=>{if(C){let t=Ez(e.placement);return t===T||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(n=e);break}case"initialPlacement":n=h}if(d!==n)return{reset:{placement:n}}}return{}}}},wP=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;let i,o,{placement:s,rects:a,platform:l,elements:c}=t,{apply:d=()=>{},...u}=Ej(e,t),p=await l.detectOverflow(t,u),h=EB(s),f=EF(s),m="y"===Ez(s),{width:g,height:b}=a.floating;"top"===h||"bottom"===h?(i=h,o=f===(await (null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(o=h,i="end"===f?"top":"bottom");let y=b-p.top-p.bottom,x=g-p.left-p.right,v=EO(b-p[i],y),E=EO(g-p[o],x),w=!t.middlewareData.shift,k=v,T=E;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(T=x),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(k=y),w&&!f){let e=EI(p.left,0),t=EI(p.right,0),n=EI(p.top,0),r=EI(p.bottom,0);m?T=g-2*(0!==e||0!==t?e+t:EI(p.left,p.right)):k=b-2*(0!==n||0!==r?n+r:EI(p.top,p.bottom))}await d({...t,availableWidth:T,availableHeight:k});let N=await l.getDimensions(c.floating);return g!==N.width||b!==N.height?{reset:{rects:!0}}:{}}}},wj=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=Ej(e,t);switch(i){case"referenceHidden":{let e=E1(await r.detectOverflow(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:E2(e)}}}case"escaped":{let e=E1(await r.detectOverflow(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:E2(e)}}}default:return{}}}}},wB=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=Ej(e,t)||{};if(null==c)return{};let u=EX(d),p={x:n,y:r},h=EH(Ez(i)),f=EU(h),m=await s.getDimensions(c),g="y"===h,b=g?"clientHeight":"clientWidth",y=o.reference[f]+o.reference[h]-p[h]-o.floating[f],x=p[h]-o.reference[h],v=await (null==s.getOffsetParent?void 0:s.getOffsetParent(c)),E=v?v[b]:0;E&&await (null==s.isElement?void 0:s.isElement(v))||(E=a.floating[b]||o.floating[f]);let w=E/2-m[f]/2-1,k=EO(u[g?"top":"left"],w),T=EO(u[g?"bottom":"right"],w),N=E-m[f]-T,A=E/2-m[f]/2+(y/2-x/2),S=EI(k,EO(A,N)),C=!l.arrow&&null!=EF(i)&&A!==S&&o.reference[f]/2-(A<k?k:T)-m[f]/2<0,_=C?A<k?A-k:A-N:0;return{[h]:p[h]+_,data:{[h]:S,centerOffset:A-S-_,...C&&{alignmentOffset:_}},reset:C}}}),wF=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:o,strategy:s}=t,{padding:a=2,x:l,y:c}=Ej(e,t),d=Array.from(await (null==o.getClientRects?void 0:o.getClientRects(r.reference))||[]),u=function(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>EQ(E3(e)))}(d),p=EQ(E3(d)),h=EX(a),f=await o.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=l&&null!=c)return u.find(e=>l>e.left-h.left&&l<e.right+h.right&&c>e.top-h.top&&c<e.bottom+h.bottom)||p;if(u.length>=2){if("y"===Ez(n)){let e=u[0],t=u[u.length-1],r="top"===EB(n),i=e.top,o=t.bottom,s=r?e.left:t.left,a=r?e.right:t.right;return{top:i,bottom:o,left:s,right:a,width:a-s,height:o-i,x:s,y:i}}let e="left"===EB(n),t=EI(...u.map(e=>e.right)),r=EO(...u.map(e=>e.left)),i=u.filter(n=>e?n.left===r:n.right===t),o=i[0].top,s=i[i.length-1].bottom;return{top:o,bottom:s,left:r,right:t,width:t-r,height:s-o,x:r,y:o}}return p}},floating:r.floating,strategy:s});return i.reference.x!==f.reference.x||i.reference.y!==f.reference.y||i.reference.width!==f.reference.width||i.reference.height!==f.reference.height?{reset:{rects:f}}:{}}}},wH=(e,t,n)=>{let r=new Map,i={platform:wM,...n},o={...i.platform,_c:r};return E0(e,t,{...i,platform:o})};var wU=class{constructor({editor:e,element:t,view:n,pluginKey:r="bubbleMenu",updateDelay:i=250,resizeDelay:o=60,shouldShow:s,appendTo:a,getReferencedVirtualElement:l,options:c}){var d;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:o}=t,{empty:s}=o,a=!i.textBetween(n,r).length&&c9(t.selection),l=this.element.contains(document.activeElement);return!!(e.hasFocus()||l)&&!s&&!a&&!!this.editor.isEditable},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.editor.isDestroyed)return void this.destroy();if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!(null==t?void 0:t.selection.eq(e.state.selection)),r=!(null==t?void 0:t.doc.eq(e.state.doc));(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;!i&&(t||n)&&(this.getShouldShow(r)?(this.show(),this.updatePosition()):this.hide())},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);"updatePosition"===t?this.updatePosition():t&&"object"==typeof t&&"updateOptions"===t.type?this.updateOptions(t.options):"hide"===t?this.hide():"show"===t&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=o,this.appendTo=a,this.scrollTarget=null!=(d=null==c?void 0:c.scrollTarget)?d:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(wL("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(wR("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(wI("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wB(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(wP("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(wD("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(wj("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(wF("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,n,r,i;let{selection:o}=this.editor.state,s=null==(e=this.getReferencedVirtualElement)?void 0:e.call(this);if(s)return s;if(!(null==(n=null==(t=this.view)?void 0:t.dom)?void 0:n.parentNode))return;let a=uc(this.view,o.from,o.to),l={getBoundingClientRect:()=>a,getClientRects:()=>[a]};if(o instanceof oy){let e=this.view.nodeDOM(o.from),t=e.dataset.nodeViewWrapper?e:e.querySelector("[data-node-view-wrapper]");t&&(e=t),e&&(l={getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>[e.getBoundingClientRect()]})}if(o instanceof lk){let e,t,n,{$anchorCell:s,$headCell:a}=o,c=s?s.pos:a.pos,d=a?a.pos:s.pos,u=this.view.nodeDOM(c),p=this.view.nodeDOM(d);if(!u||!p)return;let h=u===p?u.getBoundingClientRect():(r=u.getBoundingClientRect(),i=p.getBoundingClientRect(),e=Math.min(r.top,i.top),t=Math.max(r.bottom,i.bottom),n=Math.min(r.left,i.left),new DOMRect(n,e,Math.max(r.right,i.right)-n,t-e));l={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return l}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&wH(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{var i,o;if(this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected){if((null==(i=r.hide)?void 0:i.referenceHidden)||(null==(o=r.hide)?void 0:o.escaped)){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r)return void this.handleDebouncedUpdate(e,t);let i=!(null==t?void 0:t.selection.eq(e.state.selection)),o=!(null==t?void 0:t.doc.eq(e.state.doc));this.updateHandler(e,i,o,t)}getShouldShow(e){var t;let{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(e=>e.$from.pos)),s=Math.max(...i.map(e=>e.$to.pos));return(null==(t=this.shouldShow)?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:o,to:s}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";let t="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(e=null!=t?t:this.view.dom.parentElement)||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(void 0!==e.updateDelay&&(this.updateDelay=e.updateDelay),void 0!==e.resizeDelay&&(this.resizeDelay=e.resizeDelay),void 0!==e.appendTo&&(this.appendTo=e.appendTo),void 0!==e.getReferencedVirtualElement&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),void 0!==e.shouldShow&&e.shouldShow&&(this.shouldShow=e.shouldShow),void 0!==e.options){let n=null!=(t=e.options.scrollTarget)?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},wz=e=>new oM({key:"string"==typeof e.pluginKey?new oD(e.pluginKey):e.pluginKey,view:t=>new wU({view:t,...e})});uz.create({name:"bubbleMenu",addOptions:()=>({element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}),addProseMirrorPlugins(){return this.options.element?[wz({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var w$=class{constructor({editor:e,element:t,view:n,pluginKey:r="floatingMenu",updateDelay:i=250,resizeDelay:o=60,options:s,appendTo:a,shouldShow:l}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,o=1===r.depth,s=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&0===r.parent.childCount&&!this.getTextContent(r.parent);return!!e.hasFocus()&&!!i&&!!o&&!!s&&!!this.editor.isEditable},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;!i&&(t||n)&&(this.getShouldShow(r)?(this.updatePosition(),this.show()):this.hide())},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);"updatePosition"===t?this.updatePosition():t&&"object"==typeof t&&"updateOptions"===t.type?this.updateOptions(t.options):"hide"===t?this.hide():"show"===t&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=o,this.appendTo=a,this.scrollTarget=null!=(c=null==s?void 0:s.scrollTarget)?c:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return d5(e,{textSerializers:d4(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(wL("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(wR("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(wI("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wB(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(wP("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(wD("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(wj("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(wF("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;let{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(e=>e.$from.pos)),s=Math.max(...i.map(e=>e.$to.pos));return null==(t=this.shouldShow)?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:o,to:s})}updateOptions(e){var t;if(void 0!==e.updateDelay&&(this.updateDelay=e.updateDelay),void 0!==e.resizeDelay&&(this.resizeDelay=e.resizeDelay),void 0!==e.appendTo&&(this.appendTo=e.appendTo),void 0!==e.shouldShow&&e.shouldShow&&(this.shouldShow=e.shouldShow),void 0!==e.options){let n=null!=(t=e.options.scrollTarget)?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e,t;if(!(null==(t=null==(e=this.view)?void 0:e.dom)?void 0:t.parentNode))return;let{selection:n}=this.editor.state,r=uc(this.view,n.from,n.to);wH({getBoundingClientRect:()=>r,getClientRects:()=>[r]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{var i,o;if((null==(i=r.hide)?void 0:i.referenceHidden)||(null==(o=r.hide)?void 0:o.escaped)){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!(null==t?void 0:t.selection.eq(e.state.selection)),r=!(null==t?void 0:t.doc.eq(e.state.doc));this.updateHandler(e,n,r,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";let t="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(e=null!=t?t:this.view.dom.parentElement)||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},wG=e=>new oM({key:"string"==typeof e.pluginKey?new oD(e.pluginKey):e.pluginKey,view:t=>new w$({view:t,...e})});function wq(e,t){return null!=e?e:new oD(t)}uz.create({name:"floatingMenu",addOptions:()=>({element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}),addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[wG({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var wV="u">typeof window?Q.useLayoutEffect:Q.useEffect,wW=new Set(["left","opacity","position","top","visibility","width"]),wK=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),wY=new Set(["children","className","style"]),wX=new Set(["tabIndex"]),wQ=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),wJ={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function wZ(e,t){return/^on[A-Z]/.test(e)&&"function"==typeof t}function w0(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function w1(e,t,n){if("tabIndex"===t){e.tabIndex=Number(n);return}e[t]=n}function w2(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);wV(()=>{var i,o,s;let a,l,c,d=n.current;return!function(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}(e,d.className,t.className),i=d.style,o=t.style,a=null!=i?i:{},l=null!=o?o:{},new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{let n=a[t],r=l[t];if(n!==r){if(null==r)return void(!wW.has(t)&&e.style.removeProperty(w0(t)));wW.has(t)||e.style.setProperty(w0(t),"number"!=typeof r||0===r||t.startsWith("--")||wK.has(t)?String(r):`${r}px`)}}),new Set([...Object.keys(d),...Object.keys(t)]).forEach(n=>{if(wY.has(n)||!(n.startsWith("aria-")||n.startsWith("data-")||wQ.has(n))||wZ(n,d[n])||wZ(n,t[n]))return;let r=d[n],i=t[n];if(r===i)return;let o=(n.startsWith("aria-")||n.startsWith("data-"),n);if(null==i||!1===i){wX.has(n)&&function(e,t){if("tabIndex"===t)return e.removeAttribute("tabindex");let n=e[t];if("boolean"==typeof n){e[t]=!1;return}if("number"==typeof n){e[t]=0;return}e[t]=""}(e,n),e.removeAttribute(o);return}if(!0===i){wX.has(n)&&w1(e,n,!0),e.setAttribute(o,"");return}wX.has(n)?w1(e,n,i):e.setAttribute(o,String(i))}),s=r.current,s.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),c=[],Object.entries(t).forEach(([t,n])=>{var r;let i,o;if(!wZ(t,n))return;let{eventName:s,options:a}={eventName:null!=(r=wJ[o=((i=t.endsWith("Capture"))?t.slice(0,-7):t).slice(2)])?r:o.toLowerCase(),options:i?{capture:!0}:void 0},l=t=>{let r,i,o;n((r=t.defaultPrevented,i=!1,Object.defineProperties(o=Object.create(t),{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>r},isPropagationStopped:{value:()=>i},preventDefault:{value:()=>{r=!0,t.preventDefault()}},stopPropagation:{value:()=>{i=!0,t.stopPropagation()}}}),o))};e.addEventListener(s,l,a),c.push({eventName:s,listener:l,options:a})}),r.current=c,n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var w3=Q.default.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,getReferencedVirtualElement:s,options:a,children:l,...c},d)=>{let u=(0,Q.useRef)(document.createElement("div")),p=(0,Q.useRef)(wq(e,"bubbleMenu")).current;w2(u.current,c),"function"==typeof d?d(u.current):d&&(d.current=u.current);let{editor:h}=pX(),f=t||h,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:p,shouldShow:o,getReferencedVirtualElement:s,options:a},g=(0,Q.useRef)(m);g.current=m;let[b,y]=(0,Q.useState)(!1),x=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(null==f?void 0:f.isDestroyed)return;if(!f)return void console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");let e=u.current;e.style.visibility="hidden",e.style.position="absolute";let t=wz({...g.current,editor:f,element:e});f.registerPlugin(t);let n=g.current.pluginKey;return x.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[f]),(0,Q.useEffect)(()=>{if(b&&f&&!f.isDestroyed){if(x.current){x.current=!1;return}f.view.dispatch(f.state.tr.setMeta(p,{type:"updateOptions",options:g.current}))}},[b,f,n,r,o,a,i,s,p]),(0,t0.createPortal)(l,u.current)});Q.default.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,options:s,children:a,...l},c)=>{let d=(0,Q.useRef)(document.createElement("div")),u=(0,Q.useRef)(wq(e,"floatingMenu")).current;w2(d.current,l),"function"==typeof c?c(d.current):c&&(c.current=d.current);let{editor:p}=pX(),h=t||p,f={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:u,shouldShow:o,options:s},m=(0,Q.useRef)(f);m.current=f;let[g,b]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(null==h?void 0:h.isDestroyed)return;if(!h)return void console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");let e=d.current;e.style.visibility="hidden",e.style.position="absolute";let t=wG({...m.current,editor:h,element:e});h.registerPlugin(t);let n=m.current.pluginKey;return y.current=!0,b(!0),()=>{b(!1),h.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[h]),(0,Q.useEffect)(()=>{if(g&&h&&!h.isDestroyed){if(y.current){y.current=!1;return}h.view.dispatch(h.state.tr.setMeta(u,{type:"updateOptions",options:m.current}))}},[g,h,n,r,o,s,i,u]),(0,t0.createPortal)(a,d.current)});let w5=en("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),w4=en("align-justify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]),w6=en("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),w9=en("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),w7=en("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),w8=en("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),ke=en("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),kt=en("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),kn=en("message-circle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),kr=en("message-square-plus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]),ki=en("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),ko=en("subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]),ks=en("superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]),ka=en("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),kl=en("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function kc({anchor:e,initialUrl:t="",onCancel:n,onApply:r,onRemove:i}){let[o,s]=(0,Q.useState)(t);(0,Q.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);let a=()=>{let e=o.trim();e?r(e):n()};return(0,X.jsxs)("div",{className:"absolute z-50 w-[340px] bg-popover border border-border rounded-lg shadow-xl overflow-hidden",style:{top:e.top,left:e.left},onMouseDown:e=>e.stopPropagation(),children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,X.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[(0,X.jsx)(kt,{className:"w-3.5 h-3.5"}),t?"Edit link":"Add link"]}),(0,X.jsx)("button",{type:"button",onClick:n,className:"text-[11px] text-muted-foreground hover:text-foreground",children:"Cancel"})]}),(0,X.jsxs)("div",{className:"p-3 space-y-2",children:[(0,X.jsx)("input",{type:"url",autoFocus:!0,value:o,placeholder:"https://example.com",onChange:e=>s(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),a())},className:"w-full bg-background border border-border rounded-md px-2.5 py-1.5 text-[12px] focus:outline-none focus:ring-2 focus:ring-primary/30"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("button",{type:"button",onClick:a,disabled:!o.trim(),className:"flex-1 py-1.5 text-[12px] rounded-md bg-primary text-primary-foreground disabled:opacity-50 hover:bg-primary/90",children:t?"Update":"Add link"}),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"p-1.5 rounded-md border border-border hover:bg-accent text-muted-foreground hover:text-foreground",title:"Open link",children:(0,X.jsx)(kl,{className:"w-3.5 h-3.5"})}),i&&(0,X.jsx)("button",{type:"button",onClick:i,className:"p-1.5 rounded-md border border-border hover:bg-accent text-destructive",title:"Remove link",children:(0,X.jsx)(eA,{className:"w-3.5 h-3.5"})})]})]})]})]})}function kd({editor:e,onSuggestEdit:t,onComment:n}){let[r,i]=(0,Q.useState)(null);if((0,Q.useEffect)(()=>{if(!r)return;let e=e=>{let t=e.target;t?.closest("[data-bubble-popover='true']")||i(null)},t=window.setTimeout(()=>window.addEventListener("mousedown",e),10);return()=>{window.clearTimeout(t),window.removeEventListener("mousedown",e)}},[r]),!e)return null;let o=()=>{let{from:t,to:n}=e.state.selection;return{from:t,to:n}},s=t=>e.chain().focus().setTextSelection(t).run(),a=e=>t=>{t.preventDefault(),e()},l=t=>{r?.type==="align"&&(s(r.range),e.chain().focus().setTextAlign(t).run(),i(null))};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(w3,{editor:e,options:{placement:"top",offset:8},className:"flex items-center gap-0.5 px-1 py-1 bg-popover border border-border rounded-sm shadow-lg",children:[(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("bold")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleBold().run()),"aria-label":"Bold",children:(0,X.jsx)(w7,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("italic")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleItalic().run()),"aria-label":"Italic",children:(0,X.jsx)(ke,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("underline")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleUnderline().run()),"aria-label":"Underline",children:(0,X.jsx)(ka,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("strike")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleStrike().run()),"aria-label":"Strikethrough",children:(0,X.jsx)(ki,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("code")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleCode().run()),"aria-label":"Inline code",children:(0,X.jsx)(w8,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("superscript")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleSuperscript().run()),"aria-label":"Superscript",children:(0,X.jsx)(ks,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("subscript")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:a(()=>e.chain().focus().toggleSubscript().run()),"aria-label":"Subscript",children:(0,X.jsx)(ko,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive("link")&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.preventDefault();let n=e.getAttributes("link")?.href??"",r=t.currentTarget.getBoundingClientRect();i({type:"link",range:o(),existing:n,anchor:{top:r.bottom+6,left:r.left}})},"aria-label":"Link",children:(0,X.jsx)(kt,{className:"w-3.5 h-3.5"})}),(t||n)&&(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),n&&(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),n()},"aria-label":"Comment",title:"Comment",children:(0,X.jsx)(kn,{className:"w-3.5 h-3.5"})}),t&&(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),t()},"aria-label":"Suggest edit",title:"Suggest edit",children:(0,X.jsx)(kr,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,X.jsxs)("div",{className:"relative",children:[(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),i({type:"align",range:o()})},"aria-label":"Align",children:(0,X.jsx)(w6,{className:"w-3.5 h-3.5"})}),r?.type==="align"&&(0,X.jsxs)("div",{"data-bubble-popover":"true",className:"absolute top-full left-0 mt-1 z-50 bg-popover border border-border rounded-sm shadow-lg p-1 flex gap-0.5",children:[(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"left"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("left"),"aria-label":"Align left",children:(0,X.jsx)(w6,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"center"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("center"),"aria-label":"Align center",children:(0,X.jsx)(w5,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"right"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("right"),"aria-label":"Align right",children:(0,X.jsx)(w9,{className:"w-3.5 h-3.5"})}),(0,X.jsx)("button",{type:"button",className:t$("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e.isActive({textAlign:"justify"})&&"bg-accent text-foreground"),onMouseDown:e=>e.preventDefault(),onClick:()=>l("justify"),"aria-label":"Justify",children:(0,X.jsx)(w4,{className:"w-3.5 h-3.5"})})]})]})]}),r?.type==="link"&&(0,X.jsx)("div",{"data-bubble-popover":"true",style:{position:"fixed",top:r.anchor.top,left:r.anchor.left,zIndex:60},children:(0,X.jsx)(kc,{anchor:{top:0,left:0},initialUrl:r.existing,onCancel:()=>i(null),onApply:t=>{r?.type==="link"&&(s(r.range),e.chain().focus().extendMarkRange("link").setLink({href:t}).run(),i(null))},onRemove:r.existing?()=>{r?.type==="link"&&(s(r.range),e.chain().focus().unsetLink().run(),i(null))}:void 0})})]})}let ku=en("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),kp=en("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),kh=en("file-code",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]),kf=en("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),km=en("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]),kg=en("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]),kb=en("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),ky=en("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),kx=en("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),kv=en("pilcrow-left",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]),kE=en("pilcrow-right",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]),kw=en("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]),kk=en("redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]),kT=en("undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]),kN=en("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);var kA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=eL(`Primitive.${t}`),r=Q.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,X.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),kS="horizontal",kC=["horizontal","vertical"],k_=Q.forwardRef((e,t)=>{var n;let{decorative:r,orientation:i=kS,...o}=e,s=(n=i,kC.includes(n))?i:kS;return(0,X.jsx)(kA.div,{"data-orientation":s,...r?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"},...o,ref:t})});k_.displayName="Separator";let kM=Q.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},i)=>(0,X.jsx)(k_,{ref:i,decorative:n,orientation:t,className:t$("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...r}));kM.displayName=k_.displayName;let kO=en("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);async function kI(e,t){let n=new FormData;n.append("file",t);try{let t=await r$(`/api/upload/${e}`,{method:"POST",body:n});if(!t.ok)return null;let r=await t.json();return{url:r.url,filename:r.filename}}catch{return null}}function kD({kind:e,pagePath:t,onCancel:n,onInsert:r,anchor:i}){let[o,s]=(0,Q.useState)("upload"),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(null),h=(0,Q.useRef)(null),f=async e=>{if(e&&0!==e.length){d(!0),p(null);try{let n=e[0],i=await kI(t,n);if(!i)return void p("Upload failed.");r({url:i.url,alt:n.name,mimeType:n.type})}finally{d(!1)}}},m=()=>{let e=a.trim();e&&r({url:e})};return(0,X.jsxs)("div",{className:"absolute z-50 w-[360px] bg-popover border border-border rounded-xl shadow-e-4 overflow-hidden",style:{top:i.top,left:i.left},onMouseDown:e=>e.stopPropagation(),children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,X.jsx)("div",{className:"text-[12px] font-medium",children:"image"===e?"Insert image":"video"===e?"Insert video":"Attach file"}),(0,X.jsx)("button",{type:"button",onClick:n,className:"text-[11px] text-muted-foreground hover:text-foreground",children:"Cancel"})]}),(0,X.jsxs)("div",{className:"flex border-b border-border bg-muted/30",children:[(0,X.jsxs)("button",{type:"button",onClick:()=>s("upload"),className:t$("flex-1 py-1.5 text-[11px] flex items-center justify-center gap-1.5 transition-colors","upload"===o?"bg-background text-foreground border-b-2 border-primary":"text-muted-foreground hover:text-foreground"),children:[(0,X.jsx)(eS,{className:"w-3 h-3"})," Upload"]}),(0,X.jsxs)("button",{type:"button",onClick:()=>s("url"),className:t$("flex-1 py-1.5 text-[11px] flex items-center justify-center gap-1.5 transition-colors","url"===o?"bg-background text-foreground border-b-2 border-primary":"text-muted-foreground hover:text-foreground"),children:[(0,X.jsx)(kt,{className:"w-3 h-3"})," From URL"]})]}),"upload"===o?(0,X.jsxs)("div",{className:"p-4",onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),f(e.dataTransfer.files)},children:[(0,X.jsxs)("button",{type:"button",onClick:()=>h.current?.click(),disabled:c,className:"w-full border-2 border-dashed border-border rounded-sm py-6 flex flex-col items-center justify-center text-muted-foreground hover:bg-accent/30 transition-colors",children:[(0,X.jsx)(eS,{className:"w-5 h-5 mb-1.5"}),(0,X.jsx)("span",{className:"text-[12px] font-medium",children:c?"Uploading…":`Click to upload ${e}`}),(0,X.jsx)("span",{className:"text-[10px] mt-0.5",children:"or drop a file here"})]}),(0,X.jsx)("input",{ref:h,type:"file",accept:"image"===e?"image/*":"video"===e?"video/*":"*/*",className:"hidden",onChange:e=>f(e.target.files)}),u&&(0,X.jsx)("div",{className:"mt-2 text-[11px] text-destructive",children:u})]}):(0,X.jsxs)("div",{className:"p-3 space-y-2",children:[(0,X.jsx)("input",{type:"url",autoFocus:!0,value:a,placeholder:"image"===e?"https://example.com/image.png":"video"===e?"https://example.com/video.mp4":"https://example.com/file",onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),m()):"Escape"===e.key&&n()},className:"w-full bg-background border border-border rounded-sm px-2.5 py-1.5 text-[12px] focus:outline-none focus:ring-2 focus:ring-primary/30"}),(0,X.jsx)("button",{type:"button",onClick:m,disabled:!a.trim(),className:"w-full py-1.5 text-[12px] rounded-sm bg-primary text-primary-foreground disabled:opacity-50 hover:bg-primary/90",children:"Insert"})]}),(0,X.jsxs)("div",{className:"px-3 py-2 border-t border-border bg-muted/30 text-[10px] text-muted-foreground flex items-start gap-1.5",children:[(0,X.jsx)(kO,{className:"w-3 h-3 shrink-0 mt-[1px]"}),(0,X.jsxs)("span",{children:["Tip: you can also"," ",(0,X.jsx)("strong",{className:"text-foreground/80",children:"paste"})," or"," ",(0,X.jsx)("strong",{className:"text-foreground/80",children:"drag & drop"}),"files directly into the page — they'll be saved alongside this page automatically."]})]})]})}function kR({label:e,icon:t,active:n,disabled:r,style:i,onAction:o}){return(0,X.jsx)("button",{type:"button","aria-label":e,title:e,disabled:r,style:i,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),o(e)},className:t$("h-8 w-8 shrink-0 inline-flex items-center justify-center rounded-md text-foreground/80 hover:bg-accent hover:text-accent-foreground transition-colors disabled:opacity-40",n&&"bg-accent text-accent-foreground ring-1 ring-inset ring-foreground/15"),children:(0,X.jsx)(t,{className:"h-4 w-4"})})}function kL({editor:e}){let t=Eg(e=>e.frontmatter),n=Eg(e=>e.updateFrontmatter),r=Eg(e=>e.currentPath),i=t?.dir==="rtl",[o,s]=(0,Q.useState)(null),a=(0,Q.useRef)(null),[l,c]=(0,Q.useState)(!1),[d,u]=(0,Q.useState)(!1),[,p]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!e)return;let t=()=>p(e=>e+1);return e.on("selectionUpdate",t),e.on("transaction",t),()=>{e.off("selectionUpdate",t),e.off("transaction",t)}},[e]);let h=(0,Q.useCallback)(()=>{let e=a.current;e&&(c(e.scrollLeft>4),u(e.scrollLeft+e.clientWidth<e.scrollWidth-4))},[]);(0,Q.useEffect)(()=>{if(!e)return;let t=a.current;if(!t)return;let n=requestAnimationFrame(h),r=()=>h();window.addEventListener("resize",r),t.addEventListener("scroll",h);let i=new ResizeObserver(()=>h());for(let e of(i.observe(t),Array.from(t.children)))i.observe(e);return()=>{cancelAnimationFrame(n),window.removeEventListener("resize",r),t.removeEventListener("scroll",h),i.disconnect()}},[e,h]);let f=e=>{let t=a.current;t&&t.scrollBy({left:e*Math.max(160,.6*t.clientWidth),behavior:"smooth"})};if(!e)return null;let m=(t,n)=>{e.chain().focus().setTextSelection(t).run(),n()},g=(t,n)=>{let r=t.currentTarget.getBoundingClientRect();s(n({top:r.bottom+6,left:r.left},(()=>{let{from:t,to:n}=e.state.selection;return{from:t,to:n}})()))},b=[{icon:kf,action:()=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e.isActive("heading",{level:1}),label:"Heading 1"},{icon:km,action:()=>e.chain().focus().toggleHeading({level:2}).run(),isActive:e.isActive("heading",{level:2}),label:"Heading 2"},{icon:kg,action:()=>e.chain().focus().toggleHeading({level:3}).run(),isActive:e.isActive("heading",{level:3}),label:"Heading 3"},{separator:!0},{icon:w7,action:()=>e.chain().focus().toggleBold().run(),isActive:e.isActive("bold"),label:"Bold"},{icon:ke,action:()=>e.chain().focus().toggleItalic().run(),isActive:e.isActive("italic"),label:"Italic"},{icon:ka,action:()=>e.chain().focus().toggleUnderline().run(),isActive:e.isActive("underline"),label:"Underline"},{icon:ki,action:()=>e.chain().focus().toggleStrike().run(),isActive:e.isActive("strike"),label:"Strikethrough"},{icon:w8,action:()=>e.chain().focus().toggleCode().run(),isActive:e.isActive("code"),label:"Inline code"},{icon:kt,action:t=>{let n=e.getAttributes("link")?.href??"";g(t,(e,t)=>({type:"link",anchor:e,range:t,existing:n}))},isActive:e.isActive("link"),label:"Link"},{separator:!0},{icon:kb,action:()=>e.chain().focus().toggleBulletList().run(),isActive:e.isActive("bulletList"),label:"Bullet list"},{icon:ky,action:()=>e.chain().focus().toggleOrderedList().run(),isActive:e.isActive("orderedList"),label:"Ordered list"},{icon:kw,action:()=>e.chain().focus().toggleBlockquote().run(),isActive:e.isActive("blockquote"),label:"Blockquote"},{icon:ku,action:()=>e.chain().focus().toggleTaskList().run(),isActive:e.isActive("taskList"),label:"Checklist"},{icon:kh,action:()=>e.chain().focus().toggleCodeBlock().run(),isActive:e.isActive("codeBlock"),label:"Code block"},{icon:kx,action:()=>e.chain().focus().setHorizontalRule().run(),isActive:!1,label:"Divider"}],y=[{icon:w6,action:()=>e.chain().focus().setTextAlign("left").run(),isActive:e.isActive({textAlign:"left"}),label:"Align left"},{icon:w5,action:()=>e.chain().focus().setTextAlign("center").run(),isActive:e.isActive({textAlign:"center"}),label:"Align center"},{icon:w9,action:()=>e.chain().focus().setTextAlign("right").run(),isActive:e.isActive({textAlign:"right"}),label:"Align right"},{icon:w4,action:()=>e.chain().focus().setTextAlign("justify").run(),isActive:e.isActive({textAlign:"justify"}),label:"Justify"},{separator:!0},{icon:ks,action:()=>e.chain().focus().toggleSuperscript().run(),isActive:e.isActive("superscript"),label:"Superscript"},{icon:ko,action:()=>e.chain().focus().toggleSubscript().run(),isActive:e.isActive("subscript"),label:"Subscript"},{separator:!0},{icon:eg,action:e=>g(e,e=>({type:"media",kind:"image",anchor:e})),isActive:!1,label:"Insert image"},{icon:kN,action:e=>g(e,e=>({type:"media",kind:"video",anchor:e})),isActive:!1,label:"Insert video"},{separator:!0},{icon:kT,action:()=>e.chain().focus().undo().run(),isActive:!1,label:"Undo"},{icon:kk,action:()=>e.chain().focus().redo().run(),isActive:!1,label:"Redo"},{separator:!0},{icon:i?kv:kE,action:()=>n({dir:i?void 0:"rtl"}),isActive:i,label:i?"Switch to LTR":"Switch to RTL"}];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"relative border-b border-border bg-background/50",children:[l&&(0,X.jsx)("button",{type:"button","aria-label":"Scroll toolbar left",onMouseDown:e=>e.preventDefault(),onClick:()=>f(-1),className:"absolute left-0 top-0 bottom-0 w-6 z-10 flex items-center justify-start pl-0.5 bg-gradient-to-r from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors",children:(0,X.jsx)(kp,{className:"h-4 w-4"})}),d&&(0,X.jsx)("button",{type:"button","aria-label":"Scroll toolbar right",onMouseDown:e=>e.preventDefault(),onClick:()=>f(1),className:"absolute right-0 top-0 bottom-0 w-6 z-10 flex items-center justify-end pr-0.5 bg-gradient-to-l from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors",children:(0,X.jsx)(ea,{className:"h-4 w-4"})}),(0,X.jsx)("div",{ref:a,onWheel:e=>{let t=a.current;t&&Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(t.scrollLeft+=e.deltaY)},className:"flex items-center gap-0.5 px-2 pt-1 pb-1.5 overflow-x-scroll overflow-y-hidden editor-toolbar-scroll",children:[...b,{separator:!0},...y].map((e,t)=>"separator"in e?(0,X.jsx)(kM,{orientation:"vertical",className:"mx-1 h-6 shrink-0"},t):(0,X.jsx)(kR,{label:e.label,icon:e.icon,active:e.isActive,style:e.style,onAction:e.action},t))})]}),o?.type==="link"&&(0,X.jsx)("div",{"data-editor-popover":"true",style:{position:"fixed",top:o.anchor.top,left:o.anchor.left,zIndex:60},children:(0,X.jsx)(kc,{anchor:{top:0,left:0},initialUrl:o.existing,onCancel:()=>s(null),onApply:t=>{o?.type==="link"&&(m(o.range,()=>{e.chain().focus().extendMarkRange("link").setLink({href:t}).run()}),s(null))},onRemove:o.existing?()=>{o?.type==="link"&&(m(o.range,()=>{e.chain().focus().unsetLink().run()}),s(null))}:void 0})}),o?.type==="media"&&r&&(0,X.jsx)("div",{"data-editor-popover":"true",style:{position:"fixed",top:o.anchor.top,left:o.anchor.left,zIndex:60},children:(0,X.jsx)(kD,{kind:o.kind,pagePath:r,anchor:{top:0,left:0},onCancel:()=>s(null),onInsert:t=>((t,n)=>{let{url:r,alt:i,mimeType:o}=n;"image"===t||(o??"").startsWith("image/")||/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(r)?e.chain().focus().setImage({src:r,alt:i??""}).run():e.chain().focus().insertContent(`<a href="${r}">${i??r}</a>`).run(),s(null)})(o.kind,t)})}),o&&(0,X.jsx)(kP,{onClose:()=>s(null)})]})}function kP({onClose:e}){return(0,Q.useEffect)(()=>{let t=window.setTimeout(()=>{let t=t=>{let n=t.target;n?.closest('[data-editor-popover="true"]')||e()};window.addEventListener("mousedown",t),window.__editorPopClose=()=>window.removeEventListener("mousedown",t)},10);return()=>{window.clearTimeout(t);let e=window;e.__editorPopClose&&(e.__editorPopClose(),e.__editorPopClose=void 0)}},[e]),null}var kj=/^```([a-z]+)?[\s\n]$/,kB=/^~~~([a-z]+)?[\s\n]$/,kF=pa.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",dX(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&(null==(r=e.raw)?void 0:r.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r}
|
|
103
|
+
|
|
104
|
+
\`\`\``},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;let a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{let{from:t,to:n}=i,o=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(o)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;let{pos:i}=o,s=o.start(),a=o.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n"),c=0,d=0,u=i-s;for(let e=0;e<l.length;e+=1){if(d+l[e].length>=u){c=e;break}d+=l[e].length+1}let p=Math.min(((null==(t=l[c].match(/^ */))?void 0:t[0])||"").length,n);if(0===p)return!0;let h=s;for(let e=0;e<c;e+=1)h+=l[e].length+1;return e.delete(h,h+p),i-h<=p&&e.setSelection(og.create(e.doc,h)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:o}=i,s=r.doc.textBetween(t,o,"\n","\n").split("\n").map(e=>{var t;let r=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(t,o,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!!o&&!!s&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let s=i.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(op.near(r.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[u4({find:kj,type:this.type,getAttributes:e=>({language:e[1]})}),u4({find:kB,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new oM({key:new oD("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=null==i?void 0:i.mode;if(!n||!o)return!1;let{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(og.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}});let kH=e.i(454184).default;function kU(e){return e.value||e.children||[]}function kz({doc:e,name:t,lowlight:n,defaultLanguage:r}){let i=[];return dF(e,e=>e.type.name===t).forEach(e=>{var t;let o=e.pos+1,s=e.node.attrs.language||r,a=n.listLanguages();(function e(t,n=[]){return t.flatMap(t=>{let r=[...n,...t.properties?t.properties.className:[]];return t.children?e(t.children,r):{text:t.value,classes:r}})})(s&&(a.includes(s)||kH.getLanguage(s)||(null==(t=n.registered)?void 0:t.call(n,s)))?kU(n.highlight(s,e.node.textContent)):kU(n.highlightAuto(e.node.textContent))).forEach(e=>{let t=o+e.text.length;if(e.classes.length){let n=aR.inline(o,t,{class:e.classes.join(" ")});i.push(n)}o=t})}),aj.create(e,i)}var k$=kF.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...(null==(e=this.parent)?void 0:e.call(this))||[],function({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(e=>"function"==typeof t[e]))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new oM({key:new oD("lowlight"),state:{init:(r,{doc:i})=>kz({doc:i,name:e,lowlight:t,defaultLanguage:n}),apply:(r,i,o,s)=>{let a=o.selection.$head.parent.type.name,l=s.selection.$head.parent.type.name,c=dF(o.doc,t=>t.type.name===e),d=dF(s.doc,t=>t.type.name===e);return r.docChanged&&([a,l].includes(e)||d.length!==c.length||r.steps.some(e=>void 0!==e.from&&void 0!==e.to&&c.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?kz({doc:r.doc,name:e,lowlight:t,defaultLanguage:n}):i.map(r.mapping,r.doc)}},props:{decorations:e=>r.getState(e)}});return r}({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});let kG="numeric",kq="ascii",kV="alpha",kW="asciinumeric",kK="alphanumeric",kY="domain",kX="emoji",kQ="whitespace";function kJ(e,t,n){for(let r in t[kG]&&(t[kW]=!0,t[kK]=!0),t[kq]&&(t[kW]=!0,t[kV]=!0),t[kW]&&(t[kK]=!0),t[kV]&&(t[kK]=!0),t[kK]&&(t[kY]=!0),t[kX]&&(t[kY]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function kZ(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}kZ.groups={},kZ.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let n=this.jr[t][0],r=this.jr[t][1];if(r&&n.test(e))return r}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){let i;return r=r||kZ.groups,t&&t.j?i=t:(i=new kZ(t),n&&r&&kJ(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,o=e.length;if(!o)return i;for(let t=0;t<o-1;t++)i=i.tt(e[t]);return i.tt(e[o-1],t,n,r)},tt(e,t,n,r){if(r=r||kZ.groups,t&&t.j)return this.j[e]=t,t;let i,o=this.go(e);return o?(Object.assign((i=new kZ).j,o.j),i.jr.push.apply(i.jr,o.jr),i.jd=o.jd,i.t=o.t):i=new kZ,t&&(r&&(i.t&&"string"==typeof i.t?kJ(t,Object.assign(function(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&kJ(t,n,r)),i.t=t),this.j[e]=i,i}};let k0=(e,t,n,r,i)=>e.ta(t,n,r,i),k1=(e,t,n,r,i)=>e.tr(t,n,r,i),k2=(e,t,n,r,i)=>e.ts(t,n,r,i),k3=(e,t,n,r,i)=>e.tt(t,n,r,i),k5="WORD",k4="UWORD",k6="ASCIINUMERICAL",k9="ALPHANUMERICAL",k7="LOCALHOST",k8="UTLD",Te="SCHEME",Tt="SLASH_SCHEME",Tn="OPENBRACE",Tr="CLOSEBRACE",Ti="OPENBRACKET",To="CLOSEBRACKET",Ts="OPENPAREN",Ta="CLOSEPAREN",Tl="OPENANGLEBRACKET",Tc="CLOSEANGLEBRACKET",Td="FULLWIDTHLEFTPAREN",Tu="FULLWIDTHRIGHTPAREN",Tp="LEFTCORNERBRACKET",Th="RIGHTCORNERBRACKET",Tf="LEFTWHITECORNERBRACKET",Tm="RIGHTWHITECORNERBRACKET",Tg="FULLWIDTHLESSTHAN",Tb="FULLWIDTHGREATERTHAN",Ty="AMPERSAND",Tx="APOSTROPHE",Tv="ASTERISK",TE="BACKSLASH",Tw="BACKTICK",Tk="CARET",TT="COLON",TN="COMMA",TA="DOLLAR",TS="EQUALS",TC="EXCLAMATION",T_="HYPHEN",TM="PERCENT",TO="PIPE",TI="PLUS",TD="POUND",TR="QUERY",TL="QUOTE",TP="FULLWIDTHMIDDLEDOT",Tj="SEMI",TB="SLASH",TF="TILDE",TH="UNDERSCORE",TU="EMOJI";var Tz=Object.freeze({__proto__:null,ALPHANUMERICAL:k9,AMPERSAND:Ty,APOSTROPHE:Tx,ASCIINUMERICAL:k6,ASTERISK:Tv,AT:"AT",BACKSLASH:TE,BACKTICK:Tw,CARET:Tk,CLOSEANGLEBRACKET:Tc,CLOSEBRACE:Tr,CLOSEBRACKET:To,CLOSEPAREN:Ta,COLON:TT,COMMA:TN,DOLLAR:TA,DOT:"DOT",EMOJI:TU,EQUALS:TS,EXCLAMATION:TC,FULLWIDTHGREATERTHAN:Tb,FULLWIDTHLEFTPAREN:Td,FULLWIDTHLESSTHAN:Tg,FULLWIDTHMIDDLEDOT:TP,FULLWIDTHRIGHTPAREN:Tu,HYPHEN:T_,LEFTCORNERBRACKET:Tp,LEFTWHITECORNERBRACKET:Tf,LOCALHOST:k7,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:Tl,OPENBRACE:Tn,OPENBRACKET:Ti,OPENPAREN:Ts,PERCENT:TM,PIPE:TO,PLUS:TI,POUND:TD,QUERY:TR,QUOTE:TL,RIGHTCORNERBRACKET:Th,RIGHTWHITECORNERBRACKET:Tm,SCHEME:Te,SEMI:Tj,SLASH:TB,SLASH_SCHEME:Tt,SYM:"SYM",TILDE:TF,TLD:"TLD",UNDERSCORE:TH,UTLD:k8,UWORD:k4,WORD:k5,WS:"WS"});let T$=/[a-z]/,TG=/\p{L}/u,Tq=/\p{Emoji}/u,TV=/\d/,TW=/\s/,TK=null,TY=null;function TX(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i,o=e.charCodeAt(r),s=o<55296||o>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s<r;){let a=e,l=null,c=0,d=null,u=-1,p=-1;for(;s<r&&(l=a.go(n[s]));)(a=l).accepts()?(u=0,p=0,d=a):u>=0&&(u+=n[s].length,p++),c+=n[s].length,o+=n[s].length,s++;o-=u,s-=p,c-=u,i.push({t:d.t,v:t.slice(o-c,o),s:o-c,e:o})}return i}function TQ(e,t,n,r,i){let o,s=t.length;for(let n=0;n<s-1;n++){let s=t[n];e.j[s]?o=e.j[s]:((o=new kZ(r)).jr=i.slice(),e.j[s]=o),e=o}return(o=new kZ(n)).jr=i.slice(),e.j[t[s-1]]=o,o}function TJ(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;"0123456789".indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}let TZ={defaultProtocol:"http",events:null,format:T1,formatHref:T1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function T0(e,t=null){let n=Object.assign({},TZ);e&&(n=Object.assign(n,e instanceof T0?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function T1(e){return e}function T2(e,t){this.t="token",this.v=e,this.tk=t}function T3(e,t){class n extends T2{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}T0.prototype={o:TZ,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:TZ[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},T2.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=TZ.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),o={},s=e.get("className",t,this),a=e.get("target",t,this),l=e.get("rel",t,this),c=e.getObj("attributes",t,this),d=e.getObj("events",t,this);return o.href=n,s&&(o.class=s),a&&(o.target=a),l&&(o.rel=l),c&&Object.assign(o,c),{tagName:r,attributes:o,content:i,eventListeners:d}}};let T5=T3("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),T4=T3("text"),T6=T3("nl"),T9=T3("url",{isLink:!0,toHref(e=TZ.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==k7&&e[1].t===TT}}),T7=e=>new kZ(e);function T8(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let Ne="u">typeof console&&console&&console.warn||(()=>{}),Nt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Nn(e,t=!1){if(Nt.initialized&&Ne(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
105
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
106
|
+
2. Cannot start or end with "-"
|
|
107
|
+
3. "-" cannot repeat`);Nt.customSchemes.push([e,t])}function Nr(e){return Nt.initialized||function(){Nt.scanner=function(e=[]){let t={};kZ.groups=t;let n=new kZ;null==TK&&(TK=TJ("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==TY&&(TY=TJ("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),k3(n,"'",Tx),k3(n,"{",Tn),k3(n,"}",Tr),k3(n,"[",Ti),k3(n,"]",To),k3(n,"(",Ts),k3(n,")",Ta),k3(n,"<",Tl),k3(n,">",Tc),k3(n,"(",Td),k3(n,")",Tu),k3(n,"「",Tp),k3(n,"」",Th),k3(n,"『",Tf),k3(n,"』",Tm),k3(n,"<",Tg),k3(n,">",Tb),k3(n,"&",Ty),k3(n,"*",Tv),k3(n,"@","AT"),k3(n,"`",Tw),k3(n,"^",Tk),k3(n,":",TT),k3(n,",",TN),k3(n,"$",TA),k3(n,".","DOT"),k3(n,"=",TS),k3(n,"!",TC),k3(n,"-",T_),k3(n,"%",TM),k3(n,"|",TO),k3(n,"+",TI),k3(n,"#",TD),k3(n,"?",TR),k3(n,'"',TL),k3(n,"/",TB),k3(n,";",Tj),k3(n,"~",TF),k3(n,"_",TH),k3(n,"\\",TE),k3(n,"・",TP);let r=k1(n,TV,"NUM",{[kG]:!0});k1(r,TV,r);let i=k1(r,T$,k6,{[kW]:!0}),o=k1(r,TG,k9,{[kK]:!0}),s=k1(n,T$,k5,{[kq]:!0});k1(s,TV,i),k1(s,T$,s),k1(i,TV,i),k1(i,T$,i);let a=k1(n,TG,k4,{[kV]:!0});k1(a,T$),k1(a,TV,o),k1(a,TG,a),k1(o,TV,o),k1(o,T$),k1(o,TG,o);let l=k3(n,"\n","NL",{[kQ]:!0}),c=k3(n,"\r","WS",{[kQ]:!0}),d=k1(n,TW,"WS",{[kQ]:!0});k3(n,"",d),k3(c,"\n",l),k3(c,"",d),k1(c,TW,d),k3(d,"\r"),k3(d,"\n"),k1(d,TW,d),k3(d,"",d);let u=k1(n,Tq,TU,{[kX]:!0});k3(u,"#"),k1(u,Tq,u),k3(u,"️",u);let p=k3(u,"");k3(p,"#"),k1(p,Tq,u);let h=[[T$,s],[TV,i]],f=[[T$,null],[TG,a],[TV,o]];for(let e=0;e<TK.length;e++)TQ(n,TK[e],"TLD",k5,h);for(let e=0;e<TY.length;e++)TQ(n,TY[e],k8,k4,f);kJ("TLD",{tld:!0,ascii:!0},t),kJ(k8,{utld:!0,alpha:!0},t),TQ(n,"file",Te,k5,h),TQ(n,"mailto",Te,k5,h),TQ(n,"http",Tt,k5,h),TQ(n,"https",Tt,k5,h),TQ(n,"ftp",Tt,k5,h),TQ(n,"ftps",Tt,k5,h),kJ(Te,{scheme:!0,ascii:!0},t),kJ(Tt,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?i[kY]=!0:T$.test(r)?TV.test(r)?i[kW]=!0:i[kq]=!0:i[kG]=!0,k2(n,r,r,i)}return k2(n,"localhost",k7,{ascii:!0}),n.jd=new kZ("SYM"),{start:n,tokens:Object.assign({groups:t},Tz)}}(Nt.customSchemes);for(let e=0;e<Nt.tokenQueue.length;e++)Nt.tokenQueue[e][1]({scanner:Nt.scanner});Nt.parser=function({groups:e}){let t=e.domain.concat([Ty,Tv,"AT",TE,Tw,Tk,TA,TS,T_,"NUM",TM,TO,TI,TD,TB,"SYM",TF,TH]),n=[Tx,TT,TN,"DOT",TC,TM,TR,TL,Tj,Tl,Tc,Tn,Tr,To,Ti,Ts,Ta,Td,Tu,Tp,Th,Tf,Tm,Tg,Tb],r=[Ty,Tx,Tv,TE,Tw,Tk,TA,TS,T_,Tn,Tr,TM,TO,TI,TD,TR,TB,"SYM",TF,TH],i=T7(),o=k3(i,TF);k0(o,r,o),k0(o,e.domain,o);let s=T7(),a=T7(),l=T7();k0(i,e.domain,s),k0(i,e.scheme,a),k0(i,e.slashscheme,l),k0(s,r,o),k0(s,e.domain,s);let c=k3(s,"AT");k3(o,"AT",c),k3(a,"AT",c),k3(l,"AT",c);let d=k3(o,"DOT");k0(d,r,o),k0(d,e.domain,o);let u=T7();k0(c,e.domain,u),k0(u,e.domain,u);let p=k3(u,"DOT");k0(p,e.domain,u);let h=T7(T5);k0(p,e.tld,h),k0(p,e.utld,h),k3(c,k7,h);let f=k3(u,T_);k3(f,T_,f),k0(f,e.domain,u),k0(h,e.domain,u),k3(h,"DOT",p),k3(h,T_,f);let m=k3(s,T_),g=k3(s,"DOT");k3(m,T_,m),k0(m,e.domain,s),k0(g,r,o),k0(g,e.domain,s);let b=T7(T9);k0(g,e.tld,b),k0(g,e.utld,b),k0(b,e.domain,s),k0(b,r,o),k3(b,"DOT",g),k3(b,T_,m),k3(b,"AT",c);let y=k3(b,TT),x=T7(T9);k0(y,e.numeric,x);let v=T7(T9),E=T7();k0(v,t,v),k0(v,n,E),k0(E,t,v),k0(E,n,E),k3(b,TB,v),k3(x,TB,v);let w=k3(a,TT),k=k3(l,TT),T=k3(k,TB),N=k3(T,TB);k0(a,e.domain,s),k3(a,"DOT",g),k3(a,T_,m),k0(l,e.domain,s),k3(l,"DOT",g),k3(l,T_,m),k0(w,e.domain,v),k3(w,TB,v),k3(w,TR,v),k0(N,e.domain,v),k0(N,t,v),k3(N,TB,v);let A=[[Tn,Tr],[Ti,To],[Ts,Ta],[Tl,Tc],[Td,Tu],[Tp,Th],[Tf,Tm],[Tg,Tb]];for(let e=0;e<A.length;e++){let[r,i]=A[e],o=k3(v,r);k3(E,r,o);let s=T7(T9);k0(o,t,s);let a=T7();k0(o,n,a),k3(o,i,v),k0(s,t,s),k0(s,n,a),k0(a,t,s),k0(a,n,a),k3(s,i,v),k3(a,i,v)}return k3(i,k7,b),k3(i,"NL",T6),{start:i,tokens:Tz}}(Nt.scanner.tokens);for(let e=0;e<Nt.pluginQueue.length;e++)Nt.pluginQueue[e][1]({scanner:Nt.scanner,parser:Nt.parser});Nt.initialized=!0}(),function(e,t,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=e,l=null,c=null,d=0,u=null,p=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,(a=c).accepts()?(p=0,u=a):p>=0&&p++,i++,d++;if(p<0)(i-=d)<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(T8(T4,t,s)),s=[]),i-=p,d-=p;let e=u.t,r=n.slice(i-d,i);o.push(T8(e,t,r))}}return s.length>0&&o.push(T8(T4,t,s)),o}(Nt.parser.start,e,TX(Nt.scanner.start,e))}function Ni(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new T0(n),i=Nr(e),o=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&o.push(n.toFormattedObject(r))}return o}Nr.scan=TX;var No="[\0- -\u2029 ]",Ns=new RegExp(No),Na=RegExp(`${No}$`),Nl=RegExp(No,"g");function Nc(e,t){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(Nl,"").match(RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Nd=uB.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?Nn(e):Nn(e.scheme,e.optionalSlashes)})},onDestroy(){kZ.groups={},Nt.scanner=null,Nt.parser=null,Nt.tokenQueue=[],Nt.pluginQueue=[],Nt.customSchemes=[],Nt.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Nc(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!Nc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Nc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",dX(this.options.HTMLAttributes,e),0]:["a",dX(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,o;let s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(o=null==(i=e.attrs)?void 0:i.title)?o:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Nc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Nc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[pc({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=Ni(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Nc(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,n;let r=[],{protocols:i,defaultProtocol:o}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Nc(e,i),protocols:i,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink},new oM({key:new oD("autolink"),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),o=t.some(e=>e.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r;if(d9(dB(n.doc,[...t])).forEach(({newRange:t})=>{var n,i;let o,a,l,c=(n=r.doc,i=e=>e.isTextblock,l=[],n.nodesBetween(t.from,t.to,(e,t)=>{i(e)&&l.push({node:e,pos:t})}),l);if(c.length>1)o=c[0],a=r.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(c.length){let e=r.doc.textBetween(t.from,t.to," "," ");if(!Na.test(e))return;o=c[0],a=r.doc.textBetween(o.pos,t.to,void 0," ")}if(o&&a){let t=a.split(Ns).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],i=o.pos+a.lastIndexOf(n);if(!n)return!1;let l=Nr(n).map(t=>t.toObject(e.defaultProtocol));if(!(1===l.length?l[0].isLink:3===l.length&&!!l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;l.filter(e=>e.isLink).map(e=>({...e,from:i+e.start+1,to:i+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{d7(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||s.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),s.steps.length)return s}}))),r.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new oM({key:new oD("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(0!==r.button||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let e=r.target;if(!e)return!1;let n=t.editor.view.dom;(s=e.closest("a"))&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let n=d6(e.state,t.type.name),r=null!=(i=s.href)?i:n.href,l=null!=(o=s.target)?o:n.target;r&&(window.open(r,l),a=!0)}return a}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new oM({key:new oD("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});let c=Ni(l,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!!l&&!!c&&(void 0===i||!!i(c.value))&&n.editor.commands.setMark(n.type,{href:c.href})}}}))),r}});class Nu{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,o=this.editorView.dom,s=o.getBoundingClientRect(),a=s.width/o.offsetWidth,l=s.height/o.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&t&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*l;i={left:r.left,right:r.right,top:o-s,bottom:o+s}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let c=this.editorView.dom.offsetParent;if(!this.element&&(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),c&&(c!=document.body||"static"!=getComputedStyle(c).position)){let n=c.getBoundingClientRect(),r=n.width/c.offsetWidth,i=n.height/c.offsetHeight;e=n.left-c.scrollLeft*r,t=n.top-c.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/a+"px",this.element.style.top=(i.top-t)/l+"px",this.element.style.width=(i.right-i.left)/a+"px",this.element.style.height=(i.bottom-i.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=i9(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Np extends op{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Np.valid(n)?new Np(n):op.near(n)}content(){return r1.empty}eq(e){return e instanceof Np&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new Np(e.resolve(t.pos))}getBookmark(){return new Nh(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||Nf(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||Nf(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&Np.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(Np.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!oy.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=o,r+=t;let s=e.doc.resolve(r);if(Np.valid(s))return s}return null}}}Np.prototype.visible=!1,Np.findFrom=Np.findGapCursorFrom,op.jsonID("gapcursor",Np);class Nh{constructor(e){this.pos=e}map(e){return new Nh(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Np.valid(t)?new Np(t):op.near(t)}}function Nf(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let Nm=lu({ArrowLeft:Ng("horiz",-1),ArrowRight:Ng("horiz",1),ArrowUp:Ng("vert",-1),ArrowDown:Ng("vert",1)});function Ng(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,a=o.empty;if(o instanceof og){if(!i.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=Np.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new Np(l))),!0)}}function Nb(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Np.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&oy.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new Np(r))),!0)}function Ny(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Np))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=rY.empty;for(let e=r.length-1;e>=0;e--)i=rY.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new r1(i,0,0));return o.setSelection(og.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function Nx(e){if(!(e.selection instanceof Np))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",aj.create(e.doc,[aR.widget(e.selection.head,t,{key:"gapcursor"})])}var Nv=function(){};Nv.prototype.append=function(e){return e.length?(e=Nv.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},Nv.prototype.prepend=function(e){return e.length?Nv.from(e).append(this):this},Nv.prototype.appendInner=function(e){return new Nw(this,e)},Nv.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?Nv.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Nv.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},Nv.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Nv.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Nv.from=function(e){return e instanceof Nv?e:e&&e.length?new NE(e):Nv.empty};var NE=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Nv);Nv.empty=new NE([]);var Nw=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Nv);class Nk{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(r=(n=this.remapping(s,this.items.length)).maps.length);let a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(s,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new NT(e.map));let t=e.step.map(n.slice(r)),i;t&&a.maybeStep(t).doc&&(i=a.mapping.maps[a.mapping.maps.length-1],l.push(new NT(i,void 0,void 0,l.length+c.length))),r--,i&&n.appendMap(i,r)}else a.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new Nk(this.items.slice(0,s).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:a,selection:i}}addTransform(e,t,n,r){var i,o;let s,a=[],l=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new NT(e.mapping.maps[n],i,t),s;(s=d&&d.merge(o))&&(o=s,n?a.pop():c=c.slice(0,c.length-1)),a.push(o),t&&(l++,t=void 0),r||(d=o)}let u=l-n.depth;return u>NA&&(i=c,o=u,i.forEach((e,t)=>{if(e.selection&&0==o--)return s=t,!1}),c=i.slice(s),l-=u),new Nk(c.append(a),l)}remapping(e,t){let n=new iF;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new Nk(this.items.append(e.map(e=>new NT(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=i.getMirror(--a);if(null==r)return;o=Math.min(o,r);let l=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(a+1,r));c&&s++,n.push(new NT(l,o,c))}else n.push(new NT(l))},r);let l=[];for(let e=t;e<o;e++)l.push(new NT(i.maps[e]));let c=new Nk(this.items.slice(0,r).append(l).append(n),s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=o.selection&&o.selection.map(t.slice(n));a&&i++;let l=new NT(s.invert(),e,a),c,d=r.length-1;(c=r.length&&r[d].merge(l))?r[d]=c:r.push(l)}}else o.map&&n--},this.items.length,0),new Nk(Nv.from(r.reverse()),i)}}Nk.empty=new Nk(Nv.empty,0);class NT{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new NT(t.getMap().invert(),t,this.selection)}}}class NN{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let NA=20;function NS(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function NC(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let N_=!1,NM=null;function NO(e){let t=e.plugins;if(NM!=t){N_=!1,NM=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){N_=!0;break}}return N_}let NI=new oD("history"),ND=new oD("closeHistory");function NR(e,t){return(n,r)=>{let i=NI.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=NO(t),i=NI.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),l=new NN(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(NI,{redo:n,historyState:l})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let NL=NR(!1,!0),NP=NR(!0,!0);NR(!1,!1),NR(!0,!1),uz.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new oM({key:new oD("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,o=this.options.autoTrim;if(null==i||0===i||!1===o){e=!0;return}let s=this.storage.characters({node:r.doc});if(s>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,s-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos;return e.deleteRange(o-(i-n),o),!(this.storage.characters({node:e.doc})>n)}})]}});var Nj=uz.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new oM({view:t=>new Nu(t,e)})}(this.options)]}});uz.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new oM({key:new oD("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,o=[];if(!n||!r)return aj.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;s+=1}});let a=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((a+=1,"deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1)?"deepest"===this.options.mode:void o.push(aR.node(t,t+e.nodeSize,{class:this.options.className})))),aj.create(e,o)}}})]}});var NB=uz.create({name:"gapCursor",addProseMirrorPlugins:()=>[new oM({props:{decorations:Nx,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&Np.valid(n)?new Np(n):null,handleClick:Nb,handleKeyDown:Nm,handleDOMEvents:{beforeinput:Ny}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=dV(dz(e,"allowGapCursor",n)))?t:null}}}),NF="placeholder",NH=new oD("tiptap__placeholder");function NU(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:o,isEmptyDoc:s,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=e,d=[l];return s&&d.push(c),aR.node(i,i+o.nodeSize,{class:d.join(" "),[r]:"function"==typeof n?n({editor:t,node:o,pos:i,hasAnchor:a}):n})}var Nz={init:()=>({topPos:null,bottomPos:null}),apply(e,t){let n=e.getMeta(NH);return(null==n?void 0:n.positions)?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:null!==t.topPos?e.mapping.map(t.topPos):null,bottomPos:null!==t.bottomPos?e.mapping.map(t.bottomPos):null}:t}};function N$(e){let t=function(e){let t=e;for(;t;){if(function(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}break}t=e}return window}(e.dom),n=()=>{let n=function({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?n===window?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect():{top:0,bottom:window.innerHeight},o=Math.max(r.top,i.top)-200,s=Math.min(r.bottom,i.bottom)+200;if(o>=s)return{top:0,bottom:e.content.size};let a="rtl"===getComputedStyle(t.dom).direction?Math.max(r.right-2,r.left+2):r.left+2,l=t.posAtCoords({left:a,top:o+2}),c=t.posAtCoords({left:a,top:s-2});return{top:l?l.pos:0,bottom:c?c.pos:e.content.size}}({view:e,doc:e.state.doc,scrollContainer:t}),r=NH.getState(e.state);if((null==r?void 0:r.topPos)===n.top&&(null==r?void 0:r.bottomPos)===n.bottom)return;let i=e.state.tr.setMeta(NH,{positions:n});e.dispatch(i)},r=null,i=0,o=()=>{null===r&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):o()}))};return t.addEventListener("scroll",o,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&o()},destroy:()=>{null!==r&&cancelAnimationFrame(r),t.removeEventListener("scroll",o)}}}var NG=uz.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:NF,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[function({editor:e,options:t}){let n=t.dataAttribute?`data-${t.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${NF}`;return new oM({key:NH,state:Nz,view:N$,props:{decorations:({doc:r,selection:i})=>(function({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){var o,s;if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,l=[],c=e.isEmpty,d={emptyEditor:t.emptyEditorClass,emptyNode:t.emptyNodeClass};if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),o=i.depth>0?i.node(1):i.nodeAfter,s=i.depth>0?i.before(1):a;if(o&&o.type.isTextblock&&ui(o)){let r=a>=s&&a<=s+o.nodeSize;l.push(NU({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:d,node:o,pos:s}))}}else{let i=NH.getState(e.state),u=null!=(o=null==i?void 0:i.topPos)?o:0,p=null!=(s=null==i?void 0:i.bottomPos)?s:r.content.size;r.nodesBetween(u,p,(r,i)=>{let o=a>=i&&a<=i+r.nodeSize,s=!r.isLeaf&&ui(r);return r.type.isTextblock&&(o||!t.showOnlyCurrent)&&s&&l.push(NU({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:o,placeholder:t.placeholder,classes:d,node:r,pos:i})),t.includeChildren})}return aj.create(r,l)})({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}({editor:this.editor,options:this.options})]}});function Nq({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}uz.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new oM({key:new oD("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||uo(n.selection)||e.view.dragging?null:aj.create(n.doc,[aR.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var NV=uz.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new oD(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new oM({key:t,appendTransaction:(e,r,i)=>{let{doc:o,tr:s,schema:a}=i,l=t.getState(i),c=o.content.size,d=a.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&l)return s.insert(c,d.create())},state:{init:(e,t)=>!Nq({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!Nq({node:e.doc.lastChild,types:r})}})]}}),NW=uz.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>NL(e,t),redo:()=>({state:e,dispatch:t})=>NP(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new oM({key:NI,state:{init:()=>new NN(Nk.empty,Nk.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(NI),o;if(i)return i.historyState;n.getMeta(ND)&&(e=new NN(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(NI))if(s.getMeta(NI).redo)return new NN(e.done.addTransform(n,void 0,r,NO(t)),e.undone,NS(n.mapping.maps),e.prevTime,e.prevComposition);else return new NN(e.done,e.undone.addTransform(n,void 0,r,NO(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new NN(e.done.rebased(n,o),e.undone.rebased(n,o),NC(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new NN(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),NC(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),a=s?NC(e.prevRanges,n.mapping):NS(n.mapping.maps);return new NN(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,NO(t)),Nk.empty,a,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?NL:"historyRedo"==n?NP:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),NK=uB.create({name:"subscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sub"},{style:"vertical-align",getAttrs:e=>"sub"===e&&null}],renderHTML({HTMLAttributes:e}){return["sub",dX(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),NY=uB.create({name:"superscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sup"},{style:"vertical-align",getAttrs:e=>"super"===e&&null}],renderHTML({HTMLAttributes:e}){return["sup",dX(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});function NX(e){return"left"===e||"right"===e||"center"===e?e:null}function NQ(){return{default:null,parseHTML:e=>{let t,n;return t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase(),NX(t||n)},renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var NJ=pa.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,n;let r=e.getAttribute("colwidth"),i=r?r.split(",").map(e=>parseInt(e,10)):null;if(!i){let r=null==(t=e.closest("table"))?void 0:t.querySelectorAll("colgroup > col"),i=Array.from((null==(n=e.parentElement)?void 0:n.children)||[]).indexOf(e);if(i&&i>-1&&r&&r[i]){let e=r[i].getAttribute("width");return e?[parseInt(e,10)]:null}}return i}},align:NQ()}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td"}],renderHTML({HTMLAttributes:e}){return["td",dX(this.options.HTMLAttributes,e),0]}}),NZ=pa.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}},align:NQ()}),tableRole:"header_cell",isolating:!0,parseHTML:()=>[{tag:"th"}],renderHTML({HTMLAttributes:e}){return["th",dX(this.options.HTMLAttributes,e),0]}}),N0=pa.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes:e}){return["tr",dX(this.options.HTMLAttributes,e),0]}});function N1(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function N2(e,t,n,r,i,o){var s;let a=0,l=!0,c=t.firstChild,d=e.firstChild;if(null!==d)for(let e=0,n=0;e<d.childCount;e+=1){let{colspan:s,colwidth:u}=d.child(e).attrs;for(let e=0;e<s;e+=1,n+=1){let s=i===n?o:u&&u[e],d=s?`${s}px`:"";if(a+=s||r,s||(l=!1),c){if(c.style.width!==d){let[e,t]=N1(r,s);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement("col"),[n,i]=N1(r,s);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){let e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}let u=e.attrs.style&&"string"==typeof e.attrs.style&&/\bwidth\s*:/i.test(e.attrs.style);l&&!u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var N3=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),N2(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type===this.node.type&&(this.node=e,N2(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!n&&!r&&("attributes"===e.type||"childList"===e.type||"characterData"===e.type)}};function N5(e,t){return t?e.createChecked(null,t):e.createAndFill()}var N4=({editor:e})=>{let{selection:t}=e.state;if(!(t instanceof lk))return!1;let n=0,r=dH(t.ranges[0].$from,e=>"table"===e.type.name);return null==r||r.node.descendants(e=>{if("table"===e.type.name)return!1;["tableCell","tableHeader"].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)},N6=function(e,t,n={}){var r;let i=null!=(r=n.cellLineSeparator)?r:"\x1f";if(!e||!e.content||0===e.content.length)return"";let o=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{var r;let o=((e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(i):e.content?t.renderChildren(e.content):"")||"").replace(/\s+/g," ").trim(),s="tableHeader"===e.type,a=NX(null==(r=e.attrs)?void 0:r.align);n.push({text:o,isHeader:s,align:a})}),o.push(n)});let s=o.reduce((e,t)=>Math.max(e,t.length),0);if(0===s)return"";let a=Array.from({length:s}).fill(0);o.forEach(e=>{var t;for(let n=0;n<s;n+=1){let r=((null==(t=e[n])?void 0:t.text)||"").length;r>a[n]&&(a[n]=r),a[n]<3&&(a[n]=3)}});let l=(e,t)=>e+" ".repeat(Math.max(0,t-e.length)),c=o[0],d=c.some(e=>e.isHeader),u=Array.from({length:s}).fill(null);o.forEach(e=>{var t;for(let n=0;n<s;n+=1)!u[n]&&(null==(t=e[n])?void 0:t.align)&&(u[n]=e[n].align)});let p="\n",h=Array.from({length:s}).map((e,t)=>d&&c[t]&&c[t].text||"");return p+=`| ${h.map((e,t)=>l(e,a[t])).join(" | ")} |
|
|
108
|
+
| ${a.map((e,t)=>{let n=Math.max(3,e),r=u[t];return"left"===r?`:${"-".repeat(n)}`:"right"===r?`${"-".repeat(n)}:`:"center"===r?`:${"-".repeat(n)}:`:"-".repeat(n)}).join(" | ")} |
|
|
109
|
+
`,(d?o.slice(1):o).forEach(e=>{p+=`| ${Array.from({length:s}).fill(0).map((t,n)=>l(e[n]&&e[n].text||"",a[n])).join(" | ")} |
|
|
110
|
+
`}),p},N9=pa.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:N3,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=function(e,t){let n=0,r=!0,i=[],o=e.firstChild;if(!o)return{};for(let e=0,s=0;e<o.childCount;e+=1){let{colspan:a,colwidth:l}=o.child(e).attrs;for(let e=0;e<a;e+=1,s+=1){let o=void 0===s?void 0:l&&l[e];n+=o||t,o||(r=!1);let[a,c]=N1(t,o);i.push(["col",{style:`${a}: ${c}`}])}}return{colgroup:["colgroup",{},...i],tableWidth:r?`${n}px`:"",tableMinWidth:r?"":`${n}px`}}(e,this.options.cellMinWidth),o=t.style,s=["table",dX(this.options.HTMLAttributes,t,{style:o||(r?`width: ${r}`:`min-width: ${i}`)}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{var o;let s=NX(null!=(o=r[n])?o:e.align);i.push(t.createNode("tableHeader",s?{align:s}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{var o;let s=NX(null!=(o=r[n])?o:e.align);i.push(t.createNode("tableCell",s?{align:s}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>N6(e,t),addCommands:()=>({insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{let s=function(e,t,n,r){let i=function(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=N5(i.cell,void 0);if(e&&s.push(e),r){let e=N5(i.header_cell,void 0);e&&o.push(e)}}let a=[];for(let e=0;e<t;e+=1)a.push(i.row.createChecked(null,r&&0===e?o:s));return i.table.createChecked(null,a)}(o.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(og.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!lg(e))return!1;if(t){let n=lj(e);t(lB(e.tr,n,n.left))}return!0})(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!lg(e))return!1;if(t){let n=lj(e);t(lB(e.tr,n,n.right))}return!0})(e,t),deleteColumn:()=>({state:e,dispatch:t})=>(function(e,t){if(!lg(e))return!1;if(t){let n=lj(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;!function(e,{map:t,table:n,tableStart:r},i){let o=e.mapping.maps.length;for(let s=0;s<t.height;){let a=s*t.width+i,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&t.map[a-1]==l||i<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(o).map(r+l),null,lE(d,i-t.colCount(l)));else{let t=e.mapping.slice(o).map(r+l);e.delete(t,t+c.nodeSize)}s+=d.rowspan}}(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=lp.get(e)}t(r)}return!0})(e,t),addRowBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!lg(e))return!1;if(t){let n=lj(e);t(lF(e.tr,n,n.top))}return!0})(e,t),addRowAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!lg(e))return!1;if(t){let n=lj(e);t(lF(e.tr,n,n.bottom))}return!0})(e,t),deleteRow:()=>({state:e,dispatch:t})=>(function(e,t){if(!lg(e))return!1;if(t){let n=lj(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;!function(e,{map:t,table:n,tableStart:r},i){let o=0;for(let e=0;e<i;e++)o+=n.child(e).nodeSize;let s=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,s+r);let l=new Set;for(let o=0,s=i*t.width;o<t.width;o++,s++){let c=t.map[s];if(!l.has(c)){if(l.add(c),i>0&&c==t.map[s-t.width]){let t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),o+=t.colspan-1}else if(i<t.height&&c==t.map[s+t.width]){let s=n.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),d),o+=l.colspan-1}}}}(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=lp.get(n.table)}t(r)}return!0})(e,t),deleteTable:()=>({state:e,dispatch:t})=>(function(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1})(e,t),mergeCells:()=>({state:e,dispatch:t})=>lU(e,t),splitCell:()=>({state:e,dispatch:t})=>lz(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>lG("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>lG("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>lq(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>!!lU(e,t)||lz(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>(function(n,r){if(!lg(n))return!1;let i=lb(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let o=n.tr;n.selection instanceof lk?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&o.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0})(n,r),goToNextCell:()=>({state:e,dispatch:t})=>lV(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>lV(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&lS(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=lk.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:N4,"Mod-Backspace":N4,Delete:N4,"Mod-Delete":N4}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=l7,lastColumnResizable:i=!0}={}){let o=new oM({key:ce,state:{init(e,t){var i;let s=null==(i=o.spec)||null==(i=i.props)?void 0:i.nodeViews,a=lh(t.schema).table.name;return r&&s&&(s[a]=(e,t)=>new r(e,n,t)),new ct(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=ce.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;let i=ce.getState(e.state);if(i&&!i.dragging){let o=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),s=-1;if(o){let{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?s=cn(e,t,"left",n):i-t.clientX<=n&&(s=cn(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&-1!==s){let t=e.state.doc.resolve(s),n=t.node(-1),r=lp.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}ci(e,s)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=ce.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&ci(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return;let o=null!=(i=e.dom.ownerDocument.defaultView)?i:window,s=ce.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return;let a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=e.domAtPos(t),s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let r=ce.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),o=lp.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<o.height;e++){let t=e*o.width+a;if(e&&o.map[t]==o.map[t-o.width])continue;let r=o.map[t],c=i.nodeAt(r).attrs,d=1==c.colspan?0:a-o.colCount(r);if(c.colwidth&&c.colwidth[d]==n)continue;let u=c.colwidth?c.colwidth.slice():Array(c.colspan).fill(0);u[d]=n,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,cr(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(ce,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=ce.getState(e.state);if(i&&i.dragging){let o=cr(i.dragging,t,n);co(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(ce,{setDragging:{startX:t.clientX,startWidth:l}})),co(e,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=ce.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return aj.empty;let o=lp.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<o.height;t++){let r=a+t*o.width;if((a==o.width-1||o.map[r]!=o.map[r+1])&&(0==t||o.map[r]!=o.map[r-o.width])){var l;let t=o.map[r],a=s+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(l=ce.getState(e))?void 0:l.dragging)&&n.push(aR.node(s+t,s+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(aR.widget(a,c))}}return aj.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o}({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],function({allowTableNodeSelection:e=!1}={}){return new oM({key:lf,state:{init:()=>null,apply(e,t){let n=e.getMeta(lf);if(null!=n)return -1==n?null:n;if(null==t||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:lN,handleDOMEvents:{mousedown:l5},createSelectionBetween:e=>null!=lf.getState(e.state)?e.state.selection:null,handleTripleClick:l2,handleKeyDown:lJ,handlePaste:l3},appendTransaction:(t,n,r)=>(function(e,t,n){let r,i,o=(t||e).selection,s=(t||e).doc;if(o instanceof oy&&(i=o.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=lk.create(s,o.from);else if("row"==i){let e=s.resolve(o.from+1);r=lk.rowSelection(e,e)}else if(!n){let e=lp.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];r=lk.create(s,t+1,n)}}else o instanceof og&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(o)?r=og.create(s,o.from):o instanceof og&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(o)&&(r=og.create(s,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t})(r,lS(r,n),e)})}({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n})=>new t(e,this.options.cellMinWidth,n)},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:dV(dz(e,"tableRole",t))}}});uz.create({name:"tableKit",addExtensions(){let e=[];return!1!==this.options.table&&e.push(N9.configure(this.options.table)),!1!==this.options.tableCell&&e.push(NJ.configure(this.options.tableCell)),!1!==this.options.tableHeader&&e.push(NZ.configure(this.options.tableHeader)),!1!==this.options.tableRow&&e.push(N0.configure(this.options.tableRow)),e}});var N7=Object.defineProperty,N8="textStyle",Ae=/^\s*([-+*])\s$/,At=pa.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",dX(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(N8)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=u6({find:Ae,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=u6({find:Ae,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(N8),editor:this.editor})),[e]}}),An=pa.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",dX(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n,r,i,o;if("list_item"!==e.type)return[];let s=null!=(n=t.parseBlockChildren)?n:t.parseChildren,a=[];if(e.tokens&&e.tokens.length>0){let n;if(n=null==(r=e.tokens)?void 0:r[0],e.text&&(null==(i=e.tokens)?void 0:i.length)===1&&(null==n?void 0:n.type)==="list"&&n.ordered&&n.raw===e.text)return{type:"listItem",content:[{type:"paragraph",content:(o=e.text||"",t.tokenizeInline?t.parseInline(t.tokenizeInline(o)):t.parseInline([{type:"text",raw:o,text:o}]))}]};if(e.tokens.some(e=>"paragraph"===e.type))a=s(e.tokens);else{let n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(a=[{type:"paragraph",content:t.parseInline(n.tokens)}],e.tokens.length>1){let t=s(e.tokens.slice(1));a.push(...t)}}else a=s(e.tokens)}}return 0===a.length&&(a=[{type:"paragraph",content:[]}]),{type:"listItem",content:a}},renderMarkdown:(e,t,n)=>ps(e,t,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let r=(null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1;return`${r+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Ar={},Ai={findListItemPos:()=>As,getNextListDepth:()=>Aa,handleBackspace:()=>Au,handleDelete:()=>Af,hasListBefore:()=>Al,hasListItemAfter:()=>Am,hasListItemBefore:()=>Ac,listItemHasSubList:()=>Ad,nextListIsDeeper:()=>Ap,nextListIsHigher:()=>Ah};for(var Ao in Ai)N7(Ar,Ao,{get:Ai[Ao],enumerable:!0});var As=(e,t)=>{let{$from:n}=t.selection,r=cV(e,t.schema),i=n.depth,o=n.pos,s=null;for(;i>0&&null===s;)n.node(i).type===r?s=i:(i-=1,o-=1);return null===s?null:{$pos:t.doc.resolve(o),depth:s}},Aa=(e,t)=>{let n=As(e,t);if(!n)return!1;let[,r]=((e,t,n,r=20)=>{let i=e.doc.resolve(n),o=r,s=null;for(;o>0&&null===s;){let e=i.node(o);(null==e?void 0:e.type.name)===t?s=e:o-=1}return[s,o]})(t,e,n.$pos.pos+4);return r},Al=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),o=e.doc.resolve(i).node();return!!o&&!!n.includes(o.type.name)},Ac=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return 0!==i.index()&&(null==(n=i.nodeBefore)?void 0:n.type.name)===e},Ad=(e,t,n)=>{if(!n)return!1;let r=cV(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},Au=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!dv(e.state,t)&&Al(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let o=i.at(-1);if(!o)return!1;let s=e.state.doc.resolve(r.start()+o.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!dv(e.state,t)||!(e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos})(e.state))return!1;let r=As(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Ad(t,e.state,i);return Ac(t,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Ap=(e,t)=>{let n=Aa(e,t),r=As(e,t);return!!r&&!!n&&n>r.depth},Ah=(e,t)=>{let n=Aa(e,t),r=As(e,t);return!!r&&!!n&&n<r.depth},Af=(e,t)=>{if(!dv(e.state,t)||!((e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=dU(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos})(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!(!n.empty&&r.sameParent(i))&&(Ap(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Ah(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Am=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(n=i.nodeAfter)?void 0:n.type.name)===e},Ag=uz.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Af(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Af(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Au(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Au(e,n,r)&&(t=!0)}),t}}}}),Ab=/^(\s*)(\d+)\.\s+(.*)$/,Ay=/^\s/,Ax="textStyle",Av=/^(\d+)\.\s$/,AE=pa.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return 1===t?["ol",dX(this.options.HTMLAttributes,n),0]:["ol",dX(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,i=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})):[];return 1!==r?{type:"orderedList",attrs:{start:r},content:i}:{type:"orderedList",content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;let i=e.split("\n"),[o,s]=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],o=i.match(Ab);if(!o)break;let[,s,a,l]=o,c=s.length,d=[l],u=n+1,p=[i],h=!1;for(;u<e.length;){let t=e[u];if(t.match(Ab))break;if(""===t.trim())p.push(t),d.push(""),h=!0,u+=1;else if(t.match(Ay))p.push(t),d.push(t.slice(c+2)),u+=1;else{if(h)break;p.push(t),d.push(t),u+=1}}t.push({indent:c,number:parseInt(a,10),content:d.join("\n").trim(),contentLines:d,raw:p.join("\n")}),r=u,n=u}return[t,r]}(i);if(0===o.length)return;let a=function e(t,n,r){let i=[],o=0;for(;o<t.length;){let s=t[o];if(s.indent===n){let{paragraphLines:a,blockLines:l}=function(e){let t=[],n=[],r=!1;return e.forEach(e=>{let i;if(r)return void n.push(e);if(""===e.trim()||t.length>0&&(i=e.trimStart(),/^[-+*]\s+/.test(i)||/^\d+\.\s+/.test(i)||/^>\s?/.test(i)||/^```/.test(i)||/^~~~/.test(i))){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}(s.contentLines),c=a.join("\n").trim(),d=[];c&&d.push({type:"paragraph",raw:c,tokens:r.inlineTokens(c)});let u=l.join("\n").trim();if(u){let e=r.blockTokens(u);d.push(...e)}let p=o+1,h=[];for(;p<t.length&&t[p].indent>n;)h.push(t[p]),p+=1;if(h.length>0){let t=Math.min(...h.map(e=>e.indent)),n=e(h,t,r);d.push({type:"list",ordered:!0,start:h[0].number,items:n,raw:h.map(e=>e.raw).join("\n")})}i.push({type:"list_item",raw:s.raw,tokens:d}),o=p}else o+=1}return i}(o,0,n);if(0!==a.length)return{type:"list",ordered:!0,start:(null==(r=o[0])?void 0:r.number)||1,items:a,raw:i.slice(0,s).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Ax)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=u6({find:Av,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=u6({find:Av,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ax)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Aw=/^\s*(\[([( |x])?\])\s$/,Ak=pa.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",dX(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.checked)?"x":" ";return ps(e,t,`- [${r}] `)},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:i}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if("number"!=typeof t)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:i}),!0}).run(),r.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(a.checked=!a.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,o.append(a,s),i.append(o,l),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:i,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);let t=dQ(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),o=this.options.HTMLAttributes;return d.forEach(e=>{n.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),d=n,!0}}}},addInputRules(){return[u6({find:Aw,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),AT=pa.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",dX(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){let r=e=>{let t=po(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},i=po(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});uz.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(At.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(An.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Ag.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(AE.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(Ak.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(AT.configure(this.options.taskList)),e}});var AN=uz.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),AA=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},AS=/^\s*>\s$/,AC=pa.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return AA("blockquote",{...dX(this.options.HTMLAttributes,e),children:AA("slot",{})})},parseMarkdown:(e,t)=>{var n;let r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var i,o;let s=(null!=(o=null==(i=t.renderChild)?void 0:i.call(t,e,r))?o:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(s.join("\n"))}),n.join(`
|
|
111
|
+
>
|
|
112
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[u6({find:AS,type:this.type})]}}),A_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,AM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,AO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,AI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,AD=uB.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return AA("strong",{...dX(this.options.HTMLAttributes,e),children:AA("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[u3({find:A_,type:this.type}),u3({find:AO,type:this.type})]},addPasteRules(){return[pc({find:AM,type:this.type}),pc({find:AI,type:this.type})]}}),AR=/(^|[^`])`([^`]+)`(?!`)$/,AL=/(^|[^`])`([^`]+)`(?!`)/g,AP=uB.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",dX(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[u3({find:AR,type:this.type})]},addPasteRules(){return[pc({find:AL,type:this.type})]}}),Aj=pa.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),AB=pa.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",dX(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>`
|
|
113
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,a=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&o){let t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),AF=pa.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){let n=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${n}`,dX(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>u4({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),AH=pa.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",dX(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof oy){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return uo(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(og.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(oy.create(t.doc,n.pos)):t.setSelection(og.create(t.doc,n.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,o=null==i?void 0:i.create();o&&(t.insert(r,o),t.setSelection(og.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[u5({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),AU=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Az=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,A$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,AG=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Aq=uB.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",dX(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[u3({find:AU,type:this.type}),u3({find:A$,type:this.type})]},addPasteRules(){return[pc({find:Az,type:this.type}),pc({find:AG,type:this.type})]}}),AV=" ",AW=pa.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",dX(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===n.length&&"text"===n[0].type&&(n[0].raw===AV||n[0].text===AV||" "===n[0].raw||" "===n[0].text)&&1===r.length&&"text"===r[0].type&&(r[0].text===AV||" "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t,n)=>{var r,i;if(!e)return"";let o=Array.isArray(e.content)?e.content:[];if(0===o.length){let e=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return(null==(i=null==n?void 0:n.previousNode)?void 0:i.type)==="paragraph"&&0===e.length?AV:""}return t.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),AK=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,AY=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,AX=uB.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",dX(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[u3({find:AK,type:this.type})]},addPasteRules(){return[pc({find:AY,type:this.type})]}}),AQ=pa.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),AJ=uB.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",dX(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),AZ=uz.create({name:"starterKit",addExtensions(){var e,t,n,r;let i=[];return!1!==this.options.bold&&i.push(AD.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(AC.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(At.configure(this.options.bulletList)),!1!==this.options.code&&i.push(AP.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(kF.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(Aj.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(Nj.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(NB.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(AB.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(AF.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(NW.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(AH.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(Aq.configure(this.options.italic)),!1!==this.options.listItem&&i.push(An.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(Ag.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(Nd.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(AE.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(AW.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(AX.configure(this.options.strike)),!1!==this.options.text&&i.push(AQ.configure(this.options.text)),!1!==this.options.underline&&i.push(AJ.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&i.push(NV.configure(null==(r=this.options)?void 0:r.trailingNode)),i}});function A0(e){let t=e.regex,n={};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},{begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]}]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(s);let a={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10}),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],literal:["true","false"],built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]},contains:[l,e.SHEBANG(),c,a,i,o,{match:/(\/[a-z._-]+)+/},s,{match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},n]}}let A1=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],A2=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),A3=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),A5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),A4=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function A6(e){let t=e.regex,n={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},r=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+A3.join("|")+")"},{begin:":(:)?("+A5.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+A4.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...r,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...r,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:A2.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...r,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+A1.join("|")+")\\b"}]}}function A9(e){let t={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:t,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}let A7="[A-Za-z$_][0-9A-Za-z$_]*",A8=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Se=["true","false","null","undefined","NaN","Infinity"],St=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Sn=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Sr=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Si=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],So=[].concat(Sr,St,Sn);function Ss(e){var t;let n=e.regex,r=/<[A-Za-z0-9\\._:-]+/,i=/\/[A-Za-z0-9\\._:-]+>|\/>/,o={$pattern:A7,keyword:A8,literal:Se,built_in:So,"variable.language":Si},s="[0-9](_?[0-9])*",a=`\\.(${s})`,l="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",c={className:"number",variants:[{begin:`(\\b(${l})((${a})|\\.)?|(${a}))[eE][+-]?(${s})\\b`},{begin:`\\b(${l})\\b((${a})\\b|\\.)?|(${a})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},u={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},h={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},f={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},m={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:A7+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},g=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,p,h,f,{match:/\$\d+/},c];d.contains=g.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(g)});let b=[].concat(m,d.contains),y=b.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(b)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:y},v={variants:[{match:[/class/,/\s+/,A7,/\s+/,/extends/,/\s+/,n.concat(A7,"(",n.concat(/\./,A7),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,A7],scope:{1:"keyword",3:"title.class"}}]},E={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...St,...Sn]}},w={match:n.concat(/\b/,(t=[...Sr,"super","import"].map(e=>`${e}\\s*\\(`),n.concat("(?!",t.join("|"),")")),A7,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},k={begin:n.concat(/\./,n.lookahead(n.concat(A7,/(?![0-9A-Za-z$_(])/))),end:A7,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",N={match:[/const|var|let/,/\s+/,A7,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:y,CLASS_REFERENCE:E},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,p,h,f,m,{match:/\$\d+/},c,E,{scope:"attr",match:A7+n.lookahead(":"),relevance:0},N,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:y}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:"</>"},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:r,"on:begin":(e,t)=>{let n,r=e[0].length+e.index,i=e.input[r];if("<"===i||","===i)return void t.ignoreMatch();">"!==i||((e,{after:t})=>{let n="</"+e[0].slice(1);return -1!==e.input.indexOf(n,t)})(e,{after:r})||t.ignoreMatch();let o=e.input.substring(r);if((n=o.match(/^\s*=/))||(n=o.match(/^\s+extends\s+/))&&0===n.index)return void t.ignoreMatch()},end:i}],subLanguage:"xml",contains:[{begin:r,end:i,skip:!0,contains:["self"]}]}]},{variants:[{match:[/function/,/\s+/,A7,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,e.inherit(e.TITLE_MODE,{begin:A7,className:"title.function"})]},{match:/\.\.\./,relevance:0},k,{match:"\\$"+A7,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},w,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},v,{match:[/get|set/,/\s+/,A7,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},{match:/\$[(.]/}]}}function Sa(e){let t=["true","false","null"],n={scope:"literal",beginKeywords:t.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:t},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function Sl(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},i={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},o={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},s=e.inherit(i,{contains:[]}),a=e.inherit(o,{contains:[]});i.contains.push(a),o.contains.push(s);let l=[n,r];return[i,o,s,a].forEach(e=>{e.contains=e.contains.concat(l)}),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:l=l.concat(i,o)},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:l}]}]},n,{className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i,o,{className:"quote",begin:"^>\\s+",contains:l,end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},r,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Sc(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},o={className:"meta",begin:/^(>>>|\.\.\.) /},s={className:"subst",begin:/\{/,end:/\}/,keywords:i,illegal:/#/},a={begin:/\{\{/,relevance:0},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o,a,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o,a,s]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,a,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,a,s]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,u=`\\b|${r.join("|")}`,p={className:"number",relevance:0,variants:[{begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${c})[jJ](?=${u})`}]},h={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},f={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:["self",o,p,l,e.HASH_COMMENT_MODE]}]};return s.contains=[l,p,o],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[o,p,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},l,h,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[f]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[p,f,l]}]}}function Sd(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",a=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],l=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:l,keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],literal:["true","false","Some","None","Ok","Err"],built_in:a},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:a,type:l}},{className:"punctuation",begin:"->"},o]}}function Su(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Sp(e){let t=e.regex,n=e.COMMENT("--","$"),r=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],i=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter(e=>!r.includes(e)),o={match:t.concat(/\b/,t.either(...r),/\s*\(/),relevance:0,keywords:{built_in:r}};function s(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,"\\s+"))),/\b/)}let a={scope:"keyword",match:s(["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"]),relevance:0};return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:function(e,{exceptions:t,when:n}={}){return t=t||[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:n(e)?`${e}|0`:e)}(i,{when:e=>e.length<3}),literal:["true","false","unknown"],type:["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"]},contains:[{scope:"type",match:s(["double precision","large object","with timezone","without timezone"])},a,o,{scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},{scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},{begin:/"/,end:/"/,contains:[{match:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,{scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}let Sh="[A-Za-z$_][0-9A-Za-z$_]*",Sf=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Sm=["true","false","null","undefined","NaN","Infinity"],Sg=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Sb=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Sy=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Sx=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Sv=[].concat(Sy,Sg,Sb);function SE(e){var t;let n,r,i,o,s,a,l,c,d,u,p,h,f,m,g,b,y,x,v,E,w,k,T,N,A,S=e.regex,C=(n=e.regex,r=/<[A-Za-z0-9\\._:-]+/,i=/\/[A-Za-z0-9\\._:-]+>|\/>/,o=(e,t)=>{let n,r=e[0].length+e.index,i=e.input[r];if("<"===i||","===i)return void t.ignoreMatch();">"!==i||((e,{after:t})=>{let n="</"+e[0].slice(1);return -1!==e.input.indexOf(n,t)})(e,{after:r})||t.ignoreMatch();let o=e.input.substring(r);if((n=o.match(/^\s*=/))||(n=o.match(/^\s+extends\s+/))&&0===n.index)return void t.ignoreMatch()},s={$pattern:Sh,keyword:Sf,literal:Sm,built_in:Sv,"variable.language":Sx},a="[0-9](_?[0-9])*",l=`\\.(${a})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${l})|\\.)?|(${l}))[eE][+-]?(${a})\\b`},{begin:`\\b(${c})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},f={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:Sh+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},u.contains=(b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,h,f,m,{match:/\$\d+/},d]).concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(b)}),x=(y=[].concat(g,u.contains)).concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(y)}]),v={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:x},E={variants:[{match:[/class/,/\s+/,Sh,/\s+/,/extends/,/\s+/,n.concat(Sh,"(",n.concat(/\./,Sh),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,Sh],scope:{1:"keyword",3:"title.class"}}]},w={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Sg,...Sb]}},k={match:n.concat(/\b/,(t=[...Sy,"super","import"].map(e=>`${e}\\s*\\(`),n.concat("(?!",t.join("|"),")")),Sh,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},T={begin:n.concat(/\./,n.lookahead(n.concat(Sh,/(?![0-9A-Za-z$_(])/))),end:Sh,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,Sh,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[v]},{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:w},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,h,f,m,g,{match:/\$\d+/},d,w,{scope:"attr",match:Sh+n.lookahead(":"),relevance:0},A,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:"</>"},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:r,"on:begin":o,end:i}],subLanguage:"xml",contains:[{begin:r,end:i,skip:!0,contains:["self"]}]}]},{variants:[{match:[/function/,/\s+/,Sh,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/},{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[v,e.inherit(e.TITLE_MODE,{begin:Sh,className:"title.function"})]},{match:/\.\.\./,relevance:0},T,{match:"\\$"+Sh,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},k,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},E,{match:[/get|set/,/\s+/,Sh,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]},{match:/\$[(.]/}]}),_=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],M={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},O={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:_},contains:[C.exports.CLASS_REFERENCE]},I={$pattern:Sh,keyword:Sf.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:Sm,built_in:Sv.concat(_),"variable.language":Sx},D={className:"meta",begin:"@"+Sh},R=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(-1===r)throw Error("can not find mode to replace");e.contains.splice(r,1,n)};Object.assign(C.keywords,I),C.exports.PARAMS_CONTAINS.push(D);let L=C.contains.find(e=>"attr"===e.scope),P=Object.assign({},L,{match:S.concat(Sh,S.lookahead(/\s*\?:/))});return C.exports.PARAMS_CONTAINS.push([C.exports.CLASS_REFERENCE,L,P]),C.contains=C.contains.concat([D,M,O,P]),R(C,"shebang",e.SHEBANG()),R(C,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/}),C.contains.find(e=>"func.def"===e.label).relevance=0,Object.assign(C,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),C}function Sw(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:"string"}),a=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,a,s,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,a,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[a]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:l}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Sk(e){let t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},i=e.inherit(r,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),o={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},s=[{className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},{className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},{begin:/\{/,end:/\}/,contains:[o],illegal:"\\n",relevance:0},{begin:"\\[",end:"\\]",contains:[o],illegal:"\\n",relevance:0},{className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},r],a=[...s];return a.pop(),a.push(i),o.contains=a,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:s}}let ST={};function SN(e){let t=kH.newInstance();return e&&i(e),{highlight:n,highlightAuto:function(e,i){let o;p7("string"==typeof e,"expected `string` as `value`");let s=(i||ST).subset||r(),a=-1,l=0;for(;++a<s.length;){let r=s[a];if(!t.getLanguage(r))continue;let c=n(r,e,i);c.data&&void 0!==c.data.relevance&&c.data.relevance>l&&(l=c.data.relevance,o=c)}return o||{type:"root",children:[],data:{language:void 0,relevance:l}}},listLanguages:r,register:i,registerAlias:function(e,n){if("string"==typeof e)p7(void 0!==n),t.registerAliases("string"==typeof n?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases("string"==typeof r?r:[...r],{languageName:n})}}},registered:function(e){return!!t.getLanguage(e)}};function n(e,n,r){p7("string"==typeof e,"expected `string` as `name`"),p7("string"==typeof n,"expected `string` as `value`");let i=r||ST,o="string"==typeof i.prefix?i.prefix:"hljs-";if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:SA,classPrefix:o});let s=t.highlight(n,{ignoreIllegals:!0,language:e});if(s.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:s.errorRaised});let a=s._emitter.root,l=a.data;return l.language=s.language,l.relevance=s.relevance,a}function r(){return t.listLanguages()}function i(e,n){if("string"==typeof e)p7(void 0!==n,"expected `grammar`"),t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}}class SA{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(""===e)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&"text"===n.type?n.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:"element",tagName:"span",properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(".").map(function(e,n){return n?e+"_".repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}let SS=pa.create({name:"callout",group:"block",content:"block+",defining:!0,addAttributes:()=>({type:{default:"info",parseHTML:e=>e.getAttribute("data-callout-type")||"info",renderHTML:e=>({"data-callout-type":e.type})}}),parseHTML:()=>[{tag:'div[data-callout="true"]'}],renderHTML:({HTMLAttributes:e})=>["div",dX(e,{"data-callout":"true",class:`callout callout-${e["data-callout-type"]||"info"}`}),0]});function SC(e,t,n){let{selection:r,doc:i}=e,o=i.resolve(r.from);for(;o.depth>1;)o=i.resolve(o.before(o.depth));if(0===o.depth)return!1;let s=o.before(1),a=i.nodeAt(s);if(!a)return!1;let l=o.index(0),c="up"===n?l-1:l+1;if(c<0||c>=i.childCount)return!1;let d=i.child(c),u=e.tr,p=s+a.nodeSize,h="up"===n?s-d.nodeSize:p,f="up"===n?s:p+d.nodeSize;if("up"===n)u=(u=(u=u.delete(s,p)).insert(h,a)).setSelection(oy.create(u.doc,h));else{u=u.delete(s,p);let e=f-a.nodeSize;u=(u=u.insert(e,a)).setSelection(oy.create(u.doc,e))}return t&&t(u.scrollIntoView()),!0}let S_="cabinet-drag-handle",SM="cabinet-gutter-add",SO=uz.create({name:"dragHandle",addKeyboardShortcuts:()=>({"Mod-Alt-ArrowUp":({editor:e})=>SC(e.state,e.view.dispatch,"up"),"Mod-Alt-ArrowDown":({editor:e})=>SC(e.state,e.view.dispatch,"down"),"Alt-Shift-ArrowUp":({editor:e})=>SC(e.state,e.view.dispatch,"up"),"Alt-Shift-ArrowDown":({editor:e})=>SC(e.state,e.view.dispatch,"down")}),addProseMirrorPlugins(){let e,t,n=null,r="u">typeof document?((e=document.getElementById(S_))||((e=document.createElement("div")).id=S_,e.setAttribute("data-drag-handle","true"),e.draggable=!0,e.innerHTML='<svg width="10" height="16" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2.5" cy="3" r="1.2"/><circle cx="2.5" cy="8" r="1.2"/><circle cx="2.5" cy="13" r="1.2"/><circle cx="7.5" cy="3" r="1.2"/><circle cx="7.5" cy="8" r="1.2"/><circle cx="7.5" cy="13" r="1.2"/></svg>',Object.assign(e.style,{position:"absolute",display:"none",cursor:"grab",padding:"2px 4px",borderRadius:"4px",color:"var(--muted-foreground)",opacity:"0.55",zIndex:"40",userSelect:"none",transition:"opacity 120ms ease"}),e.addEventListener("mouseenter",()=>{e&&(e.style.opacity="1")}),e.addEventListener("mouseleave",()=>{e&&(e.style.opacity="0.55")}),document.body.appendChild(e)),e):null,i="u">typeof document?((t=document.getElementById(SM))||((t=document.createElement("button")).id=SM,t.type="button",t.setAttribute("aria-label","Add block"),t.title="Add block",t.innerHTML='<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 1V9M1 5H9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',Object.assign(t.style,{position:"absolute",display:"none",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",cursor:"pointer",borderRadius:"4px",color:"var(--muted-foreground)",opacity:"0.55",zIndex:"40",transition:"opacity 120ms ease, background 120ms ease",background:"transparent",border:"none",padding:"0"}),t.addEventListener("mouseenter",()=>{t&&(t.style.opacity="1",t.style.background="var(--muted)")}),t.addEventListener("mouseleave",()=>{t&&(t.style.opacity="0.55",t.style.background="transparent")}),document.body.appendChild(t)),t):null,o=()=>{r&&(r.style.display="none"),i&&(i.style.display="none"),n=null};return[new oM({key:new oD("cabinetDragHandle"),view:e=>{if(!r)return{destroy:()=>{}};let t=t=>{if(!e.editable)return;let s=e.dom.getBoundingClientRect();if(t.clientX<s.left-60||t.clientX>s.right+60||t.clientY<s.top||t.clientY>s.bottom)return void o();let a=function(e,t){let n=e.posAtCoords(t);if(!n)return null;let r=e.state.doc.resolve(n.inside>=0?n.inside:n.pos);for(;r.depth>0&&!r.parent.type.isBlock;)r=e.state.doc.resolve(r.before());let i=r.depth;for(;i>1&&"doc"!==e.state.doc.resolve(r.before(i)).parent.type.name;)i-=1;let o=0===i?0:r.before(Math.max(i,1)),s=e.state.doc.nodeAt(o);if(!s)return null;let a=e.nodeDOM(o);return{pos:o,node:s,dom:a}}(e,{left:Math.max(s.left+20,Math.min(s.right-20,t.clientX)),top:t.clientY});if(!a?.dom||!(a.dom instanceof HTMLElement))return void o();n=a;let l=a.dom.getBoundingClientRect();r.style.display="flex",r.style.top=`${window.scrollY+l.top+4}px`,r.style.left=`${window.scrollX+l.left-22}px`,i&&(i.style.display="flex",i.style.top=`${window.scrollY+l.top+4}px`,i.style.left=`${window.scrollX+l.left-44}px`)},s=()=>o(),a=()=>{if(!n)return;let t=n.pos+n.node.nodeSize,r=t<=e.state.doc.content.size,i=e.state.tr;if(r){let n=og.create(e.state.doc,Math.min(t-1,e.state.doc.content.size));e.dispatch(i.setSelection(n))}e.focus();let o=e.state.tr.split(e.state.selection.from);e.dispatch(o),e.dom.dispatchEvent(new KeyboardEvent("keydown",{key:"/",bubbles:!0,cancelable:!0}))},l=t=>{if(!n||!t.dataTransfer)return;let{pos:r,dom:i}=n,o=e.state.tr.setSelection(oy.create(e.state.doc,r));e.dispatch(o);let s=e.state.selection.content(),a=document.createElement("div");a.appendChild(e.someProp("clipboardSerializer")?.serializeFragment(s.content)??document.createElement("div")),t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",a.innerHTML),t.dataTransfer.setData("text/plain",i.textContent??""),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage(i,0,0),e.dragging={slice:s,move:!0}};return window.addEventListener("mousemove",t),e.dom.addEventListener("mouseleave",s),r.addEventListener("dragstart",l),i&&i.addEventListener("click",a),{destroy(){window.removeEventListener("mousemove",t),e.dom.removeEventListener("mouseleave",s),r.removeEventListener("dragstart",l),i&&i.removeEventListener("click",a),o()}}}})]}}),SI=new oD("headingAnchors");function SD(e){let t=[],n=new Map;return e.descendants((e,r)=>{if("heading"!==e.type.name)return;let i=e.textContent.toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-");if(!i)return;let o=n.get(i)??0;n.set(i,o+1);let s=0===o?i:`${i}-${o}`;t.push(aR.node(r,r+e.nodeSize,{id:s}))}),aj.create(e,t)}let SR=uz.create({name:"headingAnchors",addProseMirrorPlugins:()=>[new oM({key:SI,state:{init:(e,{doc:t})=>SD(t),apply:(e,t)=>e.docChanged?SD(e.doc):t},props:{decorations:e=>SI.getState(e)}})]}),SL=uB.create({name:"proofSpan",priority:900,inclusive:!1,keepOnSplit:!1,addAttributes:()=>({spanId:{default:null,parseHTML:e=>e.getAttribute("id"),renderHTML:e=>({id:e.spanId})},origin:{default:"ai",parseHTML:e=>e.getAttribute("origin"),renderHTML:e=>({origin:e.origin})},basis:{default:null,parseHTML:e=>e.getAttribute("basis"),renderHTML:e=>({basis:e.basis})},basisDetail:{default:null,parseHTML:e=>e.getAttribute("basis-detail"),renderHTML:e=>({"basis-detail":e.basisDetail})},by:{default:null,parseHTML:e=>e.getAttribute("by"),renderHTML:e=>({by:e.by})},at:{default:null,parseHTML:e=>e.getAttribute("at"),renderHTML:e=>({at:e.at})},inResponseTo:{default:null,parseHTML:e=>e.getAttribute("in-response-to"),renderHTML:e=>({"in-response-to":e.inResponseTo})}}),parseHTML:()=>[{tag:"proof-span"}],renderHTML:({HTMLAttributes:e})=>["proof-span",dX(e,{class:"proof-span"}),0]});var SP=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;function Sj(e){let{node:t,updateAttributes:n,selected:r,editor:i}=e,o=t.attrs,s=(0,Q.useRef)(null),a=(0,Q.useRef)(null),[l,c]=(0,Q.useState)(null),d=o.align??"center",u=(0,Q.useCallback)((e,t)=>{if(!i.isEditable)return;e.preventDefault(),e.stopPropagation();let r=s.current,o=a.current;if(!r||!o)return;let l=e.clientX,d=r.getBoundingClientRect().width,u=o.parentElement?.getBoundingClientRect().width??800,p=e=>{c(Math.max(80,Math.min(u,d+("right"===t?e.clientX-l:l-e.clientX))))},h=()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",h),c(e=>(null!=e&&n({width:Math.round(e)}),null))};window.addEventListener("pointermove",p),window.addEventListener("pointerup",h)},[i.isEditable,n]),p=null!=l?`${Math.round(l)}px`:"number"==typeof o.width?`${o.width}px`:"string"==typeof o.width&&o.width?o.width:void 0,h="left"===d?"mr-auto":"right"===d?"ml-auto":"mx-auto";return(0,X.jsx)(pJ,{as:"div",className:`resizable-image my-3 ${h}`,"data-align":d,style:{width:p??"fit-content",maxWidth:"100%"},children:(0,X.jsxs)("div",{ref:a,className:`relative group inline-block max-w-full ${r?"ring-2 ring-primary rounded-md":""}`,contentEditable:!1,children:[(0,X.jsx)("img",{ref:s,src:o.src,alt:o.alt??"",title:o.title??void 0,className:"block rounded-md max-w-full h-auto",style:{width:p},draggable:!1}),i.isEditable&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{"aria-label":"Resize from left",onPointerDown:e=>u(e,"left"),className:"absolute left-0 top-0 bottom-0 w-2 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:(0,X.jsx)("div",{className:"w-1 h-8 bg-card border border-border rounded-full shadow"})}),(0,X.jsx)("div",{"aria-label":"Resize from right",onPointerDown:e=>u(e,"right"),className:"absolute right-0 top-0 bottom-0 w-2 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:(0,X.jsx)("div",{className:"w-1 h-8 bg-card border border-border rounded-full shadow"})}),null!=l&&(0,X.jsxs)("div",{className:"absolute top-1 right-1 text-[10px] px-1.5 py-0.5 rounded bg-primary/80 text-primary-foreground font-mono",children:[Math.round(l),"px"]})]})]})})}let SB=pa.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",dX(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,i,o,s;let a=null!=(n=null==(t=e.attrs)?void 0:t.src)?n:"",l=null!=(i=null==(r=e.attrs)?void 0:r.alt)?i:"",c=null!=(s=null==(o=e.attrs)?void 0:o.title)?s:"";return c?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:o,HTMLAttributes:s,editor:a})=>{let l=document.createElement("img");Object.entries(s).forEach(([e,t])=>{if(null!=t)switch(e){case"width":case"height":break;default:l.setAttribute(e,t)}}),l.src=s.src;let c=new u9({element:l,editor:a,node:i,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();void 0!==n&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:!0===r}}),d=c.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",l.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},c}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[u5({find:SP,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}).extend({name:"image",draggable:!0,addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute("width")??e.style.width;if(!t)return null;let n=/^(\d+)(px)?$/.exec(t);return n?Number(n[1]):t},renderHTML:e=>{if(!e.width)return{};let t="number"==typeof e.width?`${e.width}px`:e.width;return{style:`width: ${t}`}}},align:{default:null,parseHTML:e=>e.getAttribute("data-align"),renderHTML:e=>e.align?{"data-align":e.align}:{}}}},addNodeView:()=>e=>e.editor.contentComponent?new p2(Sj,e,void 0):{}}),SF=new oD("wikiLinkDecorator"),SH="wikiLinkDecorator:refresh";function SU(e){let{has:t}=ET.getState(),n=e.schema.marks.wikiLink;if(!n)return aj.empty;let r=[];return e.doc.descendants((e,i)=>{if(!e.isText)return;let o=e.marks.find(e=>e.type===n);if(!o)return;let s=o.attrs.slug;!s||t(s)||r.push(aR.inline(i,i+e.nodeSize,{"data-broken":"true"}))}),aj.create(e.doc,r)}let Sz=/\[\[([a-z0-9-]+)(?:\|([^\]#|]+)|#([a-z0-9-]+))?\]\]$/,S$=uB.create({name:"wikiLink",priority:1e3,keepOnSplit:!1,inclusive:!1,addAttributes:()=>({slug:{default:null,parseHTML:e=>e.getAttribute("data-slug"),renderHTML:e=>({"data-slug":e.slug})},alias:{default:null,parseHTML:e=>e.getAttribute("data-alias"),renderHTML:e=>null!=e.alias?{"data-alias":e.alias}:{}},anchor:{default:null,parseHTML:e=>e.getAttribute("data-anchor"),renderHTML:e=>null!=e.anchor?{"data-anchor":e.anchor}:{}}}),parseHTML:()=>[{tag:'a[data-wiki-link="true"]'}],renderHTML({HTMLAttributes:e}){let t=String(e["data-slug"]??""),n=null!=e["data-anchor"]?String(e["data-anchor"]):null;return["a",dX(e,{"data-wiki-link":"true",href:n?`#wiki:${t}#${n}`:`#wiki:${t}`,class:"wiki-link"}),0]},addInputRules(){return[new uR({find:Sz,handler:({state:e,range:t,match:n})=>{let r=n[1]??"",i=n[2]??null,o=n[3]??null,s=i??(o?`${r}#${o}`:r),{tr:a}=e;a.replaceWith(t.from,t.to,e.schema.text(s,[this.type.create({slug:r,alias:i,anchor:o})]))}})]},addProseMirrorPlugins:()=>[new oM({key:SF,state:{init:(e,t)=>SU(t),apply:(e,t,n,r)=>e.getMeta(SH)||e.docChanged?SU(r):t.map(e.mapping,e.doc)},props:{decorations:e=>SF.getState(e)??aj.empty},view(e){let t=ET.subscribe(()=>{let t=e.state.tr.setMeta(SH,!0);e.dispatch(t)});return{destroy(){t()}}}})],addCommands(){return{setWikiLink:e=>({commands:t})=>t.setMark(this.name,{slug:e.slug,alias:e.alias??null,anchor:e.anchor??null}),unsetWikiLink:()=>({commands:e})=>e.unsetMark(this.name)}}}),SG=SN({bash:A0,css:A6,go:A9,javascript:Ss,json:Sa,markdown:Sl,python:Sc,rust:Sd,shell:Su,sql:Sp,typescript:SE,xml:Sw,yaml:Sk}),Sq=[AZ.configure({heading:{levels:[1,2,3,4]},codeBlock:!1,link:!1,underline:!1}),k$.configure({lowlight:SG,HTMLAttributes:{class:"rounded-md bg-muted p-4 font-mono text-sm"}}),NG.configure({placeholder:"Start writing, or press '/' for commands..."}),SB.configure({HTMLAttributes:{class:"rounded-lg max-w-full"},allowBase64:!1}),N9.configure({resizable:!0,lastColumnResizable:!1,HTMLAttributes:{class:"border-collapse w-full"}}),N0,NJ,NZ,AT.configure({HTMLAttributes:{class:"task-list"}}),Ak.configure({nested:!0}),Nd.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}}).extend({parseHTML:()=>[{tag:'a[href]:not([data-wiki-link="true"])'}],addKeyboardShortcuts(){return{"Mod-e":()=>{let{state:e}=this.editor,{from:t,to:n}=e.selection;if(t===n)return!1;let r=this.editor.getAttributes("link").href??"",i=window.prompt("Link URL",r);return null!==i&&(""===i?this.editor.chain().focus().extendMarkRange("link").unsetLink().run():this.editor.chain().focus().extendMarkRange("link").setLink({href:i}).run())}}}}),SS,SL,AN.configure({types:["heading","paragraph"]}),NK,NY,SO,SR,S$],SV=en("app-window",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]),SW=en("file-audio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]),SK=en("file-code-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]),SY=en("file-image",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]),SX=en("file-spreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),SQ=en("file-video",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]),SJ=en("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),SZ="kb-folder-view-mode";function S0(e){return"image"===e.type}function S1(e){switch(e.type){case"directory":case"cabinet":return ep;case"image":return SY;case"video":return SQ;case"audio":return SW;case"code":return SK;case"csv":case"xlsx":return SX;case"website":return em;case"app":return SV;default:return eu}}function S2(e){let{selectPage:t,expandPath:n}=Eb.getState(),r=e.split("/");for(let e=1;e<r.length;e++)n(r.slice(0,e).join("/"));t(e),Eg.getState().loadPage(e)}function S3({folderPath:e,entries:t}){let n=(0,Q.useMemo)(()=>(function(e){if(0===e.length)return!1;let t=e.filter(S0).length;return t>=4&&t/e.length>=.6})(t),[t]),[r,i]=(0,Q.useState)(()=>{let t=function(e){try{let t=localStorage.getItem(SZ);if(!t)return null;return JSON.parse(t)[e]??null}catch{return null}}(e);return t||(n?"gallery":"list")}),o=t=>{i(t);try{let n=localStorage.getItem(SZ),r=n?JSON.parse(n):{};r[e]=t,localStorage.setItem(SZ,JSON.stringify(r))}catch{}},s=(0,Q.useMemo)(()=>{let e=[...t];return e.sort((e,t)=>{let n="directory"===e.type||"cabinet"===e.type;return n!==("directory"===t.type||"cabinet"===t.type)?n?-1:1:e.name.localeCompare(t.name)}),e},[t]);return(0,X.jsxs)("div",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsxs)("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground/70",children:[s.length," ",1===s.length?"item":"items"]}),(0,X.jsxs)("div",{className:"inline-flex items-center rounded-md border border-border p-0.5 text-[11px]",children:[(0,X.jsxs)("button",{onClick:()=>o("list"),className:`flex items-center gap-1 px-2 py-1 rounded transition-colors ${"list"===r?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,"aria-pressed":"list"===r,title:"List view",children:[(0,X.jsx)(kb,{className:"h-3 w-3"}),"List"]}),(0,X.jsxs)("button",{onClick:()=>o("gallery"),className:`flex items-center gap-1 px-2 py-1 rounded transition-colors ${"gallery"===r?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,"aria-pressed":"gallery"===r,title:"Gallery view",children:[(0,X.jsx)(SJ,{className:"h-3 w-3"}),"Gallery"]})]})]}),"list"===r?(0,X.jsx)("ul",{className:"divide-y divide-border rounded-md border border-border overflow-hidden",children:s.map(e=>{let t=S1(e),n=e.frontmatter?.title||e.name;return(0,X.jsx)("li",{children:(0,X.jsxs)("button",{onClick:()=>S2(e.path),className:"w-full flex items-center gap-3 px-3 py-2 text-left text-sm hover:bg-accent/50 transition-colors",children:[(0,X.jsx)(t,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"flex-1 truncate",children:n}),(0,X.jsx)("span",{className:"text-[11px] text-muted-foreground/60 capitalize",children:e.type})]})},e.path)})}):(0,X.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:s.map(e=>{let t=e.frontmatter?.title||e.name;if(S0(e))return(0,X.jsxs)("button",{onClick:()=>S2(e.path),className:"group flex flex-col gap-1.5 text-left",title:t,children:[(0,X.jsx)("div",{className:"aspect-square w-full overflow-hidden rounded-md border border-border bg-muted",children:(0,X.jsx)("img",{src:rz(`/api/assets/${e.path}`),alt:t,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-[1.02]"})}),(0,X.jsx)("span",{className:"truncate text-[12px] text-muted-foreground group-hover:text-foreground",children:t})]},e.path);let n=S1(e);return(0,X.jsxs)("button",{onClick:()=>S2(e.path),className:"group flex flex-col gap-1.5 text-left",title:t,children:[(0,X.jsx)("div",{className:"aspect-square w-full flex items-center justify-center rounded-md border border-border bg-muted/40 group-hover:bg-muted transition-colors",children:(0,X.jsx)(n,{className:"h-8 w-8 text-muted-foreground/60"})}),(0,X.jsx)("span",{className:"truncate text-[12px] text-muted-foreground group-hover:text-foreground",children:t})]},e.path)})})]})}let S5=en("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);function S4({blockRef:e,comments:t,top:n,left:r,onClick:i}){let o;if(0===t.length)return null;let s=t.filter(e=>!e.resolved);if(0===s.length)o="check";else{let e=s[0].turns.at(-1);o=e?.by.startsWith("ai:")?"dot-ai":"ring-human"}return(0,X.jsxs)("button",{type:"button",onClick:i,style:{position:"absolute",top:n,left:r,transform:"translateY(2px)"},className:"z-10 p-2 sm:p-0.5 -m-1.5 sm:m-0 rounded transition-colors hover:bg-accent focus:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":`Comment thread for block ${e}`,children:["check"===o&&(0,X.jsx)(S5,{className:"h-3.5 w-3.5 text-muted-foreground/30"}),"dot-ai"===o&&(0,X.jsx)(kn,{className:"h-3.5 w-3.5 fill-primary text-primary"}),"ring-human"===o&&(0,X.jsx)(kn,{className:"h-3.5 w-3.5 text-muted-foreground/70"})]})}var S6="u">typeof document?Q.useLayoutEffect:function(){};function S9(e,t){let n,r,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!S9(e[r],t[r]))return!1;return!0}if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!=r--;){let n=i[r];if(("_owner"!==n||!e.$$typeof)&&!S9(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function S7(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function S8(e,t){let n=S7(e);return Math.round(t*n)/n}function Ce(e){let t=Q.useRef(e);return S6(()=>{t.current=e}),t}var Ct=Q.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,X.jsx)(t5.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,X.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Ct.displayName="Arrow";var Cn="Popper",[Cr,Ci]=tW(Cn),[Co,Cs]=Cr(Cn),Ca=e=>{let{__scopePopper:t,children:n}=e,[r,i]=Q.useState(null);return(0,X.jsx)(Co,{scope:t,anchor:r,onAnchorChange:i,children:n})};Ca.displayName=Cn;var Cl="PopperAnchor",Cc=Q.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,o=Cs(Cl,n),s=Q.useRef(null),a=eO(t,s),l=Q.useRef(null);return Q.useEffect(()=>{let e=l.current;l.current=r?.current||s.current,e!==l.current&&o.onAnchorChange(l.current)}),r?null:(0,X.jsx)(t5.div,{...i,ref:a})});Cc.displayName=Cl;var Cd="PopperContent",[Cu,Cp]=Cr(Cd),Ch=Q.forwardRef((e,t)=>{var n,r,i,o,s,a,l,c,d,u,p,h,f,m,g,b;let y,x,v,E,w,k,{__scopePopper:T,side:N="bottom",sideOffset:A=0,align:S="center",alignOffset:C=0,arrowPadding:_=0,avoidCollisions:M=!0,collisionBoundary:O=[],collisionPadding:I=0,sticky:D="partial",hideWhenDetached:R=!1,updatePositionStrategy:L="optimized",onPlaced:P,...j}=e,B=Cs(Cd,T),[F,H]=Q.useState(null),U=eO(t,e=>H(e)),[z,$]=Q.useState(null),G=function(e){let[t,n]=Q.useState(void 0);return tK(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,i;if(!Array.isArray(t)||!t.length)return;let o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,i=t.blockSize}else r=e.offsetWidth,i=e.offsetHeight;n({width:r,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(z),q=G?.width??0,V=G?.height??0,W="number"==typeof I?I:{top:0,right:0,bottom:0,left:0,...I},K=Array.isArray(O)?O:[O],Y=K.length>0,J={padding:W,boundary:K.filter(Cb),altBoundary:Y},{refs:Z,floatingStyles:ee,placement:et,isPositioned:en,middlewareData:er}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,u]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=Q.useState(r);S9(p,r)||h(r);let[f,m]=Q.useState(null),[g,b]=Q.useState(null),y=Q.useCallback(e=>{e!==w.current&&(w.current=e,m(e))},[]),x=Q.useCallback(e=>{e!==k.current&&(k.current=e,b(e))},[]),v=o||f,E=s||g,w=Q.useRef(null),k=Q.useRef(null),T=Q.useRef(d),N=null!=l,A=Ce(l),S=Ce(i),C=Ce(c),_=Q.useCallback(()=>{if(!w.current||!k.current)return;let e={placement:t,strategy:n,middleware:p};S.current&&(e.platform=S.current),wH(w.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==C.current};M.current&&!S9(T.current,t)&&(T.current=t,t0.flushSync(()=>{u(t)}))})},[p,t,n,S,C]);S6(()=>{!1===c&&T.current.isPositioned&&(T.current.isPositioned=!1,u(e=>({...e,isPositioned:!1})))},[c]);let M=Q.useRef(!1);S6(()=>(M.current=!0,()=>{M.current=!1}),[]),S6(()=>{if(v&&(w.current=v),E&&(k.current=E),v&&E){if(A.current)return A.current(v,E,_);_()}},[v,E,_,A,N]);let O=Q.useMemo(()=>({reference:w,floating:k,setReference:y,setFloating:x}),[y,x]),I=Q.useMemo(()=>({reference:v,floating:E}),[v,E]),D=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!I.floating)return e;let t=S8(I.floating,d.x),r=S8(I.floating,d.y);return a?{...e,transform:"translate("+t+"px, "+r+"px)",...S7(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,a,I.floating,d.x,d.y]);return Q.useMemo(()=>({...d,update:_,refs:O,elements:I,floatingStyles:D}),[d,_,O,I,D])}({strategy:"fixed",placement:N+("center"!==S?"-"+S:""),whileElementsMounted:(...e)=>(function(e,t,n,r){let i;void 0===r&&(r={});let{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,d=wy(e),u=o||s?[...d?wm(d):[],...t?wm(t):[]]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)});let p=d&&l?function(e,t){let n,r=null,i=E8(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),o();let c=e.getBoundingClientRect(),{left:d,top:u,width:p,height:h}=c;if(a||t(),!p||!h)return;let f={rootMargin:-ER(u)+"px "+-ER(i.clientWidth-(d+p))+"px "+-ER(i.clientHeight-(u+h))+"px "+-ER(d)+"px",threshold:EI(0,EO(1,l))||1},m=!0;function g(t){let r=t[0].intersectionRatio;if(r!==l){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||wO(c,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(g,f)}r.observe(e)}(!0),o}(d,n):null,h=-1,f=null;a&&(f=new ResizeObserver(e=>{let[r]=e;r&&r.target===d&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),n()}),d&&!c&&f.observe(d),t&&f.observe(t));let m=c?ww(e):null;return c&&function t(){let r=ww(e);m&&!wO(m,r)&&n(),m=r,i=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)}),null==p||p(),null==(e=f)||e.disconnect(),f=null,c&&cancelAnimationFrame(i)}})(...e,{animationFrame:"always"===L}),elements:{reference:B.anchor},middleware:[{name:(y=wI(n={mainAxis:A+V,alignmentAxis:C})).name,fn:y.fn,options:[n,r]},M&&{name:(x=wR(a={mainAxis:!0,crossAxis:!1,limiter:"partial"===D?{fn:(void 0===(s=i)&&(s={}),{options:s,fn(e){let{x:t,y:n,placement:r,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ej(s,e),d={x:t,y:n},u=Ez(r),p=EH(u),h=d[p],f=d[u],m=Ej(a,e),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){let e="y"===p?"height":"width",t=i.reference[p]-i.floating[e]+g.mainAxis,n=i.reference[p]+i.reference[e]-g.mainAxis;h<t?h=t:h>n&&(h=n)}if(c){var b,y;let e="y"===p?"width":"height",t=E5.has(EB(r)),n=i.reference[u]-i.floating[e]+(t&&(null==(b=o.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),s=i.reference[u]+i.reference[e]+(t?0:(null==(y=o.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);f<n?f=n:f>s&&(f=s)}return{[p]:h,[u]:f}}}).fn,options:[i,o]}:void 0,...J})).name,fn:x.fn,options:[a,l]},M&&{name:(v=wL(c={...J})).name,fn:v.fn,options:[c,d]},{name:(E=wP(u={...J,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}})).name,fn:E.fn,options:[u,p]},z&&{name:(w={name:"arrow",options:m=h={element:z,padding:_},fn(e){let{element:t,padding:n}="function"==typeof m?m(e):m;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?wB({element:t.current,padding:n}).fn(e):{}:t?wB({element:t,padding:n}).fn(e):{}}}).name,fn:w.fn,options:[h,f]},Cy({arrowWidth:q,arrowHeight:V}),R&&{name:(k=wj(g={strategy:"referenceHidden",...J})).name,fn:k.fn,options:[g,b]}]}),[ei,eo]=Cx(et),es=t6(P);tK(()=>{en&&es?.()},[en,es]);let ea=er.arrow?.x,el=er.arrow?.y,ec=er.arrow?.centerOffset!==0,[ed,eu]=Q.useState();return tK(()=>{F&&eu(window.getComputedStyle(F).zIndex)},[F]),(0,X.jsx)("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:en?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ed,"--radix-popper-transform-origin":[er.transformOrigin?.x,er.transformOrigin?.y].join(" "),...er.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,X.jsx)(Cu,{scope:T,placedSide:ei,onArrowChange:$,arrowX:ea,arrowY:el,shouldHideArrow:ec,children:(0,X.jsx)(t5.div,{"data-side":ei,"data-align":eo,...j,ref:U,style:{...j.style,animation:en?void 0:"none"}})})})});Ch.displayName=Cd;var Cf="PopperArrow",Cm={top:"bottom",right:"left",bottom:"top",left:"right"},Cg=Q.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Cp(Cf,n),o=Cm[i.placedSide];return(0,X.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,X.jsx)(Ct,{...r,ref:t,style:{...r.style,display:"block"}})})});function Cb(e){return null!==e}Cg.displayName=Cf;var Cy=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,o=i.arrow?.centerOffset!==0,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=Cx(n),d={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,p=(i.arrow?.y??0)+a/2,h="",f="";return"bottom"===l?(h=o?d:`${u}px`,f=`${-a}px`):"top"===l?(h=o?d:`${u}px`,f=`${r.floating.height+a}px`):"right"===l?(h=`${-a}px`,f=o?d:`${p}px`):"left"===l&&(h=`${r.floating.width+a}px`,f=o?d:`${p}px`),{data:{x:h,y:f}}}});function Cx(e){let[t,n="center"]=e.split("-");return[t,n]}var Cv="Popover",[CE,Cw]=tW(Cv,[Ci]),Ck=Ci(),[CT,CN]=CE(Cv),CA=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=e,a=Ck(t),l=Q.useRef(null),[c,d]=Q.useState(!1),[u,p]=tZ({prop:r,defaultProp:i??!1,onChange:o,caller:Cv});return(0,X.jsx)(Ca,{...a,children:(0,X.jsx)(CT,{scope:t,contentId:tQ(),triggerRef:l,open:u,onOpenChange:p,onOpenToggle:Q.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:c,onCustomAnchorAdd:Q.useCallback(()=>d(!0),[]),onCustomAnchorRemove:Q.useCallback(()=>d(!1),[]),modal:s,children:n})})};CA.displayName=Cv;var CS="PopoverAnchor",CC=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=CN(CS,n),o=Ck(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=i;return Q.useEffect(()=>(s(),()=>a()),[s,a]),(0,X.jsx)(Cc,{...o,...r,ref:t})});CC.displayName=CS;var C_="PopoverTrigger";Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=CN(C_,n),o=Ck(n),s=eO(t,i.triggerRef),a=(0,X.jsx)(t5.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Cz(i.open),...r,ref:s,onClick:tV(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:(0,X.jsx)(Cc,{asChild:!0,...o,children:a})}).displayName=C_;var CM="PopoverPortal",[CO,CI]=CE(CM,{forceMount:void 0}),CD=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=CN(CM,t);return(0,X.jsx)(CO,{scope:t,forceMount:n,children:(0,X.jsx)(np,{present:n||o.open,children:(0,X.jsx)(nu,{asChild:!0,container:i,children:r})})})};CD.displayName=CM;var CR="PopoverContent",CL=Q.forwardRef((e,t)=>{let n=CI(CR,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=CN(CR,e.__scopePopover);return(0,X.jsx)(np,{present:r||o.open,children:o.modal?(0,X.jsx)(Cj,{...i,ref:t}):(0,X.jsx)(CB,{...i,ref:t})})});CL.displayName=CR;var CP=t1("PopoverContent.RemoveScroll"),Cj=Q.forwardRef((e,t)=>{let n=CN(CR,e.__scopePopover),r=Q.useRef(null),i=eO(t,r),o=Q.useRef(!1);return Q.useEffect(()=>{let e=r.current;if(e)return n9(e)},[]),(0,X.jsx)(n0,{as:CP,allowPinchZoom:!0,children:(0,X.jsx)(CF,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tV(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:tV(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;o.current=2===t.button||n},{checkForDefaultPrevented:!1}),onFocusOutside:tV(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),CB=Q.forwardRef((e,t)=>{let n=CN(CR,e.__scopePopover),r=Q.useRef(!1),i=Q.useRef(!1);return(0,X.jsx)(CF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let o=t.target;n.triggerRef.current?.contains(o)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),CF=Q.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=e,p=CN(CR,n),h=Ck(n);return nm(),(0,X.jsx)(no,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:(0,X.jsx)(t8,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:(0,X.jsx)(Ch,{"data-state":Cz(p.open),role:"dialog",id:p.contentId,...h,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),CH="PopoverClose";Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=CN(CH,n);return(0,X.jsx)(t5.button,{type:"button",...r,ref:t,onClick:tV(e.onClick,()=>i.onOpenChange(!1))})}).displayName=CH;var CU=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ck(n);return(0,X.jsx)(Cg,{...i,...r,ref:t})});function Cz(e){return e?"open":"closed"}CU.displayName="PopoverArrow";let C$=new Intl.RelativeTimeFormat("en",{numeric:"auto"});async function CG(e,t,n,r){let i=encodeURIComponent(e).replace(/%2F/g,"/"),o=await r$(`/api/agent/files/${i}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:n,ops:r})});if(409===o.status){let e=await o.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return o.ok?{ok:!0,stale:!1}:{ok:!1,stale:!1}}function Cq({path:e,blockRef:t,comments:n,anchorEl:r,onClose:i}){let[o,s]=(0,Q.useState)(null),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!1),u=(0,Q.useRef)(null),p=n.filter(e=>!e.resolved),h=p.length>0,f=p[0]??n[0]??null;if((0,Q.useEffect)(()=>{if(!r)return void s(null);let e=r.getBoundingClientRect();s({top:e.bottom+4,left:e.left})},[r]),(0,Q.useEffect)(()=>{if(!r)return;let e=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,i]),(0,Q.useEffect)(()=>{o&&setTimeout(()=>u.current?.focus(),50)},[o]),!r||!o)return null;function m(){let t=EA.getState().byPath[e];return t?.snapshotRevision??0}async function g(){if(a.trim()&&!c){d(!0);try{let n=f?{type:"comment.reply",commentId:f.id,text:a.trim()}:{type:"comment.add",ref:t,text:a.trim()},r=m(),o=await CG(e,r,"human",[n]);!o.ok&&o.stale&&void 0!==o.newRevision&&(await EA.getState().loadSidecar(e),r=o.newRevision,o=await CG(e,r,"human",[n])),o.ok&&(await EA.getState().loadSidecar(e),l(""),i())}finally{d(!1)}}}async function b(){if(f&&!c){d(!0);try{let t=f.resolved?"comment.reopen":"comment.resolve",n=m(),r=await CG(e,n,"human",[{type:t,commentId:f.id}]);!r.ok&&r.stale&&void 0!==r.newRevision&&(await EA.getState().loadSidecar(e),n=r.newRevision,r=await CG(e,n,"human",[{type:t,commentId:f.id}])),r.ok&&(await EA.getState().loadSidecar(e),i())}finally{d(!1)}}}let y=n.flatMap(e=>e.turns.map(t=>({...t,resolved:e.resolved,commentId:e.id})));return(0,X.jsxs)(CA,{open:!0,children:[(0,X.jsx)(CC,{asChild:!0,children:(0,X.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:o.top,left:o.left,width:0,height:0,pointerEvents:"none"}})}),(0,X.jsx)(CD,{children:(0,X.jsxs)(CL,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:i,className:"z-50 w-[min(18rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2 text-[12px] focus:outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("span",{className:"text-[11px] font-mono text-muted-foreground/60 truncate",children:t}),f&&(0,X.jsx)("button",{type:"button",disabled:c,onClick:()=>void b(),className:"ml-2 shrink-0 text-[10px] px-1.5 py-0.5 rounded border border-border hover:bg-accent disabled:opacity-50 transition-colors",children:f.resolved?"Reopen":"Resolve"})]}),y.length>0&&(0,X.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1",children:y.map((e,t)=>(0,X.jsxs)("div",{className:"space-y-0.5",children:[(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/60",children:[e.by," · ",function(e){let t=Math.round((Date.now()-new Date(e).getTime())/1e3);if(60>Math.abs(t))return C$.format(-t,"second");let n=Math.round(t/60);if(60>Math.abs(n))return C$.format(-n,"minute");let r=Math.round(n/60);return 24>Math.abs(r)?C$.format(-r,"hour"):C$.format(-Math.round(r/24),"day")}(e.at)]}),(0,X.jsx)("p",{className:"text-foreground leading-snug whitespace-pre-wrap",children:e.text})]},t))}),(!f?.resolved||0===n.length)&&(0,X.jsxs)("div",{className:"space-y-1.5 pt-1",children:[(0,X.jsx)("textarea",{ref:u,value:a,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&g()},placeholder:h?"Reply…":"Add a comment…",rows:2,className:"w-full resize-none rounded-md border border-border bg-background px-2 py-1.5 text-[12px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"}),(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/40",children:"⌘↵ send"}),(0,X.jsx)("button",{type:"button",disabled:c||!a.trim(),onClick:()=>void g(),className:"px-2.5 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Send"})]})]}),(0,X.jsx)(CU,{className:"fill-border"})]})})]})}function CV({targetEl:e,path:t,onClose:n,onComment:r}){let[i,o]=(0,Q.useState)(null),[s,a]=(0,Q.useState)(null),[l,c]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{if(!e){o(null),a(null);return}let t=e.getBoundingClientRect();o({top:t.bottom+window.scrollY+4,left:t.left+window.scrollX}),a({spanId:e.getAttribute("id")??"",origin:e.getAttribute("origin"),basis:e.getAttribute("basis"),basisDetail:e.getAttribute("basis-detail"),by:e.getAttribute("by"),at:e.getAttribute("at")})},[e]),(0,Q.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&n()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,n]),!e||!i||!s)return null;async function d(e){if(!l&&s){c(!0);try{await r$("/api/agent/internal/span",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,spanId:s.spanId,action:e,idempotencyKey:crypto.randomUUID()})})}finally{c(!1),n()}}}return(0,X.jsxs)(CA,{open:!0,children:[(0,X.jsx)(CC,{asChild:!0,children:(0,X.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:i.top,left:i.left,width:0,height:0,pointerEvents:"none"}})}),(0,X.jsx)(CD,{children:(0,X.jsxs)(CL,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:n,className:"z-50 w-[min(16rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2 text-[12px] focus:outline-none",children:[(0,X.jsxs)("div",{className:"space-y-0.5",children:[(0,X.jsxs)("p",{className:"font-medium text-foreground truncate",children:[s.by??"unknown"," · ",s.basis??"—"," · ",function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}(s.at)]}),s.basisDetail&&(0,X.jsxs)("p",{className:"text-muted-foreground italic truncate",children:["“",s.basisDetail,"”"]}),s.origin&&(0,X.jsxs)("p",{className:"text-muted-foreground/60",children:["origin: ",s.origin]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1.5 pt-1",children:[(0,X.jsx)("button",{type:"button",disabled:l,onClick:()=>void d("accept"),className:"flex-1 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Accept"}),(0,X.jsx)("button",{type:"button",disabled:l,onClick:()=>void d("revert"),className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Revert"}),(0,X.jsx)("button",{type:"button",disabled:l,onClick:()=>{r?.(),n()},className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Comment"})]}),(0,X.jsx)(CU,{className:"fill-border"})]})})]})}async function CW(e,t,n,r){let i=encodeURIComponent(e).replace(/%2F/g,"/"),o=await r$(`/api/agent/files/${i}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:"human",ops:[{type:n,suggestionId:r}]})});return{ok:o.ok,status:o.status}}function CK({suggestion:e,currentMarkdown:t,path:n,baseRevision:r,getLatestRevision:i,top:o,left:s,width:a,onSettled:l}){let[c,d]=(0,Q.useState)(!1);async function u(){if(!c){d(!0);try{let t=await CW(n,r,"suggestion.accept",e.id);t.ok||409!==t.status||(t=await CW(n,i(),"suggestion.accept",e.id))}finally{d(!1),l()}}}async function p(){if(!c){d(!0);try{await CW(n,r,"suggestion.reject",e.id)}finally{d(!1),l()}}}let h="delete"===e.kind,f="insertAfter"===e.kind||"insertBefore"===e.kind;return(0,X.jsxs)("div",{style:{position:"absolute",top:o,left:s,width:a>0?a:void 0,zIndex:30},className:"my-1 rounded-lg border border-border bg-card shadow-md text-[12px] overflow-hidden",role:"region","aria-label":`Suggestion by ${e.by}`,children:[(0,X.jsx)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/50 border-b border-border",children:(0,X.jsxs)("span",{className:"font-medium text-foreground",children:[(0,X.jsx)("span",{className:"text-primary",children:e.by})," suggests ",(0,X.jsx)("span",{className:"text-muted-foreground",children:function(e){switch(e){case"replace":return"replacing this block";case"insertAfter":return"inserting content after this block";case"insertBefore":return"inserting content before this block";case"delete":return"deleting this block"}}(e.kind)})]})}),(0,X.jsxs)("div",{className:"p-3 space-y-2",children:["replace"===e.kind&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ current ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground bg-destructive/5 rounded px-2 py-1",children:t||"(empty)"})]}),(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ proposed ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground bg-primary/5 rounded px-2 py-1",children:e.markdown??"(empty)"})]})]}),f&&(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ will be inserted ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground bg-primary/5 rounded px-2 py-1",children:e.markdown??"(empty)"})]}),h&&(0,X.jsxs)("div",{children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ will be deleted ─"}),(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground line-through bg-destructive/5 rounded px-2 py-1",children:t||"(empty)"})]}),e.basisDetail&&(0,X.jsxs)("p",{className:"italic text-muted-foreground/70 text-[11px]",children:["Reason: ",e.basisDetail]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border-t border-border bg-muted/30",children:[(0,X.jsx)("button",{type:"button",disabled:c,onClick:()=>void u(),className:"flex-1 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Accept"}),(0,X.jsx)("button",{type:"button",disabled:c,onClick:()=>void p(),className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Reject"})]})]})}async function CY(e,t,n){let r=encodeURIComponent(e).replace(/%2F/g,"/"),i=await r$(`/api/agent/files/${r}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...{}},body:JSON.stringify({baseRevision:t,by:"human",ops:n})});if(409===i.status){let e=await i.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return i.ok?{ok:!0,stale:!1}:{ok:!1,stale:!1}}let CX={replace:"Replace block",insertAfter:"Insert after",insertBefore:"Insert before",delete:"Delete block"};function CQ({path:e,blockRef:t,currentMarkdown:n,anchor:r,onClose:i}){let[o,s]=(0,Q.useState)("replace"),[a,l]=(0,Q.useState)(n),[c,d]=(0,Q.useState)(""),[u,p]=(0,Q.useState)(!1),h=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{"replace"===o?l(n):l("")},[o,n]),(0,Q.useEffect)(()=>{let e=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i]),(0,Q.useEffect)(()=>{setTimeout(()=>h.current?.focus(),50)},[]);let f="delete"!==o,m=!u&&(!f||a.trim().length>0);async function g(){if(m){p(!0);try{let n={type:"suggestion.add",ref:t,kind:o,basis:"suggested"};f&&(n.markdown=a),c.trim()&&(n.basisDetail=c.trim());let r=EA.getState().byPath[e]?.snapshotRevision??0,s=await CY(e,r,[n]);!s.ok&&s.stale&&void 0!==s.newRevision&&(await EA.getState().loadSidecar(e),r=s.newRevision,s=await CY(e,r,[n])),s.ok&&(await EA.getState().loadSidecar(e),await EA.getState().loadSnapshot(e),i())}finally{p(!1)}}}return(0,X.jsxs)(CA,{open:!0,children:[(0,X.jsx)(CC,{asChild:!0,children:(0,X.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:r.top,left:r.left,width:0,height:0,pointerEvents:"none"}})}),(0,X.jsx)(CD,{children:(0,X.jsxs)(CL,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:i,className:"z-50 w-[min(20rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2.5 text-[12px] focus:outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("span",{className:"font-medium text-foreground",children:"Suggest an edit"}),(0,X.jsx)("span",{className:"text-[11px] font-mono text-muted-foreground/60 truncate ml-2",children:t})]}),(0,X.jsx)("div",{className:"flex flex-wrap gap-1",children:Object.keys(CX).map(e=>(0,X.jsx)("button",{type:"button",onClick:()=>s(e),className:`px-2 py-0.5 rounded-md text-[10.5px] border transition-colors ${o===e?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:bg-accent"}`,children:CX[e]},e))}),"delete"===o&&(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground line-through bg-destructive/5 rounded px-2 py-1 max-h-32 overflow-y-auto",children:n||"(empty)"}),f&&(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60",children:"replace"===o?"proposed content":"content to insert"}),(0,X.jsx)("textarea",{ref:h,value:a,onChange:e=>l(e.target.value),rows:4,placeholder:"Markdown…",className:"w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"})]}),(0,X.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&g()},placeholder:"Reason (optional)",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-[12px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"}),(0,X.jsxs)("div",{className:"flex items-center justify-between pt-0.5",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/40",children:"⌘↵ submit"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("button",{type:"button",disabled:u,onClick:i,className:"px-2.5 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),(0,X.jsx)("button",{type:"button",disabled:!m,onClick:()=>void g(),className:"px-2.5 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Suggest"})]})]}),(0,X.jsx)(CU,{className:"fill-border"})]})})]})}let CJ=en("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),CZ=en("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),C0=en("sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]),C1=en("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),C2=[{label:"Text",icon:en("type",[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]),description:"Start writing plain text",category:"basic",action:{type:"direct",run:e=>e.chain().focus().setParagraph().run()}},{label:"Heading 1",icon:kf,description:"Large section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:1}).run()}},{label:"Heading 2",icon:km,description:"Medium section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:2}).run()}},{label:"Heading 3",icon:kg,description:"Small section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:3}).run()}},{label:"Bullet List",icon:kb,description:"Create a bullet list",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleBulletList().run()}},{label:"Numbered List",icon:ky,description:"Create a numbered list",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleOrderedList().run()}},{label:"Checklist",icon:ku,description:"Create a task checklist",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleTaskList().run()}},{label:"Code Block",icon:w8,description:"Insert a code block",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleCodeBlock().run()}},{label:"Blockquote",icon:kw,description:"Insert a blockquote",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleBlockquote().run()}},{label:"Divider",icon:kx,description:"Insert a horizontal rule",category:"basic",action:{type:"direct",run:e=>e.chain().focus().setHorizontalRule().run()}},{label:"Table",icon:C1,description:"Insert a 3x3 table",category:"basic",action:{type:"direct",run:e=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{label:"Image",icon:eg,description:"Upload, paste URL, or drop an image",category:"media",action:{type:"popover",kind:{type:"media",kind:"image"}}},{label:"Video",icon:kN,description:"Upload or paste a video URL",category:"media",action:{type:"popover",kind:{type:"media",kind:"video"}}},{label:"File",icon:ec,description:"Attach any file to this page",category:"media",action:{type:"popover",kind:{type:"media",kind:"file"}}},{label:"Callout",icon:CZ,description:"Insert an info callout",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().wrapIn("callout",{type:"info"}).run()}},{label:"Warning",icon:CJ,description:"Insert a warning callout",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().wrapIn("callout",{type:"warning"}).run()}},{label:"Math",icon:C0,description:"Insert a LaTeX math expression",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().insertContent("$x=y$").run()}}];function C3({editor:e}){let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(""),[o,s]=(0,Q.useState)(0),[a,l]=(0,Q.useState)({top:0,left:0}),[c,d]=(0,Q.useState)(null),u=(0,Q.useRef)(null),p=Eg(e=>e.currentPath),h=C2.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())||e.description.toLowerCase().includes(r.toLowerCase())),f=(0,Q.useCallback)(()=>{n(!1),i(""),s(0)},[]),m=(0,Q.useCallback)(t=>{if(!e)return;let{from:o}=e.state.selection,s=o-r.length-1;e.chain().focus().deleteRange({from:s,to:o}).run(),"direct"===t.action.type?(t.action.run(e),f()):(d(t.action.kind),n(!1),i(""))},[e,r,f]);if((0,Q.useEffect)(()=>{if(!e)return;let a=a=>{if(!t){if("/"===a.key){let{from:t}=e.state.selection,r=e.state.doc.textBetween(Math.max(0,t-1),t);if(1===t||""===r||"\n"===r||" "===r){let r=e.view.coordsAtPos(t),o=e.view.dom.getBoundingClientRect();l({top:r.bottom-o.top+4,left:r.left-o.left}),n(!0),i(""),s(0)}}return}"Escape"===a.key?(a.preventDefault(),f()):"ArrowDown"===a.key?(a.preventDefault(),s(e=>Math.min(e+1,h.length-1))):"ArrowUp"===a.key?(a.preventDefault(),s(e=>Math.max(e-1,0))):"Enter"===a.key?(a.preventDefault(),h[o]&&m(h[o])):"Backspace"===a.key?0===r.length?f():(i(e=>e.slice(0,-1)),s(0)):" "===a.key?f():1!==a.key.length||a.metaKey||a.ctrlKey||(i(e=>e+a.key),s(0))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[e,t,r,o,h,f,m]),(0,Q.useEffect)(()=>{if(!t)return;let e=e=>{u.current&&!u.current.contains(e.target)&&f()};return window.addEventListener("mousedown",e),()=>window.removeEventListener("mousedown",e)},[t,f]),(!t||0===h.length)&&!c)return null;let g=new Map;for(let e of h){let t=g.get(e.category)??[];t.push(e),g.set(e.category,t)}return(0,X.jsxs)(X.Fragment,{children:[t&&h.length>0&&(0,X.jsx)("div",{ref:u,className:"absolute z-50 w-[280px] bg-popover border border-border rounded-lg shadow-lg py-1 overflow-hidden max-h-[380px] overflow-y-auto",style:{top:a.top,left:a.left},children:[{key:"basic",title:"Basic"},{key:"media",title:"Media"},{key:"advanced",title:"Advanced"}].map(e=>{let t=g.get(e.key);return t&&0!==t.length?(0,X.jsxs)("div",{children:[(0,X.jsx)("div",{className:"text-[9px] uppercase tracking-wider text-muted-foreground px-3 pt-2 pb-1",children:e.title}),t.map(e=>{let t=h.indexOf(e),n=e.icon;return(0,X.jsxs)("button",{onMouseDown:t=>{t.preventDefault(),m(e)},onMouseEnter:()=>s(t),className:t$("flex items-center gap-3 w-full px-3 py-1.5 text-left transition-colors",t===o?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[(0,X.jsx)(n,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,X.jsxs)("div",{className:"min-w-0",children:[(0,X.jsx)("p",{className:"text-[12px] font-medium truncate",children:e.label}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground truncate",children:e.description})]})]},e.label)})]},e.key):null})}),c&&e?"media"===c.type?p?(0,X.jsx)(kD,{kind:c.kind,pagePath:p,anchor:a,onCancel:()=>d(null),onInsert:t=>((t,n)=>{if(!e)return;let{url:r,alt:i,mimeType:o}=n;"image"===t||(o??"").startsWith("image/")||/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(r)?e.chain().focus().setImage({src:r,alt:i??""}).run():e.chain().focus().insertContent(`<a href="${r}">${i??r}</a>`).run(),d(null)})(c.kind,t)}):null:null:null]})}let C5=en("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),C4=en("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),C6=en("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),C9=en("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),C7=en("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),C8=en("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),_e=en("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),_t=en("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);function _n({label:e,icon:t,disabled:n,active:r,danger:i,onAction:o}){return(0,X.jsx)("button",{type:"button","aria-label":e,title:e,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),o()},className:t$("h-7 w-7 inline-flex items-center justify-center rounded text-foreground/80 hover:bg-accent transition-colors disabled:pointer-events-none disabled:opacity-35",r&&"bg-accent text-foreground",i&&"text-destructive hover:bg-destructive/10"),children:(0,X.jsx)(t,{className:"h-3.5 w-3.5"})})}function _r(){return(0,X.jsx)("div",{className:"mx-1 h-5 w-px bg-border"})}function _i({editor:e}){if(!e)return null;let t=()=>{if(!lg(e.state))return null;try{return lj(e.state)}catch{return null}},n=t=>{t()&&(e.commands.focus(),e.commands.fixTables())},r=n=>{let r=t();if(!r)return;let i=r.top,o=i+n;if(!(o<0)&&!(o>=r.map.height)){var s;(s={from:i,to:o},(e,t)=>{let{from:n,to:r,select:i=!0,pos:o=e.selection.from}=s,a=e.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,p=lO(a.doc.resolve(u));if(!p)return!1;let h=null==(t=lL(a,l))?void 0:t.indexes,f=null==(n=lL(a,c))?void 0:n.indexes;if(!h||!f||h.includes(c))return!1;let m=(r=p.node,i=h,o=f,s=lC(r),l_(r,s=lM(s,i,o,0)));if(a.replaceWith(p.pos,p.pos+p.node.nodeSize,m),!d)return!0;let g=lp.get(m),b=p.start,y=g.positionAt(c,g.width-1,m),x=a.doc.resolve(b+y),v=g.positionAt(c,0,m),E=a.doc.resolve(b+v);return a.setSelection(lk.rowSelection(x,E)),!0}({tr:a,originIndex:n,targetIndex:r,select:i,pos:o})&&(null==t||t(a),!0)})(e.state,e.view.dispatch),e.commands.focus()}},i=n=>{let r=t();if(!r)return;let i=r.left,o=i+n;if(!(o<0)&&!(o>=r.map.width)){var s;(s={from:i,to:o},(e,t)=>{let{from:n,to:r,select:i=!0,pos:o=e.selection.from}=s,a=e.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,p=lO(a.doc.resolve(u));if(!p)return!1;let h=null==(t=lR(a,l))?void 0:t.indexes,f=null==(n=lR(a,c))?void 0:n.indexes;if(!h||!f||h.includes(c))return!1;let m=(r=p.node,i=h,o=f,s=lP(lC(r)),l_(r,s=lP(s=lM(s,i,o,0))));if(a.replaceWith(p.pos,p.pos+p.node.nodeSize,m),!d)return!0;let g=lp.get(m),b=p.start,y=g.positionAt(g.height-1,c,m),x=a.doc.resolve(b+y),v=g.positionAt(0,c,m),E=a.doc.resolve(b+v);return a.setSelection(lk.colSelection(x,E)),!0}({tr:a,originIndex:n,targetIndex:r,select:i,pos:o})&&(null==t||t(a),!0)})(e.state,e.view.dispatch),e.commands.focus()}},o=t(),s=!!o&&o.top>0,a=!!o&&o.top<o.map.height-1,l=!!o&&o.left>0,c=!!o&&o.left<o.map.width-1;return(0,X.jsxs)(w3,{editor:e,pluginKey:"tableMenu",options:{placement:"top",offset:10},shouldShow:({editor:e})=>e.isActive("table"),className:"flex items-center gap-0.5 rounded-md border border-border bg-popover px-1 py-1 shadow-lg",children:[(0,X.jsx)(_n,{label:"Select cell text",icon:C1,onAction:()=>{let t=lm(e.state.selection.$from),n=t?.nodeAfter;t&&n&&e.chain().focus().setTextSelection({from:t.pos+1,to:t.pos+n.nodeSize-1}).run()}}),(0,X.jsx)(_r,{}),(0,X.jsx)(_n,{label:"Add row above",icon:_t,onAction:()=>n(()=>e.chain().focus().addRowBefore().run())}),(0,X.jsx)(_n,{label:"Add row below",icon:C5,onAction:()=>n(()=>e.chain().focus().addRowAfter().run())}),(0,X.jsx)(_n,{label:"Move row up",icon:C9,disabled:!s,onAction:()=>r(-1)}),(0,X.jsx)(_n,{label:"Move row down",icon:C5,disabled:!a,onAction:()=>r(1)}),(0,X.jsx)(_n,{label:"Delete row",icon:eA,danger:!0,onAction:()=>n(()=>e.chain().focus().deleteRow().run())}),(0,X.jsx)(_r,{}),(0,X.jsx)(_n,{label:"Add column before",icon:C7,onAction:()=>n(()=>e.chain().focus().addColumnBefore().run())}),(0,X.jsx)(_n,{label:"Add column after",icon:C6,onAction:()=>n(()=>e.chain().focus().addColumnAfter().run())}),(0,X.jsx)(_n,{label:"Move column left",icon:C4,disabled:!l,onAction:()=>i(-1)}),(0,X.jsx)(_n,{label:"Move column right",icon:C6,disabled:!c,onAction:()=>i(1)}),(0,X.jsx)(_n,{label:"Delete column",icon:eA,danger:!0,onAction:()=>n(()=>e.chain().focus().deleteColumn().run())}),(0,X.jsx)(_r,{}),(0,X.jsx)(_n,{label:"Toggle header row",icon:_e,onAction:()=>n(()=>e.chain().focus().toggleHeaderRow().run())}),(0,X.jsx)(_n,{label:"Toggle header column",icon:C8,onAction:()=>n(()=>e.chain().focus().toggleHeaderColumn().run())}),(0,X.jsx)(_r,{}),(0,X.jsx)(_n,{label:"Delete table",icon:eA,danger:!0,onAction:()=>e.chain().focus().deleteTable().run()})]})}let _o=Q.forwardRef(({className:e,type:t,...n},r)=>(0,X.jsx)("input",{type:t,className:t$("flex h-9 w-full rounded-sm border border-input bg-secondary px-3 py-1 text-sm shadow-e-1 transition-colors file:border-0 file:bg-transparent file:text-sm file:font-normal placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));_o.displayName="Input";var _s=Q.forwardRef((e,t)=>(0,X.jsx)(kA.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));_s.displayName="Label";let _a=eU("text-sm font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50"),_l=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(_s,{ref:n,className:t$(_a(),e),...t}));_l.displayName=_s.displayName;var _c=e.i(187014);function _d(e,t){_c.toast.error(e,t)}let _u=["entities","concepts","comparisons"],_p=/^[a-z0-9-]+$/;function _h({editor:e,onCreateRequest:t}){let[n,r]=(0,Q.useState)(!1),[i,o]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(0),[l,c]=(0,Q.useState)({top:0,left:0}),d=(0,Q.useRef)(null),u=(0,Q.useRef)(0),p=ET(e=>e.slugs),h=ET(e=>e.slugDir),f=ET(e=>e.has),m=Array.from(p).sort().filter(e=>!i||e.includes(i.toLowerCase())).slice(0,20),g=i.length>0&&_p.test(i)&&!f(i),b=m.length+ +!!g,y=(0,Q.useCallback)(()=>{r(!1),o(""),a(0)},[]),x=(0,Q.useCallback)(t=>{if(!e)return;let{from:n}=e.state.selection,r=u.current-2,i=e.state.schema.marks.wikiLink;if(!i)return;let o=i.create({slug:t,alias:null,anchor:null}),s=e.state.schema.text(t,[o]),a=e.state.tr.replaceWith(r,n,s);e.view.dispatch(a),e.commands.focus(),y()},[e,y]),v=(0,Q.useCallback)(async n=>{if(e){if(n<m.length)x(m[n]??"");else if(g){let e=await t(i);e.ok?x(e.slug):y()}}},[e,m,g,i,x,t,y]);return((0,Q.useEffect)(()=>{if(!e)return;let t=t=>{if(!n){if("["===t.key){let{from:t}=e.state.selection;if("["!==e.state.doc.textBetween(Math.max(0,t-1),t)||e.state.doc.resolve(t).marks().some(e=>"wikiLink"===e.type.name))return;let n=e.view.coordsAtPos(t),i=e.view.dom.getBoundingClientRect();c({top:n.bottom-i.top+4,left:n.left-i.left}),u.current=t+1,r(!0),o(""),a(0)}return}"ArrowDown"===t.key?(t.preventDefault(),a(e=>b>0?(e+1)%b:0)):"ArrowUp"===t.key?(t.preventDefault(),a(e=>b>0?(e-1+b)%b:0)):"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),b>0&&v(s)):"Escape"===t.key||"]"===t.key?y():"Backspace"===t.key?0===i.length?y():(o(e=>e.slice(0,-1)),a(0)):1!==t.key.length||t.metaKey||t.ctrlKey||(o(e=>e+t.key),a(0))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,n,i,s,b,y,v]),(0,Q.useEffect)(()=>{if(!n)return;let e=e=>{d.current&&!d.current.contains(e.target)&&y()};return window.addEventListener("mousedown",e),()=>window.removeEventListener("mousedown",e)},[n,y]),n&&0!==b)?(0,X.jsxs)("div",{ref:d,className:"absolute z-50 w-[280px] bg-popover border border-border rounded-lg shadow-lg py-1 overflow-hidden max-h-[300px] overflow-y-auto",style:{top:l.top,left:l.left},children:[m.map((e,t)=>{let n=h.get(e);return(0,X.jsxs)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),v(t)},onMouseEnter:()=>a(t),className:t$("flex items-center justify-between w-full px-3 py-1.5 text-left text-sm transition-colors",t===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[(0,X.jsx)("span",{className:"truncate",children:e}),n&&(0,X.jsx)("span",{className:"ml-2 shrink-0 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:n})]},e)}),g&&(0,X.jsx)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),v(m.length)},onMouseEnter:()=>a(m.length),className:t$("flex items-center w-full px-3 py-1.5 text-left text-sm transition-colors",m.length===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:(0,X.jsxs)("span",{className:"text-muted-foreground",children:["+ Create new “",i,"”"]})})]}):null}async function _f(e,t){let n=new FormData;n.append("file",t);try{let t=await r$(`/api/upload/${e}`,{method:"POST",body:n});if(!t.ok)return null;return(await t.json()).url}catch{return null}}function _m(e){let t=[];for(let n of e)t.push({path:n.path,name:n.name}),n.children&&t.push(..._m(n.children));return t}function _g(e,t,n){let r=_m(n).filter(t=>t.name===e||t.path.endsWith(`/${e}`));if(0===r.length)return null;if(1===r.length)return r[0].path;if(t){let n=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",i=r.find(t=>t.path===(n?`${n}/${e}`:e));if(i)return i.path}return r[0].path}function _b(e,t,n){let r=e.split("/");for(let e=1;e<r.length;e++)n(r.slice(0,e).join("/"));t(e),Eg.getState().loadPage(e),setTimeout(()=>{document.querySelector("[data-editor-scroll]")?.scrollTo(0,0)},0)}function _y(){let{currentPath:e,content:t,saveStatus:n,frontmatter:r,isLoading:i,loadStatus:o,createMissingPage:s,editMode:a,setEditMode:l}=Eg(),c=Eb(e=>e.nodes),d=Ek(e=>Ev[e.width]),u=r?.dir==="rtl",{open:p,clearMessages:h}=Eo(),{open:f,Dialog:m}=function(){let[e,t]=(0,Q.useState)(!1),[n,r]=(0,Q.useState)({slug:"",dir:"entities",title:""}),[i,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),a=(0,Q.useCallback)(e=>(r({slug:e,dir:"entities",title:e.split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}),t(!0),new Promise(e=>{s.current=e})),[]),l=(0,Q.useCallback)(()=>{t(!1),s.current?.({ok:!1,slug:n.slug}),s.current=null},[n.slug]),c=(0,Q.useCallback)(async()=>{let{slug:e,dir:r,title:i}=n;o(!0);try{let n=await r$("/api/wiki/page",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,dir:r,title:i.trim()||void 0})});if(n.ok||409===n.status){let n=ET.getState();n.invalidate(),n.load(),t(!1),s.current?.({ok:!0,slug:e,dir:r}),s.current=null}else{let e=await n.json().catch(()=>({})),t=null!==e&&"object"==typeof e&&"error"in e&&"string"==typeof e.error?e.error:"Failed to create page";_d(t)}}catch{_d("Failed to create page")}finally{o(!1)}},[n]);return{open:a,Dialog:(0,X.jsx)(rr,{open:e,onOpenChange:e=>{e||l()},children:(0,X.jsxs)(rO,{children:[(0,X.jsx)(rI,{children:(0,X.jsx)(rR,{children:"Create wiki page"})}),(0,X.jsxs)("div",{className:"space-y-4 py-2",children:[(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)(_l,{htmlFor:"wiki-create-slug",children:"Slug"}),(0,X.jsx)(_o,{id:"wiki-create-slug",value:n.slug,readOnly:!0,className:"bg-muted cursor-default select-all"})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)(_l,{children:"Directory"}),(0,X.jsx)("div",{className:"flex gap-4",children:_u.map(e=>(0,X.jsxs)("label",{className:"flex items-center gap-1.5 text-sm cursor-pointer",children:[(0,X.jsx)("input",{type:"radio",name:"wiki-create-dir",value:e,checked:n.dir===e,onChange:()=>r(t=>({...t,dir:e})),className:"accent-primary"}),e]},e))})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)(_l,{htmlFor:"wiki-create-title",children:"Title (optional)"}),(0,X.jsx)(_o,{id:"wiki-create-title",value:n.title,onChange:e=>r(t=>({...t,title:e.target.value})),placeholder:"Humanized title..."})]})]}),(0,X.jsxs)(rD,{children:[(0,X.jsx)(tq,{variant:"outline",onClick:l,disabled:i,children:"Cancel"}),(0,X.jsx)(tq,{onClick:()=>void c(),disabled:i,children:i?"Creating...":"Create"})]})]})})}}(),g=(0,Q.useRef)(f);g.current=f;let b=(0,Q.useRef)(!1),[y,x]=(0,Q.useState)(!1),[v,E]=(0,Q.useState)(""),[w,k]=(0,Q.useState)("page");(0,Q.useEffect)(()=>{k("page")},[]),(0,Q.useEffect)(()=>{ET.getState().load()},[]),(0,Q.useEffect)(()=>{e&&EA.getState().loadSidecar(e)},[e]),(0,Q.useEffect)(()=>{if(!e||!/\.(md|markdown)$/i.test(e))return;let t=t=>{r$("/api/wiki/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,action:t}),keepalive:"close"===t}).catch(()=>{})};t("open");let n=setInterval(()=>t("heartbeat"),3e4),r=()=>{"hidden"===document.visibilityState&&t("heartbeat")};return document.addEventListener("visibilitychange",r),()=>{clearInterval(n),document.removeEventListener("visibilitychange",r),t("close")}},[e]),(0,Q.useEffect)(()=>{let e=new EventSource(rz("/api/wiki/watch"));return e.onmessage=e=>{try{let t=JSON.parse(e.data),n=Eg.getState().currentPath;("change"===t.type||"add"===t.type)&&n&&t.path===n&&EA.getState().loadSnapshot(n).then(()=>EA.getState().loadSidecar(n))}catch{}},()=>{e.close()}},[]);let[T,N]=(0,Q.useState)(null),A=(0,Q.useRef)(null),[S,C]=(0,Q.useState)(new Map),_=EA(t=>e?t.byPath[e]?.snapshotBlocks:void 0),M=EA(t=>e?t.byPath[e]?.sidecar?.suggestions:void 0),O=EA(t=>e?t.byPath[e]?.snapshotRevision??0:0),I=EA(t=>e?t.byPath[e]?.sidecar?.comments:void 0),D=(0,Q.useMemo)(()=>_??[],[_]),R=(0,Q.useMemo)(()=>I??[],[I]),L=(0,Q.useMemo)(()=>M?.filter(e=>"pending"===e.status)??[],[M]),P=(0,Q.useMemo)(()=>{let e={};for(let t of R)(e[t.ref]??=[]).push(t);return e},[R]),[j,B]=(0,Q.useState)(null),[F,H]=(0,Q.useState)(null),U=(0,Q.useCallback)(()=>{if(!J.current)return null;let e=J.current.view,{from:t}=e.state.selection,n=Eg.getState().currentPath??"",r=EA.getState().byPath[n]?.snapshotBlocks??[],i=e.state.doc.resolve(t),o=i.depth>0?i.index(0):0,s=A.current?.querySelector(".ProseMirror"),a=(s?Array.from(s.children):[])[o]??null,l=r[o],c=l?.ref??a?.getAttribute("data-block-ref")??null,d=l?.markdown??"";if(!c&&a){let n=e.domAtPos(t),r=n.node.nodeType===Node.ELEMENT_NODE?n.node:n.node.parentElement,i=r?.closest("[data-block-ref]")??null;c=i?.getAttribute("data-block-ref")??null}return c&&a?{blockRef:c,blockEl:a,markdown:d}:null},[]),z=(0,Q.useCallback)(()=>{let e=U();if(!e)return;let t=e.blockEl.getBoundingClientRect();H({blockRef:e.blockRef,markdown:e.markdown,anchor:{top:t.bottom+4,left:t.left}})},[U]),$=(0,Q.useCallback)(()=>{let e=U();e&&B({blockRef:e.blockRef,el:e.blockEl})},[U]),G=(0,Q.useRef)(!1),q=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),W=e=>e.replace(/\s+$/g,"").trimStart(),K=(0,Q.useCallback)(async()=>{if(q.current||"suggesting"!==Eg.getState().editMode||!G.current)return;let e=J.current,t=Eg.getState().currentPath;if(!e||!t)return;let n=A.current?.querySelector(".ProseMirror");if(!n)return;let r=Array.from(n.children),i=EA.getState().byPath[t]?.snapshotBlocks??[];if(0!==i.length){q.current=!0,G.current=!1;try{let n=()=>EA.getState().byPath[t]?.snapshotRevision??0,o=async()=>{await EA.getState().loadSnapshot(t),await EA.getState().loadSidecar(t)},s=Math.max(r.length,i.length),a=!1;for(let e=0;e<s;e++){let s=r[e],l=i[e],c=s?Et(s.outerHTML).trim():null;if(l&&null!==c){if(W(c)!==W(l.markdown)){let e=await EC({path:t,ref:l.ref,kind:"replace",markdown:c,getRevision:n,refresh:o});a=a||e}}else if(l&&null===c){let e=await EC({path:t,ref:l.ref,kind:"delete",getRevision:n,refresh:o});a=a||e}else if(!l&&null!==c&&c.length>0){let e=i[i.length-1]?.ref;if(e){let r=await EC({path:t,ref:e,kind:"insertAfter",markdown:c,getRevision:n,refresh:o});a=a||r}}}if(a){await o();let n=(EA.getState().byPath[t]?.snapshotBlocks??i).map(e=>e.markdown).join("\n\n");b.current=!0;let r=await vE(n,t);e.commands.setContent(r),setTimeout(()=>{b.current=!1},50)}}finally{q.current=!1}}},[]);(0,Q.useEffect)(()=>{e&&EA.getState().loadSnapshot(e)},[e]),(0,Q.useEffect)(()=>{if(!e||0===D.length||!A.current)return;let t=A.current,n=t.querySelector(".ProseMirror");if(!n)return;let r=Array.from(n.children),i=t.getBoundingClientRect(),o=new Map;for(let e=0;e<Math.min(r.length,D.length);e++){let n=r[e],s=D[e];n.setAttribute("data-block-ref",s.ref);let a=n.getBoundingClientRect();o.set(s.ref,{top:a.top-i.top+t.scrollTop,left:a.left-i.left,width:a.width,bottom:a.bottom-i.top+t.scrollTop})}C(o)},[e,D]);let Y=function(e={},t=[]){let n=(0,cs.useRef)(e);n.current=e;let[r]=(0,cs.useState)(()=>new pK(n)),i=(0,ca.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,cs.useDebugValue)(i),(0,cs.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,cs.useState)(()=>new pq(e.editor)),r=(0,pF.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:pj);pG(()=>n.watch(e.editor),[e.editor,n]),(0,cs.useDebugValue)(r)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}({extensions:Sq,content:"",onUpdate:(0,Q.useCallback)(({editor:e})=>{if(b.current||!e)return;"suggesting"===Eg.getState().editMode&&(G.current=!0);let t=Et(e.getHTML());Eg.getState().updateContent(t)},[]),onBlur:()=>{K()},onSelectionUpdate:({editor:e})=>{if("suggesting"!==Eg.getState().editMode)return;let{from:t}=e.state.selection,n=e.state.doc.resolve(t),r=n.depth>0?n.index(0):0,i=V.current;V.current=r,null!==i&&i!==r&&G.current&&K()},editorProps:{attributes:{class:"focus:outline-none min-h-[calc(100vh-12rem)] px-4 sm:px-8 py-6 max-w-[var(--editor-max-w,48rem)] mx-auto"},handleKeyDown:(e,t)=>{if((t.metaKey||t.ctrlKey)&&"a"===t.key.toLowerCase()&&lg(e.state)){let n=lm(e.state.selection.$from),r=n?.nodeAfter;if(!n||!r)return!1;let i=n.pos+1,o=n.pos+r.nodeSize-1;return(e.state.selection.from!==i||e.state.selection.to!==o)&&(t.preventDefault(),Y?.chain().focus().setTextSelection({from:i,to:o}).run(),!0)}return!1},handleClick:(e,t,n)=>{let r=n.target.closest("a");if(!r)return!1;let i=r.getAttribute("href");if(!i)return!1;if("true"===r.dataset.wikiLink){n.preventDefault(),n.stopPropagation();let e=r.dataset.slug??"",t=r.dataset.anchor??null;if(!e)return!0;let i=ET.getState();if(i.has(e)){let n=i.getDir(e),r=null===n||"root"===n?`${e}.md`:`${n}/${e}.md`;Eg.getState().loadPage(r),t&&setTimeout(()=>{document.querySelector(`[id="${t}"]`)?.scrollIntoView({behavior:"smooth"})},200)}else g.current(e).then(e=>{if(e.ok){let t=e.dir??"entities",n=`${t}/${e.slug}.md`;Eg.getState().loadPage(n)}});return!0}if(i.startsWith("#page:")){n.preventDefault(),n.stopPropagation();let e=i.replace("#page:",""),{nodes:t,selectPage:r,expandPath:o}=Eb.getState(),s=_g(e,Eg.getState().currentPath,t);return s&&_b(s,r,o),!0}if(/^https?:\/\//.test(i)||i.startsWith("/api/")||i.startsWith("mailto:")||i.startsWith("tel:"))return!1;n.preventDefault(),n.stopPropagation();let{nodes:o,selectPage:s,expandPath:a}=Eb.getState(),l=function(e,t,n){let r=_m(n),i=e.replace(/\.md$/,"").replace(/^\.\//,"").replace(/^\//,""),o=r.find(e=>e.path===i);if(o)return o.path;if(t){let e=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",n=e?`${e}/${i}`:i,o=r.find(e=>e.path===n);if(o)return o.path}return _g(i.includes("/")?i.split("/").pop():i,t,n)}(i,Eg.getState().currentPath,o);return l&&_b(l,s,a),!0},handlePaste:(e,t)=>{let n=t.clipboardData?.files,r=Eg.getState().currentPath;if(n&&n.length>0&&r){for(let e of Array.from(n))_f(r,e).then(t=>{t&&Y&&(e.type.startsWith("image/")?Y.chain().focus().setImage({src:t,alt:e.name}).run():Y.chain().focus().insertContent(`<a href="${t}">${e.name}</a>`).run())});return!0}return!1},handleDrop:(e,t)=>{let n=t.dataTransfer?.files;if(!n||0===n.length)return!1;let r=Eg.getState().currentPath;if(!r)return!1;for(let e of(t.preventDefault(),Array.from(n)))_f(r,e).then(t=>{t&&Y&&(e.type.startsWith("image/")?Y.chain().focus().setImage({src:t,alt:e.name}).run():Y.chain().focus().insertContent(`<a href="${t}">${e.name}</a>`).run())});return!0}},immediatelyRender:!1}),J=(0,Q.useRef)(Y);J.current=Y;let Z=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),[et,en]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!Y||null===e||Eg.getState().isDirty&&e===Z.current||i&&""===t)return;let n=`${e} ${t}`;if(ee.current===n){et!==e&&en(e);return}Z.current=e,(async()=>{b.current=!0;let r=await vE(t,e);Y.commands.setContent(r),ee.current=n,en(e),setTimeout(()=>{b.current=!1},50)})()},[Y,t,e,i,et]);let er=null!==e&&(i||et!==e);if(null===e)return(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,X.jsxs)("div",{className:"text-center space-y-3",children:[(0,X.jsx)("p",{className:"text-lg font-medium tracking-[-0.02em]",children:"No page selected"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground/70",children:"Select a page from the sidebar or create a new one"})]})});if("missing"===o){let t=(e.split("/").pop()||e).replace(/[-_]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),n=p9(c,e),r=n?.children??[],i=r.length>0;return(0,X.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,X.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-10 space-y-6",children:[(0,X.jsxs)("div",{className:"space-y-3",children:[(0,X.jsx)("p",{className:"text-lg font-medium tracking-[-0.02em] text-foreground",children:t}),(0,X.jsxs)("p",{className:"text-sm text-muted-foreground/80",children:["This folder doesn't have an"," ",(0,X.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-[12px]",children:"index.md"}),i?" yet — its contents are listed below.":" yet."]}),(0,X.jsxs)("button",{onClick:()=>void s(t),className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[13px] font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[(0,X.jsx)(ed,{className:"h-3.5 w-3.5"}),"Create page"]})]}),i&&(0,X.jsx)(S3,{folderPath:e,entries:r},e)]})})}let ei=async()=>{if(y){if(Eg.getState().updateContent(v),Y){b.current=!0;let t=await vE(v,e??void 0);Y.commands.setContent(t),setTimeout(()=>{b.current=!1},50)}x(!1)}else E(Eg.getState().content),x(!0)},eo=p9(c,e),es=eo?.type==="directory"||eo?.type==="cabinet"?eo.children??[]:[],ea=es.length>0,el=ea&&"files"===w;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[ea&&(0,X.jsxs)("div",{className:"flex items-center gap-1 px-3 pt-2 border-b border-border",children:[(0,X.jsx)("button",{onClick:()=>k("page"),className:`px-3 py-1.5 text-[12px] rounded-t-md border-b-2 -mb-px transition-colors ${"page"===w?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"aria-pressed":"page"===w,children:"Page"}),(0,X.jsxs)("button",{onClick:()=>k("files"),className:`px-3 py-1.5 text-[12px] rounded-t-md border-b-2 -mb-px transition-colors ${"files"===w?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"aria-pressed":"files"===w,children:["Files",(0,X.jsx)("span",{className:"ml-1.5 text-muted-foreground/60",children:es.length})]})]}),el?(0,X.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,X.jsx)("div",{className:"max-w-3xl mx-auto px-6 py-6",children:(0,X.jsx)(S3,{folderPath:e,entries:es},e)})}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"flex items-center min-w-0",children:[(0,X.jsx)("div",{className:"flex-1 min-w-0",children:!y&&(0,X.jsx)(kL,{editor:Y})}),(0,X.jsxs)("button",{onClick:ei,className:`flex items-center gap-1.5 px-3 py-1 mr-2 text-[11px] rounded-md transition-colors border border-border ${y?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`,children:[(0,X.jsx)(rj,{className:"h-3 w-3"}),y?"Preview":"Markdown"]})]}),y?(0,X.jsx)("div",{className:"flex-1 overflow-y-auto p-4",dir:u?"rtl":void 0,children:(0,X.jsx)("textarea",{value:v,onChange:e=>E(e.target.value),className:"w-full h-full min-h-[calc(100vh-12rem)] bg-transparent font-mono text-[13px] leading-relaxed resize-none focus:outline-none",spellCheck:!1})}):(0,X.jsxs)("div",{className:"flex-1 relative",dir:u?"rtl":void 0,children:["suggesting"===a&&(0,X.jsx)("div",{className:"absolute top-0 inset-x-0 z-20 flex items-center justify-center gap-2 px-3 py-1 bg-primary/10 border-b border-primary/20 text-[11px] text-primary pointer-events-none",children:"Suggesting mode · your edits become suggestions for review"}),(0,X.jsxs)("div",{ref:A,className:`absolute inset-0 overflow-y-auto ${"suggesting"===a?"pt-7":""}`,style:{"--editor-max-w":d},"data-editor-scroll":!0,children:[(0,X.jsxs)("div",{"aria-hidden":"true",className:"relative pointer-events-none",style:{height:0},children:[Object.entries(P).map(([e,t])=>{let n=S.get(e);return n?(0,X.jsx)("div",{style:{pointerEvents:"auto"},children:(0,X.jsx)(S4,{blockRef:e,comments:t,top:n.top+4,left:Math.max(0,n.left-20),onClick:()=>{let t=A.current?.querySelector(`[data-block-ref="${e}"]`);t&&B({blockRef:e,el:t})}})},`pip-${e}`):null}),e&&L.map(t=>{let n=S.get(t.ref),r=D.find(e=>e.ref===t.ref);if(!n||!r)return null;let i="insertAfter"===t.kind?n.bottom+4:"insertBefore"===t.kind?Math.max(0,n.top-80):n.top;return(0,X.jsx)("div",{style:{pointerEvents:"auto"},children:(0,X.jsx)(CK,{path:e,suggestion:t,currentMarkdown:r.markdown,baseRevision:O,getLatestRevision:()=>EA.getState().byPath[e]?.snapshotRevision??0,top:i,left:n.left,width:n.width,onSettled:()=>{EA.getState().loadSidecar(e),EA.getState().loadSnapshot(e)}})},`sug-${t.id}`)})]}),j&&e&&(0,X.jsx)(Cq,{path:e,blockRef:j.blockRef,comments:P[j.blockRef]??[],anchorEl:j.el,onClose:()=>B(null)}),F&&e&&(0,X.jsx)(CQ,{path:e,blockRef:F.blockRef,currentMarkdown:F.markdown,anchor:F.anchor,onClose:()=>H(null)}),(0,X.jsx)(p$,{editor:Y}),(0,X.jsx)("div",{"aria-hidden":"true",className:"contents",onMouseOver:e=>{let t=e.target.closest(".proof-span");t&&t!==T&&N(t)},onMouseOut:e=>{let t=e.relatedTarget;t?.closest(".proof-span")||N(null)}}),e&&(0,X.jsx)(CV,{targetEl:T,path:e,onClose:()=>N(null),onComment:()=>{if(!T)return;let e=T.closest("[data-block-ref]");if(!e)return;let t=e.getAttribute("data-block-ref");t&&B({blockRef:t,el:e})}}),(0,X.jsx)(kd,{editor:Y,onSuggestEdit:z,onComment:$}),(0,X.jsx)(_i,{editor:Y}),(0,X.jsx)(C3,{editor:Y}),(0,X.jsx)(_h,{editor:Y,onCreateRequest:g.current}),(0,X.jsxs)("div",{className:"max-w-[var(--editor-max-w,48rem)] mx-auto px-8 pb-8 flex items-center gap-4",children:[(0,X.jsxs)("button",{onClick:()=>{h(),p()},className:"group flex items-center gap-2 text-[13px] text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-pointer",children:[(0,X.jsx)(p6,{className:"h-3.5 w-3.5 group-hover:text-primary transition-colors"}),(0,X.jsx)("span",{children:"Edit with AI"})]}),(0,X.jsxs)("span",{className:"text-[11px] text-muted-foreground/30 select-none",children:[(0,X.jsx)("kbd",{className:"rounded px-1 py-0.5 font-mono text-[10px] ring-1 ring-foreground/10",children:"/"})," ","for commands"]})]})]}),er&&(0,X.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 backdrop-blur-md z-20 pointer-events-none","aria-hidden":"true",children:(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin text-muted-foreground/70"})})]}),(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-1 border-t border-border text-xs text-muted-foreground/60",children:[(0,X.jsxs)("span",{className:"text-[10.5px] text-muted-foreground/30 select-none hidden sm:block",children:[(0,X.jsx)("kbd",{className:"rounded px-1 font-mono text-[9.5px] ring-1 ring-foreground/10",children:"⌘S"})," ","save",(0,X.jsx)("span",{className:"mx-1.5 opacity-40",children:"·"}),(0,X.jsx)("kbd",{className:"rounded px-1 font-mono text-[9.5px] ring-1 ring-foreground/10",children:"/"})," ","commands"]}),(0,X.jsxs)("div",{className:"flex items-center gap-3",children:[(0,X.jsxs)("div",{className:"flex items-center rounded-md border border-border overflow-hidden text-[10.5px]",role:"radiogroup","aria-label":"Edit mode",children:[(0,X.jsx)("button",{type:"button",role:"radio","aria-checked":"editing"===a,onClick:()=>l("editing"),className:`px-2 py-0.5 transition-colors ${"editing"===a?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:"Editing"}),(0,X.jsx)("button",{type:"button",role:"radio","aria-checked":"suggesting"===a,onClick:()=>l("suggesting"),className:`px-2 py-0.5 transition-colors ${"suggesting"===a?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:"Suggesting"})]}),(0,X.jsxs)("span",{children:["saving"===n&&"Saving...","saved"===n&&"Saved","error"===n&&"Save failed"]})]})]})]})]}),m]})}function _x({path:e}){let t=rz(`/api/assets/${e}`),n=e.split("/").pop()||e,r=n.includes(".")?n.split(".").pop()?.toUpperCase():"",i=async()=>{try{await r$("/api/system/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}catch{}};return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(rG,{path:e,badge:r||void 0}),(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center max-w-sm",children:[(0,X.jsx)("div",{className:"flex size-16 items-center justify-center rounded-2xl bg-muted",children:(0,X.jsx)(ec,{className:"size-8 text-muted-foreground/50"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:n}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"This file type can't be previewed in Cabinet."})]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsxs)(tq,{variant:"outline",size:"sm",className:"gap-2",onClick:i,children:[(0,X.jsx)(eh,{className:"h-4 w-4"}),"Open in Finder"]}),(0,X.jsxs)(tq,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>{let e=document.createElement("a");e.href=t,e.download=n,e.click()},children:[(0,X.jsx)(el,{className:"h-4 w-4"}),"Download"]})]})]})})]})}function _v({path:e,title:t}){let n=rz(`/api/assets/${e}`),r=e.split("/").pop()||e,i=r.includes(".")?r.split(".").pop()?.toUpperCase():"IMG";return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rG,{path:e,badge:i,children:[(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=n,e.download=r,e.click()},children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),"Open in new tab"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto flex items-center justify-center bg-[#1a1a1a] p-8",children:(0,X.jsx)("img",{src:n,alt:t,className:"max-w-full max-h-full object-contain rounded-md shadow-lg",style:{imageRendering:"auto"}})})]})}function _E({path:e,type:t}){let n=rz(`/api/assets/${e}`),r=e.split("/").pop()||e,i=r.includes(".")?r.split(".").pop()?.toUpperCase():t.toUpperCase();return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rG,{path:e,badge:i,children:[(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=n,e.download=r,e.click()},children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),"Open in new tab"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto flex items-center justify-center bg-[#1a1a1a] p-8",children:"video"===t?(0,X.jsx)("video",{src:n,controls:!0,className:"max-w-full max-h-full rounded-md shadow-lg",children:"Your browser does not support the video element."}):(0,X.jsxs)("div",{className:"w-full max-w-lg space-y-4",children:[(0,X.jsx)("div",{className:"text-center text-muted-foreground text-sm",children:r}),(0,X.jsx)("audio",{src:n,controls:!0,className:"w-full",children:"Your browser does not support the audio element."})]})})]})}let _w=en("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),_k=en("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),_T=en("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),_N=en("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),_A=en("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function _S({path:t,title:n}){let[r,i]=(0,Q.useState)(""),[o,s]=(0,Q.useState)(""),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!0),[u,p]=(0,Q.useState)(!1),[h,f]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(1),[b,y]=(0,Q.useState)({x:0,y:0}),[x,v]=(0,Q.useState)(!1),E=(0,Q.useRef)({x:0,y:0,panX:0,panY:0}),w=(0,Q.useRef)(null),k=(0,Q.useRef)(null),T=(0,Q.useRef)(0),N=(0,Q.useCallback)(e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-.25:.25;g(e=>Math.min(Math.max(e+t,.25),5))}},[]),A=(0,Q.useCallback)(e=>{0===e.button&&(v(!0),E.current={x:e.clientX,y:e.clientY,panX:b.x,panY:b.y},e.target.setPointerCapture(e.pointerId))},[b]),S=(0,Q.useCallback)(e=>{x&&y({x:E.current.panX+(e.clientX-E.current.x),y:E.current.panY+(e.clientY-E.current.y)})},[x]),C=(0,Q.useCallback)(()=>{v(!1)},[]),_=rz(`/api/assets/${t}`);t.split("/").pop();let M=(0,Q.useCallback)(async()=>{d(!0),l("");try{let t=await r$(_);if(!t.ok)throw Error("Failed to fetch file");let n=await t.text();i(n);let r=(await e.A(890793)).default;r.initialize({startOnLoad:!1,theme:document.documentElement.classList.contains("dark")?"dark":"default",securityLevel:"loose",suppressErrorRendering:!0}),await r.parse(n.trim());let o=`mermaid-${++T.current}`,{svg:a}=await r.render(o,n.trim());s(a)}catch(e){document.querySelectorAll('[id^="dmermaid-"], [id^="d"]:has(> .error-icon)').forEach(e=>e.remove()),l(e instanceof Error?e.message:"Failed to render diagram")}finally{d(!1)}},[_]);return(0,Q.useEffect)(()=>{M()},[M]),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rG,{path:t,badge:"MERMAID",children:[(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:`h-7 gap-1.5 text-xs ${u?"bg-muted":""}`,onClick:()=>p(e=>!e),children:[u?(0,X.jsx)(_k,{className:"h-3.5 w-3.5"}):(0,X.jsx)(rj,{className:"h-3.5 w-3.5"}),u?"Diagram":"Code"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{navigator.clipboard.writeText(r),f(!0),setTimeout(()=>f(!1),2e3)},children:[h?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_w,{className:"h-3.5 w-3.5"}),h?"Copied":"Copy"]}),o&&!u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"h-4 w-px bg-border mx-0.5"}),(0,X.jsx)(tq,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>g(e=>Math.max(e-.25,.25)),title:"Zoom out",children:(0,X.jsx)(_A,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)("span",{className:"text-[11px] text-muted-foreground tabular-nums w-10 text-center select-none",children:[Math.round(100*m),"%"]}),(0,X.jsx)(tq,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>g(e=>Math.min(e+.25,5)),title:"Zoom in",children:(0,X.jsx)(_N,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tq,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{g(1),y({x:0,y:0})},title:"Reset view",children:(0,X.jsx)(_T,{className:"h-3.5 w-3.5"})}),(0,X.jsx)("div",{className:"h-4 w-px bg-border mx-0.5"})]}),o&&(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{if(!o)return;let e=new Blob([o],{type:"image/svg+xml"}),t=URL.createObjectURL(e),r=document.createElement("a");r.href=t,r.download=`${n}.svg`,r.click(),URL.revokeObjectURL(t)},children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"SVG"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto",children:c?(0,X.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Rendering diagram..."}):u?(0,X.jsx)("pre",{className:"p-4 text-[13px] leading-relaxed font-mono bg-[#1e1e1e]",children:(0,X.jsx)("code",{children:r.split("\n").map((e,t)=>(0,X.jsxs)("div",{className:"flex",children:[(0,X.jsx)("span",{className:"inline-block w-12 pr-4 text-right text-[#858585] select-none shrink-0",children:t+1}),(0,X.jsx)("span",{className:"text-[#d4d4d4] flex-1",children:e||"\n"})]},t))})}):a?(0,X.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-sm p-8",children:[(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,X.jsx)("div",{className:"h-10 w-10 rounded-full bg-red-500/10 flex items-center justify-center",children:(0,X.jsx)(rj,{className:"h-5 w-5 text-red-500"})}),(0,X.jsx)("p",{className:"text-red-500 font-medium",children:"Diagram syntax error"})]}),(0,X.jsx)("pre",{className:"text-muted-foreground text-xs max-w-lg text-left bg-muted rounded-md p-3 overflow-auto whitespace-pre-wrap",children:a}),(0,X.jsx)(tq,{variant:"outline",size:"sm",onClick:()=>p(!0),children:"View source to fix"})]}):(0,X.jsx)("div",{ref:k,className:"relative w-full h-full overflow-hidden",style:{cursor:x?"grabbing":"grab"},onWheel:N,onPointerDown:A,onPointerMove:S,onPointerUp:C,children:(0,X.jsx)("div",{ref:w,className:"flex items-center justify-center p-8 min-h-full [&_svg]:max-w-full origin-center select-none",style:{transform:`translate(${b.x}px, ${b.y}px) scale(${m})`},dangerouslySetInnerHTML:{__html:o}})})})]})}var _C="[0-9](_*[0-9])*",__=`\\.(${_C})`,_M="[0-9a-fA-F](_*[0-9a-fA-F])*",_O={className:"number",variants:[{begin:`(\\b(${_C})((${__})|\\.)?|(${__}))[eE][+-]?(${_C})[fFdD]?\\b`},{begin:`\\b(${_C})((${__})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${__})[fFdD]?\\b`},{begin:`\\b(${_C})[fFdD]\\b`},{begin:`\\b0[xX]((${_M})\\.?|(${_M})?\\.(${_M}))[pP][+-]?(${_C})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${_M})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0},_I="[0-9](_*[0-9])*",_D=`\\.(${_I})`,_R="[0-9a-fA-F](_*[0-9a-fA-F])*",_L={className:"number",variants:[{begin:`(\\b(${_I})((${_D})|\\.)?|(${_D}))[eE][+-]?(${_I})[fFdD]?\\b`},{begin:`\\b(${_I})((${_D})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${_D})[fFdD]?\\b`},{begin:`\\b(${_I})[fFdD]\\b`},{begin:`\\b0[xX]((${_R})\\.?|(${_R})?\\.(${_R}))[pP][+-]?(${_I})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${_R})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};let _P=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],_j=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),_B=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),_F=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_H=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),_U=_B.concat(_F).sort().reverse(),_z=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],_$=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),_G=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),_q=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_V=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _W(e){return e?"string"==typeof e?e:e.source:null}function _K(e){return _Y("(?=",e,")")}function _Y(...e){return e.map(e=>_W(e)).join("")}function _X(...e){let t;return"("+(("object"==typeof(t=e[e.length-1])&&t.constructor===Object?(e.splice(e.length-1,1),t):{}).capture?"":"?:")+e.map(e=>_W(e)).join("|")+")"}let _Q=e=>_Y(/\b/,e,/\w$/.test(e)?/\b/:/\B/),_J=["Protocol","Type"].map(_Q),_Z=["init","self"].map(_Q),_0=["Any","Self"],_1=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],_2=["false","nil","true"],_3=["assignment","associativity","higherThan","left","lowerThan","none","right"],_5=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],_4=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],_6=_X(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_9=_X(_6,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),_7=_Y(_6,_9,"*"),_8=_X(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Me=_X(_8,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Mt=_Y(_8,Me,"*"),Mn=_Y(/[A-Z]/,Me,"*"),Mr=["attached","autoclosure",_Y(/convention\(/,_X("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",_Y(/objc\(/,Mt,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Mi=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"],Mo={arduino:function(e){let t,n,r,i,o,s,a,l,c,d,u,p,h,f,m,g,b=(t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),i="[a-zA-Z_]\\w*::",o="(?!struct)("+(r="decltype\\(auto\\)")+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},a={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(a,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},u=t.optional(i)+e.IDENT_RE+"\\s*\\(",m={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p={type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]},contains:(f=[h={className:"function.dispatch",relevance:0,keywords:{_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},c,s,n,e.C_BLOCK_COMMENT_MODE,l,a]).concat([{begin:/\(/,end:/\)/,keywords:p,contains:f.concat(["self"]),relevance:0}]),relevance:0},g={className:"function",begin:"("+o+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[a,l]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,a,l,s,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,a,l,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,c]},{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(m,g,h,f,[c,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:p,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:p},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}),y=b.keywords;return y.type=[...y.type,"boolean","byte","word","String"],y.literal=[...y.literal,"DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"],y.built_in=[...y.built_in,"KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],y._hints=["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],b.name="Arduino",b.aliases=["ino"],b.supersetOf="cpp",b},bash:A0,c:function(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},a={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(a,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},u=t.optional(i)+e.IDENT_RE+"\\s*\\(",p={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},h=[c,s,n,e.C_BLOCK_COMMENT_MODE,l,a],f={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:h.concat([{begin:/\(/,end:/\)/,keywords:p,contains:h.concat(["self"]),relevance:0}]),relevance:0},m={begin:"("+o+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,a,l,s,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,a,l,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C",aliases:["h"],keywords:p,disableAutodetect:!0,illegal:"</",contains:[].concat(f,m,h,[c,{begin:e.IDENT_RE+"::",keywords:p},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:a,keywords:p}}},cpp:function(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},a={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(a,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},u=t.optional(i)+e.IDENT_RE+"\\s*\\(",p={type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]},h={className:"function.dispatch",relevance:0,keywords:{_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},f=[h,c,s,n,e.C_BLOCK_COMMENT_MODE,l,a],m={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:f.concat([{begin:/\(/,end:/\)/,keywords:p,contains:f.concat(["self"]),relevance:0}]),relevance:0},g={className:"function",begin:"("+o+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[a,l]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,a,l,s,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,a,l,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(m,g,h,f,[c,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:p,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:p},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}},csharp:function(e){let t={keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"]),built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],literal:["default","false","null","true"]},n=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),r={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},i={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},o=e.inherit(i,{illegal:/\n/}),s={className:"subst",begin:/\{/,end:/\}/,keywords:t},a=e.inherit(s,{illegal:/\n/}),l={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,a]},c={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},s]},d=e.inherit(c,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},a]});s.contains=[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.C_BLOCK_COMMENT_MODE],a.contains=[d,l,o,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let u={variants:[{className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},p={begin:"<",end:">",contains:[{beginKeywords:"in out"},n]},h=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",f={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:t,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},u,r,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},n,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[n,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[n,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+h+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:t,contains:[{beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial",relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,p],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:t,relevance:0,contains:[u,r,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},f]}},css:A6,diff:function(e){let t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}},go:A9,graphql:function(e){let t=e.regex;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}},ini:function(e){let t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},s={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:t.concat(a,"(\\s*\\.\\s*",a,")*",t.lookahead(/\s*=\s*[^#\s]/)),className:"attr",starts:{end:/$/,contains:[r,{begin:/\[/,end:/\]/,contains:[r,o,i,s,n,"self"],relevance:0},o,i,s,n]}}]}},java:function(e){let t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+function e(t,n,r){return -1===r?"":t.replace(n,i=>e(t,n,r-1))}("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),i={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},o={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},s={className:"params",begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:i,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[o,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,_O,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_O,o]}},javascript:Ss,json:Sa,kotlin:function(e){let t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,r]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,r]}]};r.contains.push(o);let s={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},a={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},l=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),c={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]};return c.variants[1].contains=[c],c.variants[1].contains=[c],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,l,{className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},n,s,a,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[c,e.C_LINE_COMMENT_MODE,l],relevance:0},e.C_LINE_COMMENT_MODE,l,s,a,o,e.C_NUMBER_MODE]},l]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,a]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:"\n"},_L]}},less:function(e){let t={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},n="[\\w-]+",r="("+n+"|@\\{"+n+"\\})",i=[],o=[],s=function(e){return{className:"string",begin:"~?"+e+".*?"+e}},a=function(e,t,n){return{className:e,begin:t,relevance:n}},l={$pattern:/[a-z-]+/,keyword:"and or not only",attribute:_j.join(" ")};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s("'"),s('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,{begin:"\\(",end:"\\)",contains:o,keywords:l,relevance:0},a("variable","@@?"+n,10),a("variable","@\\{"+n+"\\}"),a("built_in","~?`[^`]*?`"),{className:"attribute",begin:n+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);let c=o.concat({begin:/\{/,end:/\}/,contains:i}),d={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},u={begin:r+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+_H.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},p={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:r,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:"[<='$\"]",relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,a("keyword","all\\b"),a("variable","@\\{"+n+"\\}"),{begin:"\\b("+_P.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,a("selector-tag",r,0),a("selector-id","#"+r),a("selector-class","\\."+r,0),a("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+_B.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+_F.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:c},{begin:"!important"},t.FUNCTION_DISPATCH]},h={begin:n+":(:)?"+`(${_U.join("|")})`,returnBegin:!0,contains:[p]};return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:l,returnEnd:!0,contains:o,relevance:0}},{className:"variable",variants:[{begin:"@"+n+"\\s*:",relevance:15},{begin:"@"+n}],starts:{end:"[;}]",returnEnd:!0,contains:c}},h,u,p,d,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:i}},lua:function(e){let t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}},makefile:function(e){let t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,{className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},r,{className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},{className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]}]}},markdown:Sl,objectivec:function(e){let t=/[a-zA-Z@][a-zA-Z0-9_]*/,n={$pattern:t,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:{"variable.language":["this","super"],$pattern:t,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},illegal:"</",contains:[{className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+n.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:n,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}},perl:function(e){let t=e.regex,n=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot class close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl field fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map method mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0"},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},o={begin:/->\{/,end:/\}/},s={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},a={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},c=[e.BACKSLASH_ESCAPE,i,a],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],u=(e,r,i="\\1")=>{let o="\\1"===i?i:t.concat(i,r);return t.concat(t.concat("(?:",e,")"),r,/(?:\\.|[^\\\/])*?/,o,/(?:\\.|[^\\\/])*?/,i,n)},p=(e,r,i)=>t.concat(t.concat("(?:",e,")"),r,/(?:\\.|[^\\\/])*?/,i,n),h=[a,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:c,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},l,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:u("s|tr|y",t.either(...d,{capture:!0}))},{begin:u("s|tr|y","\\(","\\)")},{begin:u("s|tr|y","\\[","\\]")},{begin:u("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=h,o.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:h}},php:function(e){let t,n=e.regex,r=/(?![A-Za-z0-9])(?![$])/,i=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,r),o=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,r),s=n.concat(/[A-Z]+/,r),a={scope:"variable",match:"\\$+"+i},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},p=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h="[ \n]",f={scope:"string",variants:[d,c,u,p]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:b,literal:(t=[],g.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t),built_in:y},v=e=>e.map(e=>e.replace(/\|\d+$/,"")),E={variants:[{match:[/new/,n.concat(h,"+"),n.concat("(?!",v(y).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},w=n.concat(i,"\\b(?!\\()"),k={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),w],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,n.concat(/::/,n.lookahead(/(?!class\b)/)),w],scope:{1:"title.class",3:"variable.constant"}},{match:[o,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},T={scope:"attr",match:n.concat(i,n.lookahead(":"),n.lookahead(/(?!::)/))},N={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[T,a,k,e.C_BLOCK_COMMENT_MODE,f,m,E]},A={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",v(b).join("\\b|"),"|",v(y).join("\\b|"),"\\b)"),i,n.concat(h,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[N]};N.contains.push(A);let S=[T,k,e.C_BLOCK_COMMENT_MODE,f,m,E],C={begin:n.concat(/#\[\s*\\?/,n.either(o,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...S]},...S,{scope:"meta",variants:[{match:o},{match:s}]}]};return{case_insensitive:!1,keywords:x,contains:[C,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},a,A,k,{match:[/const/,/\s/,i],scope:{1:"keyword",3:"variable.constant"}},E,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:x,contains:["self",C,a,k,e.C_BLOCK_COMMENT_MODE,f,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},f,m]}},"php-template":function(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}},plaintext:function(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}},python:Sc,"python-repl":function(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}},r:function(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}},ruby:function(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},a={begin:"#<",end:">"},l=[e.COMMENT("#","$",{contains:[s]}),e.COMMENT("^=begin","^=end",{contains:[s],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},u="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${u}))?([eE][+-]?(${u})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},h={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},f=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[h]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(a,l),relevance:0}].concat(a,l);c.contains=f,h.contains=f;let m=[{begin:/^\s*=>/,starts:{end:"$",contains:f}},{className:"meta.prompt",begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])",starts:{end:"$",keywords:o,contains:f}}];return l.unshift(a),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(m).concat(l).concat(f)}},rust:Sd,scss:function(e){let t={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},n="@[a-z-]+",r={className:"variable",begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+_z.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+_G.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+_q.join("|")+")"},r,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+_V.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,r,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:n,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:_$.join(" ")},contains:[{begin:n,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},r,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}},shell:Su,sql:Sp,swift:function(e){let t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,_X(..._J,..._Z)],className:{2:"keyword"}},o={match:_Y(/\./,_X(..._1)),relevance:0},s=_1.filter(e=>"string"==typeof e).concat(["_|0"]),a={variants:[{className:"keyword",match:_X(..._1.filter(e=>"string"!=typeof e).concat(_0).map(_Q),..._Z)}]},l={$pattern:_X(/\b\w+/,/#\w+/),keyword:s.concat(_5),literal:_2},c=[i,o,a],d=[{match:_Y(/\./,_X(..._4)),relevance:0},{className:"built_in",match:_Y(/\b/,_X(..._4),/(?=\()/)}],u={match:/->/,relevance:0},p=[u,{className:"operator",relevance:0,variants:[{match:_7},{match:`\\.(\\.|${_9})+`}]}],h="([0-9]_*)+",f="([0-9a-fA-F]_*)+",m={className:"number",relevance:0,variants:[{match:`\\b(${h})(\\.(${h}))?([eE][+-]?(${h}))?\\b`},{match:`\\b0x(${f})(\\.(${f}))?([pP][+-]?(${h}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e="")=>({className:"subst",variants:[{match:_Y(/\\/,e,/[0\\tnr"']/)},{match:_Y(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),b=(e="")=>({className:"subst",label:"interpol",begin:_Y(/\\/,e,/\(/),end:/\)/}),y=(e="")=>({begin:_Y(e,/"""/),end:_Y(/"""/,e),contains:[g(e),((e="")=>({className:"subst",match:_Y(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}))(e),b(e)]}),x=(e="")=>({begin:_Y(e,/"/),end:_Y(/"/,e),contains:[g(e),b(e)]}),v={className:"string",variants:[y(),y("#"),y("##"),y("###"),x(),x("#"),x("##"),x("###")]},E=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],w=e=>{let t=_Y(e,/\//),n=_Y(/\//,e);return{begin:t,end:n,contains:[...E,{scope:"comment",begin:`#(?!.*${n})`,end:/$/}]}},k={scope:"regexp",variants:[w("###"),w("##"),w("#"),{begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:E}]},T={match:_Y(/`/,Mt,/`/)},N=[T,{className:"variable",match:/\$\d+/},{className:"variable",match:`\\$${Me}+`}],A=[{match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Mi,contains:[...p,m,v]}]}},{scope:"keyword",match:_Y(/@/,_X(...Mr),_K(_X(/\(/,/\s+/)))},{scope:"meta",match:_Y(/@/,Mt)}],S={match:_K(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:_Y(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Me,"+")},{className:"type",match:Mn,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:_Y(/\s+&\s+/,_K(Mn)),relevance:0}]},C={begin:/</,end:/>/,keywords:l,contains:[...r,...c,...A,u,S]};S.contains.push(C);let _={begin:/\(/,end:/\)/,relevance:0,keywords:l,contains:["self",{match:_Y(Mt,/\s*:/),keywords:"_|0",relevance:0},...r,k,...c,...d,...p,m,v,...N,...A,S]},M={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,S]},O={begin:/\(/,end:/\)/,keywords:l,contains:[{begin:_X(_K(_Y(Mt,/\s*:/)),_K(_Y(Mt,/\s+/,Mt,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Mt}]},...r,...c,...p,m,v,...A,S,_],endsParent:!0,illegal:/["']/},I={match:[/(func|macro)/,/\s+/,_X(T.match,Mt,_7)],className:{1:"keyword",3:"title.function"},contains:[M,O,t],illegal:[/\[/,/%/]},D={begin:[/precedencegroup/,/\s+/,Mn],className:{1:"keyword",3:"title"},contains:[S],keywords:[..._3,..._2],end:/}/},R={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Mt,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:l,contains:[M,...c,{begin:/:/,end:/\{/,keywords:l,contains:[{scope:"title.class.inherited",match:Mn},...c],relevance:0}]};for(let e of v.variants){let t=e.contains.find(e=>"interpol"===e.label);t.keywords=l;let n=[...c,...d,...p,m,v,...N];t.contains=[...n,{begin:/\(/,end:/\)/,contains:["self",...n]}]}return{name:"Swift",keywords:l,contains:[...r,I,{match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[M,O,t],illegal:/\[|%/},{match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},{match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},R,{match:[/operator/,/\s+/,_7],className:{1:"keyword",3:"title"}},D,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},k,...c,...d,...p,m,v,...N,...A,S,_]}},typescript:SE,vbnet:function(e){let t=e.regex,n=/\d{1,2}\/\d{1,2}\/\d{4}/,r=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,s={className:"literal",variants:[{begin:t.concat(/# */,t.either(r,n),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,i,/ *#/)},{begin:t.concat(/# */,t.either(r,n),/ +/,t.either(i,o),/ *#/)}]},a=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),l=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s,{className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{className:"label",begin:/^\w+:/},a,l,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[l]}]}},wasm:function(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"]},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},{className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}},xml:Sw,yaml:Sk},Ms=SN(Mo);function Ma(e){return Array.isArray(e)?e.join(""):e??""}let Ml=/\x1b\[[0-9;]*[A-Za-z]/g;function Mc(e){return e.replace(Ml,"")}function Md({output:e}){if("stream"===e.output_type){let t=Mc(Ma(e.text)),n="stderr"===e.name;return(0,X.jsx)("pre",{className:`whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md ${n?"bg-[rgba(139,46,62,0.06)] text-[#8B2E3E]":"bg-[#F5EEDC] text-[#2A221B]"}`,children:t})}if("error"===e.output_type){let t=e.traceback.map(Mc).join("\n");return(0,X.jsxs)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[rgba(139,46,62,0.08)] text-[#8B2E3E] border border-[rgba(139,46,62,0.18)]",children:[(0,X.jsxs)("span",{className:"font-semibold",children:[e.ename,": ",e.evalue]}),t?`
|
|
114
|
+
|
|
115
|
+
${t}`:""]})}let t=e.data||{};if(t["image/png"]){let e=`data:image/png;base64,${Ma(t["image/png"]).replace(/\s/g,"")}`;return(0,X.jsx)("img",{src:e,alt:"output",className:"max-w-full rounded-md bg-card p-2"})}if(t["image/jpeg"]){let e=`data:image/jpeg;base64,${Ma(t["image/jpeg"]).replace(/\s/g,"")}`;return(0,X.jsx)("img",{src:e,alt:"output",className:"max-w-full rounded-md bg-card p-2"})}if(t["image/svg+xml"]){let e=Ma(t["image/svg+xml"]);return(0,X.jsx)("div",{className:"max-w-full rounded-md bg-card p-2 overflow-auto",dangerouslySetInnerHTML:{__html:e}})}if(t["text/html"]){let e=Ma(t["text/html"]);return(0,X.jsx)("iframe",{srcDoc:`<!doctype html><html><head><base target="_blank"><style>body{margin:0;padding:8px;font-family:-apple-system,BlinkMacSystemFont,Inter,system-ui,sans-serif;background:#FFF9E9;color:#2A221B;font-size:13px}table{border-collapse:collapse}th,td{border:1px solid #D4C4B0;padding:4px 8px;text-align:left}thead{background:#EFE5CC}</style></head><body>${e}</body></html>`,sandbox:"allow-scripts",className:"w-full bg-[#FFF9E9] rounded-md border border-[#E8DDC5]",style:{height:360}})}return t["text/plain"]?(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[#F5EEDC] text-[#2A221B]",children:Mc(Ma(t["text/plain"]))}):null}function Mu({cell:e,language:t}){let n=Ma(e.source),r=(0,Q.useMemo)(()=>(function(e,t){try{let n=t?Ms.highlight(t,e):Ms.highlightAuto(e);return bh(n)}catch{return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}})(n,t),[n,t]),i=e.execution_count??" ",o=(e.outputs?.length??0)>0;return(0,X.jsxs)("div",{className:"grid grid-cols-[60px_1fr] gap-3 mb-5",children:[(0,X.jsxs)("div",{className:"text-right pt-3 select-none font-mono text-[11px] text-[#8B5E3C]",children:["In [",i,"]:"]}),(0,X.jsxs)("div",{children:[(0,X.jsx)("pre",{className:"whitespace-pre overflow-x-auto font-mono text-[13px] leading-relaxed px-4 py-3 rounded-md bg-[#FFF9E9] border border-[#E8DDC5] text-[#2A221B]",children:(0,X.jsx)("code",{dangerouslySetInnerHTML:{__html:r}})}),o&&(0,X.jsxs)("div",{className:"mt-2 grid grid-cols-[60px_1fr] gap-3",children:[(0,X.jsxs)("div",{className:"text-right pt-3 select-none font-mono text-[11px] text-[#8B2E3E]",children:["Out[",i,"]:"]}),(0,X.jsx)("div",{className:"space-y-2",children:e.outputs?.map((e,t)=>(0,X.jsx)(Md,{output:e},t))})]})]})]})}function Mp({cell:e}){let[t,n]=(0,Q.useState)("");return(0,Q.useEffect)(()=>{let t=!1;return vE(Ma(e.source)).then(e=>{t||n(e)}),()=>{t=!0}},[e.source]),(0,X.jsx)("div",{className:"prose prose-sm max-w-none mb-5 px-1 [&_h1]:font-serif [&_h2]:font-serif [&_h3]:font-serif [&_a]:text-[#8B5E3C] [&_a:hover]:underline [&_code]:bg-[#F5EEDC] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-[#8B2E3E]",dangerouslySetInnerHTML:{__html:t}})}function Mh({cell:e}){return(0,X.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[12.5px] leading-relaxed px-4 py-3 rounded-md bg-[#F5EEDC] text-[#2A221B] mb-5",children:Ma(e.source)})}function Mf({path:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[a,l]=(0,Q.useState)(!1),c=rz(`/api/assets/${e}`),d=e.split("/").pop()||e,u=(0,Q.useCallback)(async()=>{i(!0),s(null);try{let e=await r$(c);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();n(t)}catch(e){s(e instanceof Error?e.message:"Failed to load notebook")}finally{i(!1)}},[c]);(0,Q.useEffect)(()=>{u()},[u]);let p=t?.metadata?.language_info?.name||t?.metadata?.kernelspec?.name||"python",h=t?.cells?.length??0,f=t?.cells?.filter(e=>"code"===e.cell_type).length??0,m=t?.cells?.some(e=>"code"===e.cell_type&&(e.outputs?.length??0)>0)??!1;return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rG,{path:e,badge:"IPYNB",sublabel:`${h} cells \xb7 ${f} code \xb7 ${p}`,children:[(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{navigator.clipboard.writeText(`jupyter lab ${e}`),l(!0),setTimeout(()=>l(!1),2e3)},title:"Copy: jupyter lab <path>",children:[a?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_w,{className:"h-3.5 w-3.5"}),a?"Copied":"Copy run cmd"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=c,e.download=d,e.click()},children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(c,"_blank"),children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),"Raw JSON"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto bg-[#F5EEDC]",children:r?(0,X.jsx)("div",{className:"flex items-center justify-center h-full text-[#7A6B5D] text-sm",children:"Loading notebook…"}):o?(0,X.jsxs)("div",{className:"flex items-center justify-center h-full text-[#8B2E3E] text-sm gap-2",children:[(0,X.jsx)(er,{className:"h-4 w-4"})," ",o]}):t?(0,X.jsxs)("div",{className:"max-w-[1100px] mx-auto py-8 px-6",children:[!m&&f>0&&(0,X.jsxs)("div",{className:"mb-6 rounded-md border border-[#E8DDC5] bg-[#FFF9E9] px-4 py-3 text-[13px] text-[#7A6B5D]",children:[(0,X.jsx)("span",{className:"font-semibold text-[#0c0a09]",children:"This notebook hasn't been run yet."})," ","Code and markdown cells display below; outputs appear once the author runs the notebook in Jupyter (or you do, then re-save)."]}),t.cells?.map((e,t)=>"markdown"===e.cell_type?(0,X.jsx)(Mp,{cell:e},t):"raw"===e.cell_type?(0,X.jsx)(Mh,{cell:e},t):(0,X.jsx)(Mu,{cell:e,language:p},t))]}):null})]})}function Mm({path:e,extLabel:t,external:n,hideFinder:r}){let i=rz(`/api/assets/${e}`),o=e.split("/").pop()||e,s=async()=>{try{await r$("/api/system/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}catch{}};return(0,X.jsxs)(rG,{path:e,badge:t||void 0,children:[n&&(0,X.jsxs)("a",{href:n.href,target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-[11px] h-7 px-2.5 rounded-md border border-border hover:bg-accent transition-colors",children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),n.label]}),!r&&(0,X.jsxs)(tq,{variant:"outline",size:"sm",className:"gap-1.5 text-[11px] h-7",onClick:s,title:"Open in Finder",children:[(0,X.jsx)(eh,{className:"h-3.5 w-3.5"}),"Reveal"]}),!r&&(0,X.jsxs)(tq,{variant:"outline",size:"sm",className:"gap-1.5 text-[11px] h-7",onClick:()=>{let e=document.createElement("a");e.href=i,e.download=o,e.click()},title:"Download original",children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Download"]})]})}function Mg({path:t,title:n}){let r=(0,Q.useRef)(null),[i,o]=(0,Q.useState)(!0),[s,a]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{let n=!1,i=r.current;if(i)return i.innerHTML="",(async()=>{o(!0),a(null);try{let[{renderAsync:r},s]=await Promise.all([e.A(410052),r$(`/api/assets/${t}`)]);if(n)return;if(!s.ok)throw Error(`Failed to load file (${s.status})`);let a=await s.blob();if(n)return;await r(a,i,void 0,{className:"docx-rendered",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!1,breakPages:!0,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,experimental:!0,useBase64URL:!0}),n||o(!1)}catch(e){n||(a(e instanceof Error?e.message:"Failed to render document"),o(!1))}})(),()=>{n=!0}},[t]),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(Mm,{path:t,title:n,extLabel:"DOCX"}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto bg-muted/30",children:[i&&!s&&(0,X.jsxs)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin mr-2"}),"Rendering document…"]}),s&&(0,X.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,X.jsxs)("div",{className:"text-center space-y-2",children:[(0,X.jsx)("p",{className:"text-sm text-destructive",children:s}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),(0,X.jsx)("div",{ref:r,className:"docx-viewer-body mx-auto max-w-5xl py-6 px-4"})]})]})}function Mb({path:t,title:n}){let r=(0,Q.useRef)(null),[i,o]=(0,Q.useState)(!0),[s,a]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{let n=!1,i=r.current;if(!i)return;i.innerHTML="";let s=null;return(async()=>{o(!0),a(null);try{let[{init:r},a]=await Promise.all([e.A(355350),r$(`/api/assets/${t}`)]);if(n)return;if(!a.ok)throw Error(`Failed to load file (${a.status})`);let l=await a.arrayBuffer();if(n)return;let c=i.clientWidth||960,d=Math.round(9*c/16);s=r(i,{width:c,height:d,mode:"list"}),await s.preview(l),n||o(!1)}catch(e){n||(a(e instanceof Error?e.message:"Failed to render presentation"),o(!1))}})(),()=>{n=!0;try{s?.destroy?.()}catch{}}},[t]),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(Mm,{path:t,title:n,extLabel:"PPTX"}),(0,X.jsxs)("div",{className:"flex-1 overflow-auto bg-muted/30 py-4",children:[i&&!s&&(0,X.jsxs)("div",{className:"h-[60vh] flex items-center justify-center text-muted-foreground",children:[(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin mr-2"}),"Rendering slides…"]}),s&&(0,X.jsx)("div",{className:"h-[60vh] flex items-center justify-center",children:(0,X.jsxs)("div",{className:"text-center space-y-2",children:[(0,X.jsx)("p",{className:"text-sm text-destructive",children:s}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),(0,X.jsx)("div",{ref:r,className:"pptx-viewer-body mx-auto max-w-5xl px-4"})]})]})}function My({path:t,title:n}){let[r,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(0),[a,l]=(0,Q.useState)(!0),[c,d]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let n=!1;return l(!0),d(null),i(null),(async()=>{try{let[r,o]=await Promise.all([e.A(432302),r$(`/api/assets/${t}`)]);if(n)return;if(!o.ok)throw Error(`Failed to load file (${o.status})`);let a=await o.arrayBuffer();if(n)return;let c=r.read(a,{type:"array",cellDates:!0,cellStyles:!0}),d=c.SheetNames.map(e=>({name:e,html:r.utils.sheet_to_html(c.Sheets[e],{editable:!1})}));if(n)return;i(d),s(0),l(!1)}catch(e){n||(d(e instanceof Error?e.message:"Failed to parse spreadsheet"),l(!1))}})(),()=>{n=!0}},[t]);let u=(0,Q.useMemo)(()=>r?.[o]??null,[r,o]);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(Mm,{path:t,title:n,extLabel:"XLSX"}),r&&r.length>1&&(0,X.jsx)("div",{className:"flex items-center gap-0.5 border-b border-border bg-muted/40 px-2 overflow-x-auto scrollbar-none",children:r.map((e,t)=>(0,X.jsx)("button",{type:"button",onClick:()=>s(t),className:t$("px-3 py-1.5 text-[12px] rounded-t whitespace-nowrap transition-colors",t===o?"bg-background text-foreground font-medium border-t border-x border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:e.name},e.name+t))}),(0,X.jsxs)("div",{className:"flex-1 overflow-auto",children:[a&&!c&&(0,X.jsxs)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin mr-2"}),"Parsing spreadsheet…"]}),c&&(0,X.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,X.jsxs)("div",{className:"text-center space-y-2",children:[(0,X.jsx)("p",{className:"text-sm text-destructive",children:c}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Try downloading the file and opening it externally."})]})}),u&&(0,X.jsx)("div",{className:"xlsx-sheet p-3 text-[12px]",dangerouslySetInnerHTML:{__html:u.html}})]})]})}function Mx({path:e,title:t}){let n=rz(`/api/assets/${e}`);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(rG,{path:e,badge:"PDF",children:(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(n,"_blank"),children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),"Open in new tab"]})}),(0,X.jsx)("iframe",{src:n,className:"flex-1 w-full border-0",title:t})]})}let Mv=en("wrap-text",[["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["path",{d:"M3 18h7",key:"sq21v6"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]),ME=SN(Mo),Mw={".js":"javascript",".cjs":"javascript",".mjs":"javascript",".ts":"typescript",".tsx":"typescript",".jsx":"javascript",".py":"python",".rb":"ruby",".php":"php",".sh":"bash",".bash":"bash",".zsh":"bash",".ps1":"powershell",".css":"css",".scss":"scss",".html":"xml",".json":"json",".jsonc":"json",".yaml":"yaml",".yml":"yaml",".toml":"ini",".ini":"ini",".xml":"xml",".sql":"sql",".graphql":"graphql",".gql":"graphql",".go":"go",".rs":"rust",".swift":"swift",".java":"java",".kt":"kotlin",".kts":"kotlin",".c":"c",".cpp":"cpp",".h":"c",".env":"bash",".txt":"",".text":"",".log":"",".rst":"",".mdx":"markdown"};function Mk({path:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(!1),[a,l]=(0,Q.useState)(!1),c=rz(`/api/assets/${e}`),d=e.split("/").pop()||e,u=Mw[d.includes(".")?`.${d.split(".").pop()?.toLowerCase()}`:""]??"",p=(0,Q.useCallback)(async()=>{i(!0);try{let e=await r$(c);if(e.ok){let t=await e.text();n(t)}}catch{}finally{i(!1)}},[c]);(0,Q.useEffect)(()=>{p()},[p]);let h=(0,Q.useMemo)(()=>{if(!t)return[];try{let e=u?ME.highlight(u,t):ME.highlightAuto(t);return bh(e).split("\n")}catch{return t.split("\n").map(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"))}},[t,u]);return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rG,{path:e,badge:d.includes(".")?d.split(".").pop()?.toUpperCase()??"TEXT":"TEXT",sublabel:u||void 0,children:[(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:`h-7 gap-1.5 text-xs ${o?"bg-muted":""}`,onClick:()=>s(e=>!e),title:o?"Disable line wrap":"Enable line wrap",children:[(0,X.jsx)(Mv,{className:"h-3.5 w-3.5"}),"Wrap"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{t&&(navigator.clipboard.writeText(t),l(!0),setTimeout(()=>l(!1),2e3))},title:"Copy file contents",children:[a?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_w,{className:"h-3.5 w-3.5"}),a?"Copied":"Copy"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{let e=document.createElement("a");e.href=c,e.download=d,e.click()},title:"Download file",children:[(0,X.jsx)(el,{className:"h-3.5 w-3.5"}),"Download"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(c,"_blank"),children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),"Raw"]})]}),(0,X.jsx)("div",{className:"flex-1 overflow-auto source-viewer-code bg-[#1e1e1e]",children:r?(0,X.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):(0,X.jsx)("table",{className:"w-full border-collapse text-[13px] leading-relaxed font-mono",children:(0,X.jsx)("tbody",{children:h.map((e,t)=>(0,X.jsxs)("tr",{className:"hover:bg-white/5",children:[(0,X.jsx)("td",{className:"w-12 pr-4 text-right text-[#858585] select-none align-top sticky left-0 bg-[#1e1e1e]",children:t+1}),(0,X.jsx)("td",{className:`text-[#d4d4d4] pl-2 ${o?"whitespace-pre-wrap break-all":"whitespace-pre"}`,dangerouslySetInnerHTML:{__html:e||" "}})]},t))})})})]})}function MT({path:e,title:t,src:n,fullscreen:r,onExit:i}){let o=rz(n??`/api/assets/${e}/index.html`),s=r&&i?(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:i,title:"Exit app",children:[(0,X.jsx)(C4,{className:"h-3.5 w-3.5"}),"Exit app"]}):null;return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsx)(rG,{path:e,badge:r?"App":void 0,showBreadcrumb:!r,leading:r?(0,X.jsxs)(X.Fragment,{children:[s,(0,X.jsx)("span",{className:"truncate text-[13px] font-medium text-foreground",children:t})]}):null,children:(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(o,"_blank"),children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),"Open in new tab"]})}),(0,X.jsx)("iframe",{src:o,className:"flex-1 w-full border-0 bg-card",title:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation-by-user-activation"})]})}let MN=en("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),MA=en("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),MS={stopped:"Stopped",installing:"Installing dependencies…",starting:"Starting…",running:"Running",error:"Error"};function MC({path:e,title:t}){let[n,r]=(0,Q.useState)("stopped"),[i,o]=(0,Q.useState)(null),[s,a]=(0,Q.useState)([]),[l,c]=(0,Q.useState)(null),[d,u]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(0),f=(0,Q.useRef)(null),m=(0,Q.useRef)(null),g=`/api/app-proxy/${e}/`,b=()=>{f.current&&(clearInterval(f.current),f.current=null)},y=(0,Q.useCallback)(async()=>{try{let t=await r$(`/api/wiki/app?path=${encodeURIComponent(e)}`);if(!t.ok)return;let n=await t.json();r(n.status),a(n.logs??[]),n.port&&o(n.port),n.error&&c(n.error),("running"===n.status||"stopped"===n.status||"error"===n.status)&&b()}catch{}},[e]);(0,Q.useEffect)(()=>("installing"===n||"starting"===n?f.current||(f.current=setInterval(y,800)):b(),b),[n,y]),(0,Q.useEffect)(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[s]),(0,Q.useEffect)(()=>{y()},[y]);let x=async()=>{c(null),a([]),r("starting");try{let t=await r$("/api/wiki/app",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await t.json();if(!t.ok||n.error){r("error"),c(n.error??"Failed to start");return}n.port&&o(n.port),await y()}catch(e){r("error"),c(String(e))}},v=async()=>{await r$("/api/wiki/app",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),r("stopped"),o(null)},E=async()=>{await v(),await x(),h(e=>e+1)};return(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,X.jsxs)(rG,{path:e,badge:"Node app",children:["running"===n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>h(e=>e+1),children:[(0,X.jsx)(ek,{className:"h-3.5 w-3.5"}),"Refresh"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>window.open(g,"_blank"),children:[(0,X.jsx)(kl,{className:"h-3.5 w-3.5"}),"Open in new tab"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:E,children:[(0,X.jsx)(ek,{className:"h-3.5 w-3.5"}),"Restart"]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs text-destructive hover:text-destructive",onClick:v,children:[(0,X.jsx)(MA,{className:"h-3.5 w-3.5"}),"Stop"]})]}),(0,X.jsxs)(tq,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>u(e=>!e),children:[(0,X.jsx)(eN,{className:"h-3.5 w-3.5"}),"Logs"]})]}),d&&(0,X.jsxs)("div",{className:"border-b bg-black/90 text-green-400 font-mono text-xs h-40 overflow-auto p-2 shrink-0",children:[0===s.length?(0,X.jsx)("span",{className:"text-muted-foreground",children:"No output yet."}):s.map((e,t)=>(0,X.jsx)("div",{className:"whitespace-pre-wrap leading-5",children:e},t)),(0,X.jsx)("div",{ref:m})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:["stopped"===n&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4",children:[(0,X.jsxs)("div",{className:"text-center space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:t}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Node.js app — will be started on a local port"})]}),(0,X.jsxs)(tq,{onClick:x,className:"gap-2",children:[(0,X.jsx)(MN,{className:"h-4 w-4"}),"Launch app"]})]}),("installing"===n||"starting"===n)&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",children:[(0,X.jsx)(eb,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:MS[n]}),i&&(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60",children:["port ",i]})]}),"error"===n&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-6",children:[(0,X.jsx)(er,{className:"h-8 w-8 text-destructive"}),(0,X.jsxs)("div",{className:"text-center space-y-1 max-w-md",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-destructive",children:"Failed to start app"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:l??"Unknown error"})]}),(0,X.jsxs)(tq,{onClick:x,variant:"outline",className:"gap-2",children:[(0,X.jsx)(ek,{className:"h-4 w-4"}),"Try again"]})]}),"running"===n&&(0,X.jsx)("iframe",{src:g,className:"flex-1 w-full border-0 bg-card",title:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-top-navigation-by-user-activation"},p)]})]})}let M_=en("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),MM=en("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),MO=en("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),MI=en("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);function MD({onSelect:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),[a,l]=(0,Q.useState)(""),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)([]),[h,f]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),g=(0,Q.useRef)(null),b=(0,Q.useCallback)(async(e,t=!0)=>{g.current&&(clearTimeout(g.current),g.current=null),i(!0),s(null);try{let r=await fetch(`/api/system/browse?path=${encodeURIComponent(e)}`);if(!r.ok){let e=await r.json();s(e.error??"Cannot open directory");return}let i=await r.json();n(i),t&&l(i.path)}catch{s("Network error")}finally{i(!1)}},[]);(0,Q.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/system/config");if(t.ok&&!e){let e=await t.json();p(e.pinnedPaths??[]),await b(e.lastOpenedPath??"");return}}catch{}e||await b("")})(),()=>{e=!0}},[]);let y=async n=>{let r=n??t?.path;if(r){d(!0);try{let t=await fetch("/api/system/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rootDir:r})});if(!t.ok){let e=await t.json();s(e.message??e.error??"Cannot use that directory");return}let{workspace:n}=await t.json();e(n.id)}catch{s("Network error")}finally{d(!1)}}},x=!!t&&u.includes(t.path),v=async()=>{if(t){f(!0);try{let e=x?"unpin":"pin";(await fetch("/api/system/pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,action:e})})).ok&&p(n=>"pin"===e?[...n,t.path]:n.filter(e=>e!==t.path))}catch{}finally{f(!1)}}},E=async e=>{try{(await fetch("/api/system/pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,action:"unpin"})})).ok&&p(t=>t.filter(t=>t!==e))}catch{}},w=(t?.path??"").split(/[/\\]/).filter(Boolean).reduce((e,t)=>{let n=e[e.length-1]?.path??"/";return e.push({label:t,path:`${"/"===n?"":n}/${t}`}),e},[{label:"/",path:"/"}]);return(0,X.jsx)("div",{className:"flex flex-1 items-center justify-center bg-background p-4",children:(0,X.jsxs)("div",{className:"flex w-full max-w-xl flex-col gap-4",children:[(0,X.jsxs)("div",{className:"text-center space-y-1",children:[(0,X.jsxs)("div",{className:"flex items-center justify-center gap-2 mb-1",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-8 w-8"}),(0,X.jsx)("span",{className:"text-xl font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)("h1",{className:"text-xl font-medium",children:"Choose a directory"}),(0,X.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Select the folder wiki-viewer should serve.",(0,X.jsx)("br",{}),"This directory lives on the server — use the browser below."]})]}),(0,X.jsxs)("div",{className:"rounded-lg border bg-card shadow-sm overflow-hidden",children:[(0,X.jsx)("div",{className:"flex items-center gap-2 border-b px-3 py-2 bg-muted",children:(0,X.jsx)("input",{ref:m,className:"flex-1 bg-transparent text-sm outline-none font-mono min-w-0",value:a,onChange:e=>{let t=e.target.value;l(t),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,b(t.trim(),!1)},500)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g.current&&(clearTimeout(g.current),g.current=null),b(a.trim())),"Escape"===e.key&&(g.current&&(clearTimeout(g.current),g.current=null),l(t?.path??""),m.current?.blur())},spellCheck:!1,placeholder:"Enter a path…"})}),(0,X.jsx)("div",{className:"flex items-center gap-1 border-b px-3 py-1.5 bg-muted/50 overflow-x-auto shrink-0 min-h-[32px]",children:w.map((e,t)=>(0,X.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[t>0&&(0,X.jsx)(ea,{className:"h-3 w-3 text-muted-foreground/50"}),(0,X.jsx)("button",{type:"button",className:"text-xs hover:text-foreground text-muted-foreground transition-colors rounded px-0.5",onClick:()=>b(e.path),children:0===t?(0,X.jsx)(M_,{className:"h-3.5 w-3.5"}):e.label})]},e.path))}),(0,X.jsx)("div",{className:"max-h-60 overflow-y-auto",children:r?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):o?(0,X.jsx)("div",{className:"px-4 py-3 text-sm text-destructive",children:o}):(0,X.jsxs)(X.Fragment,{children:[t?.parent&&(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>b(t.parent),children:[(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0"}),(0,X.jsx)("span",{className:"font-mono text-xs",children:".."})]}),t?.entries.length===0&&(0,X.jsx)("p",{className:"px-4 py-3 text-sm text-muted-foreground/60",children:"No subdirectories"}),t?.entries.map(e=>(0,X.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>b(e.path),children:[(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("span",{className:"truncate",children:e.name})]},e.path))]})}),(0,X.jsxs)("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 bg-muted",children:[(0,X.jsxs)("button",{type:"button",className:t$("flex items-center gap-1.5 text-xs transition-colors rounded px-1.5 py-1",x?"text-foreground hover:text-destructive":"text-muted-foreground hover:text-foreground"),title:x?"Unpin this path":"Pin this path for quick access",onClick:v,disabled:h||!t,children:[h?(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}):x?(0,X.jsx)(MI,{className:"h-3.5 w-3.5"}):(0,X.jsx)(MO,{className:"h-3.5 w-3.5"}),x?"Unpin":"Pin"]}),(0,X.jsxs)(tq,{size:"sm",className:"shrink-0 gap-1.5",disabled:!t||c,onClick:()=>y(),children:[c?(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eh,{className:"h-3.5 w-3.5"}),"Select"]})]})]}),u.length>0&&(0,X.jsxs)("div",{className:"rounded-lg border bg-card shadow-sm overflow-hidden",children:[(0,X.jsx)("div",{className:"px-3 py-2 border-b bg-muted",children:(0,X.jsxs)("span",{className:"text-xs font-medium text-muted-foreground flex items-center gap-1.5",children:[(0,X.jsx)(MO,{className:"h-3 w-3"})," Pinned"]})}),(0,X.jsx)("div",{className:"max-h-40 overflow-y-auto",children:u.map(e=>(0,X.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-accent group",children:[(0,X.jsxs)("button",{type:"button",className:"flex-1 flex items-center gap-2 text-sm text-left min-w-0",onClick:()=>b(e),children:[(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("span",{className:"truncate font-mono text-xs",children:e})]}),(0,X.jsx)("button",{type:"button",className:"shrink-0 text-muted-foreground/50 hover:text-destructive opacity-0 group-hover:opacity-100 transition-all",onClick:()=>E(e),title:"Remove pin",children:(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})})]},e))})]}),t?.shortcuts&&t.shortcuts.length>0&&(0,X.jsx)("div",{className:"flex flex-wrap gap-1.5 justify-center",children:t.shortcuts.map(e=>(0,X.jsxs)(tq,{variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>b(e.path),children:["Home"===e.label?(0,X.jsx)(MM,{className:"h-3 w-3"}):(0,X.jsx)(M_,{className:"h-3 w-3"}),e.label]},e.path))})]})})}function MR(e){let t=e+"CollectionProvider",[n,r]=tW(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,r=Q.default.useRef(null),o=Q.default.useRef(new Map).current;return(0,X.jsx)(i,{scope:t,itemMap:o,collectionRef:r,children:n})};s.displayName=t;let a=e+"CollectionSlot",l=t1(a),c=Q.default.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=eO(t,o(a,n).collectionRef);return(0,X.jsx)(l,{ref:i,children:r})});c.displayName=a;let d=e+"CollectionItemSlot",u="data-radix-collection-item",p=t1(d),h=Q.default.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,s=Q.default.useRef(null),a=eO(t,s),l=o(d,n);return Q.default.useEffect(()=>(l.itemMap.set(s,{ref:s,...i}),()=>void l.itemMap.delete(s))),(0,X.jsx)(p,{...{[u]:""},ref:a,children:r})});return h.displayName=d,[{Provider:s,Slot:c,ItemSlot:h},function(t){let n=o(e+"CollectionConsumer",t);return Q.default.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},r]}var ML=new WeakMap;function MP(e,t){var n,r;let i,o,s;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(n=e,r=t,i=n.length,(s=(o=Mj(r))>=0?o:i+o)<0||s>=i?-1:s);return -1===a?void 0:e[a]}function Mj(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],ML.set(this,!0)}set(e,t){return ML.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r,i=this.has(t),o=this.#e.length,s=Mj(e),a=s>=0?s:o+s,l=a<0||a>=o?-1:a;if(l===this.size||i&&l===this.size-1||-1===l)return this.set(t,n),this;let c=this.size+ +!i;s<0&&a++;let d=[...this.#e],u=!1;for(let e=a;e<c;e++)if(a===e){let o=d[e];d[e]===t&&(o=d[e+1]),i&&this.delete(t),r=this.get(o),this.set(t,n)}else{u||d[e-1]!==t||(u=!0);let n=d[u?e:e-1],i=r;r=this.get(n),this.delete(n),this.set(n,i)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=MP(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=MP(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return MP(this.#e,e)}from(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return -1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=0===r&&1===e.length?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&1===e.length?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(void 0===t)return r;t<0&&(t+=this.size),void 0!==n&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}});var MB=Q.createContext(void 0);function MF(e){let t=Q.useContext(MB);return e||t||"ltr"}var MH="rovingFocusGroup.onEntryFocus",MU={bubbles:!1,cancelable:!0},Mz="RovingFocusGroup",[M$,MG,Mq]=MR(Mz),[MV,MW]=tW(Mz,[Mq]),[MK,MY]=MV(Mz),MX=Q.forwardRef((e,t)=>(0,X.jsx)(M$.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(M$.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,X.jsx)(MQ,{...e,ref:t})})}));MX.displayName=Mz;var MQ=Q.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,p=Q.useRef(null),h=eO(t,p),f=MF(o),[m,g]=tZ({prop:s,defaultProp:a??null,onChange:l,caller:Mz}),[b,y]=Q.useState(!1),x=t6(c),v=MG(n),E=Q.useRef(!1),[w,k]=Q.useState(0);return Q.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(MH,x),()=>e.removeEventListener(MH,x)},[x]),(0,X.jsx)(MK,{scope:n,orientation:r,dir:f,loop:i,currentTabStopId:m,onItemFocus:Q.useCallback(e=>g(e),[g]),onItemShiftTab:Q.useCallback(()=>y(!0),[]),onFocusableItemAdd:Q.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:Q.useCallback(()=>k(e=>e-1),[]),children:(0,X.jsx)(t5.div,{tabIndex:b||0===w?-1:0,"data-orientation":r,...u,ref:h,style:{outline:"none",...e.style},onMouseDown:tV(e.onMouseDown,()=>{E.current=!0}),onFocus:tV(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!b){let t=new CustomEvent(MH,MU);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=v().filter(e=>e.focusable);M1([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),d)}}E.current=!1}),onBlur:tV(e.onBlur,()=>y(!1))})})}),MJ="RovingFocusGroupItem",MZ=Q.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=tQ(),c=o||l,d=MY(MJ,n),u=d.currentTabStopId===c,p=MG(n),{onFocusableItemAdd:h,onFocusableItemRemove:f,currentTabStopId:m}=d;return Q.useEffect(()=>{if(r)return h(),()=>f()},[r,h,f]),(0,X.jsx)(M$.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:(0,X.jsx)(t5.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:tV(e.onMouseDown,e=>{r?d.onItemFocus(c):e.preventDefault()}),onFocus:tV(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:tV(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,n){var r;let i=(r=e.key,"rtl"!==n?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return M0[i]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=p().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var n,r;"prev"===t&&i.reverse();let o=i.indexOf(e.currentTarget);i=d.loop?(n=i,r=o+1,n.map((e,t)=>n[(r+t)%n.length])):i.slice(o+1)}setTimeout(()=>M1(i))}}),children:"function"==typeof s?s({isCurrentTabStop:u,hasTabStop:null!=m}):s})})});MZ.displayName=MJ;var M0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function M1(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}var M2=["Enter"," "],M3=["ArrowUp","PageDown","End"],M5=["ArrowDown","PageUp","Home",...M3],M4={ltr:[...M2,"ArrowRight"],rtl:[...M2,"ArrowLeft"]},M6={ltr:["ArrowLeft"],rtl:["ArrowRight"]},M9="Menu",[M7,M8,Oe]=MR(M9),[Ot,On]=tW(M9,[Oe,Ci,MW]),Or=Ci(),Oi=MW(),[Oo,Os]=Ot(M9),[Oa,Ol]=Ot(M9),Oc=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=e,a=Or(t),[l,c]=Q.useState(null),d=Q.useRef(!1),u=t6(o),p=MF(i);return Q.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,X.jsx)(Ca,{...a,children:(0,X.jsx)(Oo,{scope:t,open:n,onOpenChange:u,content:l,onContentChange:c,children:(0,X.jsx)(Oa,{scope:t,onClose:Q.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:p,modal:s,children:r})})})};Oc.displayName=M9;var Od=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Or(n);return(0,X.jsx)(Cc,{...i,...r,ref:t})});Od.displayName="MenuAnchor";var Ou="MenuPortal",[Op,Oh]=Ot(Ou,{forceMount:void 0}),Of=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=Os(Ou,t);return(0,X.jsx)(Op,{scope:t,forceMount:n,children:(0,X.jsx)(np,{present:n||o.open,children:(0,X.jsx)(nu,{asChild:!0,container:i,children:r})})})};Of.displayName=Ou;var Om="MenuContent",[Og,Ob]=Ot(Om),Oy=Q.forwardRef((e,t)=>{let n=Oh(Om,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Os(Om,e.__scopeMenu),s=Ol(Om,e.__scopeMenu);return(0,X.jsx)(M7.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(np,{present:r||o.open,children:(0,X.jsx)(M7.Slot,{scope:e.__scopeMenu,children:s.modal?(0,X.jsx)(Ox,{...i,ref:t}):(0,X.jsx)(Ov,{...i,ref:t})})})})}),Ox=Q.forwardRef((e,t)=>{let n=Os(Om,e.__scopeMenu),r=Q.useRef(null),i=eO(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return n9(e)},[]),(0,X.jsx)(Ow,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:tV(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ov=Q.forwardRef((e,t)=>{let n=Os(Om,e.__scopeMenu);return(0,X.jsx)(Ow,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),OE=t1("MenuContent.ScrollLock"),Ow=Q.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:p,onDismiss:h,disableOutsideScroll:f,...m}=e,g=Os(Om,n),b=Ol(Om,n),y=Or(n),x=Oi(n),v=M8(n),[E,w]=Q.useState(null),k=Q.useRef(null),T=eO(t,k,g.onContentChange),N=Q.useRef(0),A=Q.useRef(""),S=Q.useRef(0),C=Q.useRef(null),_=Q.useRef("right"),M=Q.useRef(0),O=f?n0:Q.Fragment;Q.useEffect(()=>()=>window.clearTimeout(N.current),[]),nm();let I=Q.useCallback(e=>{var t,n;return _.current===C.current?.side&&(t=e,!!(n=C.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],a=t[o],l=s.x,c=s.y,d=a.x,u=a.y;c>r!=u>r&&n<(d-l)*(r-c)/(u-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,X.jsx)(Og,{scope:n,searchRef:A,onItemEnter:Q.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:Q.useCallback(e=>{I(e)||(k.current?.focus(),w(null))},[I]),onTriggerLeave:Q.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:S,onPointerGraceIntentChange:Q.useCallback(e=>{C.current=e},[]),children:(0,X.jsx)(O,{...f?{as:OE,allowPinchZoom:!0}:void 0,children:(0,X.jsx)(no,{asChild:!0,trapped:i,onMountAutoFocus:tV(o,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,X.jsx)(t8,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:p,onDismiss:h,children:(0,X.jsx)(MX,{asChild:!0,...x,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:w,onEntryFocus:tV(l,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,X.jsx)(Ch,{role:"menu","aria-orientation":"vertical","data-state":OK(g.open),"data-radix-menu-content":"",dir:b.dir,...y,...m,ref:T,style:{outline:"none",...m.style},onKeyDown:tV(m.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,o,s,a,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=A.current+i,o=v().filter(e=>!e.disabled),s=document.activeElement,a=o.find(e=>e.ref.current===s)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,s=(r=Math.max(o,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(s=s.filter(e=>e!==n));let a=s.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}(o.map(e=>e.textValue),t,a),c=o.find(e=>e.textValue===l)?.ref.current,function e(t){A.current=t,window.clearTimeout(N.current),""!==t&&(N.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let o=k.current;if(e.target!==o||!M5.includes(e.key))return;e.preventDefault();let s=v().filter(e=>!e.disabled).map(e=>e.ref.current);M3.includes(e.key)&&s.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(s)}),onBlur:tV(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),A.current="")}),onPointerMove:tV(e.onPointerMove,OQ(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(_.current=e.clientX>M.current?"right":"left",M.current=e.clientX)}))})})})})})})});Oy.displayName=Om;var Ok=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(t5.div,{role:"group",...r,ref:t})});Ok.displayName="MenuGroup";var OT=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(t5.div,{...r,ref:t})});OT.displayName="MenuLabel";var ON="MenuItem",OA="menu.itemSelect",OS=Q.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,o=Q.useRef(null),s=Ol(ON,e.__scopeMenu),a=Ob(ON,e.__scopeMenu),l=eO(t,o),c=Q.useRef(!1);return(0,X.jsx)(OC,{...i,ref:l,disabled:n,onClick:tV(e.onClick,()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(OA,{bubbles:!0,cancelable:!0});e.addEventListener(OA,e=>r?.(e),{once:!0}),t4(e,t),t.defaultPrevented?c.current=!1:s.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:tV(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:tV(e.onKeyDown,e=>{let t=""!==a.searchRef.current;n||t&&" "===e.key||M2.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});OS.displayName=ON;var OC=Q.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=Ob(ON,n),a=Oi(n),l=Q.useRef(null),c=eO(t,l),[d,u]=Q.useState(!1),[p,h]=Q.useState("");return Q.useEffect(()=>{let e=l.current;e&&h((e.textContent??"").trim())},[o.children]),(0,X.jsx)(M7.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,X.jsx)(MZ,{asChild:!0,...a,focusable:!r,children:(0,X.jsx)(t5.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:c,onPointerMove:tV(e.onPointerMove,OQ(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tV(e.onPointerLeave,OQ(e=>s.onItemLeave(e))),onFocus:tV(e.onFocus,()=>u(!0)),onBlur:tV(e.onBlur,()=>u(!1))})})})}),O_=Q.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,X.jsx)(Oj,{scope:e.__scopeMenu,checked:n,children:(0,X.jsx)(OS,{role:"menuitemcheckbox","aria-checked":OY(n)?"mixed":n,...i,ref:t,"data-state":OX(n),onSelect:tV(i.onSelect,()=>r?.(!!OY(n)||!n),{checkForDefaultPrevented:!1})})})});O_.displayName="MenuCheckboxItem";var OM="MenuRadioGroup",[OO,OI]=Ot(OM,{value:void 0,onValueChange:()=>{}}),OD=Q.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,o=t6(r);return(0,X.jsx)(OO,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,X.jsx)(Ok,{...i,ref:t})})});OD.displayName=OM;var OR="MenuRadioItem",OL=Q.forwardRef((e,t)=>{let{value:n,...r}=e,i=OI(OR,e.__scopeMenu),o=n===i.value;return(0,X.jsx)(Oj,{scope:e.__scopeMenu,checked:o,children:(0,X.jsx)(OS,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":OX(o),onSelect:tV(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});OL.displayName=OR;var OP="MenuItemIndicator",[Oj,OB]=Ot(OP,{checked:!1}),OF=Q.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,o=OB(OP,n);return(0,X.jsx)(np,{present:r||OY(o.checked)||!0===o.checked,children:(0,X.jsx)(t5.span,{...i,ref:t,"data-state":OX(o.checked)})})});OF.displayName=OP;var OH=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,X.jsx)(t5.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});OH.displayName="MenuSeparator";var OU=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Or(n);return(0,X.jsx)(Cg,{...i,...r,ref:t})});OU.displayName="MenuArrow";var[Oz,O$]=Ot("MenuSub"),OG="MenuSubTrigger",Oq=Q.forwardRef((e,t)=>{let n=Os(OG,e.__scopeMenu),r=Ol(OG,e.__scopeMenu),i=O$(OG,e.__scopeMenu),o=Ob(OG,e.__scopeMenu),s=Q.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},d=Q.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return Q.useEffect(()=>d,[d]),Q.useEffect(()=>{let e=a.current;return()=>{window.clearTimeout(e),l(null)}},[a,l]),(0,X.jsx)(Od,{asChild:!0,...c,children:(0,X.jsx)(OC,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":OK(n.open),...e,ref:eM(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:tV(e.onPointerMove,OQ(t=>{o.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||s.current||(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100)))})),onPointerLeave:tV(e.onPointerLeave,OQ(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,s=t[i?"left":"right"],l=t[i?"right":"left"];o.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:tV(e.onKeyDown,t=>{let i=""!==o.searchRef.current;e.disabled||i&&" "===t.key||M4[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Oq.displayName=OG;var OV="MenuSubContent",OW=Q.forwardRef((e,t)=>{let n=Oh(Om,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Os(Om,e.__scopeMenu),s=Ol(Om,e.__scopeMenu),a=O$(OV,e.__scopeMenu),l=Q.useRef(null),c=eO(t,l);return(0,X.jsx)(M7.Provider,{scope:e.__scopeMenu,children:(0,X.jsx)(np,{present:r||o.open,children:(0,X.jsx)(M7.Slot,{scope:e.__scopeMenu,children:(0,X.jsx)(Ow,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:"rtl"===s.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:tV(e.onFocusOutside,e=>{e.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:tV(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:tV(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=M6[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),a.trigger?.focus(),e.preventDefault())})})})})})});function OK(e){return e?"open":"closed"}function OY(e){return"indeterminate"===e}function OX(e){return OY(e)?"indeterminate":e?"checked":"unchecked"}function OQ(e){return t=>"mouse"===t.pointerType?e(t):void 0}OW.displayName=OV;var OJ="DropdownMenu",[OZ,O0]=tW(OJ,[On]),O1=On(),[O2,O3]=OZ(OJ),O5=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=O1(t),c=Q.useRef(null),[d,u]=tZ({prop:i,defaultProp:o??!1,onChange:s,caller:OJ});return(0,X.jsx)(O2,{scope:t,triggerId:tQ(),triggerRef:c,contentId:tQ(),open:d,onOpenChange:u,onOpenToggle:Q.useCallback(()=>u(e=>!e),[u]),modal:a,children:(0,X.jsx)(Oc,{...l,open:d,onOpenChange:u,dir:r,modal:a,children:n})})};O5.displayName=OJ;var O4="DropdownMenuTrigger",O6=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=O3(O4,n),s=O1(n);return(0,X.jsx)(Od,{asChild:!0,...s,children:(0,X.jsx)(t5.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:eM(t,o.triggerRef),onPointerDown:tV(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:tV(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});O6.displayName=O4;var O9=e=>{let{__scopeDropdownMenu:t,...n}=e,r=O1(t);return(0,X.jsx)(Of,{...r,...n})};O9.displayName="DropdownMenuPortal";var O7="DropdownMenuContent",O8=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O3(O7,n),o=O1(n),s=Q.useRef(!1);return(0,X.jsx)(Oy,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:tV(e.onCloseAutoFocus,e=>{s.current||i.triggerRef.current?.focus(),s.current=!1,e.preventDefault()}),onInteractOutside:tV(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});O8.displayName=O7,Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(Ok,{...i,...r,ref:t})}).displayName="DropdownMenuGroup";var Ie=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OT,{...i,...r,ref:t})});Ie.displayName="DropdownMenuLabel";var It=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OS,{...i,...r,ref:t})});It.displayName="DropdownMenuItem";var In=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(O_,{...i,...r,ref:t})});In.displayName="DropdownMenuCheckboxItem",Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OD,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup";var Ir=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OL,{...i,...r,ref:t})});Ir.displayName="DropdownMenuRadioItem";var Ii=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OF,{...i,...r,ref:t})});Ii.displayName="DropdownMenuItemIndicator";var Io=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OH,{...i,...r,ref:t})});Io.displayName="DropdownMenuSeparator",Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OU,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var Is=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(Oq,{...i,...r,ref:t})});Is.displayName="DropdownMenuSubTrigger";var Ia=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=O1(n);return(0,X.jsx)(OW,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ia.displayName="DropdownMenuSubContent";let Il=en("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);Q.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,X.jsxs)(Is,{ref:i,className:t$("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,(0,X.jsx)(ea,{className:"ml-auto h-4 w-4"})]})).displayName=Is.displayName,Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Ia,{ref:n,className:t$("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})).displayName=Ia.displayName;let Ic=Q.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,X.jsx)(O9,{children:(0,X.jsx)(O8,{ref:r,sideOffset:t,className:t$("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ic.displayName=O8.displayName;let Id=Q.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(It,{ref:r,className:t$("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Id.displayName=It.displayName,Q.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,X.jsxs)(In,{ref:i,className:t$("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[(0,X.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,X.jsx)(Ii,{children:(0,X.jsx)(eo,{className:"h-4 w-4"})})}),t]})).displayName=In.displayName,Q.forwardRef(({className:e,children:t,...n},r)=>(0,X.jsxs)(Ir,{ref:r,className:t$("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,X.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,X.jsx)(Ii,{children:(0,X.jsx)(Il,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=Ir.displayName,Q.forwardRef(({className:e,inset:t,...n},r)=>(0,X.jsx)(Ie,{ref:r,className:t$("px-2 py-1.5 text-sm font-normal",t&&"pl-8",e),...n})).displayName=Ie.displayName;let Iu=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Io,{ref:n,className:t$("-mx-1 my-1 h-px bg-muted",e),...t}));Iu.displayName=Io.displayName;let Ip=en("moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),Ih=en("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var If=e.i(917356);function Im({className:e}){let{resolvedTheme:t,setTheme:n}=(0,If.useTheme)();return(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:"dark"===t?"Switch to light":"Switch to dark",onClick:()=>n("dark"===t?"light":"dark"),children:"dark"===t?(0,X.jsx)(Ih,{className:"h-3.5 w-3.5"}):(0,X.jsx)(Ip,{className:"h-3.5 w-3.5"})})}let Ig=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rd,{ref:n,className:t$("fixed inset-0 z-40 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Ig.displayName="SheetOverlay";let Ib={bottom:"inset-x-0 bottom-0 data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom",top:"inset-x-0 top-0 data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top",left:"inset-y-0 left-0 data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left",right:"inset-y-0 right-0 data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right"},Iy=Q.forwardRef(({side:e="bottom",showClose:t=!1,className:n,children:r,...i},o)=>(0,X.jsxs)(rl,{children:[(0,X.jsx)(Ig,{}),(0,X.jsxs)(rf,{ref:o,className:t$("fixed z-50 bg-background shadow-golden transition-all ease-in-out","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",Ib[e],n),...i,children:[r,t&&(0,X.jsxs)(rk,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none",children:[(0,X.jsx)(eC,{className:"h-4 w-4"}),(0,X.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));Iy.displayName="SheetContent",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rx,{ref:n,className:t$("text-sm font-medium leading-none tracking-tight",e),...t})).displayName="SheetTitle",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(rE,{ref:n,className:t$("text-sm text-muted-foreground",e),...t})).displayName="SheetDescription";var Ix=e.i(199075);function Iv(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean)}function IE({open:e,onOpenChange:t}){let[n,r]=(0,Q.useState)(!1),[i,o]=(0,Q.useState)(!1),[s,a]=(0,Q.useState)(null),[l,c]=(0,Q.useState)("env"),[d,u]=(0,Q.useState)(""),[p,h]=(0,Q.useState)(""),[f,m]=(0,Q.useState)(null),{data:g}=Ix.authClient.useSession(),[b,y]=(0,Q.useState)(!1),[x,v]=(0,Q.useState)([]),[E,w]=(0,Q.useState)([]),[k,T]=(0,Q.useState)(null),[N,A]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(""),[_,M]=(0,Q.useState)(""),[O,I]=(0,Q.useState)(!1),[D,R]=(0,Q.useState)(null),L=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/system/admins");if(!e.ok)return;let t=await e.json();y(!!t.isAdmin),v(t.admins??[]),w(t.users??[])}catch{}},[]),P=(0,Q.useCallback)(async()=>{r(!0),a(null);try{let e=await fetch("/api/system/auth-settings");if(!e.ok)throw Error("Failed to load settings");let t=await e.json();u(t.allowedEmails.join("\n")),h(t.allowedDomains.join("\n")),c(t.source),m("number"==typeof t.rateLimit?t.rateLimit:null)}catch(e){a(e instanceof Error?e.message:"Failed to load")}finally{r(!1)}},[]);async function j(){o(!0),a(null);try{let e=await fetch("/api/system/auth-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({allowedEmails:Iv(d),allowedDomains:Iv(p)})}),n=await e.json();if(!e.ok){a(n.error??"Save failed"),_d(n.error??"Save failed");return}n.source&&c(n.source),t(!1)}catch{a("Save failed")}finally{o(!1)}}(0,Q.useEffect)(()=>{e&&(P(),L())},[e,P,L]);let B=0===Iv(d).length&&0===Iv(p).length;return(0,X.jsx)(rr,{open:e,onOpenChange:t,children:(0,X.jsxs)(Iy,{side:"right",className:"w-80 sm:max-w-md flex flex-col border-l border-border p-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsx)("span",{className:"text-sm font-semibold",children:"Settings"}),(0,X.jsxs)(rk,{className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,X.jsx)(eC,{className:"h-3.5 w-3.5"}),(0,X.jsx)("span",{className:"sr-only",children:"Close"})]})]}),n?(0,X.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,X.jsxs)("div",{className:"flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[g?.user&&(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Account"}),(0,X.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border bg-muted/40 p-3",children:[(0,X.jsxs)("div",{className:"text-sm min-w-0",children:[(0,X.jsx)("div",{className:"font-medium truncate",children:g.user.name}),(0,X.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:g.user.email})]}),(0,X.jsx)("button",{type:"button",onClick:async()=>{await Ix.authClient.signOut(),window.location.href="/signin"},className:"ml-2 shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent",children:"Sign out"})]})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Signup allowlist"}),(0,X.jsxs)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:["Control who can create an account. Leave both lists empty to allow any email. Saving here overrides the"," ",(0,X.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AUTH_ALLOWED_EMAILS"})," ","and"," ",(0,X.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AUTH_ALLOWED_DOMAIN"})," ","environment variables."]}),"env"===l&&(0,X.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,X.jsx)("span",{children:"Current values come from environment variables. Saving moves the allowlist into config and takes precedence going forward."})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)("label",{htmlFor:"allowed-emails",className:"text-sm font-medium",children:"Allowed emails"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"One per line (or comma-separated). Exact match, case-insensitive."}),(0,X.jsx)("textarea",{id:"allowed-emails",value:d,onChange:e=>u(e.target.value),spellCheck:!1,rows:5,placeholder:"alice@example.com bob@example.com",className:"w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-primary"})]}),(0,X.jsxs)("div",{className:"space-y-1.5",children:[(0,X.jsx)("label",{htmlFor:"allowed-domains",className:"text-sm font-medium",children:"Allowed domains"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"One per line (or comma-separated). Matches any email at that domain."}),(0,X.jsx)("textarea",{id:"allowed-domains",value:p,onChange:e=>h(e.target.value),spellCheck:!1,rows:4,placeholder:"example.com trusted.org",className:"w-full resize-y rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-primary"})]}),B&&(0,X.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning-ink",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,X.jsx)("span",{children:"Both lists are empty. Anyone with the signup URL can create an account."})]}),s&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),s]})]}),b&&(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Admins"}),(0,X.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Admins can create workspaces, add users, and manage access."}),k&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),k]}),(0,X.jsxs)("div",{className:"space-y-2 rounded-md border border-border p-3",children:[(0,X.jsx)("div",{className:"text-xs font-medium",children:"Add user"}),D?(0,X.jsxs)("div",{className:"space-y-2",children:[(0,X.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Created ",(0,X.jsx)("span",{className:"font-medium text-foreground",children:D.email}),". Share this temporary password now, it will not be shown again."]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 rounded bg-muted px-2 py-1.5 font-mono text-sm select-all",children:D.tempPassword}),(0,X.jsx)("button",{type:"button",className:"shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent",onClick:()=>void navigator.clipboard?.writeText(D.tempPassword),children:"Copy"})]}),(0,X.jsx)("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:()=>{R(null),C(""),M(""),L()},children:"Done"})]}):(0,X.jsxs)("div",{className:"space-y-2",children:[(0,X.jsx)("input",{type:"email",value:S,onChange:e=>C(e.target.value),placeholder:"email@team.com",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-primary"}),(0,X.jsx)("input",{type:"text",value:_,onChange:e=>M(e.target.value),placeholder:"Name (optional)",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-primary"}),(0,X.jsxs)(tq,{size:"sm",className:"w-full gap-1.5",disabled:O||!S.trim(),onClick:async()=>{I(!0),T(null);try{let e=await fetch("/api/system/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:S.trim(),name:_.trim()})}),t=await e.json();e.ok&&t.tempPassword?R({email:t.email??S.trim(),tempPassword:t.tempPassword}):T(t.message??t.error??"Failed to create user")}catch{T("Network error")}finally{I(!1)}},children:[O&&(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}),"Create user"]})]})]}),(0,X.jsxs)("div",{className:"space-y-1 rounded-md border border-border overflow-hidden",children:[E.map(e=>{let t=x.includes(e.id);return(0,X.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/40 hover:bg-muted/60 transition-colors",children:[(0,X.jsxs)("div",{className:"text-sm min-w-0",children:[(0,X.jsx)("div",{className:"font-medium truncate",children:e.name}),(0,X.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.email})]}),(0,X.jsx)("button",{type:"button",disabled:N===e.id,className:"ml-2 shrink-0 text-xs px-2 py-1 rounded border border-border hover:bg-accent disabled:opacity-50",onClick:async()=>{A(e.id),T(null);try{let n=await fetch("/api/system/admins",{method:t?"DELETE":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e.id})}),r=await n.json();n.ok?r.admins&&v(r.admins):T(r.message??r.error??"Failed")}catch{T("Network error")}finally{A(null)}},children:N===e.id?(0,X.jsx)(eb,{className:"h-3 w-3 animate-spin"}):t?"Demote":"Promote"})]},e.id)}),0===E.length&&(0,X.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No users yet."})]})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Agent rate limit"}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"text-muted-foreground",children:"Per agent"}),(0,X.jsx)("span",{className:"font-mono",children:null!==f?`${f} ops/min`:"--"})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/60",children:["Override with ",(0,X.jsx)("code",{className:"bg-muted px-0.5 rounded",children:"AGENT_RATE_LIMIT"})," env var."]})]})]})]}),(0,X.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3 shrink-0",children:[(0,X.jsx)(tq,{size:"sm",variant:"ghost",onClick:()=>t(!1),disabled:i,children:"Cancel"}),(0,X.jsxs)(tq,{size:"sm",onClick:j,disabled:i||n,className:"gap-1.5",children:[i&&(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}),"Save"]})]})]})})}let Iw=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:t$("rounded-md border border-border bg-card text-card-foreground shadow-e-2",e),...t}));Iw.displayName="Card",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:t$("flex flex-col space-y-1.5 p-6",e),...t})).displayName="CardHeader",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:t$("text-lg font-normal leading-none tracking-tight",e),...t})).displayName="CardTitle",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:t$("text-sm text-muted-foreground",e),...t})).displayName="CardDescription",Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)("div",{ref:n,className:t$("p-6 pt-0",e),...t})).displayName="CardContent";let Ik=eU("inline-flex items-center rounded-sm border px-2.5 py-0.5 text-xs font-normal transition-colors focus:outline-none focus:ring-2 focus:ring-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-e-1",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-e-1",outline:"text-foreground",accent:"border-transparent bg-accent text-accent-foreground"}},defaultVariants:{variant:"default"}});function IT({className:e,variant:t,...n}){return(0,X.jsx)("div",{className:t$(Ik({variant:t}),e),...n})}let IN=new Set(["title","type","status","created","updated","date","tags","sources","private","supersedes","superseded_by"]);function IA({data:e}){let[t,n]=(0,Q.useState)(!1),r=Object.keys(e);if(0===r.length)return null;let i="string"==typeof e.title?e.title:null,o="string"==typeof e.type?e.type:null,s="string"==typeof e.status?e.status:null,a="string"==typeof e.created?e.created:null,l="string"==typeof e.updated?e.updated:null,c=!0===e.private,d=Array.isArray(e.tags)?e.tags:[],u=Array.isArray(e.sources)?e.sources:[],p="string"==typeof e.superseded_by?e.superseded_by:null,h=r.filter(e=>!IN.has(e));return(0,X.jsxs)("div",{className:"mb-6 rounded-sm border bg-card/40 px-4 py-3 text-xs",children:[i&&(0,X.jsx)("div",{className:"mb-2 text-base font-normal text-foreground",children:i}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-muted-foreground",children:[o&&(0,X.jsx)(IT,{variant:"outline",className:"font-normal",children:o}),s&&(0,X.jsx)(IT,{variant:"outline",className:"font-normal",children:s}),c&&(0,X.jsx)(IT,{variant:"outline",className:"border-warning-ink/40 font-normal text-warning-ink",children:"private"}),p&&(0,X.jsxs)(IT,{variant:"outline",className:"border-destructive/40 font-normal text-destructive",children:["superseded → ",p]}),a&&(0,X.jsxs)("span",{children:[(0,X.jsx)("span",{className:"opacity-60",children:"created"})," ",(0,X.jsx)("span",{className:"text-foreground/80",children:a})]}),l&&l!==a&&(0,X.jsxs)("span",{children:[(0,X.jsx)("span",{className:"opacity-60",children:"updated"})," ",(0,X.jsx)("span",{className:"text-foreground/80",children:l})]})]}),d.length>0&&(0,X.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:d.map(e=>(0,X.jsxs)(IT,{variant:"secondary",className:"font-normal text-[11px]",children:["#",e]},e))}),u.length>0&&(0,X.jsxs)("div",{className:"mt-2",children:[(0,X.jsx)("span",{className:"opacity-60",children:"sources:"})," ",(0,X.jsx)("span",{className:"text-foreground/80",children:u.join(", ")})]}),h.length>0&&(0,X.jsxs)("div",{className:"mt-2 border-t pt-2",children:[(0,X.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),className:"flex items-center gap-1 text-muted-foreground hover:text-foreground",children:[t?(0,X.jsx)(es,{className:"h-3 w-3"}):(0,X.jsx)(ea,{className:"h-3 w-3"}),(0,X.jsxs)("span",{children:[h.length," more field",1===h.length?"":"s"]})]}),t&&(0,X.jsx)("dl",{className:"mt-1.5 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-0.5",children:h.map(t=>(0,X.jsxs)(Q.Fragment,{children:[(0,X.jsx)("dt",{className:"opacity-60",children:t}),(0,X.jsx)("dd",{className:"text-foreground/80 break-words",children:function e(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return t.map(e).join(", ");try{return JSON.stringify(t)}catch{return String(t)}}(e[t])})]},t))})]})]})}function IS({markdown:e,pagePath:t,onNavigate:n}){let[r,i]=(0,Q.useState)(""),o=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let n=!1;return vE(e,{pagePath:t,sanitize:!0}).then(e=>{n||i(e)}),()=>{n=!0}},[e,t]);let s=(0,Q.useCallback)(e=>{let t=e.target.closest("a");if(!t)return;if("true"===t.dataset.wikiLink){e.preventDefault();let r=t.dataset.slug??"";if(!r)return;let i=ET.getState().getDir(r);if(!i)return;n("root"===i?`${r}.md`:`${i}/${r}.md`,t.dataset.anchor??null);return}let r=t.getAttribute("href")??"";if(/^https?:\/\//.test(r)){t.target||(t.setAttribute("target","_blank"),t.setAttribute("rel","noreferrer"));return}},[n]);(0,Q.useEffect)(()=>{let e=o.current;if(e)return e.querySelectorAll("a[href^='http']").forEach(e=>{e.target||(e.setAttribute("target","_blank"),e.setAttribute("rel","noreferrer"))}),e.addEventListener("click",s),()=>e.removeEventListener("click",s)},[r,s]);let a=ET(e=>e.loadedAt);return(0,Q.useEffect)(()=>{let e=o.current;if(!e)return;let t=ET.getState();e.querySelectorAll('a[data-wiki-link="true"]').forEach(e=>{let n=e.dataset.slug??"";n&&!t.has(n)?e.dataset.broken="true":delete e.dataset.broken})},[r,a]),(0,Q.useEffect)(()=>{let e=o.current;e&&e.querySelectorAll('input[type="checkbox"]').forEach(e=>{e.disabled=!0})},[r]),(0,X.jsx)("div",{ref:o,className:"tiptap md-preview",dangerouslySetInnerHTML:{__html:r}})}let IC=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;function I_(e){let t=e.trim();if(""===t)return"";if("true"===t)return!0;if("false"===t)return!1;if("null"===t||"~"===t)return null;if(/^-?\d+$/.test(t)||/^-?\d*\.\d+$/.test(t))return Number(t);if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith("[")&&t.endsWith("]")){let e=t.slice(1,-1).trim();return""===e?[]:e.split(",").map(e=>I_(e))}return t}let IM=en("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),IO=en("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),II=en("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),ID=en("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function IR(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function IL({scope:e}){return(0,X.jsxs)("span",{className:"text-[10px] text-muted-foreground/70 font-mono",children:[e.paths.join(", ")," · ",e.ops.join(",")]})}function IP({reg:e,onApprove:t,onDeny:n}){let[r,i]=(0,Q.useState)(!1);async function o(t){i(!0);try{await t(e.registrationId)}finally{i(!1)}}return(0,X.jsxs)("li",{className:"py-1.5 border-b border-border/40 last:border-0",children:[(0,X.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,X.jsxs)("div",{className:"min-w-0",children:[(0,X.jsx)("p",{className:"text-xs font-mono truncate",children:e.displayName}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:e.agentId}),(0,X.jsx)(IL,{scope:e.requestedScope})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,X.jsxs)(tq,{size:"sm",variant:"default",className:"h-6 px-2 text-[10px]",disabled:r,onClick:()=>void o(t),title:"Approve",children:[(0,X.jsx)(IO,{className:"h-3 w-3 mr-0.5"}),"Approve"]}),(0,X.jsxs)(tq,{size:"sm",variant:"ghost",className:"h-6 px-2 text-[10px] text-destructive hover:text-destructive",disabled:r,onClick:()=>void o(n),title:"Deny",children:[(0,X.jsx)(II,{className:"h-3 w-3 mr-0.5"}),"Deny"]})]})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 mt-0.5",children:["Requested ",IR(e.requestedAt)]})]})}function Ij({agent:e,onRevoke:t}){let[n,r]=(0,Q.useState)(!1);return(0,X.jsxs)("li",{className:"py-1.5 border-b border-border/40 last:border-0",children:[(0,X.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,X.jsxs)("div",{className:"min-w-0",children:[(0,X.jsx)("p",{className:"text-xs font-mono truncate",children:e.displayName}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:e.id}),(0,X.jsx)(IL,{scope:e.scope})]}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0 text-destructive hover:text-destructive",disabled:n,onClick:async()=>{r(!0);try{await t(e.id)}finally{r(!1)}},title:"Revoke agent",children:(0,X.jsx)(eA,{className:"h-3 w-3"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 mt-0.5",children:["Last seen ",IR(e.lastSeen)]})]})}function IB(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)([]),[i,o]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{fetch("/api/owner/init",{credentials:"same-origin"}).then(e=>{(e.ok||204===e.status)&&o(!0)}).catch(()=>{o(!0)})},[]);let s=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/agent/admin/registrations",{credentials:"same-origin"});if(!e.ok)return;let n=await e.json();t(n.pending)}catch{}},[]),a=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/agent/admin/agents",{credentials:"same-origin"});if(!e.ok)return;let t=await e.json();r(t.agents)}catch{}},[]);(0,Q.useEffect)(()=>{if(!i)return;s(),a();let e=setInterval(()=>void s(),5e3),t=setInterval(()=>void a(),3e4);return()=>{clearInterval(e),clearInterval(t)}},[i,s,a]);let l=(0,Q.useCallback)(async e=>{(await fetch(`/api/agent/admin/registrations/${e}/approve`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:"{}"})).ok?(_c.toast.success("Agent approved"),await Promise.all([s(),a()])):_c.toast.error("Failed to approve agent")},[s,a]),c=(0,Q.useCallback)(async e=>{(await fetch(`/api/agent/admin/registrations/${e}/deny`,{method:"POST",credentials:"same-origin"})).ok?(_c.toast.success("Registration denied"),await s()):_c.toast.error("Failed to deny registration")},[s]),d=(0,Q.useCallback)(async e=>{(await fetch(`/api/agent/admin/agents/${encodeURIComponent(e)}/revoke`,{method:"POST",credentials:"same-origin"})).ok?(_c.toast.success("Agent revoked"),await a()):_c.toast.error("Failed to revoke agent")},[a]);return(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Agents · approve & manage access"}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0",title:"Refresh",onClick:()=>void Promise.all([s(),a()]),children:(0,X.jsx)(ek,{className:"h-3 w-3"})})]}),e.length>0&&(0,X.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-50/10 p-2",children:[(0,X.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-amber-600/80 mb-1 flex items-center gap-1",children:[(0,X.jsx)(ID,{className:"h-3 w-3"}),"Waiting for your approval (",e.length,")"]}),(0,X.jsx)("ul",{children:e.map(e=>(0,X.jsx)(IP,{reg:e,onApprove:l,onDeny:c},e.registrationId))})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-2",children:0===n.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 py-1",children:["No assistants connected yet."," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"Connect one above; once it requests access it’ll appear here for you to approve."})]}):(0,X.jsx)("ul",{children:n.map(e=>(0,X.jsx)(Ij,{agent:e,onRevoke:d},e.id))})}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/60 leading-relaxed",children:"Each assistant gets its own access that you can revoke anytime. New requests appear above for your approval before they can read or edit anything."})]})}function IF({event:e}){var t;let n=e.path.split("/").pop()??e.path,r="string"==typeof e.ref?e.ref:"";return(0,X.jsxs)("div",{className:"flex flex-col gap-0.5 py-1.5 border-b border-border/50 last:border-0",children:[(0,X.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,X.jsx)("span",{className:"text-xs font-mono text-foreground/80 truncate",title:e.path,children:n}),(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground shrink-0",children:function(e){let t=Math.floor(Math.max(0,Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}(e.at)})]}),(0,X.jsxs)("p",{className:"text-[11px] text-muted-foreground truncate",children:[(0,X.jsx)("span",{className:"text-foreground/60",children:e.by})," ",{"block.replace":"replaced","block.insertAfter":"inserted after","block.insertBefore":"inserted before","block.delete":"deleted","block.append":"appended","block.prepend":"prepended","comment.add":"commented on","comment.reply":"replied to comment","comment.resolve":"resolved comment","comment.reopen":"reopened comment","suggestion.add":"suggested","suggestion.accept":"accepted suggestion","suggestion.reject":"rejected suggestion"}[t=e.type]??t,r&&(0,X.jsxs)(X.Fragment,{children:[" ",(0,X.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground/60",children:r})]})]})]})}let IH="npx skills add anh-chu/wiki-viewer/agents/wiki-viewer-skill";function IU(e){let[t,n]=(0,Q.useState)(!1);return{copied:t,copy:(0,Q.useCallback)(async()=>{await navigator.clipboard.writeText(e()),n(!0),setTimeout(()=>n(!1),1500)},[e])}}function Iz({currentPath:e}){let t=Eo(e=>e.isOpen),n=Eo(e=>e.close),r=Eo(e=>e.activity),i=Eo(e=>e.connections),o=Eo(e=>e.loadActivity),{copied:s,copy:a}=function(e){let[t,n]=(0,Q.useState)(!1);return{copied:t,copy:(0,Q.useCallback)(async()=>{let t=window.location.origin,r=`# 1. Register
|
|
116
|
+
REG=$(curl -s -X POST -H 'Content-Type: application/json' \\
|
|
117
|
+
-d '{"id":"ai:claude","displayName":"Claude"}' \\
|
|
118
|
+
${t}/api/agent/register)
|
|
119
|
+
REG_ID=$(echo $REG | jq -r .registrationId)
|
|
120
|
+
|
|
121
|
+
# 2. Approve in AI Panel, then poll:
|
|
122
|
+
curl -s ${t}/api/agent/register/$REG_ID
|
|
123
|
+
# → {"status":"approved","token":"..."}
|
|
124
|
+
TOKEN=<paste token here>
|
|
125
|
+
|
|
126
|
+
# 3. Read snapshot
|
|
127
|
+
curl -s -H "Authorization: Bearer $TOKEN" \\
|
|
128
|
+
-H "X-Agent-Id: ai:claude" \\
|
|
129
|
+
${t}/api/agent/files/${e??"<path/to/file.md>"}`;await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)},[e])}}(e??null),[l,c]=(0,Q.useState)(""),d=(0,Q.useRef)(null),u=window.location.origin,p=(0,Q.useCallback)(()=>IH,[]),h=(0,Q.useCallback)(()=>l.replace(/\$WIKI_URL/g,u),[l,u]),f=(0,Q.useCallback)(()=>`npx wiki-viewer-mcp register --url ${u} --id ai:myagent --name "My Agent"`,[u]),m=(0,Q.useCallback)(()=>JSON.stringify({servers:{"wiki-viewer":{command:"npx",args:["wiki-viewer-mcp"],env:{WIKI_VIEWER_URL:u,WIKI_VIEWER_TOKEN:"<token from register>",WIKI_VIEWER_AGENT_ID:"ai:myagent"}}}},null,2),[u]),g=IU(p),b=IU(h),y=IU(f),x=IU(m);return((0,Q.useEffect)(()=>{if(t)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&n()}},[t,n]),(0,Q.useEffect)(()=>{t&&d.current?.focus()},[t]),(0,Q.useEffect)(()=>{if(!t)return;o();let e=setInterval(()=>void o(),1e4);return()=>clearInterval(e)},[t,o]),(0,Q.useEffect)(()=>{t&&fetch("/api/agents/install").then(e=>e.json()).then(e=>{e.bootstrapPrompt&&c(e.bootstrapPrompt)}).catch(()=>void 0)},[t]),t)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 backdrop-blur-[1px]",onClick:n,"aria-hidden":!0}),(0,X.jsxs)("aside",{ref:d,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"AI Agent Panel",className:"fixed right-0 top-0 bottom-0 z-50 flex w-80 flex-col border-l border-border bg-background shadow-xl outline-none",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)(ei,{className:"h-4 w-4 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-semibold",children:"AI Agent"})]}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:n,title:"Close panel (Esc)",children:(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-5 px-4 py-4",children:[(0,X.jsxs)("section",{className:"rounded-md border border-border bg-muted/30 p-3",children:[(0,X.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Work with this wiki using AI"}),(0,X.jsxs)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:["Connect Claude, Cursor, ChatGPT, and more. Pick by what you want — each option gives a copy-paste setup. You approve every assistant in ",(0,X.jsx)("span",{className:"font-medium text-foreground/80",children:"Agents"})," below before it gets access."]})]}),(0,X.jsxs)("section",{className:"space-y-3",children:[(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Co-write docs with you"}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Edits arrive as suggestions with comments you accept or revert. No MCP needed."}),(0,X.jsx)(tq,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void b.copy(),disabled:!l,children:b.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_w,{className:"h-3.5 w-3.5"})," Paste into any chatbot"]})}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50 pt-1",children:["Or install once so it sticks"," ",(0,X.jsx)("span",{className:"text-muted-foreground/40",children:"· Claude, OpenCode"}),":"]}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:IH}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void g.copy(),children:g.copied?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_w,{className:"h-3.5 w-3.5"})})]})]}),(0,X.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[(0,X.jsxs)("p",{className:"text-xs font-semibold text-foreground",children:["Edit files directly"," ",(0,X.jsx)("span",{className:"font-normal text-muted-foreground/60",children:"· Claude Code, Cursor, Codex"})]}),(0,X.jsx)("p",{className:"text-[10px] text-muted-foreground/70",children:"Native read / search / edit tools over MCP. Run to request access:"}),(0,X.jsxs)("div",{className:"flex items-center gap-2",children:[(0,X.jsx)("code",{className:"flex-1 text-[10px] font-mono text-foreground/80 truncate bg-muted rounded px-1 py-0.5",children:f()}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 shrink-0",title:"Copy this command",onClick:()=>void y.copy(),children:y.copied?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"}):(0,X.jsx)(_w,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("p",{className:"text-[10px] text-muted-foreground/50",children:["Approve in ",(0,X.jsx)("span",{className:"font-medium text-foreground/70",children:"Agents"}),", then add to your tool:"]}),(0,X.jsx)(tq,{size:"sm",variant:"outline",className:"h-7 w-full text-xs gap-1.5",onClick:()=>void x.copy(),children:x.copied?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(eo,{className:"h-3.5 w-3.5 text-green-500"})," Copied!"]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_w,{className:"h-3.5 w-3.5"})," Copy config (mcp.json)"]})})]}),(0,X.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,X.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"For developers:"}),(0,X.jsxs)("button",{type:"button",onClick:()=>void a(),className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[s?(0,X.jsx)(eo,{className:"h-3 w-3 text-green-500"}):(0,X.jsx)(_w,{className:"h-3 w-3"})," curl example"]}),(0,X.jsxs)("a",{href:"/api/agents/skill",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kl,{className:"h-3 w-3"})," skill"]}),(0,X.jsxs)("a",{href:"/api/agents/install",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-primary hover:underline",children:[(0,X.jsx)(kl,{className:"h-3 w-3"})," install JSON"]})]})]}),(0,X.jsx)(IB,{}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:["Active Connections"," ",(0,X.jsx)("span",{className:"normal-case font-normal text-muted-foreground/50",children:"(last 5 min)"})]}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:0===i.length?(0,X.jsxs)("p",{className:"text-xs text-muted-foreground/60 flex items-center gap-1.5",children:[(0,X.jsx)(IM,{className:"h-3.5 w-3.5"}),"No recent activity"]}):(0,X.jsx)("ul",{className:"space-y-1.5",children:i.map(e=>(0,X.jsxs)("li",{className:"flex items-center justify-between text-xs",children:[(0,X.jsx)("span",{className:"font-mono text-foreground/80 truncate",children:e.by}),(0,X.jsxs)("span",{className:"text-muted-foreground shrink-0",children:[e.opCount," op",1!==e.opCount?"s":""]})]},e.by))})})]}),(0,X.jsxs)("section",{className:"space-y-2",children:[(0,X.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Recent Activity"}),(0,X.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-1 max-h-72 overflow-y-auto",children:0===r.length?(0,X.jsx)("p",{className:"text-xs text-muted-foreground/60 py-2",children:"No events recorded"}):r.map(e=>(0,X.jsx)(IF,{event:e},`${e.path}-${e.id}`))})]}),(0,X.jsx)("section",{children:(0,X.jsx)("a",{href:"/docs/agent-collab-plan.md",target:"_blank",rel:"noreferrer",className:"text-xs text-primary underline hover:no-underline",children:"Agent collaboration docs →"})})]})]})]}):null}var I$=/[\\\/_+.#"@\[\(\{&]/,IG=/[\\\/_+.#"@\[\(\{&]/g,Iq=/[\s-]/,IV=/[\s-]/g;function IW(e){return e.toLowerCase().replace(IV," ")}var IK='[cmdk-group=""]',IY='[cmdk-group-items=""]',IX='[cmdk-item=""]',IQ=`${IX}:not([aria-disabled="true"])`,IJ="cmdk-item-select",IZ="data-value",I0=(e,t,n)=>{var r;return r=e,function e(t,n,r,i,o,s,a){if(s===n.length)return o===t.length?1:.99;var l=`${o},${s}`;if(void 0!==a[l])return a[l];for(var c,d,u,p,h=i.charAt(s),f=r.indexOf(h,o),m=0;f>=0;)(c=e(t,n,r,i,f+1,s+1,a))>m&&(f===o?c*=1:I$.test(t.charAt(f-1))?(c*=.8,(u=t.slice(o,f-1).match(IG))&&o>0&&(c*=Math.pow(.999,u.length))):Iq.test(t.charAt(f-1))?(c*=.9,(p=t.slice(o,f-1).match(IV))&&o>0&&(c*=Math.pow(.999,p.length))):(c*=.17,o>0&&(c*=Math.pow(.999,f-o))),t.charAt(f)!==n.charAt(s)&&(c*=.9999)),(c<.1&&r.charAt(f-1)===i.charAt(s+1)||i.charAt(s+1)===i.charAt(s)&&r.charAt(f-1)!==i.charAt(s))&&.1*(d=e(t,n,r,i,f+1,s+2,a))>c&&(c=.1*d),c>m&&(m=c),f=r.indexOf(h,f+1);return a[l]=m,m}(r=n&&n.length>0?`${r+" "+n.join(" ")}`:r,t,IW(r),IW(t),0,0,{})},I1=Q.createContext(void 0),I2=Q.createContext(void 0),I3=Q.createContext(void 0),I5=Q.forwardRef((e,t)=>{let n=Di(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Di(()=>new Set),i=Di(()=>new Map),o=Di(()=>new Map),s=Di(()=>new Set),a=Dn(e),{label:l,children:c,value:d,onValueChange:u,filter:p,shouldFilter:h,loop:f,disablePointerSelection:m=!1,vimBindings:g=!0,...b}=e,y=tQ(),x=tQ(),v=tQ(),E=Q.useRef(null),w=Da();Dr(()=>{if(void 0!==d){let e=d.trim();n.current.value=e,k.emit()}},[d]),Dr(()=>{w(6,_)},[]);let k=Q.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,o,s,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)C(),A(),w(1,S);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(v);e?e.focus():null==(i=document.getElementById(y))||i.focus()}if(w(7,()=>{var e;n.current.selectedItemId=null==(e=M())?void 0:e.id,k.emit()}),r||w(5,_),(null==(o=a.current)?void 0:o.value)!==void 0){null==(l=(s=a.current).onValueChange)||l.call(s,null!=t?t:"");return}}k.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),T=Q.useMemo(()=>({value:(e,t,r)=>{var i;t!==(null==(i=o.current.get(e))?void 0:i.value)&&(o.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,N(t,r)),w(2,()=>{A(),k.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{C(),A(),n.current.value||S(),k.emit()}),()=>{o.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{C(),(null==t?void 0:t.getAttribute("id"))===e&&S(),k.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:y,inputId:v,labelId:x,listInnerRef:E}),[]);function N(e,t){var r,i;let o=null!=(i=null==(r=a.current)?void 0:r.filter)?i:I0;return e?o(e,n.current.search,t):0}function A(){if(!n.current.search||!1===a.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),o=0;r.forEach(t=>{o=Math.max(e.get(t),o)}),t.push([n,o])});let r=E.current;O().sort((t,n)=>{var r,i;let o=t.getAttribute("id"),s=n.getAttribute("id");return(null!=(r=e.get(s))?r:0)-(null!=(i=e.get(o))?i:0)}).forEach(e=>{let t=e.closest(IY);t?t.appendChild(e.parentElement===t?e:e.closest(`${IY} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${IY} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=E.current)?void 0:t.querySelector(`${IK}[${IZ}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function S(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(IZ);k.setState("value",t||void 0)}function C(){var e,t,s,l;if(!n.current.search||!1===a.current.shouldFilter){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let c=0;for(let i of r.current){let r=N(null!=(t=null==(e=o.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(s=o.current.get(i))?void 0:s.keywords)?l:[]);n.current.filtered.items.set(i,r),r>0&&c++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=c}function _(){var e,t,n;let r=M();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(IK))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function M(){var e;return null==(e=E.current)?void 0:e.querySelector(`${IX}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=E.current)?void 0:e.querySelectorAll(IQ))||[])}function I(e){let t=O()[e];t&&k.setState("value",t.getAttribute(IZ))}function D(e){var t;let n=M(),r=O(),i=r.findIndex(e=>e===n),o=r[i+e];null!=(t=a.current)&&t.loop&&(o=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),o&&k.setState("value",o.getAttribute(IZ))}function R(e){let t=M(),n=null==t?void 0:t.closest(IK),r;for(;n&&!r;)r=null==(n=e>0?function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(n,IK):function(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}(n,IK))?void 0:n.querySelector(IQ);r?k.setState("value",r.getAttribute(IZ)):D(e)}let L=()=>I(O().length-1),P=e=>{e.preventDefault(),e.metaKey?L():e.altKey?R(1):D(1)},j=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?R(-1):D(-1)};return Q.createElement(kA.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=b.onKeyDown)||t.call(b,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||n))switch(e.key){case"n":case"j":g&&e.ctrlKey&&P(e);break;case"ArrowDown":P(e);break;case"p":case"k":g&&e.ctrlKey&&j(e);break;case"ArrowUp":j(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=M();if(t){let e=new Event(IJ);t.dispatchEvent(e)}}}}},Q.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Dc},l),Dl(e,e=>Q.createElement(I2.Provider,{value:k},Q.createElement(I1.Provider,{value:T},e))))}),I4=Q.forwardRef((e,t)=>{var n,r;let i=tQ(),o=Q.useRef(null),s=Q.useContext(I3),a=Q.useContext(I1),l=Dn(e),c=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;Dr(()=>{if(!c)return a.item(i,null==s?void 0:s.id)},[c]);let d=Ds(i,o,[e.value,e.children,o],e.keywords),u=Q.useContext(I2),p=Do(e=>e.value&&e.value===d.current),h=Do(e=>!!c||!1===a.filter()||!e.search||e.filtered.items.get(i)>0);function f(){var e,t;m(),null==(t=(e=l.current).onSelect)||t.call(e,d.current)}function m(){u.setState("value",d.current,!0)}if(Q.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(IJ,f),()=>t.removeEventListener(IJ,f)},[h,e.onSelect,e.disabled]),!h)return null;let{disabled:g,value:b,onSelect:y,forceMount:x,keywords:v,...E}=e;return Q.createElement(kA.div,{ref:eM(o,t),...E,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!p,"data-disabled":!!g,"data-selected":!!p,onPointerMove:g||a.getDisablePointerSelection()?void 0:m,onClick:g?void 0:f},e.children)}),I6=Q.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=tQ(),a=Q.useRef(null),l=Q.useRef(null),c=tQ(),d=Q.useContext(I1),u=Do(e=>!!i||!1===d.filter()||!e.search||e.filtered.groups.has(s));Dr(()=>d.group(s),[]),Ds(s,a,[e.value,e.heading,l]);let p=Q.useMemo(()=>({id:s,forceMount:i}),[i]);return Q.createElement(kA.div,{ref:eM(a,t),...o,"cmdk-group":"",role:"presentation",hidden:!u||void 0},n&&Q.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Dl(e,e=>Q.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},Q.createElement(I3.Provider,{value:p},e))))}),I9=Q.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Q.useRef(null),o=Do(e=>!e.search);return n||o?Q.createElement(kA.div,{ref:eM(i,t),...r,"cmdk-separator":"",role:"separator"}):null}),I7=Q.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=null!=e.value,o=Q.useContext(I2),s=Do(e=>e.search),a=Do(e=>e.selectedItemId),l=Q.useContext(I1);return Q.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),Q.createElement(kA.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:s,onChange:e=>{i||o.setState("search",e.target.value),null==n||n(e.target.value)}})}),I8=Q.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,o=Q.useRef(null),s=Q.useRef(null),a=Do(e=>e.selectedItemId),l=Q.useContext(I1);return Q.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty("--cmdk-list-height",n.toFixed(1)+"px")})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Q.createElement(kA.div,{ref:eM(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},Dl(e,e=>Q.createElement("div",{ref:eM(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),De=Q.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:o,container:s,...a}=e;return Q.createElement(rr,{open:n,onOpenChange:r},Q.createElement(rl,{container:s},Q.createElement(rd,{"cmdk-overlay":"",className:i}),Q.createElement(rf,{"aria-label":e.label,"cmdk-dialog":"",className:o},Q.createElement(I5,{ref:t,...a}))))}),Dt=Object.assign(I5,{List:I8,Item:I4,Input:I7,Group:I6,Separator:I9,Dialog:De,Empty:Q.forwardRef((e,t)=>Do(e=>0===e.filtered.count)?Q.createElement(kA.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:Q.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...o}=e;return Q.createElement(kA.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Dl(e,e=>Q.createElement("div",{"aria-hidden":!0},e)))})});function Dn(e){let t=Q.useRef(e);return Dr(()=>{t.current=e}),t}var Dr="u"<typeof window?Q.useEffect:Q.useLayoutEffect;function Di(e){let t=Q.useRef();return void 0===t.current&&(t.current=e()),t}function Do(e){let t=Q.useContext(I2),n=()=>e(t.snapshot());return Q.useSyncExternalStore(t.subscribe,n,n)}function Ds(e,t,n,r=[]){let i=Q.useRef(),o=Q.useContext(I1);return Dr(()=>{var s;let a=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=r.map(e=>e.trim());o.value(e,a,l),null==(s=t.current)||s.setAttribute(IZ,a),i.current=a}),i}var Da=()=>{let[e,t]=Q.useState(),n=Di(()=>new Map);return Dr(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Dl({asChild:e,children:t},n){let r;return e&&Q.isValidElement(t)?Q.cloneElement("function"==typeof(r=t.type)?r(t.props):"render"in r?r.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var Dc={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let Dd=en("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Du=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Dt,{ref:n,className:t$("flex h-full w-full flex-col overflow-hidden rounded-sm bg-popover text-popover-foreground",e),...t}));function Dp({children:e,shouldFilter:t,...n}){return(0,X.jsx)(rr,{...n,children:(0,X.jsxs)(rO,{className:"overflow-hidden p-0 shadow-golden max-w-lg",children:[(0,X.jsx)(rR,{className:"sr-only",children:"Search"}),(0,X.jsx)(Du,{shouldFilter:t,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})]})})}Du.displayName=Dt.displayName;let Dh=Q.forwardRef(({className:e,...t},n)=>(0,X.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,X.jsx)(Dd,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,X.jsx)(Dt.Input,{ref:n,className:t$("flex h-11 w-full rounded-sm bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Dh.displayName=Dt.Input.displayName;let Df=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Dt.List,{ref:n,className:t$("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Df.displayName=Dt.List.displayName;let Dm=Q.forwardRef((e,t)=>(0,X.jsx)(Dt.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Dm.displayName=Dt.Empty.displayName;let Dg=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Dt.Group,{ref:n,className:t$("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Dg.displayName=Dt.Group.displayName,Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Dt.Separator,{ref:n,className:t$("-mx-1 h-px bg-border",e),...t})).displayName=Dt.Separator.displayName;let Db=Q.forwardRef(({className:e,...t},n)=>(0,X.jsx)(Dt.Item,{ref:n,className:t$("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Db.displayName=Dt.Item.displayName;let Dy=null,Dx=Ei(e=>({query:"",results:[],loading:!1,truncated:!1,open:!1,setQuery:t=>e({query:t}),setOpen:t=>e({open:t}),clear:()=>{Dy?.abort(),e({query:"",results:[],loading:!1,truncated:!1})},search:async t=>{Dy?.abort();let n=new AbortController;if(Dy=n,!t.trim())return void e({results:[],loading:!1,truncated:!1});e({loading:!0});try{let r=await r$("/api/wiki/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,limit:30}),signal:n.signal});if(!r.ok)return void e({results:[],loading:!1,truncated:!1});let i=await r.json();if(n.signal.aborted)return;e({results:i.matches??[],truncated:!!i.truncated,loading:!1})}catch(t){"AbortError"!==t.name&&e({loading:!1})}}}));function Dv({html:e}){let t=function(e){let t,n=[],r=/<mark>([\s\S]*?)<\/mark>/g,i=0;for(;null!==(t=r.exec(e));)t.index>i&&n.push({text:e.slice(i,t.index),mark:!1}),n.push({text:t[1]??"",mark:!0}),i=t.index+t[0].length;return i<e.length&&n.push({text:e.slice(i),mark:!1}),n}(e);return(0,X.jsx)(X.Fragment,{children:t.map((e,t)=>e.mark?(0,X.jsx)("mark",{className:"bg-yellow-200 dark:bg-yellow-700 rounded-[2px] px-[1px]",children:e.text},t):(0,X.jsx)("span",{children:e.text},t))})}function DE({onOpenFile:e}){let t=Dx(e=>e.open),n=Dx(e=>e.setOpen),r=Dx(e=>e.query),i=Dx(e=>e.setQuery),o=Dx(e=>e.results),s=Dx(e=>e.loading),a=Dx(e=>e.truncated),l=Dx(e=>e.search);return(0,Q.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),n(!t))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,n]),(0,Q.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{l(r)},120);return()=>clearTimeout(e)},[r,t,l]),(0,X.jsxs)(Dp,{open:t,onOpenChange:n,shouldFilter:!1,children:[(0,X.jsx)(Dh,{placeholder:"Search files…",value:r,onValueChange:i}),(0,X.jsxs)(Df,{children:[s&&(0,X.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Searching…"}),!s&&""!==r.trim()&&0===o.length&&(0,X.jsx)(Dm,{children:"No matches."}),o.length>0&&(0,X.jsx)(Dg,{heading:a?"Top results (refine query for more)":"Results",children:o.map(t=>(0,X.jsx)(Db,{value:t.path,onSelect:()=>{e(t.path),n(!1)},children:(0,X.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,X.jsx)("span",{className:"truncate font-mono text-xs",children:t.path}),t.snippet&&(0,X.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:(0,X.jsx)(Dv,{html:t.snippet})})]})},t.path))})]})]})}function Dw({onOpenFile:e}){let t=Dx(e=>e.query),n=Dx(e=>e.setQuery),r=Dx(e=>e.results),i=Dx(e=>e.loading),o=Dx(e=>e.search),s=Dx(e=>e.clear),[a,l]=(0,Q.useState)(0),c=(0,Q.useRef)(null);function d(t){let n=r[t];n&&(e(n.path),s())}return(0,Q.useEffect)(()=>{l(0)},[r]),(0,Q.useEffect)(()=>{let e=c.current?.querySelector(`[data-idx="${a}"]`);e?.scrollIntoView({block:"nearest"})},[a]),(0,X.jsxs)("div",{className:"flex flex-col gap-1 px-2 py-1.5",children:[(0,X.jsxs)("div",{className:"relative",children:[(0,X.jsx)(Dd,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 opacity-50"}),(0,X.jsx)("input",{type:"text",className:"w-full rounded-sm border bg-transparent py-1 pl-7 pr-2 text-xs outline-none focus:ring-1 focus:ring-ring",placeholder:"Search… (⌘K)",value:t,onChange:e=>{n(e.target.value),o(e.target.value)},onKeyDown:e=>{"Escape"===e.key?s():0!==r.length&&("ArrowDown"===e.key?(e.preventDefault(),l(e=>(e+1)%r.length)):"ArrowUp"===e.key?(e.preventDefault(),l(e=>(e-1+r.length)%r.length)):"Enter"===e.key&&(e.preventDefault(),d(a)))}})]}),""!==t.trim()&&(0,X.jsxs)("div",{ref:c,className:"max-h-64 overflow-y-auto rounded-sm border bg-popover",children:[i&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Searching…"}),!i&&0===r.length&&(0,X.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"No matches"}),r.map((e,t)=>(0,X.jsxs)("button",{type:"button","data-idx":t,onClick:()=>d(t),onMouseEnter:()=>l(t),className:`block w-full px-2 py-1 text-left ${t===a?"bg-accent":"hover:bg-accent"}`,children:[(0,X.jsx)("div",{className:"truncate font-mono text-xs",children:e.path}),e.snippet&&(0,X.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:(0,X.jsx)(Dv,{html:e.snippet})})]},e.path))]})]})}function Dk({className:e}){let t=Ek(e=>e.width),n=Ek(e=>e.setWidth);return(0,X.jsxs)(O5,{children:[(0,X.jsx)(O6,{asChild:!0,children:(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:`Content width: ${EE[t]}`,children:(0,X.jsx)(w4,{className:"h-3.5 w-3.5"})})}),(0,X.jsx)(Ic,{align:"end",className:"w-36",children:Ew.map(e=>(0,X.jsxs)(Id,{onClick:()=>n(e),className:"flex items-center justify-between text-xs",children:[EE[e],e===t&&(0,X.jsx)(eo,{className:"h-3.5 w-3.5"})]},e))})]})}function DT(e){return e.split(".").pop()?.toLowerCase()??""}function DN(e,t){if("node-app"===t)return"node-app";if("app"===t)return"app";if("dir"===t)return"fallback";let n=DT(e);return n?["md","markdown"].includes(n)?"editor":"txt"===n?"text":["csv","tsv"].includes(n)?"csv":"pdf"===n?"pdf":["mmd","mermaid"].includes(n)?"mermaid":"ipynb"===n?"notebook":["png","jpg","jpeg","gif","webp","svg","avif","ico","bmp"].includes(n)?"image":["mp4","webm","mov","m4v","mp3","wav","ogg","m4a","aac"].includes(n)?"media":"docx"===n?"docx":["xlsx","xlsm"].includes(n)?"xlsx":"pptx"===n?"pptx":"html"===n?"html":["py","js","ts","tsx","jsx","go","rs","java","c","cpp","h","sh","bash","zsh","rb","php","swift","kt","lua","sql","yaml","yml","toml","json","xml","css","scss"].includes(n)?"source":"fallback":"fallback"}let DA=new Set(["txt","md","markdown","json","yaml","yml","toml","csv","tsv","xml","html","css","js","ts","tsx","jsx","sh","bash","zsh","rb","py","go","rs","java","c","cpp","h","php","swift","kt","lua","sql","scss","mmd","mermaid","ini","env","log","conf"]);function DS(e){let t=DN(e,"file");return"editor"===t||"text"===t||DA.has(DT(e))}function DC(e){return["md","markdown"].includes(DT(e))}function D_(e){return"image"===DN(e,"file")}async function DM(e){let t=await r$(`/api/wiki?dir=${encodeURIComponent(e)}`);return t.ok?(await t.json()).entries.map(t=>({name:t.name,path:e?`${e}/${t.name}`:t.name,type:t.type,size:t.size,modifiedAt:t.modifiedAt,expanded:!1})):[]}function DO(e,t,n){return e.map(e=>e.path===t?n(e):e.children?{...e,children:DO(e.children,t,n)}:e)}e.s(["default",0,function(){let e;ET(e=>e.loadedAt),(0,Q.useEffect)(()=>{ET.getState().load()},[]);let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(()=>rU()),[a,l]=(0,Q.useState)([]),[c,d]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(!1),h=(0,Q.useCallback)(async()=>{try{let e=await fetch("/api/system/workspaces");if(!e.ok)throw Error("Failed");let t=await e.json();if(l(t.workspaces),d(t.isAdmin),t.workspaces.length>0){n(!0);let e=new URLSearchParams(window.location.search).get("ws"),r=e?t.workspaces.find(t=>t.id===e):null,o=r??[...t.workspaces].sort((e,t)=>(t.lastOpenedAt??t.createdAt).localeCompare(e.lastOpenedAt??e.createdAt))[0];if(s(o.id),i(o.rootDir),!r){let e=new URL(location.href);e.searchParams.set("ws",o.id),history.replaceState(null,"",e.toString())}}else n(!1)}catch{n(!1)}},[]);(0,Q.useEffect)(()=>{h()},[h]);let f=Eg(e=>e.currentPath),m=(0,Q.useRef)(new URLSearchParams(window.location.search).get("path")),g=(0,Q.useRef)(!1),[b,y]=(0,Q.useState)([]),[x,v]=(0,Q.useState)(!1),[E,w]=(0,Q.useState)(!1),k=(0,Q.useRef)(!1),[T,N]=(0,Q.useState)(!1),[A,S]=(0,Q.useState)(!1),[C,_]=(0,Q.useState)(null),M=(0,Q.useRef)(null),O=(0,Q.useRef)(""),[I,D]=(0,Q.useState)(null),[R,L]=(0,Q.useState)(""),[P,j]=(0,Q.useState)(null),[B,F]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(""),[z,$]=(0,Q.useState)(null),[G,q]=(0,Q.useState)(null),[V,W]=(0,Q.useState)(!1),[K,Y]=(0,Q.useState)(null),[J,Z]=(0,Q.useState)(!1),[ee,et]=(0,Q.useState)(0),[en,e_]=(0,Q.useState)(!1),[eM,eO]=(0,Q.useState)(!1),[eI,eD]=(0,Q.useState)(null),[eR,eL]=(0,Q.useState)(0),[eP,ej]=(0,Q.useState)(!1),[eB,eF]=(0,Q.useState)(!1),[eH,eU]=(0,Q.useState)(""),[ez,e$]=(0,Q.useState)(!1),[eG,eq]=(0,Q.useState)(null),eV=(0,Q.useRef)(null),[eW,eK]=(0,Q.useState)(null),eY=(0,Q.useRef)(null),eX=(0,Q.useRef)(!1),eQ=(0,Q.useRef)(async()=>{});(0,Q.useEffect)(()=>{x||k.current||(k.current=!0,w(!0),DM("").then(e=>{y(e),v(!0),w(!1)}).catch(()=>{k.current=!1,w(!1)}))},[x]);let eJ=(0,Q.useCallback)(async e=>{let t=e.split("/");if(t.length<=1)return;let n=[],r="";for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push({prefix:r,children:await DM(r)});y(e=>{let t=e;for(let{prefix:e,children:r}of n)t=DO(t,e,e=>({...e,children:r,expanded:!0}));return t})},[]),eZ=(0,Q.useCallback)(async e=>{let t=await DM(e);""===e?y(e=>{let n=new Map(e.map(e=>[e.path,e]));return t.map(e=>{let t=n.get(e.path);return t&&("dir"===t.type||"app"===t.type)?{...e,expanded:t.expanded,children:t.children}:e})}):y(n=>DO(n,e,e=>({...e,children:t,expanded:!0})))},[]),e0=(0,Q.useCallback)(e=>{let t=[];for(let n of e)("dir"===n.type||"app"===n.type)&&n.expanded&&n.children&&(t.push(n.path),t.push(...e0(n.children)));return t},[]),e1=(0,Q.useCallback)(async()=>{N(!0);try{let e=e0(b),t=await DM("");for(let n of(y(t),e)){let e=await DM(n);y(t=>DO(t,n,t=>({...t,children:e,expanded:!0})))}}finally{N(!1)}},[b,e0]),e2=(0,Q.useCallback)(async()=>{if(K&&(["editor","text"].includes(DN(K.name,K.nodeType))||DS(K.name))){ej(!0);try{let e=await r$(`/api/wiki/content?path=${encodeURIComponent(K.path)}`);if(e.ok){let t=await e.json();eD(t.content),eL(Number(e.headers.get("X-Wiki-Revision")??0))}}catch{}ej(!1)}},[K]);async function e3(e){if("dir"===e.type||"app"===e.type)if(e.expanded)y(t=>DO(t,e.path,e=>({...e,expanded:!1})));else if(void 0===e.children){y(t=>DO(t,e.path,e=>({...e,loading:!0})));let t=await DM(e.path);y(n=>DO(n,e.path,e=>({...e,loading:!1,children:t,expanded:!0})))}else y(t=>DO(t,e.path,e=>({...e,expanded:!0})))}async function e5(e){if(Y({path:e.path,name:e.name,nodeType:"app"===e.type?"app":"node-app"===e.type?"node-app":"file"}),eF(!1),eq(null),eD(null),eL(0),["editor","text"].includes(DN(e.name,e.type))||DS(e.name)){ej(!0);try{let t=await r$(`/api/wiki/content?path=${encodeURIComponent(e.path)}`);if(t.ok){let e=await t.json();eD(e.content),eL(Number(t.headers.get("X-Wiki-Revision")??0))}}catch{}ej(!1)}}(0,Q.useEffect)(()=>{eY.current=K},[K]),(0,Q.useEffect)(()=>{eX.current=eB},[eB]),(0,Q.useEffect)(()=>{eQ.current=e2},[e2]),(0,Q.useEffect)(()=>{if(!t)return;let e=new Map,n=new EventSource(rz("/api/wiki/watch"));return n.onmessage=t=>{var n;let r;try{r=JSON.parse(t.data)}catch{return}let{type:i,path:o}=r,s=o.split("/");if(n=s.length>1?s.slice(0,-1).join("/"):"",e.has(n)&&clearTimeout(e.get(n)),e.set(n,setTimeout(()=>{e.delete(n),eZ(n)},300)),"change"===i&&eY.current?.path===o&&!eX.current){let t=`__file__${o}`;e.has(t)&&clearTimeout(e.get(t)),e.set(t,setTimeout(()=>{e.delete(t),eQ.current()},400))}},()=>{for(let t of(n.close(),e.values()))clearTimeout(t)}},[t,eZ]),(0,Q.useEffect)(()=>{Z(!1)},[]);let e4=(0,Q.useCallback)(e=>{let t=e.split("/").pop()??e;eJ(e),e5({path:e,name:t,type:"file"})},[eJ]);(0,Q.useEffect)(()=>{if(!f||K&&K.path===f)return;let e=f.split("/").pop()??f;e5({path:f,name:e,type:"file"})},[f]),(0,Q.useEffect)(()=>{let e=new URL(window.location.href);K?e.searchParams.set("path",K.path):e.searchParams.delete("path"),window.history.replaceState(null,"",e.toString())},[K]),(0,Q.useEffect)(()=>{if(g.current||!x)return;let e=m.current;if(!e){g.current=!0;return}g.current=!0,(async()=>{let t=e.split("/"),n=t[t.length-1],r=t.slice(0,-1).join("/"),i=(await DM(r)).find(t=>t.path===e);i&&(await eJ(e),e5({path:e,name:n,type:i.type,modifiedAt:i.modifiedAt}))})()},[x,eJ]);let e6=(0,Q.useCallback)(async e=>{if(e===o)return;try{await fetch(`/api/system/workspaces/${e}/open`,{method:"POST"})}catch{}let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.pushState(null,"",t.toString()),Y(null),eD(null),eF(!1),y([]),v(!1),k.current=!1,ET.getState().invalidate();let n=a.find(t=>t.id===e);n&&i(n.rootDir),s(e)},[o,a]);async function e9(){if(!K)return;e$(!0),eq(null);let e=await r$("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:K.path,content:eH,baseRevision:eR})});if(e.ok){let t=await e.json();"number"==typeof t.revision&&eL(t.revision),eD(eH),eF(!1)}else eq((await e.json()).error??"Save failed");e$(!1)}let e7=(0,Q.useCallback)(async(e,t)=>{let n=Array.from(e);if(n.length){S(!0),_(null);try{for(let e of n){let n=new FormData;n.append("file",e),n.append("dir",t);let r=await r$("/api/wiki/upload",{method:"POST",body:n});if(!r.ok){let e=await r.json();_(e.error??"Upload failed"),_d(e.error??"Upload failed");break}}await eZ(t)}catch{_("Upload failed.")}finally{S(!1),M.current&&(M.current.value="")}}},[eZ]);function e8(e){O.current=e,M.current?.click()}async function te(){let e=R.trim();if(!e||null===I)return;j(null);let t=I?`${I}/${e}`:e,n=await r$("/api/wiki/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});n.ok?(D(null),L(""),await eZ(I),""!==I&&y(e=>DO(e,I,e=>({...e,expanded:!0})))):j((await n.json()).error??"Failed")}async function tt(){let e=H.trim();if(!e||null===B)return;$(null);let t=e.includes(".")?e:`${e}.md`,n=B?`${B}/${t}`:t,r=await r$("/api/wiki/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});r.ok?(F(null),U(""),await eZ(B),""!==B&&y(e=>DO(e,B,e=>({...e,expanded:!0}))),e5({path:n,name:t,type:"file",modifiedAt:new Date().toISOString()})):$((await r.json()).error??"Failed")}async function tn(){G&&(await r$("/api/wiki",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:G})}),(K?.path===G||K?.path.startsWith(`${G}/`))&&(Y(null),eD(null)),y(e=>(function e(t,n){return t.filter(e=>e.path!==n).map(t=>t.children?{...t,children:e(t.children,n)}:t)})(e,G)),q(null))}function tr(e,t,n){e.preventDefault(),e.stopPropagation();let r=eV.current;!r||r.path===t||t.startsWith(`${r.path}/`)||(e.dataTransfer.dropEffect="move",eK("root"===n?"":t))}async function ti(e,t){e.preventDefault(),e.stopPropagation(),eK(null);let n=eV.current;if(eV.current=null,!n||n.path===t||t.startsWith(`${n.path}/`))return;let r=t?`${t}/${n.name}`:n.name;if(r!==n.path&&(await r$("/api/wiki/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:n.path,to:r})})).ok){let e=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"";await eZ(e),t!==e&&await eZ(t),K?.path===n.path&&Y({path:r,name:n.name,nodeType:K.nodeType})}}let to=K?DN(K.name,K.nodeType):null,ts=Ek(e=>e.width),ta=null===to||"editor"===to||"text"===to||"source"===to||"notebook"===to||"fallback"===to,tl=ta?Ex[ts]:"";return(0,X.jsxs)("div",{className:"flex h-screen gap-0 overflow-hidden bg-background",children:[null===t&&(0,X.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!1===t&&(0,X.jsx)(MD,{onSelect:e=>{let t=new URL(location.href);t.searchParams.set("ws",e),t.searchParams.delete("path"),history.replaceState(null,"",t.toString()),v(!1),k.current=!1,s(e),n(!0),h()}}),!0===t&&u&&(0,X.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,X.jsx)("div",{className:"flex items-center justify-end border-b px-3 py-2 bg-muted shrink-0",children:(0,X.jsxs)(tq,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>p(!1),children:[(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})," Cancel"]})}),(0,X.jsx)(MD,{onSelect:e=>{p(!1),h(),e6(e)}})]}),!0===t&&!u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(DE,{onOpenFile:e4}),!en&&(0,X.jsxs)(Iw,{className:"flex flex-col w-72 shrink-0 overflow-hidden rounded-none border-r border-l-0 border-t-0 border-b-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,X.jsx)("img",{src:"/logo.svg",alt:"Wiki Viewer",className:"h-5 w-5 shrink-0"}),(0,X.jsx)("span",{className:"truncate text-xs font-semibold tracking-tight",children:"Wiki Viewer"})]}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 shrink-0",title:"Collapse sidebar",onClick:()=>e_(!0),children:(0,X.jsx)(ex,{className:"h-3.5 w-3.5"})})]}),(0,X.jsxs)("div",{className:"flex items-center justify-between gap-1 px-3 py-1.5 border-b bg-muted/50 shrink-0",children:[(0,X.jsxs)(O5,{children:[(0,X.jsx)(O6,{asChild:!0,children:(0,X.jsxs)(tq,{size:"sm",variant:"ghost",className:"h-7 gap-1 px-2 text-xs",disabled:A,children:[A?(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ew,{className:"h-3.5 w-3.5"}),"New",(0,X.jsx)(es,{className:"h-3 w-3 opacity-60"})]})}),(0,X.jsxs)(Ic,{align:"start",className:"w-44",children:[(0,X.jsxs)(Id,{onClick:()=>{F(""),U(""),$(null)},children:[(0,X.jsx)(ed,{className:"mr-2 h-3.5 w-3.5"}),"New file"]}),(0,X.jsxs)(Id,{onClick:()=>{D(""),L(""),j(null)},children:[(0,X.jsx)(ef,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}),(0,X.jsxs)(Id,{onClick:()=>e8(""),disabled:A,children:[(0,X.jsx)(eS,{className:"mr-2 h-3.5 w-3.5"}),"Upload"]})]})]}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh tree",onClick:e1,disabled:T,children:T?(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(Im,{}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"AI Agent panel",onClick:()=>Eo.getState().toggle(),children:(0,X.jsx)(ei,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Settings",onClick:()=>eO(!0),children:(0,X.jsx)(eT,{className:"h-3.5 w-3.5"})})]})]}),C&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-destructive bg-destructive/10 shrink-0",children:[(0,X.jsx)(er,{className:"h-3.5 w-3.5 shrink-0"}),C]}),""===I&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:R,onChange:e=>L(e.target.value),onKeyDown:e=>{"Enter"===e.key&&te(),"Escape"===e.key&&(D(null),L(""))}}),P&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:P}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:te,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{D(null),L("")},children:(0,X.jsx)(eC,{className:"h-3 w-3"})})]}),""===B&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 border-b shrink-0",children:[(0,X.jsx)(eu,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:H,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tt(),"Escape"===e.key&&(F(null),U(""))}}),z&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:z}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tt,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{F(null),U("")},children:(0,X.jsx)(eC,{className:"h-3 w-3"})})]}),(0,X.jsx)("div",{className:"border-b",children:(0,X.jsx)(Dw,{onOpenFile:e4})}),(0,X.jsx)("div",{className:t$("flex-1 overflow-auto py-1",""===eW&&"ring-2 ring-inset ring-primary bg-primary/5"),onDragOver:e=>tr(e,"","root"),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||eK(null)},onDrop:e=>ti(e,""),children:E?(0,X.jsx)("div",{className:"flex justify-center py-6",children:(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):0===b.length?(0,X.jsxs)("div",{className:"flex flex-col items-center gap-3 px-4 py-8 text-center",children:[(0,X.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,X.jsx)(eu,{className:"h-6 w-6 text-muted-foreground"})}),(0,X.jsxs)("div",{className:"space-y-1",children:[(0,X.jsx)("p",{className:"text-sm font-medium",children:"No files yet"}),(0,X.jsx)("p",{className:"text-xs text-muted-foreground",children:"Upload files or add them to the configured directory"})]}),(0,X.jsxs)(tq,{size:"sm",variant:"outline",className:"w-full gap-1.5 max-w-[180px]",onClick:()=>e8(""),disabled:A,children:[A?(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(eS,{className:"h-3.5 w-3.5"}),"Upload Files"]})]}):function e(t,n=0){return t.map(t=>(0,X.jsxs)("div",{children:[(0,X.jsxs)("div",{role:"treeitem",tabIndex:0,draggable:!0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),"dir"===t.type?e3(t):"app"===t.type?(e5(t),e3(t)):e5(t))},onDragStart:e=>{eV.current=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.path)},onDragOver:e=>"dir"===t.type?tr(e,t.path,"dir"):e.preventDefault(),onDragLeave:()=>eK(null),onDrop:e=>"dir"===t.type?ti(e,t.path):e.preventDefault(),className:t$("flex items-center gap-1.5 rounded-sm px-2 py-1 text-sm cursor-pointer group transition-colors select-none",K?.path===t.path?"bg-accent-soft text-foreground font-medium":"hover:bg-muted",eW===t.path&&"ring-2 ring-primary bg-primary-soft",t.name.startsWith(".")&&"opacity-40"),style:{paddingLeft:`${14*n+8}px`},onClick:()=>{"dir"===t.type?e3(t):"app"===t.type?(e5(t),e3(t)):e5(t)},children:["dir"===t.type||"app"===t.type?t.loading?(0,X.jsx)(eb,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):t.expanded?(0,X.jsx)(es,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)(ea,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),"dir"===t.type?t.expanded?(0,X.jsx)(eh,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-warning")}):(0,X.jsx)(ep,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-warning")}):"app"===t.type?(0,X.jsx)(em,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-foreground/70")}):"node-app"===t.type?(0,X.jsx)(eN,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-emerald-500")}):"html"===DN(t.name,"file")?(0,X.jsx)(em,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-foreground/60")}):D_(t.name)?(0,X.jsx)(eg,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-sunshine-700")}):DS(t.name)?(0,X.jsx)(eu,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-foreground/70")}):(0,X.jsx)(ec,{className:t$("h-4 w-4 shrink-0",K?.path!==t.path&&"text-foreground/60")}),(0,X.jsx)("span",{className:"flex-1 truncate",children:t.name}),(0,X.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:["dir"===t.type&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"New file here (default .md)",onClick:async()=>{t.expanded||await e3(t),F(t.path),U(""),$(null)},children:(0,X.jsx)(ed,{className:"h-3 w-3"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"Upload here",onClick:()=>e8(t.path),children:(0,X.jsx)(eS,{className:"h-3 w-3"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"New subfolder",onClick:()=>{D(t.path),L(""),j(null)},children:(0,X.jsx)(ef,{className:"h-3 w-3"})})]}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",title:"file"===t.type?"Download":"Download as zip",onClick:()=>{let e,n;return e=rz(`/api/wiki/download?path=${encodeURIComponent(t.path)}`),void((n=document.createElement("a")).href=e,n.download="file"===t.type?t.name:`${t.name}.zip`,document.body.appendChild(n),n.click(),n.remove())},children:(0,X.jsx)(el,{className:"h-3 w-3"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-destructive hover:text-destructive",title:"Delete",onClick:()=>{q(t.path),W("file"!==t.type)},children:(0,X.jsx)(eA,{className:"h-3 w-3"})})]})]}),I===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(ep,{className:"h-4 w-4 shrink-0 text-warning"}),(0,X.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"Folder name",value:R,onChange:e=>L(e.target.value),onKeyDown:e=>{"Enter"===e.key&&te(),"Escape"===e.key&&(D(null),L(""))}}),P&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:P}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:te,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{D(null),L("")},children:(0,X.jsx)(eC,{className:"h-3 w-3"})})]}),B===t.path&&"dir"===t.type&&(0,X.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${(n+1)*14+8}px`},children:[(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsx)(eu,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("input",{autoFocus:!0,className:"flex-1 bg-transparent text-sm outline-none border-b border-border min-w-0",placeholder:"filename (default .md)",value:H,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key&&tt(),"Escape"===e.key&&(F(null),U(""))}}),z&&(0,X.jsx)("span",{className:"text-xs text-destructive",children:z}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:tt,children:(0,X.jsx)(eo,{className:"h-3 w-3"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{F(null),U("")},children:(0,X.jsx)(eC,{className:"h-3 w-3"})})]}),("dir"===t.type||"app"===t.type)&&t.expanded&&t.children&&t.children.length>0&&e(t.children,n+1),("dir"===t.type||"app"===t.type)&&t.expanded&&t.children?.length===0&&(0,X.jsx)("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(n+1)*14+8+14+6+16+6}px`},children:"Empty"})]},t.path))}(b)}),(0,X.jsx)("div",{className:"border-t px-2 py-2 bg-muted shrink-0",children:(0,X.jsxs)(O5,{children:[(0,X.jsx)(O6,{asChild:!0,children:(0,X.jsxs)(tq,{size:"sm",variant:"ghost",className:"w-full h-auto justify-between gap-2 px-2 py-1.5 text-left",title:r??"",children:[(0,X.jsxs)("span",{className:"flex flex-col min-w-0",children:[(0,X.jsx)("span",{className:"truncate text-xs font-medium",children:a.find(e=>e.id===o)?.name??"Workspace"}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:r??""})]}),(0,X.jsx)(es,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),(0,X.jsxs)(Ic,{align:"start",className:"w-60",children:[a.map(e=>(0,X.jsxs)(Id,{onClick:()=>void e6(e.id),className:t$("gap-2",e.id===o&&"font-medium"),children:[e.id===o?(0,X.jsx)(eo,{className:"h-3.5 w-3.5 shrink-0"}):(0,X.jsx)("span",{className:"w-3.5 shrink-0"}),(0,X.jsxs)("span",{className:"flex flex-col min-w-0",children:[(0,X.jsx)("span",{className:"truncate",children:e.name}),(0,X.jsx)("span",{className:"truncate text-[10px] text-muted-foreground font-mono",children:e.rootDir})]})]},e.id)),c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Iu,{}),(0,X.jsxs)(Id,{onClick:()=>p(!0),children:[(0,X.jsx)(ef,{className:"mr-2 h-3.5 w-3.5"}),"Add workspace…"]})]})]})]})})]}),(0,X.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[en&&(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-7 w-7 p-0 rounded-full bg-background/50 backdrop-blur-xl backdrop-saturate-150 border border-white/[0.08] text-foreground/60 hover:text-foreground/90 hover:bg-background/70 shadow-[0_0_12px_rgba(0,0,0,0.15)] [transform:translate(-50%,-50%)_translateZ(0)]",title:"Show sidebar",onClick:()=>e_(!1),children:(0,X.jsx)(ev,{className:"h-3.5 w-3.5"})}),K?"node-app"===to?(0,X.jsx)(MC,{path:K.path,title:K.name}):"app"===to||"html"===to?(e="html"===to?`/api/assets/${K.path}`:void 0,J?(0,X.jsx)(MT,{path:K.path,title:K.name,src:e,fullscreen:!0,onExit:()=>Z(!1)}):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,X.jsx)(em,{className:"h-4 w-4 shrink-0 text-accent"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:K.path,children:K.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["html"===to&&!eB&&null!==eI&&(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Edit source",onClick:()=>{eF(!0),eU(eI),eq(null)},children:(0,X.jsx)(eE,{className:"h-3.5 w-3.5"})}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:()=>et(e=>e+1),children:(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})}),(0,X.jsxs)(tq,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>Z(!0),children:[(0,X.jsx)(ey,{className:"h-3.5 w-3.5"}),"Open fullscreen"]}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{Y(null),eF(!1)},children:(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})})]})]}),eB&&"html"===to?(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,X.jsx)("textarea",{value:eH,onChange:e=>eU(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"}),(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[eG&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:eG}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",onClick:()=>{eF(!1),eq(null)},children:"Cancel"}),(0,X.jsxs)(tq,{size:"sm",className:"gap-1",onClick:e9,disabled:ez,children:[ez&&(0,X.jsx)(eb,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)(MT,{path:K.path,title:K.name,src:e},ee)]})):(0,X.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,X.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted shrink-0",children:[(0,X.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[D_(K.name)?(0,X.jsx)(eg,{className:"h-4 w-4 shrink-0 text-sunshine-700"}):DS(K.name)?(0,X.jsx)(eu,{className:"h-4 w-4 shrink-0 text-accent"}):(0,X.jsx)(ec,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,X.jsx)("span",{className:"text-sm font-normal truncate",title:K.path,children:K.path})]}),(0,X.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[DS(K.name)&&!eB&&null!==eI&&(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{eF(!0),eU(eI),eq(null),DC(K.name)&&Eg.getState().loadPage(K.path)},children:(0,X.jsx)(eE,{className:"h-3.5 w-3.5"})}),DS(K.name)&&!eB&&null!==eI&&(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"Refresh",onClick:e2,disabled:eP,children:eP?(0,X.jsx)(eb,{className:"h-3.5 w-3.5 animate-spin"}):(0,X.jsx)(ek,{className:"h-3.5 w-3.5"})}),ta&&(0,X.jsx)(Dk,{}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>{Y(null),eD(null),eF(!1)},children:(0,X.jsx)(eC,{className:"h-3.5 w-3.5"})})]})]}),eB?(0,X.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:DC(K.name)?(0,X.jsx)(_y,{}):(0,X.jsx)("textarea",{value:eH,onChange:e=>eU(e.target.value),spellCheck:!1,className:"flex-1 w-full min-h-0 resize-none bg-background text-foreground px-4 py-3 font-mono text-[13px] leading-relaxed outline-none border-0"})}):(0,X.jsx)("div",{className:"flex-1 overflow-auto p-4 min-h-0",children:(0,X.jsx)("div",{className:t$("mx-auto w-full",tl),children:eP?(0,X.jsx)("div",{className:"flex justify-center py-8",children:(0,X.jsx)(eb,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):"csv"===to?(0,X.jsx)(rW,{path:K.path,title:K.name}):"pdf"===to?(0,X.jsx)(Mx,{path:K.path,title:K.name}):"mermaid"===to?(0,X.jsx)(_S,{path:K.path,title:K.name}):"notebook"===to?(0,X.jsx)(Mf,{path:K.path,title:K.name}):"image"===to?(0,X.jsx)(_v,{path:K.path,title:K.name}):"media"===to?(0,X.jsx)(_E,{path:K.path,title:K.name,type:["mp4","webm","mov","m4v"].includes(DT(K.name))?"video":"audio"}):"docx"===to?(0,X.jsx)(Mg,{path:K.path,title:K.name}):"xlsx"===to?(0,X.jsx)(My,{path:K.path,title:K.name}):"pptx"===to?(0,X.jsx)(Mb,{path:K.path,title:K.name}):"source"===to?(0,X.jsx)(Mk,{path:K.path,title:K.name}):"fallback"===to?(0,X.jsx)(_x,{path:K.path,title:K.name}):null!==eI?["md","markdown"].includes(DT(K.name))?(()=>{let{data:e,body:t}=function(e){let t=IC.exec(e);if(!t)return{data:{},body:e};let n=t[1],r=e.slice(t[0].length),i=n.split(/\r?\n/).find(e=>""!==e.trim())??"";if(/^\s*(#{1,6}\s|<|>|-\s|\*\s|\d+\.\s)/.test(i))return{data:{},body:e};let o={},s=n.split(/\r?\n/),a=0;for(;a<s.length;){let e=s[a];if(!e||/^\s*#/.test(e)){a+=1;continue}let t=/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(e);if(!t){a+=1;continue}let n=t[1],r=t[2];if(""===r.trim()){let e=[],t=a+1;for(;t<s.length&&/^\s+-\s+/.test(s[t]);){let n=/^\s+-\s+(.*)$/.exec(s[t]);n&&e.push(I_(n[1])),t+=1}if(e.length>0){o[n]=e,a=t;continue}o[n]="",a+=1;continue}o[n]=I_(r),a+=1}return 0===Object.keys(o).length?{data:{},body:e}:{data:o,body:r}}(eI);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(IA,{data:e}),(0,X.jsx)(IS,{markdown:t,pagePath:K.path,onNavigate:(e,t)=>{e5({path:e,name:e.split("/").pop()??e,type:"file"}),t&&setTimeout(()=>{document.getElementById(t)?.scrollIntoView({behavior:"smooth"})},200)}})]})})():(0,X.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words leading-relaxed",children:eI}):DS(K.name)?(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Could not load file."}):(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Preview not available for this file type."})})}),eB&&(0,X.jsxs)("div",{className:"border-t px-4 py-2 flex items-center justify-end gap-2 bg-muted shrink-0",children:[eG&&(0,X.jsx)("span",{className:"text-xs text-destructive mr-auto",children:eG}),(0,X.jsx)(tq,{size:"sm",variant:"ghost",onClick:()=>{eF(!1),eq(null)},children:"Cancel"}),(0,X.jsxs)(tq,{size:"sm",className:"gap-1",onClick:e9,disabled:ez,children:[ez&&(0,X.jsx)(eb,{className:"h-3 w-3 animate-spin"}),"Save"]})]})]}):(0,X.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center",children:(0,X.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[(0,X.jsx)(eu,{className:"h-8 w-8 text-muted-foreground"}),(0,X.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a file to view or edit"})]})})]}),(0,X.jsx)(IE,{open:eM,onOpenChange:eO}),(0,X.jsx)(Iz,{currentPath:K?.path}),(0,X.jsx)("input",{ref:M,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&e7(e.target.files,O.current)}}),(0,X.jsx)(rP,{open:!!G,onOpenChange:e=>{e||q(null)},title:V?"Delete folder?":"Delete file?",description:V?`"${G?.split("/").pop()}" and all its contents will be permanently deleted.`:`"${G?.split("/").pop()}" will be permanently removed.`,onConfirm:tn})]})]},o??"none")}],952683)}]);
|