chapterhouse 0.3.10 → 0.3.11
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.
|
@@ -22,7 +22,7 @@ var Rz=Object.defineProperty;var Nz=(t,e,n)=>e in t?Rz(t,e,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(t){function e(I,D){var C=I.length;I.push(D);e:for(;0<C;){var F=C-1>>>1,W=I[F];if(0<i(W,D))I[F]=D,I[C]=W,C=F;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var D=I[0],C=I.pop();if(C!==D){I[0]=C;e:for(var F=0,W=I.length,v=W>>>1;F<v;){var V=2*(F+1)-1,
|
|
25
|
+
*/(function(t){function e(I,D){var C=I.length;I.push(D);e:for(;0<C;){var F=C-1>>>1,W=I[F];if(0<i(W,D))I[F]=D,I[C]=W,C=F;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var D=I[0],C=I.pop();if(C!==D){I[0]=C;e:for(var F=0,W=I.length,v=W>>>1;F<v;){var V=2*(F+1)-1,ie=I[V],te=V+1,q=I[te];if(0>i(ie,C))te<W&&0>i(q,ie)?(I[F]=q,I[te]=C,F=te):(I[F]=ie,I[V]=C,F=V);else if(te<W&&0>i(q,C))I[F]=q,I[te]=C,F=te;else break e}}return D}function i(I,D){var C=I.sortIndex-D.sortIndex;return C!==0?C:I.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,d=3,f=!1,p=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(I){for(var D=n(c);D!==null;){if(D.callback===null)r(c);else if(D.startTime<=I)r(c),D.sortIndex=D.expirationTime,e(l,D);else break;D=n(c)}}function k(I){if(g=!1,w(I),!p)if(n(l)!==null)p=!0,$(x);else{var D=n(c);D!==null&&Z(k,D.startTime-I)}}function x(I,D){p=!1,g&&(g=!1,m(P),P=-1),f=!0;var C=d;try{for(w(D),h=n(l);h!==null&&(!(h.expirationTime>D)||I&&!M());){var F=h.callback;if(typeof F=="function"){h.callback=null,d=h.priorityLevel;var W=F(h.expirationTime<=D);D=t.unstable_now(),typeof W=="function"?h.callback=W:h===n(l)&&r(l),w(D)}else r(l);h=n(l)}if(h!==null)var v=!0;else{var V=n(c);V!==null&&Z(k,V.startTime-D),v=!1}return v}finally{h=null,d=C,f=!1}}var S=!1,T=null,P=-1,Q=5,E=-1;function M(){return!(t.unstable_now()-E<Q)}function L(){if(T!==null){var I=t.unstable_now();E=I;var D=!0;try{D=T(!0,I)}finally{D?H():(S=!1,T=null)}}else S=!1}var H;if(typeof O=="function")H=function(){O(L)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,z=Y.port2;Y.port1.onmessage=L,H=function(){z.postMessage(null)}}else H=function(){b(L,0)};function $(I){T=I,S||(S=!0,H())}function Z(I,D){P=b(function(){I(t.unstable_now())},D)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(I){I.callback=null},t.unstable_continueExecution=function(){p||f||(p=!0,$(x))},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(I){switch(d){case 1:case 2:case 3:var D=3;break;default:D=d}var C=d;d=D;try{return I()}finally{d=C}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(I,D){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var C=d;d=I;try{return D()}finally{d=C}},t.unstable_scheduleCallback=function(I,D,C){var F=t.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?F+C:F):C=F,I){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=C+W,I={id:u++,callback:D,priorityLevel:I,startTime:C,expirationTime:W,sortIndex:-1},C>F?(I.sortIndex=C,e(c,I),n(l)===null&&I===n(c)&&(g?(m(P),P=-1):g=!0,Z(k,C-F))):(I.sortIndex=W,e(l,I),p||f||(p=!0,$(x))),I},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(I){var D=d;return function(){var C=d;d=D;try{return I.apply(this,arguments)}finally{d=C}}}})(eP);JA.exports=eP;var rj=JA.exports;/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -131,16 +131,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
131
131
|
|
|
132
132
|
_(cancelled)_`,pending:!1,activities:s.activities.map(o=>o.kind==="thinking"&&o.active?{...o,active:!1}:o),parts:s.parts.map(o=>o.type==="text"?{...o,text:o.text+`
|
|
133
133
|
|
|
134
|
-
_(cancelled)_`}:o.type==="thinking"?{...o,active:!1}:o)}:s)}}}),clearMessages:n=>t(r=>({messagesBySession:{...r.messagesBySession,[n]:[]}})),dropInterruptedBubble:n=>t(r=>{const i=r.messagesBySession[n]??[];let s=-1;for(let o=i.length-1;o>=0;o--){const a=i[o];if(a.role==="assistant"&&a.pending){s=o;break}}return s===-1?r:{messagesBySession:{...r.messagesBySession,[n]:i.filter((o,a)=>a!==s)}}}),seedMessages:(n,r)=>t(i=>{const s=i.messagesBySession[r];if(s&&s.
|
|
134
|
+
_(cancelled)_`}:o.type==="thinking"?{...o,active:!1}:o)}:s)}}}),clearMessages:n=>t(r=>({messagesBySession:{...r.messagesBySession,[n]:[]}})),dropInterruptedBubble:n=>t(r=>{const i=r.messagesBySession[n]??[];let s=-1;for(let o=i.length-1;o>=0;o--){const a=i[o];if(a.role==="assistant"&&a.pending){s=o;break}}return s===-1?r:{messagesBySession:{...r.messagesBySession,[n]:i.filter((o,a)=>a!==s)}}}),seedMessages:(n,r)=>t(i=>{const s=i.messagesBySession[r];if(s&&s.some(l=>l.role==="user"))return i;const o=n.map(l=>{const c=Od(),u=l.ts?new Date(l.ts).getTime():Date.now();return l.role==="user"?{role:"user",id:c,content:l.content,ts:u}:{role:"assistant",id:c,content:l.content,ts:u,pending:!1,activities:[],parts:tG(l.content,[])}}),a=(s??[]).filter(l=>l.role==="assistant"&&l.pending===!0);return{messagesBySession:{...i.messagesBySession,[r]:[...o,...a]}}}),applyActivity:(n,r,i)=>t(s=>{const o=s.messagesBySession[i]??[];return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>a.id!==n||a.role!=="assistant"?a:{...a,activities:rG(a.activities,r),parts:iG(a.parts,r)})}}}),tagUserMessageTurnId:(n,r,i)=>t(s=>{const o=s.messagesBySession[i]??[];return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>a.id===n&&a.role==="user"?{...a,turnId:r}:a)}}}),applyTurnEvent:(n,r,i)=>t(s=>{const o=s.messagesBySession[i]??[];switch(r.type){case"turn:started":{const a=Od();return{messagesBySession:{...s.messagesBySession,[i]:[...o,{role:"assistant",id:a,content:"",ts:Date.now(),pending:!0,activities:[],parts:[],turnId:n}]}}}case"turn:delta":{const a=r.part;return{messagesBySession:{...s.messagesBySession,[i]:o.map(l=>{if(l.role!=="assistant"||l.turnId!==n)return l;let c;if(a.type==="text"){const h=l.parts.findIndex(d=>d.type==="text");h===-1?c=[...l.parts,{type:"text",text:a.text}]:c=l.parts.map((d,f)=>f===h?{type:"text",text:d.text+a.text}:d)}else c=sG(l.parts,a);const u=c.find(h=>h.type==="text");return{...l,content:(u==null?void 0:u.text)??l.content,parts:c}})}}}case"turn:queued":return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>a.role==="user"&&a.turnId===n?{...a,deliveryStatus:"queued-backend",queuePosition:r.position}:a)}};case"turn:interrupted":return{messagesBySession:{...s.messagesBySession,[i]:o.filter(a=>!(a.role==="assistant"&&a.turnId===n&&a.pending))}};case"turn:complete":return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>{if(a.role!=="assistant"||a.turnId!==n)return a;let l=!1;const c=a.parts.map(h=>h.type==="text"?(l=!0,{...h,text:r.finalMessage}):h.type==="thinking"?{...h,active:!1}:h);!l&&r.finalMessage&&c.push({type:"text",text:r.finalMessage});const u=a.activities.map(h=>h.kind==="thinking"?{...h,active:!1}:h);return{...a,content:r.finalMessage,pending:!1,activities:u,parts:c}})}};case"turn:error":return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>{if(a.role!=="assistant"||a.turnId!==n)return a;const l=`**Error:** ${r.error}`,c=a.parts.findIndex(h=>h.type==="text"),u=c===-1?[...a.parts,{type:"text",text:l}]:a.parts.map((h,d)=>d===c?{type:"text",text:l}:h);return{...a,content:l,pending:!1,parts:u}})}};default:return s}}),currentModel:null,setCurrentModel:n=>t({currentModel:n})})),oG=1e3,aG=3e4,lG=10;function cG(){let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}function uG(t,e){return new Promise(n=>{if(e!=null&&e.aborted){n();return}const r=window.setTimeout(n,t);e==null||e.addEventListener("abort",()=>{window.clearTimeout(r),n()})})}function hG(t){let e="message";const n=[];for(const r of t.split(`
|
|
135
135
|
`))if(!(!r||r.startsWith(":"))){if(r.startsWith("event:")){e=r.slice(6).trim();continue}r.startsWith("data:")&&n.push(r.slice(5).trimStart())}return n.length===0?null:{event:e,data:n.join(`
|
|
136
136
|
`)}}function DC(t){const e=[];let n=t;for(;;){const r=n.indexOf(`
|
|
137
137
|
|
|
138
138
|
`);if(r<0)return{frames:e,buffer:n};const i=hG(n.slice(0,r));i&&e.push(i),n=n.slice(r+2)}}class dG{constructor(e){ze(this,"controller",null);ze(this,"streamTask",null);ze(this,"openPromise",null);ze(this,"closedByUser",!1);ze(this,"listeners",new Set);ze(this,"statusListeners",new Set);ze(this,"connectionId",null);ze(this,"connectionStatus","idle");ze(this,"reconnectAttempt",0);ze(this,"reconnectController",null);ze(this,"getReconnectDelay");ze(this,"maxAttempts");ze(this,"doFetch");ze(this,"doCreateAuthHeaders");this.getReconnectDelay=(e==null?void 0:e.getReconnectDelay)??(n=>Math.min(oG*2**(n-1),aG)),this.maxAttempts=(e==null?void 0:e.maxReconnectAttempts)??lG,this.doFetch=(e==null?void 0:e.fetch)??globalThis.fetch.bind(globalThis),this.doCreateAuthHeaders=(e==null?void 0:e.createAuthHeaders)??Uu}async open(){if(this.openPromise){await this.openPromise;return}if(this.streamTask)return;this.closedByUser=!1;const e=cG();let n=!1;const r=()=>{n||(n=!0,e.resolve())},i=s=>{n||(n=!0,e.reject(s))};this.openPromise=e.promise,this.streamTask=this.run(r,i);try{await e.promise}catch(s){throw this.close(),s}finally{this.openPromise=null}}emitStatus(e){this.connectionStatus=e;for(const n of this.statusListeners)n(e)}scheduleReconnect(){if(this.reconnectAttempt++,this.reconnectAttempt>this.maxAttempts)return this.emitStatus("disconnected"),Promise.resolve();this.emitStatus("reconnecting");const e=this.getReconnectDelay(this.reconnectAttempt),n=new AbortController;return this.reconnectController=n,uG(e,n.signal).then(()=>{this.reconnectController=null})}async run(e,n){let r=!1;try{for(;!this.closedByUser;){const i=new AbortController;this.controller=i;try{await this.connectOnce(i.signal,()=>{r||(r=!0,e()),this.reconnectAttempt=0,this.emitStatus("connected")})}catch(s){if(i.signal.aborted||this.closedByUser)break;if(this.connectionId=null,!r){n(s);return}if(await this.scheduleReconnect(),this.reconnectAttempt>this.maxAttempts)break;continue}if(!r){n(new Error("Stream closed before the server acknowledged the connection"));return}if(this.connectionId=null,!this.closedByUser&&(await this.scheduleReconnect(),this.reconnectAttempt>this.maxAttempts))break}r||n(new Error("Stream closed"))}finally{this.controller=null,this.connectionId=null,this.streamTask=null}}async connectOnce(e,n){const r=await this.doCreateAuthHeaders(),i=await this.doFetch("/stream",{method:"GET",headers:r,cache:"no-store",signal:e});if(!i.ok)throw new Error(`Stream failed: ${i.status} ${i.statusText}`);if(!i.body)throw new Error("Stream failed: response body unavailable");const s=i.body.getReader(),o=new TextDecoder;let a="",l=!1;try{for(;;){const{value:u,done:h}=await s.read();if(h)break;a+=o.decode(u,{stream:!0}).replace(/\r/g,"");const d=DC(a);a=d.buffer;for(const f of d.frames)this.handleFrame(f,()=>{l||(l=!0,n())})}a+=o.decode().replace(/\r/g,"");const c=DC(`${a}
|
|
139
139
|
|
|
140
|
-
`);for(const u of c.frames)this.handleFrame(u,()=>{l||(l=!0,n())})}finally{s.releaseLock()}}handleFrame(e,n){if(e.event!=="message"&&e.event!=="status")return;let r;try{r=JSON.parse(e.data)}catch{return}const i=bq.safeParse(r);if(!i.success){console.error("[stream] SSE frame failed schema validation:",i.error.format(),r);return}const s=i.data;s.type==="connected"&&(this.connectionId=s.connectionId,n());for(const o of this.listeners)o(s)}close(){var e,n;this.closedByUser=!0,(e=this.controller)==null||e.abort(),(n=this.reconnectController)==null||n.abort(),this.controller=null,this.connectionId=null}getConnectionId(){return this.connectionId}getStatus(){return this.connectionStatus}onStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}reconnectNow(){var e;this.reconnectAttempt=0,(e=this.reconnectController)==null||e.abort(),!this.streamTask&&!this.closedByUser&&this.open()}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}}const pa=new dG;function fG(){const t=Ae(e=>e.sseStatus);return t==="connected"||t==="idle"?null:t==="reconnecting"?y.jsxs("span",{className:"sse-badge sse-badge--reconnecting",role:"status","aria-live":"polite",children:[y.jsx("span",{className:"sse-badge__dot","aria-hidden":"true"}),"Reconnecting…"]}):y.jsxs("span",{className:"sse-badge sse-badge--disconnected",role:"status","aria-live":"assertive",children:[y.jsx("span",{className:"sse-badge__dot","aria-hidden":"true"}),"Disconnected",y.jsx("button",{type:"button",className:"sse-badge__reconnect-btn",onClick:()=>pa.reconnectNow(),children:"Reconnect now"})]})}function pG(){const[t,e]=A.useState(!1),[n,r]=A.useState(!1),[i,s]=A.useState(null),[o,a]=A.useState(!1),[l,c]=A.useState(!1),[u,h]=A.useState(null),[d,f]=A.useState(null),[p,g]=A.useState(0),[b,m]=A.useState({status:"idle",message:""}),O=Ae(z=>z.setConnectionId),w=Ae(z=>z.setSseStatus),k=Ae(z=>z.startAssistantMessage),x=Ae(z=>z.appendDelta),S=Ae(z=>z.finishAssistant),T=Ae(z=>z.markCancelled),P=Ae(z=>z.applyActivity),Q=Ae(z=>z.dropInterruptedBubble),E=Ae(z=>z.markQueuedBackend),M=Ae(z=>z.advanceQueuedSession),L=Ae(z=>z.receiveQueueAdvance);A.useEffect(()=>{e(!1),a(!1),h(null),f(null),s(null),O(null);let z=!1;const $=new Map,Z=new Map,I=new Map,D=pa.onStatusChange(F=>{z||w(F)}),C=pa.on(F=>{if(z)return;const W=F.type!=="connected"&&F.type!=="status"?F.sessionKey??"default":"default";if(F.type==="connected")O(F.connectionId),e(!0);else if(F.type==="delta"){const v=F.turnId??null,V=I.get(W)??null,se=v!==null&&v!==V;if(!$.get(W)||se){se&&M(W);const te=k(W);$.set(W,te),Z.set(W,te),v&&I.set(W,v)}x($.get(W),F.content,W)}else if(F.type==="message"){const v=F.turnId??null,V=I.get(W)??null,se=v!==null&&v!==V;if(!$.get(W)||se){se&&M(W);const te=k(W);$.set(W,te),Z.set(W,te),v&&I.set(W,v)}S($.get(W),F.content,W,F.route),$.set(W,null),I.set(W,null)}else if(F.type==="queued"){const v=F.sessionKey??"default";F.msgId&&E(F.msgId,F.position,v)}else if(F.type==="queue-advance")L(F.sessionKey??"default",F.length);else if(F.type==="cancelled")T(W),$.set(W,null);else if(F.type==="turn-interrupted"){const v=F.sessionKey??"default";Q(v),$.set(v,null),I.set(v,null)}else if(F.type==="status")m({status:F.status,message:F.message});else if(F.type==="activity"){const v=F.agentSlug!==void 0;let V=$.get(W)??null;!V&&v&&Z.get(W)&&(V=Z.get(W)),V||(V=k(W),$.set(W,V),Z.set(W,V));const{type:se,sessionKey:te,turnId:q,...Pe}=F;P(V,Pe,W)}});return(async()=>{let F=!1;try{const W=await Jg();if(z)return;F=W.entraAuthEnabled,r(W.entraAuthEnabled);const v=await em();if(z)return;if(h(null),s(v.user),v.authEnabled&&!v.isAuthenticated){a(!0);return}await pa.open()}catch(W){if(z)return;const v=W instanceof Error?W.message:String(W);if(e(!1),O(null),F){h(v),a(!0);return}f(v)}})(),()=>{z=!0,D(),C(),pa.close()}},[p,O,w,k,x,S,T,Q,P,E,M,L]);async function H(){c(!0),h(null);try{await Uq()}catch(z){h(z instanceof Error?z.message:String(z))}finally{c(!1)}}async function Y(){c(!0),e(!1),m({status:"idle",message:""}),pa.close();try{await Zq()}finally{c(!1),a(!0),s(null),O(null)}}return d?y.jsxs("div",{className:"page-shell",children:[y.jsx(kn,{title:"Couldn't connect to Chapterhouse",message:"The frontend couldn't reach the local daemon. Retry once the service is available.",onRetry:()=>g(z=>z+1)}),y.jsx("pre",{className:"error-details",children:d}),y.jsxs("p",{className:"dim",children:["Make sure the daemon is running: ",y.jsx("code",{children:"chapterhouse start"}),"."]})]}):n&&o?y.jsx("div",{className:"auth-screen",children:y.jsxs("div",{className:"auth-card",role:"region","aria-labelledby":"auth-title",children:[y.jsx("h1",{id:"auth-title",children:"Sign in to Chapterhouse"}),y.jsx("p",{children:"Use your Microsoft account to open the Chapterhouse workspace."}),u?y.jsx(kn,{inline:!0,message:u,onRetry:()=>void H()}):null,l?y.jsx(xn,{inline:!0,label:"Opening Microsoft sign-in",detail:"Finish the sign-in flow in the popup or redirected tab."}):null,y.jsx("button",{type:"button",className:"btn primary",onClick:()=>void H(),disabled:l,"aria-busy":l,children:l?"Opening sign-in…":"Sign in with Microsoft"})]})}):y.jsxs(y.Fragment,{children:[y.jsx("a",{className:"skip-link",href:"#main-content",children:"Skip to main content"}),y.jsxs("div",{className:"layout",children:[y.jsx(qq,{}),y.jsxs("main",{id:"main-content",className:"main",tabIndex:-1,children:[y.jsxs("header",{className:"app-header",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"app-header-title-row",children:[y.jsx("h1",{className:"app-header-title",children:"Chapterhouse"}),y.jsx("span",{className:`mode-badge ${n?"mode-team":"mode-standalone"}`,children:n?"Team":"Standalone"}),y.jsx(fG,{})]}),n&&i?y.jsxs("div",{className:"app-header-user",children:["Signed in as ",i.name]}):null]}),n&&i?y.jsx("button",{type:"button",className:"btn",onClick:()=>void Y(),disabled:l,children:"Sign out"}):null]}),t?y.jsx(JU,{context:{systemStatus:b}}):y.jsx(xn,{centered:!0,label:"Connecting to Chapterhouse",detail:"Starting the live session and syncing the workspace state."})]})]})]})}class gG extends A.Component{constructor(){super(...arguments);ze(this,"state",{error:null});ze(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("Chapterhouse frontend error",n,r)}render(){return this.state.error?y.jsxs("div",{className:"page-shell",children:[y.jsx(kn,{title:"Something went wrong in the interface",message:"Chapterhouse hit an unexpected UI error. You can reset this screen or reload the app.",onRetry:this.reset,retryLabel:"Reset screen",children:y.jsx("button",{type:"button",className:"btn primary",onClick:()=>window.location.reload(),children:"Reload app"})}),y.jsx("pre",{className:"error-details",children:this.state.error.message})]}):this.props.children}}function Ws({title:t,description:e,icon:n,action:r,role:i="status",className:s}){return y.jsxs("div",{className:`empty-state${s?` ${s}`:""}`,role:i,children:[n?y.jsx("div",{className:"empty-state-icon","aria-hidden":"true",children:n}):null,y.jsx("h2",{children:t}),e?y.jsx("p",{children:e}):null,r?y.jsx("div",{className:"empty-state-action",children:r}):null]})}const mG={wash:"🔧",kaylee:"⚙️",mal:"🚀",jayne:"💪",zoe:"⚔️",ripley:"🔬",simon:"🩺",inara:"✨",book:"📖"};function OG(t){return mG[t.toLowerCase()]??"🤖"}function yG(t){const e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return`${n}:${String(r).padStart(2,"0")}`}function bG({part:t}){const[e,n]=A.useState(()=>Date.now());A.useEffect(()=>{const o=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(o)},[]);const r=e-t.startedAt,i=e-t.lastUpdate>6e4,s=OG(t.agentSlug);return y.jsxs("div",{className:`activity-heartbeat${i?" stale":""}`,"aria-live":"polite","aria-atomic":"true",title:i?"No recent activity — agent may have finished":void 0,children:[y.jsx("span",{className:"heartbeat-spinner","aria-hidden":"true",children:i?"⏸":"◌"}),y.jsxs("span",{className:"heartbeat-agent",children:[s," ",t.agentName]}),y.jsx("span",{className:"heartbeat-sep","aria-hidden":"true",children:"·"}),y.jsx("span",{className:"heartbeat-action",children:t.currentAction}),y.jsx("span",{className:"heartbeat-sep","aria-hidden":"true",children:"·"}),y.jsx("time",{className:"heartbeat-elapsed",dateTime:`PT${Math.floor(r/1e3)}S`,children:yG(r)})]})}function x$(t){return t==="running"?"◌":t==="failed"?"✕":"✓"}function wG(t){return!t||t<0?"":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function SG({parts:t}){const[e,n]=A.useState(!1),[r,i]=A.useState(!1),s=A.useId(),o=A.useId(),a=t.filter(d=>d.type==="thinking"),l=t.filter(d=>d.type==="tool-call"),c=t.filter(d=>d.type==="subagent");if(a.length===0&&l.length===0&&c.length===0)return null;const u=a.some(d=>d.active),h=l.some(d=>d.status==="running")||c.some(d=>d.status==="running");return y.jsxs("div",{className:"activity-strip",children:[y.jsxs("div",{className:"activity-summary",children:[a.length>0&&y.jsxs("button",{type:"button",className:"activity-pill"+(u?" running":""),onClick:()=>n(d=>!d),"aria-expanded":e,"aria-controls":s,title:"Show or hide reasoning",children:[y.jsx("span",{className:"glyph",children:u?"◌":"✓"}),y.jsx("span",{children:u?"Thinking…":"Thought"}),y.jsx("span",{className:"caret",children:e?"▾":"▸"})]}),(l.length>0||c.length>0)&&y.jsxs("button",{type:"button",className:"activity-pill"+(h?" running":""),onClick:()=>i(d=>!d),"aria-expanded":r,"aria-controls":o,title:"Show or hide tool calls",children:[y.jsx("span",{className:"glyph",children:h?"◌":"🔧"}),y.jsx("span",{children:h?"Working…":`${l.length+c.length} ${l.length+c.length===1?"step":"steps"}`}),y.jsx("span",{className:"caret",children:r?"▾":"▸"})]})]}),e&&a.length>0&&y.jsx("div",{id:s,className:"activity-thinking",children:a.map(d=>y.jsx("pre",{className:"thinking-block",children:d.text||"…"},d.reasoningId))}),r&&(l.length>0||c.length>0)&&y.jsx("div",{id:o,className:"activity-details",children:[...l,...c].map(d=>d.type==="tool-call"?y.jsx(kG,{item:d},d.toolCallId):y.jsx(vG,{item:d},d.toolCallId))})]})}function kG({item:t}){const[e,n]=A.useState(!1),r=A.useId(),i=t.arguments?JSON.stringify(t.arguments,null,2):"";return y.jsxs("div",{className:"activity-row status-"+t.status,children:[y.jsxs("button",{type:"button",className:"activity-row-head",onClick:()=>n(s=>!s),"aria-expanded":e,"aria-controls":r,children:[y.jsx("span",{className:"glyph",children:x$(t.status)}),t.agentSlug&&y.jsxs("span",{className:"agent-tag",children:["@",t.agentSlug]}),y.jsx("code",{children:t.toolName}),t.mcpServerName&&y.jsxs("span",{className:"dim small",children:[" · ",t.mcpServerName]}),y.jsx("span",{className:"caret",children:e?"▾":"▸"})]}),e&&y.jsxs("div",{id:r,className:"activity-row-body",children:[i&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Arguments"}),y.jsx("pre",{className:"thinking-block",children:i})]}),t.detailedContent&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Result"}),y.jsx("pre",{className:"thinking-block",children:t.detailedContent})]}),!t.detailedContent&&t.resultPreview&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Result"}),y.jsx("pre",{className:"thinking-block",children:t.resultPreview})]})]})]})}function vG({item:t}){const[e,n]=A.useState(!1),r=A.useId();return y.jsxs("div",{className:"activity-row status-"+t.status,children:[y.jsxs("button",{type:"button",className:"activity-row-head",onClick:()=>n(i=>!i),"aria-expanded":e,"aria-controls":r,children:[y.jsx("span",{className:"glyph",children:x$(t.status)}),y.jsxs("span",{children:["@",t.agentName]}),t.durationMs?y.jsxs("span",{className:"dim small",children:[" · ",wG(t.durationMs)]}):null,y.jsx("span",{className:"caret",children:e?"▾":"▸"})]}),e&&y.jsxs("div",{id:r,className:"activity-row-body",children:[y.jsx("div",{className:"row-label",children:t.agentDisplayName}),t.agentDescription&&y.jsx("p",{className:"dim small",children:t.agentDescription}),t.error&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Error"}),y.jsx("pre",{className:"thinking-block",children:t.error})]})]})]})}function xG(){return y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[y.jsx("rect",{x:"9",y:"2",width:"6",height:"4",rx:"1"}),y.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"})]})}function CG(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:y.jsx("polyline",{points:"20 6 9 17 4 12"})})}function C$({text:t,label:e="Copy",className:n=""}){const[r,i]=A.useState(!1),s=A.useId(),o=A.useCallback(async()=>{try{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),1500)}catch{}},[t]);return y.jsxs(y.Fragment,{children:[y.jsx("button",{type:"button",onClick:()=>void o(),className:`copy-btn ${r?"copy-btn--copied":""} ${n}`.trim(),"aria-label":r?`${e} — copied!`:e,"aria-describedby":s,children:r?y.jsx(CG,{}):y.jsx(xG,{})}),y.jsx("span",{id:s,className:"sr-only","aria-live":"polite","aria-atomic":"true",children:r?"Copied to clipboard":""})]})}function EG(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _G=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AG={};function zC(t,e){return(AG.jsx?TG:_G).test(t)}const PG=/[ \t\n\f\r]/g;function IG(t){return typeof t=="object"?t.type==="text"?jC(t.value):!1:jC(t)}function jC(t){return t.replace(PG,"")===""}let _h=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};_h.prototype.normal={};_h.prototype.property={};_h.prototype.space=void 0;function E$(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new _h(n,r,e)}function jb(t){return t.toLowerCase()}class Zn{constructor(e,n){this.attribute=n,this.property=e}}Zn.prototype.attribute="";Zn.prototype.booleanish=!1;Zn.prototype.boolean=!1;Zn.prototype.commaOrSpaceSeparated=!1;Zn.prototype.commaSeparated=!1;Zn.prototype.defined=!1;Zn.prototype.mustUseProperty=!1;Zn.prototype.number=!1;Zn.prototype.overloadedBoolean=!1;Zn.prototype.property="";Zn.prototype.spaceSeparated=!1;Zn.prototype.space=void 0;let RG=0;const ve=na(),_t=na(),Bb=na(),J=na(),et=na(),tl=na(),Yn=na();function na(){return 2**++RG}const Ub=Object.freeze(Object.defineProperty({__proto__:null,boolean:ve,booleanish:_t,commaOrSpaceSeparated:Yn,commaSeparated:tl,number:J,overloadedBoolean:Bb,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),uO=Object.keys(Ub);class gv extends Zn{constructor(e,n,r,i){let s=-1;if(super(e,n),BC(this,"space",i),typeof r=="number")for(;++s<uO.length;){const o=uO[s];BC(this,uO[s],(r&Ub[o])===Ub[o])}}}gv.prototype.defined=!0;function BC(t,e,n){n&&(t[e]=n)}function Yl(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new gv(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[jb(r)]=r,n[jb(s.attribute)]=r}return new _h(e,n,t.space)}const _$=Yl({properties:{ariaActiveDescendant:null,ariaAtomic:_t,ariaAutoComplete:null,ariaBusy:_t,ariaChecked:_t,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:_t,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:_t,ariaFlowTo:et,ariaGrabbed:_t,ariaHasPopup:null,ariaHidden:_t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:J,ariaLive:null,ariaModal:_t,ariaMultiLine:_t,ariaMultiSelectable:_t,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:_t,ariaReadOnly:_t,ariaRelevant:null,ariaRequired:_t,ariaRoleDescription:et,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:_t,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function T$(t,e){return e in t?t[e]:e}function A$(t,e){return T$(t,e.toLowerCase())}const NG=Yl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tl,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:ve,allowPaymentRequest:ve,allowUserMedia:ve,alt:null,as:null,async:ve,autoCapitalize:null,autoComplete:et,autoFocus:ve,autoPlay:ve,blocking:et,capture:null,charSet:null,checked:ve,cite:null,className:et,cols:J,colSpan:null,content:null,contentEditable:_t,controls:ve,controlsList:et,coords:J|tl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ve,defer:ve,dir:null,dirName:null,disabled:ve,download:Bb,draggable:_t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ve,formTarget:null,headers:et,height:J,hidden:Bb,high:J,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:ve,inputMode:null,integrity:null,is:null,isMap:ve,itemId:null,itemProp:et,itemRef:et,itemScope:ve,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ve,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:ve,muted:ve,name:null,nonce:null,noModule:ve,noValidate:ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ve,optimum:J,pattern:null,ping:et,placeholder:null,playsInline:ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ve,referrerPolicy:null,rel:et,required:ve,reversed:ve,rows:J,rowSpan:J,sandbox:et,scope:null,scoped:ve,seamless:ve,selected:ve,shadowRootClonable:ve,shadowRootDelegatesFocus:ve,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:_t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:ve,useMap:null,value:_t,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ve,declare:ve,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:ve,noHref:ve,noShade:ve,noWrap:ve,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:_t,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ve,disableRemotePlayback:ve,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:A$}),$G=Yl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yn,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:tl,g2:tl,glyphName:tl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:Yn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yn,rev:Yn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yn,requiredFeatures:Yn,requiredFonts:Yn,requiredFormats:Yn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:Yn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yn,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:T$}),P$=Yl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),I$=Yl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:A$}),R$=Yl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),MG={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},QG=/[A-Z]/g,UC=/-[a-z]/g,LG=/^data[-\w.:]+$/i;function DG(t,e){const n=jb(e);let r=e,i=Zn;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&LG.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(UC,jG);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!UC.test(s)){let o=s.replace(QG,zG);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=gv}return new i(r,e)}function zG(t){return"-"+t.toLowerCase()}function jG(t){return t.charAt(1).toUpperCase()}const BG=E$([_$,NG,P$,I$,R$],"html"),mv=E$([_$,$G,P$,I$,R$],"svg");function UG(t){return t.join(" ").trim()}var Ov={},ZC=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ZG=/\n/g,FG=/^\s*/,XG=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,WG=/^:\s*/,VG=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,HG=/^[;\s]*/,YG=/^\s+|\s+$/g,qG=`
|
|
141
|
-
`,FC="/",XC="*",Oo="",GG="comment",KG="declaration";function JG(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(p){var g=p.match(ZG);g&&(n+=g.length);var b=p.lastIndexOf(qG);r=~b?p.length-b:r+p.length}function s(){var p={line:n,column:r};return function(g){return g.position=new o(p),c(),g}}function o(p){this.start=p,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(p){var g=new Error(e.source+":"+n+":"+r+": "+p);if(g.reason=p,g.filename=e.source,g.line=n,g.column=r,g.source=t,!e.silent)throw g}function l(p){var g=p.exec(t);if(g){var b=g[0];return i(b),t=t.slice(b.length),g}}function c(){l(FG)}function u(p){var g;for(p=p||[];g=h();)g!==!1&&p.push(g);return p}function h(){var p=s();if(!(FC!=t.charAt(0)||XC!=t.charAt(1))){for(var g=2;Oo!=t.charAt(g)&&(XC!=t.charAt(g)||FC!=t.charAt(g+1));)++g;if(g+=2,Oo===t.charAt(g-1))return a("End of comment missing");var b=t.slice(2,g-2);return r+=2,i(b),t=t.slice(g),r+=2,p({type:GG,comment:b})}}function d(){var p=s(),g=l(XG);if(g){if(h(),!l(WG))return a("property missing ':'");var b=l(VG),m=p({type:KG,property:WC(g[0].replace(ZC,Oo)),value:b?WC(b[0].replace(ZC,Oo)):Oo});return l(HG),m}}function f(){var p=[];u(p);for(var g;g=d();)g!==!1&&(p.push(g),u(p));return p}return c(),f()}function WC(t){return t?t.replace(YG,Oo):Oo}var e7=JG,t7=If&&If.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.default=r7;const n7=t7(e7);function r7(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,n7.default)(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?e(o,a,s):a&&(n=n||{},n[o]=a)}),n}var tm={};Object.defineProperty(tm,"__esModule",{value:!0});tm.camelCase=void 0;var i7=/^--[a-zA-Z0-9_-]+$/,s7=/-([a-z])/g,o7=/^[^-]+$/,a7=/^-(webkit|moz|ms|o|khtml)-/,l7=/^-(ms)-/,c7=function(t){return!t||o7.test(t)||i7.test(t)},u7=function(t,e){return e.toUpperCase()},VC=function(t,e){return"".concat(e,"-")},h7=function(t,e){return e===void 0&&(e={}),c7(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(l7,VC):t=t.replace(a7,VC),t.replace(s7,u7))};tm.camelCase=h7;var d7=If&&If.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},f7=d7(Ov),p7=tm;function Zb(t,e){var n={};return!t||typeof t!="string"||(0,f7.default)(t,function(r,i){r&&i&&(n[(0,p7.camelCase)(r,e)]=i)}),n}Zb.default=Zb;var g7=Zb;const m7=dg(g7),N$=$$("end"),yv=$$("start");function $$(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function O7(t){const e=yv(t),n=N$(t);if(e&&n)return{start:e,end:n}}function tu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?HC(t.position):"start"in t||"end"in t?HC(t):"line"in t||"column"in t?Fb(t):""}function Fb(t){return YC(t&&t.line)+":"+YC(t&&t.column)}function HC(t){return Fb(t&&t.start)+"-"+Fb(t&&t.end)}function YC(t){return t&&typeof t=="number"?t:1}class ln extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=tu(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ln.prototype.file="";ln.prototype.name="";ln.prototype.reason="";ln.prototype.message="";ln.prototype.stack="";ln.prototype.column=void 0;ln.prototype.line=void 0;ln.prototype.ancestors=void 0;ln.prototype.cause=void 0;ln.prototype.fatal=void 0;ln.prototype.place=void 0;ln.prototype.ruleId=void 0;ln.prototype.source=void 0;const bv={}.hasOwnProperty,y7=new Map,b7=/[A-Z]/g,w7=new Set(["table","tbody","thead","tfoot","tr"]),S7=new Set(["td","th"]),M$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function k7(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=P7(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=A7(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?mv:BG,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Q$(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function Q$(t,e,n){if(e.type==="element")return v7(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return x7(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return E7(t,e,n);if(e.type==="mdxjsEsm")return C7(t,e);if(e.type==="root")return _7(t,e,n);if(e.type==="text")return T7(t,e)}function v7(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=mv,t.schema=i),t.ancestors.push(e);const s=D$(t,e.tagName,!1),o=I7(t,e);let a=Sv(t,e);return w7.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!IG(l):!0})),L$(t,o,s,e),wv(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function x7(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Zu(t,e.position)}function C7(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Zu(t,e.position)}function E7(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=mv,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:D$(t,e.name,!0),o=R7(t,e),a=Sv(t,e);return L$(t,o,s,e),wv(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function _7(t,e,n){const r={};return wv(r,Sv(t,e)),t.create(e,t.Fragment,r,n)}function T7(t,e){return e.value}function L$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function wv(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function A7(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function P7(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=yv(r);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function I7(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&bv.call(e.properties,i)){const s=N7(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&S7.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function R7(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else Zu(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else Zu(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Sv(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:y7;for(;++r<e.children.length;){const s=e.children[r];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=Q$(t,s,o);a!==void 0&&n.push(a)}return n}function N7(t,e,n){const r=DG(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?EG(n):UG(n)),r.property==="style"){let i=typeof n=="object"?n:$7(t,String(n));return t.stylePropertyNameCase==="css"&&(i=M7(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?MG[r.property]||r.property:r.attribute,n]}}function $7(t,e){try{return m7(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new ln("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=M$+"#cannot-parse-style-attribute",i}}function D$(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=zC(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=zC(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return bv.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);Zu(t)}function Zu(t,e){const n=new ln("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=M$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function M7(t){const e={};let n;for(n in t)bv.call(t,n)&&(e[Q7(n)]=t[n]);return e}function Q7(t){let e=t.replace(b7,L7);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function L7(t){return"-"+t.toLowerCase()}const hO={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},D7={};function kv(t,e){const n=D7,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return z$(t,r,i)}function z$(t,e,n){if(z7(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return qC(t.children,e,n)}return Array.isArray(t)?qC(t,e,n):""}function qC(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=z$(t[i],e,n);return r.join("")}function z7(t){return!!(t&&typeof t=="object")}const GC=document.createElement("i");function vv(t){const e="&"+t+";";GC.innerHTML=e;const n=GC.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function ir(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function gr(t,e){return t.length>0?(ir(t,t.length,0,e),t):e}const KC={}.hasOwnProperty;function j$(t){const e={};let n=-1;for(;++n<t.length;)j7(e,t[n]);return e}function j7(t,e){let n;for(n in e){const i=(KC.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){KC.call(i,o)||(i[o]=[]);const a=s[o];B7(i[o],Array.isArray(a)?a:a?[a]:[])}}}function B7(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);ir(t,0,0,r)}function B$(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Xr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bn=oo(/[A-Za-z]/),sn=oo(/[\dA-Za-z]/),U7=oo(/[#-'*+\--9=?A-Z^-~]/);function Cp(t){return t!==null&&(t<32||t===127)}const Xb=oo(/\d/),Z7=oo(/[\dA-Fa-f]/),F7=oo(/[!-/:-@[-`{-~]/);function me(t){return t!==null&&t<-2}function Ke(t){return t!==null&&(t<0||t===32)}function Ee(t){return t===-2||t===-1||t===32}const nm=oo(new RegExp("\\p{P}|\\p{S}","u")),Wo=oo(/\s/);function oo(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function ql(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&sn(t.charCodeAt(n+1))&&sn(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ne(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ee(l)?(t.enter(n),a(l)):e(l)}function a(l){return Ee(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const X7={tokenize:W7};function W7(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Ne(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return me(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const V7={tokenize:H7},JC={tokenize:Y7};function H7(t){const e=this,n=[];let r=0,i,s,o;return a;function a(w){if(r<n.length){const k=n[r];return e.containerState=k[1],t.attempt(k[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&O();const k=e.events.length;let x=k,S;for(;x--;)if(e.events[x][0]==="exit"&&e.events[x][1].type==="chunkFlow"){S=e.events[x][1].end;break}m(r);let T=k;for(;T<e.events.length;)e.events[T][1].end={...S},T++;return ir(e.events,x+1,0,e.events.slice(k)),e.events.length=T,c(w)}return a(w)}function c(w){if(r===n.length){if(!i)return d(w);if(i.currentConstruct&&i.currentConstruct.concrete)return p(w);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(JC,u,h)(w)}function u(w){return i&&O(),m(r),d(w)}function h(w){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,p(w)}function d(w){return e.containerState={},t.attempt(JC,f,p)(w)}function f(w){return r++,n.push([e.currentConstruct,e.containerState]),d(w)}function p(w){if(w===null){i&&O(),m(0),t.consume(w);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(w)}function g(w){if(w===null){b(t.exit("chunkFlow"),!0),m(0),t.consume(w);return}return me(w)?(t.consume(w),b(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(w),g)}function b(w,k){const x=e.sliceStream(w);if(k&&x.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(x),e.parser.lazy[w.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<o&&(!i.events[S][1].end||i.events[S][1].end.offset>o))return;const T=e.events.length;let P=T,Q,E;for(;P--;)if(e.events[P][0]==="exit"&&e.events[P][1].type==="chunkFlow"){if(Q){E=e.events[P][1].end;break}Q=!0}for(m(r),S=T;S<e.events.length;)e.events[S][1].end={...E},S++;ir(e.events,P+1,0,e.events.slice(T)),e.events.length=S}}function m(w){let k=n.length;for(;k-- >w;){const x=n[k];e.containerState=x[1],x[0].exit.call(e,t)}n.length=w}function O(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Y7(t,e,n){return Ne(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vl(t){if(t===null||Ke(t)||Wo(t))return 1;if(nm(t))return 2}function rm(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Wb={name:"attention",resolveAll:q7,tokenize:G7};function q7(t,e){let n=-1,r,i,s,o,a,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},d={...t[n][1].start};eE(h,-l),eE(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:d},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=gr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=gr(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=gr(c,rm(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=gr(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=gr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,ir(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function G7(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=vl(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),u=vl(l),h=!u||u===2&&i||n.includes(l),d=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?h:h&&(i||!d)),c._close=!!(s===42?d:d&&(u||!h)),e(l)}}function eE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const K7={name:"autolink",tokenize:J7};function J7(t,e,n){let r=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return bn(f)?(t.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||sn(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),r=0,l):(f===43||f===45||f===46||sn(f))&&r++<32?(t.consume(f),a):(r=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Cp(f)?n(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):U7(f)?(t.consume(f),c):n(f)}function u(f){return sn(f)?h(f):n(f)}function h(f){return f===46?(t.consume(f),r=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):d(f)}function d(f){if((f===45||sn(f))&&r++<63){const p=f===45?d:h;return t.consume(f),p}return n(f)}}const Th={partial:!0,tokenize:e8};function e8(t,e,n){return r;function r(s){return Ee(s)?Ne(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||me(s)?e(s):n(s)}}const U$={continuation:{tokenize:n8},exit:r8,name:"blockQuote",tokenize:t8};function t8(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ee(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function n8(t,e,n){const r=this;return i;function i(o){return Ee(o)?Ne(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(U$,e,n)(o)}}function r8(t){t.exit("blockQuote")}const Z$={name:"characterEscape",tokenize:i8};function i8(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return F7(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const F$={name:"characterReference",tokenize:s8};function s8(t,e,n){const r=this;let i=0,s,o;return a;function a(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),l}function l(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=sn,u(h))}function c(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=Z7,u):(t.enter("characterReferenceValue"),s=7,o=Xb,u(h))}function u(h){if(h===59&&i){const d=t.exit("characterReferenceValue");return o===sn&&!vv(r.sliceSerialize(d))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&i++<s?(t.consume(h),u):n(h)}}const tE={partial:!0,tokenize:a8},nE={concrete:!0,name:"codeFenced",tokenize:o8};function o8(t,e,n){const r=this,i={partial:!0,tokenize:x};let s=0,o=0,a;return l;function l(S){return c(S)}function c(S){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=S,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(S)}function u(S){return S===a?(o++,t.consume(S),u):o<3?n(S):(t.exit("codeFencedFenceSequence"),Ee(S)?Ne(t,h,"whitespace")(S):h(S))}function h(S){return S===null||me(S)?(t.exit("codeFencedFence"),r.interrupt?e(S):t.check(tE,g,k)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(S))}function d(S){return S===null||me(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(S)):Ee(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ne(t,f,"whitespace")(S)):S===96&&S===a?n(S):(t.consume(S),d)}function f(S){return S===null||me(S)?h(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||me(S)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(S)):S===96&&S===a?n(S):(t.consume(S),p)}function g(S){return t.attempt(i,k,b)(S)}function b(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),m}function m(S){return s>0&&Ee(S)?Ne(t,O,"linePrefix",s+1)(S):O(S)}function O(S){return S===null||me(S)?t.check(tE,g,k)(S):(t.enter("codeFlowValue"),w(S))}function w(S){return S===null||me(S)?(t.exit("codeFlowValue"),O(S)):(t.consume(S),w)}function k(S){return t.exit("codeFenced"),e(S)}function x(S,T,P){let Q=0;return E;function E(z){return S.enter("lineEnding"),S.consume(z),S.exit("lineEnding"),M}function M(z){return S.enter("codeFencedFence"),Ee(z)?Ne(S,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):L(z)}function L(z){return z===a?(S.enter("codeFencedFenceSequence"),H(z)):P(z)}function H(z){return z===a?(Q++,S.consume(z),H):Q>=o?(S.exit("codeFencedFenceSequence"),Ee(z)?Ne(S,Y,"whitespace")(z):Y(z)):P(z)}function Y(z){return z===null||me(z)?(S.exit("codeFencedFence"),T(z)):P(z)}}}function a8(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const dO={name:"codeIndented",tokenize:c8},l8={partial:!0,tokenize:u8};function c8(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Ne(t,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):me(c)?t.attempt(l8,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||me(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function u8(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):me(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Ne(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):me(o)?i(o):n(o)}}const h8={name:"codeText",previous:f8,resolve:d8,tokenize:p8};function d8(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function f8(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function p8(t,e,n){let r=0,i,s;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),a(h)}function a(h){return h===96?(t.consume(h),r++,a):(t.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),l):h===96?(s=t.enter("codeTextSequence"),i=0,u(h)):me(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||me(h)?(t.exit("codeTextData"),l(h)):(t.consume(h),c)}function u(h){return h===96?(t.consume(h),i++,u):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",c(h))}}class g8{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Sc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Sc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Sc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Sc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Sc(this.left,n.reverse())}}}function Sc(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function X$(t){const e={};let n=-1,r,i,s,o,a,l,c;const u=new g8(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,m8(u,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return ir(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function m8(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,h,d=-1,f=n,p=0,g=0;const b=[g];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),h&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++d<a.length;)a[d][0]==="exit"&&a[d-1][0]==="enter"&&a[d][1].type===a[d-1][1].type&&a[d][1].start.line!==a[d][1].end.line&&(g=d+1,b.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):b.pop(),d=b.length;d--;){const m=a.slice(b[d],b[d+1]),O=s.pop();l.push([O,O+m.length-1]),t.splice(O,2,m)}for(l.reverse(),d=-1;++d<l.length;)c[p+l[d][0]]=p+l[d][1],p+=l[d][1]-l[d][0]-1;return c}const O8={resolve:b8,tokenize:w8},y8={partial:!0,tokenize:S8};function b8(t){return X$(t),t}function w8(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):me(a)?t.check(y8,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function S8(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Ne(t,s,"linePrefix")}function s(o){if(o===null||me(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function W$(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return h;function h(m){return m===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(m),t.exit(s),d):m===null||m===32||m===41||Cp(m)?n(m):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(m))}function d(m){return m===62?(t.enter(s),t.consume(m),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===62?(t.exit("chunkString"),t.exit(a),d(m)):m===null||m===60||me(m)?n(m):(t.consume(m),m===92?p:f)}function p(m){return m===60||m===62||m===92?(t.consume(m),f):f(m)}function g(m){return!u&&(m===null||m===41||Ke(m))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(m)):u<c&&m===40?(t.consume(m),u++,g):m===41?(t.consume(m),u--,g):m===null||m===32||m===40||Cp(m)?n(m):(t.consume(m),m===92?b:g)}function b(m){return m===40||m===41||m===92?(t.consume(m),g):g(m)}}function V$(t,e,n,r,i,s){const o=this;let a=0,l;return c;function c(f){return t.enter(r),t.enter(i),t.consume(f),t.exit(i),t.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):me(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||me(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!Ee(f)),f===92?d:h)}function d(f){return f===91||f===92||f===93?(t.consume(f),a++,h):h(f)}}function H$(t,e,n,r,i,s){let o;return a;function a(d){return d===34||d===39||d===40?(t.enter(r),t.enter(i),t.consume(d),t.exit(i),o=d===40?41:d,l):n(d)}function l(d){return d===o?(t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):(t.enter(s),c(d))}function c(d){return d===o?(t.exit(s),l(o)):d===null?n(d):me(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Ne(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(d))}function u(d){return d===o||d===null||me(d)?(t.exit("chunkString"),c(d)):(t.consume(d),d===92?h:u)}function h(d){return d===o||d===92?(t.consume(d),u):u(d)}}function nu(t,e){let n;return r;function r(i){return me(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ee(i)?Ne(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const k8={name:"definition",tokenize:x8},v8={partial:!0,tokenize:C8};function x8(t,e,n){const r=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return V$.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Xr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):n(f)}function l(f){return Ke(f)?nu(t,c)(f):c(f)}function c(f){return W$(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(v8,h,h)(f)}function h(f){return Ee(f)?Ne(t,d,"whitespace")(f):d(f)}function d(f){return f===null||me(f)?(t.exit("definition"),r.parser.defined.push(i),e(f)):n(f)}}function C8(t,e,n){return r;function r(a){return Ke(a)?nu(t,i)(a):n(a)}function i(a){return H$(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ee(a)?Ne(t,o,"whitespace")(a):o(a)}function o(a){return a===null||me(a)?e(a):n(a)}}const E8={name:"hardBreakEscape",tokenize:_8};function _8(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return me(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const T8={name:"headingAtx",resolve:A8,tokenize:P8};function A8(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ir(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function P8(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||Ke(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||me(u)?(t.exit("atxHeading"),e(u)):Ee(u)?Ne(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Ke(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const I8=["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","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],rE=["pre","script","style","textarea"],R8={concrete:!0,name:"htmlFlow",resolveTo:M8,tokenize:Q8},N8={partial:!0,tokenize:D8},$8={partial:!0,tokenize:L8};function M8(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Q8(t,e,n){const r=this;let i,s,o,a,l;return c;function c(v){return u(v)}function u(v){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(v),h}function h(v){return v===33?(t.consume(v),d):v===47?(t.consume(v),s=!0,g):v===63?(t.consume(v),i=3,r.interrupt?e:C):bn(v)?(t.consume(v),o=String.fromCharCode(v),b):n(v)}function d(v){return v===45?(t.consume(v),i=2,f):v===91?(t.consume(v),i=5,a=0,p):bn(v)?(t.consume(v),i=4,r.interrupt?e:C):n(v)}function f(v){return v===45?(t.consume(v),r.interrupt?e:C):n(v)}function p(v){const V="CDATA[";return v===V.charCodeAt(a++)?(t.consume(v),a===V.length?r.interrupt?e:L:p):n(v)}function g(v){return bn(v)?(t.consume(v),o=String.fromCharCode(v),b):n(v)}function b(v){if(v===null||v===47||v===62||Ke(v)){const V=v===47,se=o.toLowerCase();return!V&&!s&&rE.includes(se)?(i=1,r.interrupt?e(v):L(v)):I8.includes(o.toLowerCase())?(i=6,V?(t.consume(v),m):r.interrupt?e(v):L(v)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(v):s?O(v):w(v))}return v===45||sn(v)?(t.consume(v),o+=String.fromCharCode(v),b):n(v)}function m(v){return v===62?(t.consume(v),r.interrupt?e:L):n(v)}function O(v){return Ee(v)?(t.consume(v),O):E(v)}function w(v){return v===47?(t.consume(v),E):v===58||v===95||bn(v)?(t.consume(v),k):Ee(v)?(t.consume(v),w):E(v)}function k(v){return v===45||v===46||v===58||v===95||sn(v)?(t.consume(v),k):x(v)}function x(v){return v===61?(t.consume(v),S):Ee(v)?(t.consume(v),x):w(v)}function S(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(t.consume(v),l=v,T):Ee(v)?(t.consume(v),S):P(v)}function T(v){return v===l?(t.consume(v),l=null,Q):v===null||me(v)?n(v):(t.consume(v),T)}function P(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||Ke(v)?x(v):(t.consume(v),P)}function Q(v){return v===47||v===62||Ee(v)?w(v):n(v)}function E(v){return v===62?(t.consume(v),M):n(v)}function M(v){return v===null||me(v)?L(v):Ee(v)?(t.consume(v),M):n(v)}function L(v){return v===45&&i===2?(t.consume(v),$):v===60&&i===1?(t.consume(v),Z):v===62&&i===4?(t.consume(v),F):v===63&&i===3?(t.consume(v),C):v===93&&i===5?(t.consume(v),D):me(v)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(N8,W,H)(v)):v===null||me(v)?(t.exit("htmlFlowData"),H(v)):(t.consume(v),L)}function H(v){return t.check($8,Y,W)(v)}function Y(v){return t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),z}function z(v){return v===null||me(v)?H(v):(t.enter("htmlFlowData"),L(v))}function $(v){return v===45?(t.consume(v),C):L(v)}function Z(v){return v===47?(t.consume(v),o="",I):L(v)}function I(v){if(v===62){const V=o.toLowerCase();return rE.includes(V)?(t.consume(v),F):L(v)}return bn(v)&&o.length<8?(t.consume(v),o+=String.fromCharCode(v),I):L(v)}function D(v){return v===93?(t.consume(v),C):L(v)}function C(v){return v===62?(t.consume(v),F):v===45&&i===2?(t.consume(v),C):L(v)}function F(v){return v===null||me(v)?(t.exit("htmlFlowData"),W(v)):(t.consume(v),F)}function W(v){return t.exit("htmlFlow"),e(v)}}function L8(t,e,n){const r=this;return i;function i(o){return me(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function D8(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Th,e,n)}}const z8={name:"htmlText",tokenize:j8};function j8(t,e,n){const r=this;let i,s,o;return a;function a(C){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(C),l}function l(C){return C===33?(t.consume(C),c):C===47?(t.consume(C),x):C===63?(t.consume(C),w):bn(C)?(t.consume(C),P):n(C)}function c(C){return C===45?(t.consume(C),u):C===91?(t.consume(C),s=0,p):bn(C)?(t.consume(C),O):n(C)}function u(C){return C===45?(t.consume(C),f):n(C)}function h(C){return C===null?n(C):C===45?(t.consume(C),d):me(C)?(o=h,Z(C)):(t.consume(C),h)}function d(C){return C===45?(t.consume(C),f):h(C)}function f(C){return C===62?$(C):C===45?d(C):h(C)}function p(C){const F="CDATA[";return C===F.charCodeAt(s++)?(t.consume(C),s===F.length?g:p):n(C)}function g(C){return C===null?n(C):C===93?(t.consume(C),b):me(C)?(o=g,Z(C)):(t.consume(C),g)}function b(C){return C===93?(t.consume(C),m):g(C)}function m(C){return C===62?$(C):C===93?(t.consume(C),m):g(C)}function O(C){return C===null||C===62?$(C):me(C)?(o=O,Z(C)):(t.consume(C),O)}function w(C){return C===null?n(C):C===63?(t.consume(C),k):me(C)?(o=w,Z(C)):(t.consume(C),w)}function k(C){return C===62?$(C):w(C)}function x(C){return bn(C)?(t.consume(C),S):n(C)}function S(C){return C===45||sn(C)?(t.consume(C),S):T(C)}function T(C){return me(C)?(o=T,Z(C)):Ee(C)?(t.consume(C),T):$(C)}function P(C){return C===45||sn(C)?(t.consume(C),P):C===47||C===62||Ke(C)?Q(C):n(C)}function Q(C){return C===47?(t.consume(C),$):C===58||C===95||bn(C)?(t.consume(C),E):me(C)?(o=Q,Z(C)):Ee(C)?(t.consume(C),Q):$(C)}function E(C){return C===45||C===46||C===58||C===95||sn(C)?(t.consume(C),E):M(C)}function M(C){return C===61?(t.consume(C),L):me(C)?(o=M,Z(C)):Ee(C)?(t.consume(C),M):Q(C)}function L(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),i=C,H):me(C)?(o=L,Z(C)):Ee(C)?(t.consume(C),L):(t.consume(C),Y)}function H(C){return C===i?(t.consume(C),i=void 0,z):C===null?n(C):me(C)?(o=H,Z(C)):(t.consume(C),H)}function Y(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Ke(C)?Q(C):(t.consume(C),Y)}function z(C){return C===47||C===62||Ke(C)?Q(C):n(C)}function $(C){return C===62?(t.consume(C),t.exit("htmlTextData"),t.exit("htmlText"),e):n(C)}function Z(C){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),I}function I(C){return Ee(C)?Ne(t,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):D(C)}function D(C){return t.enter("htmlTextData"),o(C)}}const xv={name:"labelEnd",resolveAll:F8,resolveTo:X8,tokenize:W8},B8={tokenize:V8},U8={tokenize:H8},Z8={tokenize:Y8};function F8(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&ir(t,0,t.length,n),t}function X8(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=gr(a,t.slice(s+1,s+r+3)),a=gr(a,[["enter",u,e]]),a=gr(a,rm(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=gr(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=gr(a,t.slice(o+1)),a=gr(a,[["exit",l,e]]),ir(t,s,t.length,a),t}function W8(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(d){return s?s._inactive?h(d):(o=r.parser.defined.includes(Xr(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(d),t.exit("labelMarker"),t.exit("labelEnd"),l):n(d)}function l(d){return d===40?t.attempt(B8,u,o?u:h)(d):d===91?t.attempt(U8,u,o?c:h)(d):o?u(d):h(d)}function c(d){return t.attempt(Z8,u,h)(d)}function u(d){return e(d)}function h(d){return s._balanced=!0,n(d)}}function V8(t,e,n){return r;function r(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),i}function i(h){return Ke(h)?nu(t,s)(h):s(h)}function s(h){return h===41?u(h):W$(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Ke(h)?nu(t,l)(h):u(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?H$(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):u(h)}function c(h){return Ke(h)?nu(t,u)(h):u(h)}function u(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):n(h)}}function H8(t,e,n){const r=this;return i;function i(a){return V$.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Xr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function Y8(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const q8={name:"labelStartImage",resolveAll:xv.resolveAll,tokenize:G8};function G8(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const K8={name:"labelStartLink",resolveAll:xv.resolveAll,tokenize:J8};function J8(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const fO={name:"lineEnding",tokenize:eK};function eK(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ne(t,e,"linePrefix")}}const Of={name:"thematicBreak",tokenize:tK};function tK(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||me(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Ee(c)?Ne(t,a,"whitespace")(c):a(c))}}const _n={continuation:{tokenize:sK},exit:aK,name:"list",tokenize:iK},nK={partial:!0,tokenize:lK},rK={partial:!0,tokenize:oK};function iK(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const p=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Xb(f)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Of,n,c)(f):c(f);if(!r.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return n(f)}function l(f){return Xb(f)&&++o<10?(t.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):n(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,t.check(Th,r.interrupt?n:u,t.attempt(nK,d,h))}function u(f){return r.containerState.initialBlankLine=!0,s++,d(f)}function h(f){return Ee(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),d):n(f)}function d(f){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function sK(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Th,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ee(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(rK,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(t,t.attempt(_n,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function oK(t,e,n){const r=this;return Ne(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function aK(t){t.exit(this.containerState.type)}function lK(t,e,n){const r=this;return Ne(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ee(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const iE={name:"setextUnderline",resolveTo:cK,tokenize:uK};function cK(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function uK(t,e,n){const r=this;let i;return s;function s(c){let u=r.events.length,h;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){h=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Ee(c)?Ne(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||me(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const hK={tokenize:dK};function dK(t){const e=this,n=t.attempt(Th,r,t.attempt(this.parser.constructs.flowInitial,i,Ne(t,t.attempt(this.parser.constructs.flow,i,t.attempt(O8,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const fK={resolveAll:q$()},pK=Y$("string"),gK=Y$("text");function Y$(t){return{resolveAll:q$(t==="text"?mK:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const h=i[u];let d=-1;if(h)for(;++d<h.length;){const f=h[d];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function q$(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function mK(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const OK={42:_n,43:_n,45:_n,48:_n,49:_n,50:_n,51:_n,52:_n,53:_n,54:_n,55:_n,56:_n,57:_n,62:U$},yK={91:k8},bK={[-2]:dO,[-1]:dO,32:dO},wK={35:T8,42:Of,45:[iE,Of],60:R8,61:iE,95:Of,96:nE,126:nE},SK={38:F$,92:Z$},kK={[-5]:fO,[-4]:fO,[-3]:fO,33:q8,38:F$,42:Wb,60:[K7,z8],91:K8,92:[E8,Z$],93:xv,95:Wb,96:h8},vK={null:[Wb,fK]},xK={null:[42,95]},CK={null:[]},EK=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xK,contentInitial:yK,disable:CK,document:OK,flow:wK,flowInitial:bK,insideSpan:vK,string:SK,text:kK},Symbol.toStringTag,{value:"Module"}));function _K(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(x),check:T(S),consume:O,enter:w,exit:k,interrupt:T(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:t,previous:null,sliceSerialize:d,sliceStream:f,write:h};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(M){return o=gr(o,M),b(),o[o.length-1]!==null?[]:(P(e,0),c.events=rm(s,c.events,c),c.events)}function d(M,L){return AK(f(M),L)}function f(M){return TK(o,M)}function p(){const{_bufferIndex:M,_index:L,line:H,column:Y,offset:z}=r;return{_bufferIndex:M,_index:L,line:H,column:Y,offset:z}}function g(M){i[M.line]=M.column,E()}function b(){let M;for(;r._index<o.length;){const L=o[r._index];if(typeof L=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<L.length;)m(L.charCodeAt(r._bufferIndex));else m(L)}}function m(M){u=u(M)}function O(M){me(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,E()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=M}function w(M,L){const H=L||{};return H.type=M,H.start=p(),c.events.push(["enter",H,c]),a.push(H),H}function k(M){const L=a.pop();return L.end=p(),c.events.push(["exit",L,c]),L}function x(M,L){P(M,L.from)}function S(M,L){L.restore()}function T(M,L){return H;function H(Y,z,$){let Z,I,D,C;return Array.isArray(Y)?W(Y):"tokenize"in Y?W([Y]):F(Y);function F(te){return q;function q(Pe){const Fe=Pe!==null&&te[Pe],Ot=Pe!==null&&te.null,Lt=[...Array.isArray(Fe)?Fe:Fe?[Fe]:[],...Array.isArray(Ot)?Ot:Ot?[Ot]:[]];return W(Lt)(Pe)}}function W(te){return Z=te,I=0,te.length===0?$:v(te[I])}function v(te){return q;function q(Pe){return C=Q(),D=te,te.partial||(c.currentConstruct=te),te.name&&c.parser.constructs.disable.null.includes(te.name)?se():te.tokenize.call(L?Object.assign(Object.create(c),L):c,l,V,se)(Pe)}}function V(te){return M(D,C),z}function se(te){return C.restore(),++I<Z.length?v(Z[I]):$}}}function P(M,L){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&ir(c.events,L,c.events.length-L,M.resolve(c.events.slice(L),c)),M.resolveTo&&(c.events=M.resolveTo(c.events,c))}function Q(){const M=p(),L=c.previous,H=c.currentConstruct,Y=c.events.length,z=Array.from(a);return{from:Y,restore:$};function $(){r=M,c.previous=L,c.currentConstruct=H,c.events.length=Y,a=z,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function TK(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function AK(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
140
|
+
`);for(const u of c.frames)this.handleFrame(u,()=>{l||(l=!0,n())})}finally{s.releaseLock()}}handleFrame(e,n){if(e.event!=="message"&&e.event!=="status")return;let r;try{r=JSON.parse(e.data)}catch{return}const i=bq.safeParse(r);if(!i.success){console.error("[stream] SSE frame failed schema validation:",i.error.format(),r);return}const s=i.data;s.type==="connected"&&(this.connectionId=s.connectionId,n());for(const o of this.listeners)o(s)}close(){var e,n;this.closedByUser=!0,(e=this.controller)==null||e.abort(),(n=this.reconnectController)==null||n.abort(),this.controller=null,this.connectionId=null}getConnectionId(){return this.connectionId}getStatus(){return this.connectionStatus}onStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}reconnectNow(){var e;this.reconnectAttempt=0,(e=this.reconnectController)==null||e.abort(),!this.streamTask&&!this.closedByUser&&this.open()}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}}const pa=new dG;function fG(){const t=Ae(e=>e.sseStatus);return t==="connected"||t==="idle"?null:t==="reconnecting"?y.jsxs("span",{className:"sse-badge sse-badge--reconnecting",role:"status","aria-live":"polite",children:[y.jsx("span",{className:"sse-badge__dot","aria-hidden":"true"}),"Reconnecting…"]}):y.jsxs("span",{className:"sse-badge sse-badge--disconnected",role:"status","aria-live":"assertive",children:[y.jsx("span",{className:"sse-badge__dot","aria-hidden":"true"}),"Disconnected",y.jsx("button",{type:"button",className:"sse-badge__reconnect-btn",onClick:()=>pa.reconnectNow(),children:"Reconnect now"})]})}function pG(){const[t,e]=A.useState(!1),[n,r]=A.useState(!1),[i,s]=A.useState(null),[o,a]=A.useState(!1),[l,c]=A.useState(!1),[u,h]=A.useState(null),[d,f]=A.useState(null),[p,g]=A.useState(0),[b,m]=A.useState({status:"idle",message:""}),O=Ae(z=>z.setConnectionId),w=Ae(z=>z.setSseStatus),k=Ae(z=>z.startAssistantMessage),x=Ae(z=>z.appendDelta),S=Ae(z=>z.finishAssistant),T=Ae(z=>z.markCancelled),P=Ae(z=>z.applyActivity),Q=Ae(z=>z.dropInterruptedBubble),E=Ae(z=>z.markQueuedBackend),M=Ae(z=>z.advanceQueuedSession),L=Ae(z=>z.receiveQueueAdvance);A.useEffect(()=>{e(!1),a(!1),h(null),f(null),s(null),O(null);let z=!1;const $=new Map,Z=new Map,I=new Map,D=pa.onStatusChange(F=>{z||w(F)}),C=pa.on(F=>{if(z)return;const W=F.type!=="connected"&&F.type!=="status"?F.sessionKey??"default":"default";if(F.type==="connected")O(F.connectionId),e(!0);else if(F.type==="delta"){const v=F.turnId??null,V=I.get(W)??null,ie=v!==null&&v!==V;if(!$.get(W)||ie){ie&&M(W);const te=k(W);$.set(W,te),Z.set(W,te),v&&I.set(W,v)}x($.get(W),F.content,W)}else if(F.type==="message"){const v=F.turnId??null,V=I.get(W)??null,ie=v!==null&&v!==V;if(!$.get(W)||ie){ie&&M(W);const te=k(W);$.set(W,te),Z.set(W,te),v&&I.set(W,v)}S($.get(W),F.content,W,F.route),$.set(W,null),I.set(W,null)}else if(F.type==="queued"){const v=F.sessionKey??"default";F.msgId&&E(F.msgId,F.position,v)}else if(F.type==="queue-advance")L(F.sessionKey??"default",F.length);else if(F.type==="cancelled")T(W),$.set(W,null);else if(F.type==="turn-interrupted"){const v=F.sessionKey??"default";Q(v),$.set(v,null),I.set(v,null)}else if(F.type==="status")m({status:F.status,message:F.message});else if(F.type==="activity"){const v=F.agentSlug!==void 0;let V=$.get(W)??null;!V&&v&&Z.get(W)&&(V=Z.get(W)),V||(V=k(W),$.set(W,V),Z.set(W,V));const{type:ie,sessionKey:te,turnId:q,...Pe}=F;P(V,Pe,W)}});return(async()=>{let F=!1;try{const W=await Jg();if(z)return;F=W.entraAuthEnabled,r(W.entraAuthEnabled);const v=await em();if(z)return;if(h(null),s(v.user),v.authEnabled&&!v.isAuthenticated){a(!0);return}await pa.open()}catch(W){if(z)return;const v=W instanceof Error?W.message:String(W);if(e(!1),O(null),F){h(v),a(!0);return}f(v)}})(),()=>{z=!0,D(),C(),pa.close()}},[p,O,w,k,x,S,T,Q,P,E,M,L]);async function H(){c(!0),h(null);try{await Uq()}catch(z){h(z instanceof Error?z.message:String(z))}finally{c(!1)}}async function Y(){c(!0),e(!1),m({status:"idle",message:""}),pa.close();try{await Zq()}finally{c(!1),a(!0),s(null),O(null)}}return d?y.jsxs("div",{className:"page-shell",children:[y.jsx(kn,{title:"Couldn't connect to Chapterhouse",message:"The frontend couldn't reach the local daemon. Retry once the service is available.",onRetry:()=>g(z=>z+1)}),y.jsx("pre",{className:"error-details",children:d}),y.jsxs("p",{className:"dim",children:["Make sure the daemon is running: ",y.jsx("code",{children:"chapterhouse start"}),"."]})]}):n&&o?y.jsx("div",{className:"auth-screen",children:y.jsxs("div",{className:"auth-card",role:"region","aria-labelledby":"auth-title",children:[y.jsx("h1",{id:"auth-title",children:"Sign in to Chapterhouse"}),y.jsx("p",{children:"Use your Microsoft account to open the Chapterhouse workspace."}),u?y.jsx(kn,{inline:!0,message:u,onRetry:()=>void H()}):null,l?y.jsx(xn,{inline:!0,label:"Opening Microsoft sign-in",detail:"Finish the sign-in flow in the popup or redirected tab."}):null,y.jsx("button",{type:"button",className:"btn primary",onClick:()=>void H(),disabled:l,"aria-busy":l,children:l?"Opening sign-in…":"Sign in with Microsoft"})]})}):y.jsxs(y.Fragment,{children:[y.jsx("a",{className:"skip-link",href:"#main-content",children:"Skip to main content"}),y.jsxs("div",{className:"layout",children:[y.jsx(qq,{}),y.jsxs("main",{id:"main-content",className:"main",tabIndex:-1,children:[y.jsxs("header",{className:"app-header",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"app-header-title-row",children:[y.jsx("h1",{className:"app-header-title",children:"Chapterhouse"}),y.jsx("span",{className:`mode-badge ${n?"mode-team":"mode-standalone"}`,children:n?"Team":"Standalone"}),y.jsx(fG,{})]}),n&&i?y.jsxs("div",{className:"app-header-user",children:["Signed in as ",i.name]}):null]}),n&&i?y.jsx("button",{type:"button",className:"btn",onClick:()=>void Y(),disabled:l,children:"Sign out"}):null]}),t?y.jsx(JU,{context:{systemStatus:b}}):y.jsx(xn,{centered:!0,label:"Connecting to Chapterhouse",detail:"Starting the live session and syncing the workspace state."})]})]})]})}class gG extends A.Component{constructor(){super(...arguments);ze(this,"state",{error:null});ze(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("Chapterhouse frontend error",n,r)}render(){return this.state.error?y.jsxs("div",{className:"page-shell",children:[y.jsx(kn,{title:"Something went wrong in the interface",message:"Chapterhouse hit an unexpected UI error. You can reset this screen or reload the app.",onRetry:this.reset,retryLabel:"Reset screen",children:y.jsx("button",{type:"button",className:"btn primary",onClick:()=>window.location.reload(),children:"Reload app"})}),y.jsx("pre",{className:"error-details",children:this.state.error.message})]}):this.props.children}}function Ws({title:t,description:e,icon:n,action:r,role:i="status",className:s}){return y.jsxs("div",{className:`empty-state${s?` ${s}`:""}`,role:i,children:[n?y.jsx("div",{className:"empty-state-icon","aria-hidden":"true",children:n}):null,y.jsx("h2",{children:t}),e?y.jsx("p",{children:e}):null,r?y.jsx("div",{className:"empty-state-action",children:r}):null]})}const mG={wash:"🔧",kaylee:"⚙️",mal:"🚀",jayne:"💪",zoe:"⚔️",ripley:"🔬",simon:"🩺",inara:"✨",book:"📖"};function OG(t){return mG[t.toLowerCase()]??"🤖"}function yG(t){const e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return`${n}:${String(r).padStart(2,"0")}`}function bG({part:t}){const[e,n]=A.useState(()=>Date.now());A.useEffect(()=>{const o=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(o)},[]);const r=e-t.startedAt,i=e-t.lastUpdate>6e4,s=OG(t.agentSlug);return y.jsxs("div",{className:`activity-heartbeat${i?" stale":""}`,"aria-live":"polite","aria-atomic":"true",title:i?"No recent activity — agent may have finished":void 0,children:[y.jsx("span",{className:"heartbeat-spinner","aria-hidden":"true",children:i?"⏸":"◌"}),y.jsxs("span",{className:"heartbeat-agent",children:[s," ",t.agentName]}),y.jsx("span",{className:"heartbeat-sep","aria-hidden":"true",children:"·"}),y.jsx("span",{className:"heartbeat-action",children:t.currentAction}),y.jsx("span",{className:"heartbeat-sep","aria-hidden":"true",children:"·"}),y.jsx("time",{className:"heartbeat-elapsed",dateTime:`PT${Math.floor(r/1e3)}S`,children:yG(r)})]})}function x$(t){return t==="running"?"◌":t==="failed"?"✕":"✓"}function wG(t){return!t||t<0?"":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function SG({parts:t}){const[e,n]=A.useState(!1),[r,i]=A.useState(!1),s=A.useId(),o=A.useId(),a=t.filter(d=>d.type==="thinking"),l=t.filter(d=>d.type==="tool-call"),c=t.filter(d=>d.type==="subagent");if(a.length===0&&l.length===0&&c.length===0)return null;const u=a.some(d=>d.active),h=l.some(d=>d.status==="running")||c.some(d=>d.status==="running");return y.jsxs("div",{className:"activity-strip",children:[y.jsxs("div",{className:"activity-summary",children:[a.length>0&&y.jsxs("button",{type:"button",className:"activity-pill"+(u?" running":""),onClick:()=>n(d=>!d),"aria-expanded":e,"aria-controls":s,title:"Show or hide reasoning",children:[y.jsx("span",{className:"glyph",children:u?"◌":"✓"}),y.jsx("span",{children:u?"Thinking…":"Thought"}),y.jsx("span",{className:"caret",children:e?"▾":"▸"})]}),(l.length>0||c.length>0)&&y.jsxs("button",{type:"button",className:"activity-pill"+(h?" running":""),onClick:()=>i(d=>!d),"aria-expanded":r,"aria-controls":o,title:"Show or hide tool calls",children:[y.jsx("span",{className:"glyph",children:h?"◌":"🔧"}),y.jsx("span",{children:h?"Working…":`${l.length+c.length} ${l.length+c.length===1?"step":"steps"}`}),y.jsx("span",{className:"caret",children:r?"▾":"▸"})]})]}),e&&a.length>0&&y.jsx("div",{id:s,className:"activity-thinking",children:a.map(d=>y.jsx("pre",{className:"thinking-block",children:d.text||"…"},d.reasoningId))}),r&&(l.length>0||c.length>0)&&y.jsx("div",{id:o,className:"activity-details",children:[...l,...c].map(d=>d.type==="tool-call"?y.jsx(kG,{item:d},d.toolCallId):y.jsx(vG,{item:d},d.toolCallId))})]})}function kG({item:t}){const[e,n]=A.useState(!1),r=A.useId(),i=t.arguments?JSON.stringify(t.arguments,null,2):"";return y.jsxs("div",{className:"activity-row status-"+t.status,children:[y.jsxs("button",{type:"button",className:"activity-row-head",onClick:()=>n(s=>!s),"aria-expanded":e,"aria-controls":r,children:[y.jsx("span",{className:"glyph",children:x$(t.status)}),t.agentSlug&&y.jsxs("span",{className:"agent-tag",children:["@",t.agentSlug]}),y.jsx("code",{children:t.toolName}),t.mcpServerName&&y.jsxs("span",{className:"dim small",children:[" · ",t.mcpServerName]}),y.jsx("span",{className:"caret",children:e?"▾":"▸"})]}),e&&y.jsxs("div",{id:r,className:"activity-row-body",children:[i&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Arguments"}),y.jsx("pre",{className:"thinking-block",children:i})]}),t.detailedContent&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Result"}),y.jsx("pre",{className:"thinking-block",children:t.detailedContent})]}),!t.detailedContent&&t.resultPreview&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Result"}),y.jsx("pre",{className:"thinking-block",children:t.resultPreview})]})]})]})}function vG({item:t}){const[e,n]=A.useState(!1),r=A.useId();return y.jsxs("div",{className:"activity-row status-"+t.status,children:[y.jsxs("button",{type:"button",className:"activity-row-head",onClick:()=>n(i=>!i),"aria-expanded":e,"aria-controls":r,children:[y.jsx("span",{className:"glyph",children:x$(t.status)}),y.jsxs("span",{children:["@",t.agentName]}),t.durationMs?y.jsxs("span",{className:"dim small",children:[" · ",wG(t.durationMs)]}):null,y.jsx("span",{className:"caret",children:e?"▾":"▸"})]}),e&&y.jsxs("div",{id:r,className:"activity-row-body",children:[y.jsx("div",{className:"row-label",children:t.agentDisplayName}),t.agentDescription&&y.jsx("p",{className:"dim small",children:t.agentDescription}),t.error&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"row-label",children:"Error"}),y.jsx("pre",{className:"thinking-block",children:t.error})]})]})]})}function xG(){return y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[y.jsx("rect",{x:"9",y:"2",width:"6",height:"4",rx:"1"}),y.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"})]})}function CG(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:y.jsx("polyline",{points:"20 6 9 17 4 12"})})}function C$({text:t,label:e="Copy",className:n=""}){const[r,i]=A.useState(!1),s=A.useId(),o=A.useCallback(async()=>{try{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),1500)}catch{}},[t]);return y.jsxs(y.Fragment,{children:[y.jsx("button",{type:"button",onClick:()=>void o(),className:`copy-btn ${r?"copy-btn--copied":""} ${n}`.trim(),"aria-label":r?`${e} — copied!`:e,"aria-describedby":s,children:r?y.jsx(CG,{}):y.jsx(xG,{})}),y.jsx("span",{id:s,className:"sr-only","aria-live":"polite","aria-atomic":"true",children:r?"Copied to clipboard":""})]})}function EG(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _G=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AG={};function zC(t,e){return(AG.jsx?TG:_G).test(t)}const PG=/[ \t\n\f\r]/g;function IG(t){return typeof t=="object"?t.type==="text"?jC(t.value):!1:jC(t)}function jC(t){return t.replace(PG,"")===""}let _h=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};_h.prototype.normal={};_h.prototype.property={};_h.prototype.space=void 0;function E$(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new _h(n,r,e)}function jb(t){return t.toLowerCase()}class Zn{constructor(e,n){this.attribute=n,this.property=e}}Zn.prototype.attribute="";Zn.prototype.booleanish=!1;Zn.prototype.boolean=!1;Zn.prototype.commaOrSpaceSeparated=!1;Zn.prototype.commaSeparated=!1;Zn.prototype.defined=!1;Zn.prototype.mustUseProperty=!1;Zn.prototype.number=!1;Zn.prototype.overloadedBoolean=!1;Zn.prototype.property="";Zn.prototype.spaceSeparated=!1;Zn.prototype.space=void 0;let RG=0;const ve=na(),_t=na(),Bb=na(),J=na(),et=na(),tl=na(),Yn=na();function na(){return 2**++RG}const Ub=Object.freeze(Object.defineProperty({__proto__:null,boolean:ve,booleanish:_t,commaOrSpaceSeparated:Yn,commaSeparated:tl,number:J,overloadedBoolean:Bb,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),uO=Object.keys(Ub);class gv extends Zn{constructor(e,n,r,i){let s=-1;if(super(e,n),BC(this,"space",i),typeof r=="number")for(;++s<uO.length;){const o=uO[s];BC(this,uO[s],(r&Ub[o])===Ub[o])}}}gv.prototype.defined=!0;function BC(t,e,n){n&&(t[e]=n)}function Yl(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new gv(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[jb(r)]=r,n[jb(s.attribute)]=r}return new _h(e,n,t.space)}const _$=Yl({properties:{ariaActiveDescendant:null,ariaAtomic:_t,ariaAutoComplete:null,ariaBusy:_t,ariaChecked:_t,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:_t,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:_t,ariaFlowTo:et,ariaGrabbed:_t,ariaHasPopup:null,ariaHidden:_t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:J,ariaLive:null,ariaModal:_t,ariaMultiLine:_t,ariaMultiSelectable:_t,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:_t,ariaReadOnly:_t,ariaRelevant:null,ariaRequired:_t,ariaRoleDescription:et,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:_t,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function T$(t,e){return e in t?t[e]:e}function A$(t,e){return T$(t,e.toLowerCase())}const NG=Yl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tl,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:ve,allowPaymentRequest:ve,allowUserMedia:ve,alt:null,as:null,async:ve,autoCapitalize:null,autoComplete:et,autoFocus:ve,autoPlay:ve,blocking:et,capture:null,charSet:null,checked:ve,cite:null,className:et,cols:J,colSpan:null,content:null,contentEditable:_t,controls:ve,controlsList:et,coords:J|tl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ve,defer:ve,dir:null,dirName:null,disabled:ve,download:Bb,draggable:_t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ve,formTarget:null,headers:et,height:J,hidden:Bb,high:J,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:ve,inputMode:null,integrity:null,is:null,isMap:ve,itemId:null,itemProp:et,itemRef:et,itemScope:ve,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ve,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:ve,muted:ve,name:null,nonce:null,noModule:ve,noValidate:ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ve,optimum:J,pattern:null,ping:et,placeholder:null,playsInline:ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ve,referrerPolicy:null,rel:et,required:ve,reversed:ve,rows:J,rowSpan:J,sandbox:et,scope:null,scoped:ve,seamless:ve,selected:ve,shadowRootClonable:ve,shadowRootDelegatesFocus:ve,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:_t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:ve,useMap:null,value:_t,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ve,declare:ve,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:ve,noHref:ve,noShade:ve,noWrap:ve,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:_t,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ve,disableRemotePlayback:ve,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:A$}),$G=Yl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yn,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:tl,g2:tl,glyphName:tl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:Yn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yn,rev:Yn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yn,requiredFeatures:Yn,requiredFonts:Yn,requiredFormats:Yn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:Yn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yn,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:T$}),P$=Yl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),I$=Yl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:A$}),R$=Yl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),MG={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},QG=/[A-Z]/g,UC=/-[a-z]/g,LG=/^data[-\w.:]+$/i;function DG(t,e){const n=jb(e);let r=e,i=Zn;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&LG.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(UC,jG);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!UC.test(s)){let o=s.replace(QG,zG);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=gv}return new i(r,e)}function zG(t){return"-"+t.toLowerCase()}function jG(t){return t.charAt(1).toUpperCase()}const BG=E$([_$,NG,P$,I$,R$],"html"),mv=E$([_$,$G,P$,I$,R$],"svg");function UG(t){return t.join(" ").trim()}var Ov={},ZC=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ZG=/\n/g,FG=/^\s*/,XG=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,WG=/^:\s*/,VG=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,HG=/^[;\s]*/,YG=/^\s+|\s+$/g,qG=`
|
|
141
|
+
`,FC="/",XC="*",Oo="",GG="comment",KG="declaration";function JG(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(p){var g=p.match(ZG);g&&(n+=g.length);var b=p.lastIndexOf(qG);r=~b?p.length-b:r+p.length}function s(){var p={line:n,column:r};return function(g){return g.position=new o(p),c(),g}}function o(p){this.start=p,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(p){var g=new Error(e.source+":"+n+":"+r+": "+p);if(g.reason=p,g.filename=e.source,g.line=n,g.column=r,g.source=t,!e.silent)throw g}function l(p){var g=p.exec(t);if(g){var b=g[0];return i(b),t=t.slice(b.length),g}}function c(){l(FG)}function u(p){var g;for(p=p||[];g=h();)g!==!1&&p.push(g);return p}function h(){var p=s();if(!(FC!=t.charAt(0)||XC!=t.charAt(1))){for(var g=2;Oo!=t.charAt(g)&&(XC!=t.charAt(g)||FC!=t.charAt(g+1));)++g;if(g+=2,Oo===t.charAt(g-1))return a("End of comment missing");var b=t.slice(2,g-2);return r+=2,i(b),t=t.slice(g),r+=2,p({type:GG,comment:b})}}function d(){var p=s(),g=l(XG);if(g){if(h(),!l(WG))return a("property missing ':'");var b=l(VG),m=p({type:KG,property:WC(g[0].replace(ZC,Oo)),value:b?WC(b[0].replace(ZC,Oo)):Oo});return l(HG),m}}function f(){var p=[];u(p);for(var g;g=d();)g!==!1&&(p.push(g),u(p));return p}return c(),f()}function WC(t){return t?t.replace(YG,Oo):Oo}var e7=JG,t7=If&&If.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.default=r7;const n7=t7(e7);function r7(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,n7.default)(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?e(o,a,s):a&&(n=n||{},n[o]=a)}),n}var tm={};Object.defineProperty(tm,"__esModule",{value:!0});tm.camelCase=void 0;var i7=/^--[a-zA-Z0-9_-]+$/,s7=/-([a-z])/g,o7=/^[^-]+$/,a7=/^-(webkit|moz|ms|o|khtml)-/,l7=/^-(ms)-/,c7=function(t){return!t||o7.test(t)||i7.test(t)},u7=function(t,e){return e.toUpperCase()},VC=function(t,e){return"".concat(e,"-")},h7=function(t,e){return e===void 0&&(e={}),c7(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(l7,VC):t=t.replace(a7,VC),t.replace(s7,u7))};tm.camelCase=h7;var d7=If&&If.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},f7=d7(Ov),p7=tm;function Zb(t,e){var n={};return!t||typeof t!="string"||(0,f7.default)(t,function(r,i){r&&i&&(n[(0,p7.camelCase)(r,e)]=i)}),n}Zb.default=Zb;var g7=Zb;const m7=dg(g7),N$=$$("end"),yv=$$("start");function $$(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function O7(t){const e=yv(t),n=N$(t);if(e&&n)return{start:e,end:n}}function tu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?HC(t.position):"start"in t||"end"in t?HC(t):"line"in t||"column"in t?Fb(t):""}function Fb(t){return YC(t&&t.line)+":"+YC(t&&t.column)}function HC(t){return Fb(t&&t.start)+"-"+Fb(t&&t.end)}function YC(t){return t&&typeof t=="number"?t:1}class ln extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=tu(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ln.prototype.file="";ln.prototype.name="";ln.prototype.reason="";ln.prototype.message="";ln.prototype.stack="";ln.prototype.column=void 0;ln.prototype.line=void 0;ln.prototype.ancestors=void 0;ln.prototype.cause=void 0;ln.prototype.fatal=void 0;ln.prototype.place=void 0;ln.prototype.ruleId=void 0;ln.prototype.source=void 0;const bv={}.hasOwnProperty,y7=new Map,b7=/[A-Z]/g,w7=new Set(["table","tbody","thead","tfoot","tr"]),S7=new Set(["td","th"]),M$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function k7(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=P7(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=A7(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?mv:BG,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Q$(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function Q$(t,e,n){if(e.type==="element")return v7(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return x7(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return E7(t,e,n);if(e.type==="mdxjsEsm")return C7(t,e);if(e.type==="root")return _7(t,e,n);if(e.type==="text")return T7(t,e)}function v7(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=mv,t.schema=i),t.ancestors.push(e);const s=D$(t,e.tagName,!1),o=I7(t,e);let a=Sv(t,e);return w7.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!IG(l):!0})),L$(t,o,s,e),wv(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function x7(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Zu(t,e.position)}function C7(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Zu(t,e.position)}function E7(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=mv,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:D$(t,e.name,!0),o=R7(t,e),a=Sv(t,e);return L$(t,o,s,e),wv(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function _7(t,e,n){const r={};return wv(r,Sv(t,e)),t.create(e,t.Fragment,r,n)}function T7(t,e){return e.value}function L$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function wv(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function A7(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function P7(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=yv(r);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function I7(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&bv.call(e.properties,i)){const s=N7(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&S7.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function R7(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else Zu(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else Zu(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Sv(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:y7;for(;++r<e.children.length;){const s=e.children[r];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=Q$(t,s,o);a!==void 0&&n.push(a)}return n}function N7(t,e,n){const r=DG(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?EG(n):UG(n)),r.property==="style"){let i=typeof n=="object"?n:$7(t,String(n));return t.stylePropertyNameCase==="css"&&(i=M7(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?MG[r.property]||r.property:r.attribute,n]}}function $7(t,e){try{return m7(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new ln("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=M$+"#cannot-parse-style-attribute",i}}function D$(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=zC(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=zC(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return bv.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);Zu(t)}function Zu(t,e){const n=new ln("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=M$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function M7(t){const e={};let n;for(n in t)bv.call(t,n)&&(e[Q7(n)]=t[n]);return e}function Q7(t){let e=t.replace(b7,L7);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function L7(t){return"-"+t.toLowerCase()}const hO={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},D7={};function kv(t,e){const n=D7,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return z$(t,r,i)}function z$(t,e,n){if(z7(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return qC(t.children,e,n)}return Array.isArray(t)?qC(t,e,n):""}function qC(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=z$(t[i],e,n);return r.join("")}function z7(t){return!!(t&&typeof t=="object")}const GC=document.createElement("i");function vv(t){const e="&"+t+";";GC.innerHTML=e;const n=GC.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function ir(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function gr(t,e){return t.length>0?(ir(t,t.length,0,e),t):e}const KC={}.hasOwnProperty;function j$(t){const e={};let n=-1;for(;++n<t.length;)j7(e,t[n]);return e}function j7(t,e){let n;for(n in e){const i=(KC.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){KC.call(i,o)||(i[o]=[]);const a=s[o];B7(i[o],Array.isArray(a)?a:a?[a]:[])}}}function B7(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);ir(t,0,0,r)}function B$(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Xr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bn=oo(/[A-Za-z]/),sn=oo(/[\dA-Za-z]/),U7=oo(/[#-'*+\--9=?A-Z^-~]/);function Cp(t){return t!==null&&(t<32||t===127)}const Xb=oo(/\d/),Z7=oo(/[\dA-Fa-f]/),F7=oo(/[!-/:-@[-`{-~]/);function me(t){return t!==null&&t<-2}function Ke(t){return t!==null&&(t<0||t===32)}function Ee(t){return t===-2||t===-1||t===32}const nm=oo(new RegExp("\\p{P}|\\p{S}","u")),Wo=oo(/\s/);function oo(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function ql(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&sn(t.charCodeAt(n+1))&&sn(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ne(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ee(l)?(t.enter(n),a(l)):e(l)}function a(l){return Ee(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const X7={tokenize:W7};function W7(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Ne(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return me(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const V7={tokenize:H7},JC={tokenize:Y7};function H7(t){const e=this,n=[];let r=0,i,s,o;return a;function a(w){if(r<n.length){const k=n[r];return e.containerState=k[1],t.attempt(k[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&O();const k=e.events.length;let x=k,S;for(;x--;)if(e.events[x][0]==="exit"&&e.events[x][1].type==="chunkFlow"){S=e.events[x][1].end;break}m(r);let T=k;for(;T<e.events.length;)e.events[T][1].end={...S},T++;return ir(e.events,x+1,0,e.events.slice(k)),e.events.length=T,c(w)}return a(w)}function c(w){if(r===n.length){if(!i)return d(w);if(i.currentConstruct&&i.currentConstruct.concrete)return p(w);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(JC,u,h)(w)}function u(w){return i&&O(),m(r),d(w)}function h(w){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,p(w)}function d(w){return e.containerState={},t.attempt(JC,f,p)(w)}function f(w){return r++,n.push([e.currentConstruct,e.containerState]),d(w)}function p(w){if(w===null){i&&O(),m(0),t.consume(w);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(w)}function g(w){if(w===null){b(t.exit("chunkFlow"),!0),m(0),t.consume(w);return}return me(w)?(t.consume(w),b(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(w),g)}function b(w,k){const x=e.sliceStream(w);if(k&&x.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(x),e.parser.lazy[w.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<o&&(!i.events[S][1].end||i.events[S][1].end.offset>o))return;const T=e.events.length;let P=T,Q,E;for(;P--;)if(e.events[P][0]==="exit"&&e.events[P][1].type==="chunkFlow"){if(Q){E=e.events[P][1].end;break}Q=!0}for(m(r),S=T;S<e.events.length;)e.events[S][1].end={...E},S++;ir(e.events,P+1,0,e.events.slice(T)),e.events.length=S}}function m(w){let k=n.length;for(;k-- >w;){const x=n[k];e.containerState=x[1],x[0].exit.call(e,t)}n.length=w}function O(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Y7(t,e,n){return Ne(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vl(t){if(t===null||Ke(t)||Wo(t))return 1;if(nm(t))return 2}function rm(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Wb={name:"attention",resolveAll:q7,tokenize:G7};function q7(t,e){let n=-1,r,i,s,o,a,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},d={...t[n][1].start};eE(h,-l),eE(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:d},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=gr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=gr(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=gr(c,rm(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=gr(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=gr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,ir(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function G7(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=vl(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),u=vl(l),h=!u||u===2&&i||n.includes(l),d=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?h:h&&(i||!d)),c._close=!!(s===42?d:d&&(u||!h)),e(l)}}function eE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const K7={name:"autolink",tokenize:J7};function J7(t,e,n){let r=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return bn(f)?(t.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||sn(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),r=0,l):(f===43||f===45||f===46||sn(f))&&r++<32?(t.consume(f),a):(r=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Cp(f)?n(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):U7(f)?(t.consume(f),c):n(f)}function u(f){return sn(f)?h(f):n(f)}function h(f){return f===46?(t.consume(f),r=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):d(f)}function d(f){if((f===45||sn(f))&&r++<63){const p=f===45?d:h;return t.consume(f),p}return n(f)}}const Th={partial:!0,tokenize:e8};function e8(t,e,n){return r;function r(s){return Ee(s)?Ne(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||me(s)?e(s):n(s)}}const U$={continuation:{tokenize:n8},exit:r8,name:"blockQuote",tokenize:t8};function t8(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ee(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function n8(t,e,n){const r=this;return i;function i(o){return Ee(o)?Ne(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(U$,e,n)(o)}}function r8(t){t.exit("blockQuote")}const Z$={name:"characterEscape",tokenize:i8};function i8(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return F7(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const F$={name:"characterReference",tokenize:s8};function s8(t,e,n){const r=this;let i=0,s,o;return a;function a(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),l}function l(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=sn,u(h))}function c(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=Z7,u):(t.enter("characterReferenceValue"),s=7,o=Xb,u(h))}function u(h){if(h===59&&i){const d=t.exit("characterReferenceValue");return o===sn&&!vv(r.sliceSerialize(d))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&i++<s?(t.consume(h),u):n(h)}}const tE={partial:!0,tokenize:a8},nE={concrete:!0,name:"codeFenced",tokenize:o8};function o8(t,e,n){const r=this,i={partial:!0,tokenize:x};let s=0,o=0,a;return l;function l(S){return c(S)}function c(S){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=S,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(S)}function u(S){return S===a?(o++,t.consume(S),u):o<3?n(S):(t.exit("codeFencedFenceSequence"),Ee(S)?Ne(t,h,"whitespace")(S):h(S))}function h(S){return S===null||me(S)?(t.exit("codeFencedFence"),r.interrupt?e(S):t.check(tE,g,k)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),d(S))}function d(S){return S===null||me(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(S)):Ee(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ne(t,f,"whitespace")(S)):S===96&&S===a?n(S):(t.consume(S),d)}function f(S){return S===null||me(S)?h(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||me(S)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(S)):S===96&&S===a?n(S):(t.consume(S),p)}function g(S){return t.attempt(i,k,b)(S)}function b(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),m}function m(S){return s>0&&Ee(S)?Ne(t,O,"linePrefix",s+1)(S):O(S)}function O(S){return S===null||me(S)?t.check(tE,g,k)(S):(t.enter("codeFlowValue"),w(S))}function w(S){return S===null||me(S)?(t.exit("codeFlowValue"),O(S)):(t.consume(S),w)}function k(S){return t.exit("codeFenced"),e(S)}function x(S,T,P){let Q=0;return E;function E(z){return S.enter("lineEnding"),S.consume(z),S.exit("lineEnding"),M}function M(z){return S.enter("codeFencedFence"),Ee(z)?Ne(S,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):L(z)}function L(z){return z===a?(S.enter("codeFencedFenceSequence"),H(z)):P(z)}function H(z){return z===a?(Q++,S.consume(z),H):Q>=o?(S.exit("codeFencedFenceSequence"),Ee(z)?Ne(S,Y,"whitespace")(z):Y(z)):P(z)}function Y(z){return z===null||me(z)?(S.exit("codeFencedFence"),T(z)):P(z)}}}function a8(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const dO={name:"codeIndented",tokenize:c8},l8={partial:!0,tokenize:u8};function c8(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Ne(t,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):me(c)?t.attempt(l8,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||me(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function u8(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):me(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Ne(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):me(o)?i(o):n(o)}}const h8={name:"codeText",previous:f8,resolve:d8,tokenize:p8};function d8(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function f8(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function p8(t,e,n){let r=0,i,s;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),a(h)}function a(h){return h===96?(t.consume(h),r++,a):(t.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),l):h===96?(s=t.enter("codeTextSequence"),i=0,u(h)):me(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||me(h)?(t.exit("codeTextData"),l(h)):(t.consume(h),c)}function u(h){return h===96?(t.consume(h),i++,u):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",c(h))}}class g8{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Sc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Sc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Sc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Sc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Sc(this.left,n.reverse())}}}function Sc(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function X$(t){const e={};let n=-1,r,i,s,o,a,l,c;const u=new g8(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,m8(u,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return ir(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function m8(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,h,d=-1,f=n,p=0,g=0;const b=[g];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),h&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++d<a.length;)a[d][0]==="exit"&&a[d-1][0]==="enter"&&a[d][1].type===a[d-1][1].type&&a[d][1].start.line!==a[d][1].end.line&&(g=d+1,b.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):b.pop(),d=b.length;d--;){const m=a.slice(b[d],b[d+1]),O=s.pop();l.push([O,O+m.length-1]),t.splice(O,2,m)}for(l.reverse(),d=-1;++d<l.length;)c[p+l[d][0]]=p+l[d][1],p+=l[d][1]-l[d][0]-1;return c}const O8={resolve:b8,tokenize:w8},y8={partial:!0,tokenize:S8};function b8(t){return X$(t),t}function w8(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):me(a)?t.check(y8,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function S8(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Ne(t,s,"linePrefix")}function s(o){if(o===null||me(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function W$(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return h;function h(m){return m===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(m),t.exit(s),d):m===null||m===32||m===41||Cp(m)?n(m):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(m))}function d(m){return m===62?(t.enter(s),t.consume(m),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===62?(t.exit("chunkString"),t.exit(a),d(m)):m===null||m===60||me(m)?n(m):(t.consume(m),m===92?p:f)}function p(m){return m===60||m===62||m===92?(t.consume(m),f):f(m)}function g(m){return!u&&(m===null||m===41||Ke(m))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(m)):u<c&&m===40?(t.consume(m),u++,g):m===41?(t.consume(m),u--,g):m===null||m===32||m===40||Cp(m)?n(m):(t.consume(m),m===92?b:g)}function b(m){return m===40||m===41||m===92?(t.consume(m),g):g(m)}}function V$(t,e,n,r,i,s){const o=this;let a=0,l;return c;function c(f){return t.enter(r),t.enter(i),t.consume(f),t.exit(i),t.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):me(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||me(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!Ee(f)),f===92?d:h)}function d(f){return f===91||f===92||f===93?(t.consume(f),a++,h):h(f)}}function H$(t,e,n,r,i,s){let o;return a;function a(d){return d===34||d===39||d===40?(t.enter(r),t.enter(i),t.consume(d),t.exit(i),o=d===40?41:d,l):n(d)}function l(d){return d===o?(t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):(t.enter(s),c(d))}function c(d){return d===o?(t.exit(s),l(o)):d===null?n(d):me(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Ne(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(d))}function u(d){return d===o||d===null||me(d)?(t.exit("chunkString"),c(d)):(t.consume(d),d===92?h:u)}function h(d){return d===o||d===92?(t.consume(d),u):u(d)}}function nu(t,e){let n;return r;function r(i){return me(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ee(i)?Ne(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const k8={name:"definition",tokenize:x8},v8={partial:!0,tokenize:C8};function x8(t,e,n){const r=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return V$.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Xr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):n(f)}function l(f){return Ke(f)?nu(t,c)(f):c(f)}function c(f){return W$(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(v8,h,h)(f)}function h(f){return Ee(f)?Ne(t,d,"whitespace")(f):d(f)}function d(f){return f===null||me(f)?(t.exit("definition"),r.parser.defined.push(i),e(f)):n(f)}}function C8(t,e,n){return r;function r(a){return Ke(a)?nu(t,i)(a):n(a)}function i(a){return H$(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ee(a)?Ne(t,o,"whitespace")(a):o(a)}function o(a){return a===null||me(a)?e(a):n(a)}}const E8={name:"hardBreakEscape",tokenize:_8};function _8(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return me(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const T8={name:"headingAtx",resolve:A8,tokenize:P8};function A8(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ir(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function P8(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||Ke(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||me(u)?(t.exit("atxHeading"),e(u)):Ee(u)?Ne(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Ke(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const I8=["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","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],rE=["pre","script","style","textarea"],R8={concrete:!0,name:"htmlFlow",resolveTo:M8,tokenize:Q8},N8={partial:!0,tokenize:D8},$8={partial:!0,tokenize:L8};function M8(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Q8(t,e,n){const r=this;let i,s,o,a,l;return c;function c(v){return u(v)}function u(v){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(v),h}function h(v){return v===33?(t.consume(v),d):v===47?(t.consume(v),s=!0,g):v===63?(t.consume(v),i=3,r.interrupt?e:C):bn(v)?(t.consume(v),o=String.fromCharCode(v),b):n(v)}function d(v){return v===45?(t.consume(v),i=2,f):v===91?(t.consume(v),i=5,a=0,p):bn(v)?(t.consume(v),i=4,r.interrupt?e:C):n(v)}function f(v){return v===45?(t.consume(v),r.interrupt?e:C):n(v)}function p(v){const V="CDATA[";return v===V.charCodeAt(a++)?(t.consume(v),a===V.length?r.interrupt?e:L:p):n(v)}function g(v){return bn(v)?(t.consume(v),o=String.fromCharCode(v),b):n(v)}function b(v){if(v===null||v===47||v===62||Ke(v)){const V=v===47,ie=o.toLowerCase();return!V&&!s&&rE.includes(ie)?(i=1,r.interrupt?e(v):L(v)):I8.includes(o.toLowerCase())?(i=6,V?(t.consume(v),m):r.interrupt?e(v):L(v)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(v):s?O(v):w(v))}return v===45||sn(v)?(t.consume(v),o+=String.fromCharCode(v),b):n(v)}function m(v){return v===62?(t.consume(v),r.interrupt?e:L):n(v)}function O(v){return Ee(v)?(t.consume(v),O):E(v)}function w(v){return v===47?(t.consume(v),E):v===58||v===95||bn(v)?(t.consume(v),k):Ee(v)?(t.consume(v),w):E(v)}function k(v){return v===45||v===46||v===58||v===95||sn(v)?(t.consume(v),k):x(v)}function x(v){return v===61?(t.consume(v),S):Ee(v)?(t.consume(v),x):w(v)}function S(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(t.consume(v),l=v,T):Ee(v)?(t.consume(v),S):P(v)}function T(v){return v===l?(t.consume(v),l=null,Q):v===null||me(v)?n(v):(t.consume(v),T)}function P(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||Ke(v)?x(v):(t.consume(v),P)}function Q(v){return v===47||v===62||Ee(v)?w(v):n(v)}function E(v){return v===62?(t.consume(v),M):n(v)}function M(v){return v===null||me(v)?L(v):Ee(v)?(t.consume(v),M):n(v)}function L(v){return v===45&&i===2?(t.consume(v),$):v===60&&i===1?(t.consume(v),Z):v===62&&i===4?(t.consume(v),F):v===63&&i===3?(t.consume(v),C):v===93&&i===5?(t.consume(v),D):me(v)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(N8,W,H)(v)):v===null||me(v)?(t.exit("htmlFlowData"),H(v)):(t.consume(v),L)}function H(v){return t.check($8,Y,W)(v)}function Y(v){return t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),z}function z(v){return v===null||me(v)?H(v):(t.enter("htmlFlowData"),L(v))}function $(v){return v===45?(t.consume(v),C):L(v)}function Z(v){return v===47?(t.consume(v),o="",I):L(v)}function I(v){if(v===62){const V=o.toLowerCase();return rE.includes(V)?(t.consume(v),F):L(v)}return bn(v)&&o.length<8?(t.consume(v),o+=String.fromCharCode(v),I):L(v)}function D(v){return v===93?(t.consume(v),C):L(v)}function C(v){return v===62?(t.consume(v),F):v===45&&i===2?(t.consume(v),C):L(v)}function F(v){return v===null||me(v)?(t.exit("htmlFlowData"),W(v)):(t.consume(v),F)}function W(v){return t.exit("htmlFlow"),e(v)}}function L8(t,e,n){const r=this;return i;function i(o){return me(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function D8(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Th,e,n)}}const z8={name:"htmlText",tokenize:j8};function j8(t,e,n){const r=this;let i,s,o;return a;function a(C){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(C),l}function l(C){return C===33?(t.consume(C),c):C===47?(t.consume(C),x):C===63?(t.consume(C),w):bn(C)?(t.consume(C),P):n(C)}function c(C){return C===45?(t.consume(C),u):C===91?(t.consume(C),s=0,p):bn(C)?(t.consume(C),O):n(C)}function u(C){return C===45?(t.consume(C),f):n(C)}function h(C){return C===null?n(C):C===45?(t.consume(C),d):me(C)?(o=h,Z(C)):(t.consume(C),h)}function d(C){return C===45?(t.consume(C),f):h(C)}function f(C){return C===62?$(C):C===45?d(C):h(C)}function p(C){const F="CDATA[";return C===F.charCodeAt(s++)?(t.consume(C),s===F.length?g:p):n(C)}function g(C){return C===null?n(C):C===93?(t.consume(C),b):me(C)?(o=g,Z(C)):(t.consume(C),g)}function b(C){return C===93?(t.consume(C),m):g(C)}function m(C){return C===62?$(C):C===93?(t.consume(C),m):g(C)}function O(C){return C===null||C===62?$(C):me(C)?(o=O,Z(C)):(t.consume(C),O)}function w(C){return C===null?n(C):C===63?(t.consume(C),k):me(C)?(o=w,Z(C)):(t.consume(C),w)}function k(C){return C===62?$(C):w(C)}function x(C){return bn(C)?(t.consume(C),S):n(C)}function S(C){return C===45||sn(C)?(t.consume(C),S):T(C)}function T(C){return me(C)?(o=T,Z(C)):Ee(C)?(t.consume(C),T):$(C)}function P(C){return C===45||sn(C)?(t.consume(C),P):C===47||C===62||Ke(C)?Q(C):n(C)}function Q(C){return C===47?(t.consume(C),$):C===58||C===95||bn(C)?(t.consume(C),E):me(C)?(o=Q,Z(C)):Ee(C)?(t.consume(C),Q):$(C)}function E(C){return C===45||C===46||C===58||C===95||sn(C)?(t.consume(C),E):M(C)}function M(C){return C===61?(t.consume(C),L):me(C)?(o=M,Z(C)):Ee(C)?(t.consume(C),M):Q(C)}function L(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),i=C,H):me(C)?(o=L,Z(C)):Ee(C)?(t.consume(C),L):(t.consume(C),Y)}function H(C){return C===i?(t.consume(C),i=void 0,z):C===null?n(C):me(C)?(o=H,Z(C)):(t.consume(C),H)}function Y(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Ke(C)?Q(C):(t.consume(C),Y)}function z(C){return C===47||C===62||Ke(C)?Q(C):n(C)}function $(C){return C===62?(t.consume(C),t.exit("htmlTextData"),t.exit("htmlText"),e):n(C)}function Z(C){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),I}function I(C){return Ee(C)?Ne(t,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):D(C)}function D(C){return t.enter("htmlTextData"),o(C)}}const xv={name:"labelEnd",resolveAll:F8,resolveTo:X8,tokenize:W8},B8={tokenize:V8},U8={tokenize:H8},Z8={tokenize:Y8};function F8(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&ir(t,0,t.length,n),t}function X8(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=gr(a,t.slice(s+1,s+r+3)),a=gr(a,[["enter",u,e]]),a=gr(a,rm(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=gr(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=gr(a,t.slice(o+1)),a=gr(a,[["exit",l,e]]),ir(t,s,t.length,a),t}function W8(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(d){return s?s._inactive?h(d):(o=r.parser.defined.includes(Xr(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(d),t.exit("labelMarker"),t.exit("labelEnd"),l):n(d)}function l(d){return d===40?t.attempt(B8,u,o?u:h)(d):d===91?t.attempt(U8,u,o?c:h)(d):o?u(d):h(d)}function c(d){return t.attempt(Z8,u,h)(d)}function u(d){return e(d)}function h(d){return s._balanced=!0,n(d)}}function V8(t,e,n){return r;function r(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),i}function i(h){return Ke(h)?nu(t,s)(h):s(h)}function s(h){return h===41?u(h):W$(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Ke(h)?nu(t,l)(h):u(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?H$(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):u(h)}function c(h){return Ke(h)?nu(t,u)(h):u(h)}function u(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):n(h)}}function H8(t,e,n){const r=this;return i;function i(a){return V$.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Xr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function Y8(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const q8={name:"labelStartImage",resolveAll:xv.resolveAll,tokenize:G8};function G8(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const K8={name:"labelStartLink",resolveAll:xv.resolveAll,tokenize:J8};function J8(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const fO={name:"lineEnding",tokenize:eK};function eK(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ne(t,e,"linePrefix")}}const Of={name:"thematicBreak",tokenize:tK};function tK(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||me(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Ee(c)?Ne(t,a,"whitespace")(c):a(c))}}const _n={continuation:{tokenize:sK},exit:aK,name:"list",tokenize:iK},nK={partial:!0,tokenize:lK},rK={partial:!0,tokenize:oK};function iK(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const p=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Xb(f)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Of,n,c)(f):c(f);if(!r.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return n(f)}function l(f){return Xb(f)&&++o<10?(t.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):n(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,t.check(Th,r.interrupt?n:u,t.attempt(nK,d,h))}function u(f){return r.containerState.initialBlankLine=!0,s++,d(f)}function h(f){return Ee(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),d):n(f)}function d(f){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function sK(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Th,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ee(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(rK,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(t,t.attempt(_n,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function oK(t,e,n){const r=this;return Ne(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function aK(t){t.exit(this.containerState.type)}function lK(t,e,n){const r=this;return Ne(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ee(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const iE={name:"setextUnderline",resolveTo:cK,tokenize:uK};function cK(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function uK(t,e,n){const r=this;let i;return s;function s(c){let u=r.events.length,h;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){h=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Ee(c)?Ne(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||me(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const hK={tokenize:dK};function dK(t){const e=this,n=t.attempt(Th,r,t.attempt(this.parser.constructs.flowInitial,i,Ne(t,t.attempt(this.parser.constructs.flow,i,t.attempt(O8,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const fK={resolveAll:q$()},pK=Y$("string"),gK=Y$("text");function Y$(t){return{resolveAll:q$(t==="text"?mK:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const h=i[u];let d=-1;if(h)for(;++d<h.length;){const f=h[d];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function q$(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function mK(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const OK={42:_n,43:_n,45:_n,48:_n,49:_n,50:_n,51:_n,52:_n,53:_n,54:_n,55:_n,56:_n,57:_n,62:U$},yK={91:k8},bK={[-2]:dO,[-1]:dO,32:dO},wK={35:T8,42:Of,45:[iE,Of],60:R8,61:iE,95:Of,96:nE,126:nE},SK={38:F$,92:Z$},kK={[-5]:fO,[-4]:fO,[-3]:fO,33:q8,38:F$,42:Wb,60:[K7,z8],91:K8,92:[E8,Z$],93:xv,95:Wb,96:h8},vK={null:[Wb,fK]},xK={null:[42,95]},CK={null:[]},EK=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xK,contentInitial:yK,disable:CK,document:OK,flow:wK,flowInitial:bK,insideSpan:vK,string:SK,text:kK},Symbol.toStringTag,{value:"Module"}));function _K(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(x),check:T(S),consume:O,enter:w,exit:k,interrupt:T(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:t,previous:null,sliceSerialize:d,sliceStream:f,write:h};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(M){return o=gr(o,M),b(),o[o.length-1]!==null?[]:(P(e,0),c.events=rm(s,c.events,c),c.events)}function d(M,L){return AK(f(M),L)}function f(M){return TK(o,M)}function p(){const{_bufferIndex:M,_index:L,line:H,column:Y,offset:z}=r;return{_bufferIndex:M,_index:L,line:H,column:Y,offset:z}}function g(M){i[M.line]=M.column,E()}function b(){let M;for(;r._index<o.length;){const L=o[r._index];if(typeof L=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<L.length;)m(L.charCodeAt(r._bufferIndex));else m(L)}}function m(M){u=u(M)}function O(M){me(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,E()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=M}function w(M,L){const H=L||{};return H.type=M,H.start=p(),c.events.push(["enter",H,c]),a.push(H),H}function k(M){const L=a.pop();return L.end=p(),c.events.push(["exit",L,c]),L}function x(M,L){P(M,L.from)}function S(M,L){L.restore()}function T(M,L){return H;function H(Y,z,$){let Z,I,D,C;return Array.isArray(Y)?W(Y):"tokenize"in Y?W([Y]):F(Y);function F(te){return q;function q(Pe){const Fe=Pe!==null&&te[Pe],Ot=Pe!==null&&te.null,Lt=[...Array.isArray(Fe)?Fe:Fe?[Fe]:[],...Array.isArray(Ot)?Ot:Ot?[Ot]:[]];return W(Lt)(Pe)}}function W(te){return Z=te,I=0,te.length===0?$:v(te[I])}function v(te){return q;function q(Pe){return C=Q(),D=te,te.partial||(c.currentConstruct=te),te.name&&c.parser.constructs.disable.null.includes(te.name)?ie():te.tokenize.call(L?Object.assign(Object.create(c),L):c,l,V,ie)(Pe)}}function V(te){return M(D,C),z}function ie(te){return C.restore(),++I<Z.length?v(Z[I]):$}}}function P(M,L){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&ir(c.events,L,c.events.length-L,M.resolve(c.events.slice(L),c)),M.resolveTo&&(c.events=M.resolveTo(c.events,c))}function Q(){const M=p(),L=c.previous,H=c.currentConstruct,Y=c.events.length,z=Array.from(a);return{from:Y,restore:$};function $(){r=M,c.previous=L,c.currentConstruct=H,c.events.length=Y,a=z,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function TK(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function AK(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
142
142
|
`;break}case-3:{o=`\r
|
|
143
|
-
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function PK(t){const r={constructs:j$([EK,...(t||{}).extensions||[]]),content:i(X7),defined:[],document:i(V7),flow:i(hK),lazy:{},string:i(pK),text:i(gK)};return r;function i(s){return o;function o(a){return _K(r,s,a)}}}function IK(t){for(;!X$(t););return t}const sE=/[\0\t\n\r]/g;function RK(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,h,d,f;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,e="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(sE.lastIndex=h,c=sE.exec(s),d=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(d),!c){e=s.slice(h);break}if(f===10&&h===d&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<d&&(l.push(s.slice(h,d)),t+=d-h),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}h=d+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const NK=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $K(t){return t.replace(NK,MK)}function MK(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return B$(n.slice(s?2:1),s?16:10)}return vv(n)||t}const G$={}.hasOwnProperty;function QK(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),LK(n)(IK(PK(n).document().write(RK()(t,e,!0))))}function LK(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(co),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:s(un),blockQuote:s(Ot),characterEscape:Q,characterReference:Q,codeFenced:s(Lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Lt,o),codeText:s(lo,o),codeTextData:Q,data:Q,codeFlowValue:Q,definition:s(Jr),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(sa),hardBreakEscape:s(Qe),hardBreakTrailing:s(Qe),htmlFlow:s(Ar,o),htmlFlowData:Q,htmlText:s(Ar,o),htmlTextData:Q,image:s(Oe),label:o,link:s(co),listItem:s(Xe),listItemValue:d,listOrdered:s(Et,h),listUnordered:s(Et),paragraph:s(oa),reference:v,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(un),strong:s(Ai),thematicBreak:s(oc)},exit:{atxHeading:l(),atxHeadingSequence:x,autolink:l(),autolinkEmail:Fe,autolinkProtocol:Pe,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:te,characterReference:q,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:E,codeIndented:l(m),codeText:l(z),codeTextData:E,data:E,definition:l(),definitionDestinationString:k,definitionLabelString:O,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(L),hardBreakTrailing:l(L),htmlFlow:l(H),htmlFlowData:E,htmlText:l(Y),htmlTextData:E,image:l(Z),label:D,labelText:I,lineEnding:M,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:V,resourceDestinationString:C,resourceTitleString:F,resource:W,setextHeading:l(P),setextHeadingLineSequence:T,setextHeadingText:S,strong:l(),thematicBreak:l()}};K$(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(R){let j={type:"root",children:[]};const ne={stack:[j],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:n},he=[];let ke=-1;for(;++ke<R.length;)if(R[ke][1].type==="listOrdered"||R[ke][1].type==="listUnordered")if(R[ke][0]==="enter")he.push(ke);else{const vt=he.pop();ke=i(R,vt,ke)}for(ke=-1;++ke<R.length;){const vt=e[R[ke][0]];G$.call(vt,R[ke][1].type)&&vt[R[ke][1].type].call(Object.assign({sliceSerialize:R[ke][2].sliceSerialize},ne),R[ke][1])}if(ne.tokenStack.length>0){const vt=ne.tokenStack[ne.tokenStack.length-1];(vt[1]||oE).call(ne,void 0,vt[0])}for(j.position={start:cs(R.length>0?R[0][1].start:{line:1,column:1,offset:0}),end:cs(R.length>0?R[R.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<e.transforms.length;)j=e.transforms[ke](j)||j;return j}function i(R,j,ne){let he=j-1,ke=-1,vt=!1,Pi,Pr,ac,lc;for(;++he<=ne;){const Fn=R[he];switch(Fn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Fn[0]==="enter"?ke++:ke--,lc=void 0;break}case"lineEndingBlank":{Fn[0]==="enter"&&(Pi&&!lc&&!ke&&!ac&&(ac=he),lc=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:lc=void 0}if(!ke&&Fn[0]==="enter"&&Fn[1].type==="listItemPrefix"||ke===-1&&Fn[0]==="exit"&&(Fn[1].type==="listUnordered"||Fn[1].type==="listOrdered")){if(Pi){let aa=he;for(Pr=void 0;aa--;){const Ii=R[aa];if(Ii[1].type==="lineEnding"||Ii[1].type==="lineEndingBlank"){if(Ii[0]==="exit")continue;Pr&&(R[Pr][1].type="lineEndingBlank",vt=!0),Ii[1].type="lineEnding",Pr=aa}else if(!(Ii[1].type==="linePrefix"||Ii[1].type==="blockQuotePrefix"||Ii[1].type==="blockQuotePrefixWhitespace"||Ii[1].type==="blockQuoteMarker"||Ii[1].type==="listItemIndent"))break}ac&&(!Pr||ac<Pr)&&(Pi._spread=!0),Pi.end=Object.assign({},Pr?R[Pr][1].start:Fn[1].end),R.splice(Pr||he,0,["exit",Pi,Fn[2]]),he++,ne++}if(Fn[1].type==="listItemPrefix"){const aa={type:"listItem",_spread:!1,start:Object.assign({},Fn[1].start),end:void 0};Pi=aa,R.splice(he,0,["enter",aa,Fn[2]]),he++,ne++,ac=void 0,lc=!0}}}return R[j][1]._spread=vt,ne}function s(R,j){return ne;function ne(he){a.call(this,R(he),he),j&&j.call(this,he)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(R,j,ne){this.stack[this.stack.length-1].children.push(R),this.stack.push(R),this.tokenStack.push([j,ne||void 0]),R.position={start:cs(j.start),end:void 0}}function l(R){return j;function j(ne){R&&R.call(this,ne),c.call(this,ne)}}function c(R,j){const ne=this.stack.pop(),he=this.tokenStack.pop();if(he)he[0].type!==R.type&&(j?j.call(this,R,he[0]):(he[1]||oE).call(this,R,he[0]));else throw new Error("Cannot close `"+R.type+"` ("+tu({start:R.start,end:R.end})+"): it’s not open");ne.position.end=cs(R.end)}function u(){return kv(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function d(R){if(this.data.expectingFirstListItemValue){const j=this.stack[this.stack.length-2];j.start=Number.parseInt(this.sliceSerialize(R),10),this.data.expectingFirstListItemValue=void 0}}function f(){const R=this.resume(),j=this.stack[this.stack.length-1];j.lang=R}function p(){const R=this.resume(),j=this.stack[this.stack.length-1];j.meta=R}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R.replace(/(\r?\n|\r)$/g,"")}function O(R){const j=this.resume(),ne=this.stack[this.stack.length-1];ne.label=j,ne.identifier=Xr(this.sliceSerialize(R)).toLowerCase()}function w(){const R=this.resume(),j=this.stack[this.stack.length-1];j.title=R}function k(){const R=this.resume(),j=this.stack[this.stack.length-1];j.url=R}function x(R){const j=this.stack[this.stack.length-1];if(!j.depth){const ne=this.sliceSerialize(R).length;j.depth=ne}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function T(R){const j=this.stack[this.stack.length-1];j.depth=this.sliceSerialize(R).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(R){const ne=this.stack[this.stack.length-1].children;let he=ne[ne.length-1];(!he||he.type!=="text")&&(he=sc(),he.position={start:cs(R.start),end:void 0},ne.push(he)),this.stack.push(he)}function E(R){const j=this.stack.pop();j.value+=this.sliceSerialize(R),j.position.end=cs(R.end)}function M(R){const j=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ne=j.children[j.children.length-1];ne.position.end=cs(R.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(j.type)&&(Q.call(this,R),E.call(this,R))}function L(){this.data.atHardBreak=!0}function H(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R}function Y(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R}function z(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R}function $(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const j=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=j,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function Z(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const j=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=j,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function I(R){const j=this.sliceSerialize(R),ne=this.stack[this.stack.length-2];ne.label=$K(j),ne.identifier=Xr(j).toLowerCase()}function D(){const R=this.stack[this.stack.length-1],j=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){const he=R.children;ne.children=he}else ne.alt=j}function C(){const R=this.resume(),j=this.stack[this.stack.length-1];j.url=R}function F(){const R=this.resume(),j=this.stack[this.stack.length-1];j.title=R}function W(){this.data.inReference=void 0}function v(){this.data.referenceType="collapsed"}function V(R){const j=this.resume(),ne=this.stack[this.stack.length-1];ne.label=j,ne.identifier=Xr(this.sliceSerialize(R)).toLowerCase(),this.data.referenceType="full"}function se(R){this.data.characterReferenceType=R.type}function te(R){const j=this.sliceSerialize(R),ne=this.data.characterReferenceType;let he;ne?(he=B$(j,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):he=vv(j);const ke=this.stack[this.stack.length-1];ke.value+=he}function q(R){const j=this.stack.pop();j.position.end=cs(R.end)}function Pe(R){E.call(this,R);const j=this.stack[this.stack.length-1];j.url=this.sliceSerialize(R)}function Fe(R){E.call(this,R);const j=this.stack[this.stack.length-1];j.url="mailto:"+this.sliceSerialize(R)}function Ot(){return{type:"blockquote",children:[]}}function Lt(){return{type:"code",lang:null,meta:null,value:""}}function lo(){return{type:"inlineCode",value:""}}function Jr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function sa(){return{type:"emphasis",children:[]}}function un(){return{type:"heading",depth:0,children:[]}}function Qe(){return{type:"break"}}function Ar(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function co(){return{type:"link",title:null,url:"",children:[]}}function Et(R){return{type:"list",ordered:R.type==="listOrdered",start:null,spread:R._spread,children:[]}}function Xe(R){return{type:"listItem",spread:R._spread,checked:null,children:[]}}function oa(){return{type:"paragraph",children:[]}}function Ai(){return{type:"strong",children:[]}}function sc(){return{type:"text",value:""}}function oc(){return{type:"thematicBreak"}}}function cs(t){return{line:t.line,column:t.column,offset:t.offset}}function K$(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?K$(t,r):DK(t,r)}}function DK(t,e){let n;for(n in e)if(G$.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function oE(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+tu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+tu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+tu({start:e.start,end:e.end})+") is still open")}function zK(t){const e=this;e.parser=n;function n(r){return QK(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function jK(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function BK(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
143
|
+
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function PK(t){const r={constructs:j$([EK,...(t||{}).extensions||[]]),content:i(X7),defined:[],document:i(V7),flow:i(hK),lazy:{},string:i(pK),text:i(gK)};return r;function i(s){return o;function o(a){return _K(r,s,a)}}}function IK(t){for(;!X$(t););return t}const sE=/[\0\t\n\r]/g;function RK(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,h,d,f;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,e="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(sE.lastIndex=h,c=sE.exec(s),d=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(d),!c){e=s.slice(h);break}if(f===10&&h===d&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<d&&(l.push(s.slice(h,d)),t+=d-h),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}h=d+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const NK=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $K(t){return t.replace(NK,MK)}function MK(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return B$(n.slice(s?2:1),s?16:10)}return vv(n)||t}const G$={}.hasOwnProperty;function QK(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),LK(n)(IK(PK(n).document().write(RK()(t,e,!0))))}function LK(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(co),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:s(un),blockQuote:s(Ot),characterEscape:Q,characterReference:Q,codeFenced:s(Lt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Lt,o),codeText:s(lo,o),codeTextData:Q,data:Q,codeFlowValue:Q,definition:s(Jr),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(sa),hardBreakEscape:s(Qe),hardBreakTrailing:s(Qe),htmlFlow:s(Ar,o),htmlFlowData:Q,htmlText:s(Ar,o),htmlTextData:Q,image:s(Oe),label:o,link:s(co),listItem:s(Xe),listItemValue:d,listOrdered:s(Et,h),listUnordered:s(Et),paragraph:s(oa),reference:v,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(un),strong:s(Ai),thematicBreak:s(oc)},exit:{atxHeading:l(),atxHeadingSequence:x,autolink:l(),autolinkEmail:Fe,autolinkProtocol:Pe,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:te,characterReference:q,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:E,codeIndented:l(m),codeText:l(z),codeTextData:E,data:E,definition:l(),definitionDestinationString:k,definitionLabelString:O,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(L),hardBreakTrailing:l(L),htmlFlow:l(H),htmlFlowData:E,htmlText:l(Y),htmlTextData:E,image:l(Z),label:D,labelText:I,lineEnding:M,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:V,resourceDestinationString:C,resourceTitleString:F,resource:W,setextHeading:l(P),setextHeadingLineSequence:T,setextHeadingText:S,strong:l(),thematicBreak:l()}};K$(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(R){let j={type:"root",children:[]};const ne={stack:[j],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:n},he=[];let ke=-1;for(;++ke<R.length;)if(R[ke][1].type==="listOrdered"||R[ke][1].type==="listUnordered")if(R[ke][0]==="enter")he.push(ke);else{const vt=he.pop();ke=i(R,vt,ke)}for(ke=-1;++ke<R.length;){const vt=e[R[ke][0]];G$.call(vt,R[ke][1].type)&&vt[R[ke][1].type].call(Object.assign({sliceSerialize:R[ke][2].sliceSerialize},ne),R[ke][1])}if(ne.tokenStack.length>0){const vt=ne.tokenStack[ne.tokenStack.length-1];(vt[1]||oE).call(ne,void 0,vt[0])}for(j.position={start:cs(R.length>0?R[0][1].start:{line:1,column:1,offset:0}),end:cs(R.length>0?R[R.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<e.transforms.length;)j=e.transforms[ke](j)||j;return j}function i(R,j,ne){let he=j-1,ke=-1,vt=!1,Pi,Pr,ac,lc;for(;++he<=ne;){const Fn=R[he];switch(Fn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Fn[0]==="enter"?ke++:ke--,lc=void 0;break}case"lineEndingBlank":{Fn[0]==="enter"&&(Pi&&!lc&&!ke&&!ac&&(ac=he),lc=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:lc=void 0}if(!ke&&Fn[0]==="enter"&&Fn[1].type==="listItemPrefix"||ke===-1&&Fn[0]==="exit"&&(Fn[1].type==="listUnordered"||Fn[1].type==="listOrdered")){if(Pi){let aa=he;for(Pr=void 0;aa--;){const Ii=R[aa];if(Ii[1].type==="lineEnding"||Ii[1].type==="lineEndingBlank"){if(Ii[0]==="exit")continue;Pr&&(R[Pr][1].type="lineEndingBlank",vt=!0),Ii[1].type="lineEnding",Pr=aa}else if(!(Ii[1].type==="linePrefix"||Ii[1].type==="blockQuotePrefix"||Ii[1].type==="blockQuotePrefixWhitespace"||Ii[1].type==="blockQuoteMarker"||Ii[1].type==="listItemIndent"))break}ac&&(!Pr||ac<Pr)&&(Pi._spread=!0),Pi.end=Object.assign({},Pr?R[Pr][1].start:Fn[1].end),R.splice(Pr||he,0,["exit",Pi,Fn[2]]),he++,ne++}if(Fn[1].type==="listItemPrefix"){const aa={type:"listItem",_spread:!1,start:Object.assign({},Fn[1].start),end:void 0};Pi=aa,R.splice(he,0,["enter",aa,Fn[2]]),he++,ne++,ac=void 0,lc=!0}}}return R[j][1]._spread=vt,ne}function s(R,j){return ne;function ne(he){a.call(this,R(he),he),j&&j.call(this,he)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(R,j,ne){this.stack[this.stack.length-1].children.push(R),this.stack.push(R),this.tokenStack.push([j,ne||void 0]),R.position={start:cs(j.start),end:void 0}}function l(R){return j;function j(ne){R&&R.call(this,ne),c.call(this,ne)}}function c(R,j){const ne=this.stack.pop(),he=this.tokenStack.pop();if(he)he[0].type!==R.type&&(j?j.call(this,R,he[0]):(he[1]||oE).call(this,R,he[0]));else throw new Error("Cannot close `"+R.type+"` ("+tu({start:R.start,end:R.end})+"): it’s not open");ne.position.end=cs(R.end)}function u(){return kv(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function d(R){if(this.data.expectingFirstListItemValue){const j=this.stack[this.stack.length-2];j.start=Number.parseInt(this.sliceSerialize(R),10),this.data.expectingFirstListItemValue=void 0}}function f(){const R=this.resume(),j=this.stack[this.stack.length-1];j.lang=R}function p(){const R=this.resume(),j=this.stack[this.stack.length-1];j.meta=R}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R.replace(/(\r?\n|\r)$/g,"")}function O(R){const j=this.resume(),ne=this.stack[this.stack.length-1];ne.label=j,ne.identifier=Xr(this.sliceSerialize(R)).toLowerCase()}function w(){const R=this.resume(),j=this.stack[this.stack.length-1];j.title=R}function k(){const R=this.resume(),j=this.stack[this.stack.length-1];j.url=R}function x(R){const j=this.stack[this.stack.length-1];if(!j.depth){const ne=this.sliceSerialize(R).length;j.depth=ne}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function T(R){const j=this.stack[this.stack.length-1];j.depth=this.sliceSerialize(R).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(R){const ne=this.stack[this.stack.length-1].children;let he=ne[ne.length-1];(!he||he.type!=="text")&&(he=sc(),he.position={start:cs(R.start),end:void 0},ne.push(he)),this.stack.push(he)}function E(R){const j=this.stack.pop();j.value+=this.sliceSerialize(R),j.position.end=cs(R.end)}function M(R){const j=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ne=j.children[j.children.length-1];ne.position.end=cs(R.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(j.type)&&(Q.call(this,R),E.call(this,R))}function L(){this.data.atHardBreak=!0}function H(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R}function Y(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R}function z(){const R=this.resume(),j=this.stack[this.stack.length-1];j.value=R}function $(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const j=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=j,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function Z(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const j=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=j,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function I(R){const j=this.sliceSerialize(R),ne=this.stack[this.stack.length-2];ne.label=$K(j),ne.identifier=Xr(j).toLowerCase()}function D(){const R=this.stack[this.stack.length-1],j=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){const he=R.children;ne.children=he}else ne.alt=j}function C(){const R=this.resume(),j=this.stack[this.stack.length-1];j.url=R}function F(){const R=this.resume(),j=this.stack[this.stack.length-1];j.title=R}function W(){this.data.inReference=void 0}function v(){this.data.referenceType="collapsed"}function V(R){const j=this.resume(),ne=this.stack[this.stack.length-1];ne.label=j,ne.identifier=Xr(this.sliceSerialize(R)).toLowerCase(),this.data.referenceType="full"}function ie(R){this.data.characterReferenceType=R.type}function te(R){const j=this.sliceSerialize(R),ne=this.data.characterReferenceType;let he;ne?(he=B$(j,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):he=vv(j);const ke=this.stack[this.stack.length-1];ke.value+=he}function q(R){const j=this.stack.pop();j.position.end=cs(R.end)}function Pe(R){E.call(this,R);const j=this.stack[this.stack.length-1];j.url=this.sliceSerialize(R)}function Fe(R){E.call(this,R);const j=this.stack[this.stack.length-1];j.url="mailto:"+this.sliceSerialize(R)}function Ot(){return{type:"blockquote",children:[]}}function Lt(){return{type:"code",lang:null,meta:null,value:""}}function lo(){return{type:"inlineCode",value:""}}function Jr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function sa(){return{type:"emphasis",children:[]}}function un(){return{type:"heading",depth:0,children:[]}}function Qe(){return{type:"break"}}function Ar(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function co(){return{type:"link",title:null,url:"",children:[]}}function Et(R){return{type:"list",ordered:R.type==="listOrdered",start:null,spread:R._spread,children:[]}}function Xe(R){return{type:"listItem",spread:R._spread,checked:null,children:[]}}function oa(){return{type:"paragraph",children:[]}}function Ai(){return{type:"strong",children:[]}}function sc(){return{type:"text",value:""}}function oc(){return{type:"thematicBreak"}}}function cs(t){return{line:t.line,column:t.column,offset:t.offset}}function K$(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?K$(t,r):DK(t,r)}}function DK(t,e){let n;for(n in e)if(G$.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function oE(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+tu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+tu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+tu({start:e.start,end:e.end})+") is still open")}function zK(t){const e=this;e.parser=n;function n(r){return QK(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function jK(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function BK(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
144
144
|
`}]}function UK(t,e){const n=e.value?e.value+`
|
|
145
145
|
`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function ZK(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function FK(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function XK(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=ql(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function WK(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function VK(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function J$(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function HK(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return J$(t,e);const i={src:ql(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function YK(t,e){const n={src:ql(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function qK(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function GK(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return J$(t,e);const i={href:ql(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function KK(t,e){const n={href:ql(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function JK(t,e,n){const r=t.all(e),i=n?eJ(n):eM(e),s={},o=[];if(typeof e.checked=="boolean"){const u=r[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
146
146
|
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
@@ -169,25 +169,25 @@ _(cancelled)_`}:o.type==="thinking"?{...o,active:!1}:o)}:s)}}}),clearMessages:n=
|
|
|
169
169
|
`.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function RM(t,e,n){return t.type==="element"?Cne(t,e,n):t.type==="text"?n.whitespace==="normal"?NM(t,n):Ene(t):[]}function Cne(t,e,n){const r=$M(t,n),i=t.children||[];let s=-1,o=[];if(vne(t))return o;let a,l;for(Kb(t)||DE(t)&&$E(e,t,DE)?l=`
|
|
170
170
|
`:kne(t)?(a=2,l=2):IM(t)&&(a=1,l=1);++s<i.length;)o=o.concat(RM(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?Kb(i[s+1]):l}));return LE(t)&&$E(e,t,LE)&&o.push(" "),a&&o.unshift(a),l&&o.push(l),o}function NM(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){ME.lastIndex=s;const l=ME.exec(n),c=l&&"index"in l?l.index:n.length;r.push(_ne(n.slice(s,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?e.breakBefore:!0,c===n.length?e.breakAfter:!0)),s=c+1}let o=-1,a;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&i.push(a),i.push(r[o]),a=0):(o===0||o===r.length-1)&&i.push(0);return i}function Ene(t){return[String(t.value)]}function _ne(t,e,n){const r=[];let i=0,s;for(;i<t.length;){QE.lastIndex=i;const o=QE.exec(t);s=o?o.index:t.length,!i&&!s&&o&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=o?s+o[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function $M(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function Tne(t){return!!(t.properties||{}).hidden}function Ane(t){return t.tagName==="td"||t.tagName==="th"}function Pne(t){return t.tagName==="dialog"&&!(t.properties||{}).open}function Ine(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",p=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],m=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],k={type:g,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},x={className:"function.dispatch",relevance:0,keywords:{_hint:m},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[x,h,a,n,t.C_BLOCK_COMMENT_MODE,u,c],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:S.concat([{begin:/\(/,end:/\)/,keywords:k,contains:S.concat(["self"]),relevance:0}]),relevance:0},P={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,relevance:0},{begin:f,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(T,P,x,S,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:k,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Rne(t){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=Ine(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function Nne(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],b=["true","false"],m={match:/(\/[a-z._-]+)+/},O=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],w=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],x=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:b,built_in:[...O,...w,"set","shopt",...k,...x]},contains:[f,t.SHEBANG(),p,h,s,o,m,a,l,c,u,n]}}function $ne(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",b={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},m=[h,a,n,t.C_BLOCK_COMMENT_MODE,u,c],O={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:m.concat([{begin:/\(/,end:/\)/,keywords:b,contains:m.concat(["self"]),relevance:0}]),relevance:0},w={begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:f,returnBegin:!0,contains:[t.inherit(d,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(O,w,m,[h,{begin:t.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:h,strings:c,keywords:b}}}function Mne(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",p=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],m=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],k={type:g,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},x={className:"function.dispatch",relevance:0,keywords:{_hint:m},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[x,h,a,n,t.C_BLOCK_COMMENT_MODE,u,c],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:S.concat([{begin:/\(/,end:/\)/,keywords:k,contains:S.concat(["self"]),relevance:0}]),relevance:0},P={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,relevance:0},{begin:f,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(T,P,x,S,[h,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:k,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Qne(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},h=t.inherit(u,{illegal:/\n/}),d={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=t.inherit(d,{illegal:/\n/}),p={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,f]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},d]},b=t.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});d.contains=[g,p,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],f.contains=[b,p,h,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const m={variants:[c,g,p,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},O={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},w=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",k={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},m,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,O,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,O,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+w+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,O],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[m,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},k]}}const Lne=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Dne=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],zne=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],jne=[...Dne,...zne],Bne=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Une=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Zne=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Fne=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Xne(t){const e=t.regex,n=Lne(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Une.join("|")+")"},{begin:":(:)?("+Zne.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Fne.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Bne.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+jne.join("|")+")\\b"}]}}function Wne(t){const e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Vne(t){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:s,illegal:/["']/}]}]}}function Hne(t){const e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Yne(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},o={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,s,i,o,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,h=e.either(l,c,u),d=e.concat(h,"(\\s*\\.\\s*",h,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:d,className:"attr",starts:{end:/$/,contains:[r,a,s,i,o,n]}}]}}var ma="[0-9](_*[0-9])*",kd=`\\.(${ma})`,vd="[0-9a-fA-F](_*[0-9a-fA-F])*",zE={className:"number",variants:[{begin:`(\\b(${ma})((${kd})|\\.)?|(${kd}))[eE][+-]?(${ma})[fFdD]?\\b`},{begin:`\\b(${ma})((${kd})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${kd})[fFdD]?\\b`},{begin:`\\b(${ma})[fFdD]\\b`},{begin:`\\b0[xX]((${vd})\\.?|(${vd})?\\.(${vd}))[pP][+-]?(${ma})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${vd})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function MM(t,e,n){return n===-1?"":t.replace(e,r=>MM(t,e,n-1))}function qne(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+MM("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[u,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,zE,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},zE,c]}}const jE="[A-Za-z$_][0-9A-Za-z$_]*",Gne=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Kne=["true","false","null","undefined","NaN","Infinity"],QM=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],LM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],DM=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Jne=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ere=[].concat(DM,QM,LM);function tre(t){const e=t.regex,n=(I,{after:D})=>{const C="</"+I[0].slice(1);return I.input.indexOf(C,D)!==-1},r=jE,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(I,D)=>{const C=I[0].length+I.index,F=I.input[C];if(F==="<"||F===","){D.ignoreMatch();return}F===">"&&(n(I,{after:C})||D.ignoreMatch());let W;const v=I.input.substring(C);if(W=v.match(/^\s*=/)){D.ignoreMatch();return}if((W=v.match(/^\s+extends\s+/))&&W.index===0){D.ignoreMatch();return}}},a={$pattern:jE,keyword:Gne,literal:Kne,built_in:ere,"variable.language":Jne},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,d]},O={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},w=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,b,{match:/\$\d+/},h];d.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const k=[].concat(O,d.contains),x=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},T={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},P={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...QM,...LM]}},Q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},E={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(I){return e.concat("(?!",I.join("|"),")")}const H={match:e.concat(/\b/,L([...DM,"super","import"].map(I=>`${I}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},z={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},$="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",Z={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead($)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:P},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),Q,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,b,O,{match:/\$\d+/},h,P,{scope:"attr",match:r+e.lookahead(":"),relevance:0},Z,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[O,t.REGEXP_MODE,{className:"function",begin:$,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},E,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},H,M,T,z,{match:/\$[(.]/}]}}function nre(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Oa="[0-9](_*[0-9])*",xd=`\\.(${Oa})`,Cd="[0-9a-fA-F](_*[0-9a-fA-F])*",rre={className:"number",variants:[{begin:`(\\b(${Oa})((${xd})|\\.)?|(${xd}))[eE][+-]?(${Oa})[fFdD]?\\b`},{begin:`\\b(${Oa})((${xd})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${xd})[fFdD]?\\b`},{begin:`\\b(${Oa})[fFdD]\\b`},{begin:`\\b0[xX]((${Cd})\\.?|(${Cd})?\\.(${Cd}))[pP][+-]?(${Oa})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Cd})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function ire(t){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(o,{className:"string"}),"self"]}]},c=rre,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),h={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},d=h;return d.variants[1].contains=[h],h.variants[1].contains=[d],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,u,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[h,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,a,l,o,t.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
171
171
|
`},c]}}const sre=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ore=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],are=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],lre=[...ore,...are],cre=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),zM=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),jM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),ure=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),hre=zM.concat(jM).sort().reverse();function dre(t){const e=sre(t),n=hre,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],a=[],l=function(w){return{className:"string",begin:"~?"+w+".*?"+w}},c=function(w,k,x){return{className:w,begin:k,relevance:x}},u={$pattern:/[a-z-]+/,keyword:r,attribute:cre.join(" ")},h={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,h,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const d=a.concat({begin:/\{/,end:/\}/,contains:o}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},p={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ure.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:a,relevance:0}},b={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:d}},m={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,f,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+lre.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+zM.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+jM.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:d},{begin:"!important"},e.FUNCTION_DISPATCH]},O={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[m]};return o.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,O,p,m,f,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function fre(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function pre(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},i={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},s={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,i,s,o]}}function gre(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=t.inherit(c,{contains:[]}),d=t.inherit(u,{contains:[]});c.contains.push(d),u.contains.push(h);let f=[n,l];return[c,u,h,d].forEach(m=>{m.contains=m.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,s,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function mre(t){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function Ore(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[t.BACKSLASH_ESCAPE,s,l],h=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],d=(g,b,m="\\1")=>{const O=m==="\\1"?m:e.concat(m,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,O,/(?:\\.|[^\\\/])*?/,m,r)},f=(g,b,m)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,m,r),p=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:d("s|tr|y",e.either(...h,{capture:!0}))},{begin:d("s|tr|y","\\(","\\)")},{begin:d("s|tr|y","\\[","\\]")},{begin:d("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:f("(?:m|qr)?",/\//,/\//)},{begin:f("m|qr",e.either(...h,{capture:!0}),/\1/)},{begin:f("m|qr",/\(/,/\)/)},{begin:f("m|qr",/\[/,/\]/)},{begin:f("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=p,o.contains=p,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:p}}function yre(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=e.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),h={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(Y,z)=>{z.data._beginMatch=Y[1]||Y[2]},"on:end":(Y,z)=>{z.data._beginMatch!==Y[1]&&z.ignoreMatch()}},d=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[
|
|
172
|
-
]`,p={scope:"string",variants:[u,c,h,d]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],m=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],O=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],k={keyword:m,literal:(Y=>{const z=[];return Y.forEach($=>{z.push($),$.toLowerCase()===$?z.push($.toUpperCase()):z.push($.toLowerCase())}),z})(b),built_in:O},x=Y=>Y.map(z=>z.replace(/\|\d+$/,"")),S={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",x(O).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},T=e.concat(r,"\\b(?!\\()"),P={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},Q={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},E={relevance:0,begin:/\(/,end:/\)/,keywords:k,contains:[Q,o,P,t.C_BLOCK_COMMENT_MODE,p,g,S]},M={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",x(m).join("\\b|"),"|",x(O).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[E]};E.contains.push(M);const L=[Q,P,t.C_BLOCK_COMMENT_MODE,p,g,S],H={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...L]},...L,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:k,contains:[H,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,M,P,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},S,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:k,contains:["self",H,o,P,t.C_BLOCK_COMMENT_MODE,p,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},p,g]}}function bre(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function wre(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Sre(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",f=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,p=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${f}))[eE][+-]?(${d})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${d})[jJ](?=${p})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,h,t.HASH_COMMENT_MODE]}]};return c.contains=[h,g,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,h]}]}}function kre(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function vre(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function xre(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},h={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},d="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${d})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},S=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=S,g.contains=S;const E=[{begin:/^\s*=>/,starts:{end:"$",contains:S}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:S}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(E).concat(c).concat(S)}}function Cre(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:u}},{className:"punctuation",begin:"->"},s]}}const Ere=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),_re=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Tre=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Are=[..._re,...Tre],Pre=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Ire=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Rre=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Nre=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function $re(t){const e=Ere(t),n=Rre,r=Ire,i="@[a-z-]+",s="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+Are.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Nre.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:Pre.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function Mre(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Qre(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,p=[...c,...l].filter(x=>!u.includes(x)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},m={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function O(x){return e.concat(/\b/,e.either(...x.map(S=>S.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:O(d),relevance:0};function k(x,{exceptions:S,when:T}={}){const P=T;return S=S||[],x.map(Q=>Q.match(/\|\d+$/)||S.includes(Q)?Q:P(Q)?`${Q}|0`:Q)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(p,{when:x=>x.length<3}),literal:s,type:a,built_in:h},contains:[{scope:"type",match:O(o)},w,m,g,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function BM(t){return t?typeof t=="string"?t:t.source:null}function vc(t){return We("(?=",t,")")}function We(...t){return t.map(n=>BM(n)).join("")}function Lre(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function fn(...t){return"("+(Lre(t).capture?"":"?:")+t.map(r=>BM(r)).join("|")+")"}const $v=t=>We(/\b/,t,/\w$/.test(t)?/\b/:/\B/),Dre=["Protocol","Type"].map($v),BE=["init","self"].map($v),zre=["Any","Self"],CO=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],UE=["false","nil","true"],jre=["assignment","associativity","higherThan","left","lowerThan","none","right"],Bre=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],ZE=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],UM=fn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ZM=fn(UM,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),EO=We(UM,ZM,"*"),FM=fn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Ap=fn(FM,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ii=We(FM,Ap,"*"),Ed=We(/[A-Z]/,Ap,"*"),Ure=["attached","autoclosure",We(/convention\(/,fn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",We(/objc\(/,ii,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Zre=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Fre(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,fn(...Dre,...BE)],className:{2:"keyword"}},s={match:We(/\./,fn(...CO)),relevance:0},o=CO.filter(Qe=>typeof Qe=="string").concat(["_|0"]),a=CO.filter(Qe=>typeof Qe!="string").concat(zre).map($v),l={variants:[{className:"keyword",match:fn(...a,...BE)}]},c={$pattern:fn(/\b\w+/,/#\w+/),keyword:o.concat(Bre),literal:UE},u=[i,s,l],h={match:We(/\./,fn(...ZE)),relevance:0},d={className:"built_in",match:We(/\b/,fn(...ZE),/(?=\()/)},f=[h,d],p={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:EO},{match:`\\.(\\.|${ZM})+`}]},b=[p,g],m="([0-9]_*)+",O="([0-9a-fA-F]_*)+",w={className:"number",relevance:0,variants:[{match:`\\b(${m})(\\.(${m}))?([eE][+-]?(${m}))?\\b`},{match:`\\b0x(${O})(\\.(${O}))?([pP][+-]?(${m}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},k=(Qe="")=>({className:"subst",variants:[{match:We(/\\/,Qe,/[0\\tnr"']/)},{match:We(/\\/,Qe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),x=(Qe="")=>({className:"subst",match:We(/\\/,Qe,/[\t ]*(?:[\r\n]|\r\n)/)}),S=(Qe="")=>({className:"subst",label:"interpol",begin:We(/\\/,Qe,/\(/),end:/\)/}),T=(Qe="")=>({begin:We(Qe,/"""/),end:We(/"""/,Qe),contains:[k(Qe),x(Qe),S(Qe)]}),P=(Qe="")=>({begin:We(Qe,/"/),end:We(/"/,Qe),contains:[k(Qe),S(Qe)]}),Q={className:"string",variants:[T(),T("#"),T("##"),T("###"),P(),P("#"),P("##"),P("###")]},E=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],M={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:E},L=Qe=>{const Ar=We(Qe,/\//),Oe=We(/\//,Qe);return{begin:Ar,end:Oe,contains:[...E,{scope:"comment",begin:`#(?!.*${Oe})`,end:/$/}]}},H={scope:"regexp",variants:[L("###"),L("##"),L("#"),M]},Y={match:We(/`/,ii,/`/)},z={className:"variable",match:/\$\d+/},$={className:"variable",match:`\\$${Ap}+`},Z=[Y,z,$],I={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Zre,contains:[...b,w,Q]}]}},D={scope:"keyword",match:We(/@/,fn(...Ure),vc(fn(/\(/,/\s+/)))},C={scope:"meta",match:We(/@/,ii)},F=[I,D,C],W={match:vc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:We(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ap,"+")},{className:"type",match:Ed,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:We(/\s+&\s+/,vc(Ed)),relevance:0}]},v={begin:/</,end:/>/,keywords:c,contains:[...r,...u,...F,p,W]};W.contains.push(v);const V={match:We(ii,/\s*:/),keywords:"_|0",relevance:0},se={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",V,...r,H,...u,...f,...b,w,Q,...Z,...F,W]},te={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,W]},q={begin:fn(vc(We(ii,/\s*:/)),vc(We(ii,/\s+/,ii,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ii}]},Pe={begin:/\(/,end:/\)/,keywords:c,contains:[q,...r,...u,...b,w,Q,...F,W,se],endsParent:!0,illegal:/["']/},Fe={match:[/(func|macro)/,/\s+/,fn(Y.match,ii,EO)],className:{1:"keyword",3:"title.function"},contains:[te,Pe,e],illegal:[/\[/,/%/]},Ot={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[te,Pe,e],illegal:/\[|%/},Lt={match:[/operator/,/\s+/,EO],className:{1:"keyword",3:"title"}},lo={begin:[/precedencegroup/,/\s+/,Ed],className:{1:"keyword",3:"title"},contains:[W],keywords:[...jre,...UE],end:/}/},Jr={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},sa={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},un={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ii,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[te,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Ed},...u],relevance:0}]};for(const Qe of Q.variants){const Ar=Qe.contains.find(co=>co.label==="interpol");Ar.keywords=c;const Oe=[...u,...f,...b,w,Q,...Z];Ar.contains=[...Oe,{begin:/\(/,end:/\)/,contains:["self",...Oe]}]}return{name:"Swift",keywords:c,contains:[...r,Fe,Ot,Jr,sa,un,Lt,lo,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},H,...u,...f,...b,w,Q,...Z,...F,W,se]}}const Pp="[A-Za-z$_][0-9A-Za-z$_]*",XM=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],WM=["true","false","null","undefined","NaN","Infinity"],VM=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],HM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],YM=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],qM=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],GM=[].concat(YM,VM,HM);function Xre(t){const e=t.regex,n=(I,{after:D})=>{const C="</"+I[0].slice(1);return I.input.indexOf(C,D)!==-1},r=Pp,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(I,D)=>{const C=I[0].length+I.index,F=I.input[C];if(F==="<"||F===","){D.ignoreMatch();return}F===">"&&(n(I,{after:C})||D.ignoreMatch());let W;const v=I.input.substring(C);if(W=v.match(/^\s*=/)){D.ignoreMatch();return}if((W=v.match(/^\s+extends\s+/))&&W.index===0){D.ignoreMatch();return}}},a={$pattern:Pp,keyword:XM,literal:WM,built_in:GM,"variable.language":qM},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,d]},O={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},w=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,b,{match:/\$\d+/},h];d.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const k=[].concat(O,d.contains),x=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},T={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},P={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...VM,...HM]}},Q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},E={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(I){return e.concat("(?!",I.join("|"),")")}const H={match:e.concat(/\b/,L([...YM,"super","import"].map(I=>`${I}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},z={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},$="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",Z={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead($)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:P},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),Q,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,b,O,{match:/\$\d+/},h,P,{scope:"attr",match:r+e.lookahead(":"),relevance:0},Z,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[O,t.REGEXP_MODE,{className:"function",begin:$,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},E,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},H,M,T,z,{match:/\$[(.]/}]}}function Wre(t){const e=t.regex,n=Xre(t),r=Pp,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Pp,keyword:XM.concat(l),literal:WM,built_in:GM.concat(i),"variable.language":qM},u={className:"meta",begin:"@"+r},h=(g,b,m)=>{const O=g.contains.findIndex(w=>w.label===b);if(O===-1)throw new Error("can not find mode to replace");g.contains.splice(O,1,m)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const d=n.contains.find(g=>g.scope==="attr"),f=Object.assign({},d,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([u,s,o,f]),h(n,"shebang",t.SHEBANG()),h(n,"use_strict",a);const p=n.contains.find(g=>g.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Vre(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},h=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),d=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,u,h,d,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[d]}]}}function Hre(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,t.QUOTE_STRING_MODE,l,c,a]}}function Yre(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(s,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function qre(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},b=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},d,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,g,s,o],m=[...b];return m.pop(),m.push(a),f.contains=m,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const Gre={arduino:Rne,bash:Nne,c:$ne,cpp:Mne,csharp:Qne,css:Xne,diff:Wne,go:Vne,graphql:Hne,ini:Yne,java:qne,javascript:tre,json:nre,kotlin:ire,less:dre,lua:fre,makefile:pre,markdown:gre,objectivec:mre,perl:Ore,php:yre,"php-template":bre,plaintext:wre,python:Sre,"python-repl":kre,r:vre,ruby:xre,rust:Cre,scss:$re,shell:Mre,sql:Qre,swift:Fre,typescript:Wre,vbnet:Vre,wasm:Hre,xml:Yre,yaml:qre};function KM(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&KM(n)}),t}class FE{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function JM(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ts(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const Kre="</span>",XE=t=>!!t.scope,Jre=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class eie{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=JM(e)}openNode(e){if(!XE(e))return;const n=Jre(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){XE(e)&&(this.buffer+=Kre)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const WE=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class Mv{constructor(){this.rootNode=WE(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=WE({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{Mv._collapse(n)}))}}class tie extends Mv{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new eie(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Xu(t){return t?typeof t=="string"?t:t.source:null}function eQ(t){return ia("(?=",t,")")}function nie(t){return ia("(?:",t,")*")}function rie(t){return ia("(?:",t,")?")}function ia(...t){return t.map(n=>Xu(n)).join("")}function iie(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Qv(...t){return"("+(iie(t).capture?"":"?:")+t.map(r=>Xu(r)).join("|")+")"}function tQ(t){return new RegExp(t.toString()+"|").exec("").length-1}function sie(t,e){const n=t&&t.exec(e);return n&&n.index===0}const oie=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Lv(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let s=Xu(r),o="";for(;s.length>0;){const a=oie.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}const aie=/\b\B/,nQ="[a-zA-Z]\\w*",Dv="[a-zA-Z_]\\w*",rQ="\\b\\d+(\\.\\d+)?",iQ="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",sQ="\\b(0b[01]+)",lie="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",cie=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=ia(e,/.*\b/,t.binary,/\b.*/)),Ts({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Wu={begin:"\\\\[\\s\\S]",relevance:0},uie={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Wu]},hie={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Wu]},die={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},am=function(t,e,n={}){const r=Ts({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=Qv("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:ia(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},fie=am("//","$"),pie=am("/\\*","\\*/"),gie=am("#","$"),mie={scope:"number",begin:rQ,relevance:0},Oie={scope:"number",begin:iQ,relevance:0},yie={scope:"number",begin:sQ,relevance:0},bie={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Wu,{begin:/\[/,end:/\]/,relevance:0,contains:[Wu]}]},wie={scope:"title",begin:nQ,relevance:0},Sie={scope:"title",begin:Dv,relevance:0},kie={begin:"\\.\\s*"+Dv,relevance:0},vie=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})};var _d=Object.freeze({__proto__:null,APOS_STRING_MODE:uie,BACKSLASH_ESCAPE:Wu,BINARY_NUMBER_MODE:yie,BINARY_NUMBER_RE:sQ,COMMENT:am,C_BLOCK_COMMENT_MODE:pie,C_LINE_COMMENT_MODE:fie,C_NUMBER_MODE:Oie,C_NUMBER_RE:iQ,END_SAME_AS_BEGIN:vie,HASH_COMMENT_MODE:gie,IDENT_RE:nQ,MATCH_NOTHING_RE:aie,METHOD_GUARD:kie,NUMBER_MODE:mie,NUMBER_RE:rQ,PHRASAL_WORDS_MODE:die,QUOTE_STRING_MODE:hie,REGEXP_MODE:bie,RE_STARTERS_RE:lie,SHEBANG:cie,TITLE_MODE:wie,UNDERSCORE_IDENT_RE:Dv,UNDERSCORE_TITLE_MODE:Sie});function xie(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function Cie(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function Eie(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=xie,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function _ie(t,e){Array.isArray(t.illegal)&&(t.illegal=Qv(...t.illegal))}function Tie(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function Aie(t,e){t.relevance===void 0&&(t.relevance=1)}const Pie=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=ia(n.beforeMatch,eQ(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},Iie=["of","and","for","in","not","or","if","then","parent","list","value"],Rie="keyword";function oQ(t,e,n=Rie){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(s){Object.assign(r,oQ(t[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,Nie(l[0],l[1])]})}}function Nie(t,e){return e?Number(e):$ie(t)?0:1}function $ie(t){return Iie.includes(t.toLowerCase())}const VE={},Ro=t=>{console.error(t)},HE=(t,...e)=>{console.log(`WARN: ${t}`,...e)},da=(t,e)=>{VE[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),VE[`${t}/${e}`]=!0)},Ip=new Error;function aQ(t,e,{key:n}){let r=0;const i=t[n],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=tQ(e[a-1]);t[n]=o,t[n]._emit=s,t[n]._multi=!0}function Mie(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw Ro("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ip;if(typeof t.beginScope!="object"||t.beginScope===null)throw Ro("beginScope must be object"),Ip;aQ(t,t.begin,{key:"beginScope"}),t.begin=Lv(t.begin,{joinWith:""})}}function Qie(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw Ro("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ip;if(typeof t.endScope!="object"||t.endScope===null)throw Ro("endScope must be object"),Ip;aQ(t,t.end,{key:"endScope"}),t.end=Lv(t.end,{joinWith:""})}}function Lie(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function Die(t){Lie(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),Mie(t),Qie(t)}function zie(t){function e(o,a){return new RegExp(Xu(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=tQ(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(Lv(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((h,d)=>d>0&&h!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[Cie,Tie,Die,Pie].forEach(u=>u(o,a)),t.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[Eie,_ie,Aie].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=oQ(o.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=Xu(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return jie(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ts(t.classNameAliases||{}),s(t)}function lQ(t){return t?t.endsWithParent||lQ(t.starts):!1}function jie(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ts(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:lQ(t)?Ts(t,{starts:t.starts?Ts(t.starts):null}):Object.isFrozen(t)?Ts(t):t}var Bie="11.11.1";class Uie extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const _O=JM,YE=Ts,qE=Symbol("nomatch"),Zie=7,cQ=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:tie};function l($){return a.noHighlightRe.test($)}function c($){let Z=$.className+" ";Z+=$.parentNode?$.parentNode.className:"";const I=a.languageDetectRe.exec(Z);if(I){const D=P(I[1]);return D||(HE(s.replace("{}",I[1])),HE("Falling back to no-highlight mode for this block.",$)),D?I[1]:"no-highlight"}return Z.split(/\s+/).find(D=>l(D)||P(D))}function u($,Z,I){let D="",C="";typeof Z=="object"?(D=$,I=Z.ignoreIllegals,C=Z.language):(da("10.7.0","highlight(lang, code, ...args) has been deprecated."),da("10.7.0",`Please use highlight(code, options) instead.
|
|
173
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),C=$,D=Z),I===void 0&&(I=!0);const F={code:D,language:C};Y("before:highlight",F);const W=F.result?F.result:h(F.language,F.code,I);return W.code=F.code,Y("after:highlight",W),W}function h($,Z,I,D){const C=Object.create(null);function F(R,j){return R.keywords[j]}function W(){if(!Oe.keywords){Et.addText(Xe);return}let R=0;Oe.keywordPatternRe.lastIndex=0;let j=Oe.keywordPatternRe.exec(Xe),ne="";for(;j;){ne+=Xe.substring(R,j.index);const he=un.case_insensitive?j[0].toLowerCase():j[0],ke=F(Oe,he);if(ke){const[vt,Pi]=ke;if(Et.addText(ne),ne="",C[he]=(C[he]||0)+1,C[he]<=Zie&&(oa+=Pi),vt.startsWith("_"))ne+=j[0];else{const Pr=un.classNameAliases[vt]||vt;
|
|
174
|
-
`,1;if(sc>1e5&&sc>j.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Xe+=ne,ne.length}const un=P($);if(!un)throw Ro(s.replace("{}",$)),new Error('Unknown language: "'+$+'"');const Qe=zie(un);let Ar="",Oe=D||Qe;const co={},Et=new a.__emitter(a);lo();let Xe="",oa=0,Ai=0,sc=0,oc=!1;try{if(un.__emitTokens)un.__emitTokens(Z,Et);else{for(Oe.matcher.considerAll();;){sc++,oc?oc=!1:Oe.matcher.considerAll(),Oe.matcher.lastIndex=Ai;const R=Oe.matcher.exec(Z);if(!R)break;const j=Z.substring(Ai,R.index),ne=sa(j,R);Ai=R.index+ne}sa(Z.substring(Ai))}return Et.finalize(),Ar=Et.toHTML(),{language:$,value:Ar,relevance:oa,illegal:!1,_emitter:Et,_top:Oe}}catch(R){if(R.message&&R.message.includes("Illegal"))return{language:$,value:_O(Z),illegal:!0,relevance:0,_illegalBy:{message:R.message,index:Ai,context:Z.slice(Ai-100,Ai+100),mode:R.mode,resultSoFar:Ar},_emitter:Et};if(i)return{language:$,value:_O(Z),illegal:!1,relevance:0,errorRaised:R,_emitter:Et,_top:Oe};throw R}}function d($){const Z={value:_O($),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return Z._emitter.addText($),Z}function f($,Z){Z=Z||a.languages||Object.keys(e);const I=d($),D=Z.filter(P).filter(E).map(V=>h(V,$,!1));D.unshift(I);const C=D.sort((V,se)=>{if(V.relevance!==se.relevance)return se.relevance-V.relevance;if(V.language&&se.language){if(P(V.language).supersetOf===se.language)return 1;if(P(se.language).supersetOf===V.language)return-1}return 0}),[F,W]=C,v=F;return v.secondBest=W,v}function p($,Z,I){const D=Z&&n[Z]||I;$.classList.add("hljs"),$.classList.add(`language-${D}`)}function g($){let Z=null;const I=c($);if(l(I))return;if(Y("before:highlightElement",{el:$,language:I}),$.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",$);return}if($.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn($)),a.throwUnescapedHTML))throw new Uie("One of your code blocks includes unescaped HTML.",$.innerHTML);Z=$;const D=Z.textContent,C=I?u(D,{language:I,ignoreIllegals:!0}):f(D);$.innerHTML=C.value,$.dataset.highlighted="yes",p($,I,C.language),$.result={language:C.language,re:C.relevance,relevance:C.relevance},C.secondBest&&($.secondBest={language:C.secondBest.language,relevance:C.secondBest.relevance}),Y("after:highlightElement",{el:$,result:C,text:D})}function b($){a=YE(a,$)}const m=()=>{k(),da("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function O(){k(),da("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function k(){function $(){k()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",$,!1),w=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function x($,Z){let I=null;try{I=Z(t)}catch(D){if(Ro("Language definition for '{}' could not be registered.".replace("{}",$)),i)Ro(D);else throw D;I=o}I.name||(I.name=$),e[$]=I,I.rawDefinition=Z.bind(null,t),I.aliases&&Q(I.aliases,{languageName:$})}function S($){delete e[$];for(const Z of Object.keys(n))n[Z]===$&&delete n[Z]}function T(){return Object.keys(e)}function P($){return $=($||"").toLowerCase(),e[$]||e[n[$]]}function Q($,{languageName:Z}){typeof $=="string"&&($=[$]),$.forEach(I=>{n[I.toLowerCase()]=Z})}function E($){const Z=P($);return Z&&!Z.disableAutodetect}function M($){$["before:highlightBlock"]&&!$["before:highlightElement"]&&($["before:highlightElement"]=Z=>{$["before:highlightBlock"](Object.assign({block:Z.el},Z))}),$["after:highlightBlock"]&&!$["after:highlightElement"]&&($["after:highlightElement"]=Z=>{$["after:highlightBlock"](Object.assign({block:Z.el},Z))})}function L($){M($),r.push($)}function H($){const Z=r.indexOf($);Z!==-1&&r.splice(Z,1)}function Y($,Z){const I=$;r.forEach(function(D){D[I]&&D[I](Z)})}function z($){return da("10.7.0","highlightBlock will be removed entirely in v12.0"),da("10.7.0","Please use highlightElement now."),g($)}Object.assign(t,{highlight:u,highlightAuto:f,highlightAll:k,highlightElement:g,highlightBlock:z,configure:b,initHighlighting:m,initHighlightingOnLoad:O,registerLanguage:x,unregisterLanguage:S,listLanguages:T,getLanguage:P,registerAliases:Q,autoDetection:E,inherit:YE,addPlugin:L,removePlugin:H}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=Bie,t.regex={concat:ia,lookahead:eQ,either:Qv,optional:rie,anyNumberOfTimes:nie};for(const $ in _d)typeof _d[$]=="object"&&KM(_d[$]);return Object.assign(t,_d),t},xl=cQ({});xl.newInstance=()=>cQ({});var Fie=xl;xl.HighlightJS=xl;xl.default=xl;const Xie=dg(Fie),GE={},Wie="hljs-";function Vie(t){const e=Xie.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function n(l,c,u){const h=u||GE,d=typeof h.prefix=="string"?h.prefix:Wie;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:Hie,classPrefix:d});const f=e.highlight(c,{ignoreIllegals:!0,language:l});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,g=p.data;return g.language=f.language,g.relevance=f.relevance,p}function r(l,c){const h=(c||GE).subset||i();let d=-1,f=0,p;for(;++d<h.length;){const g=h[d];if(!e.getLanguage(g))continue;const b=n(g,l,c);b.data&&b.data.relevance!==void 0&&b.data.relevance>f&&(f=b.data.relevance,p=b)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const h=l[u];e.registerAliases(typeof h=="string"?h:[...h],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class Hie{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Yie={};function qie(t){const e=t||Yie,n=e.aliases,r=e.detect||!1,i=e.languages||Gre,s=e.plainText,o=e.prefix,a=e.subset;let l="hljs";const c=Vie(i);if(n&&c.registerAlias(n),o){const u=o.indexOf("-");l=u===-1?o:o.slice(0,u)}return function(u,h){om(u,"element",function(d,f,p){if(d.tagName!=="code"||!p||p.type!=="element"||p.tagName!=="pre")return;const g=Gie(d);if(g===!1||!g&&!r||g&&s&&s.includes(g))return;Array.isArray(d.properties.className)||(d.properties.className=[]),d.properties.className.includes(l)||d.properties.className.unshift(l);const b=xne(d,{whitespace:"pre"});let m;try{m=g?c.highlight(g,b,{prefix:o}):c.highlightAuto(b,{prefix:o,subset:a})}catch(O){const w=O;if(g&&/Unknown language/.test(w.message)){h.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[p,d],cause:w,place:d.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw w}!g&&m.data&&m.data.language&&d.properties.className.push("language-"+m.data.language),m.children.length>0&&(d.children=m.children)})}}function Gie(t){const e=t.properties.className;let n=-1;if(!Array.isArray(e))return;let r;for(;++n<e.length;){const i=String(e[n]);if(i==="no-highlight"||i==="nohighlight")return!1;!r&&i.slice(0,5)==="lang-"&&(r=i.slice(5)),!r&&i.slice(0,9)==="language-"&&(r=i.slice(9))}return r}function Jb(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Jb).join(""):t&&typeof t=="object"&&"props"in t?Jb(t.props.children):""}function Kie({children:t,...e}){const n=Jb(t).replace(/\n$/,"");return y.jsxs("pre",{...e,className:`copy-btn-wrap ${e.className??""}`.trim(),children:[y.jsx(C$,{text:n,label:"Copy code",className:"copy-btn--code"}),t]})}const Jie={pre:Kie};function uQ({content:t}){return y.jsx("div",{className:"md",children:y.jsx(iee,{remarkPlugins:[One],rehypePlugins:[qie],components:Jie,children:t})})}function ese(t){return t<=60?"just now":t<3600?`${Math.floor(t/60)} min later`:`${Math.floor(t/3600)} hr later`}function tse({gapSeconds:t}){const e=ese(t);return y.jsxs("div",{className:"time-separator",role:"separator","aria-label":e,children:[y.jsx("span",{className:"time-separator-line","aria-hidden":"true"}),y.jsx("span",{className:"time-separator-label",children:e}),y.jsx("span",{className:"time-separator-line","aria-hidden":"true"})]})}function nse(t){return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function rse(t){return new Date(t).toISOString()}function ise({message:t,assistantLabel:e}){const n=t.role==="user",r=n?"👤":"🤖",i=n?"You":e,s=rse(t.ts);return y.jsxs("div",{className:`turn-header turn-header--${t.role}`,children:[y.jsxs("span",{className:"turn-actor-badge",children:[y.jsx("span",{className:"turn-actor-icon","aria-hidden":"true",children:r}),y.jsx("span",{className:"turn-actor-name",children:i})]}),y.jsx("time",{className:"turn-ts dim",dateTime:s,title:s,children:nse(t.ts)})]})}const sse=60,ose=120;function ase(t){return t.activities.length>0&&t.content.trim().length<ose}function hQ({messages:t,lastCompletedAssistantId:e,latestAssistantRef:n,rehydrating:r,systemStatus:i,assistantLabel:s,emptyState:o}){return y.jsxs(y.Fragment,{children:[r?y.jsx(xn,{inline:!0,label:"Loading conversation history"}):t.length===0?o:null,t.map((a,l)=>{const c=a.role==="assistant"&&a.id===e,u=l>0?t[l-1]:null,h=u?(a.ts-u.ts)/1e3:0,d=u!==null&&h>sse,f=a.role==="assistant"&&ase(a);return y.jsxs("div",{className:`turn-wrapper${d?" has-separator":""}`,children:[d&&y.jsx(tse,{gapSeconds:h}),y.jsxs("article",{className:`bubble ${a.role}${f?" bubble--agent-activity":""}`,"aria-label":a.role==="user"?"You":s,tabIndex:c?-1:void 0,ref:c?p=>{n.current=p}:void 0,children:[y.jsx(ise,{message:a,assistantLabel:s}),a.role==="user"?y.jsxs("p",{className:"bubble-text user-text",children:[a.content,a.deliveryStatus==="posting"?y.jsxs("span",{className:"msg-queued-indicator","aria-label":"sending",title:"Sending…",children:[" ","⏳"]}):a.deliveryStatus==="queued-backend"?y.jsxs("span",{className:"msg-queued-backend-indicator","aria-label":`queued — ${a.queuePosition??1} ahead`,title:`Waiting in queue (${a.queuePosition??1} ahead)`,children:[" ","📥 Waiting in queue (",a.queuePosition??1," ahead)"]}):null]}):y.jsxs("div",{className:"copy-btn-wrap assistant-bubble-wrap",children:[!a.pending&&a.content&&y.jsx(C$,{text:a.content,label:"Copy message"}),a.parts.filter(p=>p.type==="activity-heartbeat").map(p=>y.jsx(bG,{part:p},p.agentSlug)),y.jsx(SG,{parts:a.parts}),a.content||!a.pending?y.jsx(uQ,{content:a.content||""}):a.parts.some(p=>p.type!=="text")?null:y.jsx(xn,{inline:!0,label:`${s} is responding`,detail:i.status==="dreaming"?i.message||"Thinking through the request.":"Streaming the reply as it arrives."}),a.route&&!a.pending&&y.jsxs("div",{className:"route-tag","aria-label":`Response routed to ${a.route.model}`,children:[a.route.tier?`${a.route.tier} → `:"",a.route.model,a.route.overrideName?` · ${a.route.overrideName}`:""]})]})]})]},a.id)})]})}const lse=1e3,cse=3e4,use=10;function hse(t){let e;const n=[];for(const r of t.split(`
|
|
172
|
+
]`,p={scope:"string",variants:[u,c,h,d]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],m=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],O=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],k={keyword:m,literal:(Y=>{const z=[];return Y.forEach($=>{z.push($),$.toLowerCase()===$?z.push($.toUpperCase()):z.push($.toLowerCase())}),z})(b),built_in:O},x=Y=>Y.map(z=>z.replace(/\|\d+$/,"")),S={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",x(O).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},T=e.concat(r,"\\b(?!\\()"),P={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},Q={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},E={relevance:0,begin:/\(/,end:/\)/,keywords:k,contains:[Q,o,P,t.C_BLOCK_COMMENT_MODE,p,g,S]},M={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",x(m).join("\\b|"),"|",x(O).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[E]};E.contains.push(M);const L=[Q,P,t.C_BLOCK_COMMENT_MODE,p,g,S],H={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...L]},...L,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:k,contains:[H,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,M,P,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},S,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:k,contains:["self",H,o,P,t.C_BLOCK_COMMENT_MODE,p,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},p,g]}}function bre(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function wre(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Sre(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",f=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,p=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${f}))[eE][+-]?(${d})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${d})[jJ](?=${p})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,h,t.HASH_COMMENT_MODE]}]};return c.contains=[h,g,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,h]}]}}function kre(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function vre(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function xre(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},h={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},d="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${d})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},S=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=S,g.contains=S;const E=[{begin:/^\s*=>/,starts:{end:"$",contains:S}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:S}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(E).concat(c).concat(S)}}function Cre(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:u}},{className:"punctuation",begin:"->"},s]}}const Ere=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),_re=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Tre=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Are=[..._re,...Tre],Pre=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Ire=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Rre=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Nre=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function $re(t){const e=Ere(t),n=Rre,r=Ire,i="@[a-z-]+",s="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+Are.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Nre.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:Pre.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function Mre(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Qre(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,p=[...c,...l].filter(x=>!u.includes(x)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},m={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function O(x){return e.concat(/\b/,e.either(...x.map(S=>S.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:O(d),relevance:0};function k(x,{exceptions:S,when:T}={}){const P=T;return S=S||[],x.map(Q=>Q.match(/\|\d+$/)||S.includes(Q)?Q:P(Q)?`${Q}|0`:Q)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(p,{when:x=>x.length<3}),literal:s,type:a,built_in:h},contains:[{scope:"type",match:O(o)},w,m,g,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function BM(t){return t?typeof t=="string"?t:t.source:null}function vc(t){return We("(?=",t,")")}function We(...t){return t.map(n=>BM(n)).join("")}function Lre(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function fn(...t){return"("+(Lre(t).capture?"":"?:")+t.map(r=>BM(r)).join("|")+")"}const $v=t=>We(/\b/,t,/\w$/.test(t)?/\b/:/\B/),Dre=["Protocol","Type"].map($v),BE=["init","self"].map($v),zre=["Any","Self"],CO=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],UE=["false","nil","true"],jre=["assignment","associativity","higherThan","left","lowerThan","none","right"],Bre=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],ZE=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],UM=fn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ZM=fn(UM,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),EO=We(UM,ZM,"*"),FM=fn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Ap=fn(FM,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ii=We(FM,Ap,"*"),Ed=We(/[A-Z]/,Ap,"*"),Ure=["attached","autoclosure",We(/convention\(/,fn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",We(/objc\(/,ii,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Zre=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Fre(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,fn(...Dre,...BE)],className:{2:"keyword"}},s={match:We(/\./,fn(...CO)),relevance:0},o=CO.filter(Qe=>typeof Qe=="string").concat(["_|0"]),a=CO.filter(Qe=>typeof Qe!="string").concat(zre).map($v),l={variants:[{className:"keyword",match:fn(...a,...BE)}]},c={$pattern:fn(/\b\w+/,/#\w+/),keyword:o.concat(Bre),literal:UE},u=[i,s,l],h={match:We(/\./,fn(...ZE)),relevance:0},d={className:"built_in",match:We(/\b/,fn(...ZE),/(?=\()/)},f=[h,d],p={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:EO},{match:`\\.(\\.|${ZM})+`}]},b=[p,g],m="([0-9]_*)+",O="([0-9a-fA-F]_*)+",w={className:"number",relevance:0,variants:[{match:`\\b(${m})(\\.(${m}))?([eE][+-]?(${m}))?\\b`},{match:`\\b0x(${O})(\\.(${O}))?([pP][+-]?(${m}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},k=(Qe="")=>({className:"subst",variants:[{match:We(/\\/,Qe,/[0\\tnr"']/)},{match:We(/\\/,Qe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),x=(Qe="")=>({className:"subst",match:We(/\\/,Qe,/[\t ]*(?:[\r\n]|\r\n)/)}),S=(Qe="")=>({className:"subst",label:"interpol",begin:We(/\\/,Qe,/\(/),end:/\)/}),T=(Qe="")=>({begin:We(Qe,/"""/),end:We(/"""/,Qe),contains:[k(Qe),x(Qe),S(Qe)]}),P=(Qe="")=>({begin:We(Qe,/"/),end:We(/"/,Qe),contains:[k(Qe),S(Qe)]}),Q={className:"string",variants:[T(),T("#"),T("##"),T("###"),P(),P("#"),P("##"),P("###")]},E=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],M={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:E},L=Qe=>{const Ar=We(Qe,/\//),Oe=We(/\//,Qe);return{begin:Ar,end:Oe,contains:[...E,{scope:"comment",begin:`#(?!.*${Oe})`,end:/$/}]}},H={scope:"regexp",variants:[L("###"),L("##"),L("#"),M]},Y={match:We(/`/,ii,/`/)},z={className:"variable",match:/\$\d+/},$={className:"variable",match:`\\$${Ap}+`},Z=[Y,z,$],I={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Zre,contains:[...b,w,Q]}]}},D={scope:"keyword",match:We(/@/,fn(...Ure),vc(fn(/\(/,/\s+/)))},C={scope:"meta",match:We(/@/,ii)},F=[I,D,C],W={match:vc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:We(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ap,"+")},{className:"type",match:Ed,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:We(/\s+&\s+/,vc(Ed)),relevance:0}]},v={begin:/</,end:/>/,keywords:c,contains:[...r,...u,...F,p,W]};W.contains.push(v);const V={match:We(ii,/\s*:/),keywords:"_|0",relevance:0},ie={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",V,...r,H,...u,...f,...b,w,Q,...Z,...F,W]},te={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,W]},q={begin:fn(vc(We(ii,/\s*:/)),vc(We(ii,/\s+/,ii,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ii}]},Pe={begin:/\(/,end:/\)/,keywords:c,contains:[q,...r,...u,...b,w,Q,...F,W,ie],endsParent:!0,illegal:/["']/},Fe={match:[/(func|macro)/,/\s+/,fn(Y.match,ii,EO)],className:{1:"keyword",3:"title.function"},contains:[te,Pe,e],illegal:[/\[/,/%/]},Ot={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[te,Pe,e],illegal:/\[|%/},Lt={match:[/operator/,/\s+/,EO],className:{1:"keyword",3:"title"}},lo={begin:[/precedencegroup/,/\s+/,Ed],className:{1:"keyword",3:"title"},contains:[W],keywords:[...jre,...UE],end:/}/},Jr={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},sa={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},un={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ii,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[te,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Ed},...u],relevance:0}]};for(const Qe of Q.variants){const Ar=Qe.contains.find(co=>co.label==="interpol");Ar.keywords=c;const Oe=[...u,...f,...b,w,Q,...Z];Ar.contains=[...Oe,{begin:/\(/,end:/\)/,contains:["self",...Oe]}]}return{name:"Swift",keywords:c,contains:[...r,Fe,Ot,Jr,sa,un,Lt,lo,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},H,...u,...f,...b,w,Q,...Z,...F,W,ie]}}const Pp="[A-Za-z$_][0-9A-Za-z$_]*",XM=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],WM=["true","false","null","undefined","NaN","Infinity"],VM=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],HM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],YM=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],qM=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],GM=[].concat(YM,VM,HM);function Xre(t){const e=t.regex,n=(I,{after:D})=>{const C="</"+I[0].slice(1);return I.input.indexOf(C,D)!==-1},r=Pp,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(I,D)=>{const C=I[0].length+I.index,F=I.input[C];if(F==="<"||F===","){D.ignoreMatch();return}F===">"&&(n(I,{after:C})||D.ignoreMatch());let W;const v=I.input.substring(C);if(W=v.match(/^\s*=/)){D.ignoreMatch();return}if((W=v.match(/^\s+extends\s+/))&&W.index===0){D.ignoreMatch();return}}},a={$pattern:Pp,keyword:XM,literal:WM,built_in:GM,"variable.language":qM},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,d]},O={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},w=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,b,{match:/\$\d+/},h];d.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const k=[].concat(O,d.contains),x=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},T={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},P={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...VM,...HM]}},Q={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},E={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(I){return e.concat("(?!",I.join("|"),")")}const H={match:e.concat(/\b/,L([...YM,"super","import"].map(I=>`${I}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},z={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},$="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",Z={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead($)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:P},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),Q,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,g,b,O,{match:/\$\d+/},h,P,{scope:"attr",match:r+e.lookahead(":"),relevance:0},Z,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[O,t.REGEXP_MODE,{className:"function",begin:$,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},E,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},H,M,T,z,{match:/\$[(.]/}]}}function Wre(t){const e=t.regex,n=Xre(t),r=Pp,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Pp,keyword:XM.concat(l),literal:WM,built_in:GM.concat(i),"variable.language":qM},u={className:"meta",begin:"@"+r},h=(g,b,m)=>{const O=g.contains.findIndex(w=>w.label===b);if(O===-1)throw new Error("can not find mode to replace");g.contains.splice(O,1,m)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const d=n.contains.find(g=>g.scope==="attr"),f=Object.assign({},d,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([u,s,o,f]),h(n,"shebang",t.SHEBANG()),h(n,"use_strict",a);const p=n.contains.find(g=>g.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Vre(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},h=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),d=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,u,h,d,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[d]}]}}function Hre(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,t.QUOTE_STRING_MODE,l,c,a]}}function Yre(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(s,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function qre(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},b=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},d,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,g,s,o],m=[...b];return m.pop(),m.push(a),f.contains=m,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const Gre={arduino:Rne,bash:Nne,c:$ne,cpp:Mne,csharp:Qne,css:Xne,diff:Wne,go:Vne,graphql:Hne,ini:Yne,java:qne,javascript:tre,json:nre,kotlin:ire,less:dre,lua:fre,makefile:pre,markdown:gre,objectivec:mre,perl:Ore,php:yre,"php-template":bre,plaintext:wre,python:Sre,"python-repl":kre,r:vre,ruby:xre,rust:Cre,scss:$re,shell:Mre,sql:Qre,swift:Fre,typescript:Wre,vbnet:Vre,wasm:Hre,xml:Yre,yaml:qre};function KM(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&KM(n)}),t}class FE{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function JM(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ts(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const Kre="</span>",XE=t=>!!t.scope,Jre=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class eie{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=JM(e)}openNode(e){if(!XE(e))return;const n=Jre(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){XE(e)&&(this.buffer+=Kre)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const WE=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class Mv{constructor(){this.rootNode=WE(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=WE({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{Mv._collapse(n)}))}}class tie extends Mv{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new eie(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Xu(t){return t?typeof t=="string"?t:t.source:null}function eQ(t){return ia("(?=",t,")")}function nie(t){return ia("(?:",t,")*")}function rie(t){return ia("(?:",t,")?")}function ia(...t){return t.map(n=>Xu(n)).join("")}function iie(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Qv(...t){return"("+(iie(t).capture?"":"?:")+t.map(r=>Xu(r)).join("|")+")"}function tQ(t){return new RegExp(t.toString()+"|").exec("").length-1}function sie(t,e){const n=t&&t.exec(e);return n&&n.index===0}const oie=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Lv(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let s=Xu(r),o="";for(;s.length>0;){const a=oie.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}const aie=/\b\B/,nQ="[a-zA-Z]\\w*",Dv="[a-zA-Z_]\\w*",rQ="\\b\\d+(\\.\\d+)?",iQ="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",sQ="\\b(0b[01]+)",lie="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",cie=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=ia(e,/.*\b/,t.binary,/\b.*/)),Ts({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Wu={begin:"\\\\[\\s\\S]",relevance:0},uie={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Wu]},hie={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Wu]},die={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},am=function(t,e,n={}){const r=Ts({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=Qv("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:ia(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},fie=am("//","$"),pie=am("/\\*","\\*/"),gie=am("#","$"),mie={scope:"number",begin:rQ,relevance:0},Oie={scope:"number",begin:iQ,relevance:0},yie={scope:"number",begin:sQ,relevance:0},bie={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Wu,{begin:/\[/,end:/\]/,relevance:0,contains:[Wu]}]},wie={scope:"title",begin:nQ,relevance:0},Sie={scope:"title",begin:Dv,relevance:0},kie={begin:"\\.\\s*"+Dv,relevance:0},vie=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})};var _d=Object.freeze({__proto__:null,APOS_STRING_MODE:uie,BACKSLASH_ESCAPE:Wu,BINARY_NUMBER_MODE:yie,BINARY_NUMBER_RE:sQ,COMMENT:am,C_BLOCK_COMMENT_MODE:pie,C_LINE_COMMENT_MODE:fie,C_NUMBER_MODE:Oie,C_NUMBER_RE:iQ,END_SAME_AS_BEGIN:vie,HASH_COMMENT_MODE:gie,IDENT_RE:nQ,MATCH_NOTHING_RE:aie,METHOD_GUARD:kie,NUMBER_MODE:mie,NUMBER_RE:rQ,PHRASAL_WORDS_MODE:die,QUOTE_STRING_MODE:hie,REGEXP_MODE:bie,RE_STARTERS_RE:lie,SHEBANG:cie,TITLE_MODE:wie,UNDERSCORE_IDENT_RE:Dv,UNDERSCORE_TITLE_MODE:Sie});function xie(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function Cie(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function Eie(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=xie,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function _ie(t,e){Array.isArray(t.illegal)&&(t.illegal=Qv(...t.illegal))}function Tie(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function Aie(t,e){t.relevance===void 0&&(t.relevance=1)}const Pie=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=ia(n.beforeMatch,eQ(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},Iie=["of","and","for","in","not","or","if","then","parent","list","value"],Rie="keyword";function oQ(t,e,n=Rie){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(s){Object.assign(r,oQ(t[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,Nie(l[0],l[1])]})}}function Nie(t,e){return e?Number(e):$ie(t)?0:1}function $ie(t){return Iie.includes(t.toLowerCase())}const VE={},Ro=t=>{console.error(t)},HE=(t,...e)=>{console.log(`WARN: ${t}`,...e)},da=(t,e)=>{VE[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),VE[`${t}/${e}`]=!0)},Ip=new Error;function aQ(t,e,{key:n}){let r=0;const i=t[n],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=tQ(e[a-1]);t[n]=o,t[n]._emit=s,t[n]._multi=!0}function Mie(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw Ro("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ip;if(typeof t.beginScope!="object"||t.beginScope===null)throw Ro("beginScope must be object"),Ip;aQ(t,t.begin,{key:"beginScope"}),t.begin=Lv(t.begin,{joinWith:""})}}function Qie(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw Ro("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ip;if(typeof t.endScope!="object"||t.endScope===null)throw Ro("endScope must be object"),Ip;aQ(t,t.end,{key:"endScope"}),t.end=Lv(t.end,{joinWith:""})}}function Lie(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function Die(t){Lie(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),Mie(t),Qie(t)}function zie(t){function e(o,a){return new RegExp(Xu(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=tQ(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(Lv(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((h,d)=>d>0&&h!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[Cie,Tie,Die,Pie].forEach(u=>u(o,a)),t.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[Eie,_ie,Aie].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=oQ(o.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=Xu(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return jie(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ts(t.classNameAliases||{}),s(t)}function lQ(t){return t?t.endsWithParent||lQ(t.starts):!1}function jie(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ts(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:lQ(t)?Ts(t,{starts:t.starts?Ts(t.starts):null}):Object.isFrozen(t)?Ts(t):t}var Bie="11.11.1";class Uie extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const _O=JM,YE=Ts,qE=Symbol("nomatch"),Zie=7,cQ=function(t){const e=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:tie};function l($){return a.noHighlightRe.test($)}function c($){let Z=$.className+" ";Z+=$.parentNode?$.parentNode.className:"";const I=a.languageDetectRe.exec(Z);if(I){const D=P(I[1]);return D||(HE(s.replace("{}",I[1])),HE("Falling back to no-highlight mode for this block.",$)),D?I[1]:"no-highlight"}return Z.split(/\s+/).find(D=>l(D)||P(D))}function u($,Z,I){let D="",C="";typeof Z=="object"?(D=$,I=Z.ignoreIllegals,C=Z.language):(da("10.7.0","highlight(lang, code, ...args) has been deprecated."),da("10.7.0",`Please use highlight(code, options) instead.
|
|
173
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),C=$,D=Z),I===void 0&&(I=!0);const F={code:D,language:C};Y("before:highlight",F);const W=F.result?F.result:h(F.language,F.code,I);return W.code=F.code,Y("after:highlight",W),W}function h($,Z,I,D){const C=Object.create(null);function F(R,j){return R.keywords[j]}function W(){if(!Oe.keywords){Et.addText(Xe);return}let R=0;Oe.keywordPatternRe.lastIndex=0;let j=Oe.keywordPatternRe.exec(Xe),ne="";for(;j;){ne+=Xe.substring(R,j.index);const he=un.case_insensitive?j[0].toLowerCase():j[0],ke=F(Oe,he);if(ke){const[vt,Pi]=ke;if(Et.addText(ne),ne="",C[he]=(C[he]||0)+1,C[he]<=Zie&&(oa+=Pi),vt.startsWith("_"))ne+=j[0];else{const Pr=un.classNameAliases[vt]||vt;ie(j[0],Pr)}}else ne+=j[0];R=Oe.keywordPatternRe.lastIndex,j=Oe.keywordPatternRe.exec(Xe)}ne+=Xe.substring(R),Et.addText(ne)}function v(){if(Xe==="")return;let R=null;if(typeof Oe.subLanguage=="string"){if(!e[Oe.subLanguage]){Et.addText(Xe);return}R=h(Oe.subLanguage,Xe,!0,co[Oe.subLanguage]),co[Oe.subLanguage]=R._top}else R=f(Xe,Oe.subLanguage.length?Oe.subLanguage:null);Oe.relevance>0&&(oa+=R.relevance),Et.__addSublanguage(R._emitter,R.language)}function V(){Oe.subLanguage!=null?v():W(),Xe=""}function ie(R,j){R!==""&&(Et.startScope(j),Et.addText(R),Et.endScope())}function te(R,j){let ne=1;const he=j.length-1;for(;ne<=he;){if(!R._emit[ne]){ne++;continue}const ke=un.classNameAliases[R[ne]]||R[ne],vt=j[ne];ke?ie(vt,ke):(Xe=vt,W(),Xe=""),ne++}}function q(R,j){return R.scope&&typeof R.scope=="string"&&Et.openNode(un.classNameAliases[R.scope]||R.scope),R.beginScope&&(R.beginScope._wrap?(ie(Xe,un.classNameAliases[R.beginScope._wrap]||R.beginScope._wrap),Xe=""):R.beginScope._multi&&(te(R.beginScope,j),Xe="")),Oe=Object.create(R,{parent:{value:Oe}}),Oe}function Pe(R,j,ne){let he=sie(R.endRe,ne);if(he){if(R["on:end"]){const ke=new FE(R);R["on:end"](j,ke),ke.isMatchIgnored&&(he=!1)}if(he){for(;R.endsParent&&R.parent;)R=R.parent;return R}}if(R.endsWithParent)return Pe(R.parent,j,ne)}function Fe(R){return Oe.matcher.regexIndex===0?(Xe+=R[0],1):(oc=!0,0)}function Ot(R){const j=R[0],ne=R.rule,he=new FE(ne),ke=[ne.__beforeBegin,ne["on:begin"]];for(const vt of ke)if(vt&&(vt(R,he),he.isMatchIgnored))return Fe(j);return ne.skip?Xe+=j:(ne.excludeBegin&&(Xe+=j),V(),!ne.returnBegin&&!ne.excludeBegin&&(Xe=j)),q(ne,R),ne.returnBegin?0:j.length}function Lt(R){const j=R[0],ne=Z.substring(R.index),he=Pe(Oe,R,ne);if(!he)return qE;const ke=Oe;Oe.endScope&&Oe.endScope._wrap?(V(),ie(j,Oe.endScope._wrap)):Oe.endScope&&Oe.endScope._multi?(V(),te(Oe.endScope,R)):ke.skip?Xe+=j:(ke.returnEnd||ke.excludeEnd||(Xe+=j),V(),ke.excludeEnd&&(Xe=j));do Oe.scope&&Et.closeNode(),!Oe.skip&&!Oe.subLanguage&&(oa+=Oe.relevance),Oe=Oe.parent;while(Oe!==he.parent);return he.starts&&q(he.starts,R),ke.returnEnd?0:j.length}function lo(){const R=[];for(let j=Oe;j!==un;j=j.parent)j.scope&&R.unshift(j.scope);R.forEach(j=>Et.openNode(j))}let Jr={};function sa(R,j){const ne=j&&j[0];if(Xe+=R,ne==null)return V(),0;if(Jr.type==="begin"&&j.type==="end"&&Jr.index===j.index&&ne===""){if(Xe+=Z.slice(j.index,j.index+1),!i){const he=new Error(`0 width match regex (${$})`);throw he.languageName=$,he.badRule=Jr.rule,he}return 1}if(Jr=j,j.type==="begin")return Ot(j);if(j.type==="illegal"&&!I){const he=new Error('Illegal lexeme "'+ne+'" for mode "'+(Oe.scope||"<unnamed>")+'"');throw he.mode=Oe,he}else if(j.type==="end"){const he=Lt(j);if(he!==qE)return he}if(j.type==="illegal"&&ne==="")return Xe+=`
|
|
174
|
+
`,1;if(sc>1e5&&sc>j.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Xe+=ne,ne.length}const un=P($);if(!un)throw Ro(s.replace("{}",$)),new Error('Unknown language: "'+$+'"');const Qe=zie(un);let Ar="",Oe=D||Qe;const co={},Et=new a.__emitter(a);lo();let Xe="",oa=0,Ai=0,sc=0,oc=!1;try{if(un.__emitTokens)un.__emitTokens(Z,Et);else{for(Oe.matcher.considerAll();;){sc++,oc?oc=!1:Oe.matcher.considerAll(),Oe.matcher.lastIndex=Ai;const R=Oe.matcher.exec(Z);if(!R)break;const j=Z.substring(Ai,R.index),ne=sa(j,R);Ai=R.index+ne}sa(Z.substring(Ai))}return Et.finalize(),Ar=Et.toHTML(),{language:$,value:Ar,relevance:oa,illegal:!1,_emitter:Et,_top:Oe}}catch(R){if(R.message&&R.message.includes("Illegal"))return{language:$,value:_O(Z),illegal:!0,relevance:0,_illegalBy:{message:R.message,index:Ai,context:Z.slice(Ai-100,Ai+100),mode:R.mode,resultSoFar:Ar},_emitter:Et};if(i)return{language:$,value:_O(Z),illegal:!1,relevance:0,errorRaised:R,_emitter:Et,_top:Oe};throw R}}function d($){const Z={value:_O($),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return Z._emitter.addText($),Z}function f($,Z){Z=Z||a.languages||Object.keys(e);const I=d($),D=Z.filter(P).filter(E).map(V=>h(V,$,!1));D.unshift(I);const C=D.sort((V,ie)=>{if(V.relevance!==ie.relevance)return ie.relevance-V.relevance;if(V.language&&ie.language){if(P(V.language).supersetOf===ie.language)return 1;if(P(ie.language).supersetOf===V.language)return-1}return 0}),[F,W]=C,v=F;return v.secondBest=W,v}function p($,Z,I){const D=Z&&n[Z]||I;$.classList.add("hljs"),$.classList.add(`language-${D}`)}function g($){let Z=null;const I=c($);if(l(I))return;if(Y("before:highlightElement",{el:$,language:I}),$.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",$);return}if($.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn($)),a.throwUnescapedHTML))throw new Uie("One of your code blocks includes unescaped HTML.",$.innerHTML);Z=$;const D=Z.textContent,C=I?u(D,{language:I,ignoreIllegals:!0}):f(D);$.innerHTML=C.value,$.dataset.highlighted="yes",p($,I,C.language),$.result={language:C.language,re:C.relevance,relevance:C.relevance},C.secondBest&&($.secondBest={language:C.secondBest.language,relevance:C.secondBest.relevance}),Y("after:highlightElement",{el:$,result:C,text:D})}function b($){a=YE(a,$)}const m=()=>{k(),da("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function O(){k(),da("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function k(){function $(){k()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",$,!1),w=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function x($,Z){let I=null;try{I=Z(t)}catch(D){if(Ro("Language definition for '{}' could not be registered.".replace("{}",$)),i)Ro(D);else throw D;I=o}I.name||(I.name=$),e[$]=I,I.rawDefinition=Z.bind(null,t),I.aliases&&Q(I.aliases,{languageName:$})}function S($){delete e[$];for(const Z of Object.keys(n))n[Z]===$&&delete n[Z]}function T(){return Object.keys(e)}function P($){return $=($||"").toLowerCase(),e[$]||e[n[$]]}function Q($,{languageName:Z}){typeof $=="string"&&($=[$]),$.forEach(I=>{n[I.toLowerCase()]=Z})}function E($){const Z=P($);return Z&&!Z.disableAutodetect}function M($){$["before:highlightBlock"]&&!$["before:highlightElement"]&&($["before:highlightElement"]=Z=>{$["before:highlightBlock"](Object.assign({block:Z.el},Z))}),$["after:highlightBlock"]&&!$["after:highlightElement"]&&($["after:highlightElement"]=Z=>{$["after:highlightBlock"](Object.assign({block:Z.el},Z))})}function L($){M($),r.push($)}function H($){const Z=r.indexOf($);Z!==-1&&r.splice(Z,1)}function Y($,Z){const I=$;r.forEach(function(D){D[I]&&D[I](Z)})}function z($){return da("10.7.0","highlightBlock will be removed entirely in v12.0"),da("10.7.0","Please use highlightElement now."),g($)}Object.assign(t,{highlight:u,highlightAuto:f,highlightAll:k,highlightElement:g,highlightBlock:z,configure:b,initHighlighting:m,initHighlightingOnLoad:O,registerLanguage:x,unregisterLanguage:S,listLanguages:T,getLanguage:P,registerAliases:Q,autoDetection:E,inherit:YE,addPlugin:L,removePlugin:H}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=Bie,t.regex={concat:ia,lookahead:eQ,either:Qv,optional:rie,anyNumberOfTimes:nie};for(const $ in _d)typeof _d[$]=="object"&&KM(_d[$]);return Object.assign(t,_d),t},xl=cQ({});xl.newInstance=()=>cQ({});var Fie=xl;xl.HighlightJS=xl;xl.default=xl;const Xie=dg(Fie),GE={},Wie="hljs-";function Vie(t){const e=Xie.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function n(l,c,u){const h=u||GE,d=typeof h.prefix=="string"?h.prefix:Wie;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:Hie,classPrefix:d});const f=e.highlight(c,{ignoreIllegals:!0,language:l});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,g=p.data;return g.language=f.language,g.relevance=f.relevance,p}function r(l,c){const h=(c||GE).subset||i();let d=-1,f=0,p;for(;++d<h.length;){const g=h[d];if(!e.getLanguage(g))continue;const b=n(g,l,c);b.data&&b.data.relevance!==void 0&&b.data.relevance>f&&(f=b.data.relevance,p=b)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const h=l[u];e.registerAliases(typeof h=="string"?h:[...h],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class Hie{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Yie={};function qie(t){const e=t||Yie,n=e.aliases,r=e.detect||!1,i=e.languages||Gre,s=e.plainText,o=e.prefix,a=e.subset;let l="hljs";const c=Vie(i);if(n&&c.registerAlias(n),o){const u=o.indexOf("-");l=u===-1?o:o.slice(0,u)}return function(u,h){om(u,"element",function(d,f,p){if(d.tagName!=="code"||!p||p.type!=="element"||p.tagName!=="pre")return;const g=Gie(d);if(g===!1||!g&&!r||g&&s&&s.includes(g))return;Array.isArray(d.properties.className)||(d.properties.className=[]),d.properties.className.includes(l)||d.properties.className.unshift(l);const b=xne(d,{whitespace:"pre"});let m;try{m=g?c.highlight(g,b,{prefix:o}):c.highlightAuto(b,{prefix:o,subset:a})}catch(O){const w=O;if(g&&/Unknown language/.test(w.message)){h.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[p,d],cause:w,place:d.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw w}!g&&m.data&&m.data.language&&d.properties.className.push("language-"+m.data.language),m.children.length>0&&(d.children=m.children)})}}function Gie(t){const e=t.properties.className;let n=-1;if(!Array.isArray(e))return;let r;for(;++n<e.length;){const i=String(e[n]);if(i==="no-highlight"||i==="nohighlight")return!1;!r&&i.slice(0,5)==="lang-"&&(r=i.slice(5)),!r&&i.slice(0,9)==="language-"&&(r=i.slice(9))}return r}function Jb(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Jb).join(""):t&&typeof t=="object"&&"props"in t?Jb(t.props.children):""}function Kie({children:t,...e}){const n=Jb(t).replace(/\n$/,"");return y.jsxs("pre",{...e,className:`copy-btn-wrap ${e.className??""}`.trim(),children:[y.jsx(C$,{text:n,label:"Copy code",className:"copy-btn--code"}),t]})}const Jie={pre:Kie};function uQ({content:t}){return y.jsx("div",{className:"md",children:y.jsx(iee,{remarkPlugins:[One],rehypePlugins:[qie],components:Jie,children:t})})}function ese(t){return t<=60?"just now":t<3600?`${Math.floor(t/60)} min later`:`${Math.floor(t/3600)} hr later`}function tse({gapSeconds:t}){const e=ese(t);return y.jsxs("div",{className:"time-separator",role:"separator","aria-label":e,children:[y.jsx("span",{className:"time-separator-line","aria-hidden":"true"}),y.jsx("span",{className:"time-separator-label",children:e}),y.jsx("span",{className:"time-separator-line","aria-hidden":"true"})]})}function nse(t){return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function rse(t){return new Date(t).toISOString()}function ise({message:t,assistantLabel:e}){const n=t.role==="user",r=n?"👤":"🤖",i=n?"You":e,s=rse(t.ts);return y.jsxs("div",{className:`turn-header turn-header--${t.role}`,children:[y.jsxs("span",{className:"turn-actor-badge",children:[y.jsx("span",{className:"turn-actor-icon","aria-hidden":"true",children:r}),y.jsx("span",{className:"turn-actor-name",children:i})]}),y.jsx("time",{className:"turn-ts dim",dateTime:s,title:s,children:nse(t.ts)})]})}const sse=60,ose=120;function ase(t){return t.activities.length>0&&t.content.trim().length<ose}function hQ({messages:t,lastCompletedAssistantId:e,latestAssistantRef:n,rehydrating:r,systemStatus:i,assistantLabel:s,emptyState:o}){return y.jsxs(y.Fragment,{children:[r?y.jsx(xn,{inline:!0,label:"Loading conversation history"}):t.length===0?o:null,t.map((a,l)=>{const c=a.role==="assistant"&&a.id===e,u=l>0?t[l-1]:null,h=u?(a.ts-u.ts)/1e3:0,d=u!==null&&h>sse,f=a.role==="assistant"&&ase(a);return y.jsxs("div",{className:`turn-wrapper${d?" has-separator":""}`,children:[d&&y.jsx(tse,{gapSeconds:h}),y.jsxs("article",{className:`bubble ${a.role}${f?" bubble--agent-activity":""}`,"aria-label":a.role==="user"?"You":s,tabIndex:c?-1:void 0,ref:c?p=>{n.current=p}:void 0,children:[y.jsx(ise,{message:a,assistantLabel:s}),a.role==="user"?y.jsxs("p",{className:"bubble-text user-text",children:[a.content,a.deliveryStatus==="posting"?y.jsxs("span",{className:"msg-queued-indicator","aria-label":"sending",title:"Sending…",children:[" ","⏳"]}):a.deliveryStatus==="queued-backend"?y.jsxs("span",{className:"msg-queued-backend-indicator","aria-label":`queued — ${a.queuePosition??1} ahead`,title:`Waiting in queue (${a.queuePosition??1} ahead)`,children:[" ","📥 Waiting in queue (",a.queuePosition??1," ahead)"]}):null]}):y.jsxs("div",{className:"copy-btn-wrap assistant-bubble-wrap",children:[!a.pending&&a.content&&y.jsx(C$,{text:a.content,label:"Copy message"}),a.parts.filter(p=>p.type==="activity-heartbeat").map(p=>y.jsx(bG,{part:p},p.agentSlug)),y.jsx(SG,{parts:a.parts}),a.content||!a.pending?y.jsx(uQ,{content:a.content||""}):y.jsx(xn,{inline:!0,label:`${s} is responding`,detail:i.status==="dreaming"?i.message||"Thinking through the request.":"Streaming the reply as it arrives."}),a.route&&!a.pending&&y.jsxs("div",{className:"route-tag","aria-label":`Response routed to ${a.route.model}`,children:[a.route.tier?`${a.route.tier} → `:"",a.route.model,a.route.overrideName?` · ${a.route.overrideName}`:""]})]})]})]},a.id)})]})}const lse=1e3,cse=3e4,use=10;function hse(t){let e;const n=[];for(const r of t.split(`
|
|
175
175
|
`))if(!(!r||r.startsWith(":"))){if(r.startsWith("id:")){const i=r.slice(3).trim(),s=parseInt(i,10);isNaN(s)||(e=s);continue}r.startsWith("data:")&&n.push(r.slice(5).trimStart())}return n.length===0?null:{id:e,data:n.join(`
|
|
176
176
|
`)}}function KE(t){const e=[];let n=t;for(;;){const r=n.indexOf(`
|
|
177
177
|
|
|
178
178
|
`);if(r<0)return{frames:e,buffer:n};const i=hse(n.slice(0,r));i&&e.push(i),n=n.slice(r+2)}}function JE(t,e){return new Promise(n=>{if(e!=null&&e.aborted){n();return}const r=window.setTimeout(n,t);e==null||e.addEventListener("abort",()=>{window.clearTimeout(r),n()})})}class dQ{constructor(e,n){ze(this,"sessionKey");ze(this,"onEvent");ze(this,"onError");ze(this,"getReconnectDelay");ze(this,"maxAttempts");ze(this,"doFetch");ze(this,"doCreateAuthHeaders");ze(this,"lastEventId");ze(this,"closedByUser",!1);ze(this,"controller",null);ze(this,"reconnectController",null);ze(this,"reconnectAttempt",0);ze(this,"streamTask",null);this.sessionKey=e,this.onEvent=n.onEvent,this.onError=n.onError,this.getReconnectDelay=n.getReconnectDelay??(r=>Math.min(lse*2**(r-1),cse)),this.maxAttempts=n.maxReconnectAttempts??use,this.doFetch=n.fetch??globalThis.fetch.bind(globalThis),this.doCreateAuthHeaders=n.createAuthHeaders??(()=>Uu()),this.streamTask=this.run().finally(()=>{this.streamTask=null})}async run(){var e;for(;!this.closedByUser;){const n=new AbortController;this.controller=n;try{await this.connectOnce(n.signal),this.reconnectAttempt=0;const r=new AbortController;this.reconnectController=r,await JE(this.getReconnectDelay(0),r.signal),this.reconnectController=null}catch(r){if(n.signal.aborted||this.closedByUser)break;if(this.reconnectAttempt++,this.reconnectAttempt>this.maxAttempts){const o=r instanceof Error?r:new Error(String(r));(e=this.onError)==null||e.call(this,o);break}const i=this.getReconnectDelay(this.reconnectAttempt),s=new AbortController;this.reconnectController=s,await JE(i,s.signal),this.reconnectController=null}}this.controller=null}async connectOnce(e){const n=await this.doCreateAuthHeaders();this.lastEventId!==void 0&&n.set("Last-Event-ID",String(this.lastEventId));const r=`/api/sessions/${encodeURIComponent(this.sessionKey)}/stream`,i=await this.doFetch(r,{method:"GET",headers:n,cache:"no-store",signal:e});if(!i.ok)throw new Error(`Session stream failed: ${i.status} ${i.statusText}`);if(!i.body)throw new Error("Session stream: response body unavailable");const s=i.body.getReader(),o=new TextDecoder;let a="";try{for(;;){const{value:c,done:u}=await s.read();if(u)break;a+=o.decode(c,{stream:!0}).replace(/\r/g,"");const h=KE(a);a=h.buffer;for(const d of h.frames)this.handleFrame(d)}a+=o.decode().replace(/\r/g,"");const l=KE(`${a}
|
|
179
179
|
|
|
180
|
-
`);for(const c of l.frames)this.handleFrame(c)}finally{s.releaseLock()}}handleFrame(e){if(e.id!==void 0&&(this.lastEventId=e.id),!e.data)return;let n;try{n=JSON.parse(e.data)}catch{return}const r=Rq.safeParse(n);if(r.success)try{this.onEvent(r.data)}catch{}}close(){var e,n;this.closedByUser=!0,(e=this.controller)==null||e.abort(),(n=this.reconnectController)==null||n.abort(),this.controller=null}reconnect(){var e,n;this.reconnectAttempt=0,(e=this.controller)==null||e.abort(),(n=this.reconnectController)==null||n.abort(),!this.streamTask&&!this.closedByUser&&(this.streamTask=this.run().finally(()=>{this.streamTask=null}))}getLastEventId(){return this.lastEventId}}const dse="Available slash commands:\n- `/clear` — clear the on-screen conversation (server history is preserved)\n- `/cancel` — cancel the in-flight response\n- `/copy` — copy the last assistant response to the clipboard\n- `/restart` — restart the daemon\n- `/model` — go to Settings → model picker\n- `/skills` — go to Skills\n- `/agents`, `/workers` — go to Workers\n- `/memory`, `/wiki` — go to Wiki\n- `/history` — go to History\n- `/help` — show this list";function fse(){const{systemStatus:t}=oR(),e=Ae(v=>v.messagesBySession.default??pv),n=Ae(v=>v.addUserMessage),r=Ae(v=>v.markMessageSent),i=Ae(v=>v.clearMessages),s=Ae(v=>v.finishAssistant),o=Ae(v=>v.startAssistantMessage),a=Ae(v=>v.seedMessages),l=Ae(v=>v.connectionId),c=Ae(v=>v.tagUserMessageTurnId),u=Ae(v=>v.applyTurnEvent),h=is(),[d,f]=A.useState(""),[p,g]=A.useState(!1),[b,m]=A.useState(null),[O,w]=A.useState(!1),[k,x]=A.useState(!1),S=A.useRef(null),T=A.useRef(null),P=A.useRef(null),Q=A.useRef(null),E=A.useRef(null),M=A.useId(),L=A.useId();A.useEffect(()=>{const v=Ae.getState().messagesBySession.default;if(v&&v.
|
|
180
|
+
`);for(const c of l.frames)this.handleFrame(c)}finally{s.releaseLock()}}handleFrame(e){if(e.id!==void 0&&(this.lastEventId=e.id),!e.data)return;let n;try{n=JSON.parse(e.data)}catch{return}const r=Rq.safeParse(n);if(r.success)try{this.onEvent(r.data)}catch{}}close(){var e,n;this.closedByUser=!0,(e=this.controller)==null||e.abort(),(n=this.reconnectController)==null||n.abort(),this.controller=null}reconnect(){var e,n;this.reconnectAttempt=0,(e=this.controller)==null||e.abort(),(n=this.reconnectController)==null||n.abort(),!this.streamTask&&!this.closedByUser&&(this.streamTask=this.run().finally(()=>{this.streamTask=null}))}getLastEventId(){return this.lastEventId}}const dse="Available slash commands:\n- `/clear` — clear the on-screen conversation (server history is preserved)\n- `/cancel` — cancel the in-flight response\n- `/copy` — copy the last assistant response to the clipboard\n- `/restart` — restart the daemon\n- `/model` — go to Settings → model picker\n- `/skills` — go to Skills\n- `/agents`, `/workers` — go to Workers\n- `/memory`, `/wiki` — go to Wiki\n- `/history` — go to History\n- `/help` — show this list";function fse(){const{systemStatus:t}=oR(),e=Ae(v=>v.messagesBySession.default??pv),n=Ae(v=>v.addUserMessage),r=Ae(v=>v.markMessageSent),i=Ae(v=>v.clearMessages),s=Ae(v=>v.finishAssistant),o=Ae(v=>v.startAssistantMessage),a=Ae(v=>v.seedMessages),l=Ae(v=>v.connectionId),c=Ae(v=>v.tagUserMessageTurnId),u=Ae(v=>v.applyTurnEvent),h=is(),[d,f]=A.useState(""),[p,g]=A.useState(!1),[b,m]=A.useState(null),[O,w]=A.useState(!1),[k,x]=A.useState(!1),S=A.useRef(null),T=A.useRef(null),P=A.useRef(null),Q=A.useRef(null),E=A.useRef(null),M=A.useId(),L=A.useId();A.useEffect(()=>{const v=Ae.getState().messagesBySession.default;if(v&&v.some(ie=>ie.role==="user"))return;let V=!1;return w(!0),He.getSessionMessages("default").then(({messages:ie})=>{V||ie.length>0&&a(ie,"default")}).catch(()=>{}).finally(()=>{V||w(!1)}),()=>{V=!0}},[]),A.useEffect(()=>{let v=null;return Jg().then(V=>{const ie=V.chatSseEnabled??!1;x(ie),ie&&(v=new dQ("default",{onEvent:te=>{u(te.turnId,te,"default")}}),S.current=v)}).catch(()=>{}),()=>{v==null||v.close(),S.current=null}},[]);const H=A.useMemo(()=>[...e].reverse().find(v=>v.role==="assistant"),[e]),Y=A.useMemo(()=>[...e].reverse().find(v=>v.role==="assistant"&&!v.pending),[e]),z=(H==null?void 0:H.role)==="assistant"&&H.pending,$=e.some(v=>v.role==="user"&&v.deliveryStatus==="queued-backend"),Z=z||$,I=(Y==null?void 0:Y.id)??null;A.useEffect(()=>{const v=T.current;v&&(v.scrollTop=v.scrollHeight)},[e]),A.useEffect(()=>{var v;!I||E.current===I||(E.current=I,document.activeElement!==P.current&&((v=Q.current)==null||v.focus({preventScroll:!0})))},[I]);async function D(){try{m(null),await He.cancel()}catch(v){m(v instanceof Error?v.message:String(v))}}async function C(v){const V=v.trim().toLowerCase();if(!V.startsWith("/"))return!1;const[ie]=V.split(/\s+/);switch(ie){case"/clear":return m(null),i("default"),!0;case"/cancel":return await D(),!0;case"/copy":{const te=[...e].reverse().find(q=>q.role==="assistant");if(!te)return m("There is no assistant response to copy yet."),!0;try{const q=te.parts.find(Fe=>Fe.type==="text"),Pe=q?q.text:te.content;await navigator.clipboard.writeText(Pe),m(null)}catch(q){m(q instanceof Error?q.message:"Couldn't copy the last response.")}return!0}case"/restart":{try{await He.restart();const te=o("default");s(te,"_Restarting Chapterhouse…_","default"),m(null)}catch(te){m(te instanceof Error?te.message:String(te))}return!0}case"/help":{const te=o("default");return s(te,dse,"default"),m(null),!0}case"/model":case"/settings":return h("/settings"),!0;case"/skills":return h("/skills"),!0;case"/agents":case"/workers":return h("/workers"),!0;case"/memory":case"/wiki":return h("/wiki"),!0;case"/history":return h("/history"),!0;default:return!1}}async function F(){const v=d.trim();if(!v||p)return;if(m(null),await C(v)){f("");return}f("");const V=n(v,"default");g(!0);try{if(k){const{turnId:ie}=await He.submitTurn("default",{prompt:v,interrupt:z||void 0});c(V,ie,"default"),r(V,"default")}else{if(!l){m("Still connecting to Chapterhouse. Try again in a moment."),f(v);return}if(z)await He.interruptMessage("default",l,v);else{const ie=crypto.randomUUID();await He.sendMessage(v,l,void 0,"default",ie)}r(V,"default")}}catch(ie){const te=ie instanceof Error?ie.message:String(ie);f(v),m(te);const q=o("default");s(q,`**Error:** ${te}
|
|
181
181
|
|
|
182
|
-
Try sending your message again.`,"default")}finally{g(!1)}}function W(v){v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),F()),v.key==="Escape"&&z&&(v.preventDefault(),D())}return y.jsxs("div",{className:"chat",children:[y.jsx("p",{className:"sr-only","aria-live":"polite",children:z?"Chapterhouse is responding.":t.status==="dreaming"?t.message||"Chapterhouse is thinking.":""}),y.jsx("section",{className:"chat-scroll",ref:T,"aria-label":"Conversation",children:y.jsx("div",{className:"chat-log",role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":z,children:y.jsx(hQ,{messages:e,lastCompletedAssistantId:I,latestAssistantRef:Q,rehydrating:O,systemStatus:t,assistantLabel:"Chapterhouse",emptyState:y.jsx(Ws,{title:"Talk to Chapterhouse.",description:'Try: "What sessions are running?" · "Start working on the auth bug in ~/dev/myapp"',action:y.jsxs("p",{className:"dim small",children:["Type ",y.jsx("code",{children:"/help"})," for slash commands."]})})})})}),y.jsxs("div",{className:"composer",children:[b?y.jsx(kn,{inline:!0,message:b,onRetry:d.trim()&&l?()=>void F():void 0}):null,y.jsx("label",{className:"sr-only",htmlFor:"chat-composer",children:"Message Chapterhouse"}),y.jsx("textarea",{id:"chat-composer",ref:P,value:d,onChange:v=>f(v.target.value),onKeyDown:W,placeholder:"Message Chapterhouse…",rows:3,disabled:!k&&!l,"aria-describedby":`${M}${t.status==="dreaming"?` ${L}`:""}`}),y.jsx("div",{id:M,className:"composer-help dim small",children:"Enter sends · Shift+Enter adds a newline · Escape cancels an in-flight response."}),t.status==="dreaming"?y.jsxs("div",{id:L,className:"dreaming-indicator","aria-live":"polite",children:[y.jsx("span",{className:"dreaming-indicator-glyph","aria-hidden":"true",children:"✦"}),y.jsx("span",{children:t.message||"Chapterhouse is thinking…"})]}):null,y.jsx("div",{className:"composer-actions",children:Z?y.jsx("button",{type:"button",onClick:()=>void D(),className:"btn cancel",children:"Cancel"}):y.jsx("button",{type:"button",onClick:()=>void F(),disabled:!d.trim()||!k&&!l||p,className:"btn primary","aria-busy":p,children:p?"Sending…":"Send"})})]})]})}const pse="Available slash commands:\n- `/clear` — clear the on-screen conversation (server history is preserved)\n- `/cancel` — cancel the in-flight response\n- `/copy` — copy the last assistant response to the clipboard\n- `/help` — show this list";function gse(){const{systemStatus:t}=oR(),{projectRef:e}=LU(),n=is(),r=A.useMemo(()=>Fq(e),[e]),i=A.useMemo(()=>Xq(r),[r]),s=r.split("/").filter(Boolean).pop()??r,o=Ae(q=>q.messagesBySession[i]??pv),a=Ae(q=>q.addUserMessage),l=Ae(q=>q.markMessageSent),c=Ae(q=>q.clearMessages),u=Ae(q=>q.finishAssistant),h=Ae(q=>q.startAssistantMessage),d=Ae(q=>q.seedMessages),f=Ae(q=>q.connectionId),p=Ae(q=>q.tagUserMessageTurnId),g=Ae(q=>q.applyTurnEvent),[b,m]=A.useState(""),[O,w]=A.useState(!1),[k,x]=A.useState(null),[S,T]=A.useState(!1),[P,Q]=A.useState(!1),E=A.useRef(null),M=A.useRef(null),L=A.useRef(null),H=A.useRef(null),Y=A.useRef(null),z=A.useId(),$=A.useId();A.useEffect(()=>{const q=Ae.getState().messagesBySession[i];if(q&&q.length>0)return;let Pe=!1;return T(!0),He.getSessionMessages(i).then(({messages:Fe})=>{Pe||Fe.length>0&&d(Fe,i)}).catch(()=>{}).finally(()=>{Pe||T(!1)}),()=>{Pe=!0}},[i]),A.useEffect(()=>{let q=null;return Jg().then(Pe=>{const Fe=Pe.chatSseEnabled??!1;Q(Fe),Fe&&(q=new dQ(i,{onEvent:Ot=>{g(Ot.turnId,Ot,i)}}),E.current=q)}).catch(()=>{}),()=>{q==null||q.close(),E.current=null}},[i]);const Z=A.useMemo(()=>[...o].reverse().find(q=>q.role==="assistant"),[o]),I=A.useMemo(()=>[...o].reverse().find(q=>q.role==="assistant"&&!q.pending),[o]),D=(Z==null?void 0:Z.role)==="assistant"&&Z.pending,C=o.some(q=>q.role==="user"&&q.deliveryStatus==="queued-backend"),F=D||C,W=(I==null?void 0:I.id)??null;A.useEffect(()=>{const q=M.current;q&&(q.scrollTop=q.scrollHeight)},[o]),A.useEffect(()=>{var q;!W||Y.current===W||(Y.current=W,document.activeElement!==L.current&&((q=H.current)==null||q.focus({preventScroll:!0})))},[W]);async function v(){try{x(null),await He.cancel()}catch(q){x(q instanceof Error?q.message:String(q))}}async function V(q){const Pe=q.trim().toLowerCase();if(!Pe.startsWith("/"))return!1;const[Fe]=Pe.split(/\s+/);switch(Fe){case"/clear":return x(null),c(i),!0;case"/cancel":return await v(),!0;case"/copy":{const Ot=[...o].reverse().find(Lt=>Lt.role==="assistant");if(!Ot)return x("There is no assistant response to copy yet."),!0;try{const Lt=Ot.parts.find(Jr=>Jr.type==="text"),lo=Lt?Lt.text:Ot.content;await navigator.clipboard.writeText(lo),x(null)}catch(Lt){x(Lt instanceof Error?Lt.message:"Couldn't copy the last response.")}return!0}case"/help":{const Ot=h(i);return u(Ot,pse,i),x(null),!0}default:return!1}}async function
|
|
182
|
+
Try sending your message again.`,"default")}finally{g(!1)}}function W(v){v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),F()),v.key==="Escape"&&z&&(v.preventDefault(),D())}return y.jsxs("div",{className:"chat",children:[y.jsx("p",{className:"sr-only","aria-live":"polite",children:z?"Chapterhouse is responding.":t.status==="dreaming"?t.message||"Chapterhouse is thinking.":""}),y.jsx("section",{className:"chat-scroll",ref:T,"aria-label":"Conversation",children:y.jsx("div",{className:"chat-log",role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":z,children:y.jsx(hQ,{messages:e,lastCompletedAssistantId:I,latestAssistantRef:Q,rehydrating:O,systemStatus:t,assistantLabel:"Chapterhouse",emptyState:y.jsx(Ws,{title:"Talk to Chapterhouse.",description:'Try: "What sessions are running?" · "Start working on the auth bug in ~/dev/myapp"',action:y.jsxs("p",{className:"dim small",children:["Type ",y.jsx("code",{children:"/help"})," for slash commands."]})})})})}),y.jsxs("div",{className:"composer",children:[b?y.jsx(kn,{inline:!0,message:b,onRetry:d.trim()&&l?()=>void F():void 0}):null,y.jsx("label",{className:"sr-only",htmlFor:"chat-composer",children:"Message Chapterhouse"}),y.jsx("textarea",{id:"chat-composer",ref:P,value:d,onChange:v=>f(v.target.value),onKeyDown:W,placeholder:"Message Chapterhouse…",rows:3,disabled:!k&&!l,"aria-describedby":`${M}${t.status==="dreaming"?` ${L}`:""}`}),y.jsx("div",{id:M,className:"composer-help dim small",children:"Enter sends · Shift+Enter adds a newline · Escape cancels an in-flight response."}),t.status==="dreaming"?y.jsxs("div",{id:L,className:"dreaming-indicator","aria-live":"polite",children:[y.jsx("span",{className:"dreaming-indicator-glyph","aria-hidden":"true",children:"✦"}),y.jsx("span",{children:t.message||"Chapterhouse is thinking…"})]}):null,y.jsx("div",{className:"composer-actions",children:Z?y.jsx("button",{type:"button",onClick:()=>void D(),className:"btn cancel",children:"Cancel"}):y.jsx("button",{type:"button",onClick:()=>void F(),disabled:!d.trim()||!k&&!l||p,className:"btn primary","aria-busy":p,children:p?"Sending…":"Send"})})]})]})}const pse="Available slash commands:\n- `/clear` — clear the on-screen conversation (server history is preserved)\n- `/cancel` — cancel the in-flight response\n- `/copy` — copy the last assistant response to the clipboard\n- `/help` — show this list";function gse(){const{systemStatus:t}=oR(),{projectRef:e}=LU(),n=is(),r=A.useMemo(()=>Fq(e),[e]),i=A.useMemo(()=>Xq(r),[r]),s=r.split("/").filter(Boolean).pop()??r,o=Ae(q=>q.messagesBySession[i]??pv),a=Ae(q=>q.addUserMessage),l=Ae(q=>q.markMessageSent),c=Ae(q=>q.clearMessages),u=Ae(q=>q.finishAssistant),h=Ae(q=>q.startAssistantMessage),d=Ae(q=>q.seedMessages),f=Ae(q=>q.connectionId),p=Ae(q=>q.tagUserMessageTurnId),g=Ae(q=>q.applyTurnEvent),[b,m]=A.useState(""),[O,w]=A.useState(!1),[k,x]=A.useState(null),[S,T]=A.useState(!1),[P,Q]=A.useState(!1),E=A.useRef(null),M=A.useRef(null),L=A.useRef(null),H=A.useRef(null),Y=A.useRef(null),z=A.useId(),$=A.useId();A.useEffect(()=>{const q=Ae.getState().messagesBySession[i];if(q&&q.length>0)return;let Pe=!1;return T(!0),He.getSessionMessages(i).then(({messages:Fe})=>{Pe||Fe.length>0&&d(Fe,i)}).catch(()=>{}).finally(()=>{Pe||T(!1)}),()=>{Pe=!0}},[i]),A.useEffect(()=>{let q=null;return Jg().then(Pe=>{const Fe=Pe.chatSseEnabled??!1;Q(Fe),Fe&&(q=new dQ(i,{onEvent:Ot=>{g(Ot.turnId,Ot,i)}}),E.current=q)}).catch(()=>{}),()=>{q==null||q.close(),E.current=null}},[i]);const Z=A.useMemo(()=>[...o].reverse().find(q=>q.role==="assistant"),[o]),I=A.useMemo(()=>[...o].reverse().find(q=>q.role==="assistant"&&!q.pending),[o]),D=(Z==null?void 0:Z.role)==="assistant"&&Z.pending,C=o.some(q=>q.role==="user"&&q.deliveryStatus==="queued-backend"),F=D||C,W=(I==null?void 0:I.id)??null;A.useEffect(()=>{const q=M.current;q&&(q.scrollTop=q.scrollHeight)},[o]),A.useEffect(()=>{var q;!W||Y.current===W||(Y.current=W,document.activeElement!==L.current&&((q=H.current)==null||q.focus({preventScroll:!0})))},[W]);async function v(){try{x(null),await He.cancel()}catch(q){x(q instanceof Error?q.message:String(q))}}async function V(q){const Pe=q.trim().toLowerCase();if(!Pe.startsWith("/"))return!1;const[Fe]=Pe.split(/\s+/);switch(Fe){case"/clear":return x(null),c(i),!0;case"/cancel":return await v(),!0;case"/copy":{const Ot=[...o].reverse().find(Lt=>Lt.role==="assistant");if(!Ot)return x("There is no assistant response to copy yet."),!0;try{const Lt=Ot.parts.find(Jr=>Jr.type==="text"),lo=Lt?Lt.text:Ot.content;await navigator.clipboard.writeText(lo),x(null)}catch(Lt){x(Lt instanceof Error?Lt.message:"Couldn't copy the last response.")}return!0}case"/help":{const Ot=h(i);return u(Ot,pse,i),x(null),!0}default:return!1}}async function ie(){const q=b.trim();if(!q||O)return;if(x(null),await V(q)){m("");return}m("");const Pe=a(q,i);w(!0);try{if(P){const{turnId:Fe}=await He.submitTurn(i,{prompt:q,interrupt:D||void 0});p(Pe,Fe,i),l(Pe,i)}else{if(!f){x("Still connecting to Chapterhouse. Try again in a moment."),m(q);return}if(D)await He.interruptMessage(i,f,q);else{const Fe=crypto.randomUUID();await He.sendMessage(q,f,r,i,Fe)}l(Pe,i)}}catch(Fe){const Ot=Fe instanceof Error?Fe.message:String(Fe);m(q),x(Ot);const Lt=h(i);u(Lt,`**Error:** ${Ot}
|
|
183
183
|
|
|
184
|
-
Try sending your message again.`,i)}finally{w(!1)}}function te(q){q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),
|
|
184
|
+
Try sending your message again.`,i)}finally{w(!1)}}function te(q){q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),ie()),q.key==="Escape"&&D&&(q.preventDefault(),v())}return y.jsxs("div",{className:"chat",children:[y.jsx("p",{className:"sr-only","aria-live":"polite",children:D?"Squad Coordinator is responding.":t.status==="dreaming"?t.message||"Squad Coordinator is thinking.":""}),y.jsxs("div",{className:"project-chat-header",role:"banner","aria-label":`Squad Coordinator for ${s}`,children:[y.jsxs("div",{className:"project-chat-header-identity",children:[y.jsx("span",{className:"project-chat-icon","aria-hidden":"true",children:"🏗️"}),y.jsxs("span",{className:"project-chat-title",children:["Squad Coordinator — ",y.jsx("strong",{children:s})]}),y.jsx("span",{className:"project-chat-path dim",title:r,children:r})]}),y.jsx("button",{type:"button",className:"btn",onClick:()=>n("/chat"),"aria-label":"Back to Chapterhouse",children:"← Back to Chapterhouse"})]}),y.jsx("section",{className:"chat-scroll",ref:M,"aria-label":"Conversation",children:y.jsx("div",{className:"chat-log",role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":D,children:y.jsx(hQ,{messages:o,lastCompletedAssistantId:W,latestAssistantRef:H,rehydrating:S,systemStatus:t,assistantLabel:"Squad Coordinator",emptyState:y.jsx(Ws,{title:`Working in ${s}.`,description:`Try: "@ripley fix the auth bug" · "Who's on the squad team?"`,action:y.jsxs("p",{className:"dim small",children:["Type ",y.jsx("code",{children:"/help"})," for slash commands."]})})})})}),y.jsxs("div",{className:"composer",children:[k?y.jsx(kn,{inline:!0,message:k,onRetry:b.trim()&&f?()=>void ie():void 0}):null,y.jsx("label",{className:"sr-only",htmlFor:"project-chat-composer",children:"Message Squad Coordinator"}),y.jsx("textarea",{id:"project-chat-composer",ref:L,value:b,onChange:q=>m(q.target.value),onKeyDown:te,placeholder:`Message Squad (${s})…`,rows:3,disabled:!f,"aria-describedby":`${z}${t.status==="dreaming"?` ${$}`:""}`}),y.jsx("div",{id:z,className:"composer-help dim small",children:"Enter sends · Shift+Enter adds a newline · Escape cancels an in-flight response."}),t.status==="dreaming"?y.jsxs("div",{id:$,className:"dreaming-indicator","aria-live":"polite",children:[y.jsx("span",{className:"dreaming-indicator-glyph","aria-hidden":"true",children:"✦"}),y.jsx("span",{children:t.message||"Squad Coordinator is thinking…"})]}):null,y.jsx("div",{className:"composer-actions",children:F?y.jsx("button",{type:"button",onClick:()=>void v(),className:"btn cancel",children:"Cancel"}):y.jsx("button",{type:"button",onClick:()=>void ie(),disabled:!b.trim()||!f||O,className:"btn primary","aria-busy":O,children:O?"Sending…":"Send"})})]})]})}function mse(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState([]),[o,a]=A.useState(null),[l,c]=A.useState(!0),u=A.useRef(null),h=A.useRef(null),d=A.useRef(null);async function f({silent:O=!1}={}){O||c(!0);try{const w=await He.listWorkers();if(e(w),a(null),n){const k=await He.getWorker(n.taskId).catch(()=>null);k&&r(k)}}catch(w){a(w instanceof Error?w.message:String(w))}finally{O||c(!1)}}async function p(){var w;(w=h.current)==null||w.abort();const O=new AbortController;h.current=O;try{const k=await Uu({Accept:"text/event-stream"}),x=await fetch("/api/squad/stream",{method:"GET",headers:k,cache:"no-store",signal:O.signal});if(!x.ok||!x.body)return;const S=x.body.getReader(),T=new TextDecoder;let P="";for(;;){const{value:Q,done:E}=await S.read();if(E||O.signal.aborted)break;P+=T.decode(Q,{stream:!0});const M=P.split(`
|
|
185
185
|
|
|
186
186
|
`);P=M.pop()??"";for(const L of M){const H=L.split(`
|
|
187
187
|
`).find(Y=>Y.startsWith("data: "));if(H)try{const Y=JSON.parse(H.slice(6));if(Y.type==="squad_event"){const z=Y.squadEvent,$=(z==null?void 0:z.type)??"";($==="session:created"||$==="session:destroyed"||$==="session:error")&&f({silent:!0})}}catch{}}}}catch(k){if(k instanceof Error&&k.name==="AbortError")return}}A.useEffect(()=>{f(),p();const O=setInterval(()=>{f({silent:!0})},1e4);return()=>{var w;clearInterval(O),(w=h.current)==null||w.abort()}},[n==null?void 0:n.taskId]),A.useEffect(()=>{const O=d.current;if(!O)return;O.scrollHeight-O.scrollTop-O.clientHeight<80&&(O.scrollTop=O.scrollHeight)},[i.length]);async function g(O){var k;(k=u.current)==null||k.abort();const w=new AbortController;u.current=w;try{const x=await He.getWorkerEvents(O);s(x.events);const S=x.events.length>0?x.events[x.events.length-1].seq:0,T=await Uu({Accept:"text/event-stream"}),P=await fetch(`/api/workers/${encodeURIComponent(O)}/events/stream`,{method:"GET",headers:T,cache:"no-store",signal:w.signal});if(!P.ok||!P.body)return;const Q=P.body.getReader(),E=new TextDecoder;let M="",L=S;for(;;){const{value:H,done:Y}=await Q.read();if(Y||w.signal.aborted)break;M+=E.decode(H,{stream:!0});const z=M.split(`
|
|
188
188
|
|
|
189
189
|
`);M=z.pop()??"";for(const $ of z){const Z=$.split(`
|
|
190
|
-
`).find(I=>I.startsWith("data: "));if(Z)try{const I=JSON.parse(Z.slice(6));if(I.type==="task_event"&&typeof I.seq=="number"&&I.seq>L){L=I.seq;const D={id:typeof I.id=="number"?I.id:0,taskId:typeof I.taskId=="string"?I.taskId:O,seq:I.seq,ts:typeof I.ts=="number"?I.ts:Date.now(),kind:I.kind==="tool_complete"?"tool_complete":"tool_start",toolName:typeof I.toolName=="string"?I.toolName:null,summary:typeof I.summary=="string"?I.summary:null};s(C=>[...C,D])}}catch{}}}}catch(x){if(x instanceof Error&&x.name==="AbortError")return}}async function b(O){try{const w=await He.getWorker(O.taskId);r(w),s([]),a(null),g(O.taskId)}catch(w){a(w instanceof Error?w.message:String(w))}}A.useEffect(()=>()=>{var O;(O=u.current)==null||O.abort()},[]);function m(O){return new Date(O).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}return y.jsxs("div",{className:"page workers",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Workers"}),y.jsx("p",{className:"dim",children:"Active and recent agent tasks (last 24 h). Updates every 4s."})]}),o?y.jsx(kn,{inline:!0,message:o,onRetry:()=>void f()}):null,y.jsxs("div",{className:"workers-layout",children:[y.jsxs("div",{className:"workers-list","aria-busy":l,children:[l&&t===null?y.jsx(xn,{inline:!0,label:"Loading workers"}):null,t&&t.length===0?y.jsx(Ws,{icon:"🤖",title:"No tasks yet",description:"No agent tasks in the last 24 hours."}):null,t==null?void 0:t.map(O=>y.jsxs("button",{type:"button",className:"worker-row"+((n==null?void 0:n.taskId)===O.taskId?" selected":""),onClick:()=>void b(O),"aria-pressed":(n==null?void 0:n.taskId)===O.taskId,children:[y.jsxs("div",{className:"worker-row-head",children:[y.jsx("strong",{children:O.name||`@${O.slug}`}),y.jsx("span",{className:`worker-status worker-status--${O.status}`,children:O.status})]}),y.jsx("div",{className:"worker-row-desc",children:O.description}),y.jsxs("div",{className:"dim small",children:["@",O.slug," · ",O.model]})]},O.taskId))]}),y.jsx("div",{className:"workers-detail","aria-live":"polite",children:n?y.jsxs(y.Fragment,{children:[y.jsxs("h2",{children:[n.name||n.agentSlug," ",y.jsxs("span",{className:"dim worker-detail-slug",children:["@",n.agentSlug]})]}),y.jsx("p",{className:"worker-detail-description",children:n.description}),y.jsxs("p",{className:"dim small worker-detail-meta",children:[y.jsx("span",{className:`worker-status worker-status--${n.status}`,children:n.status})," · ","started ",n.startedAt,n.completedAt?` · completed ${n.completedAt}`:""," · ",y.jsx("span",{className:"worker-detail-taskid",children:n.taskId})]}),y.jsx("h3",{children:"Activity"}),i.length===0&&n.status==="running"?y.jsx("p",{className:"dim small",children:"Waiting for tool-call activity…"}):i.length===0?y.jsx("p",{className:"dim small",children:"(no tool-call activity recorded)"}):y.jsx("div",{className:"worker-events",ref:d,children:i.map(O=>y.jsxs("div",{className:`worker-event worker-event--${O.kind}`,children:[y.jsx("span",{className:"worker-event-ts",children:m(O.ts)}),O.kind==="tool_start"?y.jsxs("span",{className:"worker-event-body",children:[y.jsx("span",{className:"worker-event-icon",children:"⚙️"}),y.jsx("strong",{children:O.toolName??"tool"}),O.summary?y.jsxs("span",{className:"dim",children:[" — ",O.summary]}):null]}):y.jsxs("span",{className:"worker-event-body",children:[y.jsx("span",{className:"worker-event-icon",children:"✅"}),O.summary?y.jsx("span",{className:"dim",children:O.summary}):y.jsx("span",{className:"dim",children:"done"})]})]},O.id))}),y.jsx("h3",{children:"Result"}),y.jsx("pre",{className:"output",children:n.result??"(no output yet — task still running)"})]}):y.jsx(Ws,{icon:"👈",title:"Pick a worker",description:"Select a task from the list to inspect its details."})})]})]})}const Ose=10;function yse(){var Q;const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState([]),[o,a]=A.useState(""),[l,c]=A.useState(Ose),[u,h]=A.useState(null),[d,f]=A.useState(null),[p,g]=A.useState(!1),[b,m]=A.useState(null),O=A.useRef(null);A.useEffect(()=>(w(),O.current=globalThis.setInterval(()=>void w(),5e3),()=>{O.current!==null&&globalThis.clearInterval(O.current)}),[]),A.useEffect(()=>{eu.list().then(E=>{s(E),E.length>0&&!o&&a(E[0].projectRoot)}).catch(()=>{})},[]),A.useEffect(()=>{o&&k(o)},[o,t==null?void 0:t.running]);async function w(){try{const E=await md.getStatus();e(E),h(null),E.projectRoot&&E.projectRoot!==o&&a(E.projectRoot)}catch(E){h(E instanceof Error?E.message:String(E))}}async function k(E){try{const M=await md.getQueue(E);r(M.issues),f(null)}catch(M){f(M instanceof Error?M.message:String(M)),r(null)}}async function x(){if(o){g(!0),m(null);try{await md.start(o,l),await w()}catch(E){m(E instanceof Error?E.message:String(E))}finally{g(!1)}}}async function S(){g(!0),m(null);try{await md.stop(),await w()}catch(E){m(E instanceof Error?E.message:String(E))}finally{g(!1)}}function T(E){if(!E)return"—";try{const M=Date.now()-new Date(E).getTime(),L=Math.floor(M/1e3);if(L<60)return`${L}s ago`;const H=Math.floor(L/60);return H<60?`${H}m ago`:`${Math.floor(H/60)}h ago`}catch{return E}}function P(E){return E.startsWith("priority:p0")||E.startsWith("priority:p1")?"ralph-label ralph-label--urgent":E.startsWith("squad:")?"ralph-label ralph-label--agent":E==="squad"?"ralph-label ralph-label--triage":"ralph-label"}return y.jsxs("div",{className:"page ralph",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Ralph"}),y.jsx("p",{className:"dim",children:"Squad watch loop — local project monitor. Updates every 5s."})]}),u?y.jsx(kn,{inline:!0,message:u,onRetry:()=>void w()}):null,y.jsxs("section",{className:"ralph-section",children:[y.jsx("h2",{children:"Watch Status"}),t===null?y.jsx(xn,{inline:!0,label:"Loading status…"}):y.jsxs("div",{className:"ralph-status-card",children:[y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"State"}),y.jsx("span",{className:`ralph-badge ralph-badge--${t.running?"running":"stopped"}`,children:t.running?"Running":"Stopped"})]}),t.running&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"PID"}),y.jsx("span",{className:"ralph-mono",children:t.pid})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Project"}),y.jsx("span",{className:"ralph-mono ralph-truncate",children:t.projectRoot})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Interval"}),y.jsxs("span",{children:[t.interval," min"]})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Started"}),y.jsx("span",{children:T(t.startedAt)})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Last poll"}),y.jsx("span",{children:t.lastPollAt?T(t.lastPollAt):"waiting…"})]})]})]})]}),y.jsxs("section",{className:"ralph-section",children:[y.jsx("h2",{children:"Controls"}),b?y.jsx(kn,{inline:!0,message:b}):null,t!=null&&t.running?y.jsxs("div",{className:"ralph-controls",children:[y.jsxs("p",{className:"dim",children:["Ralph is watching ",y.jsx("strong",{children:(Q=t.projectRoot)==null?void 0:Q.split("/").filter(Boolean).pop()})," every ",t.interval," min."]}),y.jsx("button",{type:"button",className:"btn btn-danger",onClick:()=>void S(),disabled:p,children:p?"Stopping…":"⏹ Stop Watch"})]}):y.jsxs("div",{className:"ralph-controls",children:[y.jsxs("div",{className:"ralph-form-row",children:[y.jsx("label",{htmlFor:"ralph-project",children:"Project"}),i.length>0?y.jsx("select",{id:"ralph-project",value:o,onChange:E=>a(E.target.value),className:"ralph-select",children:i.map(E=>{const M=E.projectRoot.split("/").filter(Boolean).pop()??E.projectRoot;return y.jsxs("option",{value:E.projectRoot,children:[M," (",E.projectRoot,")"]},E.projectRoot)})}):y.jsx("input",{id:"ralph-project",type:"text",placeholder:"/path/to/project",value:o,onChange:E=>a(E.target.value),className:"ralph-input"})]}),y.jsxs("div",{className:"ralph-form-row",children:[y.jsx("label",{htmlFor:"ralph-interval",children:"Interval (minutes)"}),y.jsx("input",{id:"ralph-interval",type:"number",min:1,max:120,value:l,onChange:E=>c(Number(E.target.value)),className:"ralph-input ralph-input--narrow"})]}),y.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>void x(),disabled:p||!o,children:p?"Starting…":"▶ Start Watch"})]})]}),y.jsxs("section",{className:"ralph-section",children:[y.jsxs("h2",{children:["Queue Snapshot",n?y.jsxs("span",{className:"ralph-queue-count",children:[" (",n.length,")"]}):null]}),o&&y.jsxs("p",{className:"dim small ralph-queue-source",children:[y.jsx("code",{children:o})," ","·"," ",y.jsx("button",{type:"button",className:"link-btn",onClick:()=>void k(o),children:"Refresh"})]}),d?y.jsx(kn,{inline:!0,message:d,onRetry:()=>void k(o)}):null,n===null&&!d?o?y.jsx(xn,{inline:!0,label:"Loading queue…"}):y.jsx(Ws,{icon:"📭",title:"No project selected",description:"Select a project above to see its squad issue queue."}):n&&n.length===0?y.jsx(Ws,{icon:"✅",title:"Queue empty",description:"No open squad-labeled issues."}):n&&n.length>0?y.jsx("div",{className:"ralph-queue",children:n.map(E=>y.jsxs("a",{href:E.url,target:"_blank",rel:"noreferrer",className:"ralph-issue",children:[y.jsxs("div",{className:"ralph-issue-head",children:[y.jsxs("span",{className:"ralph-issue-number",children:["#",E.number]}),y.jsx("span",{className:"ralph-issue-title",children:E.title})]}),y.jsxs("div",{className:"ralph-issue-meta",children:[y.jsx("span",{className:"dim small",children:T(E.createdAt)}),y.jsx("div",{className:"ralph-labels",children:E.labels.map(M=>y.jsx("span",{className:P(M),children:M},M))})]})]},E.number))}):null]})]})}function bse(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(!0),[o,a]=A.useState(!1),[l,c]=A.useState(!1),[u,h]=A.useState(""),[d,f]=A.useState(!1),[p,g]=A.useState(null),b=A.useRef(null),m=is();async function O(){s(!0);try{const S=await eu.list();e(S),r(null),a(!1)}catch(S){const T=S instanceof Error?S.message:String(S);T.includes("503")||T.toLowerCase().includes("squad integration is disabled")?(a(!0),e([])):r(T)}finally{s(!1)}}A.useEffect(()=>{O()},[]),A.useEffect(()=>{var S;l&&((S=b.current)==null||S.focus())},[l]);async function w(S){S.preventDefault();const T=u.trim();if(T){f(!0),g(null);try{await eu.register(T),h(""),c(!1),await O()}catch(P){g(P instanceof Error?P.message:String(P))}finally{f(!1)}}}async function k(S){try{await eu.remove(S),await O()}catch(T){r(T instanceof Error?T.message:String(T))}}function x(S){m(`/projects/chat/${k$(S)}`)}return y.jsxs("div",{className:"page projects",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Projects"}),y.jsxs("p",{className:"dim",children:["Registered Squad projects. Each project needs a ",y.jsx("code",{children:".squad/"})," directory."]})]}),o?y.jsx("div",{className:"projects-disabled",role:"status",children:y.jsxs("p",{children:[y.jsx("strong",{children:"Squad integration is disabled."})," Set"," ",y.jsx("code",{children:"ENABLE_SQUAD=1"})," in your environment to enable project features."]})}):y.jsxs(y.Fragment,{children:[n?y.jsx(kn,{inline:!0,message:n,onRetry:()=>void O()}):null,y.jsx("div",{className:"projects-toolbar",children:l?y.jsxs("form",{className:"projects-register-form",onSubmit:S=>void w(S),children:[y.jsx("input",{ref:b,type:"text",className:"projects-path-input",placeholder:"/absolute/path/to/project",value:u,onChange:S=>h(S.target.value),"aria-label":"Project path",disabled:d}),y.jsx("button",{type:"submit",className:"btn primary",disabled:d||!u.trim(),children:d?"Registering…":"Add"}),y.jsx("button",{type:"button",className:"btn",onClick:()=>{c(!1),g(null),h("")},disabled:d,children:"Cancel"}),p?y.jsx("span",{className:"projects-register-error dim",role:"alert",children:p}):null]}):y.jsx("button",{type:"button",className:"btn primary",onClick:()=>c(!0),"aria-expanded":l,children:"Register Project"})}),i&&t===null?y.jsx(xn,{inline:!0,label:"Loading projects"}):y.jsxs("div",{className:"projects-list","aria-busy":i,children:[t&&t.length===0?y.jsx(Ws,{icon:"🗂️",title:"No projects registered",description:"Add a project path above to get started."}):null,t==null?void 0:t.map(S=>y.jsxs("div",{className:"project-row",children:[y.jsxs("div",{className:"project-row-info",children:[y.jsx("strong",{className:"project-root",title:S.projectRoot,children:S.projectRoot}),y.jsxs("span",{className:"project-meta dim",children:[y.jsxs("span",{className:"project-badge",children:[S.agentCount," agent",S.agentCount!==1?"s":""]}),y.jsx("span",{children:S.squadDir}),y.jsxs("span",{children:["loaded ",S.loadedAt]})]})]}),y.jsxs("div",{className:"project-row-actions",children:[y.jsx("button",{type:"button",className:"btn primary",onClick:()=>x(S.projectRoot),"aria-label":`New session for ${S.projectRoot}`,children:"Chat in Project Context"}),y.jsx("button",{type:"button",className:"btn danger",onClick:()=>void k(S.projectRoot),"aria-label":`Remove ${S.projectRoot}`,children:"×"})]})]},S.projectRoot))]})]})]})}function Rp({title:t,description:e,actions:n,compact:r=!1}){return y.jsxs("div",{className:`wiki-empty-state${r?" compact":""}`,children:[y.jsx("h2",{children:t}),y.jsx("p",{children:e}),n?y.jsx("div",{className:"wiki-empty-state-actions",children:n}):null]})}const Cl="pages";function lm(t){return t.replace(new RegExp(`^${Cl}/?`),"").split("/").filter(Boolean)}function e_(t){return t.toLocaleLowerCase()}function t_(t,e){const n=Gl(t.page??t.path).toLocaleLowerCase();return n==="index"||e&&n===e.toLocaleLowerCase()?0:1}function zv(t){return t==="team"?"Team":"Personal"}function fQ(t){return t==="team"?"👥":"👤"}function wse(t,e,n){if(n!=="all"&&t.section!==n)return!1;const r=e.trim().toLocaleLowerCase();if(!r)return!0;const i=[t.title,t.summary,t.section,t.path,Gl(t),zv(t.scope),...lm(t.path),...t.tags].join(" ").toLocaleLowerCase();return r.split(/\s+/).every(s=>i.includes(s))}function Gl(t){const e=typeof t=="string"?t:t.path;return(e.split("/").pop()??e).replace(/\.md$/i,"")||"untitled"}function n_(t){const e=lm(t),n=[];let r=Cl;for(const i of e.slice(0,-1))r=`${r}/${i}`,n.push(r);return n}function Sse(t,e){const n=lm(t),r=e.find(o=>o.path===t),i=[{label:"Wiki",path:Cl,type:"folder"}];let s=Cl;for(const[o,a]of n.entries()){const l=o===n.length-1;s=`${s}/${a}`,i.push({label:l?Gl(r??t):a,path:l?t:s,type:l?"page":"folder"})}return i}function pQ(t,e){for(const n of t){if(n.path===e)return n;if(n.type==="folder"){const r=pQ(n.children,e);if(r)return r}}return null}function ew(t){for(const e of t){if(e.type==="page")return e.path;const n=ew(e.children);if(n)return n}return null}function kse(t,e){if(t===Cl)return ew(e);const n=pQ(e,t);return n?n.type==="page"?n.path:ew(n.children):null}function gQ(t,e){return[...t].sort((n,r)=>{if(n.type!==r.type)return n.type==="folder"?-1:1;if(n.type==="page"&&r.type==="page"){const i=t_(n,e)-t_(r,e);if(i!==0)return i}return e_(n.name).localeCompare(e_(r.name),void 0,{numeric:!0,sensitivity:"base"})}).map(n=>n.type==="folder"?{...n,children:gQ(n.children,n.name)}:n)}function vse(t){const e=[];for(const n of t){const r=lm(n.path);if(r.length===0)continue;let i=e,s=Cl;for(const[o,a]of r.entries()){const l=o===r.length-1;if(s=`${s}/${a}`,l){i.push({id:n.path,name:Gl(n),type:"page",path:n.path,children:[],page:n});continue}let c=i.find(u=>u.type==="folder"&&u.path===s);c||(c={id:s,name:a,type:"folder",path:s,children:[]},i.push(c)),i=c.children}}return gQ(e)}function mQ(t,e,n){return t.flatMap(r=>{if(r.type==="page")return r.page&&wse(r.page,e,n)?[r]:[];const i=mQ(r.children,e,n);return i.length>0?[{...r,children:i}]:[]})}function xse({items:t,onOpenItem:e}){return y.jsx("nav",{className:"wiki-breadcrumbs","aria-label":"Wiki breadcrumbs",children:y.jsx("ol",{children:t.map((n,r)=>{const i=r===t.length-1;return y.jsx("li",{children:i?y.jsx("span",{"aria-current":"page",children:n.label}):y.jsx("button",{type:"button",className:"wiki-breadcrumb-button",onClick:()=>e(n),children:n.label})},`${n.type}-${n.path}`)})})})}function Cse(t){if(!t)return"Unknown update time";const e=new Date(t);return Number.isNaN(e.getTime())?t:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e)}function Ese({page:t,breadcrumbs:e,onOpenBreadcrumb:n,onEdit:r,onDelete:i}){const s=zv(t.scope),o=fQ(t.scope);return y.jsxs("header",{className:"wiki-page-header",children:[y.jsx(xse,{items:e,onOpenItem:n}),y.jsxs("div",{className:"wiki-page-header-main",children:[y.jsxs("div",{className:"wiki-page-title-block",children:[y.jsx("h2",{children:t.title||Gl(t)}),t.summary?y.jsx("p",{className:"wiki-page-summary",children:t.summary}):null]}),y.jsxs("div",{className:"wiki-page-actions",children:[y.jsx("button",{type:"button",className:"btn",onClick:r,children:"Edit"}),y.jsx("button",{type:"button",className:"btn danger",onClick:i,children:"Delete"})]})]}),y.jsxs("div",{className:"wiki-meta",children:[y.jsxs("span",{className:`wiki-badge wiki-scope-badge wiki-scope-badge-${t.scope}`,children:[o," ",s]}),t.section?y.jsx("span",{className:"wiki-badge",children:t.section}):null,t.tags.map(a=>y.jsxs("span",{className:"wiki-tag",children:["#",a]},a)),y.jsxs("span",{className:"wiki-meta-item",children:["Updated ",Cse(t.updated)]}),y.jsx("code",{className:"wiki-meta-path",children:t.path})]})]})}function _se({pages:t}){return t.some(n=>n.scope==="team")?y.jsxs("span",{className:"wiki-badge wiki-scope-badge wiki-scope-badge-team wiki-scope-indicator","aria-label":"Wiki scope: Personal + Team",children:[y.jsx("span",{"aria-hidden":"true",children:"👥"})," Personal + Team"]}):y.jsxs("span",{className:"wiki-badge wiki-scope-badge wiki-scope-badge-personal wiki-scope-indicator","aria-label":"Wiki scope: Personal",children:[y.jsx("span",{"aria-hidden":"true",children:"👤"})," Personal"]})}const Tse=A.forwardRef(function({query:e,onQueryChange:n,sectionFilter:r,onSectionFilterChange:i,sections:s,resultCount:o,totalCount:a},l){const c=e.trim().length>0||r!=="all";return y.jsxs("div",{className:"wiki-search",children:[y.jsxs("label",{className:"wiki-search-field",htmlFor:"wiki-search-input",children:[y.jsx("span",{className:"sr-only",children:"Search wiki pages"}),y.jsx("input",{id:"wiki-search-input",ref:l,type:"search",value:e,onChange:u=>n(u.target.value),placeholder:"Search title, path, summary, tags…","aria-label":"Search wiki pages"})]}),y.jsxs("label",{className:"wiki-filter",htmlFor:"wiki-section-filter",children:[y.jsx("span",{children:"Section"}),y.jsxs("select",{id:"wiki-section-filter",value:r,onChange:u=>i(u.target.value),"aria-label":"Filter wiki pages by section",children:[y.jsx("option",{value:"all",children:"All sections"}),s.map(u=>y.jsx("option",{value:u,children:u},u))]})]}),y.jsx("div",{className:"wiki-search-meta","aria-live":"polite",children:c?`${o} of ${a} pages shown`:`${a} pages`})]})});function OQ(t){return t.type==="page"?1:t.children.reduce((e,n)=>e+OQ(n),0)}function yQ({node:t,depth:e,selectedPath:n,expandedPaths:r,onToggleFolder:i,onSelectPage:s,showPageMeta:o=!1}){var h;const a={paddingInlineStart:`${10+e*16}px`};if(t.type==="folder"){const d=r.has(t.path),f=OQ(t);return y.jsxs("li",{className:"wiki-node wiki-node-folder",children:[y.jsxs("button",{type:"button",className:`wiki-node-button wiki-node-folder-button${d?" expanded":""}`,style:a,onClick:()=>i(t.path),"aria-expanded":d,children:[y.jsx("span",{className:"wiki-node-icon","aria-hidden":"true",children:d?"▾":"▸"}),y.jsx("span",{className:"wiki-node-label",children:t.name}),y.jsx("span",{className:"wiki-node-count",children:f})]}),d?y.jsx("ul",{className:"wiki-tree-children",children:t.children.map(p=>y.jsx(yQ,{node:p,depth:e+1,selectedPath:n,expandedPaths:r,onToggleFolder:i,onSelectPage:s,showPageMeta:o},p.id))}):null]})}const l=((h=t.page)==null?void 0:h.scope)??"personal",c=fQ(l),u=zv(l);return y.jsx("li",{className:"wiki-node wiki-node-page",children:y.jsxs("button",{type:"button",className:`wiki-node-button wiki-node-page-button${n===t.path?" selected":""}`,style:a,onClick:()=>s(t.path),"aria-pressed":n===t.path,children:[y.jsx("span",{className:`wiki-node-icon wiki-node-scope-icon wiki-node-scope-icon-${l}`,"aria-hidden":"true",children:c}),y.jsxs("span",{className:"wiki-node-content",children:[y.jsx("span",{className:"wiki-node-label",children:t.name}),o?y.jsx("span",{className:"wiki-node-meta",children:y.jsxs("span",{className:`wiki-scope-badge wiki-scope-badge-${l}`,children:[c," ",u]})}):null]})]})})}function Ase({nodes:t,selectedPath:e,expandedPaths:n,onToggleFolder:r,onSelectPage:i,showPageMeta:s=!1}){return y.jsx("ul",{className:"wiki-tree",children:t.map(o=>y.jsx(yQ,{node:o,depth:0,selectedPath:e,expandedPaths:n,onToggleFolder:r,onSelectPage:i,showPageMeta:s},o.id))})}function Pse({searchRef:t,query:e,onQueryChange:n,sectionFilter:r,onSectionFilterChange:i,sections:s,resultCount:o,totalCount:a,loading:l,tree:c,selectedPath:u,expandedPaths:h,onToggleFolder:d,onSelectPage:f,onCreatePage:p,onClearFilters:g}){const b=e.trim().length>0||r!=="all";return y.jsxs("nav",{className:"wiki-sidebar","aria-label":"Wiki navigation","aria-busy":l,children:[y.jsxs("div",{className:"wiki-sidebar-header",children:[y.jsxs("div",{className:"wiki-sidebar-header-row",children:[y.jsxs("div",{children:[y.jsx("h2",{children:"Browse pages"}),y.jsx("p",{className:"dim small",children:"Filesystem navigation with section filtering."})]}),y.jsx("button",{type:"button",className:"btn primary",onClick:p,children:"New page"})]}),y.jsx(Tse,{ref:t,query:e,onQueryChange:n,sectionFilter:r,onSectionFilterChange:i,sections:s,resultCount:o,totalCount:a}),y.jsx("div",{className:"wiki-shortcuts dim small",children:"/ search · n new page · e edit page"}),y.jsxs("div",{className:"wiki-scope-legend dim small","aria-label":"Wiki page scope legend",children:[y.jsxs("span",{children:[y.jsx("span",{"aria-hidden":"true",children:"👤"})," Personal"]}),y.jsxs("span",{children:[y.jsx("span",{"aria-hidden":"true",children:"👥"})," Team"]})]})]}),y.jsxs("div",{className:"wiki-sidebar-body",children:[l&&a===0?y.jsx(xn,{inline:!0,label:"Loading wiki pages"}):null,!l&&a===0?y.jsx(Rp,{compact:!0,title:"No wiki pages yet",description:"Create the first page to start building your team handbook.",actions:y.jsx("button",{type:"button",className:"btn primary",onClick:p,children:"Create a page"})}):null,a>0&&c.length===0?y.jsx(Rp,{compact:!0,title:"No pages match",description:"Try a different search or clear the current section filter.",actions:b?y.jsx("button",{type:"button",className:"btn",onClick:g,children:"Clear filters"}):void 0}):null,c.length>0?y.jsx(Ase,{nodes:c,selectedPath:u,expandedPaths:h,onToggleFolder:d,onSelectPage:f,showPageMeta:b}):null]})]})}function TO(t,e){return Array.from(new Set([...t,...e]))}function bQ(t){return t.reduce((e,n)=>e+(n.type==="page"?1:bQ(n.children)),0)}function wQ(t){return t.flatMap(e=>e.type==="folder"?[e.path,...wQ(e.children)]:[])}function Ise(){const[t]=dR(),e=t.get("selected"),[n,r]=A.useState(null),[i,s]=A.useState(null),[o,a]=A.useState(!0),[l,c]=A.useState(!1),[u,h]=A.useState(null),[d,f]=A.useState(null),[p,g]=A.useState(""),[b,m]=A.useState("all"),[O,w]=A.useState([]),[k,x]=A.useState(0),S=is(),T=A.useRef(null);async function P(){a(!0);try{const V=await He.listPages();r(V),h(null)}catch(V){h(V instanceof Error?V.message:String(V))}finally{a(!1)}}A.useEffect(()=>{P()},[]),A.useEffect(()=>{if(!e){s(null),f(null),c(!1);return}let V=!1;return s(null),c(!0),He.readPage(e).then(se=>{V||(s(se.content),f(null))}).catch(se=>{V||f(se instanceof Error?se.message:String(se))}).finally(()=>{V||c(!1)}),()=>{V=!0}},[e,k]),A.useEffect(()=>{e&&w(V=>TO(V,n_(e)))},[e]),A.useEffect(()=>{function V(te){return te instanceof HTMLElement?!!te.closest("input, textarea, select, [contenteditable='true']"):!1}function se(te){var q,Pe;if(!(te.defaultPrevented||te.metaKey||te.ctrlKey||te.altKey)){if(te.key==="/"&&!V(te.target)){te.preventDefault(),(q=T.current)==null||q.focus(),(Pe=T.current)==null||Pe.select();return}V(te.target)||(te.key.toLocaleLowerCase()==="n"&&(te.preventDefault(),S("/wiki/edit?new=1")),te.key.toLocaleLowerCase()==="e"&&e&&(te.preventDefault(),S(`/wiki/edit?path=${encodeURIComponent(e)}`)))}}return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[S,e]);const Q=A.useMemo(()=>n?vse(n):[],[n]),E=A.useMemo(()=>mQ(Q,p,b),[Q,p,b]),M=A.useMemo(()=>bQ(E),[E]),L=(n==null?void 0:n.length)??0,H=A.useMemo(()=>Array.from(new Set((n??[]).map(V=>V.section).filter(Boolean))).sort((V,se)=>V.localeCompare(se)),[n]),Y=A.useMemo(()=>p.trim()||b!=="all"?wQ(E):[],[E,p,b]),z=A.useMemo(()=>new Set(TO(O,Y)),[Y,O]),$=A.useMemo(()=>e?(n==null?void 0:n.find(V=>V.path===e))??{path:e,title:Gl(e),summary:"",section:"",tags:[],updated:"",scope:"personal"}:null,[n,e]),Z=A.useMemo(()=>e?Sse(e,n??[]):[],[n,e]);async function I(){if(!(!e||!confirm(`Delete ${e}?`)))try{await He.deletePage(e),s(null),h(null),f(null),S("/wiki"),await P()}catch(V){f(V instanceof Error?V.message:String(V))}}function D(V){S(`/wiki?selected=${encodeURIComponent(V)}`)}function C(V){w(se=>se.includes(V)?se.filter(te=>te!==V):[...se,V])}function F(V){if(g(""),V.type==="page"){D(V.path);return}if(V.path==="pages"){S("/wiki");return}w(te=>TO(te,[...n_(V.path),V.path]));const se=kse(V.path,Q);se&&D(se)}const W=u??d,v=u?()=>void P():()=>x(V=>V+1);return y.jsxs("div",{className:"page wiki",children:[y.jsxs("header",{className:"page-header",children:[y.jsxs("div",{className:"wiki-scope-header-row",children:[y.jsx("h1",{children:"Wiki"}),n!==null&&y.jsx(_se,{pages:n})]}),y.jsx("p",{className:"dim",children:"A docs-style browser for Chapterhouse's shared engineering knowledge, stored at ~/.chapterhouse/wiki/."})]}),W?y.jsx(kn,{inline:!0,message:W,onRetry:v}):null,y.jsxs("div",{className:"wiki-layout",children:[y.jsx(Pse,{searchRef:T,query:p,onQueryChange:g,sectionFilter:b,onSectionFilterChange:m,sections:H,resultCount:M,totalCount:L,loading:o,tree:E,selectedPath:e,expandedPaths:z,onToggleFolder:C,onSelectPage:D,onCreatePage:()=>S("/wiki/edit?new=1"),onClearFilters:()=>{g(""),m("all")}}),y.jsx("section",{className:"wiki-main","aria-live":"polite",children:$?y.jsxs("article",{className:"wiki-document",children:[y.jsx(Ese,{page:$,breadcrumbs:Z,onOpenBreadcrumb:F,onEdit:()=>S(`/wiki/edit?path=${encodeURIComponent($.path)}`),onDelete:()=>void I()}),y.jsx("div",{className:"wiki-document-body",children:l?y.jsx(xn,{inline:!0,label:"Loading page"}):i!==null?y.jsx("div",{className:"wiki-article",children:y.jsx(uQ,{content:i})}):y.jsx(Rp,{compact:!0,title:"Page unavailable",description:"The page metadata loaded, but the content could not be shown yet. Try reloading the page.",actions:y.jsx("button",{type:"button",className:"btn",onClick:v,children:"Retry"})})})]}):y.jsx(Rp,{title:L===0?"Start the wiki":"Pick a page",description:L===0?"Create the first page and the wiki will organize itself into folders from its path.":"Choose a page from the sidebar, or create a new one if the answer does not exist yet.",actions:y.jsx("button",{type:"button",className:"btn primary",onClick:()=>S("/wiki/edit?new=1"),children:"New page"})})})]})]})}function tw(){return tw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tw.apply(null,arguments)}function Rse(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}let nw=[],SQ=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?SQ:nw).push(n=n+t[e])})();function Nse(t){if(t<768)return!1;for(let e=0,n=nw.length;;){let r=e+n>>1;if(t<nw[r])n=r;else if(t>=SQ[r])e=r+1;else return!0;if(e==n)return!1}}function r_(t){return t>=127462&&t<=127487}const i_=8205;function $se(t,e,n=!0,r=!0){return(n?kQ:Mse)(t,e,r)}function kQ(t,e,n){if(e==t.length)return e;e&&vQ(t.charCodeAt(e))&&xQ(t.charCodeAt(e-1))&&e--;let r=AO(t,e);for(e+=s_(r);e<t.length;){let i=AO(t,e);if(r==i_||i==i_||n&&Nse(i))e+=s_(i),r=i;else if(r_(i)){let s=0,o=e-2;for(;o>=0&&r_(AO(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Mse(t,e,n){for(;e>0;){let r=kQ(t,e-2,n);if(r<e)return r;e--}return 0}function AO(t,e){let n=t.charCodeAt(e);if(!xQ(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return vQ(r)?(n-55296<<10)+(r-56320)+65536:n}function vQ(t){return t>=56320&&t<57344}function xQ(t){return t>=55296&&t<56320}function s_(t){return t<65536?1:2}class Re{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=El(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),hi.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=El(this,e,n);let r=[];return this.decompose(e,n,r,0),hi.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new iu(this),s=new iu(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new iu(this,e)}iterRange(e,n=this.length){return new CQ(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new EQ(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Re.empty:e.length<=32?new xt(e):hi.from(xt.split(e,[]))}}class xt extends Re{constructor(e,n=Qse(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new Lse(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new xt(o_(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=bf(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new xt(a,o.length+s.length));else{let l=a.length>>1;r.push(new xt(a.slice(0,l)),new xt(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof xt))return super.replace(e,n,r);[e,n]=El(this,e,n);let i=bf(this.text,bf(r.text,o_(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new xt(i,s):hi.from(xt.split(i,[]),s)}sliceString(e,n=this.length,r=`
|
|
190
|
+
`).find(I=>I.startsWith("data: "));if(Z)try{const I=JSON.parse(Z.slice(6));if(I.type==="task_event"&&typeof I.seq=="number"&&I.seq>L){L=I.seq;const D={id:typeof I.id=="number"?I.id:0,taskId:typeof I.taskId=="string"?I.taskId:O,seq:I.seq,ts:typeof I.ts=="number"?I.ts:Date.now(),kind:I.kind==="tool_complete"?"tool_complete":"tool_start",toolName:typeof I.toolName=="string"?I.toolName:null,summary:typeof I.summary=="string"?I.summary:null};s(C=>[...C,D])}}catch{}}}}catch(x){if(x instanceof Error&&x.name==="AbortError")return}}async function b(O){try{const w=await He.getWorker(O.taskId);r(w),s([]),a(null),g(O.taskId)}catch(w){a(w instanceof Error?w.message:String(w))}}A.useEffect(()=>()=>{var O;(O=u.current)==null||O.abort()},[]);function m(O){return new Date(O).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}return y.jsxs("div",{className:"page workers",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Workers"}),y.jsx("p",{className:"dim",children:"Active and recent agent tasks (last 24 h). Updates every 4s."})]}),o?y.jsx(kn,{inline:!0,message:o,onRetry:()=>void f()}):null,y.jsxs("div",{className:"workers-layout",children:[y.jsxs("div",{className:"workers-list","aria-busy":l,children:[l&&t===null?y.jsx(xn,{inline:!0,label:"Loading workers"}):null,t&&t.length===0?y.jsx(Ws,{icon:"🤖",title:"No tasks yet",description:"No agent tasks in the last 24 hours."}):null,t==null?void 0:t.map(O=>y.jsxs("button",{type:"button",className:"worker-row"+((n==null?void 0:n.taskId)===O.taskId?" selected":""),onClick:()=>void b(O),"aria-pressed":(n==null?void 0:n.taskId)===O.taskId,children:[y.jsxs("div",{className:"worker-row-head",children:[y.jsx("strong",{children:O.name||`@${O.slug}`}),y.jsx("span",{className:`worker-status worker-status--${O.status}`,children:O.status})]}),y.jsx("div",{className:"worker-row-desc",children:O.description}),y.jsxs("div",{className:"dim small",children:["@",O.slug," · ",O.model]})]},O.taskId))]}),y.jsx("div",{className:"workers-detail","aria-live":"polite",children:n?y.jsxs(y.Fragment,{children:[y.jsxs("h2",{children:[n.name||n.agentSlug," ",y.jsxs("span",{className:"dim worker-detail-slug",children:["@",n.agentSlug]})]}),y.jsx("p",{className:"worker-detail-description",children:n.description}),y.jsxs("p",{className:"dim small worker-detail-meta",children:[y.jsx("span",{className:`worker-status worker-status--${n.status}`,children:n.status})," · ","started ",n.startedAt,n.completedAt?` · completed ${n.completedAt}`:""," · ",y.jsx("span",{className:"worker-detail-taskid",children:n.taskId})]}),y.jsx("h3",{children:"Activity"}),i.length===0&&n.status==="running"?y.jsx("p",{className:"dim small",children:"Waiting for tool-call activity…"}):i.length===0?y.jsx("p",{className:"dim small",children:"(no tool-call activity recorded)"}):y.jsx("div",{className:"worker-events",ref:d,children:i.map(O=>y.jsxs("div",{className:`worker-event worker-event--${O.kind}`,children:[y.jsx("span",{className:"worker-event-ts",children:m(O.ts)}),O.kind==="tool_start"?y.jsxs("span",{className:"worker-event-body",children:[y.jsx("span",{className:"worker-event-icon",children:"⚙️"}),y.jsx("strong",{children:O.toolName??"tool"}),O.summary?y.jsxs("span",{className:"dim",children:[" — ",O.summary]}):null]}):y.jsxs("span",{className:"worker-event-body",children:[y.jsx("span",{className:"worker-event-icon",children:"✅"}),O.summary?y.jsx("span",{className:"dim",children:O.summary}):y.jsx("span",{className:"dim",children:"done"})]})]},O.id))}),y.jsx("h3",{children:"Result"}),y.jsx("pre",{className:"output",children:n.result??"(no output yet — task still running)"})]}):y.jsx(Ws,{icon:"👈",title:"Pick a worker",description:"Select a task from the list to inspect its details."})})]})]})}const Ose=10;function yse(){var Q;const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState([]),[o,a]=A.useState(""),[l,c]=A.useState(Ose),[u,h]=A.useState(null),[d,f]=A.useState(null),[p,g]=A.useState(!1),[b,m]=A.useState(null),O=A.useRef(null);A.useEffect(()=>(w(),O.current=globalThis.setInterval(()=>void w(),5e3),()=>{O.current!==null&&globalThis.clearInterval(O.current)}),[]),A.useEffect(()=>{eu.list().then(E=>{s(E),E.length>0&&!o&&a(E[0].projectRoot)}).catch(()=>{})},[]),A.useEffect(()=>{o&&k(o)},[o,t==null?void 0:t.running]);async function w(){try{const E=await md.getStatus();e(E),h(null),E.projectRoot&&E.projectRoot!==o&&a(E.projectRoot)}catch(E){h(E instanceof Error?E.message:String(E))}}async function k(E){try{const M=await md.getQueue(E);r(M.issues),f(null)}catch(M){f(M instanceof Error?M.message:String(M)),r(null)}}async function x(){if(o){g(!0),m(null);try{await md.start(o,l),await w()}catch(E){m(E instanceof Error?E.message:String(E))}finally{g(!1)}}}async function S(){g(!0),m(null);try{await md.stop(),await w()}catch(E){m(E instanceof Error?E.message:String(E))}finally{g(!1)}}function T(E){if(!E)return"—";try{const M=Date.now()-new Date(E).getTime(),L=Math.floor(M/1e3);if(L<60)return`${L}s ago`;const H=Math.floor(L/60);return H<60?`${H}m ago`:`${Math.floor(H/60)}h ago`}catch{return E}}function P(E){return E.startsWith("priority:p0")||E.startsWith("priority:p1")?"ralph-label ralph-label--urgent":E.startsWith("squad:")?"ralph-label ralph-label--agent":E==="squad"?"ralph-label ralph-label--triage":"ralph-label"}return y.jsxs("div",{className:"page ralph",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Ralph"}),y.jsx("p",{className:"dim",children:"Squad watch loop — local project monitor. Updates every 5s."})]}),u?y.jsx(kn,{inline:!0,message:u,onRetry:()=>void w()}):null,y.jsxs("section",{className:"ralph-section",children:[y.jsx("h2",{children:"Watch Status"}),t===null?y.jsx(xn,{inline:!0,label:"Loading status…"}):y.jsxs("div",{className:"ralph-status-card",children:[y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"State"}),y.jsx("span",{className:`ralph-badge ralph-badge--${t.running?"running":"stopped"}`,children:t.running?"Running":"Stopped"})]}),t.running&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"PID"}),y.jsx("span",{className:"ralph-mono",children:t.pid})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Project"}),y.jsx("span",{className:"ralph-mono ralph-truncate",children:t.projectRoot})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Interval"}),y.jsxs("span",{children:[t.interval," min"]})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Started"}),y.jsx("span",{children:T(t.startedAt)})]}),y.jsxs("div",{className:"ralph-status-row",children:[y.jsx("span",{className:"ralph-status-label",children:"Last poll"}),y.jsx("span",{children:t.lastPollAt?T(t.lastPollAt):"waiting…"})]})]})]})]}),y.jsxs("section",{className:"ralph-section",children:[y.jsx("h2",{children:"Controls"}),b?y.jsx(kn,{inline:!0,message:b}):null,t!=null&&t.running?y.jsxs("div",{className:"ralph-controls",children:[y.jsxs("p",{className:"dim",children:["Ralph is watching ",y.jsx("strong",{children:(Q=t.projectRoot)==null?void 0:Q.split("/").filter(Boolean).pop()})," every ",t.interval," min."]}),y.jsx("button",{type:"button",className:"btn btn-danger",onClick:()=>void S(),disabled:p,children:p?"Stopping…":"⏹ Stop Watch"})]}):y.jsxs("div",{className:"ralph-controls",children:[y.jsxs("div",{className:"ralph-form-row",children:[y.jsx("label",{htmlFor:"ralph-project",children:"Project"}),i.length>0?y.jsx("select",{id:"ralph-project",value:o,onChange:E=>a(E.target.value),className:"ralph-select",children:i.map(E=>{const M=E.projectRoot.split("/").filter(Boolean).pop()??E.projectRoot;return y.jsxs("option",{value:E.projectRoot,children:[M," (",E.projectRoot,")"]},E.projectRoot)})}):y.jsx("input",{id:"ralph-project",type:"text",placeholder:"/path/to/project",value:o,onChange:E=>a(E.target.value),className:"ralph-input"})]}),y.jsxs("div",{className:"ralph-form-row",children:[y.jsx("label",{htmlFor:"ralph-interval",children:"Interval (minutes)"}),y.jsx("input",{id:"ralph-interval",type:"number",min:1,max:120,value:l,onChange:E=>c(Number(E.target.value)),className:"ralph-input ralph-input--narrow"})]}),y.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>void x(),disabled:p||!o,children:p?"Starting…":"▶ Start Watch"})]})]}),y.jsxs("section",{className:"ralph-section",children:[y.jsxs("h2",{children:["Queue Snapshot",n?y.jsxs("span",{className:"ralph-queue-count",children:[" (",n.length,")"]}):null]}),o&&y.jsxs("p",{className:"dim small ralph-queue-source",children:[y.jsx("code",{children:o})," ","·"," ",y.jsx("button",{type:"button",className:"link-btn",onClick:()=>void k(o),children:"Refresh"})]}),d?y.jsx(kn,{inline:!0,message:d,onRetry:()=>void k(o)}):null,n===null&&!d?o?y.jsx(xn,{inline:!0,label:"Loading queue…"}):y.jsx(Ws,{icon:"📭",title:"No project selected",description:"Select a project above to see its squad issue queue."}):n&&n.length===0?y.jsx(Ws,{icon:"✅",title:"Queue empty",description:"No open squad-labeled issues."}):n&&n.length>0?y.jsx("div",{className:"ralph-queue",children:n.map(E=>y.jsxs("a",{href:E.url,target:"_blank",rel:"noreferrer",className:"ralph-issue",children:[y.jsxs("div",{className:"ralph-issue-head",children:[y.jsxs("span",{className:"ralph-issue-number",children:["#",E.number]}),y.jsx("span",{className:"ralph-issue-title",children:E.title})]}),y.jsxs("div",{className:"ralph-issue-meta",children:[y.jsx("span",{className:"dim small",children:T(E.createdAt)}),y.jsx("div",{className:"ralph-labels",children:E.labels.map(M=>y.jsx("span",{className:P(M),children:M},M))})]})]},E.number))}):null]})]})}function bse(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(!0),[o,a]=A.useState(!1),[l,c]=A.useState(!1),[u,h]=A.useState(""),[d,f]=A.useState(!1),[p,g]=A.useState(null),b=A.useRef(null),m=is();async function O(){s(!0);try{const S=await eu.list();e(S),r(null),a(!1)}catch(S){const T=S instanceof Error?S.message:String(S);T.includes("503")||T.toLowerCase().includes("squad integration is disabled")?(a(!0),e([])):r(T)}finally{s(!1)}}A.useEffect(()=>{O()},[]),A.useEffect(()=>{var S;l&&((S=b.current)==null||S.focus())},[l]);async function w(S){S.preventDefault();const T=u.trim();if(T){f(!0),g(null);try{await eu.register(T),h(""),c(!1),await O()}catch(P){g(P instanceof Error?P.message:String(P))}finally{f(!1)}}}async function k(S){try{await eu.remove(S),await O()}catch(T){r(T instanceof Error?T.message:String(T))}}function x(S){m(`/projects/chat/${k$(S)}`)}return y.jsxs("div",{className:"page projects",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Projects"}),y.jsxs("p",{className:"dim",children:["Registered Squad projects. Each project needs a ",y.jsx("code",{children:".squad/"})," directory."]})]}),o?y.jsx("div",{className:"projects-disabled",role:"status",children:y.jsxs("p",{children:[y.jsx("strong",{children:"Squad integration is disabled."})," Set"," ",y.jsx("code",{children:"ENABLE_SQUAD=1"})," in your environment to enable project features."]})}):y.jsxs(y.Fragment,{children:[n?y.jsx(kn,{inline:!0,message:n,onRetry:()=>void O()}):null,y.jsx("div",{className:"projects-toolbar",children:l?y.jsxs("form",{className:"projects-register-form",onSubmit:S=>void w(S),children:[y.jsx("input",{ref:b,type:"text",className:"projects-path-input",placeholder:"/absolute/path/to/project",value:u,onChange:S=>h(S.target.value),"aria-label":"Project path",disabled:d}),y.jsx("button",{type:"submit",className:"btn primary",disabled:d||!u.trim(),children:d?"Registering…":"Add"}),y.jsx("button",{type:"button",className:"btn",onClick:()=>{c(!1),g(null),h("")},disabled:d,children:"Cancel"}),p?y.jsx("span",{className:"projects-register-error dim",role:"alert",children:p}):null]}):y.jsx("button",{type:"button",className:"btn primary",onClick:()=>c(!0),"aria-expanded":l,children:"Register Project"})}),i&&t===null?y.jsx(xn,{inline:!0,label:"Loading projects"}):y.jsxs("div",{className:"projects-list","aria-busy":i,children:[t&&t.length===0?y.jsx(Ws,{icon:"🗂️",title:"No projects registered",description:"Add a project path above to get started."}):null,t==null?void 0:t.map(S=>y.jsxs("div",{className:"project-row",children:[y.jsxs("div",{className:"project-row-info",children:[y.jsx("strong",{className:"project-root",title:S.projectRoot,children:S.projectRoot}),y.jsxs("span",{className:"project-meta dim",children:[y.jsxs("span",{className:"project-badge",children:[S.agentCount," agent",S.agentCount!==1?"s":""]}),y.jsx("span",{children:S.squadDir}),y.jsxs("span",{children:["loaded ",S.loadedAt]})]})]}),y.jsxs("div",{className:"project-row-actions",children:[y.jsx("button",{type:"button",className:"btn primary",onClick:()=>x(S.projectRoot),"aria-label":`New session for ${S.projectRoot}`,children:"Chat in Project Context"}),y.jsx("button",{type:"button",className:"btn danger",onClick:()=>void k(S.projectRoot),"aria-label":`Remove ${S.projectRoot}`,children:"×"})]})]},S.projectRoot))]})]})]})}function Rp({title:t,description:e,actions:n,compact:r=!1}){return y.jsxs("div",{className:`wiki-empty-state${r?" compact":""}`,children:[y.jsx("h2",{children:t}),y.jsx("p",{children:e}),n?y.jsx("div",{className:"wiki-empty-state-actions",children:n}):null]})}const Cl="pages";function lm(t){return t.replace(new RegExp(`^${Cl}/?`),"").split("/").filter(Boolean)}function e_(t){return t.toLocaleLowerCase()}function t_(t,e){const n=Gl(t.page??t.path).toLocaleLowerCase();return n==="index"||e&&n===e.toLocaleLowerCase()?0:1}function zv(t){return t==="team"?"Team":"Personal"}function fQ(t){return t==="team"?"👥":"👤"}function wse(t,e,n){if(n!=="all"&&t.section!==n)return!1;const r=e.trim().toLocaleLowerCase();if(!r)return!0;const i=[t.title,t.summary,t.section,t.path,Gl(t),zv(t.scope),...lm(t.path),...t.tags].join(" ").toLocaleLowerCase();return r.split(/\s+/).every(s=>i.includes(s))}function Gl(t){const e=typeof t=="string"?t:t.path;return(e.split("/").pop()??e).replace(/\.md$/i,"")||"untitled"}function n_(t){const e=lm(t),n=[];let r=Cl;for(const i of e.slice(0,-1))r=`${r}/${i}`,n.push(r);return n}function Sse(t,e){const n=lm(t),r=e.find(o=>o.path===t),i=[{label:"Wiki",path:Cl,type:"folder"}];let s=Cl;for(const[o,a]of n.entries()){const l=o===n.length-1;s=`${s}/${a}`,i.push({label:l?Gl(r??t):a,path:l?t:s,type:l?"page":"folder"})}return i}function pQ(t,e){for(const n of t){if(n.path===e)return n;if(n.type==="folder"){const r=pQ(n.children,e);if(r)return r}}return null}function ew(t){for(const e of t){if(e.type==="page")return e.path;const n=ew(e.children);if(n)return n}return null}function kse(t,e){if(t===Cl)return ew(e);const n=pQ(e,t);return n?n.type==="page"?n.path:ew(n.children):null}function gQ(t,e){return[...t].sort((n,r)=>{if(n.type!==r.type)return n.type==="folder"?-1:1;if(n.type==="page"&&r.type==="page"){const i=t_(n,e)-t_(r,e);if(i!==0)return i}return e_(n.name).localeCompare(e_(r.name),void 0,{numeric:!0,sensitivity:"base"})}).map(n=>n.type==="folder"?{...n,children:gQ(n.children,n.name)}:n)}function vse(t){const e=[];for(const n of t){const r=lm(n.path);if(r.length===0)continue;let i=e,s=Cl;for(const[o,a]of r.entries()){const l=o===r.length-1;if(s=`${s}/${a}`,l){i.push({id:n.path,name:Gl(n),type:"page",path:n.path,children:[],page:n});continue}let c=i.find(u=>u.type==="folder"&&u.path===s);c||(c={id:s,name:a,type:"folder",path:s,children:[]},i.push(c)),i=c.children}}return gQ(e)}function mQ(t,e,n){return t.flatMap(r=>{if(r.type==="page")return r.page&&wse(r.page,e,n)?[r]:[];const i=mQ(r.children,e,n);return i.length>0?[{...r,children:i}]:[]})}function xse({items:t,onOpenItem:e}){return y.jsx("nav",{className:"wiki-breadcrumbs","aria-label":"Wiki breadcrumbs",children:y.jsx("ol",{children:t.map((n,r)=>{const i=r===t.length-1;return y.jsx("li",{children:i?y.jsx("span",{"aria-current":"page",children:n.label}):y.jsx("button",{type:"button",className:"wiki-breadcrumb-button",onClick:()=>e(n),children:n.label})},`${n.type}-${n.path}`)})})})}function Cse(t){if(!t)return"Unknown update time";const e=new Date(t);return Number.isNaN(e.getTime())?t:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e)}function Ese({page:t,breadcrumbs:e,onOpenBreadcrumb:n,onEdit:r,onDelete:i}){const s=zv(t.scope),o=fQ(t.scope);return y.jsxs("header",{className:"wiki-page-header",children:[y.jsx(xse,{items:e,onOpenItem:n}),y.jsxs("div",{className:"wiki-page-header-main",children:[y.jsxs("div",{className:"wiki-page-title-block",children:[y.jsx("h2",{children:t.title||Gl(t)}),t.summary?y.jsx("p",{className:"wiki-page-summary",children:t.summary}):null]}),y.jsxs("div",{className:"wiki-page-actions",children:[y.jsx("button",{type:"button",className:"btn",onClick:r,children:"Edit"}),y.jsx("button",{type:"button",className:"btn danger",onClick:i,children:"Delete"})]})]}),y.jsxs("div",{className:"wiki-meta",children:[y.jsxs("span",{className:`wiki-badge wiki-scope-badge wiki-scope-badge-${t.scope}`,children:[o," ",s]}),t.section?y.jsx("span",{className:"wiki-badge",children:t.section}):null,t.tags.map(a=>y.jsxs("span",{className:"wiki-tag",children:["#",a]},a)),y.jsxs("span",{className:"wiki-meta-item",children:["Updated ",Cse(t.updated)]}),y.jsx("code",{className:"wiki-meta-path",children:t.path})]})]})}function _se({pages:t}){return t.some(n=>n.scope==="team")?y.jsxs("span",{className:"wiki-badge wiki-scope-badge wiki-scope-badge-team wiki-scope-indicator","aria-label":"Wiki scope: Personal + Team",children:[y.jsx("span",{"aria-hidden":"true",children:"👥"})," Personal + Team"]}):y.jsxs("span",{className:"wiki-badge wiki-scope-badge wiki-scope-badge-personal wiki-scope-indicator","aria-label":"Wiki scope: Personal",children:[y.jsx("span",{"aria-hidden":"true",children:"👤"})," Personal"]})}const Tse=A.forwardRef(function({query:e,onQueryChange:n,sectionFilter:r,onSectionFilterChange:i,sections:s,resultCount:o,totalCount:a},l){const c=e.trim().length>0||r!=="all";return y.jsxs("div",{className:"wiki-search",children:[y.jsxs("label",{className:"wiki-search-field",htmlFor:"wiki-search-input",children:[y.jsx("span",{className:"sr-only",children:"Search wiki pages"}),y.jsx("input",{id:"wiki-search-input",ref:l,type:"search",value:e,onChange:u=>n(u.target.value),placeholder:"Search title, path, summary, tags…","aria-label":"Search wiki pages"})]}),y.jsxs("label",{className:"wiki-filter",htmlFor:"wiki-section-filter",children:[y.jsx("span",{children:"Section"}),y.jsxs("select",{id:"wiki-section-filter",value:r,onChange:u=>i(u.target.value),"aria-label":"Filter wiki pages by section",children:[y.jsx("option",{value:"all",children:"All sections"}),s.map(u=>y.jsx("option",{value:u,children:u},u))]})]}),y.jsx("div",{className:"wiki-search-meta","aria-live":"polite",children:c?`${o} of ${a} pages shown`:`${a} pages`})]})});function OQ(t){return t.type==="page"?1:t.children.reduce((e,n)=>e+OQ(n),0)}function yQ({node:t,depth:e,selectedPath:n,expandedPaths:r,onToggleFolder:i,onSelectPage:s,showPageMeta:o=!1}){var h;const a={paddingInlineStart:`${10+e*16}px`};if(t.type==="folder"){const d=r.has(t.path),f=OQ(t);return y.jsxs("li",{className:"wiki-node wiki-node-folder",children:[y.jsxs("button",{type:"button",className:`wiki-node-button wiki-node-folder-button${d?" expanded":""}`,style:a,onClick:()=>i(t.path),"aria-expanded":d,children:[y.jsx("span",{className:"wiki-node-icon","aria-hidden":"true",children:d?"▾":"▸"}),y.jsx("span",{className:"wiki-node-label",children:t.name}),y.jsx("span",{className:"wiki-node-count",children:f})]}),d?y.jsx("ul",{className:"wiki-tree-children",children:t.children.map(p=>y.jsx(yQ,{node:p,depth:e+1,selectedPath:n,expandedPaths:r,onToggleFolder:i,onSelectPage:s,showPageMeta:o},p.id))}):null]})}const l=((h=t.page)==null?void 0:h.scope)??"personal",c=fQ(l),u=zv(l);return y.jsx("li",{className:"wiki-node wiki-node-page",children:y.jsxs("button",{type:"button",className:`wiki-node-button wiki-node-page-button${n===t.path?" selected":""}`,style:a,onClick:()=>s(t.path),"aria-pressed":n===t.path,children:[y.jsx("span",{className:`wiki-node-icon wiki-node-scope-icon wiki-node-scope-icon-${l}`,"aria-hidden":"true",children:c}),y.jsxs("span",{className:"wiki-node-content",children:[y.jsx("span",{className:"wiki-node-label",children:t.name}),o?y.jsx("span",{className:"wiki-node-meta",children:y.jsxs("span",{className:`wiki-scope-badge wiki-scope-badge-${l}`,children:[c," ",u]})}):null]})]})})}function Ase({nodes:t,selectedPath:e,expandedPaths:n,onToggleFolder:r,onSelectPage:i,showPageMeta:s=!1}){return y.jsx("ul",{className:"wiki-tree",children:t.map(o=>y.jsx(yQ,{node:o,depth:0,selectedPath:e,expandedPaths:n,onToggleFolder:r,onSelectPage:i,showPageMeta:s},o.id))})}function Pse({searchRef:t,query:e,onQueryChange:n,sectionFilter:r,onSectionFilterChange:i,sections:s,resultCount:o,totalCount:a,loading:l,tree:c,selectedPath:u,expandedPaths:h,onToggleFolder:d,onSelectPage:f,onCreatePage:p,onClearFilters:g}){const b=e.trim().length>0||r!=="all";return y.jsxs("nav",{className:"wiki-sidebar","aria-label":"Wiki navigation","aria-busy":l,children:[y.jsxs("div",{className:"wiki-sidebar-header",children:[y.jsxs("div",{className:"wiki-sidebar-header-row",children:[y.jsxs("div",{children:[y.jsx("h2",{children:"Browse pages"}),y.jsx("p",{className:"dim small",children:"Filesystem navigation with section filtering."})]}),y.jsx("button",{type:"button",className:"btn primary",onClick:p,children:"New page"})]}),y.jsx(Tse,{ref:t,query:e,onQueryChange:n,sectionFilter:r,onSectionFilterChange:i,sections:s,resultCount:o,totalCount:a}),y.jsx("div",{className:"wiki-shortcuts dim small",children:"/ search · n new page · e edit page"}),y.jsxs("div",{className:"wiki-scope-legend dim small","aria-label":"Wiki page scope legend",children:[y.jsxs("span",{children:[y.jsx("span",{"aria-hidden":"true",children:"👤"})," Personal"]}),y.jsxs("span",{children:[y.jsx("span",{"aria-hidden":"true",children:"👥"})," Team"]})]})]}),y.jsxs("div",{className:"wiki-sidebar-body",children:[l&&a===0?y.jsx(xn,{inline:!0,label:"Loading wiki pages"}):null,!l&&a===0?y.jsx(Rp,{compact:!0,title:"No wiki pages yet",description:"Create the first page to start building your team handbook.",actions:y.jsx("button",{type:"button",className:"btn primary",onClick:p,children:"Create a page"})}):null,a>0&&c.length===0?y.jsx(Rp,{compact:!0,title:"No pages match",description:"Try a different search or clear the current section filter.",actions:b?y.jsx("button",{type:"button",className:"btn",onClick:g,children:"Clear filters"}):void 0}):null,c.length>0?y.jsx(Ase,{nodes:c,selectedPath:u,expandedPaths:h,onToggleFolder:d,onSelectPage:f,showPageMeta:b}):null]})]})}function TO(t,e){return Array.from(new Set([...t,...e]))}function bQ(t){return t.reduce((e,n)=>e+(n.type==="page"?1:bQ(n.children)),0)}function wQ(t){return t.flatMap(e=>e.type==="folder"?[e.path,...wQ(e.children)]:[])}function Ise(){const[t]=dR(),e=t.get("selected"),[n,r]=A.useState(null),[i,s]=A.useState(null),[o,a]=A.useState(!0),[l,c]=A.useState(!1),[u,h]=A.useState(null),[d,f]=A.useState(null),[p,g]=A.useState(""),[b,m]=A.useState("all"),[O,w]=A.useState([]),[k,x]=A.useState(0),S=is(),T=A.useRef(null);async function P(){a(!0);try{const V=await He.listPages();r(V),h(null)}catch(V){h(V instanceof Error?V.message:String(V))}finally{a(!1)}}A.useEffect(()=>{P()},[]),A.useEffect(()=>{if(!e){s(null),f(null),c(!1);return}let V=!1;return s(null),c(!0),He.readPage(e).then(ie=>{V||(s(ie.content),f(null))}).catch(ie=>{V||f(ie instanceof Error?ie.message:String(ie))}).finally(()=>{V||c(!1)}),()=>{V=!0}},[e,k]),A.useEffect(()=>{e&&w(V=>TO(V,n_(e)))},[e]),A.useEffect(()=>{function V(te){return te instanceof HTMLElement?!!te.closest("input, textarea, select, [contenteditable='true']"):!1}function ie(te){var q,Pe;if(!(te.defaultPrevented||te.metaKey||te.ctrlKey||te.altKey)){if(te.key==="/"&&!V(te.target)){te.preventDefault(),(q=T.current)==null||q.focus(),(Pe=T.current)==null||Pe.select();return}V(te.target)||(te.key.toLocaleLowerCase()==="n"&&(te.preventDefault(),S("/wiki/edit?new=1")),te.key.toLocaleLowerCase()==="e"&&e&&(te.preventDefault(),S(`/wiki/edit?path=${encodeURIComponent(e)}`)))}}return window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)},[S,e]);const Q=A.useMemo(()=>n?vse(n):[],[n]),E=A.useMemo(()=>mQ(Q,p,b),[Q,p,b]),M=A.useMemo(()=>bQ(E),[E]),L=(n==null?void 0:n.length)??0,H=A.useMemo(()=>Array.from(new Set((n??[]).map(V=>V.section).filter(Boolean))).sort((V,ie)=>V.localeCompare(ie)),[n]),Y=A.useMemo(()=>p.trim()||b!=="all"?wQ(E):[],[E,p,b]),z=A.useMemo(()=>new Set(TO(O,Y)),[Y,O]),$=A.useMemo(()=>e?(n==null?void 0:n.find(V=>V.path===e))??{path:e,title:Gl(e),summary:"",section:"",tags:[],updated:"",scope:"personal"}:null,[n,e]),Z=A.useMemo(()=>e?Sse(e,n??[]):[],[n,e]);async function I(){if(!(!e||!confirm(`Delete ${e}?`)))try{await He.deletePage(e),s(null),h(null),f(null),S("/wiki"),await P()}catch(V){f(V instanceof Error?V.message:String(V))}}function D(V){S(`/wiki?selected=${encodeURIComponent(V)}`)}function C(V){w(ie=>ie.includes(V)?ie.filter(te=>te!==V):[...ie,V])}function F(V){if(g(""),V.type==="page"){D(V.path);return}if(V.path==="pages"){S("/wiki");return}w(te=>TO(te,[...n_(V.path),V.path]));const ie=kse(V.path,Q);ie&&D(ie)}const W=u??d,v=u?()=>void P():()=>x(V=>V+1);return y.jsxs("div",{className:"page wiki",children:[y.jsxs("header",{className:"page-header",children:[y.jsxs("div",{className:"wiki-scope-header-row",children:[y.jsx("h1",{children:"Wiki"}),n!==null&&y.jsx(_se,{pages:n})]}),y.jsx("p",{className:"dim",children:"A docs-style browser for Chapterhouse's shared engineering knowledge, stored at ~/.chapterhouse/wiki/."})]}),W?y.jsx(kn,{inline:!0,message:W,onRetry:v}):null,y.jsxs("div",{className:"wiki-layout",children:[y.jsx(Pse,{searchRef:T,query:p,onQueryChange:g,sectionFilter:b,onSectionFilterChange:m,sections:H,resultCount:M,totalCount:L,loading:o,tree:E,selectedPath:e,expandedPaths:z,onToggleFolder:C,onSelectPage:D,onCreatePage:()=>S("/wiki/edit?new=1"),onClearFilters:()=>{g(""),m("all")}}),y.jsx("section",{className:"wiki-main","aria-live":"polite",children:$?y.jsxs("article",{className:"wiki-document",children:[y.jsx(Ese,{page:$,breadcrumbs:Z,onOpenBreadcrumb:F,onEdit:()=>S(`/wiki/edit?path=${encodeURIComponent($.path)}`),onDelete:()=>void I()}),y.jsx("div",{className:"wiki-document-body",children:l?y.jsx(xn,{inline:!0,label:"Loading page"}):i!==null?y.jsx("div",{className:"wiki-article",children:y.jsx(uQ,{content:i})}):y.jsx(Rp,{compact:!0,title:"Page unavailable",description:"The page metadata loaded, but the content could not be shown yet. Try reloading the page.",actions:y.jsx("button",{type:"button",className:"btn",onClick:v,children:"Retry"})})})]}):y.jsx(Rp,{title:L===0?"Start the wiki":"Pick a page",description:L===0?"Create the first page and the wiki will organize itself into folders from its path.":"Choose a page from the sidebar, or create a new one if the answer does not exist yet.",actions:y.jsx("button",{type:"button",className:"btn primary",onClick:()=>S("/wiki/edit?new=1"),children:"New page"})})})]})]})}function tw(){return tw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tw.apply(null,arguments)}function Rse(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}let nw=[],SQ=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?SQ:nw).push(n=n+t[e])})();function Nse(t){if(t<768)return!1;for(let e=0,n=nw.length;;){let r=e+n>>1;if(t<nw[r])n=r;else if(t>=SQ[r])e=r+1;else return!0;if(e==n)return!1}}function r_(t){return t>=127462&&t<=127487}const i_=8205;function $se(t,e,n=!0,r=!0){return(n?kQ:Mse)(t,e,r)}function kQ(t,e,n){if(e==t.length)return e;e&&vQ(t.charCodeAt(e))&&xQ(t.charCodeAt(e-1))&&e--;let r=AO(t,e);for(e+=s_(r);e<t.length;){let i=AO(t,e);if(r==i_||i==i_||n&&Nse(i))e+=s_(i),r=i;else if(r_(i)){let s=0,o=e-2;for(;o>=0&&r_(AO(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Mse(t,e,n){for(;e>0;){let r=kQ(t,e-2,n);if(r<e)return r;e--}return 0}function AO(t,e){let n=t.charCodeAt(e);if(!xQ(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return vQ(r)?(n-55296<<10)+(r-56320)+65536:n}function vQ(t){return t>=56320&&t<57344}function xQ(t){return t>=55296&&t<56320}function s_(t){return t<65536?1:2}class Re{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=El(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),hi.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=El(this,e,n);let r=[];return this.decompose(e,n,r,0),hi.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new iu(this),s=new iu(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new iu(this,e)}iterRange(e,n=this.length){return new CQ(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new EQ(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Re.empty:e.length<=32?new xt(e):hi.from(xt.split(e,[]))}}class xt extends Re{constructor(e,n=Qse(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new Lse(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new xt(o_(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=bf(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new xt(a,o.length+s.length));else{let l=a.length>>1;r.push(new xt(a.slice(0,l)),new xt(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof xt))return super.replace(e,n,r);[e,n]=El(this,e,n);let i=bf(this.text,bf(r.text,o_(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new xt(i,s):hi.from(xt.split(i,[]),s)}sliceString(e,n=this.length,r=`
|
|
191
191
|
`){[e,n]=El(this,e,n);let i="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&n>s&&(i+=a.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new xt(r,i)),r=[],i=-1);return i>-1&&n.push(new xt(r,i)),n}}class hi extends Re{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&n>=o){let c=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!c?r.push(a):a.decompose(e-o,n-o,r,c)}o=l+1}}replace(e,n,r){if([e,n]=El(this,e,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&n<=a){let l=o.replace(e-s,n-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[i]=l,new hi(u,this.length-(n-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
192
192
|
`){[e,n]=El(this,e,n);let i="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&n>o&&(i+=a.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof hi))return 0;let r=0,[i,s,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let p of e)p.flatten(f);return new xt(f,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,u=[];function h(f){let p;if(f.lines>s&&f instanceof hi)for(let g of f.children)h(g);else f.lines>o&&(l>o||!l)?(d(),a.push(f)):f instanceof xt&&l&&(p=u[u.length-1])instanceof xt&&f.lines+p.lines<=32?(l+=f.lines,c+=f.length+1,u[u.length-1]=new xt(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>i&&d(),l+=f.lines,c+=f.length+1,u.push(f))}function d(){l!=0&&(a.push(u.length==1?u[0]:hi.from(u,c)),c=-1,l=u.length=0)}for(let f of e)h(f);return d(),a.length==1?a[0]:new hi(a,n)}}Re.empty=new xt([""],0);function Qse(t){let e=-1;for(let n of t)e+=n.length+1;return e}function bf(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=r;s++){let a=t[s],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function o_(t,e,n){return bf(t,[""],e,n)}class iu{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof xt?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof xt?i.text.length:i.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
193
193
|
`,this;e--}else if(i instanceof xt){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof xt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class CQ{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new iu(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class EQ{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Re.prototype[Symbol.iterator]=function(){return this.iter()},iu.prototype[Symbol.iterator]=CQ.prototype[Symbol.iterator]=EQ.prototype[Symbol.iterator]=function(){return this});let Lse=class{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}};function El(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Bt(t,e,n=!0,r=!0){return $se(t,e,n,r)}function Dse(t){return t>=56320&&t<57344}function zse(t){return t>=55296&&t<56320}function In(t,e){let n=t.charCodeAt(e);if(!zse(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Dse(r)?(n-55296<<10)+(r-56320)+65536:n}function jv(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function di(t){return t<65536?1:2}const rw=/\r\n?|\n/;var Vt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Vt||(Vt={}));class ki{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,n=!1){iw(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new ki(e)}composeDesc(e){return this.empty?e:e.empty?this:_Q(this,e)}mapDesc(e,n=!1){return e.empty?this:sw(this,e,n)}mapPos(e,n=-1,r=Vt.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=Vt.Simple&&c>=e&&(r==Vt.TrackDel&&i<e&&c>e||r==Vt.TrackBefore&&i<e||r==Vt.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==i||n<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ki(e)}static create(e){return new ki(e)}}class Nt extends ki{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return iw(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return sw(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let o=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(Re.empty);r.push(o?e.slice(s,s+o):Re.empty)}s+=o}return new Nt(n,r)}compose(e){return this.empty?e:e.empty?this:_Q(this,e,!0)}map(e,n=!1){return e.empty?this:sw(this,e,n,!0)}iterChanges(e,n=!1){iw(this,e,n)}get desc(){return ki.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new Vu(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-a);tn(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;tn(n,u,h),h>0&&As(r,n,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);tn(n,u,-1),tn(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new Nt(n,r),filtered:ki.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<n&&tn(i,n-o,-1);let h=new Nt(i,s);a=a?a.compose(h.map(a)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof Nt){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:d=h,insert:f}=u;if(h>d||h<0||d>n)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${n})`);let p=f?typeof f=="string"?Re.of(f.split(r||rw)):f:Re.empty,g=p.length;if(h==d&&g==0)return;h<o&&l(),h>o&&tn(i,h-o,-1),tn(i,d-h,g),As(s,i,p),o=d}}return c(e),l(!a),a}static empty(e){return new Nt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length<i;)r.push(Re.empty);r[i]=Re.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new Nt(n,r)}static createSet(e,n){return new Nt(e,n)}}function tn(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function As(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(Re.empty);t.push(n)}}function iw(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,h=Re.empty;for(;c+=a,u+=l,l&&r&&(h=h.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function sw(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Vu(t),a=new Vu(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);tn(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(tn(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(tn(i,0,o.ins),s&&As(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);c+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;tn(i,c,l<o.i?o.ins:0),s&&l<o.i&&As(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Nt.createSet(i,s):ki.create(i);throw new Error("Mismatched change set lengths")}}}function _Q(t,e,n=!1){let r=[],i=n?[]:null,s=new Vu(t),o=new Vu(e);for(let a=!1;;){if(s.done&&o.done)return i?Nt.createSet(r,i):ki.create(r);if(s.ins==0)tn(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)tn(r,0,o.ins,a),i&&As(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;tn(r,l,u,a),i&&u&&As(i,r,o.text)}else o.ins==-1?(tn(r,s.off?0:s.len,l,a),i&&As(i,r,s.textBit(l))):(tn(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&As(i,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}class Vu{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?Re.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Re.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Co{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Co(r,i,this.flags)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return B.range(e,n,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return B.range(this.anchor,i,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(e.anchor,e.head)}static create(e,n,r){return new Co(e,n,r)}}class B{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:B.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new B([this.main],0)}addRange(e,n=!0){return B.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,B.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(e.ranges.map(n=>Co.fromJSON(n)),e.main)}static single(e,n=e){return new B([B.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return B.normalized(e.slice(),n);r=s.to}return new B(e,n)}static cursor(e,n=0,r,i){return Co.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i,s){let o=(r??16777215)<<6|(i==null?7:Math.min(6,i));return!s&&e!=n&&(s=n<e?1:-1),n<e?Co.create(n,e,48|o):Co.create(e,n,(s?s<0?8:16:0)|o)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=n&&n--,e.splice(--i,2,s.anchor>s.head?B.range(l,a):B.range(a,l))}}return new B(e,n)}}function TQ(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Bv=0;class ae{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Bv++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ae(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Uv),!!e.static,e.enables)}of(e){return new wf([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new wf(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new wf(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Uv(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class wf{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Bv++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((n=e[h.id])!==null&&n!==void 0?n:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||ow(h,u)){let f=r(h);if(a?!a_(f,h.values[o],i):!i(f,h.values[o]))return h.values[o]=f,1}return 0},reconfigure:(h,d)=>{let f,p=d.config.address[s];if(p!=null){let g=$p(d,p);if(this.dependencies.every(b=>b instanceof ae?d.facet(b)===h.facet(b):b instanceof Gt?d.field(b,!1)==h.field(b,!1):!0)||(a?a_(f=r(h),g,i):i(f=r(h),g)))return h.values[o]=g,0}else f=r(h);return h.values[o]=f,1}}}}function a_(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function ow(t,e){let n=!1;for(let r of e)su(t,r)&1&&(n=!0);return n}function jse(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let u=0;u<r.length;u++){let h=$p(l,r[u]);if(i[u]==2)for(let d of h)c.push(d);else c.push(h)}return e.combine(c)}return{create(l){for(let c of r)su(l,c);return l.values[o]=a(l),1},update(l,c){if(!ow(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=ow(l,r),h=c.config.facets[e.id],d=c.facet(e);if(h&&!u&&Uv(n,h))return l.values[o]=d,0;let f=a(l);return e.compare(f,d)?(l.values[o]=d,0):(l.values[o]=f,1)}}}const Td=ae.define({static:!0});class Gt{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new Gt(Bv++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Td).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(Td),o=i.facet(Td),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Td.of({field:this,create:e})]}get extension(){return this}}const yo={lowest:4,low:3,default:2,high:1,highest:0};function xc(t){return e=>new AQ(e,t)}const os={highest:xc(yo.highest),high:xc(yo.high),default:xc(yo.default),low:xc(yo.low),lowest:xc(yo.lowest)};class AQ{constructor(e,n){this.inner=e,this.prec=n}}class cm{of(e){return new aw(this,e)}reconfigure(e){return cm.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class aw{constructor(e,n){this.compartment=e,this.inner=n}}class Np{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let d of Bse(e,n,o))d instanceof Gt?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of i)a[d.id]=c.length<<1,c.push(f=>d.slot(f));let u=r==null?void 0:r.config.facets;for(let d in s){let f=s[d],p=f[0].facet,g=u&&u[d]||[];if(f.every(b=>b.type==0))if(a[p.id]=l.length<<1|1,Uv(g,f))l.push(r.facet(p));else{let b=p.combine(f.map(m=>m.value));l.push(r&&p.compare(b,r.facet(p))?r.facet(p):b)}else{for(let b of f)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=c.length<<1,c.push(m=>b.dynamicSlot(m)));a[p.id]=c.length<<1,c.push(b=>jse(b,p,f))}}let h=c.map(d=>d(a));return new Np(e,o,h,a,l,s)}}function Bse(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof aw&&n.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof aw){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;n.set(o.compartment,c),s(c,a)}else if(o instanceof AQ)s(o.inner,o.prec);else if(o instanceof Gt)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof wf)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,yo.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(t,yo.default),r.reduce((o,a)=>o.concat(a))}function su(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function $p(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const PQ=ae.define(),lw=ae.define({combine:t=>t.some(e=>e),static:!0}),IQ=ae.define({combine:t=>t.length?t[0]:void 0,static:!0}),RQ=ae.define(),NQ=ae.define(),$Q=ae.define(),MQ=ae.define({combine:t=>t.length?t[0]:!1});class _i{constructor(e,n){this.type=e,this.value=n}static define(){return new Use}}class Use{of(e){return new _i(this,e)}}class Zse{constructor(e){this.map=e}of(e){return new we(this,e)}}class we{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new we(this.type,n)}is(e){return this.type==e}static define(e={}){return new Zse(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}we.reconfigure=we.define();we.appendConfig=we.define();class Pt{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&TQ(r,n.newLength),s.some(a=>a.type==Pt.time)||(this.annotations=s.concat(Pt.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Pt(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Pt.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Pt.time=_i.define();Pt.userEvent=_i.define();Pt.addToHistory=_i.define();Pt.remote=_i.define();function Fse(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],o=t[r++];else if(i<e.length)s=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function QQ(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=Nt.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:we.mapEffects(t.effects,i).concat(we.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function cw(t,e,n){let r=e.selection,i=nl(e.annotations);return e.userEvent&&(i=i.concat(Pt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Nt?e.changes:Nt.of(e.changes||[],n,t.facet(IQ)),selection:r&&(r instanceof B?r:B.single(r.anchor,r.head)),effects:nl(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function LQ(t,e,n){let r=cw(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;r=QQ(r,cw(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=Pt.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Wse(n?Xse(i):i)}function Xse(t){let e=t.startState,n=!0;for(let i of e.facet(RQ)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:Fse(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=Nt.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Pt.create(e,i,t.selection&&t.selection.map(s),we.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(NQ);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof Pt?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Pt?t=s[0]:t=LQ(e,nl(s),!1)}return t}function Wse(t){let e=t.startState,n=e.facet($Q),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=QQ(r,cw(e,s,t.changes.newLength),!0))}return r==t?t:Pt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Vse=[];function nl(t){return t==null?Vse:Array.isArray(t)?t:[t]}var lt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(lt||(lt={}));const Hse=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let uw;try{uw=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Yse(t){if(uw)return uw.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Hse.test(n)))return!0}return!1}function qse(t){return e=>{if(!/\S/.test(e))return lt.Space;if(Yse(e))return lt.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return lt.Word;return lt.Other}}class Te{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)su(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return su(this,r),$p(this,r)}update(...e){return LQ(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(cm.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(we.reconfigure)?(n=null,r=a.value):a.is(we.appendConfig)&&(n=null,r=nl(r).concat(a.value));let s;n?s=e.startState.values.slice():(n=Np.resolve(r,i,this),s=new Te(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(lw)?e.newSelection:e.newSelection.asSingle();new Te(n,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:B.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=nl(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let d=0;d<a;d++)s[d]=s[d].map(u);let h=i.mapDesc(c,!0);s.push(l.range.map(h)),i=i.compose(u),o=we.mapEffects(o,u).concat(we.mapEffects(nl(l.effects),h))}return{changes:i,selection:B.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof Nt?e:Nt.of(e,this.doc.length,this.facet(Te.lineSeparator))}toText(e){return Re.of(e.split(this.facet(Te.lineSeparator)||rw))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(su(this,n),$p(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Gt&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Te.create({doc:e.doc,selection:B.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=Np.resolve(e.extensions||[],new Map),r=e.doc instanceof Re?e.doc:Re.of((e.doc||"").split(n.staticFacet(Te.lineSeparator)||rw)),i=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return TQ(i,r.length),n.staticFacet(lw)||(i=i.asSingle()),new Te(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Te.tabSize)}get lineBreak(){return this.facet(Te.lineSeparator)||`
|
|
@@ -197,7 +197,7 @@ Try sending your message again.`,i)}finally{w(!1)}}function te(q){q.key==="Enter
|
|
|
197
197
|
`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),c=t.visualLineSide(i,!n)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function Foe(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==lt.Space&&(i=o),i==o}}function Xoe(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return B.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),u=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+u}let h=l.left+o,d=t.viewState.heightOracle.textHeight>>1,f=r??d;for(let p=0;;p+=d){let g=a+(f+p)*s,b=Tw(t,{x:h,y:g},!1,s);if(n?g>l.bottom:g<l.top)return B.cursor(b.pos,b.assoc);let m=t.coordsAtPos(b.pos,b.assoc),O=m?(m.top+m.bottom)/2:0;if(!m||(n?O>a:O<a))return B.cursor(b.pos,b.assoc,void 0,o)}}function cu(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||n||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function mL(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=cu(t,i.from,0);o!=i.from&&(s=B.cursor(o,-1))}else{let o=cu(t,i.from,-1),a=cu(t,i.to,1);(o!=i.from||a!=i.to)&&(s=B.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(n||(n=e.ranges.slice()),n[r]=s)}return n?B.create(n,e.mainIndex):e}function LO(t,e,n){let r=cu(t.state.facet(Nh).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:B.cursor(r,r<n.from?1:-1)}class fi{constructor(e,n){this.pos=e,this.assoc=n}}function Tw(t,e,n,r){let i=t.contentDOM.getBoundingClientRect(),s=i.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new fi(0,1);if(l>t.viewState.docHeight)return new fi(t.state.doc.length,-1);if(c=t.elementAtHeight(l),r==null)break;if(c.type==Yt.Text){if(r<0?c.to<t.viewport.from:c.from>t.viewport.to)break;let d=t.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(d&&(r<0?d.top<=l+s:d.bottom>=l+s))break}let h=t.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+h:c.top-h}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(n)return null;if(c.type==Yt.Text){let h=Uoe(t,i,c,o,a);return new fi(h,h==c.from?1:-1)}}if(c.type!=Yt.Text)return l<(c.top+c.bottom)/2?new fi(c.from,1):new fi(c.to,-1);let u=t.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=t.docView.lineAt(c.from,-2)),new Woe(t,o,a,t.textDirectionAt(c.from)).scanTile(u,c.from)}class Woe{constructor(e,n,r,i){this.view=e,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[gi.find(i,e-r.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[gi.find(i,e-r.from,-1,n)].dir}bidiIn(e,n){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<n)}scan(e,n,r=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,u=-1,h=1e9,d;e:for(;i<s;){let p=s-i,g=i+s>>1;t:if(o.has(g)){let m=i+Math.floor(Math.random()*p);for(let O=0;O<p;O++){if(!o.has(m)){g=m;break t}m++,m==s&&(m=i)}break e}o.add(g);let b=n(g);if(b)for(let m=0;m<b.length;m++){let O=b[m],w=0;if(!(O.width==0&&b.length>1)){if(O.bottom<this.y)(!l||l.bottom<O.bottom)&&(l=O),w=1;else if(O.top>this.y)(!c||c.top>O.top)&&(c=O),w=-1;else{let k=O.left>this.x?this.x-O.left:O.right<this.x?this.x-O.right:0,x=Math.abs(k);x<h&&(u=g,h=x,d=O),k&&(w=k<0==(this.baseDir==Ge.LTR)?-1:1)}w==-1&&(!a||this.baseDirAt(e[g],1))?s=g:w==1&&(!a||this.baseDirAt(e[g+1],-1))&&(i=g+1)}}}if(!d){let p=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(p.top+p.bottom)/2,this.scan(e,n,!0)}if(h&&!r){let{top:p,bottom:g}=d;if(l&&l.bottom>(p+p+g)/3)return this.y=l.bottom-1,this.scan(e,n,!0);if(c&&c.top<(p+g+g)/3)return this.y=c.top+1,this.scan(e,n,!0)}let f=(a?this.dirAt(e[u],1):this.baseDir)==Ge.LTR;return{i:u,after:this.x>(d.left+d.right)/2==f}}scanText(e,n){let r=[];for(let s=0;s<e.length;s=Bt(e.text,s))r.push(n+s);r.push(n+e.length);let i=this.scan(r,s=>{let o=r[s]-n,a=r[s+1]-n;return Ju(e.dom,o,a).getClientRects()});return i.after?new fi(r[i.i+1],-1):new fi(r[i.i],1)}scanTile(e,n){if(!e.length)return new fi(n,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let r=[n];for(let a=0,l=n;a<e.children.length;a++)r.push(l+=e.children[a].length);let i=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ju(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new fi(r[i.i+1],-1):new fi(o,1)}}const ya="";class Voe{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(Te.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ya}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=St.get(i),a=i.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=St.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Qp(i))||Qp(a)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!Yoe(a,n)&&this.lineBreak(),i=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(n))&&(s=a.index,o=a[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){let n=St.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Hoe(e,r.node,r.offset)?n:0))}}function Hoe(t,e,n){for(;;){if(!e||n<es(e))return!1;if(e==t)return!0;n=qs(e)+1,e=e.parentNode}}function Yoe(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=St.get(t);if(!(r!=null&&r.isWidget()))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let i=r.overrideDOMText;if(i!=null&&i.length)return!1}return!0}class C_{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class qoe{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=OL(e.docView.tile,n,r,0))){let l=s||o?[]:Koe(e),c=new Voe(l,e);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Joe(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Sw(e.contentDOM,l.focusNode)?a.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Sw(e.contentDOM,l.anchorNode)?a.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=e.viewport;if((le.ios||le.chrome)&&a.main.empty&&c!=u&&(h.from>0||h.to<e.state.doc.length)){let d=Math.min(c,u),f=Math.max(c,u),p=h.from-d,g=h.to-f;(p==0||p==1||d==0)&&(g==0||g==-1||f==e.state.doc.length)&&(c=0,u=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(B.range(u,c));else if(e.lineWrapping&&u==c&&!(a.main.empty&&a.main.head==c)&&e.inputState.lastTouchTime>Date.now()-100){let d=e.coordsAtPos(c,-1),f=0;d&&(f=e.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=B.create([B.cursor(c,f)])}else this.newSel=B.single(u,c)}}}function OL(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,u=r;l<t.children.length;l++){let h=t.children[l],d=c+h.length;if(c<e&&d>n)return OL(h,e,n,c);if(d>=e&&i==-1&&(i=l,s=c),c>n&&h.dom.parentNode==t.dom){o=l,a=u;break}u=d,c=d+h.breakAfter}return{from:s,to:a<0?r+t.length:a,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function yL(t,e){let n,{newSel:r}=e,{state:i}=t,s=i.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,c=s.from,u=null;(o===8||le.android&&e.text.length<l-a)&&(c=s.to,u="end");let h=i.doc.sliceString(a,l,ya),d,f;!s.empty&&s.from>=a&&s.to<=l&&(e.typeOver||h!=e.text)&&h.slice(0,s.from-a)==e.text.slice(0,s.from-a)&&h.slice(s.to-a)==e.text.slice(d=e.text.length-(h.length-(s.to-a)))?n={from:s.from,to:s.to,insert:Re.of(e.text.slice(s.from-a,d).split(ya))}:(f=bL(h,e.text,c-a,u))&&(le.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==ya+ya&&f.toB--,n={from:a+f.from,to:a+f.toA,insert:Re.of(e.text.slice(f.from,f.toB).split(ya))})}else r&&(!t.hasFocus&&i.facet(Qi)||jp(r,s))&&(r=null);if(!n&&!r)return!1;if((le.mac||le.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=B.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Re.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:i.toText(t.inputState.insertingText)}:le.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
|
|
198
198
|
`&&t.lineWrapping&&(r&&(r=B.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Re.of([" "])}),n)return Jv(t,n,r,o);if(r&&!jp(r,s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=mL(i.facet(Nh).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function Jv(t,e,n,r=-1){if(le.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(le.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&il(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&il(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&il(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=Goe(t,e,n));return t.state.facet(iL).some(l=>l(t,e.from,e.to,s,a))||t.dispatch(a()),!0}function Goe(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,u=cu(i.facet(Nh).map(h=>h(t)),c,l);e.from==u&&(o=u)}if(o>-1)r={changes:e,selection:B.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=i.changes(e),c=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let u=t.state.sliceDoc(e.from,e.to),h,d=n&&gL(t,n.main.head);if(d){let p=e.insert.length-(e.to-e.from);h={from:d.from,to:d.to-p}}else h=t.state.doc.lineAt(s.head);let f=s.to-e.to;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:c||p.map(l)};let g=p.to-f,b=g-u.length;if(t.state.sliceDoc(b,g)!=u||g>=h.from&&b<=h.to)return{range:p};let m=i.changes({from:b,to:g,insert:e.insert}),O=p.to-s.to;return{changes:m,range:c?B.range(Math.max(0,c.anchor+O),Math.max(0,c.head+O)):p.map(m)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function bL(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&t.length<e.length){let l=n<=s&&n>=o?s-n:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function Koe(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new C_(n,r)),(i!=n||s!=r)&&e.push(new C_(i,s))),e}function Joe(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?B.single(n+e,r+e):null}function jp(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class eae{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,le.safari&&e.contentDOM.addEventListener("input",()=>null),le.gecko&&gae(e.contentDOM.ownerDocument)}handleEvent(e){!lae(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=tae(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&SL.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),le.android&&le.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return le.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((n=wL.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nae.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,il(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:le.safari&&!le.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function E_(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){Mn(n.state,i)}}}function tae(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&n(a).handlers.push(E_(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(E_(r.value,l))}}for(let r in Yr)n(r).handlers.push(Yr[r]);for(let r in Bn)n(r).observers.push(Bn[r]);return e}const wL=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nae="dthko",SL=[16,17,18,20,91,92,224,225],Rd=6;function Nd(t){return Math.max(0,t)*.7+8}function rae(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class iae{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=FQ(e.contentDOM),this.atoms=e.state.facet(Nh).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Te.allowMultipleSelections)&&sae(e,n),this.dragging=aae(e,n)&&xL(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rae(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Kv(this.view);e.clientX-l.left<=i+Rd?n=-Nd(i-e.clientX):e.clientX+l.right>=o-Rd&&(n=Nd(e.clientX-o)),e.clientY-l.top<=s+Rd?r=-Nd(s-e.clientY):e.clientY+l.bottom>=a-Rd&&(r=Nd(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=mL(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function sae(t,e){let n=t.state.facet(eL);return n.length?n[0](e):le.mac?e.metaKey:e.ctrlKey}function oae(t,e){let n=t.state.facet(tL);return n.length?n[0](e):le.mac?!e.altKey:!e.ctrlKey}function aae(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Gu(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function lae(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=St.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Yr=Object.create(null),Bn=Object.create(null),kL=le.ie&&le.ie_version<15||le.ios&&le.webkit_version<604;function cae(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),vL(t,n.value)},50)}function pm(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function vL(t,e){e=pm(t.state,Hv,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(Aw!=null&&n.selection.ranges.every(l=>l.empty)&&Aw==s.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let h=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:h},range:B.cursor(c.from+h.length)}})}else o?r=n.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:B.cursor(l.from+c.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Bn.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Bn.wheel=Bn.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};Yr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Bn.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};Bn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Yr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(nL))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hae(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new iae(t,e,n,r)),r&&t.observer.ignore(()=>{XQ(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function __(t,e,n,r){if(r==1)return B.cursor(e,n);if(r==2)return Boe(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,B.range(o,a)}}const uae=le.ie&&le.ie_version<=11;let T_=null,A_=0,P_=0;function xL(t){if(!uae)return t.detail;let e=T_,n=P_;return T_=t,P_=Date.now(),A_=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(A_+1)%3:1}function hae(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=xL(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,a){let l=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,u=__(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let h=__(t,n.pos,n.assoc,r),d=Math.min(h.from,u.from),f=Math.max(h.to,u.to);u=d<u.from?B.range(d,f,u.assoc):B.range(f,d,u.assoc)}return o?i.replaceRange(i.main.extend(u.from,u.to,u.assoc)):a&&r==1&&i.ranges.length>1&&(c=dae(i,l.pos))?c:a?i.addRange(u):B.create([u])}}}function dae(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return B.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Yr.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=B.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",pm(t.state,Yv,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Yr.dragend=t=>(t.inputState.draggedContent=null,!1);function I_(t,e,n,r){if(n=pm(t.state,Hv,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&oae(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Yr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&I_(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return I_(t,e,r,!0),!0}return!1};Yr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=kL?null:e.clipboardData;return n?(vL(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cae(t),!1)};function fae(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function pae(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:pm(t,Yv,e.join(t.lineBreak)),ranges:n,linewise:r}}let Aw=null;Yr.copy=Yr.cut=(t,e)=>{if(!ou(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=pae(t.state);if(!n&&!i)return!1;Aw=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=kL?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(fae(t,n),!1)};const CL=_i.define();function EL(t,e){let n=[];for(let r of t.facet(sL)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:CL.of(!0)}):null}function _L(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=EL(t.state,e);n?t.dispatch(n):t.update([])}},10)}Bn.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),_L(t)};Bn.blur=t=>{t.observer.clearSelectionRange(),_L(t)};Bn.compositionstart=Bn.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Bn.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,le.chrome&&le.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Bn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Yr.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),c=t.posAtDOM(a.endContainer,a.endOffset);return Jv(t,{from:l,to:c,insert:t.state.toText(s)},null),!0}}let i;if(le.chrome&&le.android&&(i=wL.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return le.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),le.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Bn.compositionend(t,e),20),!1};const R_=new Set;function gae(t){R_.has(t)||(R_.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const N_=["pre-wrap","normal","pre-line","break-spaces"];let Al=!1;function $_(){Al=!1}class mae{constructor(e){this.lineWrapping=e,this.doc=Re.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return N_.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,o){let a=N_.indexOf(e)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class Oae{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Dr{constructor(e,n,r,i,s){this.from=e,this.length=n,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?Yt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Vo?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Dr(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var tt=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(tt||(tt={}));const Sf=.001;class vn{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Sf&&(Al=!0),this.height=e)}replace(e,n,r){return vn.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:h}=i[a],d=s.lineAt(l,tt.ByPosNoHeight,r.setDoc(n),0,0),f=d.to>=c?d:s.lineAt(c,tt.ByPosNoHeight,r,0,0);for(h+=f.to-c,c=f.to;a>0&&d.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<d.from&&(d=s.lineAt(l,tt.ByPosNoHeight,r,0,0));u+=d.from-l,l=d.from;let p=e0.build(r.setDoc(o),e,u,h);s=Bp(s,s.replace(l,c,p))}return s.updateHeight(r,0)}static empty(){return new Gn(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[n++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new bae(vn.of(e.slice(0,n)),o,vn.of(e.slice(r)))}}function Bp(t,e){return t==e?t:(t.constructor!=e.constructor&&(Al=!0),e)}vn.prototype.size=1;const yae=pe.replace({});class TL extends vn{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new Dr(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Dr(i,0,r,this.spaceAbove,yae):this.mainBlock(r,i)}lineAt(e,n,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.lineAt(0,tt.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Gn extends TL{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Dr(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Gn||i instanceof Ft&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ft?i=new Gn(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):vn.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ft extends vn{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=n.doc.lineAt(c),h=a+u.length*l,d=Math.max(r,e-h/2);return new Dr(u.from,u.length,d,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:u,length:h}=n.doc.line(s+c);return new Dr(u,h,r+a*c,a,0)}}lineAt(e,n,r,i,s){if(n==tt.ByHeight)return this.blockAt(e,r,i,s);if(n==tt.ByPosNoHeight){let{from:f,to:p}=r.doc.lineAt(e);return new Dr(f,p-f,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),u=a+c.length*l,h=c.number-o,d=i+a*h+l*(c.from-s-h);return new Dr(c.from,c.length,Math.max(i,Math.min(d,i+this.height-u)),u,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let u=e,h=i;u<=n;){let d=r.doc.lineAt(u);if(u==e){let p=d.number-a;h+=l*p+c*(e-s-p)}let f=l+c*d.length;o(new Dr(d.from,d.length,h,f,0)),h+=f,u=d.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof Ft?r[r.length-1]=new Ft(s.length+i):r.push(null,new Ft(i-1))}if(e>0){let s=r[0];s instanceof Ft?r[0]=new Ft(e+s.length):r.unshift(new Ft(e-1),null)}return vn.of(r)}decomposeLeft(e,n){n.push(new Ft(e-1),null)}decomposeRight(e,n){n.push(null,new Ft(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],a=Math.max(n,i.from),l=-1;for(i.from>n&&o.push(new Ft(i.from-n-1).updateHeight(e,n));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=i.heights[i.index++],d=0;h<0&&(d=-h,h=i.heights[i.index++]),l==-1?l=h:Math.abs(h-l)>=Sf&&(l=-2);let f=new Gn(u,h,d);f.outdated=!1,o.push(f),a+=u+1}a<=s&&o.push(null,new Ft(s-a).updateHeight(e,a));let c=vn.of(o);return(l<0||Math.abs(c.height-this.height)>=Sf||Math.abs(l-this.heightMetrics(e,n).perLine)>=Sf)&&(Al=!0),Bp(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class bae extends vn{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=n==tt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==tt.ByPosNoHeight?tt.ByPosNoHeight:tt.ByPos;return l?c.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,i,s).join(c)}forEachLine(e,n,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,i,s,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let c=this.lineAt(l,tt.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&M_(s,o-1),n<this.length){let a=s.length;this.decomposeRight(n,s),M_(s,a)}return vn.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?vn.of(this.break?[e,null,n]:[e,n]):(this.left=Bp(this.left,e),this.right=Bp(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,a=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function M_(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof Ft&&(r=t[e+1])instanceof Ft&&t.splice(e-1,3,new Ft(n.length+1+r.length))}const wae=5;class e0{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Gn?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Gn(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new TL(o,i,r)):(o||s||i>=wae)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Gn(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new Ft(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Gn)return e;let n=new Gn(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Gn)&&!this.isCovered?this.nodes.push(new Gn(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof Gn&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let s=new e0(r,e);return Ce.spans(n,r,i,s,0),s.finish(r)}}function Sae(t,e,n){let r=new kae;return Ce.compare(t,e,n,r,0),r.changes}class kae{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&rl(e,n,this.changes,5)}}function vae(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=Math.min(c==t.parentNode?i.innerHeight:l,d.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function xae(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function Cae(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class DO{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return pe.replace({widget:new Eae(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class Eae extends qr{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Q_{constructor(e,n){this.view=e,this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=L_,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ge.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(qv).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new mae(r),this.stateDeco=D_(n),this.heightMap=vn.empty().applyChanges(this.stateDeco,Re.empty,this.heightOracle.setDoc(n.doc),[new Or(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=pe.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new $d(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?L_:new t0(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(zc(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=D_(this.state);let i=e.changedRanges,s=Or.extendWithRanges(i,Sae(r,this.stateDeco,e?e.changes:Nt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);$_(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Al)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(aL)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ge.RTL:Ge.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let{scaleX:x,scaleY:S}=ZQ(n,a);(x>.005&&Math.abs(this.scaleX-x)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=x,this.scaleY=S,c|=16,o=l=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=FQ(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=WQ(this.scrollParent||e.win);let g=(this.printing?Cae:vae)(n,this.paddingTop),b=g.top-this.pixelViewport.top,m=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let O=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(O!=this.inView&&(this.inView=O,O&&(l=!0)),!this.inView&&!this.scrollTarget&&!xae(e.dom))return 0;let w=a.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let x=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(x)&&(o=!0),o||i.lineWrapping&&Math.abs(w-this.contentDOMWidth)>i.charWidth){let{lineHeight:S,charWidth:T,textHeight:P}=e.docView.measureTextSize();o=S>0&&i.refresh(s,S,T,P,Math.max(5,w/T),x),o&&(e.docView.minWidth=0,c|=16)}b>0&&m>0?u=Math.max(b,m):b<0&&m<0&&(u=Math.min(b,m)),$_();for(let S of this.viewports){let T=S.from==this.viewport.from?x:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?vn.empty().applyChanges(this.stateDeco,Re.empty,this.heightOracle,[new Or(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new Oae(S.from,T))}Al&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new $d(i.lineAt(o-r*1e3,tt.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,tt.ByHeight,s,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,tt.ByPos,s,0,0),d;n.y=="center"?d=(h.top+h.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?d=h.top:d=h.bottom-u,l=new $d(i.lineAt(d-1e3/2,tt.ByHeight,s,0,0).from,i.lineAt(d+u+1e3/2,tt.ByHeight,s,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new $d(this.heightMap.lineAt(r,tt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,tt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new DO(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Ge.LTR&&!r)return[];let a=[],l=(u,h,d,f)=>{if(h-u<s)return;let p=this.state.selection.main,g=[p.from];p.empty||g.push(p.to);for(let m of g)if(m>u&&m<h){l(u,m-10,d,f),l(m+10,h,d,f);return}let b=Tae(e,m=>m.from>=d.from&&m.to<=d.to&&Math.abs(m.from-u)<s&&Math.abs(m.to-h)<s&&!g.some(O=>m.from<O&&m.to>O));if(!b){if(h<d.to&&n&&r&&n.visibleRanges.some(w=>w.from<=h&&w.to>=h)){let w=n.moveToLineBoundary(B.cursor(h),!1,!0).head;w>u&&(h=w)}let m=this.gapSize(d,u,h,f),O=r||m<2e6?m:2e6;b=new DO(u,h,m,O)}a.push(b)},c=u=>{if(u.length<o||u.type!=Yt.Text)return;let h=_ae(u.from,u.to,this.stateDeco);if(h.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,f,p;if(r){let g=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,m;if(d!=null){let O=Qd(h,d),w=((this.visibleBottom-this.visibleTop)/2+g)/u.height;b=O-w,m=O+w}else b=(this.visibleTop-u.top-g)/u.height,m=(this.visibleBottom-u.top+g)/u.height;f=Md(h,b),p=Md(h,m)}else{let g=h.total*this.heightOracle.charWidth,b=i*this.heightOracle.charWidth,m=0;if(g>2e6)for(let S of e)S.from>=u.from&&S.from<u.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+m<this.pixelViewport.left&&(m=S.size-S.displaySize);let O=this.pixelViewport.left+m,w=this.pixelViewport.right+m,k,x;if(d!=null){let S=Qd(h,d),T=((w-O)/2+b)/g;k=S-T,x=S+T}else k=(O-b)/g,x=(w+b)/g;f=Md(h,k),p=Md(h,x)}f>u.from&&l(u.from,f,u,h),p<u.to&&l(p,u.to,u,h)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(e,n,r,i){let s=Qd(i,r)-Qd(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){DO.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=pe.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Ce.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||zc(this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||zc(this.heightMap.lineAt(this.scaler.fromDOM(e),tt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return zc(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class $d{constructor(e,n){this.from=e,this.to=n}}function _ae(t,e,n){let r=[],i=t,s=0;return Ce.spans(n,t,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function Md({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function Qd(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function Tae(t,e){for(let n of t)if(e(n))return n}const L_={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function D_(t){let e=t.facet(hm).filter(r=>typeof r!="function"),n=t.facet(Gv).filter(r=>typeof r!="function");return n.length&&e.push(Ce.join(n)),e}class t0{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,tt.ByPos,e,0,0).top,u=n.lineAt(l,tt.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof t0?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function zc(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Dr(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>zc(i,e)):t._content)}const Ld=ae.define({combine:t=>t.join(" ")}),Pw=ae.define({combine:t=>t.indexOf(!0)>-1}),Iw=Hs.newName(),AL=Hs.newName(),PL=Hs.newName(),IL={"&light":"."+AL,"&dark":"."+PL};function Rw(t,e,n){return new Hs(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const Aae=Rw("."+Iw,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},IL),Pae={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zO=le.ie&&le.ie_version<=11;class Iae{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new aoe,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(le.ie&&le.ie_version<=11||le.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&le.android&&e.constructor.EDIT_CONTEXT!==!1&&!(le.chrome&&le.chrome_version<126)&&(this.editContext=new Nae(e),e.state.facet(Qi)&&(e.contentDOM.editContext=this.editContext.editContext)),zO&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(Qi)?r.root.activeElement!=this.dom:!ou(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(le.ie&&le.ie_version<=11||le.android&&le.chrome)&&!r.state.selection.main.empty&&i.focusNode&&lu(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Gu(e.root);if(!n)return!1;let r=le.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Rae(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=ou(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&coe(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Pae),zO&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),zO&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&il(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&ou(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new qoe(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=yL(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!jp(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=z_(n,e.previousSibling||e.target.previousSibling,-1),i=z_(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Qi)!=e.state.facet(Qi)&&(e.view.contentDOM.editContext=e.state.facet(Qi)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function z_(t,e,n){for(;e;){let r=St.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function j_(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return lu(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Rae(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return j_(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?j_(t,n):null}class Nae{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&s<this.from?a=s:l==this.to&&s>this.to&&(l=s);let u=bL(e.state.sliceDoc(a,l),r.text,(c?i.from:i.to)-a,c?"end":null);if(!u){let d=B.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));jp(d,i)||e.dispatch({selection:d,userEvent:"select"});return}let h={from:u.from+a,to:u.toA+a,insert:Re.of(r.text.slice(u.from,u.toB).split(`
|
|
199
199
|
`))};if((le.mac||le.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Re.of([r.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let d=this.to-this.from+(h.to-h.from+h.insert.length);Jv(e,h,B.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.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=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(pe.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:cL.of(pe.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=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=Gu(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((s,o,a,l,c)=>{if(r)return;let u=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),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 re{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(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||loe(e.parent)||document,this.viewState=new Q_(this,e.state||Te.create(e)),e.scrollTo&&e.scrollTo.is(Id)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(La).map(i=>new NO(i));for(let i of this.plugins)i.update(this);this.observer=new Iae(this),this.inputState=new eae(this),this.inputState.ensureHandlers(this.plugins),this.docView=new v_(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 Pt?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,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(CL))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=EL(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Te.phrases)!=this.state.facet(Te.phrases))return this.setState(s);i=Lp.create(this,s,e),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:f}=d.state.selection,{x:p,y:g}=this.state.facet(re.cursorScrollMargin);h=new sl(f.empty?f:B.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",g,p)}for(let f of d.effects)f.is(Id)&&(h=f.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=Up.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Dc)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Ld)!=i.state.facet(Ld)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(Cw))try{d(i)}catch(f){Mn(this.state,f,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!yL(this,u)&&c.force&&il(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 Q_(this,e),this.plugins=e.facet(La).map(r=>new NO(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new v_(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(La),r=e.state.facet(La);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new NO(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.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){Mn(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:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(WQ(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(i);s=f.from,o=f.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!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 c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(f=>{try{return f.read(this)}catch(p){return Mn(this.state,p),B_}}),h=Lp.create(this,this.state,[]),d=!1;h.flags|=l,n?n.flags|=l: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 f=0;f<c.length;f++)if(u[f]!=B_)try{let p=c[f];p.write&&p.write(u[f],this)}catch(p){Mn(this.state,p)}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,o=-1;continue}else{let p=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o)/this.scaleY;if((p>1||p<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+p,r?r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(Cw))a(n)}get themeClasses(){return Iw+" "+(this.state.facet(Pw)?PL:AL)+" "+this.state.facet(Ld)}updateAttrs(){let e=U_(this,uL,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Qi)?"true":"false",class:"cm-content",style:`${le.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),U_(this,qv,n);let r=this.observer.ignore(()=>{let i=O_(this.contentDOM,this.contentAttrs,n),s=O_(this.dom,this.editorAttrs,e);return i||s});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(re.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Dc);let e=this.state.facet(re.cspNonce);Hs.mount(this.root,this.styleModules.concat(Aae).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 LO(this,e,x_(this,e,n,r))}moveByGroup(e,n){return LO(this,e,x_(this,e,n,r=>Foe(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return B.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return Zoe(this,e,n,r)}moveVertically(e,n,r){return LO(this,e,Xoe(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=Tw(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),Tw(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[gi.find(s,e-i.from,-1,n)];return Ku(r,o.dir==Ge.LTR==n>0)}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(oL)||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>$ae)return KQ(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||GQ(s.isolates,r=w_(this,e))))return s.order;r||(r=w_(this,e));let i=moe(e.text,n,r);return this.bidiCache.push(new Up(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||le.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{XQ(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,s,o;return Id.of(new sl(typeof e=="number"?B.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Id.of(new sl(B.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 kt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return kt.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Hs.newName(),i=[Ld.of(r),Dc.of(Rw(`.${r}`,e))];return n&&n.dark&&i.push(Pw.of(!0)),i}static baseTheme(e){return os.lowest(Dc.of(Rw("."+Iw,e,IL)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&St.get(r)||St.get(e);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}re.styleModule=Dc;re.inputHandler=iL;re.clipboardInputFilter=Hv;re.clipboardOutputFilter=Yv;re.scrollHandler=lL;re.focusChangeEffect=sL;re.perLineTextDirection=oL;re.exceptionSink=rL;re.updateListener=Cw;re.editable=Qi;re.mouseSelectionStyle=nL;re.dragMovesSelection=tL;re.clickAddsSelectionRange=eL;re.decorations=hm;re.blockWrappers=hL;re.outerDecorations=Gv;re.atomicRanges=Nh;re.bidiIsolatedRanges=dL;re.cursorScrollMargin=ae.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}}});re.scrollMargins=fL;re.darkTheme=Pw;re.cspNonce=ae.define({combine:t=>t.length?t[0]:""});re.contentAttributes=qv;re.editorAttributes=uL;re.lineWrapping=re.contentAttributes.of({class:"cm-lineWrapping"});re.announce=we.define();const $ae=4096,B_={};class Up{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Ge.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new Up(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function U_(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&Xv(o,n)}return n}const Mae=le.mac?"mac":le.windows?"win":le.linux?"linux":"key";function Qae(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Dd(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 Lae=os.default(re.domEventHandlers({keydown(t,e){return NL(RL(e.state),t,e,"editor")}})),Kl=ae.define({enables:Lae}),Z_=new WeakMap;function RL(t){let e=t.facet(Kl),n=Z_.get(e);return n||Z_.set(e,n=jae(e.reduce((r,i)=>r.concat(i),[]))),n}function Dae(t,e,n){return NL(RL(t.state),e,t,n)}let ks=null;const zae=4e3;function jae(t,e=Mae){let n=Object.create(null),r=Object.create(null),i=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,u)=>{var h,d;let f=n[o]||(n[o]=Object.create(null)),p=a.split(/ (?!$)/).map(m=>Qae(m,e));for(let m=1;m<p.length;m++){let O=p.slice(0,m).join(" ");i(O,!0),f[O]||(f[O]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=ks={view:w,prefix:O,scope:o};return setTimeout(()=>{ks==k&&(ks=null)},zae),!0}]})}let g=p.join(" ");i(g,!1);let b=f[g]||(f[g]={preventDefault:!1,stopPropagation:!1,run:((d=(h=f._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});l&&b.run.push(l),c&&(b.preventDefault=!0),u&&(b.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let d in u)u[d].run.push(f=>h(f,Nw))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let Nw=null;function NL(t,e,n,r){Nw=e;let i=toe(e),s=In(i,0),o=di(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;ks&&ks.view==n&&ks.scope==r&&(a=ks.prefix+" ",SL.indexOf(e.keyCode)<0&&(c=!0,ks=null));let h=new Set,d=b=>{if(b){for(let m of b.run)if(!h.has(m)&&(h.add(m),m(n)))return b.stopPropagation&&(u=!0),!0;b.preventDefault&&(b.stopPropagation&&(u=!0),c=!0)}return!1},f=t[r],p,g;return f&&(d(f[a+Dd(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(le.windows&&e.ctrlKey&&e.altKey)&&!(le.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Ys[e.keyCode])&&p!=i?(d(f[a+Dd(p,e,!0)])||e.shiftKey&&(g=Yu[e.keyCode])!=i&&g!=p&&d(f[a+Dd(g,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(f[a+Dd(i,e,!0)])&&(l=!0),!l&&d(f._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),Nw=null,l}class No{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}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 s=$L(e);return[new No(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Bae(e,n,r)}}function $L(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ge.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function F_(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=t.posAtCoords({x:s.left+1,y:o}),l=t.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function Bae(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),s=t.textDirection==Ge.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=$L(t),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),f=_w(t,r,1),p=_w(t,i,-1),g=f.type==Yt.Text?f:null,b=p.type==Yt.Text?p:null;if(g&&(t.lineWrapping||f.widgetLineBreaks)&&(g=F_(t,r,1,g)),b&&(t.lineWrapping||p.widgetLineBreaks)&&(b=F_(t,i,-1,b)),g&&b&&g.from==b.from&&g.to==b.to)return O(w(n.from,n.to,g));{let x=g?w(n.from,null,g):k(f,!1),S=b?w(null,n.to,b):k(p,!0),T=[];return(g||f).to<(b||p).from-(g&&b?1:0)||f.widgetLineBreaks>1&&x.bottom+t.defaultLineHeight/2<S.top?T.push(m(h,x.bottom,d,S.top)):x.bottom<S.top&&t.elementAtHeight((x.bottom+S.top)/2).type==Yt.Text&&(x.bottom=S.top=(x.bottom+S.top)/2),O(x).concat(T).concat(O(S))}function m(x,S,T,P){return new No(e,x-l.left,S-l.top,Math.max(0,T-x),P-S)}function O({top:x,bottom:S,horizontal:T}){let P=[];for(let Q=0;Q<T.length;Q+=2)P.push(m(T[Q],x,T[Q+1],S));return P}function w(x,S,T){let P=1e9,Q=-1e9,E=[];function M(Y,z,$,Z,I){let D=t.coordsAtPos(Y,Y==T.to?-2:2),C=t.coordsAtPos($,$==T.from?2:-2);!D||!C||(P=Math.min(D.top,C.top,P),Q=Math.max(D.bottom,C.bottom,Q),I==Ge.LTR?E.push(s&&z?h:D.left,s&&Z?d:C.right):E.push(!s&&Z?h:C.left,!s&&z?d:D.right))}let L=x??T.from,H=S??T.to;for(let Y of t.visibleRanges)if(Y.to>L&&Y.from<H)for(let z=Math.max(Y.from,L),$=Math.min(Y.to,H);;){let Z=t.state.doc.lineAt(z);for(let I of t.bidiSpans(Z)){let D=I.from+Z.from,C=I.to+Z.from;if(D>=$)break;C>z&&M(Math.max(D,z),x==null&&D<=L,Math.min(C,$),S==null&&C>=H,I.dir)}if(z=Z.to+1,z>=$)break}return E.length==0&&M(L,x==null,H,S==null,t.textDirection),{top:P,bottom:Q,horizontal:E}}function k(x,S){let T=a.top+(S?x.top:x.bottom);return{top:T,bottom:T,horizontal:[]}}}function Uae(t,e){return t.constructor==e.constructor&&t.eq(e)}class Zae{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(kf)!=e.state.facet(kf)&&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(kf);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)=>!Uae(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,le.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const kf=ae.define();function ML(t){return[kt.define(e=>new Zae(e,t)),kf.of(t)]}const Pl=ae.define({combine(t){return Ti(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Fae(t={}){return[Pl.of(t),Xae,Wae,Vae,aL.of(!0)]}function QL(t){return t.startState.facet(Pl)!=t.state.facet(Pl)}const Xae=ML({above:!0,markers(t){let{state:e}=t,n=e.facet(Pl),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.drawRangeCursor&&!(s&&le.ios&&n.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:B.cursor(i.head,i.assoc);for(let l of No.forRange(t,o,a))r.push(l)}}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=QL(t);return n&&X_(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){X_(e.state,t)},class:"cm-cursorLayer"});function X_(t,e){e.style.animationDuration=t.facet(Pl).cursorBlinkRate+"ms"}const Wae=ML({above:!1,markers(t){let e=[],{main:n,ranges:r}=t.state.selection;for(let i of r)if(!i.empty)for(let s of No.forRange(t,"cm-selectionBackground",i))e.push(s);if(le.ios&&!n.empty&&t.state.facet(Pl).iosSelectionHandles){for(let i of No.forRange(t,"cm-selectionHandle cm-selectionHandle-start",B.cursor(n.from,1)))e.push(i);for(let i of No.forRange(t,"cm-selectionHandle cm-selectionHandle-end",B.cursor(n.to,1)))e.push(i)}return e},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||QL(t)},class:"cm-selectionLayer"}),Vae=os.highest(re.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),LL=we.define({map(t,e){return t==null?null:e.mapPos(t)}}),jc=Gt.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(LL)?r.value:n,t)}}),Hae=kt.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(jc);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(jc)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(jc),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(jc)!=t&&this.view.dispatch({effects:LL.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 Yae(){return[jc,Hae]}function W_(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function qae(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:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class Gae{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=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=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let h=r(a,l,c);h&&u(c,c+a[0].length,h)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new Ji,r=n.add.bind(n);for(let{from:i,to:s}of qae(e,this.maxLength))W_(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,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 s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let d=[],f,p=(g,b,m)=>d.push(m.range(g,b));if(l==c)for(this.regexp.lastIndex=u-l.from;(f=this.regexp.exec(l.text))&&f.index<h-l.from;)this.addMatch(f,e,f.index+l.from,p);else W_(e.state.doc,this.regexp,u,h,(g,b)=>this.addMatch(b,e,g,p));n=n.update({filterFrom:u,filterTo:h,filter:(g,b)=>g<u||b>h,add:d})}}return n}}const $w=/x/.unicode!=null?"gu":"g",Kae=new RegExp(`[\0-\b
|
|
200
|
-
--\u2028\u2029\uFEFF-]`,$w),Jae={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 jO=null;function ele(){var t;if(jO==null&&typeof document<"u"&&document.body){let e=document.body.style;jO=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return jO||!1}const vf=ae.define({combine(t){let e=Ti(t,{render:null,specialChars:Kae,addSpecialChars:null});return(e.replaceTabs=!ele())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,$w)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,$w)),e}});function tle(t={}){return[vf.of(t),nle()]}let V_=null;function nle(){return V_||(V_=kt.fromClass(class{constructor(t){this.view=t,this.decorations=pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(vf)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Gae({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=In(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=Hr(o.text,a,r-o.from);return pe.replace({widget:new ole((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=pe.replace({widget:new sle(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(vf);t.startState.facet(vf)!=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 rle="•";function ile(t){return t>=32?rle:t==10?"":String.fromCharCode(9216+t)}class sle extends qr{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=ile(this.code),r=e.state.phrase("Control character")+" "+(Jae[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class ole extends qr{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 ale(){return cle}const lle=pe.line({class:"cm-activeLine"}),cle=kt.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(lle.range(i.from)),e=i.from)}return pe.set(n)}},{decorations:t=>t.decorations});class ule extends qr{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?au(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Ku(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function hle(t){let e=kt.fromClass(class{constructor(n){this.view=n,this.placeholder=t?pe.set([pe.widget({widget:new ule(t),side:1}).range(0)]):pe.none}get decorations(){return this.view.state.doc.length?pe.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,re.contentAttributes.of({"aria-placeholder":t})]:e}const Mw=2e3;function dle(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>Mw||n.off>Mw||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(B.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),u=pw(c.text,o,t.tabSize,!0);if(u<0)s.push(B.cursor(c.to));else{let h=pw(c.text,a,t.tabSize);s.push(B.range(c.from+u,c.from+h))}}}return s}function fle(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function H_(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>Mw?-1:i==r.length?fle(t,e.clientX):Hr(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function ple(t,e){let n=H_(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=H_(t,i);if(!a)return r;let l=dle(t.state,n,a);return l.length?o?B.create(l.concat(r.ranges)):B.create(l):r}}:null}function gle(t){let e=n=>n.altKey&&n.button==0;return re.mouseSelectionStyle.of((n,r)=>e(r)?ple(n,r):null)}const mle={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},Ole={style:"cursor: crosshair"};function yle(t={}){let[e,n]=mle[t.key||"Alt"],r=kt.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,re.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?Ole:null})]}const zd="-10000px";class DL{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(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function ble(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const BO=ae.define({combine:t=>{var e,n,r;return{position:le.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)||ble}}}),Y_=new WeakMap,n0=kt.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(BO);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 DL(t,r0,(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(BO);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=zd,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:s}=this.manager.tooltipViews[0];if(le.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Kv(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((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(BO).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=t.pos[a],d=t.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){u.style.top=zd;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,b=(e=Y_.get(c))!==null&&e!==void 0?e:d.bottom-d.top,m=c.offset||Sle,O=this.view.textDirection==Ge.LTR,w=d.width>r.right-r.left?O?r.left:r.right-d.width:O?Math.max(r.left,Math.min(h.left-(f?14:0)+m.x,r.right-g)):Math.min(Math.max(r.left,h.left-g+(f?14:0)-m.x),r.right-g),k=this.above[a];!l.strictSide&&(k?h.top-b-p-m.y<r.top:h.bottom+b+p+m.y>r.bottom)&&k==r.bottom-h.bottom>h.top-r.top&&(k=this.above[a]=!k);let x=(k?h.top-r.top:r.bottom-h.bottom)-p;if(x<b&&c.resize!==!1){if(x<this.view.defaultLineHeight){u.style.top=zd;continue}Y_.set(c,b),u.style.height=(b=x)/s+"px"}else u.style.height&&(u.style.height="");let S=k?h.top-b-p-m.y:h.bottom+p+m.y,T=w+g;if(c.overlap!==!0)for(let P of o)P.left<T&&P.right>w&&P.top<S+b&&P.bottom>S&&(S=k?P.top-b-2-p:P.bottom+p+2);if(this.position=="absolute"?(u.style.top=(S-t.parent.top)/s+"px",q_(u,(w-t.parent.left)/i)):(u.style.top=S/s+"px",q_(u,w/i)),f){let P=h.left+(O?m.x:-m.x)-(w+14-7);f.style.left=P/i+"px"}c.overlap!==!0&&o.push({left:w,top:S,right:T,bottom:S+b}),u.classList.toggle("cm-tooltip-above",k),u.classList.toggle("cm-tooltip-below",!k),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=zd}},{eventObservers:{scroll(){this.maybeMeasure()}}});function q_(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const wle=re.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:`${7*2}px`,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"}}}),Sle={x:0,y:0},r0=ae.define({enables:[n0,wle]}),Zp=ae.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class gm{static create(e){return new gm(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new DL(e,Zp,(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 kle=r0.compute([Zp],t=>{let e=t.facet(Zp);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:gm.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),zL=ae.define();class vle{constructor(e,n,r,i,s,o){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,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,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let o=e.coordsAtPos(i);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-e.defaultCharacterWidth||n.x>o.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),l=a&&a.dir==Ge.RTL?-1:1;s=n.x<o.left?-l:l}this.activateHover(e,i,s)}activateHover(e,n,r,i){let s=this.source(e,n,r),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let l=Array.isArray(a)?a:[a];i&&this.locked.set(l,i),e.dispatch({effects:this.setHover.of(l)})}};if(s&&"then"in s){let a=this.pending={pos:n};s.then(l=>{this.pending==a&&(this.pending=null,o(l))},l=>Mn(e.state,l,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(n0),n=e?e.manager.tooltips.findIndex(r=>r.create==gm.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:s}=this;if(i.length&&!this.locked.has(i)&&s&&!xle(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!Cle(this.view,o,a,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 jd=4;function xle(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=n-jd&&e.clientX<=r+jd&&e.clientY>=i-jd&&e.clientY<=s+jd}function Cle(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function Ele(t,e={}){let n=we.define(),r=new WeakMap,i=Gt.define({create(){return[]},update(o,a){let l=r.get(o);if(o.length&&(e.hideOnChange&&(a.docChanged||a.selection)?o=[]:l&&l(a)?o=[]:e.hideOn&&(o=o.filter(c=>!e.hideOn(a,c)))),a.docChanged&&o.length){let c=[];for(let u of o){let h=a.changes.mapPos(u.pos,-1,Vt.TrackDel);if(h!=null){let d=Object.assign(Object.create(null),u);d.pos=h,d.end!=null&&(d.end=a.changes.mapPos(d.end)),c.push(d)}}o=c}for(let c of a.effects)c.is(n)&&(o=c.value,l=void 0),(c.is(Tle)&&!c.value||c.value==i)&&(o=[]);return o.length&&l&&r.set(o,l),o},provide:o=>Zp.from(o)});const s=kt.define(o=>new vle(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,zL.of(s),kle]}}function _le(t,e,n,r={}){var i;let s=t.state.facet(zL).map(o=>t.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=s.find(a=>a.field==r.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(t,e,n,(i=r.until)!==null&&i!==void 0?i:()=>!1)}function jL(t,e){let n=t.plugin(n0);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Tle=we.define(),G_=ae.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 i0(t,e){let n=t.plugin(BL),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const BL=kt.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(G_);this.top=new Bd(t,!0,e.topContainer),this.bottom=new Bd(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(G_);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Bd(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Bd(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(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?s:o).push(u)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>re.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Bd{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",this.dom.style[this.top?"top":"bottom"]="0";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=K_(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=K_(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 K_(t){let e=t.nextSibling;return t.remove(),e}const eh=ae.define({enables:BL});function Ale(t,e){let n,r=new Promise(o=>n=o),i=o=>Ple(o,e,n);t.state.field(UO,!1)?t.dispatch({effects:UL.of(i)}):t.dispatch({effects:we.appendConfig.of(UO.init(()=>[i]))});let s=ZL.of(i);return{close:s,result:r.then(o=>((t.win.queueMicrotask||(l=>t.win.setTimeout(l,10)))(()=>{t.state.field(UO).indexOf(i)>-1&&t.dispatch({effects:s})}),o))}}const UO=Gt.define({create(){return[]},update(t,e){for(let n of e.effects)n.is(UL)?t=[n.value].concat(t):n.is(ZL)&&(t=t.filter(r=>r!=n.value));return t},provide:t=>eh.computeN([t],e=>e.field(t))}),UL=we.define(),ZL=we.define();function Ple(t,e,n){let r=e.content?e.content(t,()=>o(null)):null;if(!r){if(r=Ve("form"),e.input){let a=Ve("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(Ve("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(Ve("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<i.length;a++){let l=i[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let s=Ve("div",r,Ve("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(a){s.contains(s.ownerDocument.activeElement)&&t.focus(),n(a)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class ts extends Vs{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ts.prototype.elementClass="";ts.prototype.toDOM=void 0;ts.prototype.mapMode=Vt.TrackBefore;ts.prototype.startSide=ts.prototype.endSide=-1;ts.prototype.point=!0;const xf=ae.define(),Ile=ae.define(),Rle={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ce.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},uu=ae.define();function Nle(t){return[FL(),uu.of({...Rle,...t})]}const J_=ae.define({combine:t=>t.some(e=>e)});function FL(t){return[$le]}const $le=kt.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(uu).map(e=>new tT(t,e)),this.fixed=!t.state.facet(J_);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(J_)!=!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=Ce.iter(this.view.state.facet(xf),this.view.viewport.from),r=[],i=this.gutters.map(s=>new Mle(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Yt.Text&&o){Qw(n,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Yt.Text){Qw(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(uu),n=t.state.facet(uu),r=t.docChanged||t.heightChanged||t.viewportChanged||!Ce.eq(t.startState.facet(xf),t.state.facet(xf),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 s of n){let o=e.indexOf(s);o<0?i.push(new tT(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.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=>re.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==Ge.LTR?{left:r,right:i}:{right:r,left:i}})});function eT(t){return Array.isArray(t)?t:[t]}function Qw(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Mle{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Ce.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new XL(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];Qw(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.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 s of e.state.facet(Ile)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}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 tT{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 s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=eT(n.markers(e)),n.initialSpacer&&(this.spacer=new XL(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=eT(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!Ce.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 XL{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":""),Qle(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<n.length?n[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Qle(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 Lle=ae.define(),Dle=ae.define(),Da=ae.define({combine(t){return Ti(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class ZO extends ts{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function FO(t,e){return t.state.facet(Da).formatNumber(e,t.state)}const zle=uu.compute([Da],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Lle)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new ZO(FO(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(Dle)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Da)!=e.state.facet(Da),initialSpacer(e){return new ZO(FO(e,nT(e.state.doc.lines)))},updateSpacer(e,n){let r=FO(n.view,nT(n.view.state.doc.lines));return r==e.number?e:new ZO(r)},domEventHandlers:t.facet(Da).domEventHandlers,side:"before"}));function jle(t={}){return[Da.of(t),FL(),zle]}function nT(t){let e=9;for(;e<t;)e=e*10+9;return e}const Ble=new class extends ts{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Ule=xf.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(Ble.range(i)))}return Ce.of(e)});function Zle(){return Ule}const WL=1024;let Fle=0;class yr{constructor(e,n){this.from=e,this.to=n}}class Se{constructor(e={}){this.id=Fle++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Qt.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Se.closedBy=new Se({deserialize:t=>t.split(" ")});Se.openedBy=new Se({deserialize:t=>t.split(" ")});Se.group=new Se({deserialize:t=>t.split(" ")});Se.isolate=new Se({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Se.contextHash=new Se({perNode:!0});Se.lookAhead=new Se({perNode:!0});Se.mounted=new Se({perNode:!0});class ol{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[Se.mounted.id]}}const Xle=Object.create(null);class Qt{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):Xle,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Qt(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Se.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Se.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Qt.none=new Qt("",Object.create(null),0,8);class $h{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}n.push(i?new Qt(r.name,i,r.id,r.flags):r)}return new $h(n)}}const Ud=new WeakMap,rT=new WeakMap;var je;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(je||(je={}));class De{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=ol.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Fp(this.topNode,e)}cursorAt(e,n=0,r=0){let i=Ud.get(this)||this.topNode,s=new Fp(i);return s.moveTo(e,n),Ud.set(this,s._tree),s}get topNode(){return new on(this,0,0,null)}resolve(e,n=0){let r=th(Ud.get(this)||this.topNode,e,n,!1);return Ud.set(this,r),r}resolveInner(e,n=0){let r=th(rT.get(this)||this.topNode,e,n,!0);return rT.set(this,r),r}resolveStack(e,n=0){return Hle(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&je.IncludeAnonymous)>0;for(let l=this.cursor(o|je.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:a0(Qt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new De(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new De(Qt.none,n,r,i)))}static build(e){return Yle(e)}}De.empty=new De(Qt.none,[],[],0);class s0{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s0(this.buffer,this.index)}}class Gs{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Qt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(VL(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Gs(s,o,this.set)}}function VL(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function th(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof on&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:je.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof on&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class HL{cursor(e=0){return new Fp(this,e)}getChild(e,n=null,r=null){let i=iT(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return iT(this,e,n,r)}resolve(e,n=0){return th(this,e,n,!1)}resolveInner(e,n=0){return th(this,e,n,!0)}matchContext(e){return Lw(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class on extends HL{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],h=l[e]+o.from,d;if(!(!(s&je.EnterBracketed&&u instanceof De&&(d=ol.get(u))&&!d.overlay&&d.bracketed&&r>=h&&r<=h+u.length)&&!VL(i,r,h,h+u.length))){if(u instanceof Gs){if(s&je.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,n,r-h,i);if(f>-1)return new mi(new Wle(o,u,e,h),null,f)}else if(s&je.IncludeAnonymous||!u.type.isAnonymous||o0(u)){let f;if(!(s&je.IgnoreMounts)&&(f=ol.get(u))&&!f.overlay)return new on(f.tree,h,e,o);let p=new on(u,h,e,o);return s&je.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&je.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&je.IgnoreOverlays)&&(i=ol.get(this._tree))&&i.overlay){let s=e-this.from,o=r&je.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((n>0||o?a<=s:a<s)&&(n<0||o?l>=s:l>s))return new on(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function iT(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Lw(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Wle{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class mi extends HL{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new mi(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&je.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new mi(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new mi(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new mi(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new De(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function YL(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof on&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new Vle(i,n)}class Vle{constructor(e,n){this.heads=e,this.node=n}get next(){return YL(this.heads)}}function Hle(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof on?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=ol.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new on(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(th(a,e,n,!1))}}return i?YL(i):r}class Fp{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~je.EnterBracketed,e instanceof on)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof on?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&je.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&je.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&je.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&je.IncludeAnonymous||a instanceof Gs||!a.type.isAnonymous||o0(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new mi(this.buffer,n,this.stack[i]);return this.bufferNode=new mi(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return Lw(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return Lw(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function o0(t){return t.children.some(e=>e instanceof Gs||!e.type.isAnonymous||o0(e))}function Yle(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=WL,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new s0(n,n.length):n,l=r.types,c=0,u=0;function h(x,S,T,P,Q,E){let{id:M,start:L,end:H,size:Y}=a,z=u,$=c;if(Y<0)if(a.next(),Y==-1){let F=s[M];T.push(F),P.push(L-x);return}else if(Y==-3){c=M;return}else if(Y==-4){u=M;return}else throw new RangeError(`Unrecognized record size: ${Y}`);let Z=l[M],I,D,C=L-x;if(H-L<=i&&(D=b(a.pos-S,Q))){let F=new Uint16Array(D.size-D.skip),W=a.pos-D.size,v=F.length;for(;a.pos>W;)v=m(D.start,F,v);I=new Gs(F,H-D.start,r),C=D.start-x}else{let F=a.pos-Y;a.next();let W=[],v=[],V=M>=o?M:-1,se=0,te=H;for(;a.pos>F;)V>=0&&a.id==V&&a.size>=0?(a.end<=te-i&&(p(W,v,L,se,a.end,te,V,z,$),se=W.length,te=a.end),a.next()):E>2500?d(L,F,W,v):h(L,F,W,v,V,E+1);if(V>=0&&se>0&&se<W.length&&p(W,v,L,se,L,te,V,z,$),W.reverse(),v.reverse(),V>-1&&se>0){let q=f(Z,$);I=a0(Z,W,v,0,W.length,0,H-L,q,q)}else I=g(Z,W,v,H-L,z-H,$)}T.push(I),P.push(C)}function d(x,S,T,P){let Q=[],E=0,M=-1;for(;a.pos>S;){let{id:L,start:H,end:Y,size:z}=a;if(z>4)a.next();else{if(M>-1&&H<M)break;M<0&&(M=Y-i),Q.push(L,H,Y),E++,a.next()}}if(E){let L=new Uint16Array(E*4),H=Q[Q.length-2];for(let Y=Q.length-3,z=0;Y>=0;Y-=3)L[z++]=Q[Y],L[z++]=Q[Y+1]-H,L[z++]=Q[Y+2]-H,L[z++]=z;T.push(new Gs(L,Q[2]-H,r)),P.push(H-x)}}function f(x,S){return(T,P,Q)=>{let E=0,M=T.length-1,L,H;if(M>=0&&(L=T[M])instanceof De){if(!M&&L.type==x&&L.length==Q)return L;(H=L.prop(Se.lookAhead))&&(E=P[M]+L.length+H)}return g(x,T,P,Q,E,S)}}function p(x,S,T,P,Q,E,M,L,H){let Y=[],z=[];for(;x.length>P;)Y.push(x.pop()),z.push(S.pop()+T-Q);x.push(g(r.types[M],Y,z,E-Q,L-E,H)),S.push(Q-T)}function g(x,S,T,P,Q,E,M){if(E){let L=[Se.contextHash,E];M=M?[L].concat(M):[L]}if(Q>25){let L=[Se.lookAhead,Q];M=M?[L].concat(M):[L]}return new De(x,S,T,P,M)}function b(x,S){let T=a.fork(),P=0,Q=0,E=0,M=T.end-i,L={size:0,start:0,skip:0};e:for(let H=T.pos-x;T.pos>H;){let Y=T.size;if(T.id==S&&Y>=0){L.size=P,L.start=Q,L.skip=E,E+=4,P+=4,T.next();continue}let z=T.pos-Y;if(Y<0||z<H||T.start<M)break;let $=T.id>=o?4:0,Z=T.start;for(T.next();T.pos>z;){if(T.size<0)if(T.size==-3||T.size==-4)$+=4;else break e;else T.id>=o&&($+=4);T.next()}Q=Z,P+=Y,E+=$}return(S<0||P==x)&&(L.size=P,L.start=Q,L.skip=E),L.size>4?L:void 0}function m(x,S,T){let{id:P,start:Q,end:E,size:M}=a;if(a.next(),M>=0&&P<o){let L=T;if(M>4){let H=a.pos-(M-4);for(;a.pos>H;)T=m(x,S,T)}S[--T]=L,S[--T]=E-x,S[--T]=Q-x,S[--T]=P}else M==-3?c=P:M==-4&&(u=P);return T}let O=[],w=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,O,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:O.length?w[0]+O[0].length:0;return new De(l[t.topID],O.reverse(),w.reverse(),k)}const sT=new WeakMap;function Cf(t,e){if(!t.isAnonymous||e instanceof Gs||e.type!=t)return 1;let n=sT.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof De)){n=1;break}n+=Cf(t,r)}sT.set(e,n)}return n}function a0(t,e,n,r,i,s,o,a,l){let c=0;for(let p=r;p<i;p++)c+=Cf(t,e[p]);let u=Math.ceil(c*1.5/8),h=[],d=[];function f(p,g,b,m,O){for(let w=b;w<m;){let k=w,x=g[w],S=Cf(t,p[w]);for(w++;w<m;w++){let T=Cf(t,p[w]);if(S+T>=u)break;S+=T}if(w==k+1){if(S>u){let T=p[k];f(T.children,T.positions,0,T.children.length,g[k]+O);continue}h.push(p[k])}else{let T=g[w-1]+p[w-1].length-x;h.push(a0(t,p,g,k,w,x,T,null,l))}d.push(x+O-s)}}return f(e,n,r,i,0),(a||l)(h,d,o)}class qL{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof mi?this.setBuffer(e.context.buffer,e.index,n):e instanceof on&&this.map.set(e.tree,n)}get(e){return e instanceof mi?this.getBuffer(e.context.buffer,e.index):e instanceof on?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xi{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Xi(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,h=u?u.fromA:1e9;if(h-l>=r)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||c){let f=Math.max(d.from,l)-c,p=Math.min(d.to,h)-c;d=f>=p?null:new Xi(f,p,d.tree,d.offset+c,a>0,!!u)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class l0{startParse(e,n,r){return typeof e=="string"&&(e=new qle(e)),r=r?r.length?r.map(i=>new yr(i.from,i.to)):[new yr(0,0)]:[new yr(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class qle{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function GL(t){return(e,n,r,i)=>new Kle(e,t,n,r,i)}class oT{constructor(e,n,r,i,s,o){this.parser=e,this.parse=n,this.overlay=r,this.bracketed=i,this.target=s,this.from=o}}function aT(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class Gle{constructor(e,n,r,i,s,o,a,l){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const Dw=new Se({perNode:!0});class Kle{constructor(e,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new De(r.type,r.children,r.positions,r.length,r.propValues.concat([[Dw,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Se.mounted.id]=new ol(n,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new tce(this.fragments),n=null,r=null,i=new Fp(new on(this.baseTree,this.ranges[0].from,0,null),je.IncludeAnonymous|je.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,d=u.to+c.pos;h>=i.from&&d<=i.to&&!n.ranges.some(f=>f.from<d&&f.to>h)&&n.ranges.push({from:h,to:d})}}a=!1}else if(r&&(o=Jle(r.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||(ece(i),n&&n.depth++,r&&r.depth++);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new Gle(s.parser,s.overlay,c,this.inner.length,i.from,!!s.bracketed,i.tree,n);else{let u=uT(this.ranges,s.overlay||(i.from<i.to?[new yr(i.from,i.to)]:[]));u.length&&aT(u),(u.length||!s.overlay)&&this.inner.push(new oT(s.parser,u.length?s.parser.startParse(this.input,hT(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new yr(h.from-i.from,h.to-i.from)):null,!!s.bracketed,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new yr(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=uT(this.ranges,n.ranges);c.length&&(aT(c),this.inner.splice(n.index,0,new oT(n.parser,n.parser.startParse(this.input,hT(n.mounts,c),c),n.ranges.map(u=>new yr(u.from-n.start,u.to-n.start)),n.bracketed,n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function Jle(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function lT(t,e,n,r,i,s){if(e<n){let o=t.buffer[e+1];r.push(t.slice(e,n,o)),i.push(o-s)}}function ece(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,s=i.children.indexOf(r),o=i.children[s],a=o.buffer,l=[s];function c(u,h,d,f,p,g){let b=n[g],m=[],O=[];lT(o,u,b,m,O,f);let w=a[b+1],k=a[b+2];l.push(m.length);let x=g?c(b+4,a[b+3],o.set.types[a[b]],w,k-w,g-1):e.toTree();return m.push(x),O.push(w-f),lT(o,a[b+3],h,m,O,f),new De(d,m,O,p)}i.children[s]=c(0,a.length,Qt.none,0,o.length,n.length-1);for(let u of l){let h=t.tree.children[u],d=t.tree.positions[u];t.yield(new on(h,d+t.from,u,t._tree))}}class cT{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(je.IncludeAnonymous|je.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)if(!(n.to>=e&&n.enter(r,1,je.IgnoreOverlays|je.ExcludeBuffers)))if(n.to<=e)n.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof De)n=n.children[0];else break}return!1}}let tce=class{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(Dw))!==null&&n!==void 0?n:r.to,this.inner=new cT(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(Dw))!==null&&e!==void 0?e:n.to,this.inner=new cT(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(Se.mounted);if(o&&o.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}};function uT(t,e){let n=null,r=e;for(let i=1,s=0;i<t.length;i++){let o=t[i-1].to,a=t[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=a)break;l.to<=o||(n||(r=n=e.slice()),l.from<o?(n[s]=new yr(l.from,o),l.to>a&&n.splice(s+1,0,new yr(a,l.to))):l.to>a?n[s--]=new yr(a,l.to):n.splice(s--,1))}}return r}function nce(t,e,n,r){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:o?t[i].to:t[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let d=Math.max(l,n),f=Math.min(u,h,r);d<f&&c.push(new yr(d,f))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function hT(t,e){let n=[];for(let{pos:r,mount:i,frag:s}of t){let o=r+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(d=>new yr(d.from+r,d.to+r)),h=nce(e,u,l,c);for(let d=0,f=l;;d++){let p=d==h.length,g=p?c:h[d].from;if(g>f&&n.push(new Xi(f,g,i.tree,-o,s.from>=f||s.openStart,s.to<=g||s.openEnd)),p)break;f=h[d].to}}else n.push(new Xi(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return n}let rce=0;class Jn{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=rce++}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 Jn&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Jn(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new Xp(e);return r=>r.modified.indexOf(n)>-1?r:Xp.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let ice=0;class Xp{constructor(e){this.name=e,this.instances=[],this.id=ice++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&sce(n,a.modified));if(r)return r;let i=[],s=new Jn(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=oce(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(Xp.get(a,l));return s}}function sce(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function oce(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 Jl(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 s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let f=i[h++];if(h==i.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new nh(r,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return KL.add(e)}const KL=new Se({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 s=new nh(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class nh{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}}nh.empty=new nh([],2,null);function JL(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function ace(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function lce(t,e,n,r=0,i=t.length){let s=new cce(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class cce{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,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(f=>!f.scope||f.scope(o)));let c=i,u=uce(e)||nh.empty,h=ace(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(n,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Se.mounted);if(d&&d.overlay){let f=e.node.enter(d.overlay[0].from+a,1),p=this.highlighters.filter(b=>!b.scope||b.scope(d.tree.type)),g=e.firstChild();for(let b=0,m=a;;b++){let O=b<d.overlay.length?d.overlay[b]:null,w=O?O.from+a:l,k=Math.max(n,m),x=Math.min(r,w);if(k<x&&g)for(;e.from<x&&(this.highlightRange(e,k,x,i,s),this.startSpan(Math.min(x,e.to),c),!(e.to>=w||!e.nextSibling())););if(!O||w>r)break;m=O.to+a,m>n&&(this.highlightRange(f.cursor(),Math.max(n,O.from+a),Math.min(r,m),"",p),this.startSpan(Math.min(r,m),c))}g&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function uce(t){let e=t.type.prop(KL);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const ie=Jn.define,Zd=ie(),ms=ie(),dT=ie(ms),fT=ie(ms),Os=ie(),Fd=ie(Os),XO=ie(Os),si=ie(),ho=ie(si),ni=ie(),ri=ie(),zw=ie(),Ec=ie(zw),Xd=ie(),_={comment:Zd,lineComment:ie(Zd),blockComment:ie(Zd),docComment:ie(Zd),name:ms,variableName:ie(ms),typeName:dT,tagName:ie(dT),propertyName:fT,attributeName:ie(fT),className:ie(ms),labelName:ie(ms),namespace:ie(ms),macroName:ie(ms),literal:Os,string:Fd,docString:ie(Fd),character:ie(Fd),attributeValue:ie(Fd),number:XO,integer:ie(XO),float:ie(XO),bool:ie(Os),regexp:ie(Os),escape:ie(Os),color:ie(Os),url:ie(Os),keyword:ni,self:ie(ni),null:ie(ni),atom:ie(ni),unit:ie(ni),modifier:ie(ni),operatorKeyword:ie(ni),controlKeyword:ie(ni),definitionKeyword:ie(ni),moduleKeyword:ie(ni),operator:ri,derefOperator:ie(ri),arithmeticOperator:ie(ri),logicOperator:ie(ri),bitwiseOperator:ie(ri),compareOperator:ie(ri),updateOperator:ie(ri),definitionOperator:ie(ri),typeOperator:ie(ri),controlOperator:ie(ri),punctuation:zw,separator:ie(zw),bracket:Ec,angleBracket:ie(Ec),squareBracket:ie(Ec),paren:ie(Ec),brace:ie(Ec),content:si,heading:ho,heading1:ie(ho),heading2:ie(ho),heading3:ie(ho),heading4:ie(ho),heading5:ie(ho),heading6:ie(ho),contentSeparator:ie(si),list:ie(si),quote:ie(si),emphasis:ie(si),strong:ie(si),link:ie(si),monospace:ie(si),strikethrough:ie(si),inserted:ie(),deleted:ie(),changed:ie(),invalid:ie(),meta:Xd,documentMeta:ie(Xd),annotation:ie(Xd),processingInstruction:ie(Xd),definition:Jn.defineModifier("definition"),constant:Jn.defineModifier("constant"),function:Jn.defineModifier("function"),standard:Jn.defineModifier("standard"),local:Jn.defineModifier("local"),special:Jn.defineModifier("special")};for(let t in _){let e=_[t];e instanceof Jn&&(e.name=t)}JL([{tag:_.link,class:"tok-link"},{tag:_.heading,class:"tok-heading"},{tag:_.emphasis,class:"tok-emphasis"},{tag:_.strong,class:"tok-strong"},{tag:_.keyword,class:"tok-keyword"},{tag:_.atom,class:"tok-atom"},{tag:_.bool,class:"tok-bool"},{tag:_.url,class:"tok-url"},{tag:_.labelName,class:"tok-labelName"},{tag:_.inserted,class:"tok-inserted"},{tag:_.deleted,class:"tok-deleted"},{tag:_.literal,class:"tok-literal"},{tag:_.string,class:"tok-string"},{tag:_.number,class:"tok-number"},{tag:[_.regexp,_.escape,_.special(_.string)],class:"tok-string2"},{tag:_.variableName,class:"tok-variableName"},{tag:_.local(_.variableName),class:"tok-variableName tok-local"},{tag:_.definition(_.variableName),class:"tok-variableName tok-definition"},{tag:_.special(_.variableName),class:"tok-variableName2"},{tag:_.definition(_.propertyName),class:"tok-propertyName tok-definition"},{tag:_.typeName,class:"tok-typeName"},{tag:_.namespace,class:"tok-namespace"},{tag:_.className,class:"tok-className"},{tag:_.macroName,class:"tok-macroName"},{tag:_.propertyName,class:"tok-propertyName"},{tag:_.operator,class:"tok-operator"},{tag:_.comment,class:"tok-comment"},{tag:_.meta,class:"tok-meta"},{tag:_.invalid,class:"tok-invalid"},{tag:_.punctuation,class:"tok-punctuation"}]);var WO;const _o=new Se;function c0(t){return ae.define({combine:t?e=>e.concat(t):void 0})}const u0=new Se;class br{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Te.prototype.hasOwnProperty("tree")||Object.defineProperty(Te.prototype,"tree",{get(){return Je(this)}}),this.parser=n,this.extension=[Ks.of(this),Te.languageData.of((s,o,a)=>{let l=pT(s,o,a),c=l.type.prop(_o);if(!c)return[];let u=s.facet(c),h=l.type.prop(u0);if(h){let d=l.resolve(o-l.from,a);for(let f of h)if(f.test(d,s)){let p=s.facet(f.facet);return f.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return pT(e,n,r).type.prop(_o)==this.data}findRegions(e){let n=e.facet(Ks);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(_o)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(Se.mounted);if(a){if(a.tree.prop(_o)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof De&&i(c,s.positions[l]+o)}};return i(Je(e),0),r}get allowsNesting(){return!0}}br.setState=we.define();function pT(t,e,n){let r=t.facet(Ks),i=Je(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,je.ExcludeBuffers|je.EnterBracketed))s.type.isTop&&(i=s);return i}class Il extends br{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=c0(e.languageData);return new Il(n,e.parser.configure({props:[_o.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new Il(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Je(t){let e=t.field(br.state,!1);return e?e.tree:De.empty}class hce{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 _c=null;class rh{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new rh(e,n,[],De.empty,0,r,[],null)}startParse(){return this.parser.startParse(new hce(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=De.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(Xi.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(Xi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=_c;_c=this;try{return e()}finally{_c=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=gT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,d)=>l.push({fromA:c,toA:u,fromB:h,toB:d})),r=Xi.applyChanges(r,l),i=De.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new rh(this.parser,n,r,i,s,o,a,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:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=gT(this.fragments,i,s),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 l0{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=_c;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new De(Qt.none,[],[],o-s)},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 _c}}function gT(t,e,n){return Xi.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Rl{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 Rl(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=rh.create(e.facet(Ks).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Rl(r)}}br.state=Gt.define({create:Rl.init,update(t,e){for(let n of e.effects)if(n.is(br.setState))return n.value;return e.startState.facet(Ks)!=e.state.facet(Ks)?Rl.init(e.state):t.apply(e)}});let eD=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(eD=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const VO=typeof navigator<"u"&&(!((WO=navigator.scheduling)===null||WO===void 0)&&WO.isInputPending)?()=>navigator.scheduling.isInputPending():null,dce=kt.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(br.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(br.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=eD(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,s=r.field(br.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!VO?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>VO&&VO()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:br.setState.of(new Rl(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Mn(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()}}}),Ks=ae.define({combine(t){return t.length?t[0]:null},enables:t=>[br.state,dce,re.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class ih{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class Wp{constructor(e,n,r,i,s,o=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,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 Wp(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(s=>s==n))return i;if(r)for(let i of e)for(let s of i.alias){let o=n.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+s.length])))return i}return null}}const fce=ae.define(),ec=ae.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 Vp(t){let e=t.facet(ec);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function sh(t,e){let n="",r=t.tabSize,i=t.facet(ec)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function h0(t,e){t instanceof Te&&(t=new mm(t));for(let r of t.state.facet(fce)){let i=r(t,e);if(i!==void 0)return i}let n=Je(t.state);return n.length>=e?pce(t,n,e):null}class mm{constructor(e,n={}){this.state=e,this.options=n,this.unit=Vp(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&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),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return Hr(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Mh=new Se;function pce(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return tD(r,t,n)}function tD(t,e,n){for(let r=t;r;r=r.next){let i=mce(r.node);if(i)return i(d0.create(e,n,r))}return 0}function gce(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function mce(t){let e=t.type.prop(Mh);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Se.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>nD(o,!0,1,void 0,s&&!gce(o)?i.from:void 0)}return t.parent==null?Oce:null}function Oce(){return 0}class d0 extends mm{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 d0(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(yce(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tD(this.context.next,this.base,this.pos)}}function yce(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function bce(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function wce({closing:t,align:e=!0,units:n=1}){return r=>nD(r,e,n,t)}function nD(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=e?bce(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const Sce=t=>t.baseIndent;function Ef({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const kce=200;function vce(){return Te.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+kce)return t;let s=n.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=h0(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],f=sh(o,h);d!=f&&l.push({from:u.from,to:u.from+d.length,insert:f})}return l.length?[t,{changes:l,sequential:!0}]:t})}const rD=ae.define(),tc=new Se;function iD(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 xce(t,e,n){let r=Je(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(s&&a.from<e)break;let l=a.type.prop(tc);if(l&&(a.to<r.length-50||r.length==t.doc.length||!Cce(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(s=c)}}return s}function Cce(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Hp(t,e,n){for(let r of t.facet(rD)){let i=r(t,e,n);if(i)return i}return xce(t,e,n)}function sD(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 Om=we.define({map:sD}),Qh=we.define({map:sD});function oD(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 qo=Gt.define({create(){return pe.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=mT(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Om)&&!Ece(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(cD),i=r?pe.replace({widget:new Nce(r(e.state,n.value))}):OT;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(Qh)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=mT(t,e.selection.main.head)),t},provide:t=>re.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(OT.range(r,i))}return pe.set(e,!0)}});function mT(t,e,n=e){let r=!1;return t.between(e,n,(i,s)=>{i<n&&s>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,s)=>i>=n||s<=e}):t}function Yp(t,e,n){var r;let i=null;return(r=t.field(qo,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function Ece(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function aD(t,e){return t.field(qo,!1)?e:e.concat(we.appendConfig.of(uD()))}const _ce=t=>{for(let e of oD(t)){let n=Hp(t.state,e.from,e.to);if(n)return t.dispatch({effects:aD(t.state,[Om.of(n),lD(t,n)])}),!0}return!1},Tce=t=>{if(!t.state.field(qo,!1))return!1;let e=[];for(let n of oD(t)){let r=Yp(t.state,n.from,n.to);r&&e.push(Qh.of(r),lD(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lD(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return re.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const Ace=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=Hp(e,i.from,i.to);s&&n.push(Om.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:aD(t.state,n)}),!!n.length},Pce=t=>{let e=t.state.field(qo,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(Qh.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},Ice=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:_ce},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Tce},{key:"Ctrl-Alt-[",run:Ace},{key:"Ctrl-Alt-]",run:Pce}],Rce={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},cD=ae.define({combine(t){return Ti(t,Rce)}});function uD(t){return[qo,Qce]}function hD(t,e){let{state:n}=t,r=n.facet(cD),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=Yp(t.state,a.from,a.to);l&&t.dispatch({effects:Qh.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const OT=pe.replace({widget:new class extends qr{toDOM(t){return hD(t,null)}}});class Nce extends qr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return hD(e,this.value)}}const $ce={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class HO extends ts{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 Mce(t={}){let e={...$ce,...t},n=new HO(e,!0),r=new HO(e,!1),i=kt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ks)!=o.state.facet(Ks)||o.startState.field(qo,!1)!=o.state.field(qo,!1)||Je(o.startState)!=Je(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Ji;for(let l of o.viewportLineBlocks){let c=Yp(o.state,l.from,l.to)?r:Hp(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,Nle({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Ce.empty},initialSpacer(){return new HO(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=Yp(o.state,a.from,a.to);if(c)return o.dispatch({effects:Qh.of(c)}),!0;let u=Hp(o.state,a.from,a.to);return u?(o.dispatch({effects:Om.of(u)}),!0):!1}}}),uD()]}const Qce=re.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 Lh{constructor(e,n){this.specs=e;let r;function i(a){let l=Hs.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof br?a=>a.prop(_o)==o.data:o?a=>a==o:void 0,this.style=JL(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new Hs(r):null,this.themeType=n.themeType}static define(e,n){return new Lh(e,n||{})}}const jw=ae.define(),dD=ae.define({combine(t){return t.length?[t[0]]:null}});function YO(t){let e=t.facet(jw);return e.length?e:t.facet(dD)}function fD(t,e){let n=[Dce],r;return t instanceof Lh&&(t.module&&n.push(re.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(dD.of(t)):r?n.push(jw.computeN([re.darkTheme],i=>i.facet(re.darkTheme)==(r=="dark")?[t]:[])):n.push(jw.of(t)),n}class Lce{constructor(e){this.markCache=Object.create(null),this.tree=Je(e.state),this.decorations=this.buildDeco(e,YO(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Je(e.state),r=YO(e.state),i=r!=YO(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return pe.none;let r=new Ji;for(let{from:i,to:s}of e.visibleRanges)lce(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=pe.mark({class:l})))},i,s);return r.finish()}}const Dce=os.high(kt.fromClass(Lce,{decorations:t=>t.decorations})),zce=Lh.define([{tag:_.meta,color:"#404740"},{tag:_.link,textDecoration:"underline"},{tag:_.heading,textDecoration:"underline",fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strong,fontWeight:"bold"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.keyword,color:"#708"},{tag:[_.atom,_.bool,_.url,_.contentSeparator,_.labelName],color:"#219"},{tag:[_.literal,_.inserted],color:"#164"},{tag:[_.string,_.deleted],color:"#a11"},{tag:[_.regexp,_.escape,_.special(_.string)],color:"#e40"},{tag:_.definition(_.variableName),color:"#00f"},{tag:_.local(_.variableName),color:"#30a"},{tag:[_.typeName,_.namespace],color:"#085"},{tag:_.className,color:"#167"},{tag:[_.special(_.variableName),_.macroName],color:"#256"},{tag:_.definition(_.propertyName),color:"#00c"},{tag:_.comment,color:"#940"},{tag:_.invalid,color:"#f00"}]),jce=re.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),pD=1e4,gD="()[]{}",mD=ae.define({combine(t){return Ti(t,{afterCursor:!0,brackets:gD,maxScanDistance:pD,renderMatch:Zce})}}),Bce=pe.mark({class:"cm-matchingBracket"}),Uce=pe.mark({class:"cm-nonmatchingBracket"});function Zce(t){let e=[],n=t.matched?Bce:Uce;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 yT(t){let e=[],n=t.facet(mD);for(let r of t.selection.ranges){if(!r.empty)continue;let i=Oi(t,r.head,-1,n)||r.head>0&&Oi(t,r.head-1,1,n)||n.afterCursor&&(Oi(t,r.head,1,n)||r.head<t.doc.length&&Oi(t,r.head+1,-1,n));i&&(e=e.concat(n.renderMatch(i,t)))}return pe.set(e,!0)}const Fce=kt.fromClass(class{constructor(t){this.paused=!1,this.decorations=yT(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=yT(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),Xce=[Fce,jce];function Wce(t={}){return[mD.of(t),Xce]}const OD=new Se;function Bw(t,e,n){let r=t.prop(e<0?Se.openedBy:Se.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 Uw(t){let e=t.type.prop(OD);return e?e(t.node):t}function Oi(t,e,n,r={}){let i=r.maxScanDistance||pD,s=r.brackets||gD,o=Je(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=Bw(l.type,n,s);if(c&&l.from<l.to){let u=Uw(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return Vce(t,e,n,l,u,c,s)}}return Hce(t,e,n,o,a.type,i,s)}function Vce(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,u=a==null?void 0:a.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&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Uw(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Bw(u.type,n,o))c++;else if(Bw(u.type,-n,o)){if(c==0){let h=Uw(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function Hce(t,e,n,r,i,s,o){if(n<0?!e:e==t.doc.length)return null;let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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),h=0;for(let d=0;!u.next().done&&d<=s;){let f=u.value;n<0&&(d+=f.length);let p=e+d*n;for(let g=n>0?0:f.length-1,b=n>0?f.length:-1;g!=b;g+=n){let m=o.indexOf(f[g]);if(!(m<0||r.resolveInner(p+g,1).type!=i))if(m%2==0==n>0)h++;else{if(h==1)return{start:c,end:{from:p+g,to:p+g+1},matched:m>>1==l>>1};h--}}n>0&&(d+=f.length)}return u.done?{start:c,matched:!1}:null}const Yce=Object.create(null),bT=[Qt.none],wT=[],ST=Object.create(null),qce=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"]])qce[t]=Gce(Yce,e);function qO(t,e){wT.indexOf(t)>-1||(wT.push(t),console.warn(e))}function Gce(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||_[c];u?typeof u=="function"?l.length?l=l.map(u):qO(c,`Modifier ${c} used at start of tag`):l.length?qO(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:qO(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=ST[i];if(s)return s.id;let o=ST[i]=Qt.define({id:bT.length,name:r,props:[Jl({[r]:n})]});return bT.push(o),o.id}Ge.RTL,Ge.LTR;const Kce=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=p0(t.state,n.from);return r.line?Jce(t):r.block?tue(t):!1};function f0(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 Jce=f0(iue,0),eue=f0(yD,0),tue=f0((t,e)=>yD(t,e,rue(e)),0);function p0(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Tc=50;function nue(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Tc,r),o=t.sliceDoc(i,i+Tc),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,h;i-r<=2*Tc?u=h=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+Tc),h=t.sliceDoc(i-Tc,i));let d=/^\s*/.exec(u)[0].length,f=/\s*$/.exec(h)[0].length,p=h.length-f-n.length;return u.slice(d,d+e.length)==e&&h.slice(p,p+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-f-n.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function rue(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 s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function yD(t,e,n=e.selection.ranges){let r=n.map(s=>p0(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>nue(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function iue(t,e,n=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of n){let a=r.length,l=1e9,c;for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(c==null&&(c=p0(e,h.from).line,!c))continue e;if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,f=d==h.length,p=h.text.slice(d,d+c.length)==c?d:-1;d<h.text.length&&d<l&&(l=d),r.push({line:h,comment:p,token:c,indent:d,empty:f,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of r)(h||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const Zw=_i.define(),sue=_i.define(),oue=ae.define(),bD=ae.define({combine(t){return Ti(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)})}}),wD=Gt.define({create(){return yi.empty},update(t,e){let n=e.state.facet(bD),r=e.annotation(Zw);if(r){let l=Qn.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=qp(u,u.length,n.minDepth,l):u=vD(u,e.startState.selection),new yi(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(sue);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Pt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=Qn.fromTransaction(e),o=e.annotation(Pt.time),a=e.annotation(Pt.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 yi(t.done.map(Qn.fromJSON),t.undone.map(Qn.fromJSON))}});function aue(t={}){return[wD,bD.of(t),re.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?SD:e.inputType=="historyRedo"?Fw:null;return r?(e.preventDefault(),r(n)):!1}})]}function ym(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(wD,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const SD=ym(0,!1),Fw=ym(1,!1),lue=ym(0,!0),cue=ym(1,!0);class Qn{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new Qn(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 Qn(e.changes&&Nt.fromJSON(e.changes),[],e.mapped&&ki.fromJSON(e.mapped),e.startSelection&&B.fromJSON(e.startSelection),e.selectionsAfter.map(B.fromJSON))}static fromTransaction(e,n){let r=wr;for(let i of e.startState.facet(oue)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Qn(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,wr)}static selection(e){return new Qn(void 0,wr,void 0,void 0,e)}}function qp(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function uue(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function hue(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function kD(t,e){return t.length?e.length?t.concat(e):t:e}const wr=[],due=200;function vD(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-due));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),qp(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Qn.selection([e])]}function fue(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 GO(t,e){if(!t.length)return t;let n=t.length,r=wr;for(;n;){let i=pue(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[Qn.selection(r)]:wr}function pue(t,e,n){let r=kD(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):wr,n);if(!t.changes)return Qn.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Qn(i,we.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const gue=/^(input\.type|delete)($|\.)/;class yi{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 yi(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||gue.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,uue(a.changes,e.changes))||r=="input.type.compose")?o=qp(o,o.length-1,i.minDepth,new Qn(e.changes.compose(a.changes),kD(we.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,wr)):o=qp(o,o.length,i.minDepth,e),new yi(o,wr,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:wr;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&hue(s[s.length-1],e)?this:new yi(vD(this.done,e),this.undone,n,r)}addMapping(e){return new yi(GO(this.done,e),GO(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 s=i[i.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):n.selection);if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Zw.of({side:e,rest:fue(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?wr:i.slice(0,i.length-1);return s.mapped&&(a=GO(a,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Zw.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}yi.empty=new yi(wr,wr);const mue=[{key:"Mod-z",run:SD,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Fw,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Fw,preventDefault:!0},{key:"Mod-u",run:lue,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:cue,preventDefault:!0}];function nc(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function Gr(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Kr({state:t,dispatch:e},n){let r=nc(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Gr(t,r)),!0)}function bm(t,e){return B.cursor(e?t.to:t.from)}function xD(t,e){return Kr(t,n=>n.empty?t.moveByChar(n,e):bm(n,e))}function cn(t){return t.textDirectionAt(t.state.selection.main.head)==Ge.LTR}const CD=t=>xD(t,!cn(t)),ED=t=>xD(t,cn(t));function _D(t,e){return Kr(t,n=>n.empty?t.moveByGroup(n,e):bm(n,e))}const Oue=t=>_D(t,!cn(t)),yue=t=>_D(t,cn(t));function bue(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 wm(t,e,n){let r=Je(t).resolveInner(e.head),i=n?Se.closedBy:Se.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;bue(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=n?Oi(t,r.from,1):Oi(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,B.cursor(a,n?-1:1)}const wue=t=>Kr(t,e=>wm(t.state,e,!cn(t))),Sue=t=>Kr(t,e=>wm(t.state,e,cn(t)));function TD(t,e){return Kr(t,n=>{if(!n.empty)return bm(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const AD=t=>TD(t,!1),PD=t=>TD(t,!0);function ID(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(re.scrollMargins)){let o=s(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.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 RD(t,e){let n=ID(t),{state:r}=t,i=nc(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):bm(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(s=re.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(Gr(r,i),{effects:s}),!0}const kT=t=>RD(t,!1),Xw=t=>RD(t,!0);function ao(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 s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=B.cursor(r.from+s))}return i}const kue=t=>Kr(t,e=>ao(t,e,!0)),vue=t=>Kr(t,e=>ao(t,e,!1)),xue=t=>Kr(t,e=>ao(t,e,!cn(t))),Cue=t=>Kr(t,e=>ao(t,e,cn(t))),Eue=t=>Kr(t,e=>B.cursor(t.lineBlockAt(e.head).from,1)),_ue=t=>Kr(t,e=>B.cursor(t.lineBlockAt(e.head).to,-1));function Tue(t,e,n){let r=!1,i=nc(t.selection,s=>{let o=Oi(t,s.head,-1)||Oi(t,s.head,1)||s.head>0&&Oi(t,s.head-1,1)||s.head<t.doc.length&&Oi(t,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return B.cursor(a)});return r?(e(Gr(t,i)),!0):!1}const Aue=({state:t,dispatch:e})=>Tue(t,e);function _r(t,e){let n=nc(t.state.selection,r=>{let i=e(r);return B.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return n.eq(t.state.selection)?!1:(t.dispatch(Gr(t.state,n)),!0)}function ND(t,e){return _r(t,n=>t.moveByChar(n,e))}const $D=t=>ND(t,!cn(t)),MD=t=>ND(t,cn(t));function QD(t,e){return _r(t,n=>t.moveByGroup(n,e))}const Pue=t=>QD(t,!cn(t)),Iue=t=>QD(t,cn(t)),Rue=t=>_r(t,e=>wm(t.state,e,!cn(t))),Nue=t=>_r(t,e=>wm(t.state,e,cn(t)));function LD(t,e){return _r(t,n=>t.moveVertically(n,e))}const DD=t=>LD(t,!1),zD=t=>LD(t,!0);function jD(t,e){return _r(t,n=>t.moveVertically(n,e,ID(t).height))}const vT=t=>jD(t,!1),xT=t=>jD(t,!0),$ue=t=>_r(t,e=>ao(t,e,!0)),Mue=t=>_r(t,e=>ao(t,e,!1)),Que=t=>_r(t,e=>ao(t,e,!cn(t))),Lue=t=>_r(t,e=>ao(t,e,cn(t))),Due=t=>_r(t,e=>B.cursor(t.lineBlockAt(e.head).from)),zue=t=>_r(t,e=>B.cursor(t.lineBlockAt(e.head).to)),CT=({state:t,dispatch:e})=>(e(Gr(t,{anchor:0})),!0),ET=({state:t,dispatch:e})=>(e(Gr(t,{anchor:t.doc.length})),!0),_T=({state:t,dispatch:e})=>(e(Gr(t,{anchor:t.selection.main.anchor,head:0})),!0),TT=({state:t,dispatch:e})=>(e(Gr(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),jue=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Bue=({state:t,dispatch:e})=>{let n=Sm(t).map(({from:r,to:i})=>B.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:B.create(n),userEvent:"select"})),!0},Uue=({state:t,dispatch:e})=>{let n=nc(t.selection,r=>{let i=Je(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return B.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(Gr(t,n)),!0)};function BD(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=s;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(t.dispatch(Gr(n,B.create(i,i.length-1))),!0)}const Zue=t=>BD(t,!1),Fue=t=>BD(t,!0),Xue=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=B.create([n.main]):n.main.empty||(r=B.create([B.cursor(n.main.head)])),r?(e(Gr(t,r)),!0):!1};function Dh(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(n="delete.backward",l=Wd(t,l,!1)):l>o&&(n="delete.forward",l=Wd(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Wd(t,o,!1),a=Wd(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:B.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?re.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Wd(t,e,n){if(t instanceof re)for(let r of t.state.facet(re.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const UD=(t,e,n)=>Dh(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let c=Hr(a,s.tabSize),u=c%Vp(s)||Vp(s);for(let h=0;h<u&&a[a.length-1-h]==" ";h++)i--;l=i}else l=Bt(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=Bt(o.text,l-o.from,!1,!1)+o.from);return l}),Ww=t=>UD(t,!1,!0),ZD=t=>UD(t,!0,!1),FD=(t,e)=>Dh(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=Bt(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),XD=t=>FD(t,!1),Wue=t=>FD(t,!0),Vue=t=>Dh(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Hue=t=>Dh(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Yue=t=>Dh(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),que=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Re.of(["",""])},range:B.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Gue=({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,s=t.doc.lineAt(i),o=i==s.from?i-1:Bt(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Bt(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:B.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Sm(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function WD(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Sm(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(B.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(B.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:B.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Kue=({state:t,dispatch:e})=>WD(t,e,!1),Jue=({state:t,dispatch:e})=>WD(t,e,!0);function VD(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of Sm(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.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 ehe=({state:t,dispatch:e})=>VD(t,e,!1),the=({state:t,dispatch:e})=>VD(t,e,!0),nhe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Sm(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=nc(e.selection,i=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function rhe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Je(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Se.closedBy))&&s.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 AT=HD(!1),ihe=HD(!0);function HD(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&rhe(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new mm(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=h0(c,s);for(u==null&&(u=Hr(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let h=["",sh(e,u)];return l&&h.push(sh(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Re.of(h)},range:B.cursor(s+1+h[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function g0(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:B.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const she=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new mm(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=g0(t,(s,o,a)=>{let l=h0(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=sh(t,l);(c!=u||a.from<s.from+c.length)&&(n[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},YD=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(g0(t,(n,r)=>{r.push({from:n.from,insert:t.facet(ec)})}),{userEvent:"input.indent"})),!0),qD=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(g0(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Hr(i,t.tabSize),o=0,a=sh(t,Math.max(0,s-Vp(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),ohe=t=>(t.setTabFocusMode(),!0),ahe=[{key:"Ctrl-b",run:CD,shift:$D,preventDefault:!0},{key:"Ctrl-f",run:ED,shift:MD},{key:"Ctrl-p",run:AD,shift:DD},{key:"Ctrl-n",run:PD,shift:zD},{key:"Ctrl-a",run:Eue,shift:Due},{key:"Ctrl-e",run:_ue,shift:zue},{key:"Ctrl-d",run:ZD},{key:"Ctrl-h",run:Ww},{key:"Ctrl-k",run:Vue},{key:"Ctrl-Alt-h",run:XD},{key:"Ctrl-o",run:que},{key:"Ctrl-t",run:Gue},{key:"Ctrl-v",run:Xw}],lhe=[{key:"ArrowLeft",run:CD,shift:$D,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Oue,shift:Pue,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xue,shift:Que,preventDefault:!0},{key:"ArrowRight",run:ED,shift:MD,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yue,shift:Iue,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Cue,shift:Lue,preventDefault:!0},{key:"ArrowUp",run:AD,shift:DD,preventDefault:!0},{mac:"Cmd-ArrowUp",run:CT,shift:_T},{mac:"Ctrl-ArrowUp",run:kT,shift:vT},{key:"ArrowDown",run:PD,shift:zD,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ET,shift:TT},{mac:"Ctrl-ArrowDown",run:Xw,shift:xT},{key:"PageUp",run:kT,shift:vT},{key:"PageDown",run:Xw,shift:xT},{key:"Home",run:vue,shift:Mue,preventDefault:!0},{key:"Mod-Home",run:CT,shift:_T},{key:"End",run:kue,shift:$ue,preventDefault:!0},{key:"Mod-End",run:ET,shift:TT},{key:"Enter",run:AT,shift:AT},{key:"Mod-a",run:jue},{key:"Backspace",run:Ww,shift:Ww,preventDefault:!0},{key:"Delete",run:ZD,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XD,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Wue,preventDefault:!0},{mac:"Mod-Backspace",run:Hue,preventDefault:!0},{mac:"Mod-Delete",run:Yue,preventDefault:!0}].concat(ahe.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),che=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wue,shift:Rue},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Sue,shift:Nue},{key:"Alt-ArrowUp",run:Kue},{key:"Shift-Alt-ArrowUp",run:ehe},{key:"Alt-ArrowDown",run:Jue},{key:"Shift-Alt-ArrowDown",run:the},{key:"Mod-Alt-ArrowUp",run:Zue},{key:"Mod-Alt-ArrowDown",run:Fue},{key:"Escape",run:Xue},{key:"Mod-Enter",run:ihe},{key:"Alt-l",mac:"Ctrl-l",run:Bue},{key:"Mod-i",run:Uue,preventDefault:!0},{key:"Mod-[",run:qD},{key:"Mod-]",run:YD},{key:"Mod-Alt-\\",run:she},{key:"Shift-Mod-k",run:nhe},{key:"Shift-Mod-\\",run:Aue},{key:"Mod-/",run:Kce},{key:"Alt-A",run:eue},{key:"Ctrl-m",mac:"Shift-Alt-m",run:ohe}].concat(lhe),uhe={key:"Tab",run:YD,shift:qD},PT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Nl{constructor(e,n,r=0,i=e.length,s,o){this.test=o,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=s?a=>s(PT(a)):PT,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 In(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=jv(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=di(e);let i=this.normalize(n);if(i.length)for(let s=0,o=r,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<n.length&&n.charCodeAt(s)==l?o++:a=!1}}}match(e,n,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:n,to:i,precise:r&&s}:this.matches.push({from:n,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Nl.prototype[Symbol.iterator]=function(){return this});const GD={from:-1,to:-1,match:/.*/.exec(""),precise:!0},m0="gm"+(/x/.unicode==null?"":"u");class KD{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=GD,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new JD(e,n,r,i,s);this.re=new RegExp(n,m0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=Gp(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=Gp(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 KO=new WeakMap;class al{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=KO.get(e);if(!i||i.from>=r||i.to<=n){let a=new al(n,e.sliceString(n,r));return KO.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),KO.set(e,new al(o,s)),new al(n,s.slice(n-o,r-o))}}class JD{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=GD,this.matchPos=Gp(e,i),this.re=new RegExp(n,m0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=al.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=Gp(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=al.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(KD.prototype[Symbol.iterator]=JD.prototype[Symbol.iterator]=function(){return this});function hhe(t){try{return new RegExp(t,m0),!0}catch{return!1}}function Gp(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 dhe=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:i}=Ale(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return i.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,h]=o,d=u?+u.slice(1):0,f=c?+c:a.number;if(c&&h){let b=f/100;l&&(b=b*(l=="-"?-1:1)+a.number/e.doc.lines),f=Math.round(e.doc.lines*b)}else c&&l&&(f=f*(l=="-"?-1:1)+a.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,f))),g=B.cursor(p.from+Math.max(0,Math.min(d,p.length)));t.dispatch({effects:[r,re.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},fhe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},phe=ae.define({combine(t){return Ti(t,fhe,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function ghe(t){return[whe,bhe]}const mhe=pe.mark({class:"cm-selectionMatch"}),Ohe=pe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function IT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=lt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=lt.Word)}function yhe(t,e,n,r){return t(e.sliceDoc(n,n+1))==lt.Word&&t(e.sliceDoc(r-1,r))==lt.Word}const bhe=kt.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(phe),{state:n}=t,r=n.selection;if(r.ranges.length>1)return pe.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return pe.none;let l=n.wordAt(i.head);if(!l)return pe.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return pe.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(IT(o,n,i.from,i.to)&&yhe(o,n,i.from,i.to)))return pe.none}else if(s=n.sliceDoc(i.from,i.to),!s)return pe.none}let a=[];for(let l of t.visibleRanges){let c=new Nl(n.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||IT(o,n,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(Ohe.range(u,h)):(u>=i.to||h<=i.from)&&a.push(mhe.range(u,h)),a.length>e.maxMatches))return pe.none}}return pe.set(a)}},{decorations:t=>t.decorations}),whe=re.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),She=({state:t,dispatch:e})=>{let{selection:n}=t,r=B.create(n.ranges.map(i=>t.wordAt(i.head)||B.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function khe(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new Nl(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Nl(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const vhe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return She({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=khe(t,r);return i?(e(t.update({selection:t.selection.addRange(B.range(i.from,i.to),!1),effects:re.scrollIntoView(i.to)})),!0):!1},rc=ae.define({combine(t){return Ti(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Lhe(e),scrollToMatch:e=>re.scrollIntoView(e)})}});class e2{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||hhe(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"?`
|
|
200
|
+
--\u2028\u2029\uFEFF-]`,$w),Jae={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 jO=null;function ele(){var t;if(jO==null&&typeof document<"u"&&document.body){let e=document.body.style;jO=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return jO||!1}const vf=ae.define({combine(t){let e=Ti(t,{render:null,specialChars:Kae,addSpecialChars:null});return(e.replaceTabs=!ele())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,$w)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,$w)),e}});function tle(t={}){return[vf.of(t),nle()]}let V_=null;function nle(){return V_||(V_=kt.fromClass(class{constructor(t){this.view=t,this.decorations=pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(vf)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Gae({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=In(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=Hr(o.text,a,r-o.from);return pe.replace({widget:new ole((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=pe.replace({widget:new sle(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(vf);t.startState.facet(vf)!=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 rle="•";function ile(t){return t>=32?rle:t==10?"":String.fromCharCode(9216+t)}class sle extends qr{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=ile(this.code),r=e.state.phrase("Control character")+" "+(Jae[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class ole extends qr{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 ale(){return cle}const lle=pe.line({class:"cm-activeLine"}),cle=kt.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(lle.range(i.from)),e=i.from)}return pe.set(n)}},{decorations:t=>t.decorations});class ule extends qr{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?au(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Ku(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function hle(t){let e=kt.fromClass(class{constructor(n){this.view=n,this.placeholder=t?pe.set([pe.widget({widget:new ule(t),side:1}).range(0)]):pe.none}get decorations(){return this.view.state.doc.length?pe.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,re.contentAttributes.of({"aria-placeholder":t})]:e}const Mw=2e3;function dle(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>Mw||n.off>Mw||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(B.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),u=pw(c.text,o,t.tabSize,!0);if(u<0)s.push(B.cursor(c.to));else{let h=pw(c.text,a,t.tabSize);s.push(B.range(c.from+u,c.from+h))}}}return s}function fle(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function H_(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>Mw?-1:i==r.length?fle(t,e.clientX):Hr(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function ple(t,e){let n=H_(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=H_(t,i);if(!a)return r;let l=dle(t.state,n,a);return l.length?o?B.create(l.concat(r.ranges)):B.create(l):r}}:null}function gle(t){let e=n=>n.altKey&&n.button==0;return re.mouseSelectionStyle.of((n,r)=>e(r)?ple(n,r):null)}const mle={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},Ole={style:"cursor: crosshair"};function yle(t={}){let[e,n]=mle[t.key||"Alt"],r=kt.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,re.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?Ole:null})]}const zd="-10000px";class DL{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(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function ble(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const BO=ae.define({combine:t=>{var e,n,r;return{position:le.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)||ble}}}),Y_=new WeakMap,n0=kt.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(BO);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 DL(t,r0,(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(BO);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=zd,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:s}=this.manager.tooltipViews[0];if(le.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Kv(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((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(BO).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=t.pos[a],d=t.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){u.style.top=zd;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,b=(e=Y_.get(c))!==null&&e!==void 0?e:d.bottom-d.top,m=c.offset||Sle,O=this.view.textDirection==Ge.LTR,w=d.width>r.right-r.left?O?r.left:r.right-d.width:O?Math.max(r.left,Math.min(h.left-(f?14:0)+m.x,r.right-g)):Math.min(Math.max(r.left,h.left-g+(f?14:0)-m.x),r.right-g),k=this.above[a];!l.strictSide&&(k?h.top-b-p-m.y<r.top:h.bottom+b+p+m.y>r.bottom)&&k==r.bottom-h.bottom>h.top-r.top&&(k=this.above[a]=!k);let x=(k?h.top-r.top:r.bottom-h.bottom)-p;if(x<b&&c.resize!==!1){if(x<this.view.defaultLineHeight){u.style.top=zd;continue}Y_.set(c,b),u.style.height=(b=x)/s+"px"}else u.style.height&&(u.style.height="");let S=k?h.top-b-p-m.y:h.bottom+p+m.y,T=w+g;if(c.overlap!==!0)for(let P of o)P.left<T&&P.right>w&&P.top<S+b&&P.bottom>S&&(S=k?P.top-b-2-p:P.bottom+p+2);if(this.position=="absolute"?(u.style.top=(S-t.parent.top)/s+"px",q_(u,(w-t.parent.left)/i)):(u.style.top=S/s+"px",q_(u,w/i)),f){let P=h.left+(O?m.x:-m.x)-(w+14-7);f.style.left=P/i+"px"}c.overlap!==!0&&o.push({left:w,top:S,right:T,bottom:S+b}),u.classList.toggle("cm-tooltip-above",k),u.classList.toggle("cm-tooltip-below",!k),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=zd}},{eventObservers:{scroll(){this.maybeMeasure()}}});function q_(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const wle=re.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:`${7*2}px`,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"}}}),Sle={x:0,y:0},r0=ae.define({enables:[n0,wle]}),Zp=ae.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class gm{static create(e){return new gm(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new DL(e,Zp,(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 kle=r0.compute([Zp],t=>{let e=t.facet(Zp);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:gm.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),zL=ae.define();class vle{constructor(e,n,r,i,s,o){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,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,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let o=e.coordsAtPos(i);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-e.defaultCharacterWidth||n.x>o.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),l=a&&a.dir==Ge.RTL?-1:1;s=n.x<o.left?-l:l}this.activateHover(e,i,s)}activateHover(e,n,r,i){let s=this.source(e,n,r),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let l=Array.isArray(a)?a:[a];i&&this.locked.set(l,i),e.dispatch({effects:this.setHover.of(l)})}};if(s&&"then"in s){let a=this.pending={pos:n};s.then(l=>{this.pending==a&&(this.pending=null,o(l))},l=>Mn(e.state,l,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(n0),n=e?e.manager.tooltips.findIndex(r=>r.create==gm.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:s}=this;if(i.length&&!this.locked.has(i)&&s&&!xle(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!Cle(this.view,o,a,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 jd=4;function xle(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=n-jd&&e.clientX<=r+jd&&e.clientY>=i-jd&&e.clientY<=s+jd}function Cle(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function Ele(t,e={}){let n=we.define(),r=new WeakMap,i=Gt.define({create(){return[]},update(o,a){let l=r.get(o);if(o.length&&(e.hideOnChange&&(a.docChanged||a.selection)?o=[]:l&&l(a)?o=[]:e.hideOn&&(o=o.filter(c=>!e.hideOn(a,c)))),a.docChanged&&o.length){let c=[];for(let u of o){let h=a.changes.mapPos(u.pos,-1,Vt.TrackDel);if(h!=null){let d=Object.assign(Object.create(null),u);d.pos=h,d.end!=null&&(d.end=a.changes.mapPos(d.end)),c.push(d)}}o=c}for(let c of a.effects)c.is(n)&&(o=c.value,l=void 0),(c.is(Tle)&&!c.value||c.value==i)&&(o=[]);return o.length&&l&&r.set(o,l),o},provide:o=>Zp.from(o)});const s=kt.define(o=>new vle(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,zL.of(s),kle]}}function _le(t,e,n,r={}){var i;let s=t.state.facet(zL).map(o=>t.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=s.find(a=>a.field==r.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(t,e,n,(i=r.until)!==null&&i!==void 0?i:()=>!1)}function jL(t,e){let n=t.plugin(n0);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Tle=we.define(),G_=ae.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 i0(t,e){let n=t.plugin(BL),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const BL=kt.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(G_);this.top=new Bd(t,!0,e.topContainer),this.bottom=new Bd(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(G_);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Bd(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Bd(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(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?s:o).push(u)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>re.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Bd{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",this.dom.style[this.top?"top":"bottom"]="0";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=K_(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=K_(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 K_(t){let e=t.nextSibling;return t.remove(),e}const eh=ae.define({enables:BL});function Ale(t,e){let n,r=new Promise(o=>n=o),i=o=>Ple(o,e,n);t.state.field(UO,!1)?t.dispatch({effects:UL.of(i)}):t.dispatch({effects:we.appendConfig.of(UO.init(()=>[i]))});let s=ZL.of(i);return{close:s,result:r.then(o=>((t.win.queueMicrotask||(l=>t.win.setTimeout(l,10)))(()=>{t.state.field(UO).indexOf(i)>-1&&t.dispatch({effects:s})}),o))}}const UO=Gt.define({create(){return[]},update(t,e){for(let n of e.effects)n.is(UL)?t=[n.value].concat(t):n.is(ZL)&&(t=t.filter(r=>r!=n.value));return t},provide:t=>eh.computeN([t],e=>e.field(t))}),UL=we.define(),ZL=we.define();function Ple(t,e,n){let r=e.content?e.content(t,()=>o(null)):null;if(!r){if(r=Ve("form"),e.input){let a=Ve("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(Ve("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(Ve("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<i.length;a++){let l=i[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let s=Ve("div",r,Ve("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(a){s.contains(s.ownerDocument.activeElement)&&t.focus(),n(a)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class ts extends Vs{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ts.prototype.elementClass="";ts.prototype.toDOM=void 0;ts.prototype.mapMode=Vt.TrackBefore;ts.prototype.startSide=ts.prototype.endSide=-1;ts.prototype.point=!0;const xf=ae.define(),Ile=ae.define(),Rle={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ce.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},uu=ae.define();function Nle(t){return[FL(),uu.of({...Rle,...t})]}const J_=ae.define({combine:t=>t.some(e=>e)});function FL(t){return[$le]}const $le=kt.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(uu).map(e=>new tT(t,e)),this.fixed=!t.state.facet(J_);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(J_)!=!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=Ce.iter(this.view.state.facet(xf),this.view.viewport.from),r=[],i=this.gutters.map(s=>new Mle(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Yt.Text&&o){Qw(n,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Yt.Text){Qw(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(uu),n=t.state.facet(uu),r=t.docChanged||t.heightChanged||t.viewportChanged||!Ce.eq(t.startState.facet(xf),t.state.facet(xf),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 s of n){let o=e.indexOf(s);o<0?i.push(new tT(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.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=>re.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==Ge.LTR?{left:r,right:i}:{right:r,left:i}})});function eT(t){return Array.isArray(t)?t:[t]}function Qw(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Mle{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Ce.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new XL(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];Qw(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.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 s of e.state.facet(Ile)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}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 tT{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 s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=eT(n.markers(e)),n.initialSpacer&&(this.spacer=new XL(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=eT(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!Ce.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 XL{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":""),Qle(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<n.length?n[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Qle(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 Lle=ae.define(),Dle=ae.define(),Da=ae.define({combine(t){return Ti(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class ZO extends ts{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function FO(t,e){return t.state.facet(Da).formatNumber(e,t.state)}const zle=uu.compute([Da],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Lle)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new ZO(FO(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(Dle)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Da)!=e.state.facet(Da),initialSpacer(e){return new ZO(FO(e,nT(e.state.doc.lines)))},updateSpacer(e,n){let r=FO(n.view,nT(n.view.state.doc.lines));return r==e.number?e:new ZO(r)},domEventHandlers:t.facet(Da).domEventHandlers,side:"before"}));function jle(t={}){return[Da.of(t),FL(),zle]}function nT(t){let e=9;for(;e<t;)e=e*10+9;return e}const Ble=new class extends ts{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Ule=xf.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(Ble.range(i)))}return Ce.of(e)});function Zle(){return Ule}const WL=1024;let Fle=0;class yr{constructor(e,n){this.from=e,this.to=n}}class Se{constructor(e={}){this.id=Fle++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Qt.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Se.closedBy=new Se({deserialize:t=>t.split(" ")});Se.openedBy=new Se({deserialize:t=>t.split(" ")});Se.group=new Se({deserialize:t=>t.split(" ")});Se.isolate=new Se({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Se.contextHash=new Se({perNode:!0});Se.lookAhead=new Se({perNode:!0});Se.mounted=new Se({perNode:!0});class ol{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[Se.mounted.id]}}const Xle=Object.create(null);class Qt{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):Xle,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Qt(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Se.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Se.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Qt.none=new Qt("",Object.create(null),0,8);class $h{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}n.push(i?new Qt(r.name,i,r.id,r.flags):r)}return new $h(n)}}const Ud=new WeakMap,rT=new WeakMap;var je;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(je||(je={}));class De{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=ol.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Fp(this.topNode,e)}cursorAt(e,n=0,r=0){let i=Ud.get(this)||this.topNode,s=new Fp(i);return s.moveTo(e,n),Ud.set(this,s._tree),s}get topNode(){return new on(this,0,0,null)}resolve(e,n=0){let r=th(Ud.get(this)||this.topNode,e,n,!1);return Ud.set(this,r),r}resolveInner(e,n=0){let r=th(rT.get(this)||this.topNode,e,n,!0);return rT.set(this,r),r}resolveStack(e,n=0){return Hle(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&je.IncludeAnonymous)>0;for(let l=this.cursor(o|je.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:a0(Qt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new De(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new De(Qt.none,n,r,i)))}static build(e){return Yle(e)}}De.empty=new De(Qt.none,[],[],0);class s0{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new s0(this.buffer,this.index)}}class Gs{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Qt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(VL(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new Gs(s,o,this.set)}}function VL(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function th(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof on&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:je.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof on&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class HL{cursor(e=0){return new Fp(this,e)}getChild(e,n=null,r=null){let i=iT(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return iT(this,e,n,r)}resolve(e,n=0){return th(this,e,n,!1)}resolveInner(e,n=0){return th(this,e,n,!0)}matchContext(e){return Lw(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class on extends HL{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],h=l[e]+o.from,d;if(!(!(s&je.EnterBracketed&&u instanceof De&&(d=ol.get(u))&&!d.overlay&&d.bracketed&&r>=h&&r<=h+u.length)&&!VL(i,r,h,h+u.length))){if(u instanceof Gs){if(s&je.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,n,r-h,i);if(f>-1)return new mi(new Wle(o,u,e,h),null,f)}else if(s&je.IncludeAnonymous||!u.type.isAnonymous||o0(u)){let f;if(!(s&je.IgnoreMounts)&&(f=ol.get(u))&&!f.overlay)return new on(f.tree,h,e,o);let p=new on(u,h,e,o);return s&je.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&je.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&je.IgnoreOverlays)&&(i=ol.get(this._tree))&&i.overlay){let s=e-this.from,o=r&je.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((n>0||o?a<=s:a<s)&&(n<0||o?l>=s:l>s))return new on(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function iT(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Lw(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Wle{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class mi extends HL{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new mi(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&je.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new mi(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new mi(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new mi(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new De(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function YL(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof on&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new Vle(i,n)}class Vle{constructor(e,n){this.heads=e,this.node=n}get next(){return YL(this.heads)}}function Hle(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof on?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=ol.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new on(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(th(a,e,n,!1))}}return i?YL(i):r}class Fp{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~je.EnterBracketed,e instanceof on)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof on?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&je.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&je.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&je.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&je.IncludeAnonymous||a instanceof Gs||!a.type.isAnonymous||o0(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new mi(this.buffer,n,this.stack[i]);return this.bufferNode=new mi(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return Lw(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return Lw(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function o0(t){return t.children.some(e=>e instanceof Gs||!e.type.isAnonymous||o0(e))}function Yle(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=WL,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new s0(n,n.length):n,l=r.types,c=0,u=0;function h(x,S,T,P,Q,E){let{id:M,start:L,end:H,size:Y}=a,z=u,$=c;if(Y<0)if(a.next(),Y==-1){let F=s[M];T.push(F),P.push(L-x);return}else if(Y==-3){c=M;return}else if(Y==-4){u=M;return}else throw new RangeError(`Unrecognized record size: ${Y}`);let Z=l[M],I,D,C=L-x;if(H-L<=i&&(D=b(a.pos-S,Q))){let F=new Uint16Array(D.size-D.skip),W=a.pos-D.size,v=F.length;for(;a.pos>W;)v=m(D.start,F,v);I=new Gs(F,H-D.start,r),C=D.start-x}else{let F=a.pos-Y;a.next();let W=[],v=[],V=M>=o?M:-1,ie=0,te=H;for(;a.pos>F;)V>=0&&a.id==V&&a.size>=0?(a.end<=te-i&&(p(W,v,L,ie,a.end,te,V,z,$),ie=W.length,te=a.end),a.next()):E>2500?d(L,F,W,v):h(L,F,W,v,V,E+1);if(V>=0&&ie>0&&ie<W.length&&p(W,v,L,ie,L,te,V,z,$),W.reverse(),v.reverse(),V>-1&&ie>0){let q=f(Z,$);I=a0(Z,W,v,0,W.length,0,H-L,q,q)}else I=g(Z,W,v,H-L,z-H,$)}T.push(I),P.push(C)}function d(x,S,T,P){let Q=[],E=0,M=-1;for(;a.pos>S;){let{id:L,start:H,end:Y,size:z}=a;if(z>4)a.next();else{if(M>-1&&H<M)break;M<0&&(M=Y-i),Q.push(L,H,Y),E++,a.next()}}if(E){let L=new Uint16Array(E*4),H=Q[Q.length-2];for(let Y=Q.length-3,z=0;Y>=0;Y-=3)L[z++]=Q[Y],L[z++]=Q[Y+1]-H,L[z++]=Q[Y+2]-H,L[z++]=z;T.push(new Gs(L,Q[2]-H,r)),P.push(H-x)}}function f(x,S){return(T,P,Q)=>{let E=0,M=T.length-1,L,H;if(M>=0&&(L=T[M])instanceof De){if(!M&&L.type==x&&L.length==Q)return L;(H=L.prop(Se.lookAhead))&&(E=P[M]+L.length+H)}return g(x,T,P,Q,E,S)}}function p(x,S,T,P,Q,E,M,L,H){let Y=[],z=[];for(;x.length>P;)Y.push(x.pop()),z.push(S.pop()+T-Q);x.push(g(r.types[M],Y,z,E-Q,L-E,H)),S.push(Q-T)}function g(x,S,T,P,Q,E,M){if(E){let L=[Se.contextHash,E];M=M?[L].concat(M):[L]}if(Q>25){let L=[Se.lookAhead,Q];M=M?[L].concat(M):[L]}return new De(x,S,T,P,M)}function b(x,S){let T=a.fork(),P=0,Q=0,E=0,M=T.end-i,L={size:0,start:0,skip:0};e:for(let H=T.pos-x;T.pos>H;){let Y=T.size;if(T.id==S&&Y>=0){L.size=P,L.start=Q,L.skip=E,E+=4,P+=4,T.next();continue}let z=T.pos-Y;if(Y<0||z<H||T.start<M)break;let $=T.id>=o?4:0,Z=T.start;for(T.next();T.pos>z;){if(T.size<0)if(T.size==-3||T.size==-4)$+=4;else break e;else T.id>=o&&($+=4);T.next()}Q=Z,P+=Y,E+=$}return(S<0||P==x)&&(L.size=P,L.start=Q,L.skip=E),L.size>4?L:void 0}function m(x,S,T){let{id:P,start:Q,end:E,size:M}=a;if(a.next(),M>=0&&P<o){let L=T;if(M>4){let H=a.pos-(M-4);for(;a.pos>H;)T=m(x,S,T)}S[--T]=L,S[--T]=E-x,S[--T]=Q-x,S[--T]=P}else M==-3?c=P:M==-4&&(u=P);return T}let O=[],w=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,O,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:O.length?w[0]+O[0].length:0;return new De(l[t.topID],O.reverse(),w.reverse(),k)}const sT=new WeakMap;function Cf(t,e){if(!t.isAnonymous||e instanceof Gs||e.type!=t)return 1;let n=sT.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof De)){n=1;break}n+=Cf(t,r)}sT.set(e,n)}return n}function a0(t,e,n,r,i,s,o,a,l){let c=0;for(let p=r;p<i;p++)c+=Cf(t,e[p]);let u=Math.ceil(c*1.5/8),h=[],d=[];function f(p,g,b,m,O){for(let w=b;w<m;){let k=w,x=g[w],S=Cf(t,p[w]);for(w++;w<m;w++){let T=Cf(t,p[w]);if(S+T>=u)break;S+=T}if(w==k+1){if(S>u){let T=p[k];f(T.children,T.positions,0,T.children.length,g[k]+O);continue}h.push(p[k])}else{let T=g[w-1]+p[w-1].length-x;h.push(a0(t,p,g,k,w,x,T,null,l))}d.push(x+O-s)}}return f(e,n,r,i,0),(a||l)(h,d,o)}class qL{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof mi?this.setBuffer(e.context.buffer,e.index,n):e instanceof on&&this.map.set(e.tree,n)}get(e){return e instanceof mi?this.getBuffer(e.context.buffer,e.index):e instanceof on?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xi{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Xi(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,h=u?u.fromA:1e9;if(h-l>=r)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||c){let f=Math.max(d.from,l)-c,p=Math.min(d.to,h)-c;d=f>=p?null:new Xi(f,p,d.tree,d.offset+c,a>0,!!u)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class l0{startParse(e,n,r){return typeof e=="string"&&(e=new qle(e)),r=r?r.length?r.map(i=>new yr(i.from,i.to)):[new yr(0,0)]:[new yr(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class qle{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function GL(t){return(e,n,r,i)=>new Kle(e,t,n,r,i)}class oT{constructor(e,n,r,i,s,o){this.parser=e,this.parse=n,this.overlay=r,this.bracketed=i,this.target=s,this.from=o}}function aT(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class Gle{constructor(e,n,r,i,s,o,a,l){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const Dw=new Se({perNode:!0});class Kle{constructor(e,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new De(r.type,r.children,r.positions,r.length,r.propValues.concat([[Dw,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Se.mounted.id]=new ol(n,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new tce(this.fragments),n=null,r=null,i=new Fp(new on(this.baseTree,this.ranges[0].from,0,null),je.IncludeAnonymous|je.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,d=u.to+c.pos;h>=i.from&&d<=i.to&&!n.ranges.some(f=>f.from<d&&f.to>h)&&n.ranges.push({from:h,to:d})}}a=!1}else if(r&&(o=Jle(r.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||(ece(i),n&&n.depth++,r&&r.depth++);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new Gle(s.parser,s.overlay,c,this.inner.length,i.from,!!s.bracketed,i.tree,n);else{let u=uT(this.ranges,s.overlay||(i.from<i.to?[new yr(i.from,i.to)]:[]));u.length&&aT(u),(u.length||!s.overlay)&&this.inner.push(new oT(s.parser,u.length?s.parser.startParse(this.input,hT(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new yr(h.from-i.from,h.to-i.from)):null,!!s.bracketed,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new yr(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=uT(this.ranges,n.ranges);c.length&&(aT(c),this.inner.splice(n.index,0,new oT(n.parser,n.parser.startParse(this.input,hT(n.mounts,c),c),n.ranges.map(u=>new yr(u.from-n.start,u.to-n.start)),n.bracketed,n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function Jle(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function lT(t,e,n,r,i,s){if(e<n){let o=t.buffer[e+1];r.push(t.slice(e,n,o)),i.push(o-s)}}function ece(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,s=i.children.indexOf(r),o=i.children[s],a=o.buffer,l=[s];function c(u,h,d,f,p,g){let b=n[g],m=[],O=[];lT(o,u,b,m,O,f);let w=a[b+1],k=a[b+2];l.push(m.length);let x=g?c(b+4,a[b+3],o.set.types[a[b]],w,k-w,g-1):e.toTree();return m.push(x),O.push(w-f),lT(o,a[b+3],h,m,O,f),new De(d,m,O,p)}i.children[s]=c(0,a.length,Qt.none,0,o.length,n.length-1);for(let u of l){let h=t.tree.children[u],d=t.tree.positions[u];t.yield(new on(h,d+t.from,u,t._tree))}}class cT{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(je.IncludeAnonymous|je.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)if(!(n.to>=e&&n.enter(r,1,je.IgnoreOverlays|je.ExcludeBuffers)))if(n.to<=e)n.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof De)n=n.children[0];else break}return!1}}let tce=class{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(Dw))!==null&&n!==void 0?n:r.to,this.inner=new cT(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(Dw))!==null&&e!==void 0?e:n.to,this.inner=new cT(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(Se.mounted);if(o&&o.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}};function uT(t,e){let n=null,r=e;for(let i=1,s=0;i<t.length;i++){let o=t[i-1].to,a=t[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=a)break;l.to<=o||(n||(r=n=e.slice()),l.from<o?(n[s]=new yr(l.from,o),l.to>a&&n.splice(s+1,0,new yr(a,l.to))):l.to>a?n[s--]=new yr(a,l.to):n.splice(s--,1))}}return r}function nce(t,e,n,r){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:o?t[i].to:t[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let d=Math.max(l,n),f=Math.min(u,h,r);d<f&&c.push(new yr(d,f))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function hT(t,e){let n=[];for(let{pos:r,mount:i,frag:s}of t){let o=r+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(d=>new yr(d.from+r,d.to+r)),h=nce(e,u,l,c);for(let d=0,f=l;;d++){let p=d==h.length,g=p?c:h[d].from;if(g>f&&n.push(new Xi(f,g,i.tree,-o,s.from>=f||s.openStart,s.to<=g||s.openEnd)),p)break;f=h[d].to}}else n.push(new Xi(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return n}let rce=0;class Jn{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=rce++}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 Jn&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Jn(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new Xp(e);return r=>r.modified.indexOf(n)>-1?r:Xp.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let ice=0;class Xp{constructor(e){this.name=e,this.instances=[],this.id=ice++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&sce(n,a.modified));if(r)return r;let i=[],s=new Jn(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=oce(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(Xp.get(a,l));return s}}function sce(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function oce(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 Jl(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 s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let f=i[h++];if(h==i.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new nh(r,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return KL.add(e)}const KL=new Se({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 s=new nh(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class nh{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}}nh.empty=new nh([],2,null);function JL(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function ace(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function lce(t,e,n,r=0,i=t.length){let s=new cce(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class cce{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,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(f=>!f.scope||f.scope(o)));let c=i,u=uce(e)||nh.empty,h=ace(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(n,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Se.mounted);if(d&&d.overlay){let f=e.node.enter(d.overlay[0].from+a,1),p=this.highlighters.filter(b=>!b.scope||b.scope(d.tree.type)),g=e.firstChild();for(let b=0,m=a;;b++){let O=b<d.overlay.length?d.overlay[b]:null,w=O?O.from+a:l,k=Math.max(n,m),x=Math.min(r,w);if(k<x&&g)for(;e.from<x&&(this.highlightRange(e,k,x,i,s),this.startSpan(Math.min(x,e.to),c),!(e.to>=w||!e.nextSibling())););if(!O||w>r)break;m=O.to+a,m>n&&(this.highlightRange(f.cursor(),Math.max(n,O.from+a),Math.min(r,m),"",p),this.startSpan(Math.min(r,m),c))}g&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function uce(t){let e=t.type.prop(KL);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const se=Jn.define,Zd=se(),ms=se(),dT=se(ms),fT=se(ms),Os=se(),Fd=se(Os),XO=se(Os),si=se(),ho=se(si),ni=se(),ri=se(),zw=se(),Ec=se(zw),Xd=se(),_={comment:Zd,lineComment:se(Zd),blockComment:se(Zd),docComment:se(Zd),name:ms,variableName:se(ms),typeName:dT,tagName:se(dT),propertyName:fT,attributeName:se(fT),className:se(ms),labelName:se(ms),namespace:se(ms),macroName:se(ms),literal:Os,string:Fd,docString:se(Fd),character:se(Fd),attributeValue:se(Fd),number:XO,integer:se(XO),float:se(XO),bool:se(Os),regexp:se(Os),escape:se(Os),color:se(Os),url:se(Os),keyword:ni,self:se(ni),null:se(ni),atom:se(ni),unit:se(ni),modifier:se(ni),operatorKeyword:se(ni),controlKeyword:se(ni),definitionKeyword:se(ni),moduleKeyword:se(ni),operator:ri,derefOperator:se(ri),arithmeticOperator:se(ri),logicOperator:se(ri),bitwiseOperator:se(ri),compareOperator:se(ri),updateOperator:se(ri),definitionOperator:se(ri),typeOperator:se(ri),controlOperator:se(ri),punctuation:zw,separator:se(zw),bracket:Ec,angleBracket:se(Ec),squareBracket:se(Ec),paren:se(Ec),brace:se(Ec),content:si,heading:ho,heading1:se(ho),heading2:se(ho),heading3:se(ho),heading4:se(ho),heading5:se(ho),heading6:se(ho),contentSeparator:se(si),list:se(si),quote:se(si),emphasis:se(si),strong:se(si),link:se(si),monospace:se(si),strikethrough:se(si),inserted:se(),deleted:se(),changed:se(),invalid:se(),meta:Xd,documentMeta:se(Xd),annotation:se(Xd),processingInstruction:se(Xd),definition:Jn.defineModifier("definition"),constant:Jn.defineModifier("constant"),function:Jn.defineModifier("function"),standard:Jn.defineModifier("standard"),local:Jn.defineModifier("local"),special:Jn.defineModifier("special")};for(let t in _){let e=_[t];e instanceof Jn&&(e.name=t)}JL([{tag:_.link,class:"tok-link"},{tag:_.heading,class:"tok-heading"},{tag:_.emphasis,class:"tok-emphasis"},{tag:_.strong,class:"tok-strong"},{tag:_.keyword,class:"tok-keyword"},{tag:_.atom,class:"tok-atom"},{tag:_.bool,class:"tok-bool"},{tag:_.url,class:"tok-url"},{tag:_.labelName,class:"tok-labelName"},{tag:_.inserted,class:"tok-inserted"},{tag:_.deleted,class:"tok-deleted"},{tag:_.literal,class:"tok-literal"},{tag:_.string,class:"tok-string"},{tag:_.number,class:"tok-number"},{tag:[_.regexp,_.escape,_.special(_.string)],class:"tok-string2"},{tag:_.variableName,class:"tok-variableName"},{tag:_.local(_.variableName),class:"tok-variableName tok-local"},{tag:_.definition(_.variableName),class:"tok-variableName tok-definition"},{tag:_.special(_.variableName),class:"tok-variableName2"},{tag:_.definition(_.propertyName),class:"tok-propertyName tok-definition"},{tag:_.typeName,class:"tok-typeName"},{tag:_.namespace,class:"tok-namespace"},{tag:_.className,class:"tok-className"},{tag:_.macroName,class:"tok-macroName"},{tag:_.propertyName,class:"tok-propertyName"},{tag:_.operator,class:"tok-operator"},{tag:_.comment,class:"tok-comment"},{tag:_.meta,class:"tok-meta"},{tag:_.invalid,class:"tok-invalid"},{tag:_.punctuation,class:"tok-punctuation"}]);var WO;const _o=new Se;function c0(t){return ae.define({combine:t?e=>e.concat(t):void 0})}const u0=new Se;class br{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Te.prototype.hasOwnProperty("tree")||Object.defineProperty(Te.prototype,"tree",{get(){return Je(this)}}),this.parser=n,this.extension=[Ks.of(this),Te.languageData.of((s,o,a)=>{let l=pT(s,o,a),c=l.type.prop(_o);if(!c)return[];let u=s.facet(c),h=l.type.prop(u0);if(h){let d=l.resolve(o-l.from,a);for(let f of h)if(f.test(d,s)){let p=s.facet(f.facet);return f.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return pT(e,n,r).type.prop(_o)==this.data}findRegions(e){let n=e.facet(Ks);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(_o)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(Se.mounted);if(a){if(a.tree.prop(_o)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof De&&i(c,s.positions[l]+o)}};return i(Je(e),0),r}get allowsNesting(){return!0}}br.setState=we.define();function pT(t,e,n){let r=t.facet(Ks),i=Je(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,je.ExcludeBuffers|je.EnterBracketed))s.type.isTop&&(i=s);return i}class Il extends br{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=c0(e.languageData);return new Il(n,e.parser.configure({props:[_o.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new Il(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Je(t){let e=t.field(br.state,!1);return e?e.tree:De.empty}class hce{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 _c=null;class rh{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new rh(e,n,[],De.empty,0,r,[],null)}startParse(){return this.parser.startParse(new hce(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=De.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(Xi.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(Xi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=_c;_c=this;try{return e()}finally{_c=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=gT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,d)=>l.push({fromA:c,toA:u,fromB:h,toB:d})),r=Xi.applyChanges(r,l),i=De.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new rh(this.parser,n,r,i,s,o,a,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:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=gT(this.fragments,i,s),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 l0{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=_c;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new De(Qt.none,[],[],o-s)},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 _c}}function gT(t,e,n){return Xi.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Rl{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 Rl(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=rh.create(e.facet(Ks).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Rl(r)}}br.state=Gt.define({create:Rl.init,update(t,e){for(let n of e.effects)if(n.is(br.setState))return n.value;return e.startState.facet(Ks)!=e.state.facet(Ks)?Rl.init(e.state):t.apply(e)}});let eD=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(eD=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const VO=typeof navigator<"u"&&(!((WO=navigator.scheduling)===null||WO===void 0)&&WO.isInputPending)?()=>navigator.scheduling.isInputPending():null,dce=kt.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(br.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(br.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=eD(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,s=r.field(br.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!VO?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>VO&&VO()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:br.setState.of(new Rl(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Mn(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()}}}),Ks=ae.define({combine(t){return t.length?t[0]:null},enables:t=>[br.state,dce,re.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class ih{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class Wp{constructor(e,n,r,i,s,o=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,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 Wp(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(s=>s==n))return i;if(r)for(let i of e)for(let s of i.alias){let o=n.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+s.length])))return i}return null}}const fce=ae.define(),ec=ae.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 Vp(t){let e=t.facet(ec);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function sh(t,e){let n="",r=t.tabSize,i=t.facet(ec)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function h0(t,e){t instanceof Te&&(t=new mm(t));for(let r of t.state.facet(fce)){let i=r(t,e);if(i!==void 0)return i}let n=Je(t.state);return n.length>=e?pce(t,n,e):null}class mm{constructor(e,n={}){this.state=e,this.options=n,this.unit=Vp(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&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),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return Hr(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Mh=new Se;function pce(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return tD(r,t,n)}function tD(t,e,n){for(let r=t;r;r=r.next){let i=mce(r.node);if(i)return i(d0.create(e,n,r))}return 0}function gce(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function mce(t){let e=t.type.prop(Mh);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Se.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>nD(o,!0,1,void 0,s&&!gce(o)?i.from:void 0)}return t.parent==null?Oce:null}function Oce(){return 0}class d0 extends mm{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 d0(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(yce(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tD(this.context.next,this.base,this.pos)}}function yce(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function bce(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function wce({closing:t,align:e=!0,units:n=1}){return r=>nD(r,e,n,t)}function nD(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=e?bce(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const Sce=t=>t.baseIndent;function Ef({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const kce=200;function vce(){return Te.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+kce)return t;let s=n.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=h0(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],f=sh(o,h);d!=f&&l.push({from:u.from,to:u.from+d.length,insert:f})}return l.length?[t,{changes:l,sequential:!0}]:t})}const rD=ae.define(),tc=new Se;function iD(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 xce(t,e,n){let r=Je(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(s&&a.from<e)break;let l=a.type.prop(tc);if(l&&(a.to<r.length-50||r.length==t.doc.length||!Cce(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(s=c)}}return s}function Cce(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Hp(t,e,n){for(let r of t.facet(rD)){let i=r(t,e,n);if(i)return i}return xce(t,e,n)}function sD(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 Om=we.define({map:sD}),Qh=we.define({map:sD});function oD(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 qo=Gt.define({create(){return pe.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=mT(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Om)&&!Ece(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(cD),i=r?pe.replace({widget:new Nce(r(e.state,n.value))}):OT;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(Qh)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=mT(t,e.selection.main.head)),t},provide:t=>re.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(OT.range(r,i))}return pe.set(e,!0)}});function mT(t,e,n=e){let r=!1;return t.between(e,n,(i,s)=>{i<n&&s>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,s)=>i>=n||s<=e}):t}function Yp(t,e,n){var r;let i=null;return(r=t.field(qo,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function Ece(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function aD(t,e){return t.field(qo,!1)?e:e.concat(we.appendConfig.of(uD()))}const _ce=t=>{for(let e of oD(t)){let n=Hp(t.state,e.from,e.to);if(n)return t.dispatch({effects:aD(t.state,[Om.of(n),lD(t,n)])}),!0}return!1},Tce=t=>{if(!t.state.field(qo,!1))return!1;let e=[];for(let n of oD(t)){let r=Yp(t.state,n.from,n.to);r&&e.push(Qh.of(r),lD(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lD(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return re.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const Ace=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=Hp(e,i.from,i.to);s&&n.push(Om.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:aD(t.state,n)}),!!n.length},Pce=t=>{let e=t.state.field(qo,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(Qh.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},Ice=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:_ce},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Tce},{key:"Ctrl-Alt-[",run:Ace},{key:"Ctrl-Alt-]",run:Pce}],Rce={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},cD=ae.define({combine(t){return Ti(t,Rce)}});function uD(t){return[qo,Qce]}function hD(t,e){let{state:n}=t,r=n.facet(cD),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=Yp(t.state,a.from,a.to);l&&t.dispatch({effects:Qh.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const OT=pe.replace({widget:new class extends qr{toDOM(t){return hD(t,null)}}});class Nce extends qr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return hD(e,this.value)}}const $ce={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class HO extends ts{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 Mce(t={}){let e={...$ce,...t},n=new HO(e,!0),r=new HO(e,!1),i=kt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ks)!=o.state.facet(Ks)||o.startState.field(qo,!1)!=o.state.field(qo,!1)||Je(o.startState)!=Je(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Ji;for(let l of o.viewportLineBlocks){let c=Yp(o.state,l.from,l.to)?r:Hp(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,Nle({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Ce.empty},initialSpacer(){return new HO(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=Yp(o.state,a.from,a.to);if(c)return o.dispatch({effects:Qh.of(c)}),!0;let u=Hp(o.state,a.from,a.to);return u?(o.dispatch({effects:Om.of(u)}),!0):!1}}}),uD()]}const Qce=re.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 Lh{constructor(e,n){this.specs=e;let r;function i(a){let l=Hs.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof br?a=>a.prop(_o)==o.data:o?a=>a==o:void 0,this.style=JL(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new Hs(r):null,this.themeType=n.themeType}static define(e,n){return new Lh(e,n||{})}}const jw=ae.define(),dD=ae.define({combine(t){return t.length?[t[0]]:null}});function YO(t){let e=t.facet(jw);return e.length?e:t.facet(dD)}function fD(t,e){let n=[Dce],r;return t instanceof Lh&&(t.module&&n.push(re.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(dD.of(t)):r?n.push(jw.computeN([re.darkTheme],i=>i.facet(re.darkTheme)==(r=="dark")?[t]:[])):n.push(jw.of(t)),n}class Lce{constructor(e){this.markCache=Object.create(null),this.tree=Je(e.state),this.decorations=this.buildDeco(e,YO(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Je(e.state),r=YO(e.state),i=r!=YO(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return pe.none;let r=new Ji;for(let{from:i,to:s}of e.visibleRanges)lce(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=pe.mark({class:l})))},i,s);return r.finish()}}const Dce=os.high(kt.fromClass(Lce,{decorations:t=>t.decorations})),zce=Lh.define([{tag:_.meta,color:"#404740"},{tag:_.link,textDecoration:"underline"},{tag:_.heading,textDecoration:"underline",fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strong,fontWeight:"bold"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.keyword,color:"#708"},{tag:[_.atom,_.bool,_.url,_.contentSeparator,_.labelName],color:"#219"},{tag:[_.literal,_.inserted],color:"#164"},{tag:[_.string,_.deleted],color:"#a11"},{tag:[_.regexp,_.escape,_.special(_.string)],color:"#e40"},{tag:_.definition(_.variableName),color:"#00f"},{tag:_.local(_.variableName),color:"#30a"},{tag:[_.typeName,_.namespace],color:"#085"},{tag:_.className,color:"#167"},{tag:[_.special(_.variableName),_.macroName],color:"#256"},{tag:_.definition(_.propertyName),color:"#00c"},{tag:_.comment,color:"#940"},{tag:_.invalid,color:"#f00"}]),jce=re.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),pD=1e4,gD="()[]{}",mD=ae.define({combine(t){return Ti(t,{afterCursor:!0,brackets:gD,maxScanDistance:pD,renderMatch:Zce})}}),Bce=pe.mark({class:"cm-matchingBracket"}),Uce=pe.mark({class:"cm-nonmatchingBracket"});function Zce(t){let e=[],n=t.matched?Bce:Uce;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 yT(t){let e=[],n=t.facet(mD);for(let r of t.selection.ranges){if(!r.empty)continue;let i=Oi(t,r.head,-1,n)||r.head>0&&Oi(t,r.head-1,1,n)||n.afterCursor&&(Oi(t,r.head,1,n)||r.head<t.doc.length&&Oi(t,r.head+1,-1,n));i&&(e=e.concat(n.renderMatch(i,t)))}return pe.set(e,!0)}const Fce=kt.fromClass(class{constructor(t){this.paused=!1,this.decorations=yT(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=yT(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),Xce=[Fce,jce];function Wce(t={}){return[mD.of(t),Xce]}const OD=new Se;function Bw(t,e,n){let r=t.prop(e<0?Se.openedBy:Se.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 Uw(t){let e=t.type.prop(OD);return e?e(t.node):t}function Oi(t,e,n,r={}){let i=r.maxScanDistance||pD,s=r.brackets||gD,o=Je(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=Bw(l.type,n,s);if(c&&l.from<l.to){let u=Uw(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return Vce(t,e,n,l,u,c,s)}}return Hce(t,e,n,o,a.type,i,s)}function Vce(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,u=a==null?void 0:a.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&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Uw(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Bw(u.type,n,o))c++;else if(Bw(u.type,-n,o)){if(c==0){let h=Uw(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function Hce(t,e,n,r,i,s,o){if(n<0?!e:e==t.doc.length)return null;let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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),h=0;for(let d=0;!u.next().done&&d<=s;){let f=u.value;n<0&&(d+=f.length);let p=e+d*n;for(let g=n>0?0:f.length-1,b=n>0?f.length:-1;g!=b;g+=n){let m=o.indexOf(f[g]);if(!(m<0||r.resolveInner(p+g,1).type!=i))if(m%2==0==n>0)h++;else{if(h==1)return{start:c,end:{from:p+g,to:p+g+1},matched:m>>1==l>>1};h--}}n>0&&(d+=f.length)}return u.done?{start:c,matched:!1}:null}const Yce=Object.create(null),bT=[Qt.none],wT=[],ST=Object.create(null),qce=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"]])qce[t]=Gce(Yce,e);function qO(t,e){wT.indexOf(t)>-1||(wT.push(t),console.warn(e))}function Gce(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||_[c];u?typeof u=="function"?l.length?l=l.map(u):qO(c,`Modifier ${c} used at start of tag`):l.length?qO(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:qO(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=ST[i];if(s)return s.id;let o=ST[i]=Qt.define({id:bT.length,name:r,props:[Jl({[r]:n})]});return bT.push(o),o.id}Ge.RTL,Ge.LTR;const Kce=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=p0(t.state,n.from);return r.line?Jce(t):r.block?tue(t):!1};function f0(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 Jce=f0(iue,0),eue=f0(yD,0),tue=f0((t,e)=>yD(t,e,rue(e)),0);function p0(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Tc=50;function nue(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Tc,r),o=t.sliceDoc(i,i+Tc),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,h;i-r<=2*Tc?u=h=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+Tc),h=t.sliceDoc(i-Tc,i));let d=/^\s*/.exec(u)[0].length,f=/\s*$/.exec(h)[0].length,p=h.length-f-n.length;return u.slice(d,d+e.length)==e&&h.slice(p,p+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-f-n.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function rue(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 s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function yD(t,e,n=e.selection.ranges){let r=n.map(s=>p0(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>nue(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function iue(t,e,n=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of n){let a=r.length,l=1e9,c;for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(c==null&&(c=p0(e,h.from).line,!c))continue e;if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,f=d==h.length,p=h.text.slice(d,d+c.length)==c?d:-1;d<h.text.length&&d<l&&(l=d),r.push({line:h,comment:p,token:c,indent:d,empty:f,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of r)(h||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const Zw=_i.define(),sue=_i.define(),oue=ae.define(),bD=ae.define({combine(t){return Ti(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)})}}),wD=Gt.define({create(){return yi.empty},update(t,e){let n=e.state.facet(bD),r=e.annotation(Zw);if(r){let l=Qn.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=qp(u,u.length,n.minDepth,l):u=vD(u,e.startState.selection),new yi(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(sue);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Pt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=Qn.fromTransaction(e),o=e.annotation(Pt.time),a=e.annotation(Pt.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 yi(t.done.map(Qn.fromJSON),t.undone.map(Qn.fromJSON))}});function aue(t={}){return[wD,bD.of(t),re.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?SD:e.inputType=="historyRedo"?Fw:null;return r?(e.preventDefault(),r(n)):!1}})]}function ym(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(wD,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const SD=ym(0,!1),Fw=ym(1,!1),lue=ym(0,!0),cue=ym(1,!0);class Qn{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new Qn(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 Qn(e.changes&&Nt.fromJSON(e.changes),[],e.mapped&&ki.fromJSON(e.mapped),e.startSelection&&B.fromJSON(e.startSelection),e.selectionsAfter.map(B.fromJSON))}static fromTransaction(e,n){let r=wr;for(let i of e.startState.facet(oue)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Qn(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,wr)}static selection(e){return new Qn(void 0,wr,void 0,void 0,e)}}function qp(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function uue(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function hue(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function kD(t,e){return t.length?e.length?t.concat(e):t:e}const wr=[],due=200;function vD(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-due));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),qp(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Qn.selection([e])]}function fue(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 GO(t,e){if(!t.length)return t;let n=t.length,r=wr;for(;n;){let i=pue(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[Qn.selection(r)]:wr}function pue(t,e,n){let r=kD(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):wr,n);if(!t.changes)return Qn.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Qn(i,we.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const gue=/^(input\.type|delete)($|\.)/;class yi{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 yi(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||gue.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,uue(a.changes,e.changes))||r=="input.type.compose")?o=qp(o,o.length-1,i.minDepth,new Qn(e.changes.compose(a.changes),kD(we.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,wr)):o=qp(o,o.length,i.minDepth,e),new yi(o,wr,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:wr;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&hue(s[s.length-1],e)?this:new yi(vD(this.done,e),this.undone,n,r)}addMapping(e){return new yi(GO(this.done,e),GO(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 s=i[i.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):n.selection);if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Zw.of({side:e,rest:fue(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?wr:i.slice(0,i.length-1);return s.mapped&&(a=GO(a,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Zw.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}yi.empty=new yi(wr,wr);const mue=[{key:"Mod-z",run:SD,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Fw,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Fw,preventDefault:!0},{key:"Mod-u",run:lue,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:cue,preventDefault:!0}];function nc(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function Gr(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Kr({state:t,dispatch:e},n){let r=nc(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Gr(t,r)),!0)}function bm(t,e){return B.cursor(e?t.to:t.from)}function xD(t,e){return Kr(t,n=>n.empty?t.moveByChar(n,e):bm(n,e))}function cn(t){return t.textDirectionAt(t.state.selection.main.head)==Ge.LTR}const CD=t=>xD(t,!cn(t)),ED=t=>xD(t,cn(t));function _D(t,e){return Kr(t,n=>n.empty?t.moveByGroup(n,e):bm(n,e))}const Oue=t=>_D(t,!cn(t)),yue=t=>_D(t,cn(t));function bue(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 wm(t,e,n){let r=Je(t).resolveInner(e.head),i=n?Se.closedBy:Se.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;bue(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=n?Oi(t,r.from,1):Oi(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,B.cursor(a,n?-1:1)}const wue=t=>Kr(t,e=>wm(t.state,e,!cn(t))),Sue=t=>Kr(t,e=>wm(t.state,e,cn(t)));function TD(t,e){return Kr(t,n=>{if(!n.empty)return bm(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const AD=t=>TD(t,!1),PD=t=>TD(t,!0);function ID(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(re.scrollMargins)){let o=s(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.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 RD(t,e){let n=ID(t),{state:r}=t,i=nc(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):bm(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(s=re.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(Gr(r,i),{effects:s}),!0}const kT=t=>RD(t,!1),Xw=t=>RD(t,!0);function ao(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 s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=B.cursor(r.from+s))}return i}const kue=t=>Kr(t,e=>ao(t,e,!0)),vue=t=>Kr(t,e=>ao(t,e,!1)),xue=t=>Kr(t,e=>ao(t,e,!cn(t))),Cue=t=>Kr(t,e=>ao(t,e,cn(t))),Eue=t=>Kr(t,e=>B.cursor(t.lineBlockAt(e.head).from,1)),_ue=t=>Kr(t,e=>B.cursor(t.lineBlockAt(e.head).to,-1));function Tue(t,e,n){let r=!1,i=nc(t.selection,s=>{let o=Oi(t,s.head,-1)||Oi(t,s.head,1)||s.head>0&&Oi(t,s.head-1,1)||s.head<t.doc.length&&Oi(t,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return B.cursor(a)});return r?(e(Gr(t,i)),!0):!1}const Aue=({state:t,dispatch:e})=>Tue(t,e);function _r(t,e){let n=nc(t.state.selection,r=>{let i=e(r);return B.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return n.eq(t.state.selection)?!1:(t.dispatch(Gr(t.state,n)),!0)}function ND(t,e){return _r(t,n=>t.moveByChar(n,e))}const $D=t=>ND(t,!cn(t)),MD=t=>ND(t,cn(t));function QD(t,e){return _r(t,n=>t.moveByGroup(n,e))}const Pue=t=>QD(t,!cn(t)),Iue=t=>QD(t,cn(t)),Rue=t=>_r(t,e=>wm(t.state,e,!cn(t))),Nue=t=>_r(t,e=>wm(t.state,e,cn(t)));function LD(t,e){return _r(t,n=>t.moveVertically(n,e))}const DD=t=>LD(t,!1),zD=t=>LD(t,!0);function jD(t,e){return _r(t,n=>t.moveVertically(n,e,ID(t).height))}const vT=t=>jD(t,!1),xT=t=>jD(t,!0),$ue=t=>_r(t,e=>ao(t,e,!0)),Mue=t=>_r(t,e=>ao(t,e,!1)),Que=t=>_r(t,e=>ao(t,e,!cn(t))),Lue=t=>_r(t,e=>ao(t,e,cn(t))),Due=t=>_r(t,e=>B.cursor(t.lineBlockAt(e.head).from)),zue=t=>_r(t,e=>B.cursor(t.lineBlockAt(e.head).to)),CT=({state:t,dispatch:e})=>(e(Gr(t,{anchor:0})),!0),ET=({state:t,dispatch:e})=>(e(Gr(t,{anchor:t.doc.length})),!0),_T=({state:t,dispatch:e})=>(e(Gr(t,{anchor:t.selection.main.anchor,head:0})),!0),TT=({state:t,dispatch:e})=>(e(Gr(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),jue=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Bue=({state:t,dispatch:e})=>{let n=Sm(t).map(({from:r,to:i})=>B.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:B.create(n),userEvent:"select"})),!0},Uue=({state:t,dispatch:e})=>{let n=nc(t.selection,r=>{let i=Je(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return B.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(Gr(t,n)),!0)};function BD(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=s;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(t.dispatch(Gr(n,B.create(i,i.length-1))),!0)}const Zue=t=>BD(t,!1),Fue=t=>BD(t,!0),Xue=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=B.create([n.main]):n.main.empty||(r=B.create([B.cursor(n.main.head)])),r?(e(Gr(t,r)),!0):!1};function Dh(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(n="delete.backward",l=Wd(t,l,!1)):l>o&&(n="delete.forward",l=Wd(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Wd(t,o,!1),a=Wd(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:B.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?re.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Wd(t,e,n){if(t instanceof re)for(let r of t.state.facet(re.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const UD=(t,e,n)=>Dh(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let c=Hr(a,s.tabSize),u=c%Vp(s)||Vp(s);for(let h=0;h<u&&a[a.length-1-h]==" ";h++)i--;l=i}else l=Bt(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=Bt(o.text,l-o.from,!1,!1)+o.from);return l}),Ww=t=>UD(t,!1,!0),ZD=t=>UD(t,!0,!1),FD=(t,e)=>Dh(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=Bt(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),XD=t=>FD(t,!1),Wue=t=>FD(t,!0),Vue=t=>Dh(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Hue=t=>Dh(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Yue=t=>Dh(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),que=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Re.of(["",""])},range:B.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Gue=({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,s=t.doc.lineAt(i),o=i==s.from?i-1:Bt(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Bt(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:B.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Sm(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function WD(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Sm(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(B.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(B.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:B.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Kue=({state:t,dispatch:e})=>WD(t,e,!1),Jue=({state:t,dispatch:e})=>WD(t,e,!0);function VD(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of Sm(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.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 ehe=({state:t,dispatch:e})=>VD(t,e,!1),the=({state:t,dispatch:e})=>VD(t,e,!0),nhe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Sm(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=nc(e.selection,i=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function rhe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Je(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Se.closedBy))&&s.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 AT=HD(!1),ihe=HD(!0);function HD(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&rhe(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new mm(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=h0(c,s);for(u==null&&(u=Hr(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let h=["",sh(e,u)];return l&&h.push(sh(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Re.of(h)},range:B.cursor(s+1+h[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function g0(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:B.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const she=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new mm(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=g0(t,(s,o,a)=>{let l=h0(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=sh(t,l);(c!=u||a.from<s.from+c.length)&&(n[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},YD=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(g0(t,(n,r)=>{r.push({from:n.from,insert:t.facet(ec)})}),{userEvent:"input.indent"})),!0),qD=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(g0(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Hr(i,t.tabSize),o=0,a=sh(t,Math.max(0,s-Vp(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),ohe=t=>(t.setTabFocusMode(),!0),ahe=[{key:"Ctrl-b",run:CD,shift:$D,preventDefault:!0},{key:"Ctrl-f",run:ED,shift:MD},{key:"Ctrl-p",run:AD,shift:DD},{key:"Ctrl-n",run:PD,shift:zD},{key:"Ctrl-a",run:Eue,shift:Due},{key:"Ctrl-e",run:_ue,shift:zue},{key:"Ctrl-d",run:ZD},{key:"Ctrl-h",run:Ww},{key:"Ctrl-k",run:Vue},{key:"Ctrl-Alt-h",run:XD},{key:"Ctrl-o",run:que},{key:"Ctrl-t",run:Gue},{key:"Ctrl-v",run:Xw}],lhe=[{key:"ArrowLeft",run:CD,shift:$D,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Oue,shift:Pue,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:xue,shift:Que,preventDefault:!0},{key:"ArrowRight",run:ED,shift:MD,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yue,shift:Iue,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Cue,shift:Lue,preventDefault:!0},{key:"ArrowUp",run:AD,shift:DD,preventDefault:!0},{mac:"Cmd-ArrowUp",run:CT,shift:_T},{mac:"Ctrl-ArrowUp",run:kT,shift:vT},{key:"ArrowDown",run:PD,shift:zD,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ET,shift:TT},{mac:"Ctrl-ArrowDown",run:Xw,shift:xT},{key:"PageUp",run:kT,shift:vT},{key:"PageDown",run:Xw,shift:xT},{key:"Home",run:vue,shift:Mue,preventDefault:!0},{key:"Mod-Home",run:CT,shift:_T},{key:"End",run:kue,shift:$ue,preventDefault:!0},{key:"Mod-End",run:ET,shift:TT},{key:"Enter",run:AT,shift:AT},{key:"Mod-a",run:jue},{key:"Backspace",run:Ww,shift:Ww,preventDefault:!0},{key:"Delete",run:ZD,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XD,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Wue,preventDefault:!0},{mac:"Mod-Backspace",run:Hue,preventDefault:!0},{mac:"Mod-Delete",run:Yue,preventDefault:!0}].concat(ahe.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),che=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wue,shift:Rue},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Sue,shift:Nue},{key:"Alt-ArrowUp",run:Kue},{key:"Shift-Alt-ArrowUp",run:ehe},{key:"Alt-ArrowDown",run:Jue},{key:"Shift-Alt-ArrowDown",run:the},{key:"Mod-Alt-ArrowUp",run:Zue},{key:"Mod-Alt-ArrowDown",run:Fue},{key:"Escape",run:Xue},{key:"Mod-Enter",run:ihe},{key:"Alt-l",mac:"Ctrl-l",run:Bue},{key:"Mod-i",run:Uue,preventDefault:!0},{key:"Mod-[",run:qD},{key:"Mod-]",run:YD},{key:"Mod-Alt-\\",run:she},{key:"Shift-Mod-k",run:nhe},{key:"Shift-Mod-\\",run:Aue},{key:"Mod-/",run:Kce},{key:"Alt-A",run:eue},{key:"Ctrl-m",mac:"Shift-Alt-m",run:ohe}].concat(lhe),uhe={key:"Tab",run:YD,shift:qD},PT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Nl{constructor(e,n,r=0,i=e.length,s,o){this.test=o,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=s?a=>s(PT(a)):PT,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 In(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=jv(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=di(e);let i=this.normalize(n);if(i.length)for(let s=0,o=r,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<n.length&&n.charCodeAt(s)==l?o++:a=!1}}}match(e,n,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:n,to:i,precise:r&&s}:this.matches.push({from:n,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Nl.prototype[Symbol.iterator]=function(){return this});const GD={from:-1,to:-1,match:/.*/.exec(""),precise:!0},m0="gm"+(/x/.unicode==null?"":"u");class KD{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=GD,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new JD(e,n,r,i,s);this.re=new RegExp(n,m0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=Gp(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=Gp(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 KO=new WeakMap;class al{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=KO.get(e);if(!i||i.from>=r||i.to<=n){let a=new al(n,e.sliceString(n,r));return KO.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),KO.set(e,new al(o,s)),new al(n,s.slice(n-o,r-o))}}class JD{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=GD,this.matchPos=Gp(e,i),this.re=new RegExp(n,m0+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=al.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=Gp(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=al.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(KD.prototype[Symbol.iterator]=JD.prototype[Symbol.iterator]=function(){return this});function hhe(t){try{return new RegExp(t,m0),!0}catch{return!1}}function Gp(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 dhe=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:i}=Ale(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return i.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,h]=o,d=u?+u.slice(1):0,f=c?+c:a.number;if(c&&h){let b=f/100;l&&(b=b*(l=="-"?-1:1)+a.number/e.doc.lines),f=Math.round(e.doc.lines*b)}else c&&l&&(f=f*(l=="-"?-1:1)+a.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,f))),g=B.cursor(p.from+Math.max(0,Math.min(d,p.length)));t.dispatch({effects:[r,re.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},fhe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},phe=ae.define({combine(t){return Ti(t,fhe,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function ghe(t){return[whe,bhe]}const mhe=pe.mark({class:"cm-selectionMatch"}),Ohe=pe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function IT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=lt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=lt.Word)}function yhe(t,e,n,r){return t(e.sliceDoc(n,n+1))==lt.Word&&t(e.sliceDoc(r-1,r))==lt.Word}const bhe=kt.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(phe),{state:n}=t,r=n.selection;if(r.ranges.length>1)return pe.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return pe.none;let l=n.wordAt(i.head);if(!l)return pe.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return pe.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(IT(o,n,i.from,i.to)&&yhe(o,n,i.from,i.to)))return pe.none}else if(s=n.sliceDoc(i.from,i.to),!s)return pe.none}let a=[];for(let l of t.visibleRanges){let c=new Nl(n.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||IT(o,n,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(Ohe.range(u,h)):(u>=i.to||h<=i.from)&&a.push(mhe.range(u,h)),a.length>e.maxMatches))return pe.none}}return pe.set(a)}},{decorations:t=>t.decorations}),whe=re.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),She=({state:t,dispatch:e})=>{let{selection:n}=t,r=B.create(n.ranges.map(i=>t.wordAt(i.head)||B.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function khe(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new Nl(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Nl(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const vhe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return She({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=khe(t,r);return i?(e(t.update({selection:t.selection.addRange(B.range(i.from,i.to),!1),effects:re.scrollIntoView(i.to)})),!0):!1},rc=ae.define({combine(t){return Ti(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Lhe(e),scrollToMatch:e=>re.scrollIntoView(e)})}});class e2{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||hhe(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"?`
|
|
201
201
|
`: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 Ahe(this):new Ehe(this)}getCursor(e,n=0,r){let i=e.doc?e:Te.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?wa(this,i,n,r):ba(this,i,n,r)}}class t2{constructor(e){this.spec=e}}function xhe(t,e,n){return(r,i,s,o)=>{if(n&&!n(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return t(a,e,r,i)}}function ba(t,e,n,r){let i;return t.wholeWord&&(i=Che(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=xhe(t.test,e,i)),new Nl(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),i)}function Che(t,e){return(n,r,i,s)=>((s>n||s+i.length<r)&&(s=Math.max(0,n-2),i=t.sliceString(s,Math.min(t.length,r+2))),(e(Kp(i,n-s))!=lt.Word||e(Jp(i,n-s))!=lt.Word)&&(e(Jp(i,r-s))!=lt.Word||e(Kp(i,r-s))!=lt.Word))}class Ehe extends t2{constructor(e){super(e)}nextMatch(e,n,r){let i=ba(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);i=ba(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,i-1e4-this.spec.unquoted.length),o=ba(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==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=ba(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 s=ba(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function _he(t,e,n){return(r,i,s)=>(!n||n(r,i,s))&&t(s[0],e,r,i)}function wa(t,e,n,r){let i;return t.wholeWord&&(i=The(e.charCategorizer(e.selection.main.head))),t.test&&(i=_he(t.test,e,i)),new KD(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},n,r)}function Kp(t,e){return t.slice(Bt(t,e,!1),e)}function Jp(t,e){return t.slice(e,Bt(t,e))}function The(t){return(e,n,r)=>!r[0].length||(t(Kp(r.input,r.index))!=lt.Word||t(Jp(r.input,r.index))!=lt.Word)&&(t(Jp(r.input,r.index+r[0].length))!=lt.Word||t(Kp(r.input,r.index+r[0].length))!=lt.Word)}class Ahe extends t2{nextMatch(e,n,r){let i=wa(this.spec,e,r,e.doc.length).next();return i.done&&(i=wa(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=wa(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==n||a.from>s+10))return a;if(s==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 s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return n})}matchAll(e,n){let r=wa(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 s=wa(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const oh=we.define(),O0=we.define(),Bs=Gt.define({create(t){return new JO(Vw(t).create(),null)},update(t,e){for(let n of e.effects)n.is(oh)?t=new JO(n.value.create(),t.panel):n.is(O0)&&(t=new JO(t.query,n.value?y0:null));return t},provide:t=>eh.from(t,e=>e.panel)});class JO{constructor(e,n){this.query=e,this.panel=n}}const Phe=pe.mark({class:"cm-searchMatch"}),Ihe=pe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Rhe=kt.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Bs))}update(t){let e=t.state.field(Bs);(e!=t.startState.field(Bs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return pe.none;let{view:n}=this,r=new Ji;for(let i=0,s=n.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;t.highlight(n.state,a,l,(c,u)=>{let h=n.state.selection.ranges.some(d=>d.from==c&&d.to==u);r.add(c,u,h?Ihe:Phe)})}return r.finish()}},{decorations:t=>t.decorations});function zh(t){return e=>{let n=e.state.field(Bs,!1);return n&&n.query.spec.valid?t(e,n):i2(e)}}const eg=zh((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=B.single(r.from,r.to),s=t.state.facet(rc);return t.dispatch({selection:i,effects:[b0(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),r2(t),!0}),tg=zh((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=B.single(i.from,i.to),o=t.state.facet(rc);return t.dispatch({selection:s,effects:[b0(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),r2(t),!0}),Nhe=zh((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:B.create(n.map(r=>B.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),$he=({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,s=[],o=0;for(let a=new Nl(t.doc,t.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(B.range(a.value.from,a.value.to))}return e(t.update({selection:B.create(s,o),userEvent:"select.search.matches"})),!0},RT=zh((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=s,a=[],l,c,u=[];o.precise?o.from==r&&o.to==i&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),u.push(re.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=e.nextMatch(n,o.from,o.to);let h=t.state.changes(a);return o&&(l=B.single(o.from,o.to).map(h),u.push(b0(t,o)),u.push(n.facet(rc).scrollToMatch(l.main,t))),t.dispatch({changes:h,selection:l,effects:u,userEvent:"input.replace"}),!0}),Mhe=zh((t,{query:e})=>{if(t.state.readOnly)return!1;let n=[];for(let i of e.matchAll(t.state,1e9)){let{from:s,to:o,precise:a}=i;a&&n.push({from:s,to:o,insert:e.getReplacement(i)})}if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:re.announce.of(r),userEvent:"input.replace.all"}),!0});function y0(t){return t.state.facet(rc).createPanel(t)}function Vw(t,e){var n,r,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(rc);return new e2({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function n2(t){let e=i0(t,y0);return e&&e.dom.querySelector("[main-field]")}function r2(t){let e=n2(t);e&&e==t.root.activeElement&&e.select()}const i2=t=>{let e=t.state.field(Bs,!1);if(e&&e.panel){let n=n2(t);if(n&&n!=t.root.activeElement){let r=Vw(t.state,e.query.spec);r.valid&&t.dispatch({effects:oh.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[O0.of(!0),e?oh.of(Vw(t.state,e.query.spec)):we.appendConfig.of(zhe)]});return!0},s2=t=>{let e=t.state.field(Bs,!1);if(!e||!e.panel)return!1;let n=i0(t,y0);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:O0.of(!1)}),!0},Qhe=[{key:"Mod-f",run:i2,scope:"editor search-panel"},{key:"F3",run:eg,shift:tg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:eg,shift:tg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:s2,scope:"editor search-panel"},{key:"Mod-Shift-l",run:$he},{key:"Mod-Alt-g",run:dhe},{key:"Mod-d",run:vhe,preventDefault:!0}];class Lhe{constructor(e){this.view=e;let n=this.query=e.state.field(Bs).query.spec;this.commit=this.commit.bind(this),this.searchField=Ve("input",{value:n.search,placeholder:Xn(e,"Find"),"aria-label":Xn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ve("input",{value:n.replace,placeholder:Xn(e,"Replace"),"aria-label":Xn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ve("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ve("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ve("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return Ve("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Ve("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>eg(e),[Xn(e,"next")]),r("prev",()=>tg(e),[Xn(e,"previous")]),r("select",()=>Nhe(e),[Xn(e,"all")]),Ve("label",null,[this.caseField,Xn(e,"match case")]),Ve("label",null,[this.reField,Xn(e,"regexp")]),Ve("label",null,[this.wordField,Xn(e,"by word")]),...e.state.readOnly?[]:[Ve("br"),this.replaceField,r("replace",()=>RT(e),[Xn(e,"replace")]),r("replaceAll",()=>Mhe(e),[Xn(e,"replace all")])],Ve("button",{name:"close",onclick:()=>s2(e),"aria-label":Xn(e,"close"),type:"button"},["×"])])}commit(){let e=new e2({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:oh.of(e)}))}keydown(e){Dae(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?tg:eg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),RT(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(oh)&&!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(rc).top}}function Xn(t,e){return t.state.phrase(e)}const Vd=30,Hd=/[\s\.,:;?!]/;function b0(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-Vd),o=Math.min(i,n+Vd),a=t.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<Vd;l++)if(!Hd.test(a[l+1])&&Hd.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-Vd;l--)if(!Hd.test(a[l-1])&&Hd.test(a[l])){a=a.slice(0,l);break}}return re.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const Dhe=re.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"}}),zhe=[Bs,os.low(Rhe),Dhe];class w0{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=Je(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),s=i.search(a2(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}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 NT(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 jhe(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=NT(e)+NT(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function o2(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:jhe(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}function Bhe(t,e){return n=>{for(let r=Je(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 $T{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function $o(t){return t.selection.main.from}function a2(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const S0=_i.define();function Uhe(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return{...t.changeByRange(a=>{if(a!=i&&n!=r&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:l},range:B.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const MT=new WeakMap;function Zhe(t){if(!Array.isArray(t))return t;let e=MT.get(t);return e||MT.set(t,e=o2(t)),e}const ng=we.define(),ah=we.define();class Fhe{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=In(e,n),i=di(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push(In(o==s?s.toLowerCase():o,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:s,byWord:o}=this;if(n.length==1){let O=In(e,0),w=di(O),k=w==e.length?0:-100;if(O!=n[0])if(O==r[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let O=0,w=Math.min(e.length,200);O<w&&c<l;){let k=In(e,O);(k==n[c]||k==r[c])&&(i[c++]=O),O+=di(k)}if(c<l)return null}let u=0,h=0,d=!1,f=0,p=-1,g=-1,b=/[a-z]/.test(e),m=!0;for(let O=0,w=Math.min(e.length,200),k=0;O<w&&h<l;){let x=In(e,O);a<0&&(u<l&&x==n[u]&&(s[u++]=O),f<l&&(x==n[f]||x==r[f]?(f==0&&(p=O),g=O+1,f++):f=0));let S,T=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(S=jv(x))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!O||T==1&&b||k==0&&T!=0)&&(n[h]==x||r[h]==x&&(d=!0)?o[h++]=O:o.length&&(m=!1)),k=T,O+=di(x)}return h==l&&o[0]==0&&m?this.result(-100+(d?-200:0),o,e):f==l&&p==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):f==l?this.ret(-900-e.length,[p,g]):h==l?this.result(-100+(d?-200:0)+-700+(m?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let a=o+(this.astral?di(In(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class Xhe{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 jt=ae.define({combine(t){return Ti(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:Whe,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=>QT(e(r),n(r)),optionClass:(e,n)=>r=>QT(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function QT(t,e){return t?e?t+" "+e:t:e}function Whe(t,e,n,r,i,s){let o=t.textDirection==Ge.RTL,a=o,l=!1,c="top",u,h,d=e.left-i.left,f=i.right-e.right,p=r.right-r.left,g=r.bottom-r.top;if(a&&d<Math.min(p,f)?a=!1:!a&&f<Math.min(p,d)&&(a=!0),p<=(a?d:f))u=Math.max(i.top,Math.min(n.top,i.bottom-g))-e.top,h=Math.min(400,a?d:f);else{l=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let O=i.bottom-e.bottom;O>=g||O>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let b=(e.bottom-e.top)/s.offsetHeight,m=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/b}px; max-width: ${h/m}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const k0=we.define();function Vhe(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,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(u,h))),d.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},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 ey(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 Hhe{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:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,a=e.state.facet(jt);this.optionContent=Vhe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=ey(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}if(l.target==this.list){let u=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;u!=null&&(e.dispatch({effects:k0.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(jt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:ah.of(null)})}),this.showOptions(s,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:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=ey(s.length,o,e.state.facet(jt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}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=ey(n.options.length,n.selected,this.view.state.facet(jt).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:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>Mn(this.view.state,a,"completion info")):(this.addInfoPane(o,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:s}=e;r.appendChild(i),this.infoDestroy=s||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&&qhe(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(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(jt).positionInfo(this.view,n,i,r,s,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",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=s&&(o>r.from||r.from==0))if(s=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let f=i.appendChild(document.createElement("completion-section"));f.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let d of this.optionContent){let f=d(a,this.view.state,this.view,l);f&&u.appendChild(f)}}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 Yhe(t,e){return n=>new Hhe(n,t,e)}function qhe(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 LT(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Ghe(t,e){let n=[],r=null,i=null,s=u=>{n.push(u);let{section:h}=u.completion;if(h){r||(r=[]);let d=typeof h=="string"?h:h.name;r.some(f=>f.name==d)||r.push(typeof h=="string"?{name:d}:h)}},o=e.facet(jt);for(let u of t)if(u.hasResult()){let h=u.result.getMatch;if(u.result.filter===!1)for(let d of u.result.options)s(new $T(d,u.source,h?h(d):[],1e9-n.length));else{let d=e.sliceDoc(u.from,u.to),f,p=o.filterStrict?new Xhe(d):new Fhe(d);for(let g of u.result.options)if(f=p.match(g.label)){let b=g.displayLabel?h?h(g,f.matched):[]:f.matched,m=f.score+(g.boost||0);if(s(new $T(g,u.source,b,m)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:O}=g.section;i||(i=Object.create(null)),i[O]=Math.max(m,i[O]||-1e9)}}}}if(r){let u=Object.create(null),h=0,d=(f,p)=>(f.rank==="dynamic"&&p.rank==="dynamic"?i[p.name]-i[f.name]:0)||(typeof f.rank=="number"?f.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(f.name<p.name?-1:1);for(let f of r.sort(d))h-=1e5,u[f.name]=h;for(let f of n){let{section:p}=f.completion;p&&(f.score+=u[typeof p=="string"?p:p.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((h,d)=>d.score-h.score||c(h.completion,d.completion))){let h=u.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(u):LT(u.completion)>LT(l)&&(a[a.length-1]=u),l=u.completion}return a}class za{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new za(this.options,DT(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=Ghe(e,n);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(jt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new za(a,DT(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:rde,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new za(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new za(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class rg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new rg(tde,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(jt),s=(r.override||n.languageDataAt("autocomplete",$o(n)).map(Zhe)).map(l=>(this.active.find(u=>u.source==l)||new Sr(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let o=this.open,a=e.effects.some(l=>l.is(v0));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Khe(s,this.active)||a?o=za.build(s,n,this.id,o,r,a):o&&o.disabled&&!s.some(l=>l.isPending)&&(o=null),!o&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Sr(l.source,0):l));for(let l of e.effects)l.is(k0)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new rg(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Jhe:ede}}function Khe(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,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const Jhe={"aria-autocomplete":"list"},ede={};function DT(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const tde=[];function l2(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(S0);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 Sr{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=l2(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new Sr(i.source,0)),r&4&&i.state==0&&(i=new Sr(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(ng))i=new Sr(i.source,1,s.value);else if(s.is(ah))i=new Sr(i.source,0);else if(s.is(v0))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange($o(e.state))}}class ll extends Sr{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}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 s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=$o(e.state);if(a>o||!i||n&2&&($o(e.startState)==this.from||a<this.limit))return new Sr(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return nde(i.validFor,e.state,s,o)?new ll(this.source,this.explicit,l,i,s,o):i.update&&(i=i.update(i,s,o,new w0(e.state,a,!1)))?new ll(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:$o(e.state)):new Sr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new ll(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Sr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function nde(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):a2(t,!0).test(i)}const v0=we.define({map(t,e){return t.map(n=>n.map(e))}}),Rn=Gt.define({create(){return rg.start()},update(t,e){return t.update(e)},provide:t=>[r0.from(t,e=>e.tooltip),re.contentAttributes.from(t,e=>e.attrs)]});function x0(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Rn).active.find(i=>i.source==e.source);return r instanceof ll?(typeof n=="string"?t.dispatch({...Uhe(t.state,n,r.from,r.to),annotations:S0.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const rde=Yhe(Rn,x0);function Yd(t,e="option"){return n=>{let r=n.state.field(Rn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(jt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=jL(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:k0.of(a)}),!0}}const ide=t=>{let e=t.state.field(Rn,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(jt).interactionDelay?!1:x0(t,e.open.options[e.open.selected])},ty=t=>t.state.field(Rn,!1)?(t.dispatch({effects:ng.of(!0)}),!0):!1,sde=t=>{let e=t.state.field(Rn,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:ah.of(null)}),!0)};class ode{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const ade=50,lde=1e3,cde=kt.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(Rn).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Rn),n=t.state.facet(jt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Rn)==e)return;let r=t.transactions.some(s=>{let o=l2(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>ade&&Date.now()-o.time>lde){for(let a of o.context.abortListeners)try{a()}catch(l){Mn(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(ng)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Rn);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(jt).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=$o(e),r=new w0(e,n,t.explicit,this.view),i=new ode(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:ah.of(null)}),Mn(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(jt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(jt),r=this.view.state.field(Rn);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let a=$o(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(a,s.done.from+(s.active.explicit?0:1)),c=new ll(s.active.source,s.active.explicit,l,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:a);for(let u of s.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new Sr(s.active.source,0);for(let l of s.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:v0.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Rn,!1);if(e&&e.tooltip&&this.view.state.facet(jt).closeOnBlur){let n=e.open&&jL(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ah.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ng.of(!1)}),20),this.composing=0}}}),ude=typeof navigator=="object"&&/Win/.test(navigator.platform),hde=os.highest(re.domEventHandlers({keydown(t,e){let n=e.state.field(Rn,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(ude&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&x0(e,r),!1}})),c2=re.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 dde{constructor(e,n,r,i){this.field=e,this.line=n,this.from=r,this.to=i}}class C0{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Vt.TrackDel),r=e.mapPos(this.to,1,Vt.TrackDel);return n==null||r==null?null:new C0(this.field,n,r)}}class E0{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],i=[n],s=e.doc.lineAt(n),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let h=0;h<u;h++)c+=e.facet(ec);i.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new C0(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1,u=l.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h<n.length;h++)(a!=null?n[h].seq==a:u&&n[h].name==u)&&(c=h);if(c<0){let h=0;for(;h<n.length&&(a==null||n[h].seq!=null&&n[h].seq<a);)h++;n.splice(h,0,{seq:a,name:u}),c=h;for(let d of i)d.field>=c&&d.field++}for(let h of i)if(h.line==r.length&&h.from>s.index){let d=s[2]?3+(s[1]||"").length:2;h.from-=d,h.to-=d}i.push(new dde(c,r.length,s.index,s.index+u.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(o)}return new E0(r,i)}}let fde=pe.widget({widget:new class extends qr{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),pde=pe.mark({class:"cm-snippetField"});class ic{constructor(e,n){this.ranges=e,this.active=n,this.deco=pe.set(e.map(r=>(r.from==r.to?fde:pde).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 ic(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 jh=we.define({map(t,e){return t&&t.map(e)}}),gde=we.define(),lh=Gt.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(jh))return n.value;if(n.is(gde)&&t)return new ic(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=>re.decorations.from(t,e=>e?e.deco:pe.none)});function _0(t,e){return B.create(t.filter(n=>n.field==e).map(n=>B.range(n.from,n.to)))}function mde(t){let e=E0.parse(t);return(n,r,i,s)=>{let{text:o,ranges:a}=e.instantiate(n.state,i),{main:l}=n.state.selection,c={changes:{from:i,to:s==l.from?l.to:s,insert:Re.of(o)},scrollIntoView:!0,annotations:r?[S0.of(r),Pt.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=_0(a,0)),a.some(u=>u.field>0)){let u=new ic(a,0),h=c.effects=[jh.of(u)];n.state.field(lh,!1)===void 0&&h.push(we.appendConfig.of([lh,Sde,kde,c2]))}n.dispatch(n.state.update(c))}}function u2(t){return({state:e,dispatch:n})=>{let r=e.field(lh,!1);if(!r||t<0&&r.active==0)return!1;let i=r.active+t,s=t>0&&!r.ranges.some(o=>o.field==i+t);return n(e.update({selection:_0(r.ranges,i),effects:jh.of(s?null:new ic(r.ranges,i)),scrollIntoView:!0})),!0}}const Ode=({state:t,dispatch:e})=>t.field(lh,!1)?(e(t.update({effects:jh.of(null)})),!0):!1,yde=u2(1),bde=u2(-1),wde=[{key:"Tab",run:yde,shift:bde},{key:"Escape",run:Ode}],zT=ae.define({combine(t){return t.length?t[0]:wde}}),Sde=os.highest(Kl.compute([zT],t=>t.facet(zT)));function Tn(t,e){return{...e,apply:mde(t)}}const kde=re.domEventHandlers({mousedown(t,e){let n=e.state.field(lh,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(e.dispatch({selection:_0(n.ranges,i.field),effects:jh.of(n.ranges.some(s=>s.field>i.field)?new ic(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),ch={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},To=we.define({map(t,e){let n=e.mapPos(t,-1,Vt.TrackAfter);return n??void 0}}),T0=new class extends Vs{};T0.startSide=1;T0.endSide=-1;const h2=Gt.define({create(){return Ce.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(To)&&(t=t.update({add:[T0.range(n.value,n.value+1)]}));return t}});function vde(){return[Cde,h2]}const ny="()[]{}<>«»»«[]{}";function d2(t){for(let e=0;e<ny.length;e+=2)if(ny.charCodeAt(e)==t)return ny.charAt(e+1);return jv(t<128?t:t+1)}function f2(t,e){return t.languageDataAt("closeBrackets",e)[0]||ch}const xde=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Cde=re.inputHandler.of((t,e,n,r)=>{if((xde?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&di(In(r,0))==1||e!=i.from||n!=i.to)return!1;let s=Tde(t.state,r);return s?(t.dispatch(s),!0):!1}),Ede=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=f2(t,t.selection.main.head).brackets||ch.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=Ade(t.doc,o.head);for(let l of r)if(l==a&&km(t.doc,o.head)==d2(In(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:B.cursor(o.head-l.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},_de=[{key:"Backspace",run:Ede}];function Tde(t,e){let n=f2(t,t.selection.main.head),r=n.brackets||ch.brackets;for(let i of r){let s=d2(In(i,0));if(e==i)return s==i?Rde(t,i,r.indexOf(i+i+i)>-1,n):Pde(t,i,s,n.before||ch.before);if(e==s&&p2(t,t.selection.main.from))return Ide(t,i,s)}return null}function p2(t,e){let n=!1;return t.field(h2).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function km(t,e){let n=t.sliceString(e,e+2);return n.slice(0,di(In(n,0)))}function Ade(t,e){let n=t.sliceString(e-2,e);return di(In(n,0))==n.length?n:n.slice(1)}function Pde(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:To.of(o.to+e.length),range:B.range(o.anchor+e.length,o.head+e.length)};let a=km(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:To.of(o.head+e.length),range:B.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ide(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&km(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:B.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Rde(t,e,n,r){let i=r.stringPrefixes||ch.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:To.of(a.to+e.length),range:B.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=km(t.doc,l),u;if(c==e){if(jT(t,l))return{changes:{insert:e+e,from:l},effects:To.of(l+e.length),range:B.cursor(l+e.length)};if(p2(t,l)){let d=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:B.cursor(l+d.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=BT(t,l-2*e.length,i))>-1&&jT(t,u))return{changes:{insert:e+e+e+e,from:l},effects:To.of(l+e.length),range:B.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=lt.Word&&BT(t,l,i)>-1&&!Nde(t,l,e,i))return{changes:{insert:e+e,from:l},effects:To.of(l+e.length),range:B.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function jT(t,e){let n=Je(t).resolveInner(e+1);return n.parent&&n.from==e}function Nde(t,e,n,r){let i=Je(t).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+l;){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 BT(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=lt.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=lt.Word)return s}return-1}function $de(t={}){return[hde,Rn,jt.of(t),cde,Mde,c2]}const g2=[{key:"Ctrl-Space",run:ty},{mac:"Alt-`",run:ty},{mac:"Alt-i",run:ty},{key:"Escape",run:sde},{key:"ArrowDown",run:Yd(!0)},{key:"ArrowUp",run:Yd(!1)},{key:"PageDown",run:Yd(!0,"page")},{key:"PageUp",run:Yd(!1,"page")},{key:"Enter",run:ide}],Mde=os.highest(Kl.computeN([jt],t=>t.facet(jt).defaultKeymap?[g2]:[]));class UT{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class bo{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(uh).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((f,p)=>f.from-p.from||f.to-p.to),o=new Ji,a=[],l=0,c=r.doc.iter(),u=0,h=r.doc.length;for(let f=0;;){let p=f==s.length?null:s[f];if(!p&&!a.length)break;let g,b;if(a.length)g=l,b=a.reduce((w,k)=>Math.min(w,k.to),p&&p.from>g?p.from:1e8);else{if(g=p.from,g>h)break;b=p.to,a.push(p),f++}for(;f<s.length;){let w=s[f];if(w.from==g&&(w.to>w.from||w.to==g))a.push(w),f++,b=Math.min(w.to,b);else{b=Math.min(w.from,b);break}}b=Math.min(b,h);let m=!1;if(a.some(w=>w.from==g&&(w.to==b||b==h))&&(m=g==b,!m&&b-g<10)){let w=g-(u+c.value.length);w>0&&(c.next(w),u=g);for(let k=g;;){if(k>=b){m=!0;break}if(!c.lineBreak&&u+c.value.length>k)break;k=u+c.value.length,u+=c.value.length,c.next()}}let O=Hde(a);if(m)o.add(g,g,pe.widget({widget:new Fde(O),diagnostics:a.slice()}));else{let w=a.reduce((k,x)=>x.markClass?k+" "+x.markClass:k,"");o.add(g,b,pe.mark({class:"cm-lintRange cm-lintRange-"+O+w,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>b)}))}if(l=b,l==h)break;for(let w=0;w<a.length;w++)a[w].to<=l&&a.splice(w--,1)}let d=o.finish();return new bo(d,n,Js(d))}}function Js(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new UT(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new UT(r.from,s,r.diagnostic)}}),r}function Qde(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(uh).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(m2))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function Lde(t,e){return t.field(nr,!1)?e:e.concat(we.appendConfig.of(Yde))}const m2=we.define(),A0=we.define(),O2=we.define(),nr=Gt.define({create(){return new bo(pe.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 s=e.changes.mapPos(t.selected.from,1);r=Js(n,t.selected.diagnostic,s)||Js(n,null,s)}!n.size&&i&&e.state.facet(uh).autoPanel&&(i=null),t=new bo(n,i,r)}for(let n of e.effects)if(n.is(m2)){let r=e.state.facet(uh).autoPanel?n.value.length?hh.open:null:t.panel;t=bo.init(n.value,r,e.state)}else n.is(A0)?t=new bo(t.diagnostics,n.value?hh.open:null,t.selected):n.is(O2)&&(t=new bo(t.diagnostics,t.panel,n.value));return t},provide:t=>[eh.from(t,e=>e.panel),re.decorations.from(t,e=>e.diagnostics)]}),Dde=pe.mark({class:"cm-lintRange cm-lintRange-active"});function zde(t,e,n){let{diagnostics:r}=t.state.field(nr),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return i=u.diagnostics,s=l,o=c,!1});let a=t.state.facet(uh).tooltipFilter;return i&&a&&(i=a(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:jde(t,i)}}}:null}function jde(t,e){return Ve("ul",{class:"cm-tooltip-lint"},e.map(n=>b2(t,n,!1)))}const Bde=t=>{let e=t.state.field(nr,!1);(!e||!e.panel)&&t.dispatch({effects:Lde(t.state,[A0.of(!0)])});let n=i0(t,hh.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},ZT=t=>{let e=t.state.field(nr,!1);return!e||!e.panel?!1:(t.dispatch({effects:A0.of(!1)}),!0)},Ude=t=>{let e=t.state.field(nr,!1);if(!e)return!1;let n=t.state.selection.main,r=Js(e.diagnostics,null,n.to+1);return!r&&(r=Js(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}),_le(t,r.from,1,{tooltip:w2,until:i=>i.docChanged||i.newSelection.main.head<r.from||i.newSelection.main.head>r.to}),!0)},Zde=[{key:"Mod-Shift-m",run:Bde,preventDefault:!0},{key:"F8",run:Ude}],uh=ae.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Ti(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:FT,tooltipFilter:FT,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function FT(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function y2(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(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function b2(t,e,n){var r;let i=n?y2(e.actions):[];return Ve("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ve("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let p=Js(t.state.field(nr).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),Ve("u",c.slice(u,u+1)),c.slice(u+1)],d=s.markClass?" "+s.markClass:"";return Ve("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&Ve("div",{class:"cm-diagnosticSource"},e.source))}class Fde extends qr{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ve("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class XT{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=b2(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class hh{constructor(e){this.view=e,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)ZT(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:s}=this.items[this.selectedIndex],o=y2(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=Js(this.view.state.field(nr).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()}},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=Ve("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Ve("div",{class:"cm-panel-lint"},this.list,Ve("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>ZT(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(nr).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(nr),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let h=-1,d;for(let f=r;f<this.items.length;f++)if(this.items[f].diagnostic==u){h=f;break}h<0?(d=new XT(this.view,u),this.items.splice(r,0,d),i=!0):(d=this.items[h],h>r&&(this.items.splice(r,h-r),i=!0)),n&&d.diagnostic==n.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),s=d):d.dom.hasAttribute("aria-selected")&&d.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 XT(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.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(nr),r=Js(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:O2.of(r)})}static open(e){return new hh(e)}}function Xde(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 qd(t){return Xde(`<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 Wde=re.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:qd("#f11")},".cm-lintRange-warning":{backgroundImage:qd("orange")},".cm-lintRange-info":{backgroundImage:qd("#999")},".cm-lintRange-hint":{backgroundImage:qd("#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 Vde(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Hde(t){let e="hint",n=1;for(let r of t){let i=Vde(r.severity);i>n&&(n=i,e=r.severity)}return e}const w2=Ele(zde,{hideOn:Qde}),Yde=[nr,re.decorations.compute([nr],t=>{let{selected:e,panel:n}=t.field(nr);return!e||!n||e.from==e.to?pe.none:pe.set([Dde.range(e.from,e.to)])}),w2,Wde];var WT=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(_de)),e.defaultKeymap!==!1&&(r=r.concat(che)),e.searchKeymap!==!1&&(r=r.concat(Qhe)),e.historyKeymap!==!1&&(r=r.concat(mue)),e.foldKeymap!==!1&&(r=r.concat(Ice)),e.completionKeymap!==!1&&(r=r.concat(g2)),e.lintKeymap!==!1&&(r=r.concat(Zde));var i=[];return e.lineNumbers!==!1&&i.push(jle()),e.highlightActiveLineGutter!==!1&&i.push(Zle()),e.highlightSpecialChars!==!1&&i.push(tle()),e.history!==!1&&i.push(aue()),e.foldGutter!==!1&&i.push(Mce()),e.drawSelection!==!1&&i.push(Fae()),e.dropCursor!==!1&&i.push(Yae()),e.allowMultipleSelections!==!1&&i.push(Te.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(vce()),e.syntaxHighlighting!==!1&&i.push(fD(zce,{fallback:!0})),e.bracketMatching!==!1&&i.push(Wce()),e.closeBrackets!==!1&&i.push(vde()),e.autocompletion!==!1&&i.push($de()),e.rectangularSelection!==!1&&i.push(gle()),n!==!1&&i.push(yle()),e.highlightActiveLine!==!1&&i.push(ale()),e.highlightSelectionMatches!==!1&&i.push(ghe()),e.tabSize&&typeof e.tabSize=="number"&&i.push(ec.of(" ".repeat(e.tabSize))),i.concat([Kl.of(r.flat())]).filter(Boolean)};const qde="#e5c07b",VT="#e06c75",Gde="#56b6c2",Kde="#ffffff",_f="#abb2bf",Hw="#7d8799",Jde="#61afef",efe="#98c379",HT="#d19a66",tfe="#c678dd",nfe="#21252b",YT="#2c313a",qT="#282c34",ry="#353a42",rfe="#3E4451",GT="#528bff",ife=re.theme({"&":{color:_f,backgroundColor:qT},".cm-content":{caretColor:GT},".cm-cursor, .cm-dropCursor":{borderLeftColor:GT},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:rfe},".cm-panels":{backgroundColor:nfe,color:_f},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:qT,color:Hw,border:"none"},".cm-activeLineGutter":{backgroundColor:YT},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ry},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ry,borderBottomColor:ry},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:YT,color:_f}}},{dark:!0}),sfe=Lh.define([{tag:_.keyword,color:tfe},{tag:[_.name,_.deleted,_.character,_.propertyName,_.macroName],color:VT},{tag:[_.function(_.variableName),_.labelName],color:Jde},{tag:[_.color,_.constant(_.name),_.standard(_.name)],color:HT},{tag:[_.definition(_.name),_.separator],color:_f},{tag:[_.typeName,_.className,_.number,_.changed,_.annotation,_.modifier,_.self,_.namespace],color:qde},{tag:[_.operator,_.operatorKeyword,_.url,_.escape,_.regexp,_.link,_.special(_.string)],color:Gde},{tag:[_.meta,_.comment],color:Hw},{tag:_.strong,fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.link,color:Hw,textDecoration:"underline"},{tag:_.heading,fontWeight:"bold",color:VT},{tag:[_.atom,_.bool,_.special(_.variableName)],color:HT},{tag:[_.processingInstruction,_.string,_.inserted],color:efe},{tag:_.invalid,color:Kde}]),ofe=[ife,fD(sfe)];var afe=re.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),lfe=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(n&&l.unshift(Kl.of([uhe])),a&&(typeof a=="boolean"?l.unshift(WT()):l.unshift(WT(a))),o&&l.unshift(hle(o)),s){case"light":l.push(afe);break;case"dark":l.push(ofe);break;case"none":break;default:l.push(s);break}return r===!1&&l.push(re.editable.of(!1)),i&&l.push(Te.readOnly.of(!0)),[...l]},cfe=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class ufe{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class KT{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var iy=null,hfe=()=>typeof window>"u"?new KT:(iy||(iy=new KT),iy),JT=_i.define(),dfe=200,ffe=[];function pfe(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=ffe,autoFocus:l,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:f=null,minWidth:p=null,maxWidth:g=null,placeholder:b="",editable:m=!0,readOnly:O=!1,indentWithTab:w=!0,basicSetup:k=!0,root:x,initialState:S}=t,[T,P]=A.useState(),[Q,E]=A.useState(),[M,L]=A.useState(),H=A.useState(()=>({current:null}))[0],Y=A.useState(()=>({current:null}))[0],z=re.theme({"&":{height:u,minHeight:h,maxHeight:d,width:f,minWidth:p,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),$=re.updateListener.of(D=>{if(D.docChanged&&typeof r=="function"&&!D.transactions.some(W=>W.annotation(JT))){H.current?H.current.reset():(H.current=new ufe(()=>{if(Y.current){var W=Y.current;Y.current=null,W()}H.current=null},dfe),hfe().add(H.current));var C=D.state.doc,F=C.toString();r(F,D)}i&&i(cfe(D))}),Z=lfe({theme:c,editable:m,readOnly:O,placeholder:b,indentWithTab:w,basicSetup:k}),I=[$,z,...Z];return o&&typeof o=="function"&&I.push(re.updateListener.of(o)),I=I.concat(a),A.useLayoutEffect(()=>{if(T&&!M){var D={doc:e,selection:n,extensions:I},C=S?Te.fromJSON(S.json,D,S.fields):Te.create(D);if(L(C),!Q){var F=new re({state:C,parent:T,root:x});E(F),s&&s(F,C)}}return()=>{Q&&(L(void 0),E(void 0))}},[T,M]),A.useEffect(()=>{t.container&&P(t.container)},[t.container]),A.useEffect(()=>()=>{Q&&(Q.destroy(),E(void 0)),H.current&&(H.current.cancel(),H.current=null)},[Q]),A.useEffect(()=>{l&&Q&&Q.focus()},[l,Q]),A.useEffect(()=>{Q&&Q.dispatch({effects:we.reconfigure.of(I)})},[c,a,u,h,d,f,p,g,b,m,O,w,k,r,o]),A.useEffect(()=>{if(e!==void 0){var D=Q?Q.state.doc.toString():"";if(Q&&e!==D){var C=H.current&&!H.current.isDone,F=()=>{Q&&e!==Q.state.doc.toString()&&Q.dispatch({changes:{from:0,to:Q.state.doc.toString().length,insert:e||""},annotations:[JT.of(!0)]})};C?Y.current=F:F()}}},[e,Q]),{state:M,setState:L,view:Q,setView:E,container:T,setContainer:P}}var gfe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],S2=A.forwardRef((t,e)=>{var{className:n,value:r="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:f,maxHeight:p,width:g,minWidth:b,maxWidth:m,basicSetup:O,placeholder:w,indentWithTab:k,editable:x,readOnly:S,root:T,initialState:P}=t,Q=Rse(t,gfe),E=A.useRef(null),{state:M,view:L,container:H,setContainer:Y}=pfe({root:T,value:r,autoFocus:u,theme:h,height:d,minHeight:f,maxHeight:p,width:g,minWidth:b,maxWidth:m,basicSetup:O,placeholder:w,indentWithTab:k,editable:x,readOnly:S,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:P});A.useImperativeHandle(e,()=>({editor:E.current,state:M,view:L}),[E,H,M,L]);var z=A.useCallback(Z=>{E.current=Z,Y(Z)},[Y]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var $=typeof h=="string"?"cm-theme-"+h:"cm-theme";return y.jsx("div",tw({ref:z,className:""+$+(n?" "+n:"")},Q))});S2.displayName="CodeMirror";class ig{static create(e,n,r,i,s){let o=i+(i<<8)+e+(n<<4)|0;return new ig(e,n,r,o,s,[],[])}constructor(e,n,r,i,s,o,a){this.type=e,this.value=n,this.from=r,this.hash=i,this.end=s,this.children=o,this.positions=a,this.hashProp=[[Se.contextHash,i]]}addChild(e,n){e.prop(Se.contextHash)!=this.hash&&(e=new De(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 De(e.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,o)=>new De(Qt.none,i,s,o,this.hashProp)})}}var ee;(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"})(ee||(ee={}));class mfe{constructor(e,n){this.start=e,this.content=n,this.marks=[],this.parsers=[]}}class Ofe{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 hu(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 eA(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==ee.OrderedList?R0:I0)(n,e,!1);return r>0&&(t.type!=ee.BulletList||P0(n,e,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==t.value}const k2={[ee.Blockquote](t,e,n){return n.next!=62?!1:(n.markers.push(Ie(ee.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(Tr(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0)},[ee.ListItem](t,e,n){return n.indent<n.baseIndent+t.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+t.value),!0)},[ee.OrderedList]:eA,[ee.BulletList]:eA,[ee.Document](){return!0}};function Tr(t){return t==32||t==9||t==10||t==13}function hu(t,e=0){for(;e<t.length&&Tr(t.charCodeAt(e));)e++;return e}function tA(t,e,n){for(;e>n&&Tr(t.charCodeAt(e-1));)e--;return e}function v2(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 x2(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function P0(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 s=t.text.charCodeAt(i);if(s==t.next)r++;else if(!Tr(s))return-1}return n&&t.next==45&&_2(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(I2.SetextHeading)>-1||r<3?-1:1}function C2(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function I0(t,e,n){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||Tr(t.text.charCodeAt(t.pos+1)))&&(!n||C2(e,ee.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function R0(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&&!Tr(t.text.charCodeAt(r+1))||n&&!C2(e,ee.OrderedList)&&(t.skipSpace(r+1)==t.text.length||r>t.pos+1||t.next!=49)?-1:r+1-t.pos}function E2(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 _2(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&&Tr(t.text.charCodeAt(e));)e++;return e==t.text.length?n:-1}const Yw=/^[ \t]*$/,T2=/-->/,A2=/\?>/,qw=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,T2],[/^\s*<\?/,A2],[/^\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,Yw],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Yw]];function P2(t,e,n){if(t.next!=60)return-1;let r=t.text.slice(t.pos);for(let i=0,s=qw.length-(n?1:0);i<s;i++)if(qw[i][0].test(r))return i;return-1}function nA(t,e){let n=t.countIndent(e,t.pos,t.indent),r=t.countIndent(t.skipSpace(e),e,n);return r>=n+5?n+1:r}function us(t,e,n){let r=t.length-1;r>=0&&t[r].to==e&&t[r].type==ee.CodeText?t[r].to=n:t.push(Ie(ee.CodeText,e,n))}const Gd={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,s=t.lineStart+e.text.length,o=[],a=[];for(us(o,i,s);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){us(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<n)break;{if(a.length){for(let c of a)c.type==ee.CodeText?us(o,c.from,c.to):o.push(c);a=[]}us(o,t.lineStart-1,t.lineStart);for(let c of e.markers)o.push(c);s=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<s&&us(o,l,s)}}return a.length&&(a=a.filter(l=>l.type!=ee.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-i).finish(ee.CodeBlock,s-i),i),!0},FencedCode(t,e){let n=v2(e);if(n<0)return!1;let r=t.lineStart+e.pos,i=e.next,s=n-e.pos,o=e.skipSpace(n),a=tA(e.text,e.text.length,o),l=[Ie(ee.CodeMark,r,r+s)];o<a&&l.push(Ie(ee.CodeInfo,t.lineStart+o,t.lineStart+a));for(let c=!0,u=!0,h=!1;t.nextLine()&&e.depth>=t.stack.length;c=!1){let d=e.pos;if(e.indent-e.baseIndent<4)for(;d<e.text.length&&e.text.charCodeAt(d)==i;)d++;if(d-e.pos>=s&&e.skipSpace(d)==e.text.length){for(let f of e.markers)l.push(f);u&&h&&us(l,t.lineStart-1,t.lineStart),l.push(Ie(ee.CodeMark,t.lineStart+e.pos,t.lineStart+d)),t.nextLine();break}else{h=!0,c||(us(l,t.lineStart-1,t.lineStart),u=!1);for(let g of e.markers)l.push(g);let f=t.lineStart+e.basePos,p=t.lineStart+e.text.length;f<p&&(us(l,f,p),u=!1)}}return t.addNode(t.buffer.writeElements(l,-r).finish(ee.FencedCode,t.prevLineEnd()-r),r),!0},Blockquote(t,e){let n=x2(e);return n<0?!1:(t.startContext(ee.Blockquote,e.pos),t.addNode(ee.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+n),null)},HorizontalRule(t,e){if(P0(e,t,!1)<0)return!1;let n=t.lineStart+e.pos;return t.nextLine(),t.addNode(ee.HorizontalRule,n),!0},BulletList(t,e){let n=I0(e,t,!1);if(n<0)return!1;t.block.type!=ee.BulletList&&t.startContext(ee.BulletList,e.basePos,e.next);let r=nA(e,e.pos+1);return t.startContext(ee.ListItem,e.basePos,r-e.baseIndent),t.addNode(ee.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(r),null},OrderedList(t,e){let n=R0(e,t,!1);if(n<0)return!1;t.block.type!=ee.OrderedList&&t.startContext(ee.OrderedList,e.basePos,e.text.charCodeAt(e.pos+n-1));let r=nA(e,e.pos+n);return t.startContext(ee.ListItem,e.basePos,r-e.baseIndent),t.addNode(ee.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(r),null},ATXHeading(t,e){let n=E2(e);if(n<0)return!1;let r=e.pos,i=t.lineStart+r,s=tA(e.text,e.text.length,r),o=s;for(;o>r&&e.text.charCodeAt(o-1)==e.next;)o--;(o==s||o==r||!Tr(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(ee.HeaderMark,0,n).writeElements(t.parser.parseInline(e.text.slice(r+n+1,o),i+n+1),-i);o<e.text.length&&a.write(ee.HeaderMark,o-r,s-r);let l=a.finish(ee.ATXHeading1-1+n,e.text.length-r);return t.nextLine(),t.addNode(l,i),!0},HTMLBlock(t,e){let n=P2(e,t,!1);if(n<0)return!1;let r=t.lineStart+e.pos,i=qw[n][1],s=[],o=i!=Yw;for(;!i.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let c of e.markers)s.push(c)}o&&t.nextLine();let a=i==T2?ee.CommentBlock:i==A2?ee.ProcessingInstructionBlock:ee.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(s,-r).finish(a,l-r),r),!0},SetextHeading:void 0};class yfe{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+`
|
|
202
202
|
`+n.scrub(),s=this.advance(i);return s>-1&&s<i.length?this.complete(e,r,s):!1}finish(e,n){return(this.stage==2||this.stage==3)&&hu(n.content,this.pos)==n.content.length?this.complete(e,n,n.content.length):!1}complete(e,n,r){return e.addLeafElement(n,Ie(ee.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(j2(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Ie(ee.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(D2(e,hu(e,this.pos),this.start)))return-1}else if(this.stage==2){let n=hu(e,this.pos),r=0;if(n>this.pos){let i=z2(e,n,this.start);if(i){let s=sy(e,i.to-this.start);s>0&&(this.nextStage(i),r=s)}}return r||(r=sy(e,this.pos)),r>0&&r<e.length?r:-1}else return sy(e,this.pos)}}}function sy(t,e){for(;e<t.length;e++){let n=t.charCodeAt(e);if(n==10)break;if(!Tr(n))return-1}return e}class bfe{nextLine(e,n,r){let i=n.depth<e.stack.length?-1:_2(n),s=n.next;if(i<0)return!1;let o=Ie(ee.HeaderMark,e.lineStart+n.pos,e.lineStart+i);return e.nextLine(),e.addLeafElement(r,Ie(s==61?ee.SetextHeading1:ee.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}}const I2={LinkReference(t,e){return e.content.charCodeAt(0)==91?new yfe(e):null},SetextHeading(){return new bfe}},wfe=[(t,e)=>E2(e)>=0,(t,e)=>v2(e)>=0,(t,e)=>x2(e)>=0,(t,e)=>I0(e,t,!0)>=0,(t,e)=>R0(e,t,!0)>=0,(t,e)=>P0(e,t,!0)>=0,(t,e)=>P2(e,t,!0)>=0],Sfe={text:"",end:0};class kfe{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.line=new Ofe,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=ig.create(ee.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new Cfe(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 s=e.markers[r++];this.addNode(s.type,s.from,s.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}let n=new mfe(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+=`
|
|
203
203
|
`+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=B2(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=Sfe;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 s=this.ranges[i].from,o=this.lineChunkAt(s);n.end=s+o.length,n.text=n.text.slice(0,this.ranges[i-1].to-r)+o,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],s=this.parser.skipContextMarkup[i.type];if(!s)throw new Error("Unhandled block context "+ee[i.type]);let o=this.line.markers.length;if(!s(i,this,e)){this.line.markers.length>o&&(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==`
|
|
@@ -216,4 +216,4 @@ Try sending your message again.`,i)}finally{w(!1)}}function te(q){q.key==="Enter
|
|
|
216
216
|
\${}
|
|
217
217
|
}
|
|
218
218
|
}`,{label:"class",detail:"definition",type:"keyword"}),Tn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Tn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Vge=lz.concat([Tn("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Tn("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Tn("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),NA=new qL,cz=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Pc(t){return(e,n)=>{let r=e.node.getChild("VariableDefinition");return r&&n(r,t),!0}}const Hge=["FunctionDeclaration"],Yge={FunctionDeclaration:Pc("function"),ClassDeclaration:Pc("class"),ClassExpression:()=>!0,EnumDeclaration:Pc("constant"),TypeAliasDeclaration:Pc("type"),NamespaceDeclaration:Pc("namespace"),VariableDefinition(t,e){t.matchContext(Hge)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function uz(t,e){let n=NA.get(e);if(n)return n;let r=[],i=!0;function s(o,a){let l=t.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(je.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=Yge[o.name];if(a&&a(o,s)||cz.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of uz(t,o.node))r.push(a);return!1}}),NA.set(e,r),r}const $A=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,hz=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function qge(t){let e=Je(t.state).resolveInner(t.pos,-1);if(hz.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&$A.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let i=e;i;i=i.parent)cz.has(i.name)&&(r=r.concat(uz(t.state.doc,i)));return{options:r,from:n?e.from:t.pos,validFor:$A}}const vi=Il.define({name:"javascript",parser:Wge.configure({props:[Mh.add({IfStatement:Ef({except:/^\s*({|else\b)/}),TryStatement:Ef({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Sce,SwitchBody:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:r?1:2)*t.unit},Block:wce({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Ef({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),tc.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":iD,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let n=t.lastChild;return{from:e.to,to:n.type.isError?t.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let n=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,r=t.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?t.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),dz={test:t=>/^JSX/.test(t.name),facet:c0({commentTokens:{block:{open:"{/*",close:"*/}"}}})},fz=vi.configure({dialect:"ts"},"typescript"),pz=vi.configure({dialect:"jsx",props:[u0.add(t=>t.isTop?[dz]:void 0)]}),gz=vi.configure({dialect:"jsx ts",props:[u0.add(t=>t.isTop?[dz]:void 0)]},"typescript");let mz=t=>({label:t,type:"keyword"});const Oz="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(mz),Gge=Oz.concat(["declare","implements","private","protected","public"].map(mz));function Kge(t={}){let e=t.jsx?t.typescript?gz:pz:t.typescript?fz:vi,n=t.typescript?Vge.concat(Gge):lz.concat(Oz);return new ih(e,[vi.data.of({autocomplete:Bhe(hz,o2(n))}),vi.data.of({autocomplete:qge}),t.jsx?tme:[]])}function Jge(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function MA(t,e,n=t.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return t.sliceString(r.from,Math.min(r.to,n));return""}const eme=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),tme=re.inputHandler.of((t,e,n,r,i)=>{if((eme?t.composing:t.compositionStarted)||t.state.readOnly||e!=n||r!=">"&&r!="/"||!vi.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:u}=l,h=Je(o).resolveInner(u-1,-1),d;if(h.name=="JSXStartTag"&&(h=h.parent),!(o.doc.sliceString(u-1,u)!=r||h.name=="JSXAttributeValue"&&h.to>u)){if(r==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:u,insert:"</>"}};if(r=="/"&&h.name=="JSXStartCloseTag"){let f=h.parent,p=f.parent;if(p&&f.from==u-2&&((d=MA(o.doc,p.firstChild,u))||((c=p.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let g=`${d}>`;return{range:B.cursor(u+g.length,-1),changes:{from:u,insert:g}}}}else if(r==">"){let f=Jge(h);if(f&&f.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(u,u+2))&&(d=MA(o.doc,f,u)))return{range:l,changes:{from:u,insert:`</${d}>`}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Ic=["_blank","_self","_top","_parent"],py=["ascii","utf-8","utf-16","latin1","latin1"],gy=["get","post","put","delete"],my=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Vn=["true","false"],de={},nme={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ic,hreflang:null}},abbr:de,address:de,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:de,aside:de,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:de,base:{attrs:{href:null,target:Ic}},bdi:de,bdo:de,blockquote:{attrs:{cite:null}},body:de,br:de,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:my,formmethod:gy,formnovalidate:["novalidate"],formtarget:Ic,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:de,center:de,cite:de,code:de,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:de,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:de,div:de,dl:de,dt:de,em:de,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:de,figure:de,footer:de,form:{attrs:{action:null,name:null,"accept-charset":py,autocomplete:["on","off"],enctype:my,method:gy,novalidate:["novalidate"],target:Ic}},h1:de,h2:de,h3:de,h4:de,h5:de,h6:de,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:de,hgroup:de,hr:de,html:{attrs:{manifest:null}},i:de,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:my,formmethod:gy,formnovalidate:["novalidate"],formtarget:Ic,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:de,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:de,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:de,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:py,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:de,noscript:de,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:de,param:{attrs:{name:null,value:null}},pre:de,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:de,rt:de,ruby:de,samp:de,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:py}},section:de,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:de,source:{attrs:{src:null,type:null,media:null}},span:de,strong:de,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:de,summary:de,sup:de,table:de,tbody:de,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:de,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:de,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:de,time:{attrs:{datetime:null}},title:de,tr:de,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:de,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:de},yz={accesskey:null,class:null,contenteditable:Vn,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Vn,autocorrect:Vn,autocapitalize:Vn,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Vn,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Vn,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Vn,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Vn,"aria-hidden":Vn,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Vn,"aria-multiselectable":Vn,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Vn,"aria-relevant":null,"aria-required":Vn,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},bz="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of bz)yz[t]=null;class gh{constructor(e,n){this.tags={...nme,...e},this.globalAttrs={...yz,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}gh.default=new gh;function Ql(t,e,n=t.length){if(!e)return"";let r=e.firstChild,i=r&&r.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,n)):""}function Ll(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function wz(t,e,n){let r=n.tags[Ql(t,Ll(e))];return(r==null?void 0:r.children)||n.allTags}function D0(t,e){let n=[];for(let r=Ll(e);r&&!r.type.isTop;r=Ll(r.parent)){let i=Ql(t,r);if(i&&r.lastChild.name=="CloseTag")break;i&&n.indexOf(i)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&n.push(i)}return n}const Sz=/^[:\-\.\w\u00b7-\uffff]*$/;function QA(t,e,n,r,i){let s=/\s*>/.test(t.sliceDoc(i,i+5))?"":">",o=Ll(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:i,options:wz(t.doc,o,e).map(a=>({label:a,type:"type"})).concat(D0(t.doc,n).map((a,l)=>({label:"/"+a,apply:"/"+a+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function LA(t,e,n,r){let i=/\s*>/.test(t.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:D0(t.doc,e).map((s,o)=>({label:s,apply:s+i,type:"type",boost:99-o})),validFor:Sz}}function rme(t,e,n,r){let i=[],s=0;for(let o of wz(t.doc,n,e))i.push({label:"<"+o,type:"type"});for(let o of D0(t.doc,n))i.push({label:"</"+o+">",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function ime(t,e,n,r,i){let s=Ll(n),o=s?e.tags[Ql(t.doc,s)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:i,options:l.map(c=>({label:c,type:"property"})),validFor:Sz}}function sme(t,e,n,r,i){var s;let o=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),a=[],l;if(o){let c=t.sliceDoc(o.from,o.to),u=e.globalAttrs[c];if(!u){let h=Ll(n),d=h?e.tags[Ql(t.doc,h)]:null;u=(d==null?void 0:d.attrs)&&d.attrs[c]}if(u){let h=t.sliceDoc(r,i).toLowerCase(),d='"',f='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,d="",f=t.sliceDoc(i,i+1)==h[0]?"":h[0],h=h.slice(1),r++):l=/^[^\s<>='"]*$/;for(let p of u)a.push({label:p,apply:d+p+f,type:"constant"})}}return{from:r,to:i,options:a,validFor:l}}function kz(t,e){let{state:n,pos:r}=e,i=Je(n).resolveInner(r,-1),s=i.resolve(r);for(let o=r,a;s==i&&(a=i.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.from<l.to)break;s=i=a,o=l.from}return i.name=="TagName"?i.parent&&/CloseTag$/.test(i.parent.name)?LA(n,i,i.from,r):QA(n,t,i,i.from,r):i.name=="StartTag"||i.name=="IncompleteTag"?QA(n,t,i,r,r):i.name=="StartCloseTag"||i.name=="IncompleteCloseTag"?LA(n,i,r,r):i.name=="OpenTag"||i.name=="SelfClosingTag"||i.name=="AttributeName"?ime(n,t,i,i.name=="AttributeName"?i.from:r,r):i.name=="Is"||i.name=="AttributeValue"||i.name=="UnquotedAttributeValue"?sme(n,t,i,i.name=="Is"?r:i.from,r):e.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?rme(n,t,i,r):null}function ome(t){return kz(gh.default,t)}function ame(t){let{extraTags:e,extraGlobalAttributes:n}=t,r=n||e?new gh(e,n):gh.default;return i=>kz(r,i)}const lme=vi.parser.configure({top:"SingleExpression"}),vz=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:fz.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:pz.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:gz.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:lme},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:vi.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:ug.parser}],xz=[{name:"style",parser:ug.parser.configure({top:"Styles"})}].concat(bz.map(t=>({name:t,parser:vi.parser}))),Cz=Il.define({name:"html",parser:Npe.configure({props:[Mh.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].length<t.node.to)return t.continue();let e=null,n;for(let r=t.node;;){let i=r.lastChild;if(!i||i.name!="Element"||i.to!=r.to)break;e=r=i}return e&&!((n=e.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?t.lineIndent(e.from)+t.unit:null}}),tc.add({Element(t){let e=t.firstChild,n=t.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:n.name=="CloseTag"?n.from:t.to}}}),OD.add({"OpenTag CloseTag":t=>t.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Pf=Cz.configure({wrap:tz(vz,xz)});function cme(t={}){let e="",n;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(n=tz((t.nestedLanguages||[]).concat(vz),(t.nestedAttributes||[]).concat(xz)));let r=n?Cz.configure({wrap:n,dialect:e}):e?Pf.configure({dialect:e}):Pf;return new ih(r,[Pf.data.of({autocomplete:ame(t)}),t.autoCloseTags!==!1?ume:[],Kge().support,gge().support])}const DA=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),ume=re.inputHandler.of((t,e,n,r,i)=>{if(t.composing||t.state.readOnly||e!=n||r!=">"&&r!="/"||!Pf.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c,u,h;let d=o.doc.sliceString(l.from-1,l.to)==r,{head:f}=l,p=Je(o).resolveInner(f,-1),g;if(d&&r==">"&&p.name=="EndTag"){let b=p.parent;if(((u=(c=b.parent)===null||c===void 0?void 0:c.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(g=Ql(o.doc,b.parent,f))&&!DA.has(g)){let m=f+(o.doc.sliceString(f,f+1)===">"?1:0),O=`</${g}>`;return{range:l,changes:{from:f,to:m,insert:O}}}}else if(d&&r=="/"&&p.name=="IncompleteCloseTag"){let b=p.parent;if(p.from==f-2&&((h=b.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(g=Ql(o.doc,b,f))&&!DA.has(g)){let m=f+(o.doc.sliceString(f,f+1)===">"?1:0),O=`${g}>`;return{range:B.cursor(f+O.length,-1),changes:{from:f,to:m,insert:O}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Ez=c0({commentTokens:{block:{open:"<!--",close:"-->"}}}),_z=new Se,Tz=_fe.configure({props:[tc.add(t=>!t.is("Block")||t.is("Document")||rS(t)!=null||hme(t)?void 0:(e,n)=>({from:n.doc.lineAt(e.from).to,to:e.to})),_z.add(rS),Mh.add({Document:()=>null}),_o.add({Document:Ez})]});function rS(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function hme(t){return t.name=="OrderedList"||t.name=="BulletList"}function dme(t,e){let n=t;for(;;){let r=n.nextSibling,i;if(!r||(i=rS(r.type))!=null&&i<=e)break;n=r}return n.to}const fme=rD.of((t,e,n)=>{for(let r=Je(t).resolveInner(n,-1);r&&!(r.from<e);r=r.parent){let i=r.type.prop(_z);if(i==null)continue;let s=dme(r,i);if(s>n)return{from:n,to:s}}return null});function z0(t){return new br(Ez,t,[],"markdown")}const pme=z0(Tz),gme=Tz.configure([Dfe,jfe,zfe,Bfe,{props:[tc.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),hg=z0(gme);function mme(t,e){return n=>{if(n&&t){let r=null;if(n=/\S*/.exec(n)[0],typeof t=="function"?r=t(n):r=Wp.matchLanguageName(t,n,!0),r instanceof Wp)return r.support?r.support.language.parser:rh.getSkippingParser(r.load());if(r)return r.parser}return e?e.parser:null}}class Oy{constructor(e,n,r,i,s,o,a){this.node=e,this.from=n,this.to=r,this.spaceBefore=i,this.spaceAfter=s,this.type=o,this.item=a}blank(e,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;r.length<e;)r+=" ";return r}else{for(let i=this.to-this.from-r.length-this.spaceAfter.length;i>0;i--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(e,n){let r=this.node.name=="OrderedList"?String(+Pz(this.item,e)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Az(t,e){let n=[],r=[];for(let i=t;i;i=i.parent){if(i.name=="FencedCode")return r;(i.name=="ListItem"||i.name=="Blockquote")&&n.push(i)}for(let i=n.length-1;i>=0;i--){let s=n[i],o,a=e.lineAt(s.from),l=s.from-a.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))r.push(new Oy(s,l,l+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=o[3],u=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),u-=4),r.push(new Oy(s.parent,l,l+u,o[1],c,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=o[4],u=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),u-=4);let h=o[2];o[3]&&(h+=o[3].replace(/[xX]/," ")),r.push(new Oy(s.parent,l,l+u,o[1],c,h,s))}}return r}function Pz(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function yy(t,e,n,r=0){for(let i=-1,s=t;;){if(s.name=="ListItem"){let a=Pz(s,e),l=+a[2];if(i>=0){if(l!=i+1)return;n.push({from:s.from+a[1].length,to:s.from+a[0].length,insert:String(i+2+r)})}i=l}let o=s.nextSibling;if(!o)break;s=o}}function j0(t,e){let n=/^[ \t]*/.exec(t)[0].length;if(!n||e.facet(ec)!=" ")return t;let r=Hr(t,4,n),i="";for(let s=r;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+t.slice(n)}const Ome=(t={})=>({state:e,dispatch:n})=>{let r=Je(e),{doc:i}=e,s=null,o=e.changeByRange(a=>{if(!a.empty||!hg.isActiveAt(e,a.from,-1)&&!hg.isActiveAt(e,a.from,1))return s={range:a};let l=a.from,c=i.lineAt(l),u=Az(r.resolveInner(l,-1),i);for(;u.length&&u[u.length-1].from>l-c.from;)u.pop();if(!u.length)return s={range:a};let h=u[u.length-1];if(h.to-h.spaceAfter.length>l-c.from)return s={range:a};let d=l>=h.to-h.spaceAfter.length&&!/\S/.test(c.text.slice(h.to));if(h.item&&d){let m=h.node.firstChild,O=h.node.getChild("ListItem","ListItem");if(m.to>=l||O&&O.to<l||c.from>0&&!/[^\s>]/.test(i.lineAt(c.from-1).text)||t.nonTightLists===!1){let w=u.length>1?u[u.length-2]:null,k,x="";w&&w.item?(k=c.from+w.from,x=w.marker(i,1)):k=c.from+(w?w.to:0);let S=[{from:k,to:l,insert:x}];return h.node.name=="OrderedList"&&yy(h.item,i,S,-2),w&&w.node.name=="OrderedList"&&yy(w.item,i,S),{range:B.cursor(k+x.length),changes:S}}else{let w=jA(u,e,c);return{range:B.cursor(l+w.length+1),changes:{from:c.from,insert:w+e.lineBreak}}}}if(h.node.name=="Blockquote"&&d&&c.from){let m=i.lineAt(c.from-1),O=/>\s*$/.exec(m.text);if(O&&O.index==h.from){let w=e.changes([{from:m.from+O.index,to:m.to},{from:c.from+h.from,to:c.to}]);return{range:a.map(w),changes:w}}}let f=[];h.node.name=="OrderedList"&&yy(h.item,i,f);let p=h.item&&h.item.from<c.from,g="";if(!p||/^[\s\d.)\-+*>]*/.exec(c.text)[0].length>=h.to)for(let m=0,O=u.length-1;m<=O;m++)g+=m==O&&!p?u[m].marker(i,1):u[m].blank(m<O?Hr(c.text,4,u[m+1].from)-g.length:null);let b=l;for(;b>c.from&&/\s/.test(c.text.charAt(b-c.from-1));)b--;return g=j0(g,e),bme(h.node,e.doc)&&(g=jA(u,e,c)+e.lineBreak+g),f.push({from:b,to:l,insert:e.lineBreak+g}),{range:B.cursor(b+g.length+1),changes:f}});return s?!1:(n(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},yme=Ome();function zA(t){return t.name=="QuoteMark"||t.name=="ListMark"}function bme(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let n=t.firstChild,r=t.getChild("ListItem","ListItem");if(!r)return!1;let i=e.lineAt(n.to),s=e.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+(o?0:1)<s.number}function jA(t,e,n){let r="";for(let i=0,s=t.length-2;i<=s;i++)r+=t[i].blank(i<s?Hr(n.text,4,t[i+1].from)-r.length:null,i<s);return j0(r,e)}function wme(t,e){let n=t.resolveInner(e,-1),r=e;zA(n)&&(r=n.from,n=n.parent);for(let i;i=n.childBefore(r);)if(zA(i))r=i.from;else if(i.name=="OrderedList"||i.name=="BulletList")n=i.lastChild,r=n.to;else break;return n}const Sme=({state:t,dispatch:e})=>{let n=Je(t),r=null,i=t.changeByRange(s=>{let o=s.from,{doc:a}=t;if(s.empty&&hg.isActiveAt(t,s.from)){let l=a.lineAt(o),c=Az(wme(n,o),a);if(c.length){let u=c[c.length-1],h=u.to-u.spaceAfter.length+(u.spaceAfter?1:0);if(o-l.from>h&&!/\S/.test(l.text.slice(h,o-l.from)))return{range:B.cursor(l.from+h),changes:{from:l.from+h,to:o}};if(o-l.from==h&&(!u.item||l.from<=u.item.from||!/\S/.test(l.text.slice(0,u.to)))){let d=l.from+u.from;if(u.item&&u.node.from<u.item.from&&/\S/.test(l.text.slice(u.from,u.to))){let f=u.blank(Hr(l.text,4,u.to)-Hr(l.text,4,u.from));return d==l.from&&(f=j0(f,t)),{range:B.cursor(d+f.length),changes:{from:d,to:l.from+u.to,insert:f}}}if(d<o)return{range:B.cursor(d),changes:{from:d,to:o}}}}}return r={range:s}});return r?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"delete"})),!0)},kme=[{key:"Enter",run:yme},{key:"Backspace",run:Sme}],Iz=cme({matchClosingTags:!1});function vme(t={}){let{codeLanguages:e,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:i}=pme,completeHTMLTags:s=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=Iz}=t;if(!(i instanceof vm))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=t.extensions?[t.extensions]:[],c=[a.support,fme],u;o&&c.push(_me),n instanceof ih?(c.push(n.support),u=n.language):n&&(u=n);let h=e||u?mme(e,u):void 0;l.push(Afe({codeParser:h,htmlParser:a.language.parser})),r&&c.push(os.high(Kl.of(kme)));let d=z0(i.configure(l));return s&&c.push(d.data.of({autocomplete:xme})),new ih(d,c)}function xme(t){let{state:e,pos:n}=t,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(n-25,n));if(!r)return null;let i=Je(e).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name=="CodeBlock"||i.name=="FencedCode"||i.name=="ProcessingInstructionBlock"||i.name=="CommentBlock"||i.name=="Link"||i.name=="Image")return null;i=i.parent}return{from:n-r[0].length,to:n,options:Cme(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let by=null;function Cme(){if(by)return by;let t=ome(new w0(Te.create({extensions:Iz}),0,!0));return by=t?t.options:[]}const Eme=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,_me=re.domEventHandlers({paste:(t,e)=>{var n;let{main:r}=e.state.selection;if(r.empty)return!1;let i=(n=t.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!hg.isActiveAt(e.state,r.from,1)))return!1;let s=Je(e.state),o=!1;return s.iterate({from:r.from,to:r.to,enter:a=>{(a.from>r.from||Eme.test(a.name))&&(o=!0)},leave:a=>{a.to<r.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${i})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}});function Tme(){const[t]=dR(),e=t.get("path"),n=t.get("new")==="1",[r,i]=A.useState(e||"pages/"),[s,o]=A.useState(""),[a,l]=A.useState(n),[c,u]=A.useState(!1),[h,d]=A.useState(null),f=is();A.useEffect(()=>{if(!e||n){l(!0);return}l(!1),He.readPage(e).then(g=>{o(g.content),l(!0),d(null)}).catch(g=>d(g instanceof Error?g.message:String(g)))},[e,n]);async function p(){if(!r.startsWith("pages/")||!r.endsWith(".md")){d("Path must start with pages/ and end in .md");return}u(!0),d(null);try{await He.writePage(r,s),f(`/wiki?selected=${encodeURIComponent(r)}`)}catch(g){d(g instanceof Error?g.message:String(g))}finally{u(!1)}}return a?y.jsxs("div",{className:"page wiki-edit",children:[y.jsx("header",{className:"page-header",children:y.jsx("h1",{children:n?"New page":"Edit page"})}),h?y.jsx(kn,{inline:!0,message:h,onRetry:()=>void p()}):null,y.jsx("div",{className:"row",children:y.jsxs("label",{htmlFor:"wiki-path",children:["Path",y.jsx("input",{id:"wiki-path",type:"text",value:r,onChange:g=>i(g.target.value),disabled:!n,"aria-invalid":!!(h&&(!r.startsWith("pages/")||!r.endsWith(".md")))})]})}),y.jsx("div",{className:"wiki-editor","aria-label":"Markdown editor",children:y.jsx(S2,{value:s,height:"60vh",extensions:[vme()],onChange:g=>o(g),theme:"dark"})}),y.jsxs("div",{className:"composer-actions",children:[y.jsx("button",{type:"button",className:"btn primary",onClick:()=>void p(),disabled:c,children:c?"Saving…":"Save"}),y.jsx("button",{type:"button",className:"btn",onClick:()=>f(e?`/wiki?selected=${encodeURIComponent(e)}`:"/wiki"),children:"Cancel"})]})]}):y.jsx(xn,{centered:!0,label:"Loading editor",detail:"Fetching the wiki page content."})}function Ame(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(!0);async function o(){s(!0);try{const l=await He.listSkills();e(l),r(null)}catch(l){r(l instanceof Error?l.message:String(l))}finally{s(!1)}}A.useEffect(()=>{o()},[]);async function a(l){if(confirm(`Uninstall ${l}?`))try{const c=await He.removeSkill(l);if(!c.ok){r(c.message);return}await o()}catch(c){r(c instanceof Error?c.message:String(c))}}return y.jsxs("div",{className:"page skills",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Skills"}),y.jsx("p",{className:"dim",children:"Bundled skills ship with Chapterhouse. Local skills live in ~/.chapterhouse/skills/ and can be uninstalled here."})]}),n?y.jsx(kn,{inline:!0,message:n,onRetry:()=>void o()}):null,i&&t===null?y.jsx(xn,{inline:!0,label:"Loading skills"}):null,y.jsx("div",{className:"skill-grid",children:t==null?void 0:t.map(l=>y.jsxs("div",{className:"skill-card",children:[y.jsxs("div",{className:"skill-head",children:[y.jsx("strong",{children:l.name}),y.jsx("span",{className:`tag tag-${l.source}`,children:l.source})]}),y.jsx("div",{className:"dim small",children:l.slug}),y.jsx("p",{children:l.description}),l.source==="local"?y.jsx("button",{type:"button",className:"btn danger",onClick:()=>void a(l.slug),children:"Uninstall"}):null]},l.directory))})]})}function Pme(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(!0);async function o(){s(!0);try{e(await He.listHistory()),r(null)}catch(a){r(a instanceof Error?a.message:String(a))}finally{s(!1)}}return A.useEffect(()=>{o()},[]),y.jsxs("div",{className:"page history",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Conversation history"}),y.jsxs("p",{className:"dim",children:["Daily summaries Chapterhouse writes to ",y.jsx("code",{children:"pages/conversations/"}),". Newest first."]})]}),n?y.jsx(kn,{inline:!0,message:n,onRetry:()=>void o()}):null,i&&t===null?y.jsx(xn,{inline:!0,label:"Loading conversation history"}):null,t&&t.length===0?y.jsx(Ws,{icon:"📄",title:"No history yet",description:"Conversation summaries will appear here once Chapterhouse writes them to pages/conversations/."}):null,y.jsx("ul",{className:"history-list",children:t==null?void 0:t.map(a=>{const l=a.path.split("/").pop()||a.path,c=new Date(a.mtime).toLocaleString();return y.jsxs("li",{children:[y.jsx(hR,{to:`/wiki?selected=${encodeURIComponent(a.path)}`,className:"link",children:l}),y.jsxs("span",{className:"dim small",children:[" · ",c]})]},a.path)})})]})}function Ime(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(null),[o,a]=A.useState(null),[l,c]=A.useState(!0),[u,h]=A.useState(!1),d=Ae(m=>m.setCurrentModel);async function f(){a(null),c(!0);try{const[m,O]=await Promise.all([He.listModels(),He.getAuto()]);e(m.models),r(m.current),d(m.current),s(O)}catch(m){a(m instanceof Error?m.message:String(m))}finally{c(!1)}}A.useEffect(()=>{f()},[]);async function p(m){if(!(!m||m===n)){h(!0),a(null);try{await He.setModel(m),r(m),d(m)}catch(O){a(O instanceof Error?O.message:String(O))}finally{h(!1)}}}async function g(){if(i){h(!0),a(null);try{await He.setAuto({enabled:!i.enabled}),await f()}catch(m){a(m instanceof Error?m.message:String(m))}finally{h(!1)}}}async function b(){if(confirm("Restart the daemon? In-flight workers will be stopped.")){a(null),h(!0);try{await He.restart()}catch(m){a(m instanceof Error?m.message:String(m))}finally{h(!1)}}}return y.jsxs("div",{className:"page settings",children:[y.jsx("header",{className:"page-header",children:y.jsx("h1",{children:"Settings"})}),o?y.jsx(kn,{inline:!0,message:o,onRetry:()=>void f()}):null,y.jsxs("section",{"aria-busy":l||u,children:[y.jsx("h2",{children:"Model"}),l&&t===null?y.jsx(xn,{inline:!0,label:"Loading available models"}):y.jsxs("div",{className:"row settings-row",children:[y.jsxs("label",{className:"settings-field",htmlFor:"model-select",children:[y.jsx("span",{className:"settings-field-label",children:"Available models"}),y.jsx("select",{id:"model-select",value:n??"",onChange:m=>void p(m.target.value),disabled:u,children:t==null?void 0:t.map(m=>y.jsx("option",{value:m,children:m},m))})]}),y.jsxs("span",{className:"dim small",children:["Current: ",n??"(unknown)"]})]})]}),y.jsxs("section",{"aria-busy":l||u,children:[y.jsx("h2",{children:"Auto-routing"}),l&&i===null?y.jsx(xn,{inline:!0,label:"Loading routing preferences"}):i?y.jsxs(y.Fragment,{children:[y.jsxs("p",{children:["Auto-routing is currently ",y.jsx("strong",{children:i.enabled?"enabled":"disabled"}),". When on, Chapterhouse picks the model tier per message."]}),y.jsx("button",{type:"button",className:"btn",onClick:()=>void g(),disabled:u,children:i.enabled?"Disable":"Enable"})]}):null]}),y.jsxs("section",{children:[y.jsx("h2",{children:"Daemon"}),y.jsx("button",{type:"button",className:"btn danger",onClick:()=>void b(),disabled:u,children:"Restart daemon"})]})]})}wy.createRoot(document.getElementById("root")).render(y.jsx(Sa.StrictMode,{children:y.jsx(gG,{children:y.jsx(uZ,{children:y.jsx(tZ,{children:y.jsxs(Hn,{path:"/",element:y.jsx(pG,{}),children:[y.jsx(Hn,{index:!0,element:y.jsx(KU,{to:"/chat",replace:!0})}),y.jsx(Hn,{path:"chat",element:y.jsx(fse,{})}),y.jsx(Hn,{path:"projects",element:y.jsx(bse,{})}),y.jsx(Hn,{path:"projects/chat/:projectRef",element:y.jsx(gse,{})}),y.jsx(Hn,{path:"workers",element:y.jsx(mse,{})}),y.jsx(Hn,{path:"ralph",element:y.jsx(yse,{})}),y.jsx(Hn,{path:"wiki",element:y.jsx(Ise,{})}),y.jsx(Hn,{path:"wiki/edit",element:y.jsx(Tme,{})}),y.jsx(Hn,{path:"skills",element:y.jsx(Ame,{})}),y.jsx(Hn,{path:"history",element:y.jsx(Pme,{})}),y.jsx(Hn,{path:"settings",element:y.jsx(Ime,{})})]})})})})}));
|
|
219
|
-
//# sourceMappingURL=index-
|
|
219
|
+
//# sourceMappingURL=index-D92WYeM5.js.map
|