collabmd 0.1.37 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +1 -0
  2. package/dist/client/assets/{CodeMirrorEditor-UCMRAMCV-DnBV8gCm.js → CodeMirrorEditor-UCMRAMCV-75Zi8U_A.js} +1 -1
  3. package/dist/client/assets/{dist-BPEi1dEF.js → dist-1SMeCZhf.js} +1 -1
  4. package/dist/client/assets/{dist-Dbg8P4C5.js → dist-8EAyH6_p.js} +1 -1
  5. package/dist/client/assets/{dist-BEKQo64E.js → dist-B7XQNod9.js} +1 -1
  6. package/dist/client/assets/dist-BCzW2jDH.js +1 -0
  7. package/dist/client/assets/{dist-CQVTTk81.js → dist-BEk5kTf_.js} +1 -1
  8. package/dist/client/assets/dist-BOn786F3.js +1 -0
  9. package/dist/client/assets/{dist-Bn8WRPs1.js → dist-BXiFOexW.js} +1 -1
  10. package/dist/client/assets/{dist-v3i1ifes.js → dist-Bp_j2hKC.js} +1 -1
  11. package/dist/client/assets/dist-BwUX6zpo.js +1 -0
  12. package/dist/client/assets/{dist-DwvSvkOE.js → dist-Bz-8_JmE.js} +1 -1
  13. package/dist/client/assets/{dist-CBEw2W2P.js → dist-CH3l6nVf.js} +1 -1
  14. package/dist/client/assets/{dist-DQiph4qx.js → dist-CIt_ogHO.js} +1 -1
  15. package/dist/client/assets/{dist-BOP-dC-R.js → dist-CQZDuOJ9.js} +1 -1
  16. package/dist/client/assets/{dist-DdAqzGFU.js → dist-CRyP6okk.js} +1 -1
  17. package/dist/client/assets/dist-D-ixVAsS2.js +1 -0
  18. package/dist/client/assets/{dist-Brrlevif.js → dist-D8d0IGSI.js} +1 -1
  19. package/dist/client/assets/{dist-DZ2t5lUX.js → dist-Das5WX49.js} +1 -1
  20. package/dist/client/assets/{dist-CaMl1R6P.js → dist-DplP0BiK.js} +1 -1
  21. package/dist/client/assets/{dist-BE8C_ouo.js → dist-DwgKARew.js} +1 -1
  22. package/dist/client/assets/dist-GgGgSSbl.js +1 -0
  23. package/dist/client/assets/{dist-D34Xzrah.js → dist-NcJIpTJ8.js} +1 -1
  24. package/dist/client/assets/dist-QktK6LIH.js +1 -0
  25. package/dist/client/assets/{dist-BiCgLddE.js → dist-ZuMKSK7c.js} +1 -1
  26. package/dist/client/assets/{dist-DPCUH5MO.js → dist-_THc9HiJ.js} +1 -1
  27. package/dist/client/assets/{dist-mPPUaHhq.js → dist-bkoMCmF7.js} +1 -1
  28. package/dist/client/assets/{dist-B98fHn5m.js → dist-eAgBpkKv.js} +1 -1
  29. package/dist/client/assets/{dist-BScEL4VP.js → dist-fpFkgu34.js} +1 -1
  30. package/dist/client/assets/{dist-aE0_04fl.js → dist-tRNsnttY.js} +1 -1
  31. package/dist/client/assets/{dist-DWRyOl2w.js → dist-uyVGTnZh.js} +1 -1
  32. package/dist/client/assets/{dist-CJWCCWEW.js → dist-yy8SO13g.js} +1 -1
  33. package/dist/client/assets/{drawio-editor-B65ntu5E.js → drawio-editor-B_Sr8Z_Z.js} +1 -1
  34. package/dist/client/assets/{drawioEditor-ChF0ZKUh.js → drawioEditor-DBSyP3_d.js} +2 -2
  35. package/dist/client/assets/editor-session-C1scHGLl.js +16 -0
  36. package/dist/client/assets/{embedded-editor-base-CgEkjNYn.css → embedded-editor-base-Bb8ywn1e.css} +1 -1
  37. package/dist/client/assets/excalidraw-editor-B0XXVLHd.js +9 -0
  38. package/dist/client/assets/{excalidraw-scene-MyNAJi2A.js → excalidraw-scene-wAbVSY1L.js} +2 -2
  39. package/dist/client/assets/{excalidrawEditor-BT9hmN5y.js → excalidrawEditor-37sk03H8.js} +2 -2
  40. package/dist/client/assets/{export-page-9MSUmliH.js → export-page-Bnk-YQp-.js} +1 -1
  41. package/dist/client/assets/{exportDocument-W3oYiIU3.js → exportDocument-WQNApAbg.js} +2 -2
  42. package/dist/client/assets/{index-D8NvI6X_.js → index-BoKmcqkH.js} +2 -2
  43. package/dist/client/assets/{main-CuQn72Cc.js → main-BKumyd95.js} +5 -5
  44. package/dist/client/assets/preview-render-compiler-9SmLUP5V.js +1 -0
  45. package/dist/client/assets/{preview-render-compiler-BCaqHl2M.js → preview-render-compiler-IUtgIlOM.js} +1 -1
  46. package/dist/client/assets/{preview-render-worker-yfayDDfY.js → preview-render-worker-BwQ5sPy9.js} +1 -1
  47. package/dist/client/assets/runtime-config-BcUbZKho.js +1 -0
  48. package/dist/client/assets/{vault-api-client-CGLEvxZo.js → vault-api-client-BDKKvtOF.js} +1 -1
  49. package/dist/client/drawio-editor.html +1 -1
  50. package/dist/client/excalidraw-editor.html +1 -1
  51. package/dist/client/export-document.html +1 -1
  52. package/dist/client/index.html +1 -1
  53. package/docker-compose.yml +1 -0
  54. package/package.json +6 -6
  55. package/src/client/application/preview-render-compiler.js +12 -1
  56. package/src/client/application/preview-render-executor.js +4 -0
  57. package/src/client/application/preview-render-worker.js +2 -0
  58. package/src/client/application/preview-renderer.js +5 -2
  59. package/src/client/application/wiki-link-file-controller.js +7 -0
  60. package/src/client/bootstrap/collabmd-app-shell.js +2 -0
  61. package/src/client/domain/excalidraw-collaboration.js +50 -0
  62. package/src/client/domain/excalidraw-scene-reconcile.js +38 -0
  63. package/src/client/domain/mermaid-language.js +179 -0
  64. package/src/client/domain/runtime-paths.js +1 -0
  65. package/src/client/excalidraw-editor.js +76 -47
  66. package/src/client/infrastructure/editor-view-adapter.js +7 -2
  67. package/src/client/infrastructure/excalidraw-room-client.js +139 -27
  68. package/src/client/styles/surfaces/embedded-editor-base.css +2 -1
  69. package/src/domain/excalidraw-room-codec.js +1 -17
  70. package/src/server/config/env.js +1 -0
  71. package/src/server/infrastructure/http/create-static-handler.js +2 -0
  72. package/dist/client/assets/dist-BfVljg0L2.js +0 -1
  73. package/dist/client/assets/dist-CcG3Y7Wp.js +0 -1
  74. package/dist/client/assets/dist-CghBwrO3.js +0 -1
  75. package/dist/client/assets/dist-Csbx9lQ-.js +0 -1
  76. package/dist/client/assets/dist-DLyohOXi.js +0 -1
  77. package/dist/client/assets/dist-WXLmfDGg.js +0 -1
  78. package/dist/client/assets/editor-session-YtGVwK3v.js +0 -16
  79. package/dist/client/assets/excalidraw-editor-Co4KOVfJ.js +0 -9
  80. package/dist/client/assets/preview-render-compiler-kjMajWKn.js +0 -1
  81. package/dist/client/assets/runtime-config-Bf8nxVez.js +0 -1
@@ -1,16 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-BE8C_ouo.js","./dist-WXLmfDGg.js","./dist-CaMl1R6P.js","./dist-D34Xzrah.js","./dist-CQVTTk81.js","./dist-CcG3Y7Wp.js","./dist-CJWCCWEW.js","./dist-v3i1ifes.js","./dist-DLyohOXi.js","./dist-Bn8WRPs1.js","./dist-mPPUaHhq.js","./dist-DQiph4qx.js","./dist-Csbx9lQ-.js","./dist-DdAqzGFU.js","./dist-DZ2t5lUX.js","./dist-DPCUH5MO.js","./dist-DWRyOl2w.js","./dist-CghBwrO3.js","./dist-Brrlevif.js","./dist-BPEi1dEF.js","./dist-BiCgLddE.js","./dist-aE0_04fl.js","./dist-CBEw2W2P.js","./dist-BEKQo64E.js","./dist-Dbg8P4C5.js","./dist-BfVljg0L2.js","./dist-BScEL4VP.js","./dockerfile-D8_6_FRV.js","./simple-mode-pOKc0mfx.js","./factor-Cz-hzBGH.js","./javascript-qUBHINSy.js","./javascript-gTK9fxz6.js","./nsis-QPGhLAeY.js","./pug-lkTEco3G.js","./dist-B98fHn5m.js","./dist-BOP-dC-R.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-Bo9GmnuQ.js";import{$ as t,A as n,B as r,F as i,G as a,H as o,J as s,K as c,L as l,P as u,Q as d,R as f,St as p,Tt as m,V as h,W as g,Z as _,_t as ee,a as v,bt as te,c as ne,ct as y,et as re,f as ie,ft as ae,g as oe,gt as b,l as se,lt as x,mt as ce,nt as S,o as le,ot as C,pt as ue,q as de,rt as fe,st as pe,t as me,ut as w,v as he,w as ge,wt as _e,xt as ve,z as ye}from"./dist-CaMl1R6P.js";import{i as be,n as xe,r as Se}from"./dist-WXLmfDGg.js";import{a as Ce,s as we}from"./dist-Brrlevif.js";import{t as Te}from"./dist-BScEL4VP.js";import{a as Ee,c as De,i as Oe,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./dist-DwvSvkOE.js";import{d as Pe,i as Fe}from"./file-kind-DmKq2MvD.js";import{m as Ie}from"./runtime-config-Bf8nxVez.js";import{a as Le,c as T,d as E,f as Re,g as ze,h as Be,i as Ve,l as D,m as O,n as He,o as k,p as A,r as Ue,s as We,t as Ge,u as j}from"./yjs-provider-reset-guard-DSPzcvAO.js";import{a as Ke,c as qe,d as Je,i as Ye,n as Xe,o as Ze,s as Qe,t as $e,u as et}from"./room-z2w9b96b.js";function tt({body:e,user:t}){return{body:e,createdAt:Date.now(),id:Ye(`comment`),peerId:t?.peerId??``,reactions:[],userColor:t?.color??``,userName:t?.name??`Anonymous`}}function nt(e,t){return e instanceof k?e.get(t):e?.[t]}function rt(e=[]){return Array.isArray(e)?e.map(e=>({emoji:typeof e?.emoji==`string`?e.emoji:``,users:Array.isArray(e?.users)?e.users.map(e=>({reactedAt:Number.isFinite(e?.reactedAt)?e.reactedAt:Date.now(),userColor:typeof e?.userColor==`string`?e.userColor:``,userId:typeof e?.userId==`string`?e.userId:``,userName:typeof e?.userName==`string`&&e.userName?e.userName:`Anonymous`})).filter(e=>e.userId):[]})).filter(e=>e.emoji&&e.users.length>0):[]}function it(e,t){let n=t?.doc;if(!n)return null;let r=e?.anchor??e,i=r?.anchorKind===`text`?`text`:`line`,a=n.lines,o=Math.min(Math.max(Math.round(r?.startLine??1),1),a),s=Math.min(Math.max(Math.round(r?.endLine??o),o),a),c=n.line(o).from,l=n.line(s).to,u=Math.min(Math.max(Math.round(r?.startIndex??c),0),n.length),d=Math.min(Math.max(Math.round(r?.endIndex??l),u),n.length);return{anchorEndLine:s,anchorKind:i,anchorQuote:qe(r?.anchorQuote||n.sliceString(u,d)),anchorStartLine:o,endIndex:d,startIndex:u}}var at=class{constructor({getDoc:e,getEditorState:t,getLocalUser:n,onCommentsChange:r=null}){this.getDoc=e,this.getEditorState=t,this.getLocalUser=n,this.onCommentsChange=r,this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}bind({commentThreads:e,ydoc:t,ytext:n}){this.unbind(),this.commentThreads=e,this.ydoc=t,this.ytext=n,this.handleCommentThreadsChange=()=>{this.emitCommentsChange()},this.handleTextChange=()=>{this.emitCommentsChange()},this.commentThreads.observeDeep(this.handleCommentThreadsChange),this.ytext?.observe?.(this.handleTextChange),this.emitCommentsChange()}unbind(){this.commentThreads&&this.handleCommentThreadsChange&&this.commentThreads.unobserveDeep(this.handleCommentThreadsChange),this.ytext&&this.handleTextChange&&this.ytext.unobserve(this.handleTextChange),this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}emitCommentsChange(){this.onCommentsChange?.(this.getCommentThreads())}refreshComments(){this.emitCommentsChange()}getCommentThreads(){return this.commentThreads?et(this.commentThreads).map(e=>this.resolveCommentThread(e)).filter(Boolean):[]}createCommentThread({anchor:e,body:t}){let n=this.getEditorState();if(!n||!this.commentThreads||!this.ytext||!this.ydoc)return null;let r=Qe(t),i=it(e,n);if(!r||!i)return null;let a=Ke({anchorEnd:E(j(this.ytext,i.endIndex)),anchorEndLine:i.anchorEndLine,anchorKind:i.anchorKind,anchorQuote:i.anchorQuote,anchorStart:E(j(this.ytext,i.startIndex)),anchorStartLine:i.anchorStartLine,createdAt:Date.now(),createdByColor:this.getLocalUser()?.color??``,createdByName:this.getLocalUser()?.name??`Anonymous`,createdByPeerId:this.getLocalUser()?.peerId??``,id:Ye(`thread`),messages:[tt({body:r,user:this.getLocalUser()})]});return a?(this.ydoc.transact(()=>{this.commentThreads.push([a])},`comment-thread-create`),a.get(`id`)):null}replyToCommentThread(e,t){let n=Qe(t);if(!n||!this.ydoc)return null;let r=this.findSharedCommentThread(e)?.get(`messages`);if(!(r instanceof Le))return null;let i=tt({body:n,user:this.getLocalUser()});return this.ydoc.transact(()=>{r.push([i])},`comment-thread-reply`),i.id}toggleCommentReaction(e,t,n){if(!this.ydoc||!e||!t||typeof n!=`string`||!n.trim())return!1;let r=this.getLocalUser?.(),i=typeof r?.userId==`string`?r.userId:``;if(!i)return!1;let a=this.findSharedCommentThread(e)?.get(`messages`);if(!(a instanceof Le))return!1;let o=a.toArray(),s=o.findIndex(e=>nt(e,`id`)===t);if(s<0)return!1;let c=o[s]instanceof k?o[s].toJSON():{...o[s]},l=rt(c.reactions),u=l.findIndex(e=>e.emoji===n);if(u>=0){let e=l[u].users.filter(e=>e.userId!==i);e.length===l[u].users.length&&e.push({reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}),e.length===0?l.splice(u,1):l[u]={...l[u],users:e}}else l.push({emoji:n,users:[{reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}]});let d={...c,reactions:l};return this.ydoc.transact(()=>{a.delete(s,1),a.insert(s,[d])},`comment-reaction-toggle`),!0}deleteCommentThread(e){if(!this.commentThreads||!this.ydoc)return!1;let t=this.findSharedCommentThreadIndex(e);return t<0?!1:(this.ydoc.transact(()=>{this.commentThreads.delete(t,1)},`comment-thread-resolve`),!0)}findSharedCommentThread(e){return this.commentThreads?this.commentThreads.toArray().find(t=>t instanceof k&&t.get(`id`)===e)??null:null}findSharedCommentThreadIndex(e){return this.commentThreads?this.commentThreads.toArray().findIndex(t=>t instanceof k&&t.get(`id`)===e):-1}resolveCommentThread(e){let t=this.getEditorState();if(!e||!t||!this.ydoc)return null;let n=Ze(e);if(!n)return null;let r=this.resolveCommentPosition(n.anchorStart),i=this.resolveCommentPosition(n.anchorEnd),a=r?.index??t.doc.line(n.anchorStartLine).from,o=Math.min(Math.max(n.anchorEndLine??n.anchorStartLine,n.anchorStartLine),t.doc.lines),s=i?.index??t.doc.line(o).to,c=t.doc.lineAt(a).number,l=Math.min(Math.max(s,a),t.doc.length),u=t.doc.lineAt(l).number,d=Je(t.doc.sliceString(a,n.anchorKind===`text`?Math.max(s,a):t.doc.line(u).to))||n.anchorQuote;return{...e,anchor:{endIndex:s,endLine:u,excerpt:d,quote:n.anchorQuote,startIndex:a,startLine:c,kind:n.anchorKind},anchorEnd:n.anchorEnd,anchorEndLine:n.anchorEndLine,anchorKind:n.anchorKind,anchorQuote:n.anchorQuote,anchorStart:n.anchorStart,anchorStartLine:n.anchorStartLine}}resolveCommentPosition(e){if(!e||!this.ydoc||!this.ytext)return null;try{let t=T(D(e),this.ydoc);return!t||t.type!==this.ytext?null:t}catch{return null}}},ot=class{constructor({localUser:e=null,onAwarenessChange:t=null,onConnectionChange:n=null,onInitialSync:r=null,preferredUserName:i,resolveAwarenessCursor:a=null}){this.onAwarenessChange=t,this.onConnectionChange=n,this.onInitialSync=r,this.preferredUserName=i,this.providedLocalUser=e,this.resolveAwarenessCursor=a??(()=>null),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc=null,this.ytext=null,this.commentThreads=null,this.wsBaseUrl=``,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.resolveInitialSync=null}normalizeViewport(e){if(!e||typeof e!=`object`)return null;let t=Number(e.topLine),n=Number(e.viewportRatio);return!Number.isFinite(t)||t<1?null:{topLine:Math.max(1,Math.round(t)),viewportRatio:Number.isFinite(n)?Math.min(Math.max(n,0),1):.35}}async initialize(e){this.wsBaseUrl=Ie(),this.ydoc=new Ue,this.ytext=this.ydoc.getText(`codemirror`),this.commentThreads=this.ydoc.getArray(`comments`);let t=new Ve(this.ytext),n=new He(this.wsBaseUrl,e,this.ydoc,{disableBc:!0,maxBackoffTime:5e3});Ge(n);let r=n.awareness,i=this.providedLocalUser??$e(this.preferredUserName);this.provider=n,this.awareness=r,this.localUser=i,this.initialSyncComplete=!1,this.initialSyncPromise=new Promise(e=>{this.resolveInitialSync=e}),r.setLocalStateField(`user`,i),r.on(`change`,()=>{this.onAwarenessChange?.(this.collectUsers(this.resolveAwarenessCursor))}),this.trackConnectionStatus();let a=!1;return n.on(`sync`,e=>{!e||a||(a=!0,this.initialSyncComplete=!0,this.resolveInitialSync?.(),this.resolveInitialSync=null,this.onInitialSync?.())}),{awareness:r,commentThreads:this.commentThreads,localUser:this.localUser,undoManager:t,ydoc:this.ydoc,ytext:this.ytext}}destroy(){this.resolveInitialSync?.(),this.resolveInitialSync=null,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc?.destroy(),this.ydoc=null,this.ytext=null,this.commentThreads=null}waitForInitialSync(e=1500){return this.initialSyncComplete?Promise.resolve():e==null||e===!1?this.initialSyncPromise:Promise.race([this.initialSyncPromise,new Promise(t=>{window.setTimeout(t,e)})])}getText(){return this.ytext?.toString()??``}getLocalUser(){return this.localUser}setUserName(e){let t=Xe(e);return!t||!this.awareness||!this.localUser?null:(this.localUser={...this.localUser,name:t},this.awareness.setLocalStateField(`user`,this.localUser),t)}getUserCursor(e,t){return this.awareness?t(this.awareness.getStates().get(e)?.cursor):null}getUserViewport(e){if(!this.awareness)return null;let t=this.awareness.getStates().get(e);return this.normalizeViewport(t?.viewport)}setLocalViewport(e){if(!this.awareness)return null;let t=this.normalizeViewport(e);return this.awareness.setLocalStateField(`viewport`,t),t}collectUsers(e=()=>null){if(!this.awareness)return[];let t=[];return this.awareness.getStates().forEach((n,r)=>{if(!n.user)return;let i=e(n.cursor);t.push({...i??{},...n.user,clientId:r,hasCursor:!!i,isLocal:r===this.awareness.clientID,viewport:this.normalizeViewport(n.viewport)})}),t}trackConnectionStatus(){if(!this.provider)return;let e=0,t=!1;this.provider.on(`status`,({status:n})=>{n===`connecting`&&(e+=1);let r=n===`connected`&&!t;n===`connected`&&(e=0,t=!0),this.onConnectionChange?.({attempts:e,firstConnection:r,hasEverConnected:t,status:n,unreachable:!t&&e>=3,wsBaseUrl:this.wsBaseUrl})})}};function M(e){return new le(ne.define(e))}function N(t){return e(()=>import(`./dist-BE8C_ouo.js`).then(e=>e.sql({dialect:e[t]})),__vite__mapDeps([0,1,2,3]),import.meta.url)}var st=[v.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return e(()=>import(`./dist-CQVTTk81.js`).then(e=>e.cpp()),__vite__mapDeps([4,2,3]),import.meta.url)}}),v.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return e(()=>import(`./dist-CQVTTk81.js`).then(e=>e.cpp()),__vite__mapDeps([4,2,3]),import.meta.url)}}),v.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return N(`Cassandra`)}}),v.of({name:`CSS`,extensions:[`css`],load(){return e(()=>import(`./dist-CcG3Y7Wp.js`).then(e=>e.css()),__vite__mapDeps([5,6,2,3]),import.meta.url)}}),v.of({name:`Go`,extensions:[`go`],load(){return e(()=>import(`./dist-v3i1ifes.js`).then(e=>e.go()),__vite__mapDeps([7,1,2,3]),import.meta.url)}}),v.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return e(()=>import(`./dist-DLyohOXi.js`).then(e=>e.html()),__vite__mapDeps([8,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`Java`,extensions:[`java`],load(){return e(()=>import(`./dist-DQiph4qx.js`).then(e=>e.java()),__vite__mapDeps([11,2,3]),import.meta.url)}}),v.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript()),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return e(()=>import(`./dist-DdAqzGFU.js`).then(e=>e.jinja()),__vite__mapDeps([13,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return e(()=>import(`./dist-DZ2t5lUX.js`).then(e=>e.json()),__vite__mapDeps([14,2,3]),import.meta.url)}}),v.of({name:`JSX`,extensions:[`jsx`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`LESS`,extensions:[`less`],load(){return e(()=>import(`./dist-DPCUH5MO.js`).then(e=>e.less()),__vite__mapDeps([15,6,2,3]),import.meta.url)}}),v.of({name:`Liquid`,extensions:[`liquid`],load(){return e(()=>import(`./dist-DWRyOl2w.js`).then(e=>e.liquid()),__vite__mapDeps([16,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`MariaDB SQL`,load(){return N(`MariaSQL`)}}),v.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return e(()=>import(`./dist-CghBwrO3.js`).then(e=>e.markdown()),__vite__mapDeps([17,18,1,2,9,6,3,10]),import.meta.url)}}),v.of({name:`MS SQL`,load(){return N(`MSSQL`)}}),v.of({name:`MySQL`,load(){return N(`MySQL`)}}),v.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return e(()=>import(`./dist-BPEi1dEF.js`).then(e=>e.php()),__vite__mapDeps([19,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`PLSQL`,extensions:[`pls`],load(){return N(`PLSQL`)}}),v.of({name:`PostgreSQL`,load(){return N(`PostgreSQL`)}}),v.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return e(()=>import(`./dist-BiCgLddE.js`).then(e=>e.python()),__vite__mapDeps([20,1,2,3]),import.meta.url)}}),v.of({name:`Rust`,extensions:[`rs`],load(){return e(()=>import(`./dist-aE0_04fl.js`).then(e=>e.rust()),__vite__mapDeps([21,2,3]),import.meta.url)}}),v.of({name:`Sass`,extensions:[`sass`],load(){return e(()=>import(`./dist-CBEw2W2P.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([22,6,2,3]),import.meta.url)}}),v.of({name:`SCSS`,extensions:[`scss`],load(){return e(()=>import(`./dist-CBEw2W2P.js`).then(e=>e.sass()),__vite__mapDeps([22,6,2,3]),import.meta.url)}}),v.of({name:`SQL`,extensions:[`sql`],load(){return N(`StandardSQL`)}}),v.of({name:`SQLite`,load(){return N(`SQLite`)}}),v.of({name:`TSX`,extensions:[`tsx`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return e(()=>import(`./dist-Csbx9lQ-.js`).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return e(()=>import(`./dist-BEKQo64E.js`).then(e=>e.wast()),__vite__mapDeps([23,2,3]),import.meta.url)}}),v.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return e(()=>import(`./dist-Dbg8P4C5.js`).then(e=>e.xml()),__vite__mapDeps([24,2,3]),import.meta.url)}}),v.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return e(()=>import(`./dist-BfVljg0L2.js`).then(e=>e.yaml()),__vite__mapDeps([25,26,2,3]),import.meta.url)}}),v.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return e(()=>import(`./apl-C1JYSI8J.js`).then(e=>M(e.apl)),[],import.meta.url)}}),v.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return e(()=>import(`./asciiarmor-DHW75j1s.js`).then(e=>M(e.asciiArmor)),[],import.meta.url)}}),v.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return e(()=>import(`./asn1-CQiG40kG.js`).then(e=>M(e.asn1({}))),[],import.meta.url)}}),v.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return e(()=>import(`./asterisk-BWExh0n4.js`).then(e=>M(e.asterisk)),[],import.meta.url)}}),v.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return e(()=>import(`./brainfuck-CTNFyOLg.js`).then(e=>M(e.brainfuck)),[],import.meta.url)}}),v.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return e(()=>import(`./cobol-DP4QggbL.js`).then(e=>M(e.cobol)),[],import.meta.url)}}),v.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.csharp)),[],import.meta.url)}}),v.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`ClojureScript`,extensions:[`cljs`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return e(()=>import(`./css-CmhPNxBE.js`).then(e=>M(e.gss)),[],import.meta.url)}}),v.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return e(()=>import(`./cmake-DtGL-Unu.js`).then(e=>M(e.cmake)),[],import.meta.url)}}),v.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return e(()=>import(`./coffeescript-B7GZajzV.js`).then(e=>M(e.coffeeScript)),[],import.meta.url)}}),v.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return e(()=>import(`./commonlisp-COlJYiQT.js`).then(e=>M(e.commonLisp)),[],import.meta.url)}}),v.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return e(()=>import(`./cypher-DEGl2llJ.js`).then(e=>M(e.cypher)),[],import.meta.url)}}),v.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return e(()=>import(`./python-BUyhM0Ew.js`).then(e=>M(e.cython)),[],import.meta.url)}}),v.of({name:`Crystal`,extensions:[`cr`],load(){return e(()=>import(`./crystal-I_dE9xG-.js`).then(e=>M(e.crystal)),[],import.meta.url)}}),v.of({name:`D`,extensions:[`d`],load(){return e(()=>import(`./d-BspB0dox.js`).then(e=>M(e.d)),[],import.meta.url)}}),v.of({name:`Dart`,extensions:[`dart`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.dart)),[],import.meta.url)}}),v.of({name:`diff`,extensions:[`diff`,`patch`],load(){return e(()=>import(`./diff-BWuPUsEo.js`).then(e=>M(e.diff)),[],import.meta.url)}}),v.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return e(()=>import(`./dockerfile-D8_6_FRV.js`).then(e=>M(e.dockerFile)),__vite__mapDeps([27,28]),import.meta.url)}}),v.of({name:`DTD`,extensions:[`dtd`],load(){return e(()=>import(`./dtd-C6brJFPg.js`).then(e=>M(e.dtd)),[],import.meta.url)}}),v.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return e(()=>import(`./dylan-Bft86ZSB.js`).then(e=>M(e.dylan)),[],import.meta.url)}}),v.of({name:`EBNF`,load(){return e(()=>import(`./ebnf-D6ifG44A.js`).then(e=>M(e.ebnf)),[],import.meta.url)}}),v.of({name:`ECL`,extensions:[`ecl`],load(){return e(()=>import(`./ecl-D9rhJ9-u.js`).then(e=>M(e.ecl)),[],import.meta.url)}}),v.of({name:`edn`,extensions:[`edn`],load(){return e(()=>import(`./clojure-D-DYVqu7.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Eiffel`,extensions:[`e`],load(){return e(()=>import(`./eiffel-DwxtewZF.js`).then(e=>M(e.eiffel)),[],import.meta.url)}}),v.of({name:`Elm`,extensions:[`elm`],load(){return e(()=>import(`./elm-B1TncobV.js`).then(e=>M(e.elm)),[],import.meta.url)}}),v.of({name:`Erlang`,extensions:[`erl`],load(){return e(()=>import(`./erlang-BDJZNtt8.js`).then(e=>M(e.erlang)),[],import.meta.url)}}),v.of({name:`Esper`,load(){return e(()=>import(`./sql-GL7dVWcd.js`).then(e=>M(e.esper)),[],import.meta.url)}}),v.of({name:`Factor`,extensions:[`factor`],load(){return e(()=>import(`./factor-Cz-hzBGH.js`).then(e=>M(e.factor)),__vite__mapDeps([29,28]),import.meta.url)}}),v.of({name:`FCL`,load(){return e(()=>import(`./fcl-CUXJFJn1.js`).then(e=>M(e.fcl)),[],import.meta.url)}}),v.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return e(()=>import(`./forth-nvhcMz63.js`).then(e=>M(e.forth)),[],import.meta.url)}}),v.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return e(()=>import(`./fortran-BZID-z10.js`).then(e=>M(e.fortran)),[],import.meta.url)}}),v.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.fSharp)),[],import.meta.url)}}),v.of({name:`Gas`,extensions:[`s`],load(){return e(()=>import(`./gas-DjQsZDGE.js`).then(e=>M(e.gas)),[],import.meta.url)}}),v.of({name:`Gherkin`,extensions:[`feature`],load(){return e(()=>import(`./gherkin-S0kHlzux.js`).then(e=>M(e.gherkin)),[],import.meta.url)}}),v.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return e(()=>import(`./groovy-Di--Vb9Z.js`).then(e=>M(e.groovy)),[],import.meta.url)}}),v.of({name:`Haskell`,extensions:[`hs`],load(){return e(()=>import(`./haskell-C6qH3-aI.js`).then(e=>M(e.haskell)),[],import.meta.url)}}),v.of({name:`Haxe`,extensions:[`hx`],load(){return e(()=>import(`./haxe-CcPA1xnA.js`).then(e=>M(e.haxe)),[],import.meta.url)}}),v.of({name:`HXML`,extensions:[`hxml`],load(){return e(()=>import(`./haxe-CcPA1xnA.js`).then(e=>M(e.hxml)),[],import.meta.url)}}),v.of({name:`HTTP`,load(){return e(()=>import(`./http-DG1Y9fpK.js`).then(e=>M(e.http)),[],import.meta.url)}}),v.of({name:`IDL`,extensions:[`pro`],load(){return e(()=>import(`./idl-B64p3NTJ.js`).then(e=>M(e.idl)),[],import.meta.url)}}),v.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return e(()=>import(`./javascript-qUBHINSy.js`).then(e=>M(e.jsonld)),__vite__mapDeps([30,31]),import.meta.url)}}),v.of({name:`Julia`,extensions:[`jl`],load(){return e(()=>import(`./julia-B22G9Bym.js`).then(e=>M(e.julia)),[],import.meta.url)}}),v.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.kotlin)),[],import.meta.url)}}),v.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return e(()=>import(`./livescript-CkcuHqeS.js`).then(e=>M(e.liveScript)),[],import.meta.url)}}),v.of({name:`Lua`,extensions:[`lua`],load(){return e(()=>import(`./lua-Cg0FqIlO.js`).then(e=>M(e.lua)),[],import.meta.url)}}),v.of({name:`mIRC`,extensions:[`mrc`],load(){return e(()=>import(`./mirc-BVG2S5rO.js`).then(e=>M(e.mirc)),[],import.meta.url)}}),v.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return e(()=>import(`./mathematica-CKVhKnoY.js`).then(e=>M(e.mathematica)),[],import.meta.url)}}),v.of({name:`Modelica`,extensions:[`mo`],load(){return e(()=>import(`./modelica-vJ-Qa9jV.js`).then(e=>M(e.modelica)),[],import.meta.url)}}),v.of({name:`MUMPS`,extensions:[`mps`],load(){return e(()=>import(`./mumps-D0KfUTSd.js`).then(e=>M(e.mumps)),[],import.meta.url)}}),v.of({name:`Mbox`,extensions:[`mbox`],load(){return e(()=>import(`./mbox-DANyzFJ2.js`).then(e=>M(e.mbox)),[],import.meta.url)}}),v.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return e(()=>import(`./nginx-DkVceJrH.js`).then(e=>M(e.nginx)),[],import.meta.url)}}),v.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return e(()=>import(`./nsis-QPGhLAeY.js`).then(e=>M(e.nsis)),__vite__mapDeps([32,28]),import.meta.url)}}),v.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return e(()=>import(`./ntriples-BBuCIfS0.js`).then(e=>M(e.ntriples)),[],import.meta.url)}}),v.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.objectiveC)),[],import.meta.url)}}),v.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.objectiveCpp)),[],import.meta.url)}}),v.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.oCaml)),[],import.meta.url)}}),v.of({name:`Octave`,extensions:[`m`],load(){return e(()=>import(`./octave-BTv2CqSQ.js`).then(e=>M(e.octave)),[],import.meta.url)}}),v.of({name:`Oz`,extensions:[`oz`],load(){return e(()=>import(`./oz-D8SjVDNU.js`).then(e=>M(e.oz)),[],import.meta.url)}}),v.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return e(()=>import(`./pascal-T-tfhVyx.js`).then(e=>M(e.pascal)),[],import.meta.url)}}),v.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return e(()=>import(`./perl-BDrCkHRd.js`).then(e=>M(e.perl)),[],import.meta.url)}}),v.of({name:`Pig`,extensions:[`pig`],load(){return e(()=>import(`./pig-BEyI4fPq.js`).then(e=>M(e.pig)),[],import.meta.url)}}),v.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return e(()=>import(`./powershell-DtnFc6GG.js`).then(e=>M(e.powerShell)),[],import.meta.url)}}),v.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return e(()=>import(`./properties-DWUvbxV9.js`).then(e=>M(e.properties)),[],import.meta.url)}}),v.of({name:`ProtoBuf`,extensions:[`proto`],load(){return e(()=>import(`./protobuf-CQGoYyfE.js`).then(e=>M(e.protobuf)),[],import.meta.url)}}),v.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return e(()=>import(`./pug-lkTEco3G.js`).then(e=>M(e.pug)),__vite__mapDeps([33,31]),import.meta.url)}}),v.of({name:`Puppet`,extensions:[`pp`],load(){return e(()=>import(`./puppet-Dd-qWO3p.js`).then(e=>M(e.puppet)),[],import.meta.url)}}),v.of({name:`Q`,extensions:[`q`],load(){return e(()=>import(`./q-Dls1OX0D.js`).then(e=>M(e.q)),[],import.meta.url)}}),v.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return e(()=>import(`./r-DeZ8Mdev.js`).then(e=>M(e.r)),[],import.meta.url)}}),v.of({name:`RPM Changes`,load(){return e(()=>import(`./rpm-CjWxLM68.js`).then(e=>M(e.rpmChanges)),[],import.meta.url)}}),v.of({name:`RPM Spec`,extensions:[`spec`],load(){return e(()=>import(`./rpm-CjWxLM68.js`).then(e=>M(e.rpmSpec)),[],import.meta.url)}}),v.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return e(()=>import(`./ruby-CB34f2Gf.js`).then(e=>M(e.ruby)),[],import.meta.url)}}),v.of({name:`SAS`,extensions:[`sas`],load(){return e(()=>import(`./sas-Bji4HDQq.js`).then(e=>M(e.sas)),[],import.meta.url)}}),v.of({name:`Scala`,extensions:[`scala`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.scala)),[],import.meta.url)}}),v.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return e(()=>import(`./scheme-C3elI80V.js`).then(e=>M(e.scheme)),[],import.meta.url)}}),v.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return e(()=>import(`./shell-DUveK2Hb.js`).then(e=>M(e.shell)),[],import.meta.url)}}),v.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return e(()=>import(`./sieve-2ogwMVx4.js`).then(e=>M(e.sieve)),[],import.meta.url)}}),v.of({name:`Smalltalk`,extensions:[`st`],load(){return e(()=>import(`./smalltalk-BuGhc6lW.js`).then(e=>M(e.smalltalk)),[],import.meta.url)}}),v.of({name:`Solr`,load(){return e(()=>import(`./solr-DTxshpm8.js`).then(e=>M(e.solr)),[],import.meta.url)}}),v.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return e(()=>import(`./mllike-C0p7lv48.js`).then(e=>M(e.sml)),[],import.meta.url)}}),v.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return e(()=>import(`./sparql-vm8qNO8J.js`).then(e=>M(e.sparql)),[],import.meta.url)}}),v.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return e(()=>import(`./spreadsheet-C6Vbtl9-.js`).then(e=>M(e.spreadsheet)),[],import.meta.url)}}),v.of({name:`Squirrel`,extensions:[`nut`],load(){return e(()=>import(`./clike-BFTLRaGS.js`).then(e=>M(e.squirrel)),[],import.meta.url)}}),v.of({name:`Stylus`,extensions:[`styl`],load(){return e(()=>import(`./stylus-D1SZIMDs.js`).then(e=>M(e.stylus)),[],import.meta.url)}}),v.of({name:`Swift`,extensions:[`swift`],load(){return e(()=>import(`./swift-CKcKnWv9.js`).then(e=>M(e.swift)),[],import.meta.url)}}),v.of({name:`sTeX`,load(){return e(()=>import(`./stex-CEwW0Q_0.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return e(()=>import(`./stex-CEwW0Q_0.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return e(()=>import(`./verilog-DSARZZPc.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`Tcl`,extensions:[`tcl`],load(){return e(()=>import(`./tcl-SPk7uiDB.js`).then(e=>M(e.tcl)),[],import.meta.url)}}),v.of({name:`Textile`,extensions:[`textile`],load(){return e(()=>import(`./textile-C48beRus.js`).then(e=>M(e.textile)),[],import.meta.url)}}),v.of({name:`TiddlyWiki`,load(){return e(()=>import(`./tiddlywiki-CiImjFLN.js`).then(e=>M(e.tiddlyWiki)),[],import.meta.url)}}),v.of({name:`Tiki wiki`,load(){return e(()=>import(`./tiki-HkXZ4BIW.js`).then(e=>M(e.tiki)),[],import.meta.url)}}),v.of({name:`TOML`,extensions:[`toml`],load(){return e(()=>import(`./toml-BmfpMy1_.js`).then(e=>M(e.toml)),[],import.meta.url)}}),v.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return e(()=>import(`./troff-BjbEOT5E.js`).then(e=>M(e.troff)),[],import.meta.url)}}),v.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return e(()=>import(`./ttcn-NA-V4KnY.js`).then(e=>M(e.ttcn)),[],import.meta.url)}}),v.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return e(()=>import(`./ttcn-cfg-TPHncdGN.js`).then(e=>M(e.ttcnCfg)),[],import.meta.url)}}),v.of({name:`Turtle`,extensions:[`ttl`],load(){return e(()=>import(`./turtle-BkP3ExOG.js`).then(e=>M(e.turtle)),[],import.meta.url)}}),v.of({name:`Web IDL`,extensions:[`webidl`],load(){return e(()=>import(`./webidl-DttrYZRT.js`).then(e=>M(e.webIDL)),[],import.meta.url)}}),v.of({name:`VB.NET`,extensions:[`vb`],load(){return e(()=>import(`./vb-C19AQWqO.js`).then(e=>M(e.vb)),[],import.meta.url)}}),v.of({name:`VBScript`,extensions:[`vbs`],load(){return e(()=>import(`./vbscript-CHJk3s95.js`).then(e=>M(e.vbScript)),[],import.meta.url)}}),v.of({name:`Velocity`,extensions:[`vtl`],load(){return e(()=>import(`./velocity-Ya0P4sQU.js`).then(e=>M(e.velocity)),[],import.meta.url)}}),v.of({name:`Verilog`,extensions:[`v`],load(){return e(()=>import(`./verilog-DSARZZPc.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return e(()=>import(`./vhdl-CnYyYTpa.js`).then(e=>M(e.vhdl)),[],import.meta.url)}}),v.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return e(()=>import(`./xquery-CEDTd8qs.js`).then(e=>M(e.xQuery)),[],import.meta.url)}}),v.of({name:`Yacas`,extensions:[`ys`],load(){return e(()=>import(`./yacas-C7dxlPB0.js`).then(e=>M(e.yacas)),[],import.meta.url)}}),v.of({name:`Z80`,extensions:[`z80`],load(){return e(()=>import(`./z80-BqEfFSnA.js`).then(e=>M(e.z80)),[],import.meta.url)}}),v.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.mscgen)),[],import.meta.url)}}),v.of({name:`Xù`,extensions:[`xu`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.xu)),[],import.meta.url)}}),v.of({name:`MsGenny`,extensions:[`msgenny`],load(){return e(()=>import(`./mscgen-vUD-SWGJ.js`).then(e=>M(e.msgenny)),[],import.meta.url)}}),v.of({name:`Vue`,extensions:[`vue`],load(){return e(()=>import(`./dist-B98fHn5m.js`).then(e=>e.vue()),__vite__mapDeps([34,9,6,2,3,10,1]),import.meta.url)}}),v.of({name:`Angular Template`,load(){return e(()=>import(`./dist-BOP-dC-R.js`).then(e=>e.angular()),__vite__mapDeps([35,9,6,2,3,10,1]),import.meta.url)}})],ct=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,P=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(ct(e)):ct,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=m(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ve(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(P.prototype[Symbol.iterator]=function(){return this});var lt={from:-1,to:-1,match:/.*/.exec(``),precise:!0},ut=`gm`+(/x/.unicode==null?``:`u`),dt=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=lt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new mt(e,t,n,r,i);this.re=new RegExp(t,ut+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=F(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=F(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},ft=new WeakMap,pt=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=ft.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return ft.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),ft.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},mt=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=lt,this.matchPos=F(e,r),this.re=new RegExp(t,ut+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=pt.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=F(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(dt.prototype[Symbol.iterator]=mt.prototype[Symbol.iterator]=function(){return this});function ht(e){try{return new RegExp(e,ut),!0}catch{return!1}}function F(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var gt=e=>{let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=t(e,{label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,u]=r,d=c?+c.slice(1):0,f=s?+s:a.number;if(s&&u){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),f=Math.round(n.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=n.doc.line(Math.max(1,Math.min(n.doc.lines,f))),m=y.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[i,l.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},_t={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},vt=w.define({combine(e){return p(e,_t,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function yt(e){let t=[Tt,wt];return e&&t.push(vt.of(e)),t}var bt=i.mark({class:`cm-selectionMatch`}),xt=i.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function St(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=C.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=C.Word)}function Ct(e,t,n,r){return e(t.sliceDoc(n,n+1))==C.Word&&e(t.sliceDoc(r-1,r))==C.Word}var wt=f.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(vt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return i.none;let a=r.main,o,s=null;if(a.empty){if(!t.highlightWordAroundCursor)return i.none;let e=n.wordAt(a.head);if(!e)return i.none;s=n.charCategorizer(a.head),o=n.sliceDoc(e.from,e.to)}else{let e=a.to-a.from;if(e<t.minSelectionLength||e>200)return i.none;if(t.wholeWords){if(o=n.sliceDoc(a.from,a.to),s=n.charCategorizer(a.head),!(St(s,n,a.from,a.to)&&Ct(s,n,a.from,a.to)))return i.none}else if(o=n.sliceDoc(a.from,a.to),!o)return i.none}let c=[];for(let r of e.visibleRanges){let e=new P(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||St(s,n,r,o))&&(a.empty&&r<=a.from&&o>=a.to?c.push(xt.range(r,o)):(r>=a.to||o<=a.from)&&c.push(bt.range(r,o)),c.length>t.maxMatches))return i.none}}return i.set(c)}},{decorations:e=>e.decorations}),Tt=l.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Et=({state:e,dispatch:t})=>{let{selection:n}=e,r=y.create(n.ranges.map(t=>e.wordAt(t.head)||y.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Dt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new P(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new P(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Ot=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Et({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Dt(e,r);return i?(t(e.update({selection:e.selection.addRange(y.range(i.from,i.to),!1),effects:l.scrollIntoView(i.to)})),!0):!1},I=w.define({combine(e){return p(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new $t(e),scrollToMatch:e=>l.scrollIntoView(e)})}}),kt=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||ht(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
3
- `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new It(this):new Nt(this)}getCursor(e,t=0,n){let r=e.doc?e:x.create({doc:e});return n??=r.doc.length,this.regexp?R(this,r,t,n):L(this,r,t,n)}},At=class{constructor(e){this.spec=e}};function jt(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function L(e,t,n,r){let i;return e.wholeWord&&(i=Mt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=jt(e.test,t,i)),new P(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Mt(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(z(i,n-a))!=C.Word||t(B(i,n-a))!=C.Word)&&(t(B(i,r-a))!=C.Word||t(z(i,r-a))!=C.Word))}var Nt=class extends At{constructor(e){super(e)}nextMatch(e,t,n){let r=L(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=L(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=L(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=L(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=L(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Pt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function R(e,t,n,r){let i;return e.wholeWord&&(i=Ft(t.charCategorizer(t.selection.main.head))),e.test&&(i=Pt(e.test,t,i)),new dt(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function z(e,t){return e.slice(_e(e,t,!1),t)}function B(e,t){return e.slice(t,_e(e,t))}function Ft(e){return(t,n,r)=>!r[0].length||(e(z(r.input,r.index))!=C.Word||e(B(r.input,r.index))!=C.Word)&&(e(B(r.input,r.index+r[0].length))!=C.Word||e(z(r.input,r.index+r[0].length))!=C.Word)}var It=class extends At{nextMatch(e,t,n){let r=R(this.spec,e,n,e.doc.length).next();return r.done&&(r=R(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=R(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=R(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=R(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},V=b.define(),Lt=b.define(),H=ee.define({create(e){return new Rt(qt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(V)?e=new Rt(n.value.create(),e.panel):n.is(Lt)&&(e=new Rt(e.query,n.value?Kt:null));return e},provide:e=>re.from(e,e=>e.panel)}),Rt=class{constructor(e,t){this.query=e,this.panel=t}},zt=i.mark({class:`cm-searchMatch`}),Bt=i.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Vt=f.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(H))}update(e){let t=e.state.field(H);(t!=e.startState.field(H)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return i.none;let{view:n}=this,r=new ce;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Bt:zt)})}return r.finish()}},{decorations:e=>e.decorations});function U(e){return t=>{let n=t.state.field(H,!1);return n&&n.query.spec.valid?e(t,n):Xt(t)}}var W=U((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=y.single(r.from,r.to),a=e.state.facet(I);return e.dispatch({selection:i,effects:[en(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Yt(e),!0}),G=U((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=y.single(i.from,i.to),o=e.state.facet(I);return e.dispatch({selection:a,effects:[en(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Yt(e),!0}),Ht=U((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:y.create(n.map(e=>y.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Ut=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new P(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(y.range(t.value.from,t.value.to))}return t(e.update({selection:y.create(a,o),userEvent:`select.search.matches`})),!0},Wt=U((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,u,d=[];o.precise?o.from==r&&o.to==i&&(u=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:u}),d.push(l.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(s);return o&&(c=y.single(o.from,o.to).map(f),d.push(en(e,o)),d.push(n.facet(I).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:`input.replace`}),!0}),Gt=U((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:l.announce.of(r),userEvent:`input.replace.all`}),!0});function Kt(e){return e.state.facet(I).createPanel(e)}function qt(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(I);return new kt({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Jt(e){let t=o(e,Kt);return t&&t.dom.querySelector(`[main-field]`)}function Yt(e){let t=Jt(e);t&&t==e.root.activeElement&&t.select()}var Xt=e=>{let t=e.state.field(H,!1);if(t&&t.panel){let n=Jt(e);if(n&&n!=e.root.activeElement){let r=qt(e.state,t.query.spec);r.valid&&e.dispatch({effects:V.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Lt.of(!0),t?V.of(qt(e.state,t.query.spec)):b.appendConfig.of(nn)]});return!0},Zt=e=>{let t=e.state.field(H,!1);if(!t||!t.panel)return!1;let n=o(e,Kt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Lt.of(!1)}),!0},Qt=[{key:`Mod-f`,run:Xt,scope:`editor search-panel`},{key:`F3`,run:W,shift:G,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:W,shift:G,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Zt,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Ut},{key:`Mod-Alt-g`,run:gt},{key:`Mod-d`,run:Ot,preventDefault:!0}],$t=class{constructor(e){this.view=e;let t=this.query=e.state.field(H).query.spec;this.commit=this.commit.bind(this),this.searchField=S(`input`,{value:t.search,placeholder:K(e,`Find`),"aria-label":K(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=S(`input`,{value:t.replace,placeholder:K(e,`Replace`),"aria-label":K(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=S(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=S(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=S(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return S(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=S(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>W(e),[K(e,`next`)]),n(`prev`,()=>G(e),[K(e,`previous`)]),n(`select`,()=>Ht(e),[K(e,`all`)]),S(`label`,null,[this.caseField,K(e,`match case`)]),S(`label`,null,[this.reField,K(e,`regexp`)]),S(`label`,null,[this.wordField,K(e,`by word`)]),...e.state.readOnly?[]:[S(`br`),this.replaceField,n(`replace`,()=>Wt(e),[K(e,`replace`)]),n(`replaceAll`,()=>Gt(e),[K(e,`replace all`)])],S(`button`,{name:`close`,onclick:()=>Zt(e),"aria-label":K(e,`close`),type:`button`},[`×`])])}commit(){let e=new kt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:V.of(e)}))}keydown(e){d(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?G:W)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Wt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(V)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I).top}};function K(e,t){return e.state.phrase(t)}var q=30,J=/[\s\.,:;?!]/;function en(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-q),o=Math.min(i,n+q),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<q;e++)if(!J.test(s[e+1])&&J.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-q;e--)if(!J.test(s[e-1])&&J.test(s[e])){s=s.slice(0,e);break}}return l.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var tn=l.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),nn=[H,ae.low(Vt),tn],rn=`#e5c07b`,an=`#e06c75`,on=`#56b6c2`,sn=`#ffffff`,Y=`#abb2bf`,cn=`#7d8799`,ln=`#61afef`,un=`#98c379`,dn=`#d19a66`,fn=`#c678dd`,pn=`#21252b`,mn=`#2c313a`,hn=`#282c34`,gn=`#353a42`,_n=`#3E4451`,vn=`#528bff`,yn=[l.theme({"&":{color:Y,backgroundColor:hn},".cm-content":{caretColor:vn},".cm-cursor, .cm-dropCursor":{borderLeftColor:vn},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:_n},".cm-panels":{backgroundColor:pn,color:Y},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:hn,color:cn,border:`none`},".cm-activeLineGutter":{backgroundColor:mn},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:gn},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:gn,borderBottomColor:gn},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:mn,color:Y}}},{dark:!0}),n(me.define([{tag:u.keyword,color:fn},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:an},{tag:[u.function(u.variableName),u.labelName],color:ln},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:dn},{tag:[u.definition(u.name),u.separator],color:Y},{tag:[u.typeName,u.className,u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:rn},{tag:[u.operator,u.operatorKeyword,u.url,u.escape,u.regexp,u.link,u.special(u.string)],color:on},{tag:[u.meta,u.comment],color:cn},{tag:u.strong,fontWeight:`bold`},{tag:u.emphasis,fontStyle:`italic`},{tag:u.strikethrough,textDecoration:`line-through`},{tag:u.link,color:cn,textDecoration:`underline`},{tag:u.heading,fontWeight:`bold`,color:an},{tag:[u.atom,u.bool,u.special(u.variableName)],color:dn},{tag:[u.processingInstruction,u.string,u.inserted],color:un},{tag:u.invalid,color:sn}]))],bn=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:E(this.yanchor),yhead:E(this.yhead)}}static fromJSON(t){return new e(D(t.yanchor),D(t.yhead))}},xn=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new Ve(e)}toYPos(e,t=0){return j(this.ytext,e,t)}fromYPos(e){let t=T(D(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new bn(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?y.cursor(n.pos,n.assoc):y.range(t.pos,n.pos)}},X=w.define({combine(e){return e[e.length-1]}}),Sn=fe.define(),Cn=class{constructor(e){this.view=e,this.conf=e.state.facet(X),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[Sn.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(Sn)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
4
- `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},wn=f.fromClass(Cn),Tn=l.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),En=fe.define(),Dn=class extends ye{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return Re(`span`,[O(`class`,`cm-ySelectionCaret`),O(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[A(`⁠`),Re(`div`,[O(`class`,`cm-ySelectionCaretDot`)]),A(`⁠`),Re(`div`,[O(`class`,`cm-ySelectionInfo`)],[A(this.name)]),A(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},On=class{constructor(e){this.conf=e.state.facet(X),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[En.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=ue.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,a=[],o=this.conf.awareness.getLocalState();if(o!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,a=o.cursor==null?null:D(o.cursor.anchor),s=o.cursor==null?null:D(o.cursor.head);if(i!=null){let e=j(t,i.anchor),n=j(t,i.head);(o.cursor==null||!We(a,e)||!We(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else o.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((o,s)=>{if(s===r.doc.clientID)return;let c=o.cursor;if(c==null||c.anchor==null||c.head==null)return;let l=T(c.anchor,n),u=T(c.head,n);if(l==null||u==null||l.type!==t||u.type!==t)return;let{color:d=`#30bced`,name:f=`Anonymous`}=o.user||{},p=o.user&&o.user.colorLight||d+`33`,m=ze(l.index,u.index),h=Be(l.index,u.index),g=e.view.state.doc.lineAt(m),_=e.view.state.doc.lineAt(h);if(g.number===_.number)a.push({from:m,to:h,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});else{a.push({from:m,to:g.from+g.length,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})}),a.push({from:_.from,to:h,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});for(let t=g.number+1;t<_.number;t++){let n=e.view.state.doc.line(t).from;a.push({from:n,to:n,value:i.line({attributes:{style:`background-color: ${p}`,class:`cm-yLineSelection`}})})}}a.push({from:u.index,to:u.index,value:i.widget({side:u.index-l.index>0?-1:1,block:!1,widget:new Dn(d,f)})})}),this.decorations=i.set(a,!0)}},kn=f.fromClass(On,{decorations:e=>e.decorations}),An=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},jn=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},Mn=w.define({combine(e){return e[e.length-1]}});fe.define();var Nn=class{constructor(e){this.view=e,this.conf=e.state.facet(Mn),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(X),this._beforeChangeSelection=null,this._mux=An(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[l.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(Sn)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Pn=f.fromClass(Nn),Fn=({state:e,dispatch:t})=>e.facet(Mn).undo()||!0,In=({state:e,dispatch:t})=>e.facet(Mn).redo()||!0,Ln=(e,t,{undoManager:n=new Ve(e)}={})=>{let r=new xn(e,t),i=[X.of(r),wn];return t&&i.push(Tn,kn),n!==!1&&i.push(Mn.of(new jn(n)),Pn,l.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?Fn(t):e.inputType===`historyRedo`?In(t):!1}})),i},Rn=Object.freeze({bold:`bold text`,code:`code`,italic:`emphasis`,strikethrough:`struck text`}),zn=`link text`,Bn=`https://`,Vn=`alt text`,Hn=`https://`,Un=`Video`,Wn=`https://`,Gn=`code`,Kn=Object.freeze([`Column 1`,`Column 2`]),qn=`Value`,Z=Object.freeze({heading:/^#{1,6}\s+/,quote:/^>\s+/,bulletList:/^[-*+]\s+/,numberedList:/^\d+\.\s+/,taskList:/^-\s\[(?: |x|X)\]\s+/});function Jn(e,t){return{from:Math.max(0,Math.min(e.from,e.to,t)),to:Math.max(0,Math.min(Math.max(e.from,e.to),t))}}function Yn(e,t){return t===0||e[t-1]===`
5
- `}function Xn(e,t){if(t<=0)return 0;let n=e.lastIndexOf(`
6
- `,t-1);return n<0?0:n+1}function Zn(e,t){let n=e.indexOf(`
7
- `,t);return n<0?e.length:n}function Qn(e,t){let{from:n}=t,{to:r}=t;return r>n&&Yn(e,r)&&--r,{from:Xn(e,n),to:Zn(e,Math.max(n,r))}}function $n(e,t,n,r){let i=e.slice(t.from,t.to);if(i.length>n.length*2&&i.startsWith(n)&&i.endsWith(n)){let e=i.slice(n.length,i.length-n.length);return{anchor:t.from,from:t.from,head:t.from+e.length,insert:e,to:t.to}}return i.length>0?{anchor:t.from+n.length,from:t.from,head:t.from+n.length+i.length,insert:`${n}${i}${n}`,to:t.to}:{anchor:t.from+n.length,from:t.from,head:t.from+n.length+r.length,insert:`${n}${r}${n}`,to:t.to}}function er(e){return/^https?:\/\//i.test(e.trim())}function tr(e,t){let n=e.slice(t.from,t.to);if(n.length>0&&er(n))return{anchor:t.from+1,from:t.from,head:t.from+1+9,insert:`[${zn}](${n})`,to:t.to};if(n.length>0){let e=`[${n}](`;return{anchor:t.from+e.length,from:t.from,head:t.from+e.length+8,insert:`${e}${Bn})`,to:t.to}}return{anchor:t.from+1,from:t.from,head:t.from+1+9,insert:`[${zn}](${Bn})`,to:t.to}}function nr(e,t){let n=e.slice(t.from,t.to);if(n.length>0&&er(n))return{anchor:t.from+2,from:t.from,head:t.from+2+8,insert:`![${Vn}](${n})`,to:t.to};if(n.length>0){let e=`![${n}](`;return{anchor:t.from+e.length,from:t.from,head:t.from+e.length+8,insert:`${e}${Hn})`,to:t.to}}return{anchor:t.from+2,from:t.from,head:t.from+2+8,insert:`![${Vn}](${Hn})`,to:t.to}}function rr(e,t){let n=e.slice(t.from,t.to);if(n.length>0&&er(n))return{anchor:t.from+2,from:t.from,head:t.from+2+5,insert:`![${Un}](${n})`,to:t.to};if(n.length>0){let e=`![${n}](`;return{anchor:t.from+e.length,from:t.from,head:t.from+e.length+8,insert:`${e}${Wn})`,to:t.to}}return{anchor:t.from+2,from:t.from,head:t.from+2+5,insert:`![${Un}](${Wn})`,to:t.to}}function ir(e){return Z.taskList.test(e)?e.replace(Z.taskList,``):Z.numberedList.test(e)?e.replace(Z.numberedList,``):Z.bulletList.test(e)?e.replace(Z.bulletList,``):Z.quote.test(e)?e.replace(Z.quote,``):Z.heading.test(e)?e.replace(Z.heading,``):e}function ar(e,t){switch(t){case`paragraph`:return!(Z.taskList.test(e)||Z.numberedList.test(e)||Z.bulletList.test(e)||Z.quote.test(e)||Z.heading.test(e));case`heading-1`:return/^#\s+/.test(e);case`heading-2`:return/^##\s+/.test(e);case`heading-3`:return/^###\s+/.test(e);case`heading-4`:return/^####\s+/.test(e);case`heading-5`:return/^#####\s+/.test(e);case`heading-6`:return/^######\s+/.test(e);case`quote`:return Z.quote.test(e);case`bullet-list`:return Z.bulletList.test(e)&&!Z.taskList.test(e);case`numbered-list`:return Z.numberedList.test(e);case`task-list`:return Z.taskList.test(e);default:return!1}}function or(e,t){switch(e){case`heading-1`:return`# `;case`heading-2`:return`## `;case`heading-3`:return`### `;case`heading-4`:return`#### `;case`heading-5`:return`##### `;case`heading-6`:return`###### `;case`quote`:return`> `;case`bullet-list`:return`- `;case`numbered-list`:return`${t+1}. `;case`task-list`:return`- [ ] `;default:return``}}function Q(e,t,n){let r=Qn(e,t),i=e.slice(r.from,r.to).split(`
8
- `),a=i.filter(e=>e.trim().length>0),o=n!==`paragraph`&&a.length>0&&a.every(e=>ar(e,n))?`paragraph`:n,s=0,c=i.map(e=>{if(e.trim().length===0)return e;let t=ir(e);if(o===`paragraph`)return t;let n=or(o,s);return s+=1,`${n}${t}`});return{anchor:r.from,from:r.from,head:r.from+c.join(`
9
- `).length,insert:c.join(`
10
- `),to:r.to}}function $(e,t,n){return Q(e,t,`heading-${n}`)}function sr(e,t){return Q(e,t,`bullet-list`)}function cr(e,t){return Q(e,t,`quote`)}function lr(e,t){return Q(e,t,`task-list`)}function ur(e,t){return Q(e,t,`numbered-list`)}function dr(e,t){let n=Qn(e,t),r=fr(e.slice(n.from,n.to));return r===null?Q(e,t,`paragraph`):{anchor:n.from,from:n.from,head:n.from+r.length,insert:r,to:n.to}}function fr(e){let t=e.replace(/\r\n/g,`
11
- `).match(/^```[^\n]*\n([\s\S]*?)\n```$/);return t?t[1]:null}function pr(e,t){let n=e.slice(t.from,t.to);if(n.length>0){let e=fr(n);return e===null?{anchor:t.from+4,from:t.from,head:t.from+4+n.length,insert:`\`\`\`\n${n}\n\`\`\``,to:t.to}:{anchor:t.from,from:t.from,head:t.from+e.length,insert:e,to:t.to}}return{anchor:t.from+4,from:t.from,head:t.from+4+4,insert:`\`\`\`\n${Gn}\n\`\`\``,to:t.to}}function mr(e,t,n,r,i=0){let a=t.from>0&&e[t.from-1]!==`
12
- `,o=t.to<e.length&&e[t.to]!==`
13
- `,s=a?`
14
- `:``,c=`${s}${n}${o?`
15
- `:``}`,l=t.from+s.length+r;return{anchor:l,from:t.from,head:l+i,insert:c,to:t.to}}function hr(e=``){let t=e.trim()||qn;return[`| ${Kn.join(` | `)} |`,`| --- | --- |`,`| ${t} | ${qn} |`].join(`
16
- `)}function gr(e,t){return mr(e,t,hr(e.slice(t.from,t.to)),2,Kn[0].length)}function _r(e,t){return mr(e,t,`---`,4,0)}function vr(e,t,n){let r=String(e??``),i=Jn(t,r.length),a;switch(n){case`bold`:a=$n(r,i,`**`,Rn.bold);break;case`italic`:a=$n(r,i,`_`,Rn.italic);break;case`strikethrough`:a=$n(r,i,`~~`,Rn.strikethrough);break;case`code`:a=$n(r,i,"`",Rn.code);break;case`link`:a=tr(r,i);break;case`image`:a=nr(r,i);break;case`video`:a=rr(r,i);break;case`paragraph`:a=dr(r,i);break;case`heading`:a=$(r,i,2);break;case`heading-1`:a=$(r,i,1);break;case`heading-2`:a=$(r,i,2);break;case`heading-3`:a=$(r,i,3);break;case`heading-4`:a=$(r,i,4);break;case`heading-5`:a=$(r,i,5);break;case`heading-6`:a=$(r,i,6);break;case`quote`:a=cr(r,i);break;case`bullet-list`:a=sr(r,i);break;case`numbered-list`:a=ur(r,i);break;case`task-list`:a=lr(r,i);break;case`code-block`:a=pr(r,i);break;case`table`:a=gr(r,i);break;case`horizontal-rule`:a=_r(r,i);break;default:return null}return a?r.slice(a.from,a.to)===a.insert?null:a:null}function yr(e){return t=>{let n=t.state.doc.lineAt(t.pos),r=n.text.slice(0,t.pos-n.from),i=r.lastIndexOf(`[[`);if(i===-1)return null;let a=r.slice(i+2);if(a.includes(`]]`))return null;let o=a.toLowerCase(),s=n.from+i+2,c=e().map(e=>{let t=e.replace(/\.md$/i,``);return{filePath:e,label:t,fileName:t.split(`/`).pop()}}).filter(({label:e,fileName:t})=>e.toLowerCase().includes(o)||t.toLowerCase().includes(o)).map(({label:e,fileName:t})=>({label:e,detail:e.includes(`/`)?` ${t}`:void 0,apply:(e,t,n,r)=>{let i=e.state.doc.toString(),a=r;i.slice(r,r+2)===`]]`&&(a=r+2),e.dispatch({changes:{from:n,to:a,insert:`${t.label}]]`},selection:{anchor:n+t.label.length+2}})},type:`text`,boost:+!!e.toLowerCase().startsWith(o)}));return c.length===0?null:{from:s,options:c,filter:!1}}}var br=new Set([`@startuml`,`@enduml`,`@startmindmap`,`@endmindmap`,`@startwbs`,`@endwbs`,`@startgantt`,`@endgantt`,`@startjson`,`@endjson`,`@startyaml`,`@endyaml`,`@startsalt`,`@endsalt`]),xr=new Set(`activate.actor.agent.allowmixing.alt.annotation.artifact.as.autonumber.boundary.box.break.caption.card.case.circle.class.cloud.collections.component.control.create.critical.database.deactivate.destroy.detach.else.elseif.end.endlegend.endif.endwhile.entity.enum.exception.file.folder.footer.fork.frame.group.header.hide.hnote.if.interface.json.kill.label.legend.loop.map.namespace.newpage.node.note.object.of.opt.order.over.package.page.par.participant.partition.person.port.protocol.queue.rectangle.ref.repeat.return.rnote.show.skinparam.split.stack.start.state.stop.storage.struct.switch.then.title.usecase.while`.split(`.`)),Sr=new Set([`false`,`no`,`off`,`on`,`true`,`yes`]);function Cr(e){let t=e.match(/[@!A-Za-z_][\w.-]*/u,!1);return t?(e.match(/[@!A-Za-z_][\w.-]*/u),t[0]):``}var wr=new le(ne.define({languageData:{commentTokens:{block:{close:`'/`,open:`/'`},line:`'`}},startState(){return{inBlockComment:!1}},token(e,t){if(t.inBlockComment)return e.skipTo(`'/`)?(e.match(`'/`),t.inBlockComment=!1):e.skipToEnd(),`comment`;if(e.eatSpace())return null;if(e.match(`/'`))return t.inBlockComment=!0,`comment`;let n=e.pos===0?` `:e.string.charAt(e.pos-1);if(e.peek()===`'`&&(e.sol()||/\s/u.test(n)))return e.skipToEnd(),`comment`;if(e.match(/"(?:[^"\\]|\\.)*"?/u))return`string`;if(e.match(/#[0-9a-f]{3,8}\b/iu)||e.match(/#[A-Za-z][\w-]*/u))return`atom`;if(e.match(/\b\d+(?:\.\d+)?\b/u))return`number`;if(e.match(/[<>{}[\]():,]/u))return`punctuation`;if(e.match(/[ox*+<#]?[-=.\\/]+(?:left|right|up|down)?[-=.\\/]*[ox*+>#]?/iu))return`operator`;let r=Cr(e);if(r){let e=r.toLowerCase();return e.startsWith(`!`)||br.has(e)?`meta`:xr.has(e)?`keyword`:Sr.has(e)?`bool`:/^[A-Z][A-Z0-9_]*$/u.test(r)?`typeName`:`variableName`}return e.next(),null}})),Tr=v.of({alias:[`plantuml`,`puml`],extensions:[`plantuml`,`puml`],name:`PlantUML`,support:wr});function Er(e){let t=Array.from(e?.clipboardData?.files??[]);for(let e of t)if(e?.type?.startsWith?.(`image/`))return e;let n=Array.from(e?.clipboardData?.items??[]);for(let e of n){if(e.kind!==`file`||!e.type?.startsWith?.(`image/`))continue;let t=e.getAsFile?.();if(t)return t}return null}function Dr(e,t){let n=Er(e);return n?typeof t==`function`?(console.debug(`[editor] Detected pasted image.`,{name:n.name??``,size:n.size??null,type:n.type??``}),e.preventDefault?.(),Promise.resolve(t(n)).catch(e=>{console.error(`[editor] Failed to process pasted image:`,e)}),!0):(console.warn(`[editor] Ignoring pasted image because no image paste handler is registered.`),!1):!1}var Or=[...st,Tr],kr=i.mark({class:`cm-matchingBracket cm-matchingBracket-paired`}),Ar=i.mark({class:`cm-nonmatchingBracket`}),jr=i.mark({class:`cm-remoteUpdateFlash`}),Mr=1350,Nr=160,Pr=900,Fr=/^(\s*(?:>\s*)*(?:[-+*]|\d+[.)])\s+\[)( |x|X)(\])(\s.*)?$/,Ir=Object.freeze({indentLess:Oe,indentMore:Ee,openSearch:Xt,redo:Me,undo:De}),Lr=class extends ye{toDOM(){let e=document.createElement(`span`);return e.className=`cm-remoteUpdateCaretWidget`,e.setAttribute(`aria-hidden`,`true`),e}ignoreEvent(){return!0}},Rr=b.define(),zr=b.define(),Br=ee.define({create:()=>i.none,update(e,t){let n=e.map(t.changes);return t.effects.forEach(e=>{if(e.is(zr)){n=i.none;return}if(e.is(Rr)){let{from:t,showCaret:r,to:a}=e.value,o=[];a>t&&o.push(jr.range(t,a)),r&&o.push(i.widget({side:-1,widget:new Lr}).range(t)),n=o.length>0?i.set(o,!0):i.none}}),n},provide:e=>l.decorations.from(e)});function Vr(e,t){return t.selection.ranges.some(t=>t.empty&&e.to===t.head)}function Hr(e,t){let n=[];if(!e.matched)return n.push(Ar.range(e.start.from,e.start.to)),e.end&&n.push(Ar.range(e.end.from,e.end.to)),n;let r=Vr(e.start,t),i=e.end?Vr(e.end,t):!1;return r||n.push(kr.range(e.start.from,e.start.to)),e.end&&!i&&n.push(kr.range(e.end.from,e.end.to)),n}function Ur(e){let t=e===`dark`?`oklch(from var(--color-surface-offset) l c h / 0.55)`:`oklch(from var(--color-surface-offset) l c h / 0.75)`,n=e===`dark`?`oklch(from var(--color-primary) l c h / 0.28)`:`oklch(from var(--color-primary) l c h / 0.18)`,r=e===`dark`?`oklch(from var(--color-primary) l c h / 0.4)`:`oklch(from var(--color-primary) l c h / 0.26)`,i=e===`dark`?`oklch(from var(--color-primary) l c h / 0.65)`:`oklch(from var(--color-primary) l c h / 0.5)`,a=e===`dark`?`color-mix(in oklab, var(--color-primary) 78%, white)`:`color-mix(in oklab, var(--color-primary) 84%, black)`,o=e===`dark`?`oklch(from var(--color-primary) l c h / 0.2)`:`oklch(from var(--color-primary) l c h / 0.12)`,s=e===`dark`?`oklch(from var(--color-primary) calc(l + 0.08) c h / 0.85)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.7)`,c=e===`dark`?`oklch(from var(--color-error) l c h / 0.12)`:`oklch(from var(--color-error) l c h / 0.1)`,u=e===`dark`?`oklch(from var(--color-error) calc(l + 0.08) c h / 0.8)`:`oklch(from var(--color-error) calc(l - 0.04) c h / 0.7)`;return l.theme({"&":{backgroundColor:`var(--color-bg)`,color:`var(--color-text)`},".cm-content":{caretColor:a,fontFamily:`var(--font-mono)`,padding:`16px 0`},".cm-cursor, .cm-dropCursor":{borderLeftColor:a,borderLeftWidth:`3px`,marginLeft:`-1px`},".cm-foldPlaceholder":{backgroundColor:`var(--color-surface-dynamic)`,border:`none`,color:`var(--color-text-muted)`},".cm-gutters":{backgroundColor:`var(--color-surface)`,borderRight:`1px solid var(--color-divider)`,color:`var(--color-text-muted)`,minWidth:`44px`},".cm-line":{padding:`0 16px`},".cm-activeLine":{backgroundColor:t,boxShadow:`inset 3px 0 0 ${n}`},".cm-activeLineGutter":{backgroundColor:t,boxShadow:`inset 3px 0 0 ${n}`,color:`var(--color-text-muted)`},".cm-matchingBracket":{borderRadius:`2px`,color:`inherit`},".cm-matchingBracket.cm-matchingBracket-paired":{backgroundColor:o,outline:`1px solid ${s}`},".cm-nonmatchingBracket":{backgroundColor:c,outline:`1px solid ${u}`,borderRadius:`2px`},".cm-selectionMatch":{backgroundColor:`var(--color-primary-highlight)`},".cm-remoteUpdateFlash":{animation:`collabmd-remote-update-flash 1.35s ease-out`,backgroundColor:e===`dark`?`oklch(from var(--color-primary) l c h / 0.22)`:`oklch(from var(--color-primary) l c h / 0.16)`,borderRadius:`3px`,boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.05) c h / 0.26)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.2)`}`},".cm-remoteUpdateCaretWidget":{animation:`collabmd-remote-update-caret 1s ease-out`,backgroundColor:`transparent`,borderLeft:`2px solid ${e===`dark`?`color-mix(in oklab, var(--color-primary) 78%, white)`:`color-mix(in oklab, var(--color-primary) 84%, black)`}`,borderRadius:`999px`,boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.06) c h / 0.22)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.16)`}`,display:`inline-block`,height:`1.2em`,marginLeft:`-1px`,marginRight:`-1px`,pointerEvents:`none`,transformOrigin:`center bottom`,verticalAlign:`text-bottom`,width:`0`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:r},"&.cm-focused .cm-selectionLayer .cm-selectionBackground":{border:`1px solid ${i}`,borderRadius:`2px`},"@keyframes collabmd-remote-update-flash":{"0%":{backgroundColor:e===`dark`?`oklch(from var(--color-primary) l c h / 0.34)`:`oklch(from var(--color-primary) l c h / 0.26)`},"100%":{backgroundColor:`oklch(from var(--color-primary) l c h / 0)`}},"@keyframes collabmd-remote-update-caret":{"0%":{boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.08) c h / 0.34)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.24)`}`,opacity:`0`,transform:`translateY(0.2em) scaleY(0.7)`},"18%":{opacity:`1`,transform:`translateY(0) scaleY(1)`},"72%":{opacity:`1`,transform:`translateY(0) scaleY(1)`},"100%":{boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.08) c h / 0)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0)`}`,opacity:`0`,transform:`translateY(-0.05em) scaleY(0.9)`}}},{dark:e===`dark`})}function Wr(e){return Pe(e)?wr:Fe(e)?Te():Ce({base:we,codeLanguages:Or})}function Gr(e){return{from:Math.min(...e.ranges.map(e=>Math.min(e.from,e.to))),to:Math.max(...e.ranges.map(e=>Math.max(e.from,e.to)))}}var Kr=class{constructor({editorContainer:e,getFileList:t,initialTheme:n,lineInfoElement:r,lineWrappingEnabled:i=!0,onDocChanged:a=null,onImagePaste:o=null,onSelectionChanged:s=null,onViewportChanged:c=null}){this.editorContainer=e,this.getFileList=t??(()=>[]),this.initialTheme=n,this.lineInfoElement=r,this.lineWrappingEnabled=i,this.onDocChanged=a,this.onImagePaste=o,this.onSelectionChanged=s,this.onViewportChanged=c,this.editorView=null,this.themeCompartment=new pe,this.syntaxThemeCompartment=new pe,this.lineWrappingCompartment=new pe,this.viewportFrame=0,this.remoteUpdateFlashTimer=0,this.lastLocalInputAt=0,this.handleScroll=()=>{this.viewportFrame||=requestAnimationFrame(()=>{this.viewportFrame=0,this.emitViewportChange()})},this.handleLocalInputActivity=()=>{this.lastLocalInputAt=Date.now()}}createUpdateListener(){return l.updateListener.of(e=>{e.docChanged&&this.onDocChanged?.(),(e.selectionSet||e.docChanged)&&(this.updateCursorInfo(e.state),this.onSelectionChanged?.(e.state))})}getBaseExtensions(e,{readOnly:t=!1}={}){let i=[s(),a(),c(),ke(),oe(),h(),x.allowMultipleSelections.of(!0),ge(),n(ie,{fallback:!0}),se({renderMatch:Hr}),Se(),xe({override:[yr(this.getFileList)]}),_(),r(),g(),yt(),de.of([...be,...Ne,...je,...Qt,...he,Ae]),l.contentAttributes.of({"aria-label":`Markdown editor`}),Wr(e),this.themeCompartment.of(Ur(this.initialTheme)),this.syntaxThemeCompartment.of(this.initialTheme===`dark`?yn:[]),this.lineWrappingCompartment.of(this.lineWrappingEnabled?l.lineWrapping:[]),Br,this.createUpdateListener()];return t?(i.push(x.readOnly.of(!0)),i.push(l.editable.of(!1)),i):(i.splice(13,0,ae.highest(l.domEventHandlers({paste:e=>Dr(e,this.onImagePaste)}))),i)}clearEditorDom({preserveLoadingIndicator:e=!0}={}){if(!this.editorContainer)return;let t=e?this.editorContainer.querySelector(`#editorLoading`):null;Array.from(this.editorContainer.children).forEach(e=>{e!==t&&e.remove()})}teardownEditorView({clearContainer:e=!1}={}){this.editorView?.contentDOM?.removeEventListener(`beforeinput`,this.handleLocalInputActivity),this.editorView?.contentDOM?.removeEventListener(`keydown`,this.handleLocalInputActivity),this.editorView?.contentDOM?.removeEventListener(`paste`,this.handleLocalInputActivity),this.editorView?.contentDOM?.removeEventListener(`compositionstart`,this.handleLocalInputActivity),this.editorView?.scrollDOM?.removeEventListener(`scroll`,this.handleScroll),this.editorView?.destroy(),this.editorView=null,e&&this.editorContainer&&(this.editorContainer.innerHTML=``,delete this.editorContainer.dataset.editorMode)}mountEditor(e,{editorMode:t=`collaborative`,preserveScrollTop:n=0}={}){this.clearEditorDom({preserveLoadingIndicator:!0}),this.teardownEditorView(),this.editorView=new l({parent:this.editorContainer,state:e}),this.editorContainer.dataset.editorMode=t,this.editorView.scrollDOM.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.editorView.contentDOM.addEventListener(`beforeinput`,this.handleLocalInputActivity),this.editorView.contentDOM.addEventListener(`keydown`,this.handleLocalInputActivity),this.editorView.contentDOM.addEventListener(`paste`,this.handleLocalInputActivity),this.editorView.contentDOM.addEventListener(`compositionstart`,this.handleLocalInputActivity),this.updateCursorInfo(this.editorView.state),this.onSelectionChanged?.(this.editorView.state),this.emitViewportChange(),n>0&&requestAnimationFrame(()=>{this.editorView?.scrollDOM&&(this.editorView.scrollDOM.scrollTop=n)})}initialize({awareness:e,filePath:t,undoManager:n,ytext:r}){let i=this.editorView?.scrollDOM?.scrollTop??0,a=x.create({doc:r.toString(),extensions:[...this.getBaseExtensions(t),Ln(r,e,{undoManager:n})]});this.mountEditor(a,{editorMode:`collaborative`,preserveScrollTop:i})}initializeProvisional({content:e=``,filePath:t}){let n=this.editorView?.scrollDOM?.scrollTop??0,r=x.create({doc:String(e??``),extensions:this.getBaseExtensions(t,{readOnly:!0})});this.mountEditor(r,{editorMode:`provisional`,preserveScrollTop:n})}destroy(){this.viewportFrame&&=(cancelAnimationFrame(this.viewportFrame),0),this.remoteUpdateFlashTimer&&=(clearTimeout(this.remoteUpdateFlashTimer),0),this.teardownEditorView({clearContainer:!0})}getText(){return this.editorView?.state.doc.toString()??``}getDoc(){return this.editorView?.state.doc??null}getState(){return this.editorView?.state??null}getScrollContainer(){return this.editorView?.scrollDOM??null}applyTheme(e){this.editorView&&this.editorView.dispatch({effects:[this.themeCompartment.reconfigure(Ur(e)),this.syntaxThemeCompartment.reconfigure(e===`dark`?yn:[])]})}isLineWrappingEnabled(){return this.lineWrappingEnabled}setLineWrapping(e){return this.lineWrappingEnabled=!!e,this.editorView&&this.editorView.dispatch({effects:this.lineWrappingCompartment.reconfigure(this.lineWrappingEnabled?l.lineWrapping:[])}),this.lineWrappingEnabled}requestMeasure(){this.editorView?.requestMeasure()}runEditorCommand(e){if(!this.editorView)return!1;let t=Ir[String(e??``)];if(typeof t!=`function`)return!1;let n=t(this.editorView);return n&&e!==`openSearch`&&this.editorView.focus(),n}flashRemoteRange({from:e=0,to:t=0}={},n=Mr){let r=this.editorView?.state;if(!r||r.doc.length===0)return!1;let i=Math.min(Math.max(Math.round(e),0),r.doc.length),a=Math.min(Math.max(Math.round(t),0),r.doc.length);if(a<=i)if(i<r.doc.length)a=i+1;else if(i>0)--i,a=i+1;else return!1;let o=Math.max(a-i,0)<=Nr&&Date.now()-this.lastLocalInputAt>Pr;return this.editorView.dispatch({effects:Rr.of({from:i,showCaret:o,to:a})}),this.remoteUpdateFlashTimer&&clearTimeout(this.remoteUpdateFlashTimer),this.remoteUpdateFlashTimer=window.setTimeout(()=>{this.remoteUpdateFlashTimer=0,this.editorView?.dispatch({effects:zr.of(null)})},n),!0}getViewportState(e=.35){return{topLine:this.getTopVisibleLineNumber(e),viewportRatio:e}}getTopVisibleLineNumber(e=0){if(!this.editorView)return 1;let t=this.editorView.scrollDOM.getBoundingClientRect(),n=Math.max(t.height*e,8),r=this.editorView.lineBlockAtHeight(t.top+n-this.editorView.documentTop);return r?this.editorView.state.doc.lineAt(r.from).number:1}getCurrentSelectionLineRange(){let e=this.editorView?.state;if(!e)return null;let{doc:t,selection:n}=e,{from:r,to:i}=Gr(n),a=t.lineAt(r).number,o=Math.min(Math.max(i,r),t.length);return o>r&&t.lineAt(o).from===o&&--o,{endLine:t.lineAt(o).number,startLine:a}}getCurrentSelectionCommentAnchor(){let e=this.editorView?.state;if(!e)return null;let{doc:t,selection:n}=e,{from:r,to:i}=Gr(n);if(r===i){let e=t.lineAt(r);return{anchorKind:`line`,anchorQuote:qe(e.text),endIndex:e.to,endLine:e.number,startIndex:e.from,startLine:e.number}}let a=Math.min(Math.max(i,r),t.length);return a>r&&t.lineAt(a).from===a&&--a,{anchorKind:`text`,anchorQuote:qe(t.sliceString(r,i)),endIndex:i,endLine:t.lineAt(a).number,startIndex:r,startLine:t.lineAt(r).number}}normalizeLineRange({endLine:e,startLine:t}){let n=this.editorView?.state;if(!n)return{endLine:1,startLine:1};let r=n.doc.lines,i=Math.min(Math.max(Math.round(t??1),1),r);return{endLine:Math.min(Math.max(Math.round(e??i),i),r),startLine:i}}getLineInfoAt(e){let t=this.editorView?.state;if(!t)return null;let n=Math.min(Math.max(e,0),t.doc.length),r=t.doc.lineAt(n);return{line:r,lineNumber:r.number}}getAnchorClientRect(e){let t=this.editorView?.state,n=this.editorView;if(!t||!n||!e)return null;let r=e.anchorKind||e.kind||`line`,i=Math.min(Math.max(Math.round(e.startIndex??0),0),t.doc.length),a=Math.min(Math.max(Math.round(e.endIndex??i),i),t.doc.length);if(r===`text`&&a>i){let e=n.coordsAtPos(i),t=n.coordsAtPos(Math.max(a-1,i));if(e&&t)return{bottom:Math.max(e.bottom,t.bottom),height:Math.max(e.bottom,t.bottom)-Math.min(e.top,t.top),left:Math.min(e.left,t.left),right:Math.max(e.right,t.right),top:Math.min(e.top,t.top),width:Math.max(e.right,t.right)-Math.min(e.left,t.left)}}let o=t.doc.line(Math.min(Math.max(Math.round(e.startLine??1),1),t.doc.lines)),s=n.lineBlockAt(o.from),c=n.scrollDOM.getBoundingClientRect(),l=n.scrollDOM.scrollTop,u=n.contentDOM.getBoundingClientRect(),d=u.left,f=Math.max(u.right,c.right-8),p=c.top+s.top-l;return{bottom:p+s.height,height:s.height,left:d,right:f,top:p,width:Math.max(f-d,0)}}getSelectionChipClientRect(e){let t=this.editorView?.state,n=this.editorView;if(!t||!n||!e)return null;let r=Math.min(Math.max(Math.round(e.startIndex??0),0),t.doc.length),i=t.doc.lineAt(r),a=n.lineBlockAt(i.from),o=n.scrollDOM.getBoundingClientRect(),s=n.scrollDOM.scrollTop,c=n.contentDOM.getBoundingClientRect(),l=Math.max(c.right,o.right-8),u=o.top+a.top-s;return{bottom:u+a.height,height:a.height,left:c.left,right:l,top:u,width:Math.max(l-c.left,0)}}scrollToLine(e,t=0){let n=this.editorView?.state,r=this.editorView?.scrollDOM;if(!n||!r||!this.editorView)return!1;let i=Math.min(Math.max(Math.round(e),1),n.doc.lines),a=n.doc.line(i),o=this.editorView.lineBlockAt(a.from),s=Math.max(r.scrollHeight-r.clientHeight,0),c=t>0?r.clientHeight*t:8,l=Math.min(Math.max(o.top-c,0),s);return r.scrollTo({top:l}),!0}scrollToPosition(e,t=`center`){let n=this.editorView?.state,r=this.editorView?.scrollDOM;if(!n||!r||!this.editorView)return!1;let i=Math.min(Math.max(Math.round(e),0),n.doc.length),a=this.editorView.lineBlockAt(i),o=Math.max(r.scrollHeight-r.clientHeight,0),s=a.top;return t===`center`&&(s=a.top-(r.clientHeight-a.height)/2),r.scrollTo({top:Math.min(Math.max(s,0),o)}),!0}applyMarkdownToolbarAction(e){if(!this.editorView)return!1;let{state:t}=this.editorView,n=t.doc.toString(),r=!1,i=t.changeByRange(t=>{let i=vr(n,t,e);return i?(r=!0,{changes:{from:i.from,insert:i.insert,to:i.to},range:y.range(i.anchor,i.head)}):{range:t}});return r?(this.editorView.dispatch(t.update(i,{scrollIntoView:!0,userEvent:`input`})),this.editorView.focus(),!0):!1}insertText(e){if(!this.editorView)return!1;let t=String(e??``),{state:n}=this.editorView,r=n.selection.main,i=r.from+t.length;return this.editorView.dispatch({changes:{from:r.from,insert:t,to:r.to},scrollIntoView:!0,selection:{anchor:i,head:i},userEvent:`input`}),this.editorView.focus(),!0}replaceText(e){if(!this.editorView)return!1;let t=String(e??``),{state:n}=this.editorView;return this.editorView.dispatch({changes:{from:0,insert:t,to:n.doc.length},selection:{anchor:0,head:0},userEvent:`input`}),this.editorView.focus(),!0}toggleTaskListItem(e){let t=this.editorView?.state;if(!this.editorView||!t)return!1;let n=Number.parseInt(String(e??``),10);if(!Number.isFinite(n))return!1;let r=Math.min(Math.max(n,1),t.doc.lines),i=t.doc.line(r),a=Fr.exec(i.text);if(!a)return!1;let[,o,s]=a,c=i.from+o.length,l=s===` `?`x`:` `;return this.editorView.dispatch({changes:{from:c,insert:l,to:c+1},userEvent:`input`}),!0}updateCursorInfo(e){if(!this.lineInfoElement)return;let t=e.selection.main.head,n=e.doc.lineAt(t),r=t-n.from+1;this.lineInfoElement.textContent=`Ln ${n.number}, Col ${r}`}emitViewportChange(){this.onViewportChanged?.(this.getViewportState())}},qr=class{constructor({editorContainer:e,lineWrappingEnabled:t=!0,initialTheme:n,lineInfoElement:r,onAwarenessChange:i,onConnectionChange:a,onCommentsChange:o,onContentChange:s,onImagePaste:c,onSelectionChange:l,preferredUserName:u,localUser:d,getFileList:f}){this.onAwarenessChange=i,this.onCommentsChange=o,this.onContentChange=s,this.onSelectionChange=l,this.activeFilePath=``,this.bootstrapContent=null,this.pendingCollaborativeBindings=null,this.hasDeliveredContent=!1,this.lastDeliveredContent=null,this.collaborationClient=new ot({localUser:d,onAwarenessChange:e=>this.onAwarenessChange?.(e),onConnectionChange:a,onInitialSync:()=>this.emitContentChange(),preferredUserName:u,resolveAwarenessCursor:e=>this.resolveAwarenessCursor(e)}),this.viewAdapter=new Kr({editorContainer:e,getFileList:f||(()=>[]),initialTheme:n,lineInfoElement:r,lineWrappingEnabled:t,onDocChanged:()=>{this.emitContentChange()},onImagePaste:c,onViewportChanged:e=>{this.collaborationClient.setLocalViewport(e)},onSelectionChanged:()=>{this.onSelectionChange?.(this.getCurrentSelectionCommentAnchor())}}),this.commentThreadStore=new at({getDoc:()=>this.collaborationClient.ydoc,getEditorState:()=>this.viewAdapter.getState(),getLocalUser:()=>this.collaborationClient.getLocalUser(),onCommentsChange:e=>this.onCommentsChange?.(e)})}async initialize(e){this.activeFilePath=e,this.hasDeliveredContent=!1,this.lastDeliveredContent=null;let t=await this.collaborationClient.initialize(e);this.commentThreadStore.bind({commentThreads:t.commentThreads,ydoc:t.ydoc,ytext:t.ytext}),this.pendingCollaborativeBindings=t,this.collaborationClient.initialSyncComplete&&this.activateCollaborativeView(),this.onAwarenessChange?.(this.collaborationClient.collectUsers(e=>this.resolveAwarenessCursor(e)))}activateCollaborativeView(){return this.pendingCollaborativeBindings?(this.viewAdapter.initialize({awareness:this.pendingCollaborativeBindings.awareness,filePath:this.activeFilePath,undoManager:this.pendingCollaborativeBindings.undoManager,ytext:this.pendingCollaborativeBindings.ytext}),this.commentThreadStore.refreshComments(),this.pendingCollaborativeBindings=null,this.bootstrapContent=null,!0):!1}showBootstrapContent({content:e=``,filePath:t=this.activeFilePath}={}){return this.collaborationClient.initialSyncComplete?!1:(this.activeFilePath=t,this.bootstrapContent=String(e??``),this.viewAdapter.initializeProvisional({content:this.bootstrapContent,filePath:this.activeFilePath}),this.commentThreadStore.refreshComments(),this.emitContentChange())}hasBootstrapContent(){return this.bootstrapContent!==null}emitContentChange({force:e=!1}={}){let t=this.getText();return!e&&this.hasDeliveredContent&&t===this.lastDeliveredContent?!1:(this.hasDeliveredContent=!0,this.lastDeliveredContent=t,this.onContentChange?.(),!0)}ensureInitialContent(){return this.emitContentChange()}applyTheme(e){this.viewAdapter.applyTheme(e)}getText(){return this.collaborationClient.getText()||this.viewAdapter.getText()}getScrollContainer(){return this.viewAdapter.getScrollContainer()}getTopVisibleLineNumber(e=0){return this.viewAdapter.getTopVisibleLineNumber(e)}getLocalUser(){return this.collaborationClient.getLocalUser()}get awareness(){return this.collaborationClient.awareness}get provider(){return this.collaborationClient.provider}get ydoc(){return this.collaborationClient.ydoc}get ytext(){return this.collaborationClient.ytext}getCurrentSelectionLineRange(){return this.viewAdapter.getCurrentSelectionLineRange()}getCurrentSelectionCommentAnchor(){return this.viewAdapter.getCurrentSelectionCommentAnchor()}getCommentAnchorClientRect(e){return this.viewAdapter.getAnchorClientRect(e)}getSelectionChipClientRect(e){return this.viewAdapter.getSelectionChipClientRect(e)}getCommentThreads(){return this.commentThreadStore.getCommentThreads()}createCommentThread(e){return this.commentThreadStore.createCommentThread(e)}replyToCommentThread(e,t){return this.commentThreadStore.replyToCommentThread(e,t)}toggleCommentReaction(e,t,n){return this.commentThreadStore.toggleCommentReaction(e,t,n)}deleteCommentThread(e){return this.commentThreadStore.deleteCommentThread(e)}isLineWrappingEnabled(){return this.viewAdapter.isLineWrappingEnabled()}setLineWrapping(e){return this.viewAdapter.setLineWrapping(e)}scrollToLine(e,t=0){return this.viewAdapter.scrollToLine(e,t)}getUserCursor(e){return this.collaborationClient.getUserCursor(e,e=>this.resolveAwarenessCursor(e))}getUserViewport(e){return this.collaborationClient.getUserViewport(e)}scrollToPosition(e,t=`center`){return this.viewAdapter.scrollToPosition(e,t)}scrollToUserViewport(e){let t=this.getUserViewport(e);return t?this.scrollToLine(t.topLine,t.viewportRatio):!1}scrollToUserCursor(e,t=`center`){let n=this.getUserCursor(e);return n?this.scrollToPosition(n.cursorHead,t)||this.scrollToLine(n.cursorLine):!1}setUserName(e){return this.collaborationClient.setUserName(e)}requestMeasure(){this.viewAdapter.requestMeasure()}runEditorCommand(e){return this.viewAdapter.runEditorCommand(e)}applyMarkdownToolbarAction(e){return this.viewAdapter.applyMarkdownToolbarAction(e)}insertText(e){return this.viewAdapter.insertText(e)}replaceText(e){return this.viewAdapter.replaceText(e)}toggleTaskListItem(e){return this.collaborationClient.initialSyncComplete?this.viewAdapter.toggleTaskListItem(e):!1}flashExternalUpdate(e){return this.viewAdapter.flashRemoteRange(e)}waitForInitialSync(e=1500){return this.collaborationClient.waitForInitialSync(e)}destroy(){this.commentThreadStore.unbind(),this.activeFilePath=``,this.bootstrapContent=null,this.pendingCollaborativeBindings=null,this.hasDeliveredContent=!1,this.lastDeliveredContent=null,this.collaborationClient.destroy(),this.viewAdapter.destroy()}resolveAwarenessCursor(e){let t=this.collaborationClient.ydoc,n=this.collaborationClient.ytext,r=this.viewAdapter.getState();if(!e?.anchor||!e?.head||!t||!r||!n)return null;let i=T(e.anchor,t),a=T(e.head,t);if(!i||!a||i.type!==n||a.type!==n)return null;let o=r.doc.lineAt(a.index);return{cursorAnchor:i.index,cursorHead:a.index,cursorLine:o.number}}};export{qr as EditorSession};