@netnodeag/kraftwerk 0.32.1 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cli/doctor.js +2 -3
  2. package/dist/cli/kraftwerk.js +3 -0
  3. package/dist/cli/projects.d.ts +2 -0
  4. package/dist/cli/projects.js +148 -0
  5. package/dist/cli/ui.js +28 -11
  6. package/dist/config.d.ts +2 -0
  7. package/dist/config.js +2 -1
  8. package/dist/inspector/instances.d.ts +104 -1
  9. package/dist/inspector/instances.js +376 -15
  10. package/dist/inspector/self-command.d.ts +15 -0
  11. package/dist/inspector/self-command.js +18 -0
  12. package/dist/inspector/server.js +60 -7
  13. package/inspector/dist/assets/{editor-DhNlc5vd.js → editor-CXrDJOv_.js} +3 -3
  14. package/inspector/dist/assets/{index-Dgi1UC16.js → index-7J4zAS6J.js} +1 -1
  15. package/inspector/dist/assets/index-B7rwNdVj.css +1 -0
  16. package/inspector/dist/assets/index-BBGjdXk1.js +213 -0
  17. package/inspector/dist/assets/{index-2RQVAOu3.js → index-BIDsfw8C.js} +1 -1
  18. package/inspector/dist/assets/{index-xM_-dBjg.js → index-BNcXQYbv.js} +1 -1
  19. package/inspector/dist/assets/{index-DmZE5psD.js → index-BQMgADlc.js} +1 -1
  20. package/inspector/dist/assets/{index-C22iDz8w.js → index-BULB2rC_.js} +1 -1
  21. package/inspector/dist/assets/{index-DYnto4lP.js → index-Bumwg9SM.js} +1 -1
  22. package/inspector/dist/assets/{index-BmdO9i46.js → index-BxEG-IdY.js} +1 -1
  23. package/inspector/dist/assets/{index-CT73nPrH.js → index-C3hpUVfp.js} +1 -1
  24. package/inspector/dist/assets/{index-CK6xHVuA.js → index-CMMYSoL3.js} +1 -1
  25. package/inspector/dist/assets/{index-BvrVgIw_.js → index-CNJyAniG.js} +1 -1
  26. package/inspector/dist/assets/{index-CWIXOY1D.js → index-CUCCMUMY.js} +1 -1
  27. package/inspector/dist/assets/{index-BWQugB-m.js → index-ChuqpBnv.js} +1 -1
  28. package/inspector/dist/assets/{index-BanLa7PQ.js → index-CszaAR9T.js} +1 -1
  29. package/inspector/dist/assets/{index-Dx4HOh5k.js → index-DAi1VtJ8.js} +1 -1
  30. package/inspector/dist/assets/{index--vNjDAEm.js → index-DrSWAGft.js} +1 -1
  31. package/inspector/dist/assets/{index-Hlokid_B.js → index-Upf-BEsx.js} +1 -1
  32. package/inspector/dist/assets/{index-C9y82Xkr.js → index-x5G6Np7T.js} +1 -1
  33. package/inspector/dist/index.html +2 -2
  34. package/package.json +1 -1
  35. package/inspector/dist/assets/index-IK4Vsg-q.js +0 -213
  36. package/inspector/dist/assets/index-iGaBYIin.css +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Hlokid_B.js","assets/index-IK4Vsg-q.js","assets/index-iGaBYIin.css","assets/index-xM_-dBjg.js","assets/index-BWQugB-m.js","assets/index-C9y82Xkr.js","assets/index-BanLa7PQ.js","assets/index-CT73nPrH.js","assets/index-C22iDz8w.js","assets/index-Dx4HOh5k.js","assets/index-DmZE5psD.js","assets/index-BvrVgIw_.js","assets/index-CWIXOY1D.js","assets/index--vNjDAEm.js","assets/index-Dgi1UC16.js","assets/index-2RQVAOu3.js","assets/index-DYnto4lP.js","assets/dockerfile-BKs6k2Af.js","assets/simple-mode-GW_nhZxv.js","assets/factor-kuTfRLto.js","assets/nsis-LY0VT_u5.js","assets/pug-DeIclll2.js","assets/javascript-iXu5QeM3.js","assets/index-CK6xHVuA.js","assets/index-BmdO9i46.js"])))=>i.map(i=>d[i]);
2
- var Gw=t=>{throw TypeError(t)};var Kw=(t,e,n)=>e.has(t)||Gw("Cannot "+n);var Fn=(t,e,n)=>(Kw(t,e,"read from private field"),n?n.call(t):e.get(t)),Jw=(t,e,n)=>e.has(t)?Gw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),MO=(t,e,n,r)=>(Kw(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);import{r as C,R as _,j as V,a as b6,g as wE,b as Vc,_ as W,s as ek,I as tk,n as v6}from"./index-IK4Vsg-q.js";var S6=Object.defineProperty,w6=(t,e,n)=>e in t?S6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Co=(t,e,n)=>w6(t,typeof e!="symbol"?e+"":e,n);let k6=class kE{constructor(e=new Map){this.map=e}clone(){return new kE(new Map(this.map))}increment(e){const n=this.map.get(e)??0;this.map.set(e,n+1)}decrement(e,n){let r=this.map.get(e);r!==void 0&&(r-=1,this.map.set(e,r),r===0&&n())}};class Kh{constructor(){Co(this,"map",new Map)}getOrCreate(e){let n=this.map.get(e);return n===void 0&&(n=new Set,this.map.set(e,n)),n}get(e){return this.map.get(e)}use(e,n){const r=this.get(e);r!==void 0&&n(r)}delete(e){return this.map.delete(e)}}function Wa(t,e){return e(t),t}function wb(){}const CE="cell";function nk(t,e){return t===e}const hm=new Map;let C6=class{constructor(e={}){Co(this,"subscriptions",new Kh),Co(this,"singletonSubscriptions",new Map),Co(this,"graph",new Kh),Co(this,"state",new Map),Co(this,"distinctNodes",new Map),Co(this,"executionMaps",new Map),Co(this,"definitionRegistry",new Set),Co(this,"combinedCells",[]);for(const n of Object.getOwnPropertySymbols(e))this.state.set(n,e[n])}cellInstance(e,n=!0,r=Symbol()){return this.state.has(r)||this.state.set(r,e),n!==!1&&!this.distinctNodes.has(r)&&this.distinctNodes.set(r,n===!0?nk:n),r}signalInstance(e=!0,n=Symbol()){return e!==!1&&this.distinctNodes.set(n,e===!0?nk:e),n}sub(e,n){this.register(e);const r=this.subscriptions.getOrCreate(e);return r.add(n),()=>r.delete(n)}singletonSub(e,n){return this.register(e),n===void 0?this.singletonSubscriptions.delete(e):this.singletonSubscriptions.set(e,n),()=>this.singletonSubscriptions.delete(e)}resetSingletonSubs(){this.singletonSubscriptions.clear()}subMultiple(e,n){const r=this.signalInstance();return this.connect({map:i=>(...o)=>{i(o)},sink:r,sources:e}),this.sub(r,n)}pubIn(e){var n;const r=Reflect.ownKeys(e),i=this.getExecutionMap(r),o=i.refCount.clone(),s=i.participatingNodes.slice(),l=new Map(this.state),a=c=>{this.graph.use(c,u=>{for(const{sources:f,sink:h}of u)f.has(c)&&o.decrement(h,()=>{s.splice(s.indexOf(h),1),a(h)})})};for(;;){const c=s.shift();if(c===void 0)break;const u=c;let f=!1;const h=d=>{const p=this.distinctNodes.get(u);if(p!=null&&p(l.get(u),d)){f=!1;return}f=!0,l.set(u,d),this.state.has(u)&&this.state.set(u,d)};if(Object.prototype.hasOwnProperty.call(e,u)?h(e[u]):i.projections.use(u,d=>{for(const p of d){const g=[...Array.from(p.sources),...Array.from(p.pulls)].map(m=>l.get(m));p.map(h)(...g)}}),f){const d=l.get(u);this.inContext(()=>{this.subscriptions.use(u,p=>{for(const g of p)g(d)})}),(n=this.singletonSubscriptions.get(u))==null||n(d)}else a(u)}}connect({sources:e,pulls:n=[],map:r,sink:i}){const o={map:r,pulls:new Set(n),sink:this.register(i),sources:new Set(e)};for(const s of[...e,...n])this.register(s),this.graph.getOrCreate(s).add(o);this.executionMaps.clear()}pub(e,n){this.pubIn({[e]:n})}pipe(e,...n){return this.combineOperators(...n)(e)}transformer(...e){return n=>Wa(this.signalInstance(),r=>(this.link(this.pipe(r,...e),n),r))}link(e,n){this.connect({map:r=>i=>{r(i)},sink:n,sources:[e]})}combine(...e){return Wa(this.signalInstance(),n=>{this.connect({map:r=>(...i)=>{r(i)},sink:n,sources:e})})}combineCells(...e){const n=this.combinedCells.find(i=>e.length===i.sources.length&&e.every((o,s)=>o===i.sources[s]));if(n)return n.cell;const r=this.cellInstance(e.map(i=>this.getValue(i)),!0);return this.connect({map:i=>(...o)=>{i(o)},sink:r,sources:e}),this.combinedCells.push({sources:e,cell:r}),r}getValue(e){return this.register(e),this.state.get(e)}getValues(e){return e.map(n=>this.getValue(n))}register(e){const n=hm.get(e);return n===void 0||this.definitionRegistry.has(e)?e:(this.definitionRegistry.add(e),Wa(n.type===CE?this.cellInstance(n.initial,n.distinct,e):this.signalInstance(n.distinct,e),r=>{this.inContext(()=>{n.init(this,r)})}))}inContext(e){return e()}changeWith(e,n,r){this.connect({sources:[n],pulls:[e],sink:e,map:i=>(o,s)=>{i(r(s,o))}})}calculateExecutionMap(e){const n=[],r=new Set,i=new Kh,o=new k6,s=new Kh,l=(a,c=0)=>{o.increment(a),!r.has(a)&&(this.register(a),i.use(a,u=>{c=Math.max(...Array.from(u).map(f=>n.indexOf(f)))+1}),this.graph.use(a,u=>{for(const f of u)f.sources.has(a)?(s.getOrCreate(f.sink).add(f),l(f.sink,c)):i.getOrCreate(f.sink).add(a)}),r.add(a),n.splice(c,0,a))};return e.forEach(l),{participatingNodes:n,pendingPulls:i,projections:s,refCount:o}}getExecutionMap(e){let n=e;if(e.length===1){n=e[0];const i=this.executionMaps.get(n);if(i!==void 0)return i}else for(const[i,o]of this.executionMaps.entries())if(Array.isArray(i)&&i.length===e.length&&i.every(s=>e.includes(s)))return o;const r=this.calculateExecutionMap(e);return this.executionMaps.set(n,r),r}combineOperators(...e){return n=>{for(const r of e)n=r(n,this);return n}}};function we(t,e=wb,n=!0){return Wa(Symbol(),r=>{hm.set(r,{type:CE,distinct:n,initial:t,init:e})})}function Nn(t=wb,e=!1){return Wa(Symbol(),n=>{hm.set(n,{type:"signal",distinct:e,init:t})})}function Bc(t=wb){return Wa(Symbol(),e=>{hm.set(e,{type:"signal",distinct:!1,init:t})})}const _E=C.createContext(null);function yh(){const t=C.useContext(_E);if(t===null)throw new Error("useRealm must be used within a RealmContextProvider");return t}function wn(t){const e=yh();e.register(t);const n=C.useCallback(r=>e.sub(t,r),[e,t]);return C.useSyncExternalStore(n,()=>e.getValue(t),()=>e.getValue(t))}function Vn(...t){const e=yh(),n=C.useMemo(()=>e.combineCells.apply(e,t),[e,...t]);return wn(n)}function Zt(t){const e=yh();return e.register(t),C.useCallback(n=>{e.pub(t,n)},[e,t])}function Rl(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:i=>o=>{i(t(o))},sink:r,sources:[e]}),r}}function rn(...t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:i=>(...o)=>{i(o)},pulls:t,sink:r,sources:[e]}),r}}function dm(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:i=>o=>{t(o)&&i(o)},sink:r,sources:[e]}),r}}function TE(t,e){return(n,r)=>{const i=r.signalInstance();return r.connect({map:o=>s=>{o(e=t(e,s))},sink:i,sources:[n]}),i}}const Zp=new WeakMap;function rk(t,e){let n=Zp.get(t);return n||(n=new Set,Zp.set(t,n)),n.add(e),()=>{n.delete(e)}}function ik(t){const e=Zp.get(t);if(Zp.delete(t),!e)return;let n=!1,r;for(const i of[...e].reverse())try{i()}catch(o){n||(n=!0,r=o)}if(n)throw r instanceof Error?r:new Error("Realm cleanup failed with a non-Error value")}function Zr(t){return function(e){return{init:n=>{var r;return(r=t.init)==null?void 0:r.call(t,n,e)},postInit:n=>{var r;return(r=t.postInit)==null?void 0:r.call(t,n,e)},update:n=>{var r;return(r=t.update)==null?void 0:r.call(t,n,e)}}}}function _6({children:t,plugins:e}){const[n,r]=_.useState(null);return _.useEffect(()=>{var i,o;const s=new C6;try{for(const l of e)(i=l.init)==null||i.call(l,s);for(const l of e)(o=l.postInit)==null||o.call(l,s)}catch(l){try{ik(s)}catch(a){throw new AggregateError([l,a],"Realm plugin initialization and cleanup both failed")}throw l}return r(s),()=>{ik(s)}},[]),_.useEffect(()=>{var i;if(n)for(const o of e)(i=o.update)==null||i.call(o,n)}),n?_.createElement(_E.Provider,{value:n},t):null}function q(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const i of e)r.append("v",i);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function PE(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const i of e)r.append("v",i);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const cr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,T6=cr&&"documentMode"in document?document.documentMode:null,ki=cr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ho=cr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),pc=!(!cr||!("InputEvent"in window)||T6)&&"getTargetRanges"in new window.InputEvent("input"),Ms=cr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,EE=cr&&/Android/.test(navigator.userAgent),xh=cr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!EE,$E=cr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zp=cr&&EE&&$E,bh=cr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ki&&!$E,P6=0,E6=1,$6=2,ok=1,sk=2,lk=4,ak=8,A6=16,RO=32,LO=64,kb=128,Q6=1,M6=2,R6=3,L6=4,I6=5,D6=6,yf=xh||Ms||bh?" ":"​",bl=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Upf-BEsx.js","assets/index-BBGjdXk1.js","assets/index-B7rwNdVj.css","assets/index-BNcXQYbv.js","assets/index-ChuqpBnv.js","assets/index-x5G6Np7T.js","assets/index-CszaAR9T.js","assets/index-C3hpUVfp.js","assets/index-BULB2rC_.js","assets/index-DAi1VtJ8.js","assets/index-BQMgADlc.js","assets/index-CNJyAniG.js","assets/index-CUCCMUMY.js","assets/index-DrSWAGft.js","assets/index-7J4zAS6J.js","assets/index-BIDsfw8C.js","assets/index-Bumwg9SM.js","assets/dockerfile-BKs6k2Af.js","assets/simple-mode-GW_nhZxv.js","assets/factor-kuTfRLto.js","assets/nsis-LY0VT_u5.js","assets/pug-DeIclll2.js","assets/javascript-iXu5QeM3.js","assets/index-CMMYSoL3.js","assets/index-BxEG-IdY.js"])))=>i.map(i=>d[i]);
2
+ var Gw=t=>{throw TypeError(t)};var Kw=(t,e,n)=>e.has(t)||Gw("Cannot "+n);var Fn=(t,e,n)=>(Kw(t,e,"read from private field"),n?n.call(t):e.get(t)),Jw=(t,e,n)=>e.has(t)?Gw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),MO=(t,e,n,r)=>(Kw(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);import{r as C,R as _,j as V,a as b6,g as wE,b as Vc,_ as W,s as ek,I as tk,n as v6}from"./index-BBGjdXk1.js";var S6=Object.defineProperty,w6=(t,e,n)=>e in t?S6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Co=(t,e,n)=>w6(t,typeof e!="symbol"?e+"":e,n);let k6=class kE{constructor(e=new Map){this.map=e}clone(){return new kE(new Map(this.map))}increment(e){const n=this.map.get(e)??0;this.map.set(e,n+1)}decrement(e,n){let r=this.map.get(e);r!==void 0&&(r-=1,this.map.set(e,r),r===0&&n())}};class Kh{constructor(){Co(this,"map",new Map)}getOrCreate(e){let n=this.map.get(e);return n===void 0&&(n=new Set,this.map.set(e,n)),n}get(e){return this.map.get(e)}use(e,n){const r=this.get(e);r!==void 0&&n(r)}delete(e){return this.map.delete(e)}}function Wa(t,e){return e(t),t}function wb(){}const CE="cell";function nk(t,e){return t===e}const hm=new Map;let C6=class{constructor(e={}){Co(this,"subscriptions",new Kh),Co(this,"singletonSubscriptions",new Map),Co(this,"graph",new Kh),Co(this,"state",new Map),Co(this,"distinctNodes",new Map),Co(this,"executionMaps",new Map),Co(this,"definitionRegistry",new Set),Co(this,"combinedCells",[]);for(const n of Object.getOwnPropertySymbols(e))this.state.set(n,e[n])}cellInstance(e,n=!0,r=Symbol()){return this.state.has(r)||this.state.set(r,e),n!==!1&&!this.distinctNodes.has(r)&&this.distinctNodes.set(r,n===!0?nk:n),r}signalInstance(e=!0,n=Symbol()){return e!==!1&&this.distinctNodes.set(n,e===!0?nk:e),n}sub(e,n){this.register(e);const r=this.subscriptions.getOrCreate(e);return r.add(n),()=>r.delete(n)}singletonSub(e,n){return this.register(e),n===void 0?this.singletonSubscriptions.delete(e):this.singletonSubscriptions.set(e,n),()=>this.singletonSubscriptions.delete(e)}resetSingletonSubs(){this.singletonSubscriptions.clear()}subMultiple(e,n){const r=this.signalInstance();return this.connect({map:i=>(...o)=>{i(o)},sink:r,sources:e}),this.sub(r,n)}pubIn(e){var n;const r=Reflect.ownKeys(e),i=this.getExecutionMap(r),o=i.refCount.clone(),s=i.participatingNodes.slice(),l=new Map(this.state),a=c=>{this.graph.use(c,u=>{for(const{sources:f,sink:h}of u)f.has(c)&&o.decrement(h,()=>{s.splice(s.indexOf(h),1),a(h)})})};for(;;){const c=s.shift();if(c===void 0)break;const u=c;let f=!1;const h=d=>{const p=this.distinctNodes.get(u);if(p!=null&&p(l.get(u),d)){f=!1;return}f=!0,l.set(u,d),this.state.has(u)&&this.state.set(u,d)};if(Object.prototype.hasOwnProperty.call(e,u)?h(e[u]):i.projections.use(u,d=>{for(const p of d){const g=[...Array.from(p.sources),...Array.from(p.pulls)].map(m=>l.get(m));p.map(h)(...g)}}),f){const d=l.get(u);this.inContext(()=>{this.subscriptions.use(u,p=>{for(const g of p)g(d)})}),(n=this.singletonSubscriptions.get(u))==null||n(d)}else a(u)}}connect({sources:e,pulls:n=[],map:r,sink:i}){const o={map:r,pulls:new Set(n),sink:this.register(i),sources:new Set(e)};for(const s of[...e,...n])this.register(s),this.graph.getOrCreate(s).add(o);this.executionMaps.clear()}pub(e,n){this.pubIn({[e]:n})}pipe(e,...n){return this.combineOperators(...n)(e)}transformer(...e){return n=>Wa(this.signalInstance(),r=>(this.link(this.pipe(r,...e),n),r))}link(e,n){this.connect({map:r=>i=>{r(i)},sink:n,sources:[e]})}combine(...e){return Wa(this.signalInstance(),n=>{this.connect({map:r=>(...i)=>{r(i)},sink:n,sources:e})})}combineCells(...e){const n=this.combinedCells.find(i=>e.length===i.sources.length&&e.every((o,s)=>o===i.sources[s]));if(n)return n.cell;const r=this.cellInstance(e.map(i=>this.getValue(i)),!0);return this.connect({map:i=>(...o)=>{i(o)},sink:r,sources:e}),this.combinedCells.push({sources:e,cell:r}),r}getValue(e){return this.register(e),this.state.get(e)}getValues(e){return e.map(n=>this.getValue(n))}register(e){const n=hm.get(e);return n===void 0||this.definitionRegistry.has(e)?e:(this.definitionRegistry.add(e),Wa(n.type===CE?this.cellInstance(n.initial,n.distinct,e):this.signalInstance(n.distinct,e),r=>{this.inContext(()=>{n.init(this,r)})}))}inContext(e){return e()}changeWith(e,n,r){this.connect({sources:[n],pulls:[e],sink:e,map:i=>(o,s)=>{i(r(s,o))}})}calculateExecutionMap(e){const n=[],r=new Set,i=new Kh,o=new k6,s=new Kh,l=(a,c=0)=>{o.increment(a),!r.has(a)&&(this.register(a),i.use(a,u=>{c=Math.max(...Array.from(u).map(f=>n.indexOf(f)))+1}),this.graph.use(a,u=>{for(const f of u)f.sources.has(a)?(s.getOrCreate(f.sink).add(f),l(f.sink,c)):i.getOrCreate(f.sink).add(a)}),r.add(a),n.splice(c,0,a))};return e.forEach(l),{participatingNodes:n,pendingPulls:i,projections:s,refCount:o}}getExecutionMap(e){let n=e;if(e.length===1){n=e[0];const i=this.executionMaps.get(n);if(i!==void 0)return i}else for(const[i,o]of this.executionMaps.entries())if(Array.isArray(i)&&i.length===e.length&&i.every(s=>e.includes(s)))return o;const r=this.calculateExecutionMap(e);return this.executionMaps.set(n,r),r}combineOperators(...e){return n=>{for(const r of e)n=r(n,this);return n}}};function we(t,e=wb,n=!0){return Wa(Symbol(),r=>{hm.set(r,{type:CE,distinct:n,initial:t,init:e})})}function Nn(t=wb,e=!1){return Wa(Symbol(),n=>{hm.set(n,{type:"signal",distinct:e,init:t})})}function Bc(t=wb){return Wa(Symbol(),e=>{hm.set(e,{type:"signal",distinct:!1,init:t})})}const _E=C.createContext(null);function yh(){const t=C.useContext(_E);if(t===null)throw new Error("useRealm must be used within a RealmContextProvider");return t}function wn(t){const e=yh();e.register(t);const n=C.useCallback(r=>e.sub(t,r),[e,t]);return C.useSyncExternalStore(n,()=>e.getValue(t),()=>e.getValue(t))}function Vn(...t){const e=yh(),n=C.useMemo(()=>e.combineCells.apply(e,t),[e,...t]);return wn(n)}function Zt(t){const e=yh();return e.register(t),C.useCallback(n=>{e.pub(t,n)},[e,t])}function Rl(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:i=>o=>{i(t(o))},sink:r,sources:[e]}),r}}function rn(...t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:i=>(...o)=>{i(o)},pulls:t,sink:r,sources:[e]}),r}}function dm(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:i=>o=>{t(o)&&i(o)},sink:r,sources:[e]}),r}}function TE(t,e){return(n,r)=>{const i=r.signalInstance();return r.connect({map:o=>s=>{o(e=t(e,s))},sink:i,sources:[n]}),i}}const Zp=new WeakMap;function rk(t,e){let n=Zp.get(t);return n||(n=new Set,Zp.set(t,n)),n.add(e),()=>{n.delete(e)}}function ik(t){const e=Zp.get(t);if(Zp.delete(t),!e)return;let n=!1,r;for(const i of[...e].reverse())try{i()}catch(o){n||(n=!0,r=o)}if(n)throw r instanceof Error?r:new Error("Realm cleanup failed with a non-Error value")}function Zr(t){return function(e){return{init:n=>{var r;return(r=t.init)==null?void 0:r.call(t,n,e)},postInit:n=>{var r;return(r=t.postInit)==null?void 0:r.call(t,n,e)},update:n=>{var r;return(r=t.update)==null?void 0:r.call(t,n,e)}}}}function _6({children:t,plugins:e}){const[n,r]=_.useState(null);return _.useEffect(()=>{var i,o;const s=new C6;try{for(const l of e)(i=l.init)==null||i.call(l,s);for(const l of e)(o=l.postInit)==null||o.call(l,s)}catch(l){try{ik(s)}catch(a){throw new AggregateError([l,a],"Realm plugin initialization and cleanup both failed")}throw l}return r(s),()=>{ik(s)}},[]),_.useEffect(()=>{var i;if(n)for(const o of e)(i=o.update)==null||i.call(o,n)}),n?_.createElement(_E.Provider,{value:n},t):null}function q(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const i of e)r.append("v",i);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function PE(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const i of e)r.append("v",i);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const cr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,T6=cr&&"documentMode"in document?document.documentMode:null,ki=cr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ho=cr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),pc=!(!cr||!("InputEvent"in window)||T6)&&"getTargetRanges"in new window.InputEvent("input"),Ms=cr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,EE=cr&&/Android/.test(navigator.userAgent),xh=cr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!EE,$E=cr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zp=cr&&EE&&$E,bh=cr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ki&&!$E,P6=0,E6=1,$6=2,ok=1,sk=2,lk=4,ak=8,A6=16,RO=32,LO=64,kb=128,Q6=1,M6=2,R6=3,L6=4,I6=5,D6=6,yf=xh||Ms||bh?" ":"​",bl=`
3
3
 
4
4
  `,Cb=Ho?" ":yf,qo={bold:1,capitalize:1024,code:16,highlight:kb,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},N6={directionless:1,unmergeable:2},jp={center:2,end:6,justify:4,left:1,right:3,start:5},V6={[M6]:"center",[D6]:"end",[L6]:"justify",[Q6]:"left",[R6]:"right",[I6]:"start"},B6={normal:0,segmented:2,token:1},F6={[P6]:"normal",[$6]:"segmented",[E6]:"token"},ck="$config";function uk(){return Mt()._blockCursorElement}function Z6(t){return t!==null&&t.nodeType===1&&t.hasAttribute("data-lexical-slot")}let AE=class ip{element;before;after;constructor(e,n,r){this.element=e,this.before=n||null,this.after=r||null}withBefore(e){return new ip(this.element,e,this.after)}withAfter(e){return new ip(this.element,this.before,e)}withElement(e){return this.element===e?this:new ip(e,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return n!==null&&n.parentElement!==this.element&&q(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&q(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&q(359),this.element.replaceChild(e,n),this}getFirstChild(){const e=this.getFirstChildAnchor(),n=e?e.nextSibling:this.element.firstChild;return n===this.getInsertionAnchor()?null:n}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,n,r){if(this.element===e)return n===e&&r===0?"before":"after";const i=fk(e,this.element);if(i===null)return"after";const o=Array.prototype.indexOf.call(e.childNodes,i);if(o<0)return"after";if(n===e)return r<=o?"before":"after";const s=fk(e,n);if(s===null)return"after";const l=Array.prototype.indexOf.call(e.childNodes,s);return l>=0&&l<=o?"before":"after"}getInsertionAnchor(){return this.before}};function fk(t,e){let n=e;for(;n!==null&&n.parentNode!==t;)n=n.parentNode;return n}let QE=class op extends AE{withBefore(e){return new op(this.element,e,this.after)}withAfter(e){return new op(this.element,this.before,e)}withElement(e){return this.element===e?this:new op(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),n=e?e.nextSibling:this.element.firstChild;for(;Z6(n);)e=n,n=n.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===uk()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const n=e==="decorator"&&(bh||Ms||xh);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const n=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&n.removeChild(r),n.removeChild(e),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const n=this.getManagedLineBreak();if(n){if(e===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,i=this.before,o=Tt().createElement("br");if(o.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(o,i),e){const s=Tt().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,o),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=o}getFirstChildOffset(){const e=this.getFirstChild(),n=this.getInsertionAnchor();let r=0;for(let i=this.element.firstChild;i!==null&&i!==e&&i!==n;i=i.nextSibling)r++;return r}resolveChildIndex(e,n,r,i){if(r===this.element){const a=this.getFirstChildOffset(),c=uk(),u=this.element.childNodes,f=Math.min(i,u.length);let h=0;for(let d=a;d<f;d++)u[d]!==c&&h++;return[e,Math.min(h,e.getChildrenSize())]}const o=hk(n,r);o.push(i);const s=hk(n,this.element);let l=e.getIndexWithinParent();for(let a=0;a<s.length;a++){const c=o[a],u=s[a];if(c===void 0||c<u)break;if(c>u){l+=1;break}}return[e.getParentOrThrow(),l]}};function hk(t,e){const n=[];let r=e;for(;r!==t&&r!==null;r=r.parentNode){let i=0;for(let o=r.previousSibling;o!==null;o=o.previousSibling)i++;n.push(i)}return r!==t&&q(225),n.reverse()}let ME;try{ME="0.48.0+prod.esm"}catch{}const RE=ME??'"<unknown>+source"';let Ou=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const n of this._back)e.push(n);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const sl=null;function LE(t,e=1e3){return t instanceof R0?t.clone():t.size<e?new Map(t):new R0().init(new Map(t),void 0,t.size)}let R0=class IE{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new IE().init(this._old,this._nursery,this._size)}init(e,n,r){return this._old=e,this._nursery=n,this._size=r,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){const n=this._nursery&&this._nursery.get(e);return n!==void 0?n:this._old&&this._old.get(e)}get(e){const n=this.getWithTombstone(e);return n===sl?void 0:n}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const n=new Map(this._old);for(const[r,i]of this._nursery)i!==sl?n.set(r,i):n.delete(r);this._old=n,this._nursery=void 0}return this._mutable=!1,this}set(e,n){const r=this.getWithTombstone(e);if(r===n)return this;const i=this.getNursery();return r!==sl&&r!==void 0||(this._size++,r===sl&&i.delete(e)),i.set(e,n),this}delete(e){const n=this.has(e);return n&&(this.getNursery().set(e,sl),this._size--),n}getOrInsert(e,n){const r=this.get(e);return r!==void 0?r:(this.set(e,n),n)}getOrInsertComputed(e,n){const r=this.get(e);if(r!==void 0)return r;const i=n(e);return this.set(e,i),i}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,n=this._old;if(n)for(const r of n){const i=r[0],o=e?e.get(i):void 0;o!==sl&&(o!==void 0&&(r[1]=o),yield r)}if(e)for(const r of e)r[1]===sl||n&&n.has(r[0])||(yield r)}forEach(e,n){n!==void 0&&(e=e.bind(n));for(const[r,i]of this.entries())e(i,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function Xp(t,e,n,r,i,o){if(N(t)){let s=t.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&((N(s)||Do(s)&&s.__slots!==null)&&Xp(s,l,n,r,i,o),n.has(l)||o.delete(l),i.push(l)),s=s.getNextSibling()}}for(const s of Do(t)&&t.__slots!==null?t.__slots.values():[]){const l=r.get(s);l!==void 0&&Fl(l)&&l.__slotHost===e&&((N(l)||Do(l)&&l.__slots!==null)&&Xp(l,s,n,r,i,o),n.has(s)||o.delete(s),i.push(s))}}let L0=!1,_b=0;function z6(t){_b=t.timeStamp}function IO(t,e,n){const r=t.nodeName==="BR",i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&jc(t,n)!==void 0}function j6(t,e,n){const r=ur(kr(n)),i=r&&ai(r,n._rootElement);let o=null,s=null;i!==null&&i.anchorNode===t&&(o=i.anchorOffset,s=i.focusOffset);const l=t.nodeValue;l!==null&&Wb(e,l,o,s,!1)}function X6(t,e,n){if(X(t)){const r=t.anchor.getNode();if(r.is(n)&&t.format!==r.getFormat())return!1}return wr(e)&&n.isAttached()}function W6(t,e,n){for(let r=t;r&&!cA(r);r=Us(r)){const i=jc(r,e);if(i!==void 0){const o=Ge(i,n);if(o)return Fe(o)||!Qe(r)?void 0:[r,o]}}}function DE(t,e,n){L0=!0;const r=performance.now()-_b>100;try{ni(t,()=>{const i=ne()||(function(f){return f.read("latest",()=>{const h=ne();return h!==null?h.clone():null})})(t),o=new Map,s=t._editorState,l=t._blockCursorElement;let a=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],d=h.type,p=h.target,g=W6(p,t,s);if(!g)continue;const[m,O]=g;if(d==="characterData")r&&Y(O)&&wr(p)&&X6(i,p,O)&&j6(p,O,t);else if(d==="childList"){a=!0;const y=h.addedNodes;for(let S=0;S<y.length;S++){const v=y[S],w=U$(v),k=v.parentNode;if(!(k==null||v===l||w!==null||IO(v,k,t)||t._slotsUsed&&Qe(v)&&v.hasAttribute("data-lexical-slot")||cA(v))){if(Ho){const P=(Qe(v)?v.innerText:null)||v.nodeValue;P&&(c+=P)}k.removeChild(v)}}const x=h.removedNodes,b=x.length;if(b>0){let S=0;for(let v=0;v<b;v++){const w=x[v];(IO(w,p,t)||l===w)&&(p.appendChild(w),S++)}b!==S&&o.set(m,O)}}}if(o.size>0)for(const[f,h]of o)h.reconcileObservedMutation(f,t);const u=n.takeRecords();if(u.length>0){for(let f=0;f<u.length;f++){const h=u[f],d=h.addedNodes,p=h.target;for(let g=0;g<d.length;g++){const m=d[g],O=m.parentNode;O==null||m.nodeName!=="BR"||IO(m,p,t)||O.removeChild(m)}}n.takeRecords()}i!==null&&(a&&Vt(i),Ho&&nA(t)&&i.insertRawText(c))})}finally{L0=!1}}function NE(t){const e=t._observer;e!==null&&DE(t,e.takeRecords(),e)}function VE(t){(function(e){_b===0&&kr(e).addEventListener("textInput",z6,!0)})(t),t._observer=new MutationObserver((e,n)=>{DE(t,e,n)})}const dk="latest";let H6=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,n){this.key=e,this.parse=n.parse.bind(n),this.unparse=(n.unparse||U6).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=n.resetOnCopyNode||!1}};function vh(t,e){return new H6(t,e)}function pm(t,e,n=dk){const r=(n===dk?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function Ha(t,e,n){let r;if(On(),typeof n=="function"){const o=t.getLatest(),s=pm(o,e);if(r=n(s),e.isEqual(s,r))return o}else r=n;const i=t.getWritable();return FE(i).updateFromKnown(e,r),i}function q6(t){const e=new Map,n=new Set;for(const{ownNodeConfig:r}of Kb(typeof t=="function"?t:t.replace))if(r&&r.stateConfigs)for(const i of r.stateConfigs){let o;"stateConfig"in i?(o=i.stateConfig,i.flat&&n.add(o.key)):o=i,e.set(o.key,o)}return{flatKeys:n,sharedConfigMap:e}}const pk=new Set(["__proto__","constructor","prototype"]);let Y6=class BE{node;knownState;unknownState;sharedNodeState;size;constructor(e,n,r=void 0,i=new Map,o=void 0){this.node=e,this.sharedNodeState=n,this.unknownState=r,this.knownState=i;const{sharedConfigMap:s}=this.sharedNodeState,l=o!==void 0?o:(function(a,c,u){let f=u.size;if(c)for(const h in c){const d=a.get(h);d&&u.has(d)||f++}return f})(s,r,i);this.size=l}getValue(e){const n=this.knownState.get(e);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const i=this.unknownState[e.key];i!==void 0&&(r=e.parse(i)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},n={};for(const[r,i]of this.knownState)r.isEqual(i,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(i);for(const r of this.sharedNodeState.flatKeys)r in e&&(n[r]=e[r],delete e[r]);return gk(e)&&(n.$=e),n}getWritable(e){if(this.node===e)return this;const{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new BE(e,n,(function(o,s,l){let a;if(l)for(const[c,u]of Object.entries(l)){if(pk.has(c))continue;const f=o.get(c);f?s.has(f)||s.set(f,f.parse(u)):(a=a||{},a[c]=u)}return a})(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,n){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:i,unknownState:o}=this;i.has(e)||o&&r in o||(o&&(delete o[r],this.unknownState=gk(o)),this.size++),i.set(e,n)}updateFromUnknown(e,n){if(pk.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(n)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=n)}updateFromJSON(e){const{knownState:n}=this;for(const r of n.keys())n.set(r,r.defaultValue);if(this.size=n.size,this.unknownState=void 0,e)for(const[r,i]of Object.entries(e))this.updateFromUnknown(r,i)}};function FE(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new Y6(e,ZE(e));return e.__state=n,n}function ZE(t){return t.__state?t.__state.sharedNodeState:H$(Mt(),t.getType()).sharedNodeState}function gk(t){if(t)for(const e in t)return t}function U6(t){return t}function mk(t,e,n){for(const[r,i]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const o=n?n.getValue(r):r.defaultValue;if(o!==i&&!r.isEqual(o,i))return!0}return!1}function Ok(t,e,n){const{unknownState:r}=e,i=n?n.unknownState:void 0;if(r){for(const[o,s]of Object.entries(r))if(!t.has(o)&&(t.add(o),s!==(i?i[o]:void 0)))return!0}return!1}function yk(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function xk(t,e){const n=t.__mode,r=t.__format,i=t.__style,o=e.__mode,s=e.__format,l=e.__style,a=t.__state,c=e.__state;return(n===null||n===o)&&(r===null||r===s)&&(i===null||i===l)&&(t.__state===null||a===c||(function(u,f){if(u===f)return!0;const h=new Set;return!(u&&mk(h,u,f)||f&&mk(h,f,u)||u&&Ok(h,u,f)||f&&Ok(h,f,u))})(a,c))}function bk(t,e){const n=t.mergeWithSibling(e),r=at()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function vk(t){let e,n,r=t;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&Y(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(xk(e,r)){r=bk(e,r);break}break}e.remove()}for(;(n=r.getNextSibling())!==null&&Y(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(xk(r,n)){r=bk(r,n);break}break}n.remove()}}else r.remove()}function Ki(t){return Sk(t.anchor),Sk(t.focus),t}function Sk(t){for(;t.type==="element";){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=!0):(r=e.getChildAtIndex(n),i=!1),Y(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!N(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}const xf=Symbol.for("@lexical/CachedTextSize");function wk(t,e){return D0.read(()=>{let n=0,r=t;for(let i=0;i<e&&r!==null;i++){const o=Ei.get(r);if(o===void 0&&q(345,r),N(o)){const s=Rt.get(r);if(s!==void 0&&N(s)&&s.__parent!==o.__parent)n+=o.getTextContentSize();else{const l=Ll.get(r),a=l&&l.__lexicalTextContent;typeof a!="string"&&q(346,o.getType()),n+=a.length}i<e-1&&!o.isInline()&&(n+=2)}else{const s=o[xf];s===void 0&&q(347,o.getType(),r),n+=s}r=o.__next}return n},{editor:nt})}function zE(t){N(t)||t[xf]===void 0&&(t[xf]=Y(t)?t.__text.length:t.getTextContentSize())}const G6=4;let bf,nt,vf,Xe="",jt=null,zn=null,$n=null;function Ji(){return{firstTextKey:$n,format:jt,style:zn}}function Hr(t){t.firstTextKey!==null&&(jt=t.format,zn=t.style,$n=t.firstTextKey)}function I0(t){if($n!==null)return;const e=t.__lexicalFirstTextKey;if(e===void 0&&q(348),e===null)return;const n=Rt.get(e);Y(n)&&(jt=n.getFormat(),zn=n.getStyle(),$n=e)}let gm,Hu,qu,Ei,D0,Rt,Ll,N0,Sf,Il,$o=!1,Wp=!1;function Es(t,e){const n=Ei.get(t),r=Rt.has(t);if(e!==null){const i=z0(t);i.parentNode===e&&e.removeChild(i)}if(!r){if(nt._keyToDOMMap.delete(t),N(n)){const i=cg(n,Ei);V0(i,0,i.length-1,null)}if(n!==void 0){for(const i of Lr(n).values()){const o=F0(i);Es(i,null),o!==null&&o.remove()}Hb(Sf,vf,gm,n,"destroyed")}}}function V0(t,e,n,r){for(let i=e;i<=n;++i){const o=t[i];o!==void 0&&Es(o,r)}}function ll(t,e){t.setProperty("text-align",e)}const K6="40px";function jE(t,e){const n=bf.theme.indent;if(typeof n=="string"){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${K6}))`)}function XE(t,e){const n=t.style;e===0?ll(n,""):e===1?ll(n,"left"):e===2?ll(n,"center"):e===3?ll(n,"right"):e===4?ll(n,"justify"):e===5?ll(n,"start"):e===6&&ll(n,"end")}function B0(t,e){const n=(function(r){const i=r.__dir;if(i!==null)return i;if(Nt(r))return null;const o=r.getParent();return o===null||gt(o)&&o.__dir===null?"auto":null})(e);n!==null?t.dir=n:t.removeAttribute("dir")}function WE(t){const e=Tt().createElement("div");return e.setAttribute("data-lexical-slot",t),e.style.display="none",e}function HE(t,e,n){e||t.contentEditable==="false"?aN(n,nt):n.removeAttribute("contenteditable")}function kk(t,e,n){const r=Xe,i=Ji();Xe="";let o="";const s=Fe(t);for(const[l,a]of n){const c=WE(l);HE(e,s,c),e.appendChild(c),Xe="";const u=Ji();$s(a,ci(t,c,nt)),Hr(u),qE(t,l,e,c),o+=Xe}return Hr(i),Xe=r,o}function Lr(t){return Do(t)&&t.__slots!==null?t.__slots:hA}function qE(t,e,n,r){const i=Il.$getSlotTargetElement(t,e,n,nt);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display="")}function F0(t){const e=Ll.get(t);return e!==void 0?e.parentElement:null}function Ck(t,e,n){const r=Lr(t),i=Lr(e);for(const[u,f]of r)if(!i.has(u)){const h=F0(f);Es(f,null),h!==null&&h.remove()}const o=Xe,s=Ji();let l="",a=null;const c=Fe(e);for(const[u,f]of i){const h=r.get(u);let d=h!==void 0?F0(h):null;Xe="";const p=Ji();if(d===null){d=WE(u);let g=null;for(const m of n.children)if(!m.hasAttribute("data-lexical-slot")){g=m;break}n.insertBefore(d,g),$s(f,ci(e,d,nt))}else h===f?Po(f,d):(h!==void 0&&Es(h,d),$s(f,ci(e,d,nt)));if(Hr(p),HE(n,c,d),qE(e,u,n,d),l+=Xe,d.parentElement===n){const g=a===null?n.firstChild:a.nextSibling;g!==d&&n.insertBefore(d,g),a=d}}return Hr(s),Xe=o,l}function $s(t,e){const n=Rt.get(t);if(n===void 0&&q(60),e!==null){const i=Ei.get(t);if(i!==void 0){const o=Ll.get(t);if(o!==void 0){const s=Fl(i)?i.__slotHost:null,l=Fl(n)?n.__slotHost:null,a=i.__parent!==n.__parent||s!==l,c=l!==null&&o.parentElement!==e.element;if(a||c)return e.insertChild(o),Po(t,e.element)}}}const r=Il.$createDOM(n,nt);if((function(i,o,s){const l=s._keyToDOMMap;G$(o,s,i),l.set(i,o)})(t,r,nt),Y(n)?r.setAttribute("data-lexical-text","true"):Fe(n)&&(r.setAttribute("data-lexical-decorator","true"),lN(r,{captureSelection:!0})),N(n)){const i=n.__indent,o=n.__size;B0(r,n),i!==0&&jE(r,i);const s=Lr(n),l=s.size>0?kk(n,r,s):"";if(o===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,Xe+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const c=Xe,u=o-1;if(Z0(cg(n,Rt),n,0,u,ci(n,r,nt)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,Xe=c+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const a=n.__format;a!==0&&XE(r,a),n.isInline()||YE(null,n,r)}else{const i=n.getTextContent();if(Fe(n)){const o=n.decorate(nt,bf);o!==null&&UE(t,o),r.contentEditable="false";const s=Lr(n);s.size>0&&kk(n,r,s)}Xe+=i}return e!==null&&e.insertChild(r),Il.$decorateDOM(n,null,r,nt),zE(n),Hb(Sf,vf,gm,n,"created"),r}function Z0(t,e,n,r,i){const o=Xe,s=Ji();Xe="",jt=null,zn=null,$n=null;let l=n;for(;l<=r;++l){const c=Ji();$s(t[l],i);const u=Rt.get(t[l]);u!==null&&Y(u)?jt===null&&(jt=u.getFormat(),zn=u.getStyle(),$n=u.__key):N(u)&&l<r&&!u.isInline()&&(Xe+=bl),Hr(c)}const a=nt._keyToDOMMap.get(e.__key);a===void 0&&q(349,e.__key),a.__lexicalTextContent=Xe,a.__lexicalFirstTextKey=$n,Xe=o+Xe,Hr(s)}function YE(t,e,n){const r=ci(e,n,nt),i=r.element.__lexicalLastChildKind??null,o=(function(s,l){if(s){const a=s.__last;if(a){const c=l.get(a);if(c)return kn(c)?"line-break":Fe(c)&&c.isInline()?"decorator":null}return Lr(s).size>0?null:"empty"}return null})(e,Rt);i!==o&&r.setManagedLineBreak(o)}function J6(t,e,n){var r;jt=null,zn=null,$n=null,(function(i,o,s){const l=Xe,a=i.__size,c=o.__size;Xe="";const u=s.element,f=nt._keyToDOMMap.get(o.__key);f===void 0&&q(351,o.__key);const h=c-a;if(!$o&&Math.abs(h)<=1&&a>=G6&&i.__first===o.__first&&(h!==0||!nt._cloneNotNeeded.has(i.__key))){const d=f.__lexicalTextContent,p=N0.get(i.__key);if(!$o&&typeof d=="string"&&p!==void 0){const g=(function(m,O){const y=O.size;if(y===0||y>=m.__size)return null;let x=m.__last,b=null,S=0;for(;x!==null&&S<y;){if(!O.has(x))return null;b=x;const v=Rt.get(x);if(v===void 0)return null;x=v.__prev,S++}return S!==y||x!==null&&O.has(x)?null:b})(o,p);if(g!==null){const m=p.size;if(h===0){const O=wk(g,m);let y=g,x=0;for(;y!==null&&x<m;){const k=Rt.get(y);if(k===void 0)break;const P=Ji();Po(y,u),Y(k)&&jt===null&&(jt=k.getFormat(),zn=k.getStyle(),$n=k.__key),Hr(P),y=k.__next,x++}let b="";for(y=g,x=0;y!==null&&x<m;){const k=Rt.get(y);if(k===void 0)break;let P;if(N(k)){const T=nt._keyToDOMMap.get(y),M=T&&T.__lexicalTextContent;typeof M!="string"&&q(352,k.getType()),P=M}else P=k.getTextContent();b+=P,x<m-1&&N(k)&&!k.isInline()&&(b+=bl),y=k.__next,x++}const S=f.__lexicalSlotTextLength||0,v=S>0?d.slice(S):d,w=v.slice(0,v.length-O)+b;return f.__lexicalTextContent=w,Xe=l+w,void _k(o,f,p)}if((function(O,y,x,b,S,v,w,k){if(k!==1&&k!==-1||w!==(k===1?2:1))return!1;const T=w-k;let M=O.__last;for(let pe=0;pe<T-1;pe++){if(M===null)return!1;const he=Ei.get(M);if(he===void 0)return!1;M=he.__prev}if(M===null)return!1;const I=Rt.get(v),$=Ei.get(M);if(I===void 0||$===void 0||I.__prev!==$.__prev)return!1;const D=[];let Z=v;for(let pe=0;pe<w;pe++){if(Z===null)return!1;D.push(Z);const he=Rt.get(Z);Z=he?he.__next:null}const G=[];Z=M;for(let pe=0;pe<T;pe++){if(Z===null)return!1;G.push(Z);const he=Ei.get(Z);Z=he?he.__next:null}const z=new Set(G),ee=new Set(D),oe=[];let Q=0,ve=0;for(;Q<T&&ve<w;)if(D[ve]===G[Q])oe.push({key:D[ve],kind:"reconcile"}),Q++,ve++;else if(ee.has(G[Q])){if(z.has(D[ve]))return!1;oe.push({key:D[ve],kind:"create",nextIndex:ve}),ve++}else oe.push({key:G[Q],kind:"destroy"}),Q++;for(;Q<T;)oe.push({key:G[Q++],kind:"destroy"});for(;ve<w;)oe.push({key:D[ve],kind:"create",nextIndex:ve}),ve++;const _e=wk(M,T);for(const pe of oe){const he=Ji();if(pe.kind==="reconcile")Po(pe.key,x.element);else if(pe.kind==="destroy")Es(pe.key,x.element);else{let J=null;for(let ue=pe.nextIndex+1;ue<w;ue++){const Se=nt._keyToDOMMap.get(D[ue]);if(Se!==void 0){J=Se;break}}$s(pe.key,x.withBefore(J??x.before))}if(pe.kind!=="destroy"){const J=Rt.get(pe.key);J&&Y(J)&&jt===null&&(jt=J.getFormat(),zn=J.getStyle(),$n=J.__key)}Hr(he)}let L="";for(let pe=0;pe<w;pe++){const he=Rt.get(D[pe]);if(he===void 0)return!1;let J;if(N(he)){const ue=nt._keyToDOMMap.get(D[pe]),Se=ue&&ue.__lexicalTextContent;typeof Se!="string"&&q(350,he.getType()),J=Se}else J=he.getTextContent();L+=J,pe<w-1&&N(he)&&!he.isInline()&&(L+=bl)}const Ie=b.__lexicalSlotTextLength||0,Be=Ie>0?S.slice(Ie):S;return b.__lexicalTextContent=Be.slice(0,Be.length-_e)+L,!0})(i,0,s,f,d,g,m,h)){const O=f.__lexicalTextContent;return typeof O!="string"&&q(353),Xe=l+O,void _k(o,f,p)}}}if(h===0){let g=i.__first,m=0;for(;g!==null;){const O=Rt.get(g);if(O===void 0)break;const y=$o||qu.has(g)||Hu.has(g),x=Ji();if(y)Po(g,u);else{let b,S;if(N(O)){S=Ll.get(g);const v=S&&S.__lexicalTextContent;typeof v!="string"&&q(354,O.getType()),b=v}else b=O.getTextContent();Xe+=b,S!==void 0&&I0(S)}Y(O)?jt===null&&(jt=O.getFormat(),zn=O.getStyle(),$n=O.__key):N(O)&&m<c-1&&!O.isInline()&&(Xe+=bl),Hr(x),g=O.__next,m++}return f.__lexicalTextContent=Xe,f.__lexicalFirstTextKey=$n,void(Xe=l+Xe)}}if(a===1&&c===1){const d=i.__first,p=o.__first;if(d===p)Po(d,u);else{const m=z0(d),O=$s(p,null);try{m.parentNode===u?u.replaceChild(O,m):s.insertChild(O)}catch(y){if(typeof y=="object"&&y!=null){const x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${O.tagName} key: ${p}}, old child: {tag: ${m.tagName}, key: ${d}}.`;throw new Error(x)}throw y}Es(d,null)}const g=Rt.get(p);Y(g)&&jt===null&&(jt=g.getFormat(),zn=g.getStyle(),$n=g.__key)}else{const d=cg(i,Ei),p=cg(o,Rt);if(d.length!==a&&q(227),p.length!==c&&q(228),a===0)c!==0&&Z0(p,o,0,c-1,s);else if(c===0){if(a!==0){const g=s.after==null&&s.before==null&&Lr(o).size===0&&s.element.__lexicalLineBreak==null;V0(d,0,a-1,g?null:u),g&&(u.textContent="")}}else(function(g,m,O,y,x,b){const S=y-1,v=x-1;let w,k,P=b.getFirstChild(),T=0,M=0;for(;T<=S&&M<=v;){const D=m[T],Z=O[M],G=Ji();if(D===Z)P=DO(Po(Z,b.element)),T++,M++;else{if(k===void 0&&(k=Tk(O,M)),w===void 0)w=Tk(m,T);else if(!w.has(D)){T++,Hr(G);continue}if(!k.has(D)){P=DO(z0(D)),Es(D,b.element),T++,w.delete(D),Hr(G);continue}if(w.has(Z)){const ee=yc(nt,Z);ee!==P&&b.withBefore(P??b.before).insertChild(ee),P=DO(Po(Z,b.element)),T++,M++}else $s(Z,b.withBefore(P??b.before)),M++}const z=Rt.get(Z);z!==null&&Y(z)?jt===null&&(jt=z.getFormat(),zn=z.getStyle(),$n=z.__key):N(z)&&M<=v&&!z.isInline()&&(Xe+=bl),Hr(G)}const I=T>S,$=M>v;if(I&&!$){const D=O[v+1],Z=D===void 0?null:nt.getElementByKey(D);Z0(O,g,M,v,b.withBefore(Z??b.before))}else $&&!I&&V0(m,T,S,b.element)})(o,d,p,a,c,s)}f.__lexicalTextContent=Xe,f.__lexicalFirstTextKey=$n,Xe=l+Xe})(t,e,ci(e,n,nt)),gt(e)||(r=e,jt==null||jt===r.__textFormat||Wp||r.setTextFormat(jt),(function(i){zn==null||zn===i.__textStyle||Wp||i.setTextStyle(zn)})(e))}function _k(t,e,n){const r=e.__lexicalFirstTextKey;if(r!=null){const i=t.__key;let o=r;for(;o!==null;){const s=Rt.get(o);if(s===void 0){o=null;break}if(s.__parent===i)break;o=s.__parent}if(o!==null&&!n.has(o)){const s=Rt.get(r);if(Y(s))return jt=s.getFormat(),void(zn=s.getStyle())}}e.__lexicalFirstTextKey=$n}function Po(t,e){const n=Ei.get(t);let r=Rt.get(t);n!==void 0&&r!==void 0||q(61);const i=$o||qu.has(t)||Hu.has(t),o=yc(nt,t);if(n===r&&!i){let s;if(N(n)){const l=o.__lexicalTextContent;typeof l!="string"&&q(355,n.getType()),s=l,I0(o)}else s=n.getTextContent();return Xe+=s,o}if(n!==r&&i&&Hb(Sf,vf,gm,r,"updated"),Il.$updateDOM(r,n,o,nt)){const s=$s(t,null);return e===null&&q(62),e.replaceChild(s,o),Es(t,null),s}if(N(n)){N(r)||q(334,t);const s=r.__indent;($o||s!==n.__indent)&&jE(o,s);const l=r.__format;($o||l!==n.__format)&&XE(o,l);const a=i&&(Lr(r).size>0||Lr(n).size>0)?Ck(n,r,o):"";if(i){const c=Xe;if(J6(n,r,o),Nt(r)||r.isInline()||YE(0,r,o),a!==""){const u=o.__lexicalTextContent||"";o.__lexicalTextContent=a+u,Xe=c+a+u,o.__lexicalSlotTextLength=a.length}else(Lr(r).size>0||Lr(n).size>0)&&(o.__lexicalSlotTextLength=0)}else{const c=o.__lexicalTextContent;typeof c!="string"&&q(356,n.getType()),Xe+=c,I0(o)}if(($o||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(B0(o,r),Nt(r)&&!$o))for(const c of r.getChildren())N(c)&&B0(yc(nt,c.getKey()),c)}else{const s=r.getTextContent();if(Fe(r)){const l=r.decorate(nt,bf);l!==null&&UE(t,l),i&&(Lr(r).size>0||Lr(n).size>0)&&Ck(n,r,o)}Xe+=s}if(!Wp&&Nt(r)){const s=r.getLatest();if(s.__cachedText!==Xe){const l=s.getWritable();l.__cachedText=Xe,r=l}}return Il.$decorateDOM(r,n,o,nt),zE(r),o}function UE(t,e){let n=nt._pendingDecorators;const r=nt._decorators;if(n===null){if(r[t]===e)return;n=K$(nt)}n[t]=e}function DO(t){let e=t.nextSibling;return e!==null&&e===nt._blockCursorElement&&(e=e.nextSibling),e}function Tk(t,e){const n=new Set;for(let r=e;r<t.length;r++)n.add(t[r]);return n}function eD(t,e,n,r,i,o){Xe="",jt=null,zn=null,$n=null,$o=r===2,nt=n,bf=n._config,Il=n._config.dom||ig,vf=n._nodes,gm=nt._listeners.mutation,Hu=i,qu=o,Ei=t._nodeMap,D0=t,Rt=e._nodeMap,Wp=e._readOnly,Ll=LE(n._keyToDOMMap),N0=(function(){const l=new Map,a=c=>{for(const u of c){const f=Rt.get(u);if(f===void 0)continue;const h=f.__parent;if(h===null)continue;let d=l.get(h);d===void 0&&(d=new Set,l.set(h,d)),d.add(u)}};return a(Hu.keys()),a(qu),l})();const s=new Map;return Sf=s,Po("root",null),nt=void 0,vf=void 0,Hu=void 0,qu=void 0,Ei=void 0,D0=void 0,Rt=void 0,bf=void 0,Ll=void 0,N0=void 0,Sf=void 0,Il=ig,s}function z0(t){const e=Ll.get(t);return e===void 0&&q(75,t),e}function Pe(t){return{type:t}}const Tb=Pe("SELECTION_CHANGE_COMMAND"),tD=Pe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Pb=Pe("CLICK_COMMAND"),GE=Pe("BEFORE_INPUT_COMMAND"),KE=Pe("INPUT_COMMAND"),JE=Pe("COMPOSITION_START_COMMAND"),e$=Pe("COMPOSITION_END_COMMAND"),Cl=Pe("DELETE_CHARACTER_COMMAND"),qa=Pe("INSERT_LINE_BREAK_COMMAND"),wf=Pe("INSERT_PARAGRAPH_COMMAND"),Ya=Pe("CONTROLLED_TEXT_INSERTION_COMMAND"),mm=Pe("PASTE_COMMAND"),sp=Pe("REMOVE_TEXT_COMMAND"),kf=Pe("DELETE_WORD_COMMAND"),Cf=Pe("DELETE_LINE_COMMAND"),Qo=Pe("FORMAT_TEXT_COMMAND"),nD=Pe("SET_TEXT_FORMAT_COMMAND"),Om=Pe("UNDO_COMMAND"),ym=Pe("REDO_COMMAND"),xm=Pe("KEYDOWN_COMMAND"),t$=Pe("KEY_ARROW_RIGHT_COMMAND"),n$=Pe("MOVE_TO_END"),Eb=Pe("KEY_ARROW_LEFT_COMMAND"),r$=Pe("MOVE_TO_START"),$b=Pe("KEY_ARROW_UP_COMMAND"),Ab=Pe("KEY_ARROW_DOWN_COMMAND"),gc=Pe("KEY_ENTER_COMMAND"),Qb=Pe("KEY_SPACE_COMMAND"),Mb=Pe("KEY_BACKSPACE_COMMAND"),bm=Pe("KEY_ESCAPE_COMMAND"),i$=Pe("KEY_DELETE_COMMAND"),vm=Pe("KEY_TAB_COMMAND"),o$=Pe("INSERT_TAB_COMMAND"),Hp=Pe("INDENT_CONTENT_COMMAND"),j0=Pe("OUTDENT_CONTENT_COMMAND"),s$=Pe("DROP_COMMAND"),rD=Pe("FORMAT_ELEMENT_COMMAND"),l$=Pe("DRAGSTART_COMMAND"),a$=Pe("DRAGOVER_COMMAND"),iD=Pe("DRAGEND_COMMAND"),Sm=Pe("COPY_COMMAND"),Rb=Pe("CUT_COMMAND"),c$=Pe("SELECT_ALL_COMMAND"),oD=Pe("CLEAR_EDITOR_COMMAND"),sD=Pe("CLEAR_HISTORY_COMMAND"),vl=Pe("CAN_REDO_COMMAND"),Sl=Pe("CAN_UNDO_COMMAND"),wm=Pe("FOCUS_COMMAND"),Lb=Pe("BLUR_COMMAND"),lD=Pe("KEY_MODIFIER_COMMAND");function aD(t){const e=new Map;return{dispose(){for(const n of e.values())n.dispose();e.clear()},register(n,r){let i=e.get(n);i===void 0&&(i={dispose:t(n,r),holders:new Set},e.set(n,i));const o=()=>{const s=e.get(n);s&&s.holders.delete(o)&&s.holders.size===0&&(e.delete(n),s.dispose())};return i.holders.add(o),o}}}function Ib(t,e,n,r){return t.addEventListener(e,n,r),t.removeEventListener.bind(t,e,n,r)}const bo=Object.freeze({}),X0=[["keydown",function(t,e){const n=e._inputState;n.lastKeyDownTimeStamp=t.timeStamp,n.lastKeyCode=t.key,t.key!=="Backspace"&&_f(n),!e.isComposing()&&be(e,xm,t)}],["pointerdown",function(t,e){const n=Ub(t),r=t.pointerType;Xc(n)&&r!=="touch"&&r!=="pen"&&t.button===0&&ni(e,()=>{ag(n,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(t,e){be(e,JE,t)}],["compositionend",function(t,e){const n=e._inputState;Ho?n.compositionPhase="ending-firefox":Ms||!xh&&!bh?be(e,e$,t):(n.compositionPhase="ending-safari",n.compositionEndData=t.data)}],["input",function(t,e){t.stopPropagation();const n=e._inputState;_f(n),ni(e,()=>{d$(t,e)||e.dispatchCommand(KE,t)},{event:t}),n.unprocessedBeforeInputData=null}],["click",function(t,e){ni(e,()=>{const n=ne(),r=ur(kr(e)),i=aa();if(r){if(X(n)){const o=n.anchor,s=o.getNode();o.type==="element"&&o.offset===0&&n.isCollapsed()&&!Nt(s)&&ut().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(t.pointerType==="touch"||t.pointerType==="pen"){const o=ai(r,e._rootElement).anchorNode;(Qe(o)||wr(o))&&Vt(Nb(i,r,e,t))}}be(e,Pb,t)})}],["cut",bo],["copy",bo],["dragstart",bo],["dragover",bo],["dragend",bo],["paste",bo],["focus",bo],["blur",bo],["drop",bo]];pc&&X0.push(["beforeinput",(t,e)=>(function(n,r){const i=n.inputType;i==="deleteCompositionText"||Ho&&nA(r)||i!=="insertCompositionText"&&ni(r,()=>{d$(n,r)||be(r,GE,n)},{event:n})})(t,e)]);const W0=new WeakMap,qp=new WeakMap,cD=aD(t=>(t.addEventListener("selectionchange",Qk),()=>t.removeEventListener("selectionchange",Qk)));function u$(t,e,n,r,i,o){const s=t.anchor,l=t.focus,a=s.getNode(),c=at();let u;if(o!==void 0)u=o;else{const g=ur(kr(c));u=g!==null?ai(g,c._rootElement):null}const f=u!==null?u.anchorNode:null,h=s.key,d=c.getElementByKey(h),p=n.length;return h!==l.key||!Y(a)||(!i&&(!pc||c._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||a.isDirty()&&p<2||J$(n))&&s.offset!==l.offset&&!a.isComposing()||Dr(a)||a.isDirty()&&p>1||(i||!pc)&&d!==null&&!a.isComposing()&&f!==As(a,d,c)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!a.isComposing()&&(a.getFormat()!==t.format||a.getStyle()!==t.style)||(function(g,m){if(m.isSegmented())return!0;if(!g.isCollapsed())return!1;const O=g.anchor.offset,y=m.getParentOrThrow(),x=Pl(m);return O===0?!m.canInsertTextBefore()||!y.canInsertTextBefore()&&!m.isComposing()||x||(function(b){const S=b.getPreviousSibling();return(Y(S)||N(S)&&S.isInline())&&!S.canInsertTextAfter()})(m):O===m.getTextContentSize()&&(!m.canInsertTextAfter()||!y.canInsertTextAfter()&&!m.isComposing()||x)})(t,a)}function Pk(t,e){return wr(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function Ek(t,e,n){const{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=ai(t,e._rootElement),l=e._inputState;l.isSelectionChangeFromDOMUpdate&&(l.isSelectionChangeFromDOMUpdate=!1,Pk(r,i)&&Pk(o,s)&&!l.postDeleteSelectionToRestore)||ni(e,()=>{if(!n)return void Vt(null);if(!kh(e,r,o))return;let a=ne();if(l.postDeleteSelectionToRestore&&X(a)&&a.isCollapsed()){const c=a.anchor,u=l.postDeleteSelectionToRestore.anchor;(c.key===u.key&&c.offset===u.offset+1||c.offset===1&&u.getNode().is(c.getNode().getPreviousSibling()))&&(a=l.postDeleteSelectionToRestore.clone(),Vt(a))}if(l.postDeleteSelectionToRestore=null,X(a)){const c=a.anchor,u=c.getNode();if(a.isCollapsed()){t.type==="Range"&&r===o&&(a.dirty=!0);const f=kr(e).event,h=f?f.timeStamp:performance.now(),{format:d,style:p,offset:g,key:m,timeStamp:O}=l.collapsedSelectionFormat,y=ut(),x=e.isComposing()===!1&&y.getTextContent()==="";if(h<O+200&&c.offset===g&&c.key===m)lp(a,d,p);else if(c.type==="text")Y(u)||q(141),f$(a,u);else if(c.type==="element"&&!x){N(u)||q(259);const b=c.getNode();b.isEmpty()?(function(S,v){const w=v.getTextFormat(),k=v.getTextStyle();lp(S,w,k)})(a,b):lp(a,a.format,"")}}else{const f=c.key,h=a.focus.key,d=a.getNodes(),p=d.length,g=a.isBackward(),m=g?s:i,O=g?i:s,y=g?h:f,x=g?f:h;let b=2047,S=!1;for(let v=0;v<p;v++){const w=d[v],k=w.getTextContentSize();if(Y(w)&&k!==0&&!(v===0&&w.__key===y&&m===k||v===p-1&&w.__key===x&&O===0)&&(S=!0,b&=w.getFormat(),b===0))break}a.format=S?b:0}}be(e,Tb,void 0)})}function lp(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function f$(t,e){lp(t,e.getFormat(),e.getStyle())}function h$(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return e.length===0?null:e[0]}function $k(t){const{lastKeyCode:e}=at()._inputState;if(t==null||t.length<=1||e==null)return;const n=e.length===1?e:e==="Enter"?`
5
5
  `:e==="Tab"?" ":null;if(!n)return;const r=ne();if(!X(r)||!r.isCollapsed())return;const i=r.anchor.getNode();if(!Y(i))return;const{offset:o}=r.anchor;if(i.getTextContentSize()===o){const s=i.getNextSibling();if(n===`
@@ -112,7 +112,7 @@ var Gw=t=>{throw TypeError(t)};var Kw=(t,e,n)=>e.has(t)||Gw("Cannot "+n);var Fn=
112
112
  `))};if((Oe.mac||Oe.android)&&f.from==s-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:rt.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);ZS(e,f,H.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],o=null;for(let s=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);s<l;s++){let a=e.coordsForChar(s);o=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||o||new DOMRect,i.push(o)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let o of r.getTextFormats()){let s=o.underlineStyle,l=o.underlineThickness;if(!/none/i.test(s)&&!/none/i.test(l)){let a=this.toEditorPos(o.rangeStart),c=this.toEditorPos(o.rangeEnd);if(a<c){let u=`text-decoration: underline ${/^[a-z]/.test(s)?s+" ":s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;i.push(ke.mark({attributes:{style:u}}).range(a,c))}}}e.dispatch({effects:b4.of(ke.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=Kf(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((o,s,l,a,c)=>{if(r)return;let u=c.length-(s-o);if(i&&s>=i.to)if(i.from==o&&i.to==s&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(o+=n,s+=n,s<=this.from)this.from+=u,this.to+=u;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),c.toString()),this.to+=u}n+=u}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class se{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(o=>r(o,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Ote(e.parent)||document,this.viewState=new H5(this,e.state||ze.create(e)),e.scrollTo&&e.scrollTo.is(Td)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(za).map(i=>new R1(i));for(let i of this.plugins)i.update(this);this.observer=new Fne(this),this.inputState=new cne(this),this.inputState.ensureHandlers(this.plugins),this.docView=new R5(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof on?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,o=this.state;for(let h of e){if(h.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=h.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,l=0,a=null;e.some(h=>h.annotation(I4))?(this.inputState.notifiedFocused=s,l=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=D4(o,s),a||(l=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(u=null)):this.observer.clear(),o.facet(ze.phrases)!=this.state.facet(ze.phrases))return this.setState(o);i=Ng.create(this,o,e),i.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:d}=h.state.selection,{x:p,y:g}=this.state.facet(se.cursorScrollMargin);f=new cc(d.empty?d:H.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",g,p)}for(let d of h.effects)d.is(Td)&&(f=d.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=zg.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Nu)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Md)!=i.state.facet(Md)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let h of this.state.facet(Qx))try{h(i)}catch(d){yr(this.state,d,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!E4(this,u)&&c.force&&ac(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new H5(this,e),this.plugins=e.facet(za).map(r=>new R1(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new R5(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(za),r=e.state.facet(za);if(n!=r){let i=[];for(let o of r){let s=n.indexOf(o);if(s<0)i.push(new R1(o));else{let l=this.plugins[s];l.mustUpdate=e,i.push(l)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){yr(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:s,scaleY:l}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(s<0){if(r4(r||this.win))o=-1,s=this.viewState.heightMap.height/this.viewState.scaleY;else{let p=this.viewState.scrollAnchorAt(i);o=p.from,s=p.top}l=this.viewState.scaleY}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let f=u.map(p=>{try{return p.read(this)}catch(g){return yr(this.state,g),K5}}),h=Ng.create(this,this.state,[]),d=!1;h.flags|=c,n?n.flags|=c:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h),d&&this.docViewUpdate());for(let p=0;p<u.length;p++)if(f[p]!=K5)try{let g=u[p];g.write&&g.write(f[p],this)}catch(g){yr(this.state,g)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let g=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)/this.viewState.scaleY-s/l;if((g>1||g<-1)&&!(Oe.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+g,r?o<0?r.scrollTop=r.scrollHeight:r.scrollTop+=g:this.win.scrollBy(0,g),s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(Qx))a(n)}get themeClasses(){return Nx+" "+(this.state.facet(Dx)?F4:B4)+" "+this.state.facet(Md)}updateAttrs(){let e=J5(this,v4,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ao)?"true":"false",class:"cm-content",style:`${Oe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),J5(this,VS,n);let r=this.observer.ignore(()=>{let i=P5(this.contentDOM,this.contentAttrs,n),o=P5(this.dom,this.editorAttrs,e);return i||o});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(se.announce)){n&&(this.announceDOM.textContent=""),n=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Nu);let e=this.state.facet(se.cspNonce);ss.mount(this.root,this.styleModules.concat(Vne).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return N1(this,e,L5(this,e,n,r))}moveByGroup(e,n){return N1(this,e,L5(this,e,n,r=>Jte(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),o=r[n?r.length-1:0];return H.cursor(o.side(n,i)+e.from,o.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return Kte(this,e,n,r)}moveVertically(e,n,r){return N1(this,e,ene(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=Lx(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),Lx(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),o=i[ro.find(i,e-r.from,-1,n)];return this.docView.coordsAt(e,n,o.dir==_t.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(O4)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>jne)return c4(e.length);let n=this.textDirectionAt(e.from),r;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==n&&(o.fresh||a4(o.isolates,r=A5(this,e))))return o.order;r||(r=A5(this,e));let i=Cte(e.text,n,r);return this.bidiCache.push(new zg(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Oe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{n4(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){var r,i,o,s;return Td.of(new cc(typeof e=="number"?H.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(o=n.yMargin)!==null&&o!==void 0?o:5,(s=n.xMargin)!==null&&s!==void 0?s:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Td.of(new cc(H.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ht.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ht.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=ss.newName(),i=[Md.of(r),Nu.of(Vx(`.${r}`,e))];return n&&n.dark&&i.push(Dx.of(!0)),i}static baseTheme(e){return Fi.lowest(Nu.of(Vx("."+Nx,e,Z4)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&Wt.get(r)||Wt.get(e);return((n=i?.root)===null||n===void 0?void 0:n.view)||null}}se.styleModule=Nu;se.inputHandler=g4;se.clipboardInputFilter=DS;se.clipboardOutputFilter=NS;se.scrollHandler=x4;se.focusChangeEffect=m4;se.perLineTextDirection=O4;se.exceptionSink=p4;se.updateListener=Qx;se.editable=Ao;se.mouseSelectionStyle=d4;se.dragMovesSelection=h4;se.clickAddsSelectionRange=f4;se.decorations=fO;se.blockWrappers=S4;se.outerDecorations=BS;se.atomicRanges=Zh;se.bidiIsolatedRanges=w4;se.cursorScrollMargin=ye.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}});se.scrollMargins=k4;se.darkTheme=Dx;se.cspNonce=ye.define({combine:t=>t.length?t[0]:""});se.contentAttributes=VS;se.editorAttributes=v4;se.lineWrapping=se.contentAttributes.of({class:"cm-lineWrapping"});se.announce=Le.define();const jne=4096,K5={};class zg{constructor(e,n,r,i,o,s){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=o,this.order=s}static update(e,n){if(n.empty&&!e.some(o=>o.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:_t.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==i&&!n.touchesRange(s.from,s.to)&&r.push(new zg(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return r}}function J5(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let o=r[i],s=typeof o=="function"?o(t):o;s&&RS(s,n)}return n}const Xne=Oe.mac?"mac":Oe.windows?"win":Oe.linux?"linux":"key";function Wne(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,o,s,l;for(let a=0;a<n.length-1;++a){const c=n[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))e=="mac"?l=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),o&&(r="Ctrl-"+r),l&&(r="Meta-"+r),s&&(r="Shift-"+r),r}function Rd(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Hne=Fi.default(se.domEventHandlers({keydown(t,e){return j4(z4(e.state),t,e,"editor")}})),au=ye.define({enables:Hne}),eT=new WeakMap;function z4(t){let e=t.facet(au),n=eT.get(e);return n||eT.set(e,n=Une(e.reduce((r,i)=>r.concat(i),[]))),n}function qne(t,e,n){return j4(z4(t.state),e,t,n)}let ws=null;const Yne=4e3;function Une(t,e=Xne){let n=Object.create(null),r=Object.create(null),i=(s,l)=>{let a=r[s];if(a==null)r[s]=l;else if(a!=l)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,l,a,c,u)=>{var f,h;let d=n[s]||(n[s]=Object.create(null)),p=l.split(/ (?!$)/).map(O=>Wne(O,e));for(let O=1;O<p.length;O++){let y=p.slice(0,O).join(" ");i(y,!0),d[y]||(d[y]={preventDefault:!0,stopPropagation:!1,run:[x=>{let b=ws={view:x,prefix:y,scope:s};return setTimeout(()=>{ws==b&&(ws=null)},Yne),!0}]})}let g=p.join(" ");i(g,!1);let m=d[g]||(d[g]={preventDefault:!1,stopPropagation:!1,run:((h=(f=d._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});a&&m.run.push(a),c&&(m.preventDefault=!0),u&&(m.stopPropagation=!0)};for(let s of t){let l=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let c of l){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=s;for(let h in u)u[h].run.push(d=>f(d,Bx))}let a=s[e]||s.key;if(a)for(let c of l)o(c,a,s.run,s.preventDefault,s.stopPropagation),s.shift&&o(c,"Shift-"+a,s.shift,s.preventDefault,s.stopPropagation)}return n}let Bx=null;function j4(t,e,n,r){Bx=e;let i=ute(e),o=gr(i,0),s=Ui(o)==i.length&&i!=" ",l="",a=!1,c=!1,u=!1;ws&&ws.view==n&&ws.scope==r&&(l=ws.prefix+" ",Q4.indexOf(e.keyCode)<0&&(c=!0,ws=null));let f=new Set,h=m=>{if(m){for(let O of m.run)if(!f.has(O)&&(f.add(O),O(n)))return m.stopPropagation&&(u=!0),!0;m.preventDefault&&(m.stopPropagation&&(u=!0),c=!0)}return!1},d=t[r],p,g;return d&&(h(d[l+Rd(i,e,!s)])?a=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Oe.windows&&e.ctrlKey&&e.altKey)&&!(Oe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Xs[e.keyCode])&&p!=i?(h(d[l+Rd(p,e,!0)])||e.shiftKey&&(g=Uf[e.keyCode])!=i&&g!=p&&h(d[l+Rd(g,e,!1)]))&&(a=!0):s&&e.shiftKey&&h(d[l+Rd(i,e,!0)])&&(a=!0),!a&&h(d._any)&&(a=!0)),c&&(a=!0),a&&u&&e.stopPropagation(),Bx=null,a}class Al{constructor(e,n,r,i,o){this.className=e,this.left=n,this.top=r,this.width=i,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let o=X4(e);return[new Al(n,i.left-o.left,i.top-o.top,null,i.bottom-i.top)]}else return Gne(e,n,r)}}function X4(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==_t.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function tT(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let o=t.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,l=t.posAtCoords({x:o.left+1,y:s}),a=t.posAtCoords({x:o.right-1,y:s});return l==null||a==null?r:{from:Math.max(r.from,Math.min(l,a)),to:Math.min(r.to,Math.max(l,a))}}function Gne(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),o=t.textDirection==_t.LTR,s=t.contentDOM,l=s.getBoundingClientRect(),a=X4(t),c=s.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),f=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),h=l.right-(u?parseInt(u.paddingRight):0),d=Rx(t,r,1),p=Rx(t,i,-1),g=d.type==Dn.Text?d:null,m=p.type==Dn.Text?p:null;if(g&&(t.lineWrapping||d.widgetLineBreaks)&&(g=tT(t,r,1,g)),m&&(t.lineWrapping||p.widgetLineBreaks)&&(m=tT(t,i,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return y(x(n.from,n.to,g));{let S=g?x(n.from,null,g):b(d,!1),v=m?x(null,n.to,m):b(p,!0),w=[];return(g||d).to<(m||p).from-(g&&m?1:0)||d.widgetLineBreaks>1&&S.bottom+t.defaultLineHeight/2<v.top?w.push(O(f,S.bottom,h,v.top)):S.bottom<v.top&&t.elementAtHeight((S.bottom+v.top)/2).type==Dn.Text&&(S.bottom=v.top=(S.bottom+v.top)/2),y(S).concat(w).concat(y(v))}function O(S,v,w,k){return new Al(e,S-a.left,v-a.top,Math.max(0,w-S),k-v)}function y({top:S,bottom:v,horizontal:w}){let k=[];for(let P=0;P<w.length;P+=2)k.push(O(w[P],S,w[P+1],v));return k}function x(S,v,w){let k=1e9,P=-1e9,T=[];function M(D,Z,G,z,ee){let oe=t.coordsAtPos(D,D==w.to?-2:2),Q=t.coordsAtPos(G,G==w.from?2:-2);!oe||!Q||(k=Math.min(oe.top,Q.top,k),P=Math.max(oe.bottom,Q.bottom,P),ee==_t.LTR?T.push(o&&Z?f:oe.left,o&&z?h:Q.right):T.push(!o&&z?f:Q.left,!o&&Z?h:oe.right))}let I=S??w.from,$=v??w.to;for(let D of t.visibleRanges)if(D.to>I&&D.from<$)for(let Z=Math.max(D.from,I),G=Math.min(D.to,$);;){let z=t.state.doc.lineAt(Z);for(let ee of t.bidiSpans(z)){let oe=ee.from+z.from,Q=ee.to+z.from;if(oe>=G)break;Q>Z&&M(Math.max(oe,Z),S==null&&oe<=I,Math.min(Q,G),v==null&&Q>=$,ee.dir)}if(Z=z.to+1,Z>=G)break}return T.length==0&&M(I,S==null,$,v==null,t.textDirection),{top:k,bottom:P,horizontal:T}}function b(S,v){let w=l.top+(v?S.top:S.bottom);return{top:w,bottom:w,horizontal:[]}}}function Kne(t,e){return t.constructor==e.constructor&&t.eq(e)}class Jne{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Rp)!=e.state.facet(Rp)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Rp);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Kne(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e,Oe.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Rp=ye.define();function W4(t){return[Ht.define(e=>new Jne(e,t)),Rp.of(t)]}const Ec=ye.define({combine(t){return xo(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function ere(t={}){return[Ec.of(t),tre,nre,ire,y4.of(!0)]}function H4(t){return t.startState.facet(Ec)!=t.state.facet(Ec)}const tre=W4({above:!0,markers(t){let{state:e}=t,n=e.facet(Ec),r=[];for(let i of e.selection.ranges){let o=i==e.selection.main;if(i.empty||n.drawRangeCursor&&!(o&&Oe.ios&&n.iosSelectionHandles)){let s=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:H.cursor(i.head,i.assoc);for(let a of Al.forRange(t,s,l))r.push(a)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=H4(t);return n&&nT(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){nT(e.state,t)},class:"cm-cursorLayer"});function nT(t,e){e.style.animationDuration=t.facet(Ec).cursorBlinkRate+"ms"}const nre=W4({above:!1,markers(t){let e=[],{main:n,ranges:r}=t.state.selection;for(let i of r)if(!i.empty)for(let o of Al.forRange(t,"cm-selectionBackground",i))e.push(o);if(Oe.ios&&!n.empty&&t.state.facet(Ec).iosSelectionHandles){for(let i of Al.forRange(t,"cm-selectionHandle cm-selectionHandle-start",H.cursor(n.from,1)))e.push(i);for(let i of Al.forRange(t,"cm-selectionHandle cm-selectionHandle-end",H.cursor(n.to,1)))e.push(i)}return e},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||H4(t)},class:"cm-selectionLayer"}),rre=Oe.gecko&&Oe.gecko_version==153?"#ffffff01":"transparent",ire=Fi.highest(se.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${rre} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),q4=Le.define({map(t,e){return t==null?null:e.mapPos(t)}}),Bu=cn.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(q4)?r.value:n,t)}}),ore=Ht.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Bu);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Bu)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Bu),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Bu)!=t&&this.view.dispatch({effects:q4.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function sre(){return[Bu,ore]}function rT(t,e,n,r,i){e.lastIndex=0;for(let o=t.iterRange(n,r),s=n,l;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;l=e.exec(o.value);)i(s+l.index,l)}function lre(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}class are{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:o,maxLength:s=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(l,a,c,u)=>i(u,c,c+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,c,u)=>{let f=r(l,a,c);f&&u(c,c+l[0].length,f)};else if(r)this.addMatch=(l,a,c,u)=>u(c,c+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=s}createDeco(e){let n=new ir,r=n.add.bind(n);for(let{from:i,to:o}of lre(e,this.maxLength))rT(e.state.doc,this.regexp,i,o,(s,l)=>this.addMatch(l,e,s,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((o,s,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),i=Math.max(a,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let o of e.visibleRanges){let s=Math.max(o.from,r),l=Math.min(o.to,i);if(l>=s){let a=e.state.doc.lineAt(s),c=a.to<l?e.state.doc.lineAt(l):a,u=Math.max(o.from,a.from),f=Math.min(o.to,c.to);if(this.boundary){for(;s>a.from;s--)if(this.boundary.test(a.text[s-1-a.from])){u=s;break}for(;l<c.to;l++)if(this.boundary.test(c.text[l-c.from])){f=l;break}}let h=[],d,p=(g,m,O)=>h.push(O.range(g,m));if(a==c)for(this.regexp.lastIndex=u-a.from;(d=this.regexp.exec(a.text))&&d.index<f-a.from;)this.addMatch(d,e,d.index+a.from,p);else rT(e.state.doc,this.regexp,u,f,(g,m)=>this.addMatch(m,e,g,p));n=n.update({filterFrom:u,filterTo:f,filter:(g,m)=>g<u||m>f,add:h})}}return n}}const Fx=/x/.unicode!=null?"gu":"g",cre=new RegExp(`[\0-\b
113
113
  --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Fx),ure={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let F1=null;function fre(){var t;if(F1==null&&typeof document<"u"&&document.body){let e=document.body.style;F1=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return F1||!1}const Lp=ye.define({combine(t){let e=xo(t,{render:null,specialChars:cre,addSpecialChars:null});return(e.replaceTabs=!fre())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Fx)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Fx)),e}});function hre(t={}){return[Lp.of(t),dre()]}let iT=null;function dre(){return iT||(iT=Ht.fromClass(class{constructor(t){this.view=t,this.decorations=ke.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Lp)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new are({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,o=gr(e[0],0);if(o==9){let s=i.lineAt(r),l=n.state.tabSize,a=Ni(s.text,l,r-s.from);return ke.replace({widget:new Ore((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=ke.replace({widget:new mre(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Lp);t.startState.facet(Lp)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const pre="•";function gre(t){return t>=32?pre:t==10?"␤":String.fromCharCode(9216+t)}class mre extends pi{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=gre(this.code),r=e.state.phrase("Control character")+" "+(ure[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let o=document.createElement("span");return o.textContent=n,o.title=r,o.setAttribute("aria-label",r),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class Ore extends pi{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function yre(){return bre}const xre=ke.line({class:"cm-activeLine"}),bre=Ht.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(xre.range(i.from)),e=i.from)}return ke.set(n)}},{decorations:t=>t.decorations}),Zx=2e3;function vre(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),o=[];if(e.off>Zx||n.off>Zx||e.col<0||n.col<0){let s=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let a=r;a<=i;a++){let c=t.doc.line(a);c.length<=l&&o.push(H.range(c.from+s,c.to+l))}}else{let s=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let a=r;a<=i;a++){let c=t.doc.line(a),u=vx(c.text,s,t.tabSize,!0);if(u<0)o.push(H.cursor(c.to));else{let f=vx(c.text,l,t.tabSize);o.push(H.range(c.from+u,c.from+f))}}}return o}function Sre(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function oT(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,o=i>Zx?-1:i==r.length?Sre(t,e.clientX):Ni(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function wre(t,e){let n=oT(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let o=i.changes.mapPos(i.startState.doc.line(n.line).from),s=i.state.doc.lineAt(o);n={line:s.number,col:n.col,off:Math.min(n.off,s.length)},r=r.map(i.changes)}},get(i,o,s){let l=oT(t,i);if(!l)return r;let a=vre(t.state,n,l);return a.length?s?H.create(a.concat(r.ranges)):H.create(a):r}}:null}function kre(t){let e=(n=>n.altKey&&n.button==0);return se.mouseSelectionStyle.of((n,r)=>e(r)?wre(n,r):null)}const Cre={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},_re={style:"cursor: crosshair"};function Tre(t={}){let[e,n]=Cre[t.key||"Alt"],r=Ht.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,se.contentAttributes.of(i=>{var o;return!((o=i.plugin(r))===null||o===void 0)&&o.isDown?_re:null})]}const Ld="-10000px";class Y4{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(s=>s);let o=null;this.tooltipViews=this.tooltips.map(s=>o=r(s,o))}update(e,n){var r;let i=e.state.facet(this.facet),o=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let s=[],l=n?[]:null;for(let a=0;a<o.length;a++){let c=o[a],u=-1;if(c){for(let f=0;f<this.tooltips.length;f++){let h=this.tooltips[f];h&&h.create==c.create&&(u=f)}if(u<0)s[a]=this.createTooltipView(c,a?s[a-1]:null),l&&(l[a]=!!c.above);else{let f=s[a]=this.tooltipViews[u];l&&(l[a]=n[u]),f.update&&f.update(e)}}}for(let a of this.tooltipViews)s.indexOf(a)<0&&(this.removeTooltipView(a),(r=a.destroy)===null||r===void 0||r.call(a));return n&&(l.forEach((a,c)=>n[c]=a),n.length=l.length),this.input=i,this.tooltips=o,this.tooltipViews=s,!0}}function Pre(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Z1=ye.define({combine:t=>{var e,n,r;return{position:Oe.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Pre}}}),sT=new WeakMap,XS=Ht.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Z1);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Y4(t,WS,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Z1);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=Ld,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:o}=this.manager.tooltipViews[0];if(Oe.safari){let s=o.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}else n=!!o.offsetParent&&o.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let o=this.parent.getBoundingClientRect();o.width&&o.height&&(t=o.width/this.parent.offsetWidth,e=o.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=FS(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((o,s)=>{let l=this.manager.tooltipViews[s];return l.getCoords?l.getCoords(o.pos):this.view.coordsAtPos(o.pos)}),size:this.manager.tooltipViews.map(({dom:o})=>o.getBoundingClientRect()),space:this.view.state.facet(Z1).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:o}=t,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:u}=c,f=t.pos[l],h=t.size[l];if(!f||a.clip!==!1&&(f.bottom<=Math.max(n.top,r.top)||f.top>=Math.min(n.bottom,r.bottom)||f.right<Math.max(n.left,r.left)-.1||f.left>Math.min(n.right,r.right)+.1)){u.style.top=Ld;continue}let d=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,g=h.right-h.left,m=(e=sT.get(c))!==null&&e!==void 0?e:h.bottom-h.top,O=c.offset||$re,y=this.view.textDirection==_t.LTR,x=h.width>r.right-r.left?y?r.left:r.right-h.width:y?Math.max(r.left,Math.min(f.left-(d?14:0)+O.x,r.right-g)):Math.min(Math.max(r.left,f.left-g+(d?14:0)-O.x),r.right-g),b=this.above[l];!a.strictSide&&(b?f.top-m-p-O.y<r.top:f.bottom+m+p+O.y>r.bottom)&&b==r.bottom-f.bottom>f.top-r.top&&(b=this.above[l]=!b);let S=(b?f.top-r.top:r.bottom-f.bottom)-p;if(S<m&&c.resize!==!1){if(S<this.view.defaultLineHeight){u.style.top=Ld;continue}sT.set(c,m),u.style.height=(m=S)/o+"px"}else u.style.height&&(u.style.height="");let v=b?f.top-m-p-O.y:f.bottom+p+O.y,w=x+g;if(c.overlap!==!0)for(let k of s)k.left<w&&k.right>x&&k.top<v+m&&k.bottom>v&&(v=b?k.top-m-2-p:k.bottom+p+2);if(this.position=="absolute"?(u.style.top=(v-t.parent.top)/o+"px",lT(u,(x-t.parent.left)/i)):(u.style.top=v/o+"px",lT(u,x/i)),d){let k=f.left+(y?O.x:-O.x)-(x+14-7);d.style.left=k/i+"px"}c.overlap!==!0&&s.push({left:x,top:v,right:w,bottom:v+m}),u.classList.toggle("cm-tooltip-above",b),u.classList.toggle("cm-tooltip-below",!b),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Ld}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lT(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Ere=se.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),$re={x:0,y:0},WS=ye.define({enables:[XS,Ere]}),jg=ye.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class gO{static create(e){return new gO(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Y4(e,jg,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Are=WS.compute([jg],t=>{let e=t.facet(jg);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:gO.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),U4=ye.define();class Qre{constructor(e,n,r,i,o,s){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=o,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let i,o=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let s=e.coordsAtPos(i);if(!s||n.y<s.top||n.y>s.bottom||n.x<s.left-e.defaultCharacterWidth||n.x>s.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),a=l&&l.dir==_t.RTL?-1:1;o=n.x<s.left?-a:a}this.activateHover(e,i,o)}activateHover(e,n,r,i){let o=this.source(e,n,r),s=l=>{if(l&&!(Array.isArray(l)&&!l.length)){let a=Array.isArray(l)?l:[l];i&&this.locked.set(a,i),e.dispatch({effects:this.setHover.of(a)})}};if(o&&"then"in o){let l=this.pending={pos:n};o.then(a=>{this.pending==l&&(this.pending=null,s(a))},a=>yr(e.state,a,"hover tooltip"))}else s(o)}get tooltip(){let e=this.view.plugin(XS),n=e?e.manager.tooltips.findIndex(r=>r.create==gO.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:o}=this;if(i.length&&!this.locked.has(i)&&o&&!Mre(o.dom,e)||this.pending){let{pos:s}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:s;(s==l?this.view.posAtCoords(this.lastMove)!=s:!Rre(this.view,s,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Id=4;function Mre(t,e){let{left:n,right:r,top:i,bottom:o}=t.getBoundingClientRect(),s;if(s=t.querySelector(".cm-tooltip-arrow")){let l=s.getBoundingClientRect();i=Math.min(l.top,i),o=Math.max(l.bottom,o)}return e.clientX>=n-Id&&e.clientX<=r+Id&&e.clientY>=i-Id&&e.clientY<=o+Id}function Rre(t,e,n,r,i,o){let s=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(s.left>r||s.right<r||s.top>i||Math.min(s.bottom,l)<i)return!1;let a=t.posAtCoords({x:r,y:i},!1);return a>=e&&a<=n}function Lre(t,e={}){let n=Le.define(),r=new WeakMap,i=cn.define({create(){return[]},update(s,l){let a=r.get(s);if(s.length&&(e.hideOnChange&&(l.docChanged||l.selection)?s=[]:a&&a(l)?s=[]:e.hideOn&&(s=s.filter(c=>!e.hideOn(l,c)))),l.docChanged&&s.length){let c=[];for(let u of s){let f=l.changes.mapPos(u.pos,-1,Mn.TrackDel);if(f!=null){let h=Object.assign(Object.create(null),u);h.pos=f,h.end!=null&&(h.end=l.changes.mapPos(h.end)),c.push(h)}}s=c}for(let c of l.effects)c.is(n)&&(s=c.value,a=void 0),(c.is(Dre)&&!c.value||c.value==i)&&(s=[]);return s.length&&a&&r.set(s,a),s},provide:s=>jg.from(s)});const o=Ht.define(s=>new Qre(s,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,o,U4.of(o),Are]}}function Ire(t,e,n,r={}){var i;let o=t.state.facet(U4).map(s=>t.plugin(s)).filter(s=>!!s);if(r.tooltip&&r.tooltip.active){let s=o.find(l=>l.field==r.tooltip.active);s&&(o=[s])}for(let s of o)s.activateHover(t,e,n,(i=r.until)!==null&&i!==void 0?i:(()=>!1))}function G4(t,e){let n=t.plugin(XS);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Dre=Le.define(),aT=ye.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function mO(t,e){let n=t.plugin(K4),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const K4=Ht.fromClass(class{constructor(t){this.input=t.state.facet(eh),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(aT);this.top=new Dd(t,!0,e.topContainer),this.bottom=new Dd(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(aT);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dd(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dd(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(eh);if(n!=this.input){let r=n.filter(a=>a),i=[],o=[],s=[],l=[];for(let a of r){let c=this.specs.indexOf(a),u;c<0?(u=a(t.view),l.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?o:s).push(u)}this.specs=r,this.panels=i,this.top.sync(o),this.bottom.sync(s);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>se.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Dd{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=cT(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=cT(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function cT(t){let e=t.nextSibling;return t.remove(),e}const eh=ye.define({enables:K4});function Nre(t,e){let n,r=new Promise(s=>n=s),i=s=>Bre(s,e,n);t.state.field(Ip,!1)?t.dispatch({effects:J4.of(i)}):t.dispatch({effects:Le.appendConfig.of(Ip.init(()=>[i]))});let o=e7.of(i);return{close:o,result:r.then(s=>((t.win.queueMicrotask||(a=>t.win.setTimeout(a,10)))(()=>{t.state.field(Ip).indexOf(i)>-1&&t.dispatch({effects:o})}),s))}}function Vre(t,e){let n=t.state.field(Ip,!1)||[];for(let r of n){let i=mO(t,r);if(i&&i.dom.classList.contains(e))return i}return null}const Ip=cn.define({create(){return[]},update(t,e){for(let n of e.effects)n.is(J4)?t=[n.value].concat(t):n.is(e7)&&(t=t.filter(r=>r!=n.value));return t},provide:t=>eh.computeN([t],e=>e.field(t))}),J4=Le.define(),e7=Le.define();function Bre(t,e,n){let r=e.content?e.content(t,()=>s(null)):null;if(!r){if(r=xt("form"),e.input){let l=xt("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),r.appendChild(xt("label",(e.label||"")+": ",l))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(xt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let l=0;l<i.length;l++){let a=i[l];a.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),s(null)):c.keyCode==13&&(c.preventDefault(),s(a))}),a.addEventListener("submit",c=>{c.preventDefault(),s(a)})}let o=xt("div",r,xt("button",{onclick:()=>s(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(o.className=e.class),o.classList.add("cm-dialog");function s(l){o.contains(o.ownerDocument.activeElement)&&t.focus(),n(l)}return{dom:o,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=r.querySelector(e.focus):l=r.querySelector("input")||r.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class po extends js{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}po.prototype.elementClass="";po.prototype.toDOM=void 0;po.prototype.mapMode=Mn.TrackBefore;po.prototype.startSide=po.prototype.endSide=-1;po.prototype.point=!0;const Dp=ye.define(),Fre=ye.define(),Zre={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>qe.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},df=ye.define();function t7(t){return[n7(),df.of({...Zre,...t})]}const uT=ye.define({combine:t=>t.some(e=>e)});function n7(t){return[zre]}const zre=Ht.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(df).map(e=>new hT(t,e)),this.fixed=!t.state.facet(uT);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(uT)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=qe.iter(this.view.state.facet(Dp),this.view.viewport.from),r=[],i=this.gutters.map(o=>new jre(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(o.type)){let s=!0;for(let l of o.type)if(l.type==Dn.Text&&s){zx(n,r,l.from);for(let a of i)a.line(this.view,l,r);s=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(o.type==Dn.Text){zx(n,r,o.from);for(let s of i)s.line(this.view,o,r)}else if(o.widget)for(let s of i)s.widget(this.view,o);for(let o of i)o.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(df),n=t.state.facet(df),r=t.docChanged||t.heightChanged||t.viewportChanged||!qe.eq(t.startState.facet(Dp),t.state.facet(Dp),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let o of n){let s=e.indexOf(o);s<0?i.push(new hT(this.view,o)):(this.gutters[s].update(t),i.push(this.gutters[s]))}for(let o of this.gutters)o.dom.remove(),i.indexOf(o)<0&&o.destroy();for(let o of i)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>se.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,i=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==_t.LTR?{left:r,right:i}:{right:r,left:i}})});function fT(t){return Array.isArray(t)?t:[t]}function zx(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class jre{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=qe.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,o=(n.top-this.height)/e.scaleY,s=n.height/e.scaleY;if(this.i==i.elements.length){let l=new r7(e,s,o,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,s,o,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];zx(this.cursor,i,n.from),r.length&&(i=i.concat(r));let o=this.gutter.config.lineMarker(e,n,i);o&&i.unshift(o);let s=this.gutter;i.length==0&&!s.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let o of e.state.facet(Fre)){let s=o(e,n.widget,n);s&&(i||(i=[])).push(s)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class hT{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let o=i.target,s;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let a=o.getBoundingClientRect();s=(a.top+a.bottom)/2}else s=i.clientY;let l=e.lineBlockAtHeight(s-e.documentTop);n.domEventHandlers[r](e,l,i)&&i.preventDefault()});this.markers=fT(n.markers(e)),n.initialSpacer&&(this.spacer=new r7(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=fT(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!qe.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class r7{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Xre(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let o=0,s=0;;){let l=s,a=o<n.length?n[o++]:null,c=!1;if(a){let u=a.elementClass;u&&(r+=" "+u);for(let f=s;f<this.markers.length;f++)if(this.markers[f].compare(a)){l=f,c=!0;break}}else l=this.markers.length;for(;s<l;){let u=this.markers[s++];if(u.toDOM){u.destroy(i);let f=i.nextSibling;i.remove(),i=f}}if(!a)break;a.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),c&&s++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Xre(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const Wre=ye.define(),Hre=ye.define(),ja=ye.define({combine(t){return xo(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let o=r[i],s=n[i];r[i]=o?(l,a,c)=>o(l,a,c)||s(l,a,c):s}return r}})}});class z1 extends po{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function j1(t,e){return t.state.facet(ja).formatNumber(e,t.state)}const qre=df.compute([ja],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Wre)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new z1(j1(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(Hre)){let o=i(e,n,r);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(ja)!=e.state.facet(ja),initialSpacer(e){return new z1(j1(e,dT(e.state.doc.lines)))},updateSpacer(e,n){let r=j1(n.view,dT(n.view.state.doc.lines));return r==e.number?e:new z1(r)},domEventHandlers:t.facet(ja).domEventHandlers,side:"before"}));function HS(t={}){return[ja.of(t),n7(),qre]}function dT(t){let e=9;for(;e<t;)e=e*10+9;return e}const Yre=new class extends po{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Ure=Dp.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(Yre.range(i)))}return qe.of(e)});function Gre(){return Ure}let Kre=0;class Ir{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=Kre++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Ir&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new Ir(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new Xg(e);return r=>r.modified.indexOf(n)>-1?r:Xg.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}}let Jre=0;class Xg{constructor(e){this.name=e,this.instances=[],this.id=Jre++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&eie(n,l.modified));if(r)return r;let i=[],o=new Ir(e.name,i,e,n);for(let l of n)l.instances.push(o);let s=tie(n);for(let l of e.set)if(!l.modified.length)for(let a of s)i.push(Xg.get(l,a));return o}}function eie(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function tie(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function cu(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let o=[],s=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){s=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw new RangeError("Invalid path: "+i);if(o.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let d=i[f++];if(f==i.length&&d=="!"){s=0;break}if(d!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let a=o.length-1,c=o[a];if(!c)throw new RangeError("Invalid path: "+i);let u=new th(r,s,a>0?o.slice(0,a):null);e[c]=u.sort(e[c])}}return i7.add(e)}const i7=new Ve({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let o=new th(i.tags,i.mode,i.context);n?n.next=o:r=o,n=o}return r}});class th{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}th.empty=new th([],2,null);function o7(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let l of o)for(let a of l.set){let c=n[a.id];if(c){s=s?s+" "+c:c;break}}return s},scope:r}}function nie(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function rie(t,e,n,r=0,i=t.length){let o=new iie(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class iie{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,o){let{type:s,from:l,to:a}=e;if(l>=r||a<=n)return;s.isTop&&(o=this.highlighters.filter(d=>!d.scope||d.scope(s)));let c=i,u=oie(e)||th.empty,f=nie(o,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),c),u.opaque)return;let h=e.tree&&e.tree.prop(Ve.mounted);if(h&&h.overlay){let d=e.node.enter(h.overlay[0].from+l,1),p=this.highlighters.filter(m=>!m.scope||m.scope(h.tree.type)),g=e.firstChild();for(let m=0,O=l;;m++){let y=m<h.overlay.length?h.overlay[m]:null,x=y?y.from+l:a,b=Math.max(n,O),S=Math.min(r,x);if(b<S&&g)for(;e.from<S&&(this.highlightRange(e,b,S,i,o),this.startSpan(Math.min(S,e.to),c),!(e.to>=x||!e.nextSibling())););if(!y||x>r)break;O=y.to+l,O>n&&(this.highlightRange(d.cursor(),Math.max(n,y.from+l),Math.min(r,O),"",p),this.startSpan(Math.min(r,O),c))}g&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function oie(t){let e=t.type.prop(i7);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const de=Ir.define,Nd=de(),xs=de(),pT=de(xs),gT=de(xs),bs=de(),Vd=de(bs),X1=de(bs),Hi=de(),hl=de(Hi),Xi=de(),Wi=de(),jx=de(),$u=de(jx),Bd=de(),A={comment:Nd,lineComment:de(Nd),blockComment:de(Nd),docComment:de(Nd),name:xs,variableName:de(xs),typeName:pT,tagName:de(pT),propertyName:gT,attributeName:de(gT),className:de(xs),labelName:de(xs),namespace:de(xs),macroName:de(xs),literal:bs,string:Vd,docString:de(Vd),character:de(Vd),attributeValue:de(Vd),number:X1,integer:de(X1),float:de(X1),bool:de(bs),regexp:de(bs),escape:de(bs),color:de(bs),url:de(bs),keyword:Xi,self:de(Xi),null:de(Xi),atom:de(Xi),unit:de(Xi),modifier:de(Xi),operatorKeyword:de(Xi),controlKeyword:de(Xi),definitionKeyword:de(Xi),moduleKeyword:de(Xi),operator:Wi,derefOperator:de(Wi),arithmeticOperator:de(Wi),logicOperator:de(Wi),bitwiseOperator:de(Wi),compareOperator:de(Wi),updateOperator:de(Wi),definitionOperator:de(Wi),typeOperator:de(Wi),controlOperator:de(Wi),punctuation:jx,separator:de(jx),bracket:$u,angleBracket:de($u),squareBracket:de($u),paren:de($u),brace:de($u),content:Hi,heading:hl,heading1:de(hl),heading2:de(hl),heading3:de(hl),heading4:de(hl),heading5:de(hl),heading6:de(hl),contentSeparator:de(Hi),list:de(Hi),quote:de(Hi),emphasis:de(Hi),strong:de(Hi),link:de(Hi),monospace:de(Hi),strikethrough:de(Hi),inserted:de(),deleted:de(),changed:de(),invalid:de(),meta:Bd,documentMeta:de(Bd),annotation:de(Bd),processingInstruction:de(Bd),definition:Ir.defineModifier("definition"),constant:Ir.defineModifier("constant"),function:Ir.defineModifier("function"),standard:Ir.defineModifier("standard"),local:Ir.defineModifier("local"),special:Ir.defineModifier("special")};for(let t in A){let e=A[t];e instanceof Ir&&(e.name=t)}o7([{tag:A.link,class:"tok-link"},{tag:A.heading,class:"tok-heading"},{tag:A.emphasis,class:"tok-emphasis"},{tag:A.strong,class:"tok-strong"},{tag:A.keyword,class:"tok-keyword"},{tag:A.atom,class:"tok-atom"},{tag:A.bool,class:"tok-bool"},{tag:A.url,class:"tok-url"},{tag:A.labelName,class:"tok-labelName"},{tag:A.inserted,class:"tok-inserted"},{tag:A.deleted,class:"tok-deleted"},{tag:A.literal,class:"tok-literal"},{tag:A.string,class:"tok-string"},{tag:A.number,class:"tok-number"},{tag:[A.regexp,A.escape,A.special(A.string)],class:"tok-string2"},{tag:A.variableName,class:"tok-variableName"},{tag:A.local(A.variableName),class:"tok-variableName tok-local"},{tag:A.definition(A.variableName),class:"tok-variableName tok-definition"},{tag:A.special(A.variableName),class:"tok-variableName2"},{tag:A.definition(A.propertyName),class:"tok-propertyName tok-definition"},{tag:A.typeName,class:"tok-typeName"},{tag:A.namespace,class:"tok-namespace"},{tag:A.className,class:"tok-className"},{tag:A.macroName,class:"tok-macroName"},{tag:A.propertyName,class:"tok-propertyName"},{tag:A.operator,class:"tok-operator"},{tag:A.comment,class:"tok-comment"},{tag:A.meta,class:"tok-meta"},{tag:A.invalid,class:"tok-invalid"},{tag:A.punctuation,class:"tok-punctuation"}]);var W1;const Ps=new Ve;function OO(t){return ye.define({combine:t?e=>e.concat(t):void 0})}const qS=new Ve;class Nr{constructor(e,n,r=[],i=""){this.data=e,this.name=i,ze.prototype.hasOwnProperty("tree")||Object.defineProperty(ze.prototype,"tree",{get(){return wt(this)}}),this.parser=n,this.extension=[Hs.of(this),ze.languageData.of((o,s,l)=>{let a=mT(o,s,l),c=a.type.prop(Ps);if(!c)return[];let u=o.facet(c),f=a.type.prop(qS);if(f){let h=a.resolve(s-a.from,l);for(let d of f)if(d.test(h,o)){let p=o.facet(d.facet);return d.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return mT(e,n,r).type.prop(Ps)==this.data}findRegions(e){let n=e.facet(Hs);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(o,s)=>{if(o.prop(Ps)==this.data){r.push({from:s,to:s+o.length});return}let l=o.prop(Ve.mounted);if(l){if(l.tree.prop(Ps)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+s,to:a.to+s});else r.push({from:s,to:s+o.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+s),r.length>a)return}}for(let a=0;a<o.children.length;a++){let c=o.children[a];c instanceof Ye&&i(c,o.positions[a]+s)}};return i(wt(e),0),r}get allowsNesting(){return!0}}Nr.setState=Le.define();function mT(t,e,n){let r=t.facet(Hs),i=wt(t).topNode;if(!r||r.allowsNesting)for(let o=i;o;o=o.enter(e,n,dt.ExcludeBuffers|dt.EnterBracketed))o.type.isTop&&(i=o);return i}class $c extends Nr{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=OO(e.languageData);return new $c(n,e.parser.configure({props:[Ps.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new $c(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function wt(t){let e=t.field(Nr.state,!1);return e?e.tree:Ye.empty}class sie{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Au=null;class ea{constructor(e,n,r=[],i,o,s,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=o,this.viewport=s,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new ea(e,n,[],Ye.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sie(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ye.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(jo.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(jo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Au;Au=this;try{return e()}finally{Au=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=OT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:o,viewport:s,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((c,u,f,h)=>a.push({fromA:c,toA:u,fromB:f,toB:h})),r=jo.applyChanges(r,a),i=Ye.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){l=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);u<f&&l.push({from:u,to:f})}}}return new ea(this.parser,n,r,i,o,s,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:o}=this.skipped[r];i<e.to&&o>e.from&&(this.fragments=OT(this.fragments,i,o),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends cO{createParse(n,r,i){let o=i[0].from,s=i[i.length-1].to;return{parsedPos:o,advance(){let a=Au;if(a){for(let c of i)a.tempSkipped.push(c);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=s,new Ye(an.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Au}}function OT(t,e,n){return jo.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Ac{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Ac(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=ea.create(e.facet(Hs).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Ac(r)}}Nr.state=cn.define({create:Ac.init,update(t,e){for(let n of e.effects)if(n.is(Nr.setState))return n.value;return e.startState.facet(Hs)!=e.state.facet(Hs)?Ac.init(e.state):t.apply(e)}});let s7=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(s7=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const H1=typeof navigator<"u"&&(!((W1=navigator.scheduling)===null||W1===void 0)&&W1.isInputPending)?()=>navigator.scheduling.isInputPending():null,lie=Ht.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Nr.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Nr.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=s7(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,o=r.field(Nr.state);if(o.tree==o.context.tree&&o.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!H1?Math.max(25,e.timeRemaining()-5):1e9),l=o.context.treeLen<i&&r.doc.length>i+1e3,a=o.context.work(()=>H1&&H1()||Date.now()>s,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Nr.setState.of(new Ac(o.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>yr(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Hs=ye.define({combine(t){return t.length?t[0]:null},enables:t=>[Nr.state,lie,se.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Qc{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class j{constructor(e,n,r,i,o,s=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=o,this.support=s,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:n,support:r}=e;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new j(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,n,r)}static matchFilename(e,n){for(let i of e)if(i.filename&&i.filename.test(n))return i;let r=/\.([^.]+)$/.exec(n);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,n,r=!0){n=n.toLowerCase();for(let i of e)if(i.alias.some(o=>o==n))return i;if(r)for(let i of e)for(let o of i.alias){let s=n.indexOf(o);if(s>-1&&(o.length>2||!/\w/.test(n[s-1])&&!/\w/.test(n[s+o.length])))return i}return null}}const aie=ye.define(),zh=ye.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function ta(t){let e=t.facet(zh);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function nh(t,e){let n="",r=t.tabSize,i=t.facet(zh)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let o=0;o<e;o++)n+=i;return n}function YS(t,e){t instanceof ze&&(t=new yO(t));for(let r of t.state.facet(aie)){let i=r(t,e);if(i!==void 0)return i}let n=wt(t.state);return n.length>=e?cie(t,n,e):null}class yO{constructor(e,n={}){this.state=e,this.options=n,this.unit=ta(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:o}=this.options;return i!=null&&i>=r.from&&i<=r.to?o&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),o=this.countColumn(r,e-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(o+=s-this.countColumn(r,r.search(/\S|$/))),o}countColumn(e,n=e.length){return Ni(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),o=this.options.overrideIndentation;if(o){let s=o(i);if(s>-1)return s}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const uu=new Ve;function cie(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let o=[];for(let s=i;s&&!(s.from<r.node.from||s.to>r.node.to||s.from==r.node.from&&s.type==r.node.type);s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)r={node:o[s],next:r}}return l7(r,t,n)}function l7(t,e,n){for(let r=t;r;r=r.next){let i=fie(r.node);if(i)return i(US.create(e,n,r))}return 0}function uie(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function fie(t){let e=t.type.prop(uu);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Ve.closedBy))){let i=t.lastChild,o=i&&r.indexOf(i.name)>-1;return s=>a7(s,!0,1,void 0,o&&!uie(s)?i.from:void 0)}return t.parent==null?hie:null}function hie(){return 0}class US extends yO{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new US(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(die(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return l7(this.context.next,this.base,this.pos)}}function die(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function pie(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,o=t.state.doc.lineAt(n.from),s=i==null||i<=o.from?o.to:Math.min(o.to,i);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=s)return null;let c=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+c}}l=a.to}}function gie({closing:t,align:e=!0,units:n=1}){return r=>a7(r,e,n,t)}function a7(t,e,n,r,i){let o=t.textAfter,s=o.match(/^\s*/)[0].length,l=r&&o.slice(s,s+r.length)==r||i==t.pos+s,a=e?pie(t):null;return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}const mie=t=>t.baseIndent;function Np({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Oie=200;function yie(){return ze.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+Oie)return t;let o=n.sliceString(i.from,r);if(!e.some(c=>c.test(o)))return t;let{state:s}=t,l=-1,a=[];for(let{head:c}of s.selection.ranges){let u=s.doc.lineAt(c);if(u.from==l)continue;l=u.from;let f=YS(s,u.from);if(f==null)continue;let h=/^\s*/.exec(u.text)[0],d=nh(s,f);h!=d&&a.push({from:u.from,to:u.from+h.length,insert:d})}return a.length?[t,{changes:a,sequential:!0}]:t})}const c7=ye.define(),fu=new Ve;function u7(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function xie(t,e,n){let r=wt(t);if(r.length<n)return null;let i=r.resolveStack(n,1),o=null;for(let s=i;s;s=s.next){let l=s.node;if(l.to<=n||l.from>n)continue;if(o&&l.from<e)break;let a=l.type.prop(fu);if(a&&(l.to<r.length-50||r.length==t.doc.length||!bie(l))){let c=a(l,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(o=c)}}return o}function bie(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Wg(t,e,n){for(let r of t.facet(c7)){let i=r(t,e,n);if(i)return i}return xie(t,e,n)}function f7(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const xO=Le.define({map:f7}),jh=Le.define({map:f7});function h7(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const na=cn.define({create(){return ke.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,i)=>t=yT(t,r,i)),t=t.map(e.changes);let n=[];for(let r of e.effects)r.is(xO)&&!vie(t,r.value.from,r.value.to)?n.push(r.value):r.is(jh)&&(t=t.update({filter:(i,o)=>r.value.from!=i||r.value.to!=o,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=e.state.facet(g7),i=n.map(o=>(r?ke.replace({widget:new Pie(r(e.state,o))}):xT).range(o.from,o.to));t=t.update({add:i})}return e.selection&&(t=yT(t,e.selection.main.head)),t},provide:t=>se.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(xT.range(r,i))}return ke.set(e,!0)}});function yT(t,e,n=e){let r=!1;return t.between(e,n,(i,o)=>{i<n&&o>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,o)=>i>=n||o<=e}):t}function Hg(t,e,n){var r;let i=null;return(r=t.field(na,!1))===null||r===void 0||r.between(e,n,(o,s)=>{(!i||i.from>o)&&(i={from:o,to:s})}),i}function vie(t,e,n){let r=!1;return t.between(e,e,(i,o)=>{i==e&&o==n&&(r=!0)}),r}function d7(t,e){return t.field(na,!1)?e:e.concat(Le.appendConfig.of(m7()))}const Sie=t=>{for(let e of h7(t)){let n=Wg(t.state,e.from,e.to);if(n)return t.dispatch({effects:d7(t.state,[xO.of(n),p7(t,n)])}),!0}return!1},wie=t=>{if(!t.state.field(na,!1))return!1;let e=[];for(let n of h7(t)){let r=Hg(t.state,n.from,n.to);r&&e.push(jh.of(r),p7(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function p7(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return se.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const kie=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),o=Wg(e,i.from,i.to);o&&n.push(xO.of(o)),r=(o?t.lineBlockAt(o.to):i).to+1}return n.length&&t.dispatch({effects:d7(t.state,n)}),!!n.length},Cie=t=>{let e=t.state.field(na,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(jh.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},_ie=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Sie},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:wie},{key:"Ctrl-Alt-[",run:kie},{key:"Ctrl-Alt-]",run:Cie}],Tie={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},g7=ye.define({combine(t){return xo(t,Tie)}});function m7(t){return[na,Aie]}function O7(t,e){let{state:n}=t,r=n.facet(g7),i=s=>{let l=t.lineBlockAt(t.posAtDOM(s.target)),a=Hg(t.state,l.from,l.to);a&&t.dispatch({effects:jh.of(a)}),s.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const xT=ke.replace({widget:new class extends pi{toDOM(t){return O7(t,null)}}});class Pie extends pi{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return O7(e,this.value)}}const Eie={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class q1 extends po{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function $ie(t={}){let e={...Eie,...t},n=new q1(e,!0),r=new q1(e,!1),i=Ht.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(Hs)!=s.state.facet(Hs)||s.startState.field(na,!1)!=s.state.field(na,!1)||wt(s.startState)!=wt(s.state)||e.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let l=new ir;for(let a of s.viewportLineBlocks){let c=Hg(s.state,a.from,a.to)?r:Wg(s.state,a.from,a.to)?n:null;c&&l.add(a.from,a.from,c)}return l.finish()}}),{domEventHandlers:o}=e;return[i,t7({class:"cm-foldGutter",markers(s){var l;return((l=s.plugin(i))===null||l===void 0?void 0:l.markers)||qe.empty},initialSpacer(){return new q1(e,!1)},domEventHandlers:{...o,click:(s,l,a)=>{if(o.click&&o.click(s,l,a))return!0;let c=Hg(s.state,l.from,l.to);if(c)return s.dispatch({effects:jh.of(c)}),!0;let u=Wg(s.state,l.from,l.to);return u?(s.dispatch({effects:xO.of(u)}),!0):!1}}}),m7()]}const Aie=se.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Xh{constructor(e,n){this.specs=e;let r;function i(l){let a=ss.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const o=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,s=n.scope;this.scope=s instanceof Nr?l=>l.prop(Ps)==s.data:s?l=>l==s:void 0,this.style=o7(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:o}).style,this.module=r?new ss(r):null,this.themeType=n.themeType}static define(e,n){return new Xh(e,n||{})}}const Xx=ye.define(),y7=ye.define({combine(t){return t.length?[t[0]]:null}});function Y1(t){let e=t.facet(Xx);return e.length?e:t.facet(y7)}function x7(t,e){let n=[Mie],r;return t instanceof Xh&&(t.module&&n.push(se.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(y7.of(t)):r?n.push(Xx.computeN([se.darkTheme],i=>i.facet(se.darkTheme)==(r=="dark")?[t]:[])):n.push(Xx.of(t)),n}class Qie{constructor(e){this.markCache=Object.create(null),this.tree=wt(e.state),this.decorations=this.buildDeco(e,Y1(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=wt(e.state),r=Y1(e.state),i=r!=Y1(e.startState),{viewport:o}=e.view,s=e.changes.mapPos(this.decoratedTo,1);n.length<o.to&&!i&&n.type==this.tree.type&&s>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=o.to)}buildDeco(e,n){if(!n||!this.tree.length)return ke.none;let r=new ir;for(let{from:i,to:o}of e.visibleRanges)rie(this.tree,n,(s,l,a)=>{r.add(s,l,this.markCache[a]||(this.markCache[a]=ke.mark({class:a})))},i,o);return r.finish()}}const Mie=Fi.high(Ht.fromClass(Qie,{decorations:t=>t.decorations})),Rie=Xh.define([{tag:A.meta,color:"#404740"},{tag:A.link,textDecoration:"underline"},{tag:A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:A.emphasis,fontStyle:"italic"},{tag:A.strong,fontWeight:"bold"},{tag:A.strikethrough,textDecoration:"line-through"},{tag:A.keyword,color:"#708"},{tag:[A.atom,A.bool,A.url,A.contentSeparator,A.labelName],color:"#219"},{tag:[A.literal,A.inserted],color:"#164"},{tag:[A.string,A.deleted],color:"#a11"},{tag:[A.regexp,A.escape,A.special(A.string)],color:"#e40"},{tag:A.definition(A.variableName),color:"#00f"},{tag:A.local(A.variableName),color:"#30a"},{tag:[A.typeName,A.namespace],color:"#085"},{tag:A.className,color:"#167"},{tag:[A.special(A.variableName),A.macroName],color:"#256"},{tag:A.definition(A.propertyName),color:"#00c"},{tag:A.comment,color:"#940"},{tag:A.invalid,color:"#f00"}]),Lie=se.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),b7=1e4,v7="()[]{}",S7=ye.define({combine(t){return xo(t,{afterCursor:!0,brackets:v7,maxScanDistance:b7,renderMatch:Nie})}}),Iie=ke.mark({class:"cm-matchingBracket"}),Die=ke.mark({class:"cm-nonmatchingBracket"});function Nie(t){let e=[],n=t.matched?Iie:Die;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}function bT(t){let e=[],n=t.facet(S7);for(let r of t.selection.ranges){if(!r.empty)continue;let i=io(t,r.head,-1,n)||r.head>0&&io(t,r.head-1,1,n)||n.afterCursor&&(io(t,r.head,1,n)||r.head<t.doc.length&&io(t,r.head+1,-1,n));i&&(e=e.concat(n.renderMatch(i,t)))}return ke.set(e,!0)}const Vie=Ht.fromClass(class{constructor(t){this.paused=!1,this.decorations=bT(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=bT(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),Bie=[Vie,Lie];function Fie(t={}){return[S7.of(t),Bie]}const w7=new Ve;function Wx(t,e,n){let r=t.prop(e<0?Ve.openedBy:Ve.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function Hx(t){let e=t.type.prop(w7);return e?e(t.node):t}function io(t,e,n,r={}){let i=r.maxScanDistance||b7,o=r.brackets||v7,s=wt(t),l=s.resolveInner(e,n);for(let a=l;a;a=a.parent){let c=Wx(a.type,n,o);if(c&&a.from<a.to){let u=Hx(a);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return Zie(t,e,n,a,u,c,o)}}return zie(t,e,n,s,l.type,i,o)}function Zie(t,e,n,r,i,o,s){let l=r.parent,a={from:i.from,to:i.to},c=0,u=l?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&o.indexOf(u.type.name)>-1&&u.from<u.to){let f=Hx(u);return{start:a,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(Wx(u.type,n,s))c++;else if(Wx(u.type,-n,s)){if(c==0){let f=Hx(u);return{start:a,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}function zie(t,e,n,r,i,o,s){if(n<0?!e:e==t.doc.length)return null;let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let h=0;!u.next().done&&h<=o;){let d=u.value;n<0&&(h+=d.length);let p=e+h*n;for(let g=n>0?0:d.length-1,m=n>0?d.length:-1;g!=m;g+=n){let O=s.indexOf(d[g]);if(!(O<0||r.resolveInner(p+g,1).type!=i))if(O%2==0==n>0)f++;else{if(f==1)return{start:c,end:{from:p+g,to:p+g+1},matched:O>>1==a>>1};f--}}n>0&&(h+=d.length)}return u.done?{start:c,matched:!1}:null}function vT(t,e,n,r=0,i=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let o=i;for(let s=r;s<e;s++)t.charCodeAt(s)==9?o+=n-o%n:o++;return o}class k7{constructor(e,n,r,i){this.string=e,this.tabSize=n,this.indentUnit=r,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let n=this.string.charAt(this.pos),r;if(typeof e=="string"?r=n==e:r=n&&(e instanceof RegExp?e.test(n):e(n)),r)return++this.pos,n}eatWhile(e){let n=this.pos;for(;this.eat(e););return this.pos>n}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=vT(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:vT(this.string,null,this.tabSize)}match(e,n,r){if(typeof e=="string"){let i=s=>r?s.toLowerCase():s,o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&n!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function jie(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||Xie,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||JS,mergeTokens:t.mergeTokens!==!1}}function Xie(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const ST=new WeakMap;class GS extends Nr{constructor(e){let n=OO(e.languageData),r=jie(e),i,o=new class extends cO{createParse(s,l,a){return new Hie(i,s,l,a)}};super(n,o,[],e.name),this.topNode=Uie(n,this),i=this,this.streamParser=r,this.stateAfter=new Ve({perNode:!0}),this.tokenTable=e.tokenTable?new P7(r.tokenTable):Yie}static define(e){return new GS(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=ST.get(e.state),n!=null&&n<e.pos-1e4&&(n=void 0));let i=KS(this,e.node.tree,e.node.from,e.node.from,n??e.pos),o,s;if(i?(s=i.state,o=i.pos+1):(s=this.streamParser.startState(e.unit),o=e.node.from),e.pos-o>1e4)return null;for(;o<e.pos;){let a=e.state.doc.lineAt(o),c=Math.min(e.pos,a.to);if(a.length){let u=r?r(a.from):-1,f=new k7(a.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;f.pos<c-a.from;)_7(this.streamParser.token,f,s)}else this.streamParser.blankLine(s,e.unit);if(c==e.pos)break;o=a.to+1}let l=e.lineAt(e.pos);return r&&n==null&&ST.set(e.state,l.from),this.streamParser.indent(s,/^\s*(.*)/.exec(l.text)[1],e)}get allowsNesting(){return!1}}function KS(t,e,n,r,i){let o=n>=r&&n+e.length<=i&&e.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:n+e.length};for(let s=e.children.length-1;s>=0;s--){let l=e.children[s],a=n+e.positions[s],c=l instanceof Ye&&a<i&&KS(t,l,a,r,i);if(c)return c}return null}function C7(t,e,n,r,i){if(i&&n<=0&&r>=e.length)return e;!i&&n==0&&e.type==t.topNode&&(i=!0);for(let o=e.children.length-1;o>=0;o--){let s=e.positions[o],l=e.children[o],a;if(s<r&&l instanceof Ye){if(!(a=C7(t,l,n-s,r-s,i)))break;return i?new Ye(e.type,e.children.slice(0,o).concat(a),e.positions.slice(0,o+1),s+a.length):a}}return null}function Wie(t,e,n,r,i){for(let o of e){let s=o.from+(o.openStart?25:0),l=o.to-(o.openEnd?25:0),a=s<=n&&l>n&&KS(t,o.tree,0-o.offset,n,l),c;if(a&&a.pos<=r&&(c=C7(t,o.tree,n+o.offset,a.pos+o.offset,!1)))return{state:a.state,tree:c}}return{state:t.streamParser.startState(i?ta(i):4),tree:Ye.empty}}let Hie=class{constructor(e,n,r,i){this.lang=e,this.input=n,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let o=ea.get(),s=i[0].from,{state:l,tree:a}=Wie(e,r,s,this.to,o?.state);this.state=l,this.parsedPos=this.chunkStart=s+a.length;for(let c=0;c<a.children.length;c++)this.chunks.push(a.children[c]),this.chunkPos.push(a.positions[c]);o&&this.parsedPos<o.viewport.from-1e5&&i.some(c=>c.from<=o.viewport.from&&c.to>=o.viewport.from)&&(this.state=this.lang.streamParser.startState(ta(o.state)),o.skipUntilInView(this.parsedPos,o.viewport.from),this.parsedPos=o.viewport.from),this.moveRangeIndex()}advance(){let e=ea.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==`
114
114
  `&&(n="");else{let r=n.indexOf(`
115
- `);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let i=this.rangeIndex;;){let o=this.ranges[i].to;if(o>=r||(n=n.slice(0,o-(r-n.length)),i++,i==this.ranges.length))break;let s=this.ranges[i].from,l=this.lineAfter(s);n+=l,r=s+l.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,o=e+n;if(r>0?i>o:i>=o)break;let s=this.ranges[++this.rangeIndex].from;n+=s-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,i){let o=4;if(this.ranges.length>1){i=this.skipGapsTo(n,i,1),n+=i;let l=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,o+=this.chunk.length-l}let s=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&o==4&&s>=0&&this.chunk[s]==e&&this.chunk[s+2]==n?this.chunk[s+2]=r:this.chunk.push(e,n,r,o),i}parseLine(e){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:o}=this.lang,s=new k7(n,e?e.state.tabSize:4,e?ta(e.state):2);if(s.eol())o.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let l=_7(o.token,s,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+s.start,this.parsedPos+s.pos,i)),s.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ye.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:qie,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ye(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Ye(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function _7(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let i=t(e,n);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const JS=Object.create(null),rh=[an.none],qie=new su(rh),wT=[],kT=Object.create(null),T7=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])T7[t]=E7(JS,e);class P7{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),T7)}resolve(e){return e?this.table[e]||(this.table[e]=E7(this.extra,e)):0}}const Yie=new P7(JS);function U1(t,e){wT.indexOf(t)>-1||(wT.push(t),console.warn(e))}function E7(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let c of l.split(".")){let u=t[c]||A[c];u?typeof u=="function"?a.length?a=a.map(u):U1(c,`Modifier ${c} used at start of tag`):a.length?U1(c,`Tag ${c} used as modifier`):a=Array.isArray(u)?u:[u]:U1(c,`Unknown highlighting tag ${c}`)}for(let c of a)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),o=kT[i];if(o)return o.id;let s=kT[i]=an.define({id:rh.length,name:r,props:[cu({[r]:n})]});return rh.push(s),s.id}function Uie(t,e){let n=an.define({id:rh.length,name:"Document",props:[Ps.add(()=>t),uu.add(()=>r=>e.getIndent(r))],top:!0});return rh.push(n),n}_t.RTL,_t.LTR;function te(t){return new Qc(GS.define(t))}function ms(t){return W(()=>import("./index-Hlokid_B.js"),__vite__mapDeps([0,1,2])).then(e=>e.sql({dialect:e[t]}))}const Gie=[j.of({name:"C",extensions:["c","h","ino"],load(){return W(()=>import("./index-xM_-dBjg.js"),__vite__mapDeps([3,1,2])).then(t=>t.cpp())}}),j.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return W(()=>import("./index-xM_-dBjg.js"),__vite__mapDeps([3,1,2])).then(t=>t.cpp())}}),j.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return ms("Cassandra")}}),j.of({name:"CSS",extensions:["css"],load(){return W(()=>Promise.resolve().then(()=>Bfe),void 0).then(t=>t.css())}}),j.of({name:"Go",extensions:["go"],load(){return W(()=>import("./index-BWQugB-m.js"),__vite__mapDeps([4,1,2])).then(t=>t.go())}}),j.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return W(()=>Promise.resolve().then(()=>Mhe),void 0).then(t=>t.html())}}),j.of({name:"Java",extensions:["java"],load(){return W(()=>import("./index-C9y82Xkr.js"),__vite__mapDeps([5,1,2])).then(t=>t.java())}}),j.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript())}}),j.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return W(()=>import("./index-BanLa7PQ.js"),__vite__mapDeps([6,1,2])).then(t=>t.jinja())}}),j.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return W(()=>import("./index-CT73nPrH.js"),__vite__mapDeps([7,1,2])).then(t=>t.json())}}),j.of({name:"JSX",extensions:["jsx"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript({jsx:!0}))}}),j.of({name:"LESS",extensions:["less"],load(){return W(()=>import("./index-C22iDz8w.js"),__vite__mapDeps([8,1,2])).then(t=>t.less())}}),j.of({name:"Liquid",extensions:["liquid"],load(){return W(()=>import("./index-Dx4HOh5k.js"),__vite__mapDeps([9,1,2])).then(t=>t.liquid())}}),j.of({name:"MariaDB SQL",load(){return ms("MariaSQL")}}),j.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return W(()=>Promise.resolve().then(()=>jhe),void 0).then(t=>t.markdown())}}),j.of({name:"MS SQL",load(){return ms("MSSQL")}}),j.of({name:"MySQL",load(){return ms("MySQL")}}),j.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return W(()=>import("./index-DmZE5psD.js"),__vite__mapDeps([10,1,2])).then(t=>t.php())}}),j.of({name:"PLSQL",extensions:["pls"],load(){return ms("PLSQL")}}),j.of({name:"PostgreSQL",load(){return ms("PostgreSQL")}}),j.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return W(()=>import("./index-BvrVgIw_.js"),__vite__mapDeps([11,1,2])).then(t=>t.python())}}),j.of({name:"Rust",extensions:["rs"],load(){return W(()=>import("./index-CWIXOY1D.js"),__vite__mapDeps([12,1,2])).then(t=>t.rust())}}),j.of({name:"Sass",extensions:["sass"],load(){return W(()=>import("./index--vNjDAEm.js"),__vite__mapDeps([13,1,2])).then(t=>t.sass({indented:!0}))}}),j.of({name:"SCSS",extensions:["scss"],load(){return W(()=>import("./index--vNjDAEm.js"),__vite__mapDeps([13,1,2])).then(t=>t.sass())}}),j.of({name:"SQL",extensions:["sql"],load(){return ms("StandardSQL")}}),j.of({name:"SQLite",load(){return ms("SQLite")}}),j.of({name:"TSX",extensions:["tsx"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),j.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript({typescript:!0}))}}),j.of({name:"WebAssembly",extensions:["wat","wast"],load(){return W(()=>import("./index-Dgi1UC16.js"),__vite__mapDeps([14,1,2])).then(t=>t.wast())}}),j.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return W(()=>import("./index-2RQVAOu3.js"),__vite__mapDeps([15,1,2])).then(t=>t.xml())}}),j.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return W(()=>import("./index-DYnto4lP.js"),__vite__mapDeps([16,1,2])).then(t=>t.yaml())}}),j.of({name:"APL",extensions:["dyalog","apl"],load(){return W(()=>import("./apl-B4CMkyY2.js"),[]).then(t=>te(t.apl))}}),j.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return W(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(t=>te(t.asciiArmor))}}),j.of({name:"ASN.1",extensions:["asn","asn1"],load(){return W(()=>import("./asn1-EdZsLKOL.js"),[]).then(t=>te(t.asn1({})))}}),j.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return W(()=>import("./asterisk-B-8jnY81.js"),[]).then(t=>te(t.asterisk))}}),j.of({name:"Brainfuck",extensions:["b","bf"],load(){return W(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(t=>te(t.brainfuck))}}),j.of({name:"Cobol",extensions:["cob","cpy"],load(){return W(()=>import("./cobol-CWcv1MsR.js"),[]).then(t=>te(t.cobol))}}),j.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.csharp))}}),j.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return W(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>te(t.clojure))}}),j.of({name:"ClojureScript",extensions:["cljs"],load(){return W(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>te(t.clojure))}}),j.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return W(()=>import("./css-BnMrqG3P.js"),[]).then(t=>te(t.gss))}}),j.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return W(()=>import("./cmake-BQqOBYOt.js"),[]).then(t=>te(t.cmake))}}),j.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return W(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(t=>te(t.coffeeScript))}}),j.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return W(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(t=>te(t.commonLisp))}}),j.of({name:"Cypher",extensions:["cyp","cypher"],load(){return W(()=>import("./cypher-C_CwsFkJ.js"),[]).then(t=>te(t.cypher))}}),j.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return W(()=>import("./python-BuPzkPfP.js"),[]).then(t=>te(t.cython))}}),j.of({name:"Crystal",extensions:["cr"],load(){return W(()=>import("./crystal-SjHAIU92.js"),[]).then(t=>te(t.crystal))}}),j.of({name:"D",extensions:["d"],load(){return W(()=>import("./d-pRatUO7H.js"),[]).then(t=>te(t.d))}}),j.of({name:"Dart",extensions:["dart"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.dart))}}),j.of({name:"diff",extensions:["diff","patch"],load(){return W(()=>import("./diff-DbItnlRl.js"),[]).then(t=>te(t.diff))}}),j.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return W(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([17,18])).then(t=>te(t.dockerFile))}}),j.of({name:"DTD",extensions:["dtd"],load(){return W(()=>import("./dtd-DF_7sFjM.js"),[]).then(t=>te(t.dtd))}}),j.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return W(()=>import("./dylan-DwRh75JA.js"),[]).then(t=>te(t.dylan))}}),j.of({name:"EBNF",load(){return W(()=>import("./ebnf-CDyGwa7X.js"),[]).then(t=>te(t.ebnf))}}),j.of({name:"ECL",extensions:["ecl"],load(){return W(()=>import("./ecl-Cabwm37j.js"),[]).then(t=>te(t.ecl))}}),j.of({name:"edn",extensions:["edn"],load(){return W(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>te(t.clojure))}}),j.of({name:"Eiffel",extensions:["e"],load(){return W(()=>import("./eiffel-CnydiIhH.js"),[]).then(t=>te(t.eiffel))}}),j.of({name:"Elm",extensions:["elm"],load(){return W(()=>import("./elm-vLlmbW-K.js"),[]).then(t=>te(t.elm))}}),j.of({name:"Erlang",extensions:["erl"],load(){return W(()=>import("./erlang-BNw1qcRV.js"),[]).then(t=>te(t.erlang))}}),j.of({name:"Esper",load(){return W(()=>import("./sql-D0XecflT.js"),[]).then(t=>te(t.esper))}}),j.of({name:"Factor",extensions:["factor"],load(){return W(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([19,18])).then(t=>te(t.factor))}}),j.of({name:"FCL",load(){return W(()=>import("./fcl-Kvtd6kyn.js"),[]).then(t=>te(t.fcl))}}),j.of({name:"Forth",extensions:["forth","fth","4th"],load(){return W(()=>import("./forth-Ffai-XNe.js"),[]).then(t=>te(t.forth))}}),j.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return W(()=>import("./fortran-DYz_wnZ1.js"),[]).then(t=>te(t.fortran))}}),j.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return W(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>te(t.fSharp))}}),j.of({name:"Gas",extensions:["s"],load(){return W(()=>import("./gas-Bneqetm1.js"),[]).then(t=>te(t.gas))}}),j.of({name:"Gherkin",extensions:["feature"],load(){return W(()=>import("./gherkin-heZmZLOM.js"),[]).then(t=>te(t.gherkin))}}),j.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return W(()=>import("./groovy-D9Dt4D0W.js"),[]).then(t=>te(t.groovy))}}),j.of({name:"Haskell",extensions:["hs"],load(){return W(()=>import("./haskell-Cw1EW3IL.js"),[]).then(t=>te(t.haskell))}}),j.of({name:"Haxe",extensions:["hx"],load(){return W(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>te(t.haxe))}}),j.of({name:"HXML",extensions:["hxml"],load(){return W(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>te(t.hxml))}}),j.of({name:"HTTP",load(){return W(()=>import("./http-DBlCnlav.js"),[]).then(t=>te(t.http))}}),j.of({name:"IDL",extensions:["pro"],load(){return W(()=>import("./idl-BEugSyMb.js"),[]).then(t=>te(t.idl))}}),j.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return W(()=>import("./javascript-iXu5QeM3.js"),[]).then(t=>te(t.jsonld))}}),j.of({name:"Julia",extensions:["jl"],load(){return W(()=>import("./julia-DuME0IfC.js"),[]).then(t=>te(t.julia))}}),j.of({name:"Kotlin",extensions:["kt","kts"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.kotlin))}}),j.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return W(()=>import("./livescript-BwQOo05w.js"),[]).then(t=>te(t.liveScript))}}),j.of({name:"Lua",extensions:["lua"],load(){return W(()=>import("./lua-VAEuO923.js"),[]).then(t=>te(t.lua))}}),j.of({name:"mIRC",extensions:["mrc"],load(){return W(()=>import("./mirc-CjQqDB4T.js"),[]).then(t=>te(t.mirc))}}),j.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return W(()=>import("./mathematica-DTrFuWx2.js"),[]).then(t=>te(t.mathematica))}}),j.of({name:"Modelica",extensions:["mo"],load(){return W(()=>import("./modelica-Dc1JOy9r.js"),[]).then(t=>te(t.modelica))}}),j.of({name:"MUMPS",extensions:["mps"],load(){return W(()=>import("./mumps-BT43cFF4.js"),[]).then(t=>te(t.mumps))}}),j.of({name:"Mbox",extensions:["mbox"],load(){return W(()=>import("./mbox-CNhZ1qSd.js"),[]).then(t=>te(t.mbox))}}),j.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return W(()=>import("./nginx-DdIZxoE0.js"),[]).then(t=>te(t.nginx))}}),j.of({name:"NSIS",extensions:["nsh","nsi"],load(){return W(()=>import("./nsis-LY0VT_u5.js"),__vite__mapDeps([20,18])).then(t=>te(t.nsis))}}),j.of({name:"NTriples",extensions:["nt","nq"],load(){return W(()=>import("./ntriples-BfvgReVJ.js"),[]).then(t=>te(t.ntriples))}}),j.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.objectiveC))}}),j.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.objectiveCpp))}}),j.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return W(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>te(t.oCaml))}}),j.of({name:"Octave",extensions:["m"],load(){return W(()=>import("./octave-Ck1zUtKM.js"),[]).then(t=>te(t.octave))}}),j.of({name:"Oz",extensions:["oz"],load(){return W(()=>import("./oz-BzwKVEFT.js"),[]).then(t=>te(t.oz))}}),j.of({name:"Pascal",extensions:["p","pas"],load(){return W(()=>import("./pascal--L3eBynH.js"),[]).then(t=>te(t.pascal))}}),j.of({name:"Perl",extensions:["pl","pm"],load(){return W(()=>import("./perl-CdXCOZ3F.js"),[]).then(t=>te(t.perl))}}),j.of({name:"Pig",extensions:["pig"],load(){return W(()=>import("./pig-CevX1Tat.js"),[]).then(t=>te(t.pig))}}),j.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return W(()=>import("./powershell-CFHJl5sT.js"),[]).then(t=>te(t.powerShell))}}),j.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return W(()=>import("./properties-C78fOPTZ.js"),[]).then(t=>te(t.properties))}}),j.of({name:"ProtoBuf",extensions:["proto"],load(){return W(()=>import("./protobuf-ChK-085T.js"),[]).then(t=>te(t.protobuf))}}),j.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return W(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([21,22])).then(t=>te(t.pug))}}),j.of({name:"Puppet",extensions:["pp"],load(){return W(()=>import("./puppet-DMA9R1ak.js"),[]).then(t=>te(t.puppet))}}),j.of({name:"Q",extensions:["q"],load(){return W(()=>import("./q-pXgVlZs6.js"),[]).then(t=>te(t.q))}}),j.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return W(()=>import("./r-B6wPVr8A.js"),[]).then(t=>te(t.r))}}),j.of({name:"RPM Changes",load(){return W(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>te(t.rpmChanges))}}),j.of({name:"RPM Spec",extensions:["spec"],load(){return W(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>te(t.rpmSpec))}}),j.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return W(()=>import("./ruby-BK5aLJev.js"),[]).then(t=>te(t.ruby))}}),j.of({name:"SAS",extensions:["sas"],load(){return W(()=>import("./sas-B4kiWyti.js"),[]).then(t=>te(t.sas))}}),j.of({name:"Scala",extensions:["scala"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.scala))}}),j.of({name:"Scheme",extensions:["scm","ss"],load(){return W(()=>import("./scheme-C41bIUwD.js"),[]).then(t=>te(t.scheme))}}),j.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return W(()=>import("./shell-CjFT_Tl9.js"),[]).then(t=>te(t.shell))}}),j.of({name:"Sieve",extensions:["siv","sieve"],load(){return W(()=>import("./sieve-C3Gn_uJK.js"),[]).then(t=>te(t.sieve))}}),j.of({name:"Smalltalk",extensions:["st"],load(){return W(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(t=>te(t.smalltalk))}}),j.of({name:"Solr",load(){return W(()=>import("./solr-DehyRSwq.js"),[]).then(t=>te(t.solr))}}),j.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return W(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>te(t.sml))}}),j.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return W(()=>import("./sparql-DkYu6x3z.js"),[]).then(t=>te(t.sparql))}}),j.of({name:"Spreadsheet",alias:["excel","formula"],load(){return W(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(t=>te(t.spreadsheet))}}),j.of({name:"Squirrel",extensions:["nut"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.squirrel))}}),j.of({name:"Stylus",extensions:["styl"],load(){return W(()=>import("./stylus-B533Al4x.js"),[]).then(t=>te(t.stylus))}}),j.of({name:"Swift",extensions:["swift"],load(){return W(()=>import("./swift-BzpIVaGY.js"),[]).then(t=>te(t.swift))}}),j.of({name:"sTeX",load(){return W(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>te(t.stex))}}),j.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return W(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>te(t.stex))}}),j.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return W(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>te(t.verilog))}}),j.of({name:"Tcl",extensions:["tcl"],load(){return W(()=>import("./tcl-DVfN8rqt.js"),[]).then(t=>te(t.tcl))}}),j.of({name:"Textile",extensions:["textile"],load(){return W(()=>import("./textile-CnDTJFAw.js"),[]).then(t=>te(t.textile))}}),j.of({name:"TiddlyWiki",load(){return W(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(t=>te(t.tiddlyWiki))}}),j.of({name:"Tiki wiki",load(){return W(()=>import("./tiki-DGYXhP31.js"),[]).then(t=>te(t.tiki))}}),j.of({name:"TOML",extensions:["toml"],load(){return W(()=>import("./toml-Bm5Em-hy.js"),[]).then(t=>te(t.toml))}}),j.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return W(()=>import("./troff-wAsdV37c.js"),[]).then(t=>te(t.troff))}}),j.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return W(()=>import("./ttcn-CfJYG6tj.js"),[]).then(t=>te(t.ttcn))}}),j.of({name:"TTCN_CFG",extensions:["cfg"],load(){return W(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(t=>te(t.ttcnCfg))}}),j.of({name:"Turtle",extensions:["ttl"],load(){return W(()=>import("./turtle-B1tBg_DP.js"),[]).then(t=>te(t.turtle))}}),j.of({name:"Web IDL",extensions:["webidl"],load(){return W(()=>import("./webidl-ZXfAyPTL.js"),[]).then(t=>te(t.webIDL))}}),j.of({name:"VB.NET",extensions:["vb"],load(){return W(()=>import("./vb-CmGdzxic.js"),[]).then(t=>te(t.vb))}}),j.of({name:"VBScript",extensions:["vbs"],load(){return W(()=>import("./vbscript-BuJXcnF6.js"),[]).then(t=>te(t.vbScript))}}),j.of({name:"Velocity",extensions:["vtl"],load(){return W(()=>import("./velocity-D8B20fx6.js"),[]).then(t=>te(t.velocity))}}),j.of({name:"Verilog",extensions:["v"],load(){return W(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>te(t.verilog))}}),j.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return W(()=>import("./vhdl-lSbBsy5d.js"),[]).then(t=>te(t.vhdl))}}),j.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return W(()=>import("./xquery-DzFWVndE.js"),[]).then(t=>te(t.xQuery))}}),j.of({name:"Yacas",extensions:["ys"],load(){return W(()=>import("./yacas-BJ4BC0dw.js"),[]).then(t=>te(t.yacas))}}),j.of({name:"Z80",extensions:["z80"],load(){return W(()=>import("./z80-Hz9HOZM7.js"),[]).then(t=>te(t.z80))}}),j.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return W(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>te(t.mscgen))}}),j.of({name:"Xù",extensions:["xu"],load(){return W(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>te(t.xu))}}),j.of({name:"MsGenny",extensions:["msgenny"],load(){return W(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>te(t.msgenny))}}),j.of({name:"Vue",extensions:["vue"],load(){return W(()=>import("./index-CK6xHVuA.js"),__vite__mapDeps([23,1,2])).then(t=>t.vue())}}),j.of({name:"Angular Template",load(){return W(()=>import("./index-BmdO9i46.js"),__vite__mapDeps([24,1,2])).then(t=>t.angular())}})],Kie=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=tw(t.state,n.from);return r.line?Jie(t):r.block?toe(t):!1};function ew(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const Jie=ew(ioe,0),eoe=ew($7,0),toe=ew((t,e)=>$7(t,e,roe(e)),0);function tw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Qu=50;function noe(t,{open:e,close:n},r,i){let o=t.sliceDoc(r-Qu,r),s=t.sliceDoc(i,i+Qu),l=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(s)[0].length,c=o.length-l;if(o.slice(c-e.length,c)==e&&s.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let u,f;i-r<=2*Qu?u=f=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+Qu),f=t.sliceDoc(i-Qu,i));let h=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-n.length;return u.slice(h,h+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:i-d-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function roe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let o=e.length-1;o>=0&&e[o].to>r.from?e[o].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function $7(t,e,n=e.selection.ranges){let r=n.map(o=>tw(e,o.from).block);if(!r.every(o=>o))return null;let i=n.map((o,s)=>noe(e,r[s],o.from,o.to));if(t!=2&&!i.every(o=>o))return{changes:e.changes(n.map((o,s)=>i[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(t!=1&&i.some(o=>o)){let o=[];for(let s=0,l;s<i.length;s++)if(l=i[s]){let a=r[s],{open:c,close:u}=l;o.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:o}}return null}function ioe(t,e,n=e.selection.ranges){let r=[],i=-1;e:for(let{from:o,to:s}of n){let l=r.length,a=1e9,c;for(let u=o;u<=s;){let f=e.doc.lineAt(u);if(c==null&&(c=tw(e,f.from).line,!c))continue e;if(f.from>i&&(o==s||s>f.from)){i=f.from;let h=/^\s*/.exec(f.text)[0].length,d=h==f.length,p=f.text.slice(h,h+c.length)==c?h:-1;h<f.text.length&&h<a&&(a=h),r.push({line:f,comment:p,token:c,indent:h,empty:d,single:!1})}u=f.to+1}if(a<1e9)for(let u=l;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=a);r.length==l+1&&(r[l].single=!0)}if(t!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:l,token:a,indent:c,empty:u,single:f}of r)(f||!u)&&o.push({from:l.from+c,insert:a+" "});let s=e.changes(o);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:l,token:a}of r)if(l>=0){let c=s.from+l,u=c+a.length;s.text[u-s.from]==" "&&u++,o.push({from:c,to:u})}return{changes:o}}return null}const qx=ds.define(),ooe=ds.define(),soe=ye.define(),A7=ye.define({combine(t){return xo(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),Q7=cn.define({create(){return oo.empty},update(t,e){let n=e.state.facet(A7),r=e.annotation(qx);if(r){let a=xr.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return a?u=qg(u,u.length,n.minDepth,a):u=L7(u,e.startState.selection),new oo(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(ooe);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(on.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=xr.fromTransaction(e),s=e.annotation(on.time),l=e.annotation(on.userEvent);return o?t=t.addChanges(o,s,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,s,l,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new oo(t.done.map(xr.fromJSON),t.undone.map(xr.fromJSON))}});function loe(t={}){return[Q7,A7.of(t),se.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?M7:e.inputType=="historyRedo"?Yx:null;return r?(e.preventDefault(),r(n)):!1}})]}function bO(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(Q7,!1);if(!i)return!1;let o=i.pop(t,n,e);return o?(r(o),!0):!1}}const M7=bO(0,!1),Yx=bO(1,!1),aoe=bO(0,!0),coe=bO(1,!0);class xr{constructor(e,n,r,i,o){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=o}setSelAfter(e){return new xr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new xr(e.changes&&tn.fromJSON(e.changes),[],e.mapped&&lo.fromJSON(e.mapped),e.startSelection&&H.fromJSON(e.startSelection),e.selectionsAfter.map(H.fromJSON))}static fromTransaction(e,n){let r=ei;for(let i of e.startState.facet(soe)){let o=i(e);o.length&&(r=r.concat(o))}return!r.length&&e.changes.empty?null:new xr(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ei)}static selection(e){return new xr(void 0,ei,void 0,void 0,e)}}function qg(t,e,n,r){let i=e+1>n+20?e-n-1:0,o=t.slice(i,e);return o.push(r),o}function uoe(t,e){let n=[],r=!1;return t.iterChangedRanges((i,o)=>n.push(i,o)),e.iterChangedRanges((i,o,s,l)=>{for(let a=0;a<n.length;){let c=n[a++],u=n[a++];l>=c&&s<=u&&(r=!0)}}),r}function foe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function R7(t,e){return t.length?e.length?t.concat(e):t:e}const ei=[],hoe=200;function L7(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-hoe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),qg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[xr.selection([e])]}function doe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function G1(t,e){if(!t.length)return t;let n=t.length,r=ei;for(;n;){let i=poe(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let o=t.slice(0,n);return o[n-1]=i,o}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[xr.selection(r)]:ei}function poe(t,e,n){let r=R7(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ei,n);if(!t.changes)return xr.selection(r);let i=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new xr(i,Le.mapEffects(t.effects,e),s,t.startSelection.map(o),r)}const goe=/^(input\.type|delete)($|\.)/;class oo{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new oo(this.done,this.undone):this}addChanges(e,n,r,i,o){let s=this.done,l=s[s.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||goe.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,uoe(l.changes,e.changes))||r=="input.type.compose")?s=qg(s,s.length-1,i.minDepth,new xr(e.changes.compose(l.changes),R7(Le.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,ei)):s=qg(s,s.length,i.minDepth,e),new oo(s,ei,n,r)}addSelection(e,n,r,i){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:ei;return o.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&foe(o[o.length-1],e)?this:new oo(L7(this.done,e),this.undone,n,r)}addMapping(e){return new oo(G1(this.done,e),G1(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let o=i[i.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):n.selection);if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:qx.of({side:e,rest:doe(i),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let l=i.length==1?ei:i.slice(0,i.length-1);return o.mapped&&(l=G1(l,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:qx.of({side:e,rest:l,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}oo.empty=new oo(ei,ei);const moe=[{key:"Mod-z",run:M7,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Yx,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Yx,preventDefault:!0},{key:"Mod-u",run:aoe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:coe,preventDefault:!0}];function hu(t,e){return H.create(t.ranges.map(e),t.mainIndex)}function Zi(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function zi({state:t,dispatch:e},n){let r=hu(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Zi(t,r)),!0)}function vO(t,e){return H.cursor(e?t.to:t.from)}function I7(t,e){return zi(t,n=>n.empty?t.moveByChar(n,e):vO(n,e))}function Gn(t){return t.textDirectionAt(t.state.selection.main.head)==_t.LTR}const D7=t=>I7(t,!Gn(t)),N7=t=>I7(t,Gn(t));function V7(t,e){return zi(t,n=>n.empty?t.moveByGroup(n,e):vO(n,e))}const Ooe=t=>V7(t,!Gn(t)),yoe=t=>V7(t,Gn(t));function xoe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function SO(t,e,n){let r=wt(t).resolveInner(e.head),i=n?Ve.closedBy:Ve.openedBy;for(let a=e.head;;){let c=n?r.childAfter(a):r.childBefore(a);if(!c)break;xoe(t,c,i)?r=c:a=n?c.to:c.from}let o=r.type.prop(i),s,l;return o&&(s=n?io(t,r.from,1):io(t,r.to,-1))&&s.matched?l=n?s.end.to:s.end.from:l=n?r.to:r.from,H.cursor(l,n?-1:1)}const boe=t=>zi(t,e=>SO(t.state,e,!Gn(t))),voe=t=>zi(t,e=>SO(t.state,e,Gn(t)));function B7(t,e){return zi(t,n=>{if(!n.empty)return vO(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const F7=t=>B7(t,!1),Z7=t=>B7(t,!0);function z7(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let o of t.state.facet(se.scrollMargins)){let s=o(t);s?.top&&(n=Math.max(s?.top,n)),s?.bottom&&(r=Math.max(s?.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function j7(t,e){let n=z7(t),{state:r}=t,i=hu(r.selection,s=>s.empty?t.moveVertically(s,e,n.height):vO(s,e));if(i.eq(r.selection))return!1;let o;if(n.selfScroll){let s=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,c=l.bottom-n.marginBottom;s&&s.top>a&&s.bottom<c&&(o=se.scrollIntoView(i.main.head,{y:"start",yMargin:s.top-a}))}return t.dispatch(Zi(r,i),{effects:o}),!0}const CT=t=>j7(t,!1),Ux=t=>j7(t,!0);function il(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let o=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&e.head!=r.from+o&&(i=H.cursor(r.from+o))}return i}const Soe=t=>zi(t,e=>il(t,e,!0)),woe=t=>zi(t,e=>il(t,e,!1)),koe=t=>zi(t,e=>il(t,e,!Gn(t))),Coe=t=>zi(t,e=>il(t,e,Gn(t))),_oe=t=>zi(t,e=>H.cursor(t.lineBlockAt(e.head).from,1)),Toe=t=>zi(t,e=>H.cursor(t.lineBlockAt(e.head).to,-1));function Poe(t,e,n){let r=!1,i=hu(t.selection,o=>{let s=io(t,o.head,-1)||io(t,o.head,1)||o.head>0&&io(t,o.head-1,1)||o.head<t.doc.length&&io(t,o.head+1,-1);if(!s||!s.end)return o;r=!0;let l=s.start.from==o.head?s.end.to:s.end.from;return H.cursor(l)});return r?(e(Zi(t,i)),!0):!1}const Eoe=({state:t,dispatch:e})=>Poe(t,e);function gi(t,e,n){let r=hu(t.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=H.range(i.head,i.anchor));let o=n(i);return H.range(i.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(Zi(t.state,r)),!0)}function X7(t,e){return gi(t,e,n=>t.moveByChar(n,e))}const W7=t=>X7(t,!Gn(t)),H7=t=>X7(t,Gn(t));function q7(t,e){return gi(t,e,n=>t.moveByGroup(n,e))}const $oe=t=>q7(t,!Gn(t)),Aoe=t=>q7(t,Gn(t)),Qoe=t=>{let e=!Gn(t);return gi(t,e,n=>SO(t.state,n,e))},Moe=t=>{let e=Gn(t);return gi(t,e,n=>SO(t.state,n,e))};function Y7(t,e){return gi(t,e,n=>t.moveVertically(n,e))}const U7=t=>Y7(t,!1),G7=t=>Y7(t,!0);function K7(t,e){return gi(t,e,n=>t.moveVertically(n,e,z7(t).height))}const _T=t=>K7(t,!1),TT=t=>K7(t,!0),Roe=t=>gi(t,!0,e=>il(t,e,!0)),Loe=t=>gi(t,!1,e=>il(t,e,!1)),Ioe=t=>{let e=!Gn(t);return gi(t,e,n=>il(t,n,e))},Doe=t=>{let e=Gn(t);return gi(t,e,n=>il(t,n,e))},Noe=t=>gi(t,!1,e=>H.cursor(t.lineBlockAt(e.head).from)),Voe=t=>gi(t,!0,e=>H.cursor(t.lineBlockAt(e.head).to)),PT=({state:t,dispatch:e})=>(e(Zi(t,{anchor:0})),!0),ET=({state:t,dispatch:e})=>(e(Zi(t,{anchor:t.doc.length})),!0),$T=({state:t,dispatch:e})=>(e(Zi(t,{anchor:t.selection.main.anchor,head:0})),!0),AT=({state:t,dispatch:e})=>(e(Zi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Boe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Foe=({state:t,dispatch:e})=>{let n=wO(t).map(({from:r,to:i})=>H.undirectionalRange(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:H.create(n),userEvent:"select"})),!0},Zoe=({state:t,dispatch:e})=>{let n=hu(t.selection,r=>{let i=wt(t),o=i.resolveStack(r.from,1);if(r.empty){let s=i.resolveStack(r.from,-1);s.node.from>=o.node.from&&s.node.to<=o.node.to&&(o=s)}for(let s=o;s;s=s.next){let{node:l}=s;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&s.next)return H.undirectionalRange(l.from,l.to)}return r});return n.eq(t.selection)?!1:(e(Zi(t,n)),!0)};function J7(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(e?s.to<t.state.doc.length:s.from>0)for(let l=o;;){let a=t.moveVertically(l,e);if(a.head<s.from||a.head>s.to){i.some(c=>c.head==a.head)||i.push(a);break}else{if(a.head==l.head)break;l=a}}}return i.length==r.ranges.length?!1:(t.dispatch(Zi(n,H.create(i,i.length-1))),!0)}const zoe=t=>J7(t,!1),joe=t=>J7(t,!0),Xoe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=H.create([n.main]):n.main.empty||(r=H.create([H.cursor(n.main.head)])),r?(e(Zi(t,r)),!0):!1};function Wh(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(o=>{let{from:s,to:l}=o;if(s==l){let a=e(o);a<s?(n="delete.backward",a=Fd(t,a,!1)):a>s&&(n="delete.forward",a=Fd(t,a,!0)),s=Math.min(s,a),l=Math.max(l,a)}else s=Fd(t,s,!1),l=Fd(t,l,!0);return s==l?{range:o}:{changes:{from:s,to:l},range:H.cursor(s,s<o.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?se.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Fd(t,e,n){if(t instanceof se)for(let r of t.state.facet(se.atomicRanges).map(i=>i(t)))r.between(e,e,(i,o)=>{i<e&&o>e&&(e=n?o:i)});return e}const e8=(t,e,n)=>Wh(t,r=>{let i=r.from,{state:o}=t,s=o.doc.lineAt(i),l,a;if(n&&!e&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,i-s.from))){if(l[l.length-1]==" ")return i-1;let c=Ni(l,o.tabSize),u=c%ta(o)||ta(o);for(let f=0;f<u&&l[l.length-1-f]==" ";f++)i--;a=i}else a=Sn(s.text,i-s.from,e,e)+s.from,a==i&&s.number!=(e?o.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,i-s.from))&&(a=Sn(s.text,a-s.from,!1,!1)+s.from);return a}),Gx=t=>e8(t,!1,!0),t8=t=>e8(t,!0,!1),n8=(t,e)=>Wh(t,n=>{let r=n.head,{state:i}=t,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let l=null;;){if(r==(e?o.to:o.from)){r==n.head&&o.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=Sn(o.text,r-o.from,e)+o.from,c=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),u=s(c);if(l!=null&&u!=l)break;(c!=" "||r!=n.head)&&(l=u),r=a}return r}),r8=t=>n8(t,!1),Woe=t=>n8(t,!0),Hoe=t=>Wh(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),qoe=t=>Wh(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Yoe=t=>Wh(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Uoe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:rt.of(["",""])},range:H.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Goe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,o=t.doc.lineAt(i),s=i==o.from?i-1:Sn(o.text,i-o.from,!1)+o.from,l=i==o.to?i+1:Sn(o.text,i-o.from,!0)+o.from;return{changes:{from:s,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(s,i))},range:H.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function wO(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),o=t.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=t.doc.lineAt(r.to-1)),n>=i.number){let s=e[e.length-1];s.to=o.to,s.ranges.push(r)}else e.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return e}function i8(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let o of wO(t)){if(n?o.to==t.doc.length:o.from==0)continue;let s=t.doc.lineAt(n?o.to+1:o.from-1),l=s.length+1;if(n){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+t.lineBreak});for(let a of o.ranges)i.push(H.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:t.lineBreak+s.text});for(let a of o.ranges)i.push(H.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:H.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Koe=({state:t,dispatch:e})=>i8(t,e,!1),Joe=({state:t,dispatch:e})=>i8(t,e,!0);function o8(t,e,n){if(t.readOnly)return!1;let r=[];for(let o of wO(t))n?r.push({from:o.from,insert:t.doc.slice(o.from,o.to)+t.lineBreak}):r.push({from:o.to,insert:t.lineBreak+t.doc.slice(o.from,o.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ese=({state:t,dispatch:e})=>o8(t,e,!1),tse=({state:t,dispatch:e})=>o8(t,e,!0),nse=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(wO(e).map(({from:i,to:o})=>(i>0?i--:o<e.doc.length&&o++,{from:i,to:o}))),r=hu(e.selection,i=>{let o;if(t.lineWrapping){let s=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(o=s.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,o)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function rse(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=wt(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),o;return r&&i&&r.to<=e&&i.from>=e&&(o=r.type.prop(Ve.closedBy))&&o.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const QT=s8(!1),ise=s8(!0);function s8(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:o,to:s}=i,l=e.doc.lineAt(o),a=!t&&o==s&&rse(e,o);t&&(o=s=(s<=l.to?l:e.doc.lineAt(s)).to);let c=new yO(e,{simulateBreak:o,simulateDoubleBreak:!!a}),u=YS(c,o);for(u==null&&(u=Ni(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));s<l.to&&/\s/.test(l.text[s-l.from]);)s++;a?{from:o,to:s}=a:o>l.from&&o<l.from+100&&!/\S/.test(l.text.slice(0,o))&&(o=l.from);let f=["",nh(e,u)];return a&&f.push(nh(e,c.lineIndent(l.from,-1))),{changes:{from:o,to:s,insert:rt.of(f)},range:H.cursor(o+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function nw(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let s=r.from;s<=r.to;){let l=t.doc.lineAt(s);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),s=l.to+1}let o=t.changes(i);return{changes:i,range:H.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const ose=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new yO(t,{overrideIndentation:o=>{let s=n[o];return s??-1}}),i=nw(t,(o,s,l)=>{let a=YS(r,o.from);if(a==null)return;/\S/.test(o.text)||(a=0);let c=/^\s*/.exec(o.text)[0],u=nh(t,a);(c!=u||l.from<o.from+c.length)&&(n[o.from]=a,s.push({from:o.from,to:o.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},l8=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(nw(t,(n,r)=>{r.push({from:n.from,insert:t.facet(zh)})}),{userEvent:"input.indent"})),!0),a8=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(nw(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let o=Ni(i,t.tabSize),s=0,l=nh(t,Math.max(0,o-ta(t)));for(;s<i.length&&s<l.length&&i.charCodeAt(s)==l.charCodeAt(s);)s++;r.push({from:n.from+s,to:n.from+i.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0),sse=t=>(t.setTabFocusMode(),!0),lse=[{key:"Ctrl-b",run:D7,shift:W7,preventDefault:!0},{key:"Ctrl-f",run:N7,shift:H7},{key:"Ctrl-p",run:F7,shift:U7},{key:"Ctrl-n",run:Z7,shift:G7},{key:"Ctrl-a",run:_oe,shift:Noe},{key:"Ctrl-e",run:Toe,shift:Voe},{key:"Ctrl-d",run:t8},{key:"Ctrl-h",run:Gx},{key:"Ctrl-k",run:Hoe},{key:"Ctrl-Alt-h",run:r8},{key:"Ctrl-o",run:Uoe},{key:"Ctrl-t",run:Goe},{key:"Ctrl-v",run:Ux}],ase=[{key:"ArrowLeft",run:D7,shift:W7,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Ooe,shift:$oe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:koe,shift:Ioe,preventDefault:!0},{key:"ArrowRight",run:N7,shift:H7,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yoe,shift:Aoe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Coe,shift:Doe,preventDefault:!0},{key:"ArrowUp",run:F7,shift:U7,preventDefault:!0},{mac:"Cmd-ArrowUp",run:PT,shift:$T},{mac:"Ctrl-ArrowUp",run:CT,shift:_T},{key:"ArrowDown",run:Z7,shift:G7,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ET,shift:AT},{mac:"Ctrl-ArrowDown",run:Ux,shift:TT},{key:"PageUp",run:CT,shift:_T},{key:"PageDown",run:Ux,shift:TT},{key:"Home",run:woe,shift:Loe,preventDefault:!0},{key:"Mod-Home",run:PT,shift:$T},{key:"End",run:Soe,shift:Roe,preventDefault:!0},{key:"Mod-End",run:ET,shift:AT},{key:"Enter",run:QT,shift:QT},{key:"Mod-a",run:Boe},{key:"Backspace",run:Gx,shift:Gx,preventDefault:!0},{key:"Delete",run:t8,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:r8,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Woe,preventDefault:!0},{mac:"Mod-Backspace",run:qoe,preventDefault:!0},{mac:"Mod-Delete",run:Yoe,preventDefault:!0}].concat(lse.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),cse=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:boe,shift:Qoe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:voe,shift:Moe},{key:"Alt-ArrowUp",run:Koe},{key:"Shift-Alt-ArrowUp",run:ese},{key:"Alt-ArrowDown",run:Joe},{key:"Shift-Alt-ArrowDown",run:tse},{key:"Mod-Alt-ArrowUp",run:zoe},{key:"Mod-Alt-ArrowDown",run:joe},{key:"Escape",run:Xoe},{key:"Mod-Enter",run:ise},{key:"Alt-l",mac:"Ctrl-l",run:Foe},{key:"Mod-i",run:Zoe,preventDefault:!0},{key:"Mod-[",run:a8},{key:"Mod-]",run:l8},{key:"Mod-Alt-\\",run:ose},{key:"Shift-Mod-k",run:nse},{key:"Shift-Mod-\\",run:Eoe},{key:"Mod-/",run:Kie},{key:"Alt-A",mac:"Ctrl-A",run:eoe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:sse}].concat(ase),use={key:"Tab",run:l8,shift:a8},MT="#2e3440",rw="#3b4252",RT="#434c5e",Zd="#4c566a",LT="#e5e9f0",Kx="#eceff4",K1="#8fbcbb",IT="#88c0d0",fse="#81a1c1",vi="#5e81ac",hse="#bf616a",$a="#d08770",J1="#ebcb8b",DT="#a3be8c",dse="#b48ead",NT="#d30102",iw=Kx,e0=iw,pse="#ffffff",t0=rw,gse=iw,VT=rw,mse=se.theme({"&":{color:MT,backgroundColor:pse},".cm-content":{caretColor:VT},".cm-cursor, .cm-dropCursor":{borderLeftColor:VT},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:gse},".cm-panels":{backgroundColor:iw,color:Zd},".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 ${Zd}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:LT},".cm-activeLine":{backgroundColor:e0},".cm-selectionMatch":{backgroundColor:LT},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Zd}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Kx},".cm-gutters":{backgroundColor:Kx,color:MT,border:"none"},".cm-activeLineGutter":{backgroundColor:e0},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:t0},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:t0,borderBottomColor:t0},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:e0,color:Zd}}},{dark:!1}),Ose=Xh.define([{tag:A.keyword,color:vi},{tag:[A.name,A.deleted,A.character,A.propertyName,A.macroName],color:$a},{tag:[A.variableName],color:$a},{tag:[A.function(A.variableName)],color:vi},{tag:[A.labelName],color:fse},{tag:[A.color,A.constant(A.name),A.standard(A.name)],color:vi},{tag:[A.definition(A.name),A.separator],color:DT},{tag:[A.brace],color:K1},{tag:[A.annotation],color:NT},{tag:[A.number,A.changed,A.annotation,A.modifier,A.self,A.namespace],color:IT},{tag:[A.typeName,A.className],color:J1},{tag:[A.operator,A.operatorKeyword],color:DT},{tag:[A.tagName],color:dse},{tag:[A.squareBracket],color:hse},{tag:[A.angleBracket],color:$a},{tag:[A.attributeName],color:J1},{tag:[A.regexp],color:vi},{tag:[A.quote],color:rw},{tag:[A.string],color:$a},{tag:A.link,color:K1,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[A.url,A.escape,A.special(A.string)],color:$a},{tag:[A.meta],color:IT},{tag:[A.comment],color:RT,fontStyle:"italic"},{tag:A.strong,fontWeight:"bold",color:vi},{tag:A.emphasis,fontStyle:"italic",color:vi},{tag:A.strikethrough,textDecoration:"line-through"},{tag:A.heading,fontWeight:"bold",color:vi},{tag:A.special(A.heading1),fontWeight:"bold",color:vi},{tag:A.heading1,fontWeight:"bold",color:vi},{tag:[A.heading2,A.heading3,A.heading4],fontWeight:"bold",color:vi},{tag:[A.heading5,A.heading6],color:vi},{tag:[A.atom,A.bool,A.special(A.variableName)],color:$a},{tag:[A.processingInstruction,A.inserted],color:K1},{tag:[A.contentSeparator],color:J1},{tag:A.invalid,color:RT,borderBottom:`1px dotted ${NT}`}]),c8=[mse,x7(Ose)],BT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Mc{constructor(e,n,r=0,i=e.length,o,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=o?l=>o(BT(l)):BT,this.query=this.normalize(n)}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 gr(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 n=$S(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ui(e);let i=this.normalize(n);if(i.length)for(let o=0,s=r,l=!0;;o++){let a=i.charCodeAt(o),c=this.match(a,s,l,this.bufferPos+this.bufferStart,o==i.length-1);if(c)return this.value=c,this;if(o==i.length-1)break;l&&o<n.length&&n.charCodeAt(o)==a?s++:l=!1}}}match(e,n,r,i,o){let s=null;for(let l=0;l<this.matches.length;){let a=this.matches[l],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?s={from:a.from,to:i,precise:o&&a.precise}:(a.index++,c=!0)),c?l++:this.matches.splice(l,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:i,precise:r&&o}:this.matches.push({from:n,index:1,precise:r})),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Mc.prototype[Symbol.iterator]=function(){return this});const u8={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ow="gm"+(/x/.unicode==null?"":"u");class f8{constructor(e,n,r,i=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=u8,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new h8(e,n,r,i,o);this.re=new RegExp(n,ow+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let s=e.lineAt(i);this.curLineStart=s.from,this.matchPos=Yg(e,i),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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=Yg(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},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}}}const n0=new WeakMap;class uc{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=n0.get(e);if(!i||i.from>=r||i.to<=n){let l=new uc(n,e.sliceString(n,r));return n0.set(e,l),l}if(i.from==n&&i.to==r)return i;let{text:o,from:s}=i;return s>n&&(o=e.sliceString(n,s)+o,s=n),i.to<r&&(o+=e.sliceString(i.to,r)),n0.set(e,new uc(s,o)),new uc(n,o.slice(n-s,r-s))}}class h8{constructor(e,n,r,i,o){this.text=e,this.to=o,this.done=!1,this.value=u8,this.matchPos=Yg(e,i),this.re=new RegExp(n,ow+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=uc.get(e,i,this.chunkEnd(i+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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this.matchPos=Yg(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=uc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(f8.prototype[Symbol.iterator]=h8.prototype[Symbol.iterator]=function(){return this});function yse(t){try{return new RegExp(t,ow),!0}catch{return!1}}function Yg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}const xse=t=>{let e=Vre(t,"cm-goto-line");if(e){let s=e.dom.querySelector("input[type=text]");return s&&s.select(),!0}let{state:n}=t,r=String(n.doc.lineAt(t.state.selection.main.head).number),{close:i,result:o}=Nre(t,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return o.then(s=>{let l=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!l){t.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,f,h]=l,d=f?+f.slice(1):0,p=u?+u:a.number;if(u&&h){let O=p/100;c&&(O=O*(c=="-"?-1:1)+a.number/n.doc.lines),p=Math.round(n.doc.lines*O)}else u&&c&&(p=p*(c=="-"?-1:1)+a.number);let g=n.doc.line(Math.max(1,Math.min(n.doc.lines,p))),m=H.cursor(g.from+Math.max(0,Math.min(d,g.length)));t.dispatch({effects:[i,se.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},bse={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},vse=ye.define({combine(t){return xo(t,bse,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Sse(t){return[Tse,_se]}const wse=ke.mark({class:"cm-selectionMatch"}),kse=ke.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function FT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Dt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Dt.Word)}function Cse(t,e,n,r){return t(e.sliceDoc(n,n+1))==Dt.Word&&t(e.sliceDoc(r-1,r))==Dt.Word}const _se=Ht.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(vse),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ke.none;let i=r.main,o,s=null;if(i.empty){if(!e.highlightWordAroundCursor)return ke.none;let a=n.wordAt(i.head);if(!a)return ke.none;s=n.charCategorizer(i.head),o=n.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a<e.minSelectionLength||a>200)return ke.none;if(e.wholeWords){if(o=n.sliceDoc(i.from,i.to),s=n.charCategorizer(i.head),!(FT(s,n,i.from,i.to)&&Cse(s,n,i.from,i.to)))return ke.none}else if(o=n.sliceDoc(i.from,i.to),!o)return ke.none}let l=[];for(let a of t.visibleRanges){let c=new Mc(n.doc,o,a.from,a.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||FT(s,n,u,f))&&(i.empty&&u<=i.from&&f>=i.to?l.push(kse.range(u,f)):(u>=i.to||f<=i.from)&&l.push(wse.range(u,f)),l.length>e.maxMatches))return ke.none}}return ke.set(l)}},{decorations:t=>t.decorations}),Tse=se.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Pse=({state:t,dispatch:e})=>{let{selection:n}=t,r=H.create(n.ranges.map(i=>t.wordAt(i.head)||H.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Ese(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let s=!1,l=new Mc(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(s)return null;l=new Mc(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),s=!0}else{if(s&&r.some(a=>a.from==l.value.from))continue;if(o){let a=t.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const $se=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(o=>o.from===o.to))return Pse({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=r))return!1;let i=Ese(t,r);return i?(e(t.update({selection:t.selection.addRange(H.range(i.from,i.to),!1),effects:se.scrollIntoView(i.to)})),!0):!1},du=ye.define({combine(t){return xo(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new jse(e),scrollToMatch:e=>se.scrollIntoView(e)})}});class d8{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||yse(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,(n,r)=>r=="n"?`
115
+ `);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let i=this.rangeIndex;;){let o=this.ranges[i].to;if(o>=r||(n=n.slice(0,o-(r-n.length)),i++,i==this.ranges.length))break;let s=this.ranges[i].from,l=this.lineAfter(s);n+=l,r=s+l.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,o=e+n;if(r>0?i>o:i>=o)break;let s=this.ranges[++this.rangeIndex].from;n+=s-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,i){let o=4;if(this.ranges.length>1){i=this.skipGapsTo(n,i,1),n+=i;let l=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,o+=this.chunk.length-l}let s=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&o==4&&s>=0&&this.chunk[s]==e&&this.chunk[s+2]==n?this.chunk[s+2]=r:this.chunk.push(e,n,r,o),i}parseLine(e){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:o}=this.lang,s=new k7(n,e?e.state.tabSize:4,e?ta(e.state):2);if(s.eol())o.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let l=_7(o.token,s,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+s.start,this.parsedPos+s.pos,i)),s.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ye.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:qie,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ye(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Ye(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function _7(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let i=t(e,n);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const JS=Object.create(null),rh=[an.none],qie=new su(rh),wT=[],kT=Object.create(null),T7=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])T7[t]=E7(JS,e);class P7{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),T7)}resolve(e){return e?this.table[e]||(this.table[e]=E7(this.extra,e)):0}}const Yie=new P7(JS);function U1(t,e){wT.indexOf(t)>-1||(wT.push(t),console.warn(e))}function E7(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let c of l.split(".")){let u=t[c]||A[c];u?typeof u=="function"?a.length?a=a.map(u):U1(c,`Modifier ${c} used at start of tag`):a.length?U1(c,`Tag ${c} used as modifier`):a=Array.isArray(u)?u:[u]:U1(c,`Unknown highlighting tag ${c}`)}for(let c of a)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),o=kT[i];if(o)return o.id;let s=kT[i]=an.define({id:rh.length,name:r,props:[cu({[r]:n})]});return rh.push(s),s.id}function Uie(t,e){let n=an.define({id:rh.length,name:"Document",props:[Ps.add(()=>t),uu.add(()=>r=>e.getIndent(r))],top:!0});return rh.push(n),n}_t.RTL,_t.LTR;function te(t){return new Qc(GS.define(t))}function ms(t){return W(()=>import("./index-Upf-BEsx.js"),__vite__mapDeps([0,1,2])).then(e=>e.sql({dialect:e[t]}))}const Gie=[j.of({name:"C",extensions:["c","h","ino"],load(){return W(()=>import("./index-BNcXQYbv.js"),__vite__mapDeps([3,1,2])).then(t=>t.cpp())}}),j.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return W(()=>import("./index-BNcXQYbv.js"),__vite__mapDeps([3,1,2])).then(t=>t.cpp())}}),j.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return ms("Cassandra")}}),j.of({name:"CSS",extensions:["css"],load(){return W(()=>Promise.resolve().then(()=>Bfe),void 0).then(t=>t.css())}}),j.of({name:"Go",extensions:["go"],load(){return W(()=>import("./index-ChuqpBnv.js"),__vite__mapDeps([4,1,2])).then(t=>t.go())}}),j.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return W(()=>Promise.resolve().then(()=>Mhe),void 0).then(t=>t.html())}}),j.of({name:"Java",extensions:["java"],load(){return W(()=>import("./index-x5G6Np7T.js"),__vite__mapDeps([5,1,2])).then(t=>t.java())}}),j.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript())}}),j.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return W(()=>import("./index-CszaAR9T.js"),__vite__mapDeps([6,1,2])).then(t=>t.jinja())}}),j.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return W(()=>import("./index-C3hpUVfp.js"),__vite__mapDeps([7,1,2])).then(t=>t.json())}}),j.of({name:"JSX",extensions:["jsx"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript({jsx:!0}))}}),j.of({name:"LESS",extensions:["less"],load(){return W(()=>import("./index-BULB2rC_.js"),__vite__mapDeps([8,1,2])).then(t=>t.less())}}),j.of({name:"Liquid",extensions:["liquid"],load(){return W(()=>import("./index-DAi1VtJ8.js"),__vite__mapDeps([9,1,2])).then(t=>t.liquid())}}),j.of({name:"MariaDB SQL",load(){return ms("MariaSQL")}}),j.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return W(()=>Promise.resolve().then(()=>jhe),void 0).then(t=>t.markdown())}}),j.of({name:"MS SQL",load(){return ms("MSSQL")}}),j.of({name:"MySQL",load(){return ms("MySQL")}}),j.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return W(()=>import("./index-BQMgADlc.js"),__vite__mapDeps([10,1,2])).then(t=>t.php())}}),j.of({name:"PLSQL",extensions:["pls"],load(){return ms("PLSQL")}}),j.of({name:"PostgreSQL",load(){return ms("PostgreSQL")}}),j.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return W(()=>import("./index-CNJyAniG.js"),__vite__mapDeps([11,1,2])).then(t=>t.python())}}),j.of({name:"Rust",extensions:["rs"],load(){return W(()=>import("./index-CUCCMUMY.js"),__vite__mapDeps([12,1,2])).then(t=>t.rust())}}),j.of({name:"Sass",extensions:["sass"],load(){return W(()=>import("./index-DrSWAGft.js"),__vite__mapDeps([13,1,2])).then(t=>t.sass({indented:!0}))}}),j.of({name:"SCSS",extensions:["scss"],load(){return W(()=>import("./index-DrSWAGft.js"),__vite__mapDeps([13,1,2])).then(t=>t.sass())}}),j.of({name:"SQL",extensions:["sql"],load(){return ms("StandardSQL")}}),j.of({name:"SQLite",load(){return ms("SQLite")}}),j.of({name:"TSX",extensions:["tsx"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),j.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return W(()=>Promise.resolve().then(()=>tp),void 0).then(t=>t.javascript({typescript:!0}))}}),j.of({name:"WebAssembly",extensions:["wat","wast"],load(){return W(()=>import("./index-7J4zAS6J.js"),__vite__mapDeps([14,1,2])).then(t=>t.wast())}}),j.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return W(()=>import("./index-BIDsfw8C.js"),__vite__mapDeps([15,1,2])).then(t=>t.xml())}}),j.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return W(()=>import("./index-Bumwg9SM.js"),__vite__mapDeps([16,1,2])).then(t=>t.yaml())}}),j.of({name:"APL",extensions:["dyalog","apl"],load(){return W(()=>import("./apl-B4CMkyY2.js"),[]).then(t=>te(t.apl))}}),j.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return W(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(t=>te(t.asciiArmor))}}),j.of({name:"ASN.1",extensions:["asn","asn1"],load(){return W(()=>import("./asn1-EdZsLKOL.js"),[]).then(t=>te(t.asn1({})))}}),j.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return W(()=>import("./asterisk-B-8jnY81.js"),[]).then(t=>te(t.asterisk))}}),j.of({name:"Brainfuck",extensions:["b","bf"],load(){return W(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(t=>te(t.brainfuck))}}),j.of({name:"Cobol",extensions:["cob","cpy"],load(){return W(()=>import("./cobol-CWcv1MsR.js"),[]).then(t=>te(t.cobol))}}),j.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.csharp))}}),j.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return W(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>te(t.clojure))}}),j.of({name:"ClojureScript",extensions:["cljs"],load(){return W(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>te(t.clojure))}}),j.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return W(()=>import("./css-BnMrqG3P.js"),[]).then(t=>te(t.gss))}}),j.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return W(()=>import("./cmake-BQqOBYOt.js"),[]).then(t=>te(t.cmake))}}),j.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return W(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(t=>te(t.coffeeScript))}}),j.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return W(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(t=>te(t.commonLisp))}}),j.of({name:"Cypher",extensions:["cyp","cypher"],load(){return W(()=>import("./cypher-C_CwsFkJ.js"),[]).then(t=>te(t.cypher))}}),j.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return W(()=>import("./python-BuPzkPfP.js"),[]).then(t=>te(t.cython))}}),j.of({name:"Crystal",extensions:["cr"],load(){return W(()=>import("./crystal-SjHAIU92.js"),[]).then(t=>te(t.crystal))}}),j.of({name:"D",extensions:["d"],load(){return W(()=>import("./d-pRatUO7H.js"),[]).then(t=>te(t.d))}}),j.of({name:"Dart",extensions:["dart"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.dart))}}),j.of({name:"diff",extensions:["diff","patch"],load(){return W(()=>import("./diff-DbItnlRl.js"),[]).then(t=>te(t.diff))}}),j.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return W(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([17,18])).then(t=>te(t.dockerFile))}}),j.of({name:"DTD",extensions:["dtd"],load(){return W(()=>import("./dtd-DF_7sFjM.js"),[]).then(t=>te(t.dtd))}}),j.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return W(()=>import("./dylan-DwRh75JA.js"),[]).then(t=>te(t.dylan))}}),j.of({name:"EBNF",load(){return W(()=>import("./ebnf-CDyGwa7X.js"),[]).then(t=>te(t.ebnf))}}),j.of({name:"ECL",extensions:["ecl"],load(){return W(()=>import("./ecl-Cabwm37j.js"),[]).then(t=>te(t.ecl))}}),j.of({name:"edn",extensions:["edn"],load(){return W(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>te(t.clojure))}}),j.of({name:"Eiffel",extensions:["e"],load(){return W(()=>import("./eiffel-CnydiIhH.js"),[]).then(t=>te(t.eiffel))}}),j.of({name:"Elm",extensions:["elm"],load(){return W(()=>import("./elm-vLlmbW-K.js"),[]).then(t=>te(t.elm))}}),j.of({name:"Erlang",extensions:["erl"],load(){return W(()=>import("./erlang-BNw1qcRV.js"),[]).then(t=>te(t.erlang))}}),j.of({name:"Esper",load(){return W(()=>import("./sql-D0XecflT.js"),[]).then(t=>te(t.esper))}}),j.of({name:"Factor",extensions:["factor"],load(){return W(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([19,18])).then(t=>te(t.factor))}}),j.of({name:"FCL",load(){return W(()=>import("./fcl-Kvtd6kyn.js"),[]).then(t=>te(t.fcl))}}),j.of({name:"Forth",extensions:["forth","fth","4th"],load(){return W(()=>import("./forth-Ffai-XNe.js"),[]).then(t=>te(t.forth))}}),j.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return W(()=>import("./fortran-DYz_wnZ1.js"),[]).then(t=>te(t.fortran))}}),j.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return W(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>te(t.fSharp))}}),j.of({name:"Gas",extensions:["s"],load(){return W(()=>import("./gas-Bneqetm1.js"),[]).then(t=>te(t.gas))}}),j.of({name:"Gherkin",extensions:["feature"],load(){return W(()=>import("./gherkin-heZmZLOM.js"),[]).then(t=>te(t.gherkin))}}),j.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return W(()=>import("./groovy-D9Dt4D0W.js"),[]).then(t=>te(t.groovy))}}),j.of({name:"Haskell",extensions:["hs"],load(){return W(()=>import("./haskell-Cw1EW3IL.js"),[]).then(t=>te(t.haskell))}}),j.of({name:"Haxe",extensions:["hx"],load(){return W(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>te(t.haxe))}}),j.of({name:"HXML",extensions:["hxml"],load(){return W(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>te(t.hxml))}}),j.of({name:"HTTP",load(){return W(()=>import("./http-DBlCnlav.js"),[]).then(t=>te(t.http))}}),j.of({name:"IDL",extensions:["pro"],load(){return W(()=>import("./idl-BEugSyMb.js"),[]).then(t=>te(t.idl))}}),j.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return W(()=>import("./javascript-iXu5QeM3.js"),[]).then(t=>te(t.jsonld))}}),j.of({name:"Julia",extensions:["jl"],load(){return W(()=>import("./julia-DuME0IfC.js"),[]).then(t=>te(t.julia))}}),j.of({name:"Kotlin",extensions:["kt","kts"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.kotlin))}}),j.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return W(()=>import("./livescript-BwQOo05w.js"),[]).then(t=>te(t.liveScript))}}),j.of({name:"Lua",extensions:["lua"],load(){return W(()=>import("./lua-VAEuO923.js"),[]).then(t=>te(t.lua))}}),j.of({name:"mIRC",extensions:["mrc"],load(){return W(()=>import("./mirc-CjQqDB4T.js"),[]).then(t=>te(t.mirc))}}),j.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return W(()=>import("./mathematica-DTrFuWx2.js"),[]).then(t=>te(t.mathematica))}}),j.of({name:"Modelica",extensions:["mo"],load(){return W(()=>import("./modelica-Dc1JOy9r.js"),[]).then(t=>te(t.modelica))}}),j.of({name:"MUMPS",extensions:["mps"],load(){return W(()=>import("./mumps-BT43cFF4.js"),[]).then(t=>te(t.mumps))}}),j.of({name:"Mbox",extensions:["mbox"],load(){return W(()=>import("./mbox-CNhZ1qSd.js"),[]).then(t=>te(t.mbox))}}),j.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return W(()=>import("./nginx-DdIZxoE0.js"),[]).then(t=>te(t.nginx))}}),j.of({name:"NSIS",extensions:["nsh","nsi"],load(){return W(()=>import("./nsis-LY0VT_u5.js"),__vite__mapDeps([20,18])).then(t=>te(t.nsis))}}),j.of({name:"NTriples",extensions:["nt","nq"],load(){return W(()=>import("./ntriples-BfvgReVJ.js"),[]).then(t=>te(t.ntriples))}}),j.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.objectiveC))}}),j.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.objectiveCpp))}}),j.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return W(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>te(t.oCaml))}}),j.of({name:"Octave",extensions:["m"],load(){return W(()=>import("./octave-Ck1zUtKM.js"),[]).then(t=>te(t.octave))}}),j.of({name:"Oz",extensions:["oz"],load(){return W(()=>import("./oz-BzwKVEFT.js"),[]).then(t=>te(t.oz))}}),j.of({name:"Pascal",extensions:["p","pas"],load(){return W(()=>import("./pascal--L3eBynH.js"),[]).then(t=>te(t.pascal))}}),j.of({name:"Perl",extensions:["pl","pm"],load(){return W(()=>import("./perl-CdXCOZ3F.js"),[]).then(t=>te(t.perl))}}),j.of({name:"Pig",extensions:["pig"],load(){return W(()=>import("./pig-CevX1Tat.js"),[]).then(t=>te(t.pig))}}),j.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return W(()=>import("./powershell-CFHJl5sT.js"),[]).then(t=>te(t.powerShell))}}),j.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return W(()=>import("./properties-C78fOPTZ.js"),[]).then(t=>te(t.properties))}}),j.of({name:"ProtoBuf",extensions:["proto"],load(){return W(()=>import("./protobuf-ChK-085T.js"),[]).then(t=>te(t.protobuf))}}),j.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return W(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([21,22])).then(t=>te(t.pug))}}),j.of({name:"Puppet",extensions:["pp"],load(){return W(()=>import("./puppet-DMA9R1ak.js"),[]).then(t=>te(t.puppet))}}),j.of({name:"Q",extensions:["q"],load(){return W(()=>import("./q-pXgVlZs6.js"),[]).then(t=>te(t.q))}}),j.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return W(()=>import("./r-B6wPVr8A.js"),[]).then(t=>te(t.r))}}),j.of({name:"RPM Changes",load(){return W(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>te(t.rpmChanges))}}),j.of({name:"RPM Spec",extensions:["spec"],load(){return W(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>te(t.rpmSpec))}}),j.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return W(()=>import("./ruby-BK5aLJev.js"),[]).then(t=>te(t.ruby))}}),j.of({name:"SAS",extensions:["sas"],load(){return W(()=>import("./sas-B4kiWyti.js"),[]).then(t=>te(t.sas))}}),j.of({name:"Scala",extensions:["scala"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.scala))}}),j.of({name:"Scheme",extensions:["scm","ss"],load(){return W(()=>import("./scheme-C41bIUwD.js"),[]).then(t=>te(t.scheme))}}),j.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return W(()=>import("./shell-CjFT_Tl9.js"),[]).then(t=>te(t.shell))}}),j.of({name:"Sieve",extensions:["siv","sieve"],load(){return W(()=>import("./sieve-C3Gn_uJK.js"),[]).then(t=>te(t.sieve))}}),j.of({name:"Smalltalk",extensions:["st"],load(){return W(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(t=>te(t.smalltalk))}}),j.of({name:"Solr",load(){return W(()=>import("./solr-DehyRSwq.js"),[]).then(t=>te(t.solr))}}),j.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return W(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>te(t.sml))}}),j.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return W(()=>import("./sparql-DkYu6x3z.js"),[]).then(t=>te(t.sparql))}}),j.of({name:"Spreadsheet",alias:["excel","formula"],load(){return W(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(t=>te(t.spreadsheet))}}),j.of({name:"Squirrel",extensions:["nut"],load(){return W(()=>import("./clike-B9uivgTg.js"),[]).then(t=>te(t.squirrel))}}),j.of({name:"Stylus",extensions:["styl"],load(){return W(()=>import("./stylus-B533Al4x.js"),[]).then(t=>te(t.stylus))}}),j.of({name:"Swift",extensions:["swift"],load(){return W(()=>import("./swift-BzpIVaGY.js"),[]).then(t=>te(t.swift))}}),j.of({name:"sTeX",load(){return W(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>te(t.stex))}}),j.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return W(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>te(t.stex))}}),j.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return W(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>te(t.verilog))}}),j.of({name:"Tcl",extensions:["tcl"],load(){return W(()=>import("./tcl-DVfN8rqt.js"),[]).then(t=>te(t.tcl))}}),j.of({name:"Textile",extensions:["textile"],load(){return W(()=>import("./textile-CnDTJFAw.js"),[]).then(t=>te(t.textile))}}),j.of({name:"TiddlyWiki",load(){return W(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(t=>te(t.tiddlyWiki))}}),j.of({name:"Tiki wiki",load(){return W(()=>import("./tiki-DGYXhP31.js"),[]).then(t=>te(t.tiki))}}),j.of({name:"TOML",extensions:["toml"],load(){return W(()=>import("./toml-Bm5Em-hy.js"),[]).then(t=>te(t.toml))}}),j.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return W(()=>import("./troff-wAsdV37c.js"),[]).then(t=>te(t.troff))}}),j.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return W(()=>import("./ttcn-CfJYG6tj.js"),[]).then(t=>te(t.ttcn))}}),j.of({name:"TTCN_CFG",extensions:["cfg"],load(){return W(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(t=>te(t.ttcnCfg))}}),j.of({name:"Turtle",extensions:["ttl"],load(){return W(()=>import("./turtle-B1tBg_DP.js"),[]).then(t=>te(t.turtle))}}),j.of({name:"Web IDL",extensions:["webidl"],load(){return W(()=>import("./webidl-ZXfAyPTL.js"),[]).then(t=>te(t.webIDL))}}),j.of({name:"VB.NET",extensions:["vb"],load(){return W(()=>import("./vb-CmGdzxic.js"),[]).then(t=>te(t.vb))}}),j.of({name:"VBScript",extensions:["vbs"],load(){return W(()=>import("./vbscript-BuJXcnF6.js"),[]).then(t=>te(t.vbScript))}}),j.of({name:"Velocity",extensions:["vtl"],load(){return W(()=>import("./velocity-D8B20fx6.js"),[]).then(t=>te(t.velocity))}}),j.of({name:"Verilog",extensions:["v"],load(){return W(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>te(t.verilog))}}),j.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return W(()=>import("./vhdl-lSbBsy5d.js"),[]).then(t=>te(t.vhdl))}}),j.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return W(()=>import("./xquery-DzFWVndE.js"),[]).then(t=>te(t.xQuery))}}),j.of({name:"Yacas",extensions:["ys"],load(){return W(()=>import("./yacas-BJ4BC0dw.js"),[]).then(t=>te(t.yacas))}}),j.of({name:"Z80",extensions:["z80"],load(){return W(()=>import("./z80-Hz9HOZM7.js"),[]).then(t=>te(t.z80))}}),j.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return W(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>te(t.mscgen))}}),j.of({name:"Xù",extensions:["xu"],load(){return W(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>te(t.xu))}}),j.of({name:"MsGenny",extensions:["msgenny"],load(){return W(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>te(t.msgenny))}}),j.of({name:"Vue",extensions:["vue"],load(){return W(()=>import("./index-CMMYSoL3.js"),__vite__mapDeps([23,1,2])).then(t=>t.vue())}}),j.of({name:"Angular Template",load(){return W(()=>import("./index-BxEG-IdY.js"),__vite__mapDeps([24,1,2])).then(t=>t.angular())}})],Kie=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=tw(t.state,n.from);return r.line?Jie(t):r.block?toe(t):!1};function ew(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const Jie=ew(ioe,0),eoe=ew($7,0),toe=ew((t,e)=>$7(t,e,roe(e)),0);function tw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Qu=50;function noe(t,{open:e,close:n},r,i){let o=t.sliceDoc(r-Qu,r),s=t.sliceDoc(i,i+Qu),l=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(s)[0].length,c=o.length-l;if(o.slice(c-e.length,c)==e&&s.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let u,f;i-r<=2*Qu?u=f=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+Qu),f=t.sliceDoc(i-Qu,i));let h=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-n.length;return u.slice(h,h+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:i-d-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function roe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let o=e.length-1;o>=0&&e[o].to>r.from?e[o].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function $7(t,e,n=e.selection.ranges){let r=n.map(o=>tw(e,o.from).block);if(!r.every(o=>o))return null;let i=n.map((o,s)=>noe(e,r[s],o.from,o.to));if(t!=2&&!i.every(o=>o))return{changes:e.changes(n.map((o,s)=>i[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(t!=1&&i.some(o=>o)){let o=[];for(let s=0,l;s<i.length;s++)if(l=i[s]){let a=r[s],{open:c,close:u}=l;o.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:o}}return null}function ioe(t,e,n=e.selection.ranges){let r=[],i=-1;e:for(let{from:o,to:s}of n){let l=r.length,a=1e9,c;for(let u=o;u<=s;){let f=e.doc.lineAt(u);if(c==null&&(c=tw(e,f.from).line,!c))continue e;if(f.from>i&&(o==s||s>f.from)){i=f.from;let h=/^\s*/.exec(f.text)[0].length,d=h==f.length,p=f.text.slice(h,h+c.length)==c?h:-1;h<f.text.length&&h<a&&(a=h),r.push({line:f,comment:p,token:c,indent:h,empty:d,single:!1})}u=f.to+1}if(a<1e9)for(let u=l;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=a);r.length==l+1&&(r[l].single=!0)}if(t!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:l,token:a,indent:c,empty:u,single:f}of r)(f||!u)&&o.push({from:l.from+c,insert:a+" "});let s=e.changes(o);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:l,token:a}of r)if(l>=0){let c=s.from+l,u=c+a.length;s.text[u-s.from]==" "&&u++,o.push({from:c,to:u})}return{changes:o}}return null}const qx=ds.define(),ooe=ds.define(),soe=ye.define(),A7=ye.define({combine(t){return xo(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),Q7=cn.define({create(){return oo.empty},update(t,e){let n=e.state.facet(A7),r=e.annotation(qx);if(r){let a=xr.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return a?u=qg(u,u.length,n.minDepth,a):u=L7(u,e.startState.selection),new oo(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(ooe);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(on.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=xr.fromTransaction(e),s=e.annotation(on.time),l=e.annotation(on.userEvent);return o?t=t.addChanges(o,s,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,s,l,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new oo(t.done.map(xr.fromJSON),t.undone.map(xr.fromJSON))}});function loe(t={}){return[Q7,A7.of(t),se.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?M7:e.inputType=="historyRedo"?Yx:null;return r?(e.preventDefault(),r(n)):!1}})]}function bO(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(Q7,!1);if(!i)return!1;let o=i.pop(t,n,e);return o?(r(o),!0):!1}}const M7=bO(0,!1),Yx=bO(1,!1),aoe=bO(0,!0),coe=bO(1,!0);class xr{constructor(e,n,r,i,o){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=o}setSelAfter(e){return new xr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new xr(e.changes&&tn.fromJSON(e.changes),[],e.mapped&&lo.fromJSON(e.mapped),e.startSelection&&H.fromJSON(e.startSelection),e.selectionsAfter.map(H.fromJSON))}static fromTransaction(e,n){let r=ei;for(let i of e.startState.facet(soe)){let o=i(e);o.length&&(r=r.concat(o))}return!r.length&&e.changes.empty?null:new xr(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ei)}static selection(e){return new xr(void 0,ei,void 0,void 0,e)}}function qg(t,e,n,r){let i=e+1>n+20?e-n-1:0,o=t.slice(i,e);return o.push(r),o}function uoe(t,e){let n=[],r=!1;return t.iterChangedRanges((i,o)=>n.push(i,o)),e.iterChangedRanges((i,o,s,l)=>{for(let a=0;a<n.length;){let c=n[a++],u=n[a++];l>=c&&s<=u&&(r=!0)}}),r}function foe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function R7(t,e){return t.length?e.length?t.concat(e):t:e}const ei=[],hoe=200;function L7(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-hoe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),qg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[xr.selection([e])]}function doe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function G1(t,e){if(!t.length)return t;let n=t.length,r=ei;for(;n;){let i=poe(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let o=t.slice(0,n);return o[n-1]=i,o}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[xr.selection(r)]:ei}function poe(t,e,n){let r=R7(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ei,n);if(!t.changes)return xr.selection(r);let i=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new xr(i,Le.mapEffects(t.effects,e),s,t.startSelection.map(o),r)}const goe=/^(input\.type|delete)($|\.)/;class oo{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new oo(this.done,this.undone):this}addChanges(e,n,r,i,o){let s=this.done,l=s[s.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||goe.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,uoe(l.changes,e.changes))||r=="input.type.compose")?s=qg(s,s.length-1,i.minDepth,new xr(e.changes.compose(l.changes),R7(Le.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,ei)):s=qg(s,s.length,i.minDepth,e),new oo(s,ei,n,r)}addSelection(e,n,r,i){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:ei;return o.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&foe(o[o.length-1],e)?this:new oo(L7(this.done,e),this.undone,n,r)}addMapping(e){return new oo(G1(this.done,e),G1(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let o=i[i.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):n.selection);if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:qx.of({side:e,rest:doe(i),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let l=i.length==1?ei:i.slice(0,i.length-1);return o.mapped&&(l=G1(l,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:qx.of({side:e,rest:l,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}oo.empty=new oo(ei,ei);const moe=[{key:"Mod-z",run:M7,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Yx,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Yx,preventDefault:!0},{key:"Mod-u",run:aoe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:coe,preventDefault:!0}];function hu(t,e){return H.create(t.ranges.map(e),t.mainIndex)}function Zi(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function zi({state:t,dispatch:e},n){let r=hu(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Zi(t,r)),!0)}function vO(t,e){return H.cursor(e?t.to:t.from)}function I7(t,e){return zi(t,n=>n.empty?t.moveByChar(n,e):vO(n,e))}function Gn(t){return t.textDirectionAt(t.state.selection.main.head)==_t.LTR}const D7=t=>I7(t,!Gn(t)),N7=t=>I7(t,Gn(t));function V7(t,e){return zi(t,n=>n.empty?t.moveByGroup(n,e):vO(n,e))}const Ooe=t=>V7(t,!Gn(t)),yoe=t=>V7(t,Gn(t));function xoe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function SO(t,e,n){let r=wt(t).resolveInner(e.head),i=n?Ve.closedBy:Ve.openedBy;for(let a=e.head;;){let c=n?r.childAfter(a):r.childBefore(a);if(!c)break;xoe(t,c,i)?r=c:a=n?c.to:c.from}let o=r.type.prop(i),s,l;return o&&(s=n?io(t,r.from,1):io(t,r.to,-1))&&s.matched?l=n?s.end.to:s.end.from:l=n?r.to:r.from,H.cursor(l,n?-1:1)}const boe=t=>zi(t,e=>SO(t.state,e,!Gn(t))),voe=t=>zi(t,e=>SO(t.state,e,Gn(t)));function B7(t,e){return zi(t,n=>{if(!n.empty)return vO(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const F7=t=>B7(t,!1),Z7=t=>B7(t,!0);function z7(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let o of t.state.facet(se.scrollMargins)){let s=o(t);s?.top&&(n=Math.max(s?.top,n)),s?.bottom&&(r=Math.max(s?.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function j7(t,e){let n=z7(t),{state:r}=t,i=hu(r.selection,s=>s.empty?t.moveVertically(s,e,n.height):vO(s,e));if(i.eq(r.selection))return!1;let o;if(n.selfScroll){let s=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,c=l.bottom-n.marginBottom;s&&s.top>a&&s.bottom<c&&(o=se.scrollIntoView(i.main.head,{y:"start",yMargin:s.top-a}))}return t.dispatch(Zi(r,i),{effects:o}),!0}const CT=t=>j7(t,!1),Ux=t=>j7(t,!0);function il(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let o=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&e.head!=r.from+o&&(i=H.cursor(r.from+o))}return i}const Soe=t=>zi(t,e=>il(t,e,!0)),woe=t=>zi(t,e=>il(t,e,!1)),koe=t=>zi(t,e=>il(t,e,!Gn(t))),Coe=t=>zi(t,e=>il(t,e,Gn(t))),_oe=t=>zi(t,e=>H.cursor(t.lineBlockAt(e.head).from,1)),Toe=t=>zi(t,e=>H.cursor(t.lineBlockAt(e.head).to,-1));function Poe(t,e,n){let r=!1,i=hu(t.selection,o=>{let s=io(t,o.head,-1)||io(t,o.head,1)||o.head>0&&io(t,o.head-1,1)||o.head<t.doc.length&&io(t,o.head+1,-1);if(!s||!s.end)return o;r=!0;let l=s.start.from==o.head?s.end.to:s.end.from;return H.cursor(l)});return r?(e(Zi(t,i)),!0):!1}const Eoe=({state:t,dispatch:e})=>Poe(t,e);function gi(t,e,n){let r=hu(t.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=H.range(i.head,i.anchor));let o=n(i);return H.range(i.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(Zi(t.state,r)),!0)}function X7(t,e){return gi(t,e,n=>t.moveByChar(n,e))}const W7=t=>X7(t,!Gn(t)),H7=t=>X7(t,Gn(t));function q7(t,e){return gi(t,e,n=>t.moveByGroup(n,e))}const $oe=t=>q7(t,!Gn(t)),Aoe=t=>q7(t,Gn(t)),Qoe=t=>{let e=!Gn(t);return gi(t,e,n=>SO(t.state,n,e))},Moe=t=>{let e=Gn(t);return gi(t,e,n=>SO(t.state,n,e))};function Y7(t,e){return gi(t,e,n=>t.moveVertically(n,e))}const U7=t=>Y7(t,!1),G7=t=>Y7(t,!0);function K7(t,e){return gi(t,e,n=>t.moveVertically(n,e,z7(t).height))}const _T=t=>K7(t,!1),TT=t=>K7(t,!0),Roe=t=>gi(t,!0,e=>il(t,e,!0)),Loe=t=>gi(t,!1,e=>il(t,e,!1)),Ioe=t=>{let e=!Gn(t);return gi(t,e,n=>il(t,n,e))},Doe=t=>{let e=Gn(t);return gi(t,e,n=>il(t,n,e))},Noe=t=>gi(t,!1,e=>H.cursor(t.lineBlockAt(e.head).from)),Voe=t=>gi(t,!0,e=>H.cursor(t.lineBlockAt(e.head).to)),PT=({state:t,dispatch:e})=>(e(Zi(t,{anchor:0})),!0),ET=({state:t,dispatch:e})=>(e(Zi(t,{anchor:t.doc.length})),!0),$T=({state:t,dispatch:e})=>(e(Zi(t,{anchor:t.selection.main.anchor,head:0})),!0),AT=({state:t,dispatch:e})=>(e(Zi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Boe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Foe=({state:t,dispatch:e})=>{let n=wO(t).map(({from:r,to:i})=>H.undirectionalRange(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:H.create(n),userEvent:"select"})),!0},Zoe=({state:t,dispatch:e})=>{let n=hu(t.selection,r=>{let i=wt(t),o=i.resolveStack(r.from,1);if(r.empty){let s=i.resolveStack(r.from,-1);s.node.from>=o.node.from&&s.node.to<=o.node.to&&(o=s)}for(let s=o;s;s=s.next){let{node:l}=s;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&s.next)return H.undirectionalRange(l.from,l.to)}return r});return n.eq(t.selection)?!1:(e(Zi(t,n)),!0)};function J7(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(e?s.to<t.state.doc.length:s.from>0)for(let l=o;;){let a=t.moveVertically(l,e);if(a.head<s.from||a.head>s.to){i.some(c=>c.head==a.head)||i.push(a);break}else{if(a.head==l.head)break;l=a}}}return i.length==r.ranges.length?!1:(t.dispatch(Zi(n,H.create(i,i.length-1))),!0)}const zoe=t=>J7(t,!1),joe=t=>J7(t,!0),Xoe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=H.create([n.main]):n.main.empty||(r=H.create([H.cursor(n.main.head)])),r?(e(Zi(t,r)),!0):!1};function Wh(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(o=>{let{from:s,to:l}=o;if(s==l){let a=e(o);a<s?(n="delete.backward",a=Fd(t,a,!1)):a>s&&(n="delete.forward",a=Fd(t,a,!0)),s=Math.min(s,a),l=Math.max(l,a)}else s=Fd(t,s,!1),l=Fd(t,l,!0);return s==l?{range:o}:{changes:{from:s,to:l},range:H.cursor(s,s<o.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?se.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Fd(t,e,n){if(t instanceof se)for(let r of t.state.facet(se.atomicRanges).map(i=>i(t)))r.between(e,e,(i,o)=>{i<e&&o>e&&(e=n?o:i)});return e}const e8=(t,e,n)=>Wh(t,r=>{let i=r.from,{state:o}=t,s=o.doc.lineAt(i),l,a;if(n&&!e&&i>s.from&&i<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,i-s.from))){if(l[l.length-1]==" ")return i-1;let c=Ni(l,o.tabSize),u=c%ta(o)||ta(o);for(let f=0;f<u&&l[l.length-1-f]==" ";f++)i--;a=i}else a=Sn(s.text,i-s.from,e,e)+s.from,a==i&&s.number!=(e?o.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,i-s.from))&&(a=Sn(s.text,a-s.from,!1,!1)+s.from);return a}),Gx=t=>e8(t,!1,!0),t8=t=>e8(t,!0,!1),n8=(t,e)=>Wh(t,n=>{let r=n.head,{state:i}=t,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let l=null;;){if(r==(e?o.to:o.from)){r==n.head&&o.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=Sn(o.text,r-o.from,e)+o.from,c=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),u=s(c);if(l!=null&&u!=l)break;(c!=" "||r!=n.head)&&(l=u),r=a}return r}),r8=t=>n8(t,!1),Woe=t=>n8(t,!0),Hoe=t=>Wh(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),qoe=t=>Wh(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Yoe=t=>Wh(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Uoe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:rt.of(["",""])},range:H.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Goe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,o=t.doc.lineAt(i),s=i==o.from?i-1:Sn(o.text,i-o.from,!1)+o.from,l=i==o.to?i+1:Sn(o.text,i-o.from,!0)+o.from;return{changes:{from:s,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(s,i))},range:H.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function wO(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),o=t.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=t.doc.lineAt(r.to-1)),n>=i.number){let s=e[e.length-1];s.to=o.to,s.ranges.push(r)}else e.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return e}function i8(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let o of wO(t)){if(n?o.to==t.doc.length:o.from==0)continue;let s=t.doc.lineAt(n?o.to+1:o.from-1),l=s.length+1;if(n){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+t.lineBreak});for(let a of o.ranges)i.push(H.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:t.lineBreak+s.text});for(let a of o.ranges)i.push(H.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:H.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Koe=({state:t,dispatch:e})=>i8(t,e,!1),Joe=({state:t,dispatch:e})=>i8(t,e,!0);function o8(t,e,n){if(t.readOnly)return!1;let r=[];for(let o of wO(t))n?r.push({from:o.from,insert:t.doc.slice(o.from,o.to)+t.lineBreak}):r.push({from:o.to,insert:t.lineBreak+t.doc.slice(o.from,o.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ese=({state:t,dispatch:e})=>o8(t,e,!1),tse=({state:t,dispatch:e})=>o8(t,e,!0),nse=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(wO(e).map(({from:i,to:o})=>(i>0?i--:o<e.doc.length&&o++,{from:i,to:o}))),r=hu(e.selection,i=>{let o;if(t.lineWrapping){let s=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(o=s.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,o)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function rse(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=wt(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),o;return r&&i&&r.to<=e&&i.from>=e&&(o=r.type.prop(Ve.closedBy))&&o.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const QT=s8(!1),ise=s8(!0);function s8(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:o,to:s}=i,l=e.doc.lineAt(o),a=!t&&o==s&&rse(e,o);t&&(o=s=(s<=l.to?l:e.doc.lineAt(s)).to);let c=new yO(e,{simulateBreak:o,simulateDoubleBreak:!!a}),u=YS(c,o);for(u==null&&(u=Ni(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));s<l.to&&/\s/.test(l.text[s-l.from]);)s++;a?{from:o,to:s}=a:o>l.from&&o<l.from+100&&!/\S/.test(l.text.slice(0,o))&&(o=l.from);let f=["",nh(e,u)];return a&&f.push(nh(e,c.lineIndent(l.from,-1))),{changes:{from:o,to:s,insert:rt.of(f)},range:H.cursor(o+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function nw(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let s=r.from;s<=r.to;){let l=t.doc.lineAt(s);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),s=l.to+1}let o=t.changes(i);return{changes:i,range:H.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const ose=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new yO(t,{overrideIndentation:o=>{let s=n[o];return s??-1}}),i=nw(t,(o,s,l)=>{let a=YS(r,o.from);if(a==null)return;/\S/.test(o.text)||(a=0);let c=/^\s*/.exec(o.text)[0],u=nh(t,a);(c!=u||l.from<o.from+c.length)&&(n[o.from]=a,s.push({from:o.from,to:o.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},l8=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(nw(t,(n,r)=>{r.push({from:n.from,insert:t.facet(zh)})}),{userEvent:"input.indent"})),!0),a8=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(nw(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let o=Ni(i,t.tabSize),s=0,l=nh(t,Math.max(0,o-ta(t)));for(;s<i.length&&s<l.length&&i.charCodeAt(s)==l.charCodeAt(s);)s++;r.push({from:n.from+s,to:n.from+i.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0),sse=t=>(t.setTabFocusMode(),!0),lse=[{key:"Ctrl-b",run:D7,shift:W7,preventDefault:!0},{key:"Ctrl-f",run:N7,shift:H7},{key:"Ctrl-p",run:F7,shift:U7},{key:"Ctrl-n",run:Z7,shift:G7},{key:"Ctrl-a",run:_oe,shift:Noe},{key:"Ctrl-e",run:Toe,shift:Voe},{key:"Ctrl-d",run:t8},{key:"Ctrl-h",run:Gx},{key:"Ctrl-k",run:Hoe},{key:"Ctrl-Alt-h",run:r8},{key:"Ctrl-o",run:Uoe},{key:"Ctrl-t",run:Goe},{key:"Ctrl-v",run:Ux}],ase=[{key:"ArrowLeft",run:D7,shift:W7,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Ooe,shift:$oe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:koe,shift:Ioe,preventDefault:!0},{key:"ArrowRight",run:N7,shift:H7,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yoe,shift:Aoe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Coe,shift:Doe,preventDefault:!0},{key:"ArrowUp",run:F7,shift:U7,preventDefault:!0},{mac:"Cmd-ArrowUp",run:PT,shift:$T},{mac:"Ctrl-ArrowUp",run:CT,shift:_T},{key:"ArrowDown",run:Z7,shift:G7,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ET,shift:AT},{mac:"Ctrl-ArrowDown",run:Ux,shift:TT},{key:"PageUp",run:CT,shift:_T},{key:"PageDown",run:Ux,shift:TT},{key:"Home",run:woe,shift:Loe,preventDefault:!0},{key:"Mod-Home",run:PT,shift:$T},{key:"End",run:Soe,shift:Roe,preventDefault:!0},{key:"Mod-End",run:ET,shift:AT},{key:"Enter",run:QT,shift:QT},{key:"Mod-a",run:Boe},{key:"Backspace",run:Gx,shift:Gx,preventDefault:!0},{key:"Delete",run:t8,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:r8,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Woe,preventDefault:!0},{mac:"Mod-Backspace",run:qoe,preventDefault:!0},{mac:"Mod-Delete",run:Yoe,preventDefault:!0}].concat(lse.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),cse=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:boe,shift:Qoe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:voe,shift:Moe},{key:"Alt-ArrowUp",run:Koe},{key:"Shift-Alt-ArrowUp",run:ese},{key:"Alt-ArrowDown",run:Joe},{key:"Shift-Alt-ArrowDown",run:tse},{key:"Mod-Alt-ArrowUp",run:zoe},{key:"Mod-Alt-ArrowDown",run:joe},{key:"Escape",run:Xoe},{key:"Mod-Enter",run:ise},{key:"Alt-l",mac:"Ctrl-l",run:Foe},{key:"Mod-i",run:Zoe,preventDefault:!0},{key:"Mod-[",run:a8},{key:"Mod-]",run:l8},{key:"Mod-Alt-\\",run:ose},{key:"Shift-Mod-k",run:nse},{key:"Shift-Mod-\\",run:Eoe},{key:"Mod-/",run:Kie},{key:"Alt-A",mac:"Ctrl-A",run:eoe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:sse}].concat(ase),use={key:"Tab",run:l8,shift:a8},MT="#2e3440",rw="#3b4252",RT="#434c5e",Zd="#4c566a",LT="#e5e9f0",Kx="#eceff4",K1="#8fbcbb",IT="#88c0d0",fse="#81a1c1",vi="#5e81ac",hse="#bf616a",$a="#d08770",J1="#ebcb8b",DT="#a3be8c",dse="#b48ead",NT="#d30102",iw=Kx,e0=iw,pse="#ffffff",t0=rw,gse=iw,VT=rw,mse=se.theme({"&":{color:MT,backgroundColor:pse},".cm-content":{caretColor:VT},".cm-cursor, .cm-dropCursor":{borderLeftColor:VT},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:gse},".cm-panels":{backgroundColor:iw,color:Zd},".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 ${Zd}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:LT},".cm-activeLine":{backgroundColor:e0},".cm-selectionMatch":{backgroundColor:LT},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Zd}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Kx},".cm-gutters":{backgroundColor:Kx,color:MT,border:"none"},".cm-activeLineGutter":{backgroundColor:e0},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:t0},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:t0,borderBottomColor:t0},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:e0,color:Zd}}},{dark:!1}),Ose=Xh.define([{tag:A.keyword,color:vi},{tag:[A.name,A.deleted,A.character,A.propertyName,A.macroName],color:$a},{tag:[A.variableName],color:$a},{tag:[A.function(A.variableName)],color:vi},{tag:[A.labelName],color:fse},{tag:[A.color,A.constant(A.name),A.standard(A.name)],color:vi},{tag:[A.definition(A.name),A.separator],color:DT},{tag:[A.brace],color:K1},{tag:[A.annotation],color:NT},{tag:[A.number,A.changed,A.annotation,A.modifier,A.self,A.namespace],color:IT},{tag:[A.typeName,A.className],color:J1},{tag:[A.operator,A.operatorKeyword],color:DT},{tag:[A.tagName],color:dse},{tag:[A.squareBracket],color:hse},{tag:[A.angleBracket],color:$a},{tag:[A.attributeName],color:J1},{tag:[A.regexp],color:vi},{tag:[A.quote],color:rw},{tag:[A.string],color:$a},{tag:A.link,color:K1,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[A.url,A.escape,A.special(A.string)],color:$a},{tag:[A.meta],color:IT},{tag:[A.comment],color:RT,fontStyle:"italic"},{tag:A.strong,fontWeight:"bold",color:vi},{tag:A.emphasis,fontStyle:"italic",color:vi},{tag:A.strikethrough,textDecoration:"line-through"},{tag:A.heading,fontWeight:"bold",color:vi},{tag:A.special(A.heading1),fontWeight:"bold",color:vi},{tag:A.heading1,fontWeight:"bold",color:vi},{tag:[A.heading2,A.heading3,A.heading4],fontWeight:"bold",color:vi},{tag:[A.heading5,A.heading6],color:vi},{tag:[A.atom,A.bool,A.special(A.variableName)],color:$a},{tag:[A.processingInstruction,A.inserted],color:K1},{tag:[A.contentSeparator],color:J1},{tag:A.invalid,color:RT,borderBottom:`1px dotted ${NT}`}]),c8=[mse,x7(Ose)],BT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Mc{constructor(e,n,r=0,i=e.length,o,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=o?l=>o(BT(l)):BT,this.query=this.normalize(n)}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 gr(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 n=$S(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ui(e);let i=this.normalize(n);if(i.length)for(let o=0,s=r,l=!0;;o++){let a=i.charCodeAt(o),c=this.match(a,s,l,this.bufferPos+this.bufferStart,o==i.length-1);if(c)return this.value=c,this;if(o==i.length-1)break;l&&o<n.length&&n.charCodeAt(o)==a?s++:l=!1}}}match(e,n,r,i,o){let s=null;for(let l=0;l<this.matches.length;){let a=this.matches[l],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?s={from:a.from,to:i,precise:o&&a.precise}:(a.index++,c=!0)),c?l++:this.matches.splice(l,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:i,precise:r&&o}:this.matches.push({from:n,index:1,precise:r})),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Mc.prototype[Symbol.iterator]=function(){return this});const u8={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ow="gm"+(/x/.unicode==null?"":"u");class f8{constructor(e,n,r,i=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=u8,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new h8(e,n,r,i,o);this.re=new RegExp(n,ow+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let s=e.lineAt(i);this.curLineStart=s.from,this.matchPos=Yg(e,i),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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=Yg(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},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}}}const n0=new WeakMap;class uc{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=n0.get(e);if(!i||i.from>=r||i.to<=n){let l=new uc(n,e.sliceString(n,r));return n0.set(e,l),l}if(i.from==n&&i.to==r)return i;let{text:o,from:s}=i;return s>n&&(o=e.sliceString(n,s)+o,s=n),i.to<r&&(o+=e.sliceString(i.to,r)),n0.set(e,new uc(s,o)),new uc(n,o.slice(n-s,r-s))}}class h8{constructor(e,n,r,i,o){this.text=e,this.to=o,this.done=!1,this.value=u8,this.matchPos=Yg(e,i),this.re=new RegExp(n,ow+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=uc.get(e,i,this.chunkEnd(i+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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this.matchPos=Yg(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=uc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(f8.prototype[Symbol.iterator]=h8.prototype[Symbol.iterator]=function(){return this});function yse(t){try{return new RegExp(t,ow),!0}catch{return!1}}function Yg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}const xse=t=>{let e=Vre(t,"cm-goto-line");if(e){let s=e.dom.querySelector("input[type=text]");return s&&s.select(),!0}let{state:n}=t,r=String(n.doc.lineAt(t.state.selection.main.head).number),{close:i,result:o}=Nre(t,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return o.then(s=>{let l=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!l){t.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,f,h]=l,d=f?+f.slice(1):0,p=u?+u:a.number;if(u&&h){let O=p/100;c&&(O=O*(c=="-"?-1:1)+a.number/n.doc.lines),p=Math.round(n.doc.lines*O)}else u&&c&&(p=p*(c=="-"?-1:1)+a.number);let g=n.doc.line(Math.max(1,Math.min(n.doc.lines,p))),m=H.cursor(g.from+Math.max(0,Math.min(d,g.length)));t.dispatch({effects:[i,se.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},bse={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},vse=ye.define({combine(t){return xo(t,bse,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Sse(t){return[Tse,_se]}const wse=ke.mark({class:"cm-selectionMatch"}),kse=ke.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function FT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Dt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Dt.Word)}function Cse(t,e,n,r){return t(e.sliceDoc(n,n+1))==Dt.Word&&t(e.sliceDoc(r-1,r))==Dt.Word}const _se=Ht.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(vse),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ke.none;let i=r.main,o,s=null;if(i.empty){if(!e.highlightWordAroundCursor)return ke.none;let a=n.wordAt(i.head);if(!a)return ke.none;s=n.charCategorizer(i.head),o=n.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a<e.minSelectionLength||a>200)return ke.none;if(e.wholeWords){if(o=n.sliceDoc(i.from,i.to),s=n.charCategorizer(i.head),!(FT(s,n,i.from,i.to)&&Cse(s,n,i.from,i.to)))return ke.none}else if(o=n.sliceDoc(i.from,i.to),!o)return ke.none}let l=[];for(let a of t.visibleRanges){let c=new Mc(n.doc,o,a.from,a.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||FT(s,n,u,f))&&(i.empty&&u<=i.from&&f>=i.to?l.push(kse.range(u,f)):(u>=i.to||f<=i.from)&&l.push(wse.range(u,f)),l.length>e.maxMatches))return ke.none}}return ke.set(l)}},{decorations:t=>t.decorations}),Tse=se.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Pse=({state:t,dispatch:e})=>{let{selection:n}=t,r=H.create(n.ranges.map(i=>t.wordAt(i.head)||H.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Ese(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let s=!1,l=new Mc(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(s)return null;l=new Mc(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),s=!0}else{if(s&&r.some(a=>a.from==l.value.from))continue;if(o){let a=t.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const $se=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(o=>o.from===o.to))return Pse({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=r))return!1;let i=Ese(t,r);return i?(e(t.update({selection:t.selection.addRange(H.range(i.from,i.to),!1),effects:se.scrollIntoView(i.to)})),!0):!1},du=ye.define({combine(t){return xo(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new jse(e),scrollToMatch:e=>se.scrollIntoView(e)})}});class d8{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||yse(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,(n,r)=>r=="n"?`
116
116
  `:r=="r"?"\r":r=="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 Ise(this):new Mse(this)}getCursor(e,n=0,r){let i=e.doc?e:ze.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Da(this,i,n,r):Ia(this,i,n,r)}}class p8{constructor(e){this.spec=e}}function Ase(t,e,n){return(r,i,o,s)=>{if(n&&!n(r,i,o,s))return!1;let l=r>=s&&i<=s+o.length?o.slice(r-s,i-s):e.doc.sliceString(r,i);return t(l,e,r,i)}}function Ia(t,e,n,r){let i;return t.wholeWord&&(i=Qse(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=Ase(t.test,e,i)),new Mc(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:o=>o.toLowerCase(),i)}function Qse(t,e){return(n,r,i,o)=>((o>n||o+i.length<r)&&(o=Math.max(0,n-2),i=t.sliceString(o,Math.min(t.length,r+2))),(e(Ug(i,n-o))!=Dt.Word||e(Gg(i,n-o))!=Dt.Word)&&(e(Gg(i,r-o))!=Dt.Word||e(Ug(i,r-o))!=Dt.Word))}class Mse extends p8{constructor(e){super(e)}nextMatch(e,n,r){let i=Ia(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let o=Math.min(e.doc.length,n+this.spec.unquoted.length);i=Ia(this.spec,e,0,o).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let o=Math.max(n,i-1e4-this.spec.unquoted.length),s=Ia(this.spec,e,o,i),l=null;for(;!s.nextOverlapping().done;)l=s.value;if(l)return l;if(o==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=Ia(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let o=Ia(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}function Rse(t,e,n){return(r,i,o)=>(!n||n(r,i,o))&&t(o[0],e,r,i)}function Da(t,e,n,r){let i;return t.wholeWord&&(i=Lse(e.charCategorizer(e.selection.main.head))),t.test&&(i=Rse(t.test,e,i)),new f8(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},n,r)}function Ug(t,e){return t.slice(Sn(t,e,!1),e)}function Gg(t,e){return t.slice(e,Sn(t,e))}function Lse(t){return(e,n,r)=>!r[0].length||(t(Ug(r.input,r.index))!=Dt.Word||t(Gg(r.input,r.index))!=Dt.Word)&&(t(Gg(r.input,r.index+r[0].length))!=Dt.Word||t(Ug(r.input,r.index+r[0].length))!=Dt.Word)}class Ise extends p8{nextMatch(e,n,r){let i=Da(this.spec,e,r,e.doc.length).next();return i.done&&(i=Da(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let o=Math.max(n,r-i*1e4),s=Da(this.spec,e,o,r),l=null;for(;!s.next().done;)l=s.value;if(l&&(o==n||l.from>o+10))return l;if(o==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let o=+r.slice(0,i);if(o>0&&o<e.match.length)return e.match[o]+r.slice(i)}return n})}matchAll(e,n){let r=Da(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let o=Da(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}const ih=Le.define(),sw=Le.define(),Qs=cn.define({create(t){return new r0(Jx(t).create(),null)},update(t,e){for(let n of e.effects)n.is(ih)?t=new r0(n.value.create(),t.panel):n.is(sw)&&(t=new r0(t.query,n.value?lw:null));return t},provide:t=>eh.from(t,e=>e.panel)});class r0{constructor(e,n){this.query=e,this.panel=n}}const Dse=ke.mark({class:"cm-searchMatch"}),Nse=ke.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Vse=Ht.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Qs))}update(t){let e=t.state.field(Qs);(e!=t.startState.field(Qs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ke.none;let{view:n}=this,r=new ir;for(let i=0,o=n.visibleRanges,s=o.length;i<s;i++){let{from:l,to:a}=o[i];for(;i<s-1&&a>o[i+1].from-500;)a=o[++i].to;t.highlight(n.state,l,a,(c,u)=>{let f=n.state.selection.ranges.some(h=>h.from==c&&h.to==u);r.add(c,u,f?Nse:Dse)})}return r.finish()}},{decorations:t=>t.decorations});function Hh(t){return e=>{let n=e.state.field(Qs,!1);return n&&n.query.spec.valid?t(e,n):O8(e)}}const Kg=Hh((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=H.single(r.from,r.to),o=t.state.facet(du);return t.dispatch({selection:i,effects:[aw(t,r),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),m8(t),!0}),Jg=Hh((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let o=H.single(i.from,i.to),s=t.state.facet(du);return t.dispatch({selection:o,effects:[aw(t,i),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),m8(t),!0}),Bse=Hh((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:H.create(n.map(r=>H.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Fse=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let l=new Mc(t.doc,t.sliceDoc(r,i));!l.next().done;){if(o.length>1e3)return!1;l.value.from==r&&(s=o.length),o.push(H.range(l.value.from,l.value.to))}return e(t.update({selection:H.create(o,s),userEvent:"select.search.matches"})),!0},ZT=Hh((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=e.nextMatch(n,r,r);if(!o)return!1;let s=o,l=[],a,c,u=[];s.precise?s.from==r&&s.to==i&&(c=n.toText(e.getReplacement(s)),l.push({from:s.from,to:s.to,insert:c}),s=e.nextMatch(n,s.from,s.to),u.push(se.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):s=e.nextMatch(n,s.from,s.to);let f=t.state.changes(l);return s&&(a=H.single(s.from,s.to).map(f),u.push(aw(t,s)),u.push(n.facet(du).scrollToMatch(a.main,t))),t.dispatch({changes:f,selection:a,effects:u,userEvent:"input.replace"}),!0}),Zse=Hh((t,{query:e})=>{if(t.state.readOnly)return!1;let n=[];for(let i of e.matchAll(t.state,1e9)){let{from:o,to:s,precise:l}=i;l&&n.push({from:o,to:s,insert:e.getReplacement(i)})}if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:se.announce.of(r),userEvent:"input.replace.all"}),!0});function lw(t){return t.state.facet(du).createPanel(t)}function Jx(t,e){var n,r,i,o,s;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let c=t.facet(du);return new d8({search:((n=e?.literal)!==null&&n!==void 0?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(o=e?.regexp)!==null&&o!==void 0?o:c.regexp,wholeWord:(s=e?.wholeWord)!==null&&s!==void 0?s:c.wholeWord})}function g8(t){let e=mO(t,lw);return e&&e.dom.querySelector("[main-field]")}function m8(t){let e=g8(t);e&&e==t.root.activeElement&&e.select()}const O8=t=>{let e=t.state.field(Qs,!1);if(e&&e.panel){let n=g8(t);if(n&&n!=t.root.activeElement){let r=Jx(t.state,e.query.spec);r.valid&&t.dispatch({effects:ih.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[sw.of(!0),e?ih.of(Jx(t.state,e.query.spec)):Le.appendConfig.of(Wse)]});return!0},y8=t=>{let e=t.state.field(Qs,!1);if(!e||!e.panel)return!1;let n=mO(t,lw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:sw.of(!1)}),!0},zse=[{key:"Mod-f",run:O8,scope:"editor search-panel"},{key:"F3",run:Kg,shift:Jg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Kg,shift:Jg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:y8,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Fse},{key:"Mod-Alt-g",run:xse},{key:"Mod-d",run:$se,preventDefault:!0}];class jse{constructor(e){this.view=e;let n=this.query=e.state.field(Qs).query.spec;this.commit=this.commit.bind(this),this.searchField=xt("input",{value:n.search,placeholder:Pr(e,"Find"),"aria-label":Pr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=xt("input",{value:n.replace,placeholder:Pr(e,"Replace"),"aria-label":Pr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=xt("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=xt("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=xt("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,o,s){return xt("button",{class:"cm-button",name:i,onclick:o,type:"button"},s)}this.dom=xt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>Kg(e),[Pr(e,"next")]),r("prev",()=>Jg(e),[Pr(e,"previous")]),r("select",()=>Bse(e),[Pr(e,"all")]),xt("label",null,[this.caseField,Pr(e,"match case")]),xt("label",null,[this.reField,Pr(e,"regexp")]),xt("label",null,[this.wordField,Pr(e,"by word")]),...e.state.readOnly?[]:[xt("br"),this.replaceField,r("replace",()=>ZT(e),[Pr(e,"replace")]),r("replaceAll",()=>Zse(e),[Pr(e,"replace all")])],xt("button",{name:"close",onclick:()=>y8(e),"aria-label":Pr(e,"close"),type:"button"},["×"])])}commit(){let e=new d8({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:ih.of(e)}))}keydown(e){qne(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Jg:Kg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ZT(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(ih)&&!r.value.eq(this.query)&&this.setQuery(r.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(du).top}}function Pr(t,e){return t.state.phrase(e)}const zd=30,jd=/[\s\.,:;?!]/;function aw(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,o=Math.max(r.from,e-zd),s=Math.min(i,n+zd),l=t.state.sliceDoc(o,s);if(o!=r.from){for(let a=0;a<zd;a++)if(!jd.test(l[a+1])&&jd.test(l[a])){l=l.slice(a);break}}if(s!=i){for(let a=l.length-1;a>l.length-zd;a--)if(!jd.test(l[a-1])&&jd.test(l[a])){l=l.slice(0,a);break}}return se.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const Xse=se.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"}}),Wse=[Qs,Fi.low(Vse),Xse];class cw{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=wt(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),o=i.search(b8(e,!1));return o<0?null:{from:r+o,to:this.pos,text:i.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function zT(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Hse(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let o=1;o<i.length;o++)n[i[o]]=!0}let r=zT(e)+zT(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function x8(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Hse(e);return i=>{let o=i.matchBefore(r);return o||i.explicit?{from:o?o.from:i.pos,options:e,validFor:n}:null}}function qse(t,e){return n=>{for(let r=wt(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class jT{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function Ql(t){return t.selection.main.from}function b8(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",o=r[r.length-1]!="$";return!i&&!o?t:new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const uw=ds.define();function Yse(t,e,n,r){let{main:i}=t.selection,o=n-i.from,s=r-i.from;return{...t.changeByRange(l=>{if(l!=i&&n!=r&&t.sliceDoc(l.from+o,l.from+s)!=t.sliceDoc(n,r))return{range:l};let a=t.toText(e);return{changes:{from:l.from+o,to:r==i.from?l.to:l.from+s,insert:a},range:H.cursor(l.from+o+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const XT=new WeakMap;function Use(t){if(!Array.isArray(t))return t;let e=XT.get(t);return e||XT.set(t,e=x8(t)),e}const em=Le.define(),oh=Le.define();class Gse{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=gr(e,n),i=Ui(r);this.chars.push(r);let o=e.slice(n,n+i),s=o.toUpperCase();this.folded.push(gr(s==o?o.toLowerCase():s,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:o,byWord:s}=this;if(n.length==1){let y=gr(e,0),x=Ui(y),b=x==e.length?0:-100;if(y!=n[0])if(y==r[0])b+=-200;else return null;return this.ret(b,[0,x])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=n.length,c=0;if(l<0){for(let y=0,x=Math.min(e.length,200);y<x&&c<a;){let b=gr(e,y);(b==n[c]||b==r[c])&&(i[c++]=y),y+=Ui(b)}if(c<a)return null}let u=0,f=0,h=!1,d=0,p=-1,g=-1,m=/[a-z]/.test(e),O=!0;for(let y=0,x=Math.min(e.length,200),b=0;y<x&&f<a;){let S=gr(e,y);l<0&&(u<a&&S==n[u]&&(o[u++]=y),d<a&&(S==n[d]||S==r[d]?(d==0&&(p=y),g=y+1,d++):d=0));let v,w=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(v=$S(S))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!y||w==1&&m||b==0&&w!=0)&&(n[f]==S||r[f]==S&&(h=!0)?s[f++]=y:s.length&&(O=!1)),b=w,y+=Ui(S)}return f==a&&s[0]==0&&O?this.result(-100+(h?-200:0),s,e):d==a&&p==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,g]):f==a?this.result(-100+(h?-200:0)+-700+(O?0:-1100),s,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],o=0;for(let s of n){let l=s+(this.astral?Ui(gr(r,s)):1);o&&i[o-1]==s?i[o-1]=l:(i[o++]=s,i[o++]=l)}return this.ret(e-r.length,i)}}class Kse{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const vn=ye.define({combine(t){return xo(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Jse,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>WT(e(r),n(r)),optionClass:(e,n)=>r=>WT(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function WT(t,e){return t?e?t+" "+e:t:e}function Jse(t,e,n,r,i,o){let s=t.textDirection==_t.RTL,l=s,a=!1,c="top",u,f,h=e.left-i.left,d=i.right-e.right,p=r.right-r.left,g=r.bottom-r.top;if(l&&h<Math.min(p,d)?l=!1:!l&&d<Math.min(p,h)&&(l=!0),p<=(l?h:d))u=Math.max(i.top,Math.min(n.top,i.bottom-g))-e.top,f=Math.min(400,l?h:d);else{a=!0,f=Math.min(400,(s?e.right:i.right-e.left)-30);let y=i.bottom-e.bottom;y>=g||y>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let m=(e.bottom-e.top)/o.offsetHeight,O=(e.right-e.left)/o.offsetWidth;return{style:`${c}: ${u/m}px; max-width: ${f/O}px`,class:"cm-completionInfo-"+(a?s?"left-narrow":"right-narrow":l?"left":"right")}}const fw=Le.define();function ele(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,o){let s=document.createElement("span");s.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let c=0;c<o.length;){let u=o[c++],f=o[c++];u>a&&s.appendChild(document.createTextNode(l.slice(a,u)));let h=s.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(u,f))),h.className="cm-completionMatchedText",a=f}return a<l.length&&s.appendChild(document.createTextNode(l.slice(a))),s},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function i0(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.ceil((t-e)/n);return{from:t-r*n,to:t-(r-1)*n}}class tle{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:o,selected:s}=i.open,l=e.state.facet(vn);this.optionContent=ele(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=i0(o.length,s,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:c}=e.state.field(n).open;for(let u=a.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<c.length){this.applyCompletion(e,c[+f[1]]),a.preventDefault();return}if(a.target==this.list){let u=this.list.classList.contains("cm-completionListIncompleteTop")&&a.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&a.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;u!=null&&(e.dispatch({effects:fw.of(u)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(vn).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:oh.of(null)})}),this.showOptions(o,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:o,selected:s,disabled:l}=r.open;(!i.open||i.open.options!=o)&&(this.range=i0(o.length,s,e.state.facet(vn).maxRenderedOptions),this.showOptions(o,r.id)),this.updateSel(),l!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=i0(n.options.length,n.selected,this.view.state.facet(vn).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:o}=i;if(!o)return;let s=typeof o=="string"?document.createTextNode(o):o(i);if(!s)return;"then"in s?s.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,i)}).catch(l=>yr(this.view.state,l,"completion info")):(this.addInfoPane(s,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:o}=e;r.appendChild(i),this.infoDestroy=o||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&rle(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let s=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:s.clientWidth,bottom:s.clientHeight}}return i.top>Math.min(o.bottom,n.bottom)-10||i.bottom<Math.max(o.top,n.top)+10?null:this.view.state.facet(vn).positionInfo(this.view,n,i,r,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",s=>{s.target==i&&s.preventDefault()});let o=null;for(let s=r.from;s<r.to;s++){let{completion:l,match:a}=e[s],{section:c}=l;if(c){let h=typeof c=="string"?c:c.name;if(h!=o&&(s>r.from||r.from==0))if(o=h,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=h}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+s,u.setAttribute("role","option");let f=this.optionClass(l);f&&(u.className=f);for(let h of this.optionContent){let d=h(l,this.view.state,this.view,a);d&&u.appendChild(d)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function nle(t,e){return n=>new tle(n,t,e)}function rle(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function HT(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function ile(t,e){let n=[],r=null,i=null,o=u=>{n.push(u);let{section:f}=u.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(d=>d.name==h)||r.push(typeof f=="string"?{name:h}:f)}},s=e.facet(vn);for(let u of t)if(u.hasResult()){let f=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)o(new jT(h,u.source,f?f(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),d,p=s.filterStrict?new Kse(h):new Gse(h);for(let g of u.result.options)if(d=p.match(g.label)){let m=g.displayLabel?f?f(g,d.matched):[]:d.matched,O=d.score+(g.boost||0);if(o(new jT(g,u.source,m,O)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:y}=g.section;i||(i=Object.create(null)),i[y]=Math.max(O,i[y]||-1e9)}}}}if(r){let u=Object.create(null),f=0,h=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?i[p.name]-i[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.name<p.name?-1:1);for(let d of r.sort(h))f-=1e5,u[d.name]=f;for(let d of n){let{section:p}=d.completion;p&&(d.score+=u[typeof p=="string"?p:p.name])}}let l=[],a=null,c=s.compareCompletions;for(let u of n.sort((f,h)=>h.score-f.score||c(f.completion,h.completion))){let f=u.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(u):HT(u.completion)>HT(a)&&(l[l.length-1]=u),a=u.completion}return l}class Xa{constructor(e,n,r,i,o,s){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=o,this.disabled=s}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Xa(this.options,qT(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,o,s){if(i&&!s&&e.some(c=>c.isPending))return i.setDisabled();let l=ile(e,n);if(!l.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let a=n.facet(vn).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<l.length;u++)if(l[u].completion==c){a=u;break}}return new Xa(l,qT(r,a),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:ule,above:o.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new Xa(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Xa(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class tm{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new tm(ale,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(vn),o=(r.override||n.languageDataAt("autocomplete",Ql(n)).map(Use)).map(a=>(this.active.find(u=>u.source==a)||new ti(a,this.active.some(u=>u.state!=0)?1:0)).update(e,r));o.length==this.active.length&&o.every((a,c)=>a==this.active[c])&&(o=this.active);let s=this.open,l=e.effects.some(a=>a.is(hw));s&&e.docChanged&&(s=s.map(e.changes)),e.selection||o.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!ole(o,this.active)||l?s=Xa.build(o,n,this.id,s,r,l):s&&s.disabled&&!o.some(a=>a.isPending)&&(s=null),!s&&o.every(a=>!a.isPending)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new ti(a.source,0):a));for(let a of e.effects)a.is(fw)&&(s=s&&s.setSelected(a.value,this.id));return o==this.active&&s==this.open?this:new tm(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?sle:lle}}function ole(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,o=r==e.length;if(i||o)return i==o;if(t[n++].result!=e[r++].result)return!1}}const sle={"aria-autocomplete":"list"},lle={};function qT(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const ale=[];function v8(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(uw);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ti{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=v8(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new ti(i.source,0)),r&4&&i.state==0&&(i=new ti(this.source,1)),i=i.updateFor(e,r);for(let o of e.effects)if(o.is(em))i=new ti(i.source,1,o.value);else if(o.is(oh))i=new ti(i.source,0);else if(o.is(hw))for(let s of o.value)s.source==i.source&&(i=s);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ql(e.state))}}class fc extends ti{constructor(e,n,r,i,o,s){super(e,3,n),this.limit=r,this.result=i,this.from=o,this.to=s}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let o=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),l=Ql(e.state);if(l>s||!i||n&2&&(Ql(e.startState)==this.from||l<this.limit))return new ti(this.source,n&4?1:0);let a=e.changes.mapPos(this.limit);return cle(i.validFor,e.state,o,s)?new fc(this.source,this.explicit,a,i,o,s):i.update&&(i=i.update(i,o,s,new cw(e.state,l,!1)))?new fc(this.source,this.explicit,a,i,i.from,(r=i.to)!==null&&r!==void 0?r:Ql(e.state)):new ti(this.source,1,this.explicit)}map(e){if(e.empty)return this;let n=this.result.map?this.result.map(this.result,e):this.result;return n?new fc(this.source,this.explicit,e.mapPos(this.limit),n,e.mapPos(this.from),e.mapPos(this.to,1)):new ti(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function cle(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):b8(t,!0).test(i)}const hw=Le.define({map(t,e){return t.map(n=>n.map(e))}}),mr=cn.define({create(){return tm.start()},update(t,e){return t.update(e)},provide:t=>[WS.from(t,e=>e.tooltip),se.contentAttributes.from(t,e=>e.attrs)]});function dw(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(mr).active.find(i=>i.source==e.source);return r instanceof fc?(typeof n=="string"?t.dispatch({...Yse(t.state,n,r.from,r.to),annotations:uw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const ule=nle(mr,dw);function Xd(t,e="option"){return n=>{let r=n.state.field(mr,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(vn).interactionDelay)return!1;let i=1,o;e=="page"&&(o=G4(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,l=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:s-1;return l<0?l=e=="page"?0:s-1:l>=s&&(l=e=="page"?s-1:0),n.dispatch({effects:fw.of(l)}),!0}}const fle=t=>{let e=t.state.field(mr,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(vn).interactionDelay?!1:dw(t,e.open.options[e.open.selected])},o0=t=>t.state.field(mr,!1)?(t.dispatch({effects:em.of(!0)}),!0):!1,hle=t=>{let e=t.state.field(mr,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:oh.of(null)}),!0)};class dle{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const ple=50,gle=1e3,mle=Ht.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(mr).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(mr),n=t.state.facet(vn);if(!t.selectionSet&&!t.docChanged&&t.startState.field(mr)==e)return;let r=t.transactions.some(o=>{let s=v8(o,n);return s&8||(o.selection||o.docChanged)&&!(s&3)});for(let o=0;o<this.running.length;o++){let s=this.running[o];if(r||s.context.abortOnDocChange&&t.docChanged||s.updates.length+t.transactions.length>ple&&Date.now()-s.time>gle){for(let l of s.context.abortListeners)try{l()}catch(a){yr(this.view.state,a)}s.context.abortListeners=null,this.running.splice(o--,1)}else s.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(o=>o.effects.some(s=>s.is(em)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(s=>s.active.source==o.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let o of t.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(mr);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(vn).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Ql(e),r=new cw(e,n,t.explicit,this.view),i=new dle(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(o=>{i.context.aborted||(i.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:oh.of(null)}),yr(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(vn).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(vn),r=this.view.state.field(mr);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(o.done===void 0)continue;if(this.running.splice(i--,1),o.done){let l=Ql(o.updates.length?o.updates[0].startState:this.view.state),a=Math.min(l,o.done.from+(o.active.explicit?0:1)),c=new fc(o.active.source,o.active.explicit,a,o.done,o.done.from,(t=o.done.to)!==null&&t!==void 0?t:l);for(let u of o.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let s=r.active.find(l=>l.source==o.active.source);if(s&&s.isPending)if(o.done==null){let l=new ti(o.active.source,0);for(let a of o.updates)l=l.update(a,n);l.isPending||e.push(l)}else this.startQuery(s)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:hw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(mr,!1);if(e&&e.tooltip&&this.view.state.facet(vn).closeOnBlur){let n=e.open&&G4(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:oh.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:em.of(!1)}),20),this.composing=0}}}),Ole=typeof navigator=="object"&&/Win/.test(navigator.platform),yle=Fi.highest(se.domEventHandlers({keydown(t,e){let n=e.state.field(mr,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Ole&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(s=>s.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&dw(e,r),!1}})),S8=se.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xle{constructor(e,n,r,i){this.field=e,this.line=n,this.from=r,this.to=i}}class pw{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Mn.TrackDel),r=e.mapPos(this.to,1,Mn.TrackDel);return n==null||r==null?null:new pw(this.field,n,r)}}class gw{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],i=[n],o=e.doc.lineAt(n),s=/^\s*/.exec(o.text)[0];for(let a of this.lines){if(r.length){let c=s,u=/^\t*/.exec(a)[0].length;for(let f=0;f<u;f++)c+=e.facet(zh);i.push(n+c.length-u),a=c+a.slice(u)}r.push(a),n+=a.length+1}let l=this.fieldPositions.map(a=>new pw(a.field,i[a.line]+a.from,i[a.line]+a.to));return{text:r,ranges:l}}static parse(e){let n=[],r=[],i=[],o;for(let s of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(s);){let l=o[1]?+o[1]:null,a=o[2]||o[3]||"",c=-1;l===0&&(l=1e9);let u=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<n.length;f++)(l!=null?n[f].seq==l:u&&n[f].name==u)&&(c=f);if(c<0){let f=0;for(;f<n.length&&(l==null||n[f].seq!=null&&n[f].seq<l);)f++;n.splice(f,0,{seq:l,name:u}),c=f;for(let h of i)h.field>=c&&h.field++}for(let f of i)if(f.line==r.length&&f.from>o.index){let h=o[2]?3+(o[1]||"").length:2;f.from-=h,f.to-=h}i.push(new xle(c,r.length,o.index,o.index+u.length)),s=s.slice(0,o.index)+a+s.slice(o.index+o[0].length)}s=s.replace(/\\([{}])/g,(l,a,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return a}),r.push(s)}return new gw(r,i)}}let ble=ke.widget({widget:new class extends pi{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),vle=ke.mark({class:"cm-snippetField"});class pu{constructor(e,n){this.ranges=e,this.active=n,this.deco=ke.set(e.map(r=>(r.from==r.to?ble:vle).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;n.push(i)}return new pu(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const qh=Le.define({map(t,e){return t&&t.map(e)}}),Sle=Le.define(),sh=cn.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(qh))return n.value;if(n.is(Sle)&&t)return new pu(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>se.decorations.from(t,e=>e?e.deco:ke.none)});function mw(t,e){return H.create(t.filter(n=>n.field==e).map(n=>H.range(n.from,n.to)))}function wle(t){let e=gw.parse(t);return(n,r,i,o)=>{let{text:s,ranges:l}=e.instantiate(n.state,i),{main:a}=n.state.selection,c={changes:{from:i,to:o==a.from?a.to:o,insert:rt.of(s)},scrollIntoView:!0,annotations:r?[uw.of(r),on.userEvent.of("input.complete")]:void 0};if(l.length&&(c.selection=mw(l,0)),l.some(u=>u.field>0)){let u=new pu(l,0),f=c.effects=[qh.of(u)];n.state.field(sh,!1)===void 0&&f.push(Le.appendConfig.of([sh,Ple,Ele,S8]))}n.dispatch(n.state.update(c))}}function w8(t){return({state:e,dispatch:n})=>{let r=e.field(sh,!1);if(!r||t<0&&r.active==0)return!1;let i=r.active+t,o=t>0&&!r.ranges.some(s=>s.field==i+t);return n(e.update({selection:mw(r.ranges,i),effects:qh.of(o?null:new pu(r.ranges,i)),scrollIntoView:!0})),!0}}const kle=({state:t,dispatch:e})=>t.field(sh,!1)?(e(t.update({effects:qh.of(null)})),!0):!1,Cle=w8(1),_le=w8(-1),Tle=[{key:"Tab",run:Cle,shift:_le},{key:"Escape",run:kle}],YT=ye.define({combine(t){return t.length?t[0]:Tle}}),Ple=Fi.highest(au.compute([YT],t=>t.facet(YT)));function dr(t,e){return{...e,apply:wle(t)}}const Ele=se.domEventHandlers({mousedown(t,e){let n=e.state.field(sh,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=n.ranges.find(o=>o.from<=r&&o.to>=r);return!i||i.field==n.active?!1:(e.dispatch({selection:mw(n.ranges,i.field),effects:qh.of(n.ranges.some(o=>o.field>i.field)?new pu(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),lh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},kl=Le.define({map(t,e){let n=e.mapPos(t,-1,Mn.TrackAfter);return n??void 0}}),Ow=new class extends js{};Ow.startSide=1;Ow.endSide=-1;const k8=cn.define({create(){return qe.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(kl)&&(t=t.update({add:[Ow.range(n.value,n.value+1)]}));return t}});function $le(){return[Qle,k8]}const s0="()[]{}<>«»»«[]{}";function C8(t){for(let e=0;e<s0.length;e+=2)if(s0.charCodeAt(e)==t)return s0.charAt(e+1);return $S(t<128?t:t+1)}function _8(t,e){return t.languageDataAt("closeBrackets",e)[0]||lh}const Ale=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Qle=se.inputHandler.of((t,e,n,r)=>{if((Ale?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Ui(gr(r,0))==1||e!=i.from||n!=i.to)return!1;let o=Lle(t.state,r);return o?(t.dispatch(o),!0):!1}),Mle=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=_8(t,t.selection.main.head).brackets||lh.brackets,i=null,o=t.changeByRange(s=>{if(s.empty){let l=Ile(t.doc,s.head);for(let a of r)if(a==l&&kO(t.doc,s.head)==C8(gr(a,0)))return{changes:{from:s.head-a.length,to:s.head+a.length},range:H.cursor(s.head-a.length)}}return{range:i=s}});return i||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Rle=[{key:"Backspace",run:Mle}];function Lle(t,e){let n=_8(t,t.selection.main.head),r=n.brackets||lh.brackets;for(let i of r){let o=C8(gr(i,0));if(e==i)return o==i?Vle(t,i,r.indexOf(i+i+i)>-1,n):Dle(t,i,o,n.before||lh.before);if(e==o&&T8(t,t.selection.main.from))return Nle(t,i,o)}return null}function T8(t,e){let n=!1;return t.field(k8).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function kO(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ui(gr(n,0)))}function Ile(t,e){let n=t.sliceString(e-2,e);return Ui(gr(n,0))==n.length?n:n.slice(1)}function Dle(t,e,n,r){let i=null,o=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:kl.of(s.to+e.length),range:H.range(s.anchor+e.length,s.head+e.length)};let l=kO(t.doc,s.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:s.head},effects:kl.of(s.head+e.length),range:H.cursor(s.head+e.length)}:{range:i=s}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Nle(t,e,n){let r=null,i=t.changeByRange(o=>o.empty&&kO(t.doc,o.head)==n?{changes:{from:o.head,to:o.head+n.length,insert:n},range:H.cursor(o.head+n.length)}:r={range:o});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Vle(t,e,n,r){let i=r.stringPrefixes||lh.stringPrefixes,o=null,s=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:kl.of(l.to+e.length),range:H.range(l.anchor+e.length,l.head+e.length)};let a=l.head,c=kO(t.doc,a),u;if(c==e){if(UT(t,a))return{changes:{insert:e+e,from:a},effects:kl.of(a+e.length),range:H.cursor(a+e.length)};if(T8(t,a)){let h=n&&t.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+h.length,insert:h},range:H.cursor(a+h.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(u=GT(t,a-2*e.length,i))>-1&&UT(t,u))return{changes:{insert:e+e+e+e,from:a},effects:kl.of(a+e.length),range:H.cursor(a+e.length)};if(t.charCategorizer(a)(c)!=Dt.Word&&GT(t,a,i)>-1&&!Ble(t,a,e,i))return{changes:{insert:e+e,from:a},effects:kl.of(a+e.length),range:H.cursor(a+e.length)}}return{range:o=l}});return o?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function UT(t,e){let n=wt(t).resolveInner(e+1);return n.parent&&n.from==e}function Ble(t,e,n,r){let i=wt(t).resolveInner(e,-1),o=r.reduce((s,l)=>Math.max(s,l.length),0);for(let s=0;s<5;s++){let l=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),a=l.indexOf(n);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+a;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function GT(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Dt.Word)return e;for(let i of n){let o=e-i.length;if(t.sliceDoc(o,e)==i&&r(t.sliceDoc(o-1,o))!=Dt.Word)return o}return-1}function Fle(t={}){return[yle,mr,vn.of(t),mle,Zle,S8]}const P8=[{key:"Ctrl-Space",run:o0},{mac:"Alt-`",run:o0},{mac:"Alt-i",run:o0},{key:"Escape",run:hle},{key:"ArrowDown",run:Xd(!0)},{key:"ArrowUp",run:Xd(!1)},{key:"PageDown",run:Xd(!0,"page")},{key:"PageUp",run:Xd(!1,"page")},{key:"Enter",run:fle}],Zle=Fi.highest(au.computeN([vn],t=>t.facet(vn).defaultKeymap?[P8]:[]));class KT{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class yl{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(ah).markerFilter;i&&(e=i(e,r));let o=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),s=new ir,l=[],a=0,c=r.doc.iter(),u=0,f=r.doc.length;for(let d=0;;){let p=d==o.length?null:o[d];if(!p&&!l.length)break;let g,m;if(l.length)g=a,m=l.reduce((x,b)=>Math.min(x,b.to),p&&p.from>g?p.from:1e8);else{if(g=p.from,g>f)break;m=p.to,l.push(p),d++}for(;d<o.length;){let x=o[d];if(x.from==g&&(x.to>x.from||x.to==g))l.push(x),d++,m=Math.min(x.to,m);else{m=Math.min(x.from,m);break}}m=Math.min(m,f);let O=!1;if(l.some(x=>x.from==g&&(x.to==m||m==f))&&(O=g==m,!O&&m-g<10)){let x=g-(u+c.value.length);x>0&&(c.next(x),u=g);for(let b=g;;){if(b>=m){O=!0;break}if(!c.lineBreak&&u+c.value.length>b)break;b=u+c.value.length,u+=c.value.length,c.next()}}let y=tae(l);if(O)s.add(g,g,ke.widget({widget:new Gle(y),diagnostics:l.slice()}));else{let x=l.reduce((b,S)=>S.markClass?b+" "+S.markClass:b,"");s.add(g,m,ke.mark({class:"cm-lintRange cm-lintRange-"+y+x,diagnostics:l.slice(),inclusiveEnd:l.some(b=>b.to>m)}))}if(a=m,a==f)break;for(let x=0;x<l.length;x++)l[x].to<=a&&l.splice(x--,1)}let h=s.finish();return new yl(h,n,qs(h))}}function qs(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,o,{spec:s})=>{if(!(e&&s.diagnostics.indexOf(e)<0))if(!r)r=new KT(i,o,e||s.diagnostics[0]);else{if(s.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new KT(r.from,o,r.diagnostic)}}),r}function zle(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(ah).hideOn(t,n,r);if(i!=null)return i;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(E8))||t.changes.touchesRange(o.from,Math.max(o.to,r)))}function jle(t,e){return t.field(Vr,!1)?e:e.concat(Le.appendConfig.of(nae))}const E8=Le.define(),yw=Le.define(),$8=Le.define(),Vr=cn.define({create(){return new yl(ke.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);r=qs(n,t.selected.diagnostic,o)||qs(n,null,o)}!n.size&&i&&e.state.facet(ah).autoPanel&&(i=null),t=new yl(n,i,r)}for(let n of e.effects)if(n.is(E8)){let r=e.state.facet(ah).autoPanel?n.value.length?ch.open:null:t.panel;t=yl.init(n.value,r,e.state)}else n.is(yw)?t=new yl(t.diagnostics,n.value?ch.open:null,t.selected):n.is($8)&&(t=new yl(t.diagnostics,t.panel,n.value));return t},provide:t=>[eh.from(t,e=>e.panel),se.decorations.from(t,e=>e.diagnostics)]}),Xle=ke.mark({class:"cm-lintRange cm-lintRange-active"});function Wle(t,e,n){let{diagnostics:r}=t.state.field(Vr),i,o=-1,s=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,c,{spec:u})=>{if(e>=a&&e<=c&&(a==c||(e>a||n>0)&&(e<c||n<0)))return i=u.diagnostics,o=a,s=c,!1});let l=t.state.facet(ah).tooltipFilter;return i&&l&&(i=l(i,t.state)),i?{pos:o,end:s,above:!0,create(){return{dom:Hle(t,i)}}}:null}function Hle(t,e){return xt("ul",{class:"cm-tooltip-lint"},e.map(n=>Q8(t,n,!1)))}const qle=t=>{let e=t.state.field(Vr,!1);(!e||!e.panel)&&t.dispatch({effects:jle(t.state,[yw.of(!0)])});let n=mO(t,ch.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},JT=t=>{let e=t.state.field(Vr,!1);return!e||!e.panel?!1:(t.dispatch({effects:yw.of(!1)}),!0)},Yle=t=>{let e=t.state.field(Vr,!1);if(!e)return!1;let n=t.state.selection.main,r=qs(e.diagnostics,null,n.to+1);return!r&&(r=qs(e.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),Ire(t,r.from,1,{tooltip:M8,until:i=>i.docChanged||i.newSelection.main.head<r.from||i.newSelection.main.head>r.to}),!0)},Ule=[{key:"Mod-Shift-m",run:qle,preventDefault:!0},{key:"F8",run:Yle}],ah=ye.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...xo(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:eP,tooltipFilter:eP,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,o)=>e(r,i,o)||n(r,i,o):e:n,autoPanel:(e,n)=>e||n})}}});function eP(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function A8(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(o=>o.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Q8(t,e,n){var r;let i=n?A8(e.actions):[];return xt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},xt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((o,s)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=qs(t.state.field(Vr).diagnostics,e);p&&o.apply(t,p.from,p.to)},{name:c}=o,u=i[s]?c.indexOf(i[s]):-1,f=u<0?c:[c.slice(0,u),xt("u",c.slice(u,u+1)),c.slice(u+1)],h=o.markClass?" "+o.markClass:"";return xt("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[s]})"`}.`},f)}),e.source&&xt("div",{class:"cm-diagnosticSource"},e.source))}class Gle extends pi{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return xt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class tP{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Q8(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ch{constructor(e){this.view=e,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)JT(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=A8(o.actions);for(let l=0;l<s.length;l++)if(s[l].toUpperCase().charCodeAt(0)==i.keyCode){let a=qs(this.view.state.field(Vr).diagnostics,o);a&&o.actions[l].apply(e,a.from,a.to)}}else return;i.preventDefault()}},r=i=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(i.target)&&this.moveSelection(o)};this.list=xt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=xt("div",{class:"cm-panel-lint"},this.list,xt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>JT(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Vr).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Vr),r=0,i=!1,o=null,s=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:c})=>{for(let u of c.diagnostics){if(s.has(u))continue;s.add(u);let f=-1,h;for(let d=r;d<this.items.length;d++)if(this.items[d].diagnostic==u){f=d;break}f<0?(h=new tP(this.view,u),this.items.splice(r,0,h),i=!0):(h=this.items[f],f>r&&(this.items.splice(r,f-r),i=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),o=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new tP(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let c=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/c:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Vr),r=qs(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:$8.of(r)})}static open(e){return new ch(e)}}function Kle(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function Wd(t){return Kle(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Jle=se.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Wd("#f11")},".cm-lintRange-warning":{backgroundImage:Wd("orange")},".cm-lintRange-info":{backgroundImage:Wd("#999")},".cm-lintRange-hint":{backgroundImage:Wd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function eae(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function tae(t){let e="hint",n=1;for(let r of t){let i=eae(r.severity);i>n&&(n=i,e=r.severity)}return e}const M8=Lre(Wle,{hideOn:zle}),nae=[Vr,se.decorations.compute([Vr],t=>{let{selected:e,panel:n}=t.field(Vr);return!e||!n||e.from==e.to?ke.none:ke.set([Xle.range(e.from,e.to)])}),M8,Jle],R8=[HS(),Gre(),hre(),loe(),$ie(),ere(),sre(),ze.allowMultipleSelections.of(!0),yie(),x7(Rie,{fallback:!0}),Fie(),$le(),Fle(),kre(),Tre(),yre(),Sse(),au.of([...Rle,...cse,...zse,...moe,..._ie,...P8,...Ule])];function rae(t,e,n){const r=wn(zt),i=Zt(_9),o=_.useRef(null),{lexicalNode:s}=lx(),l=_.useRef(!1),a=_.useRef(!1),c=_.useCallback(()=>{i({editorType:"codeblock",rootNode:s,editorRef:o.current})},[s,i]),u=_.useCallback(f=>{var h,d,p,g,m,O;if(f.key==="ArrowDown"){const y=(d=(h=o.current)==null?void 0:h.getCodemirror())==null?void 0:d.state;if(y){const x=y.doc.length,b=y.selection.ranges[0].to;x===b&&(l.current?(r?.update(()=>{var S,v;const w=Ge(t);w.getNextSibling()?((v=(S=o.current)==null?void 0:S.getCodemirror())==null||v.contentDOM.blur(),w.selectNext()):w.insertAfter(He())}),l.current=!1):l.current=!0)}}else if(f.key==="ArrowUp"){const y=(g=(p=o.current)==null?void 0:p.getCodemirror())==null?void 0:g.state;y&&y.selection.ranges[0].from===0&&(a.current?(r?.update(()=>{var b,S;const v=Ge(t);v.getPreviousSibling()&&((S=(b=o.current)==null?void 0:b.getCodemirror())==null||S.contentDOM.blur(),v.selectPrevious())}),a.current=!1):a.current=!0)}else if(f.key==="Enter")f.stopPropagation();else if(f.key==="Backspace"||f.key==="Delete"){const y=(O=(m=o.current)==null?void 0:m.getCodemirror())==null?void 0:O.state;y?.doc.length===0&&r?.update(()=>{Ge(t).remove()})}},[r,t]);return _.useEffect(()=>{const f=o.current;return setTimeout(()=>{var h,d;(h=f?.getCodemirror())==null||h.contentDOM.addEventListener("focus",c),(d=f?.getCodemirror())==null||d.contentDOM.addEventListener("keydown",u)},300),()=>{var h,d;(h=f?.getCodemirror())==null||h.contentDOM.removeEventListener("focus",c),(d=f?.getCodemirror())==null||d.contentDOM.removeEventListener("keydown",u)}},[o,c,u,e]),_.useEffect(()=>{n.subscribe(()=>{var f,h;(h=(f=o.current)==null?void 0:f.getCodemirror())==null||h.focus(),c()})},[n,o,t,c]),o}var iae=Object.defineProperty,oae=(t,e)=>iae(t,"name",{value:e,configurable:!0});function eb(t,[e,n]){return Math.min(n,Math.max(e,t))}oae(eb,"clamp");var sae=Object.defineProperty,lae=(t,e)=>sae(t,"name",{value:e,configurable:!0});function L8(t){const e=C.useRef({value:t,previous:t});return C.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}lae(L8,"usePrevious");var aae=Object.defineProperty,cae=(t,e)=>aae(t,"name",{value:e,configurable:!0}),I8=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),uae=C.forwardRef(cae(function(e,n){return V.jsx(At.span,{...e,ref:n,style:{...I8,...e.style}})},"VisuallyHidden")),fae=uae,hae=Object.defineProperty,St=(t,e)=>hae(t,"name",{value:e,configurable:!0}),dae=[" ","Enter","ArrowUp","ArrowDown"],pae=[" ","Enter"],Rc="Select",[CO,xw,gae]=eS(Rc),[xa,dpe]=mo(Rc,[gae,tu]),bw=tu(),[mae,ol]=xa(Rc),[Oae,yae]=xa(Rc);function D8(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:l,onValueChange:a,dir:c,name:u,autoComplete:f,disabled:h,required:d,form:p,internal_do_not_use_render:g}=t,m=bw(e),[O,y]=C.useState(null),[x,b]=C.useState(null),[S,v]=C.useState(!1),w=Ih(c),[k,P]=is({prop:r,defaultProp:i??!1,onChange:o,caller:Rc}),[T,M]=is({prop:s,defaultProp:l,onChange:a,caller:Rc}),I=C.useRef(null),$=C.useRef(T);C.useEffect(()=>{const _e=p?O?.ownerDocument.getElementById(p):O?.form;if(_e instanceof HTMLFormElement){const L=St(()=>M($.current),"reset");return _e.addEventListener("reset",L),()=>_e.removeEventListener("reset",L)}},[p,O,M]);const D=O?!!p||!!O.closest("form"):!0,[Z,G]=C.useState(new Set),z=Kc(),ee=Array.from(Z).map(_e=>_e.props.value).join(";"),oe=C.useCallback(_e=>{G(L=>new Set(L).add(_e))},[]),Q=C.useCallback(_e=>{G(L=>{const Ie=new Set(L);return Ie.delete(_e),Ie})},[]),ve={required:d,trigger:O,onTriggerChange:y,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:v,contentId:z,value:T,onValueChange:M,open:k,onOpenChange:P,dir:w,triggerPointerDownPosRef:I,disabled:h,name:u,autoComplete:f,form:p,nativeOptions:Z,nativeSelectKey:ee,isFormControl:D};return V.jsx(jv,{...m,children:V.jsx(mae,{scope:e,...ve,children:V.jsx(CO.Provider,{scope:e,children:V.jsx(Oae,{scope:e,onNativeOptionAdd:oe,onNativeOptionRemove:Q,children:V8(g)?g(ve):n})})})})}St(D8,"SelectProvider");var xae=St(t=>{const{__scopeSelect:e,children:n,...r}=t;return V.jsx(D8,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:i})=>V.jsxs(V.Fragment,{children:[n,i?V.jsx(jae,{__scopeSelect:e}):null]})})},"Select"),bae="SelectTrigger",vae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,disabled:i=!1,...o}=e,s=bw(r),l=ol(bae,r),a=l.disabled||i,c=Bt(n,l.onTriggerChange),u=xw(r),f=C.useRef("touch"),[h,d,p]=vw(m=>{const O=u().filter(b=>!b.disabled),y=O.find(b=>b.value===l.value),x=Sw(O,m,y);x!==void 0&&l.onValueChange(x.value)}),g=St(m=>{a||(l.onOpenChange(!0),p()),m&&(l.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})},"handleOpen");return V.jsx(nO,{asChild:!0,...s,children:V.jsx(At.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Yh(l.value)?"":void 0,...o,ref:c,onClick:Je(o.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&g(m)}),onPointerDown:Je(o.onPointerDown,m=>{f.current=m.pointerType;const O=m.target;O.hasPointerCapture(m.pointerId)&&O.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Je(o.onKeyDown,m=>{const O=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&d(m.key),!(O&&m.key===" ")&&dae.includes(m.key)&&(g(),m.preventDefault())})})})},"SelectTrigger")),Sae="SelectValue",wae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,className:i,style:o,children:s,placeholder:l="",...a}=e,c=ol(Sae,r),{onValueNodeHasChildrenChange:u}=c,f=s!==void 0,h=Bt(n,c.onValueNodeChange);In(()=>{u(f)},[u,f]);const d=Yh(c.value);return V.jsx(At.span,{...a,asChild:d?!1:a.asChild,ref:h,style:{pointerEvents:"none"},children:V.jsx(C.Fragment,{children:d?l:s},d?"placeholder":"value")})},"SelectValue")),kae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,children:i,...o}=e;return V.jsx(At.span,{"aria-hidden":!0,...o,ref:n,children:i||"▼"})},"SelectIcon")),Cae="SelectPortal",[_ae,Tae]=xa(Cae,{forceMount:void 0}),Pae=St(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return V.jsx(_ae,{scope:t.__scopeSelect,forceMount:n,children:V.jsx(Wv,{asChild:!0,...r})})},"SelectPortal"),ra="SelectContent",Eae=C.forwardRef(St(function(e,n){const r=Tae(ra,e.__scopeSelect),{forceMount:i=r.forceMount,...o}=e,s=ol(ra,e.__scopeSelect),[l,a]=C.useState();return In(()=>{a(new DocumentFragment)},[]),V.jsx(Mh,{present:i||s.open,children:({present:c})=>c?V.jsx(Qae,{...o,ref:n}):V.jsx($ae,{...o,fragment:l})})},"SelectContent")),$ae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,children:i,fragment:o}=e;return o?Ns.createPortal(V.jsx(N8,{scope:r,children:V.jsx(CO.Slot,{scope:r,children:V.jsx("div",{ref:n,children:i})})}),o):null},"SelectContentFragment")),wi=10,[N8,_O]=xa(ra),Aae=Vs("SelectContent.RemoveScroll"),Qae=C.forwardRef(St(function(e,n){const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:l,side:a,sideOffset:c,align:u,alignOffset:f,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:O,...y}=e,x=ol(ra,r),[b,S]=C.useState(null),[v,w]=C.useState(null),k=Bt(n,S),[P,T]=C.useState(null),[M,I]=C.useState(null),$=xw(r),[D,Z]=C.useState(!1),G=C.useRef(!1);C.useEffect(()=>{if(b)return UQ(b)},[b]),Ym();const z=C.useCallback(J=>{const[ue,...Se]=$().map(Ue=>Ue.ref.current),[Ae]=Se.slice(-1),Ze=document.activeElement;for(const Ue of J)if(Ue===Ze||(Ue?.scrollIntoView({block:"nearest"}),Ue===ue&&v&&(v.scrollTop=0),Ue===Ae&&v&&(v.scrollTop=v.scrollHeight),Ue?.focus(),document.activeElement!==Ze))return},[$,v]),ee=C.useCallback(()=>z([P,b]),[z,P,b]);C.useEffect(()=>{D&&ee()},[D,ee]);const{onOpenChange:oe,triggerPointerDownPosRef:Q}=x;C.useEffect(()=>{if(b){let J={x:0,y:0};const ue=St(Ae=>{J={x:Math.abs(Math.round(Ae.pageX)-(Q.current?.x??0)),y:Math.abs(Math.round(Ae.pageY)-(Q.current?.y??0))}},"handlePointerMove"),Se=St(Ae=>{J.x<=10&&J.y<=10?Ae.preventDefault():Ae.composedPath().includes(b)||oe(!1),document.removeEventListener("pointermove",ue),Q.current=null},"handlePointerUp");return Q.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",Se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",Se,{capture:!0})}}},[b,oe,Q]),C.useEffect(()=>{const J=St(()=>oe(!1),"close");return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[oe]);const[ve,_e]=vw(J=>{const ue=$().filter(Ze=>!Ze.disabled),Se=ue.find(Ze=>Ze.ref.current===document.activeElement),Ae=Sw(ue,J,Se);Ae&&setTimeout(()=>Ae.ref.current?.focus())}),L=C.useCallback((J,ue,Se)=>{const Ae=!G.current&&!Se;(x.value!==void 0&&x.value===ue||Ae)&&(T(J),Ae&&(G.current=!0))},[x.value]),Ie=C.useCallback(()=>b?.focus(),[b]),Be=C.useCallback((J,ue,Se)=>{const Ae=!G.current&&!Se;(x.value!==void 0&&x.value===ue||Ae)&&I(J)},[x.value]),pe=i==="popper"?nP:Mae,he=pe===nP?{side:a,sideOffset:c,align:u,alignOffset:f,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:O}:{};return V.jsx(N8,{scope:r,content:b,viewport:v,onViewportChange:w,itemRefCallback:L,selectedItem:P,onItemLeave:Ie,itemTextRefCallback:Be,focusSelectedItem:ee,selectedItemText:M,position:i,isPositioned:D,searchRef:ve,children:V.jsx(Hv,{as:Aae,allowPinchZoom:!0,children:V.jsx(OQ,{asChild:!0,trapped:x.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Je(o,J=>{x.trigger?.focus({preventScroll:!0}),J.preventDefault()}),children:V.jsx(Rv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:V.jsx(pe,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:J=>J.preventDefault(),...y,...he,onPlaced:()=>Z(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Je(y.onKeyDown,J=>{const ue=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!ue&&J.key.length===1&&_e(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let Ae=$().filter(Ze=>!Ze.disabled).map(Ze=>Ze.ref.current);if(["ArrowUp","End"].includes(J.key)&&(Ae=Ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const Ze=J.target,Ue=Ae.indexOf(Ze);Ae=Ae.slice(Ue+1)}setTimeout(()=>z(Ae)),J.preventDefault()}})})})})})})},"SelectContentImpl")),Mae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,onPlaced:i,...o}=e,s=ol(ra,r),l=_O(ra,r),[a,c]=C.useState(null),[u,f]=C.useState(null),h=Bt(n,f),d=xw(r),p=C.useRef(!1),g=C.useRef(!0),{viewport:m,selectedItem:O,selectedItemText:y,focusSelectedItem:x}=l,b=C.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&O&&y){const k=s.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),T=s.valueNode.getBoundingClientRect(),M=y.getBoundingClientRect();if(s.dir!=="rtl"){const Ze=M.left-P.left,Ue=T.left-Ze,Qt=k.left-Ue,st=k.width+Qt,Gt=Math.max(st,P.width),Kt=window.innerWidth-wi,fr=eb(Ue,[wi,Math.max(wi,Kt-Gt)]);a.style.minWidth=st+"px",a.style.left=fr+"px"}else{const Ze=P.right-M.right,Ue=window.innerWidth-T.right-Ze,Qt=window.innerWidth-k.right-Ue,st=k.width+Qt,Gt=Math.max(st,P.width),Kt=window.innerWidth-wi,fr=eb(Ue,[wi,Math.max(wi,Kt-Gt)]);a.style.minWidth=st+"px",a.style.right=fr+"px"}const I=d(),$=window.innerHeight-wi*2,D=m.scrollHeight,Z=window.getComputedStyle(u),G=parseInt(Z.borderTopWidth,10),z=parseInt(Z.paddingTop,10),ee=parseInt(Z.borderBottomWidth,10),oe=parseInt(Z.paddingBottom,10),Q=G+z+D+oe+ee,ve=Math.min(O.offsetHeight*5,Q),_e=window.getComputedStyle(m),L=parseInt(_e.paddingTop,10),Ie=parseInt(_e.paddingBottom,10),Be=k.top+k.height/2-wi,pe=$-Be,he=O.offsetHeight/2,J=O.offsetTop+he,ue=G+z+J,Se=Q-ue;if(ue<=Be){const Ze=I.length>0&&O===I[I.length-1].ref.current;a.style.bottom="0px";const Ue=u.clientHeight-m.offsetTop-m.offsetHeight,Qt=Math.max(pe,he+(Ze?Ie:0)+Ue+ee),st=ue+Qt;a.style.height=st+"px"}else{const Ze=I.length>0&&O===I[0].ref.current;a.style.top="0px";const Qt=Math.max(Be,G+m.offsetTop+(Ze?L:0)+he)+Se;a.style.height=Qt+"px",m.scrollTop=ue-Be+m.offsetTop}a.style.margin=`${wi}px 0`,a.style.minHeight=ve+"px",a.style.maxHeight=$+"px",i?.(),requestAnimationFrame(()=>p.current=!0)}},[d,s.trigger,s.valueNode,a,u,m,O,y,s.dir,i]);In(()=>b(),[b]);const[S,v]=C.useState();In(()=>{u&&v(window.getComputedStyle(u).zIndex)},[u]);const w=C.useCallback(k=>{k&&g.current===!0&&(b(),x?.(),g.current=!1)},[b,x]);return V.jsx(Rae,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:w,children:V.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:V.jsx(At.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})},"SelectItemAlignedPosition")),nP=C.forwardRef(St(function(e,n){const{__scopeSelect:r,align:i="start",collisionPadding:o=wi,...s}=e,l=bw(r);return V.jsx(Xv,{...l,...s,ref:n,align:i,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[Rae,Lae]=xa(ra,{}),rP="SelectViewport",Iae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,nonce:i,...o}=e,s=_O(rP,r),l=Lae(rP,r),a=Bt(n,s.onViewportChange),c=C.useRef(0);return V.jsxs(V.Fragment,{children:[V.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),V.jsx(CO.Slot,{scope:r,children:V.jsx(At.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Je(o.onScroll,u=>{const f=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:d}=l;if(d?.current&&h){const p=Math.abs(c.current-f.scrollTop);if(p>0){const g=window.innerHeight-wi*2,m=parseFloat(h.style.minHeight),O=parseFloat(h.style.height),y=Math.max(m,O);if(y<g){const x=y+p,b=Math.min(g,x),S=x-b;h.style.height=b+"px",h.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})},"SelectViewport")),Dae="SelectGroup",[ppe,gpe]=xa(Dae),tb="SelectItem",[Nae,Vae]=xa(tb),Bae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,value:i,disabled:o=!1,textValue:s,...l}=e,a=ol(tb,r),c=_O(tb,r),u=a.value===i,[f,h]=C.useState(s??""),[d,p]=C.useState(!1),g=Di(b=>c.itemRefCallback?.(b,i,o)),m=Bt(n,g),O=Kc(),y=C.useRef("touch"),x=St(()=>{o||(a.onValueChange(i),a.onOpenChange(!1))},"handleSelect");return V.jsx(Nae,{scope:r,value:i,disabled:o,textId:O,isSelected:u,onItemTextChange:C.useCallback(b=>{h(S=>S||(b?.textContent??"").trim())},[]),children:V.jsx(CO.ItemSlot,{scope:r,value:i,disabled:o,textValue:f,children:V.jsx(At.div,{role:"option","aria-labelledby":O,"data-highlighted":d?"":void 0,"aria-selected":u&&d,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:m,onFocus:Je(l.onFocus,()=>p(!0)),onBlur:Je(l.onBlur,()=>p(!1)),onClick:Je(l.onClick,()=>{y.current!=="mouse"&&x()}),onPointerUp:Je(l.onPointerUp,()=>{y.current==="mouse"&&x()}),onPointerDown:Je(l.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:Je(l.onPointerMove,b=>{y.current=b.pointerType,o?c.onItemLeave?.():y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Je(l.onPointerLeave,b=>{b.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Je(l.onKeyDown,b=>{o||b.target!==b.currentTarget||c.searchRef?.current!==""&&b.key===" "||(pae.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})})})})},"SelectItem")),Hd="SelectItemText",Fae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,className:i,style:o,...s}=e,l=ol(Hd,r),a=_O(Hd,r),c=Vae(Hd,r),u=yae(Hd,r),[f,h]=C.useState(null),d=Di(x=>a.itemTextRefCallback?.(x,c.value,c.disabled)),p=Bt(n,h,c.onItemTextChange,d),g=f?.textContent,m=C.useMemo(()=>V.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:O,onNativeOptionRemove:y}=u;return In(()=>(O(m),()=>y(m)),[O,y,m]),V.jsxs(V.Fragment,{children:[V.jsx(At.span,{id:c.textId,...s,ref:p}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!Yh(l.value)?Ns.createPortal(s.children,l.valueNode):null]})},"SelectItemText")),Zae=C.forwardRef(St(function(e,n){const{__scopeSelect:r,...i}=e;return V.jsx(At.div,{"aria-hidden":!0,...i,ref:n})},"SelectSeparator")),zae="SelectBubbleInput",jae=C.forwardRef(St(function({__scopeSelect:e,...n},r){const i=ol(zae,e),{value:o,onValueChange:s,required:l,disabled:a,name:c,autoComplete:u,form:f}=i,{nativeOptions:h,nativeSelectKey:d}=i,p=C.useRef(null),g=Bt(r,p),m=o??"",O=L8(m),y=Array.from(h).some(x=>(x.props.value??"")==="");return C.useEffect(()=>{const x=p.current;if(!x)return;const b=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(b,"value").set;if(O!==m&&v){const w=new Event("change",{bubbles:!0});v.call(x,m),x.dispatchEvent(w)}},[O,m]),V.jsxs(At.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:c,autoComplete:u,disabled:a,form:f,onChange:x=>s(x.target.value),...n,style:{...I8,...n.style},ref:g,defaultValue:m,children:[Yh(o)&&!y?V.jsx("option",{value:""}):null,Array.from(h)]},d)},"SelectBubbleInput"));function V8(t){return typeof t=="function"}St(V8,"isFunction");function Yh(t){return t===""||t===void 0}St(Yh,"shouldShowPlaceholder");function vw(t){const e=Di(t),n=C.useRef(""),r=C.useRef(0),i=C.useCallback(s=>{const l=n.current+s;e(l),St((function a(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>a(""),1e3))}),"updateSearch")(l)},[e]),o=C.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}St(vw,"useTypeaheadSearch");function Sw(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=B8(t,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}St(Sw,"findNextItem");function B8(t,e){return t.map((n,r)=>t[(e+r)%t.length])}St(B8,"wrapArray");var Xae=Object.defineProperty,hn=(t,e)=>Xae(t,"name",{value:e,configurable:!0}),[ww,mpe]=mo("Tooltip",[tu]),TO=tu(),Wae="TooltipProvider",Hae=700,nb="tooltip.open",[qae,kw]=ww(Wae),Yae=hn(t=>{const{__scopeTooltip:e,delayDuration:n=Hae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,s=C.useRef(!0),l=C.useRef(!1),a=C.useRef(0);return C.useEffect(()=>{const c=a.current;return()=>window.clearTimeout(c)},[]),V.jsx(qae,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:C.useCallback(()=>{r<=0||(window.clearTimeout(a.current),s.current=!1)},[r]),onClose:C.useCallback(()=>{r<=0||(window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(c=>{l.current=c},[]),disableHoverableContent:i,children:o})},"TooltipProvider"),rb="Tooltip",[Uae,Uh]=ww(rb),Gae=hn(t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:s,delayDuration:l}=t,a=kw(rb,t.__scopeTooltip),c=TO(e),[u,f]=C.useState(null),[h,d]=C.useState(void 0),p=Kc(),g=C.useRef(0),m=s??a.disableHoverableContent,O=l??a.delayDuration,y=C.useRef(!1),[x,b]=is({prop:r,defaultProp:i??!1,onChange:hn(T=>{T?(a.onOpen(),document.dispatchEvent(new CustomEvent(nb))):a.onClose(),o?.(T)},"onChange"),caller:rb}),S=C.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),v=C.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,b(!0)},[b]),w=C.useCallback(()=>{window.clearTimeout(g.current),g.current=0,b(!1)},[b]),k=C.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,b(!0),g.current=0},O)},[O,b]);C.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]);const P=h??p;return V.jsx(jv,{...c,children:V.jsx(Uae,{scope:e,contentId:P,setContentId:d,open:x,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:C.useCallback(()=>{a.isOpenDelayedRef.current?k():v()},[a.isOpenDelayedRef,k,v]),onTriggerLeave:C.useCallback(()=>{m?w():(window.clearTimeout(g.current),g.current=0)},[w,m]),onOpen:v,onClose:w,disableHoverableContent:m,children:n})})},"Tooltip"),iP="TooltipTrigger",Kae=C.forwardRef(hn(function(e,n){const{__scopeTooltip:r,...i}=e,o=Uh(iP,r),s=kw(iP,r),l=TO(r),a=C.useRef(null),c=Bt(n,a,o.onTriggerChange),u=C.useRef(!1),f=C.useRef(!1),h=C.useCallback(()=>u.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),V.jsx(nO,{asChild:!0,...l,children:V.jsx(At.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:c,onPointerMove:Je(e.onPointerMove,d=>{d.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:Je(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:Je(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Je(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Je(e.onBlur,o.onClose),onClick:Je(e.onClick,o.onClose)})})},"TooltipTrigger")),F8="TooltipPortal",[Jae,ece]=ww(F8,{forceMount:void 0}),tce=hn(t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,o=Uh(F8,e);return V.jsx(Jae,{scope:e,forceMount:n,children:V.jsx(Mh,{present:n||o.open,children:V.jsx(Wv,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),uh="TooltipContent",nce=C.forwardRef(hn(function(e,n){const r=ece(uh,e.__scopeTooltip),{forceMount:i=r.forceMount,side:o="top",...s}=e,l=Uh(uh,e.__scopeTooltip);return V.jsx(Mh,{present:i||l.open,children:l.disableHoverableContent?V.jsx(Z8,{side:o,...s,ref:n}):V.jsx(rce,{side:o,...s,ref:n})})},"TooltipContent")),rce=C.forwardRef(hn(function(e,n){const r=Uh(uh,e.__scopeTooltip),i=kw(uh,e.__scopeTooltip),o=C.useRef(null),s=Bt(n,o),[l,a]=C.useState(null),{trigger:c,onClose:u}=r,f=o.current,{onPointerInTransitChange:h}=i,d=C.useCallback(()=>{a(null),h(!1)},[h]),p=C.useCallback((g,m)=>{const O=g.currentTarget,y={x:g.clientX,y:g.clientY},x=z8(y,O.getBoundingClientRect()),b=j8(y,x),S=X8(m.getBoundingClientRect()),v=H8([...b,...S]);a(v),h(!0)},[h]);return C.useEffect(()=>()=>d(),[d]),C.useEffect(()=>{if(c&&f){const g=hn(O=>p(O,f),"handleTriggerLeave"),m=hn(O=>p(O,c),"handleContentLeave");return c.addEventListener("pointerleave",g),f.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),f.removeEventListener("pointerleave",m)}}},[c,f,p,d]),C.useEffect(()=>{if(l){const g=hn(m=>{const O=m.target,y={x:m.clientX,y:m.clientY},x=c?.contains(O)||f?.contains(O),b=!W8(y,l);x?d():b&&(d(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,f,l,u,d]),V.jsx(Z8,{...e,ref:s})},"TooltipContentHoverable")),ice=aQ("TooltipContent"),Z8=C.forwardRef(hn(function(e,n){const{__scopeTooltip:r,children:i,"aria-label":o,id:s,onEscapeKeyDown:l,onPointerDownOutside:a,...c}=e,u=Uh(uh,r),f=TO(r),{onClose:h}=u;C.useEffect(()=>(document.addEventListener(nb,h),()=>document.removeEventListener(nb,h)),[h]),C.useEffect(()=>{if(u.trigger){const p=hn(g=>{g.target instanceof Node&&g.target.contains(u.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[u.trigger,h]);const{setContentId:d}=u;return In(()=>(d(s),()=>{d(void 0)}),[s,d]),V.jsx(Rv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:h,children:V.jsxs(Xv,{"data-state":u.stateAttribute,role:o?void 0:"tooltip",id:o?void 0:u.contentId,...f,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[V.jsx(ice,{children:i}),o?V.jsx(fae,{id:u.contentId,role:"tooltip",children:o}):null]})})},"TooltipContentImpl")),oce=C.forwardRef(hn(function(e,n){const{__scopeTooltip:r,...i}=e,o=TO(r);return V.jsx(FQ,{...o,...i,ref:n})},"TooltipArrow"));function z8(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}hn(z8,"getExitSideFromRect");function j8(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}hn(j8,"getPaddedExitPoints");function X8(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}hn(X8,"getPointsFromRect");function W8(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;o<e.length;s=o++){const l=e[o],a=e[s],c=l.x,u=l.y,f=a.x,h=a.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(i=!i)}return i}hn(W8,"isPointInPolygon");function H8(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),q8(e)}hn(H8,"getHull");function q8(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}hn(q8,"getHullPresorted");var Y8=Yae,U8=Gae,G8=Kae,K8=tce,J8=nce,sce=oce;const PO=_.forwardRef(({title:t,children:e},n)=>{const r=wn(qc);return _.createElement(Y8,{delayDuration:100},_.createElement(U8,null,_.createElement(G8,{ref:n,asChild:!0},_.createElement("span",{className:xe.tooltipTrigger},e)),_.createElement(K8,{container:r?.current},_.createElement(J8,{className:sn(xe.tooltipContent),sideOffset:10},t))))}),lce=_.forwardRef(({children:t,className:e,...n},r)=>_.createElement(Bae,{...n,ref:r,className:sn(e,xe.selectItem)},_.createElement(Fae,null,t))),ace=({title:t,placeholder:e,className:n})=>{const[r,i]=Vn(ui,Bn);return _.createElement(PO,{title:t},_.createElement(vae,{"aria-label":e,className:sn(xe.selectTrigger,n),"data-toolbar-item":!0,disabled:r},_.createElement(wae,{placeholder:e}),_.createElement(kae,{className:xe.selectDropdownArrow},i("arrow_drop_down"))))},cce=({children:t,className:e=xe.selectContainer})=>{const n=wn(qc);return _.createElement(Pae,{container:n?.current},_.createElement(Eae,{className:sn(e,"mdxeditor-select-content"),onCloseAutoFocus:r=>{r.preventDefault()},position:"popper"},_.createElement(Iae,{"data-editor-dropdown":!0,style:{maxHeight:"var(--radix-select-content-available-height)"}},t)))},eL=t=>_.createElement(xae,{value:t.value||"",onValueChange:t.onChange,disabled:t.disabled},_.createElement(ace,{title:t.triggerTitle,placeholder:t.placeholder}),_.createElement(cce,null,t.items.map((e,n)=>e==="separator"?_.createElement(Zae,{key:n}):_.createElement(lce,{key:n,value:e.value},e.label)))),uce=({language:t,nodeKey:e,code:n,focusEmitter:r})=>{const i=_n(),{parentEditor:o,lexicalNode:s}=lx(),[l,a,c,u,f]=Vn(ui,sb,lb,Bn,ob),h=rae(e,t,r),{setCode:d}=lx(),p=_.useRef(null),g=_.useRef(null),{value:m,items:O}=_.useMemo(()=>fce(f,t),[f,t]),y=_.useRef(d);return y.current=d,h.current={getCodemirror:()=>p.current},_.useEffect(()=>{const x=g.current;return(async()=>{const b=[...a,R8,c8,HS(),au.of([use]),se.lineWrapping,se.updateListener.of(({state:S})=>{y.current(S.doc.toString())}),se.domEventHandlers({focus:()=>{o.update(()=>{Vt(null)})}})];if(l&&b.push(ze.readOnly.of(!0)),t!==""){const S=f.keyMap[t]??t,v=f.supportMap[S];if(v)b.push(v.extension);else if(c){const w=Gie.find(k=>k.name===t||k.alias.includes(t)||k.extensions.includes(t));if(w)try{const k=await w.load();b.push(k.extension)}catch{console.warn("failed to load language support for",t)}}}x.innerHTML="",p.current=new se({parent:x,state:ze.create({doc:n,extensions:b})}),x.addEventListener("keydown",oP)})(),()=>{var b;(b=p.current)==null||b.destroy(),p.current=null,x.removeEventListener("keydown",oP)}},[l,t,...a]),_.createElement("div",{className:xe.codeMirrorWrapper},_.createElement("div",{className:xe.codeMirrorToolbar},_.createElement(eL,{disabled:l,value:m,onChange:x=>{o.update(()=>{s.setLanguage(x===Vp?"":x),setTimeout(()=>{o.update(()=>{s.getLatest().select()})})})},triggerTitle:i("codeBlock.selectLanguage","Select code block language"),placeholder:i("codeBlock.inlineLanguage","Language"),items:O}),_.createElement("button",{className:xe.iconButton,type:"button",disabled:l,title:i("codeblock.delete","Delete code block"),onClick:x=>{x.preventDefault(),o.update(()=>{s.remove()})}},u("delete_small"))),_.createElement("div",{ref:g}))};function oP(t){t.stopPropagation()}const Vp="__EMPTY_VALUE__";function ib(t){var e;const n=[],r={},i={};if(Array.isArray(t))for(const o of t){const s=((e=o.alias)==null?void 0:e[0])??o.name.toLowerCase(),l=s||Vp;if(n.push({value:l,label:o.name}),r[s]=l,o.alias)for(const a of o.alias)r[a]=l;if(o.extensions)for(const a of o.extensions)r[a]=l;r[o.name.toLowerCase()]=l,o.support&&(i[l]=o.support)}else{const o={};for(const[s,l]of Object.entries(t))l in o||(o[l]=s,n.push({value:s||Vp,label:l})),r[s]=o[l]||Vp}return{items:n,keyMap:r,supportMap:i}}function fce(t,e){const n=t.keyMap[e]??e;return!n||t.items.some(r=>r.value===n)?{value:n,items:t.items}:{value:n,items:[...t.items,{value:n,label:e}]}}const ob=we(ib({js:"JavaScript",ts:"TypeScript",tsx:"TypeScript (React)",jsx:"JavaScript (React)",css:"CSS"})),hce=Nn(t=>{t.link(t.pipe(hce,Rl(({language:e,code:n})=>({code:n,language:e,meta:""}))),_S)}),sb=we([]),lb=we(!0),dce=Zr({update(t,e){t.pubIn({[ob]:ib(e?.codeBlockLanguages??{}),[sb]:e?.codeMirrorExtensions??[],[lb]:e?.autoLoadLanguageSupport??!0})},init(t,e){const n=ib(e?.codeBlockLanguages??{});t.pubIn({[ob]:n,[sb]:e?.codeMirrorExtensions??[],[_ee]:pce(n),[lb]:e?.autoLoadLanguageSupport??!0})}});function pce(t){return{match(e,n){return!n||Object.hasOwn(t.keyMap,e??"")},priority:1,Editor:uce}}function gce({url:t,title:e,text:n,onSubmit:r,onCancel:i,linkAutocompleteSuggestions:o,showLinkTitleField:s,showAnchorTextField:l}){const{register:a,handleSubmit:c,control:u,setValue:f,reset:h}=CJ({values:{url:t,title:e,text:n}}),d=_n();return _.createElement("form",{onSubmit:p=>{c(r)(p),p.stopPropagation(),p.preventDefault()},onReset:p=>{p.stopPropagation(),i()},onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),i())},className:sn(xe.multiFieldForm,xe.linkDialogEditForm)},_.createElement("div",{className:xe.formField},_.createElement("label",{htmlFor:"link-url"},d("createLink.url","URL")),_.createElement(dee,{register:a,initialInputValue:t,inputName:"url",suggestions:o,setValue:f,control:u,placeholder:d("createLink.urlPlaceholder","Select or paste an URL"),autofocus:!0})),l?_.createElement("div",{className:xe.formField},_.createElement("label",{htmlFor:"link-text",title:d("createLink.textTooltip","The text to be displayed for the link")},d("createLink.text","Anchor text")),_.createElement("input",{id:"link-text",className:xe.textInput,size:40,...a("text")})):null,s?_.createElement("div",{className:xe.formField},_.createElement("label",{htmlFor:"link-title",title:d("createLink.titleTooltip","The link's title attribute, shown on hover")},d("createLink.title","Link title")),_.createElement("input",{id:"link-title",className:xe.textInput,size:40,...a("title")})):null,_.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"var(--spacing-2)"}},_.createElement("button",{type:"submit",title:d("createLink.saveTooltip","Set URL"),"aria-label":d("createLink.saveTooltip","Set URL"),className:sn(xe.primaryButton)},d("dialogControls.save","Save")),_.createElement("button",{type:"reset",title:d("createLink.cancelTooltip","Cancel change"),"aria-label":d("createLink.cancelTooltip","Cancel change"),className:sn(xe.secondaryButton)},d("dialogControls.cancel","Cancel"))))}const mce=()=>{const[t,e,n,r,i,o,s,l]=Vn(qc,w9,zt,Bn,Zn,lL,aL,uL),a=Zt(nL),c=Zt(rL),u=Zt(iL),f=Zt(oL),h=Zt(sL);_.useEffect(()=>{const y=e?.closest(".mdxeditor-root-contenteditable"),x=()=>{n?.getEditorState().read(()=>{a(!0)})};return window.addEventListener("resize",x),window.addEventListener("scroll",x),y?.addEventListener("scroll",x),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",x),y?.removeEventListener("scroll",x)}},[n,e,a]);const[d,p]=_.useState(!1),g=_n();if(i.type==="inactive")return null;const m=i.rectangle,O=i.type==="preview"&&i.url.startsWith("http");return _.createElement(Gv,{open:!0},_.createElement(PG,{"data-visible":i.type==="edit",className:xe.linkDialogAnchor,style:{top:`${m.top}px`,left:`${m.left}px`,width:`${m.width}px`,height:`${m.height}px`}}),_.createElement(Kv,{container:t?.current},_.createElement(EG,{className:sn(xe.linkDialogPopoverContent),sideOffset:5,updatePositionStrategy:"always",onOpenAutoFocus:y=>{y.preventDefault()},key:i.linkNodeKey},i.type==="edit"&&_.createElement(gce,{url:i.url,title:i.title,text:i.text,onSubmit:c,onCancel:u.bind(null),linkAutocompleteSuggestions:o,showLinkTitleField:l,showAnchorTextField:i.withAnchorText}),i.type==="preview"&&_.createElement(_.Fragment,null,_.createElement("a",{className:xe.linkDialogPreviewAnchor,"data-testid":"link-dialog-preview",href:i.href??"about:blank",...O?{target:"_blank",rel:"noreferrer"}:{},onClick:y=>{s!==null&&(y.preventDefault(),s(i.url))},title:O?g("linkPreview.open","Open {{url}} in new window",{url:i.url}):i.url},_.createElement("span",null,i.url),O&&r("open_in_new")),_.createElement(l0,{onClick:()=>{f()},title:g("linkPreview.edit","Edit link URL"),"aria-label":g("linkPreview.edit","Edit link URL")},r("edit")),_.createElement(Y8,null,_.createElement(U8,{open:d},_.createElement(G8,{asChild:!0},_.createElement(l0,{title:g("linkPreview.copyToClipboard","Copy to clipboard"),"aria-label":g("linkPreview.copyToClipboard","Copy to clipboard"),onClick:()=>{window.navigator.clipboard.writeText(i.url).then(()=>{p(!0),setTimeout(()=>{p(!1)},1e3)})}},r(d?"check":"content_copy"))),_.createElement(K8,{container:t?.current},_.createElement(J8,{className:sn(xe.tooltipContent),sideOffset:5},g("linkPreview.copied","Copied!"),_.createElement(sce,null))))),_.createElement(l0,{title:g("linkPreview.remove","Remove link"),"aria-label":g("linkPreview.remove","Remove link"),onClick:()=>{h()}},r("link_off"))),_.createElement(Jv,{className:xe.popoverArrow}))))},l0=_.forwardRef(({className:t,...e},n)=>_.createElement("button",{className:sn(xe.actionButton,t),ref:n,...e}));function nm(t){if(!t)return null;const e=cH(t);if(e===null)return null;const n=e.getParent();return en(n)?n:en(e)?e:null}function tL(t=ne()){if(!it(t))return null;const e=t.getNodes(),n=e.length===1?e[0]:null;return Fe(n)&&n.isInline()?n:null}function a0(t,e,n){return t?t.getEditorState().read(()=>{const r=e===""?null:Ge(e),i=ne(),o=X(i)?nm(i):null,s=en(r)?r:o;return s?.sanitizeUrl(n)??"about:blank"}):"about:blank"}const nL=Nn(),Zn=we({type:"inactive"},t=>{t.pub(vg,e=>e.registerCommand(bm,()=>t.getValue(Zn).type==="preview"?(t.pub(Zn,{type:"inactive"}),!0):!1,fn)),t.sub(t.pipe(ts),e=>{e!=="rich-text"&&t.pub(Zn,{type:"inactive"})}),t.pub(vg,e=>e.registerCommand(xm,n=>{if(n.key==="k"&&(wg?n.metaKey:n.ctrlKey)&&!t.getValue(ui)){const r=ne();return X(r)||tL(r)!==null?(t.pub(Cw),n.stopPropagation(),n.preventDefault(),!0):!1}return!1},DD)),t.sub(t.pipe(oL,rn(Zn,zt)),([,e,n])=>{if(e.type==="preview")setTimeout(()=>{n?.getEditorState().read(()=>{const r=Ge(e.linkNodeKey),i=en(r)?r.getTextContent().length>0&&r.getChildrenSize()<=1:!1,o=i&&r?r.getTextContent():"";t.pub(Zn,{type:"edit",initialUrl:e.url,url:e.url,title:e.title,text:o,withAnchorText:i,linkNodeKey:e.linkNodeKey,decoratorNodeKey:e.decoratorNodeKey,rectangle:e.rectangle})})});else throw new Error("Cannot switch to edit mode when not in preview mode")}),t.sub(t.pipe(rL,rn(zt,Zn,wc)),([e,n,r,i])=>{var o,s,l;const a=((o=e.text)==null?void 0:o.trim())??"",c=((s=e.url)==null?void 0:s.trim())??"",u=((l=e.title)==null?void 0:l.trim())??"";if(c!==""){if(r.decoratorNodeKey!==void 0){let f="",h=!1;if(n?.update(()=>{const d=Ge(r.decoratorNodeKey);if(d===null)return;const p=Vl();if(p.add(d.getKey()),Vt(p),h=n.dispatchCommand(Cs,c),!h)return;const g=d.getParent();en(g)&&(g.setTitle(u),f=g.getKey())},{discrete:!0}),f==="")return;t.pub(Zn,{type:"preview",linkNodeKey:f,decoratorNodeKey:r.decoratorNodeKey,rectangle:r.rectangle,title:u,url:c,href:a0(n,f,c)});return}if(i?.isCollapsed()){const f=a||u||c;n?.update(()=>{const h=nm(i);if(h)if(er(h)){const d=os(c,{title:u});d.append(bt(a)),h.replace(d),d.select()}else h.setURL(c),h.setTitle(u),sP(h.getFirstChild(),a);else{const d=os(c,{title:u});d.append(bt(f)),_m([d]),d.select()}},{discrete:!0})}else n?.update(()=>{sP(i?.anchor.getNode(),a)}),n?.dispatchCommand(Cs,{url:c,title:u});t.pub(Zn,{type:"preview",linkNodeKey:r.linkNodeKey,rectangle:r.rectangle,title:u,url:c,href:a0(n,r.linkNodeKey??"",c)})}else r.type==="edit"&&r.initialUrl!==""&&(r.decoratorNodeKey!==void 0?n?.update(()=>{const f=Ge(r.decoratorNodeKey);if(f===null)return;const h=Vl();h.add(f.getKey()),Vt(h),n.dispatchCommand(Cs,null)}):n?.dispatchCommand(Cs,null)),t.pub(Zn,{type:"inactive"})}),t.link(t.pipe(iL,rn(Zn,zt),Rl(([,e,n])=>{if(e.type==="edit")return n?.focus(),e.initialUrl===""?{type:"inactive"}:{type:"preview",url:e.initialUrl,href:a0(n,e.linkNodeKey,e.initialUrl),linkNodeKey:e.linkNodeKey,decoratorNodeKey:e.decoratorNodeKey,rectangle:e.rectangle};throw new Error("Cannot cancel edit when not in edit mode")})),Zn),t.link(t.pipe(t.combine(wc,nL),rn(zt,Zn,ui),Rl(([[e],n,r,i])=>{if(r.decoratorNodeKey!==void 0&&n&&!i){if(n.getEditorState().read(()=>{const l=ne();if(!it(l))return null;const a=l.getNodes();return a.length===1?a[0].getKey():null})!==r.decoratorNodeKey)return{type:"inactive"};const s=B9(n,r.decoratorNodeKey);return s===null?{type:"inactive"}:{...r,rectangle:s}}if(X(e)&&n&&!i){const o=nm(e);if(!e.isCollapsed())return{type:"inactive"};if(o){const s=F9(n);return s?{type:"preview",url:o.getURL(),href:o.sanitizeUrl(o.getURL()),linkNodeKey:o.getKey(),title:o.getTitle(),rectangle:s}:{type:"inactive"}}else return{type:"inactive"}}else return{type:"inactive"}})),Zn)}),rL=Nn(),iL=Bc();Bc();const oL=Bc(),sL=Bc(t=>{t.sub(t.pipe(sL,rn(zt)),([,e])=>{e?.dispatchCommand(Cs,null)})}),Cw=Bc(t=>{t.sub(t.pipe(Cw,rn(wc,zt)),([,e,n])=>{if(!n)return;const r=n.getEditorState().read(()=>{const i=tL();if(i===null)return null;const o=i.getParent(),s=en(o)?o:null;return{nodeKey:i.getKey(),url:s?.getURL()??"",title:s?.getTitle()??"",linkNodeKey:s?.getKey()??""}});if(r!==null){const i=B9(n,r.nodeKey);if(i===null)return;t.pub(Zn,{type:"edit",initialUrl:r.url,url:r.url,title:r.title,text:"",withAnchorText:!1,linkNodeKey:r.linkNodeKey,decoratorNodeKey:r.nodeKey,rectangle:i});return}X(e)&&n.focus(()=>{setTimeout(()=>{n.getEditorState().read(()=>{const i=nm(e),o=F9(n);if(o===null)return;const s=i?.getURL()??"",l=i?.getURL()??"",a=i?.getTitle()??"",c=i?.getKey()??"",u=i?i.getTextContent().length>0&&i.getChildrenSize()<=1:e.isCollapsed(),f=u&&i?i.getTextContent():"";t.pub(Zn,{type:"edit",initialUrl:s,url:l,title:a,text:f,withAnchorText:u,linkNodeKey:c,rectangle:o})})})})})}),lL=we([]),aL=we(null),cL=we(null,t=>{t.pub(vg,e=>{function n(r){const[i,o]=t.getValues([ui,cL]);!i||o===null||e.update(()=>{const s=Li(r.target);if(s!==null){const l=lt(s,a=>a instanceof yo);l!==null&&o(r,l,l.getURL())}})}return e.registerRootListener((r,i)=>{r&&r.addEventListener("click",n),i&&i.removeEventListener("click",n)})})});function sP(t,e){Y(t)&&e&&(t.setTextContent(e),t.selectStart())}const uL=we(!0),Oce=Zr({init(t,e){t.pub(Ah,e?.LinkDialog??mce),t.pub(aL,e?.onClickLinkCallback??null),t.pub(cL,e?.onReadOnlyClickLinkCallback??null),t.pub(uL,e?.showLinkTitleField??!0)},update(t,e={}){t.pub(lL,e.linkAutocompleteSuggestions??[])}});function _w(t,e){return _.forwardRef((n,r)=>{const i=sn(e.className,n.className);return _.createElement(t,{...e,...n,className:i,ref:r})})}function yce(t){return({title:e,children:n,...r})=>_.createElement(t,{"aria-label":e,...r},_.createElement(PO,{title:e},n))}const xce=({readOnly:t,children:e,className:n})=>_.createElement(iS,{className:sn("mdxeditor-toolbar",xe.toolbarRoot,{[xe.readOnlyToolbarRoot]:t},n),...t?{tabIndex:-1}:{}},e),bce=_w($l,{className:xe.toolbarButton,"data-toolbar-item":!0}),EO=yce(bce),fL=_w(Tp,{className:xe.toolbarToggleItem,"data-toolbar-item":!0});_w(sO,{type:"single",className:xe.toolbarToggleSingleGroup});const hL=_.forwardRef(({on:t,title:e,children:n,disabled:r,...i},o)=>_.createElement(sO,{type:"single",className:xe.toolbarToggleSingleGroup,...i,value:t?"on":"off",ref:o},_.createElement(fL,{"aria-label":e,value:"on",disabled:r},_.createElement(PO,{title:e},n)))),dL=({items:t})=>_.createElement("div",{className:xe.toolbarGroupOfGroups},t.map((e,n)=>_.createElement(hL,{key:n,title:e.title,on:e.active,onValueChange:r=>{e.onChange(r==="on")},disabled:e.disabled},e.contents))),pL=({value:t,onChange:e,className:n,ggClassName:r,items:i,disabled:o})=>{const s=_n();return _.createElement("div",{className:sn(xe.toolbarGroupOfGroups,r)},_.createElement(sO,{"aria-label":s("toolbar.toggleGroup","toggle group"),type:"single",className:sn(xe.toolbarToggleSingleGroup,n),onValueChange:e,value:t||"",disabled:o,onFocus:l=>{l.preventDefault()}},i.map((l,a)=>_.createElement(fL,{key:a,"aria-label":l.title,value:l.value},_.createElement(PO,{title:l.title},l.contents)))))},c0=we(()=>null),u0=we(""),lP=()=>"This is an empty toolbar. Pass `{toolbarContents: () => { return <>toolbar components</> }}` to the toolbarPlugin to customize it.",vce=Zr({init(t,e){const n=e?.toolbarPosition==="bottom"?GX:UX;t.pubIn({[c0]:e?.toolbarContents??lP,[u0]:e?.toolbarClassName??"",[n]:()=>{const[r,i,o]=Vn(c0,ui,u0);return _.createElement(xce,{className:o,readOnly:i},r())}})},update(t,e){t.pub(c0,e?.toolbarContents??lP),t.pub(u0,e?.toolbarClassName??"")}});class nn{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}offset(e,n=e){return new nn(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function ia(t,e,n,r,i,o){if(t==r)return[];let s=Pw(t,e,n,r,i,o),l=Ew(t,e+s,n,r,i+s,o);e+=s,n-=l,i+=s,o-=l;let a=n-e,c=o-i;if(!a||!c)return[new nn(e,n,i,o)];if(a>c){let f=t.slice(e,n).indexOf(r.slice(i,o));if(f>-1)return[new nn(e,e+f,i,i),new nn(e+f+c,n,o,o)]}else if(c>a){let f=r.slice(i,o).indexOf(t.slice(e,n));if(f>-1)return[new nn(e,e,i,i+f),new nn(n,n,i+f+a,o)]}if(a==1||c==1)return[new nn(e,n,i,o)];let u=OL(t,e,n,r,i,o);if(u){let[f,h,d]=u;return ia(t,e,f,r,i,h).concat(ia(t,f+d,n,r,h+d,o))}return Sce(t,e,n,r,i,o)}let Fu=1e9,Zu=0,Tw=!1;function Sce(t,e,n,r,i,o){let s=n-e,l=o-i;if(Fu<1e9&&Math.min(s,l)>Fu*16||Zu>0&&Date.now()>Zu)return Math.min(s,l)>Fu*64?[new nn(e,n,i,o)]:aP(t,e,n,r,i,o);let a=Math.ceil((s+l)/2);f0.reset(a),h0.reset(a);let c=(d,p)=>t.charCodeAt(e+d)==r.charCodeAt(i+p),u=(d,p)=>t.charCodeAt(n-d-1)==r.charCodeAt(o-p-1),f=(s-l)%2!=0?h0:null,h=f?null:f0;for(let d=0;d<a;d++){if(d>Fu||Zu>0&&!(d&63)&&Date.now()>Zu)return aP(t,e,n,r,i,o);let p=f0.advance(d,s,l,a,f,!1,c)||h0.advance(d,s,l,a,h,!0,u);if(p)return wce(t,e,n,e+p[0],r,i,o,i+p[1])}return[new nn(e,n,i,o)]}class gL{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,r,i,o,s,l){for(let a=-e+this.start;a<=e-this.end;a+=2){let c=i+a,u=a==-e||a!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-a;for(;u<n&&f<r&&l(u,f);)u++,f++;if(this.vec[c]=u,u>n)this.end+=2;else if(f>r)this.start+=2;else if(o){let h=i+(n-r)-a;if(h>=0&&h<this.len&&o.vec[h]!=-1)if(s){let d=o.vec[h];if(d>=n-u)return[d,i+d-h]}else{let d=n-o.vec[h];if(u>=d)return[u,f]}}}return null}}const f0=new gL,h0=new gL;function wce(t,e,n,r,i,o,s,l){let a=!1;return!Lc(t,r)&&++r==n&&(a=!0),!Lc(i,l)&&++l==s&&(a=!0),a?[new nn(e,n,o,s)]:ia(t,e,r,i,o,l).concat(ia(t,r,n,i,l,s))}function mL(t,e){let n=1,r=Math.min(t,e);for(;n<r;)n=n<<1;return n}function Pw(t,e,n,r,i,o){if(e==n||e==o||t.charCodeAt(e)!=r.charCodeAt(i))return 0;let s=mL(n-e,o-i);for(let l=e,a=i;;){let c=l+s,u=a+s;if(c>n||u>o||t.slice(l,c)!=r.slice(a,u)){if(s==1)return l-e-(Lc(t,l)?0:1);s=s>>1}else{if(c==n||u==o)return c-e;l=c,a=u}}}function Ew(t,e,n,r,i,o){if(e==n||i==o||t.charCodeAt(n-1)!=r.charCodeAt(o-1))return 0;let s=mL(n-e,o-i);for(let l=n,a=o;;){let c=l-s,u=a-s;if(c<e||u<i||t.slice(c,l)!=r.slice(u,a)){if(s==1)return n-l-(Lc(t,l)?0:1);s=s>>1}else{if(c==e||u==i)return n-c;l=c,a=u}}}function ab(t,e,n,r,i,o,s,l){let a=r.slice(i,o),c=null;for(;;){if(c||s<l)return c;for(let u=e+s;;){Lc(t,u)||u++;let f=u+s;if(Lc(t,f)||(f+=f==u+1?1:-1),f>=n)break;let h=t.slice(u,f),d=-1;for(;(d=a.indexOf(h,d+1))!=-1;){let p=Pw(t,f,n,r,i+d+h.length,o),g=Ew(t,e,u,r,i,i+d),m=h.length+p+g;(!c||c[2]<m)&&(c=[u-g,i+d-g,m])}u=f}if(l<0)return c;s=s>>1}}function OL(t,e,n,r,i,o){let s=n-e,l=o-i;if(s<l){let a=OL(r,i,o,t,e,n);return a&&[a[1],a[0],a[2]]}return s<4||l*2<s?null:ab(t,e,n,r,i,o,Math.floor(s/4),-1)}function aP(t,e,n,r,i,o){Tw=!0;let s=n-e,l=o-i,a;if(s<l){let h=ab(r,i,o,t,e,n,Math.floor(s/6),50);a=h&&[h[1],h[0],h[2]]}else a=ab(t,e,n,r,i,o,Math.floor(l/6),50);if(!a)return[new nn(e,n,i,o)];let[c,u,f]=a;return ia(t,e,c,r,i,u).concat(ia(t,c+f,n,r,u+f,o))}function yL(t,e){for(let n=1;n<t.length;n++){let r=t[n-1],i=t[n];r.toA>i.fromA-e&&r.toB>i.fromB-e&&(t[n-1]=new nn(r.fromA,i.toA,r.fromB,i.toB),t.splice(n--,1))}}function kce(t,e,n){for(;;){yL(n,1);let r=!1;for(let i=0;i<n.length;i++){let o=n[i],s,l;(s=Pw(t,o.fromA,o.toA,e,o.fromB,o.toB))&&(o=n[i]=new nn(o.fromA+s,o.toA,o.fromB+s,o.toB)),(l=Ew(t,o.fromA,o.toA,e,o.fromB,o.toB))&&(o=n[i]=new nn(o.fromA,o.toA-l,o.fromB,o.toB-l));let a=o.toA-o.fromA,c=o.toB-o.fromB;if(a&&c)continue;let u=o.fromA-(i?n[i-1].toA:0),f=(i<n.length-1?n[i+1].fromA:t.length)-o.toA;if(!u||!f)continue;let h=a?t.slice(o.fromA,o.toA):e.slice(o.fromB,o.toB);u<=h.length&&t.slice(o.fromA-u,o.fromA)==h.slice(h.length-u)?(n[i]=new nn(o.fromA-u,o.toA-u,o.fromB-u,o.toB-u),r=!0):f<=h.length&&t.slice(o.toA,o.toA+f)==h.slice(0,f)&&(n[i]=new nn(o.fromA+f,o.toA+f,o.fromB+f,o.toB+f),r=!0)}if(!r)break}return n}function Cce(t,e,n){for(let r=0,i=0;i<t.length;i++){let o=t[i],s=o.toA-o.fromA,l=o.toB-o.fromB;if(s&&l||s>3||l>3){let a=i==t.length-1?e.length:t[i+1].fromA,c=o.fromA-r,u=a-o.toA,f=uP(e,o.fromA,c),h=cP(e,o.toA,u),d=o.fromA-f,p=h-o.toA;if((!s||!l)&&d&&p){let g=Math.max(s,l),[m,O,y]=s?[e,o.fromA,o.toA]:[n,o.fromB,o.toB];g>d&&e.slice(f,o.fromA)==m.slice(y-d,y)?(o=t[i]=new nn(f,f+s,o.fromB-d,o.toB-d),f=o.fromA,h=cP(e,o.toA,a-o.toA)):g>p&&e.slice(o.toA,h)==m.slice(O,O+p)&&(o=t[i]=new nn(h-s,h,o.fromB+p,o.toB+p),h=o.toA,f=uP(e,o.fromA,o.fromA-r)),d=o.fromA-f,p=h-o.toA}if(d||p)o=t[i]=new nn(o.fromA-d,o.toA+p,o.fromB-d,o.toB+p);else if(s){if(!l){let g=hP(e,o.fromA,o.toA),m,O=g<0?-1:fP(e,o.toA,o.fromA);g>-1&&(m=g-o.fromA)<=u&&e.slice(o.fromA,g)==e.slice(o.toA,o.toA+m)?o=t[i]=o.offset(m):O>-1&&(m=o.toA-O)<=c&&e.slice(o.fromA-m,o.fromA)==e.slice(O,o.toA)&&(o=t[i]=o.offset(-m))}}else{let g=hP(n,o.fromB,o.toB),m,O=g<0?-1:fP(n,o.toB,o.fromB);g>-1&&(m=g-o.fromB)<=u&&n.slice(o.fromB,g)==n.slice(o.toB,o.toB+m)?o=t[i]=o.offset(m):O>-1&&(m=o.toB-O)<=c&&n.slice(o.fromB-m,o.fromB)==n.slice(O,o.toB)&&(o=t[i]=o.offset(-m))}}r=o.toA}return yL(t,3),t}let Ml;try{Ml=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function xL(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function bL(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?xL(n)?1:0:Ml?!wL(n)||e==t.length-1?Ml.test(String.fromCharCode(n))?1:0:Ml.test(t.slice(e,e+2))?2:0:0}function vL(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?xL(n)?1:0:Ml?!kL(n)||e==1?Ml.test(String.fromCharCode(n))?1:0:Ml.test(t.slice(e-2,e))?2:0:0}const SL=8;function cP(t,e,n){if(e==t.length||!vL(t,e))return e;for(let r=e,i=e+n,o=0;o<SL;o++){let s=bL(t,r);if(!s||r+s>i)return r;r+=s}return e}function uP(t,e,n){if(!e||!bL(t,e))return e;for(let r=e,i=e-n,o=0;o<SL;o++){let s=vL(t,r);if(!s||r-s<i)return r;r-=s}return e}function fP(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function hP(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const wL=t=>t>=55296&&t<=56319,kL=t=>t>=56320&&t<=57343;function Lc(t,e){return!e||e==t.length||!wL(t.charCodeAt(e-1))||!kL(t.charCodeAt(e))}function _ce(t,e,n){var r;let i=n?.override;return i?i(t,e):(Fu=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,Zu=n?.timeout?Date.now()+n.timeout:0,Tw=!1,kce(t,e,ia(t,0,t.length,e,0,e.length)))}function CL(){return!Tw}function _L(t,e,n){return Cce(_ce(t,e,n),t,e)}const Pi=ye.define({combine:t=>t[0]}),cb=Le.define(),Tce=ye.define(),Wo=cn.define({create(t){return null},update(t,e){for(let n of e.effects)n.is(cb)&&(t=n.value);for(let n of e.state.facet(Tce))t=n(t,e);return t}});class hc{constructor(e,n,r,i,o,s=!0){this.changes=e,this.fromA=n,this.toA=r,this.fromB=i,this.toB=o,this.precise=s}offset(e,n){return e||n?new hc(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,r){let i=_L(e.toString(),n.toString(),r);return TL(i,e,n,0,0,CL())}static updateA(e,n,r,i,o){return OP(mP(e,i,!0,r.length),e,n,r,o)}static updateB(e,n,r,i,o){return OP(mP(e,i,!1,n.length),e,n,r,o)}}function dP(t,e,n,r){let i=n.lineAt(t),o=r.lineAt(e);return i.to==t&&o.to==e&&t<n.length&&e<r.length?[t+1,e+1]:[i.from,o.from]}function pP(t,e,n,r){let i=n.lineAt(t),o=r.lineAt(e);return i.from==t&&o.from==e?[t,e]:[i.to+1,o.to+1]}function TL(t,e,n,r,i,o){let s=[];for(let l=0;l<t.length;l++){let a=t[l],[c,u]=dP(a.fromA+r,a.fromB+i,e,n),[f,h]=pP(a.toA+r,a.toB+i,e,n),d=[a.offset(-c+r,-u+i)];for(;l<t.length-1;){let p=t[l+1],[g,m]=dP(p.fromA+r,p.fromB+i,e,n);if(g>f+1&&m>h+1)break;d.push(p.offset(-c+r,-u+i)),[f,h]=pP(p.toA+r,p.toB+i,e,n),l++}s.push(new hc(d,c,Math.max(c,f),u,Math.max(u,h),o))}return s}const qd=1e3;function gP(t,e,n,r){let i=0,o=t.length;for(;;){if(i==o){let u=0,f=0;i&&({toA:u,toB:f}=t[i-1]);let h=e-(n?u:f);return[u+h,f+h]}let s=i+o>>1,l=t[s],[a,c]=n?[l.fromA,l.toA]:[l.fromB,l.toB];if(a>e)o=s;else if(c<=e)i=s+1;else return r?[l.fromA,l.fromB]:[l.toA,l.toB]}}function mP(t,e,n,r){let i=[];return e.iterChangedRanges((o,s,l,a)=>{let c=0,u=n?e.length:r,f=0,h=n?r:e.length;o>qd&&([c,f]=gP(t,o-qd,n,!0)),s<e.length-qd&&([u,h]=gP(t,s+qd,n,!1));let d=a-l-(s-o),p,[g,m]=n?[d,0]:[0,d];i.length&&(p=i[i.length-1]).toA>=c?i[i.length-1]={fromA:p.fromA,fromB:p.fromB,toA:u,toB:h,diffA:p.diffA+g,diffB:p.diffB+m}:i.push({fromA:c,toA:u,fromB:f,toB:h,diffA:g,diffB:m})}),i}function OP(t,e,n,r,i){if(!t.length)return e;let o=[];for(let s=0,l=0,a=0,c=0;;s++){let u=s==t.length?null:t[s],f=u?u.fromA+l:n.length,h=u?u.fromB+a:r.length;for(;c<e.length;){let m=e[c];if(u&&(m.toA+l>f||m.toB+a>h))break;o.push(m.offset(l,a)),c++}if(!u)break;let d=u.toA+l+u.diffA,p=u.toB+a+u.diffB,g=_L(n.sliceString(f,d),r.sliceString(h,p),i);for(let m of TL(g,n,r,f,h,CL()))o.push(m);for(l+=u.diffA,a+=u.diffB;c<e.length;){let m=e[c];if(m.fromA+l>d&&m.fromB+a>p)break;c++}}return o}const Pce={scanLimit:500},PL=Ht.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=bP(t))}update(t){(t.docChanged||t.viewportChanged||Ece(t.startState,t.state)||$ce(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=bP(t.view))}},{decorations:t=>t.deco}),Yd=Fi.low(t7({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(PL))===null||e===void 0?void 0:e.gutter)||qe.empty}}));function Ece(t,e){return t.field(Wo,!1)!=e.field(Wo,!1)}function $ce(t,e){return t.facet(Pi)!=e.facet(Pi)}const yP=ke.line({class:"cm-changedLine"}),Ace=ke.mark({class:"cm-changedText"}),Qce=ke.mark({tagName:"ins",class:"cm-insertedLine"}),Mce=ke.mark({tagName:"del",class:"cm-deletedLine"}),xP=new class extends po{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Rce(t,e,n,r,i,o){let s=n?t.fromA:t.fromB,l=n?t.toA:t.toB,a=0;if(s!=l){i.add(s,s,yP),i.add(s,l,n?Mce:Qce),o&&o.add(s,s,xP);for(let c=e.iterRange(s,l-1),u=s;!c.next().done;){if(c.lineBreak){u++,i.add(u,u,yP),o&&o.add(u,u,xP);continue}let f=u+c.value.length;if(r)for(;a<t.changes.length;){let h=t.changes[a],d=s+(n?h.fromA:h.fromB),p=s+(n?h.toA:h.toB),g=Math.max(u,d),m=Math.min(f,p);if(g<m&&i.add(g,m,Ace),p<f)a++;else break}u=f}}}function bP(t){let e=t.state.field(Wo),{side:n,highlightChanges:r,markGutter:i,overrideChunk:o}=t.state.facet(Pi),s=n=="a",l=new ir,a=i?new ir:null,{from:c,to:u}=t.viewport;for(let f of e){if((s?f.fromA:f.fromB)>=u)break;(s?f.toA:f.toB)>c&&(!o||!o(t.state,f,l,a))&&Rce(f,t.state.doc,s,r,l,a)}return{deco:l.finish(),gutter:a&&a.finish()}}class Ud extends pi{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const rm=Le.define({map:(t,e)=>t.map(e)}),zu=cn.define({create:()=>ke.none,update:(t,e)=>{for(let n of e.effects)if(n.is(rm))return n.value;return t.map(e.changes)},provide:t=>se.decorations.from(t)}),Gd=.01;function vP(t,e){if(t.size!=e.size)return!1;let n=t.iter(),r=e.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Lce(t,e,n){let r=new ir,i=new ir,o=t.state.field(zu).iter(),s=e.state.field(zu).iter(),l=0,a=0,c=0,u=0,f=t.viewport,h=e.viewport;for(let m=0;;m++){let O=m<n.length?n[m]:null,y=O?O.fromA:t.state.doc.length,x=O?O.fromB:e.state.doc.length;if(l<y){let b=t.lineBlockAt(l).top+c,S=e.lineBlockAt(a).top+u,v=b-S;v<-Gd?(c-=v,r.add(l,l,ke.widget({widget:new Ud(-v),block:!0,side:-1}))):v>Gd&&(u+=v,i.add(a,a,ke.widget({widget:new Ud(v),block:!0,side:-1})))}if(y>l+1e3&&l<f.from&&y>f.from&&a<h.from&&x>h.from){let b=Math.min(f.from-l,h.from-a);l+=b,a+=b,m--}else if(O)l=O.toA,a=O.toB;else break;for(;o.value&&o.from<l;)c-=o.value.spec.widget.height,o.next();for(;s.value&&s.from<a;)u-=s.value.spec.widget.height,s.next()}for(;o.value;)c-=o.value.spec.widget.height,o.next();for(;s.value;)u-=s.value.spec.widget.height,s.next();let d=t.contentHeight+c-(e.contentHeight+u);d<Gd?r.add(t.state.doc.length,t.state.doc.length,ke.widget({widget:new Ud(-d),block:!0,side:1})):d>Gd&&i.add(e.state.doc.length,e.state.doc.length,ke.widget({widget:new Ud(d),block:!0,side:1}));let p=r.finish(),g=i.finish();vP(p,t.state.field(zu))||t.dispatch({effects:rm.of(p)}),vP(g,e.state.field(zu))||e.dispatch({effects:rm.of(g)})}const ub=Le.define({map:(t,e)=>e.mapPos(t)});class Ice extends pi{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",r=>{let i=e.posAtDOM(r.target);e.dispatch({effects:ub.of(i)});let{side:o,sibling:s}=e.state.facet(Pi);s&&s().dispatch({effects:ub.of(Dce(i,e.state.field(Wo),o=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Dce(t,e,n){let r=0,i=0;for(let o=0;;o++){let s=o<e.length?e[o]:null;if(!s||(n?s.fromA:s.fromB)>=t)return i+(t-r);[r,i]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const Nce=cn.define({create(t){return ke.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(ub)&&(t=t.update({filter:r=>r!=n.value}));if(t.size&&e.state.field(Wo)!=e.startState.field(Wo,!1)){let n=e.state.facet(Pi).side=="a",r=[];for(let i of e.state.field(Wo))t.between(n?i.fromA:i.fromB,n?i.toA:i.toB,o=>{r.push(o)});r.length&&(t=t.update({filter:i=>r.indexOf(i)<0}))}return t},provide:t=>se.decorations.from(t)});function SP({margin:t=3,minSize:e=4}){return Nce.init(n=>Vce(n,t,e))}function Vce(t,e,n){let r=new ir,i=t.facet(Pi).side=="a",o=t.field(Wo),s=1;for(let l=0;;l++){let a=l<o.length?o[l]:null,c=l?s+e:1,u=a?t.doc.lineAt(i?a.fromA:a.fromB).number-1-e:t.doc.lines,f=u-c+1;if(f>=n&&r.add(t.doc.line(c).from,t.doc.line(u).to,ke.replace({widget:new Ice(f),block:!0})),!a)break;s=t.doc.lineAt(Math.min(t.doc.length,i?a.toA:a.toB)).number}return r.finish()}const Bce=se.styleModule.of(new ss({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),Fce=se.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),wP=new lu,Kd=new lu;class Zce{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Pce;let n=[Fi.low(PL),Fce,Bce,zu,se.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(h=>h.effects.some(d=>d.is(rm)))&&this.measure()})],r=[Pi.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&r.push(Yd);let i=ze.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],se.editorAttributes.of({class:"cm-merge-a"}),Kd.of(r),n]}),o=[Pi.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(Yd);let s=ze.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],se.editorAttributes.of({class:"cm-merge-b"}),Kd.of(o),n]});this.chunks=hc.build(i.doc,s.doc,this.diffConf);let l=[Wo.init(()=>this.chunks),wP.of(e.collapseUnchanged?SP(e.collapseUnchanged):[])];i=i.update({effects:Le.appendConfig.of(l)}).state,s=s.update({effects:Le.appendConfig.of(l)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let a=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(a=="a-b"?c:u),this.editorDOM.appendChild(a=="a-b"?u:c),this.a=new se({state:i,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new se({state:s,parent:u,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(r=>r.docChanged)){let r=e[e.length-1],i=e.reduce((s,l)=>s.compose(l.changes),tn.empty(e[0].startState.doc.length));this.chunks=n==this.a?hc.updateA(this.chunks,r.newDoc,this.b.state.doc,i,this.diffConf):hc.updateB(this.chunks,this.a.state.doc,r.newDoc,i,this.diffConf),n.update([...e,r.state.update({effects:cb.of(this.chunks)})]);let o=n==this.a?this.b:this.a;o.update([o.state.update({effects:cb.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let o=e.orientation!="b-a";if(o!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,l=this.b.dom.parentNode;s.remove(),l.remove(),this.editorDOM.insertBefore(o?s:l,this.editorDOM.firstChild),this.editorDOM.appendChild(o?l:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let o=!!this.revertDOM,s=this.revertToA,l=this.renderRevert;"revertControls"in e&&(o=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(l=e.renderRevertControl),this.setupRevertControls(o,s,l)}let n="highlightChanges"in e,r="gutter"in e,i="collapseUnchanged"in e;if(n||r||i){let o=[],s=[];if(n||r){let l=this.a.state.facet(Pi),a=r?e.gutter!==!1:l.markGutter,c=n?e.highlightChanges!==!1:l.highlightChanges;o.push(Kd.reconfigure([Pi.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:a}),a?Yd:[]])),s.push(Kd.reconfigure([Pi.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:a}),a?Yd:[]]))}if(i){let l=wP.reconfigure(e.collapseUnchanged?SP(e.collapseUnchanged):[]);o.push(l),s.push(l)}this.a.dispatch({effects:o}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,n,r){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=r,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",i=>this.revertClicked(i)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){Lce(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,r=this.a.viewport,i=this.b.viewport;for(let o=0;o<this.chunks.length;o++){let s=this.chunks[o];if(s.fromA>r.to||s.fromB>i.to)break;if(s.fromA<r.from||s.fromB<i.from)continue;let l=this.a.lineBlockAt(s.fromA).top+"px";for(;n&&+n.dataset.chunk<o;)n=kP(n);n&&n.dataset.chunk==String(o)?(n.style.top!=l&&(n.style.top=l),n=n.nextSibling):e.insertBefore(this.renderRevertButton(l,o),n)}for(;n;)n=kP(n)}renderRevertButton(e,n){let r;if(this.renderRevert)r=this.renderRevert();else{r=document.createElement("button");let i=this.a.state.phrase("Revert this chunk");r.setAttribute("aria-label",i),r.setAttribute("title",i),r.textContent=this.revertToLeft?"⇜":"⇝"}return r.style.top=e,r.setAttribute("data-chunk",String(n)),r}revertClicked(e){let n=e.target,r;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(r=this.chunks[n.dataset.chunk])){let[i,o,s,l,a,c]=this.revertToA?[this.b,this.a,r.fromB,r.toB,r.fromA,r.toA]:[this.a,this.b,r.fromA,r.toA,r.fromB,r.toB],u=i.state.sliceDoc(s,Math.max(s,l-1));s!=l&&c<=o.state.doc.length&&(u+=i.state.lineBreak),o.dispatch({changes:{from:a,to:Math.min(o.state.doc.length,c),insert:u},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function kP(t){let e=t.nextSibling;return t.remove(),e}class im{static create(e,n,r,i,o){let s=i+(i<<8)+e+(n<<4)|0;return new im(e,n,r,s,o,[],[])}constructor(e,n,r,i,o,s,l){this.type=e,this.value=n,this.from=r,this.hash=i,this.end=o,this.children=s,this.positions=l,this.hashProp=[[Ve.contextHash,i]]}addChild(e,n){e.prop(Ve.contextHash)!=this.hash&&(e=new Ye(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(n)}toTree(e,n=this.end){let r=this.children.length-1;return r>=0&&(n=Math.max(n,this.positions[r]+this.children[r].length+this.from)),new Ye(e.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,o,s)=>new Ye(an.none,i,o,s,this.hashProp)})}}var le;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(le||(le={}));class zce{constructor(e,n){this.start=e,this.content=n,this.marks=[],this.parsers=[]}}class jce{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return pf(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,n=0,r=0){for(let i=n;i<e;i++)r+=this.text.charCodeAt(i)==9?4-r%4:1;return r}findColumn(e){let n=0;for(let r=0;n<this.text.length&&r<e;n++)r+=this.text.charCodeAt(n)==9?4-r%4:1;return n}scrub(){if(!this.baseIndent)return this.text;let e="";for(let n=0;n<this.basePos;n++)e+=" ";return e+this.text.slice(this.basePos)}}function CP(t,e,n){if(n.pos==n.text.length||t!=e.block&&n.indent>=e.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(t.type==le.OrderedList?Qw:Aw)(n,e,!1);return r>0&&(t.type!=le.BulletList||$w(n,e,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==t.value}const EL={[le.Blockquote](t,e,n){return n.next!=62?!1:(n.markers.push(tt(le.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(mi(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0)},[le.ListItem](t,e,n){return n.indent<n.baseIndent+t.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+t.value),!0)},[le.OrderedList]:CP,[le.BulletList]:CP,[le.Document](){return!0}};function mi(t){return t==32||t==9||t==10||t==13}function pf(t,e=0){for(;e<t.length&&mi(t.charCodeAt(e));)e++;return e}function _P(t,e,n){for(;e>n&&mi(t.charCodeAt(e-1));)e--;return e}function $L(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let n=e;n<t.text.length;n++)if(t.text.charCodeAt(n)==96)return-1}return e}function AL(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function $w(t,e,n){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let r=1;for(let i=t.pos+1;i<t.text.length;i++){let o=t.text.charCodeAt(i);if(o==t.next)r++;else if(!mi(o))return-1}return n&&t.next==45&&RL(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(NL.SetextHeading)>-1||r<3?-1:1}function QL(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function Aw(t,e,n){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||mi(t.text.charCodeAt(t.pos+1)))&&(!n||QL(e,le.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function Qw(t,e,n){let r=t.pos,i=t.next;for(;i>=48&&i<=57;){r++;if(r==t.text.length)return-1;i=t.text.charCodeAt(r)}return r==t.pos||r>t.pos+9||i!=46&&i!=41||r<t.text.length-1&&!mi(t.text.charCodeAt(r+1))||n&&!QL(e,le.OrderedList)&&(t.skipSpace(r+1)==t.text.length||r>t.pos+1||t.next!=49)?-1:r+1-t.pos}function ML(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==35;)e++;if(e<t.text.length&&t.text.charCodeAt(e)!=32)return-1;let n=e-t.pos;return n>6?-1:n}function RL(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;let n=e;for(;e<t.text.length&&mi(t.text.charCodeAt(e));)e++;return e==t.text.length?n:-1}const fb=/^[ \t]*$/,LL=/-->/,IL=/\?>/,hb=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,LL],[/^\s*<\?/,IL],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,fb],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,fb]];function DL(t,e,n){if(t.next!=60)return-1;let r=t.text.slice(t.pos);for(let i=0,o=hb.length-(n?1:0);i<o;i++)if(hb[i][0].test(r))return i;return-1}function TP(t,e){let n=t.countIndent(e,t.pos,t.indent),r=t.skipSpace(e),i=t.countIndent(r,e,n);return i>=n+5||r==t.text.length?n+1:i}function Os(t,e,n){let r=t.length-1;r>=0&&t[r].to==e&&t[r].type==le.CodeText?t[r].to=n:t.push(tt(le.CodeText,e,n))}const Jd={LinkReference:void 0,IndentedCode(t,e){let n=e.baseIndent+4;if(e.indent<n)return!1;let r=e.findColumn(n),i=t.lineStart+r,o=t.lineStart+e.text.length,s=[],l=[];for(Os(s,i,o);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){Os(l,t.lineStart-1,t.lineStart);for(let a of e.markers)l.push(a)}else{if(e.indent<n)break;{if(l.length){for(let c of l)c.type==le.CodeText?Os(s,c.from,c.to):s.push(c);l=[]}Os(s,t.lineStart-1,t.lineStart);for(let c of e.markers)s.push(c);o=t.lineStart+e.text.length;let a=t.lineStart+e.findColumn(e.baseIndent+4);a<o&&Os(s,a,o)}}return l.length&&(l=l.filter(a=>a.type!=le.CodeText),l.length&&(e.markers=l.concat(e.markers))),t.addNode(t.buffer.writeElements(s,-i).finish(le.CodeBlock,o-i),i),!0},FencedCode(t,e){let n=$L(e);if(n<0)return!1;let r=t.lineStart+e.pos,i=e.next,o=n-e.pos,s=e.skipSpace(n),l=_P(e.text,e.text.length,s),a=[tt(le.CodeMark,r,r+o)];s<l&&a.push(tt(le.CodeInfo,t.lineStart+s,t.lineStart+l));for(let c=!0,u=!0,f=!1;t.nextLine()&&e.depth>=t.stack.length;c=!1){let h=e.pos;if(e.indent-e.baseIndent<4)for(;h<e.text.length&&e.text.charCodeAt(h)==i;)h++;if(h-e.pos>=o&&e.skipSpace(h)==e.text.length){for(let d of e.markers)a.push(d);u&&f&&Os(a,t.lineStart-1,t.lineStart),a.push(tt(le.CodeMark,t.lineStart+e.pos,t.lineStart+h)),t.nextLine();break}else{f=!0,c||(Os(a,t.lineStart-1,t.lineStart),u=!1);for(let g of e.markers)a.push(g);let d=t.lineStart+e.basePos,p=t.lineStart+e.text.length;d<p&&(Os(a,d,p),u=!1)}}return t.addNode(t.buffer.writeElements(a,-r).finish(le.FencedCode,t.prevLineEnd()-r),r),!0},Blockquote(t,e){let n=AL(e);return n<0?!1:(t.startContext(le.Blockquote,e.pos),t.addNode(le.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+n),null)},HorizontalRule(t,e){if($w(e,t,!1)<0)return!1;let n=t.lineStart+e.pos;return t.nextLine(),t.addNode(le.HorizontalRule,n),!0},BulletList(t,e){let n=Aw(e,t,!1);if(n<0)return!1;t.block.type!=le.BulletList&&t.startContext(le.BulletList,e.basePos,e.next);let r=TP(e,e.pos+1);return t.startContext(le.ListItem,e.basePos,r-e.baseIndent),t.addNode(le.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(r),null},OrderedList(t,e){let n=Qw(e,t,!1);if(n<0)return!1;t.block.type!=le.OrderedList&&t.startContext(le.OrderedList,e.basePos,e.text.charCodeAt(e.pos+n-1));let r=TP(e,e.pos+n);return t.startContext(le.ListItem,e.basePos,r-e.baseIndent),t.addNode(le.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(r),null},ATXHeading(t,e){let n=ML(e);if(n<0)return!1;let r=e.pos,i=t.lineStart+r,o=_P(e.text,e.text.length,r),s=o;for(;s>r&&e.text.charCodeAt(s-1)==e.next;)s--;(s==o||s==r||!mi(e.text.charCodeAt(s-1)))&&(s=e.text.length);let l=t.buffer.write(le.HeaderMark,0,n).writeElements(t.parser.parseInline(e.text.slice(r+n+1,s),i+n+1),-i);s<e.text.length&&l.write(le.HeaderMark,s-r,o-r);let a=l.finish(le.ATXHeading1-1+n,e.text.length-r);return t.nextLine(),t.addNode(a,i),!0},HTMLBlock(t,e){let n=DL(e,t,!1);if(n<0)return!1;let r=t.lineStart+e.pos,i=hb[n][1],o=[],s=i!=fb;for(;!i.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){s=!1;break}for(let c of e.markers)o.push(c)}s&&t.nextLine();let l=i==LL?le.CommentBlock:i==IL?le.ProcessingInstructionBlock:le.HTMLBlock,a=t.prevLineEnd();return t.addNode(t.buffer.writeElements(o,-r).finish(l,a-r),r),!0},SetextHeading:void 0};class Xce{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,n,r){if(this.stage==-1)return!1;let i=r.content+`
117
117
  `+n.scrub(),o=this.advance(i);return o>-1&&o<i.length?this.complete(e,r,o):!1}finish(e,n){return(this.stage==2||this.stage==3)&&pf(n.content,this.pos)==n.content.length?this.complete(e,n,n.content.length):!1}complete(e,n,r){return e.addLeafElement(n,tt(le.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(HL(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(tt(le.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(XL(e,pf(e,this.pos),this.start)))return-1}else if(this.stage==2){let n=pf(e,this.pos),r=0;if(n>this.pos){let i=WL(e,n,this.start);if(i){let o=d0(e,i.to-this.start);o>0&&(this.nextStage(i),r=o)}}return r||(r=d0(e,this.pos)),r>0&&r<e.length?r:-1}else return d0(e,this.pos)}}}function d0(t,e){for(;e<t.length;e++){let n=t.charCodeAt(e);if(n==10)break;if(!mi(n))return-1}return e}class Wce{nextLine(e,n,r){let i=n.depth<e.stack.length?-1:RL(n),o=n.next;if(i<0)return!1;let s=tt(le.HeaderMark,e.lineStart+n.pos,e.lineStart+i);return e.nextLine(),e.addLeafElement(r,tt(o==61?le.SetextHeading1:le.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),s])),!0}finish(){return!1}}const NL={LinkReference(t,e){return e.content.charCodeAt(0)==91?new Xce(e):null},SetextHeading(){return new Wce}},Hce=[(t,e)=>ML(e)>=0,(t,e)=>$L(e)>=0,(t,e)=>AL(e)>=0,(t,e)=>Aw(e,t,!0)>=0,(t,e)=>Qw(e,t,!0)>=0,(t,e)=>$w(e,t,!0)>=0,(t,e)=>DL(e,t,!0)>=0],qce={text:"",end:0};class Yce{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.line=new jce,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=im.create(le.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new Kce(r,n):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let r=0;;){let i=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!i||e.markers[r].from<i.end);){let o=e.markers[r++];this.addNode(o.type,o.from,o.to)}if(!i)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let i=r(this,e);if(i!=!1){if(i==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let n=new zce(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let i=r(this,n);i&&n.parsers.push(i)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,n))break e}for(let r of n.parsers)if(r.nextLine(this,e,n))return null;n.content+=`
118
118
  `+e.scrub();for(let r of e.markers)n.marks.push(r)}return this.finishLeaf(n),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let n=this.fragments.takeNodes(this);return n?(this.absoluteLineStart+=n,this.lineStart=qL(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let n=qce;if(n.end=e,e>=this.to)n.text="";else if(n.text=this.lineChunkAt(e),n.end+=n.text.length,this.ranges.length>1){let r=this.absoluteLineStart,i=this.rangeI;for(;this.ranges[i].to<n.end;){i++;let o=this.ranges[i].from,s=this.lineChunkAt(o);n.end=o+s.length,n.text=n.text.slice(0,this.ranges[i-1].to-r)+s,r=n.end-n.text.length}}return n}readLine(){let{line:e}=this,{text:n,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(n);e.depth<this.stack.length;e.depth++){let i=this.stack[e.depth],o=this.parser.skipContextMarkup[i.type];if(!o)throw new Error("Unhandled block context "+le[i.type]);let s=this.line.markers.length;if(!o(i,this,e)){this.line.markers.length>s&&(i.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let n=this.input.chunk(e),r;if(this.input.lineChunks)r=n==`