@profoundlogic/coderflow-server 0.5.2 → 0.5.3
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/dist/coder-server.js +1 -1
- package/dist/config.js +1 -1
- package/dist/lib/agent-keepalive.js +1 -1
- package/dist/lib/agent-models.js +1 -1
- package/dist/lib/api-keys.js +1 -1
- package/dist/lib/apiKeys.js +1 -1
- package/dist/lib/app-server-ports.js +1 -1
- package/dist/lib/auto-judge.js +1 -1
- package/dist/lib/automation-service.js +1 -1
- package/dist/lib/basic-auth.js +1 -1
- package/dist/lib/bindings.js +1 -1
- package/dist/lib/build-history.js +1 -1
- package/dist/lib/build-output-service.js +1 -1
- package/dist/lib/build-scheduler.js +1 -1
- package/dist/lib/build-service.js +1 -1
- package/dist/lib/ca-certificates.js +1 -1
- package/dist/lib/claude-oauth-refresh.js +1 -1
- package/dist/lib/cli/build.js +1 -1
- package/dist/lib/cli/cleanup-users.js +1 -1
- package/dist/lib/cli/config-command.js +1 -1
- package/dist/lib/cli/config.js +1 -1
- package/dist/lib/cli/create-user.js +1 -1
- package/dist/lib/cli/grant-admin.js +1 -1
- package/dist/lib/cli/init.js +1 -1
- package/dist/lib/cli/jira.js +1 -1
- package/dist/lib/cli/license.js +1 -1
- package/dist/lib/cli/list-roles.js +1 -1
- package/dist/lib/cli/list-users.js +1 -1
- package/dist/lib/cli/server-manager.js +1 -1
- package/dist/lib/cli/set-password.js +1 -1
- package/dist/lib/config-migration.js +1 -1
- package/dist/lib/container-credential-sync.js +1 -1
- package/dist/lib/container-tokens.js +1 -1
- package/dist/lib/data-dir.js +1 -1
- package/dist/lib/deployment-history.js +1 -1
- package/dist/lib/deployment-service.js +1 -1
- package/dist/lib/docker-utils.js +1 -1
- package/dist/lib/email.js +1 -1
- package/dist/lib/emailTemplates.js +1 -1
- package/dist/lib/entitlement.js +1 -1
- package/dist/lib/external-connections.js +1 -1
- package/dist/lib/fetch-utils.js +1 -1
- package/dist/lib/git-commit-details-route.js +1 -1
- package/dist/lib/git-history-diff-guardrails.js +1 -1
- package/dist/lib/git-provider-service.js +1 -1
- package/dist/lib/git-provider-setup/github-setup-handler.js +1 -1
- package/dist/lib/git-provider-setup/index.js +1 -1
- package/dist/lib/git-provider-setup/setup-factory.js +1 -1
- package/dist/lib/git-provider-setup/setup-interface.js +1 -1
- package/dist/lib/git-providers/azure-devops-provider.js +1 -1
- package/dist/lib/git-providers/github-app-provider.js +1 -1
- package/dist/lib/git-providers/index.js +1 -1
- package/dist/lib/git-providers/provider-factory.js +1 -1
- package/dist/lib/git-providers/provider-interface.js +1 -1
- package/dist/lib/github-urls.js +1 -1
- package/dist/lib/group-objective-linking.js +1 -1
- package/dist/lib/ibmi-sync.js +1 -1
- package/dist/lib/jira-client.js +1 -1
- package/dist/lib/judge-blinding.js +1 -1
- package/dist/lib/logger.js +1 -1
- package/dist/lib/migration-to-scoped-rbac.js +1 -1
- package/dist/lib/model-fetcher.js +1 -1
- package/dist/lib/notifications.js +1 -1
- package/dist/lib/objective-context.js +1 -1
- package/dist/lib/oidc-auth.js +1 -1
- package/dist/lib/oidc-device-flow.js +1 -1
- package/dist/lib/passwordTokens.js +1 -1
- package/dist/lib/permission-resolver.js +1 -1
- package/dist/lib/pin-cascade.js +1 -1
- package/dist/lib/provider-accounts.js +1 -1
- package/dist/lib/provider-oauth.js +1 -1
- package/dist/lib/provider-profile.js +1 -1
- package/dist/lib/provider-token-refresh.js +1 -1
- package/dist/lib/rbac-user-state.js +1 -1
- package/dist/lib/request-url.js +1 -1
- package/dist/lib/rewind.js +1 -1
- package/dist/lib/role-definitions.js +1 -1
- package/dist/lib/roles.js +1 -1
- package/dist/lib/secrets.js +1 -1
- package/dist/lib/setup-repo-git-auth.js +1 -1
- package/dist/lib/state-capture.js +1 -1
- package/dist/lib/static-files.js +1 -1
- package/dist/lib/task-name-format.js +1 -1
- package/dist/lib/task-name-generator.js +1 -1
- package/dist/lib/task-source-metadata.js +1 -1
- package/dist/lib/teams.js +1 -1
- package/dist/lib/user-git-oauth.js +1 -1
- package/dist/lib/user-git-tokens.js +1 -1
- package/dist/lib/users.js +1 -1
- package/dist/middleware/requireAuth.js +1 -1
- package/dist/middleware/requireInit.js +1 -1
- package/dist/middleware/requirePermission.js +1 -1
- package/dist/package.json +1 -1
- package/dist/playwright.config.js +1 -1
- package/dist/routes/apiKeys.js +1 -1
- package/dist/routes/auth-oidc.js +1 -1
- package/dist/routes/auth.js +1 -1
- package/dist/routes/automations.js +1 -1
- package/dist/routes/bindings.js +1 -1
- package/dist/routes/build.js +1 -1
- package/dist/routes/containers.js +1 -1
- package/dist/routes/deploy-task.js +1 -1
- package/dist/routes/environment-management.js +1 -1
- package/dist/routes/environments.js +1 -1
- package/dist/routes/external-skills.js +1 -1
- package/dist/routes/git-credentials.js +1 -1
- package/dist/routes/git-oauth.js +1 -1
- package/dist/routes/git-provider-setup.js +1 -1
- package/dist/routes/health.js +1 -1
- package/dist/routes/jira.js +1 -1
- package/dist/routes/objective-management.js +1 -1
- package/dist/routes/password.js +1 -1
- package/dist/routes/prompt.js +1 -1
- package/dist/routes/provider-auth.js +1 -1
- package/dist/routes/qa.js +1 -1
- package/dist/routes/roles.js +1 -1
- package/dist/routes/settings.js +1 -1
- package/dist/routes/skill-management.js +1 -1
- package/dist/routes/skills.js +1 -1
- package/dist/routes/tasks.js +1 -1
- package/dist/routes/teams.js +1 -1
- package/dist/routes/templates.js +1 -1
- package/dist/routes/test-task.js +1 -1
- package/dist/routes/test.js +1 -1
- package/dist/routes/users.js +1 -1
- package/dist/routes/visualizations.js +1 -1
- package/dist/scripts/create-user.js +1 -1
- package/dist/scripts/migrate-config-to-data-dir.js +1 -1
- package/dist/start.js +1 -1
- package/dist/web-ui/public/activity-detail-modal.js +1 -1
- package/dist/web-ui/public/activity-feed.js +1 -1
- package/dist/web-ui/public/activity-formatters.js +1 -1
- package/dist/web-ui/public/agent-event-parser.js +1 -1
- package/dist/web-ui/public/app.js +1 -1
- package/dist/web-ui/public/approve-dialog.js +1 -1
- package/dist/web-ui/public/automation-links.js +1 -1
- package/dist/web-ui/public/automation-schedule.js +1 -1
- package/dist/web-ui/public/comments-widget.js +1 -1
- package/dist/web-ui/public/diff-utils.js +1 -1
- package/dist/web-ui/public/environments.js +1 -1
- package/dist/web-ui/public/feedback-widget.js +1 -1
- package/dist/web-ui/public/git-history-lazy-utils.js +1 -1
- package/dist/web-ui/public/git-history.js +1 -1
- package/dist/web-ui/public/git-status.js +1 -1
- package/dist/web-ui/public/index.html +1 -1
- package/dist/web-ui/public/index.js +1 -1
- package/dist/web-ui/public/login.js +1 -1
- package/dist/web-ui/public/markdown-editor.js +1 -1
- package/dist/web-ui/public/markdown-file-editor.js +1 -1
- package/dist/web-ui/public/modal-maximize.js +1 -1
- package/dist/web-ui/public/notifications.js +1 -1
- package/dist/web-ui/public/pr-dialog.js +1 -1
- package/dist/web-ui/public/roles.js +1 -1
- package/dist/web-ui/public/server-health.js +1 -1
- package/dist/web-ui/public/settings.js +1 -1
- package/dist/web-ui/public/setup-password.js +1 -1
- package/dist/web-ui/public/skills.js +1 -1
- package/dist/web-ui/public/sse-client.js +1 -1
- package/dist/web-ui/public/sse-shared-worker.js +1 -1
- package/dist/web-ui/public/task.js +1 -1
- package/dist/web-ui/public/teams.js +1 -1
- package/dist/web-ui/public/terminal.js +1 -1
- package/dist/web-ui/public/theme.js +1 -1
- package/dist/web-ui/public/users.js +1 -1
- package/dist/web-ui/public/variant-grouping.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initTheme,mountThemeToggle}from'./theme.js';const OIDC_ERRORS={'oidc_init_failed':'Failed\x20to\x20connect\x20to\x20the\x20identity\x20provider.\x20Please\x20try\x20again.','oidc_not_configured':'Single\x20sign-on\x20is\x20not\x20configured.\x20Please\x20use\x20local\x20login.','oidc_error':'Authentication\x20was\x20cancelled\x20or\x20failed.','oidc_invalid_callback':'Invalid\x20authentication\x20response.\x20Please\x20try\x20again.','oidc_no_email':'Your\x20identity\x20provider\x20did\x20not\x20provide\x20an\x20email\x20address.\x20Please\x20contact\x20your\x20administrator.','oidc_user_not_found':'Your\x20account\x20is\x20not\x20authorized\x20to\x20access\x20this\x20application.\x20Please\x20contact\x20your\x20administrator.','oidc_invalid_state':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_session_expired':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_callback_failed':'Authentication\x20failed.\x20Please\x20try\x20again.','session_failed':'Failed\x20to\x20create\x20session.\x20Please\x20try\x20again.'};async function loadOidcConfig(){try{const
|
|
1
|
+
import{initTheme,mountThemeToggle}from'./theme.js';const OIDC_ERRORS={'oidc_init_failed':'Failed\x20to\x20connect\x20to\x20the\x20identity\x20provider.\x20Please\x20try\x20again.','oidc_not_configured':'Single\x20sign-on\x20is\x20not\x20configured.\x20Please\x20use\x20local\x20login.','oidc_error':'Authentication\x20was\x20cancelled\x20or\x20failed.','oidc_invalid_callback':'Invalid\x20authentication\x20response.\x20Please\x20try\x20again.','oidc_no_email':'Your\x20identity\x20provider\x20did\x20not\x20provide\x20an\x20email\x20address.\x20Please\x20contact\x20your\x20administrator.','oidc_user_not_found':'Your\x20account\x20is\x20not\x20authorized\x20to\x20access\x20this\x20application.\x20Please\x20contact\x20your\x20administrator.','oidc_invalid_state':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_session_expired':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_callback_failed':'Authentication\x20failed.\x20Please\x20try\x20again.','session_failed':'Failed\x20to\x20create\x20session.\x20Please\x20try\x20again.'};async function loadOidcConfig(){try{const _0x4a3a13=await fetch('/auth/oidc/config');if(_0x4a3a13['ok'])return await _0x4a3a13['json']();}catch(_0xf92f9a){console['error']('Failed\x20to\x20load\x20OIDC\x20configuration:',_0xf92f9a);}return{'enabled':![]};}function initializeSsoUi(_0x46877d){const _0x7e99a9=document['getElementById']('sso-section'),_0x489159=document['getElementById']('sso-divider'),_0x35e320=document['getElementById']('sso-button-text'),_0x422266=document['getElementById']('sso-button'),_0x5dc223=document['querySelector']('.local-auth-section');_0x46877d['enabled']&&(_0x7e99a9['classList']['add']('visible'),_0x35e320['textContent']=_0x46877d['display_name']||'Sign\x20in\x20with\x20SSO',_0x422266['addEventListener']('click',()=>{window['location']['href']='/auth/oidc/login';}),!_0x46877d['allow_local_auth']&&(_0x5dc223['classList']['add']('hidden'),_0x489159['style']['display']='none'));}function checkOidcErrors(){const _0x26f7f1=new URLSearchParams(window['location']['search']),_0x26ba5c=_0x26f7f1['get']('error'),_0x18c1bf=_0x26f7f1['get']('message');if(_0x26ba5c){const _0x4da800=document['getElementById']('login-error'),_0x16f45a=_0x18c1bf||OIDC_ERRORS[_0x26ba5c]||'Authentication\x20error:\x20'+_0x26ba5c;_0x4da800['textContent']=_0x16f45a,_0x4da800['classList']['add']('visible'),window['history']['replaceState']({},document['title'],window['location']['pathname']);}}async function handleLogin(_0x4397cd){_0x4397cd['preventDefault']();const _0x2c9f11=_0x4397cd['target'],_0xb90289=_0x2c9f11['username']['value']['trim'](),_0x12615f=_0x2c9f11['password']['value'],_0x126368=_0x2c9f11['querySelector']('button[type=\x22submit\x22]'),_0x3b15c6=document['getElementById']('login-error');_0x3b15c6['classList']['remove']('visible'),_0x3b15c6['textContent']='',_0x126368['disabled']=!![],_0x126368['textContent']='Signing\x20in...';try{const _0x34f20f=await fetch('/auth/login',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify']({'username':_0xb90289,'password':_0x12615f})}),_0x57bf51=await _0x34f20f['json']();if(!_0x34f20f['ok'])throw new Error(_0x57bf51['message']||'Login\x20failed');window['location']['href']='index.html';}catch(_0x3867b5){_0x3b15c6['textContent']=_0x3867b5['message']||'An\x20error\x20occurred\x20during\x20login',_0x3b15c6['classList']['add']('visible'),_0x126368['disabled']=![],_0x126368['textContent']='Sign\x20In',_0x2c9f11['password']['value']='',_0x2c9f11['password']['focus']();}}document['addEventListener']('DOMContentLoaded',async()=>{initTheme(),mountThemeToggle(),checkOidcErrors();const _0x296ae2=await loadOidcConfig();initializeSsoUi(_0x296ae2);const _0x239706=document['getElementById']('login-form');_0x239706&&_0x239706['addEventListener']('submit',handleLogin);});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const ATTACHMENT_SCHEME='attachment:',INTERNAL_DRAG_MIME='application/x-profound-editor-image',LINK_DIALOG_STYLE_ID='markdown-editor-link-dialog-styles',ICONS={'bold':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M6\x204h8a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path><path\x20d=\x22M6\x2012h9a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path></svg>','italic':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2219\x22\x20y1=\x224\x22\x20x2=\x2210\x22\x20y2=\x224\x22></line><line\x20x1=\x2214\x22\x20y1=\x2220\x22\x20x2=\x225\x22\x20y2=\x2220\x22></line><line\x20x1=\x2215\x22\x20y1=\x224\x22\x20x2=\x229\x22\x20y2=\x2220\x22></line></svg>','strike':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x225\x22\x20y1=\x2212\x22\x20x2=\x2219\x22\x20y2=\x2212\x22></line><path\x20d=\x22M16\x206a4\x204\x200\x200\x200-4-4c-2.48\x200-4\x201.79-4\x204\x200\x201.25.5\x202.5\x201.5\x203\x22></path><path\x20d=\x22M9\x2018c0\x201.79\x201.79\x203\x204\x203\x202.48\x200\x204-1.79\x204-4\x200-1.25-.5-2.5-1.5-3\x22></path></svg>','link':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M10\x2013a5\x205\x200\x200\x200\x207.54.54l3-3a5\x205\x200\x200\x200-7.07-7.07l-1.72\x201.71\x22></path><path\x20d=\x22M14\x2011a5\x205\x200\x200\x200-7.54-.54l-3\x203a5\x205\x200\x200\x200\x207.07\x207.07l1.71-1.71\x22></path></svg>','code':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>','listBullet':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x228\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x228\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x228\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><line\x20x1=\x223\x22\x20y1=\x226\x22\x20x2=\x223.01\x22\x20y2=\x226\x22></line><line\x20x1=\x223\x22\x20y1=\x2212\x22\x20x2=\x223.01\x22\x20y2=\x2212\x22></line><line\x20x1=\x223\x22\x20y1=\x2218\x22\x20x2=\x223.01\x22\x20y2=\x2218\x22></line></svg>','listOrdered':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2210\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x2210\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x2210\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><path\x20d=\x22M4\x206h1v4\x22></path><path\x20d=\x22M4\x2010h2\x22></path><path\x20d=\x22M6\x2018H4c0-1\x202-2\x202-3s-1-1.5-2-1\x22></path></svg>','blockquote':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M21\x2015a2\x202\x200\x200\x201-2\x202H7l-4\x204V5a2\x202\x200\x200\x201\x202-2h14a2\x202\x200\x200\x201\x202\x202z\x22></path></svg>','codeBlock':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><rect\x20x=\x223\x22\x20y=\x223\x22\x20width=\x2218\x22\x20height=\x2218\x22\x20rx=\x222\x22\x20ry=\x222\x22></rect><polyline\x20points=\x229\x208\x205\x2012\x209\x2016\x22></polyline><polyline\x20points=\x2215\x208\x2019\x2012\x2015\x2016\x22></polyline></svg>','header':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2012h8\x22></path><path\x20d=\x22M4\x2018V6\x22></path><path\x20d=\x22M12\x2018V6\x22></path><path\x20d=\x22M17\x2012l3-2v8\x22></path></svg>','color':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2020h16\x22></path><path\x20d=\x22M6\x2016l6-14\x206\x2014\x22></path><path\x20d=\x22M8\x2012h8\x22></path></svg>'},LINK_DIALOG_STYLES='\x0a.markdown-editor-link-modal\x20{\x0a\x20\x20position:\x20fixed;\x0a\x20\x20inset:\x200;\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20center;\x0a\x20\x20z-index:\x2010020;\x0a}\x0a\x0a.markdown-editor-link-modal[hidden]\x20{\x0a\x20\x20display:\x20none\x20!important;\x0a}\x0a\x0a.markdown-editor-link-backdrop\x20{\x0a\x20\x20position:\x20absolute;\x0a\x20\x20inset:\x200;\x0a\x20\x20background:\x20rgba(15,\x2023,\x2042,\x200.45);\x0a}\x0a\x0a.markdown-editor-link-dialog\x20{\x0a\x20\x20position:\x20relative;\x0a\x20\x20width:\x20min(460px,\x20calc(100vw\x20-\x2024px));\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-medium,\x2010px);\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(15,\x2023,\x2042,\x200.25);\x0a\x20\x20padding:\x2014px;\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2012px;\x0a}\x0a\x0a.markdown-editor-link-header\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20space-between;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-title\x20{\x0a\x20\x20margin:\x200;\x0a\x20\x20font-size:\x2016px;\x0a\x20\x20font-weight:\x20600;\x0a}\x0a\x0a.markdown-editor-link-close\x20{\x0a\x20\x20width:\x2028px;\x0a\x20\x20height:\x2028px;\x0a\x20\x20border:\x20none;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#6b7280));\x0a\x20\x20font-size:\x2020px;\x0a\x20\x20line-height:\x201;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-close:hover\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a}\x0a\x0a.markdown-editor-link-form\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-field-grid\x20{\x0a\x20\x20display:\x20grid;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-label\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x206px;\x0a\x20\x20font-size:\x2012px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#4b5563));\x0a}\x0a\x0a.markdown-editor-link-input\x20{\x0a\x20\x20width:\x20100%;\x0a\x20\x20padding:\x209px\x2010px;\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20font-size:\x2014px;\x0a}\x0a\x0a.markdown-editor-link-input:focus\x20{\x0a\x20\x20outline:\x20none;\x0a\x20\x20border-color:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20box-shadow:\x200\x200\x200\x203px\x20rgba(63,\x20114,\x20255,\x200.2);\x0a}\x0a\x0a.markdown-editor-link-actions\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20justify-content:\x20flex-end;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-btn\x20{\x0a\x20\x20border:\x201px\x20solid\x20transparent;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20padding:\x207px\x2012px;\x0a\x20\x20font-size:\x2013px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-btn-secondary\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border-color:\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a}\x0a\x0a.markdown-editor-link-btn-secondary:hover\x20{\x0a\x20\x20background:\x20var(--color-bg-secondary,\x20var(--feedback-surface-hover,\x20#e5e7eb));\x0a}\x0a\x0a.markdown-editor-link-btn-danger\x20{\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-danger,\x20#dc2626);\x0a\x20\x20border-color:\x20rgba(220,\x2038,\x2038,\x200.35);\x0a}\x0a\x0a.markdown-editor-link-btn-danger:hover\x20{\x0a\x20\x20background:\x20rgba(220,\x2038,\x2038,\x200.08);\x0a}\x0a\x0a.markdown-editor-link-btn-primary\x20{\x0a\x20\x20background:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20color:\x20#ffffff;\x0a}\x0a\x0a.markdown-editor-link-btn-primary:hover\x20{\x0a\x20\x20background:\x20var(--color-accent,\x20#2563eb);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-backdrop\x20{\x0a\x20\x20background:\x20rgba(2,\x206,\x2023,\x200.65);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(0,\x200,\x200,\x200.5);\x0a}\x0a\x0a@media\x20(max-width:\x20480px)\x20{\x0a\x20\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20\x20\x20width:\x20calc(100vw\x20-\x2016px);\x0a\x20\x20\x20\x20padding:\x2012px;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-actions\x20{\x0a\x20\x20\x20\x20flex-wrap:\x20wrap;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-btn\x20{\x0a\x20\x20\x20\x20flex:\x201\x201\x20calc(50%\x20-\x206px);\x0a\x20\x20\x20\x20text-align:\x20center;\x0a\x20\x20}\x0a}\x0a';export class MarkdownEditor{constructor(_0x53dea1,_0x4a2d71={}){this['element']=_0x53dea1,this['options']={'placeholder':_0x4a2d71['placeholder']||'Start\x20typing...','editable':_0x4a2d71['editable']!==![],'onChange':_0x4a2d71['onChange']||null,'minHeight':_0x4a2d71['minHeight']||'100px','toolbar':_0x4a2d71['toolbar']||![],'onAddAttachments':_0x4a2d71['onAddAttachments']||null,'resolveAttachmentUrl':_0x4a2d71['resolveAttachmentUrl']||null,'isAttachmentNameTaken':_0x4a2d71['isAttachmentNameTaken']||null,'fetchUsers':_0x4a2d71['fetchUsers']||null},this['mentionState']={'active':![],'query':'','startOffset':0x0,'startNode':null,'users':[],'filteredUsers':[],'selectedIndex':0x0},this['mentionDropdown']=null,this['usersCache']=null,this['linkDialog']=null,this['linkDialogContext']=null;const _0xb008e3=window['TurndownService'];this['turndownService']=new _0xb008e3({'headingStyle':'atx','codeBlockStyle':'fenced','emDelimiter':'_','bulletListMarker':'-'}),this['attachmentObjectUrls']=new Map(),this['registerTurndownRules'](),this['init']();}['registerTurndownRules'](){this['turndownService']['addRule']('profoundAttachmentImage',{'filter':_0x3de94b=>{return _0x3de94b&&_0x3de94b['nodeName']==='IMG'&&_0x3de94b['getAttribute']&&_0x3de94b['getAttribute']('data-attachment-name');},'replacement':(_0x147ab2,_0xdc6c5b)=>{const _0x1c7942=_0xdc6c5b['getAttribute']('data-attachment-name')||'',_0x2db9b7=_0xdc6c5b['getAttribute']('alt')||'',_0x448dc7=_0x1c7942['trim'](),_0x48a806=this['escapeAltText'](_0x2db9b7||_0x448dc7),_0x32e8c5=encodeURIComponent(_0x448dc7);return'';}}),this['turndownService']['addRule']('profoundMention',{'filter':_0x319516=>{return _0x319516&&_0x319516['nodeName']==='SPAN'&&_0x319516['getAttribute']&&_0x319516['getAttribute']('data-mention-user-id');},'replacement':(_0x7d4466,_0x169288)=>{const _0x2895d2=_0x169288['getAttribute']('data-mention-user-id')||'',_0x1a3320=_0x169288['textContent']||'',_0x4021e0=_0x1a3320['startsWith']('@')?_0x1a3320['slice'](0x1):_0x1a3320;return'['+_0x4021e0+'](mention:'+_0x2895d2+')';}}),this['turndownService']['addRule']('profoundColoredText',{'filter':_0x35765e=>{if(!_0x35765e)return![];if(_0x35765e['nodeName']==='FONT'&&_0x35765e['getAttribute']&&_0x35765e['getAttribute']('color'))return!![];if(_0x35765e['nodeName']==='SPAN'&&_0x35765e['style']&&_0x35765e['style']['color']){if(_0x35765e['getAttribute']&&_0x35765e['getAttribute']('data-mention-user-id'))return![];return!![];}return![];},'replacement':(_0xb690b9,_0x4e3007)=>{if(!_0xb690b9['trim']())return _0xb690b9;let _0x707179='';if(_0x4e3007['nodeName']==='FONT')_0x707179=_0x4e3007['getAttribute']('color')||'';else _0x4e3007['style']&&_0x4e3007['style']['color']&&(_0x707179=this['rgbToHex'](_0x4e3007['style']['color']));if(!_0x707179)return _0xb690b9;return'{color:'+_0x707179+'}'+_0xb690b9+'{/color}';}});}['rgbToHex'](_0x4cfd5e){if(!_0x4cfd5e)return'';if(_0x4cfd5e['startsWith']('#'))return _0x4cfd5e;const _0x2f47aa=_0x4cfd5e['match'](/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(!_0x2f47aa)return _0x4cfd5e;const _0xce6c81=parseInt(_0x2f47aa[0x1],0xa),_0x54a850=parseInt(_0x2f47aa[0x2],0xa),_0x2b714c=parseInt(_0x2f47aa[0x3],0xa);return'#'+[_0xce6c81,_0x54a850,_0x2b714c]['map'](_0x2000ef=>_0x2000ef['toString'](0x10)['padStart'](0x2,'0'))['join']('')['toUpperCase']();}['escapeAltText'](_0x4ea1df){return String(_0x4ea1df||'')['replace'](/\]/g,'\x5c]');}['init'](){this['editor']=document['createElement']('div'),this['editor']['className']='markdown-editor',this['editor']['contentEditable']=this['options']['editable'],this['editor']['setAttribute']('role','textbox'),this['editor']['setAttribute']('aria-multiline','true'),this['editor']['style']['minHeight']=this['options']['minHeight'];this['options']['placeholder']&&this['editor']['setAttribute']('data-placeholder',this['options']['placeholder']);this['options']['toolbar']?(this['container']=document['createElement']('div'),this['container']['className']='markdown-editor-wrapper',this['container']['style']['display']='flex',this['container']['style']['flexDirection']='column',this['createToolbar'](),this['container']['appendChild'](this['toolbar']),this['container']['appendChild'](this['editor']),this['element']['parentNode']['insertBefore'](this['container'],this['element'])):this['element']['parentNode']['insertBefore'](this['editor'],this['element']);this['element']['style']['display']='none',this['isMac']=navigator['platform']['toUpperCase']()['indexOf']('MAC')>=0x0,this['linkHintText']=this['isMac']?'⌘+click\x20to\x20follow':'Ctrl+click\x20to\x20follow';this['options']['editable']&&this['bindEvents']();const _0x44e162=this['element']['textContent']||this['element']['value']||'';_0x44e162['trim']()&&this['setMarkdown'](_0x44e162);}['createToolbar'](){this['toolbar']=document['createElement']('div'),this['toolbar']['className']='markdown-editor-toolbar',this['toolbarButtons']={};const _0x11a7c5=[{'id':'header','icon':ICONS['header'],'title':'Heading','action':'header','isDropdown':!![]},{'separator':!![]},{'id':'bold','icon':ICONS['bold'],'title':'Bold\x20(Ctrl+B)','action':'bold','command':'bold'},{'id':'italic','icon':ICONS['italic'],'title':'Italic\x20(Ctrl+I)','action':'italic','command':'italic'},{'id':'strike','icon':ICONS['strike'],'title':'Strikethrough','action':'strikeThrough','command':'strikeThrough'},{'id':'color','icon':ICONS['color'],'title':'Text\x20Color','action':'color','isDropdown':!![]},{'separator':!![]},{'id':'link','icon':ICONS['link'],'title':'Link\x20(Ctrl+K)','action':'link','tagName':'A'},{'id':'code','icon':ICONS['code'],'title':'Inline\x20Code','action':'code','tagName':'CODE'},{'id':'codeBlock','icon':ICONS['codeBlock'],'title':'Code\x20Block','action':'codeBlock','tagName':'PRE'},{'separator':!![]},{'id':'list-bullet','icon':ICONS['listBullet'],'title':'Bullet\x20List','action':'insertUnorderedList','command':'insertUnorderedList'},{'id':'list-ordered','icon':ICONS['listOrdered'],'title':'Numbered\x20List','action':'insertOrderedList','command':'insertOrderedList'}];_0x11a7c5['forEach'](_0x5996a3=>{if(_0x5996a3['separator']){const _0x41463f=document['createElement']('div');_0x41463f['className']='markdown-toolbar-separator',_0x41463f['style']['width']='1px',_0x41463f['style']['height']='16px',_0x41463f['style']['background']='var(--color-border)',_0x41463f['style']['margin']='0\x206px',_0x41463f['style']['alignSelf']='center',this['toolbar']['appendChild'](_0x41463f);}else{if(_0x5996a3['isDropdown']){const _0x4b304a=document['createElement']('div');_0x4b304a['className']='markdown-toolbar-dropdown',_0x4b304a['style']['position']='relative';const _0x28934e=document['createElement']('button');_0x28934e['type']='button',_0x28934e['className']='markdown-editor-toolbar-btn\x20markdown-toolbar-dropdown-btn',_0x28934e['tabIndex']=-0x1,_0x28934e['innerHTML']=_0x5996a3['icon']+'<svg\x20class=\x22dropdown-arrow\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2210\x22\x20height=\x2210\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x226\x209\x2012\x2015\x2018\x209\x22></polyline></svg>',_0x28934e['title']=_0x5996a3['title'],_0x28934e['dataset']['action']=_0x5996a3['action'];const _0x505aef=document['createElement']('div');_0x505aef['className']='markdown-toolbar-dropdown-menu',_0x505aef['style']['display']='none';if(_0x5996a3['action']==='header')this['createHeaderDropdown'](_0x505aef);else _0x5996a3['action']==='color'&&this['createColorDropdown'](_0x505aef);_0x28934e['addEventListener']('click',_0x577ddc=>{_0x577ddc['preventDefault'](),_0x577ddc['stopPropagation'](),this['toggleDropdown'](_0x505aef,_0x28934e);}),_0x4b304a['appendChild'](_0x28934e),_0x4b304a['appendChild'](_0x505aef),this['toolbar']['appendChild'](_0x4b304a),this['toolbarButtons'][_0x5996a3['id']]={'button':_0x28934e,'dropdown':_0x505aef,'command':_0x5996a3['command'],'tagName':_0x5996a3['tagName']};}else{const _0xd3a7c3=document['createElement']('button');_0xd3a7c3['type']='button',_0xd3a7c3['className']='markdown-editor-toolbar-btn',_0xd3a7c3['tabIndex']=-0x1,_0xd3a7c3['innerHTML']=_0x5996a3['icon'],_0xd3a7c3['title']=_0x5996a3['title'],_0xd3a7c3['dataset']['action']=_0x5996a3['action'],_0xd3a7c3['addEventListener']('click',_0x5c7761=>{_0x5c7761['preventDefault'](),this['handleToolbarAction'](_0x5996a3['action']);}),this['toolbar']['appendChild'](_0xd3a7c3),this['toolbarButtons'][_0x5996a3['id']]={'button':_0xd3a7c3,'command':_0x5996a3['command'],'tagName':_0x5996a3['tagName']};}}}),document['addEventListener']('click',_0x45cc3c=>{!this['toolbar']['contains'](_0x45cc3c['target'])&&this['closeAllDropdowns']();});}['createHeaderDropdown'](_0x5d16f8){const _0x35b9af=[{'level':0x1,'label':'Heading\x201','tag':'H1'},{'level':0x2,'label':'Heading\x202','tag':'H2'},{'level':0x3,'label':'Heading\x203','tag':'H3'},{'level':0x4,'label':'Heading\x204','tag':'H4'},{'level':0x0,'label':'Normal\x20Text','tag':'P'}];_0x35b9af['forEach'](_0x1d5d7e=>{const _0xd28ed7=document['createElement']('button');_0xd28ed7['type']='button',_0xd28ed7['className']='markdown-dropdown-item',_0xd28ed7['tabIndex']=-0x1,_0xd28ed7['innerHTML']='<span\x20style=\x22font-size:\x20'+(_0x1d5d7e['level']===0x0?'14px':0x14-_0x1d5d7e['level']*0x2+'px')+';\x20font-weight:\x20'+(_0x1d5d7e['level']===0x0?'normal':'bold')+'\x22>'+_0x1d5d7e['label']+'</span>',_0xd28ed7['addEventListener']('click',_0x1eb632=>{_0x1eb632['preventDefault'](),_0x1eb632['stopPropagation'](),this['applyHeader'](_0x1d5d7e['level']),this['closeAllDropdowns']();}),_0x5d16f8['appendChild'](_0xd28ed7);});}['createColorDropdown'](_0x349705){const _0x20f0e5=[{'value':'#000000','label':'Black'},{'value':'#374151','label':'Gray'},{'value':'#DC2626','label':'Red'},{'value':'#EA580C','label':'Orange'},{'value':'#CA8A04','label':'Yellow'},{'value':'#16A34A','label':'Green'},{'value':'#2563EB','label':'Blue'},{'value':'#7C3AED','label':'Purple'},{'value':'#DB2777','label':'Pink'}],_0x632e29=document['createElement']('div');_0x632e29['className']='markdown-color-grid',_0x632e29['style']['display']='grid',_0x632e29['style']['gridTemplateColumns']='repeat(3,\x201fr)',_0x632e29['style']['gap']='4px',_0x632e29['style']['padding']='8px',_0x20f0e5['forEach'](_0x2e6cb8=>{const _0x301f61=document['createElement']('button');_0x301f61['type']='button',_0x301f61['className']='markdown-color-btn',_0x301f61['tabIndex']=-0x1,_0x301f61['style']['width']='24px',_0x301f61['style']['height']='24px',_0x301f61['style']['backgroundColor']=_0x2e6cb8['value'],_0x301f61['style']['border']='1px\x20solid\x20var(--color-border)',_0x301f61['style']['borderRadius']='4px',_0x301f61['style']['cursor']='pointer',_0x301f61['title']=_0x2e6cb8['label'],_0x301f61['addEventListener']('click',_0x584c11=>{_0x584c11['preventDefault'](),_0x584c11['stopPropagation'](),this['applyColor'](_0x2e6cb8['value']),this['closeAllDropdowns']();}),_0x632e29['appendChild'](_0x301f61);}),_0x349705['appendChild'](_0x632e29);const _0x59b952=document['createElement']('button');_0x59b952['type']='button',_0x59b952['className']='markdown-dropdown-item',_0x59b952['innerHTML']='<span>Remove\x20Color</span>',_0x59b952['style']['borderTop']='1px\x20solid\x20var(--color-border)',_0x59b952['style']['marginTop']='4px',_0x59b952['style']['paddingTop']='8px',_0x59b952['addEventListener']('click',_0x5289d4=>{_0x5289d4['preventDefault'](),_0x5289d4['stopPropagation'](),this['removeColor'](),this['closeAllDropdowns']();}),_0x349705['appendChild'](_0x59b952);}['toggleDropdown'](_0x2a1fe3,_0x17987d){const _0x4218bc=_0x2a1fe3['style']['display']!=='none';this['toolbar']&&this['closeAllDropdowns'](),!_0x4218bc&&(_0x2a1fe3['style']['display']='block',_0x17987d['classList']['add']('active'));}['closeAllDropdowns'](){const _0x5a1108=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-menu');_0x5a1108['forEach'](_0x7eee31=>_0x7eee31['style']['display']='none');const _0x21c249=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-btn');_0x21c249['forEach'](_0x1abf9b=>_0x1abf9b['classList']['remove']('active'));}['applyHeader'](_0x1a4628){this['editor']['focus']();const _0x507a4c=window['getSelection']();if(!_0x507a4c||_0x507a4c['rangeCount']===0x0)return;const _0x4c8fa4=_0x507a4c['getRangeAt'](0x0);let _0x7d553=_0x4c8fa4['startContainer'];while(_0x7d553&&_0x7d553!==this['editor']){if(_0x7d553['nodeType']===Node['ELEMENT_NODE']){const _0x1a7187=window['getComputedStyle'](_0x7d553)['display'];if(_0x1a7187==='block'||['P','H1','H2','H3','H4','H5','H6','DIV']['includes'](_0x7d553['tagName']))break;}_0x7d553=_0x7d553['parentNode'];}_0x1a4628===0x0?document['execCommand']('formatBlock',![],'p'):document['execCommand']('formatBlock',![],'h'+_0x1a4628),this['editor']['dispatchEvent'](new Event('input'));}['applyColor'](_0x5c4934){this['editor']['focus'](),document['execCommand']('foreColor',![],_0x5c4934),this['editor']['dispatchEvent'](new Event('input'));}['removeColor'](){this['editor']['focus'](),document['execCommand']('removeFormat',![],null),this['editor']['dispatchEvent'](new Event('input'));}['handleToolbarAction'](_0x4e224a){this['editor']['focus']();switch(_0x4e224a){case'bold':case'italic':case'strikeThrough':case'insertUnorderedList':case'insertOrderedList':document['execCommand'](_0x4e224a,![],null);break;case'link':this['openLinkDialog']();return;case'code':this['toggleInlineCode']();break;case'codeBlock':this['insertCodeBlock']();break;}this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialog'](){if(this['linkDialog'])return;this['ensureLinkDialogStyles']();const _0x57b065=document['createElement']('div');_0x57b065['className']='markdown-editor-link-modal',_0x57b065['hidden']=!![],_0x57b065['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-backdrop\x22></div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-dialog\x22\x20role=\x22dialog\x22\x20aria-modal=\x22true\x22\x20aria-label=\x22Edit\x20link\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h3\x20class=\x22markdown-editor-link-title\x22>Insert\x20Link</h3>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-close\x22\x20aria-label=\x22Close\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<form\x20class=\x22markdown-editor-link-form\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-field-grid\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20URL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22url\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22https://example.com\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Display\x20text\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22Text\x20shown\x20to\x20readers\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-secondary\x22\x20data-action=\x22cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-danger\x22\x20data-action=\x22remove\x22\x20hidden>Remove\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22submit\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-primary\x22>Insert\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</form>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20',document['body']['appendChild'](_0x57b065),this['linkDialog']=_0x57b065,this['linkDialogElements']={'backdrop':_0x57b065['querySelector']('.markdown-editor-link-backdrop'),'title':_0x57b065['querySelector']('.markdown-editor-link-title'),'close':_0x57b065['querySelector']('.markdown-editor-link-close'),'form':_0x57b065['querySelector']('.markdown-editor-link-form'),'urlInput':_0x57b065['querySelector']('[data-link-field=\x22url\x22]'),'textInput':_0x57b065['querySelector']('[data-link-field=\x22text\x22]'),'remove':_0x57b065['querySelector']('[data-action=\x22remove\x22]'),'cancel':_0x57b065['querySelector']('[data-action=\x22cancel\x22]'),'submit':_0x57b065['querySelector']('.markdown-editor-link-btn-primary')},this['linkDialogElements']['backdrop']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['close']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['cancel']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['remove']['addEventListener']('click',()=>{this['applyLinkDialogResult']({'remove':!![]});}),this['linkDialogElements']['form']['addEventListener']('submit',_0x55f319=>{_0x55f319['preventDefault'](),this['applyLinkDialogResult']();}),this['linkDialog']['addEventListener']('keydown',_0x2c2a88=>{_0x2c2a88['key']==='Escape'&&(_0x2c2a88['preventDefault'](),this['closeLinkDialog']({'restoreSelection':!![]}));});}['openLinkDialog'](){const _0x89eef2=window['getSelection']();if(!_0x89eef2||_0x89eef2['rangeCount']===0x0)return;const _0x15556e=_0x89eef2['getRangeAt'](0x0),_0x2a2850=this['editor']['contains'](_0x15556e['commonAncestorContainer'])||this['editor']===_0x15556e['commonAncestorContainer'];if(!_0x2a2850)return;this['toolbar']&&this['closeAllDropdowns']();this['ensureLinkDialog']();const _0x2ef796=_0x15556e['cloneRange'](),_0x4e407e=this['findLinkAtRange'](_0x2ef796),_0x2efe4b=_0x4e407e?_0x4e407e['getAttribute']('href')||'':'',_0x3682d6=_0x4e407e?_0x4e407e['textContent']||'':_0x2ef796['toString']();this['linkDialogContext']={'range':_0x2ef796,'existingLink':_0x4e407e,'selectedText':_0x3682d6},this['linkDialogElements']['title']['textContent']=_0x4e407e?'Edit\x20Link':'Insert\x20Link',this['linkDialogElements']['submit']['textContent']=_0x4e407e?'Save\x20Link':'Insert\x20Link',this['linkDialogElements']['remove']['hidden']=!_0x4e407e,this['linkDialogElements']['urlInput']['value']=_0x2efe4b,this['linkDialogElements']['textInput']['value']=_0x3682d6,this['linkDialog']['hidden']=![],this['linkDialogElements']['urlInput']['focus'](),this['linkDialogElements']['urlInput']['select']();}['closeLinkDialog']({restoreSelection:restoreSelection=![]}={}){if(!this['linkDialog'])return;const _0x23ea56=this['linkDialogContext'];this['linkDialog']['hidden']=!![],restoreSelection&&_0x23ea56?.['range']&&(this['editor']['focus'](),this['restoreRange'](_0x23ea56['range'])),this['linkDialogContext']=null;}['applyLinkDialogResult']({remove:remove=![]}={}){if(!this['linkDialog']||!this['linkDialogContext'])return;const _0xbe2738=this['linkDialogContext'],_0x8abc7c=(this['linkDialogElements']['urlInput']['value']||'')['trim'](),_0x3fcc05=this['linkDialogElements']['textInput']['value']||'',_0x231a60=_0x3fcc05['trim']();if(!remove&&!_0x8abc7c){this['linkDialogElements']['urlInput']['focus']();return;}this['closeLinkDialog'](),this['editor']['focus'](),this['restoreRange'](_0xbe2738['range']);if(remove)_0xbe2738['existingLink']&&_0xbe2738['existingLink']['parentNode']?this['unwrapLinkElement'](_0xbe2738['existingLink']):document['execCommand']('unlink',![],null);else{if(_0xbe2738['existingLink']&&_0xbe2738['existingLink']['parentNode'])_0xbe2738['existingLink']['setAttribute']('href',_0x8abc7c),_0xbe2738['existingLink']['textContent']=_0x231a60||_0x8abc7c;else{const _0x34549c=window['getSelection']();if(!_0x34549c||_0x34549c['rangeCount']===0x0)return;const _0x449ea4=_0x34549c['getRangeAt'](0x0),_0x402216=(_0xbe2738['selectedText']||'')['trim'](),_0x513f38=_0x231a60||_0x402216||_0x8abc7c;_0x449ea4['deleteContents']();const _0x591a6f=document['createElement']('a');_0x591a6f['href']=_0x8abc7c,_0x591a6f['textContent']=_0x513f38,_0x449ea4['insertNode'](_0x591a6f),_0x449ea4['setStartAfter'](_0x591a6f),_0x449ea4['collapse'](!![]),_0x34549c['removeAllRanges'](),_0x34549c['addRange'](_0x449ea4);}}this['addLinkHints'](),this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialogStyles'](){if(document['getElementById'](LINK_DIALOG_STYLE_ID))return;const _0x38829d=document['createElement']('style');_0x38829d['id']=LINK_DIALOG_STYLE_ID,_0x38829d['textContent']=LINK_DIALOG_STYLES,document['head']['appendChild'](_0x38829d);}['restoreRange'](_0x225ae7){const _0x52162a=window['getSelection']();if(!_0x52162a)return;try{_0x52162a['removeAllRanges'](),_0x52162a['addRange'](_0x225ae7);return;}catch(_0x53df51){}const _0x3f4716=document['createRange']();_0x3f4716['selectNodeContents'](this['editor']),_0x3f4716['collapse'](![]),_0x52162a['removeAllRanges'](),_0x52162a['addRange'](_0x3f4716);}['findLinkAtRange'](_0x1b17da){if(!_0x1b17da)return null;const _0x161f36=this['findParentLink'](_0x1b17da['startContainer']);if(_0x1b17da['collapsed'])return _0x161f36;const _0x1dd078=this['findParentLink'](_0x1b17da['endContainer']);if(_0x161f36&&_0x161f36===_0x1dd078)return _0x161f36;if(_0x161f36&&_0x161f36['contains'](_0x1b17da['endContainer']))return _0x161f36;if(_0x1dd078&&_0x1dd078['contains'](_0x1b17da['startContainer']))return _0x1dd078;return null;}['findParentLink'](_0x48ede4){let _0x2e0446=_0x48ede4;while(_0x2e0446&&_0x2e0446!==this['editor']){if(_0x2e0446['nodeType']===Node['ELEMENT_NODE']&&_0x2e0446['tagName']==='A'){const _0x49a92d=_0x2e0446['getAttribute']('href')||'';if(_0x49a92d['startsWith']('mention:'))return null;return _0x2e0446;}_0x2e0446=_0x2e0446['parentNode'];}return null;}['unwrapLinkElement'](_0x2bccf8){const _0x4c84a3=_0x2bccf8['parentNode'];if(!_0x4c84a3)return;while(_0x2bccf8['firstChild']){_0x4c84a3['insertBefore'](_0x2bccf8['firstChild'],_0x2bccf8);}_0x4c84a3['removeChild'](_0x2bccf8);}['isSelectionInTag'](_0x3f6414){const _0x11df9d=window['getSelection']();if(!_0x11df9d||_0x11df9d['rangeCount']===0x0)return![];let _0x4fbb11=_0x11df9d['anchorNode'];while(_0x4fbb11&&_0x4fbb11!==this['editor']){if(_0x4fbb11['nodeType']===Node['ELEMENT_NODE']&&_0x4fbb11['tagName']===_0x3f6414)return!![];_0x4fbb11=_0x4fbb11['parentNode'];}return![];}['updateToolbarState'](){if(!this['toolbarButtons'])return;for(const [_0xf16d4b,_0x23cc8a]of Object['entries'](this['toolbarButtons'])){let _0x3762e7=![];if(_0x23cc8a['command'])try{_0x3762e7=document['queryCommandState'](_0x23cc8a['command']);}catch(_0x180766){_0x3762e7=![];}else _0x23cc8a['tagName']&&(_0x3762e7=this['isSelectionInTag'](_0x23cc8a['tagName']));_0x23cc8a['button']['classList']['toggle']('active',_0x3762e7);}}['bindEvents'](){this['editor']['addEventListener']('keydown',_0x1801c6=>this['handleKeydown'](_0x1801c6)),this['editor']['addEventListener']('input',_0x1841f3=>{this['handleMentionInput'](_0x1841f3),this['handleAutoFormat'](_0x1841f3);}),this['editor']['addEventListener']('input',()=>{const _0x3a1ad9=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');!_0x3a1ad9&&(this['editor']['innerHTML']='');this['updatePlaceholder']();const _0x402f42=this['getMarkdown']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x402f42:this['element']['textContent']=_0x402f42,this['options']['onChange']&&this['options']['onChange'](_0x402f42);}),this['editor']['addEventListener']('paste',_0x1f8242=>this['handlePaste'](_0x1f8242)),this['editor']['addEventListener']('dragover',_0x525d43=>this['handleDragOver'](_0x525d43)),this['editor']['addEventListener']('drop',_0xcbd388=>this['handleDrop'](_0xcbd388)),this['editor']['addEventListener']('dragstart',_0x31f0f6=>this['handleDragStart'](_0x31f0f6)),this['options']['toolbar']&&(this['selectionChangeHandler']=()=>{(this['editor']['contains'](document['activeElement'])||this['editor']===document['activeElement'])&&this['updateToolbarState']();},document['addEventListener']('selectionchange',this['selectionChangeHandler']),this['editor']['addEventListener']('keyup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('mouseup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('focus',()=>this['updateToolbarState']())),this['linkClickHandler']=_0x49b2a5=>this['handleLinkClick'](_0x49b2a5),this['editor']['addEventListener']('click',this['linkClickHandler']),this['linkMouseEnterHandler']=_0x47e78b=>this['handleLinkMouseEnter'](_0x47e78b),this['linkMouseLeaveHandler']=_0x54a25b=>this['handleLinkMouseLeave'](_0x54a25b),this['editor']['addEventListener']('mouseover',this['linkMouseEnterHandler']),this['editor']['addEventListener']('mouseout',this['linkMouseLeaveHandler']),this['updatePlaceholder']();}['handleAutoFormat'](_0x3292aa){if(_0x3292aa['inputType']==='deleteContentBackward')return;const _0x370087=window['getSelection']();if(!_0x370087||_0x370087['rangeCount']===0x0)return;const _0x3ac0b5=_0x370087['getRangeAt'](0x0),_0x3dc7ea=_0x3ac0b5['startContainer'];if(_0x3dc7ea['nodeType']!==Node['TEXT_NODE'])return;if(this['isSelectionInTag']('CODE')||this['isSelectionInTag']('PRE'))return;const _0x39dc51=_0x3dc7ea['textContent'],_0x3aa9a3=_0x3ac0b5['startOffset'],_0x2e3a0f=_0x39dc51['slice'](0x0,_0x3aa9a3);if(_0x2e3a0f['endsWith']('```')){_0x3ac0b5['setStart'](_0x3dc7ea,_0x3aa9a3-0x3),_0x3ac0b5['setEnd'](_0x3dc7ea,_0x3aa9a3),_0x3ac0b5['deleteContents'](),this['insertCodeBlock']();return;}const _0x5c83a5=/`([^`]+)`$/,_0x42cc04=_0x2e3a0f['match'](_0x5c83a5);if(_0x42cc04){const _0x52d657=_0x42cc04[0x1];if(_0x52d657){const _0x1827c3=_0x42cc04['index'],_0x454293=_0x1827c3+_0x52d657['length']+0x2;_0x3ac0b5['setStart'](_0x3dc7ea,_0x1827c3),_0x3ac0b5['setEnd'](_0x3dc7ea,_0x3aa9a3),_0x3ac0b5['deleteContents']();const _0x34bb29=document['createElement']('code');_0x34bb29['textContent']=_0x52d657,_0x3ac0b5['insertNode'](_0x34bb29),_0x3ac0b5['setStartAfter'](_0x34bb29),_0x3ac0b5['setEndAfter'](_0x34bb29);const _0x5b2757=document['createTextNode']('');_0x3ac0b5['insertNode'](_0x5b2757),_0x3ac0b5['setStartAfter'](_0x5b2757),_0x3ac0b5['setEndAfter'](_0x5b2757),_0x370087['removeAllRanges'](),_0x370087['addRange'](_0x3ac0b5);return;}}const _0x55f105=_0x2e3a0f['match'](/^[-*][\s\u00A0]$/);if(_0x55f105&&this['isAtStartOfBlock'](_0x3dc7ea)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x3ac0b5['setStart'](_0x3dc7ea,Math['max'](_0x3aa9a3-0x2,0x0)),_0x3ac0b5['setEnd'](_0x3dc7ea,_0x3aa9a3),_0x3ac0b5['deleteContents']();const _0x4b70e1=this['ensureListInsertionAnchor'](_0x3dc7ea);document['execCommand']('insertUnorderedList',![],null);_0x4b70e1&&_0x4b70e1['parentNode']&&_0x4b70e1['parentNode']['removeChild'](_0x4b70e1);this['updateToolbarState']();return;}const _0x1f588d=_0x2e3a0f['match'](/^1\.[\s\u00A0]$/);if(_0x1f588d&&this['isAtStartOfBlock'](_0x3dc7ea)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x3ac0b5['setStart'](_0x3dc7ea,Math['max'](_0x3aa9a3-0x3,0x0)),_0x3ac0b5['setEnd'](_0x3dc7ea,_0x3aa9a3),_0x3ac0b5['deleteContents']();const _0x180f85=this['ensureListInsertionAnchor'](_0x3dc7ea);document['execCommand']('insertOrderedList',![],null);_0x180f85&&_0x180f85['parentNode']&&_0x180f85['parentNode']['removeChild'](_0x180f85);this['updateToolbarState']();return;}}['isAtStartOfBlock'](_0x149a9f){let _0x28502d=_0x149a9f;while(_0x28502d&&_0x28502d!==this['editor']){const _0x5c0281=_0x28502d['parentNode'];if(!_0x5c0281)break;const _0x4e04e2=_0x5c0281['tagName'];if(_0x4e04e2==='DIV'||_0x4e04e2==='P'||_0x4e04e2==='LI'||_0x5c0281===this['editor']){let _0x22528b=_0x5c0281['firstChild'];while(_0x22528b&&(_0x22528b['nodeType']===Node['TEXT_NODE']&&_0x22528b['textContent']===''||_0x22528b['nodeType']===Node['ELEMENT_NODE']&&_0x22528b['tagName']==='BR')){_0x22528b=_0x22528b['nextSibling'];}return _0x22528b===_0x149a9f||_0x22528b===_0x28502d;}_0x28502d=_0x5c0281;}if(_0x28502d===this['editor']||_0x149a9f['parentNode']===this['editor']){let _0x363192=this['editor']['firstChild'];while(_0x363192&&(_0x363192['nodeType']===Node['TEXT_NODE']&&_0x363192['textContent']===''||_0x363192['nodeType']===Node['ELEMENT_NODE']&&_0x363192['tagName']==='BR')){_0x363192=_0x363192['nextSibling'];}return _0x363192===_0x149a9f;}return![];}['getClosestBlockElement'](_0x575d6c){let _0x30e309=_0x575d6c;while(_0x30e309&&_0x30e309!==this['editor']){const _0x23fc6d=_0x30e309['parentNode'];if(!_0x23fc6d)break;const _0x55ddf4=_0x23fc6d['tagName'];if(_0x55ddf4==='DIV'||_0x55ddf4==='P'||_0x55ddf4==='LI'||_0x23fc6d===this['editor'])return _0x23fc6d;_0x30e309=_0x23fc6d;}return this['editor'];}['ensureListInsertionAnchor'](_0x3648b1){const _0x4c5aef=window['getSelection']();if(!_0x4c5aef||_0x4c5aef['rangeCount']===0x0)return null;const _0x15ffd7=this['getClosestBlockElement'](_0x3648b1);if(!_0x15ffd7||_0x15ffd7===this['editor'])return null;const _0x107065=_0x15ffd7['textContent']['replace'](/\u200B/g,'');if(_0x107065!=='')return null;const _0x376890=document['createTextNode']('');_0x15ffd7['appendChild'](_0x376890);const _0x5604e2=document['createRange']();return _0x5604e2['setStart'](_0x376890,0x1),_0x5604e2['setEnd'](_0x376890,0x1),_0x4c5aef['removeAllRanges'](),_0x4c5aef['addRange'](_0x5604e2),_0x376890;}['getContainingListItem'](){const _0x26ef63=window['getSelection']();if(!_0x26ef63||_0x26ef63['rangeCount']===0x0)return null;let _0x4af513=_0x26ef63['anchorNode'];while(_0x4af513&&_0x4af513!==this['editor']){if(_0x4af513['nodeType']===Node['ELEMENT_NODE']&&_0x4af513['tagName']==='LI')return _0x4af513;_0x4af513=_0x4af513['parentNode'];}return null;}['isEmptyListItem'](_0x1b4a7d){if(!_0x1b4a7d)return![];const _0x264707=_0x1b4a7d['textContent']['replace'](/\u200B/g,'')['trim']();if(_0x264707!=='')return![];const _0x424fb2=_0x1b4a7d['querySelector']('img');if(_0x424fb2)return![];const _0xd87396=_0x1b4a7d['querySelector']('ul,\x20ol');if(_0xd87396)return![];return!![];}['isCursorAtStartOfListItem'](_0x3a3cff){if(!_0x3a3cff)return![];const _0x41626f=window['getSelection']();if(!_0x41626f||_0x41626f['rangeCount']===0x0||!_0x41626f['isCollapsed'])return![];const _0x56b40b=_0x41626f['getRangeAt'](0x0),_0x1ed0f6=_0x56b40b['startContainer'];if(_0x1ed0f6!==_0x3a3cff&&!_0x3a3cff['contains'](_0x1ed0f6))return![];const _0x1b52e0=_0x56b40b['cloneRange']();_0x1b52e0['setStart'](_0x3a3cff,0x0),_0x1b52e0['setEnd'](_0x1ed0f6,_0x56b40b['startOffset']);const _0x5a9cf1=_0x1b52e0['toString']()['replace'](/\u200B/g,'')['replace'](/\u00A0/g,'\x20');return _0x5a9cf1['trim']()==='';}['indentListItem'](_0x71da8){const _0xaf5d7d=_0x71da8['previousElementSibling'];if(!_0xaf5d7d||_0xaf5d7d['tagName']!=='LI')return;const _0x10664a=_0x71da8['parentNode'],_0x47e0f2=_0x10664a['tagName'];let _0x5dcd9a=_0xaf5d7d['querySelector'](':scope\x20>\x20ul,\x20:scope\x20>\x20ol');!_0x5dcd9a&&(_0x5dcd9a=document['createElement'](_0x47e0f2),_0xaf5d7d['appendChild'](_0x5dcd9a)),_0x5dcd9a['appendChild'](_0x71da8),this['placeCursorInListItem'](_0x71da8);}['outdentListItem'](_0x2e5415){const _0x24f8f6=_0x2e5415['parentNode'];if(!_0x24f8f6||_0x24f8f6['tagName']!=='UL'&&_0x24f8f6['tagName']!=='OL')return;const _0x42d159=_0x24f8f6['parentNode'];if(_0x42d159&&_0x42d159['tagName']==='LI'){const _0x576ed0=_0x42d159['parentNode'];_0x576ed0['insertBefore'](_0x2e5415,_0x42d159['nextSibling']),_0x24f8f6['children']['length']===0x0&&_0x24f8f6['remove'](),this['placeCursorInListItem'](_0x2e5415);}else return;}['exitListOnEmptyBullet'](_0x27567c){const _0x31f036=_0x27567c['parentNode'];if(!_0x31f036)return;const _0x21489b=_0x31f036['parentNode'];if(_0x21489b&&_0x21489b['tagName']==='LI'){this['outdentListItem'](_0x27567c);return;}const _0x326171=_0x31f036['parentNode'],_0x2c49ad=document['createElement']('p');_0x2c49ad['innerHTML']='<br>',_0x326171['insertBefore'](_0x2c49ad,_0x31f036['nextSibling']),_0x27567c['remove']();_0x31f036['children']['length']===0x0&&_0x31f036['remove']();const _0x98e24f=window['getSelection'](),_0x5d536e=document['createRange']();_0x5d536e['setStart'](_0x2c49ad,0x0),_0x5d536e['collapse'](!![]),_0x98e24f['removeAllRanges'](),_0x98e24f['addRange'](_0x5d536e);}['placeCursorInListItem'](_0x10ae76){const _0x49e020=window['getSelection'](),_0x561774=document['createRange'](),_0x53d8b6=document['createTreeWalker'](_0x10ae76,NodeFilter['SHOW_TEXT'],null,![]),_0x1ce8fb=_0x53d8b6['nextNode']();_0x1ce8fb?_0x561774['setStart'](_0x1ce8fb,0x0):_0x561774['setStart'](_0x10ae76,0x0),_0x561774['collapse'](!![]),_0x49e020['removeAllRanges'](),_0x49e020['addRange'](_0x561774);}['handleLinkClick'](_0x2705b3){const _0x9356b1=this['isMac']?_0x2705b3['metaKey']:_0x2705b3['ctrlKey'];if(!_0x9356b1)return;let _0x12e2cf=_0x2705b3['target'];while(_0x12e2cf&&_0x12e2cf!==this['editor']){if(_0x12e2cf['tagName']==='A'){_0x2705b3['preventDefault'](),_0x2705b3['stopPropagation']();const _0x5c6e80=_0x12e2cf['getAttribute']('href');if(!_0x5c6e80)return;if(_0x5c6e80['startsWith']('mention:'))return;const _0x2c6efb=/^https?:\/\//i['test'](_0x5c6e80);_0x2c6efb?window['open'](_0x5c6e80,'_blank','noopener,noreferrer'):window['location']['href']=_0x5c6e80;return;}_0x12e2cf=_0x12e2cf['parentNode'];}}['handleLinkMouseEnter'](_0x28ebfd){const _0x2a83c5=_0x28ebfd['target'];if(_0x2a83c5['tagName']!=='A')return;const _0x3f3a29=_0x2a83c5['getAttribute']('href')||'';if(_0x3f3a29['startsWith']('mention:'))return;this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=setTimeout(()=>{this['showLinkTooltip'](_0x2a83c5);},0x12c);}['handleLinkMouseLeave'](_0x36a43d){const _0x14157f=_0x36a43d['target'];if(_0x14157f['tagName']!=='A')return;this['linkTooltipTimeout']&&(clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=null),this['hideLinkTooltip']();}['showLinkTooltip'](_0x307263){!this['linkTooltip']&&(this['linkTooltip']=document['createElement']('div'),this['linkTooltip']['className']='markdown-editor-link-tooltip',document['body']['appendChild'](this['linkTooltip']));this['linkTooltip']['textContent']=this['linkHintText']||'Ctrl+click\x20to\x20follow';const _0x2e0892=_0x307263['getBoundingClientRect'](),_0x2b5e1a=this['linkTooltip']['getBoundingClientRect']();let _0x1fea97=_0x2e0892['bottom']+0x4,_0x139e3a=_0x2e0892['left']+_0x2e0892['width']/0x2;_0x1fea97+0x1e>window['innerHeight']&&(_0x1fea97=_0x2e0892['top']-0x1e);const _0x4cbf84=0x78;if(_0x139e3a-_0x4cbf84/0x2<0xa)_0x139e3a=_0x4cbf84/0x2+0xa;else _0x139e3a+_0x4cbf84/0x2>window['innerWidth']-0xa&&(_0x139e3a=window['innerWidth']-_0x4cbf84/0x2-0xa);this['linkTooltip']['style']['top']=_0x1fea97+'px',this['linkTooltip']['style']['left']=_0x139e3a+'px',this['linkTooltip']['style']['transform']='translateX(-50%)',this['linkTooltip']['classList']['add']('visible');}['hideLinkTooltip'](){this['linkTooltip']&&this['linkTooltip']['classList']['remove']('visible');}['handleKeydown'](_0x3f5a64){if(this['mentionState']['active']){if(_0x3f5a64['key']==='ArrowDown'){_0x3f5a64['preventDefault'](),this['mentionNavigate'](0x1);return;}if(_0x3f5a64['key']==='ArrowUp'){_0x3f5a64['preventDefault'](),this['mentionNavigate'](-0x1);return;}if(_0x3f5a64['key']==='Enter'||_0x3f5a64['key']==='Tab'){if(this['mentionState']['filteredUsers']['length']>0x0){_0x3f5a64['preventDefault'](),this['insertMention'](this['mentionState']['filteredUsers'][this['mentionState']['selectedIndex']]);return;}}if(_0x3f5a64['key']==='Escape'){_0x3f5a64['preventDefault'](),this['closeMentionDropdown']();return;}}if(_0x3f5a64['key']==='Tab'&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x35d459=this['getContainingListItem']();if(_0x35d459&&this['isCursorAtStartOfListItem'](_0x35d459)){_0x3f5a64['preventDefault']();_0x3f5a64['shiftKey']?this['outdentListItem'](_0x35d459):this['indentListItem'](_0x35d459);this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x3f5a64['key']==='Enter'&&!_0x3f5a64['shiftKey']&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0xe46b18=this['getContainingListItem']();if(_0xe46b18&&this['isEmptyListItem'](_0xe46b18)){_0x3f5a64['preventDefault'](),this['exitListOnEmptyBullet'](_0xe46b18),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x3f5a64['key']==='Enter'&&!_0x3f5a64['shiftKey']&&this['isSelectionInTag']('PRE')){_0x3f5a64['preventDefault']();const _0x483baa=window['getSelection']();if(_0x483baa['rangeCount']>0x0){const _0x2a36f5=_0x483baa['getRangeAt'](0x0);_0x2a36f5['deleteContents']();const _0x313ee9=document['createTextNode']('\x0a');_0x2a36f5['insertNode'](_0x313ee9),_0x2a36f5['setStartAfter'](_0x313ee9),_0x2a36f5['setEndAfter'](_0x313ee9),_0x483baa['removeAllRanges'](),_0x483baa['addRange'](_0x2a36f5),this['handleInput']();}return;}(_0x3f5a64['ctrlKey']||_0x3f5a64['metaKey'])&&_0x3f5a64['key']==='b'&&(_0x3f5a64['preventDefault'](),document['execCommand']('bold',![],null));(_0x3f5a64['ctrlKey']||_0x3f5a64['metaKey'])&&_0x3f5a64['key']==='i'&&(_0x3f5a64['preventDefault'](),document['execCommand']('italic',![],null));if((_0x3f5a64['ctrlKey']||_0x3f5a64['metaKey'])&&_0x3f5a64['key']==='k'){_0x3f5a64['preventDefault'](),this['openLinkDialog']();return;}}['handlePaste'](_0x363538){const _0x16ba05=_0x363538['clipboardData'];if(_0x16ba05&&this['options']['onAddAttachments']){const _0x3d7704=this['extractImageFilesFromClipboard'](_0x16ba05);if(_0x3d7704['length']>0x0){_0x363538['preventDefault'](),this['addAndInsertImages'](_0x3d7704);return;}}_0x363538['preventDefault']();const _0x38f4e4=_0x363538['clipboardData']['getData']('text/html');if(_0x38f4e4&&_0x38f4e4['trim']()){const _0x392a2b=this['convertPastedHtmlToMarkdown'](_0x38f4e4);if(_0x392a2b&&_0x392a2b['trim']()){this['insertMarkdownAsRichText'](_0x392a2b);return;}}const _0x1a5001=_0x363538['clipboardData']['getData']('text/plain');document['execCommand']('insertText',![],_0x1a5001);}['convertPastedHtmlToMarkdown'](_0x50a970){const _0x463738=document['createElement']('div');_0x463738['innerHTML']=_0x50a970;const _0x5b2e32=_0x463738['querySelectorAll']('style,\x20script,\x20meta,\x20link,\x20head,\x20title');_0x5b2e32['forEach'](_0x1faed9=>_0x1faed9['remove']());const _0x5d1b30=_0x463738['querySelectorAll']('*');_0x5d1b30['forEach'](_0x300e29=>{const _0x43a1b1=Array['from'](_0x300e29['attributes']);_0x43a1b1['forEach'](_0x3f9c8=>{_0x3f9c8['name']['startsWith']('data-')&&_0x3f9c8['name']!=='data-attachment-name'&&_0x3f9c8['name']!=='data-mention-user-id'&&_0x300e29['removeAttribute'](_0x3f9c8['name']);});}),_0x463738['querySelectorAll']('font[color]')['forEach'](_0x20268e=>{_0x20268e['replaceWith'](..._0x20268e['childNodes']);}),_0x463738['querySelectorAll']('span')['forEach'](_0x943233=>{_0x943233['style']['color']&&_0x943233['style']['removeProperty']('color'),!_0x943233['getAttribute']('style')&&!_0x943233['getAttribute']('data-mention-user-id')&&!_0x943233['getAttribute']('data-attachment-name')&&_0x943233['replaceWith'](..._0x943233['childNodes']);});try{return this['turndownService']['turndown'](_0x463738['innerHTML']);}catch(_0x12e70d){return console['warn']('Failed\x20to\x20convert\x20HTML\x20to\x20markdown:',_0x12e70d),null;}}['insertMarkdownAsRichText'](_0x47517f){const _0x1f234e=window['marked'];if(!_0x1f234e){document['execCommand']('insertText',![],_0x47517f);return;}try{const _0x1b66c9=this['preprocessColorSyntax'](_0x47517f),_0x383f00=_0x1f234e['parse'](_0x1b66c9),_0x4d7b4e=document['createElement']('div');_0x4d7b4e['innerHTML']=_0x383f00,this['processHtmlForEditor'](_0x4d7b4e),document['execCommand']('insertHTML',![],_0x4d7b4e['innerHTML']);}catch(_0xe479b7){console['warn']('Failed\x20to\x20convert\x20markdown\x20to\x20HTML:',_0xe479b7),document['execCommand']('insertText',![],_0x47517f);}}['processHtmlForEditor'](_0x4801ff){const _0x49cff2=_0x4801ff['querySelectorAll']('pre');_0x49cff2['forEach'](_0x5280b8=>{const _0x131b16=_0x5280b8['querySelector']('code');if(_0x131b16){const _0x1be6c2=Array['from'](_0x131b16['classList'])['find'](_0x142b46=>_0x142b46['startsWith']('language-')),_0x1768bd=_0x1be6c2?_0x1be6c2['replace']('language-',''):'',_0x28e9d7=document['createElement']('pre');_0x1768bd&&_0x28e9d7['setAttribute']('data-language',_0x1768bd),_0x28e9d7['textContent']=_0x131b16['textContent'],_0x5280b8['replaceWith'](_0x28e9d7);}});const _0x5c3305=_0x4801ff['querySelectorAll']('a');_0x5c3305['forEach'](_0x1d59f9=>{_0x1d59f9['setAttribute']('target','_blank'),_0x1d59f9['setAttribute']('rel','noopener\x20noreferrer');});}['handleDragStart'](_0x37a171){const _0x131c0f=_0x37a171['target'];if(!_0x131c0f||_0x131c0f['tagName']!=='IMG')return;if(!_0x37a171['dataTransfer'])return;const _0x19d270=_0x131c0f['getAttribute']('data-attachment-name')||'';try{_0x37a171['dataTransfer']['setData'](INTERNAL_DRAG_MIME,_0x19d270||'1');}catch{}_0x37a171['dataTransfer']['effectAllowed']='move';}['handleDragOver'](_0x4471c9){if(!this['isExternalFileTransfer'](_0x4471c9['dataTransfer']))return;_0x4471c9['preventDefault'](),_0x4471c9['dataTransfer']['dropEffect']='copy';}['handleDrop'](_0xd5d509){if(!this['isExternalFileTransfer'](_0xd5d509['dataTransfer']))return;const _0x39ba36=_0xd5d509['dataTransfer'],_0x3dc555=Array['from'](_0x39ba36['files']||[])['filter'](_0xbadd3=>_0xbadd3&&typeof _0xbadd3['type']==='string'),_0x1b227a=_0x3dc555['filter'](_0x304cd4=>_0x304cd4['type']['startsWith']('image/'));if(_0x1b227a['length']===0x0)return;_0xd5d509['preventDefault'](),_0xd5d509['stopPropagation'](),this['cleanupParentDragState'](),this['moveSelectionToDropPoint'](_0xd5d509),this['addAndInsertImages'](_0x1b227a);}['cleanupParentDragState'](){let _0x1cef88=this['editor']['parentElement'];while(_0x1cef88){_0x1cef88['classList']&&_0x1cef88['classList']['contains']('drag-over')&&_0x1cef88['classList']['remove']('drag-over'),_0x1cef88=_0x1cef88['parentElement'];}}['isExternalFileTransfer'](_0xbd966c){if(!_0xbd966c)return![];const _0x2c4f28=Array['from'](_0xbd966c['types']||[]);if(!_0x2c4f28['includes']('Files'))return![];if(_0x2c4f28['includes'](INTERNAL_DRAG_MIME))return![];if(_0xbd966c['files']&&_0xbd966c['files']['length']>0x0)return!![];if(_0xbd966c['items']&&Array['from'](_0xbd966c['items'])['some'](_0x2fcd27=>_0x2fcd27['kind']==='file'))return!![];return![];}['moveSelectionToDropPoint'](_0x2b6796){const _0x14d796=_0x2b6796['clientX'],_0x49a6af=_0x2b6796['clientY'];let _0x352795=null;if(document['caretRangeFromPoint'])_0x352795=document['caretRangeFromPoint'](_0x14d796,_0x49a6af);else{if(document['caretPositionFromPoint']){const _0x105b5f=document['caretPositionFromPoint'](_0x14d796,_0x49a6af);_0x105b5f&&(_0x352795=document['createRange'](),_0x352795['setStart'](_0x105b5f['offsetNode'],_0x105b5f['offset']),_0x352795['collapse'](!![]));}}if(_0x352795){const _0x556d8d=window['getSelection']();_0x556d8d['removeAllRanges'](),_0x556d8d['addRange'](_0x352795);}}['extractImageFilesFromClipboard'](_0x373daf){const _0x2e31ac=Array['from'](_0x373daf['items']||[]),_0x31c32d=[];for(const _0x3c50fd of _0x2e31ac){if(_0x3c50fd['kind']==='file'&&_0x3c50fd['type']&&_0x3c50fd['type']['startsWith']('image/')){const _0x5152d7=_0x3c50fd['getAsFile']();if(_0x5152d7)_0x31c32d['push'](_0x5152d7);}}return _0x31c32d;}['addAndInsertImages'](_0x310031){const _0x40996b=_0x310031['map'](_0xbbbbfa=>this['prepareAttachmentFile'](_0xbbbbfa))['filter'](Boolean);if(_0x40996b['length']===0x0)return;const _0x46a14c=_0x40996b['map'](_0x4a4680=>_0x4a4680['file']);try{this['options']['onAddAttachments'](_0x46a14c);}catch(_0x145cb6){console['error']('Failed\x20to\x20add\x20attachments:',_0x145cb6);}for(const {name:_0x377a03,objectUrl:_0x409847}of _0x40996b){this['insertAttachmentImage'](_0x377a03,_0x409847);}this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['prepareAttachmentFile'](_0x2acbef){const _0x1dda6a=this['sanitizeFilename'](_0x2acbef['name']||this['defaultImageName'](_0x2acbef['type']));if(!_0x1dda6a)return null;const _0x3c2b29=this['getUniqueAttachmentName'](_0x1dda6a),_0x3eecf1=_0x3c2b29===_0x2acbef['name']?_0x2acbef:new File([_0x2acbef],_0x3c2b29,{'type':_0x2acbef['type'],'lastModified':_0x2acbef['lastModified']}),_0x55251=URL['createObjectURL'](_0x3eecf1);return this['attachmentObjectUrls']['set'](_0x3c2b29,_0x55251),{'name':_0x3c2b29,'file':_0x3eecf1,'objectUrl':_0x55251};}['getUniqueAttachmentName'](_0xf1a93f){const _0x4b34ee=_0x512155=>{if(this['attachmentObjectUrls']['has'](_0x512155))return!![];if(this['options']['isAttachmentNameTaken'])try{return Boolean(this['options']['isAttachmentNameTaken'](_0x512155));}catch{return![];}return![];};if(!_0x4b34ee(_0xf1a93f))return _0xf1a93f;const {stem:_0x49c183,ext:_0x1161ea}=this['splitFilename'](_0xf1a93f);for(let _0x14b2dd=0x2;_0x14b2dd<0x3e8;_0x14b2dd++){const _0x2aaa6e=_0x49c183+'-'+_0x14b2dd+_0x1161ea;if(!_0x4b34ee(_0x2aaa6e))return _0x2aaa6e;}return _0x49c183+'-'+Date['now']()+_0x1161ea;}['splitFilename'](_0x525a39){const _0x4da143=_0x525a39['lastIndexOf']('.');if(_0x4da143<=0x0||_0x4da143===_0x525a39['length']-0x1)return{'stem':_0x525a39,'ext':''};return{'stem':_0x525a39['slice'](0x0,_0x4da143),'ext':_0x525a39['slice'](_0x4da143)};}['sanitizeFilename'](_0x156bbf){const _0x234aa3=String(_0x156bbf||'')['split']('/')['pop']()['split']('\x5c')['pop']();return _0x234aa3['replace'](/[\u0000-\u001F\u007F]/g,'')['trim']();}['defaultImageName'](_0x35795e){const _0x4d605d=this['extensionForMime'](_0x35795e);return'pasted-image-'+Date['now']()+_0x4d605d;}['extensionForMime'](_0x4634e3){switch(_0x4634e3){case'image/png':return'.png';case'image/jpeg':return'.jpg';case'image/gif':return'.gif';case'image/webp':return'.webp';case'image/svg+xml':return'.svg';default:return'.png';}}['insertAttachmentImage'](_0x7edb4b,_0x4624e0){const _0x4c4b25=document['createElement']('img');_0x4c4b25['src']=_0x4624e0,_0x4c4b25['alt']=_0x7edb4b,_0x4c4b25['setAttribute']('data-attachment-name',_0x7edb4b),_0x4c4b25['draggable']=!![];const _0x12867f=window['getSelection']();let _0x93e537=![];if(_0x12867f&&_0x12867f['rangeCount']>0x0){const _0x566da4=_0x12867f['getRangeAt'](0x0);_0x93e537=this['editor']['contains'](_0x566da4['commonAncestorContainer'])||this['editor']===_0x566da4['commonAncestorContainer'];}if(!_0x93e537){this['editor']['appendChild'](_0x4c4b25);const _0x677510=document['createRange']();_0x677510['setStartAfter'](_0x4c4b25),_0x677510['collapse'](!![]),_0x12867f['removeAllRanges'](),_0x12867f['addRange'](_0x677510);return;}const _0x3b88d5=_0x12867f['getRangeAt'](0x0);_0x3b88d5['deleteContents'](),_0x3b88d5['insertNode'](_0x4c4b25),_0x3b88d5['setStartAfter'](_0x4c4b25),_0x3b88d5['collapse'](!![]),_0x12867f['removeAllRanges'](),_0x12867f['addRange'](_0x3b88d5);}['toggleInlineCode'](){const _0x2a246d=window['getSelection']();if(_0x2a246d['rangeCount']===0x0)return;const _0x41cb0f=_0x2a246d['getRangeAt'](0x0),_0x243bb6=_0x41cb0f['toString']();if(_0x243bb6){const _0x12764b=document['createElement']('code');_0x12764b['textContent']=_0x243bb6,_0x41cb0f['deleteContents'](),_0x41cb0f['insertNode'](_0x12764b),_0x41cb0f['setStartAfter'](_0x12764b),_0x41cb0f['setEndAfter'](_0x12764b),_0x2a246d['removeAllRanges'](),_0x2a246d['addRange'](_0x41cb0f);}}['insertCodeBlock'](){const _0x3813b8=window['getSelection']();if(_0x3813b8['rangeCount']===0x0)return;const _0x24141b=_0x3813b8['getRangeAt'](0x0),_0x4d9ae5=_0x24141b['toString'](),_0x188f02=document['createElement']('pre'),_0x2076b4=document['createElement']('code');_0x2076b4['textContent']=_0x4d9ae5||'\x0a',_0x188f02['appendChild'](_0x2076b4),_0x24141b['deleteContents'](),_0x24141b['insertNode'](_0x188f02);const _0x2fb038=document['createElement']('p');_0x2fb038['innerHTML']='<br>',_0x188f02['parentNode']['insertBefore'](_0x2fb038,_0x188f02['nextSibling']);const _0x3e9bb7=document['createRange']();!_0x4d9ae5?(_0x3e9bb7['setStart'](_0x2076b4['firstChild'],0x0),_0x3e9bb7['setEnd'](_0x2076b4['firstChild'],0x0)):(_0x3e9bb7['selectNodeContents'](_0x2076b4),_0x3e9bb7['collapse'](![])),_0x3813b8['removeAllRanges'](),_0x3813b8['addRange'](_0x3e9bb7);}['updatePlaceholder'](){const _0x15b67b=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');_0x15b67b?this['editor']['classList']['remove']('empty'):this['editor']['classList']['add']('empty');}['setMarkdown'](_0x4a499f){if(!_0x4a499f||!_0x4a499f['trim']()){this['editor']['innerHTML']='',this['updatePlaceholder']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']='':this['element']['textContent']='';return;}const _0x4f4c0e=this['preprocessColorSyntax'](_0x4a499f),_0x39087a=window['marked']['parse'](_0x4f4c0e);this['editor']['innerHTML']=_0x39087a,this['rewriteAttachmentImages'](),this['rewriteMentionLinks'](),this['addLinkHints'](),this['updatePlaceholder'](),this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x4a499f:this['element']['textContent']=_0x4a499f;}['rewriteAttachmentImages'](){const _0x2e834c=this['editor']['querySelectorAll']('img');_0x2e834c['forEach'](_0x177235=>{const _0x1b981a=_0x177235['getAttribute']('data-attachment-name'),_0x49772c=_0x177235['getAttribute']('src')||'',_0x1c9171=this['parseAttachmentReference'](_0x49772c)||this['parseTaskAttachmentUrl'](_0x49772c),_0x1af546=_0x1b981a||(_0x1c9171?_0x1c9171['name']:null);if(!_0x1af546)return;_0x177235['setAttribute']('data-attachment-name',_0x1af546);const _0x222023=this['attachmentObjectUrls']['get'](_0x1af546)||(this['options']['resolveAttachmentUrl']?this['options']['resolveAttachmentUrl'](_0x1af546):null);_0x222023&&(_0x177235['src']=_0x222023);});}['rewriteMentionLinks'](){const _0x1e19d8=this['editor']['querySelectorAll']('a[href^=\x22mention:\x22]');_0x1e19d8['forEach'](_0x2d4758=>{const _0x3aeb38=_0x2d4758['getAttribute']('href')||'',_0x468840=_0x3aeb38['replace']('mention:',''),_0x3c631a=_0x2d4758['textContent']||'',_0x4d52fe=document['createElement']('span');_0x4d52fe['className']='mention',_0x4d52fe['setAttribute']('data-mention-user-id',_0x468840),_0x4d52fe['setAttribute']('contenteditable','false'),_0x4d52fe['textContent']='@'+_0x3c631a;const _0x4fb59d=_0x2d4758['previousSibling'];_0x4fb59d&&_0x4fb59d['nodeType']===Node['TEXT_NODE']&&_0x4fb59d['textContent']['endsWith']('@')&&(_0x4fb59d['textContent']=_0x4fb59d['textContent']['slice'](0x0,-0x1)),_0x2d4758['parentNode']['replaceChild'](_0x4d52fe,_0x2d4758);});}['addLinkHints'](){if(!this['options']['editable'])return;const _0x460deb=this['editor']['querySelectorAll']('a');_0x460deb['forEach'](_0x471811=>{const _0x3f4202=_0x471811['getAttribute']('href')||'';if(_0x3f4202['startsWith']('mention:'))return;const _0x27250d=_0x471811['textContent']||_0x3f4202,_0x1a848c=_0x27250d+'\x20('+(this['linkHintText']||'Ctrl+click\x20to\x20follow')+')';_0x471811['setAttribute']('aria-label',_0x1a848c);});}['preprocessColorSyntax'](_0x2b9196){if(!_0x2b9196)return _0x2b9196;const _0x5c4bd8=_0x513804=>{return String(_0x513804)['replace'](/\{color:(#[0-9A-Fa-f]{3,6})\}([\s\S]*?)\{\/color\}/g,(_0x548bc1,_0x115f50,_0x47d08c)=>{const _0x54f931=_0x5c4bd8(_0x47d08c);return'<span\x20style=\x22color:\x20'+_0x115f50+'\x22>'+_0x54f931+'</span>';});};return _0x5c4bd8(_0x2b9196);}['parseAttachmentReference'](_0x225a2c){if(!_0x225a2c||typeof _0x225a2c!=='string')return null;if(!_0x225a2c['startsWith'](ATTACHMENT_SCHEME)&&!_0x225a2c['startsWith'](ATTACHMENT_SCHEME+'//'))return null;const _0x503753=_0x225a2c['replace'](ATTACHMENT_SCHEME+'//','')['replace'](ATTACHMENT_SCHEME,'');if(!_0x503753)return null;try{return{'name':decodeURIComponent(_0x503753)};}catch{return{'name':_0x503753};}}['parseTaskAttachmentUrl'](_0x5cfb9b){if(!_0x5cfb9b||typeof _0x5cfb9b!=='string')return null;const _0x5935d3=_0x5cfb9b['match'](/\/tasks\/[^/]+\/attachments\/([^?#]+)/);if(!_0x5935d3)return null;const _0x76178b=_0x5935d3[0x1];try{return{'name':decodeURIComponent(_0x76178b)};}catch{return{'name':_0x76178b};}}['updateAttachmentFile'](_0x3742a3,_0x50b7a6){const _0x106180=this['attachmentObjectUrls']['get'](_0x3742a3);if(_0x106180)try{URL['revokeObjectURL'](_0x106180);}catch{}const _0x482ac6=URL['createObjectURL'](_0x50b7a6);this['attachmentObjectUrls']['set'](_0x3742a3,_0x482ac6);const _0x42c6cf=this['editor']['querySelector']('img[data-attachment-name=\x22'+CSS['escape'](_0x3742a3)+'\x22]');return _0x42c6cf&&(_0x42c6cf['src']=_0x482ac6),_0x482ac6;}['getMarkdown'](){const _0x4cd4a8=this['editor']['innerHTML'];if(!_0x4cd4a8||_0x4cd4a8['trim']()===''||_0x4cd4a8==='<br>')return'';return this['turndownService']['turndown'](_0x4cd4a8)['replace'](/\u200B/g,'');}['getValue'](){return this['getMarkdown']();}['setValue'](_0x46dc90){this['setMarkdown'](_0x46dc90);}['focus'](){this['editor']['focus']();}['clear'](){this['editor']['innerHTML']='',this['updatePlaceholder']();}['setEditable'](_0x51f15e){this['editor']['contentEditable']=_0x51f15e,this['options']['editable']=_0x51f15e;}['handleMentionInput'](_0x3f69c3){if(!this['options']['fetchUsers'])return;const _0x552f58=window['getSelection']();if(!_0x552f58||_0x552f58['rangeCount']===0x0){this['closeMentionDropdown']();return;}const _0x3a3707=_0x552f58['getRangeAt'](0x0),_0x26329b=_0x3a3707['startContainer'];if(_0x26329b['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x4e183b=_0x26329b['textContent']||'',_0x53a550=_0x3a3707['startOffset'],_0x2bd777=_0x4e183b['slice'](0x0,_0x53a550),_0x27df0e=_0x2bd777['lastIndexOf']('@');if(_0x27df0e===-0x1){this['closeMentionDropdown']();return;}const _0x2fa877=_0x27df0e>0x0?_0x2bd777[_0x27df0e-0x1]:'\x20';if(!/\s/['test'](_0x2fa877)&&_0x27df0e!==0x0){this['closeMentionDropdown']();return;}const _0x4770aa=_0x2bd777['slice'](_0x27df0e+0x1);if(/[\s\n]/['test'](_0x4770aa)){this['closeMentionDropdown']();return;}this['mentionState']['active']=!![],this['mentionState']['query']=_0x4770aa['toLowerCase'](),this['mentionState']['startOffset']=_0x27df0e,this['mentionState']['startNode']=_0x26329b,this['showMentionDropdown']();}async['showMentionDropdown'](){if(!this['usersCache'])try{const _0x400f77=await this['options']['fetchUsers']();this['usersCache']=_0x400f77['users']||_0x400f77||[];}catch(_0x2203fa){console['error']('Failed\x20to\x20fetch\x20users\x20for\x20@mention:',_0x2203fa),this['closeMentionDropdown']();return;}this['mentionState']['users']=this['usersCache'];const _0x5d24c5=this['mentionState']['query'];this['mentionState']['filteredUsers']=this['mentionState']['users']['filter'](_0x27c862=>{const _0x44787d=(_0x27c862['name']||'')['toLowerCase'](),_0x3a39aa=(_0x27c862['username']||'')['toLowerCase']();return _0x44787d['includes'](_0x5d24c5)||_0x3a39aa['includes'](_0x5d24c5);})['slice'](0x0,0x8),this['mentionState']['selectedIndex']=0x0;if(this['mentionState']['filteredUsers']['length']===0x0){this['closeMentionDropdown']();return;}this['renderMentionDropdown'](),this['positionMentionDropdown']();}['renderMentionDropdown'](){!this['mentionDropdown']&&(this['mentionDropdown']=document['createElement']('div'),this['mentionDropdown']['className']='mention-dropdown',document['body']['appendChild'](this['mentionDropdown']),this['mentionClickOutsideHandler']=_0x21ac50=>{!this['mentionDropdown']['contains'](_0x21ac50['target'])&&!this['editor']['contains'](_0x21ac50['target'])&&this['closeMentionDropdown']();},document['addEventListener']('click',this['mentionClickOutsideHandler']),this['mentionScrollHandler']=()=>{this['mentionState']['active']&&this['positionMentionDropdown']();},window['addEventListener']('scroll',this['mentionScrollHandler'],!![]));const _0x354216=this['mentionState']['filteredUsers'];this['mentionDropdown']['innerHTML']=_0x354216['map']((_0x4bdb3d,_0x316ad8)=>{const _0x30e76c=_0x316ad8===this['mentionState']['selectedIndex'],_0x1c28f5=_0x4bdb3d['name']||_0x4bdb3d['username']||'Unknown',_0x5525e0=_0x4bdb3d['username']||'',_0x1d0c05=this['getInitials'](_0x1c28f5),_0x180e4f=this['getAvatarColorIndex'](_0x5525e0||_0x4bdb3d['id']||_0x1c28f5);return'\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22mention-option\x20'+(_0x30e76c?'mention-option-selected':'')+'\x22\x20data-index=\x22'+_0x316ad8+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-avatar\x20avatar-color-'+_0x180e4f+'\x22>'+this['escapeHtmlForMention'](_0x1d0c05)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-option-name\x22>'+this['escapeHtmlForMention'](_0x1c28f5)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x5525e0?'<span\x20class=\x22mention-option-username\x22>@'+this['escapeHtmlForMention'](_0x5525e0)+'</span>':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20';})['join'](''),this['mentionDropdown']['querySelectorAll']('.mention-option')['forEach'](_0xba9dd0=>{_0xba9dd0['addEventListener']('mousedown',_0x281d5b=>{_0x281d5b['preventDefault']();const _0x280f90=parseInt(_0xba9dd0['dataset']['index'],0xa);this['insertMention'](this['mentionState']['filteredUsers'][_0x280f90]);}),_0xba9dd0['addEventListener']('mouseenter',()=>{const _0x440294=parseInt(_0xba9dd0['dataset']['index'],0xa);this['mentionState']['selectedIndex']=_0x440294,this['updateMentionSelection']();});}),this['mentionDropdown']['style']['display']='block';}['positionMentionDropdown'](){if(!this['mentionDropdown'])return;const _0x4360ed=window['getSelection']();if(!_0x4360ed||_0x4360ed['rangeCount']===0x0)return;const _0x5eaf50=_0x4360ed['getRangeAt'](0x0),_0x5db919=_0x5eaf50['getBoundingClientRect'](),_0x3d1362=0x104,_0x1d49db=Math['min'](0xf0,this['mentionState']['filteredUsers']['length']*0x24+0x8),_0x427d65=window['innerWidth'],_0x16c953=window['innerHeight'],_0x294011=_0x16c953-_0x5db919['bottom'],_0x13c2e4=_0x5db919['top'],_0x739e8e=_0x294011<_0x1d49db+0xa&&_0x13c2e4>_0x294011;let _0x20747c,_0x45313a;_0x739e8e?_0x20747c=_0x5db919['top']+window['scrollY']-_0x1d49db-0x4:_0x20747c=_0x5db919['bottom']+window['scrollY']+0x4,_0x45313a=_0x5db919['left']+window['scrollX'],_0x45313a+_0x3d1362>_0x427d65-0xa&&(_0x45313a=_0x427d65-_0x3d1362-0xa),_0x45313a<0xa&&(_0x45313a=0xa),this['mentionDropdown']['style']['position']='absolute',this['mentionDropdown']['style']['top']=_0x20747c+'px',this['mentionDropdown']['style']['left']=_0x45313a+'px';}['mentionNavigate'](_0x2579d4){const _0x20a1ec=this['mentionState']['filteredUsers']['length'];if(_0x20a1ec===0x0)return;this['mentionState']['selectedIndex']=(this['mentionState']['selectedIndex']+_0x2579d4+_0x20a1ec)%_0x20a1ec,this['updateMentionSelection']();}['updateMentionSelection'](){if(!this['mentionDropdown'])return;const _0x31a9ff=this['mentionDropdown']['querySelectorAll']('.mention-option');_0x31a9ff['forEach']((_0x5276aa,_0x175096)=>{_0x175096===this['mentionState']['selectedIndex']?(_0x5276aa['classList']['add']('mention-option-selected'),_0x5276aa['scrollIntoView']({'block':'nearest'})):_0x5276aa['classList']['remove']('mention-option-selected');});}['insertMention'](_0x2b5c06){if(!_0x2b5c06)return;const _0x196d1f=window['getSelection']();if(!_0x196d1f||_0x196d1f['rangeCount']===0x0)return;const _0x39453a=_0x196d1f['getRangeAt'](0x0),_0xcc7478=this['mentionState']['startNode'];if(!_0xcc7478||_0xcc7478['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x232c1d=_0xcc7478['textContent']||'',_0x2fbb07=this['mentionState']['startOffset'],_0x57d312=_0x39453a['startOffset'],_0x11e054=_0x232c1d['slice'](0x0,_0x2fbb07),_0x476ca7=_0x232c1d['slice'](_0x57d312),_0x2603e0=document['createElement']('span');_0x2603e0['className']='mention',_0x2603e0['setAttribute']('data-mention-user-id',_0x2b5c06['id']),_0x2603e0['setAttribute']('contenteditable','false'),_0x2603e0['textContent']='@'+(_0x2b5c06['name']||_0x2b5c06['username']);const _0x331eaa=document['createTextNode'](_0x11e054),_0xb99e99=document['createTextNode']('\x20'+_0x476ca7),_0x448a57=_0xcc7478['parentNode'];_0x448a57['insertBefore'](_0x331eaa,_0xcc7478),_0x448a57['insertBefore'](_0x2603e0,_0xcc7478),_0x448a57['insertBefore'](_0xb99e99,_0xcc7478),_0x448a57['removeChild'](_0xcc7478);const _0x31bc54=document['createRange']();_0x31bc54['setStart'](_0xb99e99,0x1),_0x31bc54['collapse'](!![]),_0x196d1f['removeAllRanges'](),_0x196d1f['addRange'](_0x31bc54),this['closeMentionDropdown'](),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['closeMentionDropdown'](){this['mentionState']['active']=![],this['mentionState']['query']='',this['mentionState']['filteredUsers']=[],this['mentionState']['selectedIndex']=0x0,this['mentionDropdown']&&(this['mentionDropdown']['style']['display']='none');}['escapeHtmlForMention'](_0x5d52bd){const _0x4565dc=document['createElement']('div');return _0x4565dc['textContent']=_0x5d52bd,_0x4565dc['innerHTML'];}['getInitials'](_0x5560b1){if(!_0x5560b1)return'?';const _0x2fe013=_0x5560b1['trim']()['split'](/\s+/);if(_0x2fe013['length']>=0x2)return(_0x2fe013[0x0][0x0]+_0x2fe013[_0x2fe013['length']-0x1][0x0])['toUpperCase']();return _0x5560b1['substring'](0x0,0x2)['toUpperCase']();}['getAvatarColorIndex'](_0x593d24){if(!_0x593d24)return 0x6;let _0x16e7ff=0x0;for(let _0x1f3eec=0x0;_0x1f3eec<_0x593d24['length'];_0x1f3eec++){_0x16e7ff=_0x593d24['charCodeAt'](_0x1f3eec)+((_0x16e7ff<<0x5)-_0x16e7ff);}return Math['abs'](_0x16e7ff)%0xa;}['destroy'](){this['selectionChangeHandler']&&document['removeEventListener']('selectionchange',this['selectionChangeHandler']);this['linkClickHandler']&&this['editor']['removeEventListener']('click',this['linkClickHandler']);this['linkMouseEnterHandler']&&this['editor']['removeEventListener']('mouseover',this['linkMouseEnterHandler']);this['linkMouseLeaveHandler']&&this['editor']['removeEventListener']('mouseout',this['linkMouseLeaveHandler']);this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']);this['linkTooltip']&&(this['linkTooltip']['remove'](),this['linkTooltip']=null);this['linkDialog']&&(this['linkDialog']['remove'](),this['linkDialog']=null,this['linkDialogContext']=null,this['linkDialogElements']=null);this['mentionDropdown']&&(this['mentionDropdown']['remove'](),this['mentionDropdown']=null);this['mentionClickOutsideHandler']&&document['removeEventListener']('click',this['mentionClickOutsideHandler']);this['mentionScrollHandler']&&window['removeEventListener']('scroll',this['mentionScrollHandler'],!![]);for(const _0x5a34de of this['attachmentObjectUrls']['values']()){try{URL['revokeObjectURL'](_0x5a34de);}catch{}}this['attachmentObjectUrls']['clear'](),this['container']?this['container']['remove']():this['editor']['remove'](),this['element']['style']['display']='';}}typeof window!=='undefined'&&(window['MarkdownEditor']=MarkdownEditor);
|
|
1
|
+
const ATTACHMENT_SCHEME='attachment:',INTERNAL_DRAG_MIME='application/x-profound-editor-image',LINK_DIALOG_STYLE_ID='markdown-editor-link-dialog-styles',ICONS={'bold':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M6\x204h8a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path><path\x20d=\x22M6\x2012h9a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path></svg>','italic':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2219\x22\x20y1=\x224\x22\x20x2=\x2210\x22\x20y2=\x224\x22></line><line\x20x1=\x2214\x22\x20y1=\x2220\x22\x20x2=\x225\x22\x20y2=\x2220\x22></line><line\x20x1=\x2215\x22\x20y1=\x224\x22\x20x2=\x229\x22\x20y2=\x2220\x22></line></svg>','strike':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x225\x22\x20y1=\x2212\x22\x20x2=\x2219\x22\x20y2=\x2212\x22></line><path\x20d=\x22M16\x206a4\x204\x200\x200\x200-4-4c-2.48\x200-4\x201.79-4\x204\x200\x201.25.5\x202.5\x201.5\x203\x22></path><path\x20d=\x22M9\x2018c0\x201.79\x201.79\x203\x204\x203\x202.48\x200\x204-1.79\x204-4\x200-1.25-.5-2.5-1.5-3\x22></path></svg>','link':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M10\x2013a5\x205\x200\x200\x200\x207.54.54l3-3a5\x205\x200\x200\x200-7.07-7.07l-1.72\x201.71\x22></path><path\x20d=\x22M14\x2011a5\x205\x200\x200\x200-7.54-.54l-3\x203a5\x205\x200\x200\x200\x207.07\x207.07l1.71-1.71\x22></path></svg>','code':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>','listBullet':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x228\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x228\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x228\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><line\x20x1=\x223\x22\x20y1=\x226\x22\x20x2=\x223.01\x22\x20y2=\x226\x22></line><line\x20x1=\x223\x22\x20y1=\x2212\x22\x20x2=\x223.01\x22\x20y2=\x2212\x22></line><line\x20x1=\x223\x22\x20y1=\x2218\x22\x20x2=\x223.01\x22\x20y2=\x2218\x22></line></svg>','listOrdered':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2210\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x2210\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x2210\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><path\x20d=\x22M4\x206h1v4\x22></path><path\x20d=\x22M4\x2010h2\x22></path><path\x20d=\x22M6\x2018H4c0-1\x202-2\x202-3s-1-1.5-2-1\x22></path></svg>','blockquote':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M21\x2015a2\x202\x200\x200\x201-2\x202H7l-4\x204V5a2\x202\x200\x200\x201\x202-2h14a2\x202\x200\x200\x201\x202\x202z\x22></path></svg>','codeBlock':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><rect\x20x=\x223\x22\x20y=\x223\x22\x20width=\x2218\x22\x20height=\x2218\x22\x20rx=\x222\x22\x20ry=\x222\x22></rect><polyline\x20points=\x229\x208\x205\x2012\x209\x2016\x22></polyline><polyline\x20points=\x2215\x208\x2019\x2012\x2015\x2016\x22></polyline></svg>','header':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2012h8\x22></path><path\x20d=\x22M4\x2018V6\x22></path><path\x20d=\x22M12\x2018V6\x22></path><path\x20d=\x22M17\x2012l3-2v8\x22></path></svg>','color':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2020h16\x22></path><path\x20d=\x22M6\x2016l6-14\x206\x2014\x22></path><path\x20d=\x22M8\x2012h8\x22></path></svg>'},LINK_DIALOG_STYLES='\x0a.markdown-editor-link-modal\x20{\x0a\x20\x20position:\x20fixed;\x0a\x20\x20inset:\x200;\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20center;\x0a\x20\x20z-index:\x2010020;\x0a}\x0a\x0a.markdown-editor-link-modal[hidden]\x20{\x0a\x20\x20display:\x20none\x20!important;\x0a}\x0a\x0a.markdown-editor-link-backdrop\x20{\x0a\x20\x20position:\x20absolute;\x0a\x20\x20inset:\x200;\x0a\x20\x20background:\x20rgba(15,\x2023,\x2042,\x200.45);\x0a}\x0a\x0a.markdown-editor-link-dialog\x20{\x0a\x20\x20position:\x20relative;\x0a\x20\x20width:\x20min(460px,\x20calc(100vw\x20-\x2024px));\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-medium,\x2010px);\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(15,\x2023,\x2042,\x200.25);\x0a\x20\x20padding:\x2014px;\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2012px;\x0a}\x0a\x0a.markdown-editor-link-header\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20space-between;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-title\x20{\x0a\x20\x20margin:\x200;\x0a\x20\x20font-size:\x2016px;\x0a\x20\x20font-weight:\x20600;\x0a}\x0a\x0a.markdown-editor-link-close\x20{\x0a\x20\x20width:\x2028px;\x0a\x20\x20height:\x2028px;\x0a\x20\x20border:\x20none;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#6b7280));\x0a\x20\x20font-size:\x2020px;\x0a\x20\x20line-height:\x201;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-close:hover\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a}\x0a\x0a.markdown-editor-link-form\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-field-grid\x20{\x0a\x20\x20display:\x20grid;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-label\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x206px;\x0a\x20\x20font-size:\x2012px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#4b5563));\x0a}\x0a\x0a.markdown-editor-link-input\x20{\x0a\x20\x20width:\x20100%;\x0a\x20\x20padding:\x209px\x2010px;\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20font-size:\x2014px;\x0a}\x0a\x0a.markdown-editor-link-input:focus\x20{\x0a\x20\x20outline:\x20none;\x0a\x20\x20border-color:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20box-shadow:\x200\x200\x200\x203px\x20rgba(63,\x20114,\x20255,\x200.2);\x0a}\x0a\x0a.markdown-editor-link-actions\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20justify-content:\x20flex-end;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-btn\x20{\x0a\x20\x20border:\x201px\x20solid\x20transparent;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20padding:\x207px\x2012px;\x0a\x20\x20font-size:\x2013px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-btn-secondary\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border-color:\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a}\x0a\x0a.markdown-editor-link-btn-secondary:hover\x20{\x0a\x20\x20background:\x20var(--color-bg-secondary,\x20var(--feedback-surface-hover,\x20#e5e7eb));\x0a}\x0a\x0a.markdown-editor-link-btn-danger\x20{\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-danger,\x20#dc2626);\x0a\x20\x20border-color:\x20rgba(220,\x2038,\x2038,\x200.35);\x0a}\x0a\x0a.markdown-editor-link-btn-danger:hover\x20{\x0a\x20\x20background:\x20rgba(220,\x2038,\x2038,\x200.08);\x0a}\x0a\x0a.markdown-editor-link-btn-primary\x20{\x0a\x20\x20background:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20color:\x20#ffffff;\x0a}\x0a\x0a.markdown-editor-link-btn-primary:hover\x20{\x0a\x20\x20background:\x20var(--color-accent,\x20#2563eb);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-backdrop\x20{\x0a\x20\x20background:\x20rgba(2,\x206,\x2023,\x200.65);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(0,\x200,\x200,\x200.5);\x0a}\x0a\x0a@media\x20(max-width:\x20480px)\x20{\x0a\x20\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20\x20\x20width:\x20calc(100vw\x20-\x2016px);\x0a\x20\x20\x20\x20padding:\x2012px;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-actions\x20{\x0a\x20\x20\x20\x20flex-wrap:\x20wrap;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-btn\x20{\x0a\x20\x20\x20\x20flex:\x201\x201\x20calc(50%\x20-\x206px);\x0a\x20\x20\x20\x20text-align:\x20center;\x0a\x20\x20}\x0a}\x0a';export class MarkdownEditor{constructor(_0xe06438,_0x435d92={}){this['element']=_0xe06438,this['options']={'placeholder':_0x435d92['placeholder']||'Start\x20typing...','editable':_0x435d92['editable']!==![],'onChange':_0x435d92['onChange']||null,'minHeight':_0x435d92['minHeight']||'100px','toolbar':_0x435d92['toolbar']||![],'onAddAttachments':_0x435d92['onAddAttachments']||null,'resolveAttachmentUrl':_0x435d92['resolveAttachmentUrl']||null,'isAttachmentNameTaken':_0x435d92['isAttachmentNameTaken']||null,'fetchUsers':_0x435d92['fetchUsers']||null},this['mentionState']={'active':![],'query':'','startOffset':0x0,'startNode':null,'users':[],'filteredUsers':[],'selectedIndex':0x0},this['mentionDropdown']=null,this['usersCache']=null,this['linkDialog']=null,this['linkDialogContext']=null;const _0x55bb00=window['TurndownService'];this['turndownService']=new _0x55bb00({'headingStyle':'atx','codeBlockStyle':'fenced','emDelimiter':'_','bulletListMarker':'-'}),this['attachmentObjectUrls']=new Map(),this['registerTurndownRules'](),this['init']();}['registerTurndownRules'](){this['turndownService']['addRule']('profoundAttachmentImage',{'filter':_0x479ea3=>{return _0x479ea3&&_0x479ea3['nodeName']==='IMG'&&_0x479ea3['getAttribute']&&_0x479ea3['getAttribute']('data-attachment-name');},'replacement':(_0x59b1ca,_0xedb0bc)=>{const _0x4fd016=_0xedb0bc['getAttribute']('data-attachment-name')||'',_0x5d76a5=_0xedb0bc['getAttribute']('alt')||'',_0x596a7e=_0x4fd016['trim'](),_0x5153af=this['escapeAltText'](_0x5d76a5||_0x596a7e),_0x5e79fa=encodeURIComponent(_0x596a7e);return'';}}),this['turndownService']['addRule']('profoundMention',{'filter':_0x465220=>{return _0x465220&&_0x465220['nodeName']==='SPAN'&&_0x465220['getAttribute']&&_0x465220['getAttribute']('data-mention-user-id');},'replacement':(_0x5e89c2,_0x1cee08)=>{const _0x313232=_0x1cee08['getAttribute']('data-mention-user-id')||'',_0x3dbc12=_0x1cee08['textContent']||'',_0x3dea95=_0x3dbc12['startsWith']('@')?_0x3dbc12['slice'](0x1):_0x3dbc12;return'['+_0x3dea95+'](mention:'+_0x313232+')';}}),this['turndownService']['addRule']('profoundColoredText',{'filter':_0x2171ef=>{if(!_0x2171ef)return![];if(_0x2171ef['nodeName']==='FONT'&&_0x2171ef['getAttribute']&&_0x2171ef['getAttribute']('color'))return!![];if(_0x2171ef['nodeName']==='SPAN'&&_0x2171ef['style']&&_0x2171ef['style']['color']){if(_0x2171ef['getAttribute']&&_0x2171ef['getAttribute']('data-mention-user-id'))return![];return!![];}return![];},'replacement':(_0x1f83ea,_0x1a5aad)=>{if(!_0x1f83ea['trim']())return _0x1f83ea;let _0x17d444='';if(_0x1a5aad['nodeName']==='FONT')_0x17d444=_0x1a5aad['getAttribute']('color')||'';else _0x1a5aad['style']&&_0x1a5aad['style']['color']&&(_0x17d444=this['rgbToHex'](_0x1a5aad['style']['color']));if(!_0x17d444)return _0x1f83ea;return'{color:'+_0x17d444+'}'+_0x1f83ea+'{/color}';}});}['rgbToHex'](_0x2f4dce){if(!_0x2f4dce)return'';if(_0x2f4dce['startsWith']('#'))return _0x2f4dce;const _0x29db5e=_0x2f4dce['match'](/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(!_0x29db5e)return _0x2f4dce;const _0x4e2449=parseInt(_0x29db5e[0x1],0xa),_0x4f60f8=parseInt(_0x29db5e[0x2],0xa),_0x243cf7=parseInt(_0x29db5e[0x3],0xa);return'#'+[_0x4e2449,_0x4f60f8,_0x243cf7]['map'](_0x4a521b=>_0x4a521b['toString'](0x10)['padStart'](0x2,'0'))['join']('')['toUpperCase']();}['escapeAltText'](_0x166828){return String(_0x166828||'')['replace'](/\]/g,'\x5c]');}['init'](){this['editor']=document['createElement']('div'),this['editor']['className']='markdown-editor',this['editor']['contentEditable']=this['options']['editable'],this['editor']['setAttribute']('role','textbox'),this['editor']['setAttribute']('aria-multiline','true'),this['editor']['style']['minHeight']=this['options']['minHeight'];this['options']['placeholder']&&this['editor']['setAttribute']('data-placeholder',this['options']['placeholder']);this['options']['toolbar']?(this['container']=document['createElement']('div'),this['container']['className']='markdown-editor-wrapper',this['container']['style']['display']='flex',this['container']['style']['flexDirection']='column',this['createToolbar'](),this['container']['appendChild'](this['toolbar']),this['container']['appendChild'](this['editor']),this['element']['parentNode']['insertBefore'](this['container'],this['element'])):this['element']['parentNode']['insertBefore'](this['editor'],this['element']);this['element']['style']['display']='none',this['isMac']=navigator['platform']['toUpperCase']()['indexOf']('MAC')>=0x0,this['linkHintText']=this['isMac']?'⌘+click\x20to\x20follow':'Ctrl+click\x20to\x20follow';this['options']['editable']&&this['bindEvents']();const _0x2880cc=this['element']['textContent']||this['element']['value']||'';_0x2880cc['trim']()&&this['setMarkdown'](_0x2880cc);}['createToolbar'](){this['toolbar']=document['createElement']('div'),this['toolbar']['className']='markdown-editor-toolbar',this['toolbarButtons']={};const _0x34193f=[{'id':'header','icon':ICONS['header'],'title':'Heading','action':'header','isDropdown':!![]},{'separator':!![]},{'id':'bold','icon':ICONS['bold'],'title':'Bold\x20(Ctrl+B)','action':'bold','command':'bold'},{'id':'italic','icon':ICONS['italic'],'title':'Italic\x20(Ctrl+I)','action':'italic','command':'italic'},{'id':'strike','icon':ICONS['strike'],'title':'Strikethrough','action':'strikeThrough','command':'strikeThrough'},{'id':'color','icon':ICONS['color'],'title':'Text\x20Color','action':'color','isDropdown':!![]},{'separator':!![]},{'id':'link','icon':ICONS['link'],'title':'Link\x20(Ctrl+K)','action':'link','tagName':'A'},{'id':'code','icon':ICONS['code'],'title':'Inline\x20Code','action':'code','tagName':'CODE'},{'id':'codeBlock','icon':ICONS['codeBlock'],'title':'Code\x20Block','action':'codeBlock','tagName':'PRE'},{'separator':!![]},{'id':'list-bullet','icon':ICONS['listBullet'],'title':'Bullet\x20List','action':'insertUnorderedList','command':'insertUnorderedList'},{'id':'list-ordered','icon':ICONS['listOrdered'],'title':'Numbered\x20List','action':'insertOrderedList','command':'insertOrderedList'}];_0x34193f['forEach'](_0x583b10=>{if(_0x583b10['separator']){const _0x4d45c9=document['createElement']('div');_0x4d45c9['className']='markdown-toolbar-separator',_0x4d45c9['style']['width']='1px',_0x4d45c9['style']['height']='16px',_0x4d45c9['style']['background']='var(--color-border)',_0x4d45c9['style']['margin']='0\x206px',_0x4d45c9['style']['alignSelf']='center',this['toolbar']['appendChild'](_0x4d45c9);}else{if(_0x583b10['isDropdown']){const _0x1e3514=document['createElement']('div');_0x1e3514['className']='markdown-toolbar-dropdown',_0x1e3514['style']['position']='relative';const _0x3983f4=document['createElement']('button');_0x3983f4['type']='button',_0x3983f4['className']='markdown-editor-toolbar-btn\x20markdown-toolbar-dropdown-btn',_0x3983f4['tabIndex']=-0x1,_0x3983f4['innerHTML']=_0x583b10['icon']+'<svg\x20class=\x22dropdown-arrow\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2210\x22\x20height=\x2210\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x226\x209\x2012\x2015\x2018\x209\x22></polyline></svg>',_0x3983f4['title']=_0x583b10['title'],_0x3983f4['dataset']['action']=_0x583b10['action'];const _0x1e8ffb=document['createElement']('div');_0x1e8ffb['className']='markdown-toolbar-dropdown-menu',_0x1e8ffb['style']['display']='none';if(_0x583b10['action']==='header')this['createHeaderDropdown'](_0x1e8ffb);else _0x583b10['action']==='color'&&this['createColorDropdown'](_0x1e8ffb);_0x3983f4['addEventListener']('click',_0x4e980c=>{_0x4e980c['preventDefault'](),_0x4e980c['stopPropagation'](),this['toggleDropdown'](_0x1e8ffb,_0x3983f4);}),_0x1e3514['appendChild'](_0x3983f4),_0x1e3514['appendChild'](_0x1e8ffb),this['toolbar']['appendChild'](_0x1e3514),this['toolbarButtons'][_0x583b10['id']]={'button':_0x3983f4,'dropdown':_0x1e8ffb,'command':_0x583b10['command'],'tagName':_0x583b10['tagName']};}else{const _0x3cdd53=document['createElement']('button');_0x3cdd53['type']='button',_0x3cdd53['className']='markdown-editor-toolbar-btn',_0x3cdd53['tabIndex']=-0x1,_0x3cdd53['innerHTML']=_0x583b10['icon'],_0x3cdd53['title']=_0x583b10['title'],_0x3cdd53['dataset']['action']=_0x583b10['action'],_0x3cdd53['addEventListener']('click',_0x2d4d8f=>{_0x2d4d8f['preventDefault'](),this['handleToolbarAction'](_0x583b10['action']);}),this['toolbar']['appendChild'](_0x3cdd53),this['toolbarButtons'][_0x583b10['id']]={'button':_0x3cdd53,'command':_0x583b10['command'],'tagName':_0x583b10['tagName']};}}}),document['addEventListener']('click',_0x4c9b2d=>{!this['toolbar']['contains'](_0x4c9b2d['target'])&&this['closeAllDropdowns']();});}['createHeaderDropdown'](_0x399361){const _0x29cb75=[{'level':0x1,'label':'Heading\x201','tag':'H1'},{'level':0x2,'label':'Heading\x202','tag':'H2'},{'level':0x3,'label':'Heading\x203','tag':'H3'},{'level':0x4,'label':'Heading\x204','tag':'H4'},{'level':0x0,'label':'Normal\x20Text','tag':'P'}];_0x29cb75['forEach'](_0x1e40d7=>{const _0xccd23=document['createElement']('button');_0xccd23['type']='button',_0xccd23['className']='markdown-dropdown-item',_0xccd23['tabIndex']=-0x1,_0xccd23['innerHTML']='<span\x20style=\x22font-size:\x20'+(_0x1e40d7['level']===0x0?'14px':0x14-_0x1e40d7['level']*0x2+'px')+';\x20font-weight:\x20'+(_0x1e40d7['level']===0x0?'normal':'bold')+'\x22>'+_0x1e40d7['label']+'</span>',_0xccd23['addEventListener']('click',_0xba9b6=>{_0xba9b6['preventDefault'](),_0xba9b6['stopPropagation'](),this['applyHeader'](_0x1e40d7['level']),this['closeAllDropdowns']();}),_0x399361['appendChild'](_0xccd23);});}['createColorDropdown'](_0x3d9f1a){const _0x65d5f8=[{'value':'#000000','label':'Black'},{'value':'#374151','label':'Gray'},{'value':'#DC2626','label':'Red'},{'value':'#EA580C','label':'Orange'},{'value':'#CA8A04','label':'Yellow'},{'value':'#16A34A','label':'Green'},{'value':'#2563EB','label':'Blue'},{'value':'#7C3AED','label':'Purple'},{'value':'#DB2777','label':'Pink'}],_0x3f60da=document['createElement']('div');_0x3f60da['className']='markdown-color-grid',_0x3f60da['style']['display']='grid',_0x3f60da['style']['gridTemplateColumns']='repeat(3,\x201fr)',_0x3f60da['style']['gap']='4px',_0x3f60da['style']['padding']='8px',_0x65d5f8['forEach'](_0x4dae85=>{const _0x2614a8=document['createElement']('button');_0x2614a8['type']='button',_0x2614a8['className']='markdown-color-btn',_0x2614a8['tabIndex']=-0x1,_0x2614a8['style']['width']='24px',_0x2614a8['style']['height']='24px',_0x2614a8['style']['backgroundColor']=_0x4dae85['value'],_0x2614a8['style']['border']='1px\x20solid\x20var(--color-border)',_0x2614a8['style']['borderRadius']='4px',_0x2614a8['style']['cursor']='pointer',_0x2614a8['title']=_0x4dae85['label'],_0x2614a8['addEventListener']('click',_0x43e167=>{_0x43e167['preventDefault'](),_0x43e167['stopPropagation'](),this['applyColor'](_0x4dae85['value']),this['closeAllDropdowns']();}),_0x3f60da['appendChild'](_0x2614a8);}),_0x3d9f1a['appendChild'](_0x3f60da);const _0x28c881=document['createElement']('button');_0x28c881['type']='button',_0x28c881['className']='markdown-dropdown-item',_0x28c881['innerHTML']='<span>Remove\x20Color</span>',_0x28c881['style']['borderTop']='1px\x20solid\x20var(--color-border)',_0x28c881['style']['marginTop']='4px',_0x28c881['style']['paddingTop']='8px',_0x28c881['addEventListener']('click',_0x23e1ba=>{_0x23e1ba['preventDefault'](),_0x23e1ba['stopPropagation'](),this['removeColor'](),this['closeAllDropdowns']();}),_0x3d9f1a['appendChild'](_0x28c881);}['toggleDropdown'](_0x47d571,_0x10d04d){const _0x4c06ee=_0x47d571['style']['display']!=='none';this['toolbar']&&this['closeAllDropdowns'](),!_0x4c06ee&&(_0x47d571['style']['display']='block',_0x10d04d['classList']['add']('active'));}['closeAllDropdowns'](){const _0x1bd1be=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-menu');_0x1bd1be['forEach'](_0x316b86=>_0x316b86['style']['display']='none');const _0x3b0000=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-btn');_0x3b0000['forEach'](_0x557d82=>_0x557d82['classList']['remove']('active'));}['applyHeader'](_0xd90e01){this['editor']['focus']();const _0x3e6f64=window['getSelection']();if(!_0x3e6f64||_0x3e6f64['rangeCount']===0x0)return;const _0x706444=_0x3e6f64['getRangeAt'](0x0);let _0x414f6e=_0x706444['startContainer'];while(_0x414f6e&&_0x414f6e!==this['editor']){if(_0x414f6e['nodeType']===Node['ELEMENT_NODE']){const _0x3a7cb6=window['getComputedStyle'](_0x414f6e)['display'];if(_0x3a7cb6==='block'||['P','H1','H2','H3','H4','H5','H6','DIV']['includes'](_0x414f6e['tagName']))break;}_0x414f6e=_0x414f6e['parentNode'];}_0xd90e01===0x0?document['execCommand']('formatBlock',![],'p'):document['execCommand']('formatBlock',![],'h'+_0xd90e01),this['editor']['dispatchEvent'](new Event('input'));}['applyColor'](_0x231d8d){this['editor']['focus'](),document['execCommand']('foreColor',![],_0x231d8d),this['editor']['dispatchEvent'](new Event('input'));}['removeColor'](){this['editor']['focus'](),document['execCommand']('removeFormat',![],null),this['editor']['dispatchEvent'](new Event('input'));}['handleToolbarAction'](_0x2dd637){this['editor']['focus']();switch(_0x2dd637){case'bold':case'italic':case'strikeThrough':case'insertUnorderedList':case'insertOrderedList':document['execCommand'](_0x2dd637,![],null);break;case'link':this['openLinkDialog']();return;case'code':this['toggleInlineCode']();break;case'codeBlock':this['insertCodeBlock']();break;}this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialog'](){if(this['linkDialog'])return;this['ensureLinkDialogStyles']();const _0x4ff14f=document['createElement']('div');_0x4ff14f['className']='markdown-editor-link-modal',_0x4ff14f['hidden']=!![],_0x4ff14f['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-backdrop\x22></div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-dialog\x22\x20role=\x22dialog\x22\x20aria-modal=\x22true\x22\x20aria-label=\x22Edit\x20link\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h3\x20class=\x22markdown-editor-link-title\x22>Insert\x20Link</h3>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-close\x22\x20aria-label=\x22Close\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<form\x20class=\x22markdown-editor-link-form\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-field-grid\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20URL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22url\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22https://example.com\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Display\x20text\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22Text\x20shown\x20to\x20readers\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</label>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-secondary\x22\x20data-action=\x22cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-danger\x22\x20data-action=\x22remove\x22\x20hidden>Remove\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22submit\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-primary\x22>Insert\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</form>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20',document['body']['appendChild'](_0x4ff14f),this['linkDialog']=_0x4ff14f,this['linkDialogElements']={'backdrop':_0x4ff14f['querySelector']('.markdown-editor-link-backdrop'),'title':_0x4ff14f['querySelector']('.markdown-editor-link-title'),'close':_0x4ff14f['querySelector']('.markdown-editor-link-close'),'form':_0x4ff14f['querySelector']('.markdown-editor-link-form'),'urlInput':_0x4ff14f['querySelector']('[data-link-field=\x22url\x22]'),'textInput':_0x4ff14f['querySelector']('[data-link-field=\x22text\x22]'),'remove':_0x4ff14f['querySelector']('[data-action=\x22remove\x22]'),'cancel':_0x4ff14f['querySelector']('[data-action=\x22cancel\x22]'),'submit':_0x4ff14f['querySelector']('.markdown-editor-link-btn-primary')},this['linkDialogElements']['backdrop']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['close']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['cancel']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['remove']['addEventListener']('click',()=>{this['applyLinkDialogResult']({'remove':!![]});}),this['linkDialogElements']['form']['addEventListener']('submit',_0x4b69f3=>{_0x4b69f3['preventDefault'](),this['applyLinkDialogResult']();}),this['linkDialog']['addEventListener']('keydown',_0x573e41=>{_0x573e41['key']==='Escape'&&(_0x573e41['preventDefault'](),this['closeLinkDialog']({'restoreSelection':!![]}));});}['openLinkDialog'](){const _0x4e01fb=window['getSelection']();if(!_0x4e01fb||_0x4e01fb['rangeCount']===0x0)return;const _0x1262d7=_0x4e01fb['getRangeAt'](0x0),_0x170eac=this['editor']['contains'](_0x1262d7['commonAncestorContainer'])||this['editor']===_0x1262d7['commonAncestorContainer'];if(!_0x170eac)return;this['toolbar']&&this['closeAllDropdowns']();this['ensureLinkDialog']();const _0x447ee9=_0x1262d7['cloneRange'](),_0x4368af=this['findLinkAtRange'](_0x447ee9),_0x309846=_0x4368af?_0x4368af['getAttribute']('href')||'':'',_0xa69bf4=_0x4368af?_0x4368af['textContent']||'':_0x447ee9['toString']();this['linkDialogContext']={'range':_0x447ee9,'existingLink':_0x4368af,'selectedText':_0xa69bf4},this['linkDialogElements']['title']['textContent']=_0x4368af?'Edit\x20Link':'Insert\x20Link',this['linkDialogElements']['submit']['textContent']=_0x4368af?'Save\x20Link':'Insert\x20Link',this['linkDialogElements']['remove']['hidden']=!_0x4368af,this['linkDialogElements']['urlInput']['value']=_0x309846,this['linkDialogElements']['textInput']['value']=_0xa69bf4,this['linkDialog']['hidden']=![],this['linkDialogElements']['urlInput']['focus'](),this['linkDialogElements']['urlInput']['select']();}['closeLinkDialog']({restoreSelection:restoreSelection=![]}={}){if(!this['linkDialog'])return;const _0x56428d=this['linkDialogContext'];this['linkDialog']['hidden']=!![],restoreSelection&&_0x56428d?.['range']&&(this['editor']['focus'](),this['restoreRange'](_0x56428d['range'])),this['linkDialogContext']=null;}['applyLinkDialogResult']({remove:remove=![]}={}){if(!this['linkDialog']||!this['linkDialogContext'])return;const _0x339864=this['linkDialogContext'],_0x37685e=(this['linkDialogElements']['urlInput']['value']||'')['trim'](),_0x5e309f=this['linkDialogElements']['textInput']['value']||'',_0x4f3ab4=_0x5e309f['trim']();if(!remove&&!_0x37685e){this['linkDialogElements']['urlInput']['focus']();return;}this['closeLinkDialog'](),this['editor']['focus'](),this['restoreRange'](_0x339864['range']);if(remove)_0x339864['existingLink']&&_0x339864['existingLink']['parentNode']?this['unwrapLinkElement'](_0x339864['existingLink']):document['execCommand']('unlink',![],null);else{if(_0x339864['existingLink']&&_0x339864['existingLink']['parentNode'])_0x339864['existingLink']['setAttribute']('href',_0x37685e),_0x339864['existingLink']['textContent']=_0x4f3ab4||_0x37685e;else{const _0x73a301=window['getSelection']();if(!_0x73a301||_0x73a301['rangeCount']===0x0)return;const _0x1f788f=_0x73a301['getRangeAt'](0x0),_0x1c1d0d=(_0x339864['selectedText']||'')['trim'](),_0x2eee07=_0x4f3ab4||_0x1c1d0d||_0x37685e;_0x1f788f['deleteContents']();const _0x17ae1b=document['createElement']('a');_0x17ae1b['href']=_0x37685e,_0x17ae1b['textContent']=_0x2eee07,_0x1f788f['insertNode'](_0x17ae1b),_0x1f788f['setStartAfter'](_0x17ae1b),_0x1f788f['collapse'](!![]),_0x73a301['removeAllRanges'](),_0x73a301['addRange'](_0x1f788f);}}this['addLinkHints'](),this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialogStyles'](){if(document['getElementById'](LINK_DIALOG_STYLE_ID))return;const _0x198a6b=document['createElement']('style');_0x198a6b['id']=LINK_DIALOG_STYLE_ID,_0x198a6b['textContent']=LINK_DIALOG_STYLES,document['head']['appendChild'](_0x198a6b);}['restoreRange'](_0x188f15){const _0x56c8f0=window['getSelection']();if(!_0x56c8f0)return;try{_0x56c8f0['removeAllRanges'](),_0x56c8f0['addRange'](_0x188f15);return;}catch(_0x17e1f2){}const _0x388fb1=document['createRange']();_0x388fb1['selectNodeContents'](this['editor']),_0x388fb1['collapse'](![]),_0x56c8f0['removeAllRanges'](),_0x56c8f0['addRange'](_0x388fb1);}['findLinkAtRange'](_0x46b782){if(!_0x46b782)return null;const _0x45c484=this['findParentLink'](_0x46b782['startContainer']);if(_0x46b782['collapsed'])return _0x45c484;const _0x1b164b=this['findParentLink'](_0x46b782['endContainer']);if(_0x45c484&&_0x45c484===_0x1b164b)return _0x45c484;if(_0x45c484&&_0x45c484['contains'](_0x46b782['endContainer']))return _0x45c484;if(_0x1b164b&&_0x1b164b['contains'](_0x46b782['startContainer']))return _0x1b164b;return null;}['findParentLink'](_0x4aaaae){let _0x47667e=_0x4aaaae;while(_0x47667e&&_0x47667e!==this['editor']){if(_0x47667e['nodeType']===Node['ELEMENT_NODE']&&_0x47667e['tagName']==='A'){const _0x16d4db=_0x47667e['getAttribute']('href')||'';if(_0x16d4db['startsWith']('mention:'))return null;return _0x47667e;}_0x47667e=_0x47667e['parentNode'];}return null;}['unwrapLinkElement'](_0x43d27b){const _0x4cdc2c=_0x43d27b['parentNode'];if(!_0x4cdc2c)return;while(_0x43d27b['firstChild']){_0x4cdc2c['insertBefore'](_0x43d27b['firstChild'],_0x43d27b);}_0x4cdc2c['removeChild'](_0x43d27b);}['isSelectionInTag'](_0x3a771d){const _0x28486e=window['getSelection']();if(!_0x28486e||_0x28486e['rangeCount']===0x0)return![];let _0x51d4df=_0x28486e['anchorNode'];while(_0x51d4df&&_0x51d4df!==this['editor']){if(_0x51d4df['nodeType']===Node['ELEMENT_NODE']&&_0x51d4df['tagName']===_0x3a771d)return!![];_0x51d4df=_0x51d4df['parentNode'];}return![];}['updateToolbarState'](){if(!this['toolbarButtons'])return;for(const [_0x47a788,_0x2a6512]of Object['entries'](this['toolbarButtons'])){let _0xcd19f6=![];if(_0x2a6512['command'])try{_0xcd19f6=document['queryCommandState'](_0x2a6512['command']);}catch(_0x280458){_0xcd19f6=![];}else _0x2a6512['tagName']&&(_0xcd19f6=this['isSelectionInTag'](_0x2a6512['tagName']));_0x2a6512['button']['classList']['toggle']('active',_0xcd19f6);}}['bindEvents'](){this['editor']['addEventListener']('keydown',_0x43c024=>this['handleKeydown'](_0x43c024)),this['editor']['addEventListener']('input',_0x1404ba=>{this['handleMentionInput'](_0x1404ba),this['handleAutoFormat'](_0x1404ba);}),this['editor']['addEventListener']('input',()=>{const _0x275aff=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');!_0x275aff&&(this['editor']['innerHTML']='');this['updatePlaceholder']();const _0x5f572c=this['getMarkdown']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x5f572c:this['element']['textContent']=_0x5f572c,this['options']['onChange']&&this['options']['onChange'](_0x5f572c);}),this['editor']['addEventListener']('paste',_0x1f3e32=>this['handlePaste'](_0x1f3e32)),this['editor']['addEventListener']('dragover',_0x55be7e=>this['handleDragOver'](_0x55be7e)),this['editor']['addEventListener']('drop',_0x463e36=>this['handleDrop'](_0x463e36)),this['editor']['addEventListener']('dragstart',_0x1a23ac=>this['handleDragStart'](_0x1a23ac)),this['options']['toolbar']&&(this['selectionChangeHandler']=()=>{(this['editor']['contains'](document['activeElement'])||this['editor']===document['activeElement'])&&this['updateToolbarState']();},document['addEventListener']('selectionchange',this['selectionChangeHandler']),this['editor']['addEventListener']('keyup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('mouseup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('focus',()=>this['updateToolbarState']())),this['linkClickHandler']=_0x39c3c9=>this['handleLinkClick'](_0x39c3c9),this['editor']['addEventListener']('click',this['linkClickHandler']),this['linkMouseEnterHandler']=_0x54ea66=>this['handleLinkMouseEnter'](_0x54ea66),this['linkMouseLeaveHandler']=_0x248329=>this['handleLinkMouseLeave'](_0x248329),this['editor']['addEventListener']('mouseover',this['linkMouseEnterHandler']),this['editor']['addEventListener']('mouseout',this['linkMouseLeaveHandler']),this['updatePlaceholder']();}['handleAutoFormat'](_0x1cc7ab){if(_0x1cc7ab['inputType']==='deleteContentBackward')return;const _0x4e228c=window['getSelection']();if(!_0x4e228c||_0x4e228c['rangeCount']===0x0)return;const _0x35d8f2=_0x4e228c['getRangeAt'](0x0),_0x5ea157=_0x35d8f2['startContainer'];if(_0x5ea157['nodeType']!==Node['TEXT_NODE'])return;if(this['isSelectionInTag']('CODE')||this['isSelectionInTag']('PRE'))return;const _0x1a386a=_0x5ea157['textContent'],_0x2da60b=_0x35d8f2['startOffset'],_0x3197d5=_0x1a386a['slice'](0x0,_0x2da60b);if(_0x3197d5['endsWith']('```')){_0x35d8f2['setStart'](_0x5ea157,_0x2da60b-0x3),_0x35d8f2['setEnd'](_0x5ea157,_0x2da60b),_0x35d8f2['deleteContents'](),this['insertCodeBlock']();return;}const _0x85a7b2=/`([^`]+)`$/,_0x42ea43=_0x3197d5['match'](_0x85a7b2);if(_0x42ea43){const _0x4b5461=_0x42ea43[0x1];if(_0x4b5461){const _0x71c4f2=_0x42ea43['index'],_0x41c001=_0x71c4f2+_0x4b5461['length']+0x2;_0x35d8f2['setStart'](_0x5ea157,_0x71c4f2),_0x35d8f2['setEnd'](_0x5ea157,_0x2da60b),_0x35d8f2['deleteContents']();const _0xe6db05=document['createElement']('code');_0xe6db05['textContent']=_0x4b5461,_0x35d8f2['insertNode'](_0xe6db05),_0x35d8f2['setStartAfter'](_0xe6db05),_0x35d8f2['setEndAfter'](_0xe6db05);const _0x174c50=document['createTextNode']('');_0x35d8f2['insertNode'](_0x174c50),_0x35d8f2['setStartAfter'](_0x174c50),_0x35d8f2['setEndAfter'](_0x174c50),_0x4e228c['removeAllRanges'](),_0x4e228c['addRange'](_0x35d8f2);return;}}const _0xf7fc3=_0x3197d5['match'](/^[-*][\s\u00A0]$/);if(_0xf7fc3&&this['isAtStartOfBlock'](_0x5ea157)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x35d8f2['setStart'](_0x5ea157,Math['max'](_0x2da60b-0x2,0x0)),_0x35d8f2['setEnd'](_0x5ea157,_0x2da60b),_0x35d8f2['deleteContents']();const _0x40547c=this['ensureListInsertionAnchor'](_0x5ea157);document['execCommand']('insertUnorderedList',![],null);_0x40547c&&_0x40547c['parentNode']&&_0x40547c['parentNode']['removeChild'](_0x40547c);this['updateToolbarState']();return;}const _0x2aacb0=_0x3197d5['match'](/^1\.[\s\u00A0]$/);if(_0x2aacb0&&this['isAtStartOfBlock'](_0x5ea157)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x35d8f2['setStart'](_0x5ea157,Math['max'](_0x2da60b-0x3,0x0)),_0x35d8f2['setEnd'](_0x5ea157,_0x2da60b),_0x35d8f2['deleteContents']();const _0x198224=this['ensureListInsertionAnchor'](_0x5ea157);document['execCommand']('insertOrderedList',![],null);_0x198224&&_0x198224['parentNode']&&_0x198224['parentNode']['removeChild'](_0x198224);this['updateToolbarState']();return;}}['isAtStartOfBlock'](_0x49cdce){let _0x57a820=_0x49cdce;while(_0x57a820&&_0x57a820!==this['editor']){const _0x2448e4=_0x57a820['parentNode'];if(!_0x2448e4)break;const _0x5d0834=_0x2448e4['tagName'];if(_0x5d0834==='DIV'||_0x5d0834==='P'||_0x5d0834==='LI'||_0x2448e4===this['editor']){let _0x2ae7e8=_0x2448e4['firstChild'];while(_0x2ae7e8&&(_0x2ae7e8['nodeType']===Node['TEXT_NODE']&&_0x2ae7e8['textContent']===''||_0x2ae7e8['nodeType']===Node['ELEMENT_NODE']&&_0x2ae7e8['tagName']==='BR')){_0x2ae7e8=_0x2ae7e8['nextSibling'];}return _0x2ae7e8===_0x49cdce||_0x2ae7e8===_0x57a820;}_0x57a820=_0x2448e4;}if(_0x57a820===this['editor']||_0x49cdce['parentNode']===this['editor']){let _0x373bd8=this['editor']['firstChild'];while(_0x373bd8&&(_0x373bd8['nodeType']===Node['TEXT_NODE']&&_0x373bd8['textContent']===''||_0x373bd8['nodeType']===Node['ELEMENT_NODE']&&_0x373bd8['tagName']==='BR')){_0x373bd8=_0x373bd8['nextSibling'];}return _0x373bd8===_0x49cdce;}return![];}['getClosestBlockElement'](_0xbe581d){let _0x3f9c0a=_0xbe581d;while(_0x3f9c0a&&_0x3f9c0a!==this['editor']){const _0x509fa0=_0x3f9c0a['parentNode'];if(!_0x509fa0)break;const _0x2b9cca=_0x509fa0['tagName'];if(_0x2b9cca==='DIV'||_0x2b9cca==='P'||_0x2b9cca==='LI'||_0x509fa0===this['editor'])return _0x509fa0;_0x3f9c0a=_0x509fa0;}return this['editor'];}['ensureListInsertionAnchor'](_0x1e97ae){const _0x4a3273=window['getSelection']();if(!_0x4a3273||_0x4a3273['rangeCount']===0x0)return null;const _0x191a0b=this['getClosestBlockElement'](_0x1e97ae);if(!_0x191a0b||_0x191a0b===this['editor'])return null;const _0x5cc4bd=_0x191a0b['textContent']['replace'](/\u200B/g,'');if(_0x5cc4bd!=='')return null;const _0x1ea5cb=document['createTextNode']('');_0x191a0b['appendChild'](_0x1ea5cb);const _0x3ebfc8=document['createRange']();return _0x3ebfc8['setStart'](_0x1ea5cb,0x1),_0x3ebfc8['setEnd'](_0x1ea5cb,0x1),_0x4a3273['removeAllRanges'](),_0x4a3273['addRange'](_0x3ebfc8),_0x1ea5cb;}['getContainingListItem'](){const _0x294de8=window['getSelection']();if(!_0x294de8||_0x294de8['rangeCount']===0x0)return null;let _0x3aec60=_0x294de8['anchorNode'];while(_0x3aec60&&_0x3aec60!==this['editor']){if(_0x3aec60['nodeType']===Node['ELEMENT_NODE']&&_0x3aec60['tagName']==='LI')return _0x3aec60;_0x3aec60=_0x3aec60['parentNode'];}return null;}['isEmptyListItem'](_0x10ca4b){if(!_0x10ca4b)return![];const _0x96f0ea=_0x10ca4b['textContent']['replace'](/\u200B/g,'')['trim']();if(_0x96f0ea!=='')return![];const _0x3009fd=_0x10ca4b['querySelector']('img');if(_0x3009fd)return![];const _0x500ea5=_0x10ca4b['querySelector']('ul,\x20ol');if(_0x500ea5)return![];return!![];}['isCursorAtStartOfListItem'](_0x4dea59){if(!_0x4dea59)return![];const _0x174ef9=window['getSelection']();if(!_0x174ef9||_0x174ef9['rangeCount']===0x0||!_0x174ef9['isCollapsed'])return![];const _0x227259=_0x174ef9['getRangeAt'](0x0),_0x1c7619=_0x227259['startContainer'];if(_0x1c7619!==_0x4dea59&&!_0x4dea59['contains'](_0x1c7619))return![];const _0x58ad9d=_0x227259['cloneRange']();_0x58ad9d['setStart'](_0x4dea59,0x0),_0x58ad9d['setEnd'](_0x1c7619,_0x227259['startOffset']);const _0x1f508e=_0x58ad9d['toString']()['replace'](/\u200B/g,'')['replace'](/\u00A0/g,'\x20');return _0x1f508e['trim']()==='';}['indentListItem'](_0x573188){const _0xe860d9=_0x573188['previousElementSibling'];if(!_0xe860d9||_0xe860d9['tagName']!=='LI')return;const _0x297574=_0x573188['parentNode'],_0x13529a=_0x297574['tagName'];let _0x1cbc08=_0xe860d9['querySelector'](':scope\x20>\x20ul,\x20:scope\x20>\x20ol');!_0x1cbc08&&(_0x1cbc08=document['createElement'](_0x13529a),_0xe860d9['appendChild'](_0x1cbc08)),_0x1cbc08['appendChild'](_0x573188),this['placeCursorInListItem'](_0x573188);}['outdentListItem'](_0x25f5b0){const _0x4b75fc=_0x25f5b0['parentNode'];if(!_0x4b75fc||_0x4b75fc['tagName']!=='UL'&&_0x4b75fc['tagName']!=='OL')return;const _0x3ae4f7=_0x4b75fc['parentNode'];if(_0x3ae4f7&&_0x3ae4f7['tagName']==='LI'){const _0x2045a6=_0x3ae4f7['parentNode'];_0x2045a6['insertBefore'](_0x25f5b0,_0x3ae4f7['nextSibling']),_0x4b75fc['children']['length']===0x0&&_0x4b75fc['remove'](),this['placeCursorInListItem'](_0x25f5b0);}else return;}['exitListOnEmptyBullet'](_0x4e099a){const _0x2230b5=_0x4e099a['parentNode'];if(!_0x2230b5)return;const _0x59f658=_0x2230b5['parentNode'];if(_0x59f658&&_0x59f658['tagName']==='LI'){this['outdentListItem'](_0x4e099a);return;}const _0xc1dce=_0x2230b5['parentNode'],_0x3ff9f2=document['createElement']('p');_0x3ff9f2['innerHTML']='<br>',_0xc1dce['insertBefore'](_0x3ff9f2,_0x2230b5['nextSibling']),_0x4e099a['remove']();_0x2230b5['children']['length']===0x0&&_0x2230b5['remove']();const _0x47906b=window['getSelection'](),_0x2eed21=document['createRange']();_0x2eed21['setStart'](_0x3ff9f2,0x0),_0x2eed21['collapse'](!![]),_0x47906b['removeAllRanges'](),_0x47906b['addRange'](_0x2eed21);}['placeCursorInListItem'](_0x3a2ed3){const _0x45fc4a=window['getSelection'](),_0x5647fe=document['createRange'](),_0x167325=document['createTreeWalker'](_0x3a2ed3,NodeFilter['SHOW_TEXT'],null,![]),_0x20ce00=_0x167325['nextNode']();_0x20ce00?_0x5647fe['setStart'](_0x20ce00,0x0):_0x5647fe['setStart'](_0x3a2ed3,0x0),_0x5647fe['collapse'](!![]),_0x45fc4a['removeAllRanges'](),_0x45fc4a['addRange'](_0x5647fe);}['handleLinkClick'](_0x5c2528){const _0x59bda5=this['isMac']?_0x5c2528['metaKey']:_0x5c2528['ctrlKey'];if(!_0x59bda5)return;let _0x18a02c=_0x5c2528['target'];while(_0x18a02c&&_0x18a02c!==this['editor']){if(_0x18a02c['tagName']==='A'){_0x5c2528['preventDefault'](),_0x5c2528['stopPropagation']();const _0x17cf29=_0x18a02c['getAttribute']('href');if(!_0x17cf29)return;if(_0x17cf29['startsWith']('mention:'))return;const _0x3f930d=/^https?:\/\//i['test'](_0x17cf29);_0x3f930d?window['open'](_0x17cf29,'_blank','noopener,noreferrer'):window['location']['href']=_0x17cf29;return;}_0x18a02c=_0x18a02c['parentNode'];}}['handleLinkMouseEnter'](_0x2f53b5){const _0x1bf847=_0x2f53b5['target'];if(_0x1bf847['tagName']!=='A')return;const _0x2cc0cb=_0x1bf847['getAttribute']('href')||'';if(_0x2cc0cb['startsWith']('mention:'))return;this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=setTimeout(()=>{this['showLinkTooltip'](_0x1bf847);},0x12c);}['handleLinkMouseLeave'](_0x32f83e){const _0x565f49=_0x32f83e['target'];if(_0x565f49['tagName']!=='A')return;this['linkTooltipTimeout']&&(clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=null),this['hideLinkTooltip']();}['showLinkTooltip'](_0x544526){!this['linkTooltip']&&(this['linkTooltip']=document['createElement']('div'),this['linkTooltip']['className']='markdown-editor-link-tooltip',document['body']['appendChild'](this['linkTooltip']));this['linkTooltip']['textContent']=this['linkHintText']||'Ctrl+click\x20to\x20follow';const _0x3c2fec=_0x544526['getBoundingClientRect'](),_0xa32ec4=this['linkTooltip']['getBoundingClientRect']();let _0x5dc436=_0x3c2fec['bottom']+0x4,_0x25671c=_0x3c2fec['left']+_0x3c2fec['width']/0x2;_0x5dc436+0x1e>window['innerHeight']&&(_0x5dc436=_0x3c2fec['top']-0x1e);const _0x4b3a0c=0x78;if(_0x25671c-_0x4b3a0c/0x2<0xa)_0x25671c=_0x4b3a0c/0x2+0xa;else _0x25671c+_0x4b3a0c/0x2>window['innerWidth']-0xa&&(_0x25671c=window['innerWidth']-_0x4b3a0c/0x2-0xa);this['linkTooltip']['style']['top']=_0x5dc436+'px',this['linkTooltip']['style']['left']=_0x25671c+'px',this['linkTooltip']['style']['transform']='translateX(-50%)',this['linkTooltip']['classList']['add']('visible');}['hideLinkTooltip'](){this['linkTooltip']&&this['linkTooltip']['classList']['remove']('visible');}['handleKeydown'](_0x412378){if(this['mentionState']['active']){if(_0x412378['key']==='ArrowDown'){_0x412378['preventDefault'](),this['mentionNavigate'](0x1);return;}if(_0x412378['key']==='ArrowUp'){_0x412378['preventDefault'](),this['mentionNavigate'](-0x1);return;}if(_0x412378['key']==='Enter'||_0x412378['key']==='Tab'){if(this['mentionState']['filteredUsers']['length']>0x0){_0x412378['preventDefault'](),this['insertMention'](this['mentionState']['filteredUsers'][this['mentionState']['selectedIndex']]);return;}}if(_0x412378['key']==='Escape'){_0x412378['preventDefault'](),this['closeMentionDropdown']();return;}}if(_0x412378['key']==='Tab'&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x428f40=this['getContainingListItem']();if(_0x428f40&&this['isCursorAtStartOfListItem'](_0x428f40)){_0x412378['preventDefault']();_0x412378['shiftKey']?this['outdentListItem'](_0x428f40):this['indentListItem'](_0x428f40);this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x412378['key']==='Enter'&&!_0x412378['shiftKey']&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x428c1f=this['getContainingListItem']();if(_0x428c1f&&this['isEmptyListItem'](_0x428c1f)){_0x412378['preventDefault'](),this['exitListOnEmptyBullet'](_0x428c1f),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x412378['key']==='Enter'&&!_0x412378['shiftKey']&&this['isSelectionInTag']('PRE')){_0x412378['preventDefault']();const _0x4bf0e3=window['getSelection']();if(_0x4bf0e3['rangeCount']>0x0){const _0x4f2b5b=_0x4bf0e3['getRangeAt'](0x0);_0x4f2b5b['deleteContents']();const _0x47be9b=document['createTextNode']('\x0a');_0x4f2b5b['insertNode'](_0x47be9b),_0x4f2b5b['setStartAfter'](_0x47be9b),_0x4f2b5b['setEndAfter'](_0x47be9b),_0x4bf0e3['removeAllRanges'](),_0x4bf0e3['addRange'](_0x4f2b5b),this['handleInput']();}return;}(_0x412378['ctrlKey']||_0x412378['metaKey'])&&_0x412378['key']==='b'&&(_0x412378['preventDefault'](),document['execCommand']('bold',![],null));(_0x412378['ctrlKey']||_0x412378['metaKey'])&&_0x412378['key']==='i'&&(_0x412378['preventDefault'](),document['execCommand']('italic',![],null));if((_0x412378['ctrlKey']||_0x412378['metaKey'])&&_0x412378['key']==='k'){_0x412378['preventDefault'](),this['openLinkDialog']();return;}}['handlePaste'](_0x1388e0){const _0xacdbe5=_0x1388e0['clipboardData'];if(_0xacdbe5&&this['options']['onAddAttachments']){const _0xd013de=this['extractImageFilesFromClipboard'](_0xacdbe5);if(_0xd013de['length']>0x0){_0x1388e0['preventDefault'](),this['addAndInsertImages'](_0xd013de);return;}}_0x1388e0['preventDefault']();const _0x1dd589=_0x1388e0['clipboardData']['getData']('text/html');if(_0x1dd589&&_0x1dd589['trim']()){const _0xeeb7ea=this['convertPastedHtmlToMarkdown'](_0x1dd589);if(_0xeeb7ea&&_0xeeb7ea['trim']()){this['insertMarkdownAsRichText'](_0xeeb7ea);return;}}const _0x122a0d=_0x1388e0['clipboardData']['getData']('text/plain');document['execCommand']('insertText',![],_0x122a0d);}['convertPastedHtmlToMarkdown'](_0x112ad0){const _0x2caf05=document['createElement']('div');_0x2caf05['innerHTML']=_0x112ad0;const _0x41f1ca=_0x2caf05['querySelectorAll']('style,\x20script,\x20meta,\x20link,\x20head,\x20title');_0x41f1ca['forEach'](_0xd9478c=>_0xd9478c['remove']());const _0x164486=_0x2caf05['querySelectorAll']('*');_0x164486['forEach'](_0x3d7963=>{const _0x341be3=Array['from'](_0x3d7963['attributes']);_0x341be3['forEach'](_0x419785=>{_0x419785['name']['startsWith']('data-')&&_0x419785['name']!=='data-attachment-name'&&_0x419785['name']!=='data-mention-user-id'&&_0x3d7963['removeAttribute'](_0x419785['name']);});}),_0x2caf05['querySelectorAll']('font[color]')['forEach'](_0x1c5ad9=>{_0x1c5ad9['replaceWith'](..._0x1c5ad9['childNodes']);}),_0x2caf05['querySelectorAll']('span')['forEach'](_0x3a7fb6=>{_0x3a7fb6['style']['color']&&_0x3a7fb6['style']['removeProperty']('color'),!_0x3a7fb6['getAttribute']('style')&&!_0x3a7fb6['getAttribute']('data-mention-user-id')&&!_0x3a7fb6['getAttribute']('data-attachment-name')&&_0x3a7fb6['replaceWith'](..._0x3a7fb6['childNodes']);});try{return this['turndownService']['turndown'](_0x2caf05['innerHTML']);}catch(_0x31568b){return console['warn']('Failed\x20to\x20convert\x20HTML\x20to\x20markdown:',_0x31568b),null;}}['insertMarkdownAsRichText'](_0x2c635e){const _0x367063=window['marked'];if(!_0x367063){document['execCommand']('insertText',![],_0x2c635e);return;}try{const _0x41a434=this['preprocessColorSyntax'](_0x2c635e),_0x59f970=_0x367063['parse'](_0x41a434),_0x2b0f64=document['createElement']('div');_0x2b0f64['innerHTML']=_0x59f970,this['processHtmlForEditor'](_0x2b0f64),document['execCommand']('insertHTML',![],_0x2b0f64['innerHTML']);}catch(_0x31a7d2){console['warn']('Failed\x20to\x20convert\x20markdown\x20to\x20HTML:',_0x31a7d2),document['execCommand']('insertText',![],_0x2c635e);}}['processHtmlForEditor'](_0x39276e){const _0x656075=_0x39276e['querySelectorAll']('pre');_0x656075['forEach'](_0x3d458c=>{const _0x2d40d4=_0x3d458c['querySelector']('code');if(_0x2d40d4){const _0x17281a=Array['from'](_0x2d40d4['classList'])['find'](_0x4d8b22=>_0x4d8b22['startsWith']('language-')),_0x21e6fe=_0x17281a?_0x17281a['replace']('language-',''):'',_0x27e636=document['createElement']('pre');_0x21e6fe&&_0x27e636['setAttribute']('data-language',_0x21e6fe),_0x27e636['textContent']=_0x2d40d4['textContent'],_0x3d458c['replaceWith'](_0x27e636);}});const _0x9f1c88=_0x39276e['querySelectorAll']('a');_0x9f1c88['forEach'](_0x31dac7=>{_0x31dac7['setAttribute']('target','_blank'),_0x31dac7['setAttribute']('rel','noopener\x20noreferrer');});}['handleDragStart'](_0x570dd5){const _0x2e087c=_0x570dd5['target'];if(!_0x2e087c||_0x2e087c['tagName']!=='IMG')return;if(!_0x570dd5['dataTransfer'])return;const _0x97d1c3=_0x2e087c['getAttribute']('data-attachment-name')||'';try{_0x570dd5['dataTransfer']['setData'](INTERNAL_DRAG_MIME,_0x97d1c3||'1');}catch{}_0x570dd5['dataTransfer']['effectAllowed']='move';}['handleDragOver'](_0x468c11){if(!this['isExternalFileTransfer'](_0x468c11['dataTransfer']))return;_0x468c11['preventDefault'](),_0x468c11['dataTransfer']['dropEffect']='copy';}['handleDrop'](_0x270283){if(!this['isExternalFileTransfer'](_0x270283['dataTransfer']))return;const _0x36041e=_0x270283['dataTransfer'],_0x332259=Array['from'](_0x36041e['files']||[])['filter'](_0x128a25=>_0x128a25&&typeof _0x128a25['type']==='string'),_0x3bd5f8=_0x332259['filter'](_0x240cbc=>_0x240cbc['type']['startsWith']('image/'));if(_0x3bd5f8['length']===0x0)return;_0x270283['preventDefault'](),_0x270283['stopPropagation'](),this['cleanupParentDragState'](),this['moveSelectionToDropPoint'](_0x270283),this['addAndInsertImages'](_0x3bd5f8);}['cleanupParentDragState'](){let _0x214655=this['editor']['parentElement'];while(_0x214655){_0x214655['classList']&&_0x214655['classList']['contains']('drag-over')&&_0x214655['classList']['remove']('drag-over'),_0x214655=_0x214655['parentElement'];}}['isExternalFileTransfer'](_0x5c2530){if(!_0x5c2530)return![];const _0x2346a2=Array['from'](_0x5c2530['types']||[]);if(!_0x2346a2['includes']('Files'))return![];if(_0x2346a2['includes'](INTERNAL_DRAG_MIME))return![];if(_0x5c2530['files']&&_0x5c2530['files']['length']>0x0)return!![];if(_0x5c2530['items']&&Array['from'](_0x5c2530['items'])['some'](_0x4976ba=>_0x4976ba['kind']==='file'))return!![];return![];}['moveSelectionToDropPoint'](_0xf875e7){const _0x12ef85=_0xf875e7['clientX'],_0x7bbd61=_0xf875e7['clientY'];let _0x43bbee=null;if(document['caretRangeFromPoint'])_0x43bbee=document['caretRangeFromPoint'](_0x12ef85,_0x7bbd61);else{if(document['caretPositionFromPoint']){const _0x3be016=document['caretPositionFromPoint'](_0x12ef85,_0x7bbd61);_0x3be016&&(_0x43bbee=document['createRange'](),_0x43bbee['setStart'](_0x3be016['offsetNode'],_0x3be016['offset']),_0x43bbee['collapse'](!![]));}}if(_0x43bbee){const _0x49c149=window['getSelection']();_0x49c149['removeAllRanges'](),_0x49c149['addRange'](_0x43bbee);}}['extractImageFilesFromClipboard'](_0x2d0003){const _0x5d7f16=Array['from'](_0x2d0003['items']||[]),_0x124b39=[];for(const _0x5bfa79 of _0x5d7f16){if(_0x5bfa79['kind']==='file'&&_0x5bfa79['type']&&_0x5bfa79['type']['startsWith']('image/')){const _0xdf67cc=_0x5bfa79['getAsFile']();if(_0xdf67cc)_0x124b39['push'](_0xdf67cc);}}return _0x124b39;}['addAndInsertImages'](_0x5dff47){const _0x5ba45a=_0x5dff47['map'](_0x2bcb61=>this['prepareAttachmentFile'](_0x2bcb61))['filter'](Boolean);if(_0x5ba45a['length']===0x0)return;const _0xa26275=_0x5ba45a['map'](_0x1ddfb7=>_0x1ddfb7['file']);try{this['options']['onAddAttachments'](_0xa26275);}catch(_0x1b94c1){console['error']('Failed\x20to\x20add\x20attachments:',_0x1b94c1);}for(const {name:_0xd3b6c2,objectUrl:_0x2e4f71}of _0x5ba45a){this['insertAttachmentImage'](_0xd3b6c2,_0x2e4f71);}this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['prepareAttachmentFile'](_0x44d774){const _0x379b94=this['sanitizeFilename'](_0x44d774['name']||this['defaultImageName'](_0x44d774['type']));if(!_0x379b94)return null;const _0x3f18d0=this['getUniqueAttachmentName'](_0x379b94),_0x3a8070=_0x3f18d0===_0x44d774['name']?_0x44d774:new File([_0x44d774],_0x3f18d0,{'type':_0x44d774['type'],'lastModified':_0x44d774['lastModified']}),_0x84080c=URL['createObjectURL'](_0x3a8070);return this['attachmentObjectUrls']['set'](_0x3f18d0,_0x84080c),{'name':_0x3f18d0,'file':_0x3a8070,'objectUrl':_0x84080c};}['getUniqueAttachmentName'](_0x35f87f){const _0x280226=_0xe44b33=>{if(this['attachmentObjectUrls']['has'](_0xe44b33))return!![];if(this['options']['isAttachmentNameTaken'])try{return Boolean(this['options']['isAttachmentNameTaken'](_0xe44b33));}catch{return![];}return![];};if(!_0x280226(_0x35f87f))return _0x35f87f;const {stem:_0x54709a,ext:_0x1efa0c}=this['splitFilename'](_0x35f87f);for(let _0x458400=0x2;_0x458400<0x3e8;_0x458400++){const _0x2cad76=_0x54709a+'-'+_0x458400+_0x1efa0c;if(!_0x280226(_0x2cad76))return _0x2cad76;}return _0x54709a+'-'+Date['now']()+_0x1efa0c;}['splitFilename'](_0x4f2208){const _0x2d5196=_0x4f2208['lastIndexOf']('.');if(_0x2d5196<=0x0||_0x2d5196===_0x4f2208['length']-0x1)return{'stem':_0x4f2208,'ext':''};return{'stem':_0x4f2208['slice'](0x0,_0x2d5196),'ext':_0x4f2208['slice'](_0x2d5196)};}['sanitizeFilename'](_0xb21269){const _0x5efeb9=String(_0xb21269||'')['split']('/')['pop']()['split']('\x5c')['pop']();return _0x5efeb9['replace'](/[\u0000-\u001F\u007F]/g,'')['trim']();}['defaultImageName'](_0x484b64){const _0x538fe2=this['extensionForMime'](_0x484b64);return'pasted-image-'+Date['now']()+_0x538fe2;}['extensionForMime'](_0x3c45a4){switch(_0x3c45a4){case'image/png':return'.png';case'image/jpeg':return'.jpg';case'image/gif':return'.gif';case'image/webp':return'.webp';case'image/svg+xml':return'.svg';default:return'.png';}}['insertAttachmentImage'](_0x315841,_0x379152){const _0xd5cefe=document['createElement']('img');_0xd5cefe['src']=_0x379152,_0xd5cefe['alt']=_0x315841,_0xd5cefe['setAttribute']('data-attachment-name',_0x315841),_0xd5cefe['draggable']=!![];const _0x5dbff5=window['getSelection']();let _0xc1a7db=![];if(_0x5dbff5&&_0x5dbff5['rangeCount']>0x0){const _0x2d9e15=_0x5dbff5['getRangeAt'](0x0);_0xc1a7db=this['editor']['contains'](_0x2d9e15['commonAncestorContainer'])||this['editor']===_0x2d9e15['commonAncestorContainer'];}if(!_0xc1a7db){this['editor']['appendChild'](_0xd5cefe);const _0xa54d73=document['createRange']();_0xa54d73['setStartAfter'](_0xd5cefe),_0xa54d73['collapse'](!![]),_0x5dbff5['removeAllRanges'](),_0x5dbff5['addRange'](_0xa54d73);return;}const _0xac3688=_0x5dbff5['getRangeAt'](0x0);_0xac3688['deleteContents'](),_0xac3688['insertNode'](_0xd5cefe),_0xac3688['setStartAfter'](_0xd5cefe),_0xac3688['collapse'](!![]),_0x5dbff5['removeAllRanges'](),_0x5dbff5['addRange'](_0xac3688);}['toggleInlineCode'](){const _0x372dbe=window['getSelection']();if(_0x372dbe['rangeCount']===0x0)return;const _0x1cb817=_0x372dbe['getRangeAt'](0x0),_0x121a12=_0x1cb817['toString']();if(_0x121a12){const _0x3c5319=document['createElement']('code');_0x3c5319['textContent']=_0x121a12,_0x1cb817['deleteContents'](),_0x1cb817['insertNode'](_0x3c5319),_0x1cb817['setStartAfter'](_0x3c5319),_0x1cb817['setEndAfter'](_0x3c5319),_0x372dbe['removeAllRanges'](),_0x372dbe['addRange'](_0x1cb817);}}['insertCodeBlock'](){const _0x47ec0f=window['getSelection']();if(_0x47ec0f['rangeCount']===0x0)return;const _0x51b0ee=_0x47ec0f['getRangeAt'](0x0),_0x1c8fca=_0x51b0ee['toString'](),_0x9a0612=document['createElement']('pre'),_0x330837=document['createElement']('code');_0x330837['textContent']=_0x1c8fca||'\x0a',_0x9a0612['appendChild'](_0x330837),_0x51b0ee['deleteContents'](),_0x51b0ee['insertNode'](_0x9a0612);const _0x2072e3=document['createElement']('p');_0x2072e3['innerHTML']='<br>',_0x9a0612['parentNode']['insertBefore'](_0x2072e3,_0x9a0612['nextSibling']);const _0x2fe180=document['createRange']();!_0x1c8fca?(_0x2fe180['setStart'](_0x330837['firstChild'],0x0),_0x2fe180['setEnd'](_0x330837['firstChild'],0x0)):(_0x2fe180['selectNodeContents'](_0x330837),_0x2fe180['collapse'](![])),_0x47ec0f['removeAllRanges'](),_0x47ec0f['addRange'](_0x2fe180);}['updatePlaceholder'](){const _0xa5f090=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');_0xa5f090?this['editor']['classList']['remove']('empty'):this['editor']['classList']['add']('empty');}['setMarkdown'](_0x1f3b07){if(!_0x1f3b07||!_0x1f3b07['trim']()){this['editor']['innerHTML']='',this['updatePlaceholder']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']='':this['element']['textContent']='';return;}const _0x1183e3=this['preprocessColorSyntax'](_0x1f3b07),_0x203e6d=window['marked']['parse'](_0x1183e3);this['editor']['innerHTML']=_0x203e6d,this['rewriteAttachmentImages'](),this['rewriteMentionLinks'](),this['addLinkHints'](),this['updatePlaceholder'](),this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x1f3b07:this['element']['textContent']=_0x1f3b07;}['rewriteAttachmentImages'](){const _0xbee8ff=this['editor']['querySelectorAll']('img');_0xbee8ff['forEach'](_0x7935b1=>{const _0xda024a=_0x7935b1['getAttribute']('data-attachment-name'),_0x158c00=_0x7935b1['getAttribute']('src')||'',_0x2c30a8=this['parseAttachmentReference'](_0x158c00)||this['parseTaskAttachmentUrl'](_0x158c00),_0x55a3fe=_0xda024a||(_0x2c30a8?_0x2c30a8['name']:null);if(!_0x55a3fe)return;_0x7935b1['setAttribute']('data-attachment-name',_0x55a3fe);const _0xd213e=this['attachmentObjectUrls']['get'](_0x55a3fe)||(this['options']['resolveAttachmentUrl']?this['options']['resolveAttachmentUrl'](_0x55a3fe):null);_0xd213e&&(_0x7935b1['src']=_0xd213e);});}['rewriteMentionLinks'](){const _0x5f1796=this['editor']['querySelectorAll']('a[href^=\x22mention:\x22]');_0x5f1796['forEach'](_0x476850=>{const _0x240a4b=_0x476850['getAttribute']('href')||'',_0x2e5896=_0x240a4b['replace']('mention:',''),_0x15042a=_0x476850['textContent']||'',_0x2233f3=document['createElement']('span');_0x2233f3['className']='mention',_0x2233f3['setAttribute']('data-mention-user-id',_0x2e5896),_0x2233f3['setAttribute']('contenteditable','false'),_0x2233f3['textContent']='@'+_0x15042a;const _0x4cb376=_0x476850['previousSibling'];_0x4cb376&&_0x4cb376['nodeType']===Node['TEXT_NODE']&&_0x4cb376['textContent']['endsWith']('@')&&(_0x4cb376['textContent']=_0x4cb376['textContent']['slice'](0x0,-0x1)),_0x476850['parentNode']['replaceChild'](_0x2233f3,_0x476850);});}['addLinkHints'](){if(!this['options']['editable'])return;const _0x1af88a=this['editor']['querySelectorAll']('a');_0x1af88a['forEach'](_0x5a39a7=>{const _0x1b08a7=_0x5a39a7['getAttribute']('href')||'';if(_0x1b08a7['startsWith']('mention:'))return;const _0x242a53=_0x5a39a7['textContent']||_0x1b08a7,_0xa80b94=_0x242a53+'\x20('+(this['linkHintText']||'Ctrl+click\x20to\x20follow')+')';_0x5a39a7['setAttribute']('aria-label',_0xa80b94);});}['preprocessColorSyntax'](_0x29162b){if(!_0x29162b)return _0x29162b;const _0x42e880=_0x70c8de=>{return String(_0x70c8de)['replace'](/\{color:(#[0-9A-Fa-f]{3,6})\}([\s\S]*?)\{\/color\}/g,(_0x499cbe,_0x26b3df,_0x47b85e)=>{const _0x20e0d1=_0x42e880(_0x47b85e);return'<span\x20style=\x22color:\x20'+_0x26b3df+'\x22>'+_0x20e0d1+'</span>';});};return _0x42e880(_0x29162b);}['parseAttachmentReference'](_0x4c59b0){if(!_0x4c59b0||typeof _0x4c59b0!=='string')return null;if(!_0x4c59b0['startsWith'](ATTACHMENT_SCHEME)&&!_0x4c59b0['startsWith'](ATTACHMENT_SCHEME+'//'))return null;const _0x4b74ce=_0x4c59b0['replace'](ATTACHMENT_SCHEME+'//','')['replace'](ATTACHMENT_SCHEME,'');if(!_0x4b74ce)return null;try{return{'name':decodeURIComponent(_0x4b74ce)};}catch{return{'name':_0x4b74ce};}}['parseTaskAttachmentUrl'](_0x51c14b){if(!_0x51c14b||typeof _0x51c14b!=='string')return null;const _0x270fa4=_0x51c14b['match'](/\/tasks\/[^/]+\/attachments\/([^?#]+)/);if(!_0x270fa4)return null;const _0x5c0a09=_0x270fa4[0x1];try{return{'name':decodeURIComponent(_0x5c0a09)};}catch{return{'name':_0x5c0a09};}}['updateAttachmentFile'](_0x576f45,_0x499683){const _0x537e32=this['attachmentObjectUrls']['get'](_0x576f45);if(_0x537e32)try{URL['revokeObjectURL'](_0x537e32);}catch{}const _0xeecbf8=URL['createObjectURL'](_0x499683);this['attachmentObjectUrls']['set'](_0x576f45,_0xeecbf8);const _0x11c0ba=this['editor']['querySelector']('img[data-attachment-name=\x22'+CSS['escape'](_0x576f45)+'\x22]');return _0x11c0ba&&(_0x11c0ba['src']=_0xeecbf8),_0xeecbf8;}['getMarkdown'](){const _0x262271=this['editor']['innerHTML'];if(!_0x262271||_0x262271['trim']()===''||_0x262271==='<br>')return'';return this['turndownService']['turndown'](_0x262271)['replace'](/\u200B/g,'');}['getValue'](){return this['getMarkdown']();}['setValue'](_0x28fcd4){this['setMarkdown'](_0x28fcd4);}['focus'](){this['editor']['focus']();}['clear'](){this['editor']['innerHTML']='',this['updatePlaceholder']();}['setEditable'](_0x6a900){this['editor']['contentEditable']=_0x6a900,this['options']['editable']=_0x6a900;}['handleMentionInput'](_0xf4dc34){if(!this['options']['fetchUsers'])return;const _0x340ac9=window['getSelection']();if(!_0x340ac9||_0x340ac9['rangeCount']===0x0){this['closeMentionDropdown']();return;}const _0x5ece16=_0x340ac9['getRangeAt'](0x0),_0x2757ad=_0x5ece16['startContainer'];if(_0x2757ad['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x155634=_0x2757ad['textContent']||'',_0x44cdd9=_0x5ece16['startOffset'],_0x503bb1=_0x155634['slice'](0x0,_0x44cdd9),_0x2b97e3=_0x503bb1['lastIndexOf']('@');if(_0x2b97e3===-0x1){this['closeMentionDropdown']();return;}const _0x4efdf3=_0x2b97e3>0x0?_0x503bb1[_0x2b97e3-0x1]:'\x20';if(!/\s/['test'](_0x4efdf3)&&_0x2b97e3!==0x0){this['closeMentionDropdown']();return;}const _0x187cbe=_0x503bb1['slice'](_0x2b97e3+0x1);if(/[\s\n]/['test'](_0x187cbe)){this['closeMentionDropdown']();return;}this['mentionState']['active']=!![],this['mentionState']['query']=_0x187cbe['toLowerCase'](),this['mentionState']['startOffset']=_0x2b97e3,this['mentionState']['startNode']=_0x2757ad,this['showMentionDropdown']();}async['showMentionDropdown'](){if(!this['usersCache'])try{const _0x40863f=await this['options']['fetchUsers']();this['usersCache']=_0x40863f['users']||_0x40863f||[];}catch(_0x3d2946){console['error']('Failed\x20to\x20fetch\x20users\x20for\x20@mention:',_0x3d2946),this['closeMentionDropdown']();return;}this['mentionState']['users']=this['usersCache'];const _0x24febd=this['mentionState']['query'];this['mentionState']['filteredUsers']=this['mentionState']['users']['filter'](_0x390bf3=>{const _0x14946b=(_0x390bf3['name']||'')['toLowerCase'](),_0x5a5c57=(_0x390bf3['username']||'')['toLowerCase']();return _0x14946b['includes'](_0x24febd)||_0x5a5c57['includes'](_0x24febd);})['slice'](0x0,0x8),this['mentionState']['selectedIndex']=0x0;if(this['mentionState']['filteredUsers']['length']===0x0){this['closeMentionDropdown']();return;}this['renderMentionDropdown'](),this['positionMentionDropdown']();}['renderMentionDropdown'](){!this['mentionDropdown']&&(this['mentionDropdown']=document['createElement']('div'),this['mentionDropdown']['className']='mention-dropdown',document['body']['appendChild'](this['mentionDropdown']),this['mentionClickOutsideHandler']=_0x155fc0=>{!this['mentionDropdown']['contains'](_0x155fc0['target'])&&!this['editor']['contains'](_0x155fc0['target'])&&this['closeMentionDropdown']();},document['addEventListener']('click',this['mentionClickOutsideHandler']),this['mentionScrollHandler']=()=>{this['mentionState']['active']&&this['positionMentionDropdown']();},window['addEventListener']('scroll',this['mentionScrollHandler'],!![]));const _0xe3fcfd=this['mentionState']['filteredUsers'];this['mentionDropdown']['innerHTML']=_0xe3fcfd['map']((_0x1cbd66,_0xaa7eaf)=>{const _0x340633=_0xaa7eaf===this['mentionState']['selectedIndex'],_0x5a9667=_0x1cbd66['name']||_0x1cbd66['username']||'Unknown',_0x2fa234=_0x1cbd66['username']||'',_0x4f91c5=this['getInitials'](_0x5a9667),_0x5548a9=this['getAvatarColorIndex'](_0x2fa234||_0x1cbd66['id']||_0x5a9667);return'\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22mention-option\x20'+(_0x340633?'mention-option-selected':'')+'\x22\x20data-index=\x22'+_0xaa7eaf+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-avatar\x20avatar-color-'+_0x5548a9+'\x22>'+this['escapeHtmlForMention'](_0x4f91c5)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-option-name\x22>'+this['escapeHtmlForMention'](_0x5a9667)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x2fa234?'<span\x20class=\x22mention-option-username\x22>@'+this['escapeHtmlForMention'](_0x2fa234)+'</span>':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20';})['join'](''),this['mentionDropdown']['querySelectorAll']('.mention-option')['forEach'](_0x42c062=>{_0x42c062['addEventListener']('mousedown',_0xd99c8b=>{_0xd99c8b['preventDefault']();const _0x327095=parseInt(_0x42c062['dataset']['index'],0xa);this['insertMention'](this['mentionState']['filteredUsers'][_0x327095]);}),_0x42c062['addEventListener']('mouseenter',()=>{const _0x3287b8=parseInt(_0x42c062['dataset']['index'],0xa);this['mentionState']['selectedIndex']=_0x3287b8,this['updateMentionSelection']();});}),this['mentionDropdown']['style']['display']='block';}['positionMentionDropdown'](){if(!this['mentionDropdown'])return;const _0x40722c=window['getSelection']();if(!_0x40722c||_0x40722c['rangeCount']===0x0)return;const _0x50731e=_0x40722c['getRangeAt'](0x0),_0x534675=_0x50731e['getBoundingClientRect'](),_0x9e0760=0x104,_0x46ef77=Math['min'](0xf0,this['mentionState']['filteredUsers']['length']*0x24+0x8),_0x28c28=window['innerWidth'],_0x749719=window['innerHeight'],_0x5395d9=_0x749719-_0x534675['bottom'],_0x476820=_0x534675['top'],_0x116e52=_0x5395d9<_0x46ef77+0xa&&_0x476820>_0x5395d9;let _0x2f9ba8,_0x4b3053;_0x116e52?_0x2f9ba8=_0x534675['top']+window['scrollY']-_0x46ef77-0x4:_0x2f9ba8=_0x534675['bottom']+window['scrollY']+0x4,_0x4b3053=_0x534675['left']+window['scrollX'],_0x4b3053+_0x9e0760>_0x28c28-0xa&&(_0x4b3053=_0x28c28-_0x9e0760-0xa),_0x4b3053<0xa&&(_0x4b3053=0xa),this['mentionDropdown']['style']['position']='absolute',this['mentionDropdown']['style']['top']=_0x2f9ba8+'px',this['mentionDropdown']['style']['left']=_0x4b3053+'px';}['mentionNavigate'](_0x6edb08){const _0x15d62b=this['mentionState']['filteredUsers']['length'];if(_0x15d62b===0x0)return;this['mentionState']['selectedIndex']=(this['mentionState']['selectedIndex']+_0x6edb08+_0x15d62b)%_0x15d62b,this['updateMentionSelection']();}['updateMentionSelection'](){if(!this['mentionDropdown'])return;const _0x5302cb=this['mentionDropdown']['querySelectorAll']('.mention-option');_0x5302cb['forEach']((_0xd4a2f5,_0x50fc8b)=>{_0x50fc8b===this['mentionState']['selectedIndex']?(_0xd4a2f5['classList']['add']('mention-option-selected'),_0xd4a2f5['scrollIntoView']({'block':'nearest'})):_0xd4a2f5['classList']['remove']('mention-option-selected');});}['insertMention'](_0x5515b3){if(!_0x5515b3)return;const _0x55c077=window['getSelection']();if(!_0x55c077||_0x55c077['rangeCount']===0x0)return;const _0x3d9686=_0x55c077['getRangeAt'](0x0),_0x1db2b6=this['mentionState']['startNode'];if(!_0x1db2b6||_0x1db2b6['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x736cf2=_0x1db2b6['textContent']||'',_0x46e583=this['mentionState']['startOffset'],_0x199fda=_0x3d9686['startOffset'],_0x49e9ac=_0x736cf2['slice'](0x0,_0x46e583),_0x2c9926=_0x736cf2['slice'](_0x199fda),_0x5e35d5=document['createElement']('span');_0x5e35d5['className']='mention',_0x5e35d5['setAttribute']('data-mention-user-id',_0x5515b3['id']),_0x5e35d5['setAttribute']('contenteditable','false'),_0x5e35d5['textContent']='@'+(_0x5515b3['name']||_0x5515b3['username']);const _0x4282c9=document['createTextNode'](_0x49e9ac),_0x3d1a81=document['createTextNode']('\x20'+_0x2c9926),_0xcc22e0=_0x1db2b6['parentNode'];_0xcc22e0['insertBefore'](_0x4282c9,_0x1db2b6),_0xcc22e0['insertBefore'](_0x5e35d5,_0x1db2b6),_0xcc22e0['insertBefore'](_0x3d1a81,_0x1db2b6),_0xcc22e0['removeChild'](_0x1db2b6);const _0x56e6af=document['createRange']();_0x56e6af['setStart'](_0x3d1a81,0x1),_0x56e6af['collapse'](!![]),_0x55c077['removeAllRanges'](),_0x55c077['addRange'](_0x56e6af),this['closeMentionDropdown'](),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['closeMentionDropdown'](){this['mentionState']['active']=![],this['mentionState']['query']='',this['mentionState']['filteredUsers']=[],this['mentionState']['selectedIndex']=0x0,this['mentionDropdown']&&(this['mentionDropdown']['style']['display']='none');}['escapeHtmlForMention'](_0x39407f){const _0x45439d=document['createElement']('div');return _0x45439d['textContent']=_0x39407f,_0x45439d['innerHTML'];}['getInitials'](_0xc1522f){if(!_0xc1522f)return'?';const _0x35e1e2=_0xc1522f['trim']()['split'](/\s+/);if(_0x35e1e2['length']>=0x2)return(_0x35e1e2[0x0][0x0]+_0x35e1e2[_0x35e1e2['length']-0x1][0x0])['toUpperCase']();return _0xc1522f['substring'](0x0,0x2)['toUpperCase']();}['getAvatarColorIndex'](_0x18afdd){if(!_0x18afdd)return 0x6;let _0x5daae8=0x0;for(let _0x58297f=0x0;_0x58297f<_0x18afdd['length'];_0x58297f++){_0x5daae8=_0x18afdd['charCodeAt'](_0x58297f)+((_0x5daae8<<0x5)-_0x5daae8);}return Math['abs'](_0x5daae8)%0xa;}['destroy'](){this['selectionChangeHandler']&&document['removeEventListener']('selectionchange',this['selectionChangeHandler']);this['linkClickHandler']&&this['editor']['removeEventListener']('click',this['linkClickHandler']);this['linkMouseEnterHandler']&&this['editor']['removeEventListener']('mouseover',this['linkMouseEnterHandler']);this['linkMouseLeaveHandler']&&this['editor']['removeEventListener']('mouseout',this['linkMouseLeaveHandler']);this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']);this['linkTooltip']&&(this['linkTooltip']['remove'](),this['linkTooltip']=null);this['linkDialog']&&(this['linkDialog']['remove'](),this['linkDialog']=null,this['linkDialogContext']=null,this['linkDialogElements']=null);this['mentionDropdown']&&(this['mentionDropdown']['remove'](),this['mentionDropdown']=null);this['mentionClickOutsideHandler']&&document['removeEventListener']('click',this['mentionClickOutsideHandler']);this['mentionScrollHandler']&&window['removeEventListener']('scroll',this['mentionScrollHandler'],!![]);for(const _0x1a4263 of this['attachmentObjectUrls']['values']()){try{URL['revokeObjectURL'](_0x1a4263);}catch{}}this['attachmentObjectUrls']['clear'](),this['container']?this['container']['remove']():this['editor']['remove'](),this['element']['style']['display']='';}}typeof window!=='undefined'&&(window['MarkdownEditor']=MarkdownEditor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let monacoLoadPromise=null;async function ensureMonacoLoaded(){if(typeof monaco!=='undefined')return;if(monacoLoadPromise)return monacoLoadPromise;const _0x57dc83=document['querySelector']('script[src*=\x22monaco-editor\x22][src*=\x22loader.min.js\x22]');if(_0x57dc83)return monacoLoadPromise=new Promise((_0x3cb35d,_0x230d29)=>{const _0x12b517=setInterval(()=>{typeof monaco!=='undefined'&&(clearInterval(_0x12b517),_0x3cb35d());},0x32);setTimeout(()=>{clearInterval(_0x12b517),_0x230d29(new Error('Monaco\x20loading\x20timeout'));},0x2710);}),monacoLoadPromise;return monacoLoadPromise=new Promise((_0x2e3f23,_0x1bbaf1)=>{const _0x347251=document['createElement']('script');_0x347251['src']='https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs/loader.min.js',_0x347251['onload']=()=>{require['config']({'paths':{'vs':'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs'}}),require(['vs/editor/editor.main'],()=>{_0x2e3f23();});},_0x347251['onerror']=()=>_0x1bbaf1(new Error('Failed\x20to\x20load\x20Monaco\x20Editor')),document['head']['appendChild'](_0x347251);}),monacoLoadPromise;}function getMonacoTheme(){const _0x3d6d47=document['documentElement']['getAttribute']('data-theme')==='dark';return _0x3d6d47?'vs-dark':'vs';}function isMarkdownFile(_0x25a70a){if(!_0x25a70a)return![];const _0x12de5f=_0x25a70a['split']('.')['pop']()['toLowerCase']();return _0x12de5f==='md'||_0x12de5f==='markdown';}function createMarkdownFileEditor(_0x48bed1){const {container:_0x202ef6,content:content='',readOnly:readOnly=![],height:height='400px',onChange:onChange=null,placeholder:placeholder='Enter\x20markdown\x20content...',enableModeToggle:enableModeToggle=!![],initialMode:initialMode='visual'}=_0x48bed1;_0x202ef6['innerHTML']='';let _0x2cc35c='visual',_0x19c58d=content,_0x3371ae=null,_0x41125d=null,_0x32838e=![],_0x2bfd07=initialMode==='source';const _0x389959=document['createElement']('div');_0x389959['className']='markdown-file-editor-wrapper',_0x389959['style']['height']=height,_0x389959['style']['display']='flex',_0x389959['style']['flexDirection']='column',_0x389959['style']['border']='1px\x20solid\x20var(--color-border)',_0x389959['style']['borderRadius']='var(--radius-small)',_0x389959['style']['overflow']='hidden';let _0x1dbef7=null,_0x43bee8=null,_0x575198=null;!readOnly&&enableModeToggle&&(_0x1dbef7=document['createElement']('div'),_0x1dbef7['className']='markdown-editor-mode-toggle',_0x1dbef7['style']['display']='flex',_0x1dbef7['style']['alignItems']='center',_0x1dbef7['style']['padding']='4px\x208px',_0x1dbef7['style']['borderBottom']='1px\x20solid\x20var(--color-border)',_0x1dbef7['style']['background']='var(--color-surface-secondary)',_0x1dbef7['style']['gap']='4px',_0x1dbef7['style']['flexShrink']='0',_0x43bee8=document['createElement']('button'),_0x43bee8['type']='button',_0x43bee8['className']='markdown-mode-btn',_0x43bee8['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><path\x20d=\x22M1\x2012s4-8\x2011-8\x2011\x208\x2011\x208-4\x208-11\x208-11-8-11-8z\x22></path><circle\x20cx=\x2212\x22\x20cy=\x2212\x22\x20r=\x223\x22></circle></svg>\x20Visual',_0x43bee8['title']='Visual\x20editing\x20mode\x20(WYSIWYG)',_0x575198=document['createElement']('button'),_0x575198['type']='button',_0x575198['className']='markdown-mode-btn',_0x575198['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>\x20Source',_0x575198['title']='Source\x20editing\x20mode\x20(Monaco\x20Editor)',_0x1dbef7['appendChild'](_0x43bee8),_0x1dbef7['appendChild'](_0x575198),_0x389959['appendChild'](_0x1dbef7));const _0x32ad1c=document['createElement']('div');_0x32ad1c['className']='markdown-visual-container',_0x32ad1c['style']['flex']='1',_0x32ad1c['style']['display']='flex',_0x32ad1c['style']['flexDirection']='column',_0x32ad1c['style']['overflow']='hidden',_0x32ad1c['style']['minHeight']='0';const _0x1db24f=document['createElement']('textarea');_0x1db24f['style']['display']='none',_0x1db24f['value']=content,_0x32ad1c['appendChild'](_0x1db24f),_0x389959['appendChild'](_0x32ad1c);const _0x541ed4=document['createElement']('div');_0x541ed4['className']='markdown-source-container',_0x541ed4['style']['flex']='1',_0x541ed4['style']['display']='none',_0x541ed4['style']['overflow']='hidden',_0x541ed4['style']['minHeight']='0',_0x389959['appendChild'](_0x541ed4),_0x202ef6['appendChild'](_0x389959),_0x3371ae=new window['MarkdownEditor'](_0x1db24f,{'placeholder':placeholder,'editable':!readOnly,'minHeight':'100%','toolbar':!readOnly,'onChange':_0x1f17be=>{_0x19c58d=_0x1f17be,onChange&&onChange(_0x1f17be);}});_0x3371ae['container']&&(_0x3371ae['container']['style']['flex']='1',_0x3371ae['container']['style']['display']='flex',_0x3371ae['container']['style']['flexDirection']='column',_0x3371ae['container']['style']['overflow']='hidden');_0x3371ae['editor']&&(_0x3371ae['editor']['style']['flex']='1',_0x3371ae['editor']['style']['overflow']='auto',_0x3371ae['editor']['style']['minHeight']='0',_0x3371ae['editor']['style']['border']='none',_0x3371ae['editor']['style']['borderRadius']='0',_0x3371ae['editor']['style']['padding']='16px',_0x3371ae['editor']['style']['fontSize']='14px',_0x3371ae['editor']['style']['lineHeight']='1.6');_0x3371ae['toolbar']&&(_0x3371ae['toolbar']['style']['borderRadius']='0',_0x3371ae['toolbar']['style']['flexShrink']='0');content&&_0x3371ae['setMarkdown'](content);function _0x34c74a(){if(!_0x43bee8||!_0x575198)return;_0x2cc35c==='visual'?(_0x43bee8['classList']['add']('active'),_0x575198['classList']['remove']('active')):(_0x43bee8['classList']['remove']('active'),_0x575198['classList']['add']('active'));}async function _0x49ef07(){if(_0x32838e)return;try{await ensureMonacoLoaded(),_0x41125d=monaco['editor']['create'](_0x541ed4,{'value':_0x19c58d,'language':'markdown','theme':getMonacoTheme(),'readOnly':readOnly,'minimap':{'enabled':![]},'automaticLayout':!![],'wordWrap':'on','lineNumbers':'on','scrollBeyondLastLine':![],'fontSize':0xe,'lineHeight':0x16,'padding':{'top':0x10,'bottom':0x10},'renderWhitespace':'selection','tabSize':0x2,'insertSpaces':!![]}),_0x41125d['onDidChangeModelContent'](()=>{_0x19c58d=_0x41125d['getValue'](),onChange&&onChange(_0x19c58d);}),_0x32838e=!![];}catch(_0x38c649){console['error']('Failed\x20to\x20initialize\x20Monaco\x20editor:',_0x38c649);throw _0x38c649;}}async function _0x27fa5e(_0xbb21a6){if(_0xbb21a6===_0x2cc35c)return;if(_0x2cc35c==='visual')_0x19c58d=_0x3371ae['getMarkdown']();else _0x41125d&&(_0x19c58d=_0x41125d['getValue']());_0x2cc35c=_0xbb21a6;if(_0xbb21a6==='visual')_0x541ed4['style']['display']='none',_0x32ad1c['style']['display']='flex',_0x3371ae['setMarkdown'](_0x19c58d),_0x3371ae['focus']();else{_0x32ad1c['style']['display']='none',_0x541ed4['style']['display']='block';if(!_0x32838e)try{await _0x49ef07();}catch(_0x1cc9fd){console['error']('Failed\x20to\x20switch\x20to\x20source\x20mode:',_0x1cc9fd),_0x2cc35c='visual',_0x541ed4['style']['display']='none',_0x32ad1c['style']['display']='flex',_0x34c74a();return;}_0x41125d&&(_0x41125d['setValue'](_0x19c58d),_0x41125d['focus'](),_0x41125d['layout']());}_0x34c74a();}_0x43bee8&&_0x575198&&(_0x43bee8['addEventListener']('click',_0x4319f5=>{_0x4319f5['preventDefault'](),_0x27fa5e('visual');}),_0x575198['addEventListener']('click',_0x4b7ecf=>{_0x4b7ecf['preventDefault'](),_0x27fa5e('source');}),_0x34c74a());_0x2bfd07&&setTimeout(()=>_0x27fa5e('source'),0x0);const _0x188347={'getValue':()=>{if(_0x2cc35c==='visual')return _0x3371ae['getMarkdown']();else{if(_0x41125d)return _0x41125d['getValue']();}return _0x19c58d;},'setValue':_0x48a15c=>{_0x19c58d=_0x48a15c||'';if(_0x2cc35c==='visual')_0x3371ae['setMarkdown'](_0x19c58d);else _0x41125d&&_0x41125d['setValue'](_0x19c58d);},'focus':()=>{if(_0x2cc35c==='visual')_0x3371ae['focus']();else _0x41125d&&_0x41125d['focus']();},'setEditable':_0x1eb82e=>{_0x3371ae['setEditable'](_0x1eb82e),_0x41125d&&_0x41125d['updateOptions']({'readOnly':!_0x1eb82e});},'destroy':()=>{_0x3371ae['destroy'](),_0x41125d&&(_0x41125d['dispose'](),_0x41125d=null),_0x202ef6['innerHTML']='';},'getMode':()=>_0x2cc35c,'setMode':_0xcfe26b=>_0x27fa5e(_0xcfe26b),'toggleMode':()=>_0x27fa5e(_0x2cc35c==='visual'?'source':'visual'),'_visualEditor':_0x3371ae,'_getSourceEditor':()=>_0x41125d,'_container':_0x202ef6,'_isMarkdownFileEditor':!![],'_hasModeToggle':enableModeToggle};return _0x188347;}const markdownFileEditors=new Map();function getOrCreateMarkdownFileEditor(_0x2680ea,_0x475d75,_0x43a806=![],_0x2dd2e1='400px',_0x21df66=null,_0x309de5={}){const _0x54e0bb=document['getElementById'](_0x2680ea);if(!_0x54e0bb)return console['error']('Container\x20not\x20found:\x20'+_0x2680ea),null;const _0xbad5b3=markdownFileEditors['get'](_0x2680ea);if(_0xbad5b3){try{_0xbad5b3['destroy']();}catch(_0x41716a){console['warn']('Failed\x20to\x20destroy\x20existing\x20markdown\x20editor:',_0x41716a);}markdownFileEditors['delete'](_0x2680ea);}const _0x48603f=createMarkdownFileEditor({'container':_0x54e0bb,'content':_0x475d75,'readOnly':_0x43a806,'height':_0x2dd2e1,'onChange':_0x21df66,..._0x309de5});return markdownFileEditors['set'](_0x2680ea,_0x48603f),_0x48603f;}function getMarkdownFileEditorValue(_0x3cc1e9){const _0x405e45=markdownFileEditors['get'](_0x3cc1e9);if(!_0x405e45)return null;return _0x405e45['getValue']();}function setMarkdownFileEditorValue(_0x4556b9,_0x2d1f27){const _0x49f0d4=markdownFileEditors['get'](_0x4556b9);_0x49f0d4&&_0x49f0d4['setValue'](_0x2d1f27||'');}function disposeMarkdownFileEditor(_0x570b41){const _0x55860e=markdownFileEditors['get'](_0x570b41);if(_0x55860e){try{_0x55860e['destroy']();}catch(_0x17e7f7){console['warn']('Failed\x20to\x20dispose\x20markdown\x20editor:',_0x17e7f7);}markdownFileEditors['delete'](_0x570b41);}}function hasMarkdownFileEditor(_0x2f1fdb){return markdownFileEditors['has'](_0x2f1fdb);}function getMarkdownFileEditorMode(_0x151be7){const _0x3e4257=markdownFileEditors['get'](_0x151be7);if(!_0x3e4257||!_0x3e4257['getMode'])return null;return _0x3e4257['getMode']();}function setMarkdownFileEditorMode(_0x24baeb,_0x93d658){const _0x56b566=markdownFileEditors['get'](_0x24baeb);_0x56b566&&_0x56b566['setMode']&&_0x56b566['setMode'](_0x93d658);}typeof window!=='undefined'&&(window['MarkdownFileEditor']={'isMarkdownFile':isMarkdownFile,'create':createMarkdownFileEditor,'getOrCreate':getOrCreateMarkdownFileEditor,'getValue':getMarkdownFileEditorValue,'setValue':setMarkdownFileEditorValue,'dispose':disposeMarkdownFileEditor,'has':hasMarkdownFileEditor,'getMode':getMarkdownFileEditorMode,'setMode':setMarkdownFileEditorMode,'editors':markdownFileEditors,'ensureMonacoLoaded':ensureMonacoLoaded});
|
|
1
|
+
let monacoLoadPromise=null;async function ensureMonacoLoaded(){if(typeof monaco!=='undefined')return;if(monacoLoadPromise)return monacoLoadPromise;const _0x7c63d4=document['querySelector']('script[src*=\x22monaco-editor\x22][src*=\x22loader.min.js\x22]');if(_0x7c63d4)return monacoLoadPromise=new Promise((_0x32fdf0,_0x5aaf44)=>{const _0x19dc8d=setInterval(()=>{typeof monaco!=='undefined'&&(clearInterval(_0x19dc8d),_0x32fdf0());},0x32);setTimeout(()=>{clearInterval(_0x19dc8d),_0x5aaf44(new Error('Monaco\x20loading\x20timeout'));},0x2710);}),monacoLoadPromise;return monacoLoadPromise=new Promise((_0x17d47c,_0xdba0bb)=>{const _0x22f966=document['createElement']('script');_0x22f966['src']='https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs/loader.min.js',_0x22f966['onload']=()=>{require['config']({'paths':{'vs':'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs'}}),require(['vs/editor/editor.main'],()=>{_0x17d47c();});},_0x22f966['onerror']=()=>_0xdba0bb(new Error('Failed\x20to\x20load\x20Monaco\x20Editor')),document['head']['appendChild'](_0x22f966);}),monacoLoadPromise;}function getMonacoTheme(){const _0x49230b=document['documentElement']['getAttribute']('data-theme')==='dark';return _0x49230b?'vs-dark':'vs';}function isMarkdownFile(_0x10df88){if(!_0x10df88)return![];const _0x9d7253=_0x10df88['split']('.')['pop']()['toLowerCase']();return _0x9d7253==='md'||_0x9d7253==='markdown';}function createMarkdownFileEditor(_0x5bfa82){const {container:_0x59d78b,content:content='',readOnly:readOnly=![],height:height='400px',onChange:onChange=null,placeholder:placeholder='Enter\x20markdown\x20content...',enableModeToggle:enableModeToggle=!![],initialMode:initialMode='visual'}=_0x5bfa82;_0x59d78b['innerHTML']='';let _0xdf84c7='visual',_0x560d56=content,_0x2e4e70=null,_0x4a32dc=null,_0x148ae0=![],_0x53cfbb=initialMode==='source';const _0x1d7f6e=document['createElement']('div');_0x1d7f6e['className']='markdown-file-editor-wrapper',_0x1d7f6e['style']['height']=height,_0x1d7f6e['style']['display']='flex',_0x1d7f6e['style']['flexDirection']='column',_0x1d7f6e['style']['border']='1px\x20solid\x20var(--color-border)',_0x1d7f6e['style']['borderRadius']='var(--radius-small)',_0x1d7f6e['style']['overflow']='hidden';let _0x274c41=null,_0x314537=null,_0x3e8e29=null;!readOnly&&enableModeToggle&&(_0x274c41=document['createElement']('div'),_0x274c41['className']='markdown-editor-mode-toggle',_0x274c41['style']['display']='flex',_0x274c41['style']['alignItems']='center',_0x274c41['style']['padding']='4px\x208px',_0x274c41['style']['borderBottom']='1px\x20solid\x20var(--color-border)',_0x274c41['style']['background']='var(--color-surface-secondary)',_0x274c41['style']['gap']='4px',_0x274c41['style']['flexShrink']='0',_0x314537=document['createElement']('button'),_0x314537['type']='button',_0x314537['className']='markdown-mode-btn',_0x314537['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><path\x20d=\x22M1\x2012s4-8\x2011-8\x2011\x208\x2011\x208-4\x208-11\x208-11-8-11-8z\x22></path><circle\x20cx=\x2212\x22\x20cy=\x2212\x22\x20r=\x223\x22></circle></svg>\x20Visual',_0x314537['title']='Visual\x20editing\x20mode\x20(WYSIWYG)',_0x3e8e29=document['createElement']('button'),_0x3e8e29['type']='button',_0x3e8e29['className']='markdown-mode-btn',_0x3e8e29['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>\x20Source',_0x3e8e29['title']='Source\x20editing\x20mode\x20(Monaco\x20Editor)',_0x274c41['appendChild'](_0x314537),_0x274c41['appendChild'](_0x3e8e29),_0x1d7f6e['appendChild'](_0x274c41));const _0x16c30a=document['createElement']('div');_0x16c30a['className']='markdown-visual-container',_0x16c30a['style']['flex']='1',_0x16c30a['style']['display']='flex',_0x16c30a['style']['flexDirection']='column',_0x16c30a['style']['overflow']='hidden',_0x16c30a['style']['minHeight']='0';const _0x7439cb=document['createElement']('textarea');_0x7439cb['style']['display']='none',_0x7439cb['value']=content,_0x16c30a['appendChild'](_0x7439cb),_0x1d7f6e['appendChild'](_0x16c30a);const _0x4504a3=document['createElement']('div');_0x4504a3['className']='markdown-source-container',_0x4504a3['style']['flex']='1',_0x4504a3['style']['display']='none',_0x4504a3['style']['overflow']='hidden',_0x4504a3['style']['minHeight']='0',_0x1d7f6e['appendChild'](_0x4504a3),_0x59d78b['appendChild'](_0x1d7f6e),_0x2e4e70=new window['MarkdownEditor'](_0x7439cb,{'placeholder':placeholder,'editable':!readOnly,'minHeight':'100%','toolbar':!readOnly,'onChange':_0x15b1ff=>{_0x560d56=_0x15b1ff,onChange&&onChange(_0x15b1ff);}});_0x2e4e70['container']&&(_0x2e4e70['container']['style']['flex']='1',_0x2e4e70['container']['style']['display']='flex',_0x2e4e70['container']['style']['flexDirection']='column',_0x2e4e70['container']['style']['overflow']='hidden');_0x2e4e70['editor']&&(_0x2e4e70['editor']['style']['flex']='1',_0x2e4e70['editor']['style']['overflow']='auto',_0x2e4e70['editor']['style']['minHeight']='0',_0x2e4e70['editor']['style']['border']='none',_0x2e4e70['editor']['style']['borderRadius']='0',_0x2e4e70['editor']['style']['padding']='16px',_0x2e4e70['editor']['style']['fontSize']='14px',_0x2e4e70['editor']['style']['lineHeight']='1.6');_0x2e4e70['toolbar']&&(_0x2e4e70['toolbar']['style']['borderRadius']='0',_0x2e4e70['toolbar']['style']['flexShrink']='0');content&&_0x2e4e70['setMarkdown'](content);function _0x1d845e(){if(!_0x314537||!_0x3e8e29)return;_0xdf84c7==='visual'?(_0x314537['classList']['add']('active'),_0x3e8e29['classList']['remove']('active')):(_0x314537['classList']['remove']('active'),_0x3e8e29['classList']['add']('active'));}async function _0x55b016(){if(_0x148ae0)return;try{await ensureMonacoLoaded(),_0x4a32dc=monaco['editor']['create'](_0x4504a3,{'value':_0x560d56,'language':'markdown','theme':getMonacoTheme(),'readOnly':readOnly,'minimap':{'enabled':![]},'automaticLayout':!![],'wordWrap':'on','lineNumbers':'on','scrollBeyondLastLine':![],'fontSize':0xe,'lineHeight':0x16,'padding':{'top':0x10,'bottom':0x10},'renderWhitespace':'selection','tabSize':0x2,'insertSpaces':!![]}),_0x4a32dc['onDidChangeModelContent'](()=>{_0x560d56=_0x4a32dc['getValue'](),onChange&&onChange(_0x560d56);}),_0x148ae0=!![];}catch(_0x105022){console['error']('Failed\x20to\x20initialize\x20Monaco\x20editor:',_0x105022);throw _0x105022;}}async function _0x56413f(_0x514c39){if(_0x514c39===_0xdf84c7)return;if(_0xdf84c7==='visual')_0x560d56=_0x2e4e70['getMarkdown']();else _0x4a32dc&&(_0x560d56=_0x4a32dc['getValue']());_0xdf84c7=_0x514c39;if(_0x514c39==='visual')_0x4504a3['style']['display']='none',_0x16c30a['style']['display']='flex',_0x2e4e70['setMarkdown'](_0x560d56),_0x2e4e70['focus']();else{_0x16c30a['style']['display']='none',_0x4504a3['style']['display']='block';if(!_0x148ae0)try{await _0x55b016();}catch(_0xe820e1){console['error']('Failed\x20to\x20switch\x20to\x20source\x20mode:',_0xe820e1),_0xdf84c7='visual',_0x4504a3['style']['display']='none',_0x16c30a['style']['display']='flex',_0x1d845e();return;}_0x4a32dc&&(_0x4a32dc['setValue'](_0x560d56),_0x4a32dc['focus'](),_0x4a32dc['layout']());}_0x1d845e();}_0x314537&&_0x3e8e29&&(_0x314537['addEventListener']('click',_0x3fcf8f=>{_0x3fcf8f['preventDefault'](),_0x56413f('visual');}),_0x3e8e29['addEventListener']('click',_0x2b6062=>{_0x2b6062['preventDefault'](),_0x56413f('source');}),_0x1d845e());_0x53cfbb&&setTimeout(()=>_0x56413f('source'),0x0);const _0x3e1bbf={'getValue':()=>{if(_0xdf84c7==='visual')return _0x2e4e70['getMarkdown']();else{if(_0x4a32dc)return _0x4a32dc['getValue']();}return _0x560d56;},'setValue':_0x33663c=>{_0x560d56=_0x33663c||'';if(_0xdf84c7==='visual')_0x2e4e70['setMarkdown'](_0x560d56);else _0x4a32dc&&_0x4a32dc['setValue'](_0x560d56);},'focus':()=>{if(_0xdf84c7==='visual')_0x2e4e70['focus']();else _0x4a32dc&&_0x4a32dc['focus']();},'setEditable':_0x53948d=>{_0x2e4e70['setEditable'](_0x53948d),_0x4a32dc&&_0x4a32dc['updateOptions']({'readOnly':!_0x53948d});},'destroy':()=>{_0x2e4e70['destroy'](),_0x4a32dc&&(_0x4a32dc['dispose'](),_0x4a32dc=null),_0x59d78b['innerHTML']='';},'getMode':()=>_0xdf84c7,'setMode':_0x225065=>_0x56413f(_0x225065),'toggleMode':()=>_0x56413f(_0xdf84c7==='visual'?'source':'visual'),'_visualEditor':_0x2e4e70,'_getSourceEditor':()=>_0x4a32dc,'_container':_0x59d78b,'_isMarkdownFileEditor':!![],'_hasModeToggle':enableModeToggle};return _0x3e1bbf;}const markdownFileEditors=new Map();function getOrCreateMarkdownFileEditor(_0x384d8c,_0x456f10,_0x2b8597=![],_0x342f03='400px',_0x409c08=null,_0x1fae17={}){const _0x3aaae1=document['getElementById'](_0x384d8c);if(!_0x3aaae1)return console['error']('Container\x20not\x20found:\x20'+_0x384d8c),null;const _0x592cd1=markdownFileEditors['get'](_0x384d8c);if(_0x592cd1){try{_0x592cd1['destroy']();}catch(_0x35eb67){console['warn']('Failed\x20to\x20destroy\x20existing\x20markdown\x20editor:',_0x35eb67);}markdownFileEditors['delete'](_0x384d8c);}const _0x4bbc27=createMarkdownFileEditor({'container':_0x3aaae1,'content':_0x456f10,'readOnly':_0x2b8597,'height':_0x342f03,'onChange':_0x409c08,..._0x1fae17});return markdownFileEditors['set'](_0x384d8c,_0x4bbc27),_0x4bbc27;}function getMarkdownFileEditorValue(_0x5f0299){const _0x51f1c8=markdownFileEditors['get'](_0x5f0299);if(!_0x51f1c8)return null;return _0x51f1c8['getValue']();}function setMarkdownFileEditorValue(_0x46df72,_0x16938e){const _0x3bc85b=markdownFileEditors['get'](_0x46df72);_0x3bc85b&&_0x3bc85b['setValue'](_0x16938e||'');}function disposeMarkdownFileEditor(_0x261f68){const _0x2e8290=markdownFileEditors['get'](_0x261f68);if(_0x2e8290){try{_0x2e8290['destroy']();}catch(_0x1445c3){console['warn']('Failed\x20to\x20dispose\x20markdown\x20editor:',_0x1445c3);}markdownFileEditors['delete'](_0x261f68);}}function hasMarkdownFileEditor(_0x4a0b87){return markdownFileEditors['has'](_0x4a0b87);}function getMarkdownFileEditorMode(_0x52c9ce){const _0x583202=markdownFileEditors['get'](_0x52c9ce);if(!_0x583202||!_0x583202['getMode'])return null;return _0x583202['getMode']();}function setMarkdownFileEditorMode(_0x9c230d,_0x10061a){const _0xaaabd8=markdownFileEditors['get'](_0x9c230d);_0xaaabd8&&_0xaaabd8['setMode']&&_0xaaabd8['setMode'](_0x10061a);}typeof window!=='undefined'&&(window['MarkdownFileEditor']={'isMarkdownFile':isMarkdownFile,'create':createMarkdownFileEditor,'getOrCreate':getOrCreateMarkdownFileEditor,'getValue':getMarkdownFileEditorValue,'setValue':setMarkdownFileEditorValue,'dispose':disposeMarkdownFileEditor,'has':hasMarkdownFileEditor,'getMode':getMarkdownFileEditorMode,'setMode':setMarkdownFileEditorMode,'editors':markdownFileEditors,'ensureMonacoLoaded':ensureMonacoLoaded});
|