agenttwin 0.3.4 → 0.3.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/cli.js +5 -5
- package/dist/dashboard/assets/dashboard/agent-home.css +7 -9
- package/dist/dashboard/assets/dashboard/inventory.json +1 -1
- package/dist/dashboard/assets/dashboard/runs.json +1 -1
- package/dist/dashboard/assets/next/static/It81cabE0Vc-SUEO_z8CQ/_buildManifest.js +1 -0
- package/dist/dashboard/assets/next/static/It81cabE0Vc-SUEO_z8CQ/_ssgManifest.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/255-09fb0d129bb12f51.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/4bd1b696-c023c6e3521b1417.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/772-85561381eedc95da.js +67 -0
- package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-5dc6a60918e8652d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-fa1f6ba56d7af38a.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-9b4372b1e47bc3bc.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/demo/page-760a47a5e4dee43f.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-80a0c2c82d5b4efd.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/layout-1a40c59e535513d4.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/page-de4735052adab906.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/pricing/page-7703fc31d6dff0f7.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-ef5a216a578eb7a8.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/framework-292291387d6b2e39.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/main-aea6e71289384293.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/main-app-99295a8cc37e8a47.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/pages/_app-7d307437aca18ad4.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/pages/_error-cb2a52f75f2162e2.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/webpack-330c9b9dd99c0d55.js +1 -0
- package/dist/dashboard/assets/next/static/css/1323d7da89b3fa5e.css +1 -0
- package/dist/dashboard/assets/next/static/css/45513ebc8c6ae800.css +1 -0
- package/dist/dashboard/assets/next/static/css/61ec74d503f353d4.css +1 -0
- package/dist/dashboard/assets/next/static/css/62e3209163fa5e55.css +1 -0
- package/dist/dashboard/assets/next/static/css/9282330a2fd1ab73.css +1 -0
- package/dist/dashboard/assets/next/static/css/c5ac36ef5726e746.css +1 -0
- package/dist/dashboard/assets/next/static/media/inter-var.e4af272c.woff2 +0 -0
- package/dist/dashboard/assets/next/static/media/moonlit-coast.bbe901a1.png +0 -0
- package/dist/dashboard/assets/next/static/media/plexmono-400.d3ebbfd6.woff2 +0 -0
- package/dist/dashboard/index.html +1 -140
- package/package.json +1 -1
- package/dist/dashboard/assets/dashboard/agent-home.js +0 -298
- package/dist/dashboard/assets/dashboard/dashboard.js +0 -462
- package/dist/dashboard/assets/dashboard/hosted.js +0 -89
- package/dist/dashboard/assets/dashboard/workflows.js +0 -39
- package/dist/dashboard/assets/vendor/dompurify.LICENSE +0 -202
- package/dist/dashboard/assets/vendor/marked.LICENSE +0 -44
- package/dist/dashboard/assets/vendor/marked.js +0 -82
- package/dist/dashboard/assets/vendor/purify.min.js +0 -7
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
const el=id=>document.getElementById(id);
|
|
3
|
-
const safe=value=>String(value??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
|
4
|
-
let connection=null,bundle=null,jobs=[],loading=false,submitting=false;
|
|
5
|
-
function clearPreparedUpload(){bundle=null;submissions.clear();el('bundle-consent').checked=false;el('bundle-review').innerHTML='<p class="coverage">Select a prepared workflow bundle to review its files and configuration.</p>';dispatchEvent(new CustomEvent('agenttwin:bundle-cleared'));}
|
|
6
|
-
const submissions=new Map();
|
|
7
|
-
const loadedReceipts=new Set();
|
|
8
|
-
let discoveryStamp="",selectedProject=null,projectGeneration=0;
|
|
9
|
-
const projectPath=path=>selectedProject?path+'?project='+encodeURIComponent(selectedProject):path;
|
|
10
|
-
async function refreshDiscovery(){try{
|
|
11
|
-
const generation=projectGeneration,current=connection;
|
|
12
|
-
const list=await request('/v1/projects');if(generation!==projectGeneration||current!==connection)return;
|
|
13
|
-
window.agentTwinProjects=list.projects??[];dispatchEvent(new CustomEvent('agenttwin:projects'));
|
|
14
|
-
if(!selectedProject&&list.latest)selectedProject=list.latest;
|
|
15
|
-
const data=await request(projectPath('/v1/discovery'));if(generation!==projectGeneration||current!==connection)return;
|
|
16
|
-
if(data.inventory){const stamp=JSON.stringify(data.inventory);if(stamp!==discoveryStamp){window.agentTwinDashboard.importDiscovery(data.inventory);discoveryStamp=stamp;message('Connected to '+data.inventory.name+'.');}}
|
|
17
|
-
}catch(error){message('Discovery sync unavailable: '+error.message+'. You can still import discovery JSON.');}}
|
|
18
|
-
async function selectProject(name){
|
|
19
|
-
if(!connection)throw new Error('Connect your account to switch repositories.');
|
|
20
|
-
const data=await request('/v1/discovery?project='+encodeURIComponent(name));
|
|
21
|
-
selectedProject=name;projectGeneration++;discoveryStamp='';clearPreparedUpload();window.agentTwinDashboard.clearProject();window.agentTwinDashboard.importDiscovery(data.inventory);discoveryStamp=JSON.stringify(data.inventory);state();
|
|
22
|
-
}
|
|
23
|
-
const message=text=>{el('api-message').textContent=text;};
|
|
24
|
-
// Live state for the Home view: real job list and connection, nothing synthesized.
|
|
25
|
-
const publish=()=>{window.agentTwinHosted={connected:!!connection,jobs:jobs.map(job=>({id:job.id,status:job.status,createdAt:job.createdAt}))};dispatchEvent(new CustomEvent('agenttwin:jobs'));};
|
|
26
|
-
const digest=async bytes=>Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),v=>v.toString(16).padStart(2,'0')).join('');
|
|
27
|
-
const textDigest=value=>digest(new TextEncoder().encode(value));
|
|
28
|
-
function state(){publish();el('account-menu-status').textContent=connection?'Account connected':'Not connected';el('account-connection-status').textContent=connection?'Connected to '+connection.base:'Not connected';el('account-disconnect').disabled=!connection;el('history-view').classList.toggle('account-connected',!!connection);el('workflow-connection').innerHTML=connection?'CLI tests sync to this workspace. Cloud execution is optional.':'Connect your account before executing. <button type="button" data-action="settings">Open settings →</button>'; el('api-disconnect').disabled=!connection;el('api-sync-settings').disabled=!connection||loading;el('refresh-api-jobs').disabled=!connection||loading;el('submit-hosted-run').disabled=!connection||!bundle||!el('bundle-consent').checked||submitting;}
|
|
29
|
-
async function request(path,options={}){
|
|
30
|
-
const current=connection;if(!current)throw new Error('Connect to the API first.');
|
|
31
|
-
const response=await fetch(current.base+path,{...options,headers:{authorization:'Bearer '+current.token,'content-type':'application/json'},redirect:'error',signal:AbortSignal.timeout(['/v1/chat','/v1/transcriptions'].includes(path.split('?')[0])?55000:20000)});
|
|
32
|
-
if(connection!==current)throw new Error('Connection changed.');
|
|
33
|
-
const data=await response.json();if(!response.ok)throw Object.assign(new Error(data.message||data.error||'API request failed: '+response.status),{data});return data;
|
|
34
|
-
}
|
|
35
|
-
function renderJobs(){el('api-jobs').innerHTML=jobs.length?jobs.map(job=>`<article class="candidate-row"><div><h3>${safe(window.agentTwinDashboard.getReceipts().find(r=>r.apiJobId===job.id)?.name.replaceAll('_',' ')||'Run '+job.id.slice(0,8))}</h3><p class="muted">${safe(window.agentTwinDashboard.getReceipts().find(r=>r.apiJobId===job.id)?.status||job.status)} · ${safe(job.createdAt)} · ${safe(job.id.slice(0,8))}</p></div><div class="actions">${['queued','running','cancelling'].includes(job.status)?`<button type="button" data-cancel-job="${safe(job.id)}" ${job.status==='cancelling'?'disabled':''}>${job.status==='cancelling'?'Cancelling…':'Cancel run'}</button>`:''}${job.status==='completed'?`<button type="button" data-inspect-job="${safe(job.id)}">Inspect run ↗</button>`:''}${job.status==='error'||job.status==='cancelled'?`<button type="button" data-inspect-job="${safe(job.id)}">View details</button>`:''}</div></article>`).join(''):(connection?'<div class="run-empty"><h2>Your first run starts here.</h2><p>Test a workflow through npx agenttwin run, then sync its evidence here.</p><button type="button" data-action="configure">Choose a workflow →</button></div>':'<div class="run-empty"><span class="intro-mark" aria-hidden="true">↻</span><h2>Every run leaves evidence.</h2><p>Connect your account to see execution results, state changes and what needs fixing.</p><button type="button" data-action="settings">Connect your account →</button></div>');}
|
|
36
|
-
async function loadRecentReceipts(){
|
|
37
|
-
const current=connection;
|
|
38
|
-
for(const item of jobs.filter(j=>j.status==='completed'&&!loadedReceipts.has(j.id)).slice(0,window.agentTwinPreferences?.receiptLimit??25)){
|
|
39
|
-
const job=await request('/v1/runs/'+item.id);
|
|
40
|
-
if(connection!==current)return;
|
|
41
|
-
if(job.receipt){if(job.receipt.apiJobId!==job.id)throw new Error('Receipt belongs to a different job.');window.agentTwinDashboard.importReceipt(job.receipt,{navigate:false});loadedReceipts.add(job.id);}
|
|
42
|
-
}
|
|
43
|
-
renderJobs();
|
|
44
|
-
}
|
|
45
|
-
async function refresh(){if(!connection||loading)return;loading=true;state();try{const data=await request('/v1/runs');if(!Array.isArray(data.jobs)||data.jobs.some(job=>!/^[a-f0-9-]{36}$/.test(job.id)||!['queued','running','cancelling','cancelled','completed','error'].includes(job.status)))throw new Error('Invalid API job list.');jobs=data.jobs;renderJobs();await loadRecentReceipts();}catch(error){message('Could not load jobs: '+error.message);}finally{loading=false;state();}}
|
|
46
|
-
el('api-connect').addEventListener('submit',async event=>{event.preventDefault();try{
|
|
47
|
-
const url=new URL(el('api-url').value.trim());if(url.username||url.password||url.search||url.hash||(url.protocol!=='https:'&&!(url.protocol==='http:'&&['127.0.0.1','localhost','[::1]'].includes(url.hostname))))throw new Error('Use HTTPS; loopback HTTP is allowed for development.');
|
|
48
|
-
const token=el('api-token').value.trim();if(!/^at_user_[a-f0-9]{64}$/.test(token))throw new Error('Use an individual at_user_ account token.');
|
|
49
|
-
clearPreparedUpload();window.agentTwinDashboard.clearAccount();loadedReceipts.clear();discoveryStamp='';selectedProject=null;projectGeneration++;
|
|
50
|
-
connection=null;jobs=[];state();
|
|
51
|
-
connection={base:url.href.replace(/\/$/,''),token};el('api-token').value='';jobs=[];renderJobs();state();const data=await request('/v1/runs');if(!Array.isArray(data.jobs))throw new Error('This API does not support dashboard job listing.');jobs=data.jobs;renderJobs();await refreshDiscovery();await loadRecentReceipts();state();const project=window.agentTwinDashboard.getProject();message(project.discovered?'Connected to '+project.name+'. Discovery and run evidence refresh automatically.':'Connected. Run npx agenttwin sync in your project to populate Environment and Workflows.');
|
|
52
|
-
}catch(error){clearPreparedUpload();window.agentTwinDashboard.clearAccount();connection=null;jobs=[];renderJobs();message('Connection failed: '+error.message);state();}});
|
|
53
|
-
el('api-sync-settings').addEventListener('click',async()=>{if(!connection)return;await refresh();if(connection)await refreshDiscovery();});
|
|
54
|
-
el('api-disconnect').addEventListener('click',()=>{clearPreparedUpload();window.agentTwinDashboard.clearAccount();connection=null;jobs=[];renderJobs();submissions.clear();loadedReceipts.clear();discoveryStamp="";selectedProject=null;projectGeneration++;message('Disconnected. Account token cleared from memory.');state();});
|
|
55
|
-
el('bundle-import').addEventListener('change',async event=>{bundle=null;el('bundle-consent').checked=false;state();try{
|
|
56
|
-
const file=event.target.files[0];if(!file)return;if(file.size>28*1024*1024)throw new Error('Bundle exceeds 28 MiB.');const data=JSON.parse(await file.text());
|
|
57
|
-
if(data.schema!=='agenttwin/upload-v1'||data.spec?.schema!=='agenttwin/world-v1'||!data.files||typeof data.files!=='object'||Array.isArray(data.files)||data.manifest?.schema!=='agenttwin/prepared-v1')throw new Error('Choose a bundle generated by agenttwin prepare.');
|
|
58
|
-
const paths=data.spec.files;if(!Array.isArray(paths)||paths.length<1||paths.length>100||new Set(paths).size!==paths.length||Object.keys(data.files).length!==paths.length)throw new Error('Bundle file list is invalid.');
|
|
59
|
-
if(data.manifest.workflowId!==data.spec.workflowId||!data.spec.workflowId||JSON.stringify(data.manifest.invocation)!==JSON.stringify(data.spec.command)||Object.keys(data.manifest.sourceDigests??{}).length!==paths.length)throw new Error('Workflow provenance does not match.');
|
|
60
|
-
if(await textDigest(JSON.stringify(data.spec))!==data.manifest.specDigest)throw new Error('World digest does not match the reviewed bundle.');
|
|
61
|
-
let total=0;for(const path of paths){if(typeof path!=='string'||!path||path.startsWith('/')||path.includes('\\')||path.includes('\0')||path.split('/').some(p=>!p||p==='.'||p==='..'||/^(\.env.*|\.git|\.ssh|\.aws|\.azure|\.config|\.npmrc|\.netrc|credentials.*)$/i.test(p))||/\.(pem|key|p12|pfx)$/i.test(path))throw new Error('Unsafe bundle file path.');const encoded=data.files[path];if(typeof encoded!=='string')throw new Error('Missing file content.');const raw=atob(encoded);if(btoa(raw)!==encoded)throw new Error('File encoding is invalid.');const bytes=Uint8Array.from(raw,c=>c.charCodeAt(0));total+=bytes.length;if(total>20*1024*1024)throw new Error('Application exceeds 20 MiB.');if(await digest(bytes)!==data.manifest.sourceDigests[path])throw new Error('Source digest mismatch: '+path);}
|
|
62
|
-
bundle=data;dispatchEvent(new CustomEvent('agenttwin:bundle',{detail:{spec:data.spec}}));el('bundle-review').innerHTML=`<h3>${safe(data.spec.name)}</h3><p class="mono">${safe(data.spec.command.join(' '))}</p><p class="coverage">${paths.length} actual files · ${total.toLocaleString()} bytes · ${safe(data.spec.timeoutSeconds)} second execution limit</p><details><summary>Review explicit upload</summary><pre>${safe(JSON.stringify({files:paths,mappings:data.manifest.mappings,world:data.spec},null,2))}</pre></details>`;message('Bundle digests verified. Review files and fixtures before upload.');
|
|
63
|
-
}catch(error){el('bundle-review').textContent='Bundle rejected: '+error.message;message(error.message);}finally{event.target.value='';state();}});
|
|
64
|
-
el('bundle-consent').addEventListener('change',state);
|
|
65
|
-
el('submit-hosted-run').addEventListener('click',async()=>{if(!bundle||!connection||!el('bundle-consent').checked||submitting)return;submitting=true;state();const submitted=bundle;try{message('Submitting reviewed files. The cloud runner will execute this workflow.');const job=await request('/v1/runs',{method:'POST',body:JSON.stringify({spec:submitted.spec,files:submitted.files,git:submitted.manifest.git,project:submitted.manifest.project})});if(!/^[a-f0-9-]{36}$/.test(job.id))throw new Error('Invalid API job ID.');submissions.set(job.id,submitted.manifest);el('bundle-consent').checked=false;message('Run accepted: '+job.id+'. Job status refreshes while this page is visible.');await refresh();}catch(error){message('Submission could not be confirmed: '+error.message+'. Refresh your account jobs before retrying.');}finally{submitting=false;state();}});
|
|
66
|
-
el('refresh-api-jobs').addEventListener('click',refresh);
|
|
67
|
-
el('api-jobs').addEventListener('click',async event=>{const cancel=event.target.closest('[data-cancel-job]'),inspect=event.target.closest('[data-inspect-job]');try{
|
|
68
|
-
if(cancel){cancel.disabled=true;const data=await request('/v1/runs/'+cancel.dataset.cancelJob,{method:'DELETE'});message('Run '+data.status+'. Cancellation does not refund the submission quota.');await refresh();}
|
|
69
|
-
if(inspect)await inspectJob(inspect.dataset.inspectJob);
|
|
70
|
-
}catch(error){message('API action failed: '+error.message);if(cancel)cancel.disabled=false;}});
|
|
71
|
-
async function inspectJob(id){
|
|
72
|
-
const job=await request('/v1/runs/'+id);
|
|
73
|
-
if(job.receipt){
|
|
74
|
-
if(job.receipt.apiJobId!==job.id)throw new Error('Receipt belongs to a different job.');
|
|
75
|
-
const manifest=submissions.get(job.id);
|
|
76
|
-
if(manifest&&(manifest.specDigest!==job.receipt.specDigest||JSON.stringify(Object.entries(manifest.sourceDigests).sort())!==JSON.stringify(Object.entries(job.receipt.sourceDigests??{}).sort())))throw new Error('Receipt does not match the submitted source/world.');
|
|
77
|
-
window.agentTwinDashboard.importReceipt(job.receipt);
|
|
78
|
-
}else{window.agentTwinDashboard.go('history');message(job.error||'Run '+job.status+'.');}
|
|
79
|
-
}
|
|
80
|
-
// Narrow authenticated actions; never expose the token or a generic request method.
|
|
81
|
-
window.agentTwinAccount={refreshRuns:refresh,selectProject,workflows:()=>request(projectPath('/v1/workflows')),saveWorkflow:input=>request(projectPath('/v1/workflows'),{method:'POST',body:JSON.stringify(input)}),chat:()=>request(projectPath('/v1/chat')),transcribe:input=>request('/v1/transcriptions',{method:'POST',body:JSON.stringify(input)}),sendChat:input=>request(projectPath('/v1/chat'),{method:'POST',body:JSON.stringify(input)}),inspectJob};
|
|
82
|
-
setInterval(()=>{if(!document.hidden&&connection&&window.agentTwinPreferences?.autoRefresh!==false){void refreshDiscovery();void refresh();}},10000);
|
|
83
|
-
setInterval(()=>{if(!document.hidden&&connection&&window.agentTwinPreferences?.autoRefresh!==false&&jobs.some(job=>['queued','running','cancelling'].includes(job.status)))void refresh();},3000);
|
|
84
|
-
const configuredApi=document.querySelector('meta[name="agenttwin-api-url"]')?.content;
|
|
85
|
-
if(configuredApi)el('api-url').value=configuredApi;
|
|
86
|
-
else if(location.protocol==='https:'&&location.pathname.startsWith('/dashboard/'))el('api-url').value=location.origin;
|
|
87
|
-
renderJobs();state();
|
|
88
|
-
})();
|
|
89
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
(()=>{
|
|
2
|
-
const $=id=>document.getElementById(id);
|
|
3
|
-
const esc=value=>String(value??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
|
4
|
-
let saved=[],project=null,selected=null,generation=0;
|
|
5
|
-
function faultControls(){
|
|
6
|
-
try{const spec=JSON.parse($('workflow-spec').value);$('workflow-fault-type').value=spec.fault?.type||'none';$('workflow-fault-delay').value=spec.fault?.delayMs||1200;const targets=(spec.services||[]).flatMap(service=>(service.collections||[]).map(collection=>({service:service.name,path:collection.path})));$('workflow-fault-target').innerHTML=targets.map(target=>`<option value="${esc(JSON.stringify(target))}">${esc(target.service+' '+target.path)}</option>`).join('');if(spec.fault)$('workflow-fault-target').value=JSON.stringify({service:spec.fault.service,path:spec.fault.path});}
|
|
7
|
-
catch{$('workflow-fault-target').innerHTML='<option value="">Load a valid configuration first</option>';}
|
|
8
|
-
}
|
|
9
|
-
$('workflow-spec').addEventListener('input',faultControls);
|
|
10
|
-
$('workflow-apply-fault').addEventListener('click',()=>{try{const spec=JSON.parse($('workflow-spec').value);if($('workflow-fault-type').value==='none')delete spec.fault;else{const target=JSON.parse($('workflow-fault-target').value),delayMs=Number($('workflow-fault-delay').value);if(!Number.isInteger(delayMs)||delayMs<1||delayMs>10000)throw new Error('Delay must be 1–10000 milliseconds.');spec.fault={...target,type:'timeout-after-write',delayMs};}$('workflow-spec').value=JSON.stringify(spec,null,2);faultControls();note('Scenario applied to this draft. Save or export it, rebuild your bundle, then review the new upload before running.');}catch(error){note('Scenario was not changed: '+error.message);}});
|
|
11
|
-
const note=text=>{$('workflow-save-status').textContent=text;};
|
|
12
|
-
function render(){
|
|
13
|
-
$('workflow-saved-list').innerHTML=saved.length?saved.map(w=>`<article class="candidate-row"><div><h3>${esc(w.spec.name)}</h3><p class="mono">${esc(w.spec.command.join(' '))}</p><p class="coverage">Draft · revision ${w.revision} · ${esc(w.project)} · bundle required to run</p></div><button type="button" data-edit-workflow="${esc(w.id)}">Edit configuration</button></article>`).join(''):'<p class="coverage">No saved contracts for this project.</p>';
|
|
14
|
-
}
|
|
15
|
-
async function refresh(){
|
|
16
|
-
const current=++generation;selected=null;saved=[];project=null;render();$('workflow-spec').value='';faultControls();
|
|
17
|
-
if(!window.agentTwinHosted?.connected){note('Connect an account and sync project discovery to save contracts.');return;}
|
|
18
|
-
try{const data=await window.agentTwinAccount.workflows();if(current!==generation)return;saved=data.workflows;project=data.project;render();note(project?'Project: '+project:'Run npx agenttwin init, then sync discovery first.');}
|
|
19
|
-
catch(error){if(current===generation)note('Could not load contracts: '+error.message);}
|
|
20
|
-
}
|
|
21
|
-
$('workflow-refresh').addEventListener('click',refresh);
|
|
22
|
-
$('workflow-saved-list').addEventListener('click',e=>{const button=e.target.closest('[data-edit-workflow]');if(!button)return;selected=saved.find(w=>w.id===button.dataset.editWorkflow);$('workflow-spec').value=JSON.stringify(selected.spec,null,2);$('workflow-editor').open=true;faultControls();note('Editing revision '+selected.revision+'. Saving invalidates any previous bundle approval.');});
|
|
23
|
-
$('workflow-save').addEventListener('click',async()=>{
|
|
24
|
-
if(!project){note('Connect your account and sync discovery first.');return;}
|
|
25
|
-
const current=generation;$('workflow-save').disabled=true;
|
|
26
|
-
try{const spec=JSON.parse($('workflow-spec').value);const data=await window.agentTwinAccount.saveWorkflow({project,spec,...(selected?{id:selected.id,revision:selected.revision}:{})});if(current!==generation)return;selected=data.workflow;saved=[selected,...saved.filter(w=>w.id!==selected.id)];render();note('Draft saved · revision '+selected.revision+'. Rebundle application files before execution.');}
|
|
27
|
-
catch(error){if(current===generation)note('Draft was not saved: '+error.message);}
|
|
28
|
-
finally{$('workflow-save').disabled=false;}
|
|
29
|
-
});
|
|
30
|
-
$('workflow-new').addEventListener('click',()=>{selected=null;$('workflow-spec').value='';faultControls();note('Paste a valid world contract, then save.');});
|
|
31
|
-
$('workflow-export').addEventListener('click',()=>{try{const spec=JSON.parse($('workflow-spec').value);const url=URL.createObjectURL(new Blob([JSON.stringify(spec,null,2)+'\n'],{type:'application/json'}));const a=document.createElement('a');a.href=url;a.download='agenttwin.world.json';a.click();setTimeout(()=>URL.revokeObjectURL(url),1000);note('Configuration exported. Review it and rebuild the source bundle before running.');}catch{note('Enter valid JSON before exporting.');}});
|
|
32
|
-
addEventListener('agenttwin:bundle',e=>{selected=null;$('workflow-spec').value=JSON.stringify(e.detail.spec,null,2);$('workflow-editor').open=true;faultControls();note('Imported bundle contract. Saving stores configuration only, not source files.');});
|
|
33
|
-
addEventListener('agenttwin:bundle-cleared',()=>{selected=null;$('workflow-spec').value='';faultControls();});
|
|
34
|
-
let connected=false;
|
|
35
|
-
addEventListener('agenttwin:jobs',()=>{const next=!!window.agentTwinHosted?.connected;if(connected!==next){connected=next;void refresh();}});
|
|
36
|
-
addEventListener('agenttwin:discovery',()=>void refresh());
|
|
37
|
-
render();faultControls();
|
|
38
|
-
|
|
39
|
-
})();
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# License information
|
|
2
|
-
|
|
3
|
-
## Contribution License Agreement
|
|
4
|
-
|
|
5
|
-
If you contribute code to this project, you are implicitly allowing your code
|
|
6
|
-
to be distributed under the MIT license. You are also implicitly verifying that
|
|
7
|
-
all code is your original work. `</legalese>`
|
|
8
|
-
|
|
9
|
-
## Marked
|
|
10
|
-
|
|
11
|
-
Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
|
|
12
|
-
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
|
|
13
|
-
|
|
14
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
in the Software without restriction, including without limitation the rights
|
|
17
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
-
furnished to do so, subject to the following conditions:
|
|
20
|
-
|
|
21
|
-
The above copyright notice and this permission notice shall be included in
|
|
22
|
-
all copies or substantial portions of the Software.
|
|
23
|
-
|
|
24
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
30
|
-
THE SOFTWARE.
|
|
31
|
-
|
|
32
|
-
## Markdown
|
|
33
|
-
|
|
34
|
-
Copyright © 2004, John Gruber
|
|
35
|
-
http://daringfireball.net/
|
|
36
|
-
All rights reserved.
|
|
37
|
-
|
|
38
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
39
|
-
|
|
40
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
41
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
42
|
-
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
43
|
-
|
|
44
|
-
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* marked v18.1.0 - a markdown parser
|
|
3
|
-
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
4
|
-
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
5
|
-
* https://github.com/markedjs/marked
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* DO NOT EDIT THIS FILE
|
|
10
|
-
* The code in this file is generated from files in ./src/
|
|
11
|
-
*/
|
|
12
|
-
(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f()}else if("function"==typeof define && define.amd){define("marked",f)}else {g["marked"]=f()}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports};
|
|
13
|
-
"use strict";var W=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var Ae=Object.prototype.hasOwnProperty;var Ee=(l,e)=>{for(var t in e)W(l,t,{get:e[t],enumerable:!0})},Me=(l,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ze(e))!Ae.call(l,s)&&s!==t&&W(l,s,{get:()=>e[s],enumerable:!(n=Le(e,s))||n.enumerable});return l};var Ie=l=>Me(W({},"__esModule",{value:!0}),l);var Zt={};Ee(Zt,{Hooks:()=>_,Lexer:()=>b,Marked:()=>v,Parser:()=>R,Renderer:()=>S,TextRenderer:()=>$,Tokenizer:()=>y,defaults:()=>O,getDefaults:()=>A,lexer:()=>vt,marked:()=>k,options:()=>Mt,parse:()=>Dt,parseInline:()=>Bt,parser:()=>qt,setOptions:()=>It,use:()=>ye,walkTokens:()=>Ct});module.exports=Ie(Zt);function A(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var O=A();function X(l){O=l}var E={exec:()=>null};function C(l){let e=[];return t=>{let n=Math.max(0,Math.min(3,t-1)),s=e[n];return s||(s=l(n),e[n]=s),s}}function h(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(s,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(x.caret,"$1"),t=t.replace(s,o),n},getRegex:()=>new RegExp(t,e)};return n}var Ce=((l="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+l)}catch{return!1}})(),x={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:C(l=>new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:C(l=>new RegExp(`^ {0,${l}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:C(l=>new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),headingBeginRegex:C(l=>new RegExp(`^ {0,${l}}#`)),htmlBeginRegex:C(l=>new RegExp(`^ {0,${l}}(?:</?(?:${Q})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,"i")),blockquoteBeginRegex:C(l=>new RegExp(`^ {0,${l}}>`))},Be=/^(?:[ \t]*(?:\n|$))+/,De=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,N=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ve=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,V=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ke=h(de).replace(/bull/g,V).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ze=h(de).replace(/bull/g,V).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Y=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,He=/^[^\n]+/,ee=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ge=h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ee).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ne=h(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,V).getRegex(),Q="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",te=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qe=h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",te).replace("tag",Q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge=l=>h(Y).replace("hr",N).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",l).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),je=ge(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Fe=ge(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ue=h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Fe).getRegex(),ne={blockquote:Ue,code:De,def:Ge,fences:qe,heading:ve,hr:N,html:Qe,lheading:ke,list:Ne,newline:Be,paragraph:je,table:E,text:He},pe=h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",N).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),Ke={...ne,lheading:Ze,table:pe,paragraph:h(Y).replace("hr",N).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex()},We={...ne,html:h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",te).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:E,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h(Y).replace("hr",N).replace("heading",` *#{1,6} *[^
|
|
14
|
-
]`).replace("lheading",ke).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Je=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fe=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Ve=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,L=/[\p{P}\p{S}]/u,B=/[\s\p{P}\p{S}]/u,j=/[^\s\p{P}\p{S}]/u,Ye=h(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,B).getRegex(),et=/[\p{Pi}\p{Ps}"']/u,me=/(?!~)[\p{P}\p{S}]/u,tt=/(?!~)[\s\p{P}\p{S}]/u,nt=/(?:[^\s\p{P}\p{S}]|~)/u,rt=h(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ce?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xe=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,st=h(xe,"u").replace(/punct/g,L).getRegex(),it=h(xe,"u").replace(/punct/g,me).getRegex(),ot=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,at=h(ot,"u").replace(/openQuote/g,et).replace(/punct/g,L).getRegex(),be="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",lt=h(be,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,L).getRegex(),ut=h(be,"gu").replace(/notPunctSpace/g,nt).replace(/punctSpace/g,tt).replace(/punct/g,me).getRegex(),pt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",ct=h(pt,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,L).getRegex(),ht=h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,L).getRegex(),dt="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",kt=h(dt,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,L).getRegex(),gt=h(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,L).getRegex(),ft="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",mt=h(ft,"gu").replace(/notPunctSpace/g,j).replace(/punctSpace/g,B).replace(/punct/g,L).getRegex(),xt=h(/\\(punct)/,"gu").replace(/punct/g,L).getRegex(),bt=h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Rt=h(te).replace("(?:-->|$)","-->").getRegex(),Tt=h("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Re=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,U=h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Re).getRegex(),Ot=h(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",U).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),wt=h(/^!?\[(label)\]\[(ref)\]/).replace("label",U).replace("ref",ee).getRegex(),Pt=h(/^!?\[(ref)\](?:\[\])?/).replace("ref",ee).getRegex(),ce=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,yt=h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Re).getRegex(),St=h("reflink|nolink(?!\\()","g").replace("reflink",h(/^!?\[(label)\]\[(ref)\]/).replace("label",yt).replace("ref",ce).getRegex()).replace("nolink",h(/^!?\[(ref)\](?:\[\])?/).replace("ref",ce).getRegex()).getRegex(),he=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,_t=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,$t=h(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,_t).getRegex(),re={_backpedal:E,anyPunctuation:xt,autolink:bt,blockSkip:rt,br:fe,code:Je,del:E,delLDelim:E,delRDelim:E,emStrongLDelim:st,emStrongRDelimAst:lt,emStrongRDelimUnd:ht,escape:Xe,link:Ot,nolink:Pt,punctuation:Ye,reflink:wt,reflinkSearch:St,tag:Tt,text:Ve,url:E},Lt={...re,emStrongLDelim:at,emStrongRDelimAst:ct,emStrongRDelimUnd:kt,link:h(/^!?\[(label)\]\((.*?)\)/).replace("label",U).getRegex(),reflink:h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",U).getRegex()},J={...re,emStrongRDelimAst:ut,emStrongLDelim:it,delLDelim:gt,delRDelim:mt,url:h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",$t).replace("protocol",he).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:h(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",he).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},zt={...J,br:h(fe).replace("{2,}","*").getRegex(),text:h(J.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},F={normal:ne,gfm:Ke,pedantic:We},D={normal:re,gfm:J,breaks:zt,pedantic:Lt};var At={"&":"&","<":"<",">":">",'"':""","'":"'"},Te=l=>At[l];function w(l,e){if(e){if(x.escapeTest.test(l))return l.replace(x.escapeReplace,Te)}else if(x.escapeTestNoEncode.test(l))return l.replace(x.escapeReplaceNoEncode,Te);return l}function Oe(l){return l.replace(x.numericCharacterReference,(e,t,n)=>{let s=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return s===0||s>1114111||s>=55296&&s<=57343?"\uFFFD":String.fromCodePoint(s)})}function se(l){try{l=encodeURI(l).replace(x.percentDecode,"%")}catch{return null}return l}function ie(l,e){let t=l.replace(x.findPipe,(r,o,i)=>{let u=!1,a=o;for(;--a>=0&&i[a]==="\\";)u=!u;return u?"|":" |"}),n=t.split(x.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(x.slashPipe,"|");return n}function z(l,e,t){let n=l.length;if(n===0)return"";let s=0;for(;s<n;){let r=l.charAt(n-s-1);if(r===e&&!t)s++;else if(r!==e&&t)s++;else break}return l.slice(0,n-s)}function oe(l){let e=l.split(`
|
|
15
|
-
`),t=e.length-1;for(;t>=0&&x.blankLine.test(e[t]);)t--;return e.length-t<=2?l:e.slice(0,t+1).join(`
|
|
16
|
-
`)}function q(l){return l.trim().toLowerCase().toUpperCase().toLowerCase()}function ae(l,e){if(l.indexOf(e[0])===-1&&l.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function le(l,e=0){let t=e,n="";for(let s of l)if(s===" "){let r=4-t%4;n+=" ".repeat(r),t+=r}else n+=s,t++;return n}function we(l,e,t,n,s){let r=e.href,o=e.title||null,i=l[1].replace(s.other.outputLinkReplace,"$1"),u=l[0].charAt(0)==="!";n.state.inLink=!0;let a=n.state.linkEmitted,p=n.state.inRawBlock;n.state.linkEmitted=!1;let c=n.inlineTokens(i),d=n.state.linkEmitted;if(n.state.linkEmitted=a,n.state.inLink=!1,!u){if(d){n.state.inRawBlock=p;return}n.state.linkEmitted=!0}return{type:u?"image":"link",raw:t,href:r,title:o,text:i,tokens:c}}function Et(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
|
|
17
|
-
`).map(r=>{let o=r.match(t.other.beginningSpace);if(o===null)return r;let[i]=o;return r.slice(Math.min(i.length,s.length))}).join(`
|
|
18
|
-
`)}function Pe(l,e,t,n){if(!e.includes("<"))return!1;for(let s=0;s<e.length;s++){if(e[s]==="\\"){s++;continue}if(e[s]==="`"){let i=n.inline.code.exec(e.slice(s));if(i){s+=i[0].length-1;continue}}if(e[s]!=="<")continue;let r=l.slice(t+s),o=n.inline.tag.exec(r)||n.inline.autolink.exec(r);if(o){if(o[0].length>e.length-s)return!0;s+=o[0].length-1}}return!1}var y=class{options;rules;lexer;constructor(e){this.options=e||O}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:oe(t[0]),s=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:s}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=Et(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=z(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceTabChar.test(s))&&(n=s.trim())}return{type:"heading",raw:z(t[0],`
|
|
19
|
-
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:z(t[0],`
|
|
20
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=z(t[0],`
|
|
21
|
-
`).split(`
|
|
22
|
-
`),s="",r="",o=[];for(;n.length>0;){let i=!1,u=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))u.push(n[a]),i=!0;else if(!i)u.push(n[a]);else break;n=n.slice(a);let p=u.join(`
|
|
23
|
-
`),c=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
24
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
25
|
-
${p}`:p,r=r?`${r}
|
|
26
|
-
${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,o,!0),this.lexer.state.top=d,n.length===0)break;let m=o.at(-1);if(m?.type==="code")break;if(m?.type==="blockquote"){let T=m,g=n.join(`
|
|
27
|
-
`),P=T.raw+`
|
|
28
|
-
`+g.replace(this.rules.other.blockquoteSetextReplace2,""),f=this.blockquote(P);o[o.length-1]=f;let I=P.substring(f.raw.length).replace(/^\n/,""),Z=I?I.split(`
|
|
29
|
-
`).length:0,H=Z?n.slice(0,-Z):n;H.length>0&&(s=`${s}
|
|
30
|
-
${H.join(`
|
|
31
|
-
`)}`),r=r.substring(0,r.length-T.text.length)+f.text;break}else if(m?.type==="list"){let T=m,g=T.raw+`
|
|
32
|
-
`+n.join(`
|
|
33
|
-
`),P=this.list(g);o[o.length-1]=P,s=s.substring(0,s.length-m.raw.length)+P.raw,r=r.substring(0,r.length-T.raw.length)+P.raw,n=g.substring(o.at(-1).raw.length).split(`
|
|
34
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let o=this.rules.other.listItemRegex(n),i=!1;for(;e;){let a=!1,p="",c="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let d=t[2].split(`
|
|
35
|
-
`,1)[0],m=t[1].length,T=this.options.pedantic?le(d,m):d.replace(this.rules.other.leadingSpaceTab,I=>le(I,m)),g=e.split(`
|
|
36
|
-
`,1)[0],P=!T.trim(),f=0;if(this.options.pedantic?(f=2,c=T.trimStart()):P?f=m+1:(f=T.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=T.slice(f),f+=m),P&&this.rules.other.blankLine.test(g)&&(p+=g+`
|
|
37
|
-
`,e=e.substring(g.length+1),a=!0),!a){let I=this.rules.other.nextBulletRegex(f),Z=this.rules.other.hrRegex(f),H=this.rules.other.fencesBeginRegex(f),ue=this.rules.other.headingBeginRegex(f),Se=this.rules.other.htmlBeginRegex(f),_e=this.rules.other.blockquoteBeginRegex(f);for(;e;){let K=e.split(`
|
|
38
|
-
`,1)[0],G;if(g=K,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),G=g):G=g.replace(this.rules.other.leadingSpaceTab,$e=>$e.replace(this.rules.other.tabCharGlobal," ")),H.test(g)||ue.test(g)||Se.test(g)||_e.test(g)||I.test(g)||Z.test(g))break;if(G.search(this.rules.other.nonSpaceChar)>=f||!g.trim())c+=`
|
|
39
|
-
`+G.slice(f);else{if(P||T.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||H.test(T)||ue.test(T)||Z.test(T))break;c+=`
|
|
40
|
-
`+g}P=!g.trim(),p+=K+`
|
|
41
|
-
`,e=e.substring(K.length+1),T=G.slice(f)}}r.loose||(i?r.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(i=!0)),r.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=p}let u=r.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items)if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),!r.loose){let p=a.tokens.filter(d=>d.type==="space"),c=p.length>0&&p.some(d=>this.rules.other.anyLine.test(d.raw));r.loose=c}for(let a of r.items){let p=a.tokens[0];if(a.task&&(p?.type==="text"||p?.type==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let d={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=d.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=d.raw+a.tokens[0].raw,a.tokens[0].text=d.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(d)):a.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):a.tokens.unshift(d)}}else a.task&&(a.task=!1)}if(r.loose)for(let a of r.items){a.loose=!0;for(let p of a.tokens)p.type==="text"&&(p.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=oe(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&ae(t[2],"()")!==-1)return;let n=q(t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:z(t[0],`
|
|
42
|
-
`),href:s,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ie(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
43
|
-
`):[],o={type:"table",raw:z(t[0],`
|
|
44
|
-
`),header:[],align:[],rows:[]};if(n.length===s.length){for(let i of s)this.rules.other.tableAlignRight.test(i)?o.align.push("right"):this.rules.other.tableAlignCenter.test(i)?o.align.push("center"):this.rules.other.tableAlignLeft.test(i)?o.align.push("left"):o.align.push(null);for(let i=0;i<n.length;i++)o.header.push({text:n[i],tokens:this.lexer.inline(n[i]),header:!0,align:o.align[i]});for(let i of r)o.rows.push(ie(i,o.header.length).map((u,a)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:o.align[a]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:z(t[0],`
|
|
45
|
-
`),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
46
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Pe(e,t[1],n,this.rules))return;let s=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let i=z(s.slice(0,-1),"\\");if((s.length-i.length)%2===0)return}else{let i=ae(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?r=r.slice(1):r=r.slice(1,-1)),we(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=n[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Pe(e,n[1],s,this.rules))return;let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[q(r)];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return we(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[3]||"")||!n||this.rules.inline.punctuation.exec(n)){let o=[...s[0]].length-1,i,u,a=o,p=0,c=s[0][0],d=n===c,m=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(s=m.exec(t))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(u=[...i].length,s[3]||s[4]){a+=u;continue}else if(s[5]||s[6]){if(o%3&&!((o+u)%3)){p+=u;continue}if(d)break}if(a-=u,a>0)continue;u=Math.min(u,u+a+p);let T=[...s[0]][0].length,g=e.slice(0,o+s.index+T+u);if(Math.min(o,u)%2){let f=g.slice(1,-1);return{type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}let P=g.slice(2,-2);return{type:"strong",raw:g,text:P,tokens:this.lexer.inlineTokens(P)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(!s)return;if(!(s[1]||"")||!n||this.rules.inline.punctuation.exec(n)){let o=[...s[0]].length-1,i,u,a=o,p=this.rules.inline.delRDelim;for(p.lastIndex=0,t=t.slice(-1*e.length+o);(s=p.exec(t))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(u=[...i].length,u!==o))continue;if(s[3]||s[4]){a+=u;continue}if(a-=u,a>0)continue;u=Math.min(u,u+a);let c=[...s[0]][0].length,d=e.slice(0,o+s.index+c+u),m=d.slice(o,-o);return{type:"del",raw:d,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:n?t[0]:Oe(t[0]),escaped:n}}}};var b=class l{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||O,this.options.tokenizer=this.options.tokenizer||new y,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:x,block:F.normal,inline:D.normal};this.options.pedantic?(t.block=F.pedantic,t.inline=D.pedantic):this.options.gfm&&(t.block=F.gfm,this.options.breaks?t.inline=D.breaks:t.inline=D.gfm),this.tokenizer.rules=t}static get rules(){return{block:F,inline:D}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(x.carriageReturn,`
|
|
47
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(x.tabCharGlobal," ").replace(x.spaceLine,""));let s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(i=>(r=i.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let i=t.at(-1);r.raw.length===1&&i!==void 0?i.raw+=`
|
|
48
|
-
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
49
|
-
`)?"":`
|
|
50
|
-
`)+r.raw,i.text+=`
|
|
51
|
-
`+r.text,this.inlineQueue.at(-1).src=i.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
52
|
-
`)?"":`
|
|
53
|
-
`)+r.raw,i.text+=`
|
|
54
|
-
`+r.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let i=1/0,u=e.slice(1),a;this.options.extensions.startBlock.forEach(p=>{a=p.call({lexer:this},u),typeof a=="number"&&a>=0&&(i=Math.min(i,a))}),i<1/0&&i>=0&&(o=e.substring(0,i+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let i=t.at(-1);n&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
|
|
55
|
-
`)?"":`
|
|
56
|
-
`)+r.raw,i.text+=`
|
|
57
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(r),n=o.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let i=t.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
58
|
-
`)?"":`
|
|
59
|
-
`)+r.raw,i.text+=`
|
|
60
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let s=n[0],r=s.lastIndexOf("[");if(!(s.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,q(s.slice(r+1,-1))))&&!(r>1&&this.linkInText(s.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(")");try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes("[")){let i=this.tokenizer.rules.inline.reflinkSearch,u=a=>{let p=a.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,q(a.slice(p+1,-1))))return a;if(p>1&&a.charAt(0)!=="!"){let c=a.slice(1,p-1);if(this.linkInText(c))return"["+c.replace(i,u)+"]["+"a".repeat(a.length-p-2)+"]"}return"["+"a".repeat(a.length-2)+"]"};n=n.replace(i,u)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,i=>"+".repeat(i.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(i,u,a)=>{let p=a?a.length:0;return i.slice(0,p)+"["+"a".repeat(i.length-p-2)+"]"}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let s=!1,r="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}s||(r=""),s=!1;let i;if(this.options.extensions?.inline?.some(a=>(i=a.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.escape(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.tag(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.link(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length);let a=t.at(-1);i.type==="text"&&a?.type==="text"?(a.raw+=i.raw,a.text+=i.text):t.push(i);continue}if(i=this.tokenizer.emStrong(e,n,r)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.codespan(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.br(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.del(e,n,r)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.autolink(e)){e=e.substring(i.raw.length),t.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e))){e=e.substring(i.raw.length),t.push(i);continue}let u=e;if(this.options.extensions?.startInline){let a=1/0,p=e.slice(1),c;this.options.extensions.startInline.forEach(d=>{c=d.call({lexer:this},p),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(u=e.substring(0,a+1))}if(i=this.tokenizer.inlineText(u)){e=e.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(r=i.raw.slice(-1)),s=!0;let a=t.at(-1);a?.type==="text"?(a.raw+=i.raw,a.text+=i.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}};var S=class{options;parser;constructor(e){this.options=e||O}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(x.notSpaceStart)?.[0],r=e?e.replace(x.endingNewline,"")+`
|
|
61
|
-
`:"";return s?'<pre><code class="language-'+w(s)+'">'+(n?r:w(r,!0))+`</code></pre>
|
|
62
|
-
`:"<pre><code>"+(n?r:w(r,!0))+`</code></pre>
|
|
63
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
64
|
-
${this.parser.parse(e)}</blockquote>
|
|
65
|
-
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
66
|
-
`}hr(e){return`<hr>
|
|
67
|
-
`}list(e){let t=e.ordered,n=e.start,s="";for(let i=0;i<e.items.length;i++){let u=e.items[i];s+=this.listitem(u)}let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
|
|
68
|
-
`+s+"</"+r+`>
|
|
69
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
70
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
71
|
-
`}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let s="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];n="";for(let i=0;i<o.length;i++)n+=this.tablecell(o[i]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
72
|
-
<thead>
|
|
73
|
-
`+t+`</thead>
|
|
74
|
-
`+s+`</table>
|
|
75
|
-
`}tablerow({text:e}){return`<tr>
|
|
76
|
-
${e}</tr>
|
|
77
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
78
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${w(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:s,autolink:r}){let o=r?w(n,!0):this.parser.parseInline(s),i=se(e);if(i===null)return o;e=w(i,r);let u='<a href="'+e+'"';return t&&(u+=' title="'+w(t)+'"'),u+=">"+o+"</a>",u}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=se(e);if(r===null)return w(n);e=r;let o=`<img src="${w(e)}" alt="${w(n)}"`;return t&&(o+=` title="${w(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:w(e.text)}};var $=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}};var R=class l{options;renderer;textRenderer;constructor(e){this.options=e||O,this.options.renderer=this.options.renderer||new S,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let s=e[n];if(this.options.extensions?.renderers?.[s.type]){let o=s,i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=i||"";continue}}let r=s;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let i=this.options.extensions.renderers[r.type].call({parser:this},r);if(i!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){n+=i||"";continue}}let o=r;switch(o.type){case"escape":{n+=t.text(o);break}case"html":{n+=t.html(o);break}case"link":{n+=t.link(o);break}case"image":{n+=t.image(o);break}case"checkbox":{n+=t.checkbox(o);break}case"strong":{n+=t.strong(o);break}case"em":{n+=t.em(o);break}case"codespan":{n+=t.codespan(o);break}case"br":{n+=t.br(o);break}case"del":{n+=t.del(o);break}case"text":{n+=t.text(o);break}default:{let i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}};var _=class{options;block;constructor(e){this.options=e||O}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?b.lex:b.lexInline}provideParser(e=this.block){return e?R.parse:R.parseInline}};var v=class{defaults=A();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=R;Renderer=S;TextRenderer=$;Lexer=b;Tokenizer=y;Hooks=_;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let r=s;for(let o of r.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let i of o)n=n.concat(this.walkTokens(i.tokens,t));break}case"list":{let r=s;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let i=r[o].flat(1/0);n=n.concat(this.walkTokens(i,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...i){let u=r.renderer.apply(this,i);return u===!1&&(u=o.apply(this,i)),u}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),s.extensions=t),n.renderer){let r=this.defaults.renderer||new S(this.defaults);for(let o in n.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,u=n.renderer[i],a=r[i];r[i]=(...p)=>{let c=u.apply(r,p);return c===!1&&(c=a.apply(r,p)),c||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new y(this.defaults);for(let o in n.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,u=n.tokenizer[i],a=r[i];r[i]=(...p)=>{let c=u.apply(r,p);return c===!1&&(c=a.apply(r,p)),c}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new _;for(let o in n.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,u=n.hooks[i],a=r[i];_.passThroughHooks.has(o)?r[i]=p=>{if(this.defaults.async&&_.passThroughHooksRespectAsync.has(o))return(async()=>{let d=await u.call(r,p);return a.call(r,d)})();let c=u.call(r,p);return a.call(r,c)}:r[i]=(...p)=>{if(this.defaults.async)return(async()=>{let d=await u.apply(r,p);return d===!1&&(d=await a.apply(r,p)),d})();let c=u.apply(r,p);return c===!1&&(c=a.apply(r,p)),c}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,o=n.walkTokens;s.walkTokens=function(i){let u=[];return u.push(o.call(this,i)),r&&(u=u.concat(r.call(this,i))),u}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return b.lex(e,t??this.defaults)}parser(e,t){return R.parse(e,t??this.defaults)}parseMarkdown(e){return(n,s)=>{let r={...s},o={...this.defaults,...r},i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let u=o.hooks?await o.hooks.preprocess(n):n,p=await(o.hooks?await o.hooks.provideLexer(e):e?b.lex:b.lexInline)(u,o),c=o.hooks?await o.hooks.processAllTokens(p):p;o.walkTokens&&await Promise.all(this.walkTokens(c,o.walkTokens));let m=await(o.hooks?await o.hooks.provideParser(e):e?R.parse:R.parseInline)(c,o);return o.hooks?await o.hooks.postprocess(m):m})().catch(i);try{o.hooks&&(n=o.hooks.preprocess(n));let a=(o.hooks?o.hooks.provideLexer(e):e?b.lex:b.lexInline)(n,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let c=(o.hooks?o.hooks.provideParser(e):e?R.parse:R.parseInline)(a,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(u){return i(u)}}}onError(e,t){return n=>{if(n.message+=`
|
|
79
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+w(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}};var M=new v;function k(l,e){return M.parse(l,e)}k.options=k.setOptions=function(l){return M.setOptions(l),k.defaults=M.defaults,X(k.defaults),k};k.getDefaults=A;k.defaults=O;function ye(...l){return M.use(...l),k.defaults=M.defaults,X(k.defaults),k}k.use=ye;k.walkTokens=function(l,e){return M.walkTokens(l,e)};k.parseInline=M.parseInline;k.Parser=R;k.parser=R.parse;k.Renderer=S;k.TextRenderer=$;k.Lexer=b;k.lexer=b.lex;k.Tokenizer=y;k.Hooks=_;k.parse=k;var Mt=k.options,It=k.setOptions,Ct=k.walkTokens,Bt=k.parseInline,Dt=k,qt=R.parse,vt=b.lex;
|
|
80
|
-
|
|
81
|
-
if(__exports != exports)module.exports = exports;return module.exports}));
|
|
82
|
-
//# sourceMappingURL=marked.umd.js.map
|