@profoundlogic/coderflow-server 0.5.3 → 0.5.5
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.html +6 -6
- package/dist/web-ui/public/environments.js +1 -1
- package/dist/web-ui/public/feedback-widget.css +409 -0
- 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.html +4 -4
- 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 +4 -4
- package/dist/web-ui/public/index.js +1 -1
- package/dist/web-ui/public/login.html +2 -2
- 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.html +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.html +4 -4
- package/dist/web-ui/public/settings.js +1 -1
- package/dist/web-ui/public/setup-password.html +2 -2
- package/dist/web-ui/public/setup-password.js +1 -1
- package/dist/web-ui/public/skills.html +6 -6
- 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/styles.css +2975 -2022
- package/dist/web-ui/public/task.html +101 -5
- package/dist/web-ui/public/task.js +1 -1
- package/dist/web-ui/public/teams.html +1 -1
- package/dist/web-ui/public/teams.js +1 -1
- package/dist/web-ui/public/terminal.html +2 -2
- package/dist/web-ui/public/terminal.js +1 -1
- package/dist/web-ui/public/theme.js +1 -1
- package/dist/web-ui/public/users.html +2 -2
- package/dist/web-ui/public/users.js +1 -1
- package/dist/web-ui/public/variant-grouping.js +1 -1
- package/package.json +1 -1
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
})();
|
|
24
24
|
</script>
|
|
25
|
-
<link rel="stylesheet" href="styles.css?v=
|
|
26
|
-
<script type="module" src="login.js?v=
|
|
25
|
+
<link rel="stylesheet" href="styles.css?v=84">
|
|
26
|
+
<script type="module" src="login.js?v=57"></script>
|
|
27
27
|
<style>
|
|
28
28
|
body {
|
|
29
29
|
display: flex;
|
|
@@ -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 _0x2df92e=await fetch('/auth/oidc/config');if(_0x2df92e['ok'])return await _0x2df92e['json']();}catch(_0xb3e125){console['error']('Failed\x20to\x20load\x20OIDC\x20configuration:',_0xb3e125);}return{'enabled':![]};}function initializeSsoUi(_0xca7978){const _0x2fe10f=document['getElementById']('sso-section'),_0x3a84a0=document['getElementById']('sso-divider'),_0x51a27f=document['getElementById']('sso-button-text'),_0x5bcfaa=document['getElementById']('sso-button'),_0x63f57b=document['querySelector']('.local-auth-section');_0xca7978['enabled']&&(_0x2fe10f['classList']['add']('visible'),_0x51a27f['textContent']=_0xca7978['display_name']||'Sign\x20in\x20with\x20SSO',_0x5bcfaa['addEventListener']('click',()=>{window['location']['href']='/auth/oidc/login';}),!_0xca7978['allow_local_auth']&&(_0x63f57b['classList']['add']('hidden'),_0x3a84a0['style']['display']='none'));}function checkOidcErrors(){const _0x322429=new URLSearchParams(window['location']['search']),_0x1d8c3a=_0x322429['get']('error'),_0x4254f8=_0x322429['get']('message');if(_0x1d8c3a){const _0x2c9e15=document['getElementById']('login-error'),_0x591c88=_0x4254f8||OIDC_ERRORS[_0x1d8c3a]||'Authentication\x20error:\x20'+_0x1d8c3a;_0x2c9e15['textContent']=_0x591c88,_0x2c9e15['classList']['add']('visible'),window['history']['replaceState']({},document['title'],window['location']['pathname']);}}async function handleLogin(_0x55cfb3){_0x55cfb3['preventDefault']();const _0x129bee=_0x55cfb3['target'],_0x44cfcf=_0x129bee['username']['value']['trim'](),_0x67c60=_0x129bee['password']['value'],_0x1466bc=_0x129bee['querySelector']('button[type=\x22submit\x22]'),_0x22cd65=document['getElementById']('login-error');_0x22cd65['classList']['remove']('visible'),_0x22cd65['textContent']='',_0x1466bc['disabled']=!![],_0x1466bc['textContent']='Signing\x20in...';try{const _0x20b281=await fetch('/auth/login',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify']({'username':_0x44cfcf,'password':_0x67c60})}),_0x5548c0=await _0x20b281['json']();if(!_0x20b281['ok'])throw new Error(_0x5548c0['message']||'Login\x20failed');window['location']['href']='index.html';}catch(_0x45630c){_0x22cd65['textContent']=_0x45630c['message']||'An\x20error\x20occurred\x20during\x20login',_0x22cd65['classList']['add']('visible'),_0x1466bc['disabled']=![],_0x1466bc['textContent']='Sign\x20In',_0x129bee['password']['value']='',_0x129bee['password']['focus']();}}document['addEventListener']('DOMContentLoaded',async()=>{initTheme(),mountThemeToggle(),checkOidcErrors();const _0x258551=await loadOidcConfig();initializeSsoUi(_0x258551);const _0x145122=document['getElementById']('login-form');_0x145122&&_0x145122['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(_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
|
+
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(_0x9f4123,_0x27ed93={}){this['element']=_0x9f4123,this['options']={'placeholder':_0x27ed93['placeholder']||'Start\x20typing...','editable':_0x27ed93['editable']!==![],'onChange':_0x27ed93['onChange']||null,'minHeight':_0x27ed93['minHeight']||'100px','toolbar':_0x27ed93['toolbar']||![],'onAddAttachments':_0x27ed93['onAddAttachments']||null,'resolveAttachmentUrl':_0x27ed93['resolveAttachmentUrl']||null,'isAttachmentNameTaken':_0x27ed93['isAttachmentNameTaken']||null,'fetchUsers':_0x27ed93['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 _0x27209a=window['TurndownService'];this['turndownService']=new _0x27209a({'headingStyle':'atx','codeBlockStyle':'fenced','emDelimiter':'_','bulletListMarker':'-'}),this['attachmentObjectUrls']=new Map(),this['registerTurndownRules'](),this['init']();}['registerTurndownRules'](){this['turndownService']['addRule']('profoundAttachmentImage',{'filter':_0x3eb554=>{return _0x3eb554&&_0x3eb554['nodeName']==='IMG'&&_0x3eb554['getAttribute']&&_0x3eb554['getAttribute']('data-attachment-name');},'replacement':(_0x5a416b,_0x51dbae)=>{const _0xf1ee15=_0x51dbae['getAttribute']('data-attachment-name')||'',_0x130ac0=_0x51dbae['getAttribute']('alt')||'',_0x49a280=_0xf1ee15['trim'](),_0x4d0894=this['escapeAltText'](_0x130ac0||_0x49a280),_0x57afbe=encodeURIComponent(_0x49a280);return'';}}),this['turndownService']['addRule']('profoundMention',{'filter':_0x7f4a62=>{return _0x7f4a62&&_0x7f4a62['nodeName']==='SPAN'&&_0x7f4a62['getAttribute']&&_0x7f4a62['getAttribute']('data-mention-user-id');},'replacement':(_0x16d670,_0x4acfb8)=>{const _0x15204e=_0x4acfb8['getAttribute']('data-mention-user-id')||'',_0x42d145=_0x4acfb8['textContent']||'',_0x48d504=_0x42d145['startsWith']('@')?_0x42d145['slice'](0x1):_0x42d145;return'['+_0x48d504+'](mention:'+_0x15204e+')';}}),this['turndownService']['addRule']('profoundColoredText',{'filter':_0x12019a=>{if(!_0x12019a)return![];if(_0x12019a['nodeName']==='FONT'&&_0x12019a['getAttribute']&&_0x12019a['getAttribute']('color'))return!![];if(_0x12019a['nodeName']==='SPAN'&&_0x12019a['style']&&_0x12019a['style']['color']){if(_0x12019a['getAttribute']&&_0x12019a['getAttribute']('data-mention-user-id'))return![];return!![];}return![];},'replacement':(_0x496a1e,_0x5d87b)=>{if(!_0x496a1e['trim']())return _0x496a1e;let _0x42a01c='';if(_0x5d87b['nodeName']==='FONT')_0x42a01c=_0x5d87b['getAttribute']('color')||'';else _0x5d87b['style']&&_0x5d87b['style']['color']&&(_0x42a01c=this['rgbToHex'](_0x5d87b['style']['color']));if(!_0x42a01c)return _0x496a1e;return'{color:'+_0x42a01c+'}'+_0x496a1e+'{/color}';}});}['rgbToHex'](_0x5607da){if(!_0x5607da)return'';if(_0x5607da['startsWith']('#'))return _0x5607da;const _0x56cf7d=_0x5607da['match'](/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(!_0x56cf7d)return _0x5607da;const _0x11136e=parseInt(_0x56cf7d[0x1],0xa),_0x578264=parseInt(_0x56cf7d[0x2],0xa),_0x2ca26d=parseInt(_0x56cf7d[0x3],0xa);return'#'+[_0x11136e,_0x578264,_0x2ca26d]['map'](_0x3b735d=>_0x3b735d['toString'](0x10)['padStart'](0x2,'0'))['join']('')['toUpperCase']();}['escapeAltText'](_0x12d6ca){return String(_0x12d6ca||'')['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 _0x5a1524=this['element']['textContent']||this['element']['value']||'';_0x5a1524['trim']()&&this['setMarkdown'](_0x5a1524);}['createToolbar'](){this['toolbar']=document['createElement']('div'),this['toolbar']['className']='markdown-editor-toolbar',this['toolbarButtons']={};const _0x2e55cd=[{'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'}];_0x2e55cd['forEach'](_0x431469=>{if(_0x431469['separator']){const _0x4e7983=document['createElement']('div');_0x4e7983['className']='markdown-toolbar-separator',_0x4e7983['style']['width']='1px',_0x4e7983['style']['height']='16px',_0x4e7983['style']['background']='var(--color-border)',_0x4e7983['style']['margin']='0\x206px',_0x4e7983['style']['alignSelf']='center',this['toolbar']['appendChild'](_0x4e7983);}else{if(_0x431469['isDropdown']){const _0x2179e5=document['createElement']('div');_0x2179e5['className']='markdown-toolbar-dropdown',_0x2179e5['style']['position']='relative';const _0x305cb9=document['createElement']('button');_0x305cb9['type']='button',_0x305cb9['className']='markdown-editor-toolbar-btn\x20markdown-toolbar-dropdown-btn',_0x305cb9['tabIndex']=-0x1,_0x305cb9['innerHTML']=_0x431469['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>',_0x305cb9['title']=_0x431469['title'],_0x305cb9['dataset']['action']=_0x431469['action'];const _0x2d06d8=document['createElement']('div');_0x2d06d8['className']='markdown-toolbar-dropdown-menu',_0x2d06d8['style']['display']='none';if(_0x431469['action']==='header')this['createHeaderDropdown'](_0x2d06d8);else _0x431469['action']==='color'&&this['createColorDropdown'](_0x2d06d8);_0x305cb9['addEventListener']('click',_0x2a0c5f=>{_0x2a0c5f['preventDefault'](),_0x2a0c5f['stopPropagation'](),this['toggleDropdown'](_0x2d06d8,_0x305cb9);}),_0x2179e5['appendChild'](_0x305cb9),_0x2179e5['appendChild'](_0x2d06d8),this['toolbar']['appendChild'](_0x2179e5),this['toolbarButtons'][_0x431469['id']]={'button':_0x305cb9,'dropdown':_0x2d06d8,'command':_0x431469['command'],'tagName':_0x431469['tagName']};}else{const _0x1bc7c6=document['createElement']('button');_0x1bc7c6['type']='button',_0x1bc7c6['className']='markdown-editor-toolbar-btn',_0x1bc7c6['tabIndex']=-0x1,_0x1bc7c6['innerHTML']=_0x431469['icon'],_0x1bc7c6['title']=_0x431469['title'],_0x1bc7c6['dataset']['action']=_0x431469['action'],_0x1bc7c6['addEventListener']('click',_0x2690a6=>{_0x2690a6['preventDefault'](),this['handleToolbarAction'](_0x431469['action']);}),this['toolbar']['appendChild'](_0x1bc7c6),this['toolbarButtons'][_0x431469['id']]={'button':_0x1bc7c6,'command':_0x431469['command'],'tagName':_0x431469['tagName']};}}}),document['addEventListener']('click',_0x57a0ed=>{!this['toolbar']['contains'](_0x57a0ed['target'])&&this['closeAllDropdowns']();});}['createHeaderDropdown'](_0x564149){const _0x3c4142=[{'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'}];_0x3c4142['forEach'](_0xfa940d=>{const _0x21b071=document['createElement']('button');_0x21b071['type']='button',_0x21b071['className']='markdown-dropdown-item',_0x21b071['tabIndex']=-0x1,_0x21b071['innerHTML']='<span\x20style=\x22font-size:\x20'+(_0xfa940d['level']===0x0?'14px':0x14-_0xfa940d['level']*0x2+'px')+';\x20font-weight:\x20'+(_0xfa940d['level']===0x0?'normal':'bold')+'\x22>'+_0xfa940d['label']+'</span>',_0x21b071['addEventListener']('click',_0x766372=>{_0x766372['preventDefault'](),_0x766372['stopPropagation'](),this['applyHeader'](_0xfa940d['level']),this['closeAllDropdowns']();}),_0x564149['appendChild'](_0x21b071);});}['createColorDropdown'](_0x515d2d){const _0x4d5ba2=[{'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'}],_0x29789c=document['createElement']('div');_0x29789c['className']='markdown-color-grid',_0x29789c['style']['display']='grid',_0x29789c['style']['gridTemplateColumns']='repeat(3,\x201fr)',_0x29789c['style']['gap']='4px',_0x29789c['style']['padding']='8px',_0x4d5ba2['forEach'](_0x327b72=>{const _0x43583c=document['createElement']('button');_0x43583c['type']='button',_0x43583c['className']='markdown-color-btn',_0x43583c['tabIndex']=-0x1,_0x43583c['style']['width']='24px',_0x43583c['style']['height']='24px',_0x43583c['style']['backgroundColor']=_0x327b72['value'],_0x43583c['style']['border']='1px\x20solid\x20var(--color-border)',_0x43583c['style']['borderRadius']='4px',_0x43583c['style']['cursor']='pointer',_0x43583c['title']=_0x327b72['label'],_0x43583c['addEventListener']('click',_0x2c33c6=>{_0x2c33c6['preventDefault'](),_0x2c33c6['stopPropagation'](),this['applyColor'](_0x327b72['value']),this['closeAllDropdowns']();}),_0x29789c['appendChild'](_0x43583c);}),_0x515d2d['appendChild'](_0x29789c);const _0xb9c466=document['createElement']('button');_0xb9c466['type']='button',_0xb9c466['className']='markdown-dropdown-item',_0xb9c466['innerHTML']='<span>Remove\x20Color</span>',_0xb9c466['style']['borderTop']='1px\x20solid\x20var(--color-border)',_0xb9c466['style']['marginTop']='4px',_0xb9c466['style']['paddingTop']='8px',_0xb9c466['addEventListener']('click',_0x53c754=>{_0x53c754['preventDefault'](),_0x53c754['stopPropagation'](),this['removeColor'](),this['closeAllDropdowns']();}),_0x515d2d['appendChild'](_0xb9c466);}['toggleDropdown'](_0x4dcf65,_0x596053){const _0x5a9cc2=_0x4dcf65['style']['display']!=='none';this['toolbar']&&this['closeAllDropdowns'](),!_0x5a9cc2&&(_0x4dcf65['style']['display']='block',_0x596053['classList']['add']('active'));}['closeAllDropdowns'](){const _0x35afcd=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-menu');_0x35afcd['forEach'](_0x5bd8c8=>_0x5bd8c8['style']['display']='none');const _0x4961f0=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-btn');_0x4961f0['forEach'](_0x48bb47=>_0x48bb47['classList']['remove']('active'));}['applyHeader'](_0xe8661b){this['editor']['focus']();const _0xafea58=window['getSelection']();if(!_0xafea58||_0xafea58['rangeCount']===0x0)return;const _0x5312d9=_0xafea58['getRangeAt'](0x0);let _0x2d80b1=_0x5312d9['startContainer'];while(_0x2d80b1&&_0x2d80b1!==this['editor']){if(_0x2d80b1['nodeType']===Node['ELEMENT_NODE']){const _0x3182cd=window['getComputedStyle'](_0x2d80b1)['display'];if(_0x3182cd==='block'||['P','H1','H2','H3','H4','H5','H6','DIV']['includes'](_0x2d80b1['tagName']))break;}_0x2d80b1=_0x2d80b1['parentNode'];}_0xe8661b===0x0?document['execCommand']('formatBlock',![],'p'):document['execCommand']('formatBlock',![],'h'+_0xe8661b),this['editor']['dispatchEvent'](new Event('input'));}['applyColor'](_0xe7f9be){this['editor']['focus'](),document['execCommand']('foreColor',![],_0xe7f9be),this['editor']['dispatchEvent'](new Event('input'));}['removeColor'](){this['editor']['focus'](),document['execCommand']('removeFormat',![],null),this['editor']['dispatchEvent'](new Event('input'));}['handleToolbarAction'](_0x382687){this['editor']['focus']();switch(_0x382687){case'bold':case'italic':case'strikeThrough':case'insertUnorderedList':case'insertOrderedList':document['execCommand'](_0x382687,![],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 _0xb3abe9=document['createElement']('div');_0xb3abe9['className']='markdown-editor-link-modal',_0xb3abe9['hidden']=!![],_0xb3abe9['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'](_0xb3abe9),this['linkDialog']=_0xb3abe9,this['linkDialogElements']={'backdrop':_0xb3abe9['querySelector']('.markdown-editor-link-backdrop'),'title':_0xb3abe9['querySelector']('.markdown-editor-link-title'),'close':_0xb3abe9['querySelector']('.markdown-editor-link-close'),'form':_0xb3abe9['querySelector']('.markdown-editor-link-form'),'urlInput':_0xb3abe9['querySelector']('[data-link-field=\x22url\x22]'),'textInput':_0xb3abe9['querySelector']('[data-link-field=\x22text\x22]'),'remove':_0xb3abe9['querySelector']('[data-action=\x22remove\x22]'),'cancel':_0xb3abe9['querySelector']('[data-action=\x22cancel\x22]'),'submit':_0xb3abe9['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',_0x3b0c3f=>{_0x3b0c3f['preventDefault'](),this['applyLinkDialogResult']();}),this['linkDialog']['addEventListener']('keydown',_0x562a13=>{_0x562a13['key']==='Escape'&&(_0x562a13['preventDefault'](),this['closeLinkDialog']({'restoreSelection':!![]}));});}['openLinkDialog'](){const _0x562593=window['getSelection']();if(!_0x562593||_0x562593['rangeCount']===0x0)return;const _0x3fe848=_0x562593['getRangeAt'](0x0),_0x548c26=this['editor']['contains'](_0x3fe848['commonAncestorContainer'])||this['editor']===_0x3fe848['commonAncestorContainer'];if(!_0x548c26)return;this['toolbar']&&this['closeAllDropdowns']();this['ensureLinkDialog']();const _0x210f00=_0x3fe848['cloneRange'](),_0x4f17f0=this['findLinkAtRange'](_0x210f00),_0x40780f=_0x4f17f0?_0x4f17f0['getAttribute']('href')||'':'',_0x4822c5=_0x4f17f0?_0x4f17f0['textContent']||'':_0x210f00['toString']();this['linkDialogContext']={'range':_0x210f00,'existingLink':_0x4f17f0,'selectedText':_0x4822c5},this['linkDialogElements']['title']['textContent']=_0x4f17f0?'Edit\x20Link':'Insert\x20Link',this['linkDialogElements']['submit']['textContent']=_0x4f17f0?'Save\x20Link':'Insert\x20Link',this['linkDialogElements']['remove']['hidden']=!_0x4f17f0,this['linkDialogElements']['urlInput']['value']=_0x40780f,this['linkDialogElements']['textInput']['value']=_0x4822c5,this['linkDialog']['hidden']=![],this['linkDialogElements']['urlInput']['focus'](),this['linkDialogElements']['urlInput']['select']();}['closeLinkDialog']({restoreSelection:restoreSelection=![]}={}){if(!this['linkDialog'])return;const _0x55d72c=this['linkDialogContext'];this['linkDialog']['hidden']=!![],restoreSelection&&_0x55d72c?.['range']&&(this['editor']['focus'](),this['restoreRange'](_0x55d72c['range'])),this['linkDialogContext']=null;}['applyLinkDialogResult']({remove:remove=![]}={}){if(!this['linkDialog']||!this['linkDialogContext'])return;const _0x253c5f=this['linkDialogContext'],_0x3839b1=(this['linkDialogElements']['urlInput']['value']||'')['trim'](),_0x38a990=this['linkDialogElements']['textInput']['value']||'',_0x1635ae=_0x38a990['trim']();if(!remove&&!_0x3839b1){this['linkDialogElements']['urlInput']['focus']();return;}this['closeLinkDialog'](),this['editor']['focus'](),this['restoreRange'](_0x253c5f['range']);if(remove)_0x253c5f['existingLink']&&_0x253c5f['existingLink']['parentNode']?this['unwrapLinkElement'](_0x253c5f['existingLink']):document['execCommand']('unlink',![],null);else{if(_0x253c5f['existingLink']&&_0x253c5f['existingLink']['parentNode'])_0x253c5f['existingLink']['setAttribute']('href',_0x3839b1),_0x253c5f['existingLink']['textContent']=_0x1635ae||_0x3839b1;else{const _0x1d3815=window['getSelection']();if(!_0x1d3815||_0x1d3815['rangeCount']===0x0)return;const _0x1252c3=_0x1d3815['getRangeAt'](0x0),_0x4da38e=(_0x253c5f['selectedText']||'')['trim'](),_0x1e2496=_0x1635ae||_0x4da38e||_0x3839b1;_0x1252c3['deleteContents']();const _0x58dab4=document['createElement']('a');_0x58dab4['href']=_0x3839b1,_0x58dab4['textContent']=_0x1e2496,_0x1252c3['insertNode'](_0x58dab4),_0x1252c3['setStartAfter'](_0x58dab4),_0x1252c3['collapse'](!![]),_0x1d3815['removeAllRanges'](),_0x1d3815['addRange'](_0x1252c3);}}this['addLinkHints'](),this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialogStyles'](){if(document['getElementById'](LINK_DIALOG_STYLE_ID))return;const _0x4e13ea=document['createElement']('style');_0x4e13ea['id']=LINK_DIALOG_STYLE_ID,_0x4e13ea['textContent']=LINK_DIALOG_STYLES,document['head']['appendChild'](_0x4e13ea);}['restoreRange'](_0x504baf){const _0x468c42=window['getSelection']();if(!_0x468c42)return;try{_0x468c42['removeAllRanges'](),_0x468c42['addRange'](_0x504baf);return;}catch(_0xf772bc){}const _0x55ec79=document['createRange']();_0x55ec79['selectNodeContents'](this['editor']),_0x55ec79['collapse'](![]),_0x468c42['removeAllRanges'](),_0x468c42['addRange'](_0x55ec79);}['findLinkAtRange'](_0x1f9049){if(!_0x1f9049)return null;const _0x2551aa=this['findParentLink'](_0x1f9049['startContainer']);if(_0x1f9049['collapsed'])return _0x2551aa;const _0x287472=this['findParentLink'](_0x1f9049['endContainer']);if(_0x2551aa&&_0x2551aa===_0x287472)return _0x2551aa;if(_0x2551aa&&_0x2551aa['contains'](_0x1f9049['endContainer']))return _0x2551aa;if(_0x287472&&_0x287472['contains'](_0x1f9049['startContainer']))return _0x287472;return null;}['findParentLink'](_0x344107){let _0x24a8a6=_0x344107;while(_0x24a8a6&&_0x24a8a6!==this['editor']){if(_0x24a8a6['nodeType']===Node['ELEMENT_NODE']&&_0x24a8a6['tagName']==='A'){const _0x2460b9=_0x24a8a6['getAttribute']('href')||'';if(_0x2460b9['startsWith']('mention:'))return null;return _0x24a8a6;}_0x24a8a6=_0x24a8a6['parentNode'];}return null;}['unwrapLinkElement'](_0x234482){const _0x60aa3e=_0x234482['parentNode'];if(!_0x60aa3e)return;while(_0x234482['firstChild']){_0x60aa3e['insertBefore'](_0x234482['firstChild'],_0x234482);}_0x60aa3e['removeChild'](_0x234482);}['isSelectionInTag'](_0x56d715){const _0x37fe1c=window['getSelection']();if(!_0x37fe1c||_0x37fe1c['rangeCount']===0x0)return![];let _0x3a43d2=_0x37fe1c['anchorNode'];while(_0x3a43d2&&_0x3a43d2!==this['editor']){if(_0x3a43d2['nodeType']===Node['ELEMENT_NODE']&&_0x3a43d2['tagName']===_0x56d715)return!![];_0x3a43d2=_0x3a43d2['parentNode'];}return![];}['updateToolbarState'](){if(!this['toolbarButtons'])return;for(const [_0x53a18d,_0xdf4dd2]of Object['entries'](this['toolbarButtons'])){let _0x1d9ee8=![];if(_0xdf4dd2['command'])try{_0x1d9ee8=document['queryCommandState'](_0xdf4dd2['command']);}catch(_0x122639){_0x1d9ee8=![];}else _0xdf4dd2['tagName']&&(_0x1d9ee8=this['isSelectionInTag'](_0xdf4dd2['tagName']));_0xdf4dd2['button']['classList']['toggle']('active',_0x1d9ee8);}}['bindEvents'](){this['editor']['addEventListener']('keydown',_0x1c1928=>this['handleKeydown'](_0x1c1928)),this['editor']['addEventListener']('input',_0x2e5ecb=>{this['handleMentionInput'](_0x2e5ecb),this['handleAutoFormat'](_0x2e5ecb);}),this['editor']['addEventListener']('input',()=>{const _0x228430=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');!_0x228430&&(this['editor']['innerHTML']='');this['updatePlaceholder']();const _0xedd811=this['getMarkdown']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0xedd811:this['element']['textContent']=_0xedd811,this['options']['onChange']&&this['options']['onChange'](_0xedd811);}),this['editor']['addEventListener']('paste',_0x509926=>this['handlePaste'](_0x509926)),this['editor']['addEventListener']('dragover',_0x4050f2=>this['handleDragOver'](_0x4050f2)),this['editor']['addEventListener']('drop',_0x1c00e5=>this['handleDrop'](_0x1c00e5)),this['editor']['addEventListener']('dragstart',_0x4a3d1a=>this['handleDragStart'](_0x4a3d1a)),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']=_0x2b218a=>this['handleLinkClick'](_0x2b218a),this['editor']['addEventListener']('click',this['linkClickHandler']),this['linkMouseEnterHandler']=_0x202aaa=>this['handleLinkMouseEnter'](_0x202aaa),this['linkMouseLeaveHandler']=_0x1b1359=>this['handleLinkMouseLeave'](_0x1b1359),this['editor']['addEventListener']('mouseover',this['linkMouseEnterHandler']),this['editor']['addEventListener']('mouseout',this['linkMouseLeaveHandler']),this['updatePlaceholder']();}['handleAutoFormat'](_0x188263){if(_0x188263['inputType']==='deleteContentBackward')return;const _0xd38659=window['getSelection']();if(!_0xd38659||_0xd38659['rangeCount']===0x0)return;const _0x465ec0=_0xd38659['getRangeAt'](0x0),_0x22fdb4=_0x465ec0['startContainer'];if(_0x22fdb4['nodeType']!==Node['TEXT_NODE'])return;if(this['isSelectionInTag']('CODE')||this['isSelectionInTag']('PRE'))return;const _0x8b8519=_0x22fdb4['textContent'],_0x2071f8=_0x465ec0['startOffset'],_0x101ef5=_0x8b8519['slice'](0x0,_0x2071f8);if(_0x101ef5['endsWith']('```')){_0x465ec0['setStart'](_0x22fdb4,_0x2071f8-0x3),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents'](),this['insertCodeBlock']();return;}const _0x3dc70d=/`([^`]+)`$/,_0x3471d4=_0x101ef5['match'](_0x3dc70d);if(_0x3471d4){const _0x5eaa03=_0x3471d4[0x1];if(_0x5eaa03){const _0x3faf94=_0x3471d4['index'],_0x1de92a=_0x3faf94+_0x5eaa03['length']+0x2;_0x465ec0['setStart'](_0x22fdb4,_0x3faf94),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents']();const _0x187e60=document['createElement']('code');_0x187e60['textContent']=_0x5eaa03,_0x465ec0['insertNode'](_0x187e60),_0x465ec0['setStartAfter'](_0x187e60),_0x465ec0['setEndAfter'](_0x187e60);const _0x10335b=document['createTextNode']('');_0x465ec0['insertNode'](_0x10335b),_0x465ec0['setStartAfter'](_0x10335b),_0x465ec0['setEndAfter'](_0x10335b),_0xd38659['removeAllRanges'](),_0xd38659['addRange'](_0x465ec0);return;}}const _0x2c639a=_0x101ef5['match'](/^[-*][\s\u00A0]$/);if(_0x2c639a&&this['isAtStartOfBlock'](_0x22fdb4)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x465ec0['setStart'](_0x22fdb4,Math['max'](_0x2071f8-0x2,0x0)),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents']();const _0x4d38a3=this['ensureListInsertionAnchor'](_0x22fdb4);document['execCommand']('insertUnorderedList',![],null);_0x4d38a3&&_0x4d38a3['parentNode']&&_0x4d38a3['parentNode']['removeChild'](_0x4d38a3);this['updateToolbarState']();return;}const _0x11811b=_0x101ef5['match'](/^1\.[\s\u00A0]$/);if(_0x11811b&&this['isAtStartOfBlock'](_0x22fdb4)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x465ec0['setStart'](_0x22fdb4,Math['max'](_0x2071f8-0x3,0x0)),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents']();const _0x45363e=this['ensureListInsertionAnchor'](_0x22fdb4);document['execCommand']('insertOrderedList',![],null);_0x45363e&&_0x45363e['parentNode']&&_0x45363e['parentNode']['removeChild'](_0x45363e);this['updateToolbarState']();return;}}['isAtStartOfBlock'](_0x2416f9){let _0xeeb6ce=_0x2416f9;while(_0xeeb6ce&&_0xeeb6ce!==this['editor']){const _0x4c423f=_0xeeb6ce['parentNode'];if(!_0x4c423f)break;const _0x49b87e=_0x4c423f['tagName'];if(_0x49b87e==='DIV'||_0x49b87e==='P'||_0x49b87e==='LI'||_0x4c423f===this['editor']){let _0x35e01a=_0x4c423f['firstChild'];while(_0x35e01a&&(_0x35e01a['nodeType']===Node['TEXT_NODE']&&_0x35e01a['textContent']===''||_0x35e01a['nodeType']===Node['ELEMENT_NODE']&&_0x35e01a['tagName']==='BR')){_0x35e01a=_0x35e01a['nextSibling'];}return _0x35e01a===_0x2416f9||_0x35e01a===_0xeeb6ce;}_0xeeb6ce=_0x4c423f;}if(_0xeeb6ce===this['editor']||_0x2416f9['parentNode']===this['editor']){let _0x3e9ab1=this['editor']['firstChild'];while(_0x3e9ab1&&(_0x3e9ab1['nodeType']===Node['TEXT_NODE']&&_0x3e9ab1['textContent']===''||_0x3e9ab1['nodeType']===Node['ELEMENT_NODE']&&_0x3e9ab1['tagName']==='BR')){_0x3e9ab1=_0x3e9ab1['nextSibling'];}return _0x3e9ab1===_0x2416f9;}return![];}['getClosestBlockElement'](_0x1f409e){let _0x127d69=_0x1f409e;while(_0x127d69&&_0x127d69!==this['editor']){const _0x317ad7=_0x127d69['parentNode'];if(!_0x317ad7)break;const _0x58fb3c=_0x317ad7['tagName'];if(_0x58fb3c==='DIV'||_0x58fb3c==='P'||_0x58fb3c==='LI'||_0x317ad7===this['editor'])return _0x317ad7;_0x127d69=_0x317ad7;}return this['editor'];}['ensureListInsertionAnchor'](_0x5d8899){const _0x585f91=window['getSelection']();if(!_0x585f91||_0x585f91['rangeCount']===0x0)return null;const _0x42e5ef=this['getClosestBlockElement'](_0x5d8899);if(!_0x42e5ef||_0x42e5ef===this['editor'])return null;const _0x3ddd57=_0x42e5ef['textContent']['replace'](/\u200B/g,'');if(_0x3ddd57!=='')return null;const _0x504689=document['createTextNode']('');_0x42e5ef['appendChild'](_0x504689);const _0xc94d59=document['createRange']();return _0xc94d59['setStart'](_0x504689,0x1),_0xc94d59['setEnd'](_0x504689,0x1),_0x585f91['removeAllRanges'](),_0x585f91['addRange'](_0xc94d59),_0x504689;}['getContainingListItem'](){const _0x2ee489=window['getSelection']();if(!_0x2ee489||_0x2ee489['rangeCount']===0x0)return null;let _0x5c66da=_0x2ee489['anchorNode'];while(_0x5c66da&&_0x5c66da!==this['editor']){if(_0x5c66da['nodeType']===Node['ELEMENT_NODE']&&_0x5c66da['tagName']==='LI')return _0x5c66da;_0x5c66da=_0x5c66da['parentNode'];}return null;}['isEmptyListItem'](_0x3c1050){if(!_0x3c1050)return![];const _0x47f721=_0x3c1050['textContent']['replace'](/\u200B/g,'')['trim']();if(_0x47f721!=='')return![];const _0x10b709=_0x3c1050['querySelector']('img');if(_0x10b709)return![];const _0x48e8f5=_0x3c1050['querySelector']('ul,\x20ol');if(_0x48e8f5)return![];return!![];}['isCursorAtStartOfListItem'](_0x5ea4fb){if(!_0x5ea4fb)return![];const _0x2a5176=window['getSelection']();if(!_0x2a5176||_0x2a5176['rangeCount']===0x0||!_0x2a5176['isCollapsed'])return![];const _0x3acaf0=_0x2a5176['getRangeAt'](0x0),_0x1c2515=_0x3acaf0['startContainer'];if(_0x1c2515!==_0x5ea4fb&&!_0x5ea4fb['contains'](_0x1c2515))return![];const _0x4df2c8=_0x3acaf0['cloneRange']();_0x4df2c8['setStart'](_0x5ea4fb,0x0),_0x4df2c8['setEnd'](_0x1c2515,_0x3acaf0['startOffset']);const _0xfb486a=_0x4df2c8['toString']()['replace'](/\u200B/g,'')['replace'](/\u00A0/g,'\x20');return _0xfb486a['trim']()==='';}['indentListItem'](_0x21eb50){const _0xb90887=_0x21eb50['previousElementSibling'];if(!_0xb90887||_0xb90887['tagName']!=='LI')return;const _0x568b66=_0x21eb50['parentNode'],_0x2ace14=_0x568b66['tagName'];let _0xe7fe39=_0xb90887['querySelector'](':scope\x20>\x20ul,\x20:scope\x20>\x20ol');!_0xe7fe39&&(_0xe7fe39=document['createElement'](_0x2ace14),_0xb90887['appendChild'](_0xe7fe39)),_0xe7fe39['appendChild'](_0x21eb50),this['placeCursorInListItem'](_0x21eb50);}['outdentListItem'](_0xc81b79){const _0x3e8642=_0xc81b79['parentNode'];if(!_0x3e8642||_0x3e8642['tagName']!=='UL'&&_0x3e8642['tagName']!=='OL')return;const _0x28b53b=_0x3e8642['parentNode'];if(_0x28b53b&&_0x28b53b['tagName']==='LI'){const _0x5ca9d3=_0x28b53b['parentNode'];_0x5ca9d3['insertBefore'](_0xc81b79,_0x28b53b['nextSibling']),_0x3e8642['children']['length']===0x0&&_0x3e8642['remove'](),this['placeCursorInListItem'](_0xc81b79);}else return;}['exitListOnEmptyBullet'](_0x27cfe2){const _0x15bd73=_0x27cfe2['parentNode'];if(!_0x15bd73)return;const _0xd6c5a1=_0x15bd73['parentNode'];if(_0xd6c5a1&&_0xd6c5a1['tagName']==='LI'){this['outdentListItem'](_0x27cfe2);return;}const _0x165a92=_0x15bd73['parentNode'],_0xbad395=document['createElement']('p');_0xbad395['innerHTML']='<br>',_0x165a92['insertBefore'](_0xbad395,_0x15bd73['nextSibling']),_0x27cfe2['remove']();_0x15bd73['children']['length']===0x0&&_0x15bd73['remove']();const _0xd7141d=window['getSelection'](),_0x532ffc=document['createRange']();_0x532ffc['setStart'](_0xbad395,0x0),_0x532ffc['collapse'](!![]),_0xd7141d['removeAllRanges'](),_0xd7141d['addRange'](_0x532ffc);}['placeCursorInListItem'](_0x4d0441){const _0x2aebcc=window['getSelection'](),_0xde65b1=document['createRange'](),_0x33a0b3=document['createTreeWalker'](_0x4d0441,NodeFilter['SHOW_TEXT'],null,![]),_0x2f9cf1=_0x33a0b3['nextNode']();_0x2f9cf1?_0xde65b1['setStart'](_0x2f9cf1,0x0):_0xde65b1['setStart'](_0x4d0441,0x0),_0xde65b1['collapse'](!![]),_0x2aebcc['removeAllRanges'](),_0x2aebcc['addRange'](_0xde65b1);}['handleLinkClick'](_0x275a39){const _0x112e30=this['isMac']?_0x275a39['metaKey']:_0x275a39['ctrlKey'];if(!_0x112e30)return;let _0x463591=_0x275a39['target'];while(_0x463591&&_0x463591!==this['editor']){if(_0x463591['tagName']==='A'){_0x275a39['preventDefault'](),_0x275a39['stopPropagation']();const _0x5a25d4=_0x463591['getAttribute']('href');if(!_0x5a25d4)return;if(_0x5a25d4['startsWith']('mention:'))return;const _0x378aa8=/^https?:\/\//i['test'](_0x5a25d4);_0x378aa8?window['open'](_0x5a25d4,'_blank','noopener,noreferrer'):window['location']['href']=_0x5a25d4;return;}_0x463591=_0x463591['parentNode'];}}['handleLinkMouseEnter'](_0x22c019){const _0x1c4135=_0x22c019['target'];if(_0x1c4135['tagName']!=='A')return;const _0x5a6a1d=_0x1c4135['getAttribute']('href')||'';if(_0x5a6a1d['startsWith']('mention:'))return;this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=setTimeout(()=>{this['showLinkTooltip'](_0x1c4135);},0x12c);}['handleLinkMouseLeave'](_0x2147b5){const _0x192b6e=_0x2147b5['target'];if(_0x192b6e['tagName']!=='A')return;this['linkTooltipTimeout']&&(clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=null),this['hideLinkTooltip']();}['showLinkTooltip'](_0x1ac7a4){!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 _0x2270a0=_0x1ac7a4['getBoundingClientRect'](),_0x4151c3=this['linkTooltip']['getBoundingClientRect']();let _0x21df3b=_0x2270a0['bottom']+0x4,_0x50bfec=_0x2270a0['left']+_0x2270a0['width']/0x2;_0x21df3b+0x1e>window['innerHeight']&&(_0x21df3b=_0x2270a0['top']-0x1e);const _0x469256=0x78;if(_0x50bfec-_0x469256/0x2<0xa)_0x50bfec=_0x469256/0x2+0xa;else _0x50bfec+_0x469256/0x2>window['innerWidth']-0xa&&(_0x50bfec=window['innerWidth']-_0x469256/0x2-0xa);this['linkTooltip']['style']['top']=_0x21df3b+'px',this['linkTooltip']['style']['left']=_0x50bfec+'px',this['linkTooltip']['style']['transform']='translateX(-50%)',this['linkTooltip']['classList']['add']('visible');}['hideLinkTooltip'](){this['linkTooltip']&&this['linkTooltip']['classList']['remove']('visible');}['handleKeydown'](_0x21349d){if(this['mentionState']['active']){if(_0x21349d['key']==='ArrowDown'){_0x21349d['preventDefault'](),this['mentionNavigate'](0x1);return;}if(_0x21349d['key']==='ArrowUp'){_0x21349d['preventDefault'](),this['mentionNavigate'](-0x1);return;}if(_0x21349d['key']==='Enter'||_0x21349d['key']==='Tab'){if(this['mentionState']['filteredUsers']['length']>0x0){_0x21349d['preventDefault'](),this['insertMention'](this['mentionState']['filteredUsers'][this['mentionState']['selectedIndex']]);return;}}if(_0x21349d['key']==='Escape'){_0x21349d['preventDefault'](),this['closeMentionDropdown']();return;}}if(_0x21349d['key']==='Tab'&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x15cf91=this['getContainingListItem']();if(_0x15cf91&&this['isCursorAtStartOfListItem'](_0x15cf91)){_0x21349d['preventDefault']();_0x21349d['shiftKey']?this['outdentListItem'](_0x15cf91):this['indentListItem'](_0x15cf91);this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x21349d['key']==='Enter'&&!_0x21349d['shiftKey']&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x53128b=this['getContainingListItem']();if(_0x53128b&&this['isEmptyListItem'](_0x53128b)){_0x21349d['preventDefault'](),this['exitListOnEmptyBullet'](_0x53128b),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x21349d['key']==='Enter'&&!_0x21349d['shiftKey']&&this['isSelectionInTag']('PRE')){_0x21349d['preventDefault']();const _0x2d11c0=window['getSelection']();if(_0x2d11c0['rangeCount']>0x0){const _0x584ea8=_0x2d11c0['getRangeAt'](0x0);_0x584ea8['deleteContents']();const _0x1d46cd=document['createTextNode']('\x0a');_0x584ea8['insertNode'](_0x1d46cd),_0x584ea8['setStartAfter'](_0x1d46cd),_0x584ea8['setEndAfter'](_0x1d46cd),_0x2d11c0['removeAllRanges'](),_0x2d11c0['addRange'](_0x584ea8),this['handleInput']();}return;}(_0x21349d['ctrlKey']||_0x21349d['metaKey'])&&_0x21349d['key']==='b'&&(_0x21349d['preventDefault'](),document['execCommand']('bold',![],null));(_0x21349d['ctrlKey']||_0x21349d['metaKey'])&&_0x21349d['key']==='i'&&(_0x21349d['preventDefault'](),document['execCommand']('italic',![],null));if((_0x21349d['ctrlKey']||_0x21349d['metaKey'])&&_0x21349d['key']==='k'){_0x21349d['preventDefault'](),this['openLinkDialog']();return;}}['handlePaste'](_0x21341c){const _0x506118=_0x21341c['clipboardData'];if(_0x506118&&this['options']['onAddAttachments']){const _0x58185b=this['extractImageFilesFromClipboard'](_0x506118);if(_0x58185b['length']>0x0){_0x21341c['preventDefault'](),this['addAndInsertImages'](_0x58185b);return;}}_0x21341c['preventDefault']();const _0x3fbe44=_0x21341c['clipboardData']['getData']('text/html');if(_0x3fbe44&&_0x3fbe44['trim']()){const _0x3cd16a=this['convertPastedHtmlToMarkdown'](_0x3fbe44);if(_0x3cd16a&&_0x3cd16a['trim']()){this['insertMarkdownAsRichText'](_0x3cd16a);return;}}const _0x5db9eb=_0x21341c['clipboardData']['getData']('text/plain');document['execCommand']('insertText',![],_0x5db9eb);}['convertPastedHtmlToMarkdown'](_0xdf163a){const _0x198d94=document['createElement']('div');_0x198d94['innerHTML']=_0xdf163a;const _0x4aa2cb=_0x198d94['querySelectorAll']('style,\x20script,\x20meta,\x20link,\x20head,\x20title');_0x4aa2cb['forEach'](_0x4646ed=>_0x4646ed['remove']());const _0x37595d=_0x198d94['querySelectorAll']('*');_0x37595d['forEach'](_0x73c488=>{const _0x4bd5f0=Array['from'](_0x73c488['attributes']);_0x4bd5f0['forEach'](_0x513184=>{_0x513184['name']['startsWith']('data-')&&_0x513184['name']!=='data-attachment-name'&&_0x513184['name']!=='data-mention-user-id'&&_0x73c488['removeAttribute'](_0x513184['name']);});}),_0x198d94['querySelectorAll']('font[color]')['forEach'](_0x58c219=>{_0x58c219['replaceWith'](..._0x58c219['childNodes']);}),_0x198d94['querySelectorAll']('span')['forEach'](_0x1861ea=>{_0x1861ea['style']['color']&&_0x1861ea['style']['removeProperty']('color'),!_0x1861ea['getAttribute']('style')&&!_0x1861ea['getAttribute']('data-mention-user-id')&&!_0x1861ea['getAttribute']('data-attachment-name')&&_0x1861ea['replaceWith'](..._0x1861ea['childNodes']);});try{return this['turndownService']['turndown'](_0x198d94['innerHTML']);}catch(_0x1d1943){return console['warn']('Failed\x20to\x20convert\x20HTML\x20to\x20markdown:',_0x1d1943),null;}}['insertMarkdownAsRichText'](_0x328e07){const _0x57905b=window['marked'];if(!_0x57905b){document['execCommand']('insertText',![],_0x328e07);return;}try{const _0x11b607=this['preprocessColorSyntax'](_0x328e07),_0x1c7a40=_0x57905b['parse'](_0x11b607),_0x376ef4=document['createElement']('div');_0x376ef4['innerHTML']=_0x1c7a40,this['processHtmlForEditor'](_0x376ef4),document['execCommand']('insertHTML',![],_0x376ef4['innerHTML']);}catch(_0x14844e){console['warn']('Failed\x20to\x20convert\x20markdown\x20to\x20HTML:',_0x14844e),document['execCommand']('insertText',![],_0x328e07);}}['processHtmlForEditor'](_0x1646a6){const _0x2d118b=_0x1646a6['querySelectorAll']('pre');_0x2d118b['forEach'](_0x39f8d8=>{const _0x6dd161=_0x39f8d8['querySelector']('code');if(_0x6dd161){const _0x4fb700=Array['from'](_0x6dd161['classList'])['find'](_0x1aa9ce=>_0x1aa9ce['startsWith']('language-')),_0x142689=_0x4fb700?_0x4fb700['replace']('language-',''):'',_0x1d7e13=document['createElement']('pre');_0x142689&&_0x1d7e13['setAttribute']('data-language',_0x142689),_0x1d7e13['textContent']=_0x6dd161['textContent'],_0x39f8d8['replaceWith'](_0x1d7e13);}});const _0x1c5ca4=_0x1646a6['querySelectorAll']('a');_0x1c5ca4['forEach'](_0x170950=>{_0x170950['setAttribute']('target','_blank'),_0x170950['setAttribute']('rel','noopener\x20noreferrer');});}['handleDragStart'](_0x3130e7){const _0x40202d=_0x3130e7['target'];if(!_0x40202d||_0x40202d['tagName']!=='IMG')return;if(!_0x3130e7['dataTransfer'])return;const _0x2094b8=_0x40202d['getAttribute']('data-attachment-name')||'';try{_0x3130e7['dataTransfer']['setData'](INTERNAL_DRAG_MIME,_0x2094b8||'1');}catch{}_0x3130e7['dataTransfer']['effectAllowed']='move';}['handleDragOver'](_0x599c1d){if(!this['isExternalFileTransfer'](_0x599c1d['dataTransfer']))return;_0x599c1d['preventDefault'](),_0x599c1d['dataTransfer']['dropEffect']='copy';}['handleDrop'](_0x12a657){if(!this['isExternalFileTransfer'](_0x12a657['dataTransfer']))return;const _0x19a7b5=_0x12a657['dataTransfer'],_0x4f2026=Array['from'](_0x19a7b5['files']||[])['filter'](_0x130446=>_0x130446&&typeof _0x130446['type']==='string'),_0x16405a=_0x4f2026['filter'](_0x478cce=>_0x478cce['type']['startsWith']('image/'));if(_0x16405a['length']===0x0)return;_0x12a657['preventDefault'](),_0x12a657['stopPropagation'](),this['cleanupParentDragState'](),this['moveSelectionToDropPoint'](_0x12a657),this['addAndInsertImages'](_0x16405a);}['cleanupParentDragState'](){let _0x4c65b1=this['editor']['parentElement'];while(_0x4c65b1){_0x4c65b1['classList']&&_0x4c65b1['classList']['contains']('drag-over')&&_0x4c65b1['classList']['remove']('drag-over'),_0x4c65b1=_0x4c65b1['parentElement'];}}['isExternalFileTransfer'](_0x5d633a){if(!_0x5d633a)return![];const _0x5e45d0=Array['from'](_0x5d633a['types']||[]);if(!_0x5e45d0['includes']('Files'))return![];if(_0x5e45d0['includes'](INTERNAL_DRAG_MIME))return![];if(_0x5d633a['files']&&_0x5d633a['files']['length']>0x0)return!![];if(_0x5d633a['items']&&Array['from'](_0x5d633a['items'])['some'](_0x3154fa=>_0x3154fa['kind']==='file'))return!![];return![];}['moveSelectionToDropPoint'](_0x4f392c){const _0x16b83d=_0x4f392c['clientX'],_0x2ef1b3=_0x4f392c['clientY'];let _0x32462a=null;if(document['caretRangeFromPoint'])_0x32462a=document['caretRangeFromPoint'](_0x16b83d,_0x2ef1b3);else{if(document['caretPositionFromPoint']){const _0x5c89a0=document['caretPositionFromPoint'](_0x16b83d,_0x2ef1b3);_0x5c89a0&&(_0x32462a=document['createRange'](),_0x32462a['setStart'](_0x5c89a0['offsetNode'],_0x5c89a0['offset']),_0x32462a['collapse'](!![]));}}if(_0x32462a){const _0x4160e0=window['getSelection']();_0x4160e0['removeAllRanges'](),_0x4160e0['addRange'](_0x32462a);}}['extractImageFilesFromClipboard'](_0x48c74b){const _0x1eed62=Array['from'](_0x48c74b['items']||[]),_0x523710=[];for(const _0x10ded3 of _0x1eed62){if(_0x10ded3['kind']==='file'&&_0x10ded3['type']&&_0x10ded3['type']['startsWith']('image/')){const _0x141371=_0x10ded3['getAsFile']();if(_0x141371)_0x523710['push'](_0x141371);}}return _0x523710;}['addAndInsertImages'](_0x359432){const _0x29add6=_0x359432['map'](_0x11f2ee=>this['prepareAttachmentFile'](_0x11f2ee))['filter'](Boolean);if(_0x29add6['length']===0x0)return;const _0x4b6ed0=_0x29add6['map'](_0x15e701=>_0x15e701['file']);try{this['options']['onAddAttachments'](_0x4b6ed0);}catch(_0x2743e9){console['error']('Failed\x20to\x20add\x20attachments:',_0x2743e9);}for(const {name:_0x506bc8,objectUrl:_0xe8c73d}of _0x29add6){this['insertAttachmentImage'](_0x506bc8,_0xe8c73d);}this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['prepareAttachmentFile'](_0x3f1c39){const _0x44c683=this['sanitizeFilename'](_0x3f1c39['name']||this['defaultImageName'](_0x3f1c39['type']));if(!_0x44c683)return null;const _0xa2b761=this['getUniqueAttachmentName'](_0x44c683),_0x24daa0=_0xa2b761===_0x3f1c39['name']?_0x3f1c39:new File([_0x3f1c39],_0xa2b761,{'type':_0x3f1c39['type'],'lastModified':_0x3f1c39['lastModified']}),_0x59efff=URL['createObjectURL'](_0x24daa0);return this['attachmentObjectUrls']['set'](_0xa2b761,_0x59efff),{'name':_0xa2b761,'file':_0x24daa0,'objectUrl':_0x59efff};}['getUniqueAttachmentName'](_0x3179d5){const _0x220775=_0x5f3b59=>{if(this['attachmentObjectUrls']['has'](_0x5f3b59))return!![];if(this['options']['isAttachmentNameTaken'])try{return Boolean(this['options']['isAttachmentNameTaken'](_0x5f3b59));}catch{return![];}return![];};if(!_0x220775(_0x3179d5))return _0x3179d5;const {stem:_0x466af6,ext:_0x311355}=this['splitFilename'](_0x3179d5);for(let _0x96c8a2=0x2;_0x96c8a2<0x3e8;_0x96c8a2++){const _0x7ca768=_0x466af6+'-'+_0x96c8a2+_0x311355;if(!_0x220775(_0x7ca768))return _0x7ca768;}return _0x466af6+'-'+Date['now']()+_0x311355;}['splitFilename'](_0x3f7b02){const _0x43d7c2=_0x3f7b02['lastIndexOf']('.');if(_0x43d7c2<=0x0||_0x43d7c2===_0x3f7b02['length']-0x1)return{'stem':_0x3f7b02,'ext':''};return{'stem':_0x3f7b02['slice'](0x0,_0x43d7c2),'ext':_0x3f7b02['slice'](_0x43d7c2)};}['sanitizeFilename'](_0x592b78){const _0x4f823f=String(_0x592b78||'')['split']('/')['pop']()['split']('\x5c')['pop']();return _0x4f823f['replace'](/[\u0000-\u001F\u007F]/g,'')['trim']();}['defaultImageName'](_0x54fe05){const _0x13b429=this['extensionForMime'](_0x54fe05);return'pasted-image-'+Date['now']()+_0x13b429;}['extensionForMime'](_0x169921){switch(_0x169921){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'](_0x157193,_0x352904){const _0x49cc87=document['createElement']('img');_0x49cc87['src']=_0x352904,_0x49cc87['alt']=_0x157193,_0x49cc87['setAttribute']('data-attachment-name',_0x157193),_0x49cc87['draggable']=!![];const _0x5a50b5=window['getSelection']();let _0xb581b1=![];if(_0x5a50b5&&_0x5a50b5['rangeCount']>0x0){const _0x26e536=_0x5a50b5['getRangeAt'](0x0);_0xb581b1=this['editor']['contains'](_0x26e536['commonAncestorContainer'])||this['editor']===_0x26e536['commonAncestorContainer'];}if(!_0xb581b1){this['editor']['appendChild'](_0x49cc87);const _0x3b5003=document['createRange']();_0x3b5003['setStartAfter'](_0x49cc87),_0x3b5003['collapse'](!![]),_0x5a50b5['removeAllRanges'](),_0x5a50b5['addRange'](_0x3b5003);return;}const _0x5d4c25=_0x5a50b5['getRangeAt'](0x0);_0x5d4c25['deleteContents'](),_0x5d4c25['insertNode'](_0x49cc87),_0x5d4c25['setStartAfter'](_0x49cc87),_0x5d4c25['collapse'](!![]),_0x5a50b5['removeAllRanges'](),_0x5a50b5['addRange'](_0x5d4c25);}['toggleInlineCode'](){const _0x1af98a=window['getSelection']();if(_0x1af98a['rangeCount']===0x0)return;const _0x1164c2=_0x1af98a['getRangeAt'](0x0),_0x8b5f13=_0x1164c2['toString']();if(_0x8b5f13){const _0x2ddcc0=document['createElement']('code');_0x2ddcc0['textContent']=_0x8b5f13,_0x1164c2['deleteContents'](),_0x1164c2['insertNode'](_0x2ddcc0),_0x1164c2['setStartAfter'](_0x2ddcc0),_0x1164c2['setEndAfter'](_0x2ddcc0),_0x1af98a['removeAllRanges'](),_0x1af98a['addRange'](_0x1164c2);}}['insertCodeBlock'](){const _0x34cd92=window['getSelection']();if(_0x34cd92['rangeCount']===0x0)return;const _0x5d785d=_0x34cd92['getRangeAt'](0x0),_0x499bdb=_0x5d785d['toString'](),_0x22cdf2=document['createElement']('pre'),_0x7058e9=document['createElement']('code');_0x7058e9['textContent']=_0x499bdb||'\x0a',_0x22cdf2['appendChild'](_0x7058e9),_0x5d785d['deleteContents'](),_0x5d785d['insertNode'](_0x22cdf2);const _0x282761=document['createElement']('p');_0x282761['innerHTML']='<br>',_0x22cdf2['parentNode']['insertBefore'](_0x282761,_0x22cdf2['nextSibling']);const _0x55ad2e=document['createRange']();!_0x499bdb?(_0x55ad2e['setStart'](_0x7058e9['firstChild'],0x0),_0x55ad2e['setEnd'](_0x7058e9['firstChild'],0x0)):(_0x55ad2e['selectNodeContents'](_0x7058e9),_0x55ad2e['collapse'](![])),_0x34cd92['removeAllRanges'](),_0x34cd92['addRange'](_0x55ad2e);}['updatePlaceholder'](){const _0x226224=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');_0x226224?this['editor']['classList']['remove']('empty'):this['editor']['classList']['add']('empty');}['setMarkdown'](_0x3f76dc){if(!_0x3f76dc||!_0x3f76dc['trim']()){this['editor']['innerHTML']='',this['updatePlaceholder']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']='':this['element']['textContent']='';return;}const _0x321d6b=this['preprocessColorSyntax'](_0x3f76dc),_0x48ddbc=window['marked']['parse'](_0x321d6b);this['editor']['innerHTML']=_0x48ddbc,this['rewriteAttachmentImages'](),this['rewriteMentionLinks'](),this['addLinkHints'](),this['updatePlaceholder'](),this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x3f76dc:this['element']['textContent']=_0x3f76dc;}['rewriteAttachmentImages'](){const _0x21f9f0=this['editor']['querySelectorAll']('img');_0x21f9f0['forEach'](_0x525d81=>{const _0x578355=_0x525d81['getAttribute']('data-attachment-name'),_0x98c117=_0x525d81['getAttribute']('src')||'',_0x28b15f=this['parseAttachmentReference'](_0x98c117)||this['parseTaskAttachmentUrl'](_0x98c117),_0x4919a5=_0x578355||(_0x28b15f?_0x28b15f['name']:null);if(!_0x4919a5)return;_0x525d81['setAttribute']('data-attachment-name',_0x4919a5);const _0x1e371b=this['attachmentObjectUrls']['get'](_0x4919a5)||(this['options']['resolveAttachmentUrl']?this['options']['resolveAttachmentUrl'](_0x4919a5):null);_0x1e371b&&(_0x525d81['src']=_0x1e371b);});}['rewriteMentionLinks'](){const _0x1fad6d=this['editor']['querySelectorAll']('a[href^=\x22mention:\x22]');_0x1fad6d['forEach'](_0x3eac7a=>{const _0x3aba6a=_0x3eac7a['getAttribute']('href')||'',_0x439db6=_0x3aba6a['replace']('mention:',''),_0x572d80=_0x3eac7a['textContent']||'',_0x4d8fbf=document['createElement']('span');_0x4d8fbf['className']='mention',_0x4d8fbf['setAttribute']('data-mention-user-id',_0x439db6),_0x4d8fbf['setAttribute']('contenteditable','false'),_0x4d8fbf['textContent']='@'+_0x572d80;const _0x145f5b=_0x3eac7a['previousSibling'];_0x145f5b&&_0x145f5b['nodeType']===Node['TEXT_NODE']&&_0x145f5b['textContent']['endsWith']('@')&&(_0x145f5b['textContent']=_0x145f5b['textContent']['slice'](0x0,-0x1)),_0x3eac7a['parentNode']['replaceChild'](_0x4d8fbf,_0x3eac7a);});}['addLinkHints'](){if(!this['options']['editable'])return;const _0x44ae12=this['editor']['querySelectorAll']('a');_0x44ae12['forEach'](_0x2b96e2=>{const _0x3f67a8=_0x2b96e2['getAttribute']('href')||'';if(_0x3f67a8['startsWith']('mention:'))return;const _0x32362a=_0x2b96e2['textContent']||_0x3f67a8,_0x16ef25=_0x32362a+'\x20('+(this['linkHintText']||'Ctrl+click\x20to\x20follow')+')';_0x2b96e2['setAttribute']('aria-label',_0x16ef25);});}['preprocessColorSyntax'](_0x2c3e78){if(!_0x2c3e78)return _0x2c3e78;const _0x43c9cb=_0x127a1c=>{return String(_0x127a1c)['replace'](/\{color:(#[0-9A-Fa-f]{3,6})\}([\s\S]*?)\{\/color\}/g,(_0x542265,_0x852044,_0x420ea6)=>{const _0x36b025=_0x43c9cb(_0x420ea6);return'<span\x20style=\x22color:\x20'+_0x852044+'\x22>'+_0x36b025+'</span>';});};return _0x43c9cb(_0x2c3e78);}['parseAttachmentReference'](_0x556db6){if(!_0x556db6||typeof _0x556db6!=='string')return null;if(!_0x556db6['startsWith'](ATTACHMENT_SCHEME)&&!_0x556db6['startsWith'](ATTACHMENT_SCHEME+'//'))return null;const _0x1273de=_0x556db6['replace'](ATTACHMENT_SCHEME+'//','')['replace'](ATTACHMENT_SCHEME,'');if(!_0x1273de)return null;try{return{'name':decodeURIComponent(_0x1273de)};}catch{return{'name':_0x1273de};}}['parseTaskAttachmentUrl'](_0x3e2671){if(!_0x3e2671||typeof _0x3e2671!=='string')return null;const _0x33c2a7=_0x3e2671['match'](/\/tasks\/[^/]+\/attachments\/([^?#]+)/);if(!_0x33c2a7)return null;const _0x1f542a=_0x33c2a7[0x1];try{return{'name':decodeURIComponent(_0x1f542a)};}catch{return{'name':_0x1f542a};}}['updateAttachmentFile'](_0x20213b,_0x10d3e7){const _0x528a54=this['attachmentObjectUrls']['get'](_0x20213b);if(_0x528a54)try{URL['revokeObjectURL'](_0x528a54);}catch{}const _0x518265=URL['createObjectURL'](_0x10d3e7);this['attachmentObjectUrls']['set'](_0x20213b,_0x518265);const _0x1c3809=this['editor']['querySelector']('img[data-attachment-name=\x22'+CSS['escape'](_0x20213b)+'\x22]');return _0x1c3809&&(_0x1c3809['src']=_0x518265),_0x518265;}['getMarkdown'](){const _0x20a79f=this['editor']['innerHTML'];if(!_0x20a79f||_0x20a79f['trim']()===''||_0x20a79f==='<br>')return'';return this['turndownService']['turndown'](_0x20a79f)['replace'](/\u200B/g,'');}['getValue'](){return this['getMarkdown']();}['setValue'](_0x4a449d){this['setMarkdown'](_0x4a449d);}['focus'](){this['editor']['focus']();}['clear'](){this['editor']['innerHTML']='',this['updatePlaceholder']();}['setEditable'](_0x140a5a){this['editor']['contentEditable']=_0x140a5a,this['options']['editable']=_0x140a5a;}['handleMentionInput'](_0x44191c){if(!this['options']['fetchUsers'])return;const _0x3e9a4b=window['getSelection']();if(!_0x3e9a4b||_0x3e9a4b['rangeCount']===0x0){this['closeMentionDropdown']();return;}const _0x456d88=_0x3e9a4b['getRangeAt'](0x0),_0x427dcd=_0x456d88['startContainer'];if(_0x427dcd['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0xb9508d=_0x427dcd['textContent']||'',_0x224766=_0x456d88['startOffset'],_0x5424f4=_0xb9508d['slice'](0x0,_0x224766),_0x1bb2a1=_0x5424f4['lastIndexOf']('@');if(_0x1bb2a1===-0x1){this['closeMentionDropdown']();return;}const _0x44f855=_0x1bb2a1>0x0?_0x5424f4[_0x1bb2a1-0x1]:'\x20';if(!/\s/['test'](_0x44f855)&&_0x1bb2a1!==0x0){this['closeMentionDropdown']();return;}const _0x112ec4=_0x5424f4['slice'](_0x1bb2a1+0x1);if(/[\s\n]/['test'](_0x112ec4)){this['closeMentionDropdown']();return;}this['mentionState']['active']=!![],this['mentionState']['query']=_0x112ec4['toLowerCase'](),this['mentionState']['startOffset']=_0x1bb2a1,this['mentionState']['startNode']=_0x427dcd,this['showMentionDropdown']();}async['showMentionDropdown'](){if(!this['usersCache'])try{const _0xd57e57=await this['options']['fetchUsers']();this['usersCache']=_0xd57e57['users']||_0xd57e57||[];}catch(_0x3542f8){console['error']('Failed\x20to\x20fetch\x20users\x20for\x20@mention:',_0x3542f8),this['closeMentionDropdown']();return;}this['mentionState']['users']=this['usersCache'];const _0x4e7669=this['mentionState']['query'];this['mentionState']['filteredUsers']=this['mentionState']['users']['filter'](_0x30011e=>{const _0x1fc7ba=(_0x30011e['name']||'')['toLowerCase'](),_0x270a79=(_0x30011e['username']||'')['toLowerCase']();return _0x1fc7ba['includes'](_0x4e7669)||_0x270a79['includes'](_0x4e7669);})['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']=_0x32b8ca=>{!this['mentionDropdown']['contains'](_0x32b8ca['target'])&&!this['editor']['contains'](_0x32b8ca['target'])&&this['closeMentionDropdown']();},document['addEventListener']('click',this['mentionClickOutsideHandler']),this['mentionScrollHandler']=()=>{this['mentionState']['active']&&this['positionMentionDropdown']();},window['addEventListener']('scroll',this['mentionScrollHandler'],!![]));const _0x105ffa=this['mentionState']['filteredUsers'];this['mentionDropdown']['innerHTML']=_0x105ffa['map']((_0x4918b2,_0x474f0a)=>{const _0x574fac=_0x474f0a===this['mentionState']['selectedIndex'],_0xf85eca=_0x4918b2['name']||_0x4918b2['username']||'Unknown',_0x51057a=_0x4918b2['username']||'',_0x42eb8d=this['getInitials'](_0xf85eca),_0x3dc7f4=this['getAvatarColorIndex'](_0x51057a||_0x4918b2['id']||_0xf85eca);return'\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22mention-option\x20'+(_0x574fac?'mention-option-selected':'')+'\x22\x20data-index=\x22'+_0x474f0a+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-avatar\x20avatar-color-'+_0x3dc7f4+'\x22>'+this['escapeHtmlForMention'](_0x42eb8d)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-option-name\x22>'+this['escapeHtmlForMention'](_0xf85eca)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x51057a?'<span\x20class=\x22mention-option-username\x22>@'+this['escapeHtmlForMention'](_0x51057a)+'</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'](_0x5912e8=>{_0x5912e8['addEventListener']('mousedown',_0xefe572=>{_0xefe572['preventDefault']();const _0x509567=parseInt(_0x5912e8['dataset']['index'],0xa);this['insertMention'](this['mentionState']['filteredUsers'][_0x509567]);}),_0x5912e8['addEventListener']('mouseenter',()=>{const _0x3a65de=parseInt(_0x5912e8['dataset']['index'],0xa);this['mentionState']['selectedIndex']=_0x3a65de,this['updateMentionSelection']();});}),this['mentionDropdown']['style']['display']='block';}['positionMentionDropdown'](){if(!this['mentionDropdown'])return;const _0x343843=window['getSelection']();if(!_0x343843||_0x343843['rangeCount']===0x0)return;const _0x46974a=_0x343843['getRangeAt'](0x0),_0xcadfb3=_0x46974a['getBoundingClientRect'](),_0x2f572c=0x104,_0x4faaab=Math['min'](0xf0,this['mentionState']['filteredUsers']['length']*0x24+0x8),_0x4c4720=window['innerWidth'],_0x408fd3=window['innerHeight'],_0x378316=_0x408fd3-_0xcadfb3['bottom'],_0xe5dfac=_0xcadfb3['top'],_0x463ee7=_0x378316<_0x4faaab+0xa&&_0xe5dfac>_0x378316;let _0x3158d3,_0x439c35;_0x463ee7?_0x3158d3=_0xcadfb3['top']+window['scrollY']-_0x4faaab-0x4:_0x3158d3=_0xcadfb3['bottom']+window['scrollY']+0x4,_0x439c35=_0xcadfb3['left']+window['scrollX'],_0x439c35+_0x2f572c>_0x4c4720-0xa&&(_0x439c35=_0x4c4720-_0x2f572c-0xa),_0x439c35<0xa&&(_0x439c35=0xa),this['mentionDropdown']['style']['position']='absolute',this['mentionDropdown']['style']['top']=_0x3158d3+'px',this['mentionDropdown']['style']['left']=_0x439c35+'px';}['mentionNavigate'](_0x57964b){const _0x1e8959=this['mentionState']['filteredUsers']['length'];if(_0x1e8959===0x0)return;this['mentionState']['selectedIndex']=(this['mentionState']['selectedIndex']+_0x57964b+_0x1e8959)%_0x1e8959,this['updateMentionSelection']();}['updateMentionSelection'](){if(!this['mentionDropdown'])return;const _0x4b7a66=this['mentionDropdown']['querySelectorAll']('.mention-option');_0x4b7a66['forEach']((_0x479d11,_0x1ff691)=>{_0x1ff691===this['mentionState']['selectedIndex']?(_0x479d11['classList']['add']('mention-option-selected'),_0x479d11['scrollIntoView']({'block':'nearest'})):_0x479d11['classList']['remove']('mention-option-selected');});}['insertMention'](_0x1f6be0){if(!_0x1f6be0)return;const _0x423416=window['getSelection']();if(!_0x423416||_0x423416['rangeCount']===0x0)return;const _0x2d2439=_0x423416['getRangeAt'](0x0),_0xeaa275=this['mentionState']['startNode'];if(!_0xeaa275||_0xeaa275['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x48457e=_0xeaa275['textContent']||'',_0x45d8cb=this['mentionState']['startOffset'],_0x44172b=_0x2d2439['startOffset'],_0xfbaa3c=_0x48457e['slice'](0x0,_0x45d8cb),_0x5d1c57=_0x48457e['slice'](_0x44172b),_0x3fea2b=document['createElement']('span');_0x3fea2b['className']='mention',_0x3fea2b['setAttribute']('data-mention-user-id',_0x1f6be0['id']),_0x3fea2b['setAttribute']('contenteditable','false'),_0x3fea2b['textContent']='@'+(_0x1f6be0['name']||_0x1f6be0['username']);const _0x3021aa=document['createTextNode'](_0xfbaa3c),_0x27b203=document['createTextNode']('\x20'+_0x5d1c57),_0x26827d=_0xeaa275['parentNode'];_0x26827d['insertBefore'](_0x3021aa,_0xeaa275),_0x26827d['insertBefore'](_0x3fea2b,_0xeaa275),_0x26827d['insertBefore'](_0x27b203,_0xeaa275),_0x26827d['removeChild'](_0xeaa275);const _0x1986a1=document['createRange']();_0x1986a1['setStart'](_0x27b203,0x1),_0x1986a1['collapse'](!![]),_0x423416['removeAllRanges'](),_0x423416['addRange'](_0x1986a1),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'](_0x29fd4d){const _0x56b9f7=document['createElement']('div');return _0x56b9f7['textContent']=_0x29fd4d,_0x56b9f7['innerHTML'];}['getInitials'](_0xa72cf4){if(!_0xa72cf4)return'?';const _0xaf3b8e=_0xa72cf4['trim']()['split'](/\s+/);if(_0xaf3b8e['length']>=0x2)return(_0xaf3b8e[0x0][0x0]+_0xaf3b8e[_0xaf3b8e['length']-0x1][0x0])['toUpperCase']();return _0xa72cf4['substring'](0x0,0x2)['toUpperCase']();}['getAvatarColorIndex'](_0x40f7ff){if(!_0x40f7ff)return 0x6;let _0x532da6=0x0;for(let _0x41fcd7=0x0;_0x41fcd7<_0x40f7ff['length'];_0x41fcd7++){_0x532da6=_0x40f7ff['charCodeAt'](_0x41fcd7)+((_0x532da6<<0x5)-_0x532da6);}return Math['abs'](_0x532da6)%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 _0x2296d5 of this['attachmentObjectUrls']['values']()){try{URL['revokeObjectURL'](_0x2296d5);}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 _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});
|
|
1
|
+
let monacoLoadPromise=null;async function ensureMonacoLoaded(){if(typeof monaco!=='undefined')return;if(monacoLoadPromise)return monacoLoadPromise;const _0xb4784a=document['querySelector']('script[src*=\x22monaco-editor\x22][src*=\x22loader.min.js\x22]');if(_0xb4784a)return monacoLoadPromise=new Promise((_0x229c3a,_0x53a910)=>{const _0x399b9f=setInterval(()=>{typeof monaco!=='undefined'&&(clearInterval(_0x399b9f),_0x229c3a());},0x32);setTimeout(()=>{clearInterval(_0x399b9f),_0x53a910(new Error('Monaco\x20loading\x20timeout'));},0x2710);}),monacoLoadPromise;return monacoLoadPromise=new Promise((_0x60ec55,_0x3d76dc)=>{const _0x4b2cdc=document['createElement']('script');_0x4b2cdc['src']='https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs/loader.min.js',_0x4b2cdc['onload']=()=>{require['config']({'paths':{'vs':'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs'}}),require(['vs/editor/editor.main'],()=>{_0x60ec55();});},_0x4b2cdc['onerror']=()=>_0x3d76dc(new Error('Failed\x20to\x20load\x20Monaco\x20Editor')),document['head']['appendChild'](_0x4b2cdc);}),monacoLoadPromise;}function getMonacoTheme(){const _0x33eaf9=document['documentElement']['getAttribute']('data-theme')==='dark';return _0x33eaf9?'vs-dark':'vs';}function isMarkdownFile(_0x28a0a1){if(!_0x28a0a1)return![];const _0x3727f2=_0x28a0a1['split']('.')['pop']()['toLowerCase']();return _0x3727f2==='md'||_0x3727f2==='markdown';}function createMarkdownFileEditor(_0x9165d5){const {container:_0x1fad71,content:content='',readOnly:readOnly=![],height:height='400px',onChange:onChange=null,placeholder:placeholder='Enter\x20markdown\x20content...',enableModeToggle:enableModeToggle=!![],initialMode:initialMode='visual'}=_0x9165d5;_0x1fad71['innerHTML']='';let _0x123be2='visual',_0x6ec4e3=content,_0x7e41f=null,_0x443e00=null,_0x432aa9=![],_0xe176a4=initialMode==='source';const _0x5672dc=document['createElement']('div');_0x5672dc['className']='markdown-file-editor-wrapper',_0x5672dc['style']['height']=height,_0x5672dc['style']['display']='flex',_0x5672dc['style']['flexDirection']='column',_0x5672dc['style']['border']='1px\x20solid\x20var(--color-border)',_0x5672dc['style']['borderRadius']='var(--radius-small)',_0x5672dc['style']['overflow']='hidden';let _0x268f86=null,_0x555e78=null,_0x31c541=null;!readOnly&&enableModeToggle&&(_0x268f86=document['createElement']('div'),_0x268f86['className']='markdown-editor-mode-toggle',_0x268f86['style']['display']='flex',_0x268f86['style']['alignItems']='center',_0x268f86['style']['padding']='4px\x208px',_0x268f86['style']['borderBottom']='1px\x20solid\x20var(--color-border)',_0x268f86['style']['background']='var(--color-surface-secondary)',_0x268f86['style']['gap']='4px',_0x268f86['style']['flexShrink']='0',_0x555e78=document['createElement']('button'),_0x555e78['type']='button',_0x555e78['className']='markdown-mode-btn',_0x555e78['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',_0x555e78['title']='Visual\x20editing\x20mode\x20(WYSIWYG)',_0x31c541=document['createElement']('button'),_0x31c541['type']='button',_0x31c541['className']='markdown-mode-btn',_0x31c541['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',_0x31c541['title']='Source\x20editing\x20mode\x20(Monaco\x20Editor)',_0x268f86['appendChild'](_0x555e78),_0x268f86['appendChild'](_0x31c541),_0x5672dc['appendChild'](_0x268f86));const _0x3716cc=document['createElement']('div');_0x3716cc['className']='markdown-visual-container',_0x3716cc['style']['flex']='1',_0x3716cc['style']['display']='flex',_0x3716cc['style']['flexDirection']='column',_0x3716cc['style']['overflow']='hidden',_0x3716cc['style']['minHeight']='0';const _0x308ccc=document['createElement']('textarea');_0x308ccc['style']['display']='none',_0x308ccc['value']=content,_0x3716cc['appendChild'](_0x308ccc),_0x5672dc['appendChild'](_0x3716cc);const _0x4e5847=document['createElement']('div');_0x4e5847['className']='markdown-source-container',_0x4e5847['style']['flex']='1',_0x4e5847['style']['display']='none',_0x4e5847['style']['overflow']='hidden',_0x4e5847['style']['minHeight']='0',_0x5672dc['appendChild'](_0x4e5847),_0x1fad71['appendChild'](_0x5672dc),_0x7e41f=new window['MarkdownEditor'](_0x308ccc,{'placeholder':placeholder,'editable':!readOnly,'minHeight':'100%','toolbar':!readOnly,'onChange':_0x36336e=>{_0x6ec4e3=_0x36336e,onChange&&onChange(_0x36336e);}});_0x7e41f['container']&&(_0x7e41f['container']['style']['flex']='1',_0x7e41f['container']['style']['display']='flex',_0x7e41f['container']['style']['flexDirection']='column',_0x7e41f['container']['style']['overflow']='hidden');_0x7e41f['editor']&&(_0x7e41f['editor']['style']['flex']='1',_0x7e41f['editor']['style']['overflow']='auto',_0x7e41f['editor']['style']['minHeight']='0',_0x7e41f['editor']['style']['border']='none',_0x7e41f['editor']['style']['borderRadius']='0',_0x7e41f['editor']['style']['padding']='16px',_0x7e41f['editor']['style']['fontSize']='14px',_0x7e41f['editor']['style']['lineHeight']='1.6');_0x7e41f['toolbar']&&(_0x7e41f['toolbar']['style']['borderRadius']='0',_0x7e41f['toolbar']['style']['flexShrink']='0');content&&_0x7e41f['setMarkdown'](content);function _0x36bac4(){if(!_0x555e78||!_0x31c541)return;_0x123be2==='visual'?(_0x555e78['classList']['add']('active'),_0x31c541['classList']['remove']('active')):(_0x555e78['classList']['remove']('active'),_0x31c541['classList']['add']('active'));}async function _0x23077b(){if(_0x432aa9)return;try{await ensureMonacoLoaded(),_0x443e00=monaco['editor']['create'](_0x4e5847,{'value':_0x6ec4e3,'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':!![]}),_0x443e00['onDidChangeModelContent'](()=>{_0x6ec4e3=_0x443e00['getValue'](),onChange&&onChange(_0x6ec4e3);}),_0x432aa9=!![];}catch(_0x523b62){console['error']('Failed\x20to\x20initialize\x20Monaco\x20editor:',_0x523b62);throw _0x523b62;}}async function _0x3de32e(_0x1c2351){if(_0x1c2351===_0x123be2)return;if(_0x123be2==='visual')_0x6ec4e3=_0x7e41f['getMarkdown']();else _0x443e00&&(_0x6ec4e3=_0x443e00['getValue']());_0x123be2=_0x1c2351;if(_0x1c2351==='visual')_0x4e5847['style']['display']='none',_0x3716cc['style']['display']='flex',_0x7e41f['setMarkdown'](_0x6ec4e3),_0x7e41f['focus']();else{_0x3716cc['style']['display']='none',_0x4e5847['style']['display']='block';if(!_0x432aa9)try{await _0x23077b();}catch(_0x237e06){console['error']('Failed\x20to\x20switch\x20to\x20source\x20mode:',_0x237e06),_0x123be2='visual',_0x4e5847['style']['display']='none',_0x3716cc['style']['display']='flex',_0x36bac4();return;}_0x443e00&&(_0x443e00['setValue'](_0x6ec4e3),_0x443e00['focus'](),_0x443e00['layout']());}_0x36bac4();}_0x555e78&&_0x31c541&&(_0x555e78['addEventListener']('click',_0x415fbc=>{_0x415fbc['preventDefault'](),_0x3de32e('visual');}),_0x31c541['addEventListener']('click',_0x51713c=>{_0x51713c['preventDefault'](),_0x3de32e('source');}),_0x36bac4());_0xe176a4&&setTimeout(()=>_0x3de32e('source'),0x0);const _0x3ef114={'getValue':()=>{if(_0x123be2==='visual')return _0x7e41f['getMarkdown']();else{if(_0x443e00)return _0x443e00['getValue']();}return _0x6ec4e3;},'setValue':_0x5aa28a=>{_0x6ec4e3=_0x5aa28a||'';if(_0x123be2==='visual')_0x7e41f['setMarkdown'](_0x6ec4e3);else _0x443e00&&_0x443e00['setValue'](_0x6ec4e3);},'focus':()=>{if(_0x123be2==='visual')_0x7e41f['focus']();else _0x443e00&&_0x443e00['focus']();},'setEditable':_0xb3bd34=>{_0x7e41f['setEditable'](_0xb3bd34),_0x443e00&&_0x443e00['updateOptions']({'readOnly':!_0xb3bd34});},'destroy':()=>{_0x7e41f['destroy'](),_0x443e00&&(_0x443e00['dispose'](),_0x443e00=null),_0x1fad71['innerHTML']='';},'getMode':()=>_0x123be2,'setMode':_0x2be90e=>_0x3de32e(_0x2be90e),'toggleMode':()=>_0x3de32e(_0x123be2==='visual'?'source':'visual'),'_visualEditor':_0x7e41f,'_getSourceEditor':()=>_0x443e00,'_container':_0x1fad71,'_isMarkdownFileEditor':!![],'_hasModeToggle':enableModeToggle};return _0x3ef114;}const markdownFileEditors=new Map();function getOrCreateMarkdownFileEditor(_0xd193f,_0x59db75,_0x58b0f0=![],_0x1dd237='400px',_0x396cbc=null,_0x3a8add={}){const _0x2fbd3d=document['getElementById'](_0xd193f);if(!_0x2fbd3d)return console['error']('Container\x20not\x20found:\x20'+_0xd193f),null;const _0x349445=markdownFileEditors['get'](_0xd193f);if(_0x349445){try{_0x349445['destroy']();}catch(_0x226182){console['warn']('Failed\x20to\x20destroy\x20existing\x20markdown\x20editor:',_0x226182);}markdownFileEditors['delete'](_0xd193f);}const _0x28f9a4=createMarkdownFileEditor({'container':_0x2fbd3d,'content':_0x59db75,'readOnly':_0x58b0f0,'height':_0x1dd237,'onChange':_0x396cbc,..._0x3a8add});return markdownFileEditors['set'](_0xd193f,_0x28f9a4),_0x28f9a4;}function getMarkdownFileEditorValue(_0x2c4090){const _0x352bc1=markdownFileEditors['get'](_0x2c4090);if(!_0x352bc1)return null;return _0x352bc1['getValue']();}function setMarkdownFileEditorValue(_0x3ee1fb,_0x37ff17){const _0x250c6b=markdownFileEditors['get'](_0x3ee1fb);_0x250c6b&&_0x250c6b['setValue'](_0x37ff17||'');}function disposeMarkdownFileEditor(_0x527e20){const _0x3ac5ca=markdownFileEditors['get'](_0x527e20);if(_0x3ac5ca){try{_0x3ac5ca['destroy']();}catch(_0x37f933){console['warn']('Failed\x20to\x20dispose\x20markdown\x20editor:',_0x37f933);}markdownFileEditors['delete'](_0x527e20);}}function hasMarkdownFileEditor(_0x58ecd6){return markdownFileEditors['has'](_0x58ecd6);}function getMarkdownFileEditorMode(_0x1fc566){const _0x21af70=markdownFileEditors['get'](_0x1fc566);if(!_0x21af70||!_0x21af70['getMode'])return null;return _0x21af70['getMode']();}function setMarkdownFileEditorMode(_0x233e2f,_0x44d34e){const _0x45ae85=markdownFileEditors['get'](_0x233e2f);_0x45ae85&&_0x45ae85['setMode']&&_0x45ae85['setMode'](_0x44d34e);}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});
|