@sudocode-ai/local-server 0.1.4 → 0.1.6

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.
@@ -0,0 +1,570 @@
1
+ var ky=t=>{throw TypeError(t)};var uh=(t,e,n)=>e.has(t)||ky("Cannot "+n);var R=(t,e,n)=>(uh(t,e,"read from private field"),n?n.call(t):e.get(t)),Ce=(t,e,n)=>e.has(t)?ky("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),pe=(t,e,n,r)=>(uh(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ve=(t,e,n)=>(uh(t,e,"access private method"),n);var Pc=(t,e,n,r)=>({set _(s){pe(t,e,s,n)},get _(){return R(t,e,r)}});import{j as h,P as zn,c as hg,a as Q0,b as ek,d as Yd,D as tk,C as nk,u as Gn,e as Zd,f as Op,R as rk,A as sk,g as Ot,h as ik,O as pg,i as ok,k as mg,T as gg,l as bg,m as ak,n as lk,o as ck,p as OA,q as vi,r as IA,s as DA,t as LA,v as PA,F as jA,w as zA,x as uk,W as FA,y as dk}from"./ui-vendor-CotR6bx9.js";import{e as BA,g as lc,a as x,u as $A,L as yg,O as HA,d as ht,b as li,R as fk,f as kr,r as hk,c as UA,h as xg,B as VA,i as WA,j as ss,N as qA}from"./react-vendor-ByUx1V_q.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var jc={},Sy;function KA(){if(Sy)return jc;Sy=1;var t=BA();return jc.createRoot=t.createRoot,jc.hydrateRoot=t.hydrateRoot,jc}var GA=KA();const JA=lc(GA);var Oa=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},YA={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Qs,fg,H0,ZA=(H0=class{constructor(){Ce(this,Qs,YA);Ce(this,fg,!1)}setTimeoutProvider(t){pe(this,Qs,t)}setTimeout(t,e){return R(this,Qs).setTimeout(t,e)}clearTimeout(t){R(this,Qs).clearTimeout(t)}setInterval(t,e){return R(this,Qs).setInterval(t,e)}clearInterval(t){R(this,Qs).clearInterval(t)}},Qs=new WeakMap,fg=new WeakMap,H0),Bi=new ZA;function XA(t){setTimeout(t,0)}var co=typeof window>"u"||"Deno"in globalThis;function Rn(){}function QA(t,e){return typeof t=="function"?t(e):t}function Ip(t){return typeof t=="number"&&t>=0&&t!==1/0}function pk(t,e){return Math.max(t+(e||0)-Date.now(),0)}function hi(t,e){return typeof t=="function"?t(e):t}function fr(t,e){return typeof t=="function"?t(e):t}function Ey(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==vg(o,e.options))return!1}else if(!Ml(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||s&&s!==e.state.fetchStatus||i&&!i(e))}function Cy(t,e){const{exact:n,status:r,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(uo(e.options.mutationKey)!==uo(i))return!1}else if(!Ml(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function vg(t,e){return((e==null?void 0:e.queryKeyHashFn)||uo)(t)}function uo(t){return JSON.stringify(t,(e,n)=>Dp(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ml(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Ml(t[n],e[n])):!1}var eM=Object.prototype.hasOwnProperty;function mk(t,e){if(t===e)return t;const n=Ny(t)&&Ny(e);if(!n&&!(Dp(t)&&Dp(e)))return e;const s=(n?t:Object.keys(t)).length,i=n?e:Object.keys(e),o=i.length,a=n?new Array(o):{};let l=0;for(let c=0;c<o;c++){const u=n?c:i[c],d=t[u],f=e[u];if(d===f){a[u]=d,(n?c<s:eM.call(t,u))&&l++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){a[u]=f;continue}const p=mk(d,f);a[u]=p,p===d&&l++}return s===o&&l===s?t:a}function Au(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function Ny(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Dp(t){if(!_y(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!_y(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function _y(t){return Object.prototype.toString.call(t)==="[object Object]"}function tM(t){return new Promise(e=>{Bi.setTimeout(e,t)})}function Lp(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?mk(t,e):e}function nM(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function rM(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var wg=Symbol();function gk(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===wg?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function bk(t,e){return typeof t=="function"?t(...e):!!t}var qi,ei,la,U0,sM=(U0=class extends Oa{constructor(){super();Ce(this,qi);Ce(this,ei);Ce(this,la);pe(this,la,e=>{if(!co&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){R(this,ei)||this.setEventListener(R(this,la))}onUnsubscribe(){var e;this.hasListeners()||((e=R(this,ei))==null||e.call(this),pe(this,ei,void 0))}setEventListener(e){var n;pe(this,la,e),(n=R(this,ei))==null||n.call(this),pe(this,ei,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){R(this,qi)!==e&&(pe(this,qi,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof R(this,qi)=="boolean"?R(this,qi):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qi=new WeakMap,ei=new WeakMap,la=new WeakMap,U0),kg=new sM;function Pp(){let t,e;const n=new Promise((s,i)=>{t=s,e=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}var iM=XA;function oM(){let t=[],e=0,n=a=>{a()},r=a=>{a()},s=iM;const i=a=>{e?t.push(a):s(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Xt=oM(),ca,ti,ua,V0,aM=(V0=class extends Oa{constructor(){super();Ce(this,ca,!0);Ce(this,ti);Ce(this,ua);pe(this,ua,e=>{if(!co&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){R(this,ti)||this.setEventListener(R(this,ua))}onUnsubscribe(){var e;this.hasListeners()||((e=R(this,ti))==null||e.call(this),pe(this,ti,void 0))}setEventListener(e){var n;pe(this,ua,e),(n=R(this,ti))==null||n.call(this),pe(this,ti,e(this.setOnline.bind(this)))}setOnline(e){R(this,ca)!==e&&(pe(this,ca,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return R(this,ca)}},ca=new WeakMap,ti=new WeakMap,ua=new WeakMap,V0),Mu=new aM;function lM(t){return Math.min(1e3*2**t,3e4)}function yk(t){return(t??"online")==="online"?Mu.isOnline():!0}var jp=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function xk(t){let e=!1,n=0,r;const s=Pp(),i=()=>s.status!=="pending",o=g=>{var b;if(!i()){const y=new jp(g);f(y),(b=t.onCancel)==null||b.call(t,y)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>kg.isFocused()&&(t.networkMode==="always"||Mu.isOnline())&&t.canRun(),u=()=>yk(t.networkMode)&&t.canRun(),d=g=>{i()||(r==null||r(),s.resolve(g))},f=g=>{i()||(r==null||r(),s.reject(g))},p=()=>new Promise(g=>{var b;r=y=>{(i()||c())&&g(y)},(b=t.onPause)==null||b.call(t)}).then(()=>{var g;r=void 0,i()||(g=t.onContinue)==null||g.call(t)}),m=()=>{if(i())return;let g;const b=n===0?t.initialPromise:void 0;try{g=b??t.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(d).catch(y=>{var S;if(i())return;const w=t.retry??(co?0:3),v=t.retryDelay??lM,k=typeof v=="function"?v(n,y):v,N=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,y);if(e||!N){f(y);return}n++,(S=t.onFail)==null||S.call(t,n,y),tM(k).then(()=>c()?void 0:p()).then(()=>{e?f(y):m()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():p().then(m),s)}}var Ki,W0,vk=(W0=class{constructor(){Ce(this,Ki)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ip(this.gcTime)&&pe(this,Ki,Bi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(co?1/0:300*1e3))}clearGcTimeout(){R(this,Ki)&&(Bi.clearTimeout(R(this,Ki)),pe(this,Ki,void 0))}},Ki=new WeakMap,W0),Gi,da,dr,Ji,rn,rc,Yi,Tr,us,q0,cM=(q0=class extends vk{constructor(e){super();Ce(this,Tr);Ce(this,Gi);Ce(this,da);Ce(this,dr);Ce(this,Ji);Ce(this,rn);Ce(this,rc);Ce(this,Yi);pe(this,Yi,!1),pe(this,rc,e.defaultOptions),this.setOptions(e.options),this.observers=[],pe(this,Ji,e.client),pe(this,dr,R(this,Ji).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,pe(this,Gi,Ay(this.options)),this.state=e.state??R(this,Gi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=R(this,rn))==null?void 0:e.promise}setOptions(e){if(this.options={...R(this,rc),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ay(this.options);n.data!==void 0&&(this.setState(Ty(n.data,n.dataUpdatedAt)),pe(this,Gi,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,dr).remove(this)}setData(e,n){const r=Lp(this.state.data,e,this.options);return Ve(this,Tr,us).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Ve(this,Tr,us).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=R(this,rn))==null?void 0:r.promise;return(s=R(this,rn))==null||s.cancel(e),n?n.then(Rn).catch(Rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(R(this,Gi))}isActive(){return this.observers.some(e=>fr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>hi(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!pk(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=R(this,rn))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=R(this,rn))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),R(this,dr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(R(this,rn)&&(R(this,Yi)?R(this,rn).cancel({revert:!0}):R(this,rn).cancelRetry()),this.scheduleGc()),R(this,dr).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ve(this,Tr,us).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,u,d,f,p,m,g,b,y,w,v;if(this.state.fetchStatus!=="idle"&&((l=R(this,rn))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(R(this,rn))return R(this,rn).continueRetry(),R(this,rn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const k=this.observers.find(N=>N.options.queryFn);k&&this.setOptions(k.options)}const r=new AbortController,s=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(pe(this,Yi,!0),r.signal)})},i=()=>{const k=gk(this.options,n),S=(()=>{const C={client:R(this,Ji),queryKey:this.queryKey,meta:this.meta};return s(C),C})();return pe(this,Yi,!1),this.options.persister?this.options.persister(k,S,this):k(S)},a=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:R(this,Ji),state:this.state,fetchFn:i};return s(k),k})();(c=this.options.behavior)==null||c.onFetch(a,this),pe(this,da,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&Ve(this,Tr,us).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),pe(this,rn,xk({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:k=>{k instanceof jp&&k.revert&&this.setState({...R(this,da),fetchStatus:"idle"}),r.abort()},onFail:(k,N)=>{Ve(this,Tr,us).call(this,{type:"failed",failureCount:k,error:N})},onPause:()=>{Ve(this,Tr,us).call(this,{type:"pause"})},onContinue:()=>{Ve(this,Tr,us).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const k=await R(this,rn).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(p=(f=R(this,dr).config).onSuccess)==null||p.call(f,k,this),(g=(m=R(this,dr).config).onSettled)==null||g.call(m,k,this.state.error,this),k}catch(k){if(k instanceof jp){if(k.silent)return R(this,rn).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw Ve(this,Tr,us).call(this,{type:"error",error:k}),(y=(b=R(this,dr).config).onError)==null||y.call(b,k,this),(v=(w=R(this,dr).config).onSettled)==null||v.call(w,this.state.data,k,this),k}finally{this.scheduleGc()}}},Gi=new WeakMap,da=new WeakMap,dr=new WeakMap,Ji=new WeakMap,rn=new WeakMap,rc=new WeakMap,Yi=new WeakMap,Tr=new WeakSet,us=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...wk(r.data,this.options),fetchMeta:e.meta??null};case"success":const s={...r,...Ty(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return pe(this,da,e.manual?s:void 0),s;case"error":const i=e.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Xt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),R(this,dr).notify({query:this,type:"updated",action:e})})},q0);function wk(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yk(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Ty(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ay(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Hn,et,sc,Tn,Zi,fa,ms,ni,ic,ha,pa,Xi,Qi,ri,ma,ut,sl,zp,Fp,Bp,$p,Hp,Up,Vp,kk,K0,uM=(K0=class extends Oa{constructor(e,n){super();Ce(this,ut);Ce(this,Hn);Ce(this,et);Ce(this,sc);Ce(this,Tn);Ce(this,Zi);Ce(this,fa);Ce(this,ms);Ce(this,ni);Ce(this,ic);Ce(this,ha);Ce(this,pa);Ce(this,Xi);Ce(this,Qi);Ce(this,ri);Ce(this,ma,new Set);this.options=n,pe(this,Hn,e),pe(this,ni,null),pe(this,ms,Pp()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,et).addObserver(this),My(R(this,et),this.options)?Ve(this,ut,sl).call(this):this.updateResult(),Ve(this,ut,$p).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wp(R(this,et),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wp(R(this,et),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ve(this,ut,Hp).call(this),Ve(this,ut,Up).call(this),R(this,et).removeObserver(this)}setOptions(e){const n=this.options,r=R(this,et);if(this.options=R(this,Hn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof fr(this.options.enabled,R(this,et))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ve(this,ut,Vp).call(this),R(this,et).setOptions(this.options),n._defaulted&&!Au(this.options,n)&&R(this,Hn).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,et),observer:this});const s=this.hasListeners();s&&Ry(R(this,et),r,this.options,n)&&Ve(this,ut,sl).call(this),this.updateResult(),s&&(R(this,et)!==r||fr(this.options.enabled,R(this,et))!==fr(n.enabled,R(this,et))||hi(this.options.staleTime,R(this,et))!==hi(n.staleTime,R(this,et)))&&Ve(this,ut,zp).call(this);const i=Ve(this,ut,Fp).call(this);s&&(R(this,et)!==r||fr(this.options.enabled,R(this,et))!==fr(n.enabled,R(this,et))||i!==R(this,ri))&&Ve(this,ut,Bp).call(this,i)}getOptimisticResult(e){const n=R(this,Hn).getQueryCache().build(R(this,Hn),e),r=this.createResult(n,e);return fM(this,r)&&(pe(this,Tn,r),pe(this,fa,this.options),pe(this,Zi,R(this,et).state)),r}getCurrentResult(){return R(this,Tn)}trackResult(e,n){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&R(this,ms).status==="pending"&&R(this,ms).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(e){R(this,ma).add(e)}getCurrentQuery(){return R(this,et)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=R(this,Hn).defaultQueryOptions(e),r=R(this,Hn).getQueryCache().build(R(this,Hn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Ve(this,ut,sl).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Tn)))}createResult(e,n){var O;const r=R(this,et),s=this.options,i=R(this,Tn),o=R(this,Zi),a=R(this,fa),c=e!==r?e.state:R(this,sc),{state:u}=e;let d={...u},f=!1,p;if(n._optimisticResults){const T=this.hasListeners(),I=!T&&My(e,n),D=T&&Ry(e,r,n,s);(I||D)&&(d={...d,...wk(u.data,e.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:b}=d;p=d.data;let y=!1;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let T;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(T=i.data,y=!0):T=typeof n.placeholderData=="function"?n.placeholderData((O=R(this,pa))==null?void 0:O.state.data,R(this,pa)):n.placeholderData,T!==void 0&&(b="success",p=Lp(i==null?void 0:i.data,T,n),f=!0)}if(n.select&&p!==void 0&&!y)if(i&&p===(o==null?void 0:o.data)&&n.select===R(this,ic))p=R(this,ha);else try{pe(this,ic,n.select),p=n.select(p),p=Lp(i==null?void 0:i.data,p,n),pe(this,ha,p),pe(this,ni,null)}catch(T){pe(this,ni,T)}R(this,ni)&&(m=R(this,ni),p=R(this,ha),g=Date.now(),b="error");const w=d.fetchStatus==="fetching",v=b==="pending",k=b==="error",N=v&&w,S=p!==void 0,_={status:b,fetchStatus:d.fetchStatus,isPending:v,isSuccess:b==="success",isError:k,isInitialLoading:N,isLoading:N,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!v,isLoadingError:k&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:k&&S,isStale:Sg(e,n),refetch:this.refetch,promise:R(this,ms),isEnabled:fr(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const T=V=>{_.status==="error"?V.reject(_.error):_.data!==void 0&&V.resolve(_.data)},I=()=>{const V=pe(this,ms,_.promise=Pp());T(V)},D=R(this,ms);switch(D.status){case"pending":e.queryHash===r.queryHash&&T(D);break;case"fulfilled":(_.status==="error"||_.data!==D.value)&&I();break;case"rejected":(_.status!=="error"||_.error!==D.reason)&&I();break}}return _}updateResult(){const e=R(this,Tn),n=this.createResult(R(this,et),this.options);if(pe(this,Zi,R(this,et).state),pe(this,fa,this.options),R(this,Zi).data!==void 0&&pe(this,pa,R(this,et)),Au(n,e))return;pe(this,Tn,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!R(this,ma).size)return!0;const o=new Set(i??R(this,ma));return this.options.throwOnError&&o.add("error"),Object.keys(R(this,Tn)).some(a=>{const l=a;return R(this,Tn)[l]!==e[l]&&o.has(l)})};Ve(this,ut,kk).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ve(this,ut,$p).call(this)}},Hn=new WeakMap,et=new WeakMap,sc=new WeakMap,Tn=new WeakMap,Zi=new WeakMap,fa=new WeakMap,ms=new WeakMap,ni=new WeakMap,ic=new WeakMap,ha=new WeakMap,pa=new WeakMap,Xi=new WeakMap,Qi=new WeakMap,ri=new WeakMap,ma=new WeakMap,ut=new WeakSet,sl=function(e){Ve(this,ut,Vp).call(this);let n=R(this,et).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Rn)),n},zp=function(){Ve(this,ut,Hp).call(this);const e=hi(this.options.staleTime,R(this,et));if(co||R(this,Tn).isStale||!Ip(e))return;const r=pk(R(this,Tn).dataUpdatedAt,e)+1;pe(this,Xi,Bi.setTimeout(()=>{R(this,Tn).isStale||this.updateResult()},r))},Fp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,et)):this.options.refetchInterval)??!1},Bp=function(e){Ve(this,ut,Up).call(this),pe(this,ri,e),!(co||fr(this.options.enabled,R(this,et))===!1||!Ip(R(this,ri))||R(this,ri)===0)&&pe(this,Qi,Bi.setInterval(()=>{(this.options.refetchIntervalInBackground||kg.isFocused())&&Ve(this,ut,sl).call(this)},R(this,ri)))},$p=function(){Ve(this,ut,zp).call(this),Ve(this,ut,Bp).call(this,Ve(this,ut,Fp).call(this))},Hp=function(){R(this,Xi)&&(Bi.clearTimeout(R(this,Xi)),pe(this,Xi,void 0))},Up=function(){R(this,Qi)&&(Bi.clearInterval(R(this,Qi)),pe(this,Qi,void 0))},Vp=function(){const e=R(this,Hn).getQueryCache().build(R(this,Hn),this.options);if(e===R(this,et))return;const n=R(this,et);pe(this,et,e),pe(this,sc,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},kk=function(e){Xt.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(R(this,Tn))}),R(this,Hn).getQueryCache().notify({query:R(this,et),type:"observerResultsUpdated"})})},K0);function dM(t,e){return fr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function My(t,e){return dM(t,e)||t.state.data!==void 0&&Wp(t,e,e.refetchOnMount)}function Wp(t,e,n){if(fr(e.enabled,t)!==!1&&hi(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Sg(t,e)}return!1}function Ry(t,e,n,r){return(t!==e||fr(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Sg(t,n)}function Sg(t,e){return fr(e.enabled,t)!==!1&&t.isStaleByTime(hi(e.staleTime,t))}function fM(t,e){return!Au(t.getCurrentResult(),e)}function Oy(t){return{onFetch:(e,n)=>{var u,d,f,p,m;const r=e.options,s=(f=(d=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((m=e.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const b=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},y=gk(e.options,e.fetchOptions),w=async(v,k,N)=>{if(g)return Promise.reject();if(k==null&&v.pages.length)return Promise.resolve(v);const C=(()=>{const I={client:e.client,queryKey:e.queryKey,pageParam:k,direction:N?"backward":"forward",meta:e.options.meta};return b(I),I})(),_=await y(C),{maxPages:O}=e.options,T=N?rM:nM;return{pages:T(v.pages,_,O),pageParams:T(v.pageParams,k,O)}};if(s&&i.length){const v=s==="backward",k=v?hM:Iy,N={pages:i,pageParams:o},S=k(r,N);a=await w(N,S,v)}else{const v=t??i.length;do{const k=l===0?o[0]??r.initialPageParam:Iy(r,a);if(l>0&&k==null)break;a=await w(a,k),l++}while(l<v)}return a};e.options.persister?e.fetchFn=()=>{var g,b;return(b=(g=e.options).persister)==null?void 0:b.call(g,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function Iy(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function hM(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var oc,Gr,An,eo,Jr,$s,G0,pM=(G0=class extends vk{constructor(e){super();Ce(this,Jr);Ce(this,oc);Ce(this,Gr);Ce(this,An);Ce(this,eo);pe(this,oc,e.client),this.mutationId=e.mutationId,pe(this,An,e.mutationCache),pe(this,Gr,[]),this.state=e.state||Sk(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){R(this,Gr).includes(e)||(R(this,Gr).push(e),this.clearGcTimeout(),R(this,An).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){pe(this,Gr,R(this,Gr).filter(n=>n!==e)),this.scheduleGc(),R(this,An).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){R(this,Gr).length||(this.state.status==="pending"?this.scheduleGc():R(this,An).remove(this))}continue(){var e;return((e=R(this,eo))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,u,d,f,p,m,g,b,y,w,v,k,N,S,C,_,O;const n=()=>{Ve(this,Jr,$s).call(this,{type:"continue"})},r={client:R(this,oc),meta:this.options.meta,mutationKey:this.options.mutationKey};pe(this,eo,xk({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(T,I)=>{Ve(this,Jr,$s).call(this,{type:"failed",failureCount:T,error:I})},onPause:()=>{Ve(this,Jr,$s).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,An).canRun(this)}));const s=this.state.status==="pending",i=!R(this,eo).canStart();try{if(s)n();else{Ve(this,Jr,$s).call(this,{type:"pending",variables:e,isPaused:i}),await((a=(o=R(this,An).config).onMutate)==null?void 0:a.call(o,e,this,r));const I=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e,r));I!==this.state.context&&Ve(this,Jr,$s).call(this,{type:"pending",context:I,variables:e,isPaused:i})}const T=await R(this,eo).start();return await((d=(u=R(this,An).config).onSuccess)==null?void 0:d.call(u,T,e,this.state.context,this,r)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,T,e,this.state.context,r)),await((g=(m=R(this,An).config).onSettled)==null?void 0:g.call(m,T,null,this.state.variables,this.state.context,this,r)),await((y=(b=this.options).onSettled)==null?void 0:y.call(b,T,null,e,this.state.context,r)),Ve(this,Jr,$s).call(this,{type:"success",data:T}),T}catch(T){try{throw await((v=(w=R(this,An).config).onError)==null?void 0:v.call(w,T,e,this.state.context,this,r)),await((N=(k=this.options).onError)==null?void 0:N.call(k,T,e,this.state.context,r)),await((C=(S=R(this,An).config).onSettled)==null?void 0:C.call(S,void 0,T,this.state.variables,this.state.context,this,r)),await((O=(_=this.options).onSettled)==null?void 0:O.call(_,void 0,T,e,this.state.context,r)),T}finally{Ve(this,Jr,$s).call(this,{type:"error",error:T})}}finally{R(this,An).runNext(this)}}},oc=new WeakMap,Gr=new WeakMap,An=new WeakMap,eo=new WeakMap,Jr=new WeakSet,$s=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Xt.batch(()=>{R(this,Gr).forEach(r=>{r.onMutationUpdate(e)}),R(this,An).notify({mutation:this,type:"updated",action:e})})},G0);function Sk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var gs,Ar,ac,J0,mM=(J0=class extends Oa{constructor(e={}){super();Ce(this,gs);Ce(this,Ar);Ce(this,ac);this.config=e,pe(this,gs,new Set),pe(this,Ar,new Map),pe(this,ac,0)}build(e,n,r){const s=new pM({client:e,mutationCache:this,mutationId:++Pc(this,ac)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){R(this,gs).add(e);const n=zc(e);if(typeof n=="string"){const r=R(this,Ar).get(n);r?r.push(e):R(this,Ar).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(R(this,gs).delete(e)){const n=zc(e);if(typeof n=="string"){const r=R(this,Ar).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&R(this,Ar).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=zc(e);if(typeof n=="string"){const r=R(this,Ar).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=zc(e);if(typeof n=="string"){const s=(r=R(this,Ar).get(n))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Xt.batch(()=>{R(this,gs).forEach(e=>{this.notify({type:"removed",mutation:e})}),R(this,gs).clear(),R(this,Ar).clear()})}getAll(){return Array.from(R(this,gs))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Cy(n,r))}findAll(e={}){return this.getAll().filter(n=>Cy(e,n))}notify(e){Xt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Xt.batch(()=>Promise.all(e.map(n=>n.continue().catch(Rn))))}},gs=new WeakMap,Ar=new WeakMap,ac=new WeakMap,J0);function zc(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bs,si,Un,ys,Es,pu,qp,Y0,gM=(Y0=class extends Oa{constructor(n,r){super();Ce(this,Es);Ce(this,bs);Ce(this,si);Ce(this,Un);Ce(this,ys);pe(this,bs,n),this.setOptions(r),this.bindMethods(),Ve(this,Es,pu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=R(this,bs).defaultMutationOptions(n),Au(this.options,r)||R(this,bs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,Un),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&uo(r.mutationKey)!==uo(this.options.mutationKey)?this.reset():((s=R(this,Un))==null?void 0:s.state.status)==="pending"&&R(this,Un).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=R(this,Un))==null||n.removeObserver(this)}onMutationUpdate(n){Ve(this,Es,pu).call(this),Ve(this,Es,qp).call(this,n)}getCurrentResult(){return R(this,si)}reset(){var n;(n=R(this,Un))==null||n.removeObserver(this),pe(this,Un,void 0),Ve(this,Es,pu).call(this),Ve(this,Es,qp).call(this)}mutate(n,r){var s;return pe(this,ys,r),(s=R(this,Un))==null||s.removeObserver(this),pe(this,Un,R(this,bs).getMutationCache().build(R(this,bs),this.options)),R(this,Un).addObserver(this),R(this,Un).execute(n)}},bs=new WeakMap,si=new WeakMap,Un=new WeakMap,ys=new WeakMap,Es=new WeakSet,pu=function(){var r;const n=((r=R(this,Un))==null?void 0:r.state)??Sk();pe(this,si,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},qp=function(n){Xt.batch(()=>{var r,s,i,o,a,l,c,u;if(R(this,ys)&&this.hasListeners()){const d=R(this,si).variables,f=R(this,si).context,p={client:R(this,bs),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((s=(r=R(this,ys)).onSuccess)==null||s.call(r,n.data,d,f,p),(o=(i=R(this,ys)).onSettled)==null||o.call(i,n.data,null,d,f,p)):(n==null?void 0:n.type)==="error"&&((l=(a=R(this,ys)).onError)==null||l.call(a,n.error,d,f,p),(u=(c=R(this,ys)).onSettled)==null||u.call(c,void 0,n.error,d,f,p))}this.listeners.forEach(d=>{d(R(this,si))})})},Y0),Yr,Z0,bM=(Z0=class extends Oa{constructor(e={}){super();Ce(this,Yr);this.config=e,pe(this,Yr,new Map)}build(e,n,r){const s=n.queryKey,i=n.queryHash??vg(s,n);let o=this.get(i);return o||(o=new cM({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){R(this,Yr).has(e.queryHash)||(R(this,Yr).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=R(this,Yr).get(e.queryHash);n&&(e.destroy(),n===e&&R(this,Yr).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Xt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return R(this,Yr).get(e)}getAll(){return[...R(this,Yr).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Ey(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>Ey(e,r)):n}notify(e){Xt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Xt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Xt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Yr=new WeakMap,Z0),Pt,ii,oi,ga,ba,ai,ya,xa,X0,yM=(X0=class{constructor(t={}){Ce(this,Pt);Ce(this,ii);Ce(this,oi);Ce(this,ga);Ce(this,ba);Ce(this,ai);Ce(this,ya);Ce(this,xa);pe(this,Pt,t.queryCache||new bM),pe(this,ii,t.mutationCache||new mM),pe(this,oi,t.defaultOptions||{}),pe(this,ga,new Map),pe(this,ba,new Map),pe(this,ai,0)}mount(){Pc(this,ai)._++,R(this,ai)===1&&(pe(this,ya,kg.subscribe(async t=>{t&&(await this.resumePausedMutations(),R(this,Pt).onFocus())})),pe(this,xa,Mu.subscribe(async t=>{t&&(await this.resumePausedMutations(),R(this,Pt).onOnline())})))}unmount(){var t,e;Pc(this,ai)._--,R(this,ai)===0&&((t=R(this,ya))==null||t.call(this),pe(this,ya,void 0),(e=R(this,xa))==null||e.call(this),pe(this,xa,void 0))}isFetching(t){return R(this,Pt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return R(this,ii).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=R(this,Pt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=R(this,Pt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(hi(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return R(this,Pt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=R(this,Pt).get(r.queryHash),i=s==null?void 0:s.state.data,o=QA(e,i);if(o!==void 0)return R(this,Pt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Xt.batch(()=>R(this,Pt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=R(this,Pt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=R(this,Pt);Xt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=R(this,Pt);return Xt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Xt.batch(()=>R(this,Pt).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(Rn).catch(Rn)}invalidateQueries(t,e={}){return Xt.batch(()=>(R(this,Pt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Xt.batch(()=>R(this,Pt).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Rn)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Rn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=R(this,Pt).build(this,e);return n.isStaleByTime(hi(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Rn).catch(Rn)}fetchInfiniteQuery(t){return t.behavior=Oy(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Rn).catch(Rn)}ensureInfiniteQueryData(t){return t.behavior=Oy(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Mu.isOnline()?R(this,ii).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,Pt)}getMutationCache(){return R(this,ii)}getDefaultOptions(){return R(this,oi)}setDefaultOptions(t){pe(this,oi,t)}setQueryDefaults(t,e){R(this,ga).set(uo(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...R(this,ga).values()],n={};return e.forEach(r=>{Ml(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){R(this,ba).set(uo(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...R(this,ba).values()],n={};return e.forEach(r=>{Ml(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...R(this,oi).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=vg(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===wg&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...R(this,oi).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){R(this,Pt).clear(),R(this,ii).clear()}},Pt=new WeakMap,ii=new WeakMap,oi=new WeakMap,ga=new WeakMap,ba=new WeakMap,ai=new WeakMap,ya=new WeakMap,xa=new WeakMap,X0),Ek=x.createContext(void 0),Ts=t=>{const e=x.useContext(Ek);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},xM=({client:t,children:e})=>(x.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),h.jsx(Ek.Provider,{value:t,children:e})),Ck=x.createContext(!1),vM=()=>x.useContext(Ck);Ck.Provider;function wM(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var kM=x.createContext(wM()),SM=()=>x.useContext(kM),EM=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},CM=t=>{x.useEffect(()=>{t.clearReset()},[t])},NM=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||bk(n,[t.error,r])),_M=t=>{if(t.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},TM=(t,e)=>t.isLoading&&t.isFetching&&!e,AM=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Dy=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function MM(t,e,n){var d,f,p,m,g;const r=vM(),s=SM(),i=Ts(),o=i.defaultQueryOptions(t);(f=(d=i.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||f.call(d,o),o._optimisticResults=r?"isRestoring":"optimistic",_M(o),EM(o,s),CM(s);const a=!i.getQueryCache().get(o.queryHash),[l]=x.useState(()=>new e(i,o)),c=l.getOptimisticResult(o),u=!r&&t.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(b=>{const y=u?l.subscribe(Xt.batchCalls(b)):Rn;return l.updateResult(),y},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),x.useEffect(()=>{l.setOptions(o)},[o,l]),AM(o,c))throw Dy(o,l,s);if(NM({result:c,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw c.error;if((m=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,o,c),o.experimental_prefetchInRender&&!co&&TM(c,r)){const b=a?Dy(o,l,s):(g=i.getQueryCache().get(o.queryHash))==null?void 0:g.promise;b==null||b.catch(Rn).finally(()=>{l.updateResult()})}return o.notifyOnChangeProps?c:l.trackResult(c)}function cc(t,e){return MM(t,uM)}function xr(t,e){const n=Ts(),[r]=x.useState(()=>new gM(n,t));x.useEffect(()=>{r.setOptions(t)},[r,t]);const s=x.useSyncExternalStore(x.useCallback(o=>r.subscribe(Xt.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=x.useCallback((o,a)=>{r.mutate(o,a).catch(Rn)},[r]);if(s.error&&bk(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const Nk=x.createContext(void 0);function RM({children:t}){const[e,n]=x.useState(()=>localStorage.getItem("theme")||"system"),[r,s]=x.useState(()=>e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e==="dark"?"dark":"light");return x.useEffect(()=>{const i=window.document.documentElement;if(i.classList.remove("light","dark"),e==="system"){const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";i.classList.add(o),s(o)}else i.classList.add(e),s(e)},[e]),x.useEffect(()=>{localStorage.setItem("theme",e)},[e]),x.useEffect(()=>{const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>{if(e==="system"){const a=i.matches?"dark":"light";s(a),window.document.documentElement.classList.remove("light","dark"),window.document.documentElement.classList.add(a)}};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[e]),h.jsx(Nk.Provider,{value:{theme:e,setTheme:n,actualTheme:r},children:t})}function OM(){const t=x.useContext(Nk);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t}const _k=x.createContext(null);function IM({children:t,url:e="",reconnect:n=!0,reconnectInterval:r=5e3}){const s=x.useRef(null),i=x.useRef(null),o=x.useRef(new Map),a=x.useRef(new Set),l=x.useRef(new Set),[c,u]=x.useState(!1),[d,f]=x.useState(null),p=x.useCallback(()=>{var C;if(((C=s.current)==null?void 0:C.readyState)===WebSocket.OPEN)return;const k="/ws",N=window.location.protocol==="https:"?"wss:":"ws:",S=k.startsWith("/")?`${N}//${window.location.host}${k}${e}`:`${k}${e}`;console.log("[WebSocket] Connecting to:",S);try{s.current=new WebSocket(S),s.current.onopen=()=>{console.log("[WebSocket] Connected"),u(!0),l.current.forEach(_=>{var O;if(((O=s.current)==null?void 0:O.readyState)===WebSocket.OPEN){const T=DM(_);T&&(s.current.send(JSON.stringify(T)),console.log("[WebSocket] Resubscribed to:",_))}}),a.current=new Set(l.current),l.current.clear()},s.current.onmessage=_=>{try{const O=JSON.parse(_.data);console.log("[WebSocket] Message received:",O.type),f(O),o.current.forEach(T=>{try{T(O)}catch(I){console.error("[WebSocket] Handler error:",I)}})}catch(O){console.error("[WebSocket] Failed to parse message:",O)}},s.current.onerror=_=>{console.error("[WebSocket] Error:",_)},s.current.onclose=()=>{console.log("[WebSocket] Disconnected"),u(!1),l.current=new Set(a.current),n&&(i.current=setTimeout(()=>{console.log("[WebSocket] Attempting to reconnect..."),p()},r))}}catch(_){console.error("[WebSocket] Connection failed:",_)}},[e,n,r]),m=x.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null),s.current&&(s.current.onclose=null,s.current.close(),s.current=null),u(!1),a.current.clear(),l.current.clear()},[]),g=x.useCallback((k,N)=>{var C;const S=N?`${k}:${N}`:`${k}:*`;if(a.current.add(S),((C=s.current)==null?void 0:C.readyState)===WebSocket.OPEN){const _={type:"subscribe",entity_type:k,entity_id:N};s.current.send(JSON.stringify(_)),console.log("[WebSocket] Subscribed to:",S)}else l.current.add(S)},[]),b=x.useCallback((k,N)=>{var C;const S=N?`${k}:${N}`:`${k}:*`;if(a.current.delete(S),l.current.delete(S),((C=s.current)==null?void 0:C.readyState)===WebSocket.OPEN){const _={type:"unsubscribe",entity_type:k,entity_id:N};s.current.send(JSON.stringify(_)),console.log("[WebSocket] Unsubscribed from:",S)}},[]),y=x.useCallback((k,N)=>{o.current.set(k,N)},[]),w=x.useCallback(k=>{o.current.delete(k)},[]);x.useEffect(()=>(p(),()=>{m()}),[p,m]);const v={connected:c,lastMessage:d,subscribe:g,unsubscribe:b,addMessageHandler:y,removeMessageHandler:w};return h.jsx(_k.Provider,{value:v,children:t})}function Xd(){const t=x.useContext(_k);if(!t)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return t}function DM(t){if(t==="all")return{type:"subscribe",entity_type:"all"};const[e,n]=t.split(":");return e==="issue"||e==="spec"?{type:"subscribe",entity_type:e,entity_id:n==="*"?void 0:n}:null}/**
2
+ * @license lucide-react v0.344.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */var LM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
7
+ * @license lucide-react v0.344.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const PM=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Me=(t,e)=>{const n=x.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...c},u)=>x.createElement("svg",{ref:u,...LM,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${PM(t)}`,a].join(" "),...c},[...e.map(([d,f])=>x.createElement(d,f)),...Array.isArray(l)?l:[l]]));return n.displayName=`${t}`,n};/**
12
+ * @license lucide-react v0.344.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const fo=Me("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
17
+ * @license lucide-react v0.344.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Eg=Me("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
22
+ * @license lucide-react v0.344.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const Ia=Me("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
27
+ * @license lucide-react v0.344.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const Qd=Me("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
32
+ * @license lucide-react v0.344.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const jM=Me("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
37
+ * @license lucide-react v0.344.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const zM=Me("Bold",[["path",{d:"M14 12a4 4 0 0 0 0-8H6v8",key:"v2sylx"}],["path",{d:"M15 20a4 4 0 0 0 0-8H6v8Z",key:"1ef5ya"}]]);/**
42
+ * @license lucide-react v0.344.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Cg=Me("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
47
+ * @license lucide-react v0.344.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const Tk=Me("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
52
+ * @license lucide-react v0.344.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const Rl=Me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
57
+ * @license lucide-react v0.344.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const Ng=Me("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
62
+ * @license lucide-react v0.344.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const FM=Me("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
67
+ * @license lucide-react v0.344.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const Ol=Me("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
72
+ * @license lucide-react v0.344.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const uc=Me("Code2",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
77
+ * @license lucide-react v0.344.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const BM=Me("CodeSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 10-2 2 2 2",key:"p6et6i"}],["path",{d:"m14 14 2-2-2-2",key:"m075q2"}]]);/**
82
+ * @license lucide-react v0.344.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const $M=Me("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
87
+ * @license lucide-react v0.344.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const HM=Me("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/**
92
+ * @license lucide-react v0.344.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const UM=Me("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
97
+ * @license lucide-react v0.344.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const As=Me("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
102
+ * @license lucide-react v0.344.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const _g=Me("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
107
+ * @license lucide-react v0.344.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const VM=Me("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
112
+ * @license lucide-react v0.344.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const WM=Me("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
117
+ * @license lucide-react v0.344.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const qM=Me("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
122
+ * @license lucide-react v0.344.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const KM=Me("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
127
+ * @license lucide-react v0.344.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const Ly=Me("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
132
+ * @license lucide-react v0.344.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const GM=Me("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
137
+ * @license lucide-react v0.344.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const JM=Me("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
142
+ * @license lucide-react v0.344.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const YM=Me("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
147
+ * @license lucide-react v0.344.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const Ak=Me("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
152
+ * @license lucide-react v0.344.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const ZM=Me("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
157
+ * @license lucide-react v0.344.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const XM=Me("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
162
+ * @license lucide-react v0.344.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const QM=Me("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
167
+ * @license lucide-react v0.344.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const pi=Me("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
172
+ * @license lucide-react v0.344.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const eR=Me("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
177
+ * @license lucide-react v0.344.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const tR=Me("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
182
+ * @license lucide-react v0.344.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const nR=Me("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/**
187
+ * @license lucide-react v0.344.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const Tg=Me("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
192
+ * @license lucide-react v0.344.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const ef=Me("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
197
+ * @license lucide-react v0.344.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const rR=Me("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
202
+ * @license lucide-react v0.344.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const Mk=Me("PauseCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
207
+ * @license lucide-react v0.344.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const sR=Me("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
212
+ * @license lucide-react v0.344.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const ho=Me("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
217
+ * @license lucide-react v0.344.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const iR=Me("Quote",[["path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z",key:"4rm80e"}],["path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",key:"10za9r"}]]);/**
222
+ * @license lucide-react v0.344.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const oR=Me("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
227
+ * @license lucide-react v0.344.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const tf=Me("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
232
+ * @license lucide-react v0.344.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const Py=Me("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
237
+ * @license lucide-react v0.344.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const Rk=Me("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/**
242
+ * @license lucide-react v0.344.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const jy=Me("StopCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
247
+ * @license lucide-react v0.344.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const aR=Me("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
252
+ * @license lucide-react v0.344.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const lR=Me("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
257
+ * @license lucide-react v0.344.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const Da=Me("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
262
+ * @license lucide-react v0.344.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const cR=Me("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
267
+ * @license lucide-react v0.344.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const uR=Me("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
272
+ * @license lucide-react v0.344.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */const Zo=Me("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
277
+ * @license lucide-react v0.344.0 - ISC
278
+ *
279
+ * This source code is licensed under the ISC license.
280
+ * See the LICENSE file in the root directory of this source tree.
281
+ */const hl=Me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Ok(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=Ok(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Ik(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=Ok(t))&&(r&&(r+=" "),r+=e);return r}const Ag="-",dR=t=>{const e=hR(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(Ag);return a[0]===""&&a.length!==1&&a.shift(),Dk(a,e)||fR(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},Dk=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?Dk(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(Ag);return(o=e.validators.find(({validator:a})=>a(i)))==null?void 0:o.classGroupId},zy=/^\[(.+)\]$/,fR=t=>{if(zy.test(t)){const e=zy.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},hR=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return mR(Object.entries(t.classGroups),n).forEach(([i,o])=>{Kp(o,r,i,e)}),r},Kp=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:Fy(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(pR(s)){Kp(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{Kp(o,Fy(e,i),n,r)})})},Fy=(t,e)=>{let n=t;return e.split(Ag).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},pR=t=>t.isThemeGetter,mR=(t,e)=>e?t.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,a])=>[e+o,a])):i);return[n,s]}):t,gR=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},Lk="!",bR=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,s=e[0],i=e.length,o=a=>{const l=[];let c=0,u=0,d;for(let b=0;b<a.length;b++){let y=a[b];if(c===0){if(y===s&&(r||a.slice(b,b+i)===e)){l.push(a.slice(u,b)),u=b+i;continue}if(y==="/"){d=b;continue}}y==="["?c++:y==="]"&&c--}const f=l.length===0?a:a.substring(u),p=f.startsWith(Lk),m=p?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:o}):o},yR=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},xR=t=>({cache:gR(t.cacheSize),parseClassName:bR(t),...dR(t)}),vR=/\s+/,wR=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],o=t.trim().split(vR);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(c);let m=!!p,g=r(m?f.substring(0,p):f);if(!g){if(!m){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}m=!1}const b=yR(u).join(":"),y=d?b+Lk:b,w=y+g;if(i.includes(w))continue;i.push(w);const v=s(g,m);for(let k=0;k<v.length;++k){const N=v[k];i.push(y+N)}a=c+(a.length>0?" "+a:a)}return a};function kR(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Pk(e))&&(r&&(r+=" "),r+=n);return r}const Pk=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Pk(t[r]))&&(n&&(n+=" "),n+=e);return n};function SR(t,...e){let n,r,s,i=o;function o(l){const c=e.reduce((u,d)=>d(u),t());return n=xR(c),r=n.cache.get,s=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=wR(l,n);return s(l,u),u}return function(){return i(kR.apply(null,arguments))}}const Tt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},jk=/^\[(?:([a-z-]+):)?(.+)\]$/i,ER=/^\d+\/\d+$/,CR=new Set(["px","full","screen"]),NR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_R=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,TR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,AR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,is=t=>Xo(t)||CR.has(t)||ER.test(t),js=t=>La(t,"length",zR),Xo=t=>!!t&&!Number.isNaN(Number(t)),dh=t=>La(t,"number",Xo),qa=t=>!!t&&Number.isInteger(Number(t)),RR=t=>t.endsWith("%")&&Xo(t.slice(0,-1)),He=t=>jk.test(t),zs=t=>NR.test(t),OR=new Set(["length","size","percentage"]),IR=t=>La(t,OR,zk),DR=t=>La(t,"position",zk),LR=new Set(["image","url"]),PR=t=>La(t,LR,BR),jR=t=>La(t,"",FR),Ka=()=>!0,La=(t,e,n)=>{const r=jk.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},zR=t=>_R.test(t)&&!TR.test(t),zk=()=>!1,FR=t=>AR.test(t),BR=t=>MR.test(t),$R=()=>{const t=Tt("colors"),e=Tt("spacing"),n=Tt("blur"),r=Tt("brightness"),s=Tt("borderColor"),i=Tt("borderRadius"),o=Tt("borderSpacing"),a=Tt("borderWidth"),l=Tt("contrast"),c=Tt("grayscale"),u=Tt("hueRotate"),d=Tt("invert"),f=Tt("gap"),p=Tt("gradientColorStops"),m=Tt("gradientColorStopPositions"),g=Tt("inset"),b=Tt("margin"),y=Tt("opacity"),w=Tt("padding"),v=Tt("saturate"),k=Tt("scale"),N=Tt("sepia"),S=Tt("skew"),C=Tt("space"),_=Tt("translate"),O=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",He,e],D=()=>[He,e],V=()=>["",is,js],z=()=>["auto",Xo,He],j=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],ue=()=>["","0",He],A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ce=()=>[Xo,He];return{cacheSize:500,separator:":",theme:{colors:[Ka],spacing:[is,js],blur:["none","",zs,He],brightness:ce(),borderColor:[t],borderRadius:["none","","full",zs,He],borderSpacing:D(),borderWidth:V(),contrast:ce(),grayscale:ue(),hueRotate:ce(),invert:ue(),gap:D(),gradientColorStops:[t],gradientColorStopPositions:[RR,js],inset:I(),margin:I(),opacity:ce(),padding:D(),saturate:ce(),scale:ce(),sepia:ue(),skew:ce(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",He]}],container:["container"],columns:[{columns:[zs]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...j(),He]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qa,He]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",He]}],grow:[{grow:ue()}],shrink:[{shrink:ue()}],order:[{order:["first","last","none",qa,He]}],"grid-cols":[{"grid-cols":[Ka]}],"col-start-end":[{col:["auto",{span:["full",qa,He]},He]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[Ka]}],"row-start-end":[{row:["auto",{span:[qa,He]},He]}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",He]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",He]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",He,e]}],"min-w":[{"min-w":[He,e,"min","max","fit"]}],"max-w":[{"max-w":[He,e,"none","full","min","max","fit","prose",{screen:[zs]},zs]}],h:[{h:[He,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[He,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[He,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[He,e,"auto","min","max","fit"]}],"font-size":[{text:["base",zs,js]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",dh]}],"font-family":[{font:[Ka]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",He]}],"line-clamp":[{"line-clamp":["none",Xo,dh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",is,He]}],"list-image":[{"list-image":["none",He]}],"list-style-type":[{list:["none","disc","decimal",He]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",is,js]}],"underline-offset":[{"underline-offset":["auto",is,He]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",He]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",He]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...j(),DR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",IR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},PR]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:q()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[is,He]}],"outline-w":[{outline:[is,js]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[is,js]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",zs,jR]}],"shadow-color":[{shadow:[Ka]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...re(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":re()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",zs,He]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",He]}],duration:[{duration:ce()}],ease:[{ease:["linear","in","out","in-out",He]}],delay:[{delay:ce()}],animate:[{animate:["none","spin","ping","pulse","bounce",He]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[qa,He]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",He]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",He]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",He]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[is,js,dh]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},HR=SR($R);function Oe(...t){return HR(Ik(t))}var UR=Symbol("radix.slottable");function VR(t){const e=({children:n})=>h.jsx(h.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=UR,e}var Fk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),WR="VisuallyHidden",Bk=x.forwardRef((t,e)=>h.jsx(zn.span,{...t,ref:e,style:{...Fk,...t.style}}));Bk.displayName=WR;var qR=Bk,[nf]=hg("Tooltip",[Yd]),rf=Yd(),$k="TooltipProvider",KR=700,Gp="tooltip.open",[GR,Mg]=nf($k),Hk=t=>{const{__scopeTooltip:e,delayDuration:n=KR,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),h.jsx(GR,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})};Hk.displayName=$k;var Il="Tooltip",[JR,dc]=nf(Il),Uk=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,l=Mg(Il,t.__scopeTooltip),c=rf(e),[u,d]=x.useState(null),f=Zd(),p=x.useRef(0),m=o??l.disableHoverableContent,g=a??l.delayDuration,b=x.useRef(!1),[y,w]=Op({prop:r,defaultProp:s??!1,onChange:C=>{C?(l.onOpen(),document.dispatchEvent(new CustomEvent(Gp))):l.onClose(),i==null||i(C)},caller:Il}),v=x.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),k=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,w(!0)},[w]),N=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),S=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,w(!0),p.current=0},g)},[g,w]);return x.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(rk,{...c,children:h.jsx(JR,{scope:e,contentId:f,open:y,stateAttribute:v,trigger:u,onTriggerChange:d,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayedRef.current?S():k()},[l.isOpenDelayedRef,S,k]),onTriggerLeave:x.useCallback(()=>{m?N():(window.clearTimeout(p.current),p.current=0)},[N,m]),onOpen:k,onClose:N,disableHoverableContent:m,children:n})})};Uk.displayName=Il;var Jp="TooltipTrigger",Vk=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=dc(Jp,n),i=Mg(Jp,n),o=rf(n),a=x.useRef(null),l=Gn(e,a,s.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),d=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),h.jsx(sk,{asChild:!0,...o,children:h.jsx(zn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:Ot(t.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ot(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:Ot(t.onPointerDown,()=>{s.open&&s.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ot(t.onFocus,()=>{c.current||s.onOpen()}),onBlur:Ot(t.onBlur,s.onClose),onClick:Ot(t.onClick,s.onClose)})})});Vk.displayName=Jp;var Rg="TooltipPortal",[YR,ZR]=nf(Rg,{forceMount:void 0}),Wk=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=dc(Rg,e);return h.jsx(YR,{scope:e,forceMount:n,children:h.jsx(Q0,{present:n||i.open,children:h.jsx(ek,{asChild:!0,container:s,children:r})})})};Wk.displayName=Rg;var va="TooltipContent",qk=x.forwardRef((t,e)=>{const n=ZR(va,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,o=dc(va,t.__scopeTooltip);return h.jsx(Q0,{present:r||o.open,children:o.disableHoverableContent?h.jsx(Kk,{side:s,...i,ref:e}):h.jsx(XR,{side:s,...i,ref:e})})}),XR=x.forwardRef((t,e)=>{const n=dc(va,t.__scopeTooltip),r=Mg(va,t.__scopeTooltip),s=x.useRef(null),i=Gn(e,s),[o,a]=x.useState(null),{trigger:l,onClose:c}=n,u=s.current,{onPointerInTransitChange:d}=r,f=x.useCallback(()=>{a(null),d(!1)},[d]),p=x.useCallback((m,g)=>{const b=m.currentTarget,y={x:m.clientX,y:m.clientY},w=rO(y,b.getBoundingClientRect()),v=sO(y,w),k=iO(g.getBoundingClientRect()),N=aO([...v,...k]);a(N),d(!0)},[d]);return x.useEffect(()=>()=>f(),[f]),x.useEffect(()=>{if(l&&u){const m=b=>p(b,u),g=b=>p(b,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",g)}}},[l,u,p,f]),x.useEffect(()=>{if(o){const m=g=>{const b=g.target,y={x:g.clientX,y:g.clientY},w=(l==null?void 0:l.contains(b))||(u==null?void 0:u.contains(b)),v=!oO(y,o);w?f():v&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(Kk,{...t,ref:i})}),[QR,eO]=nf(Il,{isInside:!1}),tO=VR("TooltipContent"),Kk=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=t,l=dc(va,n),c=rf(n),{onClose:u}=l;return x.useEffect(()=>(document.addEventListener(Gp,u),()=>document.removeEventListener(Gp,u)),[u]),x.useEffect(()=>{if(l.trigger){const d=f=>{const p=f.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),h.jsx(tk,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(nk,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(tO,{children:r}),h.jsx(QR,{scope:n,isInside:!0,children:h.jsx(qR,{id:l.contentId,role:"tooltip",children:s||r})})]})})});qk.displayName=va;var Gk="TooltipArrow",nO=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=rf(n);return eO(Gk,n).isInside?null:h.jsx(ik,{...s,...r,ref:e})});nO.displayName=Gk;function rO(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function sO(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function iO(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function oO(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(s=!s)}return s}function aO(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),lO(e)}function lO(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var cO=Hk,uO=Uk,dO=Vk,fO=Wk,Jk=qk;const po=cO,gr=uO,br=dO,er=x.forwardRef(({className:t,sideOffset:e=4,...n},r)=>h.jsx(fO,{children:h.jsx(Jk,{ref:r,sideOffset:e,className:Oe("z-50 origin-[--radix-tooltip-content-transform-origin] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));er.displayName=Jk.displayName;const Mo=ak,hO=lk,pO=ok,Yk=x.forwardRef(({className:t,...e},n)=>h.jsx(pg,{ref:n,className:Oe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));Yk.displayName=pg.displayName;const Ci=x.forwardRef(({className:t,children:e,...n},r)=>h.jsxs(pO,{children:[h.jsx(Yk,{}),h.jsx(mg,{ref:r,className:Oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:e})]}));Ci.displayName=mg.displayName;const Ni=({className:t,...e})=>h.jsx("div",{className:Oe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Ni.displayName="DialogHeader";const Og=({className:t,...e})=>h.jsx("div",{className:Oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Og.displayName="DialogFooter";const _i=x.forwardRef(({className:t,...e},n)=>h.jsx(gg,{ref:n,className:Oe("text-lg font-semibold leading-none tracking-tight",t),...e}));_i.displayName=gg.displayName;const sf=x.forwardRef(({className:t,...e},n)=>h.jsx(bg,{ref:n,className:Oe("text-sm text-muted-foreground",t),...e}));sf.displayName=bg.displayName;function Zk(t,e){return function(){return t.apply(e,arguments)}}const{toString:mO}=Object.prototype,{getPrototypeOf:Ig}=Object,{iterator:of,toStringTag:Xk}=Symbol,af=(t=>e=>{const n=mO.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Pr=t=>(t=t.toLowerCase(),e=>af(e)===t),lf=t=>e=>typeof e===t,{isArray:Pa}=Array,wa=lf("undefined");function fc(t){return t!==null&&!wa(t)&&t.constructor!==null&&!wa(t.constructor)&&Wn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Qk=Pr("ArrayBuffer");function gO(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Qk(t.buffer),e}const bO=lf("string"),Wn=lf("function"),eS=lf("number"),hc=t=>t!==null&&typeof t=="object",yO=t=>t===!0||t===!1,mu=t=>{if(af(t)!=="object")return!1;const e=Ig(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Xk in t)&&!(of in t)},xO=t=>{if(!hc(t)||fc(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},vO=Pr("Date"),wO=Pr("File"),kO=Pr("Blob"),SO=Pr("FileList"),EO=t=>hc(t)&&Wn(t.pipe),CO=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Wn(t.append)&&((e=af(t))==="formdata"||e==="object"&&Wn(t.toString)&&t.toString()==="[object FormData]"))},NO=Pr("URLSearchParams"),[_O,TO,AO,MO]=["ReadableStream","Request","Response","Headers"].map(Pr),RO=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function pc(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Pa(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(fc(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let a;for(r=0;r<o;r++)a=i[r],e.call(null,t[a],a,t)}}function tS(t,e){if(fc(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const $i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nS=t=>!wa(t)&&t!==$i;function Yp(){const{caseless:t,skipUndefined:e}=nS(this)&&this||{},n={},r=(s,i)=>{const o=t&&tS(n,i)||i;mu(n[o])&&mu(s)?n[o]=Yp(n[o],s):mu(s)?n[o]=Yp({},s):Pa(s)?n[o]=s.slice():(!e||!wa(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&pc(arguments[s],r);return n}const OO=(t,e,n,{allOwnKeys:r}={})=>(pc(e,(s,i)=>{n&&Wn(s)?t[i]=Zk(s,n):t[i]=s},{allOwnKeys:r}),t),IO=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),DO=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},LO=(t,e,n,r)=>{let s,i,o;const a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&Ig(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},PO=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},jO=t=>{if(!t)return null;if(Pa(t))return t;let e=t.length;if(!eS(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},zO=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ig(Uint8Array)),FO=(t,e)=>{const r=(t&&t[of]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},BO=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},$O=Pr("HTMLFormElement"),HO=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),By=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),UO=Pr("RegExp"),rS=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};pc(n,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(r[i]=o||s)}),Object.defineProperties(t,r)},VO=t=>{rS(t,(e,n)=>{if(Wn(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Wn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},WO=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Pa(t)?r(t):r(String(t).split(e)),n},qO=()=>{},KO=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function GO(t){return!!(t&&Wn(t.append)&&t[Xk]==="FormData"&&t[of])}const JO=t=>{const e=new Array(10),n=(r,s)=>{if(hc(r)){if(e.indexOf(r)>=0)return;if(fc(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Pa(r)?[]:{};return pc(r,(o,a)=>{const l=n(o,s+1);!wa(l)&&(i[a]=l)}),e[s]=void 0,i}}return r};return n(t,0)},YO=Pr("AsyncFunction"),ZO=t=>t&&(hc(t)||Wn(t))&&Wn(t.then)&&Wn(t.catch),sS=((t,e)=>t?setImmediate:e?((n,r)=>($i.addEventListener("message",({source:s,data:i})=>{s===$i&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),$i.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Wn($i.postMessage)),XO=typeof queueMicrotask<"u"?queueMicrotask.bind($i):typeof process<"u"&&process.nextTick||sS,QO=t=>t!=null&&Wn(t[of]),B={isArray:Pa,isArrayBuffer:Qk,isBuffer:fc,isFormData:CO,isArrayBufferView:gO,isString:bO,isNumber:eS,isBoolean:yO,isObject:hc,isPlainObject:mu,isEmptyObject:xO,isReadableStream:_O,isRequest:TO,isResponse:AO,isHeaders:MO,isUndefined:wa,isDate:vO,isFile:wO,isBlob:kO,isRegExp:UO,isFunction:Wn,isStream:EO,isURLSearchParams:NO,isTypedArray:zO,isFileList:SO,forEach:pc,merge:Yp,extend:OO,trim:RO,stripBOM:IO,inherits:DO,toFlatObject:LO,kindOf:af,kindOfTest:Pr,endsWith:PO,toArray:jO,forEachEntry:FO,matchAll:BO,isHTMLForm:$O,hasOwnProperty:By,hasOwnProp:By,reduceDescriptors:rS,freezeMethods:VO,toObjectSet:WO,toCamelCase:HO,noop:qO,toFiniteNumber:KO,findKey:tS,global:$i,isContextDefined:nS,isSpecCompliantForm:GO,toJSONObject:JO,isAsyncFn:YO,isThenable:ZO,setImmediate:sS,asap:XO,isIterable:QO};function $e(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}B.inherits($e,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.status}}});const iS=$e.prototype,oS={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{oS[t]={value:t}});Object.defineProperties($e,oS);Object.defineProperty(iS,"isAxiosError",{value:!0});$e.from=(t,e,n,r,s,i)=>{const o=Object.create(iS);B.toFlatObject(t,o,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return $e.call(o,a,l,n,r,s),t&&o.cause==null&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",i&&Object.assign(o,i),o};const eI=null;function Zp(t){return B.isPlainObject(t)||B.isArray(t)}function aS(t){return B.endsWith(t,"[]")?t.slice(0,-2):t}function $y(t,e,n){return t?t.concat(e).map(function(s,i){return s=aS(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function tI(t){return B.isArray(t)&&!t.some(Zp)}const nI=B.toFlatObject(B,{},null,function(e){return/^is[A-Z]/.test(e)});function cf(t,e,n){if(!B.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=B.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,b){return!B.isUndefined(b[g])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&B.isSpecCompliantForm(e);if(!B.isFunction(s))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if(B.isDate(m))return m.toISOString();if(B.isBoolean(m))return m.toString();if(!l&&B.isBlob(m))throw new $e("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(m)||B.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function u(m,g,b){let y=m;if(m&&!b&&typeof m=="object"){if(B.endsWith(g,"{}"))g=r?g:g.slice(0,-2),m=JSON.stringify(m);else if(B.isArray(m)&&tI(m)||(B.isFileList(m)||B.endsWith(g,"[]"))&&(y=B.toArray(m)))return g=aS(g),y.forEach(function(v,k){!(B.isUndefined(v)||v===null)&&e.append(o===!0?$y([g],k,i):o===null?g:g+"[]",c(v))}),!1}return Zp(m)?!0:(e.append($y(b,g,i),c(m)),!1)}const d=[],f=Object.assign(nI,{defaultVisitor:u,convertValue:c,isVisitable:Zp});function p(m,g){if(!B.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(m),B.forEach(m,function(y,w){(!(B.isUndefined(y)||y===null)&&s.call(e,y,B.isString(w)?w.trim():w,g,f))===!0&&p(y,g?g.concat(w):[w])}),d.pop()}}if(!B.isObject(t))throw new TypeError("data must be an object");return p(t),e}function Hy(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Dg(t,e){this._pairs=[],t&&cf(t,this,e)}const lS=Dg.prototype;lS.append=function(e,n){this._pairs.push([e,n])};lS.toString=function(e){const n=e?function(r){return e.call(this,r,Hy)}:Hy;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function rI(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function cS(t,e,n){if(!e)return t;const r=n&&n.encode||rI;B.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=B.isURLSearchParams(e)?e.toString():new Dg(e,n).toString(r),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Uy{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,function(r){r!==null&&e(r)})}}const uS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},sI=typeof URLSearchParams<"u"?URLSearchParams:Dg,iI=typeof FormData<"u"?FormData:null,oI=typeof Blob<"u"?Blob:null,aI={isBrowser:!0,classes:{URLSearchParams:sI,FormData:iI,Blob:oI},protocols:["http","https","file","blob","url","data"]},Lg=typeof window<"u"&&typeof document<"u",Xp=typeof navigator=="object"&&navigator||void 0,lI=Lg&&(!Xp||["ReactNative","NativeScript","NS"].indexOf(Xp.product)<0),cI=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",uI=Lg&&window.location.href||"http://localhost",dI=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Lg,hasStandardBrowserEnv:lI,hasStandardBrowserWebWorkerEnv:cI,navigator:Xp,origin:uI},Symbol.toStringTag,{value:"Module"})),xn={...dI,...aI};function fI(t,e){return cf(t,new xn.classes.URLSearchParams,{visitor:function(n,r,s,i){return xn.isNode&&B.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function hI(t){return B.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function pI(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function dS(t){function e(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&B.isArray(s)?s.length:o,l?(B.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!B.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],i)&&B.isArray(s[o])&&(s[o]=pI(s[o])),!a)}if(B.isFormData(t)&&B.isFunction(t.entries)){const n={};return B.forEachEntry(t,(r,s)=>{e(hI(r),s,n,0)}),n}return null}function mI(t,e,n){if(B.isString(t))try{return(e||JSON.parse)(t),B.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const mc={transitional:uS,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=B.isObject(e);if(i&&B.isHTMLForm(e)&&(e=new FormData(e)),B.isFormData(e))return s?JSON.stringify(dS(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e)||B.isReadableStream(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return fI(e,this.formSerializer).toString();if((a=B.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return cf(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),mI(e)):e}],transformResponse:[function(e){const n=this.transitional||mc.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(B.isResponse(e)||B.isReadableStream(e))return e;if(e&&B.isString(e)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?$e.from(a,$e.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xn.classes.FormData,Blob:xn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],t=>{mc.headers[t]={}});const gI=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),bI=t=>{const e={};let n,r,s;return t&&t.split(`
282
+ `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||e[n]&&gI[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Vy=Symbol("internals");function Ga(t){return t&&String(t).trim().toLowerCase()}function gu(t){return t===!1||t==null?t:B.isArray(t)?t.map(gu):String(t)}function yI(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const xI=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fh(t,e,n,r,s){if(B.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!B.isString(e)){if(B.isString(r))return e.indexOf(r)!==-1;if(B.isRegExp(r))return r.test(e)}}function vI(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function wI(t,e){const n=B.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}let qn=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(a,l,c){const u=Ga(l);if(!u)throw new Error("header name must be a non-empty string");const d=B.findKey(s,u);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||l]=gu(a))}const o=(a,l)=>B.forEach(a,(c,u)=>i(c,u,l));if(B.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(B.isString(e)&&(e=e.trim())&&!xI(e))o(bI(e),n);else if(B.isObject(e)&&B.isIterable(e)){let a={},l,c;for(const u of e){if(!B.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?B.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}o(a,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Ga(e),e){const r=B.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return yI(s);if(B.isFunction(n))return n.call(this,s,r);if(B.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ga(e),e){const r=B.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||fh(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(o){if(o=Ga(o),o){const a=B.findKey(r,o);a&&(!n||fh(r,r[a],a,n))&&(delete r[a],s=!0)}}return B.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||fh(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return B.forEach(this,(s,i)=>{const o=B.findKey(r,i);if(o){n[o]=gu(s),delete n[i];return}const a=e?vI(i):String(i).trim();a!==i&&delete n[i],n[a]=gu(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return B.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&B.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
283
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[Vy]=this[Vy]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Ga(o);r[a]||(wI(s,o),r[a]=!0)}return B.isArray(e)?e.forEach(i):i(e),this}};qn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors(qn.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});B.freezeMethods(qn);function hh(t,e){const n=this||mc,r=e||n,s=qn.from(r.headers);let i=r.data;return B.forEach(t,function(a){i=a.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function fS(t){return!!(t&&t.__CANCEL__)}function ja(t,e,n){$e.call(this,t??"canceled",$e.ERR_CANCELED,e,n),this.name="CanceledError"}B.inherits(ja,$e,{__CANCEL__:!0});function hS(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new $e("Request failed with status code "+n.status,[$e.ERR_BAD_REQUEST,$e.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function kI(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function SI(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[i];o||(o=c),n[s]=l,r[s]=c;let d=i,f=0;for(;d!==s;)f+=n[d++],d=d%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),c-o<e)return;const p=u&&c-u;return p?Math.round(f*1e3/p):void 0}}function EI(t,e){let n=0,r=1e3/e,s,i;const o=(c,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),t(...c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?o(c,u):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const Ru=(t,e,n=3)=>{let r=0;const s=SI(50,250);return EI(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),u=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},n)},Wy=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},qy=t=>(...e)=>B.asap(()=>t(...e)),CI=xn.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,xn.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(xn.origin),xn.navigator&&/(msie|trident)/i.test(xn.navigator.userAgent)):()=>!0,NI=xn.hasStandardBrowserEnv?{write(t,e,n,r,s,i,o){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];B.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),B.isString(r)&&a.push(`path=${r}`),B.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),B.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function _I(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function TI(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function pS(t,e,n){let r=!_I(e);return t&&(r||n==!1)?TI(t,e):e}const Ky=t=>t instanceof qn?{...t}:t;function mo(t,e){e=e||{};const n={};function r(c,u,d,f){return B.isPlainObject(c)&&B.isPlainObject(u)?B.merge.call({caseless:f},c,u):B.isPlainObject(u)?B.merge({},u):B.isArray(u)?u.slice():u}function s(c,u,d,f){if(B.isUndefined(u)){if(!B.isUndefined(c))return r(void 0,c,d,f)}else return r(c,u,d,f)}function i(c,u){if(!B.isUndefined(u))return r(void 0,u)}function o(c,u){if(B.isUndefined(u)){if(!B.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in t)return r(void 0,c)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>s(Ky(c),Ky(u),d,!0)};return B.forEach(Object.keys({...t,...e}),function(u){const d=l[u]||s,f=d(t[u],e[u],u);B.isUndefined(f)&&d!==a||(n[u]=f)}),n}const mS=t=>{const e=mo({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;if(e.headers=o=qn.from(o),e.url=cS(pS(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),B.isFormData(n)){if(xn.hasStandardBrowserEnv||xn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(B.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(xn.hasStandardBrowserEnv&&(r&&B.isFunction(r)&&(r=r(e)),r||r!==!1&&CI(e.url))){const l=s&&i&&NI.read(i);l&&o.set(s,l)}return e},AI=typeof XMLHttpRequest<"u",MI=AI&&function(t){return new Promise(function(n,r){const s=mS(t);let i=s.data;const o=qn.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,u,d,f,p,m;function g(){p&&p(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function y(){if(!b)return;const v=qn.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),N={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:v,config:t,request:b};hS(function(C){n(C),g()},function(C){r(C),g()},N),b=null}"onloadend"in b?b.onloadend=y:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(y)},b.onabort=function(){b&&(r(new $e("Request aborted",$e.ECONNABORTED,t,b)),b=null)},b.onerror=function(k){const N=k&&k.message?k.message:"Network Error",S=new $e(N,$e.ERR_NETWORK,t,b);S.event=k||null,r(S),b=null},b.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const N=s.transitional||uS;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new $e(k,N.clarifyTimeoutError?$e.ETIMEDOUT:$e.ECONNABORTED,t,b)),b=null},i===void 0&&o.setContentType(null),"setRequestHeader"in b&&B.forEach(o.toJSON(),function(k,N){b.setRequestHeader(N,k)}),B.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),a&&a!=="json"&&(b.responseType=s.responseType),c&&([f,m]=Ru(c,!0),b.addEventListener("progress",f)),l&&b.upload&&([d,p]=Ru(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(u=v=>{b&&(r(!v||v.type?new ja(null,t,b):v),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const w=kI(s.url);if(w&&xn.protocols.indexOf(w)===-1){r(new $e("Unsupported protocol "+w+":",$e.ERR_BAD_REQUEST,t));return}b.send(i||null)})},RI=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof $e?u:new ja(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new $e(`timeout ${e} of ms exceeded`,$e.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),t=null)};t.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>B.asap(a),l}},OI=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},II=async function*(t,e){for await(const n of DI(t))yield*OI(n,e)},DI=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},Gy=(t,e,n,r)=>{const s=II(t,e);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await s.next();if(c){a(),l.close();return}let d=u.byteLength;if(n){let f=i+=d;n(f)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},Jy=64*1024,{isFunction:Fc}=B,LI=(({Request:t,Response:e})=>({Request:t,Response:e}))(B.global),{ReadableStream:Yy,TextEncoder:Zy}=B.global,Xy=(t,...e)=>{try{return!!t(...e)}catch{return!1}},PI=t=>{t=B.merge.call({skipUndefined:!0},LI,t);const{fetch:e,Request:n,Response:r}=t,s=e?Fc(e):typeof fetch=="function",i=Fc(n),o=Fc(r);if(!s)return!1;const a=s&&Fc(Yy),l=s&&(typeof Zy=="function"?(m=>g=>m.encode(g))(new Zy):async m=>new Uint8Array(await new n(m).arrayBuffer())),c=i&&a&&Xy(()=>{let m=!1;const g=new n(xn.origin,{body:new Yy,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!g}),u=o&&a&&Xy(()=>B.isReadableStream(new r("").body)),d={stream:u&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!d[m]&&(d[m]=(g,b)=>{let y=g&&g[m];if(y)return y.call(g);throw new $e(`Response type '${m}' is not supported`,$e.ERR_NOT_SUPPORT,b)})});const f=async m=>{if(m==null)return 0;if(B.isBlob(m))return m.size;if(B.isSpecCompliantForm(m))return(await new n(xn.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(B.isArrayBufferView(m)||B.isArrayBuffer(m))return m.byteLength;if(B.isURLSearchParams(m)&&(m=m+""),B.isString(m))return(await l(m)).byteLength},p=async(m,g)=>{const b=B.toFiniteNumber(m.getContentLength());return b??f(g)};return async m=>{let{url:g,method:b,data:y,signal:w,cancelToken:v,timeout:k,onDownloadProgress:N,onUploadProgress:S,responseType:C,headers:_,withCredentials:O="same-origin",fetchOptions:T}=mS(m),I=e||fetch;C=C?(C+"").toLowerCase():"text";let D=RI([w,v&&v.toAbortSignal()],k),V=null;const z=D&&D.unsubscribe&&(()=>{D.unsubscribe()});let j;try{if(S&&c&&b!=="get"&&b!=="head"&&(j=await p(_,y))!==0){let ce=new n(g,{method:"POST",body:y,duplex:"half"}),ye;if(B.isFormData(y)&&(ye=ce.headers.get("content-type"))&&_.setContentType(ye),ce.body){const[E,P]=Wy(j,Ru(qy(S)));y=Gy(ce.body,Jy,E,P)}}B.isString(O)||(O=O?"include":"omit");const q=i&&"credentials"in n.prototype,re={...T,signal:D,method:b.toUpperCase(),headers:_.normalize().toJSON(),body:y,duplex:"half",credentials:q?O:void 0};V=i&&new n(g,re);let G=await(i?I(V,T):I(g,re));const ue=u&&(C==="stream"||C==="response");if(u&&(N||ue&&z)){const ce={};["status","statusText","headers"].forEach(F=>{ce[F]=G[F]});const ye=B.toFiniteNumber(G.headers.get("content-length")),[E,P]=N&&Wy(ye,Ru(qy(N),!0))||[];G=new r(Gy(G.body,Jy,E,()=>{P&&P(),z&&z()}),ce)}C=C||"text";let A=await d[B.findKey(d,C)||"text"](G,m);return!ue&&z&&z(),await new Promise((ce,ye)=>{hS(ce,ye,{data:A,headers:qn.from(G.headers),status:G.status,statusText:G.statusText,config:m,request:V})})}catch(q){throw z&&z(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new $e("Network Error",$e.ERR_NETWORK,m,V),{cause:q.cause||q}):$e.from(q,q&&q.code,m,V)}}},jI=new Map,gS=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let o=i.length,a=o,l,c,u=jI;for(;a--;)l=i[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:PI(e)),u=c;return c};gS();const Pg={http:eI,xhr:MI,fetch:{get:gS}};B.forEach(Pg,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Qy=t=>`- ${t}`,zI=t=>B.isFunction(t)||t===null||t===!1;function FI(t,e){t=B.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let o=0;o<n;o++){r=t[o];let a;if(s=r,!zI(r)&&(s=Pg[(a=String(r)).toLowerCase()],s===void 0))throw new $e(`Unknown adapter '${a}'`);if(s&&(B.isFunction(s)||(s=s.get(e))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
284
+ `+o.map(Qy).join(`
285
+ `):" "+Qy(o[0]):"as no adapter specified";throw new $e("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const bS={getAdapter:FI,adapters:Pg};function ph(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ja(null,t)}function ex(t){return ph(t),t.headers=qn.from(t.headers),t.data=hh.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),bS.getAdapter(t.adapter||mc.adapter,t)(t).then(function(r){return ph(t),r.data=hh.call(t,t.transformResponse,r),r.headers=qn.from(r.headers),r},function(r){return fS(r)||(ph(t),r&&r.response&&(r.response.data=hh.call(t,t.transformResponse,r.response),r.response.headers=qn.from(r.response.headers))),Promise.reject(r)})}const yS="1.13.2",uf={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{uf[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const tx={};uf.transitional=function(e,n,r){function s(i,o){return"[Axios v"+yS+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new $e(s(o," has been removed"+(n?" in "+n:"")),$e.ERR_DEPRECATED);return n&&!tx[o]&&(tx[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,o,a):!0}};uf.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function BI(t,e,n){if(typeof t!="object")throw new $e("options must be an object",$e.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],o=e[i];if(o){const a=t[i],l=a===void 0||o(a,i,t);if(l!==!0)throw new $e("option "+i+" must be "+l,$e.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new $e("Unknown option "+i,$e.ERR_BAD_OPTION)}}const bu={assertOptions:BI,validators:uf},Hr=bu.validators;let to=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Uy,response:new Uy}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
286
+ `+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=mo(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&bu.assertOptions(r,{silentJSONParsing:Hr.transitional(Hr.boolean),forcedJSONParsing:Hr.transitional(Hr.boolean),clarifyTimeoutError:Hr.transitional(Hr.boolean)},!1),s!=null&&(B.isFunction(s)?n.paramsSerializer={serialize:s}:bu.assertOptions(s,{encode:Hr.function,serialize:Hr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),bu.assertOptions(n,{baseUrl:Hr.spelling("baseURL"),withXsrfToken:Hr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&B.merge(i.common,i[n.method]);i&&B.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=qn.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(l=l&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,f;if(!l){const m=[ex.bind(this),void 0];for(m.unshift(...a),m.push(...c),f=m.length,u=Promise.resolve(n);d<f;)u=u.then(m[d++],m[d++]);return u}f=a.length;let p=n;for(;d<f;){const m=a[d++],g=a[d++];try{p=m(p)}catch(b){g.call(this,b);break}}try{u=ex.call(this,p)}catch(m){return Promise.reject(m)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=mo(this.defaults,e);const n=pS(e.baseURL,e.url,e.allowAbsoluteUrls);return cS(n,e.params,e.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(e){to.prototype[e]=function(n,r){return this.request(mo(r||{},{method:e,url:n,data:(r||{}).data}))}});B.forEach(["post","put","patch"],function(e){function n(r){return function(i,o,a){return this.request(mo(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}to.prototype[e]=n(),to.prototype[e+"Form"]=n(!0)});let $I=class xS{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new ja(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new xS(function(s){e=s}),cancel:e}}};function HI(t){return function(n){return t.apply(null,n)}}function UI(t){return B.isObject(t)&&t.isAxiosError===!0}const Qp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Qp).forEach(([t,e])=>{Qp[e]=t});function vS(t){const e=new to(t),n=Zk(to.prototype.request,e);return B.extend(n,to.prototype,e,{allOwnKeys:!0}),B.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return vS(mo(t,s))},n}const $t=vS(mc);$t.Axios=to;$t.CanceledError=ja;$t.CancelToken=$I;$t.isCancel=fS;$t.VERSION=yS;$t.toFormData=cf;$t.AxiosError=$e;$t.Cancel=$t.CanceledError;$t.all=function(e){return Promise.all(e)};$t.spread=HI;$t.isAxiosError=UI;$t.mergeConfig=mo;$t.AxiosHeaders=qn;$t.formToJSON=t=>dS(B.isHTMLForm(t)?new FormData(t):t);$t.getAdapter=bS.getAdapter;$t.HttpStatusCode=Qp;$t.default=$t;const{Axios:EY,AxiosError:CY,CanceledError:NY,isCancel:_Y,CancelToken:TY,VERSION:AY,all:MY,Cancel:RY,isAxiosError:OY,spread:IY,toFormData:DY,AxiosHeaders:LY,HttpStatusCode:PY,formToJSON:jY,getAdapter:zY,mergeConfig:FY}=$t;function VI({isOpen:t,onClose:e}){const{theme:n,setTheme:r}=OM(),[s,i]=x.useState(null),o=()=>{r(n==="dark"?"light":"dark")};return x.useEffect(()=>{t&&(async()=>{try{const l=await $t.get("/api/version");i(l.data)}catch(l){console.error("Failed to fetch version information:",l)}})()},[t]),h.jsx(Mo,{open:t,onOpenChange:e,children:h.jsxs(Ci,{className:"max-w-md",children:[h.jsx(Ni,{children:h.jsx(_i,{children:"Settings"})}),h.jsxs("div",{className:"space-y-6 py-4",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Appearance"}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"Theme"}),h.jsx("button",{onClick:o,className:Oe("flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors","bg-accent text-foreground hover:bg-accent/80"),children:n==="dark"?h.jsxs(h.Fragment,{children:[h.jsx(aR,{className:"h-4 w-4"}),h.jsx("span",{children:"Light Mode"})]}):h.jsxs(h.Fragment,{children:[h.jsx(rR,{className:"h-4 w-4"}),h.jsx("span",{children:"Dark Mode"})]})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Version"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"CLI"}),h.jsx("span",{className:"text-sm text-foreground font-mono",children:(s==null?void 0:s.cli)??"Loading..."})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"Server"}),h.jsx("span",{className:"text-sm text-foreground font-mono",children:(s==null?void 0:s.server)??"Loading..."})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"Frontend"}),h.jsx("span",{className:"text-sm text-foreground font-mono",children:(s==null?void 0:s.frontend)??"Loading..."})]})]})]})]})]})})}function WI({isOpen:t,onClose:e}){const n=[{title:"Docs",description:"Learn how to use sudocode",url:"https://docs.sudocode.ai",icon:As},{title:"GitHub Issues",description:"Report bugs or request features",url:"https://github.com/sudocode-ai/sudocode/issues",icon:VM},{title:"Discord Community",description:"Join our community for help and discussion",url:"https://discord.gg/T3kR4EzQ6V",icon:tR}];return h.jsx(Mo,{open:t,onOpenChange:e,children:h.jsxs(Ci,{className:"max-w-md",children:[h.jsx(Ni,{children:h.jsx(_i,{children:"Resources"})}),h.jsx("div",{className:"space-y-3 py-4",children:n.map(r=>{const s=r.icon;return h.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:Oe("flex items-start gap-3 rounded-lg border border-border p-4 transition-colors","hover:border-accent-foreground/20 hover:bg-accent"),children:[h.jsx(s,{className:"h-5 w-5 flex-shrink-0 text-muted-foreground"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:r.title}),h.jsx(UM,{className:"h-3 w-3 text-muted-foreground"})]}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r.description})]})]},r.url)})})]})})}function qI({open:t,collapsed:e,onClose:n}){const r=$A(),[s,i]=x.useState(!1),[o,a]=x.useState(!1),l=u=>r.pathname.startsWith(u),c=[{path:"/issues",label:"Issues",icon:XM},{path:"/specs",label:"Specs",icon:As}];return h.jsxs(po,{delayDuration:300,children:[t&&h.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:n,"aria-hidden":"true"}),h.jsxs("aside",{className:Oe("fixed inset-y-0 left-0 z-50 flex flex-col border-r border-border bg-background transition-all duration-300 md:sticky md:top-0 md:z-30 md:h-screen md:translate-x-0",t?"translate-x-0":"-translate-x-full",e?"w-16":"w-64"),children:[h.jsx("div",{className:"hidden h-16 items-center justify-center md:flex",children:h.jsx("img",{src:"/logo.png",alt:"Logo",className:Oe("h-10 w-10 rounded-md transition-all duration-300")})}),h.jsxs("div",{className:"flex h-16 items-center justify-between border-b border-border px-4 md:hidden",children:[h.jsx("img",{src:"/logo.png",alt:"Logo",className:"h-8 w-8 rounded-md"}),h.jsx("button",{onClick:n,className:"rounded-md p-2 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":"Close menu",children:h.jsx(hl,{className:"h-5 w-5"})})]}),h.jsx("nav",{className:Oe("flex-1 space-y-1 p-2",e?"px-2":"px-3"),children:c.map(u=>{const d=u.icon,f=l(u.path),p=h.jsxs(yg,{to:u.path,onClick:n,className:Oe("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",f?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground",e&&"justify-center px-2"),children:[h.jsx(d,{className:"h-5 w-5 flex-shrink-0"+(f?" text-white":"")}),!e&&h.jsx("span",{children:u.label})]},u.path);return e?h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:p}),h.jsx(er,{side:"right",children:u.label})]},u.path):p})}),h.jsx("div",{children:h.jsxs("div",{className:Oe("space-y-1 p-2",e?"px-2":"px-3"),children:[e?h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx("button",{onClick:()=>a(!0),className:Oe("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",e&&"justify-center px-2"),"aria-label":"Help",children:h.jsx(Ly,{className:"h-5 w-5 flex-shrink-0"})})}),h.jsx(er,{side:"right",children:"Help"})]}):h.jsxs("button",{onClick:()=>a(!0),className:Oe("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"),"aria-label":"Help",children:[h.jsx(Ly,{className:"h-5 w-5 flex-shrink-0"}),h.jsx("span",{children:"Help"})]}),e?h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx("button",{onClick:()=>i(!0),className:Oe("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",e&&"justify-center px-2"),"aria-label":"Settings",children:h.jsx(Py,{className:"h-5 w-5 flex-shrink-0"})})}),h.jsx(er,{side:"right",children:"Settings"})]}):h.jsxs("button",{onClick:()=>i(!0),className:Oe("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"),"aria-label":"Settings",children:[h.jsx(Py,{className:"h-5 w-5 flex-shrink-0"}),h.jsx("span",{children:"Settings"})]})]})})]}),h.jsx(WI,{isOpen:o,onClose:()=>a(!1)}),h.jsx(VI,{isOpen:s,onClose:()=>i(!1)})]})}function KI(){const[t,e]=x.useState(!1);return h.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[!t&&h.jsx("button",{onClick:()=>e(!0),className:"fixed left-4 top-4 z-40 inline-flex rounded-md bg-background p-2 text-muted-foreground shadow-lg ring-1 ring-border hover:bg-accent hover:text-foreground md:hidden","aria-label":"Toggle menu",children:h.jsx(eR,{className:"h-5 w-5"})}),h.jsx(qI,{open:t,collapsed:!0,onClose:()=>e(!1)}),h.jsx("main",{className:"flex-1 overflow-y-auto",children:h.jsx(HA,{})})]})}const gc=$t.create({baseURL:"/api",timeout:3e4,headers:{"Content-Type":"application/json"}});gc.interceptors.response.use(t=>{const e=t.data;if(!e.success){const n=new Error(e.message||"API request failed");throw n.response={data:e.error_data,status:t.status},n}return e.data},t=>{if(console.error("API Error:",t),!t.response)throw new Error("Network error: Please check your connection");const e=t.response.status;throw e===404?new Error("Resource not found"):e===500?new Error("Server error: Please try again later"):t});const Or=t=>gc.get(t),no=(t,e)=>gc.post(t,e),jg=(t,e)=>gc.put(t,e),ka=(t,e)=>gc.delete(t,e?{data:e}:void 0),Ko={getAll:t=>{const e=t!==void 0?`?archived=${t}`:"";return Or(`/issues${e}`)},getById:t=>Or(`/issues/${t}`),create:t=>no("/issues",t),update:(t,e)=>jg(`/issues/${t}`,e),delete:t=>ka(`/issues/${t}`)},Go={getAll:t=>{const e=t!==void 0?`?archived=${t}`:"";return Or(`/specs${e}`)},getById:t=>Or(`/specs/${t}`),create:t=>no("/specs",t),update:(t,e)=>jg(`/specs/${t}`,e),delete:t=>ka(`/specs/${t}`),getFeedback:t=>Or(`/feedback?spec_id=${t}`)},Qo={getForEntity:(t,e)=>Or(`/relationships/${e}/${t}`),create:t=>no("/relationships",t),delete:t=>ka("/relationships",t)},mh={getForSpec:t=>Or(`/feedback?spec_id=${t}`),getById:t=>Or(`/feedback/${t}`),create:t=>no("/feedback",t),update:(t,e)=>jg(`/feedback/${t}`,e),delete:t=>ka(`/feedback/${t}`)},ur={prepare:(t,e)=>no(`/issues/${t}/executions/prepare`,e),create:(t,e)=>no(`/issues/${t}/executions`,e),getById:t=>Or(`/executions/${t}`),list:t=>Or(`/issues/${t}/executions`),createFollowUp:(t,e)=>no(`/executions/${t}/follow-up`,e),cancel:t=>ka(`/executions/${t}`),worktreeExists:t=>Or(`/executions/${t}/worktree`),deleteWorktree:t=>ka(`/executions/${t}/worktree`)};function df(t){const e=Ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Xd(),a=cc({queryKey:t!==void 0?["issues",{archived:t}]:["issues"],queryFn:()=>Ko.getAll(t)}),l=x.useCallback(m=>{(m.type==="issue_created"||m.type==="issue_updated"||m.type==="issue_deleted")&&e.invalidateQueries({queryKey:["issues"]})},[e]);x.useEffect(()=>{const m="useIssues";return i(m,l),n&&r("issue"),()=>{o(m),s("issue")}},[n,r,s,i,o,l]);const c=xr({mutationFn:({id:m,data:g})=>Ko.update(m,g),onMutate:async({id:m,data:g})=>{await e.cancelQueries({queryKey:["issues"]});const b=e.getQueryData(["issues"]);return e.setQueryData(["issues"],y=>y==null?void 0:y.map(w=>w.id===m?{...w,...g}:w)),{previousIssues:b}},onError:(m,g,b)=>{b!=null&&b.previousIssues&&e.setQueryData(["issues"],b.previousIssues)},onSettled:()=>{e.invalidateQueries({queryKey:["issues"]})}}),u=xr({mutationFn:Ko.create,onSuccess:()=>{e.invalidateQueries({queryKey:["issues"]})}}),d=xr({mutationFn:Ko.delete,onSuccess:()=>{e.invalidateQueries({queryKey:["issues"]})}}),f=m=>c.mutate({id:m,data:{archived:!0}}),p=m=>c.mutate({id:m,data:{archived:!1}});return{issues:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error,updateIssue:c.mutate,updateIssueAsync:c.mutateAsync,createIssue:u.mutate,createIssueAsync:u.mutateAsync,deleteIssue:d.mutate,deleteIssueAsync:d.mutateAsync,archiveIssue:f,unarchiveIssue:p,isUpdating:c.isPending,isCreating:u.isPending,isDeleting:d.isPending}}function GI(t){return cc({queryKey:["issues",t],queryFn:()=>Ko.getById(t),enabled:!!t})}function JI(){const t=Ts();return xr({mutationFn:({id:e,status:n})=>Ko.update(e,{status:n}),onMutate:async({id:e,status:n})=>{await t.cancelQueries({queryKey:["issues"]});const r=t.getQueryData(["issues"]);return t.setQueryData(["issues"],s=>s==null?void 0:s.map(i=>i.id===e?{...i,status:n}:i)),{previousIssues:r}},onError:(e,n,r)=>{r!=null&&r.previousIssues&&t.setQueryData(["issues"],r.previousIssues)},onSettled:()=>{t.invalidateQueries({queryKey:["issues"]})}})}const Bt=x.forwardRef(({className:t,...e},n)=>h.jsx("div",{ref:n,className:Oe("bg-card text-card-foreground",t),...e}));Bt.displayName="Card";const YI=x.forwardRef(({className:t,...e},n)=>h.jsx("div",{ref:n,className:Oe("flex flex-col space-y-1.5 p-6",t),...e}));YI.displayName="CardHeader";const ZI=x.forwardRef(({className:t,...e},n)=>h.jsx("div",{ref:n,className:Oe("text-2xl font-semibold leading-none tracking-tight",t),...e}));ZI.displayName="CardTitle";const XI=x.forwardRef(({className:t,...e},n)=>h.jsx("div",{ref:n,className:Oe("text-sm text-muted-foreground",t),...e}));XI.displayName="CardDescription";const QI=x.forwardRef(({className:t,...e},n)=>h.jsx("div",{ref:n,className:Oe("p-6 pt-0",t),...e}));QI.displayName="CardContent";const eD=x.forwardRef(({className:t,...e},n)=>h.jsx("div",{ref:n,className:Oe("flex items-center p-6 pt-0",t),...e}));eD.displayName="CardFooter";const nx=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rx=Ik,wS=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return rx(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(c=>{const u=n==null?void 0:n[c],d=i==null?void 0:i[c];if(u===null)return null;const f=nx(u)||nx(d);return s[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...p}=u;return Object.entries(p).every(m=>{let[g,b]=m;return Array.isArray(b)?b.includes({...i,...a}[g]):{...i,...a}[g]===b})?[...c,d,f]:c},[]);return rx(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},tD=wS("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",issue:"border-blue-500/20 bg-blue-500/10 text-blue-600 dark:text-blue-400 hover:bg-blue-500/20",spec:"border-purple-500/20 bg-purple-500/10 text-purple-600 dark:text-purple-400 hover:bg-purple-500/20"}},defaultVariants:{variant:"default"}});function ct({className:t,variant:e,...n}){return h.jsx("div",{className:Oe(tD({variant:e}),t),...n})}const ff=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function zg(t){return"nodeType"in t}function Fn(t){var e,n;return t?za(t)?t:zg(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Fg(t){const{Document:e}=Fn(t);return t instanceof e}function bc(t){return za(t)?!1:t instanceof Fn(t).HTMLElement}function kS(t){return t instanceof Fn(t).SVGElement}function Fa(t){return t?za(t)?t.document:zg(t)?Fg(t)?t:bc(t)||kS(t)?t.ownerDocument:document:document:document}const Cs=ff?x.useLayoutEffect:x.useEffect;function hf(t){const e=x.useRef(t);return Cs(()=>{e.current=t}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}function nD(){const t=x.useRef(null),e=x.useCallback((r,s)=>{t.current=setInterval(r,s)},[]),n=x.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Dl(t,e){e===void 0&&(e=[t]);const n=x.useRef(t);return Cs(()=>{n.current!==t&&(n.current=t)},e),n}function yc(t,e){const n=x.useRef();return x.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Ou(t){const e=hf(t),n=x.useRef(null),r=x.useCallback(s=>{s!==n.current&&(e==null||e(s,n.current)),n.current=s},[]);return[n,r]}function Iu(t){const e=x.useRef();return x.useEffect(()=>{e.current=t},[t]),e.current}let gh={};function pf(t,e){return x.useMemo(()=>{if(e)return e;const n=gh[t]==null?0:gh[t]+1;return gh[t]=n,t+"-"+n},[t,e])}function SS(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+t*c)}return i},{...e})}}const ea=SS(1),Du=SS(-1);function rD(t){return"clientX"in t&&"clientY"in t}function Bg(t){if(!t)return!1;const{KeyboardEvent:e}=Fn(t.target);return e&&t instanceof e}function sD(t){if(!t)return!1;const{TouchEvent:e}=Fn(t.target);return e&&t instanceof e}function Lu(t){if(sD(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return rD(t)?{x:t.clientX,y:t.clientY}:null}const Ll=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Ll.Translate.toString(t),Ll.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),sx="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function iD(t){return t.matches(sx)?t:t.querySelector(sx)}const oD={display:"none"};function aD(t){let{id:e,value:n}=t;return ht.createElement("div",{id:e,style:oD},n)}function lD(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ht.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function cD(){const[t,e]=x.useState("");return{announce:x.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const ES=x.createContext(null);function uD(t){const e=x.useContext(ES);x.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function dD(){const[t]=x.useState(()=>new Set),e=x.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[x.useCallback(r=>{let{type:s,event:i}=r;t.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[t]),e]}const fD={draggable:`
287
+ To pick up a draggable item, press the space bar.
288
+ While dragging, use the arrow keys to move the item.
289
+ Press space again to drop the item in its new position, or press escape to cancel.
290
+ `},hD={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function pD(t){let{announcements:e=hD,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=fD}=t;const{announce:i,announcement:o}=cD(),a=pf("DndLiveRegion"),[l,c]=x.useState(!1);if(x.useEffect(()=>{c(!0)},[]),uD(x.useMemo(()=>({onDragStart(d){let{active:f}=d;i(e.onDragStart({active:f}))},onDragMove(d){let{active:f,over:p}=d;e.onDragMove&&i(e.onDragMove({active:f,over:p}))},onDragOver(d){let{active:f,over:p}=d;i(e.onDragOver({active:f,over:p}))},onDragEnd(d){let{active:f,over:p}=d;i(e.onDragEnd({active:f,over:p}))},onDragCancel(d){let{active:f,over:p}=d;i(e.onDragCancel({active:f,over:p}))}}),[i,e])),!l)return null;const u=ht.createElement(ht.Fragment,null,ht.createElement(aD,{id:r,value:s.draggable}),ht.createElement(lD,{id:a,announcement:o}));return n?li.createPortal(u,n):u}var Zt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Zt||(Zt={}));function Pu(){}function mD(t,e){return x.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function gD(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return x.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const Lr=Object.freeze({x:0,y:0});function bD(t,e){const n=Lu(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function yD(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function xD(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function vD(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),o=s-r,a=i-n;if(r<s&&n<i){const l=e.width*e.height,c=t.width*t.height,u=o*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const CS=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:o}=i,a=n.get(o);if(a){const l=vD(a,e);l>0&&s.push({id:o,data:{droppableContainer:i,value:l}})}}return s.sort(yD)};function wD(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function NS(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Lr}function kD(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const SD=kD(1);function _S(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function ED(t,e,n){const r=_S(e);if(!r)return t;const{scaleX:s,scaleY:i,x:o,y:a}=r,l=t.left-o-(1-s)*parseFloat(n),c=t.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=s?t.width/s:t.width,d=i?t.height/i:t.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const CD={ignoreTransform:!1};function xc(t,e){e===void 0&&(e=CD);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=Fn(t).getComputedStyle(t);c&&(n=ED(n,c,u))}const{top:r,left:s,width:i,height:o,bottom:a,right:l}=n;return{top:r,left:s,width:i,height:o,bottom:a,right:l}}function ix(t){return xc(t,{ignoreTransform:!0})}function ND(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function _D(t,e){return e===void 0&&(e=Fn(t).getComputedStyle(t)),e.position==="fixed"}function TD(t,e){e===void 0&&(e=Fn(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function $g(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Fg(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!bc(s)||kS(s)||n.includes(s))return n;const i=Fn(t).getComputedStyle(s);return s!==t&&TD(s,i)&&n.push(s),_D(s,i)?n:r(s.parentNode)}return t?r(t):n}function TS(t){const[e]=$g(t,1);return e??null}function bh(t){return!ff||!t?null:za(t)?t:zg(t)?Fg(t)||t===Fa(t).scrollingElement?window:bc(t)?t:null:null}function AS(t){return za(t)?t.scrollX:t.scrollLeft}function MS(t){return za(t)?t.scrollY:t.scrollTop}function em(t){return{x:AS(t),y:MS(t)}}var sn;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(sn||(sn={}));function RS(t){return!ff||!t?!1:t===document.scrollingElement}function OS(t){const e={x:0,y:0},n=RS(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const AD={x:.2,y:.2};function MD(t,e,n,r,s){let{top:i,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=AD);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=OS(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*s.y,width:e.width*s.x};return!c&&i<=e.top+g.height?(p.y=sn.Backward,m.y=r*Math.abs((e.top+g.height-i)/g.height)):!u&&l>=e.bottom-g.height&&(p.y=sn.Forward,m.y=r*Math.abs((e.bottom-g.height-l)/g.height)),!f&&a>=e.right-g.width?(p.x=sn.Forward,m.x=r*Math.abs((e.right-g.width-a)/g.width)):!d&&o<=e.left+g.width&&(p.x=sn.Backward,m.x=r*Math.abs((e.left+g.width-o)/g.width)),{direction:p,speed:m}}function RD(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function IS(t){return t.reduce((e,n)=>ea(e,em(n)),Lr)}function OD(t){return t.reduce((e,n)=>e+AS(n),0)}function ID(t){return t.reduce((e,n)=>e+MS(n),0)}function DS(t,e){if(e===void 0&&(e=xc),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);TS(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const DD=[["x",["left","right"],OD],["y",["top","bottom"],ID]];class Hg{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=$g(n),s=IS(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,o,a]of DD)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=s[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class pl{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function LD(t){const{EventTarget:e}=Fn(t);return t instanceof e?t:Fa(t)}function yh(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var hr;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(hr||(hr={}));function ox(t){t.preventDefault()}function PD(t){t.stopPropagation()}var bt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(bt||(bt={}));const LS={start:[bt.Space,bt.Enter],cancel:[bt.Esc],end:[bt.Space,bt.Enter,bt.Tab]},jD=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case bt.Right:return{...n,x:n.x+25};case bt.Left:return{...n,x:n.x-25};case bt.Down:return{...n,y:n.y+25};case bt.Up:return{...n,y:n.y-25}}};class PS{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new pl(Fa(n)),this.windowListeners=new pl(Fn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(hr.Resize,this.handleCancel),this.windowListeners.add(hr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(hr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&DS(r),n(Lr)}handleKeyDown(e){if(Bg(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=LS,coordinateGetter:o=jD,scrollBehavior:a="smooth"}=s,{code:l}=e;if(i.end.includes(l)){this.handleEnd(e);return}if(i.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Lr;this.referenceCoordinates||(this.referenceCoordinates=u);const d=o(e,{active:n,context:r.current,currentCoordinates:u});if(d){const f=Du(d,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const b=e.code,{isTop:y,isRight:w,isLeft:v,isBottom:k,maxScroll:N,minScroll:S}=OS(g),C=RD(g),_={x:Math.min(b===bt.Right?C.right-C.width/2:C.right,Math.max(b===bt.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(b===bt.Down?C.bottom-C.height/2:C.bottom,Math.max(b===bt.Down?C.top:C.top+C.height/2,d.y))},O=b===bt.Right&&!w||b===bt.Left&&!v,T=b===bt.Down&&!k||b===bt.Up&&!y;if(O&&_.x!==d.x){const I=g.scrollLeft+f.x,D=b===bt.Right&&I<=N.x||b===bt.Left&&I>=S.x;if(D&&!f.y){g.scrollTo({left:I,behavior:a});return}D?p.x=g.scrollLeft-I:p.x=b===bt.Right?g.scrollLeft-N.x:g.scrollLeft-S.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(T&&_.y!==d.y){const I=g.scrollTop+f.y,D=b===bt.Down&&I<=N.y||b===bt.Up&&I>=S.y;if(D&&!f.x){g.scrollTo({top:I,behavior:a});return}D?p.y=g.scrollTop-I:p.y=b===bt.Down?g.scrollTop-N.y:g.scrollTop-S.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,ea(Du(d,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}PS.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=LS,onActivation:s}=e,{active:i}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=i.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),s==null||s({event:t.nativeEvent}),!0)}return!1}}];function ax(t){return!!(t&&"distance"in t)}function lx(t){return!!(t&&"delay"in t)}class Ug{constructor(e,n,r){var s;r===void 0&&(r=LD(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:o}=i;this.props=e,this.events=n,this.document=Fa(o),this.documentListeners=new pl(this.document),this.listeners=new pl(r),this.windowListeners=new pl(Fn(o)),this.initialCoordinates=(s=Lu(i))!=null?s:Lr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(hr.Resize,this.handleCancel),this.windowListeners.add(hr.DragStart,ox),this.windowListeners.add(hr.VisibilityChange,this.handleCancel),this.windowListeners.add(hr.ContextMenu,ox),this.documentListeners.add(hr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(lx(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(ax(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(hr.Click,PD,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(hr.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const l=(n=Lu(e))!=null?n:Lr,c=Du(s,l);if(!r&&a){if(ax(a)){if(a.tolerance!=null&&yh(c,a.tolerance))return this.handleCancel();if(yh(c,a.distance))return this.handleStart()}if(lx(a)&&yh(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===bt.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const zD={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vg extends Ug{constructor(e){const{event:n}=e,r=Fa(n.target);super(e,zD,r)}}Vg.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const FD={move:{name:"mousemove"},end:{name:"mouseup"}};var tm;(function(t){t[t.RightClick=2]="RightClick"})(tm||(tm={}));class BD extends Ug{constructor(e){super(e,FD,Fa(e.event.target))}}BD.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===tm.RightClick?!1:(r==null||r({event:n}),!0)}}];const xh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class $D extends Ug{constructor(e){super(e,xh)}static setup(){return window.addEventListener(xh.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(xh.move.name,e)};function e(){}}}$D.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var ml;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ml||(ml={}));var ju;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ju||(ju={}));function HD(t){let{acceleration:e,activator:n=ml.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:a=ju.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:f}=t;const p=VD({delta:d,disabled:!i}),[m,g]=nD(),b=x.useRef({x:0,y:0}),y=x.useRef({x:0,y:0}),w=x.useMemo(()=>{switch(n){case ml.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case ml.DraggableRect:return s}},[n,s,l]),v=x.useRef(null),k=x.useCallback(()=>{const S=v.current;if(!S)return;const C=b.current.x*y.current.x,_=b.current.y*y.current.y;S.scrollBy(C,_)},[]),N=x.useMemo(()=>a===ju.TreeOrder?[...c].reverse():c,[a,c]);x.useEffect(()=>{if(!i||!c.length||!w){g();return}for(const S of N){if((r==null?void 0:r(S))===!1)continue;const C=c.indexOf(S),_=u[C];if(!_)continue;const{direction:O,speed:T}=MD(S,_,w,e,f);for(const I of["x","y"])p[I][O[I]]||(T[I]=0,O[I]=0);if(T.x>0||T.y>0){g(),v.current=S,m(k,o),b.current=T,y.current=O;return}}b.current={x:0,y:0},y.current={x:0,y:0},g()},[e,k,r,g,i,o,JSON.stringify(w),JSON.stringify(p),m,c,N,u,JSON.stringify(f)])}const UD={x:{[sn.Backward]:!1,[sn.Forward]:!1},y:{[sn.Backward]:!1,[sn.Forward]:!1}};function VD(t){let{delta:e,disabled:n}=t;const r=Iu(e);return yc(s=>{if(n||!r||!s)return UD;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[sn.Backward]:s.x[sn.Backward]||i.x===-1,[sn.Forward]:s.x[sn.Forward]||i.x===1},y:{[sn.Backward]:s.y[sn.Backward]||i.y===-1,[sn.Forward]:s.y[sn.Forward]||i.y===1}}},[n,e,r])}function WD(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return yc(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function qD(t,e){return x.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...i]},[]),[t,e])}var Pl;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Pl||(Pl={}));var nm;(function(t){t.Optimized="optimized"})(nm||(nm={}));const cx=new Map;function KD(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,o]=x.useState(null),{frequency:a,measure:l,strategy:c}=s,u=x.useRef(t),d=b(),f=Dl(d),p=x.useCallback(function(y){y===void 0&&(y=[]),!f.current&&o(w=>w===null?y:w.concat(y.filter(v=>!w.includes(v))))},[f]),m=x.useRef(null),g=yc(y=>{if(d&&!n)return cx;if(!y||y===cx||u.current!==t||i!=null){const w=new Map;for(let v of t){if(!v)continue;if(i&&i.length>0&&!i.includes(v.id)&&v.rect.current){w.set(v.id,v.rect.current);continue}const k=v.node.current,N=k?new Hg(l(k),k):null;v.rect.current=N,N&&w.set(v.id,N)}return w}return y},[t,i,n,d,l]);return x.useEffect(()=>{u.current=t},[t]),x.useEffect(()=>{d||p()},[n,d]),x.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),x.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,d,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(c){case Pl.Always:return!1;case Pl.BeforeDragging:return n;default:return!n}}}function Wg(t,e){return yc(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function GD(t,e){return Wg(t,e)}function JD(t){let{callback:e,disabled:n}=t;const r=hf(e),s=x.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return x.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function mf(t){let{callback:e,disabled:n}=t;const r=hf(e),s=x.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return x.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function YD(t){return new Hg(xc(t),t)}function ux(t,e,n){e===void 0&&(e=YD);const[r,s]=x.useState(null);function i(){s(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const o=JD({callback(l){if(t)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(t)){i();break}}}}),a=mf({callback:i});return Cs(()=>{i(),t?(a==null||a.observe(t),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[t]),r}function ZD(t){const e=Wg(t);return NS(t,e)}const dx=[];function XD(t){const e=x.useRef(t),n=yc(r=>t?r&&r!==dx&&t&&e.current&&t.parentNode===e.current.parentNode?r:$g(t):dx,[t]);return x.useEffect(()=>{e.current=t},[t]),n}function QD(t){const[e,n]=x.useState(null),r=x.useRef(t),s=x.useCallback(i=>{const o=bh(i.target);o&&n(a=>a?(a.set(o,em(o)),new Map(a)):null)},[]);return x.useEffect(()=>{const i=r.current;if(t!==i){o(i);const a=t.map(l=>{const c=bh(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,em(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(i)};function o(a){a.forEach(l=>{const c=bh(l);c==null||c.removeEventListener("scroll",s)})}},[s,t]),x.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,o)=>ea(i,o),Lr):IS(t):Lr,[t,e])}function fx(t,e){e===void 0&&(e=[]);const n=x.useRef(null);return x.useEffect(()=>{n.current=null},e),x.useEffect(()=>{const r=t!==Lr;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Du(t,n.current):Lr}function eL(t){x.useEffect(()=>{if(!ff)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function tL(t,e){return x.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,e)},n},{}),[t,e])}function jS(t){return x.useMemo(()=>t?ND(t):null,[t])}const hx=[];function nL(t,e){e===void 0&&(e=xc);const[n]=t,r=jS(n?Fn(n):null),[s,i]=x.useState(hx);function o(){i(()=>t.length?t.map(l=>RS(l)?r:new Hg(e(l),l)):hx)}const a=mf({callback:o});return Cs(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),s}function zS(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return bc(e)?e:t}function rL(t){let{measure:e}=t;const[n,r]=x.useState(null),s=x.useCallback(c=>{for(const{target:u}of c)if(bc(u)){r(d=>{const f=e(u);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=mf({callback:s}),o=x.useCallback(c=>{const u=zS(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?e(u):null)},[e,i]),[a,l]=Ou(o);return x.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const sL=[{sensor:Vg,options:{}},{sensor:PS,options:{}}],iL={current:{}},yu={draggable:{measure:ix},droppable:{measure:ix,strategy:Pl.WhileDragging,frequency:nm.Optimized},dragOverlay:{measure:xc}};class gl extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const oL={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new gl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:yu,measureDroppableContainers:Pu,windowRect:null,measuringScheduled:!1},FS={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Pu,draggableNodes:new Map,over:null,measureDroppableContainers:Pu},vc=x.createContext(FS),BS=x.createContext(oL);function aL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new gl}}}function lL(t,e){switch(e.type){case Zt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Zt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Zt.DragEnd:case Zt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zt.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new gl(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case Zt.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new gl(t.droppable.containers);return o.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:o}}}case Zt.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new gl(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function cL(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=x.useContext(vc),i=Iu(r),o=Iu(n==null?void 0:n.id);return x.useEffect(()=>{if(!e&&!r&&i&&o!=null){if(!Bg(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=iD(u);if(d){d.focus();break}}})}},[r,e,s,o,i]),null}function $S(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function uL(t){return x.useMemo(()=>({draggable:{...yu.draggable,...t==null?void 0:t.draggable},droppable:{...yu.droppable,...t==null?void 0:t.droppable},dragOverlay:{...yu.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function dL(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=x.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Cs(()=>{if(!o&&!a||!e){i.current=!1;return}if(i.current||!r)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=NS(u,r);if(o||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=TS(c);f&&f.scrollBy({top:d.y,left:d.x})}},[e,o,a,r,n])}const gf=x.createContext({...Lr,scaleX:1,scaleY:1});var Us;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Us||(Us={}));const fL=x.memo(function(e){var n,r,s,i;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:u=sL,collisionDetection:d=CS,measuring:f,modifiers:p,...m}=e;const g=x.useReducer(lL,void 0,aL),[b,y]=g,[w,v]=dD(),[k,N]=x.useState(Us.Uninitialized),S=k===Us.Initialized,{draggable:{active:C,nodes:_,translate:O},droppable:{containers:T}}=b,I=C!=null?_.get(C):null,D=x.useRef({initial:null,translated:null}),V=x.useMemo(()=>{var Gt;return C!=null?{id:C,data:(Gt=I==null?void 0:I.data)!=null?Gt:iL,rect:D}:null},[C,I]),z=x.useRef(null),[j,q]=x.useState(null),[re,G]=x.useState(null),ue=Dl(m,Object.values(m)),A=pf("DndDescribedBy",o),ce=x.useMemo(()=>T.getEnabled(),[T]),ye=uL(f),{droppableRects:E,measureDroppableContainers:P,measuringScheduled:F}=KD(ce,{dragging:S,dependencies:[O.x,O.y],config:ye.droppable}),$=WD(_,C),L=x.useMemo(()=>re?Lu(re):null,[re]),H=ih(),J=GD($,ye.draggable.measure);dL({activeNode:C!=null?_.get(C):null,config:H.layoutShiftCompensation,initialRect:J,measure:ye.draggable.measure});const ne=ux($,ye.draggable.measure,J),xe=ux($?$.parentElement:null),ge=x.useRef({activatorEvent:null,active:null,activeNode:$,collisionRect:null,collisions:null,droppableRects:E,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Pe=T.getNodeFor((n=ge.current.over)==null?void 0:n.id),Ze=rL({measure:ye.dragOverlay.measure}),de=(r=Ze.nodeRef.current)!=null?r:$,se=S?(s=Ze.rect)!=null?s:ne:null,it=!!(Ze.nodeRef.current&&Ze.rect),Ye=ZD(it?null:ne),ie=jS(de?Fn(de):null),Be=XD(S?Pe??$:null),dt=nL(Be),ot=$S(p,{transform:{x:O.x-Ye.x,y:O.y-Ye.y,scaleX:1,scaleY:1},activatorEvent:re,active:V,activeNodeRect:ne,containerNodeRect:xe,draggingNodeRect:se,over:ge.current.over,overlayNodeRect:Ze.rect,scrollableAncestors:Be,scrollableAncestorRects:dt,windowRect:ie}),or=L?ea(L,O):null,Yn=QD(Be),Ds=fx(Yn),U=fx(Yn,[ne]),Y=ea(ot,Ds),_e=se?SD(se,ot):null,je=V&&_e?d({active:V,collisionRect:_e,droppableRects:E,droppableContainers:ce,pointerCoordinates:or}):null,tt=xD(je,"id"),[Rt,Bn]=x.useState(null),pn=it?ot:ea(ot,U),zr=wD(pn,(i=Rt==null?void 0:Rt.rect)!=null?i:null,ne),Er=x.useRef(null),nn=x.useCallback((Gt,Ut)=>{let{sensor:M,options:W}=Ut;if(z.current==null)return;const ee=_.get(z.current);if(!ee)return;const we=Gt.nativeEvent,at=new M({active:z.current,activeNode:ee,event:we,options:W,context:ge,onAbort(oe){if(!_.get(oe))return;const{onDragAbort:ke}=ue.current,mt={id:oe};ke==null||ke(mt),w({type:"onDragAbort",event:mt})},onPending(oe,fe,ke,mt){if(!_.get(oe))return;const{onDragPending:Cr}=ue.current,ar={id:oe,constraint:fe,initialCoordinates:ke,offset:mt};Cr==null||Cr(ar),w({type:"onDragPending",event:ar})},onStart(oe){const fe=z.current;if(fe==null)return;const ke=_.get(fe);if(!ke)return;const{onDragStart:mt}=ue.current,wt={activatorEvent:we,active:{id:fe,data:ke.data,rect:D}};li.unstable_batchedUpdates(()=>{mt==null||mt(wt),N(Us.Initializing),y({type:Zt.DragStart,initialCoordinates:oe,active:fe}),w({type:"onDragStart",event:wt}),q(Er.current),G(we)})},onMove(oe){y({type:Zt.DragMove,coordinates:oe})},onEnd:pt(Zt.DragEnd),onCancel:pt(Zt.DragCancel)});Er.current=at;function pt(oe){return async function(){const{active:ke,collisions:mt,over:wt,scrollAdjustedTranslate:Cr}=ge.current;let ar=null;if(ke&&Cr){const{cancelDrop:ns}=ue.current;ar={activatorEvent:we,active:ke,collisions:mt,delta:Cr,over:wt},oe===Zt.DragEnd&&typeof ns=="function"&&await Promise.resolve(ns(ar))&&(oe=Zt.DragCancel)}z.current=null,li.unstable_batchedUpdates(()=>{y({type:oe}),N(Us.Uninitialized),Bn(null),q(null),G(null),Er.current=null;const ns=oe===Zt.DragEnd?"onDragEnd":"onDragCancel";if(ar){const Wa=ue.current[ns];Wa==null||Wa(ar),w({type:ns,event:ar})}})}}},[_]),Fr=x.useCallback((Gt,Ut)=>(M,W)=>{const ee=M.nativeEvent,we=_.get(W);if(z.current!==null||!we||ee.dndKit||ee.defaultPrevented)return;const at={active:we};Gt(M,Ut.options,at)===!0&&(ee.dndKit={capturedBy:Ut.sensor},z.current=W,nn(M,Ut))},[_,nn]),mn=qD(u,Fr);eL(u),Cs(()=>{ne&&k===Us.Initializing&&N(Us.Initialized)},[ne,k]),x.useEffect(()=>{const{onDragMove:Gt}=ue.current,{active:Ut,activatorEvent:M,collisions:W,over:ee}=ge.current;if(!Ut||!M)return;const we={active:Ut,activatorEvent:M,collisions:W,delta:{x:Y.x,y:Y.y},over:ee};li.unstable_batchedUpdates(()=>{Gt==null||Gt(we),w({type:"onDragMove",event:we})})},[Y.x,Y.y]),x.useEffect(()=>{const{active:Gt,activatorEvent:Ut,collisions:M,droppableContainers:W,scrollAdjustedTranslate:ee}=ge.current;if(!Gt||z.current==null||!Ut||!ee)return;const{onDragOver:we}=ue.current,at=W.get(tt),pt=at&&at.rect.current?{id:at.id,rect:at.rect.current,data:at.data,disabled:at.disabled}:null,oe={active:Gt,activatorEvent:Ut,collisions:M,delta:{x:ee.x,y:ee.y},over:pt};li.unstable_batchedUpdates(()=>{Bn(pt),we==null||we(oe),w({type:"onDragOver",event:oe})})},[tt]),Cs(()=>{ge.current={activatorEvent:re,active:V,activeNode:$,collisionRect:_e,collisions:je,droppableRects:E,draggableNodes:_,draggingNode:de,draggingNodeRect:se,droppableContainers:T,over:Rt,scrollableAncestors:Be,scrollAdjustedTranslate:Y},D.current={initial:se,translated:_e}},[V,$,je,_e,_,de,se,E,T,Rt,Be,Y]),HD({...H,delta:O,draggingRect:_e,pointerCoordinates:or,scrollableAncestors:Be,scrollableAncestorRects:dt});const Ac=x.useMemo(()=>({active:V,activeNode:$,activeNodeRect:ne,activatorEvent:re,collisions:je,containerNodeRect:xe,dragOverlay:Ze,draggableNodes:_,droppableContainers:T,droppableRects:E,over:Rt,measureDroppableContainers:P,scrollableAncestors:Be,scrollableAncestorRects:dt,measuringConfiguration:ye,measuringScheduled:F,windowRect:ie}),[V,$,ne,re,je,xe,Ze,_,T,E,Rt,P,Be,dt,ye,F,ie]),Mc=x.useMemo(()=>({activatorEvent:re,activators:mn,active:V,activeNodeRect:ne,ariaDescribedById:{draggable:A},dispatch:y,draggableNodes:_,over:Rt,measureDroppableContainers:P}),[re,mn,V,ne,y,A,_,Rt,P]);return ht.createElement(ES.Provider,{value:v},ht.createElement(vc.Provider,{value:Mc},ht.createElement(BS.Provider,{value:Ac},ht.createElement(gf.Provider,{value:zr},c)),ht.createElement(cL,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ht.createElement(pD,{...a,hiddenTextDescribedById:A}));function ih(){const Gt=(j==null?void 0:j.autoScrollEnabled)===!1,Ut=typeof l=="object"?l.enabled===!1:l===!1,M=S&&!Gt&&!Ut;return typeof l=="object"?{...l,enabled:M}:{enabled:M}}}),hL=x.createContext(null),px="button",pL="Draggable";function mL(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=pf(pL),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:f}=x.useContext(vc),{role:p=px,roleDescription:m="draggable",tabIndex:g=0}=s??{},b=(l==null?void 0:l.id)===e,y=x.useContext(b?gf:hL),[w,v]=Ou(),[k,N]=Ou(),S=tL(o,e),C=Dl(n);Cs(()=>(d.set(e,{id:e,key:i,node:w,activatorNode:k,data:C}),()=>{const O=d.get(e);O&&O.key===i&&d.delete(e)}),[d,e]);const _=x.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":b&&p===px?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,b,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:_,isDragging:b,listeners:r?void 0:S,node:w,over:f,setNodeRef:v,setActivatorNodeRef:N,transform:y}}function gL(){return x.useContext(BS)}const bL="Droppable",yL={timeout:25};function xL(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=pf(bL),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=x.useContext(vc),u=x.useRef({disabled:n}),d=x.useRef(!1),f=x.useRef(null),p=x.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:b}={...yL,...s},y=Dl(g??r),w=x.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),p.current=null},b)},[b]),v=mf({callback:w,disabled:m||!o}),k=x.useCallback((_,O)=>{v&&(O&&(v.unobserve(O),d.current=!1),_&&v.observe(_))},[v]),[N,S]=Ou(k),C=Dl(e);return x.useEffect(()=>{!v||!N.current||(v.disconnect(),d.current=!1,v.observe(N.current))},[N,v]),x.useEffect(()=>(a({type:Zt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:N,rect:f,data:C}}),()=>a({type:Zt.UnregisterDroppable,key:i,id:r})),[r]),x.useEffect(()=>{n!==u.current.disabled&&(a({type:Zt.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:o,rect:f,isOver:(l==null?void 0:l.id)===r,node:N,over:l,setNodeRef:S}}function vL(t){let{animation:e,children:n}=t;const[r,s]=x.useState(null),[i,o]=x.useState(null),a=Iu(n);return!n&&!r&&a&&s(a),Cs(()=>{if(!i)return;const l=r==null?void 0:r.key,c=r==null?void 0:r.props.id;if(l==null||c==null){s(null);return}Promise.resolve(e(c,i)).then(()=>{s(null)})},[e,r,i]),ht.createElement(ht.Fragment,null,n,r?x.cloneElement(r,{ref:o}):null)}const wL={x:0,y:0,scaleX:1,scaleY:1};function kL(t){let{children:e}=t;return ht.createElement(vc.Provider,{value:FS},ht.createElement(gf.Provider,{value:wL},e))}const SL={position:"fixed",touchAction:"none"},EL=t=>Bg(t)?"transform 250ms ease":void 0,CL=x.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:a,style:l,transform:c,transition:u=EL}=t;if(!a)return null;const d=s?c:{...c,scaleX:1,scaleY:1},f={...SL,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ll.Transform.toString(d),transformOrigin:s&&r?bD(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return ht.createElement(n,{className:o,style:f,ref:e},i)}),NL=t=>e=>{let{active:n,dragOverlay:r}=e;const s={},{styles:i,className:o}=t;if(i!=null&&i.active)for(const[a,l]of Object.entries(i.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(i!=null&&i.dragOverlay)for(const[a,l]of Object.entries(i.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);o!=null&&o.active&&n.node.classList.remove(o.active)}},_L=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Ll.Transform.toString(e)},{transform:Ll.Transform.toString(n)}]},TL={duration:250,easing:"ease",keyframes:_L,sideEffects:NL({styles:{active:{opacity:"0"}}})};function AL(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=t;return hf((i,o)=>{if(e===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const c=zS(o);if(!c)return;const{transform:u}=Fn(o).getComputedStyle(o),d=_S(u);if(!d)return;const f=typeof e=="function"?e:ML(e);return DS(l,s.draggable.measure),f({active:{id:i,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:d})})}function ML(t){const{duration:e,easing:n,sideEffects:r,keyframes:s}={...TL,...t};return i=>{let{active:o,dragOverlay:a,transform:l,...c}=i;if(!e)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},d={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-u.x,y:l.y-u.y,...d},p=s({...c,active:o,dragOverlay:a,transform:{initial:l,final:f}}),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const b=r==null?void 0:r({active:o,dragOverlay:a,...c}),y=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(w=>{y.onfinish=()=>{b==null||b(),w()}})}}let mx=0;function RL(t){return x.useMemo(()=>{if(t!=null)return mx++,mx},[t])}const OL=ht.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:b,over:y,measuringConfiguration:w,scrollableAncestors:v,scrollableAncestorRects:k,windowRect:N}=gL(),S=x.useContext(gf),C=RL(d==null?void 0:d.id),_=$S(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:b.rect,over:y,overlayNodeRect:b.rect,scrollableAncestors:v,scrollableAncestorRects:k,transform:S,windowRect:N}),O=Wg(f),T=AL({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:w}),I=O?b.setRef:void 0;return ht.createElement(kL,null,ht.createElement(vL,{animation:T},d&&C?ht.createElement(CL,{key:C,id:d.id,ref:I,as:a,activatorEvent:u,adjustScale:e,className:l,transition:i,rect:O,style:{zIndex:c,...s},transform:_},n):null))});var IL=Symbol.for("react.lazy"),zu=fk[" use ".trim().toString()];function DL(t){return typeof t=="object"&&t!==null&&"then"in t}function HS(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===IL&&"_payload"in t&&DL(t._payload)}function US(t){const e=PL(t),n=x.forwardRef((r,s)=>{let{children:i,...o}=r;HS(i)&&typeof zu=="function"&&(i=zu(i._payload));const a=x.Children.toArray(i),l=a.find(zL);if(l){const c=l.props.children,u=a.map(d=>d===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:s,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}var LL=US("Slot");function PL(t){const e=x.forwardRef((n,r)=>{let{children:s,...i}=n;if(HS(s)&&typeof zu=="function"&&(s=zu(s._payload)),x.isValidElement(s)){const o=BL(s),a=FL(i,s.props);return s.type!==x.Fragment&&(a.ref=r?ck(r,o):o),x.cloneElement(s,a)}return x.Children.count(s)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var jL=Symbol("radix.slottable");function zL(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===jL}function FL(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function BL(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const qg=wS("inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed rounded-md",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 border border-primary dark:border-primary/50 dark:text-white",destructive:"border border-destructive text-destructive hover:bg-destructive/10 dark:hover:bg-destructive/20",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:border-input/50 dark:hover:bg-accent/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-secondary dark:border-secondary/50",ghost:"text-foreground hover:bg-accent/50 hover:text-accent-foreground dark:hover:bg-accent/30",link:"text-foreground hover:underline dark:text-foreground/90",icon:"bg-transparent rounded text-muted-foreground hover:text-foreground dark:hover:text-foreground/90"},size:{default:"h-10 px-4 py-2",xs:"h-8 px-2 text-xs",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10"}},compoundVariants:[{variant:"icon",class:"p-0 h-4"}],defaultVariants:{variant:"default",size:"default"}}),le=x.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const o=r?LL:"button";return h.jsx(o,{className:Oe(qg({variant:e,size:n,className:t})),ref:i,...s})});le.displayName="Button";const $L=({id:t,children:e,className:n,"data-column-id":r,collapsed:s=!1})=>{const{isOver:i,setNodeRef:o}=xL({id:t});return h.jsx("div",{className:Oe("flex h-full min-h-40 flex-col transition-all",i?"outline-primary":"outline-border",s&&"min-w-0",n),ref:o,"data-column-id":r,children:e})},HL=({id:t,name:e,index:n,parent:r,children:s,className:i,onClick:o,tabIndex:a,forwardedRef:l,onKeyDown:c,isOpen:u})=>{const{attributes:d,listeners:f,setNodeRef:p,isDragging:m}=mL({id:t,data:{index:n,parent:r}}),g=x.useRef(!1);x.useEffect(()=>{if(m)g.current=!0;else if(g.current){const w=setTimeout(()=>{g.current=!1},100);return()=>clearTimeout(w)}},[m]);const b=w=>{p(w),typeof l=="function"?l(w):l&&typeof l=="object"&&(l.current=w)},y=w=>{if(g.current){w.preventDefault(),w.stopPropagation();return}o==null||o()};return h.jsx(Bt,{className:Oe("flex-col space-y-2 border-b p-3 outline-none",m&&"cursor-grabbing opacity-50",u&&"ring-2 ring-inset ring-secondary-foreground",i),...f,...d,ref:b,tabIndex:a,onClick:y,onKeyDown:c,"data-issue-id":t,children:s??h.jsx("p",{className:"m-0 text-sm font-medium",children:e})})},UL=({children:t,className:e,collapsed:n=!1})=>h.jsx("div",{className:Oe("flex flex-1 flex-col overflow-y-auto",n&&"hidden",e),children:t}),VL=t=>"children"in t?t.children:t.collapsed??!1?h.jsx(Bt,{className:Oe("sticky top-0 z-20 flex flex-col flex-1 shrink-0 items-center justify-center border-b border-dashed p-3","bg-background",t.className),style:{backgroundImage:`linear-gradient(hsl(var(${t.color}) / 0.03), hsl(var(${t.color}) / 0.03))`},children:h.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap cursor-pointer hover:opacity-80 transition-opacity",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},onClick:t.onToggleCollapse,children:[h.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:`hsl(var(${t.color}))`}}),h.jsx("p",{className:"m-0 text-sm",children:t.name}),t.count!==void 0&&h.jsx(ct,{variant:"secondary",children:t.count})]})}):h.jsxs(Bt,{className:Oe("sticky top-0 z-20 flex flex shrink-0 items-center gap-2 gap-2 border-b border-dashed p-3","bg-background",t.className),style:{backgroundImage:`linear-gradient(hsl(var(${t.color}) / 0.03), hsl(var(${t.color}) / 0.03))`},children:[h.jsxs("span",{className:"flex flex-1 items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:t.onToggleCollapse,children:[h.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:`hsl(var(${t.color}))`}}),h.jsx("p",{className:"m-0 text-sm",children:t.name}),t.count!==void 0&&h.jsx(ct,{variant:"secondary",children:t.count})]}),h.jsxs("span",{className:"flex items-center gap-1",children:[t.onArchiveAll&&h.jsx(po,{children:h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx(le,{variant:"ghost",className:"m-0 h-0 p-0 text-foreground/50 hover:text-foreground",onClick:n=>{var r;n.stopPropagation(),(r=t.onArchiveAll)==null||r.call(t)},"aria-label":"Archive All",children:h.jsx(Ia,{className:"h-4 w-4"})})}),h.jsx(er,{side:"top",children:"Archive All"})]})}),t.onAddIssue&&h.jsx(po,{children:h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx(le,{variant:"ghost",className:"m-0 h-0 p-0 text-foreground/50 hover:text-foreground",onClick:n=>{var r;n.stopPropagation(),(r=t.onAddIssue)==null||r.call(t)},"aria-label":"Add Issue",children:h.jsx(ho,{className:"h-4 w-4"})})}),h.jsx(er,{side:"top",children:"Add Issue"})]})})]})]});function WL(t,e,n,r){const s={...t};return e.top+t.y<=n.top?s.y=n.top-e.top:e.bottom+t.y>=n.top+n.height&&(s.y=n.top+n.height-e.bottom),e.left+t.x<=n.left?s.x=n.left-e.left:e.right+t.x+r>=n.left+n.width&&(s.x=n.left+n.width-e.right-r),{...s,x:s.x}}const qL=t=>{const{draggingNodeRect:e,transform:n,scrollableAncestorRects:r}=t,s=r[0];return!e||!s?n:WL(n,e,s,16)},KL=({children:t,onDragEnd:e,className:n,renderDragOverlay:r,collapsedColumns:s=new Set,totalColumns:i=0})=>{const[o,a]=x.useState(null),l=gD(mD(Vg,{activationConstraint:{distance:8}})),c=(()=>{if(i===0)return"auto-cols-[minmax(200px,400px)]";const u=[];return(Array.isArray(t)?t:[t]).forEach(f=>{const p=f==null?void 0:f.key;p&&s.has(p)?u.push("48px"):u.push("minmax(200px, 1fr)")}),u.join(" ")})();return h.jsxs(fL,{collisionDetection:CS,onDragStart:u=>a(u.active.id),onDragEnd:u=>{a(null),e(u)},onDragCancel:()=>a(null),sensors:l,modifiers:[qL],children:[h.jsx("div",{className:Oe("inline-grid h-full grid-flow-col divide-x border-x transition-all",n),style:{gridTemplateColumns:c},children:t}),h.jsx(OL,{dropAnimation:null,children:o&&r?r(o):null})]})},GL={0:"bg-red-600 dark:bg-red-700",1:"bg-orange-600 dark:bg-orange-700",2:"bg-yellow-600 dark:bg-yellow-700",3:"bg-blue-600 dark:bg-blue-700",4:"bg-gray-600 dark:bg-gray-700"},JL={0:"P0",1:"P1",2:"P2",3:"P3",4:"P4"};function gx({issue:t,index:e,status:n,onViewDetails:r,isOpen:s}){const i=kr(),o=x.useCallback(()=>{r?r(t):i(`/issues/${t.id}`)},[t,r,i]),a=x.useRef(null);return x.useEffect(()=>{if(!s||!a.current)return;const l=a.current;requestAnimationFrame(()=>{l.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})})},[s]),h.jsx(HL,{id:t.id,name:t.title,index:e,parent:n,onClick:o,isOpen:s,forwardedRef:a,className:t.archived?"opacity-60":"",children:h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-start gap-2",children:[h.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[h.jsx("div",{className:"text-xs text-muted-foreground",children:t.id}),t.priority!==void 0&&t.priority<=3&&h.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs text-white ${GL[t.priority]}`,children:JL[t.priority]})]}),h.jsx("h4",{className:"text-md line-clamp-2 min-w-0 flex-1 font-medium",children:t.title}),t.content&&h.jsx("p",{className:"line-clamp-2 break-words text-xs text-muted-foreground",children:(()=>{const l=t.content.replace(/^#+ /gm,"").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/\[(.+?)\]\(.+?\)/g,"$1").replace(/`(.+?)`/g,"$1").trim();return l.length>100?`${l.substring(0,100)}...`:l})()})]})},t.id)}const bx=["blocked","open","in_progress","needs_review","closed"],YL={open:"Open",in_progress:"In Progress",blocked:"Blocked",needs_review:"Needs Review",closed:"Closed"},ZL={open:"--chart-3",in_progress:"--chart-2",blocked:"--chart-1",needs_review:"--chart-4",closed:"--chart-5"};function XL({groupedIssues:t,onDragEnd:e,onViewIssueDetails:n,selectedIssue:r,onArchiveAllClosed:s,collapsedColumns:i=new Set,onToggleColumnCollapse:o}){const a=l=>{if(!l)return null;for(const[c,u]of Object.entries(t)){const d=u.find(f=>f.id===l);if(d){const f=u.indexOf(d);return h.jsx(gx,{issue:d,index:f,status:c,onViewDetails:n,isOpen:!1})}}return null};return h.jsx(KL,{onDragEnd:e,renderDragOverlay:a,collapsedColumns:i,totalColumns:bx.length,children:bx.map(l=>{const c=t[l]||[],u=i.has(l);return h.jsxs($L,{id:l,"data-column-id":l,collapsed:u,children:[h.jsx(VL,{name:YL[l],color:ZL[l],count:c.length,onArchiveAll:l==="closed"?s:void 0,collapsed:u,onToggleCollapse:o?()=>o(l):void 0}),h.jsx(UL,{collapsed:u,children:c.map((d,f)=>h.jsx(gx,{issue:d,index:f,status:l,onViewDetails:n,isOpen:(r==null?void 0:r.id)===d.id},d.id))})]},l)})})}const Fu=x.memo(XL);function hn(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function QL(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const Bc=43200,yx=1440;let eP={};function tP(){return eP}function xx(t){const e=hn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function xu(t,e){const n=hn(t),r=hn(e),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function nP(t){return QL(t,Date.now())}function rP(t,e){const n=hn(t),r=hn(e),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function sP(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function iP(t,e){return+hn(t)-+hn(e)}function oP(t){const e=hn(t);return e.setHours(23,59,59,999),e}function aP(t){const e=hn(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function lP(t){const e=hn(t);return+oP(e)==+aP(e)}function cP(t,e){const n=hn(t),r=hn(e),s=xu(n,r),i=Math.abs(rP(n,r));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let a=xu(n,r)===-s;lP(hn(t))&&i===1&&xu(t,r)===1&&(a=!1),o=s*(i-Number(a))}return o===0?0:o}function uP(t,e,n){const r=iP(t,e)/1e3;return sP(n==null?void 0:n.roundingMethod)(r)}const dP={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},fP=(t,e,n)=>{let r;const s=dP[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function vh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const hP={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},pP={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},mP={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gP={date:vh({formats:hP,defaultWidth:"full"}),time:vh({formats:pP,defaultWidth:"full"}),dateTime:vh({formats:mP,defaultWidth:"full"})},bP={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},yP=(t,e,n,r)=>bP[t];function Ja(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,a=n!=null&&n.width?String(n.width):o;s=t.formattingValues[a]||t.formattingValues[o]}else{const o=t.defaultWidth,a=n!=null&&n.width?String(n.width):t.defaultWidth;s=t.values[a]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const xP={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},vP={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wP={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},kP={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},SP={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},EP={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},CP=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},NP={ordinalNumber:CP,era:Ja({values:xP,defaultWidth:"wide"}),quarter:Ja({values:vP,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ja({values:wP,defaultWidth:"wide"}),day:Ja({values:kP,defaultWidth:"wide"}),dayPeriod:Ja({values:SP,defaultWidth:"wide",formattingValues:EP,defaultFormattingWidth:"wide"})};function Ya(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?TP(a,d=>d.test(o)):_P(a,d=>d.test(o));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function _P(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function TP(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function AP(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const a=e.slice(s.length);return{value:o,rest:a}}}const MP=/^(\d+)(th|st|nd|rd)?/i,RP=/\d+/i,OP={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},IP={any:[/^b/i,/^(a|c)/i]},DP={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},LP={any:[/1/i,/2/i,/3/i,/4/i]},PP={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jP={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zP={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},FP={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},BP={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},$P={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},HP={ordinalNumber:AP({matchPattern:MP,parsePattern:RP,valueCallback:t=>parseInt(t,10)}),era:Ya({matchPatterns:OP,defaultMatchWidth:"wide",parsePatterns:IP,defaultParseWidth:"any"}),quarter:Ya({matchPatterns:DP,defaultMatchWidth:"wide",parsePatterns:LP,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ya({matchPatterns:PP,defaultMatchWidth:"wide",parsePatterns:jP,defaultParseWidth:"any"}),day:Ya({matchPatterns:zP,defaultMatchWidth:"wide",parsePatterns:FP,defaultParseWidth:"any"}),dayPeriod:Ya({matchPatterns:BP,defaultMatchWidth:"any",parsePatterns:$P,defaultParseWidth:"any"})},UP={code:"en-US",formatDistance:fP,formatLong:gP,formatRelative:yP,localize:NP,match:HP,options:{weekStartsOn:0,firstWeekContainsDate:1}};function VP(t,e,n){const r=tP(),s=(n==null?void 0:n.locale)??r.locale??UP,i=2520,o=xu(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let l,c;o>0?(l=hn(e),c=hn(t)):(l=hn(t),c=hn(e));const u=uP(c,l),d=(xx(c)-xx(l))/1e3,f=Math.round((u-d)/60);let p;if(f<2)return n!=null&&n.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,a):u<10?s.formatDistance("lessThanXSeconds",10,a):u<20?s.formatDistance("lessThanXSeconds",20,a):u<40?s.formatDistance("halfAMinute",0,a):u<60?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",1,a):f===0?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",f,a);if(f<45)return s.formatDistance("xMinutes",f,a);if(f<90)return s.formatDistance("aboutXHours",1,a);if(f<yx){const m=Math.round(f/60);return s.formatDistance("aboutXHours",m,a)}else{if(f<i)return s.formatDistance("xDays",1,a);if(f<Bc){const m=Math.round(f/yx);return s.formatDistance("xDays",m,a)}else if(f<Bc*2)return p=Math.round(f/Bc),s.formatDistance("aboutXMonths",p,a)}if(p=cP(c,l),p<12){const m=Math.round(f/Bc);return s.formatDistance("xMonths",m,a)}else{const m=p%12,g=Math.trunc(p/12);return m<3?s.formatDistance("aboutXYears",g,a):m<9?s.formatDistance("overXYears",g,a):s.formatDistance("almostXYears",g+1,a)}}function Bu(t,e){return VP(t,nP(t),e)}const Ms=x.forwardRef(({className:t,type:e,...n},r)=>h.jsx("input",{type:e,className:Oe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...n}));Ms.displayName="Input";function vx(t,[e,n]){return Math.min(n,Math.max(e,t))}function WP(t){const e=qP(t),n=x.forwardRef((r,s)=>{const{children:i,...o}=r,a=x.Children.toArray(i),l=a.find(GP);if(l){const c=l.props.children,u=a.map(d=>d===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:s,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function qP(t){const e=x.forwardRef((n,r)=>{const{children:s,...i}=n;if(x.isValidElement(s)){const o=YP(s),a=JP(i,s.props);return s.type!==x.Fragment&&(a.ref=r?ck(r,o):o),x.cloneElement(s,a)}return x.Children.count(s)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var KP=Symbol("radix.slottable");function GP(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===KP}function JP(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function YP(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function ZP(t){const e=x.useRef({value:t,previous:t});return x.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var XP=[" ","Enter","ArrowUp","ArrowDown"],QP=[" ","Enter"],go="Select",[bf,yf,e2]=OA(go),[Ba]=hg(go,[e2,Yd]),xf=Yd(),[t2,Ti]=Ba(go),[n2,r2]=Ba(go),VS=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:f,required:p,form:m}=t,g=xf(e),[b,y]=x.useState(null),[w,v]=x.useState(null),[k,N]=x.useState(!1),S=zA(c),[C,_]=Op({prop:r,defaultProp:s??!1,onChange:i,caller:go}),[O,T]=Op({prop:o,defaultProp:a,onChange:l,caller:go}),I=x.useRef(null),D=b?m||!!b.closest("form"):!0,[V,z]=x.useState(new Set),j=Array.from(V).map(q=>q.props.value).join(";");return h.jsx(rk,{...g,children:h.jsxs(t2,{required:p,scope:e,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:v,valueNodeHasChildren:k,onValueNodeHasChildrenChange:N,contentId:Zd(),value:O,onValueChange:T,open:C,onOpenChange:_,dir:S,triggerPointerDownPosRef:I,disabled:f,children:[h.jsx(bf.Provider,{scope:e,children:h.jsx(n2,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(q=>{z(re=>new Set(re).add(q))},[]),onNativeOptionRemove:x.useCallback(q=>{z(re=>{const G=new Set(re);return G.delete(q),G})},[]),children:n})}),D?h.jsxs(pE,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:O,onChange:q=>T(q.target.value),disabled:f,form:m,children:[O===void 0?h.jsx("option",{value:""}):null,Array.from(V)]},j):null]})})};VS.displayName=go;var WS="SelectTrigger",qS=x.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=xf(n),o=Ti(WS,n),a=o.disabled||r,l=Gn(e,o.onTriggerChange),c=yf(n),u=x.useRef("touch"),[d,f,p]=gE(g=>{const b=c().filter(v=>!v.disabled),y=b.find(v=>v.value===o.value),w=bE(b,g,y);w!==void 0&&o.onValueChange(w.value)}),m=g=>{a||(o.onOpenChange(!0),p()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return h.jsx(sk,{asChild:!0,...i,children:h.jsx(zn.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":mE(o.value)?"":void 0,...s,ref:l,onClick:Ot(s.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&m(g)}),onPointerDown:Ot(s.onPointerDown,g=>{u.current=g.pointerType;const b=g.target;b.hasPointerCapture(g.pointerId)&&b.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(m(g),g.preventDefault())}),onKeyDown:Ot(s.onKeyDown,g=>{const b=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(b&&g.key===" ")&&XP.includes(g.key)&&(m(),g.preventDefault())})})})});qS.displayName=WS;var KS="SelectValue",GS=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=t,l=Ti(KS,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Gn(e,l.onValueNodeChange);return vi(()=>{c(u)},[c,u]),h.jsx(zn.span,{...a,ref:d,style:{pointerEvents:"none"},children:mE(l.value)?h.jsx(h.Fragment,{children:o}):i})});GS.displayName=KS;var s2="SelectIcon",JS=x.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return h.jsx(zn.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});JS.displayName=s2;var i2="SelectPortal",YS=t=>h.jsx(ek,{asChild:!0,...t});YS.displayName=i2;var bo="SelectContent",ZS=x.forwardRef((t,e)=>{const n=Ti(bo,t.__scopeSelect),[r,s]=x.useState();if(vi(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?li.createPortal(h.jsx(XS,{scope:t.__scopeSelect,children:h.jsx(bf.Slot,{scope:t.__scopeSelect,children:h.jsx("div",{children:t.children})})}),i):null}return h.jsx(QS,{...t,ref:e})});ZS.displayName=bo;var _r=10,[XS,Ai]=Ba(bo),o2="SelectContentImpl",a2=WP("SelectContent.RemoveScroll"),QS=x.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:b,...y}=t,w=Ti(bo,n),[v,k]=x.useState(null),[N,S]=x.useState(null),C=Gn(e,L=>k(L)),[_,O]=x.useState(null),[T,I]=x.useState(null),D=yf(n),[V,z]=x.useState(!1),j=x.useRef(!1);x.useEffect(()=>{if(v)return DA(v)},[v]),LA();const q=x.useCallback(L=>{const[H,...J]=D().map(ge=>ge.ref.current),[ne]=J.slice(-1),xe=document.activeElement;for(const ge of L)if(ge===xe||(ge==null||ge.scrollIntoView({block:"nearest"}),ge===H&&N&&(N.scrollTop=0),ge===ne&&N&&(N.scrollTop=N.scrollHeight),ge==null||ge.focus(),document.activeElement!==xe))return},[D,N]),re=x.useCallback(()=>q([_,v]),[q,_,v]);x.useEffect(()=>{V&&re()},[V,re]);const{onOpenChange:G,triggerPointerDownPosRef:ue}=w;x.useEffect(()=>{if(v){let L={x:0,y:0};const H=ne=>{var xe,ge;L={x:Math.abs(Math.round(ne.pageX)-(((xe=ue.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(ne.pageY)-(((ge=ue.current)==null?void 0:ge.y)??0))}},J=ne=>{L.x<=10&&L.y<=10?ne.preventDefault():v.contains(ne.target)||G(!1),document.removeEventListener("pointermove",H),ue.current=null};return ue.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",J,{capture:!0})}}},[v,G,ue]),x.useEffect(()=>{const L=()=>G(!1);return window.addEventListener("blur",L),window.addEventListener("resize",L),()=>{window.removeEventListener("blur",L),window.removeEventListener("resize",L)}},[G]);const[A,ce]=gE(L=>{const H=D().filter(xe=>!xe.disabled),J=H.find(xe=>xe.ref.current===document.activeElement),ne=bE(H,L,J);ne&&setTimeout(()=>ne.ref.current.focus())}),ye=x.useCallback((L,H,J)=>{const ne=!j.current&&!J;(w.value!==void 0&&w.value===H||ne)&&(O(L),ne&&(j.current=!0))},[w.value]),E=x.useCallback(()=>v==null?void 0:v.focus(),[v]),P=x.useCallback((L,H,J)=>{const ne=!j.current&&!J;(w.value!==void 0&&w.value===H||ne)&&I(L)},[w.value]),F=r==="popper"?rm:eE,$=F===rm?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:b}:{};return h.jsx(XS,{scope:n,content:v,viewport:N,onViewportChange:S,itemRefCallback:ye,selectedItem:_,onItemLeave:E,itemTextRefCallback:P,focusSelectedItem:re,selectedItemText:T,position:r,isPositioned:V,searchRef:A,children:h.jsx(PA,{as:a2,allowPinchZoom:!0,children:h.jsx(jA,{asChild:!0,trapped:w.open,onMountAutoFocus:L=>{L.preventDefault()},onUnmountAutoFocus:Ot(s,L=>{var H;(H=w.trigger)==null||H.focus({preventScroll:!0}),L.preventDefault()}),children:h.jsx(tk,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:L=>L.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:h.jsx(F,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:L=>L.preventDefault(),...y,...$,onPlaced:()=>z(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Ot(y.onKeyDown,L=>{const H=L.ctrlKey||L.altKey||L.metaKey;if(L.key==="Tab"&&L.preventDefault(),!H&&L.key.length===1&&ce(L.key),["ArrowUp","ArrowDown","Home","End"].includes(L.key)){let ne=D().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(L.key)&&(ne=ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(L.key)){const xe=L.target,ge=ne.indexOf(xe);ne=ne.slice(ge+1)}setTimeout(()=>q(ne)),L.preventDefault()}})})})})})})});QS.displayName=o2;var l2="SelectItemAlignedPosition",eE=x.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=Ti(bo,n),o=Ai(bo,n),[a,l]=x.useState(null),[c,u]=x.useState(null),d=Gn(e,C=>u(C)),f=yf(n),p=x.useRef(!1),m=x.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=o,v=x.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&g&&b&&y){const C=i.trigger.getBoundingClientRect(),_=c.getBoundingClientRect(),O=i.valueNode.getBoundingClientRect(),T=y.getBoundingClientRect();if(i.dir!=="rtl"){const xe=T.left-_.left,ge=O.left-xe,Pe=C.left-ge,Ze=C.width+Pe,de=Math.max(Ze,_.width),se=window.innerWidth-_r,it=vx(ge,[_r,Math.max(_r,se-de)]);a.style.minWidth=Ze+"px",a.style.left=it+"px"}else{const xe=_.right-T.right,ge=window.innerWidth-O.right-xe,Pe=window.innerWidth-C.right-ge,Ze=C.width+Pe,de=Math.max(Ze,_.width),se=window.innerWidth-_r,it=vx(ge,[_r,Math.max(_r,se-de)]);a.style.minWidth=Ze+"px",a.style.right=it+"px"}const I=f(),D=window.innerHeight-_r*2,V=g.scrollHeight,z=window.getComputedStyle(c),j=parseInt(z.borderTopWidth,10),q=parseInt(z.paddingTop,10),re=parseInt(z.borderBottomWidth,10),G=parseInt(z.paddingBottom,10),ue=j+q+V+G+re,A=Math.min(b.offsetHeight*5,ue),ce=window.getComputedStyle(g),ye=parseInt(ce.paddingTop,10),E=parseInt(ce.paddingBottom,10),P=C.top+C.height/2-_r,F=D-P,$=b.offsetHeight/2,L=b.offsetTop+$,H=j+q+L,J=ue-H;if(H<=P){const xe=I.length>0&&b===I[I.length-1].ref.current;a.style.bottom="0px";const ge=c.clientHeight-g.offsetTop-g.offsetHeight,Pe=Math.max(F,$+(xe?E:0)+ge+re),Ze=H+Pe;a.style.height=Ze+"px"}else{const xe=I.length>0&&b===I[0].ref.current;a.style.top="0px";const Pe=Math.max(P,j+g.offsetTop+(xe?ye:0)+$)+J;a.style.height=Pe+"px",g.scrollTop=H-P+g.offsetTop}a.style.margin=`${_r}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=D+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,a,c,g,b,y,i.dir,r]);vi(()=>v(),[v]);const[k,N]=x.useState();vi(()=>{c&&N(window.getComputedStyle(c).zIndex)},[c]);const S=x.useCallback(C=>{C&&m.current===!0&&(v(),w==null||w(),m.current=!1)},[v,w]);return h.jsx(u2,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:h.jsx(zn.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});eE.displayName=l2;var c2="SelectPopperPosition",rm=x.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=_r,...i}=t,o=xf(n);return h.jsx(nk,{...o,...i,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});rm.displayName=c2;var[u2,Kg]=Ba(bo,{}),sm="SelectViewport",tE=x.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=Ai(sm,n),o=Kg(sm,n),a=Gn(e,i.onViewportChange),l=x.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(bf.Slot,{scope:n,children:h.jsx(zn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ot(s.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&d){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-_r*2,g=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),y=Math.max(g,b);if(y<m){const w=y+p,v=Math.min(m,w),k=w-v;d.style.height=v+"px",d.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});tE.displayName=sm;var nE="SelectGroup",[d2,f2]=Ba(nE),h2=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Zd();return h.jsx(d2,{scope:n,id:s,children:h.jsx(zn.div,{role:"group","aria-labelledby":s,...r,ref:e})})});h2.displayName=nE;var rE="SelectLabel",sE=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=f2(rE,n);return h.jsx(zn.div,{id:s.id,...r,ref:e})});sE.displayName=rE;var $u="SelectItem",[p2,iE]=Ba($u),oE=x.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=t,a=Ti($u,n),l=Ai($u,n),c=a.value===r,[u,d]=x.useState(i??""),[f,p]=x.useState(!1),m=Gn(e,w=>{var v;return(v=l.itemRefCallback)==null?void 0:v.call(l,w,r,s)}),g=Zd(),b=x.useRef("touch"),y=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(p2,{scope:n,value:r,disabled:s,textId:g,isSelected:c,onItemTextChange:x.useCallback(w=>{d(v=>v||((w==null?void 0:w.textContent)??"").trim())},[]),children:h.jsx(bf.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:h.jsx(zn.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:m,onFocus:Ot(o.onFocus,()=>p(!0)),onBlur:Ot(o.onBlur,()=>p(!1)),onClick:Ot(o.onClick,()=>{b.current!=="mouse"&&y()}),onPointerUp:Ot(o.onPointerUp,()=>{b.current==="mouse"&&y()}),onPointerDown:Ot(o.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:Ot(o.onPointerMove,w=>{var v;b.current=w.pointerType,s?(v=l.onItemLeave)==null||v.call(l):b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ot(o.onPointerLeave,w=>{var v;w.currentTarget===document.activeElement&&((v=l.onItemLeave)==null||v.call(l))}),onKeyDown:Ot(o.onKeyDown,w=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&w.key===" "||(QP.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});oE.displayName=$u;var il="SelectItemText",aE=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,o=Ti(il,n),a=Ai(il,n),l=iE(il,n),c=r2(il,n),[u,d]=x.useState(null),f=Gn(e,y=>d(y),l.onItemTextChange,y=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,y,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=x.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:b}=c;return vi(()=>(g(m),()=>b(m)),[g,b,m]),h.jsxs(h.Fragment,{children:[h.jsx(zn.span,{id:l.textId,...i,ref:f}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?li.createPortal(i.children,o.valueNode):null]})});aE.displayName=il;var lE="SelectItemIndicator",cE=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return iE(lE,n).isSelected?h.jsx(zn.span,{"aria-hidden":!0,...r,ref:e}):null});cE.displayName=lE;var im="SelectScrollUpButton",uE=x.forwardRef((t,e)=>{const n=Ai(im,t.__scopeSelect),r=Kg(im,t.__scopeSelect),[s,i]=x.useState(!1),o=Gn(e,r.onScrollButtonChange);return vi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?h.jsx(fE,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});uE.displayName=im;var om="SelectScrollDownButton",dE=x.forwardRef((t,e)=>{const n=Ai(om,t.__scopeSelect),r=Kg(om,t.__scopeSelect),[s,i]=x.useState(!1),o=Gn(e,r.onScrollButtonChange);return vi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?h.jsx(fE,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});dE.displayName=om;var fE=x.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=Ai("SelectScrollButton",n),o=x.useRef(null),a=yf(n),l=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),vi(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),h.jsx(zn.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:Ot(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Ot(s.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Ot(s.onPointerLeave,()=>{l()})})}),m2="SelectSeparator",hE=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return h.jsx(zn.div,{"aria-hidden":!0,...r,ref:e})});hE.displayName=m2;var am="SelectArrow",g2=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=xf(n),i=Ti(am,n),o=Ai(am,n);return i.open&&o.position==="popper"?h.jsx(ik,{...s,...r,ref:e}):null});g2.displayName=am;var b2="SelectBubbleInput",pE=x.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=x.useRef(null),i=Gn(r,s),o=ZP(e);return x.useEffect(()=>{const a=s.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&u){const d=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(d)}},[o,e]),h.jsx(zn.select,{...n,style:{...Fk,...n.style},ref:i,defaultValue:e})});pE.displayName=b2;function mE(t){return t===""||t===void 0}function gE(t){const e=IA(t),n=x.useRef(""),r=x.useRef(0),s=x.useCallback(o=>{const a=n.current+o;e(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[e]),i=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function bE(t,e,n){const s=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=y2(t,Math.max(i,0));s.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function y2(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var x2=VS,yE=qS,v2=GS,w2=JS,k2=YS,xE=ZS,S2=tE,vE=sE,wE=oE,E2=aE,C2=cE,kE=uE,SE=dE,EE=hE;const In=x2,Dn=v2,vn=x.forwardRef(({className:t,children:e,...n},r)=>h.jsxs(yE,{ref:r,className:Oe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,h.jsx(w2,{asChild:!0,children:h.jsx(Rl,{className:"h-4 w-4 opacity-50"})})]}));vn.displayName=yE.displayName;const CE=x.forwardRef(({className:t,...e},n)=>h.jsx(kE,{ref:n,className:Oe("flex cursor-default items-center justify-center py-1",t),...e,children:h.jsx(Ng,{className:"h-4 w-4"})}));CE.displayName=kE.displayName;const NE=x.forwardRef(({className:t,...e},n)=>h.jsx(SE,{ref:n,className:Oe("flex cursor-default items-center justify-center py-1",t),...e,children:h.jsx(Rl,{className:"h-4 w-4"})}));NE.displayName=SE.displayName;const wn=x.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>h.jsx(k2,{children:h.jsxs(xE,{ref:s,className:Oe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[h.jsx(CE,{}),h.jsx(S2,{className:Oe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),h.jsx(NE,{})]})}));wn.displayName=xE.displayName;const N2=x.forwardRef(({className:t,...e},n)=>h.jsx(vE,{ref:n,className:Oe("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));N2.displayName=vE.displayName;const Ct=x.forwardRef(({className:t,children:e,...n},r)=>h.jsxs(wE,{ref:r,className:Oe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(C2,{children:h.jsx(Tk,{className:"h-4 w-4"})})}),h.jsx(E2,{children:e})]}));Ct.displayName=wE.displayName;const _2=x.forwardRef(({className:t,...e},n)=>h.jsx(EE,{ref:n,className:Oe("-mx-1 my-1 h-px bg-muted",t),...e}));_2.displayName=EE.displayName;var T2=Symbol("radix.slottable");function A2(t){const e=({children:n})=>h.jsx(h.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=T2,e}var _E="AlertDialog",[M2]=hg(_E,[uk]),Rs=uk(),TE=t=>{const{__scopeAlertDialog:e,...n}=t,r=Rs(e);return h.jsx(ak,{...r,...n,modal:!0})};TE.displayName=_E;var R2="AlertDialogTrigger",O2=x.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Rs(n);return h.jsx(lk,{...s,...r,ref:e})});O2.displayName=R2;var I2="AlertDialogPortal",AE=t=>{const{__scopeAlertDialog:e,...n}=t,r=Rs(e);return h.jsx(ok,{...r,...n})};AE.displayName=I2;var D2="AlertDialogOverlay",ME=x.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Rs(n);return h.jsx(pg,{...s,...r,ref:e})});ME.displayName=D2;var ta="AlertDialogContent",[L2,P2]=M2(ta),j2=A2("AlertDialogContent"),RE=x.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=Rs(n),o=x.useRef(null),a=Gn(e,o),l=x.useRef(null);return h.jsx(FA,{contentName:ta,titleName:OE,docsSlug:"alert-dialog",children:h.jsx(L2,{scope:n,cancelRef:l,children:h.jsxs(mg,{role:"alertdialog",...i,...s,ref:a,onOpenAutoFocus:Ot(s.onOpenAutoFocus,c=>{var u;c.preventDefault(),(u=l.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[h.jsx(j2,{children:r}),h.jsx(F2,{contentRef:o})]})})})});RE.displayName=ta;var OE="AlertDialogTitle",IE=x.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Rs(n);return h.jsx(gg,{...s,...r,ref:e})});IE.displayName=OE;var DE="AlertDialogDescription",LE=x.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Rs(n);return h.jsx(bg,{...s,...r,ref:e})});LE.displayName=DE;var z2="AlertDialogAction",PE=x.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Rs(n);return h.jsx(dk,{...s,...r,ref:e})});PE.displayName=z2;var jE="AlertDialogCancel",zE=x.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=P2(jE,n),i=Rs(n),o=Gn(e,s);return h.jsx(dk,{...i,...r,ref:o})});zE.displayName=jE;var F2=({contentRef:t})=>{const e=`\`${ta}\` requires a description for the component to be accessible for screen reader users.
291
+
292
+ You can add a description to the \`${ta}\` by passing a \`${DE}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
293
+
294
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ta}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
295
+
296
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return x.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},B2=TE,$2=AE,FE=ME,BE=RE,$E=PE,HE=zE,UE=IE,VE=LE;const Gg=B2,H2=$2,WE=x.forwardRef(({className:t,...e},n)=>h.jsx(FE,{className:Oe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));WE.displayName=FE.displayName;const vf=x.forwardRef(({className:t,...e},n)=>h.jsxs(H2,{children:[h.jsx(WE,{}),h.jsx(BE,{ref:n,className:Oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));vf.displayName=BE.displayName;const wf=({className:t,...e})=>h.jsx("div",{className:Oe("flex flex-col space-y-2 text-center sm:text-left",t),...e});wf.displayName="AlertDialogHeader";const kf=({className:t,...e})=>h.jsx("div",{className:Oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});kf.displayName="AlertDialogFooter";const Sf=x.forwardRef(({className:t,...e},n)=>h.jsx(UE,{ref:n,className:Oe("text-lg font-semibold",t),...e}));Sf.displayName=UE.displayName;const Ef=x.forwardRef(({className:t,...e},n)=>h.jsx(VE,{ref:n,className:Oe("text-sm text-muted-foreground",t),...e}));Ef.displayName=VE.displayName;const Cf=x.forwardRef(({className:t,...e},n)=>h.jsx($E,{ref:n,className:Oe(qg(),t),...e}));Cf.displayName=$E.displayName;const Nf=x.forwardRef(({className:t,...e},n)=>h.jsx(HE,{ref:n,className:Oe(qg({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Nf.displayName=HE.displayName;function qE({issue:t,isOpen:e,onClose:n,onConfirm:r,isDeleting:s=!1}){return t?h.jsx(Gg,{open:e,onOpenChange:n,children:h.jsxs(vf,{children:[h.jsxs(wf,{children:[h.jsx(Sf,{children:"Delete Issue"}),h.jsxs(Ef,{children:["Are you sure you want to delete ",h.jsx("strong",{children:t.title})," (",t.id,")?",h.jsx("br",{}),"This action cannot be undone."]})]}),h.jsxs(kf,{children:[h.jsx(Nf,{disabled:s,children:"Cancel"}),h.jsx(Cf,{onClick:r,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?"Deleting...":"Delete"})]})]})}):null}const KE={blocks:"Blocks",related:"Related to","discovered-from":"Discovered from",implements:"Implements",references:"References","depends-on":"Depends on"},U2={blocks:"bg-red-600 dark:bg-red-700",related:"bg-blue-600 dark:bg-blue-700","discovered-from":"bg-purple-600 dark:bg-purple-700",implements:"bg-green-600 dark:bg-green-700",references:"bg-gray-600 dark:bg-gray-700","depends-on":"bg-orange-600 dark:bg-orange-700"};function V2(t){return{blocks:"Blocked by",related:"Related to","discovered-from":"Led to discovery of",implements:"Implemented by",references:"Referenced by","depends-on":"Required by"}[t]}function W2(t,e){const n=Array.isArray(t)?t:[];return{outgoing:n.filter(r=>r.from_id===e),incoming:n.filter(r=>r.to_id===e)}}function GE({relationships:t,currentEntityId:e,currentEntityType:n,onNavigate:r,onDelete:s,showEmpty:i=!0,showGroupHeaders:o=!0}){const a=W2(t,e);if(t.length===0&&i)return h.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No relationships yet"});if(t.length===0)return null;const l=(c,u)=>{const d=u==="outgoing",f=d?c.to_id:c.from_id,p=d?c.to_type:c.from_type,m=d?KE[c.relationship_type]:V2(c.relationship_type),g=U2[c.relationship_type],b=()=>p==="issue"?`/issues/${f}`:`/specs/${f}`,y=()=>p==="issue"?h.jsx(_g,{className:"h-3 w-3"}):h.jsx(As,{className:"h-3 w-3"}),w=()=>p==="issue"?"issue":"spec";return h.jsxs(Bt,{className:"group flex items-center gap-2 p-2 transition-colors hover:bg-accent/50",children:[h.jsx("span",{className:`shrink-0 rounded-full px-2 py-1 text-xs font-medium text-white ${g}`,children:m}),h.jsx(jM,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),h.jsx(yg,{to:b(),className:"min-w-0 flex-1 no-underline",children:h.jsxs(ct,{variant:w(),className:"inline-flex items-center gap-1",children:[y(),f]})}),s&&h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>s(c),className:"h-6 w-6 shrink-0 p-0 opacity-0 transition-opacity group-hover:opacity-100","aria-label":"Remove relationship",title:"Remove relationship",children:h.jsx(Da,{className:"h-3 w-3"})})}),h.jsx(er,{children:"Remove relationship"})]})]},`${c.from_id}-${c.to_id}-${c.relationship_type}`)};if(!o){const c=[...a.outgoing.map(u=>({rel:u,direction:"outgoing"})),...a.incoming.map(u=>({rel:u,direction:"incoming"}))];return h.jsx(po,{delayDuration:300,children:h.jsx("div",{className:"space-y-2",children:c.map(({rel:u,direction:d})=>l(u,d))})})}return h.jsx(po,{delayDuration:300,children:h.jsxs("div",{className:"space-y-4",children:[a.outgoing.length>0&&h.jsxs("div",{children:[h.jsxs("h4",{className:"mb-2 text-sm font-medium text-muted-foreground",children:["Outgoing (",a.outgoing.length,")"]}),h.jsx("div",{className:"space-y-2",children:a.outgoing.map(c=>l(c,"outgoing"))})]}),a.incoming.length>0&&h.jsxs("div",{children:[h.jsxs("h4",{className:"mb-2 text-sm font-medium text-muted-foreground",children:["Incoming (",a.incoming.length,")"]}),h.jsx("div",{className:"space-y-2",children:a.incoming.map(c=>l(c,"incoming"))})]})]})})}var q2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],K2=q2.reduce((t,e)=>{const n=US(`Primitive.${e}`),r=x.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),G2="Label",JE=x.forwardRef((t,e)=>h.jsx(K2.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));JE.displayName=G2;var YE=JE;const Yt=x.forwardRef(({className:t,...e},n)=>h.jsx(YE,{ref:n,className:Oe("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Yt.displayName=YE.displayName;const J2=["blocks","related","discovered-from","implements","references","depends-on"];function ZE({fromId:t,fromType:e,onSubmit:n,onCancel:r,inline:s=!1}){const[i,o]=x.useState(""),[a,l]=x.useState("issue"),[c,u]=x.useState("related"),[d,f]=x.useState(!1),p=async g=>{if(g.preventDefault(),!!i.trim()){f(!0);try{await n(i.trim(),a,c),o(""),l("issue"),u("related")}finally{f(!1)}}},m=h.jsxs("form",{onSubmit:p,className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"target-id",children:"Target Entity"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(In,{value:a,onValueChange:g=>l(g),children:[h.jsx(vn,{className:"w-[120px]",children:h.jsx(Dn,{})}),h.jsxs(wn,{children:[h.jsx(Ct,{value:"issue",children:"Issue"}),h.jsx(Ct,{value:"spec",children:"Spec"})]})]}),h.jsx(Ms,{id:"target-id",placeholder:a==="issue"?"i-x7k9":"s-14sh",value:i,onChange:g=>o(g.target.value),className:"flex-1",disabled:d})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"relationship-type",children:"Relationship Type"}),h.jsxs(In,{value:c,onValueChange:g=>u(g),children:[h.jsx(vn,{id:"relationship-type",children:h.jsx(Dn,{})}),h.jsx(wn,{children:J2.map(g=>h.jsx(Ct,{value:g,children:KE[g]},g))})]})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[r&&h.jsx(le,{type:"button",variant:"outline",onClick:r,disabled:d,children:"Cancel"}),h.jsx(le,{type:"submit",disabled:!i.trim()||d,children:"Create"})]})]});return s?m:h.jsx(Bt,{className:"p-4",children:m})}const _f=x.forwardRef(({className:t,...e},n)=>h.jsx("textarea",{className:Oe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));_f.displayName="Textarea";function Y2({issueId:t,open:e,onStart:n,onCancel:r}){var v,k,N,S;const[s,i]=x.useState(!0),[o,a]=x.useState(null),[l,c]=x.useState(""),[u,d]=x.useState({mode:"worktree",cleanupMode:"manual"}),[f,p]=x.useState(!1);x.useEffect(()=>{if(!e)return;(async()=>{i(!0);try{const _=await ur.prepare(t);a(_),c(_.renderedPrompt),d({...u,..._.defaultConfig})}catch(_){console.error("Failed to prepare execution:",_)}finally{i(!1)}})()},[e,t]);const m=C=>{d({...u,...C})},g=()=>{n(u,l)},b=(o==null?void 0:o.errors)&&o.errors.length>0,y=(o==null?void 0:o.warnings)&&o.warnings.length>0,w=!s&&!b&&l.trim().length>0;return h.jsx(Mo,{open:e,onOpenChange:r,children:h.jsxs(Ci,{className:"max-h-[90vh] max-w-3xl overflow-y-auto",children:[h.jsxs(Ni,{children:[h.jsx(_i,{children:"Configure Agent Execution"}),h.jsx(sf,{children:"Configure settings and review the prompt before starting the agent."})]}),s?h.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Loading template..."}):h.jsxs("div",{className:"space-y-6",children:[b&&h.jsx("div",{className:"rounded-lg border border-destructive bg-destructive/10 p-3",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(fo,{className:"mt-0.5 h-5 w-5 text-destructive"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsx("p",{className:"text-sm font-medium text-destructive",children:"Errors"}),o.errors.map((C,_)=>h.jsx("p",{className:"text-sm text-destructive/90",children:C},_))]})]})}),y&&h.jsx("div",{className:"rounded-lg border border-yellow-500 bg-yellow-500/10 p-3",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(JM,{className:"mt-0.5 h-5 w-5 text-yellow-600"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsx("p",{className:"text-sm font-medium text-yellow-600",children:"Warnings"}),o.warnings.map((C,_)=>h.jsx("p",{className:"text-sm text-yellow-600/90",children:C},_))]})]})}),o&&((((v=o.relatedSpecs)==null?void 0:v.length)??0)>0||(((k=o.relatedFeedback)==null?void 0:k.length)??0)>0)&&h.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[h.jsx("p",{className:"mb-2 text-sm font-medium",children:"Context Included"}),h.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[(((N=o.relatedSpecs)==null?void 0:N.length)??0)>0&&h.jsxs("p",{children:["• ",o.relatedSpecs.length," related spec(s)"]}),(((S=o.relatedFeedback)==null?void 0:S.length)??0)>0&&h.jsxs("p",{children:["• ",o.relatedFeedback.length," feedback item(s)"]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"mode",children:"Execution Mode"}),h.jsxs(In,{value:u.mode,onValueChange:C=>m({mode:C}),children:[h.jsx(vn,{id:"mode",children:h.jsx(Dn,{})}),h.jsxs(wn,{children:[h.jsx(Ct,{value:"worktree",children:"Worktree (Recommended) - Isolated git worktree"}),h.jsx(Ct,{value:"local",children:"Local - Run in current directory"})]})]})]}),u.mode==="worktree"&&(o==null?void 0:o.availableBranches)&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"baseBranch",children:"Base Branch"}),h.jsxs(In,{value:u.baseBranch,onValueChange:C=>m({baseBranch:C}),children:[h.jsx(vn,{id:"baseBranch",children:h.jsx(Dn,{placeholder:"Select base branch"})}),h.jsx(wn,{children:o.availableBranches.map(C=>h.jsx(Ct,{value:C,children:C},C))})]})]}),(o==null?void 0:o.availableModels)&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"model",children:"Model"}),h.jsxs(In,{value:u.model,onValueChange:C=>m({model:C}),children:[h.jsx(vn,{id:"model",children:h.jsx(Dn,{placeholder:"Select model"})}),h.jsx(wn,{children:o.availableModels.map(C=>h.jsx(Ct,{value:C,children:C},C))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"cleanup",children:"Cleanup Mode"}),h.jsxs(In,{value:u.cleanupMode,onValueChange:C=>m({cleanupMode:C}),children:[h.jsx(vn,{id:"cleanup",children:h.jsx(Dn,{})}),h.jsxs(wn,{children:[h.jsx(Ct,{value:"auto",children:"Auto - Clean up after completion"}),h.jsx(Ct,{value:"manual",children:"Manual - Keep for review"}),h.jsx(Ct,{value:"never",children:"Never - Persist permanently"})]})]})]}),h.jsxs("button",{type:"button",onClick:()=>p(!f),className:"text-sm text-muted-foreground hover:text-foreground",children:[f?"▼":"▶"," Advanced Options"]}),f&&h.jsxs("div",{className:"space-y-4 border-l-2 border-muted pl-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"timeout",children:"Timeout (ms)"}),h.jsx("input",{id:"timeout",type:"number",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.timeout??"",onChange:C=>m({timeout:C.target.value?parseInt(C.target.value):void 0}),placeholder:"No timeout"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"maxTokens",children:"Max Tokens"}),h.jsx("input",{id:"maxTokens",type:"number",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.maxTokens??"",onChange:C=>m({maxTokens:C.target.value?parseInt(C.target.value):void 0}),placeholder:"Model default"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"temperature",children:"Temperature"}),h.jsx("input",{id:"temperature",type:"number",step:"0.1",min:"0",max:"2",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.temperature??"",onChange:C=>m({temperature:C.target.value?parseFloat(C.target.value):void 0}),placeholder:"Model default"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"prompt",children:"Prompt"}),h.jsx(_f,{id:"prompt",value:l,onChange:C=>c(C.target.value),rows:12,className:"font-mono text-sm",placeholder:"Edit the generated prompt..."}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Review and edit the generated prompt before starting the agent."})]})]}),h.jsxs(Og,{children:[h.jsx(le,{variant:"outline",onClick:r,children:"Cancel"}),h.jsx(le,{onClick:g,disabled:!w,children:"Start Agent"})]})]})})}const Z2={preparing:{label:"Preparing",variant:"secondary",icon:h.jsx(Ol,{className:"h-3 w-3"})},pending:{label:"Pending",variant:"secondary",icon:h.jsx(Ol,{className:"h-3 w-3"})},running:{label:"Running",variant:"default",icon:h.jsx(pi,{className:"h-3 w-3 animate-spin"})},paused:{label:"Paused",variant:"outline",icon:h.jsx(Mk,{className:"h-3 w-3"})},completed:{label:"Completed",variant:"default",icon:h.jsx(Cg,{className:"h-3 w-3"})},failed:{label:"Failed",variant:"destructive",icon:h.jsx(Zo,{className:"h-3 w-3"})},cancelled:{label:"Cancelled",variant:"secondary",icon:h.jsx(jy,{className:"h-3 w-3"})},stopped:{label:"Stopped",variant:"secondary",icon:h.jsx(jy,{className:"h-3 w-3"})}};function X2(t){if(!t)return"N/A";const e=new Date(t),r=new Date().getTime()-e.getTime(),s=Math.floor(r/6e4),i=Math.floor(r/36e5),o=Math.floor(r/864e5);return s<1?"Just now":s<60?`${s}m ago`:i<24?`${i}h ago`:o<7?`${o}d ago`:e.toLocaleDateString()}function Q2(t,e=8){return t.substring(0,e)}function ej({issueId:t}){const e=kr(),[n,r]=x.useState([]),[s,i]=x.useState(!0),[o,a]=x.useState(null);x.useEffect(()=>{(async()=>{i(!0),a(null);try{const d=(await ur.list(t)).sort((f,p)=>new Date(p.created_at).getTime()-new Date(f.created_at).getTime());r(d)}catch(u){console.error("Failed to fetch executions:",u),a("Failed to load execution history")}finally{i(!1)}})()},[t]);const l=c=>{e(`/executions/${c}`)};return s?h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading executions..."})]}):o?h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive",children:o})]}):n.length===0?h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsxs(Bt,{className:"p-6 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No executions yet"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:'Click "Run Agent" to start your first execution'})]})]}):h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsx(ct,{variant:"secondary",children:n.length})]}),h.jsx("div",{className:"space-y-2",children:n.map(c=>{const u=Z2[c.status]||{label:c.status,variant:"outline",icon:h.jsx(Ol,{className:"h-3 w-3"})},d=c.completed_at||c.started_at||c.created_at;let f=[];if(c.files_changed)try{f=typeof c.files_changed=="string"?JSON.parse(c.files_changed):c.files_changed}catch(p){console.error("Failed to parse files_changed:",p)}return h.jsx(Bt,{className:"cursor-pointer p-3 transition-colors hover:bg-accent",onClick:()=>l(c.id),children:h.jsx("div",{className:"flex items-start justify-between gap-3",children:h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"font-mono text-xs text-muted-foreground",children:Q2(c.id)}),h.jsxs(ct,{variant:u.variant,className:"gap-1",children:[u.icon,u.label]})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h.jsx("span",{children:c.model}),h.jsx("span",{children:"•"}),h.jsx("span",{className:"capitalize",children:c.mode}),h.jsx("span",{children:"•"}),h.jsx("span",{children:X2(d)})]}),c.error&&h.jsxs("div",{className:"line-clamp-1 text-xs text-destructive",children:["Error: ",c.error]}),f.length>0&&h.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.length," file(s) changed"]})]})})},c.id)})})]})}function tj(){const t=Ts(),e=xr({mutationFn:r=>Qo.create(r),onSuccess:()=>{t.invalidateQueries({queryKey:["issue-relationships"]})}}),n=xr({mutationFn:r=>Qo.delete(r),onSuccess:()=>{t.invalidateQueries({queryKey:["issue-relationships"]})}});return{createRelationship:e.mutate,createRelationshipAsync:e.mutateAsync,deleteRelationship:n.mutate,deleteRelationshipAsync:n.mutateAsync,isCreating:e.isPending,isDeleting:n.isPending}}var wh={exports:{}},kh={};/**
297
+ * @license React
298
+ * use-sync-external-store-shim.production.js
299
+ *
300
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
301
+ *
302
+ * This source code is licensed under the MIT license found in the
303
+ * LICENSE file in the root directory of this source tree.
304
+ */var wx;function nj(){if(wx)return kh;wx=1;var t=hk();function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function a(d,f){var p=f(),m=r({inst:{value:p,getSnapshot:f}}),g=m[0].inst,b=m[1];return i(function(){g.value=p,g.getSnapshot=f,l(g)&&b({inst:g})},[d,p,f]),s(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),o(p),p}function l(d){var f=d.getSnapshot;d=d.value;try{var p=f();return!n(d,p)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return kh.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,kh}var kx;function XE(){return kx||(kx=1,wh.exports=nj()),wh.exports}var QE=XE();function un(t){this.content=t}un.prototype={constructor:un,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new un(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new un(n)},addToStart:function(t,e){return new un([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new un(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new un(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=un.from(t),t.size?new un(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=un.from(t),t.size?new un(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=un.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};un.from=function(t){if(t instanceof un)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new un(e)};function eC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=eC(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function tC(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=tC(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class K{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new K(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new K(r,s)}cutByIndex(e,n){return e==n?K.empty:e==0&&n==this.content.length?this:new K(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new K(s,i)}addToStart(e){return new K([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new K(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return eC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return tC(this,e,n,r)}findIndex(e){if(e==0)return $c(0,e);if(e==this.size)return $c(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?$c(n+1,i):$c(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return K.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new K(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return K.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new K(n||e,r)}static from(e){if(!e)return K.empty;if(e instanceof K)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new K([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}K.empty=new K([],0);const Sh={index:0,offset:0};function $c(t,e){return Sh.index=t,Sh.offset=e,Sh}function Hu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Hu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Hu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let xt=class lm{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Hu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return lm.none;if(e instanceof lm)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};xt.none=[];class Uu extends Error{}class ae{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=rC(this.content,e+this.openStart,n);return r&&new ae(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ae(nC(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ae.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ae(K.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new ae(e,r,s)}}ae.empty=new ae(K.empty,0,0);function nC(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(nC(i.content,e-s-1,n-s-1)))}function rC(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=rC(o.content,e-i-1,n,o);return a&&t.replaceChild(s,o.copy(a))}function rj(t,e,n){if(n.openStart>t.depth)throw new Uu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Uu("Inconsistent open depths");return sC(t,e,n,0)}function sC(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=sC(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return so(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=sj(n,t);return so(i,oC(t,o,a,e,r))}else return so(i,Vu(t,e,r))}function iC(t,e){if(!e.type.compatibleContent(t.type))throw new Uu("Cannot join "+e.type.name+" onto "+t.type.name)}function cm(t,e,n){let r=t.node(n);return iC(r,e.node(n)),r}function ro(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function bl(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(ro(t.nodeAfter,r),i++));for(let a=i;a<o;a++)ro(s.child(a),r);e&&e.depth==n&&e.textOffset&&ro(e.nodeBefore,r)}function so(t,e){return t.type.checkContent(e),t.copy(e)}function oC(t,e,n,r,s){let i=t.depth>s&&cm(t,e,s+1),o=r.depth>s&&cm(n,r,s+1),a=[];return bl(null,t,s,a),i&&o&&e.index(s)==n.index(s)?(iC(i,o),ro(so(i,oC(t,e,n,r,s+1)),a)):(i&&ro(so(i,Vu(t,e,s+1)),a),bl(e,n,s,a),o&&ro(so(o,Vu(n,r,s+1)),a)),bl(r,null,s,a),new K(a)}function Vu(t,e,n){let r=[];if(bl(null,t,n,r),t.depth>n){let s=cm(t,e,n+1);ro(so(s,Vu(t,e,n+1)),r)}return bl(e,null,n,r),new K(r)}function sj(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(K.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class jl{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return xt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Wu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new jl(n,r,i)}static resolveCached(e,n){let r=Sx.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else Sx.set(e,r=new ij);let s=r.elts[r.i]=jl.resolve(e,n);return r.i=(r.i+1)%oj,s}}class ij{constructor(){this.elts=[],this.i=0}}const oj=12,Sx=new WeakMap;class Wu{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const aj=Object.create(null);let mi=class um{constructor(e,n,r,s=xt.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||K.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Hu(this.attrs,n||e.defaultAttrs||aj)&&xt.sameSet(this.marks,r||xt.none)}copy(e=null){return e==this.content?this:new um(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new um(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ae.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new ae(c,s.depth-o,i.depth-o)}replace(e,n,r){return rj(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return jl.resolveCached(this,e)}resolveNoCache(e){return jl.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),aC(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=K.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=xt.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!xt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=K.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};mi.prototype.text=void 0;class qu extends mi{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):aC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new qu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new qu(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function aC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class yo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new lj(e,n);if(r.next==null)return yo.empty;let s=lC(r);r.next&&r.err("Unexpected trailing text");let i=mj(pj(s));return gj(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return K.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
305
+ `)}}yo.empty=new yo(!0);class lj{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function lC(t){let e=[];do e.push(cj(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function cj(t){let e=[];do e.push(uj(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function uj(t){let e=hj(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=dj(t,e);else break;return e}function Ex(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function dj(t,e){let n=Ex(t),r=n;return t.eat(",")&&(t.next!="}"?r=Ex(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function fj(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function hj(t){if(t.eat("(")){let e=lC(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=fj(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function pj(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function cC(t,e){return e-t}function Cx(t,e){let n=[];return r(e),n.sort(cC);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function mj(t){let e=Object.create(null);return n(Cx(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);Cx(t,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new yo(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(cC);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function gj(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function uC(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function dC(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function fC(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function hC(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new yj(t,r,e[r]);return n}let Nx=class pC{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=hC(e,r.attrs),this.defaultAttrs=uC(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:dC(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mi(this,this.computeAttrs(e),K.from(n),xt.setFrom(r))}createChecked(e=null,n,r){return n=K.from(n),this.checkContent(n),new mi(this,this.computeAttrs(e),n,xt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=K.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(K.empty,!0);return i?new mi(this,e,n.append(i),xt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){fC(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:xt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new pC(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function bj(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class yj{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?bj(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Tf{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=hC(e,s.attrs),this.excluded=null;let i=uC(this.attrs);this.instance=i?new xt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new xt(this,dC(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Tf(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){fC(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let mC=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=un.from(e.nodes),n.marks=un.from(e.marks||{}),this.nodes=Nx.compile(this.spec.nodes,this),this.marks=Tf.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=yo.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?_x(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:_x(this,o.split(" "))}this.nodeFromJSON=s=>mi.fromJSON(this,s),this.markFromJSON=s=>xt.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Nx){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new qu(r,r.defaultAttrs,e,xt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function _x(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function xj(t){return t.tag!=null}function vj(t){return t.style!=null}class gi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(xj(s))this.tags.push(s);else if(vj(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Ax(this,n,!1);return r.addAll(e,xt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Ax(this,n,!0);return r.addAll(e,xt.none,n.from,n.to),ae.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Sj(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Mx(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Mx(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gi(e,gi.schemaRules(e)))}}const gC={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},wj={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},bC={ol:!0,ul:!0},zl=1,dm=2,yl=4;function Tx(t,e,n){return e!=null?(e?zl:0)|(e==="full"?dm:0):t&&t.whitespace=="pre"?zl|dm:n&~yl}class Hc{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=xt.none,this.match=i||(o&yl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(K.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zl)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=K.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!gC.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ax{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=Tx(null,n.preserveWhitespace,0)|(r?yl:0);s?i=new Hc(s.type,s.attrs,xt.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Hc(null,null,xt.none,!0,null,o):i=new Hc(e.schema.topNodeType,null,xt.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&dm?"full":this.localPreserveWS||(s.options&zl)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
306
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;bC.hasOwnProperty(o)&&this.parser.normalizeLists&&kj(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:wj.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(gC.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
307
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=xt.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):Rx(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Tx(e,i,o.options);o.options&yl&&o.content.length==0&&(a|=yl);let l=xt.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Rx(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Hc(e,n,l,s,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=zl)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function kj(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&bC.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Sj(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Mx(t){let e={};for(let n in t)e[n]=t[n];return e}function Rx(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class Ro{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Eh(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=vu(Eh(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&vu(Eh(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return vu(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ro(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Ox(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Ox(e.marks)}}function Ox(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Eh(t){return t.document||window.document}const Ix=new WeakMap;function Ej(t){let e=Ix.get(t);return e===void 0&&Ix.set(t,e=Cj(t)),e}function Cj(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function vu(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Ej(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:m}=vu(t,f,n,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const yC=65535,xC=Math.pow(2,16);function Nj(t,e){return t+e*xC}function Dx(t){return t&yC}function _j(t){return(t-(t&yC))/xC}const vC=1,wC=2,wu=4,kC=8;class fm{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&kC)>0}get deletedBefore(){return(this.delInfo&(vC|wu))>0}get deletedAfter(){return(this.delInfo&(wC|wu))>0}get deletedAcross(){return(this.delInfo&wu)>0}}class tr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&tr.empty)return tr.empty}recover(e){let n=0,r=Dx(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+_j(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,p=l+s+(f<0?0:u);if(r)return p;let m=e==(n<0?l:d)?null:Nj(a/3,e-l),g=e==l?wC:e==d?vC:wu;return(n<0?e!=l:e!=d)&&(g|=kC),new fm(p,g,m)}s+=u-c}return r?e+s:new fm(e+s,0,null)}touches(e,n){let r=0,s=Dx(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new tr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?tr.empty:new tr(e<0?[0,-e,0]:[0,0,e])}}tr.empty=new tr([]);class Fl{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Fl(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Fl;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new fm(e,s,null)}}const Ch=Object.create(null);class Cn{getMap(){return tr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ch[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ch)throw new RangeError("Duplicate use of step JSON ID "+e);return Ch[e]=n,n.prototype.jsonID=e,n}}class qt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new qt(e,null)}static fail(e){return new qt(null,e)}static fromReplace(e,n,r,s){try{return qt.ok(e.replace(n,r,s))}catch(i){if(i instanceof Uu)return qt.fail(i.message);throw i}}}function Jg(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(Jg(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return K.fromArray(r)}class ci extends Cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new ae(Jg(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return qt.fromReplace(e,this.from,this.to,i)}invert(){return new Rr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ci(n.pos,r.pos,this.mark)}merge(e){return e instanceof ci&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ci(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ci(n.from,n.to,e.markFromJSON(n.mark))}}Cn.jsonID("addMark",ci);class Rr extends Cn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ae(Jg(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return qt.fromReplace(e,this.from,this.to,r)}invert(){return new ci(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Rr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Rr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Rr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Rr(n.from,n.to,e.markFromJSON(n.mark))}}Cn.jsonID("removeMark",Rr);class ui extends Cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qt.fromReplace(e,this.pos,this.pos+1,new ae(K.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new ui(this.pos,n.marks[s]);return new ui(this.pos,this.mark)}}return new xo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ui(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ui(n.pos,e.markFromJSON(n.mark))}}Cn.jsonID("addNodeMark",ui);class xo extends Cn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return qt.fromReplace(e,this.pos,this.pos+1,new ae(K.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ui(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new xo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xo(n.pos,e.markFromJSON(n.mark))}}Cn.jsonID("removeNodeMark",xo);class on extends Cn{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&hm(e,this.from,this.to)?qt.fail("Structure replace would overwrite content"):qt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new tr([this.from,this.to-this.from,this.slice.size])}invert(e){return new on(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new on(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof on)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ae.empty:new ae(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new on(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ae.empty:new ae(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new on(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new on(n.from,n.to,ae.fromJSON(e,n.slice),!!n.structure)}}Cn.jsonID("replace",on);class an extends Cn{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(hm(e,this.from,this.gapFrom)||hm(e,this.gapTo,this.to)))return qt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return qt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?qt.fromReplace(e,this.from,this.to,r):qt.fail("Content does not fit in gap")}getMap(){return new tr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new an(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new an(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new an(n.from,n.to,n.gapFrom,n.gapTo,ae.fromJSON(e,n.slice),n.insert,!!n.structure)}}Cn.jsonID("replaceAround",an);function hm(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Tj(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,n),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=p:s.push(o=new Rr(f,p,d[g])));a&&a.to==f?a.to=p:i.push(a=new ci(f,p,r))}}),s.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function Aj(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof Tf){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&d.eq(s[p].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Rr(o.from,o.to,o.style)))}function Yg(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new on(a,u,ae.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Rr(a,u,c.marks[f]));if(s&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(c.text);)m||(m=new ae(K.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new on(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(K.empty,!0);t.replace(a,a,new ae(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function Mj(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $a(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+s,l=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!Mj(o,a,l))break;a&&(s=1),l<o.childCount&&(i=1)}return null}function Rj(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=K.empty,d=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,u=K.from(r.node(m).copy(u)),d++):l--;let f=K.empty,p=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=K.from(s.node(m).copy(f)),p++):c++;t.step(new an(l,c,o,a,new ae(u.append(f),d,p),u.size-d,!0))}function Zg(t,e,n=null,r=t){let s=Oj(t,e),i=s&&Ij(r,e);return i?s.map(Lx).concat({type:e,attrs:n}).concat(i.map(Lx)):null}function Lx(t){return{type:t,attrs:null}}function Oj(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function Ij(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function Dj(t,e,n){let r=K.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=K.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new an(s,i,s,i,new ae(r,0,0),n.length,!0))}function Lj(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&Pj(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&EC(t,o,a,i),Yg(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return t.step(new an(d,f,d+1,f-1,new ae(K.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&SC(t,o,a,i),!1}})}function SC(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function EC(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
308
+ `))}})}function Pj(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function jj(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new an(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ae(K.from(o),0,0),1,!0))}function ws(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let d=s.node(c),f=s.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(p))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function zj(t,e,n=1,r){let s=t.doc.resolve(e),i=K.empty,o=K.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=K.from(s.node(a).copy(i));let u=r&&r[c];o=K.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}t.step(new on(e,e,new ae(i.append(o),n,n),!0))}function Mi(t,e){let n=t.resolve(e),r=n.index();return CC(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Fj(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function CC(t,e){return!!(t&&e&&!t.isLeaf&&Fj(t,e))}function Af(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&CC(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function Bj(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);EC(t,u.node(),u.before(),a)}o.inlineContent&&Yg(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new on(c,l.map(e+n,-1),ae.empty,!0)),r===!0){let u=t.doc.resolve(c);SC(t,u.node(),u.before(),t.steps.length)}return t}function $j(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function NC(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(l,l,s);else{let d=c.contentMatchAt(l).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Mf(t,e,n=e,r=ae.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return _C(s,i,r)?new on(e,n,r):new Hj(s,i,r).fit()}function _C(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Hj{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=K.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new ae(i,o,a);return e>-1?new an(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new on(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=Nh(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(K.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Nh(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new ae(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Nh(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new ae(ol(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ae(ol(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)u.push(s.child(g));d=d.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),b=d.matchType(g.type);if(!b)break;c++,(c>1||l==0||g.content.size)&&(d=b,u.push(TC(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=al(this.placed,n,K.from(u)),this.frontier[n].match=d,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=a;g<p;g++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=m?e==0?ae.empty:new ae(ol(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new ae(ol(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!_h(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=_h(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=_h(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=al(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=al(this.placed,this.depth,K.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=al(this.placed,this.frontier.length,n))}}function ol(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ol(t.firstChild.content,e-1,n)))}function al(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(al(t.lastChild.content,e-1,n)))}function Nh(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function TC(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,TC(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),t.copy(r)}function _h(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!Uj(n,i.content,o)?a:null}function Uj(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Vj(t){return t.spec.defining||t.spec.definingForContent}function Wj(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(_C(s,i,r))return t.step(new on(e,n,r));let o=MC(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let f=s.depth,p=s.pos-1;f>0;f--,p--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:s.before(f)==p&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let m=f.firstChild;if(c.push(m),p==r.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let p=c[f],m=Vj(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(a)-1)))u=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),m=c[p];if(m)for(let g=0;g<o.length;g++){let b=o[(g+l)%o.length],y=!0;b<0&&(y=!1,b=-b);let w=s.node(b-1),v=s.index(b-1);if(w.canReplaceWith(v,v,m.type,m.marks))return t.replace(s.before(b),y?i.after(b):n,new ae(AC(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=o[f];p<0||(e=s.before(p),n=i.after(p))}}function AC(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(AC(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(K.empty,!0))}return t}function qj(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=$j(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new ae(K.from(r),0,0))}function Kj(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),i=MC(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function MC(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class na extends Cn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return qt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return qt.fromReplace(e,this.pos,this.pos+1,new ae(K.from(s),0,n.isLeaf?0:1))}getMap(){return tr.empty}invert(e){return new na(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new na(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new na(n.pos,n.attr,n.value)}}Cn.jsonID("attr",na);class Bl extends Cn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return qt.ok(r)}getMap(){return tr.empty}invert(e){return new Bl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Bl(n.attr,n.value)}}Cn.jsonID("docAttr",Bl);let Sa=class extends Error{};Sa=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Sa.prototype=Object.create(Error.prototype);Sa.prototype.constructor=Sa;Sa.prototype.name="TransformError";class Xg{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Fl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Sa(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ae.empty){let s=Mf(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new ae(K.from(r),0,0))}delete(e,n){return this.replace(e,n,ae.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Wj(this,e,n,r),this}replaceRangeWith(e,n,r){return qj(this,e,n,r),this}deleteRange(e,n){return Kj(this,e,n),this}lift(e,n){return Rj(this,e,n),this}join(e,n=1){return Bj(this,e,n),this}wrap(e,n){return Dj(this,e,n),this}setBlockType(e,n=e,r,s=null){return Lj(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return jj(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new na(e,n,r)),this}setDocAttribute(e,n){return this.step(new Bl(e,n)),this}addNodeMark(e,n){return this.step(new ui(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof xt)n.isInSet(r.marks)&&this.step(new xo(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new xo(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return zj(this,e,n,r),this}addMark(e,n,r){return Tj(this,e,n,r),this}removeMark(e,n,r){return Aj(this,e,n,r),this}clearIncompatible(e,n,r){return Yg(this,e,n,r),this}}const Th=Object.create(null);class De{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new RC(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ae.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ae.empty:n),a==0&&zx(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),zx(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new Ae(e):zo(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?zo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):zo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new rr(e.node(0))}static atStart(e){return zo(e,e,0,0,1)||new rr(e)}static atEnd(e){return zo(e,e,e.content.size,e.childCount,-1)||new rr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Th[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Th)throw new RangeError("Duplicate use of selection JSON ID "+e);return Th[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ae.between(this.$anchor,this.$head).getBookmark()}}De.prototype.visible=!0;class RC{constructor(e,n){this.$from=e,this.$to=n}}let Px=!1;function jx(t){!Px&&!t.parent.inlineContent&&(Px=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ae extends De{constructor(e,n=e){jx(e),jx(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return De.near(r);let s=e.resolve(n.map(this.anchor));return new Ae(s.parent.inlineContent?s:r,r)}replace(e,n=ae.empty){if(super.replace(e,n),n==ae.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Rf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ae(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=De.findFrom(n,r,!0)||De.findFrom(n,-r,!0);if(i)n=i.$head;else return De.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(De.findFrom(e,-r,!0)||De.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new Ae(e,n)}}De.jsonID("text",Ae);class Rf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Rf(e.map(this.anchor),e.map(this.head))}resolve(e){return Ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ee extends De{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?De.near(i):new Ee(i)}content(){return new ae(K.from(this.node),0,0)}eq(e){return e instanceof Ee&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Qg(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ee(e.resolve(n.anchor))}static create(e,n){return new Ee(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ee.prototype.visible=!1;De.jsonID("node",Ee);class Qg{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Rf(r,r):new Qg(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ee.isSelectable(r)?new Ee(n):De.near(n)}}class rr extends De{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ae.empty){if(n==ae.empty){e.delete(0,e.doc.content.size);let r=De.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new rr(e)}map(e){return new rr(e)}eq(e){return e instanceof rr}getBookmark(){return Gj}}De.jsonID("all",rr);const Gj={map(){return this},resolve(t){return new rr(t)}};function zo(t,e,n,r,s,i=!1){if(e.inlineContent)return Ae.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&Ee.isSelectable(a))return Ee.create(t,n-(s<0?a.nodeSize:0))}else{let l=zo(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function zx(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof on||s instanceof an))return;let i=t.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(De.near(t.doc.resolve(o),n))}const Fx=1,Uc=2,Bx=4;class Jj extends Xg{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Fx)&~Uc,this.storedMarks=null,this}get selectionSet(){return(this.updated&Fx)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Uc,this}ensureMarks(e){return xt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Uc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Uc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||xt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(De.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Bx,this}get scrolledIntoView(){return(this.updated&Bx)>0}}function $x(t,e){return!e||!t?t:t.bind(e)}class ll{constructor(e,n,r){this.name=e,this.init=$x(n.init,r),this.apply=$x(n.apply,r)}}const Yj=[new ll("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ll("selection",{init(t,e){return t.selection||De.atStart(e.doc)},apply(t){return t.selection}}),new ll("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ll("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ah{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Yj.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ll(r.key,r.spec.state,r))})}}class Jo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Jo(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Jj(this)}static create(e){let n=new Ah(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Jo(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new Ah(this.schema,e.plugins),r=n.fields,s=new Jo(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Ah(e.schema,e.plugins),i=new Jo(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=mi.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=De.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function OC(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=OC(s,e,{})),n[r]=s}return n}class Mt{constructor(e){this.spec=e,this.props={},e.props&&OC(e.props,this,this.props),this.key=e.key?e.key.key:IC("plugin")}getState(e){return e[this.key]}}const Mh=Object.create(null);function IC(t){return t in Mh?t+"$"+ ++Mh[t]:(Mh[t]=0,t+"$")}class Ht{constructor(e="key"){this.key=IC(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const eb=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function DC(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const LC=(t,e,n)=>{let r=DC(t,n);if(!r)return!1;let s=tb(r);if(!s){let o=r.blockRange(),a=o&&$a(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(VC(t,s,e,-1))return!0;if(r.parent.content.size==0&&(Ea(i,"end")||Ee.isSelectable(i)))for(let o=r.depth;;o--){let a=Mf(t.doc,r.before(o),r.after(o),ae.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Ea(i,"end")?De.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):Ee.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},Zj=(t,e,n)=>{let r=DC(t,n);if(!r)return!1;let s=tb(r);return s?PC(t,s,e):!1},Xj=(t,e,n)=>{let r=zC(t,n);if(!r)return!1;let s=nb(r);return s?PC(t,s,e):!1};function PC(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Mf(t.doc,i,l,ae.empty);if(!c||c.from!=i||c instanceof on&&c.slice.size>=l-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(Ae.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Ea(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const jC=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=tb(r)}let o=i&&i.nodeBefore;return!o||!Ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ee.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function tb(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function zC(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const FC=(t,e,n)=>{let r=zC(t,n);if(!r)return!1;let s=nb(r);if(!s)return!1;let i=s.nodeAfter;if(VC(t,s,e,1))return!0;if(r.parent.content.size==0&&(Ea(i,"start")||Ee.isSelectable(i))){let o=Mf(t.doc,r.before(),r.after(),ae.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(Ea(i,"start")?De.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):Ee.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},BC=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=nb(r)}let o=i&&i.nodeAfter;return!o||!Ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ee.create(t.doc,i.pos)).scrollIntoView()),!0)};function nb(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Qj=(t,e)=>{let n=t.selection,r=n instanceof Ee,s;if(r){if(n.node.isTextblock||!Mi(t.doc,n.from))return!1;s=n.from}else if(s=Af(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(Ee.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},ez=(t,e)=>{let n=t.selection,r;if(n instanceof Ee){if(n.node.isTextblock||!Mi(t.doc,n.to))return!1;r=n.to}else if(r=Af(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},tz=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&$a(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},$C=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
309
+ `).scrollIntoView()),!0)};function rb(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const nz=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=rb(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(De.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},HC=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof rr||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=rb(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(Ae.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},UC=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ws(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&$a(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function rz(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof Ee&&e.selection.node.isBlock)return!r.parentOffset||!ws(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=rb(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),o=p;break}else{if(p==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Ae||e.selection instanceof rr)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=ws(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=ws(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(o).type!=a){let p=u.mapping.map(r.before(o)),m=u.doc.resolve(p);a&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const sz=rz(),iz=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(Ee.create(t.doc,s))),!0)};function oz(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Mi(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function VC(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&oz(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,m=K.empty;for(let y=o.length-1;y>=0;y--)m=K.from(o[y].create(null,m));m=K.from(s.copy(m));let g=t.tr.step(new an(e.pos-1,p,e.pos,p,new ae(m,1,0),o.length,!0)),b=g.doc.resolve(p+2*o.length);b.nodeAfter&&b.nodeAfter.type==s.type&&Mi(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:De.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&$a(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Ea(i,"start",!0)&&Ea(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=i,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let y=K.empty;for(let v=m.length-1;v>=0;v--)y=K.from(m[v].copy(y));let w=t.tr.step(new an(e.pos-m.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new ae(y,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function WC(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(Ae.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const az=WC(-1),lz=WC(1);function cz(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&Zg(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Hx(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let u=n.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function sb(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}sb(eb,LC,jC);sb(eb,FC,BC);sb($C,HC,UC,sz);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function uz(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return dz(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function dz(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);i=new Wu(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Wu(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=Zg(i,n,r,e);return a?(t&&fz(t,e,a,s,n),!0):!1}function fz(t,e,n,r,s){let i=K.empty;for(let u=n.length-1;u>=0;u--)i=K.from(n[u].type.create(n[u].attrs,i));t.step(new an(e.start-(r?2:0),e.end,e.start,e.end,new ae(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&ws(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function hz(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?pz(e,n,t,i):mz(e,n,i):!0:!1}}function pz(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new an(i-1,o,i,o,new ae(K.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Wu(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=$a(r);if(a==null)return!1;s.lift(r,a);let l=s.doc.resolve(s.mapping.map(i,-1)-1);return Mi(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function mz(t,e,n){let r=t.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?K.empty:K.from(s))))return!1;let d=i.pos,f=d+o.nodeSize;return r.step(new an(d-(a?1:0),f+(l?1:0),d+1,f-1,new ae((a?K.empty:K.from(s.copy(K.empty))).append(l?K.empty:K.from(s.copy(K.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function gz(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=K.from(c?t.create():null),d=new ae(K.from(t.create(null,K.from(a.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new an(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const dn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ca=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let pm=null;const ps=function(t,e,n){let r=pm||(pm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},bz=function(){pm=null},vo=function(t,e,n,r){return n&&(Ux(t,e,n,r,-1)||Ux(t,e,n,r,1))},yz=/^(img|br|input|textarea|hr)$/i;function Ux(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:yr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||wc(t)||yz.test(t.nodeName)||t.contentEditable=="false")return!1;e=dn(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?yr(t):0}else return!1}}function yr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function xz(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=yr(t)}else if(t.parentNode&&!wc(t))e=dn(t),t=t.parentNode;else return null}}function vz(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!wc(t))e=dn(t)+1,t=t.parentNode;else return null}}function wz(t,e,n){for(let r=e==0,s=e==yr(t);r||s;){if(t==n)return!0;let i=dn(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==yr(t)}}function wc(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Of=function(t){return t.focusNode&&vo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Fi(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function kz(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Sz(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(yr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(yr(r.startContainer),r.startOffset)}}}const Xr=typeof navigator<"u"?navigator:null,Vx=typeof document<"u"?document:null,Ri=Xr&&Xr.userAgent||"",mm=/Edge\/(\d+)/.exec(Ri),qC=/MSIE \d/.exec(Ri),gm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ri),Kn=!!(qC||gm||mm),bi=qC?document.documentMode:gm?+gm[1]:mm?+mm[1]:0,vr=!Kn&&/gecko\/(\d+)/i.test(Ri);vr&&+(/Firefox\/(\d+)/.exec(Ri)||[0,0])[1];const bm=!Kn&&/Chrome\/(\d+)/.exec(Ri),kn=!!bm,KC=bm?+bm[1]:0,Ln=!Kn&&!!Xr&&/Apple Computer/.test(Xr.vendor),Na=Ln&&(/Mobile\/\w+/.test(Ri)||!!Xr&&Xr.maxTouchPoints>2),pr=Na||(Xr?/Mac/.test(Xr.platform):!1),Ez=Xr?/Win/.test(Xr.platform):!1,vs=/Android \d/.test(Ri),kc=!!Vx&&"webkitFontSmoothing"in Vx.documentElement.style,Cz=kc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Nz(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function as(t,e){return typeof t=="number"?t:t[e]}function _z(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Wx(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Ca(o);continue}let a=o,l=a==i.body,c=l?Nz(i):_z(a),u=0,d=0;if(e.top<c.top+as(r,"top")?d=-(c.top-e.top+as(s,"top")):e.bottom>c.bottom-as(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+as(s,"top")-c.top:e.bottom-c.bottom+as(s,"bottom")),e.left<c.left+as(r,"left")?u=-(c.left-e.left+as(s,"left")):e.right>c.right-as(r,"right")&&(u=e.right-c.right+as(s,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-p,b=a.scrollTop-m;e={left:e.left-g,top:e.top-b,right:e.right-g,bottom:e.bottom-b}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Ca(o)}}function Tz(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:GC(t.dom)}}function GC(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ca(r));return e}function Az({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;JC(n,r==0?0:r-e)}function JC(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Io=null;function Mz(t){if(t.setActive)return t.setActive();if(Io)return t.focus(Io);let e=GC(t);t.focus(Io==null?{get preventScroll(){return Io={preventScroll:!0},!0}}:void 0),Io||(Io=!1,JC(e,0))}function YC(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=ps(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){n=u,r=g,s=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=d+1)}}return!n&&l&&(n=l,s=c,r=0),n&&n.nodeType==3?Rz(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:YC(n,s)}function Rz(t,e){let n=t.nodeValue.length,r=document.createRange();for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let i=Hs(r,1);if(i.top!=i.bottom&&ib(e,i))return{node:t,offset:s+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function ib(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Oz(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Iz(t,e,n){let{node:r,offset:s}=YC(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function Dz(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?s=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function ZC(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(ib(e,c))return ZC(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function Lz(t,e){let n=t.dom.ownerDocument,r,s=0,i=Sz(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!ib(e,c)||(o=ZC(t.dom,e,c),!o))return null}if(Ln)for(let c=o;r&&c;c=Ca(c))c.draggable&&(r=void 0);if(o=Oz(o,e),r){if(vr&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;kc&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=Dz(t,r,s,e))}a==null&&(a=Iz(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function qx(t){return t.top<t.bottom||t.left<t.right}function Hs(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(qx(r))return r}return Array.prototype.find.call(n,qx)||t.getBoundingClientRect()}const Pz=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function XC(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=kc||vr;if(r.nodeType==3)if(o&&(Pz.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=Hs(ps(r,s,s),n);if(vr&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Hs(ps(r,s-1,s-1),-1);if(c.top==l.top){let u=Hs(ps(r,s,s+1),-1);if(u.top!=l.top)return Za(u,u.left<c.left)}}return l}else{let l=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Za(Hs(ps(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==yr(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return Rh(l.getBoundingClientRect(),!1)}if(i==null&&s<yr(r)){let l=r.childNodes[s];if(l.nodeType==1)return Rh(l.getBoundingClientRect(),!0)}return Rh(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==yr(r))){let l=r.childNodes[s-1],c=l.nodeType==3?ps(l,yr(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Za(Hs(c,1),!1)}if(i==null&&s<yr(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ps(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Za(Hs(c,-1),!0)}return Za(Hs(r.nodeType==3?ps(r):r,-n),n>=0)}function Za(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Rh(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function QC(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function jz(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return QC(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=XC(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ps(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const zz=/[\u0590-\u08ac]/;function Fz(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!zz.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:QC(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),b=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),b}):r.pos==r.start()||r.pos==r.end()}let Kx=null,Gx=null,Jx=!1;function Bz(t,e,n){return Kx==e&&Gx==n?Jx:(Kx=e,Gx=n,Jx=n=="up"||n=="down"?jz(t,e,n):Fz(t,e,n))}const wr=0,Yx=1,Hi=2,Qr=3;class Sc{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=wr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>dn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof t1){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof e1&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?dn(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?dn(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=dn(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=dn(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],b=m+g.size;if(i>m&&o<b)return g.setSelection(e-m-g.border,n-m-g.border,r,s);m=b}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((vr||Ln)&&e==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(d=!!(m&&p.nodeValue[m-1]==`
310
+ `),d&&m==p.nodeValue.length)for(let g=p,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:dn(b)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=p.childNodes[m-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(vr&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||d&&Ln)&&vo(a.node,a.offset,u.anchorNode,u.anchorOffset)&&vo(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&vr)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+i.border,l=o-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Hi:Yx,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Qr:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Hi:Qr}r=o}this.dirty=Hi}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Hi:Yx;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class e1 extends Sc{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==wr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class $z extends Sc{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class wo extends Sc{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Ro.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new wo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Qr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Qr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=wr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=wr}}slice(e,n,r){let s=wo.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=xm(i,n,o,r)),e>0&&(i=xm(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class yi extends Sc{constructor(e,n,r,s,i,o,a,l,c){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Ro.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=s1(u,r,n),c?l=new Hz(e,n,r,s,u,d||null,f,c,i,o+1):n.isText?new If(e,n,r,s,u,f,i):new yi(e,n,r,s,u,d||null,f,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>K.empty)}return e}matchesNode(e,n,r){return this.dirty==wr&&e.eq(this.node)&&Ku(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new Vz(this,o&&o.node,e);Kz(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?xt.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,s)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,p,e)||l.updateNextNode(c,u,d,e,f,s)||l.addNode(c,u,d,e,s),s+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Hi)&&(o&&this.protectLocalComposition(e,o),n1(this.contentDOM,this.children,e),Na&&Gz(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Ae)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=Jz(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new $z(this,i,n,s);e.input.compositionNodes.push(o),this.children=xm(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Qr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=wr}updateOuterDeco(e){if(Ku(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=r1(this.dom,this.nodeDOM,ym(this.outerDeco,this.node,n),ym(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Zx(t,e,n,r,s){s1(r,e,t);let i=new yi(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class If extends yi{constructor(e,n,r,s,i,o,a){super(e,n,r,s,i,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==Qr||this.dirty!=wr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=wr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=wr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new If(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Qr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class t1 extends Sc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==wr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Hz extends yi{constructor(e,n,r,s,i,o,a,l,c,u){super(e,n,r,s,i,o,a,c,u),this.spec=l}update(e,n,r,s){if(this.dirty==Qr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function n1(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Xx(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof wo){let l=r?r.previousSibling:t.lastChild;n1(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Xx(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const xl=function(t){t&&(this.nodeName=t)};xl.prototype=Object.create(null);const Ui=[new xl];function ym(t,e,n){if(t.length==0)return Ui;let r=n?Ui[0]:new xl,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new xl(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new xl(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function r1(t,e,n,r){if(n==Ui&&r==Ui)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=Ui[0]),s=l}Uz(s,a||Ui[0],o)}return s}function Uz(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function s1(t,e,n){return r1(t,t,Ui,ym(e,n,t.nodeType!=1))}function Ku(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Xx(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Vz{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Wz(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let s=0,i=this.stack.length>>1,o=Math.min(i,e.length);for(;s<o&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=wr,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=wo.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==Qr&&o.dom==o.contentDOM&&(o.dirty=Hi),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof yi){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Qr&&Ku(n,l.outerDeco));if(!f&&l.update(e,n,r,s))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Hi,d.updateChildren(s,o+1),d.dirty=wr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Ku(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=yi.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=yi.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new e1(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof wo;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof If)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ln||kn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new t1(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Wz(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof wo)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function qz(t,e){return t.type.side-e.type.side}function Kz(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let b=s[o++];b.widget&&(u?(d||(d=[u])).push(b):u=b)}if(u)if(d){d.sort(qz);for(let b=0;b<d.length;b++)n(d[b],c,!!l)}else n(u,c,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(c<t.childCount)p=c,f=t.child(c++);else break;for(let b=0;b<a.length;b++)a[b].to<=i&&a.splice(b--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let m=i+f.nodeSize;if(f.isText){let b=m;o<s.length&&s[o].from<b&&(b=s[o].from);for(let y=0;y<a.length;y++)a[y].to<b&&(b=a[y].to);b<m&&(l=f.cut(b-i),f=f.cut(0,b-i),m=b,p=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=f.isInline&&!f.isLeaf?a.filter(b=>!b.inline):a.slice();r(f,g,e.forChild(i,f),p),i=m}}function Gz(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Jz(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function xm(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function ob(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Of(n)){for(l=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&Ee.isSelectable(d)&&s.parent&&!(d.isInline&&wz(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;c=new Ee(o==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,o]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=ab(t,u,a,d)}return c}function i1(t){return t.editable?t.hasFocus():a1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ks(t,e=!1){let n=t.state.selection;if(o1(t,n),!!i1(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&kn){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&vo(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Zz(t);else{let{anchor:r,head:s}=n,i,o;Qx&&!(n instanceof Ae)&&(n.$from.parent.inlineContent||(i=ev(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ev(t,n.to))),t.docView.setSelection(r,s,t,e),Qx&&(i&&tv(i),o&&tv(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Yz(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Qx=Ln||kn&&KC<63;function ev(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Ln&&s&&s.contentEditable=="false")return Oh(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Oh(s);if(i)return Oh(i)}}function Oh(t){return t.contentEditable="true",Ln&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function tv(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Yz(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!i1(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Zz(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,dn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Kn&&bi<=11&&(n.disabled=!0,n.disabled=!1)}function o1(t,e){if(e instanceof Ee){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(nv(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else nv(t)}function nv(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ab(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||Ae.between(e,n,r)}function rv(t){return t.editable&&!t.hasFocus()?!1:a1(t)}function a1(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Xz(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return vo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function vm(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&De.findFrom(i,e)}function Vs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function sv(t,e,n){let r=t.state.selection;if(r instanceof Ae)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Vs(t,new Ae(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=vm(t.state,e);return s&&s instanceof Ee?Vs(t,s):!1}else if(!(pr&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?Ee.isSelectable(i)?Vs(t,new Ee(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):kc?Vs(t,new Ae(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ee&&r.node.isInline)return Vs(t,new Ae(e>0?r.$to:r.$from));{let s=vm(t.state,e);return s?Vs(t,s):!1}}}function Gu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function vl(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Do(t,e){return e<0?Qz(t):eF(t)}function Qz(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(vr&&n.nodeType==1&&r<Gu(n)&&vl(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(vl(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(l1(n))break;{let a=n.previousSibling;for(;a&&vl(a,-1);)s=n.parentNode,i=dn(a),a=a.previousSibling;if(a)n=a,r=Gu(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?wm(t,n,r):s&&wm(t,s,i)}function eF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=Gu(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(vl(a,1))i=n,o=++r;else break}else{if(l1(n))break;{let a=n.nextSibling;for(;a&&vl(a,1);)i=a.parentNode,o=dn(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=Gu(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&wm(t,i,o)}function l1(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function tF(t,e){for(;t&&e==t.childNodes.length&&!wc(t);)e=dn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function nF(t,e){for(;t&&!e&&!wc(t);)e=dn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function wm(t,e,n){if(e.nodeType!=3){let i,o;(o=tF(e,n))?(e=o,n=0):(i=nF(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Of(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&ks(t)},50)}function iv(t,e){let n=t.state.doc.resolve(e);if(!(kn||Ez)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function ov(t,e,n){let r=t.state.selection;if(r instanceof Ae&&!r.empty||n.indexOf("s")>-1||pr&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=vm(t.state,e);if(o&&o instanceof Ee)return Vs(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof rr?De.near(o,e):De.findFrom(o,e);return a?Vs(t,a):!1}return!1}function av(t,e){if(!(t.state.selection instanceof Ae))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function lv(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function rF(t){if(!Ln||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;lv(t,r,"true"),setTimeout(()=>lv(t,r,"false"),20)}return!1}function sF(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function iF(t,e){let n=e.keyCode,r=sF(e);if(n==8||pr&&n==72&&r=="c")return av(t,-1)||Do(t,-1);if(n==46&&!e.shiftKey||pr&&n==68&&r=="c")return av(t,1)||Do(t,1);if(n==13||n==27)return!0;if(n==37||pr&&n==66&&r=="c"){let s=n==37?iv(t,t.state.selection.from)=="ltr"?-1:1:-1;return sv(t,s,r)||Do(t,s)}else if(n==39||pr&&n==70&&r=="c"){let s=n==39?iv(t,t.state.selection.from)=="ltr"?1:-1:1;return sv(t,s,r)||Do(t,s)}else{if(n==38||pr&&n==80&&r=="c")return ov(t,-1,r)||Do(t,-1);if(n==40||pr&&n==78&&r=="c")return rF(t)||ov(t,1,r)||Do(t,1);if(r==(pr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function lb(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||Ro.fromSchema(t.state.schema),a=p1(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=h1[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
311
+
312
+ `);return{dom:l,text:f,slice:e}}function c1(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return a=new ae(K.from(t.state.schema.text(e.replace(/\r\n?/g,`
313
+ `))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(d)a=d;else{let f=s.marks(),{schema:p}=t.state,m=Ro.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=o.appendChild(document.createElement("p"));g&&b.appendChild(m.serializeNode(p.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=cF(n),kc&&uF(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||gi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!oF.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=dF(cv(a,+u[1],+u[2]),u[4]);else if(a=ae.maxOpen(aF(a.content,s),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=cv(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const oF=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function aF(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&d1(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=f1(o[o.length-1],i.length));let u=u1(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return K.from(o)}return t}function u1(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,K.from(t));return t}function d1(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=d1(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(K.from(u1(n,t,s+1))))}}function f1(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,f1(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(K.empty,!0);return t.copy(n.append(r))}function km(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=km(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(K.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function cv(t,e,n){return e<t.openStart&&(t=new ae(km(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ae(km(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const h1={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let uv=null;function p1(){return uv||(uv=document.implementation.createHTMLDocument("title"))}let Ih=null;function lF(t){let e=window.trustedTypes;return e?(Ih||(Ih=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ih.createHTML(t)):t}function cF(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=p1().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&h1[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=lF(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function uF(t){let e=t.querySelectorAll(kn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function dF(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=K.from(l.create(r[a+1],s)),i++,o++}return new ae(s,i,o)}const Pn={},jn={},fF={touchstart:!0,touchmove:!0};class hF{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function pF(t){for(let e in Pn){let n=Pn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{gF(t,r)&&!cb(t,r)&&(t.editable||!(r.type in jn))&&n(t,r)},fF[e]?{passive:!0}:void 0)}Ln&&t.dom.addEventListener("input",()=>null),Sm(t)}function di(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function mF(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Sm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>cb(t,r))})}function cb(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function gF(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function bF(t,e){!cb(t,e)&&Pn[e.type]&&(t.editable||!(e.type in jn))&&Pn[e.type](t,e)}jn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!g1(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(vs&&kn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Na&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Fi(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||iF(t,n)?n.preventDefault():di(t,"key")};jn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};jn.keypress=(t,e)=>{let n=e;if(g1(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||pr&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ae)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function Df(t){return{left:t.clientX,top:t.clientY}}function yF(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ub(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function ra(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function xF(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ee.isSelectable(r)?(ra(t,new Ee(n)),!0):!1}function vF(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Ee&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(Ee.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(ra(t,Ee.create(t.state.doc,s)),!0):!1}function wF(t,e,n,r,s){return ub(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?vF(t,n):xF(t,n))}function kF(t,e,n,r){return ub(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function SF(t,e,n,r){return ub(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||EF(t,n,r)}function EF(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ra(t,Ae.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)ra(t,Ae.create(r,a+1,a+1+o.content.size));else if(Ee.isSelectable(o))ra(t,Ee.create(r,a));else continue;return!0}}function db(t){return Ju(t)}const m1=pr?"metaKey":"ctrlKey";Pn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=db(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&yF(n,t.input.lastClick)&&!n[m1]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Df(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new CF(t,o,n,!!r)):(i=="doubleClick"?kF:SF)(t,o.pos,o.inside,n)?n.preventDefault():di(t,"pointer"))};class CF{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[m1],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,o=u.depth?u.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Ee&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&vr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),di(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ks(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Df(e))),this.updateAllowDefault(e),this.allowDefault||!n?di(this.view,"pointer"):wF(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ln&&this.mightDrag&&!this.mightDrag.node.isAtom||kn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ra(this.view,De.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):di(this.view,"pointer")}move(e){this.updateAllowDefault(e),di(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Pn.touchstart=t=>{t.input.lastTouch=Date.now(),db(t),di(t,"pointer")};Pn.touchmove=t=>{t.input.lastTouch=Date.now(),di(t,"pointer")};Pn.contextmenu=t=>db(t);function g1(t,e){return t.composing?!0:Ln&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const NF=vs?5e3:-1;jn.compositionstart=jn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Ju(t,!0),t.markCursor=null;else if(Ju(t,!e.selection.empty),vr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}b1(t,NF)};jn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,b1(t,20))};function b1(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ju(t),e))}function y1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=TF());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function _F(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=xz(e.focusNode,e.focusOffset),r=vz(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function TF(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ju(t,e=!1){if(!(vs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),y1(t),e||t.docView&&t.docView.dirty){let n=ob(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function AF(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const $l=Kn&&bi<15||Na&&Cz<604;Pn.copy=jn.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=$l?null:n.clipboardData,o=r.content(),{dom:a,text:l}=lb(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):AF(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function MF(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function RF(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Hl(t,r.value,null,s,e):Hl(t,r.textContent,r.innerHTML,s,e)},50)}function Hl(t,e,n,r,s){let i=c1(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||ae.empty)))return!0;if(!i)return!1;let o=MF(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function x1(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}jn.paste=(t,e)=>{let n=e;if(t.composing&&!vs)return;let r=$l?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Hl(t,x1(r),r.getData("text/html"),s,n)?n.preventDefault():RF(t,n)};class v1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const OF=pr?"altKey":"ctrlKey";function w1(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[OF]}Pn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Df(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Ee?s.to-1:s.to))){if(r&&r.mightDrag)o=Ee.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=Ee.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=lb(t,a);(!n.dataTransfer.files.length||!kn||KC>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData($l?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",$l||n.dataTransfer.setData("text/plain",c),t.dragging=new v1(u,w1(t,n),o)};Pn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};jn.dragover=jn.dragenter=(t,e)=>e.preventDefault();jn.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let s=t.posAtCoords(Df(n));if(!s)return;let i=t.state.doc.resolve(s.pos),o=r&&r.slice;o?t.someProp("transformPasted",m=>{o=m(o,t,!1)}):o=c1(t,x1(n.dataTransfer),$l?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&w1(t,n));if(t.someProp("handleDrop",m=>m(t,n,o||ae.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?NC(t.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=t.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&Ee.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new Ee(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((g,b,y,w)=>m=w),c.setSelection(ab(t,p,c.doc.resolve(m)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Pn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ks(t)},20))};Pn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Pn.beforeinput=(t,e)=>{if(kn&&vs&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Fi(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in jn)Pn[t]=jn[t];function Ul(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Yu{constructor(e,n){this.toDOM=e,this.spec=n||io,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Qt(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Yu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ul(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xi{constructor(e,n){this.attrs=e,this.spec=n||io}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Qt(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof xi&&Ul(this.attrs,e.attrs)&&Ul(this.spec,e.spec)}static is(e){return e.type instanceof xi}destroy(){}}class fb{constructor(e,n){this.attrs=e,this.spec=n||io}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Qt(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof fb&&Ul(this.attrs,e.attrs)&&Ul(this.spec,e.spec)}destroy(){}}class Qt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Qt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Qt(e,e,new Yu(n,r))}static inline(e,n,r,s){return new Qt(e,n,new xi(r,s))}static node(e,n,r,s){return new Qt(e,n,new fb(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof xi}get widget(){return this.type instanceof Yu}}const Fo=[],io={};class yt{constructor(e,n){this.local=e.length?e:Fo,this.children=n.length?n:Fo}static create(e,n){return n.length?Zu(n,e,0,io):yn}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==yn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||io)}mapInner(e,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(n,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?IF(this.children,o||[],e,n,r,s,i):o?new yt(o.sort(oo),Fo):yn}add(e,n){return n.length?this==yn?yt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=S1(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,Zu(u,a,c+1,io)),i+=3}});let o=k1(i?E1(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new yt(o.length?this.local.concat(o).sort(oo):this.local,s||this.children)}remove(e){return e.length==0||this==yn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=yn?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new yt(s,r):yn}forChild(e,n){if(this==yn)return this;if(n.isLeaf)return yt.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof xi){let c=Math.max(i,l.from)-i,u=Math.min(o,l.to)-i;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new yt(s.sort(oo),Fo);return r?new Gs([a,r]):a}return r||yn}eq(e){if(this==e)return!0;if(!(e instanceof yt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return hb(this.localsInner(e))}localsInner(e){if(this==yn)return Fo;if(e.inlineContent||!this.local.some(xi.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof xi||n.push(this.local[r]);return n}forEachSet(e){e(this)}}yt.empty=new yt([],[]);yt.removeOverlap=hb;const yn=yt.empty;class Gs{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,io));return Gs.from(r)}forChild(e,n){if(n.isLeaf)return yt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=yn&&(i instanceof Gs?r=r.concat(i.members):r.push(i))}return Gs.from(r)}eq(e){if(!(e instanceof Gs)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?hb(r?n:n.sort(oo)):Fo}static from(e){switch(e.length){case 0:return yn;case 1:return e[0];default:return new Gs(e.every(n=>n instanceof yt)?e:e.reduce((n,r)=>n.concat(r instanceof yt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function IF(t,e,n,r,s,i,o){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,p,m,g)=>{let b=g-m-(p-f);for(let y=0;y<a.length;y+=3){let w=a[y+1];if(w<0||f>w+u-d)continue;let v=a[y]+u-d;p>=v?a[y+1]=f<=v?-2:-1:f>=u&&b&&(a[y]+=b,a[y+1]+=b)}d+=b}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+i,-1),p=f-s,{index:m,offset:g}=r.content.findIndex(d),b=r.maybeChild(m);if(b&&g==d&&g+b.nodeSize==p){let y=a[c+2].mapInner(n,b,u+1,t[c]+i+1,o);y!=yn?(a[c]=d,a[c+1]=p,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=DF(a,t,e,n,s,i,o),u=Zu(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new yt(e.sort(oo),a)}function k1(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Qt(s.from+e,s.to+e,s.type))}return n}function DF(t,e,n,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function S1(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function E1(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Zu(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let c=S1(t,a,l+n);if(c){i=!0;let u=Zu(c,a,n+l+1,r);u!=yn&&s.push(l,l+a.nodeSize,u)}});let o=k1(i?E1(t):t,-n).sort(oo);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new yt(o,s):yn}function oo(t,e){return t.from-e.from||t.to-e.to}function hb(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),dv(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),dv(e,s,r.copy(i.from,r.to)));break}}}return e}function dv(t,e,n){for(;e<t.length&&oo(n,t[e])>0;)e++;t.splice(e,0,n)}function Dh(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=yn&&e.push(r)}),t.cursorWrapper&&e.push(yt.create(t.state.doc,[t.cursorWrapper.deco])),Gs.from(e)}const LF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},PF=Kn&&bi<=11;class jF{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class zF{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new jF,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Kn&&bi<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),PF&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,LF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(rv(this.view)){if(this.suppressingSelectionUpdates)return ks(this.view);if(Kn&&bi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&vo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Ca(i))n.add(i);for(let i=e.anchorNode;i;i=Ca(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&rv(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(vr&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||$F(e,d)!=p)&&f.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Of(r)&&(c=ob(e))&&c.eq(De.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ks(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),FF(e)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ks(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(Kn&&bi<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?dn(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?dn(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let fv=new WeakMap,hv=!1;function FF(t){if(!fv.has(t)&&(fv.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=vr,hv)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),hv=!0}}function pv(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return vo(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function BF(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return pv(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?pv(t,n):null}function $F(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function HF(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Of(l)||c.push({node:l.focusNode,offset:l.focusOffset})),kn&&t.input.lastKeyCode===8)for(let b=i;b>s;b--){let y=r.childNodes[b-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=b;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||gi.fromSchema(t.state.schema),p=d.resolve(o),m=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:UF,context:p});if(c&&c[0].pos!=null){let b=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=b),m={anchor:b+o,head:y+o}}return{doc:g,sel:m,from:o,to:a}}function UF(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ln&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ln&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const VF=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function WF(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,_=ob(t,C);if(_&&!t.state.selection.eq(_)){if(kn&&vs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",T=>T(t,Fi(13,"Enter"))))return;let O=t.state.tr.setSelection(_);C=="pointer"?O.setMeta("pointer",!0):C=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),t.dispatch(O)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=HF(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=GF(d.content,c.doc.content,c.from,f,p);if(m&&t.input.domChangeCount++,(Na&&t.input.lastIOSEnter>Date.now()-225||vs)&&s.some(C=>C.nodeType==1&&!VF.test(C.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",C=>C(t,Fi(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Ae&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let C=mv(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let _=t.state.tr.setSelection(C);i&&_.setMeta("composition",i),t.dispatch(_)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Ae&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Kn&&bi<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),b=c.doc.resolveNoCache(m.endB-c.from),y=u.resolve(m.start),w=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA;if((Na&&t.input.lastIOSEnter>Date.now()-225&&(!w||s.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!w&&g.pos<c.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(c.doc.textBetween(g.pos,b.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,Fi(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&KF(u,m.start,m.endA,g,b)&&t.someProp("handleKeyDown",C=>C(t,Fi(8,"Backspace")))){vs&&kn&&t.domObserver.suppressSelectionUpdates();return}kn&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),vs&&!w&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,b=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,Fi(13,"Enter"))})},20));let v=m.start,k=m.endA,N=C=>{let _=C||t.state.tr.replace(v,k,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let O=mv(t,_.doc,c.sel);O&&!(kn&&t.composing&&O.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==v||O.head==_.mapping.map(k)-1)||Kn&&O.empty&&O.head==v)&&_.setSelection(O)}return i&&_.setMeta("composition",i),_.scrollIntoView()},S;if(w)if(g.pos==b.pos){Kn&&bi<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ks(t),20));let C=N(t.state.tr.delete(v,k)),_=u.resolve(m.start).marksAcross(u.resolve(m.endA));_&&C.ensureMarks(_),t.dispatch(C)}else if(m.endA==m.endB&&(S=qF(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let C=N(t.state.tr);S.type=="add"?C.addMark(v,k,S.mark):C.removeMark(v,k,S.mark),t.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,b.parentOffset),_=()=>N(t.state.tr.insertText(C,v,k));t.someProp("handleTextInput",O=>O(t,v,k,C,_))||t.dispatch(_())}else t.dispatch(N());else t.dispatch(N())}function mv(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ab(t,e.resolve(n.anchor),e.resolve(n.head))}function qF(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(K.from(c).eq(t))return{mark:a,type:o}}function KF(t,e,n,r,s){if(n-e<=s.pos-r.pos||Lh(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(Lh(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Lh(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Lh(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function GF(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&t.size<e.size){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<e.size&&gv(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-o),o=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<t.size&&gv(t.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}function gv(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class C1{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new hF,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(wv),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=xv(this),yv(this),this.nodeViews=vv(this),this.docView=Zx(this.state.doc,bv(this),Dh(this),this.dom,this),this.domObserver=new zF(this,(r,s,i,o)=>WF(this,r,s,i,o)),this.domObserver.start(),pF(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Sm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wv),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(y1(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=vv(this);YF(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Sm(this),this.editable=xv(this),yv(this);let l=Dh(this),c=bv(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(s.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Tz(this);if(o){this.domObserver.stop();let p=d&&(Kn||kn)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&JF(s.selection,e.selection);if(d){let m=kn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_F(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Zx(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Xz(this))?ks(this,p):(o1(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Az(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ee){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Wx(this,n.getBoundingClientRect(),e)}else Wx(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new v1(e.slice,e.move,s<0?void 0:Ee.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(Kn){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Mz(this.dom),ks(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Lz(this,e)}coordsAtPos(e,n=1){return XC(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return Bz(this,n||this.state,e)}pasteHTML(e,n){return Hl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Hl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return lb(this,e)}destroy(){this.docView&&(mF(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Dh(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,bz())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return bF(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ln&&this.root.nodeType===11&&kz(this.dom.ownerDocument)==this.dom&&BF(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}C1.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function bv(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Qt.node(0,t.state.doc.content.size,e)]}function yv(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Qt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xv(t){return!t.someProp("editable",e=>e(t.state)===!1)}function JF(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function vv(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function YF(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function wv(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var wi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ZF=typeof navigator<"u"&&/Mac/.test(navigator.platform),XF=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var fn=0;fn<10;fn++)wi[48+fn]=wi[96+fn]=String(fn);for(var fn=1;fn<=24;fn++)wi[fn+111]="F"+fn;for(var fn=65;fn<=90;fn++)wi[fn]=String.fromCharCode(fn+32),Xu[fn]=String.fromCharCode(fn);for(var Ph in wi)Xu.hasOwnProperty(Ph)||(Xu[Ph]=wi[Ph]);function QF(t){var e=ZF&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||XF&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xu:wi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const eB=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),tB=typeof navigator<"u"&&/Win/.test(navigator.platform);function nB(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))eB?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function rB(t){let e=Object.create(null);for(let n in t)e[nB(n)]=t[n];return e}function jh(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function sB(t){return new Mt({props:{handleKeyDown:pb(t)}})}function pb(t){let e=rB(t);return function(n,r){let s=QF(r),i,o=e[jh(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[jh(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(tB&&r.ctrlKey&&r.altKey)&&(i=wi[r.keyCode])&&i!=s){let a=e[jh(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var iB=Object.defineProperty,mb=(t,e)=>{for(var n in e)iB(t,n,{get:e[n],enumerable:!0})};function Lf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Pf=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const u=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],a=!!t,l=t||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...m)=>{const g=this.buildProps(l,e),b=f(...m)(g);return o.push(b),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Lf({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},N1={};mb(N1,{blur:()=>oB,clearContent:()=>aB,clearNodes:()=>lB,command:()=>cB,createParagraphNear:()=>uB,cut:()=>dB,deleteCurrentNode:()=>fB,deleteNode:()=>hB,deleteRange:()=>pB,deleteSelection:()=>mB,enter:()=>gB,exitCode:()=>bB,extendMarkRange:()=>yB,first:()=>xB,focus:()=>vB,forEach:()=>wB,insertContent:()=>kB,insertContentAt:()=>CB,joinBackward:()=>TB,joinDown:()=>_B,joinForward:()=>AB,joinItemBackward:()=>MB,joinItemForward:()=>RB,joinTextblockBackward:()=>OB,joinTextblockForward:()=>IB,joinUp:()=>NB,keyboardShortcut:()=>LB,lift:()=>PB,liftEmptyBlock:()=>jB,liftListItem:()=>zB,newlineInCode:()=>FB,resetAttributes:()=>BB,scrollIntoView:()=>$B,selectAll:()=>HB,selectNodeBackward:()=>UB,selectNodeForward:()=>VB,selectParentNode:()=>WB,selectTextblockEnd:()=>qB,selectTextblockStart:()=>KB,setContent:()=>GB,setMark:()=>d$,setMeta:()=>f$,setNode:()=>h$,setNodeSelection:()=>p$,setTextSelection:()=>m$,sinkListItem:()=>g$,splitBlock:()=>b$,splitListItem:()=>y$,toggleList:()=>x$,toggleMark:()=>v$,toggleNode:()=>w$,toggleWrap:()=>k$,undoInputRule:()=>S$,unsetAllMarks:()=>E$,unsetMark:()=>C$,updateAttributes:()=>N$,wrapIn:()=>_$,wrapInList:()=>T$});var oB=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),aB=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),lB=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;const m=$a(p);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},cB=t=>e=>t(e),uB=()=>({state:t,dispatch:e})=>HC(t,e),dB=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Ae(r.doc.resolve(Math.max(o-1,0)))),!0},fB=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const a=s.before(i),l=s.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1};function Kt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var hB=t=>({tr:e,state:n,dispatch:r})=>{const s=Kt(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),c=i.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},pB=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},mB=()=>({state:t,dispatch:e})=>eb(t,e),gB=()=>({commands:t})=>t.keyboardShortcut("Enter"),bB=()=>({state:t,dispatch:e})=>nz(t,e);function gb(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Qu(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:gb(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function _1(t,e,n={}){return t.find(r=>r.type===e&&Qu(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function kv(t,e,n={}){return!!_1(t,e,n)}function bb(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(u=>u.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(u=>u.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!_1([...s.node.marks],e,n)))return;let o=s.index,a=t.start()+s.offset,l=o+1,c=a+s.node.nodeSize;for(;o>0&&kv([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&kv([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Os(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var yB=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const i=Os(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(s){const d=bb(l,i,e);if(d&&d.from<=c&&d.to>=u){const f=Ae.create(o,d.from,d.to);n.setSelection(f)}}return!0},xB=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function T1(t){return t instanceof Ae}function Vi(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function A1(t,e=null){if(!e)return null;const n=De.atStart(t),r=De.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?Ae.create(t,Vi(0,s,i),Vi(t.content.size,s,i)):Ae.create(t,Vi(e,s,i),Vi(e,s,i))}function M1(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function jf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var vB=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(jf()||M1())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!T1(n.state.selection))return o(),!0;const a=A1(s.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},wB=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),kB=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),R1=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&R1(r)}return t};function Vc(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return R1(n)}function Vl(t,e,n){if(t instanceof mi||t instanceof K)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return K.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Vl("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new mC({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?gi.fromSchema(l).parseSlice(Vc(t),n.parseOptions):gi.fromSchema(l).parse(Vc(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=gi.fromSchema(e);return n.slice?i.parseSlice(Vc(t),n.parseOptions).content:i.parse(Vc(t),n.parseOptions)}return Vl("",e,n)}function SB(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof on||s instanceof an))return;const i=t.mapping.maps[r];let o=0;i.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(De.near(t.doc.resolve(o),n))}var EB=t=>!("type"in t),CB=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=b=>{i.emit("contentError",{editor:i,error:b,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Vl(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(b){l(b)}try{a=Vl(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(b){return l(b),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((EB(a)?a:[a]).forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,p=p?b.isBlock:!1}),u===d&&p){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof K){let b="";e.forEach(y=>{y.text&&(b+=y.text)}),g=b}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=a;const b=r.doc.resolve(u),y=b.node(),w=b.parentOffset===0,v=y.isText||y.isTextblock,k=y.content.size>0;w&&v&&k&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&SB(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},NB=()=>({state:t,dispatch:e})=>Qj(t,e),_B=()=>({state:t,dispatch:e})=>ez(t,e),TB=()=>({state:t,dispatch:e})=>LC(t,e),AB=()=>({state:t,dispatch:e})=>FC(t,e),MB=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Af(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},RB=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Af(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},OB=()=>({state:t,dispatch:e})=>Zj(t,e),IB=()=>({state:t,dispatch:e})=>Xj(t,e);function O1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function DB(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))jf()||O1()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var LB=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=DB(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function ki(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Kt(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),m=Math.min(s,f+d.nodeSize);a.push({node:d,from:p,to:m})});const l=s-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Qu(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var PB=(t,e={})=>({state:n,dispatch:r})=>{const s=Kt(t,n.schema);return ki(n,s,e)?tz(n,r):!1},jB=()=>({state:t,dispatch:e})=>UC(t,e),zB=t=>({state:e,dispatch:n})=>{const r=Kt(t,e.schema);return hz(r)(e,n)},FB=()=>({state:t,dispatch:e})=>$C(t,e);function zf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Sv(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var BB=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=zf(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=Kt(t,r.schema)),a==="mark"&&(o=Os(t,r.schema)),s&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,Sv(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&n.addMark(u,u+c.nodeSize,o.create(Sv(d.attrs,e)))})})}),!0):!1},$B=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),HB=()=>({tr:t,dispatch:e})=>{if(e){const n=new rr(t.doc);t.setSelection(n)}return!0},UB=()=>({state:t,dispatch:e})=>jC(t,e),VB=()=>({state:t,dispatch:e})=>BC(t,e),WB=()=>({state:t,dispatch:e})=>iz(t,e),qB=()=>({state:t,dispatch:e})=>lz(t,e),KB=()=>({state:t,dispatch:e})=>az(t,e);function Em(t,e,n={},r={}){return Vl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var GB=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=Em(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function I1(t,e){const n=Os(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function D1(t,e){const n=new Xg(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function JB(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Cm(t,e){const n=[];return t.descendants((r,s)=>{e(r)&&n.push({node:r,pos:s})}),n}function YB(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function L1(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Ff(t){return e=>L1(e.$from,t)}function Ne(t,e,n){return t.config[e]===void 0&&t.parent?Ne(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ne(t.parent,e,n):null}):t.config[e]}function yb(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ne(e,"addExtensions",n);return r?[e,...yb(r())]:e}).flat(10)}function xb(t,e){const n=Ro.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function P1(t){return typeof t=="function"}function lt(t,e=void 0,...n){return P1(t)?e?t.bind(e)(...n):t(...n):t}function ZB(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Wl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function j1(t){const e=[],{nodeExtensions:n,markExtensions:r}=Wl(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:s},l=Ne(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...i,...p}})})})})}),s.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=Ne(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:o.name,name:u,attribute:f})})}),e}function _t(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],c=a.filter(u=>!l.includes(u));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[s]?r[s].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),r[s]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[s]=i}),r},{})}function ql(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>_t(n,r),{})}function XB(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Ev(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):XB(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function Cv(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&ZB(n)?!1:n!=null))}function Nv(t){var e,n,r;const s={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&((n=t==null?void 0:t.attribute)==null?void 0:n.default)!==void 0&&(s.default=t.attribute.default),((r=t==null?void 0:t.attribute)==null?void 0:r.validate)!==void 0&&(s.validate=t.attribute.validate),[t.name,s]}function QB(t,e){var n;const r=j1(t),{nodeExtensions:s,markExtensions:i}=Wl(t),o=(n=s.find(c=>Ne(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(s.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,w)=>{const v=Ne(w,"extendNodeSchema",d);return{...y,...v?v(c):{}}},{}),p=Cv({...f,content:lt(Ne(c,"content",d)),marks:lt(Ne(c,"marks",d)),group:lt(Ne(c,"group",d)),inline:lt(Ne(c,"inline",d)),atom:lt(Ne(c,"atom",d)),selectable:lt(Ne(c,"selectable",d)),draggable:lt(Ne(c,"draggable",d)),code:lt(Ne(c,"code",d)),whitespace:lt(Ne(c,"whitespace",d)),linebreakReplacement:lt(Ne(c,"linebreakReplacement",d)),defining:lt(Ne(c,"defining",d)),isolating:lt(Ne(c,"isolating",d)),attrs:Object.fromEntries(u.map(Nv))}),m=lt(Ne(c,"parseHTML",d));m&&(p.parseDOM=m.map(y=>Ev(y,u)));const g=Ne(c,"renderHTML",d);g&&(p.toDOM=y=>g({node:y,HTMLAttributes:ql(y,u)}));const b=Ne(c,"renderText",d);return b&&(p.toText=b),[c.name,p]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,y)=>{const w=Ne(y,"extendMarkSchema",d);return{...b,...w?w(c):{}}},{}),p=Cv({...f,inclusive:lt(Ne(c,"inclusive",d)),excludes:lt(Ne(c,"excludes",d)),group:lt(Ne(c,"group",d)),spanning:lt(Ne(c,"spanning",d)),code:lt(Ne(c,"code",d)),attrs:Object.fromEntries(u.map(Nv))}),m=lt(Ne(c,"parseHTML",d));m&&(p.parseDOM=m.map(b=>Ev(b,u)));const g=Ne(c,"renderHTML",d);return g&&(p.toDOM=b=>g({mark:b,HTMLAttributes:ql(b,u)})),[c.name,p]}));return new mC({topNode:o,nodes:a,marks:l})}function e$(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function vb(t){return t.sort((n,r)=>{const s=Ne(n,"priority")||100,i=Ne(r,"priority")||100;return s>i?-1:s<i?1:0})}function z1(t){const e=vb(yb(t)),n=e$(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function F1(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
314
+
315
+ `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=i);const p=o==null?void 0:o[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l==null?void 0:l.text)==null?void 0:f.slice(Math.max(r,c)-c,s-c))}),a}function t$(t,e){const n={from:0,to:t.content.size};return F1(t,n,e)}function B1(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function n$(t,e){const n=Kt(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function $1(t,e){const n=zf(typeof e=="string"?e:e.name,t.schema);return n==="node"?n$(t,e):n==="mark"?I1(t,e):{}}function r$(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function s$(t){const e=r$(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function H1(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(i).map(a,-1),u=e.slice(i).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),s$(r)}function wb(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=bb(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var i$=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);(a==null?void 0:a.type.name)===e?o=a:i-=1}return[o,i]};function zh(t,e){return e.nodes[t]||e.marks[t]||null}function ku(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var o$=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,c;const u=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Nm(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?Os(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Qu(d.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:f})=>{const p=d.pos,m=f.pos;t.doc.nodesBetween(p,m,(g,b)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(p,b),w=Math.min(m,b+g.nodeSize),v=w-y;o+=v,a.push(...g.marks.map(k=>({mark:k,from:y,to:w})))})}),o===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Qu(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function a$(t,e,n={}){if(!e)return ki(t,null,n)||Nm(t,null,n);const r=zf(e,t.schema);return r==="node"?ki(t,e,n):r==="mark"?Nm(t,e,n):!1}var l$=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=Ff(a=>a.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},c$=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function _v(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Tv(t,e){const{nodeExtensions:n}=Wl(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=lt(Ne(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function Bf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(Bf(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function U1(t){return t instanceof Ee}function u$(t,e,n){var r;const{selection:s}=e;let i=null;if(T1(s)&&(i=s.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const p=!f||f.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=p&&m}return!c}),c})}var d$=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=Os(t,r.schema);if(s)if(o){const c=I1(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const m=Math.max(p,u),g=Math.min(p+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(m,g,l.create({...y.attrs,...e}))}):n.addMark(m,g,l.create(e))})});return u$(r,n,l)},f$=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),h$=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Kt(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>Hx(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Hx(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},p$=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Vi(t,0,r.content.size),i=Ee.create(r,s);e.setSelection(i)}return!0},m$=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Ae.atStart(r).from,a=Ae.atEnd(r).to,l=Vi(s,o,a),c=Vi(i,o,a),u=Ae.create(r,l,c);e.setSelection(u)}return!0},g$=t=>({state:e,dispatch:n})=>{const r=Kt(t,e.schema);return gz(r)(e,n)};function Av(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var b$=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,c=s.extensionManager.attributes,u=ku(c,a.node().type.name,a.node().attrs);if(i instanceof Ee&&i.node.isBlock)return!a.parentOffset||!ws(o,a.pos)?!1:(r&&(t&&Av(n,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:JB(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,m=ws(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&ws(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(i instanceof Ae&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),b=e.doc.resolve(g);a.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&Av(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},y$=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const a=Kt(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let y=K.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let _=l.depth-w;_>=l.depth-3;_-=1)y=K.from(l.node(_).copy(y));const v=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...ku(f,l.node().type.name,l.node().attrs),...e},N=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(k))||void 0;y=y.append(K.from(a.createAndFill(null,N)||void 0));const S=l.before(l.depth-(w-1));n.replace(S,l.after(-v),new ae(y,4-w,0));let C=-1;n.doc.nodesBetween(S,n.doc.content.size,(_,O)=>{if(C>-1)return!1;_.isTextblock&&_.content.size===0&&(C=O+1)}),C>-1&&n.setSelection(Ae.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...ku(f,d.type.name,d.attrs),...e},g={...ku(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const b=p?[{type:a,attrs:m},{type:p,attrs:g}]:[{type:a,attrs:m}];if(!ws(n.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:w}=r,{splittableMarks:v}=i.extensionManager,k=w||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!k||!s)return!0;const N=k.filter(S=>v.includes(S.type.name));n.ensureMarks(N)}return!0},Fh=(t,e)=>{const n=Ff(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Mi(t.doc,n.pos)&&t.join(n.pos),!0},Bh=(t,e)=>{const n=Ff(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Mi(t.doc,r)&&t.join(r),!0},x$=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,p=Kt(t,o.schema),m=Kt(e,o.schema),{selection:g,storedMarks:b}=o,{$from:y,$to:w}=g,v=y.blockRange(w),k=b||g.$to.parentOffset&&g.$from.marks();if(!v)return!1;const N=Ff(S=>Tv(S.type.name,d))(g);if(v.depth>=1&&N&&v.depth-N.depth<=1){if(N.node.type===p)return c.liftListItem(m);if(Tv(N.node.type.name,d)&&p.validContent(N.node.content)&&a)return l().command(()=>(i.setNodeMarkup(N.pos,p),!0)).command(()=>Fh(i,p)).command(()=>Bh(i,p)).run()}return!n||!k||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Fh(i,p)).command(()=>Bh(i,p)).run():l().command(()=>{const S=u().wrapInList(p,r),C=k.filter(_=>f.includes(_.type.name));return i.ensureMarks(C),S?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Fh(i,p)).command(()=>Bh(i,p)).run()},v$=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Os(t,r.schema);return Nm(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},w$=(t,e,n={})=>({state:r,commands:s})=>{const i=Kt(t,r.schema),o=Kt(e,r.schema),a=ki(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},k$=(t,e={})=>({state:n,commands:r})=>{const s=Kt(t,n.schema);return ki(n,s,e)?r.lift(s):r.wrapIn(s,e)},S$=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},E$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},C$=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=Os(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!s)return!0;if(u&&o){let{from:f,to:p}=a;const m=(i=c.marks().find(b=>b.type===l))==null?void 0:i.attrs,g=bb(c,l,m);g&&(f=g.from,p=g.to),n.removeMark(f,p,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},N$=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=zf(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=Kt(t,r.schema)),a==="mark"&&(o=Os(t,r.schema)),s&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,f,p,m;n.selection.empty?r.doc.nodesBetween(c,u,(g,b)=>{i&&i===g.type&&(p=Math.max(b,c),m=Math.min(b+g.nodeSize,u),d=b,f=g)}):r.doc.nodesBetween(c,u,(g,b)=>{b<c&&i&&i===g.type&&(p=Math.max(b,c),m=Math.min(b+g.nodeSize,u),d=b,f=g),b>=c&&b<=u&&(i&&i===g.type&&n.setNodeMarkup(b,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(y=>{if(o===y.type){const w=Math.max(b,c),v=Math.min(b+g.nodeSize,u);n.addMark(w,v,o.create({...y.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&n.addMark(p,m,o.create({...g.attrs,...e}))}))}),!0):!1},_$=(t,e={})=>({state:n,dispatch:r})=>{const s=Kt(t,n.schema);return cz(s,e)(n,r)},T$=(t,e={})=>({state:n,dispatch:r})=>{const s=Kt(t,n.schema);return uz(s,e)(n,r)},A$=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},$f=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},M$=(t,e)=>{if(gb(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Wc(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=o$(c)+i;return o.forEach(f=>{if(u)return;const p=M$(d,f.find);if(!p)return;const m=l.state.tr,g=Lf({state:l.state,transaction:m}),b={from:r-(p[0].length-i.length),to:s},{commands:y,chain:w,can:v}=new Pf({editor:n,state:g});f.handler({state:g,range:b,match:p,commands:y,chain:w,can:v})===null||!m.steps.length||(f.undoable&&m.setMeta(a,{transform:m,from:r,to:s,text:i}),l.dispatch(m),u=!0)}),u}function R$(t){const{editor:e,rules:n}=t,r=new Mt({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=xb(K.from(u),o.schema);const{from:d}=l,f=d+u.length;Wc({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return Wc({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Wc({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Wc({editor:e,from:o.pos,to:o.pos,text:`
316
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function O$(t){return Object.prototype.toString.call(t).slice(8,-1)}function qc(t){return O$(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function V1(t,e){const n={...t};return qc(t)&&qc(e)&&Object.keys(e).forEach(r=>{qc(e[r])&&qc(t[r])?n[r]=V1(t[r],e[r]):n[r]=e[r]}),n}var kb=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...lt(Ne(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...lt(Ne(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>V1(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Oi=class W1 extends kb{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new W1(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function I$(t){return typeof t=="number"}var D$=class{constructor(t){this.find=t.find,this.handler=t.handler}},L$=(t,e,n)=>{if(gb(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function P$(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Pf({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,s,(p,m)=>{var g,b,y,w,v;if((b=(g=p.type)==null?void 0:g.spec)!=null&&b.code||!(p.isText||p.isTextblock||p.isInline))return;const k=(v=(w=(y=p.content)==null?void 0:y.size)!=null?w:p.nodeSize)!=null?v:0,N=Math.max(r,m),S=Math.min(s,m+k);if(N>=S)return;const C=p.isText?p.text||"":p.textBetween(N-m,S-m,void 0,"");L$(C,i.find,o).forEach(O=>{if(O.index===void 0)return;const T=N+O.index+1,I=T+O[0].length,D={from:n.tr.mapping.map(T),to:n.tr.mapping.map(I)},V=i.handler({state:n,range:D,match:O,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(V)})}),d.every(p=>p!==null)}var Kc=null,j$=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function z$(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:p,pasteEvt:m})=>{const g=u.tr,b=Lf({state:u,transaction:g});if(!(!P$({editor:e,state:b,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new Mt({view(d){const f=m=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(m.target)?d.dom.parentElement:null,r&&(Kc=e)},p=()=>{Kc&&(Kc=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const p=Kc;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,f)=>{var p;const m=(p=f.clipboardData)==null?void 0:p.getData("text/html");return o=f,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,p)=>{const m=d[0],g=m.getMeta("uiEvent")==="paste"&&!s,b=m.getMeta("uiEvent")==="drop"&&!i,y=m.getMeta("applyPasteRules"),w=!!y;if(!g&&!b&&!w)return;if(w){let{text:N}=y;typeof N=="string"?N=N:N=xb(K.from(N),p.schema);const{from:S}=y,C=S+N.length,_=j$(N);return l({rule:u,state:p,from:S,to:{b:C},pasteEvt:_})}const v=f.doc.content.findDiffStart(p.doc.content),k=f.doc.content.findDiffEnd(p.doc.content);if(!(!I$(v)||!k||v===k.b))return l({rule:u,state:p,from:v,to:k,pasteEvt:o})}}))}var Hf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=z1(t),this.schema=QB(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:zh(e.name,this.schema)},r=Ne(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return vb([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:zh(r.name,this.schema)},i=[],o=Ne(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&Ne(r,"exitable",s)&&(a.ArrowRight=()=>Oi.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:t})]));a={...a,...f}}const l=sB(a);i.push(l);const c=Ne(r,"addInputRules",s);if(_v(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const p=R$({editor:t,rules:f}),m=Array.isArray(p)?p:[p];i.push(...m)}}const u=Ne(r,"addPasteRules",s);if(_v(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const p=z$({editor:t,rules:f});i.push(...p)}}const d=Ne(r,"addProseMirrorPlugins",s);if(d){const f=d();i.push(...f)}return i})}get attributes(){return j1(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Wl(this.extensions);return Object.fromEntries(e.filter(n=>!!Ne(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Kt(n.name,this.schema)},i=Ne(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(l,c,u,d,f)=>{const p=ql(l,r);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:p})};return[n.name,a]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Wl(this.extensions);return Object.fromEntries(e.filter(n=>!!Ne(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Os(n.name,this.schema)},i=Ne(n,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const u=ql(a,r);return i()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{Q$(a,t,d)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:zh(e.name,this.schema)};e.type==="mark"&&((n=lt(Ne(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=Ne(e,"onBeforeCreate",r),i=Ne(e,"onCreate",r),o=Ne(e,"onUpdate",r),a=Ne(e,"onSelectionUpdate",r),l=Ne(e,"onTransaction",r),c=Ne(e,"onFocus",r),u=Ne(e,"onBlur",r),d=Ne(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Hf.resolve=z1;Hf.sort=vb;Hf.flatten=yb;var F$={};mb(F$,{ClipboardTextSerializer:()=>K1,Commands:()=>G1,Delete:()=>J1,Drop:()=>Y1,Editable:()=>Z1,FocusEvents:()=>Q1,Keymap:()=>eN,Paste:()=>tN,Tabindex:()=>nN,focusEventsPluginKey:()=>X1});var It=class q1 extends kb{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new q1(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},K1=It.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Mt({key:new Ht("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=B1(n);return F1(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),G1=It.create({name:"commands",addCommands(){return{...N1}}}),J1=It.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=D1(t.before,[t,...e]);H1(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const b=g+m.nodeSize-2,y=p.oldRange.from<=g&&b<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:b,newFrom:u.mapping.map(g),newTo:u.mapping.map(b),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((p,m)=>{var g,b;if(p instanceof Rr){const y=f.slice(m).map(p.from,-1),w=f.slice(m).map(p.to),v=f.invert().map(y,-1),k=f.invert().map(w),N=(g=u.doc.nodeAt(y-1))==null?void 0:g.marks.some(C=>C.eq(p.mark)),S=(b=u.doc.nodeAt(w))==null?void 0:b.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:k},newRange:{from:y,to:w},partial:!!(S||N),editor:this.editor,transaction:t,combinedTransform:u})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),Y1=It.create({name:"drop",addProseMirrorPlugins(){return[new Mt({key:new Ht("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Z1=It.create({name:"editable",addProseMirrorPlugins(){return[new Mt({key:new Ht("editable"),props:{editable:()=>this.editor.options.editable}})]}}),X1=new Ht("focusEvents"),Q1=It.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Mt({key:X1,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),eN=It.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,m=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=m.parent.type.spec.isolating,b=d.pos-d.parentOffset,y=g&&m.parent.childCount===1?b===d.pos:De.atStart(c).from===f;return!u||!p.type.isTextblock||p.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return jf()||O1()?i:s},addProseMirrorPlugins(){return[new Mt({key:new Ht("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),s=t.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=De.atStart(e.doc).from,c=De.atEnd(e.doc).to;if(i||!(o===l&&a===c)||!Bf(n.doc))return;const f=n.tr,p=Lf({state:n,transaction:f}),{commands:m}=new Pf({editor:this.editor,state:p});if(m.clearNodes(),!!f.steps.length)return f}})]}}),tN=It.create({name:"paste",addProseMirrorPlugins(){return[new Mt({key:new Ht("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),nN=It.create({name:"tabindex",addProseMirrorPlugins(){return[new Mt({key:new Ht("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),B$=class Bo{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Bo(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Bo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Bo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=this.pos+r+(i?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!s&&a.depth<=this.depth)return;const l=new Bo(a,this.editor,s,s?n:null);s&&(l.actualDepth=this.depth+1),e.push(new Bo(a,this.editor,s,s?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==n[l])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>n[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},$$=`.ProseMirror {
317
+ position: relative;
318
+ }
319
+
320
+ .ProseMirror {
321
+ word-wrap: break-word;
322
+ white-space: pre-wrap;
323
+ white-space: break-spaces;
324
+ -webkit-font-variant-ligatures: none;
325
+ font-variant-ligatures: none;
326
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
327
+ }
328
+
329
+ .ProseMirror [contenteditable="false"] {
330
+ white-space: normal;
331
+ }
332
+
333
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
334
+ white-space: pre-wrap;
335
+ }
336
+
337
+ .ProseMirror pre {
338
+ white-space: pre-wrap;
339
+ }
340
+
341
+ img.ProseMirror-separator {
342
+ display: inline !important;
343
+ border: none !important;
344
+ margin: 0 !important;
345
+ width: 0 !important;
346
+ height: 0 !important;
347
+ }
348
+
349
+ .ProseMirror-gapcursor {
350
+ display: none;
351
+ pointer-events: none;
352
+ position: absolute;
353
+ margin: 0;
354
+ }
355
+
356
+ .ProseMirror-gapcursor:after {
357
+ content: "";
358
+ display: block;
359
+ position: absolute;
360
+ top: -2px;
361
+ width: 20px;
362
+ border-top: 1px solid black;
363
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
364
+ }
365
+
366
+ @keyframes ProseMirror-cursor-blink {
367
+ to {
368
+ visibility: hidden;
369
+ }
370
+ }
371
+
372
+ .ProseMirror-hideselection *::selection {
373
+ background: transparent;
374
+ }
375
+
376
+ .ProseMirror-hideselection *::-moz-selection {
377
+ background: transparent;
378
+ }
379
+
380
+ .ProseMirror-hideselection * {
381
+ caret-color: transparent;
382
+ }
383
+
384
+ .ProseMirror-focused .ProseMirror-gapcursor {
385
+ display: block;
386
+ }`;function H$(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var U$=class extends A${constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=A1(e,this.options.autofocus);this.editorState=Jo.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=H$($$,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=P1(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[Z1,K1.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),G1,Q1,eN,nN,Y1,tN,J1].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Hf(r,this)}createCommandManager(){this.commandManager=new Pf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Em(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Em(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new C1(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return $1(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return a$(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return xb(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
387
+
388
+ `,textSerializers:n={}}=t||{};return t$(this.state.doc,{blockSeparator:e,textSerializers:{...B1(this.schema),...n}})}get isEmpty(){return Bf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new B$(e,this)}get $doc(){return this.$pos(0)}};function _a(t){return new $f({find:t.find,handler:({state:e,range:n,match:r})=>{const s=lt(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(wb(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+l,c);const f=n.from+l+o.length;i.addMark(n.from+l,f,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function rN(t){return new $f({find:t.find,handler:({state:e,range:n,match:r})=>{const s=lt(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let a=n.to;const l=t.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?o:o-1;i.insert(c,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:t.undoable})}function _m(t){return new $f({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=lt(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Ta(t){return new $f({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=lt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Zg(l,t.type,i);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,m=f||d.$to.parentOffset&&d.$from.marks();if(m){const g=m.filter(b=>p.includes(b.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Mi(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}var V$=t=>"touches"in t,W$=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.handleMouseMove=o=>{if(!this.isResizing||!this.activeHandle)return;const a=o.clientX-this.startX,l=o.clientY-this.startY;this.handleResize(a,l)},this.handleTouchMove=o=>{if(!this.isResizing||!this.activeHandle)return;const a=o.touches[0];if(!a)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleMouseUp=()=>{if(!this.isResizing)return;const o=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(o,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=o=>{o.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=o=>{o.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,i;this.node=t.node,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles()}get dom(){return this.container}get contentDOM(){return this.contentElement}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",t.style.justifyContent="flex-start",t.style.alignItems="flex-start",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{const e=this.createHandle(t);this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.wrapper.appendChild(e)})}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,V$(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,s,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const i=t.includes("right"),o=t.includes("left"),a=t.includes("bottom"),l=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),a?s=this.startHeight+n:l&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,i,o;if(!n){let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(s=this.maxSize)!=null&&s.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let a=t,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function q$(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ee){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}var K$={};mb(K$,{createAtomBlockMarkdownSpec:()=>G$,createBlockMarkdownSpec:()=>J$,createInlineMarkdownSpec:()=>X$,parseAttributes:()=>Sb,parseIndentedBlocks:()=>Tm,renderNestedMarkdownContent:()=>Cb,serializeAttributes:()=>Eb});function Sb(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=n[f];p&&(e[c]=p.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Eb(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function G$(t){const{nodeName:e,name:n,parseAttributes:r=Sb,serializeAttributes:s=Eb,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),p=(d=u.match(f))==null?void 0:d.index;return p!==void 0?p:-1},tokenize(u,d,f){const p=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(p);if(!m)return;const g=m[1]||"",b=r(g);if(!o.find(w=>!(w in b)))return{type:e,raw:m[0],attributes:b}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=s(d),p=f?` {${f}}`:"";return`:::${l}${p} :::`}}}function J$(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Sb,serializeAttributes:i=Eb,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{let p;if(r){const g=r(d);p=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?p=f.parseChildren(d.tokens||[]):p=f.parseInline(d.tokens||[]);const m={...o,...d.attributes};return f.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${c}`,"m"),m=(f=d.match(p))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(d,f,p){var m;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=d.match(g);if(!b)return;const[y,w=""]=b,v=s(w);let k=1;const N=y.length;let S="";const C=/^:::([\w-]*)(\s.*)?/gm,_=d.slice(N);for(C.lastIndex=0;;){const O=C.exec(_);if(O===null)break;const T=O.index,I=O[1];if(!((m=O[2])!=null&&m.endsWith(":::"))){if(I)k+=1;else if(k-=1,k===0){const D=_.slice(0,T);S=D.trim();const V=d.slice(0,N+T+O[0].length);let z=[];if(S)if(a==="block")for(z=p.blockTokens(D),z.forEach(j=>{j.text&&(!j.tokens||j.tokens.length===0)&&(j.tokens=p.inlineTokens(j.text))});z.length>0;){const j=z[z.length-1];if(j.type==="paragraph"&&(!j.text||j.text.trim()===""))z.pop();else break}else z=p.inlineTokens(S);return{type:e,raw:V,attributes:v,content:S,tokens:z}}}}}},renderMarkdown:(d,f)=>{const p=u(d.attrs||{}),m=i(p),g=m?` {${m}}`:"",b=f.renderChildren(d.content||[],`
389
+
390
+ `);return`:::${c}${g}
391
+
392
+ ${b}
393
+
394
+ :::`}}}function Y$(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function Z$(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function X$(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Y$,serializeAttributes:i=Z$,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=f=>{if(!l)return f;const p={};return l.forEach(m=>{m in f&&(p[m]=f[m])}),p},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const m={...o,...f.attributes};if(a)return p.createNode(e,m);const g=r?r(f):f.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(f){const p=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=f.match(p),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(f,p,m){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),b=f.match(g);if(!b)return;let y="",w="";if(a){const[,k]=b;w=k}else{const[,k,N]=b;w=k,y=N||""}const v=s(w.trim());return{type:e,raw:b[0],content:y.trim(),attributes:v}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const m=u(f.attrs||{}),g=i(m),b=g?` ${g}`:"";return a?`[${c}${b}]`:`[${c}${b}]${p}[/${c}]`}}}function Tm(t,e,n){var r,s,i,o;const a=t.split(`
395
+ `),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const f=a[u],p=f.match(e.itemPattern);if(!p){if(l.length>0)break;if(f.trim()===""){u+=1;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:b}=m;c=`${c}${f}
396
+ `;const y=[b];for(u+=1;u<a.length;){const N=a[u];if(N.trim()===""){const C=a.slice(u+1).findIndex(T=>T.trim()!=="");if(C===-1)break;if((((s=(r=a[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){y.push(N),c=`${c}${N}
397
+ `,u+=1;continue}else break}if((((o=(i=N.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)y.push(N),c=`${c}${N}
398
+ `,u+=1;else break}let w;const v=y.slice(1);if(v.length>0){const N=v.map(S=>S.slice(g+d)).join(`
399
+ `);N.trim()&&(e.customNestedParser?w=e.customNestedParser(N):w=n.blockTokens(N))}const k=e.createToken(m,w);l.push(k)}if(l.length!==0)return{items:l,raw:c.trim()}}function Cb(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,a=e.renderChildren([i]),l=[`${s}${a}`];return o&&o.length>0&&o.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
400
+ `).map(f=>f?e.indent(f):"").join(`
401
+ `);l.push(d)}}),l.join(`
402
+ `)}function Q$(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(p=>{if(p!==o)return!1;d=p}),!d)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==d.attrs[p]&&(f=!0)}),f){const p=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,p)}}),i.docChanged&&e.view.dispatch(i)}var en=class sN extends kb{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new sN(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},e3=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,s,i,o,a;const{view:l}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const w=this.dom.getBoundingClientRect(),v=u.getBoundingClientRect(),k=(s=t.offsetX)!=null?s:(r=t.nativeEvent)==null?void 0:r.offsetX,N=(o=t.offsetY)!=null?o:(i=t.nativeEvent)==null?void 0:i.offsetY;d=v.x-w.x+k,f=v.y-w.y+N}const p=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();p.style.width=`${Math.round(w.width)}px`,p.style.height=`${Math.round(w.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(p),document.body.appendChild(m),(a=t.dataTransfer)==null||a.setDragImage(p,d,f)}finally{m&&setTimeout(()=>{try{m==null||m.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=Ee.create(l.state.doc,g),y=l.state.tr.setSelection(b);l.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const s=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!s)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=Ee.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",p=t.type==="cut",m=t.type==="mousedown";if(!c&&u&&s&&t.target===this.dom&&t.preventDefault(),c&&s&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&a&&!l&&m){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||i||d||f||p||m&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(jf()||M1())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function ko(t){return new D$({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=lt(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(wb(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}var $h,Mv;function t3(){return Mv||(Mv=1,$h=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,s,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!t(e[s],n[s]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],n.get(s[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(e[s]!==n[s])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),$h}var n3=t3();const r3=lc(n3);var Hh={exports:{}},Uh={};/**
403
+ * @license React
404
+ * use-sync-external-store-shim/with-selector.production.js
405
+ *
406
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
407
+ *
408
+ * This source code is licensed under the MIT license found in the
409
+ * LICENSE file in the root directory of this source tree.
410
+ */var Rv;function s3(){if(Rv)return Uh;Rv=1;var t=hk(),e=XE();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Uh.useSyncExternalStoreWithSelector=function(c,u,d,f,p){var m=i(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function y(S){if(!w){if(w=!0,v=S,S=f(S),p!==void 0&&g.hasValue){var C=g.value;if(p(C,S))return k=C}return k=S}if(C=k,r(v,S))return C;var _=f(S);return p!==void 0&&p(C,_)?(v=S,C):(v=S,k=_)}var w=!1,v,k,N=d===void 0?null:d;return[function(){return y(u())},N===null?void 0:function(){return y(N())}]},[u,d,f,p]);var b=s(c,m[0],m[1]);return o(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Uh}var Ov;function i3(){return Ov||(Ov=1,Hh.exports=s3()),Hh.exports}var o3=i3(),a3=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},l3=({contentComponent:t})=>{const e=QE.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return h.jsx(h.Fragment,{children:Object.values(e)})};function c3(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:UA.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var u3=class extends ht.Component{constructor(t){var e;super(t),this.editorContentRef=ht.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=c3(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:a3(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&h.jsx(l3,{contentComponent:t.contentComponent})]})}},d3=x.forwardRef((t,e)=>{const n=ht.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ht.createElement(u3,{key:n,innerRef:e,...t})}),f3=ht.memo(d3),h3=typeof window<"u"?x.useLayoutEffect:x.useEffect,p3=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function m3(t){var e;const[n]=x.useState(()=>new p3(t.editor)),r=o3.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:r3);return h3(()=>n.watch(t.editor),[t.editor,n]),x.useDebugValue(r),r}var g3=!1,Am=typeof window>"u",b3=Am||!!(typeof window<"u"&&window.next),y3=class iN{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Am||b3?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new U$(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?iN.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function x3(t={},e=[]){const n=x.useRef(t);n.current=t;const[r]=x.useState(()=>new y3(n)),s=QE.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(s),x.useEffect(r.onRender(e)),m3({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var v3=x.createContext({editor:null});v3.Consumer;var oN=x.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),aN=()=>x.useContext(oN);function w3({as:t="div",...e}){const{nodeViewContentRef:n,nodeViewContentChildren:r}=aN();return h.jsx(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:r})}var lN=ht.forwardRef((t,e)=>{const{onDragStart:n}=aN(),r=t.as||"div";return h.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Iv(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Dv(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function k3(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function S3(t){if(Iv(t)||Dv(t))return!0;if(k3(t)){const e=t.type;if(e)return Iv(e)||Dv(e)}return!1}function E3(){try{if(x.version)return parseInt(x.version.split(".")[0],10)>=19}catch{}return!1}var C3=class{constructor(t,{editor:e,props:n={},as:r="div",className:s=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?li.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,s=E3(),i=S3(e),o={...n};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=a=>{this.ref=a}),this.reactElement=h.jsx(e,{...o}),(t=r==null?void 0:r.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e==null?void 0:e.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};ht.createContext({markViewContentRef:()=>{}});var N3=class extends e3{constructor(t,e,n){if(super(t,e,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:x.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},s=this.component,i=x.memo(l=>h.jsx(oN.Provider,{value:r,children:x.createElement(s,l)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new C3(i,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,e,n){const r=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,i=this.decorations,o=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:s,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=ql(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function cN(t,e){return n=>n.editor.contentComponent?new N3(t,n,e):{}}var ed=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},_3=/^\s*>\s$/,T3=en.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ed("blockquote",{..._t(this.options.HTMLAttributes,t),children:ed("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(s=>{const a=e.renderChildren([s]).split(`
411
+ `).map(l=>l.trim()===""?n:`${n} ${l}`);r.push(a.join(`
412
+ `))}),r.join(`
413
+ ${n}
414
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ta({find:_3,type:this.type})]}}),A3=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,M3=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,R3=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,O3=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,I3=Oi.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return ed("strong",{..._t(this.options.HTMLAttributes,t),children:ed("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[_a({find:A3,type:this.type}),_a({find:R3,type:this.type})]},addPasteRules(){return[ko({find:M3,type:this.type}),ko({find:O3,type:this.type})]}}),D3=/(^|[^`])`([^`]+)`(?!`)$/,L3=/(^|[^`])`([^`]+)`(?!`)/g,P3=Oi.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",_t(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[_a({find:D3,type:this.type})]},addPasteRules(){return[ko({find:L3,type:this.type})]}}),Vh=4,j3=/^```([a-z]+)?[\s\n]$/,z3=/^~~~([a-z]+)?[\s\n]$/,uN=en.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Vh,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",_t(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
415
+ `):r=`\`\`\`${s}
416
+
417
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Vh,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:u}=s,p=r.doc.textBetween(c,u,`
418
+ `,`
419
+ `).split(`
420
+ `).map(m=>a+m).join(`
421
+ `);return l.replaceWith(c,u,r.schema.text(p)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Vh,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var l;const{pos:c}=i,u=i.start(),d=i.end(),p=r.doc.textBetween(u,d,`
422
+ `,`
423
+ `).split(`
424
+ `);let m=0,g=0;const b=c-u;for(let S=0;S<p.length;S+=1){if(g+p[S].length>=b){m=S;break}g+=p[S].length+1}const w=((l=p[m].match(/^ */))==null?void 0:l[0])||"",v=Math.min(w.length,n);if(v===0)return!0;let k=u;for(let S=0;S<m;S+=1)k+=p[S].length+1;return a.delete(k,k+v),c-k<=v&&a.setSelection(Ae.create(a.doc,k)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=s,f=r.doc.textBetween(l,c,`
425
+ `,`
426
+ `).split(`
427
+ `).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",b=Math.min(g.length,n);return p.slice(b)}).join(`
428
+ `);return a.replaceWith(l,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
429
+
430
+ `);return!i||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(De.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[_m({find:j3,type:this.type,getAttributes:t=>({language:t[1]})}),_m({find:z3,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Mt({key:new Ht("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
431
+ `));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(Ae.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),F3=uN,B3=en.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
432
+
433
+ `):""}),$3=en.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",_t(this.options.HTMLAttributes,t)]},renderText(){return`
434
+ `},renderMarkdown:()=>`
435
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),H3=en.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,_t(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>_m({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),U3=en.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",_t(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!q$(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return U1(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(Ae.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(Ee.create(o.doc,l.pos)):o.setSelection(Ae.create(o.doc,l.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection(Ae.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[rN({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),V3=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,W3=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,q3=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,K3=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,G3=Oi.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",_t(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[_a({find:V3,type:this.type}),_a({find:q3,type:this.type})]},addPasteRules(){return[ko({find:W3,type:this.type}),ko({find:K3,type:this.type})]}});const J3="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Y3="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Mm="numeric",Rm="ascii",Om="alpha",wl="asciinumeric",cl="alphanumeric",Im="domain",dN="emoji",Z3="scheme",X3="slashscheme",Wh="whitespace";function Q3(t,e){return t in e||(e[t]=[]),e[t]}function Wi(t,e,n){e[Mm]&&(e[wl]=!0,e[cl]=!0),e[Rm]&&(e[wl]=!0,e[Om]=!0),e[wl]&&(e[cl]=!0),e[Om]&&(e[cl]=!0),e[cl]&&(e[Im]=!0),e[dN]&&(e[Im]=!0);for(const r in e){const s=Q3(r,n);s.indexOf(t)<0&&s.push(t)}}function e4(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Vn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Vn.groups={};Vn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Vn.groups;let s;return e&&e.j?s=e:(s=new Vn(e),n&&r&&Wi(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Vn.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new Vn,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Vn,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(e4(o.t,r),n);Wi(i,l,r)}else n&&Wi(i,n,r);o.t=i}return s.j[t]=o,o}};const We=(t,e,n,r,s)=>t.ta(e,n,r,s),Lt=(t,e,n,r,s)=>t.tr(e,n,r,s),Lv=(t,e,n,r,s)=>t.ts(e,n,r,s),Z=(t,e,n,r,s)=>t.tt(e,n,r,s),ds="WORD",Dm="UWORD",fN="ASCIINUMERICAL",hN="ALPHANUMERICAL",Kl="LOCALHOST",Lm="TLD",Pm="UTLD",Su="SCHEME",$o="SLASH_SCHEME",Nb="NUM",jm="WS",_b="NL",kl="OPENBRACE",Sl="CLOSEBRACE",td="OPENBRACKET",nd="CLOSEBRACKET",rd="OPENPAREN",sd="CLOSEPAREN",id="OPENANGLEBRACKET",od="CLOSEANGLEBRACKET",ad="FULLWIDTHLEFTPAREN",ld="FULLWIDTHRIGHTPAREN",cd="LEFTCORNERBRACKET",ud="RIGHTCORNERBRACKET",dd="LEFTWHITECORNERBRACKET",fd="RIGHTWHITECORNERBRACKET",hd="FULLWIDTHLESSTHAN",pd="FULLWIDTHGREATERTHAN",md="AMPERSAND",gd="APOSTROPHE",bd="ASTERISK",Ws="AT",yd="BACKSLASH",xd="BACKTICK",vd="CARET",Js="COLON",Tb="COMMA",wd="DOLLAR",Vr="DOT",kd="EQUALS",Ab="EXCLAMATION",cr="HYPHEN",El="PERCENT",Sd="PIPE",Ed="PLUS",Cd="POUND",Cl="QUERY",Mb="QUOTE",pN="FULLWIDTHMIDDLEDOT",Rb="SEMI",Wr="SLASH",Nl="TILDE",Nd="UNDERSCORE",mN="EMOJI",_d="SYM";var gN=Object.freeze({__proto__:null,ALPHANUMERICAL:hN,AMPERSAND:md,APOSTROPHE:gd,ASCIINUMERICAL:fN,ASTERISK:bd,AT:Ws,BACKSLASH:yd,BACKTICK:xd,CARET:vd,CLOSEANGLEBRACKET:od,CLOSEBRACE:Sl,CLOSEBRACKET:nd,CLOSEPAREN:sd,COLON:Js,COMMA:Tb,DOLLAR:wd,DOT:Vr,EMOJI:mN,EQUALS:kd,EXCLAMATION:Ab,FULLWIDTHGREATERTHAN:pd,FULLWIDTHLEFTPAREN:ad,FULLWIDTHLESSTHAN:hd,FULLWIDTHMIDDLEDOT:pN,FULLWIDTHRIGHTPAREN:ld,HYPHEN:cr,LEFTCORNERBRACKET:cd,LEFTWHITECORNERBRACKET:dd,LOCALHOST:Kl,NL:_b,NUM:Nb,OPENANGLEBRACKET:id,OPENBRACE:kl,OPENBRACKET:td,OPENPAREN:rd,PERCENT:El,PIPE:Sd,PLUS:Ed,POUND:Cd,QUERY:Cl,QUOTE:Mb,RIGHTCORNERBRACKET:ud,RIGHTWHITECORNERBRACKET:fd,SCHEME:Su,SEMI:Rb,SLASH:Wr,SLASH_SCHEME:$o,SYM:_d,TILDE:Nl,TLD:Lm,UNDERSCORE:Nd,UTLD:Pm,UWORD:Dm,WORD:ds,WS:jm});const ls=/[a-z]/,Xa=new RegExp("\\p{L}","u"),qh=new RegExp("\\p{Emoji}","u"),cs=/\d/,Kh=/\s/,Pv="\r",Gh=`
436
+ `,t4="️",n4="‍",Jh="";let Gc=null,Jc=null;function r4(t=[]){const e={};Vn.groups=e;const n=new Vn;Gc==null&&(Gc=jv(J3)),Jc==null&&(Jc=jv(Y3)),Z(n,"'",gd),Z(n,"{",kl),Z(n,"}",Sl),Z(n,"[",td),Z(n,"]",nd),Z(n,"(",rd),Z(n,")",sd),Z(n,"<",id),Z(n,">",od),Z(n,"(",ad),Z(n,")",ld),Z(n,"「",cd),Z(n,"」",ud),Z(n,"『",dd),Z(n,"』",fd),Z(n,"<",hd),Z(n,">",pd),Z(n,"&",md),Z(n,"*",bd),Z(n,"@",Ws),Z(n,"`",xd),Z(n,"^",vd),Z(n,":",Js),Z(n,",",Tb),Z(n,"$",wd),Z(n,".",Vr),Z(n,"=",kd),Z(n,"!",Ab),Z(n,"-",cr),Z(n,"%",El),Z(n,"|",Sd),Z(n,"+",Ed),Z(n,"#",Cd),Z(n,"?",Cl),Z(n,'"',Mb),Z(n,"/",Wr),Z(n,";",Rb),Z(n,"~",Nl),Z(n,"_",Nd),Z(n,"\\",yd),Z(n,"・",pN);const r=Lt(n,cs,Nb,{[Mm]:!0});Lt(r,cs,r);const s=Lt(r,ls,fN,{[wl]:!0}),i=Lt(r,Xa,hN,{[cl]:!0}),o=Lt(n,ls,ds,{[Rm]:!0});Lt(o,cs,s),Lt(o,ls,o),Lt(s,cs,s),Lt(s,ls,s);const a=Lt(n,Xa,Dm,{[Om]:!0});Lt(a,ls),Lt(a,cs,i),Lt(a,Xa,a),Lt(i,cs,i),Lt(i,ls),Lt(i,Xa,i);const l=Z(n,Gh,_b,{[Wh]:!0}),c=Z(n,Pv,jm,{[Wh]:!0}),u=Lt(n,Kh,jm,{[Wh]:!0});Z(n,Jh,u),Z(c,Gh,l),Z(c,Jh,u),Lt(c,Kh,u),Z(u,Pv),Z(u,Gh),Lt(u,Kh,u),Z(u,Jh,u);const d=Lt(n,qh,mN,{[dN]:!0});Z(d,"#"),Lt(d,qh,d),Z(d,t4,d);const f=Z(d,n4);Z(f,"#"),Lt(f,qh,d);const p=[[ls,o],[cs,s]],m=[[ls,null],[Xa,a],[cs,i]];for(let g=0;g<Gc.length;g++)Fs(n,Gc[g],Lm,ds,p);for(let g=0;g<Jc.length;g++)Fs(n,Jc[g],Pm,Dm,m);Wi(Lm,{tld:!0,ascii:!0},e),Wi(Pm,{utld:!0,alpha:!0},e),Fs(n,"file",Su,ds,p),Fs(n,"mailto",Su,ds,p),Fs(n,"http",$o,ds,p),Fs(n,"https",$o,ds,p),Fs(n,"ftp",$o,ds,p),Fs(n,"ftps",$o,ds,p),Wi(Su,{scheme:!0,ascii:!0},e),Wi($o,{slashscheme:!0,ascii:!0},e),t=t.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<t.length;g++){const b=t[g][0],w=t[g][1]?{[Z3]:!0}:{[X3]:!0};b.indexOf("-")>=0?w[Im]=!0:ls.test(b)?cs.test(b)?w[wl]=!0:w[Rm]=!0:w[Mm]=!0,Lv(n,b,b,w)}return Lv(n,"localhost",Kl,{ascii:!0}),n.jd=new Vn(_d),{start:n,tokens:Object.assign({groups:e},gN)}}function bN(t,e){const n=s4(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[o].length,f++),c+=n[o].length,i+=n[o].length,o++;i-=d,o-=f,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function s4(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Fs(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Vn(r),i.jr=s.slice(),t.j[l]=i),t=i}return i=new Vn(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function jv(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Gl={defaultProtocol:"http",events:null,format:zv,formatHref:zv,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ob(t,e=null){let n=Object.assign({},Gl);t&&(n=Object.assign(n,t instanceof Ob?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}Ob.prototype={o:Gl,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:Gl[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function zv(t){return t}function yN(t,e){this.t="token",this.v=t,this.tk=e}yN.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Gl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function Uf(t,e){class n extends yN{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Fv=Uf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Bv=Uf("text"),i4=Uf("nl"),Yc=Uf("url",{isLink:!0,toHref(t=Gl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Kl&&t[1].t===Js}}),lr=t=>new Vn(t);function o4({groups:t}){const e=t.domain.concat([md,bd,Ws,yd,xd,vd,wd,kd,cr,Nb,El,Sd,Ed,Cd,Wr,_d,Nl,Nd]),n=[gd,Js,Tb,Vr,Ab,El,Cl,Mb,Rb,id,od,kl,Sl,nd,td,rd,sd,ad,ld,cd,ud,dd,fd,hd,pd],r=[md,gd,bd,yd,xd,vd,wd,kd,cr,kl,Sl,El,Sd,Ed,Cd,Cl,Wr,_d,Nl,Nd],s=lr(),i=Z(s,Nl);We(i,r,i),We(i,t.domain,i);const o=lr(),a=lr(),l=lr();We(s,t.domain,o),We(s,t.scheme,a),We(s,t.slashscheme,l),We(o,r,i),We(o,t.domain,o);const c=Z(o,Ws);Z(i,Ws,c),Z(a,Ws,c),Z(l,Ws,c);const u=Z(i,Vr);We(u,r,i),We(u,t.domain,i);const d=lr();We(c,t.domain,d),We(d,t.domain,d);const f=Z(d,Vr);We(f,t.domain,d);const p=lr(Fv);We(f,t.tld,p),We(f,t.utld,p),Z(c,Kl,p);const m=Z(d,cr);Z(m,cr,m),We(m,t.domain,d),We(p,t.domain,d),Z(p,Vr,f),Z(p,cr,m);const g=Z(p,Js);We(g,t.numeric,Fv);const b=Z(o,cr),y=Z(o,Vr);Z(b,cr,b),We(b,t.domain,o),We(y,r,i),We(y,t.domain,o);const w=lr(Yc);We(y,t.tld,w),We(y,t.utld,w),We(w,t.domain,o),We(w,r,i),Z(w,Vr,y),Z(w,cr,b),Z(w,Ws,c);const v=Z(w,Js),k=lr(Yc);We(v,t.numeric,k);const N=lr(Yc),S=lr();We(N,e,N),We(N,n,S),We(S,e,N),We(S,n,S),Z(w,Wr,N),Z(k,Wr,N);const C=Z(a,Js),_=Z(l,Js),O=Z(_,Wr),T=Z(O,Wr);We(a,t.domain,o),Z(a,Vr,y),Z(a,cr,b),We(l,t.domain,o),Z(l,Vr,y),Z(l,cr,b),We(C,t.domain,N),Z(C,Wr,N),Z(C,Cl,N),We(T,t.domain,N),We(T,e,N),Z(T,Wr,N);const I=[[kl,Sl],[td,nd],[rd,sd],[id,od],[ad,ld],[cd,ud],[dd,fd],[hd,pd]];for(let D=0;D<I.length;D++){const[V,z]=I[D],j=Z(N,V);Z(S,V,j),Z(j,z,N);const q=lr(Yc);We(j,e,q);const re=lr();We(j,n),We(q,e,q),We(q,n,re),We(re,e,q),We(re,n,re),Z(q,z,N),Z(re,z,N)}return Z(s,Kl,w),Z(s,_b,i4),{start:s,tokens:gN}}function a4(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let a=t,l=null,c=null,u=0,d=null,f=-1;for(;s<r&&!(l=a.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=l||a.go(n[s].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,s++,u++;if(f<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(Yh(Bv,e,o)),o=[]),s-=f,u-=f;const p=d.t,m=n.slice(s-u,s);i.push(Yh(p,e,m))}}return o.length>0&&i.push(Yh(Bv,e,o)),i}function Yh(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const l4=typeof console<"u"&&console&&console.warn||(()=>{}),c4="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",At={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function u4(){return Vn.groups={},At.scanner=null,At.parser=null,At.tokenQueue=[],At.pluginQueue=[],At.customSchemes=[],At.initialized=!1,At}function $v(t,e=!1){if(At.initialized&&l4(`linkifyjs: already initialized - will not register custom scheme "${t}" ${c4}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
437
+ 1. Must only contain digits, lowercase ASCII letters or "-"
438
+ 2. Cannot start or end with "-"
439
+ 3. "-" cannot repeat`);At.customSchemes.push([t,e])}function d4(){At.scanner=r4(At.customSchemes);for(let t=0;t<At.tokenQueue.length;t++)At.tokenQueue[t][1]({scanner:At.scanner});At.parser=o4(At.scanner.tokens);for(let t=0;t<At.pluginQueue.length;t++)At.pluginQueue[t][1]({scanner:At.scanner,parser:At.parser});return At.initialized=!0,At}function Ib(t){return At.initialized||d4(),a4(At.parser.start,t,bN(At.scanner.start,t))}Ib.scan=bN;function xN(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Ob(n),s=Ib(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var Db="[\0-   ᠎ -\u2029  ]",f4=new RegExp(Db),h4=new RegExp(`${Db}$`),p4=new RegExp(Db,"g");function m4(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function g4(t){return new Mt({key:new Ht("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=D1(n.doc,[...e]);if(H1(a).forEach(({newRange:c})=>{const u=YB(r.doc,c,p=>p.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!h4.test(p))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const p=f.split(f4).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=d.pos+f.lastIndexOf(m);if(!m)return!1;const b=Ib(m).map(y=>y.toObject(t.defaultProtocol));if(!m4(b))return!1;b.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{wb(y.from,y.to,r.doc).some(w=>w.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function b4(t){return new Mt({key:new Ht("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;o=d.find(f=>f.nodeName==="A")}if(!o)return!1;const a=$1(e.state,t.type.name),l=(s=o==null?void 0:o.href)!=null?s:a.href,c=(i=o==null?void 0:o.target)!=null?i:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),o&&l?(window.open(l,c),!0):!1}}})}function y4(t){return new Mt({key:new Ht("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=xN(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||s!==void 0&&!s(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Pi(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(p4,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var x4=Oi.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){$v(t);return}$v(t.scheme,t.optionalSlashes)})},onDestroy(){u4()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Pi(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Pi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Pi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",_t(this.options.HTMLAttributes,t),0]:["a",_t(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Pi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Pi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ko({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=xN(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Pi(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(g4({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Pi(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(b4({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(y4({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),v4=Object.defineProperty,w4=(t,e)=>{for(var n in e)v4(t,n,{get:e[n],enumerable:!0})},k4="listItem",Hv="textStyle",Uv=/^\s*([-+*])\s$/,vN=en.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",_t(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
440
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(k4,this.editor.getAttributes(Hv)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ta({find:Uv,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ta({find:Uv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Hv),editor:this.editor})),[t]}}),wN=en.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",_t(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))n=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),a=e.parseChildren(o);n.push(...a)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Cb(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),S4={};w4(S4,{findListItemPos:()=>Ec,getNextListDepth:()=>Lb,handleBackspace:()=>zm,handleDelete:()=>Fm,hasListBefore:()=>kN,hasListItemAfter:()=>E4,hasListItemBefore:()=>SN,listItemHasSubList:()=>EN,nextListIsDeeper:()=>CN,nextListIsHigher:()=>NN});var Ec=(t,e)=>{const{$from:n}=e.selection,r=Kt(t,e.schema);let s=null,i=n.depth,o=n.pos,a=null;for(;i>0&&a===null;)s=n.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Lb=(t,e)=>{const n=Ec(t,e);if(!n)return!1;const[,r]=i$(e,t,n.$pos.pos+4);return r},kN=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},SN=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},EN=(t,e,n)=>{if(!n)return!1;const r=Kt(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},zm=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ki(t.state,e)&&kN(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,p)=>{f.type.name===e&&c.push({node:f,pos:p})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(l.start()+u.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!ki(t.state,e)||!c$(t.state))return!1;const r=Ec(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=EN(e,t.state,i);return SN(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},CN=(t,e)=>{const n=Lb(t,e),r=Ec(t,e);return!r||!n?!1:n>r.depth},NN=(t,e)=>{const n=Lb(t,e),r=Ec(t,e);return!r||!n?!1:n<r.depth},Fm=(t,e)=>{if(!ki(t.state,e)||!l$(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:CN(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():NN(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},E4=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},_N=It.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Fm(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Fm(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&zm(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&zm(t,n,r)&&(e=!0)}),e}}}}),Vv=/^(\s*)(\d+)\.\s+(.*)$/,C4=/^\s/;function N4(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(Vv);if(!i)break;const[,o,a,l]=i,c=o.length;let u=l,d=n+1;const f=[s];for(;d<t.length;){const p=t[d];if(p.match(Vv))break;if(p.trim()==="")f.push(p),u+=`
441
+ `,d+=1;else if(p.match(C4))f.push(p),u+=`
442
+ ${p.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:f.join(`
443
+ `)}),r=d,n=d}return[e,r]}function TN(t,e,n){var r;const s=[];let i=0;for(;i<t.length;){const o=t[i];if(o.indent===e){const a=o.content.split(`
444
+ `),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join(`
445
+ `).trim();if(u){const p=n.blockTokens(u);c.push(...p)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const p=Math.min(...f.map(g=>g.indent)),m=TN(f,p,n);c.push({type:"list",ordered:!0,start:f[0].number,items:m,raw:f.map(g=>g.raw).join(`
446
+ `)})}s.push({type:"list_item",raw:o.raw,tokens:c}),i=d}else i+=1}return s}function _4(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var T4="listItem",Wv="textStyle",qv=/^(\d+)\.\s$/,AN=en.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",_t(this.options.HTMLAttributes,n),0]:["ol",_t(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?_4(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
447
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(`
448
+ `),[i,o]=N4(s);if(i.length===0)return;const a=TN(i,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:a,raw:s.slice(0,o).join(`
449
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(T4,this.editor.getAttributes(Wv)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ta({find:qv,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ta({find:qv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Wv)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),A4=/^\s*(\[([( |x])?\])\s$/,M4=en.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",_t(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Cb(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var d,f;a.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=n();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m==null?void 0:m.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{s.setAttribute(u,d)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([u,d])=>{s.setAttribute(u,d)}),{dom:s,contentDOM:l,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[Ta({find:A4,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),R4=en.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",_t(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
450
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=Tm(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=Tm(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),O4=It.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(vN.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(wN.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(_N.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(AN.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(M4.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(R4.configure(this.options.taskList)),t}}),I4=en.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",_t(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),D4=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,L4=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,P4=Oi.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",_t(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[_a({find:D4,type:this.type})]},addPasteRules(){return[ko({find:L4,type:this.type})]}}),j4=en.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),z4=Oi.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",_t(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function F4(t={}){return new Mt({view(e){return new B4(e,t)}})}class B4{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=d?m.bottom:m.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*a;r={left:m.left,right:m.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,p=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=NC(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class jt extends De{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return jt.valid(r)?new jt(r):De.near(r)}content(){return ae.empty}eq(e){return e instanceof jt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new jt(e.resolve(n.pos))}getBookmark(){return new Pb(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!$4(e)||!H4(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&jt.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(jt.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Ee.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(jt.valid(a))return a}return null}}}jt.prototype.visible=!1;jt.findFrom=jt.findGapCursorFrom;De.jsonID("gapcursor",jt);class Pb{constructor(e){this.pos=e}map(e){return new Pb(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return jt.valid(n)?new jt(n):De.near(n)}}function MN(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function $4(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||MN(s.type))return!0;if(s.inlineContent)return!1}}return!0}function H4(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||MN(s.type))return!0;if(s.inlineContent)return!1}}return!0}function U4(){return new Mt({props:{decorations:K4,createSelectionBetween(t,e,n){return e.pos==n.pos&&jt.valid(n)?new jt(n):null},handleClick:W4,handleKeyDown:V4,handleDOMEvents:{beforeinput:q4}}})}const V4=pb({ArrowLeft:Zc("horiz",-1),ArrowRight:Zc("horiz",1),ArrowUp:Zc("vert",-1),ArrowDown:Zc("vert",1)});function Zc(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof Ae){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=jt.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new jt(c))),!0):!1}}function W4(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!jt.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Ee.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new jt(r))),!0)}function q4(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof jt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=K.empty;for(let o=r.length-1;o>=0;o--)s=K.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new ae(s,0,0));return i.setSelection(Ae.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function K4(t){if(!(t.selection instanceof jt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",yt.create(t.doc,[Qt.widget(t.selection.head,e,{key:"gapcursor"})])}var Td=200,ln=function(){};ln.prototype.append=function(e){return e.length?(e=ln.from(e),!this.length&&e||e.length<Td&&this.leafAppend(e)||this.length<Td&&e.leafPrepend(this)||this.appendInner(e)):this};ln.prototype.prepend=function(e){return e.length?ln.from(e).append(this):this};ln.prototype.appendInner=function(e){return new G4(this,e)};ln.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ln.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ln.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ln.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ln.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};ln.from=function(e){return e instanceof ln?e:e&&e.length?new RN(e):ln.empty};var RN=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Td)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Td)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(ln);ln.empty=new RN([]);var G4=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ln);const J4=500;class Mr{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new qr(d.map));let p=d.step.map(s.slice(i)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new qr(m,void 0,void 0,c.length+u.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new Mr(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new qr(e.mapping.maps[u],d,n),p;(p=l&&l.merge(f))&&(f=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(o++,n=void 0),s||(l=f)}let c=o-r.depth;return c>Z4&&(a=Y4(a,c),o-=c),new Mr(a.append(i),o)}remapping(e,n){let r=new Fl;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Mr(this.items.append(e.map(n=>new qr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},s);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=i.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),b=f.selection&&f.selection.map(i.slice(l+1,p));b&&a++,r.push(new qr(m,g,b))}else r.push(new qr(m))},s);let c=[];for(let f=n;f<o;f++)c.push(new qr(i.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new Mr(u,a);return d.emptyItemCount()>J4&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new qr(c.invert(),l,u),f,p=s.length-1;(f=s.length&&s[p].merge(d))?s[p]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new Mr(ln.from(s.reverse()),i)}}Mr.empty=new Mr(ln.empty,0);function Y4(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class qr{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new qr(n.getMap().invert(),n,this.selection)}}}class qs{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const Z4=20;function X4(t,e,n,r){let s=n.getMeta(ao),i;if(s)return s.historyState;n.getMeta(tH)&&(t=new qs(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ao))return o.getMeta(ao).redo?new qs(t.done.addTransform(n,void 0,r,Eu(e)),t.undone,Kv(n.mapping.maps),t.prevTime,t.prevComposition):new qs(t.done,t.undone.addTransform(n,void 0,r,Eu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Q4(n,t.prevRanges)),c=o?Zh(t.prevRanges,n.mapping):Kv(n.mapping.maps);return new qs(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Eu(e)),Mr.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new qs(t.done.rebased(n,i),t.undone.rebased(n,i),Zh(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new qs(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Zh(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Q4(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Kv(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function Zh(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function eH(t,e,n){let r=Eu(e),s=ao.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new qs(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(ao,{redo:n,historyState:l})}let Xh=!1,Gv=null;function Eu(t){let e=t.plugins;if(Gv!=e){Xh=!1,Gv=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Xh=!0;break}}return Xh}const ao=new Ht("history"),tH=new Ht("closeHistory");function nH(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Mt({key:ao,state:{init(){return new qs(Mr.empty,Mr.empty,null,0,-1)},apply(e,n,r){return X4(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?IN:r=="historyRedo"?DN:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function ON(t,e){return(n,r)=>{let s=ao.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=eH(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const IN=ON(!1,!0),DN=ON(!0,!0);It.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Mt({key:new Ht("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const o=i-s,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=i-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var rH=It.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[F4(this.options)]}});It.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Mt({key:new Ht("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return yt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Qt.node(c,c+l.nodeSize,{class:this.options.className}))}),yt.create(t,i)}}})]}});var sH=It.create({name:"gapCursor",addProseMirrorPlugins(){return[U4()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=lt(Ne(t,"allowGapCursor",n)))!=null?e:null}}}),iH=It.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Mt({key:new Ht("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&Bf(o);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Qt.node(a,a+o.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),yt.create(t,s)}}})]}});It.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Mt({key:new Ht("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||U1(n.selection)||t.view.dragging?null:yt.create(n.doc,[Qt.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Jv({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var oH=It.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Ht(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Mt({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:l,schema:c}=o,u=e.getState(o),d=a.content.size,f=c.nodes[n];if(u)return l.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!Jv({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Jv({node:o,types:r})}}})]}}),aH=It.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>IN(t,e),redo:()=>({state:t,dispatch:e})=>DN(t,e)}},addProseMirrorPlugins(){return[nH(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),lH=It.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(I3.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(T3.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(vN.configure(this.options.bulletList)),this.options.code!==!1&&s.push(P3.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(uN.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(B3.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(rH.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(sH.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push($3.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(H3.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(aH.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(U3.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(G3.configure(this.options.italic)),this.options.listItem!==!1&&s.push(wN.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(_N.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(x4.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(AN.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(I4.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(P4.configure(this.options.strike)),this.options.text!==!1&&s.push(j4.configure(this.options.text)),this.options.underline!==!1&&s.push(z4.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(oH.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),cH=lH,Qh,Yv;function uH(){if(Yv)return Qh;Yv=1;function t(M){return M instanceof Map?M.clear=M.delete=M.set=function(){throw new Error("map is read-only")}:M instanceof Set&&(M.add=M.clear=M.delete=function(){throw new Error("set is read-only")}),Object.freeze(M),Object.getOwnPropertyNames(M).forEach(W=>{const ee=M[W],we=typeof ee;(we==="object"||we==="function")&&!Object.isFrozen(ee)&&t(ee)}),M}class e{constructor(W){W.data===void 0&&(W.data={}),this.data=W.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(M){return M.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(M,...W){const ee=Object.create(null);for(const we in M)ee[we]=M[we];return W.forEach(function(we){for(const at in we)ee[at]=we[at]}),ee}const s="</span>",i=M=>!!M.scope,o=(M,{prefix:W})=>{if(M.startsWith("language:"))return M.replace("language:","language-");if(M.includes(".")){const ee=M.split(".");return[`${W}${ee.shift()}`,...ee.map((we,at)=>`${we}${"_".repeat(at+1)}`)].join(" ")}return`${W}${M}`};class a{constructor(W,ee){this.buffer="",this.classPrefix=ee.classPrefix,W.walk(this)}addText(W){this.buffer+=n(W)}openNode(W){if(!i(W))return;const ee=o(W.scope,{prefix:this.classPrefix});this.span(ee)}closeNode(W){i(W)&&(this.buffer+=s)}value(){return this.buffer}span(W){this.buffer+=`<span class="${W}">`}}const l=(M={})=>{const W={children:[]};return Object.assign(W,M),W};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(W){this.top.children.push(W)}openNode(W){const ee=l({scope:W});this.add(ee),this.stack.push(ee)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(W){return this.constructor._walk(W,this.rootNode)}static _walk(W,ee){return typeof ee=="string"?W.addText(ee):ee.children&&(W.openNode(ee),ee.children.forEach(we=>this._walk(W,we)),W.closeNode(ee)),W}static _collapse(W){typeof W!="string"&&W.children&&(W.children.every(ee=>typeof ee=="string")?W.children=[W.children.join("")]:W.children.forEach(ee=>{c._collapse(ee)}))}}class u extends c{constructor(W){super(),this.options=W}addText(W){W!==""&&this.add(W)}startScope(W){this.openNode(W)}endScope(){this.closeNode()}__addSublanguage(W,ee){const we=W.root;ee&&(we.scope=`language:${ee}`),this.add(we)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(M){return M?typeof M=="string"?M:M.source:null}function f(M){return g("(?=",M,")")}function p(M){return g("(?:",M,")*")}function m(M){return g("(?:",M,")?")}function g(...M){return M.map(ee=>d(ee)).join("")}function b(M){const W=M[M.length-1];return typeof W=="object"&&W.constructor===Object?(M.splice(M.length-1,1),W):{}}function y(...M){return"("+(b(M).capture?"":"?:")+M.map(we=>d(we)).join("|")+")"}function w(M){return new RegExp(M.toString()+"|").exec("").length-1}function v(M,W){const ee=M&&M.exec(W);return ee&&ee.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function N(M,{joinWith:W}){let ee=0;return M.map(we=>{ee+=1;const at=ee;let pt=d(we),oe="";for(;pt.length>0;){const fe=k.exec(pt);if(!fe){oe+=pt;break}oe+=pt.substring(0,fe.index),pt=pt.substring(fe.index+fe[0].length),fe[0][0]==="\\"&&fe[1]?oe+="\\"+String(Number(fe[1])+at):(oe+=fe[0],fe[0]==="("&&ee++)}return oe}).map(we=>`(${we})`).join(W)}const S=/\b\B/,C="[a-zA-Z]\\w*",_="[a-zA-Z_]\\w*",O="\\b\\d+(\\.\\d+)?",T="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",I="\\b(0b[01]+)",D="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",V=(M={})=>{const W=/^#![ ]*\//;return M.binary&&(M.begin=g(W,/.*\b/,M.binary,/\b.*/)),r({scope:"meta",begin:W,end:/$/,relevance:0,"on:begin":(ee,we)=>{ee.index!==0&&we.ignoreMatch()}},M)},z={begin:"\\\\[\\s\\S]",relevance:0},j={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[z]},q={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[z]},re={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/},G=function(M,W,ee={}){const we=r({scope:"comment",begin:M,end:W,contains:[]},ee);we.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 at=y("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 we.contains.push({begin:g(/[ ]+/,"(",at,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),we},ue=G("//","$"),A=G("/\\*","\\*/"),ce=G("#","$"),ye={scope:"number",begin:O,relevance:0},E={scope:"number",begin:T,relevance:0},P={scope:"number",begin:I,relevance:0},F={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[z,{begin:/\[/,end:/\]/,relevance:0,contains:[z]}]},$={scope:"title",begin:C,relevance:0},L={scope:"title",begin:_,relevance:0},H={begin:"\\.\\s*"+_,relevance:0};var ne=Object.freeze({__proto__:null,APOS_STRING_MODE:j,BACKSLASH_ESCAPE:z,BINARY_NUMBER_MODE:P,BINARY_NUMBER_RE:I,COMMENT:G,C_BLOCK_COMMENT_MODE:A,C_LINE_COMMENT_MODE:ue,C_NUMBER_MODE:E,C_NUMBER_RE:T,END_SAME_AS_BEGIN:function(M){return Object.assign(M,{"on:begin":(W,ee)=>{ee.data._beginMatch=W[1]},"on:end":(W,ee)=>{ee.data._beginMatch!==W[1]&&ee.ignoreMatch()}})},HASH_COMMENT_MODE:ce,IDENT_RE:C,MATCH_NOTHING_RE:S,METHOD_GUARD:H,NUMBER_MODE:ye,NUMBER_RE:O,PHRASAL_WORDS_MODE:re,QUOTE_STRING_MODE:q,REGEXP_MODE:F,RE_STARTERS_RE:D,SHEBANG:V,TITLE_MODE:$,UNDERSCORE_IDENT_RE:_,UNDERSCORE_TITLE_MODE:L});function xe(M,W){M.input[M.index-1]==="."&&W.ignoreMatch()}function ge(M,W){M.className!==void 0&&(M.scope=M.className,delete M.className)}function Pe(M,W){W&&M.beginKeywords&&(M.begin="\\b("+M.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",M.__beforeBegin=xe,M.keywords=M.keywords||M.beginKeywords,delete M.beginKeywords,M.relevance===void 0&&(M.relevance=0))}function Ze(M,W){Array.isArray(M.illegal)&&(M.illegal=y(...M.illegal))}function de(M,W){if(M.match){if(M.begin||M.end)throw new Error("begin & end are not supported with match");M.begin=M.match,delete M.match}}function se(M,W){M.relevance===void 0&&(M.relevance=1)}const it=(M,W)=>{if(!M.beforeMatch)return;if(M.starts)throw new Error("beforeMatch cannot be used with starts");const ee=Object.assign({},M);Object.keys(M).forEach(we=>{delete M[we]}),M.keywords=ee.keywords,M.begin=g(ee.beforeMatch,f(ee.begin)),M.starts={relevance:0,contains:[Object.assign(ee,{endsParent:!0})]},M.relevance=0,delete ee.beforeMatch},Ye=["of","and","for","in","not","or","if","then","parent","list","value"],ie="keyword";function Be(M,W,ee=ie){const we=Object.create(null);return typeof M=="string"?at(ee,M.split(" ")):Array.isArray(M)?at(ee,M):Object.keys(M).forEach(function(pt){Object.assign(we,Be(M[pt],W,pt))}),we;function at(pt,oe){W&&(oe=oe.map(fe=>fe.toLowerCase())),oe.forEach(function(fe){const ke=fe.split("|");we[ke[0]]=[pt,dt(ke[0],ke[1])]})}}function dt(M,W){return W?Number(W):ot(M)?0:1}function ot(M){return Ye.includes(M.toLowerCase())}const or={},Yn=M=>{console.error(M)},Ds=(M,...W)=>{console.log(`WARN: ${M}`,...W)},U=(M,W)=>{or[`${M}/${W}`]||(console.log(`Deprecated as of ${M}. ${W}`),or[`${M}/${W}`]=!0)},Y=new Error;function _e(M,W,{key:ee}){let we=0;const at=M[ee],pt={},oe={};for(let fe=1;fe<=W.length;fe++)oe[fe+we]=at[fe],pt[fe+we]=!0,we+=w(W[fe-1]);M[ee]=oe,M[ee]._emit=pt,M[ee]._multi=!0}function je(M){if(Array.isArray(M.begin)){if(M.skip||M.excludeBegin||M.returnBegin)throw Yn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Y;if(typeof M.beginScope!="object"||M.beginScope===null)throw Yn("beginScope must be object"),Y;_e(M,M.begin,{key:"beginScope"}),M.begin=N(M.begin,{joinWith:""})}}function tt(M){if(Array.isArray(M.end)){if(M.skip||M.excludeEnd||M.returnEnd)throw Yn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Y;if(typeof M.endScope!="object"||M.endScope===null)throw Yn("endScope must be object"),Y;_e(M,M.end,{key:"endScope"}),M.end=N(M.end,{joinWith:""})}}function Rt(M){M.scope&&typeof M.scope=="object"&&M.scope!==null&&(M.beginScope=M.scope,delete M.scope)}function Bn(M){Rt(M),typeof M.beginScope=="string"&&(M.beginScope={_wrap:M.beginScope}),typeof M.endScope=="string"&&(M.endScope={_wrap:M.endScope}),je(M),tt(M)}function pn(M){function W(oe,fe){return new RegExp(d(oe),"m"+(M.case_insensitive?"i":"")+(M.unicodeRegex?"u":"")+(fe?"g":""))}class ee{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(fe,ke){ke.position=this.position++,this.matchIndexes[this.matchAt]=ke,this.regexes.push([ke,fe]),this.matchAt+=w(fe)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const fe=this.regexes.map(ke=>ke[1]);this.matcherRe=W(N(fe,{joinWith:"|"}),!0),this.lastIndex=0}exec(fe){this.matcherRe.lastIndex=this.lastIndex;const ke=this.matcherRe.exec(fe);if(!ke)return null;const mt=ke.findIndex((Cr,ar)=>ar>0&&Cr!==void 0),wt=this.matchIndexes[mt];return ke.splice(0,mt),Object.assign(ke,wt)}}class we{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(fe){if(this.multiRegexes[fe])return this.multiRegexes[fe];const ke=new ee;return this.rules.slice(fe).forEach(([mt,wt])=>ke.addRule(mt,wt)),ke.compile(),this.multiRegexes[fe]=ke,ke}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(fe,ke){this.rules.push([fe,ke]),ke.type==="begin"&&this.count++}exec(fe){const ke=this.getMatcher(this.regexIndex);ke.lastIndex=this.lastIndex;let mt=ke.exec(fe);if(this.resumingScanAtSamePosition()&&!(mt&&mt.index===this.lastIndex)){const wt=this.getMatcher(0);wt.lastIndex=this.lastIndex+1,mt=wt.exec(fe)}return mt&&(this.regexIndex+=mt.position+1,this.regexIndex===this.count&&this.considerAll()),mt}}function at(oe){const fe=new we;return oe.contains.forEach(ke=>fe.addRule(ke.begin,{rule:ke,type:"begin"})),oe.terminatorEnd&&fe.addRule(oe.terminatorEnd,{type:"end"}),oe.illegal&&fe.addRule(oe.illegal,{type:"illegal"}),fe}function pt(oe,fe){const ke=oe;if(oe.isCompiled)return ke;[ge,de,Bn,it].forEach(wt=>wt(oe,fe)),M.compilerExtensions.forEach(wt=>wt(oe,fe)),oe.__beforeBegin=null,[Pe,Ze,se].forEach(wt=>wt(oe,fe)),oe.isCompiled=!0;let mt=null;return typeof oe.keywords=="object"&&oe.keywords.$pattern&&(oe.keywords=Object.assign({},oe.keywords),mt=oe.keywords.$pattern,delete oe.keywords.$pattern),mt=mt||/\w+/,oe.keywords&&(oe.keywords=Be(oe.keywords,M.case_insensitive)),ke.keywordPatternRe=W(mt,!0),fe&&(oe.begin||(oe.begin=/\B|\b/),ke.beginRe=W(ke.begin),!oe.end&&!oe.endsWithParent&&(oe.end=/\B|\b/),oe.end&&(ke.endRe=W(ke.end)),ke.terminatorEnd=d(ke.end)||"",oe.endsWithParent&&fe.terminatorEnd&&(ke.terminatorEnd+=(oe.end?"|":"")+fe.terminatorEnd)),oe.illegal&&(ke.illegalRe=W(oe.illegal)),oe.contains||(oe.contains=[]),oe.contains=[].concat(...oe.contains.map(function(wt){return Er(wt==="self"?oe:wt)})),oe.contains.forEach(function(wt){pt(wt,ke)}),oe.starts&&pt(oe.starts,fe),ke.matcher=at(ke),ke}if(M.compilerExtensions||(M.compilerExtensions=[]),M.contains&&M.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return M.classNameAliases=r(M.classNameAliases||{}),pt(M)}function zr(M){return M?M.endsWithParent||zr(M.starts):!1}function Er(M){return M.variants&&!M.cachedVariants&&(M.cachedVariants=M.variants.map(function(W){return r(M,{variants:null},W)})),M.cachedVariants?M.cachedVariants:zr(M)?r(M,{starts:M.starts?r(M.starts):null}):Object.isFrozen(M)?r(M):M}var nn="11.11.1";class Fr extends Error{constructor(W,ee){super(W),this.name="HTMLInjectionError",this.html=ee}}const mn=n,Ac=r,Mc=Symbol("nomatch"),ih=7,Gt=function(M){const W=Object.create(null),ee=Object.create(null),we=[];let at=!0;const pt="Could not find the language '{}', did you forget to load/include a language module?",oe={disableAutodetect:!0,name:"Plain text",contains:[]};let fe={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function ke(te){return fe.noHighlightRe.test(te)}function mt(te){let Te=te.className+" ";Te+=te.parentNode?te.parentNode.className:"";const Qe=fe.languageDetectRe.exec(Te);if(Qe){const kt=Ls(Qe[1]);return kt||(Ds(pt.replace("{}",Qe[1])),Ds("Falling back to no-highlight mode for this block.",te)),kt?Qe[1]:"no-highlight"}return Te.split(/\s+/).find(kt=>ke(kt)||Ls(kt))}function wt(te,Te,Qe){let kt="",Jt="";typeof Te=="object"?(kt=te,Qe=Te.ignoreIllegals,Jt=Te.language):(U("10.7.0","highlight(lang, code, ...args) has been deprecated."),U("10.7.0",`Please use highlight(code, options) instead.
451
+ https://github.com/highlightjs/highlight.js/issues/2277`),Jt=te,kt=Te),Qe===void 0&&(Qe=!0);const Nr={code:kt,language:Jt};Oc("before:highlight",Nr);const Ps=Nr.result?Nr.result:Cr(Nr.language,Nr.code,Qe);return Ps.code=Nr.code,Oc("after:highlight",Ps),Ps}function Cr(te,Te,Qe,kt){const Jt=Object.create(null);function Nr(he,Se){return he.keywords[Se]}function Ps(){if(!Fe.keywords){cn.addText(St);return}let he=0;Fe.keywordPatternRe.lastIndex=0;let Se=Fe.keywordPatternRe.exec(St),Ge="";for(;Se;){Ge+=St.substring(he,Se.index);const ft=$r.case_insensitive?Se[0].toLowerCase():Se[0],gn=Nr(Fe,ft);if(gn){const[rs,MA]=gn;if(cn.addText(Ge),Ge="",Jt[ft]=(Jt[ft]||0)+1,Jt[ft]<=ih&&(Lc+=MA),rs.startsWith("_"))Ge+=Se[0];else{const RA=$r.classNameAliases[rs]||rs;Br(Se[0],RA)}}else Ge+=Se[0];he=Fe.keywordPatternRe.lastIndex,Se=Fe.keywordPatternRe.exec(St)}Ge+=St.substring(he),cn.addText(Ge)}function Ic(){if(St==="")return;let he=null;if(typeof Fe.subLanguage=="string"){if(!W[Fe.subLanguage]){cn.addText(St);return}he=Cr(Fe.subLanguage,St,!0,wy[Fe.subLanguage]),wy[Fe.subLanguage]=he._top}else he=ns(St,Fe.subLanguage.length?Fe.subLanguage:null);Fe.relevance>0&&(Lc+=he.relevance),cn.__addSublanguage(he._emitter,he.language)}function Zn(){Fe.subLanguage!=null?Ic():Ps(),St=""}function Br(he,Se){he!==""&&(cn.startScope(Se),cn.addText(he),cn.endScope())}function by(he,Se){let Ge=1;const ft=Se.length-1;for(;Ge<=ft;){if(!he._emit[Ge]){Ge++;continue}const gn=$r.classNameAliases[he[Ge]]||he[Ge],rs=Se[Ge];gn?Br(rs,gn):(St=rs,Ps(),St=""),Ge++}}function yy(he,Se){return he.scope&&typeof he.scope=="string"&&cn.openNode($r.classNameAliases[he.scope]||he.scope),he.beginScope&&(he.beginScope._wrap?(Br(St,$r.classNameAliases[he.beginScope._wrap]||he.beginScope._wrap),St=""):he.beginScope._multi&&(by(he.beginScope,Se),St="")),Fe=Object.create(he,{parent:{value:Fe}}),Fe}function xy(he,Se,Ge){let ft=v(he.endRe,Ge);if(ft){if(he["on:end"]){const gn=new e(he);he["on:end"](Se,gn),gn.isMatchIgnored&&(ft=!1)}if(ft){for(;he.endsParent&&he.parent;)he=he.parent;return he}}if(he.endsWithParent)return xy(he.parent,Se,Ge)}function CA(he){return Fe.matcher.regexIndex===0?(St+=he[0],1):(ch=!0,0)}function NA(he){const Se=he[0],Ge=he.rule,ft=new e(Ge),gn=[Ge.__beforeBegin,Ge["on:begin"]];for(const rs of gn)if(rs&&(rs(he,ft),ft.isMatchIgnored))return CA(Se);return Ge.skip?St+=Se:(Ge.excludeBegin&&(St+=Se),Zn(),!Ge.returnBegin&&!Ge.excludeBegin&&(St=Se)),yy(Ge,he),Ge.returnBegin?0:Se.length}function _A(he){const Se=he[0],Ge=Te.substring(he.index),ft=xy(Fe,he,Ge);if(!ft)return Mc;const gn=Fe;Fe.endScope&&Fe.endScope._wrap?(Zn(),Br(Se,Fe.endScope._wrap)):Fe.endScope&&Fe.endScope._multi?(Zn(),by(Fe.endScope,he)):gn.skip?St+=Se:(gn.returnEnd||gn.excludeEnd||(St+=Se),Zn(),gn.excludeEnd&&(St=Se));do Fe.scope&&cn.closeNode(),!Fe.skip&&!Fe.subLanguage&&(Lc+=Fe.relevance),Fe=Fe.parent;while(Fe!==ft.parent);return ft.starts&&yy(ft.starts,he),gn.returnEnd?0:Se.length}function TA(){const he=[];for(let Se=Fe;Se!==$r;Se=Se.parent)Se.scope&&he.unshift(Se.scope);he.forEach(Se=>cn.openNode(Se))}let Dc={};function vy(he,Se){const Ge=Se&&Se[0];if(St+=he,Ge==null)return Zn(),0;if(Dc.type==="begin"&&Se.type==="end"&&Dc.index===Se.index&&Ge===""){if(St+=Te.slice(Se.index,Se.index+1),!at){const ft=new Error(`0 width match regex (${te})`);throw ft.languageName=te,ft.badRule=Dc.rule,ft}return 1}if(Dc=Se,Se.type==="begin")return NA(Se);if(Se.type==="illegal"&&!Qe){const ft=new Error('Illegal lexeme "'+Ge+'" for mode "'+(Fe.scope||"<unnamed>")+'"');throw ft.mode=Fe,ft}else if(Se.type==="end"){const ft=_A(Se);if(ft!==Mc)return ft}if(Se.type==="illegal"&&Ge==="")return St+=`
452
+ `,1;if(lh>1e5&&lh>Se.index*3)throw new Error("potential infinite loop, way more iterations than matches");return St+=Ge,Ge.length}const $r=Ls(te);if(!$r)throw Yn(pt.replace("{}",te)),new Error('Unknown language: "'+te+'"');const AA=pn($r);let ah="",Fe=kt||AA;const wy={},cn=new fe.__emitter(fe);TA();let St="",Lc=0,Li=0,lh=0,ch=!1;try{if($r.__emitTokens)$r.__emitTokens(Te,cn);else{for(Fe.matcher.considerAll();;){lh++,ch?ch=!1:Fe.matcher.considerAll(),Fe.matcher.lastIndex=Li;const he=Fe.matcher.exec(Te);if(!he)break;const Se=Te.substring(Li,he.index),Ge=vy(Se,he);Li=he.index+Ge}vy(Te.substring(Li))}return cn.finalize(),ah=cn.toHTML(),{language:te,value:ah,relevance:Lc,illegal:!1,_emitter:cn,_top:Fe}}catch(he){if(he.message&&he.message.includes("Illegal"))return{language:te,value:mn(Te),illegal:!0,relevance:0,_illegalBy:{message:he.message,index:Li,context:Te.slice(Li-100,Li+100),mode:he.mode,resultSoFar:ah},_emitter:cn};if(at)return{language:te,value:mn(Te),illegal:!1,relevance:0,errorRaised:he,_emitter:cn,_top:Fe};throw he}}function ar(te){const Te={value:mn(te),illegal:!1,relevance:0,_top:oe,_emitter:new fe.__emitter(fe)};return Te._emitter.addText(te),Te}function ns(te,Te){Te=Te||fe.languages||Object.keys(W);const Qe=ar(te),kt=Te.filter(Ls).filter(gy).map(Zn=>Cr(Zn,te,!1));kt.unshift(Qe);const Jt=kt.sort((Zn,Br)=>{if(Zn.relevance!==Br.relevance)return Br.relevance-Zn.relevance;if(Zn.language&&Br.language){if(Ls(Zn.language).supersetOf===Br.language)return 1;if(Ls(Br.language).supersetOf===Zn.language)return-1}return 0}),[Nr,Ps]=Jt,Ic=Nr;return Ic.secondBest=Ps,Ic}function Wa(te,Te,Qe){const kt=Te&&ee[Te]||Qe;te.classList.add("hljs"),te.classList.add(`language-${kt}`)}function oh(te){let Te=null;const Qe=mt(te);if(ke(Qe))return;if(Oc("before:highlightElement",{el:te,language:Qe}),te.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",te);return}if(te.children.length>0&&(fe.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(te)),fe.throwUnescapedHTML))throw new Fr("One of your code blocks includes unescaped HTML.",te.innerHTML);Te=te;const kt=Te.textContent,Jt=Qe?wt(kt,{language:Qe,ignoreIllegals:!0}):ns(kt);te.innerHTML=Jt.value,te.dataset.highlighted="yes",Wa(te,Qe,Jt.language),te.result={language:Jt.language,re:Jt.relevance,relevance:Jt.relevance},Jt.secondBest&&(te.secondBest={language:Jt.secondBest.language,relevance:Jt.secondBest.relevance}),Oc("after:highlightElement",{el:te,result:Jt,text:kt})}function mA(te){fe=Ac(fe,te)}const gA=()=>{Rc(),U("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function bA(){Rc(),U("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let py=!1;function Rc(){function te(){Rc()}if(document.readyState==="loading"){py||window.addEventListener("DOMContentLoaded",te,!1),py=!0;return}document.querySelectorAll(fe.cssSelector).forEach(oh)}function yA(te,Te){let Qe=null;try{Qe=Te(M)}catch(kt){if(Yn("Language definition for '{}' could not be registered.".replace("{}",te)),at)Yn(kt);else throw kt;Qe=oe}Qe.name||(Qe.name=te),W[te]=Qe,Qe.rawDefinition=Te.bind(null,M),Qe.aliases&&my(Qe.aliases,{languageName:te})}function xA(te){delete W[te];for(const Te of Object.keys(ee))ee[Te]===te&&delete ee[Te]}function vA(){return Object.keys(W)}function Ls(te){return te=(te||"").toLowerCase(),W[te]||W[ee[te]]}function my(te,{languageName:Te}){typeof te=="string"&&(te=[te]),te.forEach(Qe=>{ee[Qe.toLowerCase()]=Te})}function gy(te){const Te=Ls(te);return Te&&!Te.disableAutodetect}function wA(te){te["before:highlightBlock"]&&!te["before:highlightElement"]&&(te["before:highlightElement"]=Te=>{te["before:highlightBlock"](Object.assign({block:Te.el},Te))}),te["after:highlightBlock"]&&!te["after:highlightElement"]&&(te["after:highlightElement"]=Te=>{te["after:highlightBlock"](Object.assign({block:Te.el},Te))})}function kA(te){wA(te),we.push(te)}function SA(te){const Te=we.indexOf(te);Te!==-1&&we.splice(Te,1)}function Oc(te,Te){const Qe=te;we.forEach(function(kt){kt[Qe]&&kt[Qe](Te)})}function EA(te){return U("10.7.0","highlightBlock will be removed entirely in v12.0"),U("10.7.0","Please use highlightElement now."),oh(te)}Object.assign(M,{highlight:wt,highlightAuto:ns,highlightAll:Rc,highlightElement:oh,highlightBlock:EA,configure:mA,initHighlighting:gA,initHighlightingOnLoad:bA,registerLanguage:yA,unregisterLanguage:xA,listLanguages:vA,getLanguage:Ls,registerAliases:my,autoDetection:gy,inherit:Ac,addPlugin:kA,removePlugin:SA}),M.debugMode=function(){at=!1},M.safeMode=function(){at=!0},M.versionString=nn,M.regex={concat:g,lookahead:f,either:y,optional:m,anyNumberOfTimes:p};for(const te in ne)typeof ne[te]=="object"&&t(ne[te]);return Object.assign(M,ne),M},Ut=Gt({});return Ut.newInstance=()=>Gt({}),Qh=Ut,Ut.HighlightJS=Ut,Ut.default=Ut,Qh}var dH=uH();const LN=lc(dH);function PN(t,e=[]){return t.flatMap(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?PN(n.children,r):{text:n.value,classes:r}})}function Zv(t){return t.value||t.children||[]}function fH(t){return!!LN.getLanguage(t)}function Xv({doc:t,name:e,lowlight:n,defaultLanguage:r}){const s=[];return Cm(t,i=>i.type.name===e).forEach(i=>{var o;let a=i.pos+1;const l=i.node.attrs.language||r,c=n.listLanguages(),u=l&&(c.includes(l)||fH(l)||(o=n.registered)!=null&&o.call(n,l))?Zv(n.highlight(l,i.node.textContent)):Zv(n.highlightAuto(i.node.textContent));PN(u).forEach(d=>{const f=a+d.text.length;if(d.classes.length){const p=Qt.inline(a,f,{class:d.classes.join(" ")});s.push(p)}a=f})}),yt.create(t,s)}function hH(t){return typeof t=="function"}function pH({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(s=>hH(e[s])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Mt({key:new Ht("lowlight"),state:{init:(s,{doc:i})=>Xv({doc:i,name:t,lowlight:e,defaultLanguage:n}),apply:(s,i,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=Cm(o.doc,f=>f.type.name===t),d=Cm(a.doc,f=>f.type.name===t);return s.docChanged&&([l,c].includes(t)||d.length!==u.length||s.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?Xv({doc:s.doc,name:t,lowlight:e,defaultLanguage:n}):i.map(s.mapping,s.doc)}},props:{decorations(s){return r.getState(s)}}});return r}var mH=F3.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],pH({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),gH=mH,bH=iH;function yH(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(s)+"[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},d={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]},f={className:"title",begin:e.optional(s)+t.IDENT_RE,relevance:0},p=e.optional(s)+t.IDENT_RE+"\\s*\\(",m=["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"],y=["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:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[N,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],C={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},_={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,relevance:0},{begin:p,returnBegin:!0,contains:[f],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,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,_,N,S,[d,{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 xH(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=yH(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 vH(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 s={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=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,s]};s.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),m={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"],y={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["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"],N=["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:[...w,...v,"set","shopt",...k,...N]},contains:[p,t.SHEBANG(),m,d,i,o,y,a,l,c,u,n]}}function wH(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(s)+"[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},d={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]},f={className:"title",begin:e.optional(s)+t.IDENT_RE,relevance:0},p=e.optional(s)+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"},y=[d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:y.concat([{begin:/\(/,end:/\)/,keywords:b,contains:y.concat(["self"]),relevance:0}]),relevance:0},v={begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:p,returnBegin:!0,contains:[t.inherit(f,{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,d]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(w,v,y,[d,{begin:t.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:b}}}function kH(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(s)+"[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},d={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]},f={className:"title",begin:e.optional(s)+t.IDENT_RE,relevance:0},p=e.optional(s)+t.IDENT_RE+"\\s*\\(",m=["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"],y=["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:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[N,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],C={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},_={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,relevance:0},{begin:p,returnBegin:!0,contains:[f],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,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,_,N,S,[d,{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 SH(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"],s=["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"],i=["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:s.concat(i),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:'""'}]},d=t.inherit(u,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:o},p=t.inherit(f,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},b=t.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});f.contains=[g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],p.contains=[b,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[c,g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},v=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"}},y,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,w,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,w,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:"("+v+"\\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,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[y,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},k]}}const EH=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_-]*/}}),CH=["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"],NH=["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"],_H=[...CH,...NH],TH=["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(),AH=["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(),MH=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),RH=["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 OH(t){const e=t.regex,n=EH(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\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:":("+AH.join("|")+")"},{begin:":(:)?("+MH.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+RH.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:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:TH.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+_H.join("|")+")\\b"}]}}function IH(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 DH(t){const i={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:i,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:i,illegal:/["']/}]}]}}function LH(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 PH(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 s={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={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,i,s,o,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,d=e.either(l,c,u),f=e.concat(d,"(\\s*\\.\\s*",d,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[r,a,i,s,o,n]}}]}}var Ho="[0-9](_*[0-9])*",Xc=`\\.(${Ho})`,Qc="[0-9a-fA-F](_*[0-9a-fA-F])*",Qv={className:"number",variants:[{begin:`(\\b(${Ho})((${Xc})|\\.)?|(${Xc}))[eE][+-]?(${Ho})[fFdD]?\\b`},{begin:`\\b(${Ho})((${Xc})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Xc})[fFdD]?\\b`},{begin:`\\b(${Ho})[fFdD]\\b`},{begin:`\\b0[xX]((${Qc})\\.?|(${Qc})?\\.(${Qc}))[pP][+-]?(${Ho})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Qc})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function jN(t,e,n){return n===-1?"":t.replace(e,r=>jN(t,e,n-1))}function jH(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+jN("(?:<"+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,Qv,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Qv,c]}}const ew="[A-Za-z$_][0-9A-Za-z$_]*",zH=["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"],FH=["true","false","null","undefined","NaN","Infinity"],zN=["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"],FN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],BN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],BH=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],$H=[].concat(BN,zN,FN);function HH(t){const e=t.regex,n=(G,{after:ue})=>{const A="</"+G[0].slice(1);return G.input.indexOf(A,ue)!==-1},r=ew,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(G,ue)=>{const A=G[0].length+G.index,ce=G.input[A];if(ce==="<"||ce===","){ue.ignoreMatch();return}ce===">"&&(n(G,{after:A})||ue.ignoreMatch());let ye;const E=G.input.substring(A);if(ye=E.match(/^\s*=/)){ue.ignoreMatch();return}if((ye=E.match(/^\s+extends\s+/))&&ye.index===0){ue.ignoreMatch();return}}},a={$pattern:ew,keyword:zH,literal:FH,built_in:$H,"variable.language":BH},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={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},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},w={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]},v=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const k=[].concat(w,f.contains),N=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},C={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"}}]},_={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:{_:[...zN,...FN]}},O={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function D(G){return e.concat("(?!",G.join("|"),")")}const V={match:e.concat(/\b/,D([...BN,"super","import"].map(G=>`${G}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",re={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),O,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,w,{match:/\$\d+/},d,_,{scope:"attr",match:r+e.lookahead(":"),relevance:0},re,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:q,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:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},T,{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},z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},V,I,C,j,{match:/\$[(.]/}]}}function UH(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,s,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Uo="[0-9](_*[0-9])*",eu=`\\.(${Uo})`,tu="[0-9a-fA-F](_*[0-9a-fA-F])*",VH={className:"number",variants:[{begin:`(\\b(${Uo})((${eu})|\\.)?|(${eu}))[eE][+-]?(${Uo})[fFdD]?\\b`},{begin:`\\b(${Uo})((${eu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${eu})[fFdD]?\\b`},{begin:`\\b(${Uo})[fFdD]\\b`},{begin:`\\b0[xX]((${tu})\\.?|(${tu})?\\.(${tu}))[pP][+-]?(${Uo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${tu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function WH(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+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,i,s]}]};s.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=VH,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{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:[d,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:`
453
+ `},c]}}const qH=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_-]*/}}),KH=["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"],GH=["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"],JH=[...KH,...GH],YH=["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(),$N=["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(),HN=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),ZH=["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(),XH=$N.concat(HN).sort().reverse();function QH(t){const e=qH(t),n=XH,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",o=[],a=[],l=function(v){return{className:"string",begin:"~?"+v+".*?"+v}},c=function(v,k,N){return{className:v,begin:k,relevance:N}},u={$pattern:/[a-z-]+/,keyword:r,attribute:YH.join(" ")},d={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,d,c("variable","@@?"+s,10),c("variable","@\\{"+s+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const f=a.concat({begin:/\{/,end:/\}/,contains:o}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ZH.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:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:f}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+s+"\\}"),{begin:"\\b("+JH.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",i,0),c("selector-id","#"+i),c("selector-class","\\."+i,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+$N.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+HN.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return o.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,w,m,y,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function eU(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},s=[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:s.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:s}].concat(s)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function tU(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]},s={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={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,s,i,o]}}function nU(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={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}]},i={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}]},d=t.inherit(c,{contains:[]}),f=t.inherit(u,{contains:[]});c.contains.push(f),u.contains.push(d);let p=[n,l];return[c,u,d,f].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function rU(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 sU(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}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},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,i,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,y="\\1")=>{const w=y==="\\1"?y:e.concat(y,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,y,r)},p=(g,b,y)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,y,r),m=[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:f("s|tr|y",e.either(...d,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",e.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("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 i.contains=m,o.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function iU(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),s=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=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)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(z,j)=>{j.data._beginMatch=z[1]||z[2]},"on:end":(z,j)=>{j.data._beginMatch!==z[1]&&j.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
454
+ ]`,m={scope:"string",variants:[u,c,d,f]},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"],y=["__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"],w=["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:y,literal:(z=>{const j=[];return z.forEach(q=>{j.push(q),q.toLowerCase()===q?j.push(q.toUpperCase()):j.push(q.toLowerCase())}),j})(b),built_in:w},N=z=>z.map(j=>j.replace(/\|\d+$/,"")),S={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",N(w).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},C=e.concat(r,"\\b(?!\\()"),_={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,e.concat(/::/,e.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[s,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},O={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:k,contains:[O,o,_,t.C_BLOCK_COMMENT_MODE,m,g,S]},I={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",N(y).join("\\b|"),"|",N(w).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[T]};T.contains.push(I);const D=[O,_,t.C_BLOCK_COMMENT_MODE,m,g,S],V={begin:e.concat(/#\[\s*\\?/,e.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...D]},...D,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:k,contains:[V,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,I,_,{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",V,o,_,t.C_BLOCK_COMMENT_MODE,m,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]},m,g]}}function oU(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 aU(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function lU(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},d={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]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${f})[jJ](?=${m})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,d,t.HASH_COMMENT_MODE]}]};return c.contains=[d,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"},d,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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,y,d]}]}}function cU(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function uU(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]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=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:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function dU(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]+/),s=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},d={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]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|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=[d,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:o},{relevance:0,match:[s,/\.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:[d,{begin:n}],relevance:0},m,{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 T=[{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(T).concat(c).concat(S)}}function fU(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),s=e.concat(n,t.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,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:"->"},i]}}const hU=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_-]*/}}),pU=["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"],mU=["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"],gU=[...pU,...mU],bU=["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(),yU=["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(),xU=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),vU=["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 wU(t){const e=hU(t),n=xU,r=yU,s="@[a-z-]+",i="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("+gU.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("+vU.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:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:bU.join(" ")},contains:[{begin:s,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 kU(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function SU(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["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"],d=["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"],f=["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"],p=u,m=[...c,...l].filter(N=>!u.includes(N)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function w(N){return e.concat(/\b/,e.either(...N.map(S=>S.replace(/\s+/,"\\s+"))),/\b/)}const v={scope:"keyword",match:w(f),relevance:0};function k(N,{exceptions:S,when:C}={}){const _=C;return S=S||[],N.map(O=>O.match(/\|\d+$/)||S.includes(O)?O:_(O)?`${O}|0`:O)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(m,{when:N=>N.length<3}),literal:i,type:a,built_in:d},contains:[{scope:"type",match:w(o)},v,y,g,r,s,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function UN(t){return t?typeof t=="string"?t:t.source:null}function Qa(t){return gt("(?=",t,")")}function gt(...t){return t.map(n=>UN(n)).join("")}function EU(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Mn(...t){return"("+(EU(t).capture?"":"?:")+t.map(r=>UN(r)).join("|")+")"}const jb=t=>gt(/\b/,t,/\w$/.test(t)?/\b/:/\B/),CU=["Protocol","Type"].map(jb),tw=["init","self"].map(jb),NU=["Any","Self"],ep=["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"],nw=["false","nil","true"],_U=["assignment","associativity","higherThan","left","lowerThan","none","right"],TU=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],rw=["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"],VN=Mn(/[/=\-+!*%<>&|^~?]/,/[\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]/),WN=Mn(VN,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),tp=gt(VN,WN,"*"),qN=Mn(/[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]/),Ad=Mn(qN,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ur=gt(qN,Ad,"*"),nu=gt(/[A-Z]/,Ad,"*"),AU=["attached","autoclosure",gt(/convention\(/,Mn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",gt(/objc\(/,Ur,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],MU=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function RU(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],s={match:[/\./,Mn(...CU,...tw)],className:{2:"keyword"}},i={match:gt(/\./,Mn(...ep)),relevance:0},o=ep.filter(se=>typeof se=="string").concat(["_|0"]),a=ep.filter(se=>typeof se!="string").concat(NU).map(jb),l={variants:[{className:"keyword",match:Mn(...a,...tw)}]},c={$pattern:Mn(/\b\w+/,/#\w+/),keyword:o.concat(TU),literal:nw},u=[s,i,l],d={match:gt(/\./,Mn(...rw)),relevance:0},f={className:"built_in",match:gt(/\b/,Mn(...rw),/(?=\()/)},p=[d,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:tp},{match:`\\.(\\.|${WN})+`}]},b=[m,g],y="([0-9]_*)+",w="([0-9a-fA-F]_*)+",v={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},k=(se="")=>({className:"subst",variants:[{match:gt(/\\/,se,/[0\\tnr"']/)},{match:gt(/\\/,se,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(se="")=>({className:"subst",match:gt(/\\/,se,/[\t ]*(?:[\r\n]|\r\n)/)}),S=(se="")=>({className:"subst",label:"interpol",begin:gt(/\\/,se,/\(/),end:/\)/}),C=(se="")=>({begin:gt(se,/"""/),end:gt(/"""/,se),contains:[k(se),N(se),S(se)]}),_=(se="")=>({begin:gt(se,/"/),end:gt(/"/,se),contains:[k(se),S(se)]}),O={className:"string",variants:[C(),C("#"),C("##"),C("###"),_(),_("#"),_("##"),_("###")]},T=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],I={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:T},D=se=>{const it=gt(se,/\//),Ye=gt(/\//,se);return{begin:it,end:Ye,contains:[...T,{scope:"comment",begin:`#(?!.*${Ye})`,end:/$/}]}},V={scope:"regexp",variants:[D("###"),D("##"),D("#"),I]},z={match:gt(/`/,Ur,/`/)},j={className:"variable",match:/\$\d+/},q={className:"variable",match:`\\$${Ad}+`},re=[z,j,q],G={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:MU,contains:[...b,v,O]}]}},ue={scope:"keyword",match:gt(/@/,Mn(...AU),Qa(Mn(/\(/,/\s+/)))},A={scope:"meta",match:gt(/@/,Ur)},ce=[G,ue,A],ye={match:Qa(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:gt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ad,"+")},{className:"type",match:nu,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:gt(/\s+&\s+/,Qa(nu)),relevance:0}]},E={begin:/</,end:/>/,keywords:c,contains:[...r,...u,...ce,m,ye]};ye.contains.push(E);const P={match:gt(Ur,/\s*:/),keywords:"_|0",relevance:0},F={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",P,...r,V,...u,...p,...b,v,O,...re,...ce,ye]},$={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,ye]},L={begin:Mn(Qa(gt(Ur,/\s*:/)),Qa(gt(Ur,/\s+/,Ur,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ur}]},H={begin:/\(/,end:/\)/,keywords:c,contains:[L,...r,...u,...b,v,O,...ce,ye,F],endsParent:!0,illegal:/["']/},J={match:[/(func|macro)/,/\s+/,Mn(z.match,Ur,tp)],className:{1:"keyword",3:"title.function"},contains:[$,H,e],illegal:[/\[/,/%/]},ne={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[$,H,e],illegal:/\[|%/},xe={match:[/operator/,/\s+/,tp],className:{1:"keyword",3:"title"}},ge={begin:[/precedencegroup/,/\s+/,nu],className:{1:"keyword",3:"title"},contains:[ye],keywords:[..._U,...nw],end:/}/},Pe={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ze={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},de={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ur,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[$,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:nu},...u],relevance:0}]};for(const se of O.variants){const it=se.contains.find(ie=>ie.label==="interpol");it.keywords=c;const Ye=[...u,...p,...b,v,O,...re];it.contains=[...Ye,{begin:/\(/,end:/\)/,contains:["self",...Ye]}]}return{name:"Swift",keywords:c,contains:[...r,J,ne,Pe,Ze,de,xe,ge,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},V,...u,...p,...b,v,O,...re,...ce,ye,F]}}const Md="[A-Za-z$_][0-9A-Za-z$_]*",KN=["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"],GN=["true","false","null","undefined","NaN","Infinity"],JN=["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"],YN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ZN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],XN=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],QN=[].concat(ZN,JN,YN);function OU(t){const e=t.regex,n=(G,{after:ue})=>{const A="</"+G[0].slice(1);return G.input.indexOf(A,ue)!==-1},r=Md,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(G,ue)=>{const A=G[0].length+G.index,ce=G.input[A];if(ce==="<"||ce===","){ue.ignoreMatch();return}ce===">"&&(n(G,{after:A})||ue.ignoreMatch());let ye;const E=G.input.substring(A);if(ye=E.match(/^\s*=/)){ue.ignoreMatch();return}if((ye=E.match(/^\s+extends\s+/))&&ye.index===0){ue.ignoreMatch();return}}},a={$pattern:Md,keyword:KN,literal:GN,built_in:QN,"variable.language":XN},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={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},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},w={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]},v=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const k=[].concat(w,f.contains),N=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},C={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"}}]},_={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:{_:[...JN,...YN]}},O={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function D(G){return e.concat("(?!",G.join("|"),")")}const V={match:e.concat(/\b/,D([...ZN,"super","import"].map(G=>`${G}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",re={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),O,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,w,{match:/\$\d+/},d,_,{scope:"attr",match:r+e.lookahead(":"),relevance:0},re,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:q,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:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},T,{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},z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},V,I,C,j,{match:/\$[(.]/}]}}function IU(t){const e=t.regex,n=OU(t),r=Md,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},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:Md,keyword:KN.concat(l),literal:GN,built_in:QN.concat(s),"variable.language":XN},u={className:"meta",begin:"@"+r},d=(g,b,y)=>{const w=g.contains.findIndex(v=>v.label===b);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,y)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const f=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,p]),n.contains=n.contains.concat([u,i,o,p]),d(n,"shebang",t.SHEBANG()),d(n,"use_strict",a);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function DU(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\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(i,s),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(i,s),/ +/,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+:/},d=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=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,d,f,{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:[f]}]}}function LU(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"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={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"}},i,o,s,t.QUOTE_STRING_MODE,l,c,a]}}function PU(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,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(i,{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:[s]},{begin:/'/,end:/'/,contains:[s]},{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:[i,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{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 jU(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]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={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,s]},a=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={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"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],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}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},m,g,i,o],y=[...b];return y.pop(),y.push(a),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const zU={arduino:xH,bash:vH,c:wH,cpp:kH,csharp:SH,css:OH,diff:IH,go:DH,graphql:LH,ini:PH,java:jH,javascript:HH,json:UH,kotlin:WH,less:QH,lua:eU,makefile:tU,markdown:nU,objectivec:rU,perl:sU,php:iU,"php-template":oU,plaintext:aU,python:lU,"python-repl":cU,r:uU,ruby:dU,rust:fU,scss:wU,shell:kU,sql:SU,swift:RU,typescript:IU,vbnet:DU,wasm:LU,xml:PU,yaml:jU};const sw={},FU="hljs-";function BU(t){const e=LN.newInstance();return t&&i(t),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:o,registered:a};function n(l,c,u){const d=u||sw,f=typeof d.prefix=="string"?d.prefix:FU;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:$U,classPrefix:f});const p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function r(l,c){const d=(c||sw).subset||s();let f=-1,p=0,m;for(;++f<d.length;){const g=d[f];if(!e.getLanguage(g))continue;const b=n(g,l,c);b.data&&b.data.relevance!==void 0&&b.data.relevance>p&&(p=b.data.relevance,m=b)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return e.listLanguages()}function i(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 d=l[u];e.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class $U{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],s=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.options.classPrefix+o}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}function iw(t){if(t)throw t}var np,ow;function HU(){if(ow)return np;ow=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},i=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var f;for(f in c);return typeof f>"u"||t.call(c,f)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return np=function l(){var c,u,d,f,p,m,g=arguments[0],b=1,y=arguments.length,w=!1;for(typeof g=="boolean"&&(w=g,g=arguments[1]||{},b=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});b<y;++b)if(c=arguments[b],c!=null)for(u in c)d=a(g,u),f=a(c,u),g!==f&&(w&&f&&(i(f)||(p=s(f)))?(p?(p=!1,m=d&&s(d)?d:[]):m=d&&i(d)?d:{},o(g,{name:u,newValue:l(w,m,f)})):typeof f<"u"&&o(g,{name:u,newValue:f}));return g},np}var UU=HU();const rp=lc(UU);function Bm(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function VU(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=t[++i];let d=-1;if(l){o(l);return}for(;++d<s.length;)(c[d]===null||c[d]===void 0)&&(c[d]=s[d]);s=c,u?WU(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function WU(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(s);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,e(o,...a))}function i(o){s(null,o)}}function _l(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?aw(t.position):"start"in t||"end"in t?aw(t):"line"in t||"column"in t?$m(t):""}function $m(t){return lw(t&&t.line)+":"+lw(t&&t.column)}function aw(t){return $m(t&&t.start)+"-"+$m(t&&t.end)}function lw(t){return t&&typeof t=="number"?t:1}class Nn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(o=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=_l(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const Kr={basename:qU,dirname:KU,extname:GU,join:JU,sep:"/"};function qU(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Cc(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function KU(t){if(Cc(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function GU(t){Cc(t);let e=t.length,n=-1,r=0,s=-1,i=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function JU(...t){let e=-1,n;for(;++e<t.length;)Cc(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":YU(n)}function YU(t){Cc(t);const e=t.codePointAt(0)===47;let n=ZU(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function ZU(t,e){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function Cc(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const XU={cwd:QU};function QU(){return"/"}function Hm(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function eV(t){if(typeof t=="string")t=new URL(t);else if(!Hm(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return tV(t)}function tV(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const sp=["history","path","basename","stem","extname","dirname"];class e_{constructor(e){let n;e?Hm(e)?n={path:e}:typeof e=="string"||nV(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":XU.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<sp.length;){const i=sp[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)sp.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Kr.basename(this.path):void 0}set basename(e){op(e,"basename"),ip(e,"basename"),this.path=Kr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Kr.dirname(this.path):void 0}set dirname(e){cw(this.basename,"dirname"),this.path=Kr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Kr.extname(this.path):void 0}set extname(e){if(ip(e,"extname"),cw(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Kr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Hm(e)&&(e=eV(e)),op(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Kr.basename(this.path,this.extname):void 0}set stem(e){op(e,"stem"),ip(e,"stem"),this.path=Kr.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new Nn(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function ip(t,e){if(t&&t.includes(Kr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Kr.sep+"`")}function op(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function cw(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function nV(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const rV=(function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),sV={}.hasOwnProperty;class zb extends rV{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=VU()}copy(){const e=new zb;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(rp(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(cp("data",this.frozen),this.namespace[e]=n,this):sV.call(this.namespace,e)&&this.namespace[e]||void 0:e?(cp("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=ru(e),r=this.parser||this.Parser;return ap("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),ap("process",this.parser||this.Parser),lp("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=ru(e),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const p=d,m=r.stringify(p,f);oV(m)?f.value=m:f.result=m,c(u,f)});function c(u,d){u||!d?o(u):i?i(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),ap("processSync",this.parser||this.Parser),lp("processSync",this.compiler||this.Compiler),this.process(e,s),dw("processSync","process",n),r;function s(i,o){n=!0,iw(i),r=o}}run(e,n,r){uw(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=ru(n);s.run(e,l,c);function c(u,d,f){const p=d||e;u?a(u):o?o(p):r(void 0,p,f)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),dw("runSync","run",r),s;function i(o,a){iw(o),s=a,r=!0}}stringify(e,n){this.freeze();const r=ru(n),s=this.compiler||this.Compiler;return lp("stringify",s),uw(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if(cp("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(s.settings=rp(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[p,...m]=u;const g=r[f][1];Bm(g)&&Bm(p)&&(p=rp(!0,g,p)),r[f]=[c,p,...m]}}}}const t_=new zb().freeze();function ap(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function lp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function cp(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function uw(t){if(!Bm(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function dw(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function ru(t){return iV(t)?t:new e_(t)}function iV(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function oV(t){return typeof t=="string"||aV(t)}function aV(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const lV={};function Fb(t,e){const n=lV,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return n_(t,r,s)}function n_(t,e,n){if(cV(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 fw(t.children,e,n)}return Array.isArray(t)?fw(t,e,n):""}function fw(t,e,n){const r=[];let s=-1;for(;++s<t.length;)r[s]=n_(t[s],e,n);return r.join("")}function cV(t){return!!(t&&typeof t=="object")}const hw=document.createElement("i");function Bb(t){const e="&"+t+";";hw.innerHTML=e;const n=hw.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function sr(t,e,n,r){const s=t.length;let i=0,o;if(e<0?e=-e>s?0:s+e:e=e>s?s: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);i<r.length;)o=r.slice(i,i+1e4),o.unshift(e,0),t.splice(...o),i+=1e4,e+=1e4}function mr(t,e){return t.length>0?(sr(t,t.length,0,e),t):e}const pw={}.hasOwnProperty;function r_(t){const e={};let n=-1;for(;++n<t.length;)uV(e,t[n]);return e}function uV(t,e){let n;for(n in e){const s=(pw.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let o;if(i)for(o in i){pw.call(s,o)||(s[o]=[]);const a=i[o];dV(s[o],Array.isArray(a)?a:a?[a]:[])}}}function dV(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);sr(t,0,0,r)}function s_(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 Ir(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const On=Ii(/[A-Za-z]/),Sn=Ii(/[\dA-Za-z]/),fV=Ii(/[#-'*+\--9=?A-Z^-~]/);function Rd(t){return t!==null&&(t<32||t===127)}const Um=Ii(/\d/),hV=Ii(/[\dA-Fa-f]/),pV=Ii(/[!-/:-@[-`{-~]/);function Re(t){return t!==null&&t<-2}function vt(t){return t!==null&&(t<0||t===32)}function Xe(t){return t===-2||t===-1||t===32}const Vf=Ii(new RegExp("\\p{P}|\\p{S}","u")),So=Ii(/\s/);function Ii(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ha(t){const e=[];let n=-1,r=0,s=0;for(;++n<t.length;){const i=t.charCodeAt(n);let o="";if(i===37&&Sn(t.charCodeAt(n+1))&&Sn(t.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=t.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function nt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Xe(l)?(t.enter(n),a(l)):e(l)}function a(l){return Xe(l)&&i++<s?(t.consume(l),a):(t.exit(n),e(l))}}const mV={tokenize:gV};function gV(t){const e=t.attempt(this.parser.constructs.contentInitial,r,s);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),nt(t,e,"linePrefix")}function s(a){return t.enter("paragraph"),i(a)}function i(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 Re(a)?(t.consume(a),t.exit("chunkText"),i):(t.consume(a),o)}}const bV={tokenize:yV},mw={tokenize:xV};function yV(t){const e=this,n=[];let r=0,s,i,o;return a;function a(v){if(r<n.length){const k=n[r];return e.containerState=k[1],t.attempt(k[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&w();const k=e.events.length;let N=k,S;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){S=e.events[N][1].end;break}y(r);let C=k;for(;C<e.events.length;)e.events[C][1].end={...S},C++;return sr(e.events,N+1,0,e.events.slice(k)),e.events.length=C,c(v)}return a(v)}function c(v){if(r===n.length){if(!s)return f(v);if(s.currentConstruct&&s.currentConstruct.concrete)return m(v);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(mw,u,d)(v)}function u(v){return s&&w(),y(r),f(v)}function d(v){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,m(v)}function f(v){return e.containerState={},t.attempt(mw,p,m)(v)}function p(v){return r++,n.push([e.currentConstruct,e.containerState]),f(v)}function m(v){if(v===null){s&&w(),y(0),t.consume(v);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),g(v)}function g(v){if(v===null){b(t.exit("chunkFlow"),!0),y(0),t.consume(v);return}return Re(v)?(t.consume(v),b(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(v),g)}function b(v,k){const N=e.sliceStream(v);if(k&&N.push(null),v.previous=i,i&&(i.next=v),i=v,s.defineSkip(v.start),s.write(N),e.parser.lazy[v.start.line]){let S=s.events.length;for(;S--;)if(s.events[S][1].start.offset<o&&(!s.events[S][1].end||s.events[S][1].end.offset>o))return;const C=e.events.length;let _=C,O,T;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){if(O){T=e.events[_][1].end;break}O=!0}for(y(r),S=C;S<e.events.length;)e.events[S][1].end={...T},S++;sr(e.events,_+1,0,e.events.slice(C)),e.events.length=S}}function y(v){let k=n.length;for(;k-- >v;){const N=n[k];e.containerState=N[1],N[0].exit.call(e,t)}n.length=v}function w(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function xV(t,e,n){return nt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Aa(t){if(t===null||vt(t)||So(t))return 1;if(Vf(t))return 2}function Wf(t,e,n){const r=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const Vm={name:"attention",resolveAll:vV,tokenize:wV};function vV(t,e){let n=-1,r,s,i,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 d={...t[r][1].end},f={...t[n][1].start};gw(d,-l),gw(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={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=mr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=mr(c,[["enter",s,e],["enter",o,e],["exit",o,e],["enter",i,e]]),c=mr(c,Wf(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=mr(c,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=mr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,sr(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 wV(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Aa(r);let i;return o;function o(l){return i=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===i)return t.consume(l),a;const c=t.exit("attentionSequence"),u=Aa(l),d=!u||u===2&&s||n.includes(l),f=!s||s===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(s||!f)),c._close=!!(i===42?f:f&&(u||!d)),e(l)}}function gw(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const kV={name:"autolink",tokenize:SV};function SV(t,e,n){let r=0;return s;function s(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(p){return On(p)?(t.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||Sn(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(t.consume(p),r=0,l):(p===43||p===45||p===46||Sn(p))&&r++<32?(t.consume(p),a):(r=0,c(p))}function l(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||Rd(p)?n(p):(t.consume(p),l)}function c(p){return p===64?(t.consume(p),u):fV(p)?(t.consume(p),c):n(p)}function u(p){return Sn(p)?d(p):n(p)}function d(p){return p===46?(t.consume(p),r=0,u):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):f(p)}function f(p){if((p===45||Sn(p))&&r++<63){const m=p===45?f:d;return t.consume(p),m}return n(p)}}const Nc={partial:!0,tokenize:EV};function EV(t,e,n){return r;function r(i){return Xe(i)?nt(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||Re(i)?e(i):n(i)}}const i_={continuation:{tokenize:NV},exit:_V,name:"blockQuote",tokenize:CV};function CV(t,e,n){const r=this;return s;function s(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"),i}return n(o)}function i(o){return Xe(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function NV(t,e,n){const r=this;return s;function s(o){return Xe(o)?nt(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return t.attempt(i_,e,n)(o)}}function _V(t){t.exit("blockQuote")}const o_={name:"characterEscape",tokenize:TV};function TV(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return pV(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const a_={name:"characterReference",tokenize:AV};function AV(t,e,n){const r=this;let s=0,i,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),i=31,o=Sn,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,o=hV,u):(t.enter("characterReferenceValue"),i=7,o=Um,u(d))}function u(d){if(d===59&&s){const f=t.exit("characterReferenceValue");return o===Sn&&!Bb(r.sliceSerialize(f))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&s++<i?(t.consume(d),u):n(d)}}const bw={partial:!0,tokenize:RV},yw={concrete:!0,name:"codeFenced",tokenize:MV};function MV(t,e,n){const r=this,s={partial:!0,tokenize:N};let i=0,o=0,a;return l;function l(S){return c(S)}function c(S){const C=r.events[r.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[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"),Xe(S)?nt(t,d,"whitespace")(S):d(S))}function d(S){return S===null||Re(S)?(t.exit("codeFencedFence"),r.interrupt?e(S):t.check(bw,g,k)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(S))}function f(S){return S===null||Re(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(S)):Xe(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),nt(t,p,"whitespace")(S)):S===96&&S===a?n(S):(t.consume(S),f)}function p(S){return S===null||Re(S)?d(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||Re(S)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(S)):S===96&&S===a?n(S):(t.consume(S),m)}function g(S){return t.attempt(s,k,b)(S)}function b(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),y}function y(S){return i>0&&Xe(S)?nt(t,w,"linePrefix",i+1)(S):w(S)}function w(S){return S===null||Re(S)?t.check(bw,g,k)(S):(t.enter("codeFlowValue"),v(S))}function v(S){return S===null||Re(S)?(t.exit("codeFlowValue"),w(S)):(t.consume(S),v)}function k(S){return t.exit("codeFenced"),e(S)}function N(S,C,_){let O=0;return T;function T(j){return S.enter("lineEnding"),S.consume(j),S.exit("lineEnding"),I}function I(j){return S.enter("codeFencedFence"),Xe(j)?nt(S,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):D(j)}function D(j){return j===a?(S.enter("codeFencedFenceSequence"),V(j)):_(j)}function V(j){return j===a?(O++,S.consume(j),V):O>=o?(S.exit("codeFencedFenceSequence"),Xe(j)?nt(S,z,"whitespace")(j):z(j)):_(j)}function z(j){return j===null||Re(j)?(S.exit("codeFencedFence"),C(j)):_(j)}}}function RV(t,e,n){const r=this;return s;function s(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const up={name:"codeIndented",tokenize:IV},OV={partial:!0,tokenize:DV};function IV(t,e,n){const r=this;return s;function s(c){return t.enter("codeIndented"),nt(t,i,"linePrefix",5)(c)}function i(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):Re(c)?t.attempt(OV,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Re(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function DV(t,e,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Re(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):nt(t,i,"linePrefix",5)(o)}function i(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):Re(o)?s(o):n(o)}}const LV={name:"codeText",previous:jV,resolve:PV,tokenize:zV};function PV(t){let e=t.length-4,n=3,r,s;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;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="codeTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function jV(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function zV(t,e,n){let r=0,s,i;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),r++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(i=t.enter("codeTextSequence"),s=0,u(d)):Re(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Re(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),s++,u):s===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(i.type="codeTextData",c(d))}}class FV{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 s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&el(this.left,r),i.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),el(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),el(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);el(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);el(this.left,n.reverse())}}}function el(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 l_(t){const e={};let n=-1,r,s,i,o,a,l,c;const u=new FV(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,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,BV(u,n)),n=e[n],c=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},a=u.slice(s,n),a.unshift(r),u.splice(s,n-s+1,a))}}return sr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function BV(t,e){const n=t.get(e)[1],r=t.get(e)[2];let s=e-1;const i=[];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,d,f=-1,p=n,m=0,g=0;const b=[g];for(;p;){for(;t.get(++s)[1]!==p;);i.push(s),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,b.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),f=b.length;f--;){const y=a.slice(b[f],b[f+1]),w=i.pop();l.push([w,w+y.length-1]),t.splice(w,2,y)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}const $V={resolve:UV,tokenize:VV},HV={partial:!0,tokenize:WV};function UV(t){return l_(t),t}function VV(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):Re(a)?t.check(HV,o,i)(a):(t.consume(a),s)}function i(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,s}}function WV(t,e,n){const r=this;return s;function s(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),nt(t,i,"linePrefix")}function i(o){if(o===null||Re(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 c_(t,e,n,r,s,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(y){return y===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(y),t.exit(i),f):y===null||y===32||y===41||Rd(y)?n(y):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(y))}function f(y){return y===62?(t.enter(i),t.consume(y),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(t.exit("chunkString"),t.exit(a),f(y)):y===null||y===60||Re(y)?n(y):(t.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(t.consume(y),p):p(y)}function g(y){return!u&&(y===null||y===41||vt(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(y)):u<c&&y===40?(t.consume(y),u++,g):y===41?(t.consume(y),u--,g):y===null||y===32||y===40||Rd(y)?n(y):(t.consume(y),y===92?b:g)}function b(y){return y===40||y===41||y===92?(t.consume(y),g):g(y)}}function u_(t,e,n,r,s,i){const o=this;let a=0,l;return c;function c(p){return t.enter(r),t.enter(s),t.consume(p),t.exit(s),t.enter(i),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(t.exit(i),t.enter(s),t.consume(p),t.exit(s),t.exit(r),e):Re(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Re(p)||a++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!Xe(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(t.consume(p),a++,d):d(p)}}function d_(t,e,n,r,s,i){let o;return a;function a(f){return f===34||f===39||f===40?(t.enter(r),t.enter(s),t.consume(f),t.exit(s),o=f===40?41:f,l):n(f)}function l(f){return f===o?(t.enter(s),t.consume(f),t.exit(s),t.exit(r),e):(t.enter(i),c(f))}function c(f){return f===o?(t.exit(i),l(o)):f===null?n(f):Re(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),nt(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||Re(f)?(t.exit("chunkString"),c(f)):(t.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(t.consume(f),u):u(f)}}function Tl(t,e){let n;return r;function r(s){return Re(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Xe(s)?nt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const qV={name:"definition",tokenize:GV},KV={partial:!0,tokenize:JV};function GV(t,e,n){const r=this;let s;return i;function i(p){return t.enter("definition"),o(p)}function o(p){return u_.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=Ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):n(p)}function l(p){return vt(p)?Tl(t,c)(p):c(p)}function c(p){return c_(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(KV,d,d)(p)}function d(p){return Xe(p)?nt(t,f,"whitespace")(p):f(p)}function f(p){return p===null||Re(p)?(t.exit("definition"),r.parser.defined.push(s),e(p)):n(p)}}function JV(t,e,n){return r;function r(a){return vt(a)?Tl(t,s)(a):n(a)}function s(a){return d_(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Xe(a)?nt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Re(a)?e(a):n(a)}}const YV={name:"hardBreakEscape",tokenize:ZV};function ZV(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Re(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const XV={name:"headingAtx",resolve:QV,tokenize:e5};function QV(t,e){let n=t.length-2,r=3,s,i;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&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},sr(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function e5(t,e,n){let r=0;return s;function s(u){return t.enter("atxHeading"),i(u)}function i(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||vt(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Re(u)?(t.exit("atxHeading"),e(u)):Xe(u)?nt(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||vt(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const t5=["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"],xw=["pre","script","style","textarea"],n5={concrete:!0,name:"htmlFlow",resolveTo:i5,tokenize:o5},r5={partial:!0,tokenize:l5},s5={partial:!0,tokenize:a5};function i5(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 o5(t,e,n){const r=this;let s,i,o,a,l;return c;function c(E){return u(E)}function u(E){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(E),d}function d(E){return E===33?(t.consume(E),f):E===47?(t.consume(E),i=!0,g):E===63?(t.consume(E),s=3,r.interrupt?e:A):On(E)?(t.consume(E),o=String.fromCharCode(E),b):n(E)}function f(E){return E===45?(t.consume(E),s=2,p):E===91?(t.consume(E),s=5,a=0,m):On(E)?(t.consume(E),s=4,r.interrupt?e:A):n(E)}function p(E){return E===45?(t.consume(E),r.interrupt?e:A):n(E)}function m(E){const P="CDATA[";return E===P.charCodeAt(a++)?(t.consume(E),a===P.length?r.interrupt?e:D:m):n(E)}function g(E){return On(E)?(t.consume(E),o=String.fromCharCode(E),b):n(E)}function b(E){if(E===null||E===47||E===62||vt(E)){const P=E===47,F=o.toLowerCase();return!P&&!i&&xw.includes(F)?(s=1,r.interrupt?e(E):D(E)):t5.includes(o.toLowerCase())?(s=6,P?(t.consume(E),y):r.interrupt?e(E):D(E)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):i?w(E):v(E))}return E===45||Sn(E)?(t.consume(E),o+=String.fromCharCode(E),b):n(E)}function y(E){return E===62?(t.consume(E),r.interrupt?e:D):n(E)}function w(E){return Xe(E)?(t.consume(E),w):T(E)}function v(E){return E===47?(t.consume(E),T):E===58||E===95||On(E)?(t.consume(E),k):Xe(E)?(t.consume(E),v):T(E)}function k(E){return E===45||E===46||E===58||E===95||Sn(E)?(t.consume(E),k):N(E)}function N(E){return E===61?(t.consume(E),S):Xe(E)?(t.consume(E),N):v(E)}function S(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(t.consume(E),l=E,C):Xe(E)?(t.consume(E),S):_(E)}function C(E){return E===l?(t.consume(E),l=null,O):E===null||Re(E)?n(E):(t.consume(E),C)}function _(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||vt(E)?N(E):(t.consume(E),_)}function O(E){return E===47||E===62||Xe(E)?v(E):n(E)}function T(E){return E===62?(t.consume(E),I):n(E)}function I(E){return E===null||Re(E)?D(E):Xe(E)?(t.consume(E),I):n(E)}function D(E){return E===45&&s===2?(t.consume(E),q):E===60&&s===1?(t.consume(E),re):E===62&&s===4?(t.consume(E),ce):E===63&&s===3?(t.consume(E),A):E===93&&s===5?(t.consume(E),ue):Re(E)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(r5,ye,V)(E)):E===null||Re(E)?(t.exit("htmlFlowData"),V(E)):(t.consume(E),D)}function V(E){return t.check(s5,z,ye)(E)}function z(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),j}function j(E){return E===null||Re(E)?V(E):(t.enter("htmlFlowData"),D(E))}function q(E){return E===45?(t.consume(E),A):D(E)}function re(E){return E===47?(t.consume(E),o="",G):D(E)}function G(E){if(E===62){const P=o.toLowerCase();return xw.includes(P)?(t.consume(E),ce):D(E)}return On(E)&&o.length<8?(t.consume(E),o+=String.fromCharCode(E),G):D(E)}function ue(E){return E===93?(t.consume(E),A):D(E)}function A(E){return E===62?(t.consume(E),ce):E===45&&s===2?(t.consume(E),A):D(E)}function ce(E){return E===null||Re(E)?(t.exit("htmlFlowData"),ye(E)):(t.consume(E),ce)}function ye(E){return t.exit("htmlFlow"),e(E)}}function a5(t,e,n){const r=this;return s;function s(o){return Re(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function l5(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(Nc,e,n)}}const c5={name:"htmlText",tokenize:u5};function u5(t,e,n){const r=this;let s,i,o;return a;function a(A){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(A),l}function l(A){return A===33?(t.consume(A),c):A===47?(t.consume(A),N):A===63?(t.consume(A),v):On(A)?(t.consume(A),_):n(A)}function c(A){return A===45?(t.consume(A),u):A===91?(t.consume(A),i=0,m):On(A)?(t.consume(A),w):n(A)}function u(A){return A===45?(t.consume(A),p):n(A)}function d(A){return A===null?n(A):A===45?(t.consume(A),f):Re(A)?(o=d,re(A)):(t.consume(A),d)}function f(A){return A===45?(t.consume(A),p):d(A)}function p(A){return A===62?q(A):A===45?f(A):d(A)}function m(A){const ce="CDATA[";return A===ce.charCodeAt(i++)?(t.consume(A),i===ce.length?g:m):n(A)}function g(A){return A===null?n(A):A===93?(t.consume(A),b):Re(A)?(o=g,re(A)):(t.consume(A),g)}function b(A){return A===93?(t.consume(A),y):g(A)}function y(A){return A===62?q(A):A===93?(t.consume(A),y):g(A)}function w(A){return A===null||A===62?q(A):Re(A)?(o=w,re(A)):(t.consume(A),w)}function v(A){return A===null?n(A):A===63?(t.consume(A),k):Re(A)?(o=v,re(A)):(t.consume(A),v)}function k(A){return A===62?q(A):v(A)}function N(A){return On(A)?(t.consume(A),S):n(A)}function S(A){return A===45||Sn(A)?(t.consume(A),S):C(A)}function C(A){return Re(A)?(o=C,re(A)):Xe(A)?(t.consume(A),C):q(A)}function _(A){return A===45||Sn(A)?(t.consume(A),_):A===47||A===62||vt(A)?O(A):n(A)}function O(A){return A===47?(t.consume(A),q):A===58||A===95||On(A)?(t.consume(A),T):Re(A)?(o=O,re(A)):Xe(A)?(t.consume(A),O):q(A)}function T(A){return A===45||A===46||A===58||A===95||Sn(A)?(t.consume(A),T):I(A)}function I(A){return A===61?(t.consume(A),D):Re(A)?(o=I,re(A)):Xe(A)?(t.consume(A),I):O(A)}function D(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),s=A,V):Re(A)?(o=D,re(A)):Xe(A)?(t.consume(A),D):(t.consume(A),z)}function V(A){return A===s?(t.consume(A),s=void 0,j):A===null?n(A):Re(A)?(o=V,re(A)):(t.consume(A),V)}function z(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||vt(A)?O(A):(t.consume(A),z)}function j(A){return A===47||A===62||vt(A)?O(A):n(A)}function q(A){return A===62?(t.consume(A),t.exit("htmlTextData"),t.exit("htmlText"),e):n(A)}function re(A){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),G}function G(A){return Xe(A)?nt(t,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ue(A)}function ue(A){return t.enter("htmlTextData"),o(A)}}const $b={name:"labelEnd",resolveAll:p5,resolveTo:m5,tokenize:g5},d5={tokenize:b5},f5={tokenize:y5},h5={tokenize:x5};function p5(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 s=r.type==="labelImage"?4:2;r.type="data",e+=s}}return t.length!==n.length&&sr(t,0,t.length,n),t}function m5(t,e){let n=t.length,r=0,s,i,o,a;for(;n--;)if(s=t[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const l={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[i][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=mr(a,t.slice(i+1,i+r+3)),a=mr(a,[["enter",u,e]]),a=mr(a,Wf(e.parser.constructs.insideSpan.null,t.slice(i+r+4,o-3),e)),a=mr(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=mr(a,t.slice(o+1)),a=mr(a,[["exit",l,e]]),sr(t,i,t.length,a),t}function g5(t,e,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(f){return i?i._inactive?d(f):(o=r.parser.defined.includes(Ir(r.sliceSerialize({start:i.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),l):n(f)}function l(f){return f===40?t.attempt(d5,u,o?u:d)(f):f===91?t.attempt(f5,u,o?c:d)(f):o?u(f):d(f)}function c(f){return t.attempt(h5,u,d)(f)}function u(f){return e(f)}function d(f){return i._balanced=!0,n(f)}}function b5(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),s}function s(d){return vt(d)?Tl(t,i)(d):i(d)}function i(d){return d===41?u(d):c_(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return vt(d)?Tl(t,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?d_(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return vt(d)?Tl(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function y5(t,e,n){const r=this;return s;function s(a){return u_.call(r,t,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function x5(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const v5={name:"labelStartImage",resolveAll:$b.resolveAll,tokenize:w5};function w5(t,e,n){const r=this;return s;function s(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),i}function i(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 k5={name:"labelStartLink",resolveAll:$b.resolveAll,tokenize:S5};function S5(t,e,n){const r=this;return s;function s(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const dp={name:"lineEnding",tokenize:E5};function E5(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),nt(t,e,"linePrefix")}}const Cu={name:"thematicBreak",tokenize:C5};function C5(t,e,n){let r=0,s;return i;function i(c){return t.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Re(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===s?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Xe(c)?nt(t,a,"whitespace")(c):a(c))}}const $n={continuation:{tokenize:A5},exit:R5,name:"list",tokenize:T5},N5={partial:!0,tokenize:O5},_5={partial:!0,tokenize:M5};function T5(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Um(p)){if(r.containerState.type||(r.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(Cu,n,c)(p):c(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return n(p)}function l(p){return Um(p)&&++o<10?(t.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),c(p)):n(p)}function c(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(Nc,r.interrupt?n:u,t.attempt(N5,f,d))}function u(p){return r.containerState.initialBlankLine=!0,i++,f(p)}function d(p){return Xe(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function A5(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Nc,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,nt(t,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Xe(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(_5,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,nt(t,t.attempt($n,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function M5(t,e,n){const r=this;return nt(t,s,"listItemIndent",r.containerState.size+1);function s(i){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(i):n(i)}}function R5(t){t.exit(this.containerState.type)}function O5(t,e,n){const r=this;return nt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Xe(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const vw={name:"setextUnderline",resolveTo:I5,tokenize:D5};function I5(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",o,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function D5(t,e,n){const r=this;let s;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Xe(c)?nt(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Re(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const L5={tokenize:P5};function P5(t){const e=this,n=t.attempt(Nc,r,t.attempt(this.parser.constructs.flowInitial,s,nt(t,t.attempt(this.parser.constructs.flow,s,t.attempt($V,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const j5={resolveAll:h_()},z5=f_("string"),F5=f_("text");function f_(t){return{resolveAll:h_(t==="text"?B5:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,o,a);return o;function o(u){return c(u)?i(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"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=s[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function h_(t){return e;function e(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(n,r):n}}function B5(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],s=e.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const c=s[i];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){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,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 $5={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:i_},H5={91:qV},U5={[-2]:up,[-1]:up,32:up},V5={35:XV,42:Cu,45:[vw,Cu],60:n5,61:vw,95:Cu,96:yw,126:yw},W5={38:a_,92:o_},q5={[-5]:dp,[-4]:dp,[-3]:dp,33:v5,38:a_,42:Vm,60:[kV,c5],91:k5,92:[YV,o_],93:$b,95:Vm,96:LV},K5={null:[Vm,j5]},G5={null:[42,95]},J5={null:[]},Y5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:G5,contentInitial:H5,disable:J5,document:$5,flow:V5,flowInitial:U5,insideSpan:K5,string:W5,text:q5},Symbol.toStringTag,{value:"Module"}));function Z5(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 s={},i=[];let o=[],a=[];const l={attempt:C(N),check:C(S),consume:w,enter:v,exit:k,interrupt:C(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:t,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&i.push(e),c;function d(I){return o=mr(o,I),b(),o[o.length-1]!==null?[]:(_(e,0),c.events=Wf(i,c.events,c),c.events)}function f(I,D){return Q5(p(I),D)}function p(I){return X5(o,I)}function m(){const{_bufferIndex:I,_index:D,line:V,column:z,offset:j}=r;return{_bufferIndex:I,_index:D,line:V,column:z,offset:j}}function g(I){s[I.line]=I.column,T()}function b(){let I;for(;r._index<o.length;){const D=o[r._index];if(typeof D=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<D.length;)y(D.charCodeAt(r._bufferIndex));else y(D)}}function y(I){u=u(I)}function w(I){Re(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,T()):I!==-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=I}function v(I,D){const V=D||{};return V.type=I,V.start=m(),c.events.push(["enter",V,c]),a.push(V),V}function k(I){const D=a.pop();return D.end=m(),c.events.push(["exit",D,c]),D}function N(I,D){_(I,D.from)}function S(I,D){D.restore()}function C(I,D){return V;function V(z,j,q){let re,G,ue,A;return Array.isArray(z)?ye(z):"tokenize"in z?ye([z]):ce(z);function ce($){return L;function L(H){const J=H!==null&&$[H],ne=H!==null&&$.null,xe=[...Array.isArray(J)?J:J?[J]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return ye(xe)(H)}}function ye($){return re=$,G=0,$.length===0?q:E($[G])}function E($){return L;function L(H){return A=O(),ue=$,$.partial||(c.currentConstruct=$),$.name&&c.parser.constructs.disable.null.includes($.name)?F():$.tokenize.call(D?Object.assign(Object.create(c),D):c,l,P,F)(H)}}function P($){return I(ue,A),j}function F($){return A.restore(),++G<re.length?E(re[G]):q}}}function _(I,D){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&sr(c.events,D,c.events.length-D,I.resolve(c.events.slice(D),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function O(){const I=m(),D=c.previous,V=c.currentConstruct,z=c.events.length,j=Array.from(a);return{from:z,restore:q};function q(){r=I,c.previous=D,c.currentConstruct=V,c.events.length=z,a=j,T()}}function T(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function X5(t,e){const n=e.start._index,r=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let o;if(n===s)o=[t[n].slice(r,i)];else{if(o=t.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(t[s].slice(0,i))}return o}function Q5(t,e){let n=-1;const r=[];let s;for(;++n<t.length;){const i=t[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
455
+ `;break}case-3:{o=`\r
456
+ `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function eW(t){const r={constructs:r_([Y5,...(t||{}).extensions||[]]),content:s(mV),defined:[],document:s(bV),flow:s(L5),lazy:{},string:s(z5),text:s(F5)};return r;function s(i){return o;function o(a){return Z5(r,i,a)}}}function tW(t){for(;!l_(t););return t}const ww=/[\0\t\n\r]/g;function nW(){let t=1,e="",n=!0,r;return s;function s(i,o,a){const l=[];let c,u,d,f,p;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,e="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(ww.lastIndex=d,c=ww.exec(i),f=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(f),!c){e=i.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),t+=f-d),p){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}d=f+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const rW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sW(t){return t.replace(rW,iW)}function iW(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return s_(n.slice(i?2:1),i?16:10)}return Bb(n)||t}const p_={}.hasOwnProperty;function oW(t,e,n){return typeof e!="string"&&(n=e,e=void 0),aW(n)(tW(eW(n).document().write(nW()(t,e,!0))))}function aW(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ie),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(de),blockQuote:i(ne),characterEscape:O,characterReference:O,codeFenced:i(xe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(xe,o),codeText:i(ge,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(Pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ze),hardBreakEscape:i(se),hardBreakTrailing:i(se),htmlFlow:i(it,o),htmlFlowData:O,htmlText:i(it,o),htmlTextData:O,image:i(Ye),label:o,link:i(ie),listItem:i(dt),listItemValue:f,listOrdered:i(Be,d),listUnordered:i(Be),paragraph:i(ot),reference:E,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(de),strong:i(or),thematicBreak:i(Ds)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:J,autolinkProtocol:H,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:F,characterReferenceMarkerNumeric:F,characterReferenceValue:$,characterReference:L,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:T,codeIndented:l(y),codeText:l(j),codeTextData:T,data:T,definition:l(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(D),hardBreakTrailing:l(D),htmlFlow:l(V),htmlFlowData:T,htmlText:l(z),htmlTextData:T,image:l(re),label:ue,labelText:G,lineEnding:I,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:P,resourceDestinationString:A,resourceTitleString:ce,resource:ye,setextHeading:l(_),setextHeadingLineSequence:C,setextHeadingText:S,strong:l(),thematicBreak:l()}};m_(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(U){let Y={type:"root",children:[]};const _e={stack:[Y],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:n},je=[];let tt=-1;for(;++tt<U.length;)if(U[tt][1].type==="listOrdered"||U[tt][1].type==="listUnordered")if(U[tt][0]==="enter")je.push(tt);else{const Rt=je.pop();tt=s(U,Rt,tt)}for(tt=-1;++tt<U.length;){const Rt=e[U[tt][0]];p_.call(Rt,U[tt][1].type)&&Rt[U[tt][1].type].call(Object.assign({sliceSerialize:U[tt][2].sliceSerialize},_e),U[tt][1])}if(_e.tokenStack.length>0){const Rt=_e.tokenStack[_e.tokenStack.length-1];(Rt[1]||kw).call(_e,void 0,Rt[0])}for(Y.position={start:Bs(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Bs(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<e.transforms.length;)Y=e.transforms[tt](Y)||Y;return Y}function s(U,Y,_e){let je=Y-1,tt=-1,Rt=!1,Bn,pn,zr,Er;for(;++je<=_e;){const nn=U[je];switch(nn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nn[0]==="enter"?tt++:tt--,Er=void 0;break}case"lineEndingBlank":{nn[0]==="enter"&&(Bn&&!Er&&!tt&&!zr&&(zr=je),Er=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Er=void 0}if(!tt&&nn[0]==="enter"&&nn[1].type==="listItemPrefix"||tt===-1&&nn[0]==="exit"&&(nn[1].type==="listUnordered"||nn[1].type==="listOrdered")){if(Bn){let Fr=je;for(pn=void 0;Fr--;){const mn=U[Fr];if(mn[1].type==="lineEnding"||mn[1].type==="lineEndingBlank"){if(mn[0]==="exit")continue;pn&&(U[pn][1].type="lineEndingBlank",Rt=!0),mn[1].type="lineEnding",pn=Fr}else if(!(mn[1].type==="linePrefix"||mn[1].type==="blockQuotePrefix"||mn[1].type==="blockQuotePrefixWhitespace"||mn[1].type==="blockQuoteMarker"||mn[1].type==="listItemIndent"))break}zr&&(!pn||zr<pn)&&(Bn._spread=!0),Bn.end=Object.assign({},pn?U[pn][1].start:nn[1].end),U.splice(pn||je,0,["exit",Bn,nn[2]]),je++,_e++}if(nn[1].type==="listItemPrefix"){const Fr={type:"listItem",_spread:!1,start:Object.assign({},nn[1].start),end:void 0};Bn=Fr,U.splice(je,0,["enter",Fr,nn[2]]),je++,_e++,zr=void 0,Er=!0}}}return U[Y][1]._spread=Rt,_e}function i(U,Y){return _e;function _e(je){a.call(this,U(je),je),Y&&Y.call(this,je)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(U,Y,_e){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([Y,_e||void 0]),U.position={start:Bs(Y.start),end:void 0}}function l(U){return Y;function Y(_e){U&&U.call(this,_e),c.call(this,_e)}}function c(U,Y){const _e=this.stack.pop(),je=this.tokenStack.pop();if(je)je[0].type!==U.type&&(Y?Y.call(this,U,je[0]):(je[1]||kw).call(this,U,je[0]));else throw new Error("Cannot close `"+U.type+"` ("+_l({start:U.start,end:U.end})+"): it’s not open");_e.position.end=Bs(U.end)}function u(){return Fb(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(U){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function p(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=U}function m(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=U}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.value=U.replace(/(\r?\n|\r)$/g,"")}function w(U){const Y=this.resume(),_e=this.stack[this.stack.length-1];_e.label=Y,_e.identifier=Ir(this.sliceSerialize(U)).toLowerCase()}function v(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.title=U}function k(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.url=U}function N(U){const Y=this.stack[this.stack.length-1];if(!Y.depth){const _e=this.sliceSerialize(U).length;Y.depth=_e}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(U){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function O(U){const _e=this.stack[this.stack.length-1].children;let je=_e[_e.length-1];(!je||je.type!=="text")&&(je=Yn(),je.position={start:Bs(U.start),end:void 0},_e.push(je)),this.stack.push(je)}function T(U){const Y=this.stack.pop();Y.value+=this.sliceSerialize(U),Y.position.end=Bs(U.end)}function I(U){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _e=Y.children[Y.children.length-1];_e.position.end=Bs(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Y.type)&&(O.call(this,U),T.call(this,U))}function D(){this.data.atHardBreak=!0}function V(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.value=U}function z(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.value=U}function j(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.value=U}function q(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=Y,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function re(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=Y,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function G(U){const Y=this.sliceSerialize(U),_e=this.stack[this.stack.length-2];_e.label=sW(Y),_e.identifier=Ir(Y).toLowerCase()}function ue(){const U=this.stack[this.stack.length-1],Y=this.resume(),_e=this.stack[this.stack.length-1];if(this.data.inReference=!0,_e.type==="link"){const je=U.children;_e.children=je}else _e.alt=Y}function A(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.url=U}function ce(){const U=this.resume(),Y=this.stack[this.stack.length-1];Y.title=U}function ye(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function P(U){const Y=this.resume(),_e=this.stack[this.stack.length-1];_e.label=Y,_e.identifier=Ir(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function F(U){this.data.characterReferenceType=U.type}function $(U){const Y=this.sliceSerialize(U),_e=this.data.characterReferenceType;let je;_e?(je=s_(Y,_e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):je=Bb(Y);const tt=this.stack[this.stack.length-1];tt.value+=je}function L(U){const Y=this.stack.pop();Y.position.end=Bs(U.end)}function H(U){T.call(this,U);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(U)}function J(U){T.call(this,U);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(U)}function ne(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function ge(){return{type:"inlineCode",value:""}}function Pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ze(){return{type:"emphasis",children:[]}}function de(){return{type:"heading",depth:0,children:[]}}function se(){return{type:"break"}}function it(){return{type:"html",value:""}}function Ye(){return{type:"image",title:null,url:"",alt:null}}function ie(){return{type:"link",title:null,url:"",children:[]}}function Be(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function dt(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function ot(){return{type:"paragraph",children:[]}}function or(){return{type:"strong",children:[]}}function Yn(){return{type:"text",value:""}}function Ds(){return{type:"thematicBreak"}}}function Bs(t){return{line:t.line,column:t.column,offset:t.offset}}function m_(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?m_(t,r):lW(t,r)}}function lW(t,e){let n;for(n in e)if(p_.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 kw(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+_l({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+_l({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+_l({start:e.start,end:e.end})+") is still open")}function g_(t){const e=this;e.parser=n;function n(r){return oW(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Od(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function cW(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const qf=(function(t){if(t==null)return hW;if(typeof t=="function")return Kf(t);if(typeof t=="object")return Array.isArray(t)?uW(t):dW(t);if(typeof t=="string")return fW(t);throw new Error("Expected function, string, or object as test")});function uW(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=qf(t[n]);return Kf(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function dW(t){const e=t;return Kf(n);function n(r){const s=r;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function fW(t){return Kf(e);function e(n){return n&&n.type===t}}function Kf(t){return e;function e(n,r,s){return!!(pW(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function hW(){return!0}function pW(t){return t!==null&&typeof t=="object"&&"type"in t}const b_=[],mW=!0,Wm=!1,gW="skip";function y_(t,e,n,r){let s;typeof e=="function"&&typeof n!="function"?(r=n,n=e):s=e;const i=qf(s),o=r?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=b_,m,g,b;if((!e||i(l,c,u[u.length-1]||void 0))&&(p=bW(n(l,u)),p[0]===Wm))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==gW)for(g=(r?y.children.length:-1)+o,b=u.concat(y);g>-1&&g<y.children.length;){const w=y.children[g];if(m=a(w,g,b)(),m[0]===Wm)return m;g=typeof m[1]=="number"?m[1]:g+o}}return p}}}function bW(t){return Array.isArray(t)?t:typeof t=="number"?[mW,t]:t==null?b_:[t]}function yW(t,e,n){const s=qf((n||{}).ignore||[]),i=xW(e);let o=-1;for(;++o<i.length;)y_(t,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const p=u[d],m=f?f.children:void 0;if(s(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=i[o][0],p=i[o][1];let m=0;const b=d.children.indexOf(c);let y=!1,w=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){const k=v.index,N={index:v.index,input:v.input,stack:[...u,c]};let S=p(...v,N);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?f.lastIndex=k+1:(m!==k&&w.push({type:"text",value:c.value.slice(m,k)}),Array.isArray(S)?w.push(...S):S&&w.push(S),m=k+v[0].length,y=!0),!f.global)break;v=f.exec(c.value)}return y?(m<c.value.length&&w.push({type:"text",value:c.value.slice(m)}),d.children.splice(b,1,...w)):w=[c],b+w.length}}function xW(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([vW(s[0]),wW(s[1])])}return e}function vW(t){return typeof t=="string"?new RegExp(cW(t),"g"):t}function wW(t){return typeof t=="function"?t:function(){return t}}const fp="phrasing",hp=["autolink","link","image","label"];function kW(){return{transforms:[AW],enter:{literalAutolink:EW,literalAutolinkEmail:pp,literalAutolinkHttp:pp,literalAutolinkWww:pp},exit:{literalAutolink:TW,literalAutolinkEmail:_W,literalAutolinkHttp:CW,literalAutolinkWww:NW}}}function SW(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:fp,notInConstruct:hp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:fp,notInConstruct:hp},{character:":",before:"[ps]",after:"\\/",inConstruct:fp,notInConstruct:hp}]}}function EW(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function pp(t){this.config.enter.autolinkProtocol.call(this,t)}function CW(t){this.config.exit.autolinkProtocol.call(this,t)}function NW(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function _W(t){this.config.exit.autolinkEmail.call(this,t)}function TW(t){this.exit(t)}function AW(t){yW(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,MW],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),RW]],{ignore:["link","linkReference"]})}function MW(t,e,n,r,s){let i="";if(!x_(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!OW(n)))return!1;const o=IW(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function RW(t,e,n,r){return!x_(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function OW(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function IW(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=Od(t,"(");let i=Od(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function x_(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||So(n)||Vf(n))&&(!e||n!==47)}v_.peek=HW;function DW(){this.buffer()}function LW(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function PW(){this.buffer()}function jW(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function zW(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ir(this.sliceSerialize(t)).toLowerCase(),n.label=e}function FW(t){this.exit(t)}function BW(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ir(this.sliceSerialize(t)).toLowerCase(),n.label=e}function $W(t){this.exit(t)}function HW(){return"["}function v_(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function UW(){return{enter:{gfmFootnoteCallString:DW,gfmFootnoteCall:LW,gfmFootnoteDefinitionLabelString:PW,gfmFootnoteDefinition:jW},exit:{gfmFootnoteCallString:zW,gfmFootnoteCall:FW,gfmFootnoteDefinitionLabelString:BW,gfmFootnoteDefinition:$W}}}function VW(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:v_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
457
+ `:" ")+i.indentLines(i.containerFlow(r,a.current()),e?w_:WW))),c(),l}}function WW(t,e,n){return e===0?t:w_(t,e,n)}function w_(t,e,n){return(n?"":" ")+t}const qW=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];k_.peek=ZW;function KW(){return{canContainEols:["delete"],enter:{strikethrough:JW},exit:{strikethrough:YW}}}function GW(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:qW}],handlers:{delete:k_}}}function JW(t){this.enter({type:"delete",children:[]},t)}function YW(t){this.exit(t)}function k_(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(t,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function ZW(){return"~"}function XW(t){return t.length}function QW(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||XW,i=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const g=[],b=[];let y=-1;for(t[u].length>c&&(c=t[u].length);++y<t[u].length;){const w=eq(t[u][y]);if(n.alignDelimiters!==!1){const v=s(w);b[y]=v,(l[y]===void 0||v>l[y])&&(l[y]=v)}g.push(w)}o[u]=g,a[u]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=Sw(r[d]);else{const g=Sw(r);for(;++d<c;)i[d]=g}d=-1;const f=[],p=[];for(;++d<c;){const g=i[d];let b="",y="";g===99?(b=":",y=":"):g===108?b=":":g===114&&(y=":");let w=n.alignDelimiters===!1?1:Math.max(1,l[d]-b.length-y.length);const v=b+"-".repeat(w)+y;n.alignDelimiters!==!1&&(w=b.length+w+y.length,w>l[d]&&(l[d]=w),p[d]=w),f[d]=v}o.splice(1,0,f),a.splice(1,0,p),u=-1;const m=[];for(;++u<o.length;){const g=o[u],b=a[u];d=-1;const y=[];for(;++d<c;){const w=g[d]||"";let v="",k="";if(n.alignDelimiters!==!1){const N=l[d]-(b[d]||0),S=i[d];S===114?v=" ".repeat(N):S===99?N%2?(v=" ".repeat(N/2+.5),k=" ".repeat(N/2-.5)):(v=" ".repeat(N/2),k=v):k=" ".repeat(N)}n.delimiterStart!==!1&&!d&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||d)&&y.push(" "),n.alignDelimiters!==!1&&y.push(v),y.push(w),n.alignDelimiters!==!1&&y.push(k),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&y.push("|")}m.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
458
+ `)}function eq(t){return t==null?"":String(t)}function Sw(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}const Ew={}.hasOwnProperty;function tq(t,e){const n=e||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&Ew.call(s,t)){const l=String(s[t]);o=Ew.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function nq(t,e,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(t,i.current()),rq);return s(),o}function rq(t,e,n){return">"+(n?"":" ")+t}function sq(t,e){return Cw(t,e.inConstruct,!0)&&!Cw(t,e.notInConstruct,!1)}function Cw(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function Nw(t,e,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
459
+ `&&sq(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
460
+ `}function iq(t,e){const n=String(t);let r=n.indexOf(e),s=r,i=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+e.length,r=n.indexOf(e,s);return o}function oq(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function aq(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function lq(t,e,n,r){const s=aq(n),i=t.value||"",o=s==="`"?"GraveAccent":"Tilde";if(oq(t,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,cq);return d(),f}const a=n.createTracker(r),l=s.repeat(Math.max(iq(i,s)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(t.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(t.meta,{before:u,after:`
461
+ `,encode:["`"],...a.current()})),d()}return u+=a.move(`
462
+ `),i&&(u+=a.move(i+`
463
+ `)),u+=a.move(l),c(),u}function cq(t,e,n){return(n?"":" ")+t}function Hb(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function uq(t,e,n,r){const s=Hb(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
464
+ `,...l.current()}))),a(),t.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(t.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),o(),c}function dq(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Jl(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Id(t,e,n){const r=Aa(t),s=Aa(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}S_.peek=fq;function S_(t,e,n,r){const s=dq(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(t,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=Id(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=Jl(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Id(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+Jl(d));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function fq(t,e,n){return n.options.emphasis||"*"}function Ub(t,e,n,r){let s,i,o;typeof e=="function"&&typeof n!="function"?(i=void 0,o=e,s=n):(i=e,o=n,s=r),y_(t,i,a,s);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}function hq(t,e){let n=!1;return Ub(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Wm}),!!((!t.depth||t.depth<3)&&Fb(t)&&(e.options.setext||n))}function pq(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(hq(t,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(t,{...i.current(),before:`
465
+ `,after:`
466
+ `});return d(),u(),f+`
467
+ `+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
468
+ `))+1))}const o="#".repeat(s),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
469
+ `,...i.current()});return/^[\t ]/.test(c)&&(c=Jl(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}E_.peek=mq;function E_(t){return t.value||""}function mq(){return"<"}C_.peek=gq;function C_(t,e,n,r){const s=Hb(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(t.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),c+=l.move(")"),o(),c}function gq(){return"!"}N_.peek=bq;function N_(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function bq(){return"!"}__.peek=yq;function __(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return s+r+s}function yq(){return"`"}function T_(t,e){const n=Fb(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}A_.peek=xq;function A_(t,e,n,r){const s=Hb(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(T_(t,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=n.enter(`title${i}`),c+=o.move(" "+s),c+=o.move(n.safe(t.title,{before:c,after:s,...o.current()})),c+=o.move(s),l()),c+=o.move(")"),a(),c}function xq(t,e,n){return T_(t,n)?"<":"["}M_.peek=vq;function M_(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function vq(){return"["}function Vb(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function wq(t){const e=Vb(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function kq(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function R_(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function Sq(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=t.ordered?kq(n):Vb(n);const a=t.ordered?o==="."?")":".":wq(n);let l=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),R_(n)===o&&u){let d=-1;for(;++d<t.children.length;){const f=t.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(t,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),c}function Eq(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function Cq(t,e,n,r){const s=Eq(n);let i=n.bulletCurrent||Vb(n);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,a.current()),u);return l(),c;function u(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?i:i+" ".repeat(o-i.length))+d}}function Nq(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(t,r);return i(),s(),o}const _q=qf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Tq(t,e,n,r){return(t.children.some(function(o){return _q(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Aq(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}O_.peek=Mq;function O_(t,e,n,r){const s=Aq(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(t,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=Id(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=Jl(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Id(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+Jl(d));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function Mq(t,e,n){return n.options.strong||"*"}function Rq(t,e,n,r){return n.safe(t.value,r)}function Oq(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Iq(t,e,n){const r=(R_(n)+(n.options.ruleSpaces?" ":"")).repeat(Oq(n));return n.options.ruleSpaces?r.slice(0,-1):r}const I_={blockquote:nq,break:Nw,code:lq,definition:uq,emphasis:S_,hardBreak:Nw,heading:pq,html:E_,image:C_,imageReference:N_,inlineCode:__,link:A_,linkReference:M_,list:Sq,listItem:Cq,paragraph:Nq,root:Tq,strong:O_,text:Rq,thematicBreak:Iq};function Dq(){return{enter:{table:Lq,tableData:_w,tableHeader:_w,tableRow:jq},exit:{codeText:zq,table:Pq,tableData:mp,tableHeader:mp,tableRow:mp}}}function Lq(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Pq(t){this.exit(t),this.data.inTable=void 0}function jq(t){this.enter({type:"tableRow",children:[]},t)}function mp(t){this.exit(t)}function _w(t){this.enter({type:"tableCell",children:[]},t)}function zq(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Fq));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Fq(t,e){return e==="|"?e:t}function Bq(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
470
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,m,g,b){return c(u(p,g,b),p.align)}function a(p,m,g,b){const y=d(p,g,b),w=c([y]);return w.slice(0,w.indexOf(`
471
+ `))}function l(p,m,g,b){const y=g.enter("tableCell"),w=g.enter("phrasing"),v=g.containerPhrasing(p,{...b,before:i,after:i});return w(),y(),v}function c(p,m){return QW(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function u(p,m,g){const b=p.children;let y=-1;const w=[],v=m.enter("table");for(;++y<b.length;)w[y]=d(b[y],m,g);return v(),w}function d(p,m,g){const b=p.children;let y=-1;const w=[],v=m.enter("tableRow");for(;++y<b.length;)w[y]=l(b[y],p,m,g);return v(),w}function f(p,m,g){let b=I_.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function $q(){return{exit:{taskListCheckValueChecked:Tw,taskListCheckValueUnchecked:Tw,paragraph:Uq}}}function Hq(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Vq}}}function Tw(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Uq(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=e.children;let i=-1,o;for(;++i<s.length;){const a=s[i];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Vq(t,e,n,r){const s=t.children[0],i=typeof t.checked=="boolean"&&s&&s.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=I_.listItem(t,e,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function Wq(){return[kW(),UW(),KW(),Dq(),$q()]}function qq(t){return{extensions:[SW(),VW(t),GW(),Bq(t),Hq()]}}const Kq={tokenize:Qq,partial:!0},D_={tokenize:e9,partial:!0},L_={tokenize:t9,partial:!0},P_={tokenize:n9,partial:!0},Gq={tokenize:r9,partial:!0},j_={name:"wwwAutolink",tokenize:Zq,previous:F_},z_={name:"protocolAutolink",tokenize:Xq,previous:B_},Is={name:"emailAutolink",tokenize:Yq,previous:$_},es={};function Jq(){return{text:es}}let ji=48;for(;ji<123;)es[ji]=Is,ji++,ji===58?ji=65:ji===91&&(ji=97);es[43]=Is;es[45]=Is;es[46]=Is;es[95]=Is;es[72]=[Is,z_];es[104]=[Is,z_];es[87]=[Is,j_];es[119]=[Is,j_];function Yq(t,e,n){const r=this;let s,i;return o;function o(d){return!qm(d)||!$_.call(r,r.previous)||Wb(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return qm(d)?(t.consume(d),a):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(Gq,u,c)(d):d===45||d===95||Sn(d)?(i=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),s=!0,l}function u(d){return i&&s&&On(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function Zq(t,e,n){const r=this;return s;function s(o){return o!==87&&o!==119||!F_.call(r,r.previous)||Wb(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Kq,t.attempt(D_,t.attempt(L_,i),n),n)(o))}function i(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function Xq(t,e,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&B_.call(r,r.previous)&&!Wb(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),t.consume(d),a):n(d)}function a(d){if(On(d)&&s.length<5)return s+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const f=s.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||Rd(d)||vt(d)||So(d)||Vf(d)?n(d):t.attempt(D_,t.attempt(L_,u),n)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function Qq(t,e,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),s):o===46&&r===3?(t.consume(o),i):n(o)}function i(o){return o===null?n(o):e(o)}}function e9(t,e,n){let r,s,i;return o;function o(c){return c===46||c===95?t.check(P_,l,a)(c):c===null||vt(c)||So(c)||c!==45&&Vf(c)?l(c):(i=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),t.consume(c),o}function l(c){return s||r||!i?n(c):e(c)}}function t9(t,e){let n=0,r=0;return s;function s(o){return o===40?(n++,t.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(P_,e,i)(o):o===null||vt(o)||So(o)?e(o):(t.consume(o),s)}function i(o){return o===41&&r++,t.consume(o),s}}function n9(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),i):a===93?(t.consume(a),s):a===60||a===null||vt(a)||So(a)?e(a):n(a)}function s(a){return a===null||a===40||a===91||vt(a)||So(a)?e(a):r(a)}function i(a){return On(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):On(a)?(t.consume(a),o):n(a)}}function r9(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Sn(i)?n(i):e(i)}}function F_(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||vt(t)}function B_(t){return!On(t)}function $_(t){return!(t===47||qm(t))}function qm(t){return t===43||t===45||t===46||t===95||Sn(t)}function Wb(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const s9={tokenize:f9,partial:!0};function i9(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:c9,continuation:{tokenize:u9},exit:d9}},text:{91:{name:"gfmFootnoteCall",tokenize:l9},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o9,resolveTo:a9}}}}function o9(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Ir(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function a9(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function l9(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!o||d===null||d===91||vt(d))return n(d);if(d===93){t.exit("chunkString");const f=t.exit("gfmFootnoteCallString");return s.includes(Ir(r.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return vt(d)||(o=!0),i++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),i++,c):c(d)}}function c9(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||vt(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return i=Ir(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return vt(m)||(a=!0),o++,t.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function f(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),s.includes(i)||s.push(i),nt(t,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return e(m)}}function u9(t,e,n){return t.check(Nc,e,t.attempt(s9,e,n))}function d9(t){t.exit("gfmFootnoteDefinition")}function f9(t,e,n){const r=this;return nt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(i):n(i)}}function h9(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&sr(f,f.length,0,Wf(p,o.slice(c+1,l),a)),sr(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),sr(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const g=Aa(c);if(m===126)return d>1?l(m):(o.consume(m),d++,p);if(d<2&&!n)return l(m);const b=o.exit("strikethroughSequenceTemporary"),y=Aa(m);return b._open=!y||y===2&&!!g,b._close=!g||g===2&&!!y,a(m)}}}class p9{constructor(){this.map=[]}add(e,n,r){m9(this,e,n,r)}consume(e){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function m9(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<t.map.length;){if(t.map[s][0]===e){t.map[s][1]+=n,t.map[s][2].push(...r);return}s+=1}t.map.push([e,n,r])}}function g9(t,e){let n=!1;const r=[];for(;e<t.length;){const s=t[e];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function b9(){return{flow:{null:{name:"table",tokenize:y9,resolveAll:x9}}}}function y9(t,e,n){const r=this;let s=0,i=0,o;return a;function a(T){let I=r.events.length-1;for(;I>-1;){const z=r.events[I][1].type;if(z==="lineEnding"||z==="linePrefix")I--;else break}const D=I>-1?r.events[I][1].type:null,V=D==="tableHead"||D==="tableRow"?S:l;return V===S&&r.parser.lazy[r.now().line]?n(T):V(T)}function l(T){return t.enter("tableHead"),t.enter("tableRow"),c(T)}function c(T){return T===124||(o=!0,i+=1),u(T)}function u(T){return T===null?n(T):Re(T)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),p):n(T):Xe(T)?nt(t,u,"whitespace")(T):(i+=1,o&&(o=!1,s+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(T)))}function d(T){return T===null||T===124||vt(T)?(t.exit("data"),u(T)):(t.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(t.consume(T),d):d(T)}function p(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(t.enter("tableDelimiterRow"),o=!1,Xe(T)?nt(t,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):m(T))}function m(T){return T===45||T===58?b(T):T===124?(o=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),g):N(T)}function g(T){return Xe(T)?nt(t,b,"whitespace")(T):b(T)}function b(T){return T===58?(i+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),y):T===45?(i+=1,y(T)):T===null||Re(T)?k(T):N(T)}function y(T){return T===45?(t.enter("tableDelimiterFiller"),w(T)):N(T)}function w(T){return T===45?(t.consume(T),w):T===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(T))}function v(T){return Xe(T)?nt(t,k,"whitespace")(T):k(T)}function k(T){return T===124?m(T):T===null||Re(T)?!o||s!==i?N(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(T)):N(T)}function N(T){return n(T)}function S(T){return t.enter("tableRow"),C(T)}function C(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),C):T===null||Re(T)?(t.exit("tableRow"),e(T)):Xe(T)?nt(t,C,"whitespace")(T):(t.enter("data"),_(T))}function _(T){return T===null||T===124||vt(T)?(t.exit("data"),C(T)):(t.consume(T),T===92?O:_)}function O(T){return T===92||T===124?(t.consume(T),_):_(T)}}function x9(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new p9;for(;++n<t.length;){const p=t[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(Aw(f,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",c,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,e]])),s=m.type==="tableDelimiterRow"?2:u?3:1):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=su(f,e,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=su(f,e,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):m.type==="tableHead"?(a=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],d=su(f,e,i,s,n,d)):o[1]!==0&&(d=su(f,e,o,s,n,d)),s=0):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&Aw(f,e,l,c,u),f.consume(e.events),n=-1;++n<e.events.length;){const p=e.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=g9(e.events,n))}return t}function su(t,e,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Vo(e.events,n[0])),t.add(n[0],0,[["exit",i,e]]));const l=Vo(e.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",i,e]]),n[2]!==0){const c=Vo(e.events,n[2]),u=Vo(e.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const f=e.events[n[2]],p=e.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;t.add(m,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return s!==void 0&&(i.end=Object.assign({},Vo(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function Aw(t,e,n,r,s){const i=[],o=Vo(e.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,e])),r.end=Object.assign({},o),i.push(["exit",r,e]),t.add(n+1,0,i)}function Vo(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const v9={name:"tasklistCheck",tokenize:k9};function w9(){return{text:{91:v9}}}function k9(t,e,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),i)}function i(l){return vt(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return Re(l)?e(l):Xe(l)?t.check({tokenize:S9},e,n)(l):n(l)}}function S9(t,e,n){return nt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function E9(t){return r_([Jq(),i9(),h9(t),b9(),w9()])}const C9={};function H_(t){const e=this,n=t||C9,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(E9(n)),i.push(Wq()),o.push(qq(n))}function N9(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 _9(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
472
+ `}]}function T9(t,e){const n=e.value?e.value+`
473
+ `:"",r={};e.lang&&(r.className=["language-"+e.lang]);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 A9(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function M9(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function R9(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=Ha(r.toLowerCase()),i=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=i+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(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 O9(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 I9(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function U_(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 s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function D9(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return U_(t,e);const s={src:Ha(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function L9(t,e){const n={src:Ha(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 P9(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 j9(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return U_(t,e);const s={href:Ha(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function z9(t,e){const n={href:Ha(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 F9(t,e,n){const r=t.all(e),s=n?B9(n):V_(e),i={},o=[];if(typeof e.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(s||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
474
+ `}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
475
+ `});const c={type:"element",tagName:"li",properties:i,children:o};return t.patch(e,c),t.applyData(e,c)}function B9(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=V_(n[r])}return e}function V_(t){const e=t.spread;return e??t.children.length>1}function $9(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)}function H9(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function U9(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function V9(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const W_=q_("end"),qb=q_("start");function q_(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 W9(t){const e=qb(t),n=W_(t);if(e&&n)return{start:e,end:n}}function q9(t,e){const n=t.all(e),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=qb(e.children[1]),l=W_(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function K9(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const d=e.children[l],f={},p=o?o[l]:void 0;p&&(f.align=p);let m={type:"element",tagName:i,properties:f,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function G9(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const Mw=9,Rw=32;function J9(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),s=0;const i=[];for(;r;)i.push(Ow(e.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(Ow(e.slice(s),s>0,!1)),i.join("")}function Ow(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===Mw||i===Rw;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===Mw||i===Rw;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function Y9(t,e){const n={type:"text",value:J9(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Z9(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const X9={blockquote:N9,break:_9,code:T9,delete:A9,emphasis:M9,footnoteReference:R9,heading:O9,html:I9,imageReference:D9,image:L9,inlineCode:P9,linkReference:j9,link:z9,listItem:F9,list:$9,paragraph:H9,root:U9,strong:V9,table:q9,tableCell:G9,tableRow:K9,text:Y9,thematicBreak:Z9,toml:iu,yaml:iu,definition:iu,footnoteDefinition:iu};function iu(){}const K_=-1,Gf=0,Al=1,Dd=2,Kb=3,Gb=4,Jb=5,Yb=6,G_=7,J_=8,Iw=typeof self=="object"?self:globalThis,Q9=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,o]=e[s];switch(i){case Gf:case K_:return n(o,s);case Al:{const a=n([],s);for(const l of o)a.push(r(l));return a}case Dd:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case Kb:return n(new Date(o),s);case Gb:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case Jb:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case Yb:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case G_:{const{name:a,message:l}=o;return n(new Iw[a](l),s)}case J_:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new Iw[i](o),s)};return r},Dw=t=>Q9(new Map,t)(0),Lo="",{toString:e6}={},{keys:t6}=Object,tl=t=>{const e=typeof t;if(e!=="object"||!t)return[Gf,e];const n=e6.call(t).slice(8,-1);switch(n){case"Array":return[Al,Lo];case"Object":return[Dd,Lo];case"Date":return[Kb,Lo];case"RegExp":return[Gb,Lo];case"Map":return[Jb,Lo];case"Set":return[Yb,Lo];case"DataView":return[Al,n]}return n.includes("Array")?[Al,n]:n.includes("Error")?[G_,n]:[Dd,n]},ou=([t,e])=>t===Gf&&(e==="function"||e==="symbol"),n6=(t,e,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=tl(o);switch(a){case Gf:{let u=o;switch(l){case"bigint":a=J_,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([K_],o)}return s([a,u],o)}case Al:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),s([l,[...f]],o)}const u=[],d=s([a,u],o);for(const f of o)u.push(i(f));return d}case Dd:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());const u=[],d=s([a,u],o);for(const f of t6(o))(t||!ou(tl(o[f])))&&u.push([i(f),i(o[f])]);return d}case Kb:return s([a,o.toISOString()],o);case Gb:{const{source:u,flags:d}=o;return s([a,{source:u,flags:d}],o)}case Jb:{const u=[],d=s([a,u],o);for(const[f,p]of o)(t||!(ou(tl(f))||ou(tl(p))))&&u.push([i(f),i(p)]);return d}case Yb:{const u=[],d=s([a,u],o);for(const f of o)(t||!ou(tl(f)))&&u.push(i(f));return d}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},Lw=(t,{json:e,lossy:n}={})=>{const r=[];return n6(!(e||n),!!e,new Map,r)(t),r},Ld=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Dw(Lw(t,e)):structuredClone(t):(t,e)=>Dw(Lw(t,e));function r6(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function s6(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function i6(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||r6,r=t.options.footnoteBackLabel||s6,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const u=t.all(c),d=String(c.identifier).toUpperCase(),f=Ha(d.toLowerCase());let p=0;const m=[],g=t.footnoteCounts.get(d);for(;g!==void 0&&++p<=g;){m.length>0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(l,p);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const w=b.children[b.children.length-1];w&&w.type==="text"?w.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...m)}else u.push(...m);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+f},children:t.wrap(u,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ld(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
476
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
477
+ `}]}}const Km={}.hasOwnProperty,o6={};function a6(t,e){const n=e||o6,r=new Map,s=new Map,i=new Map,o={...X9,...n.handlers},a={all:c,applyData:c6,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:l6,wrap:d6};return Ub(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:s,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,p=a.handlers[f];if(Km.call(a.handlers,f)&&p)return p(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:g,...b}=u,y=Ld(b);return y.children=a.all(u),y}return Ld(u)}return(a.options.unknownHandler||u6)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let p=-1;for(;++p<f.length;){const m=a.one(f[p],u);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Pw(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=Pw(g.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function l6(t,e){t.position&&(e.position=W9(t))}function c6(t,e){let n=e;if(t&&t.data){const r=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Ld(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function u6(t,e){const n=e.data||{},r="value"in e&&!(Km.call(n,"hProperties")||Km.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function d6(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
478
+ `});++r<t.length;)r&&n.push({type:"text",value:`
479
+ `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
480
+ `}),n}function Pw(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function jw(t,e){const n=a6(t,e),r=n.one(t,void 0),s=i6(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
481
+ `},s),i}function Y_(t,e){return t&&"run"in t?async function(n,r){const s=jw(n,{file:r,...e});await t.run(s,r)}:function(n,r){return jw(n,{file:r,...t||e})}}const f6=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class _c{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}_c.prototype.normal={};_c.prototype.property={};_c.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new _c(n,r,e)}function Gm(t){return t.toLowerCase()}class Jn{constructor(e,n){this.attribute=n,this.property=e}}Jn.prototype.attribute="";Jn.prototype.booleanish=!1;Jn.prototype.boolean=!1;Jn.prototype.commaOrSpaceSeparated=!1;Jn.prototype.commaSeparated=!1;Jn.prototype.defined=!1;Jn.prototype.mustUseProperty=!1;Jn.prototype.number=!1;Jn.prototype.overloadedBoolean=!1;Jn.prototype.property="";Jn.prototype.spaceSeparated=!1;Jn.prototype.space=void 0;let h6=0;const Ue=Oo(),Vt=Oo(),Jm=Oo(),X=Oo(),Et=Oo(),sa=Oo(),Xn=Oo();function Oo(){return 2**++h6}const Ym=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ue,booleanish:Vt,commaOrSpaceSeparated:Xn,commaSeparated:sa,number:X,overloadedBoolean:Jm,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),gp=Object.keys(Ym);class Zb extends Jn{constructor(e,n,r,s){let i=-1;if(super(e,n),zw(this,"space",s),typeof r=="number")for(;++i<gp.length;){const o=gp[i];zw(this,gp[i],(r&Ym[o])===Ym[o])}}}Zb.prototype.defined=!0;function zw(t,e,n){n&&(t[e]=n)}function Ua(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const i=new Zb(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[Gm(r)]=r,n[Gm(i.attribute)]=r}return new _c(e,n,t.space)}const X_=Ua({properties:{ariaActiveDescendant:null,ariaAtomic:Vt,ariaAutoComplete:null,ariaBusy:Vt,ariaChecked:Vt,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Vt,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Vt,ariaFlowTo:Et,ariaGrabbed:Vt,ariaHasPopup:null,ariaHidden:Vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:X,ariaLive:null,ariaModal:Vt,ariaMultiLine:Vt,ariaMultiSelectable:Vt,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:Vt,ariaReadOnly:Vt,ariaRelevant:null,ariaRequired:Vt,ariaRoleDescription:Et,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:Vt,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Q_(t,e){return e in t?t[e]:e}function eT(t,e){return Q_(t,e.toLowerCase())}const p6=Ua({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:sa,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:Ue,allowPaymentRequest:Ue,allowUserMedia:Ue,alt:null,as:null,async:Ue,autoCapitalize:null,autoComplete:Et,autoFocus:Ue,autoPlay:Ue,blocking:Et,capture:null,charSet:null,checked:Ue,cite:null,className:Et,cols:X,colSpan:null,content:null,contentEditable:Vt,controls:Ue,controlsList:Et,coords:X|sa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ue,defer:Ue,dir:null,dirName:null,disabled:Ue,download:Jm,draggable:Vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ue,formTarget:null,headers:Et,height:X,hidden:Jm,high:X,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:Ue,inputMode:null,integrity:null,is:null,isMap:Ue,itemId:null,itemProp:Et,itemRef:Et,itemScope:Ue,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ue,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Ue,muted:Ue,name:null,nonce:null,noModule:Ue,noValidate:Ue,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:Ue,optimum:X,pattern:null,ping:Et,placeholder:null,playsInline:Ue,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ue,referrerPolicy:null,rel:Et,required:Ue,reversed:Ue,rows:X,rowSpan:X,sandbox:Et,scope:null,scoped:Ue,seamless:Ue,selected:Ue,shadowRootClonable:Ue,shadowRootDelegatesFocus:Ue,shadowRootMode:null,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:Vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Ue,useMap:null,value:Vt,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ue,declare:Ue,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Ue,noHref:Ue,noShade:Ue,noWrap:Ue,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:Vt,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ue,disableRemotePlayback:Ue,prefix:null,property:null,results:X,security:null,unselectable:null},space:"html",transform:eT}),m6=Ua({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:Xn,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,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:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Ue,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,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:sa,g2:sa,glyphName:sa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:Xn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,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:X,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:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xn,rev:Xn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xn,requiredFeatures:Xn,requiredFonts:Xn,requiredFormats:Xn,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:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:Xn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xn,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Q_}),tT=Ua({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()}}),nT=Ua({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:eT}),rT=Ua({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),g6={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"},b6=/[A-Z]/g,Fw=/-[a-z]/g,y6=/^data[-\w.:]+$/i;function sT(t,e){const n=Gm(e);let r=e,s=Jn;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&y6.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(Fw,v6);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!Fw.test(i)){let o=i.replace(b6,x6);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}s=Zb}return new s(r,e)}function x6(t){return"-"+t.toLowerCase()}function v6(t){return t.charAt(1).toUpperCase()}const iT=Z_([X_,p6,tT,nT,rT],"html"),Tc=Z_([X_,m6,tT,nT,rT],"svg"),w6=/["&'<>`]/g,k6=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,S6=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,E6=/[|\\{}()[\]^$+*?.]/g,Bw=new WeakMap;function C6(t,e){if(t=t.replace(e.subset?N6(e.subset):w6,r),e.subset||e.escapeOnly)return t;return t.replace(k6,n).replace(S6,r);function n(s,i,o){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function r(s,i,o){return e.format(s.charCodeAt(0),o.charCodeAt(i+1),e)}}function N6(t){let e=Bw.get(t);return e||(e=_6(t),Bw.set(t,e)),e}function _6(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(E6,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const T6=/[\dA-Fa-f]/;function A6(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!T6.test(String.fromCharCode(e))?r:r+";"}const M6=/\d/;function R6(t,e,n){const r="&#"+String(t);return n&&e&&!M6.test(String.fromCharCode(e))?r:r+";"}const O6=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],bp={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},I6=["cent","copy","divide","gt","lt","not","para","times"],oT={}.hasOwnProperty,Zm={};let au;for(au in bp)oT.call(bp,au)&&(Zm[bp[au]]=au);const D6=/[^\dA-Za-z]/;function L6(t,e,n,r){const s=String.fromCharCode(t);if(oT.call(Zm,s)){const i=Zm[s],o="&"+i;return n&&O6.includes(i)&&!I6.includes(i)&&(!r||e&&e!==61&&D6.test(String.fromCharCode(e)))?o:o+";"}return""}function P6(t,e,n){let r=A6(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=L6(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=R6(t,e,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function ia(t,e){return C6(t,Object.assign({format:P6},e))}const j6=/^>|^->|<!--|-->|--!>|<!-$/g,z6=[">"],F6=["<",">"];function B6(t,e,n,r){return r.settings.bogusComments?"<?"+ia(t.value,Object.assign({},r.settings.characterReferences,{subset:z6}))+">":"<!--"+t.value.replace(j6,s)+"-->";function s(i){return ia(i,Object.assign({},r.settings.characterReferences,{subset:F6}))}}function $6(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function aT(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function lT(t){return t.join(" ").trim()}const H6=/[ \t\n\f\r]/g;function Jf(t){return typeof t=="object"?t.type==="text"?$w(t.value):!1:$w(t)}function $w(t){return t.replace(H6,"")===""}const tn=uT(1),cT=uT(-1),U6=[];function uT(t){return e;function e(n,r,s){const i=n?n.children:U6;let o=(r||0)+t,a=i[o];if(!s)for(;a&&Jf(a);)o+=t,a=i[o];return a}}const V6={}.hasOwnProperty;function dT(t){return e;function e(n,r,s){return V6.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const Xb=dT({body:q6,caption:yp,colgroup:yp,dd:Y6,dt:J6,head:yp,html:W6,li:G6,optgroup:Z6,option:X6,p:K6,rp:Hw,rt:Hw,tbody:eK,td:Uw,tfoot:tK,th:Uw,thead:Q6,tr:nK});function yp(t,e,n){const r=tn(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Jf(r.value.charAt(0)))}function W6(t,e,n){const r=tn(n,e);return!r||r.type!=="comment"}function q6(t,e,n){const r=tn(n,e);return!r||r.type!=="comment"}function K6(t,e,n){const r=tn(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function G6(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&r.tagName==="li"}function J6(t,e,n){const r=tn(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Y6(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Hw(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Z6(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function X6(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Q6(t,e,n){const r=tn(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function eK(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function tK(t,e,n){return!tn(n,e)}function nK(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Uw(t,e,n){const r=tn(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const rK=dT({body:oK,colgroup:aK,head:iK,html:sK,tbody:lK});function sK(t){const e=tn(t,-1);return!e||e.type!=="comment"}function iK(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function oK(t){const e=tn(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Jf(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function aK(t,e,n){const r=cT(n,e),s=tn(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Xb(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function lK(t,e,n){const r=cT(n,e),s=tn(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Xb(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const lu={name:[[`
482
+ \f\r &/=>`.split(""),`
483
+ \f\r "&'/=>\``.split("")],[`\0
484
+ \f\r "&'/<=>`.split(""),`\0
485
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
486
+ \f\r &>`.split(""),`\0
487
+ \f\r "&'<=>\``.split("")],[`\0
488
+ \f\r "&'<=>\``.split(""),`\0
489
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function cK(t,e,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;s.space==="html"&&t.tagName==="svg"&&(r.schema=Tc);const c=uK(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(o=!1),(c||!i||!rK(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!Xb(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function uK(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const i=dK(t,s,e[s]);i&&n.push(i)}}for(;++r<n.length;){const i=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function dK(t,e,n){const r=sT(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1;let o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=ia(r.attribute,Object.assign({},t.settings.characterReferences,{subset:lu.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?aT:lT)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=ia(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:lu.unquoted[s][i]}))),a!==n&&(t.settings.quoteSmart&&Od(n,o)>Od(n,t.alternative)&&(o=t.alternative),a=o+ia(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?lu.single:lu.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const fK=["<","&"];function fT(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:ia(t.value,Object.assign({},r.settings.characterReferences,{subset:fK}))}function hK(t,e,n,r){return r.settings.allowDangerousHtml?t.value:fT(t,e,n,r)}function pK(t,e,n,r){return r.all(t)}const mK=tq("type",{invalid:gK,unknown:bK,handlers:{comment:B6,doctype:$6,element:cK,raw:hK,root:pK,text:fT}});function gK(t){throw new Error("Expected node, not `"+t+"`")}function bK(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const yK={},xK={},vK=[];function wK(t,e){const n=e||yK,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:kK,all:SK,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||f6,characterReferences:n.characterReferences||xK,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Tc:iT,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function kK(t,e,n){return mK(t,e,n,this)}function SK(t){const e=[],n=t&&t.children||vK;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function EK(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(s){return wK(s,n)}}function CK(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t}function Xm(t,e){return Array(e+1).join(t)}function hT(t){return t.replace(/^\n*/,"")}function pT(t){for(var e=t.length;e>0&&t[e-1]===`
490
+ `;)e--;return t.substring(0,e)}function mT(t){return pT(hT(t))}var NK=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Qb(t){return ey(t,NK)}var gT=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function bT(t){return ey(t,gT)}function _K(t){return xT(t,gT)}var yT=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function TK(t){return ey(t,yT)}function AK(t){return xT(t,yT)}function ey(t,e){return e.indexOf(t.nodeName)>=0}function xT(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var _n={};_n.paragraph={filter:"p",replacement:function(t){return`
491
+
492
+ `+t+`
493
+
494
+ `}};_n.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
495
+ `}};_n.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var s=Xm(r===1?"=":"-",t.length);return`
496
+
497
+ `+t+`
498
+ `+s+`
499
+
500
+ `}else return`
501
+
502
+ `+Xm("#",r)+" "+t+`
503
+
504
+ `}};_n.blockquote={filter:"blockquote",replacement:function(t){return t=mT(t).replace(/^/gm,"> "),`
505
+
506
+ `+t+`
507
+
508
+ `}};_n.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
509
+ `+t:`
510
+
511
+ `+t+`
512
+
513
+ `}};_n.listItem={filter:"li",replacement:function(t,e,n){var r=n.bulletListMarker+" ",s=e.parentNode;if(s.nodeName==="OL"){var i=s.getAttribute("start"),o=Array.prototype.indexOf.call(s.children,e);r=(i?Number(i)+o:o+1)+". "}var a=/\n$/.test(t);return t=mT(t)+(a?`
514
+ `:""),t=t.replace(/\n/gm,`
515
+ `+" ".repeat(r.length)),r+t+(e.nextSibling?`
516
+ `:"")}};_n.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return`
517
+
518
+ `+e.firstChild.textContent.replace(/\n/g,`
519
+ `)+`
520
+
521
+ `}};_n.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var r=e.firstChild.getAttribute("class")||"",s=(r.match(/language-(\S+)/)||[null,""])[1],i=e.firstChild.textContent,o=n.fence.charAt(0),a=3,l=new RegExp("^"+o+"{3,}","gm"),c;c=l.exec(i);)c[0].length>=a&&(a=c[0].length+1);var u=Xm(o,a);return`
522
+
523
+ `+u+s+`
524
+ `+i.replace(/\n$/,"")+`
525
+ `+u+`
526
+
527
+ `}};_n.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
528
+
529
+ `+n.hr+`
530
+
531
+ `}};_n.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=e.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var r=Pd(e.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+t+"]("+n+r+")"}};_n.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var r=e.getAttribute("href"),s=Pd(e.getAttribute("title"));s&&(s=' "'+s+'"');var i,o;switch(n.linkReferenceStyle){case"collapsed":i="["+t+"][]",o="["+t+"]: "+r+s;break;case"shortcut":i="["+t+"]",o="["+t+"]: "+r+s;break;default:var a=this.references.length+1;i="["+t+"]["+a+"]",o="["+a+"]: "+r+s}return this.references.push(o),i},references:[],append:function(t){var e="";return this.references.length&&(e=`
532
+
533
+ `+this.references.join(`
534
+ `)+`
535
+
536
+ `,this.references=[]),e}};_n.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};_n.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};_n.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};_n.image={filter:"img",replacement:function(t,e){var n=Pd(e.getAttribute("alt")),r=e.getAttribute("src")||"",s=Pd(e.getAttribute("title")),i=s?' "'+s+'"':"";return r?"!["+n+"]("+r+i+")":""}};function Pd(t){return t?t.replace(/(\n+\s*)+/g,`
537
+ `):""}function vT(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}vT.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=xp(this.array,t,this.options))||(e=xp(this._keep,t,this.options))||(e=xp(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function xp(t,e,n){for(var r=0;r<t.length;r++){var s=t[r];if(MK(s,e,n))return s}}function MK(t,e,n){var r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function RK(t){var e=t.element,n=t.isBlock,r=t.isVoid,s=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||s(e))){for(var i=null,o=!1,a=null,l=Vw(a,e,s);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!o&&c[0]===" "&&(c=c.substr(1)),!c){l=vp(l);continue}l.data=c,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,o=!1):r(l)||s(l)?(i=null,o=!0):i&&(o=!1);else{l=vp(l);continue}var u=Vw(a,l,s);a=l,l=u}i&&(i.data=i.data.replace(/ $/,""),i.data||vp(i))}}function vp(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function Vw(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var ty=typeof window<"u"?window:{};function OK(){var t=ty.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function IK(){var t=function(){};return DK()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function DK(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{ty.ActiveXObject&&(t=!0)}return t}var LK=OK()?ty.DOMParser:IK();function PK(t,e){var n;if(typeof t=="string"){var r=jK().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return RK({element:n,isBlock:Qb,isVoid:bT,isPre:e.preformattedCode?zK:null}),n}var wp;function jK(){return wp=wp||new LK,wp}function zK(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function FK(t,e){return t.isBlock=Qb(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=BK(t),t.flankingWhitespace=$K(t,e),t}function BK(t){return!bT(t)&&!TK(t)&&/^\s*$/i.test(t.textContent)&&!_K(t)&&!AK(t)}function $K(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=HK(t.textContent);return n.leadingAscii&&Ww("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Ww("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function HK(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function Ww(t,e,n){var r,s,i;return t==="left"?(r=e.previousSibling,s=/ $/):(r=e.nextSibling,s=/^ /),r&&(r.nodeType===3?i=s.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Qb(r)&&(i=s.test(r.textContent))),i}var UK=Array.prototype.reduce,VK=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function jd(t){if(!(this instanceof jd))return new jd(t);var e={rules:_n,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
538
+
539
+ `:""},keepReplacement:function(n,r){return r.isBlock?`
540
+
541
+ `+r.outerHTML+`
542
+
543
+ `:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?`
544
+
545
+ `+n+`
546
+
547
+ `:n}};this.options=CK({},e,t),this.rules=new vT(this.options)}jd.prototype={turndown:function(t){if(!KK(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=wT.call(this,new PK(t,this.options));return WK.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return VK.reduce(function(e,n){return e.replace(n[0],n[1])},t)}};function wT(t){var e=this;return UK.call(t.childNodes,function(n,r){r=new FK(r,e.options);var s="";return r.nodeType===3?s=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(s=qK.call(e,r)),kT(n,s)},"")}function WK(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=kT(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function qK(t){var e=this.rules.forNode(t),n=wT.call(this,t),r=t.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+e.replacement(n,t,this.options)+r.trailing}function kT(t,e){var n=pT(t),r=hT(e),s=Math.max(t.length-n.length,e.length-r.length),i=`
548
+
549
+ `.substring(0,s);return n+i+r}function KK(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}function GK(t){var o;if(!t)return[];const e=t.split(`
550
+ `),n=[];let r=!1,s=!1,i=!1;for(let a=0;a<e.length;a++){const c=e[a].trim();if(c.startsWith("```"))if(r=!r,r){n.push(a+1),i=!0,s=!1;continue}else{s=!1;continue}if(r)continue;if(!c){s=!1;continue}const u=/^#{1,6}\s/.test(c),d=/^[-*+]\s/.test(c),f=/^\d+\.\s/.test(c),p=c.startsWith(">"),m=/^[-*_]{3,}$/.test(c);if(d||f){s||(n.push(a+1),i=!0,s=!0);continue}s=!1,(u||p||m||!i||!((o=e[a-1])!=null&&o.trim()))&&(n.push(a+1),i=!0)}return n}var Qm,eg;if(typeof WeakMap<"u"){let t=new WeakMap;Qm=e=>t.get(e),eg=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Qm=r=>{for(let s=0;s<t.length;s+=2)if(t[s]==r)return t[s+1]},eg=(r,s)=>(n==10&&(n=0),t[n++]=r,t[n++]=s)}var Ft=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,s=e/this.width|0;let i=r+1,o=s+1;for(let a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:s,right:i,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:s,top:i,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(t,e){const{left:n,right:r,top:s,bottom:i}=this.findCell(t),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(s,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let s=t.left;s<t.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==t.left&&s&&this.map[i-1]==o||r==t.top&&r&&this.map[i-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<s;)o++;return o==a?i-1:this.map[o]}s=i}}static get(t){return Qm(t)||eg(t,JK(t))}};function JK(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=YK(t),n=t.childCount,r=[];let s=0,i=null;const o=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==d.childCount)break;const g=d.child(m),{colspan:b,rowspan:y,colwidth:w}=g.attrs;for(let v=0;v<y;v++){if(v+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-v});break}const k=s+v*e;for(let N=0;N<b;N++){r[k+N]==0?r[k+N]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:b-N});const S=w&&w[N];if(S){const C=(k+N)%e*2,_=o[C];_==null||_!=S&&o[C+1]==1?(o[C]=S,o[C+1]=1):_==S&&o[C+1]++}}}s+=b,u+=g.nodeSize}const f=(c+1)*e;let p=0;for(;s<f;)r[s++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new Ft(e,n,r,i);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(l=!0);return l&&ZK(a,o,t),a}function YK(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const s=t.child(r);let i=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const a=s.child(o);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function ZK(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s<t.map.length;s++){const i=t.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=(s+c)%t.width,d=e[u*2];d!=null&&(!l.colwidth||l.colwidth[c]!=d)&&((a||(a=XK(l)))[c]=d)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function XK(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function En(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],s=r.spec.tableRole;s&&(e[s]=r)}}return e}var Ys=new Ht("selectingCells");function Va(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function QK(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function jr(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Yf(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Va(e.$head)||eG(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function eG(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function tg(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function tG(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ny(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function ST(t,e,n){const r=t.node(-1),s=Ft.get(r),i=t.start(-1),o=s.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function Eo(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function ET(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(e,0,0)}return r}function nG(t,e,n){const r=En(e.type.schema).header_cell;for(let s=0;s<t.height;s++)if(e.nodeAt(t.map[n+s*t.width]).type!=r)return!1;return!0}var Nt=class fs extends De{constructor(e,n=e){const r=e.node(-1),s=Ft.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,n.pos-i),a=e.node(0),l=s.cellsInRect(o).filter(u=>u!=n.pos-i);l.unshift(n.pos-i);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new RC(a.resolve(f),a.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(tg(r)&&tg(s)&&ny(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?fs.rowSelection(r,s):i&&this.isColSelection()?fs.colSelection(r,s):new fs(r,s)}return Ae.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=Ft.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let l=s.top;l<s.bottom;l++){const c=[];for(let u=l*n.width+s.left,d=s.left;d<s.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=s.left-p.left,b=p.right-s.right;if(g>0||b>0){let y=m.attrs;if(g>0&&(y=Eo(y,0,g)),b>0&&(y=Eo(y,y.colspan-b,b)),p.left<s.left){if(m=m.type.createAndFill(y),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(p.top<s.top||p.bottom>s.bottom){const y={...m.attrs,rowspan:Math.min(p.bottom,s.bottom)-Math.max(p.top,s.top)};p.top<s.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}c.push(m)}o.push(e.child(l).copy(K.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new ae(K.from(a),1,1)}replace(e,n=ae.empty){const r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:a,$to:l}=s[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?ae.empty:n)}const i=De.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new ae(K.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ft.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(n.nodeAt(i[o]),s+i[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=Ft.get(r),i=e.start(-1),o=s.findCell(e.pos-i),a=s.findCell(n.pos-i),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(i+s.map[o.left])),a.bottom<s.height&&(n=l.resolve(i+s.map[s.width*(s.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+s.map[a.left])),o.bottom<s.height&&(e=l.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new fs(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ft.get(e),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof fs&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=Ft.get(r),i=e.start(-1),o=s.findCell(e.pos-i),a=s.findCell(n.pos-i),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(i+s.map[o.top*s.width])),a.right<s.width&&(n=l.resolve(i+s.map[s.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+s.map[a.top*s.width])),o.right<s.width&&(e=l.resolve(i+s.map[s.width*(o.top+1)-1]))),new fs(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new fs(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new fs(e.resolve(n),e.resolve(r))}getBookmark(){return new rG(this.$anchorCell.pos,this.$headCell.pos)}};Nt.prototype.visible=!1;De.jsonID("cell",Nt);var rG=class CT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new CT(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&ny(n,r)?new Nt(n,r):De.near(r,1)}};function sG(t){if(!(t.selection instanceof Nt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Qt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),yt.create(t.doc,e)}function iG({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,s=t.depth;for(;s>=0&&!(t.after(s+1)<t.end(s));s--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function oG({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const i=t.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let s=e.depth;s>0;s--){const i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function aG(t,e,n){const r=(e||t).selection,s=(e||t).doc;let i,o;if(r instanceof Ee&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=Nt.create(s,r.from);else if(o=="row"){const a=s.resolve(r.from+1);i=Nt.rowSelection(a,a)}else if(!n){const a=Ft.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=Nt.create(s,l+1,c)}}else r instanceof Ae&&iG(r)?i=Ae.create(s,r.from):r instanceof Ae&&oG(r)&&(i=Ae.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var lG=new Ht("fix-tables");function NT(t,e,n,r){const s=t.childCount,i=e.childCount;e:for(let o=0,a=0;o<i;o++){const l=e.child(o);for(let c=a,u=Math.min(s,o+3);c<u;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<s&&t.child(a).sameMarkup(l)?NT(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function _T(t,e){let n;const r=(s,i)=>{s.type.spec.tableRole=="table"&&(n=cG(t,s,i,n))};return e?e.doc!=t.doc&&NT(e.doc,t.doc,0,r):t.doc.descendants(r),n}function cG(t,e,n,r){const s=Ft.get(e);if(!s.problems)return r;r||(r=t.tr);const i=[];for(let l=0;l<s.height;l++)i.push(0);for(let l=0;l<s.problems.length;l++){const c=s.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Eo(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let o,a;for(let l=0;l<i.length;l++)i[l]&&(o==null&&(o=l),a=l);for(let l=0,c=n+1;l<s.height;l++){const u=e.child(l),d=c+u.nodeSize,f=i[l];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<f;b++){const y=En(t.schema)[p].createAndFill();y&&m.push(y)}const g=(l==0||o==l-1)&&a==l?c+1:d-1;r.insert(r.mapping.map(g),m)}c=d}return r.setMeta(lG,{fixTables:!0})}function ts(t){const e=t.selection,n=Yf(t),r=n.node(-1),s=n.start(-1),i=Ft.get(r);return{...e instanceof Nt?i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function TT(t,{map:e,tableStart:n,table:r},s){let i=s>0?-1:0;nG(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+s;if(s>0&&s<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,ET(c.attrs,s-e.colCount(l))),o+=c.attrs.rowspan-1}else{const l=i==null?En(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(o,s,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function uG(t,e){if(!jr(t))return!1;if(e){const n=ts(t);e(TT(t.tr,n,n.left))}return!0}function dG(t,e){if(!jr(t))return!1;if(e){const n=ts(t);e(TT(t.tr,n,n.right))}return!0}function fG(t,{map:e,table:n,tableStart:r},s){const i=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+s,l=e.map[a],c=n.nodeAt(l),u=c.attrs;if(s>0&&e.map[a-1]==l||s<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(r+l),null,Eo(u,s-e.colCount(l)));else{const d=t.mapping.slice(i).map(r+l);t.delete(d,d+c.nodeSize)}o+=u.rowspan}}function hG(t,e){if(!jr(t))return!1;if(e){const n=ts(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;fG(r,n,s),s!=n.left;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Ft.get(i)}e(r)}return!0}function pG(t,e,n){var r;const s=En(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))==null?void 0:r.type)!=s)return!1;return!0}function AT(t,{map:e,tableStart:n,table:r},s){var i;let o=n;for(let c=0;c<s;c++)o+=r.child(c).nodeSize;const a=[];let l=s>0?-1:0;pG(e,r,s+l)&&(l=s==0||s==e.height?null:0);for(let c=0,u=e.width*s;c<e.width;c++,u++)if(s>0&&s<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=l==null?En(r.type.schema).cell:(i=r.nodeAt(e.map[u+l*e.width]))==null?void 0:i.type,f=d==null?void 0:d.createAndFill();f&&a.push(f)}return t.insert(o,En(r.type.schema).row.create(null,a)),t}function mG(t,e){if(!jr(t))return!1;if(e){const n=ts(t);e(AT(t.tr,n,n.top))}return!0}function gG(t,e){if(!jr(t))return!1;if(e){const n=ts(t);e(AT(t.tr,n,n.bottom))}return!0}function bG(t,{map:e,table:n,tableStart:r},s){let i=0;for(let c=0;c<s;c++)i+=n.child(c).nodeSize;const o=i+n.child(s).nodeSize,a=t.mapping.maps.length;t.delete(i+r,o+r);const l=new Set;for(let c=0,u=s*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),s>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(s<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(s+1,c,n);t.insert(t.mapping.slice(a).map(r+g),m),c+=p.colspan-1}}}}function yG(t,e){if(!jr(t))return!1;if(e){const n=ts(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;bG(r,n,s),s!=n.top;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Ft.get(n.table)}e(r)}return!0}function qw(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function xG({width:t,height:e,map:n},r){let s=r.top*t+r.left,i=s,o=(r.bottom-1)*t+r.left,a=s+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[a]==n[a+1])return!0;i+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[s]==n[s-t]||r.bottom<e&&n[o]==n[o+t])return!0;s++,o++}return!1}function Kw(t,e){const n=t.selection;if(!(n instanceof Nt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=ts(t),{map:s}=r;if(xG(s,r))return!1;if(e){const i=t.tr,o={};let a=K.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=s.map[u*s.width+d],p=r.table.nodeAt(f);if(!(o[f]||!p))if(o[f]=!0,l==null)l=f,c=p;else{qw(p)||(a=a.append(p.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+p.nodeSize)}}if(l==null||c==null)return!0;if(i.setNodeMarkup(l+r.tableStart,null,{...ET(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const u=l+1+c.content.size,d=qw(c)?l+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,a)}i.setSelection(new Nt(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function Gw(t,e){const n=En(t.schema);return vG(({node:r})=>n[r.type.spec.tableRole])(t,e)}function vG(t){return(e,n)=>{var r;const s=e.selection;let i,o;if(s instanceof Nt){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;i=s.$anchorCell.nodeAfter,o=s.$anchorCell.pos}else{if(i=QK(s.$from),!i)return!1;o=(r=Va(s.$from))==null?void 0:r.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=ts(e),d=e.tr;for(let p=0;p<u.right-u.left;p++)l.push(c?{...a,colwidth:c&&c[p]?[c[p]]:null}:a);let f;for(let p=u.top;p<u.bottom;p++){let m=u.map.positionAt(p,u.left,u.table);p==u.top&&(m+=i.nodeSize);for(let g=u.left,b=0;g<u.right;g++,b++)g==u.left&&p==u.top||d.insert(f=d.mapping.map(m+u.tableStart,1),t({node:i,row:p,col:g}).createAndFill(l[b]))}d.setNodeMarkup(o,t({node:i,row:u.top,col:u.left}),l[0]),s instanceof Nt&&d.setSelection(new Nt(d.doc.resolve(s.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function wG(t,e){return function(n,r){if(!jr(n))return!1;const s=Yf(n);if(s.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof Nt?n.selection.forEachCell((o,a)=>{o.attrs[t]!==e&&i.setNodeMarkup(a,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function kG(t){return function(e,n){if(!jr(e))return!1;if(n){const r=En(e.schema),s=ts(e),i=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),a=o.map(l=>s.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<o.length;l++)i.setNodeMarkup(s.tableStart+o[l],r.header_cell,a[l].attrs);n(i)}return!0}}function Jw(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function Yl(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?kG(t):function(n,r){if(!jr(n))return!1;if(r){const s=En(n.schema),i=ts(n),o=n.tr,a=Jw("row",i,s),l=Jw("column",i,s),u=(t==="column"?a:t==="row"?l:!1)?1:0,d=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?l?s.cell:s.header_cell:t=="row"?a?s.cell:s.header_cell:s.cell;i.map.cellsInRect(d).forEach(p=>{const m=p+i.tableStart,g=o.doc.nodeAt(m);g&&o.setNodeMarkup(m,f,g.attrs)}),r(o)}return!0}}Yl("row",{useDeprecatedLogic:!0});Yl("column",{useDeprecatedLogic:!0});var SG=Yl("cell",{useDeprecatedLogic:!0});function EG(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return s-1-o.nodeSize;s-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),s=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}return null}function Yw(t){return function(e,n){if(!jr(e))return!1;const r=EG(Yf(e),t);if(r==null)return!1;if(n){const s=e.doc.resolve(r);n(e.tr.setSelection(Ae.between(s,tG(s))).scrollIntoView())}return!0}}function CG(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function cu(t,e){const n=t.selection;if(!(n instanceof Nt))return!1;if(e){const r=t.tr,s=En(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ae(s,0,0))}),r.docChanged&&e(r)}return!0}function NG(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),i=s.type.spec.tableRole,o=s.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=ng(En(o).row,new ae(c,u,d)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(n||r?ng(En(o).row,new ae(e,n,r)).content:e);else return null;return _G(o,a)}function _G(t,e){const n=[];for(let s=0;s<e.length;s++){const i=e[s];for(let o=i.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=i.child(o).attrs;for(let c=s;c<s+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,n[s]);for(let s=0;s<n.length;s++)if(s>=e.length&&e.push(K.empty),n[s]<r){const i=En(t).cell.createAndFill(),o=[];for(let a=n[s];a<r;a++)o.push(i);e[s]=e[s].append(K.from(o))}return{height:e.length,width:r,rows:e}}function ng(t,e){const n=t.createAndFill();return new Xg(n).replace(0,n.content.size,e).doc}function TG({width:t,height:e,rows:n},r,s){if(t!=r){const i=[],o=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=i[a]||0,d=0;u<r;d++){let f=l.child(d%l.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Eo(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[a+p]=(i[a+p]||0)+f.attrs.colspan}o.push(K.from(c))}n=o,t=r}if(e!=s){const i=[];for(let o=0,a=0;o<s;o++,a++){const l=[],c=n[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>s&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,s-d.attrs.rowspan)},d.content)),l.push(d)}i.push(K.from(l))}n=i,e=s}return{width:t,height:e,rows:n}}function AG(t,e,n,r,s,i,o){const a=t.doc.type.schema,l=En(a);let c,u;if(s>e.width)for(let d=0,f=0;d<e.height;d++){const p=n.child(d);f+=p.nodeSize;const m=[];let g;p.lastChild==null||p.lastChild.type==l.cell?g=c||(c=l.cell.createAndFill()):g=u||(u=l.header_cell.createAndFill());for(let b=e.width;b<s;b++)m.push(g);t.insert(t.mapping.slice(o).map(f-1+r),m)}if(i>e.height){const d=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,s);m++){const b=m>=e.width?!1:n.nodeAt(e.map[g+m]).type==l.header_cell;d.push(b?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const f=l.row.create(null,K.from(d)),p=[];for(let m=e.height;m<i;m++)p.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),p)}return!!(c||u)}function Zw(t,e,n,r,s,i,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=s;c<i;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const f=n.nodeAt(d),{top:p,left:m}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...f.attrs,rowspan:o-p}),t.insert(t.mapping.slice(a).map(e.positionAt(o,m,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return l}function Xw(t,e,n,r,s,i,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=s;c<i;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){l=!0;const f=n.nodeAt(d),p=e.colCount(d),m=t.mapping.slice(a).map(d+r);t.setNodeMarkup(m,null,Eo(f.attrs,o-p,f.attrs.colspan-(o-p))),t.insert(m+f.nodeSize,f.type.createAndFill(Eo(f.attrs,0,o-p))),c+=f.attrs.rowspan-1}}return l}function Qw(t,e,n,r,s){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let o=Ft.get(i);const{top:a,left:l}=r,c=l+s.width,u=a+s.height,d=t.tr;let f=0;function p(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");o=Ft.get(i),f=d.mapping.maps.length}AG(d,o,i,n,c,u,f)&&p(),Zw(d,o,i,n,l,c,a,f)&&p(),Zw(d,o,i,n,l,c,u,f)&&p(),Xw(d,o,i,n,a,u,l,f)&&p(),Xw(d,o,i,n,a,u,c,f)&&p();for(let m=a;m<u;m++){const g=o.positionAt(m,l,i),b=o.positionAt(m,c,i);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(b+n),new ae(s.rows[m-a],0,0))}p(),d.setSelection(new Nt(d.doc.resolve(n+o.positionAt(a,l,i)),d.doc.resolve(n+o.positionAt(u-1,c-1,i)))),e(d)}var MG=pb({ArrowLeft:uu("horiz",-1),ArrowRight:uu("horiz",1),ArrowUp:uu("vert",-1),ArrowDown:uu("vert",1),"Shift-ArrowLeft":du("horiz",-1),"Shift-ArrowRight":du("horiz",1),"Shift-ArrowUp":du("vert",-1),"Shift-ArrowDown":du("vert",1),Backspace:cu,"Mod-Backspace":cu,Delete:cu,"Mod-Delete":cu});function Nu(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function uu(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof Nt)return Nu(n,r,De.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=MT(s,t,e);if(o==null)return!1;if(t=="horiz")return Nu(n,r,De.near(n.doc.resolve(i.head+e),e));{const a=n.doc.resolve(o),l=ST(a,t,e);let c;return l?c=De.near(l,1):e<0?c=De.near(n.doc.resolve(a.before(-1)),-1):c=De.near(n.doc.resolve(a.after(-1)),1),Nu(n,r,c)}}}function du(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof Nt)o=i;else{const l=MT(s,t,e);if(l==null)return!1;o=new Nt(n.doc.resolve(l))}const a=ST(o.$headCell,t,e);return a?Nu(n,r,new Nt(o.$anchorCell,a)):!1}}function RG(t,e){const n=t.state.doc,r=Va(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Nt(r))),!0):!1}function OG(t,e,n){if(!jr(t.state))return!1;let r=NG(n);const s=t.state.selection;if(s instanceof Nt){r||(r={width:1,height:1,rows:[K.from(ng(En(t.state.schema).cell,n))]});const i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),a=Ft.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=TG(r,a.right-a.left,a.bottom-a.top),Qw(t.state,t.dispatch,o,a,r),!0}else if(r){const i=Yf(t.state),o=i.start(-1);return Qw(t.state,t.dispatch,o,Ft.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function IG(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=e0(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof Nt)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Va(t.state.selection.$anchor))!=null&&((n=kp(t,e))==null?void 0:n.pos)!=s.pos)i(s,e),e.preventDefault();else if(!r)return;function i(l,c){let u=kp(t,c);const d=Ys.getState(t.state)==null;if(!u||!ny(l,u))if(d)u=l;else return;const f=new Nt(l,u);if(d||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);d&&p.setMeta(Ys,l.pos),t.dispatch(p)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Ys.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ys,-1))}function a(l){const c=l,u=Ys.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(e0(t,c.target)!=r&&(d=kp(t,e),!d))return o();d&&i(d,c)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function MT(t,e,n){if(!(t.state.selection instanceof Ae))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const a=r.before(s),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}function e0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function kp(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Va(t.state.doc.resolve(n.pos)):null}var DG=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),rg(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,rg(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function rg(t,e,n,r,s,i){var o;let a=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let g=0;g<p;g++,f++){const b=s==f?i:m&&m[g],y=b?b+"px":"";if(a+=b||r,b||(l=!1),c)c.style.width!=y&&(c.style.width=y),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=y,e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=d}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var nr=new Ht("tableColumnResizing");function LG({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=DG,lastColumnResizable:s=!0}={}){const i=new Mt({key:nr,state:{init(o,a){var l,c;const u=(c=(l=i.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,d=En(a.schema).table.name;return r&&u&&(u[d]=(f,p)=>new r(f,n,p)),new PG(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=nr.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{jG(o,a,t,s)},mouseleave:o=>{zG(o)},mousedown:(o,a)=>{FG(o,a,e,n)}},decorations:o=>{const a=nr.getState(o);if(a&&a.activeHandle>-1)return VG(o,a.activeHandle)},nodeViews:{}}});return i}var PG=class _u{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(nr);if(r&&r.setHandle!=null)return new _u(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new _u(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return tg(e.doc.resolve(s))||(s=-1),new _u(s,n.dragging)}return n}};function jG(t,e,n,r){if(!t.editable)return;const s=nr.getState(t.state);if(s&&!s.dragging){const i=$G(e.target);let o=-1;if(i){const{left:a,right:l}=i.getBoundingClientRect();e.clientX-a<=n?o=t0(t,e,"left",n):l-e.clientX<=n&&(o=t0(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),l=a.node(-1),c=Ft.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}RT(t,o)}}}function zG(t){if(!t.editable)return;const e=nr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&RT(t,-1)}function FG(t,e,n,r){var s;if(!t.editable)return!1;const i=(s=t.dom.ownerDocument.defaultView)!=null?s:window,o=nr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),l=BG(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(nr,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=nr.getState(t.state);f!=null&&f.dragging&&(HG(t,f.activeHandle,n0(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(nr,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=nr.getState(t.state);if(f&&f.dragging){const p=n0(f.dragging,d,n);r0(t,f.activeHandle,p,r)}}return r0(t,o.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function BG(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const i=t.domAtPos(e);let a=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function $G(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function t0(t,e,n,r){const s=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+s,top:e.clientY});if(!i)return-1;const{pos:o}=i,a=Va(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const l=Ft.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function n0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function RT(t,e){t.dispatch(t.state.tr.setMeta(nr,{setHandle:e}))}function HG(t,e,n){const r=t.state.doc.resolve(e),s=r.node(-1),i=Ft.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=s.nodeAt(d).attrs,p=f.colspan==1?0:a-i.colCount(d);if(f.colwidth&&f.colwidth[p]==n)continue;const m=f.colwidth?f.colwidth.slice():UG(f.colspan);m[p]=n,l.setNodeMarkup(o+d,null,{...f,colwidth:m})}l.docChanged&&t.dispatch(l)}function r0(t,e,n,r){const s=t.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),a=Ft.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1;let l=t.domAtPos(s.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&rg(i,l.firstChild,l,r,a,n)}function UG(t){return Array(t).fill(0)}function VG(t,e){var n;const r=[],s=t.doc.resolve(e),i=s.node(-1);if(!i)return yt.empty;const o=Ft.get(i),a=s.start(-1),l=o.colCount(s.pos-a)+s.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const u=l+c*o.width;if((l==o.width-1||o.map[u]!=o.map[u+1])&&(c==0||o.map[u]!=o.map[u-o.width])){const d=o.map[u],f=a+d+i.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=nr.getState(t))!=null&&n.dragging&&r.push(Qt.node(a+d,a+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Qt.widget(f,p))}}return yt.create(t.doc,r)}function WG({allowTableNodeSelection:t=!1}={}){return new Mt({key:Ys,state:{init(){return null},apply(e,n){const r=e.getMeta(Ys);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:s,pos:i}=e.mapping.mapResult(n);return s?null:i}},props:{decorations:sG,handleDOMEvents:{mousedown:IG},createSelectionBetween(e){return Ys.getState(e.state)!=null?e.state.selection:null},handleTripleClick:RG,handleKeyDown:MG,handlePaste:OG},appendTransaction(e,n,r){return aG(r,_T(r,n),t)}})}var OT=en.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(i=>parseInt(i,10)):null;if(!s){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const a=i[o].getAttribute("width");return a?[parseInt(a,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",_t(this.options.HTMLAttributes,t),0]}}),IT=en.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",_t(this.options.HTMLAttributes,t),0]}}),DT=en.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",_t(this.options.HTMLAttributes,t),0]}});function sg(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function s0(t,e,n,r,s,i){var o;let a=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let f=0,p=0;f<u.childCount;f+=1){const{colspan:m,colwidth:g}=u.child(f).attrs;for(let b=0;b<m;b+=1,p+=1){const y=s===p?i:g&&g[b],w=y?`${y}px`:"";if(a+=y||r,y||(l=!1),c){if(c.style.width!==w){const[v,k]=sg(r,y);c.style.setProperty(v,k)}c=c.nextSibling}else{const v=document.createElement("col"),[k,N]=sg(r,y);v.style.setProperty(k,N),e.appendChild(v)}}}for(;c;){const f=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=f}const d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!d?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var qG=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),s0(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,s0(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function KG(t,e,n,r){let s=0,i=!0;const o=[],a=t.firstChild;if(!a)return{};for(let d=0,f=0;d<a.childCount;d+=1){const{colspan:p,colwidth:m}=a.child(d).attrs;for(let g=0;g<p;g+=1,f+=1){const b=n===f?r:m&&m[g];s+=b||e,b||(i=!1);const[y,w]=sg(e,b);o.push(["col",{style:`${y}: ${w}`}])}}const l=i?`${s}px`:"",c=i?"":`${s}px`;return{colgroup:["colgroup",{},...o],tableWidth:l,tableMinWidth:c}}function i0(t,e){return t.createAndFill()}function GG(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function JG(t,e,n,r,s){const i=GG(t),o=[],a=[];for(let c=0;c<n;c+=1){const u=i0(i.cell);if(u&&a.push(u),r){const d=i0(i.header_cell);d&&o.push(d)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?o:a));return i.table.createChecked(null,l)}function YG(t){return t instanceof Nt}var fu=({editor:t})=>{const{selection:e}=t.state;if(!YG(e))return!1;let n=0;const r=L1(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},ZG="";function XG(t){return(t||"").replace(/\s+/g," ").trim()}function QG(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:ZG;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(m=>{const g=[];m.content&&m.content.forEach(b=>{let y="";b.content&&Array.isArray(b.content)&&b.content.length>1?y=b.content.map(N=>e.renderChildren(N)).join(s):y=b.content?e.renderChildren(b.content):"";const w=XG(y),v=b.type==="tableHeader";g.push({text:w,isHeader:v})}),i.push(g)});const o=i.reduce((m,g)=>Math.max(m,g.length),0);if(o===0)return"";const a=new Array(o).fill(0);i.forEach(m=>{var g;for(let b=0;b<o;b+=1){const w=(((g=m[b])==null?void 0:g.text)||"").length;w>a[b]&&(a[b]=w),a[b]<3&&(a[b]=3)}});const l=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),c=i[0],u=c.some(m=>m.isHeader);let d=`
551
+ `;const f=new Array(o).fill(0).map((m,g)=>u&&c[g]&&c[g].text||"");return d+=`| ${f.map((m,g)=>l(m,a[g])).join(" | ")} |
552
+ `,d+=`| ${a.map(m=>"-".repeat(Math.max(3,m))).join(" | ")} |
553
+ `,(u?i.slice(1):i).forEach(m=>{d+=`| ${new Array(o).fill(0).map((g,b)=>l(m[b]&&m[b].text||"",a[b])).join(" | ")} |
554
+ `}),d}var e8=QG,LT=en.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:qG,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=KG(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const a=["table",_t(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},a]:a},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(s=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const s=[];r.forEach(i=>{s.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>e8(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=JG(i.schema,t,e,n);if(s){const a=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Ae.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>uG(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>dG(t,e),deleteColumn:()=>({state:t,dispatch:e})=>hG(t,e),addRowBefore:()=>({state:t,dispatch:e})=>mG(t,e),addRowAfter:()=>({state:t,dispatch:e})=>gG(t,e),deleteRow:()=>({state:t,dispatch:e})=>yG(t,e),deleteTable:()=>({state:t,dispatch:e})=>CG(t,e),mergeCells:()=>({state:t,dispatch:e})=>Kw(t,e),splitCell:()=>({state:t,dispatch:e})=>Gw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Yl("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Yl("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>SG(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Kw(t,e)?!0:Gw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>wG(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Yw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Yw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&_T(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Nt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:fu,"Mod-Backspace":fu,Delete:fu,"Mod-Delete":fu}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[LG({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],WG({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:lt(Ne(t,"tableRole",e))}}});It.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(LT.configure(this.options.table)),this.options.tableCell!==!1&&t.push(OT.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(IT.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(DT.configure(this.options.tableRow)),t}});var t8=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,n8=en.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",_t(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,o;const a=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",l=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return c?`![${l}](${a} "${c}")`:`![${l}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u"||!this.editor.isEditable)return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o})=>{const a=document.createElement("img");Object.entries(o).forEach(([u,d])=>{if(d!=null)switch(u){case"width":case"height":break;default:a.setAttribute(u,d);break}}),a.src=o.src;const l=new W$({element:a,node:s,getPos:i,onResize:(u,d)=>{a.style.width=`${u}px`,a.style.height=`${d}px`},onCommit:(u,d)=>{const f=i();f!==void 0&&this.editor.chain().setNodeSelection(f).updateAttributes(this.name,{width:u,height:d}).run()},onUpdate:(u,d,f)=>u.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),c=l.dom;return c.style.visibility="hidden",c.style.pointerEvents="none",a.onload=()=>{c.style.visibility="",c.style.pointerEvents=""},l}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[rN({find:t8,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),r8=n8;function s8({editor:t,getPos:e}){const n=()=>{const o=e();if(typeof o=="number")try{const a=t.state.doc.resolve(o+1);let l=o+1;return a.node(a.depth).descendants((u,d)=>u.type.name==="tableCell"||u.type.name==="tableHeader"?(l=o+1+d+1,!1):!0),t.chain().focus().setTextSelection(l).run(),!0}catch(a){return console.error("Failed to select table cell:",a),!1}return!1},r=()=>{if(console.log("addRowBelow called"),n()){const o=t.chain().focus().addRowAfter().run();console.log("addRowAfter result:",o)}},s=()=>{if(console.log("addColumnRight called"),n()){const o=t.chain().focus().addColumnAfter().run();console.log("addColumnAfter result:",o)}},i=()=>{if(console.log("deleteTable called"),n()){const o=t.chain().focus().deleteTable().run();console.log("deleteTable result:",o)}};return h.jsxs(lN,{className:"group relative my-4 inline-block",children:[h.jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 top-0 flex flex-col justify-center opacity-0 transition-opacity group-hover:opacity-100",children:h.jsx("div",{className:"pointer-events-auto flex flex-col gap-1",children:h.jsx(le,{size:"sm",variant:"ghost",onClick:s,className:"h-5 w-5 bg-background/30 p-0 backdrop-blur-sm hover:bg-background/60",type:"button",children:h.jsx(ho,{className:"h-3 w-3"})})})}),h.jsx("div",{className:"pointer-events-none absolute -bottom-6 left-0 right-0 flex justify-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:h.jsxs("div",{className:"pointer-events-auto flex gap-1",children:[h.jsx(le,{size:"sm",variant:"ghost",onClick:r,className:"h-5 bg-background/30 px-2 text-xs backdrop-blur-sm hover:bg-background/60",type:"button",children:h.jsx(ho,{className:"h-3 w-3"})}),h.jsx(le,{size:"sm",variant:"ghost",onClick:i,className:"h-5 bg-background/30 px-2 text-xs text-destructive backdrop-blur-sm hover:bg-background/60 hover:text-destructive",type:"button",children:h.jsx(Da,{className:"h-3 w-3"})})]})}),h.jsx(w3,{as:"table",className:"w-full table-auto border-collapse"})]})}function i8({node:t}){const{entityId:e,entityType:n,displayText:r,relationshipType:s}=t.attrs,i=()=>n==="issue"?`/issues/${e}`:`/specs/${e}`,o=()=>n==="issue"?h.jsx(_g,{className:"h-3 w-3"}):h.jsx(As,{className:"h-3 w-3"}),a=()=>n==="issue"?"issue":"spec",l=r||e;return h.jsxs(lN,{as:"span",className:"inline-block",children:[h.jsx(yg,{to:i(),className:"no-underline",contentEditable:!1,children:h.jsxs(ct,{variant:a(),className:"inline-flex items-center gap-1",children:[o(),l]})}),s&&h.jsx("span",{className:"ml-1 text-xs text-muted-foreground",contentEditable:!1,children:s})]})}const o8=en.create({name:"entityMention",addOptions(){return{HTMLAttributes:{}}},inline:!0,group:"inline",atom:!0,addAttributes(){return{entityId:{default:null,parseHTML:t=>t.getAttribute("data-entity-id"),renderHTML:t=>t.entityId?{"data-entity-id":t.entityId}:{}},entityType:{default:null,parseHTML:t=>t.getAttribute("data-entity-type"),renderHTML:t=>t.entityType?{"data-entity-type":t.entityType}:{}},displayText:{default:null,parseHTML:t=>t.getAttribute("data-display-text"),renderHTML:t=>t.displayText?{"data-display-text":t.displayText}:{}},relationshipType:{default:null,parseHTML:t=>t.getAttribute("data-relationship-type"),renderHTML:t=>t.relationshipType?{"data-relationship-type":t.relationshipType}:{}}}},parseHTML(){return[{tag:"span[data-entity-id]"}]},renderHTML({node:t,HTMLAttributes:e}){return["span",_t({"data-entity-id":t.attrs.entityId},{"data-entity-type":t.attrs.entityType},this.options.HTMLAttributes,e),t.attrs.entityId]},addNodeView(){return cN(i8)},addCommands(){return{setEntityMention:t=>({commands:e})=>{const n=t.startsWith("ISSUE-")||t.startsWith("i-")?"issue":"spec";return e.insertContent({type:this.name,attrs:{entityId:t,entityType:n}})}}}}),a8=Oi.create({name:"feedbackHighlight",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{feedbackId:{default:null,parseHTML:t=>t.getAttribute("data-feedback-id"),renderHTML:t=>t.feedbackId?{"data-feedback-id":t.feedbackId}:{}}}},parseHTML(){return[{tag:"mark[data-feedback-id]"}]},renderHTML({HTMLAttributes:t}){return["mark",{...this.options.HTMLAttributes,...t,class:"feedback-highlight bg-yellow-100 cursor-pointer hover:bg-yellow-200 transition-colors"},0]},addCommands(){return{setFeedbackHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleFeedbackHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetFeedbackHighlight:()=>({commands:t})=>t.unsetMark(this.name)}}});function l8(t){return t.replace(new RegExp("(?<!\\\\)\\[\\[((?:[is]-[0-9a-z]{4,8})|(?:[A-Z]+-\\d+))(?:\\|([^\\]]+))?\\]\\](?:\\{\\s*([^}]+)\\s*\\})?","g"),(e,n,r,s)=>{const i=n.startsWith("ISSUE-")||n.startsWith("i-")?"issue":"spec",o=r==null?void 0:r.trim(),a=s==null?void 0:s.trim();return`<span ${[`data-entity-id="${n}"`,`data-entity-type="${i}"`,o?`data-display-text="${Sp(o)}"`:"",a?`data-relationship-type="${Sp(a)}"`:""].filter(Boolean).join(" ")}>${Sp(o||n)}</span>`})}function Sp(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const c8=BU(zU);function o0(){const t=new jd({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-",hr:"---",emDelimiter:"_",strongDelimiter:"**"});return t.addRule("strikethrough",{filter:["del","s"],replacement:e=>`~~${e}~~`}),t.addRule("table",{filter:"table",replacement:e=>`
555
+ `+e+`
556
+ `}),t.addRule("tableRow",{filter:"tr",replacement:(e,n)=>{const r="|"+e+`
557
+ `,s=n.querySelectorAll("th");if(s.length>0){const i="|"+Array.from(s).map(()=>" --- |").join("")+`
558
+ `;return r+i}return r}}),t.addRule("tableCell",{filter:["th","td"],replacement:e=>" "+e.trim()+" |"}),t.addRule("listItem",{filter:"li",replacement:(e,n)=>{e=e.trim().replace(/\n\n/g,`
559
+ `);const r=n.parentNode;return r?(/ol/i.test(r.nodeName)?"1. ":"- ")+e.replace(/\n/g,`
560
+ `)+`
561
+ `:e}}),t.addRule("entityMention",{filter:e=>e.nodeName==="SPAN"&&e.hasAttribute("data-entity-id"),replacement:(e,n)=>{const r=n,s=r.getAttribute("data-entity-id"),i=r.getAttribute("data-display-text"),o=r.getAttribute("data-relationship-type");if(!s)return e;let a=`[[${s}`;return i&&(a+=`|${i}`),a+="]]",o&&(a+=`{ ${o} }`),a}}),t}const u8=It.create({name:"tabHandler",addKeyboardShortcuts(){return{Tab:()=>{const{state:t}=this.editor,{$from:e}=t.selection,n=e.node(e.depth-1);return n&&n.type.name==="listItem"?this.editor.commands.sinkListItem("listItem"):this.editor.commands.insertContent(" ")},"Shift-Tab":()=>{const{state:t}=this.editor,{$from:e}=t.selection,n=e.node(e.depth-1);return n&&n.type.name==="listItem"?this.editor.commands.liftListItem("listItem"):!1}}}}),d8=It.create({name:"lineNumbers",addGlobalAttributes(){return[{types:["heading","paragraph","codeBlock","blockquote","orderedList","bulletList"],attributes:{lineNumber:{default:null,parseHTML:t=>t.getAttribute("data-line-number"),renderHTML:t=>t.lineNumber?{"data-line-number":t.lineNumber}:{}}}}]}});function Zf({content:t,editable:e=!1,onSave:n,onChange:r,onCancel:s,className:i="",showToolbar:o=!1,feedback:a=[],onFeedbackClick:l,showLineNumbers:c=!1,selectedLine:u,onLineClick:d,placeholder:f}){const[p,m]=x.useState(""),[g,b]=x.useState(!1),y=x.useRef(!1),w=x.useRef(""),v=x3({extensions:[cH.configure({heading:{levels:[1,2,3,4,5,6],HTMLAttributes:{class:"font-bold"}},codeBlock:!1,code:{HTMLAttributes:{class:"bg-muted/50 rounded px-1.5 py-0.5 font-mono text-sm"}},blockquote:{HTMLAttributes:{class:"border-l-4 border-primary/50 pl-4 italic text-muted-foreground my-4"}},bulletList:!1,orderedList:!1,listItem:!1,listKeymap:!1}),gH.configure({lowlight:c8,HTMLAttributes:{class:"bg-muted/50 rounded-md p-4 font-mono text-sm my-4 overflow-x-auto"}}),bH.configure({placeholder:f,emptyEditorClass:"is-editor-empty"}),LT.extend({addNodeView(){return cN(s8)}}).configure({resizable:!0,HTMLAttributes:{class:"border-collapse table-auto w-full"}}),DT,IT.configure({HTMLAttributes:{class:"border border-border bg-muted/50 px-4 py-2 text-left font-bold"}}),OT.configure({HTMLAttributes:{class:"border border-border px-4 py-2"}}),r8.configure({HTMLAttributes:{class:"max-w-full h-auto rounded-md my-4"}}),O4,u8,d8,o8,a8],editable:e,content:p,onUpdate:({editor:_})=>{if(!y.current&&(b(!0),r)){const O=_.getHTML(),I=o0().turndown(O);I!==w.current&&(w.current=I,r(I))}}});x.useEffect(()=>{if(!t){m("");return}const _=l8(t);t_().use(g_).use(H_).use(Y_,{allowDangerousHtml:!0}).use(EK,{allowDangerousHtml:!0}).process(_).then(O=>{m(String(O))}).catch(O=>{console.error("Failed to convert markdown to HTML:",O),m(`<pre>${t}</pre>`)})},[t]),x.useEffect(()=>{v&&p&&(v.isFocused||(y.current=!0,v.commands.setContent(p),b(!1),w.current=t,setTimeout(()=>{y.current=!1},100)))},[p,v,t]),x.useEffect(()=>{v&&v.setEditable(e)},[e,v]),x.useEffect(()=>{if(!v||!l)return;const _=T=>{const D=T.target.closest("[data-feedback-id]");if(D){const V=D.getAttribute("data-feedback-id");V&&l(V)}},O=v.view.dom;return O.addEventListener("click",_),()=>{O.removeEventListener("click",_)}},[v,l]),x.useEffect(()=>{if(!v||!c||!t)return;const _=()=>{const T=GK(t),{state:I}=v,{tr:D}=I;let V=0;I.doc.descendants((z,j,q)=>{if(q===I.doc&&z.isBlock){const re=T[V]||V+1;return D.setNodeMarkup(j,void 0,{...z.attrs,lineNumber:String(re)}),V++,!1}return!0}),D.docChanged&&v.view.dispatch(D)},O=setTimeout(()=>{_()},100);return()=>{clearTimeout(O)}},[v,c,t]),x.useEffect(()=>{if(!v||!c)return;const _=T=>{const D=T.target.closest(".ProseMirror > *");if(!D)return;const V=parseInt(D.getAttribute("data-line-number")||"0");V>0&&d&&d(V)},O=v.view.dom;return O.addEventListener("click",_),()=>{O.removeEventListener("click",_)}},[v,c,d]),x.useEffect(()=>{if(!v||!c)return;const _=v.view.dom.querySelectorAll(".ProseMirror > *");_.forEach(O=>O.classList.remove("selected-line")),u&&u>0&&_.forEach(O=>{parseInt(O.getAttribute("data-line-number")||"0")===u&&O.classList.add("selected-line")})},[v,c,u]);const k=()=>{if(!v||!n)return;const _=v.getHTML(),T=o0().turndown(_);n(T),b(!1)},N=()=>{v&&(v.commands.setContent(p),b(!1)),s==null||s()},S=()=>{const _=window.prompt("Enter image URL:");_&&v&&v.chain().focus().setImage({src:_}).run()},C=()=>{v&&v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()};return v?h.jsxs("div",{className:i,children:[e&&o&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border bg-muted/30 pl-2 pr-4 py-2",children:[h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"bg-muted":"",type:"button",children:h.jsx(zM,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"bg-muted":"",type:"button",children:h.jsx(YM,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"bg-muted":"",type:"button",children:h.jsx($M,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"bg-muted":"",type:"button",children:h.jsx(WM,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"bg-muted":"",type:"button",children:h.jsx(qM,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"bg-muted":"",type:"button",children:h.jsx(KM,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"bg-muted":"",type:"button",children:h.jsx(QM,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"bg-muted":"",type:"button",children:h.jsx(ZM,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"bg-muted":"",type:"button",children:h.jsx(iR,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleCodeBlock().run(),className:v.isActive("codeBlock")?"bg-muted":"",type:"button",children:h.jsx(BM,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(le,{variant:"ghost",size:"sm",onClick:C,className:v.isActive("table")?"bg-muted":"",type:"button",children:h.jsx(lR,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:S,type:"button",children:h.jsx(GM,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:h.jsx(cR,{className:"h-4 w-4"})}),h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:h.jsx(oR,{className:"h-4 w-4"})}),h.jsx("div",{className:"flex-1"}),h.jsx(le,{variant:"outline",size:"sm",onClick:N,type:"button",children:"Cancel"}),h.jsx(le,{variant:"default",size:"sm",onClick:k,disabled:!g,type:"button",children:"Save"})]}),h.jsx("div",{className:`pl-3 pr-6 py-6 ${c?"tiptap-with-line-numbers":""}`,children:h.jsx(f3,{editor:v,className:"tiptap-editor prose prose-sm dark:prose-invert max-w-none"})})]}):h.jsx("div",{className:i,children:h.jsxs("div",{className:"animate-pulse",children:[h.jsx("div",{className:"mb-2 h-4 w-3/4 rounded bg-muted"}),h.jsx("div",{className:"mb-2 h-4 w-1/2 rounded bg-muted"}),h.jsx("div",{className:"h-4 w-5/6 rounded bg-muted"})]})})}const a0="sudocode:details:viewMode",l0="sudocode:issue:descriptionCollapsed",f8=[{value:"open",label:"Open"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"needs_review",label:"Needs Review"},{value:"closed",label:"Closed"}],h8=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}];function ry({issue:t,onClose:e,onUpdate:n,onDelete:r,onArchive:s,onUnarchive:i,isUpdating:o=!1,isDeleting:a=!1,showOpenDetail:l=!1,hideTopControls:c=!1,viewMode:u,onViewModeChange:d,showViewToggleInline:f=!0}){const p=kr(),[m,g]=x.useState(t.title),[b,y]=x.useState(t.content||""),[w,v]=x.useState(t.status),[k,N]=x.useState(()=>{const ie=localStorage.getItem(a0);return ie!==null?JSON.parse(ie):"formatted"}),[S,C]=x.useState(()=>{const ie=localStorage.getItem(l0);return ie!==null?JSON.parse(ie):!1}),_=x.useRef(null),O=u??k,T=ie=>{d?d(ie):N(ie)},[I,D]=x.useState(t.priority),[V,z]=x.useState(!1),[j,q]=x.useState(!1),[re,G]=x.useState([]),[ue,A]=x.useState(!1),[ce,ye]=x.useState(!1),[E,P]=x.useState(!1),F=x.useRef(null),$=x.useRef(null),{createRelationshipAsync:L,deleteRelationshipAsync:H}=tj(),J=x.useRef(n),ne=x.useRef({title:m,content:b,status:w,priority:I,hasChanges:E});x.useEffect(()=>{J.current=n},[n]),x.useEffect(()=>{ne.current={title:m,content:b,status:w,priority:I,hasChanges:E}},[m,b,w,I,E]),x.useEffect(()=>{$.current&&(clearTimeout($.current),$.current=null),P(!1)},[t.id]),x.useEffect(()=>{u||localStorage.setItem(a0,JSON.stringify(k))},[k,u]),x.useEffect(()=>{localStorage.setItem(l0,JSON.stringify(S))},[S]),x.useEffect(()=>{g(t.title),y(t.content||""),v(t.status),D(t.priority),P(!1)},[t]),x.useEffect(()=>{(async()=>{ye(!0);try{const Be=await Qo.getForEntity(t.id,"issue");let dt=[];if(Array.isArray(Be))dt=Be;else if(Be&&typeof Be=="object"&&"outgoing"in Be&&"incoming"in Be){const ot=Be;dt=[...ot.outgoing||[],...ot.incoming||[]]}G(dt)}catch(Be){console.error("Failed to fetch relationships:",Be),G([])}finally{ye(!1)}})()},[t.id]),x.useEffect(()=>{const ie=Be=>{var pn;if(!F.current||!e)return;const dt=Be.target;if(F.current.contains(dt))return;const ot=dt;if(ot.closest("[data-issue-id]")||ot.closest("[data-panel-resize-handle-id]")||(pn=ot.classList)!=null&&pn.contains("cursor-col-resize"))return;const Ds=ot.closest('[role="dialog"]'),U=ot.closest('[role="alertdialog"]'),Y=ot.closest('[role="listbox"]'),_e=ot.closest("[data-radix-popper-content-wrapper]");if(Ds||U||Y||_e)return;const je=ot.closest(".ProseMirror"),tt=ot.closest(".tiptap-editor"),Rt=ot.closest("[data-tippy-root]"),Bn=ot.closest(".tippy-box");je||tt||Rt||Bn||e()};return document.addEventListener("mousedown",ie),()=>{document.removeEventListener("mousedown",ie)}},[e]),x.useEffect(()=>{const ie=Be=>{e&&(V||j||ue||Be.key==="Escape"&&e())};return document.addEventListener("keydown",ie),()=>{document.removeEventListener("keydown",ie)}},[e,V,j,ue]),x.useEffect(()=>{if(!(!E||!J.current))return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{var ie;(ie=J.current)==null||ie.call(J,{title:m,content:b,status:w,priority:I}),P(!1)},1e3),()=>{$.current&&clearTimeout($.current)}},[m,b,w,I,E]),x.useEffect(()=>()=>{const{hasChanges:ie,title:Be,content:dt,status:ot,priority:or}=ne.current;ie&&J.current&&J.current({title:Be,content:dt,status:ot,priority:or})},[]),x.useEffect(()=>{if(O==="markdown"&&_.current){const ie=_.current;ie.style.height="auto",ie.style.height=`${ie.scrollHeight}px`}},[b,O]);const xe=ie=>{g(ie),P(!0)},ge=ie=>{y(ie),P(!0)},Pe=ie=>{v(ie),P(!0)},Ze=ie=>{D(ie),P(!0)},de=()=>{r==null||r(),z(!1)},se=async(ie,Be,dt)=>{try{const ot=await L({from_id:t.id,from_type:"issue",to_id:ie,to_type:Be,relationship_type:dt});G([...re,ot]),A(!1)}catch(ot){console.error("Failed to create relationship:",ot)}},it=async ie=>{try{await H({from_id:ie.from_id,from_type:ie.from_type,to_id:ie.to_id,to_type:ie.to_type,relationship_type:ie.relationship_type}),G(re.filter(Be=>!(Be.from_id===ie.from_id&&Be.to_id===ie.to_id&&Be.relationship_type===ie.relationship_type)))}catch(Be){console.error("Failed to delete relationship:",Be)}},Ye=async(ie,Be)=>{try{const dt=await ur.create(t.id,{config:ie,prompt:Be});q(!1),p(`/executions/${dt.id}`)}catch(dt){console.error("Failed to create execution:",dt)}};return h.jsx(po,{delayDuration:300,children:h.jsxs("div",{className:"flex h-full flex-col",ref:F,children:[!c&&h.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[e&&h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx("button",{onClick:e,className:"text-muted-foreground hover:text-foreground","aria-label":"Back",children:h.jsx(Qd,{className:"h-4 w-4"})})}),h.jsx(er,{children:"Close (ESC)"})]}),l&&h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx("button",{onClick:()=>p(`/issues/${t.id}`),className:"text-muted-foreground hover:text-foreground","aria-label":"Open in full page",children:h.jsx(HM,{className:"h-4 w-4"})})}),h.jsx(er,{children:"Open in full page"})]})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[f&&h.jsxs("div",{className:"mr-4 flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(le,{variant:O==="formatted"?"outline":"ghost",size:"sm",onClick:()=>T("formatted"),className:`h-7 rounded-sm ${O==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(As,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(le,{variant:O==="markdown"?"outline":"ghost",size:"sm",onClick:()=>T("markdown"),className:`h-7 rounded-sm ${O==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(uc,{className:"mr-2 h-4 w-4"}),"Markdown"]})]}),(s||i)&&h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx("button",{onClick:()=>t.archived?i==null?void 0:i(t.id):s==null?void 0:s(t.id),className:"text-muted-foreground hover:text-foreground","aria-label":t.archived?"Unarchive":"Archive",disabled:o,children:t.archived?h.jsx(Eg,{className:"h-4 w-4"}):h.jsx(Ia,{className:"h-4 w-4"})})}),h.jsx(er,{children:t.archived?"Unarchive":"Archive"})]}),r&&h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsx("button",{onClick:()=>z(!0),className:"text-muted-foreground hover:text-destructive","aria-label":"Delete",disabled:o||a,children:h.jsx(Da,{className:"h-4 w-4"})})}),h.jsx(er,{children:"Delete issue"})]})]})]}),h.jsx("div",{className:`flex-1 overflow-y-auto px-6 ${c?"py-4":"py-3"}`,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2 pb-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(ct,{variant:"issue",className:"font-mono",children:t.id}),n&&h.jsx("div",{className:"text-xs italic text-muted-foreground",children:o?"Saving...":E?"Unsaved changes...":"All changes saved"})]}),h.jsx(Ms,{value:m,onChange:ie=>xe(ie.target.value),placeholder:"Issue title...",disabled:o,className:"border-none bg-transparent px-0 text-2xl font-semibold shadow-none focus-visible:ring-0"})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(FM,{className:"h-4 w-4 text-muted-foreground"}),h.jsxs(In,{value:w,onValueChange:ie=>Pe(ie),disabled:o,children:[h.jsx(vn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:h.jsx(Dn,{placeholder:"Status"})}),h.jsx(wn,{children:f8.map(ie=>h.jsx(Ct,{value:ie.value,children:ie.label},ie.value))})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Rk,{className:"h-4 w-4 text-muted-foreground"}),h.jsxs(In,{value:String(I),onValueChange:ie=>Ze(parseInt(ie)),disabled:o,children:[h.jsx(vn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:h.jsx(Dn,{placeholder:"Priority"})}),h.jsx(wn,{children:h8.map(ie=>h.jsx(Ct,{value:ie.value,children:ie.label},ie.value))})]})]}),t.parent_id&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(_g,{className:"h-4 w-4"}),h.jsx("span",{children:t.parent_id})]}),h.jsx("div",{className:"ml-auto text-xs text-muted-foreground",children:t.closed_at?`Closed ${Bu(new Date(t.closed_at.endsWith("Z")?t.closed_at:t.closed_at+"Z"),{addSuffix:!0})}`:`Updated ${Bu(new Date(t.updated_at.endsWith("Z")?t.updated_at:t.updated_at+"Z"),{addSuffix:!0})}`})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Relationships"}),h.jsx(ct,{variant:"secondary",children:re.length})]}),h.jsxs(le,{variant:"outline",size:"xs",onClick:()=>A(!ue),className:"h-6",children:[h.jsx(ho,{className:"mr-1 h-4 w-4"}),"Add"]})]}),ue&&h.jsx("div",{className:"rounded-lg border p-4",children:h.jsx(ZE,{fromId:t.id,fromType:"issue",onSubmit:se,onCancel:()=>A(!1)})}),ce?h.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading relationships..."}):h.jsx(GE,{relationships:re,currentEntityId:t.id,currentEntityType:"issue",onDelete:it,showEmpty:!1,showGroupHeaders:!1})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),h.jsx(le,{variant:"ghost",size:"xs",onClick:()=>C(!S),className:"h-6 gap-1 text-muted-foreground",children:S?h.jsxs(h.Fragment,{children:[h.jsx(Rl,{className:"h-4 w-4"}),"Expand"]}):h.jsxs(h.Fragment,{children:[h.jsx(Ng,{className:"h-4 w-4"}),"Collapse"]})})]}),h.jsxs("div",{className:"relative",children:[h.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${S?"max-h-[200px] cursor-pointer 2xl:max-h-[300px]":""}`,onClick:()=>{S&&C(!1)},children:h.jsx(Bt,{className:"overflow-hidden rounded-md border",children:O==="formatted"?h.jsx(Zf,{content:b,editable:!S,onChange:ge,onCancel:()=>{y(t.content||""),P(!1)},className:"min-h-[200px]",placeholder:"Issue description..."}):h.jsx("div",{className:"p-4",children:h.jsx("textarea",{ref:_,value:b,onChange:ie=>ge(ie.target.value),placeholder:"Issue description in markdown...",className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1,disabled:S,style:{minHeight:"200px"}})})})}),S&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background to-transparent"}),h.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2",children:h.jsxs(le,{variant:"outline",size:"sm",onClick:ie=>{ie.stopPropagation(),C(!1)},className:"gap-1 shadow-sm",children:[h.jsx(Rl,{className:"h-4 w-4"}),"Expand"]})})]})]})]}),t.assignee&&h.jsx("div",{className:"border-t pt-4",children:h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Assignee: "}),h.jsx("span",{children:t.assignee})]})}),h.jsx(ej,{issueId:t.id})]})}),h.jsx("div",{className:"border-t bg-background px-6 py-3",children:h.jsx("div",{className:"flex items-center justify-end gap-3",children:h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsxs(le,{onClick:()=>q(!0),disabled:t.archived||o,variant:"default",size:"xs",className:"gap-2",children:[h.jsx(sR,{className:"h-4 w-4"}),"Run Agent"]})}),h.jsx(er,{children:"Configure and start agent execution"})]})})}),h.jsx(qE,{issue:t,isOpen:V,onClose:()=>z(!1),onConfirm:de,isDeleting:a}),h.jsx(Y2,{issueId:t.id,open:j,onStart:Ye,onCancel:()=>q(!1)})]})})}const c0="sudocode:issueEditor:viewMode",p8=[{value:"open",label:"Open"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"needs_review",label:"Needs Review"},{value:"closed",label:"Closed"}],m8=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}];function g8({issue:t,onSave:e,onCancel:n,isLoading:r=!1}){const[s,i]=x.useState((t==null?void 0:t.title)||""),[o,a]=x.useState((t==null?void 0:t.content)||""),[l,c]=x.useState((t==null?void 0:t.status)||"open"),[u,d]=x.useState((t==null?void 0:t.priority)??2),[f,p]=x.useState({}),[m,g]=x.useState(()=>{const v=localStorage.getItem(c0);return v!==null?JSON.parse(v):"formatted"}),b=x.useRef(null);x.useEffect(()=>{t&&(i(t.title),a(t.content||""),c(t.status),d(t.priority))},[t]),x.useEffect(()=>{localStorage.setItem(c0,JSON.stringify(m))},[m]),x.useEffect(()=>{if(m==="markdown"&&b.current){const v=b.current;v.style.height="auto",v.style.height=`${v.scrollHeight}px`}},[o,m]);const y=()=>{const v={};return s.trim()?s.length>200&&(v.title="Title must be less than 200 characters"):v.title="Title is required",p(v),Object.keys(v).length===0},w=v=>{v.preventDefault(),y()&&e({title:s,content:o,status:l,priority:u})};return h.jsxs("form",{onSubmit:w,className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs(Yt,{htmlFor:"title",children:["Title ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(Ms,{id:"title",value:s,onChange:v=>i(v.target.value),placeholder:"Enter issue title...",className:f.title?"border-destructive":"",disabled:r}),f.title&&h.jsx("p",{className:"text-sm text-destructive",children:f.title})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Yt,{htmlFor:"content",children:"Details"}),h.jsxs("div",{className:"flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(le,{variant:m==="formatted"?"outline":"ghost",size:"sm",onClick:()=>g("formatted"),className:`h-7 rounded-sm ${m==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(As,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(le,{variant:m==="markdown"?"outline":"ghost",size:"sm",onClick:()=>g("markdown"),className:`h-7 rounded-sm ${m==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(uc,{className:"mr-2 h-4 w-4"}),"Markdown"]})]})]}),h.jsx(Bt,{className:"overflow-hidden rounded-md border",children:m==="formatted"?h.jsx(Zf,{content:o,editable:!0,onChange:v=>a(v),onSave:v=>a(v),onCancel:()=>{t&&a(t.content||"")},className:"min-h-[300px]",placeholder:"Issue description..."}):h.jsx("div",{className:"p-4",children:h.jsx("textarea",{ref:b,value:o,onChange:v=>a(v.target.value),placeholder:"Issue description in markdown...",className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1,style:{minHeight:"300px"},disabled:r})})})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"status",children:"Status"}),h.jsxs(In,{value:l,onValueChange:v=>c(v),disabled:r,children:[h.jsx(vn,{id:"status",children:h.jsx(Dn,{placeholder:"Select status"})}),h.jsx(wn,{children:p8.map(v=>h.jsx(Ct,{value:v.value,children:v.label},v.value))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"priority",children:"Priority"}),h.jsxs(In,{value:String(u),onValueChange:v=>d(parseInt(v)),disabled:r,children:[h.jsx(vn,{id:"priority",children:h.jsx(Dn,{placeholder:"Select priority"})}),h.jsx(wn,{children:m8.map(v=>h.jsx(Ct,{value:v.value,children:v.label},v.value))})]})]})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[h.jsx(le,{type:"button",variant:"outline",onClick:n,disabled:r,children:"Cancel"}),h.jsx(le,{type:"submit",disabled:r,children:r?"Saving...":t?"Update Issue":"Create Issue"})]})]})}function b8({isOpen:t,onClose:e,onCreate:n,isCreating:r=!1,defaultStatus:s}){const[i,o]=x.useState(!1),a=c=>{n(c),o(!1)},l=()=>{i&&!window.confirm("You have unsaved changes. Are you sure you want to close?")||(o(!1),e())};return h.jsx(Mo,{open:t,onOpenChange:l,children:h.jsxs(Ci,{className:"max-h-[90vh] max-w-2xl overflow-y-auto",children:[h.jsx(Ni,{children:h.jsx(_i,{children:"Create New Issue"})}),h.jsx(g8,{issue:s?{status:s,priority:2}:null,onSave:a,onCancel:l,isLoading:r})]})})}const Xf=x.createContext(null);Xf.displayName="PanelGroupContext";const zt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},sy=10,lo=x.useLayoutEffect,u0=fk.useId,y8=typeof u0=="function"?u0:()=>null;let x8=0;function iy(t=null){const e=y8(),n=x.useRef(t||e||null);return n.current===null&&(n.current=""+x8++),t??n.current}function PT({children:t,className:e="",collapsedSize:n,collapsible:r,defaultSize:s,forwardedRef:i,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:f,style:p,tagName:m="div",...g}){const b=x.useContext(Xf);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:w,getPanelSize:v,getPanelStyle:k,groupId:N,isPanelCollapsed:S,reevaluatePanelConstraints:C,registerPanel:_,resizePanel:O,unregisterPanel:T}=b,I=iy(o),D=x.useRef({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:s,maxSize:a,minSize:l},id:I,idIsFromProps:o!==void 0,order:f});x.useRef({didLogMissingDefaultSizeWarning:!1}),lo(()=>{const{callbacks:z,constraints:j}=D.current,q={...j};D.current.id=I,D.current.idIsFromProps=o!==void 0,D.current.order=f,z.onCollapse=c,z.onExpand=u,z.onResize=d,j.collapsedSize=n,j.collapsible=r,j.defaultSize=s,j.maxSize=a,j.minSize=l,(q.collapsedSize!==j.collapsedSize||q.collapsible!==j.collapsible||q.maxSize!==j.maxSize||q.minSize!==j.minSize)&&C(D.current,q)}),lo(()=>{const z=D.current;return _(z),()=>{T(z)}},[f,I,_,T]),x.useImperativeHandle(i,()=>({collapse:()=>{y(D.current)},expand:z=>{w(D.current,z)},getId(){return I},getSize(){return v(D.current)},isCollapsed(){return S(D.current)},isExpanded(){return!S(D.current)},resize:z=>{O(D.current,z)}}),[y,w,v,S,I,O]);const V=k(D.current,s);return x.createElement(m,{...g,children:t,className:e,id:I,style:{...V,...p},[zt.groupId]:N,[zt.panel]:"",[zt.panelCollapsible]:r||void 0,[zt.panelId]:I,[zt.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}const Zl=x.forwardRef((t,e)=>x.createElement(PT,{...t,forwardedRef:e}));PT.displayName="Panel";Zl.displayName="forwardRef(Panel)";let ig=null,Tu=-1,Zs=null;function v8(t,e,n){const r=(e&$T)!==0,s=(e&HT)!==0,i=(e&UT)!==0,o=(e&VT)!==0;if(e){if(r)return i?"se-resize":o?"ne-resize":"e-resize";if(s)return i?"sw-resize":o?"nw-resize":"w-resize";if(i)return"s-resize";if(o)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function w8(){Zs!==null&&(document.head.removeChild(Zs),ig=null,Zs=null,Tu=-1)}function Ep(t,e,n){var r,s;const i=v8(t,e);if(ig!==i){if(ig=i,Zs===null&&(Zs=document.createElement("style"),document.head.appendChild(Zs)),Tu>=0){var o;(o=Zs.sheet)===null||o===void 0||o.removeRule(Tu)}Tu=(r=(s=Zs.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${i} !important;}`))!==null&&r!==void 0?r:-1}}function jT(t){return t.type==="keydown"}function zT(t){return t.type.startsWith("pointer")}function FT(t){return t.type.startsWith("mouse")}function Qf(t){if(zT(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(FT(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function k8(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function S8(t,e,n){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function E8(t,e){if(t===e)throw new Error("Cannot compare node with itself");const n={a:h0(t),b:h0(e)};let r;for(;n.a.at(-1)===n.b.at(-1);)t=n.a.pop(),e=n.b.pop(),r=t;qe(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:f0(d0(n.a)),b:f0(d0(n.b))};if(s.a===s.b){const i=r.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(s.a-s.b)}const C8=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function N8(t){var e;const n=getComputedStyle((e=BT(t))!==null&&e!==void 0?e:t).display;return n==="flex"||n==="inline-flex"}function _8(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||N8(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||C8.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function d0(t){let e=t.length;for(;e--;){const n=t[e];if(qe(n,"Missing node"),_8(n))return n}return null}function f0(t){return t&&Number(getComputedStyle(t).zIndex)||0}function h0(t){const e=[];for(;t;)e.push(t),t=BT(t);return e}function BT(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const $T=1,HT=2,UT=4,VT=8,T8=k8()==="coarse";let Dr=[],oa=!1,Xs=new Map,eh=new Map;const Xl=new Set;function A8(t,e,n,r,s){var i;const{ownerDocument:o}=e,a={direction:n,element:e,hitAreaMargins:r,setResizeHandlerState:s},l=(i=Xs.get(o))!==null&&i!==void 0?i:0;return Xs.set(o,l+1),Xl.add(a),zd(),function(){var u;eh.delete(t),Xl.delete(a);const d=(u=Xs.get(o))!==null&&u!==void 0?u:1;if(Xs.set(o,d-1),zd(),d===1&&Xs.delete(o),Dr.includes(a)){const f=Dr.indexOf(a);f>=0&&Dr.splice(f,1),th(),s("up",!0,null)}}}function M8(t){const{target:e}=t,{x:n,y:r}=Qf(t);oa=!0,oy({target:e,x:n,y:r}),zd(),Dr.length>0&&(Fd("down",t),th(),t.preventDefault(),WT(e)||t.stopImmediatePropagation())}function Cp(t){const{x:e,y:n}=Qf(t);if(oa&&t.type!=="pointerleave"&&t.buttons===0&&(oa=!1,Fd("up",t)),!oa){const{target:r}=t;oy({target:r,x:e,y:n})}Fd("move",t),th(),Dr.length>0&&t.preventDefault()}function Np(t){const{target:e}=t,{x:n,y:r}=Qf(t);eh.clear(),oa=!1,Dr.length>0&&(t.preventDefault(),WT(e)||t.stopImmediatePropagation()),Fd("up",t),oy({target:e,x:n,y:r}),th(),zd()}function WT(t){let e=t;for(;e;){if(e.hasAttribute(zt.resizeHandle))return!0;e=e.parentElement}return!1}function oy({target:t,x:e,y:n}){Dr.splice(0);let r=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(r=t),Xl.forEach(s=>{const{element:i,hitAreaMargins:o}=s,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,f=T8?o.coarse:o.fine;if(e>=c-f&&e<=u+f&&n>=d-f&&n<=l+f){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&E8(r,i)>0){let m=r,g=!1;for(;m&&!m.contains(i);){if(S8(m.getBoundingClientRect(),a)){g=!0;break}m=m.parentElement}if(g)return}Dr.push(s)}})}function _p(t,e){eh.set(t,e)}function th(){let t=!1,e=!1;Dr.forEach(r=>{const{direction:s}=r;s==="horizontal"?t=!0:e=!0});let n=0;eh.forEach(r=>{n|=r}),t&&e?Ep("intersection",n):t?Ep("horizontal",n):e?Ep("vertical",n):w8()}let Tp;function zd(){var t;(t=Tp)===null||t===void 0||t.abort(),Tp=new AbortController;const e={capture:!0,signal:Tp.signal};Xl.size&&(oa?(Dr.length>0&&Xs.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("contextmenu",Np,e),s.addEventListener("pointerleave",Cp,e),s.addEventListener("pointermove",Cp,e))}),Xs.forEach((n,r)=>{const{body:s}=r;s.addEventListener("pointerup",Np,e),s.addEventListener("pointercancel",Np,e)})):Xs.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("pointerdown",M8,e),s.addEventListener("pointermove",Cp,e))}))}function Fd(t,e){Xl.forEach(n=>{const{setResizeHandlerState:r}=n,s=Dr.includes(n);r(t,s,e)})}function R8(){const[t,e]=x.useState(0);return x.useCallback(()=>e(n=>n+1),[])}function qe(t,e){if(!t)throw console.error(e),Error(e)}function Co(t,e,n=sy){return t.toFixed(n)===e.toFixed(n)?0:t>e?1:-1}function xs(t,e,n=sy){return Co(t,e,n)===0}function Qn(t,e,n){return Co(t,e,n)===0}function O8(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const s=t[r],i=e[r];if(!Qn(s,i,n))return!1}return!0}function Yo({panelConstraints:t,panelIndex:e,size:n}){const r=t[e];qe(r!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:s=0,collapsible:i,maxSize:o=100,minSize:a=0}=r;if(Co(n,a)<0)if(i){const l=(s+a)/2;Co(n,l)<0?n=s:n=a}else n=a;return n=Math.min(o,n),n=parseFloat(n.toFixed(sy)),n}function ul({delta:t,initialLayout:e,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:i}){if(Qn(t,0))return e;const o=[...e],[a,l]=r;qe(a!=null,"Invalid first pivot index"),qe(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const d=t<0?l:a,f=n[d];qe(f,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=f;if(m){const b=e[d];if(qe(b!=null,`Previous layout not found for panel index ${d}`),Qn(b,p)){const y=g-b;Co(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const d=t<0?a:l,f=n[d];qe(f,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=f;if(m){const b=e[d];if(qe(b!=null,`Previous layout not found for panel index ${d}`),Qn(b,g)){const y=b-p;Co(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{const d=t<0?1:-1;let f=t<0?l:a,p=0;for(;;){const g=e[f];qe(g!=null,`Previous layout not found for panel index ${f}`);const y=Yo({panelConstraints:n,panelIndex:f,size:100})-g;if(p+=y,f+=d,f<0||f>=n.length)break}const m=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-m:m}{let f=t<0?a:l;for(;f>=0&&f<n.length;){const p=Math.abs(t)-Math.abs(c),m=e[f];qe(m!=null,`Previous layout not found for panel index ${f}`);const g=m-p,b=Yo({panelConstraints:n,panelIndex:f,size:g});if(!Qn(m,b)&&(c+=m-b,o[f]=b,c.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(O8(s,o))return s;{const d=t<0?l:a,f=e[d];qe(f!=null,`Previous layout not found for panel index ${d}`);const p=f+c,m=Yo({panelConstraints:n,panelIndex:d,size:p});if(o[d]=m,!Qn(m,p)){let g=p-m,y=t<0?l:a;for(;y>=0&&y<n.length;){const w=o[y];qe(w!=null,`Previous layout not found for panel index ${y}`);const v=w+g,k=Yo({panelConstraints:n,panelIndex:y,size:v});if(Qn(w,k)||(g-=k-w,o[y]=k),Qn(g,0))break;t>0?y--:y++}}}const u=o.reduce((d,f)=>f+d,0);return Qn(u,100)?o:s}function I8({layout:t,panelsArray:e,pivotIndices:n}){let r=0,s=100,i=0,o=0;const a=n[0];qe(a!=null,"No pivot index found"),e.forEach((d,f)=>{const{constraints:p}=d,{maxSize:m=100,minSize:g=0}=p;f===a?(r=g,s=m):(i+=g,o+=m)});const l=Math.min(s,100-i),c=Math.max(r,100-o),u=t[a];return{valueMax:l,valueMin:c,valueNow:u}}function Ql(t,e=document){return Array.from(e.querySelectorAll(`[${zt.resizeHandleId}][data-panel-group-id="${t}"]`))}function qT(t,e,n=document){const s=Ql(t,n).findIndex(i=>i.getAttribute(zt.resizeHandleId)===e);return s??null}function KT(t,e,n){const r=qT(t,e,n);return r!=null?[r,r+1]:[-1,-1]}function D8(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function GT(t,e=document){if(D8(e)&&e.dataset.panelGroupId==t)return e;const n=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return n||null}function nh(t,e=document){const n=e.querySelector(`[${zt.resizeHandleId}="${t}"]`);return n||null}function L8(t,e,n,r=document){var s,i,o,a;const l=nh(e,r),c=Ql(t,r),u=l?c.indexOf(l):-1,d=(s=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&s!==void 0?s:null,f=(o=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[d,f]}function P8({committedValuesRef:t,eagerValuesRef:e,groupId:n,layout:r,panelDataArray:s,panelGroupElement:i,setLayout:o}){x.useRef({didWarnAboutMissingResizeHandle:!1}),lo(()=>{if(!i)return;const a=Ql(n,i);for(let l=0;l<s.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=I8({layout:r,panelsArray:s,pivotIndices:[l,l+1]}),f=a[l];if(f!=null){const p=s[l];qe(p,`No panel data found for index "${l}"`),f.setAttribute("aria-controls",p.id),f.setAttribute("aria-valuemax",""+Math.round(c)),f.setAttribute("aria-valuemin",""+Math.round(u)),f.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,s,i]),x.useEffect(()=>{if(!i)return;const a=e.current;qe(a,"Eager values not found");const{panelDataArray:l}=a,c=GT(n,i);qe(c!=null,`No group found for id "${n}"`);const u=Ql(n,i);qe(u,`No resize handles found for group id "${n}"`);const d=u.map(f=>{const p=f.getAttribute(zt.resizeHandleId);qe(p,"Resize handle element has no handle id attribute");const[m,g]=L8(n,p,l,i);if(m==null||g==null)return()=>{};const b=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const w=l.findIndex(v=>v.id===m);if(w>=0){const v=l[w];qe(v,`No panel data found for index ${w}`);const k=r[w],{collapsedSize:N=0,collapsible:S,minSize:C=0}=v.constraints;if(k!=null&&S){const _=ul({delta:Qn(k,N)?C-N:N-k,initialLayout:r,panelConstraints:l.map(O=>O.constraints),pivotIndices:KT(n,p,i),prevLayout:r,trigger:"keyboard"});r!==_&&o(_)}}break}}};return f.addEventListener("keydown",b),()=>{f.removeEventListener("keydown",b)}});return()=>{d.forEach(f=>f())}},[i,t,e,n,r,s,o])}function p0(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function JT(t,e){const n=t==="horizontal",{x:r,y:s}=Qf(e);return n?r:s}function j8(t,e,n,r,s){const i=n==="horizontal",o=nh(e,s);qe(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(zt.groupId);qe(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=JT(n,t),u=GT(a,s);qe(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),f=i?d.width:d.height;return(c-l)/f*100}function z8(t,e,n,r,s,i){if(jT(t)){const o=n==="horizontal";let a=0;t.shiftKey?a=100:s!=null?a=s:a=10;let l=0;switch(t.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:j8(t,e,n,r,i)}function F8({panelDataArray:t}){const e=Array(t.length),n=t.map(i=>i.constraints);let r=0,s=100;for(let i=0;i<t.length;i++){const o=n[i];qe(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;a!=null&&(r++,e[i]=a,s-=a)}for(let i=0;i<t.length;i++){const o=n[i];qe(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;if(a!=null)continue;const l=t.length-r,c=s/l;r++,e[i]=c,s-=c}return e}function Po(t,e,n){e.forEach((r,s)=>{const i=t[s];qe(i,`Panel data not found for index ${s}`);const{callbacks:o,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:f,onExpand:p,onResize:m}=o;m&&m(r,d),u&&(f||p)&&(p&&(d==null||xs(d,c))&&!xs(r,c)&&p(),f&&(d==null||!xs(d,c))&&xs(r,c)&&f())}})}function hu(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}function B8({defaultSize:t,dragState:e,layout:n,panelData:r,panelIndex:s,precision:i=3}){const o=n[s];let a;return o==null?a=t!=null?t.toFixed(i):"1":r.length===1?a="1":a=o.toFixed(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function $8(t,e=10){let n=null;return(...s)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...s)},e)}}function m0(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,n)=>{localStorage.setItem(e,n)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function YT(t){return`react-resizable-panels:${t}`}function ZT(t){return t.map(e=>{const{constraints:n,id:r,idIsFromProps:s,order:i}=e;return s?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((e,n)=>e.localeCompare(n)).join(",")}function XT(t,e){try{const n=YT(t),r=e.getItem(n);if(r){const s=JSON.parse(r);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function H8(t,e,n){var r,s;const i=(r=XT(t,n))!==null&&r!==void 0?r:{},o=ZT(e);return(s=i[o])!==null&&s!==void 0?s:null}function U8(t,e,n,r,s){var i;const o=YT(t),a=ZT(e),l=(i=XT(t,s))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{s.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function g0({layout:t,panelConstraints:e}){const n=[...t],r=n.reduce((i,o)=>i+o,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Qn(r,100)&&n.length>0)for(let i=0;i<e.length;i++){const o=n[i];qe(o!=null,`No layout data found for index ${i}`);const a=100/r*o;n[i]=a}let s=0;for(let i=0;i<e.length;i++){const o=n[i];qe(o!=null,`No layout data found for index ${i}`);const a=Yo({panelConstraints:e,panelIndex:i,size:o});o!=a&&(s+=o-a,n[i]=a)}if(!Qn(s,0))for(let i=0;i<e.length;i++){const o=n[i];qe(o!=null,`No layout data found for index ${i}`);const a=o+s,l=Yo({panelConstraints:e,panelIndex:i,size:a});if(o!==l&&(s-=l-o,n[i]=l,Qn(s,0)))break}return n}const V8=100,dl={getItem:t=>(m0(dl),dl.getItem(t)),setItem:(t,e)=>{m0(dl),dl.setItem(t,e)}},b0={};function QT({autoSaveId:t=null,children:e,className:n="",direction:r,forwardedRef:s,id:i=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=dl,style:c,tagName:u="div",...d}){const f=iy(i),p=x.useRef(null),[m,g]=x.useState(null),[b,y]=x.useState([]),w=R8(),v=x.useRef({}),k=x.useRef(new Map),N=x.useRef(0),S=x.useRef({autoSaveId:t,direction:r,dragState:m,id:f,keyboardResizeBy:a,onLayout:o,storage:l}),C=x.useRef({layout:b,panelDataArray:[],panelDataArrayChanged:!1});x.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x.useImperativeHandle(s,()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:E}=C.current;return E},setLayout:E=>{const{onLayout:P}=S.current,{layout:F,panelDataArray:$}=C.current,L=g0({layout:E,panelConstraints:$.map(H=>H.constraints)});p0(F,L)||(y(L),C.current.layout=L,P&&P(L),Po($,L,v.current))}}),[]),lo(()=>{S.current.autoSaveId=t,S.current.direction=r,S.current.dragState=m,S.current.id=f,S.current.onLayout=o,S.current.storage=l}),P8({committedValuesRef:S,eagerValuesRef:C,groupId:f,layout:b,panelDataArray:C.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),x.useEffect(()=>{const{panelDataArray:E}=C.current;if(t){if(b.length===0||b.length!==E.length)return;let P=b0[t];P==null&&(P=$8(U8,V8),b0[t]=P);const F=[...E],$=new Map(k.current);P(t,F,$,b,l)}},[t,b,l]),x.useEffect(()=>{});const _=x.useCallback(E=>{const{onLayout:P}=S.current,{layout:F,panelDataArray:$}=C.current;if(E.constraints.collapsible){const L=$.map(xe=>xe.constraints),{collapsedSize:H=0,panelSize:J,pivotIndices:ne}=zi($,E,F);if(qe(J!=null,`Panel size not found for panel "${E.id}"`),!xs(J,H)){k.current.set(E.id,J);const ge=Wo($,E)===$.length-1?J-H:H-J,Pe=ul({delta:ge,initialLayout:F,panelConstraints:L,pivotIndices:ne,prevLayout:F,trigger:"imperative-api"});hu(F,Pe)||(y(Pe),C.current.layout=Pe,P&&P(Pe),Po($,Pe,v.current))}}},[]),O=x.useCallback((E,P)=>{const{onLayout:F}=S.current,{layout:$,panelDataArray:L}=C.current;if(E.constraints.collapsible){const H=L.map(Ze=>Ze.constraints),{collapsedSize:J=0,panelSize:ne=0,minSize:xe=0,pivotIndices:ge}=zi(L,E,$),Pe=P??xe;if(xs(ne,J)){const Ze=k.current.get(E.id),de=Ze!=null&&Ze>=Pe?Ze:Pe,it=Wo(L,E)===L.length-1?ne-de:de-ne,Ye=ul({delta:it,initialLayout:$,panelConstraints:H,pivotIndices:ge,prevLayout:$,trigger:"imperative-api"});hu($,Ye)||(y(Ye),C.current.layout=Ye,F&&F(Ye),Po(L,Ye,v.current))}}},[]),T=x.useCallback(E=>{const{layout:P,panelDataArray:F}=C.current,{panelSize:$}=zi(F,E,P);return qe($!=null,`Panel size not found for panel "${E.id}"`),$},[]),I=x.useCallback((E,P)=>{const{panelDataArray:F}=C.current,$=Wo(F,E);return B8({defaultSize:P,dragState:m,layout:b,panelData:F,panelIndex:$})},[m,b]),D=x.useCallback(E=>{const{layout:P,panelDataArray:F}=C.current,{collapsedSize:$=0,collapsible:L,panelSize:H}=zi(F,E,P);return qe(H!=null,`Panel size not found for panel "${E.id}"`),L===!0&&xs(H,$)},[]),V=x.useCallback(E=>{const{layout:P,panelDataArray:F}=C.current,{collapsedSize:$=0,collapsible:L,panelSize:H}=zi(F,E,P);return qe(H!=null,`Panel size not found for panel "${E.id}"`),!L||Co(H,$)>0},[]),z=x.useCallback(E=>{const{panelDataArray:P}=C.current;P.push(E),P.sort((F,$)=>{const L=F.order,H=$.order;return L==null&&H==null?0:L==null?-1:H==null?1:L-H}),C.current.panelDataArrayChanged=!0,w()},[w]);lo(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:E,onLayout:P,storage:F}=S.current,{layout:$,panelDataArray:L}=C.current;let H=null;if(E){const ne=H8(E,L,F);ne&&(k.current=new Map(Object.entries(ne.expandToSizes)),H=ne.layout)}H==null&&(H=F8({panelDataArray:L}));const J=g0({layout:H,panelConstraints:L.map(ne=>ne.constraints)});p0($,J)||(y(J),C.current.layout=J,P&&P(J),Po(L,J,v.current))}}),lo(()=>{const E=C.current;return()=>{E.layout=[]}},[]);const j=x.useCallback(E=>{let P=!1;const F=p.current;return F&&window.getComputedStyle(F,null).getPropertyValue("direction")==="rtl"&&(P=!0),function(L){L.preventDefault();const H=p.current;if(!H)return()=>null;const{direction:J,dragState:ne,id:xe,keyboardResizeBy:ge,onLayout:Pe}=S.current,{layout:Ze,panelDataArray:de}=C.current,{initialLayout:se}=ne??{},it=KT(xe,E,H);let Ye=z8(L,E,J,ne,ge,H);const ie=J==="horizontal";ie&&P&&(Ye=-Ye);const Be=de.map(or=>or.constraints),dt=ul({delta:Ye,initialLayout:se??Ze,panelConstraints:Be,pivotIndices:it,prevLayout:Ze,trigger:jT(L)?"keyboard":"mouse-or-touch"}),ot=!hu(Ze,dt);(zT(L)||FT(L))&&N.current!=Ye&&(N.current=Ye,!ot&&Ye!==0?ie?_p(E,Ye<0?$T:HT):_p(E,Ye<0?UT:VT):_p(E,0)),ot&&(y(dt),C.current.layout=dt,Pe&&Pe(dt),Po(de,dt,v.current))}},[]),q=x.useCallback((E,P)=>{const{onLayout:F}=S.current,{layout:$,panelDataArray:L}=C.current,H=L.map(Ze=>Ze.constraints),{panelSize:J,pivotIndices:ne}=zi(L,E,$);qe(J!=null,`Panel size not found for panel "${E.id}"`);const ge=Wo(L,E)===L.length-1?J-P:P-J,Pe=ul({delta:ge,initialLayout:$,panelConstraints:H,pivotIndices:ne,prevLayout:$,trigger:"imperative-api"});hu($,Pe)||(y(Pe),C.current.layout=Pe,F&&F(Pe),Po(L,Pe,v.current))},[]),re=x.useCallback((E,P)=>{const{layout:F,panelDataArray:$}=C.current,{collapsedSize:L=0,collapsible:H}=P,{collapsedSize:J=0,collapsible:ne,maxSize:xe=100,minSize:ge=0}=E.constraints,{panelSize:Pe}=zi($,E,F);Pe!=null&&(H&&ne&&xs(Pe,L)?xs(L,J)||q(E,J):Pe<ge?q(E,ge):Pe>xe&&q(E,xe))},[q]),G=x.useCallback((E,P)=>{const{direction:F}=S.current,{layout:$}=C.current;if(!p.current)return;const L=nh(E,p.current);qe(L,`Drag handle element not found for id "${E}"`);const H=JT(F,P);g({dragHandleId:E,dragHandleRect:L.getBoundingClientRect(),initialCursorPosition:H,initialLayout:$})},[]),ue=x.useCallback(()=>{g(null)},[]),A=x.useCallback(E=>{const{panelDataArray:P}=C.current,F=Wo(P,E);F>=0&&(P.splice(F,1),delete v.current[E.id],C.current.panelDataArrayChanged=!0,w())},[w]),ce=x.useMemo(()=>({collapsePanel:_,direction:r,dragState:m,expandPanel:O,getPanelSize:T,getPanelStyle:I,groupId:f,isPanelCollapsed:D,isPanelExpanded:V,reevaluatePanelConstraints:re,registerPanel:z,registerResizeHandle:j,resizePanel:q,startDragging:G,stopDragging:ue,unregisterPanel:A,panelGroupElement:p.current}),[_,m,r,O,T,I,f,D,V,re,z,j,q,G,ue,A]),ye={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return x.createElement(Xf.Provider,{value:ce},x.createElement(u,{...d,children:e,className:n,id:i,ref:p,style:{...ye,...c},[zt.group]:"",[zt.groupDirection]:r,[zt.groupId]:f}))}const ay=x.forwardRef((t,e)=>x.createElement(QT,{...t,forwardedRef:e}));QT.displayName="PanelGroup";ay.displayName="forwardRef(PanelGroup)";function Wo(t,e){return t.findIndex(n=>n===e||n.id===e.id)}function zi(t,e,n){const r=Wo(t,e),i=r===t.length-1?[r-1,r]:[r,r+1],o=n[r];return{...e.constraints,panelSize:o,pivotIndices:i}}function W8({disabled:t,handleId:e,resizeHandler:n,panelGroupElement:r}){x.useEffect(()=>{if(t||n==null||r==null)return;const s=nh(e,r);if(s==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),n(o);break}case"F6":{o.preventDefault();const a=s.getAttribute(zt.groupId);qe(a,`No group element found for id "${a}"`);const l=Ql(a,r),c=qT(a,e,r);qe(c!==null,`No resize element found for id "${e}"`);const u=o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return s.addEventListener("keydown",i),()=>{s.removeEventListener("keydown",i)}},[r,t,e,n])}function ly({children:t=null,className:e="",disabled:n=!1,hitAreaMargins:r,id:s,onBlur:i,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:u,style:d={},tabIndex:f=0,tagName:p="div",...m}){var g,b;const y=x.useRef(null),w=x.useRef({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:u});x.useEffect(()=>{w.current.onClick=o,w.current.onDragging=a,w.current.onPointerDown=c,w.current.onPointerUp=u});const v=x.useContext(Xf);if(v===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:k,groupId:N,registerResizeHandle:S,startDragging:C,stopDragging:_,panelGroupElement:O}=v,T=iy(s),[I,D]=x.useState("inactive"),[V,z]=x.useState(!1),[j,q]=x.useState(null),re=x.useRef({state:I});lo(()=>{re.current.state=I}),x.useEffect(()=>{if(n)q(null);else{const ce=S(T);q(()=>ce)}},[n,T,S]);const G=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,ue=(b=r==null?void 0:r.fine)!==null&&b!==void 0?b:5;x.useEffect(()=>{if(n||j==null)return;const ce=y.current;qe(ce,"Element ref not attached");let ye=!1;return A8(T,ce,k,{coarse:G,fine:ue},(P,F,$)=>{if(!F){D("inactive");return}switch(P){case"down":{D("drag"),ye=!1,qe($,'Expected event to be defined for "down" action'),C(T,$);const{onDragging:L,onPointerDown:H}=w.current;L==null||L(!0),H==null||H();break}case"move":{const{state:L}=re.current;ye=!0,L!=="drag"&&D("hover"),qe($,'Expected event to be defined for "move" action'),j($);break}case"up":{D("hover"),_();const{onClick:L,onDragging:H,onPointerUp:J}=w.current;H==null||H(!1),J==null||J(),ye||L==null||L();break}}})},[G,k,n,ue,S,T,j,C,_]),W8({disabled:n,handleId:T,resizeHandler:j,panelGroupElement:O});const A={touchAction:"none",userSelect:"none"};return x.createElement(p,{...m,children:t,className:e,id:s,onBlur:()=>{z(!1),i==null||i()},onFocus:()=>{z(!0),l==null||l()},ref:y,role:"separator",style:{...A,...d},tabIndex:f,[zt.groupDirection]:k,[zt.groupId]:N,[zt.resizeHandle]:"",[zt.resizeHandleActive]:I==="drag"?"pointer":V?"keyboard":void 0,[zt.resizeHandleEnabled]:!n,[zt.resizeHandleId]:T,[zt.resizeHandleState]:I})}ly.displayName="PanelResizeHandle";const y0="sudocode:issues:sortOption";function q8(){var $;const t=kr(),{issues:e,isLoading:n,isError:r,error:s,createIssueAsync:i,updateIssue:o,deleteIssue:a,archiveIssue:l,unarchiveIssue:c,isCreating:u,isUpdating:d,isDeleting:f}=df(),p=JI(),[m,g]=x.useState(),[b,y]=x.useState(!1),[w,v]=x.useState(),[k,N]=x.useState(!1),[S,C]=x.useState(""),[_,O]=x.useState(()=>{try{const L=localStorage.getItem(y0);if(L&&["priority","newest","last-updated"].includes(L))return L}catch(L){console.error("Failed to load sort preference from localStorage:",L)}return"priority"}),[T,I]=x.useState(()=>{try{const L=localStorage.getItem("issuesPage.collapsedColumns");if(L){const H=JSON.parse(L);return new Set(H)}}catch{}return new Set}),D=x.useCallback(L=>{const H=L;O(H);try{localStorage.setItem(y0,H)}catch(J){console.error("Failed to save sort preference to localStorage:",J)}},[]),V=x.useMemo(()=>{const L=S?e.filter(J=>{const ne=S.toLowerCase();return J.title.toLowerCase().includes(ne)||J.content&&J.content.toLowerCase().includes(ne)}):e,H={open:[],in_progress:[],blocked:[],needs_review:[],closed:[]};return L.forEach(J=>{const ne=J.status.toLowerCase();H[ne]?H[ne].push(J):H.open.push(J)}),Object.keys(H).forEach(J=>{H[J].sort((xe,ge)=>{switch(_){case"priority":return xe.priority!==ge.priority?xe.priority-ge.priority:new Date(ge.created_at).getTime()-new Date(xe.created_at).getTime();case"newest":return new Date(ge.created_at).getTime()-new Date(xe.created_at).getTime();case"last-updated":return new Date(ge.updated_at).getTime()-new Date(xe.updated_at).getTime();default:return 0}})}),H},[e,S,_]),z=x.useCallback(L=>{const{active:H,over:J}=L;if(!J||!H.data.current)return;const ne=H.id,xe=J.id,ge=e.find(Pe=>Pe.id===ne);!ge||ge.status===xe||p.mutate({id:ne,status:xe})},[e,p]),j=x.useCallback(L=>{g(L)},[]),q=x.useCallback(()=>{g(void 0)},[]),re=x.useCallback(L=>{v(L),y(!0)},[]),G=x.useCallback(async L=>{try{await i(L),y(!1),v(void 0)}catch(H){console.error("Failed to create issue:",H)}},[i]),ue=x.useCallback(L=>{m&&o({id:m.id,data:L})},[m,o]),A=x.useCallback(()=>{m&&(a(m.id),g(void 0))},[m,a]),ce=x.useCallback(L=>{l(L)},[l]),ye=x.useCallback(L=>{c(L)},[c]),E=x.useCallback(()=>{N(!0)},[]),P=x.useCallback(()=>{(V.closed||[]).forEach(H=>{l(H.id)}),N(!1)},[V.closed,l]),F=x.useCallback(L=>{I(H=>{const J=new Set(H);J.has(L)?J.delete(L):J.add(L);try{localStorage.setItem("issuesPage.collapsedColumns",JSON.stringify(Array.from(J)))}catch{}return J})},[]);return n?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsx("p",{className:"text-muted-foreground",children:"Loading issues..."})}):r?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsxs("p",{className:"text-destructive",children:["Error loading issues: ",(s==null?void 0:s.message)||"Unknown error"]})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Issues"}),h.jsx(ct,{variant:"secondary",children:e.length})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"relative",children:[h.jsx(tf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(Ms,{type:"text",placeholder:"Filter issues...",value:S,onChange:L=>C(L.target.value),className:"h-9 w-64 pl-8"})]}),h.jsxs(In,{value:_,onValueChange:D,children:[h.jsx(vn,{className:"h-9 w-[100px]",children:h.jsx(Dn,{})}),h.jsxs(wn,{children:[h.jsx(Ct,{value:"priority",children:"Priority"}),h.jsx(Ct,{value:"newest",children:"Newest"}),h.jsx(Ct,{value:"last-updated",children:"Updated"})]})]}),h.jsxs(le,{onClick:()=>t("/issues/archived"),variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-foreground",children:[h.jsx(Ia,{className:"h-4 w-4"}),"Archived"]}),h.jsxs(le,{onClick:()=>re(),variant:"default",size:"sm",className:"text-primary-foreground hover:bg-primary/90",children:[h.jsx(ho,{className:"mr-2 h-4 w-4"}),"Create Issue"]})]})]}),h.jsx("div",{className:"flex flex-1 overflow-hidden",children:m?h.jsxs(ay,{direction:"horizontal",className:"h-full min-h-0",onLayout:L=>{if(L.length===2)try{localStorage.setItem("issuesPage.panelSizes",JSON.stringify(L))}catch{}},children:[h.jsx(Zl,{id:"kanban",order:1,defaultSize:(()=>{try{const L=localStorage.getItem("issuesPage.panelSizes");if(L){const H=JSON.parse(L);if(Array.isArray(H)&&H.length===2)return H[0]}}catch{}return 66})(),minSize:30,className:"min-h-0 min-w-0 overflow-auto",children:h.jsx(Fu,{groupedIssues:V,onDragEnd:z,onViewIssueDetails:j,selectedIssue:m,onArchiveAllClosed:E,collapsedColumns:T,onToggleColumnCollapse:F})}),h.jsxs(ly,{className:"group relative z-30 w-1 cursor-col-resize touch-none bg-border focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",children:[h.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),h.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center gap-1 rounded-full border border-border bg-muted/90 px-1.5 py-3 opacity-70 shadow-sm transition-opacity group-hover:opacity-100 group-focus:opacity-100",children:[h.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"})]})]}),h.jsx(Zl,{id:"details",order:2,defaultSize:(()=>{try{const L=localStorage.getItem("issuesPage.panelSizes");if(L){const H=JSON.parse(L);if(Array.isArray(H)&&H.length===2)return H[1]}}catch{}return 34})(),minSize:20,className:"min-h-0 min-w-0 overflow-hidden border-l bg-background shadow-lg",children:h.jsx(ry,{issue:m,onClose:q,onUpdate:ue,onDelete:A,onArchive:ce,onUnarchive:ye,isUpdating:d,isDeleting:f,showOpenDetail:!0})})]}):h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(Fu,{groupedIssues:V,onDragEnd:z,onViewIssueDetails:j,selectedIssue:m,onArchiveAllClosed:E,collapsedColumns:T,onToggleColumnCollapse:F})})}),h.jsx(b8,{isOpen:b,onClose:()=>{y(!1),v(void 0)},onCreate:G,isCreating:u,defaultStatus:w}),h.jsx(Gg,{open:k,onOpenChange:N,children:h.jsxs(vf,{children:[h.jsxs(wf,{children:[h.jsx(Sf,{children:"Archive All Closed Issues?"}),h.jsxs(Ef,{children:["This will archive all ",(($=V.closed)==null?void 0:$.length)||0," closed issues. You can view archived issues later from the Archived Issues page."]})]}),h.jsxs(kf,{children:[h.jsx(Nf,{children:"Cancel"}),h.jsx(Cf,{onClick:P,children:"Archive All"})]})]})})]})}const x0="sudocode:details:viewMode";function K8(){const{id:t}=xg(),e=kr(),{data:n,isLoading:r,isError:s}=GI(t||""),{updateIssue:i,deleteIssue:o,archiveIssue:a,unarchiveIssue:l,isUpdating:c,isDeleting:u}=df(),[d,f]=x.useState(!1),[p,m]=x.useState(()=>{const v=localStorage.getItem(x0);return v!==null?JSON.parse(v):"formatted"}),g=v=>{t&&i({id:t,data:v})},b=()=>{t&&(o(t),e("/issues"))},y=v=>{a(v),e("/issues")},w=v=>{l(v),e("/issues")};return x.useEffect(()=>{localStorage.setItem(x0,JSON.stringify(p))},[p]),r?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),h.jsx("p",{className:"text-muted-foreground",children:"Loading issue..."})]})}):s||!n?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Issue not found"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"The issue you're looking for doesn't exist or has been deleted."}),h.jsx(le,{onClick:()=>e("/issues"),children:"Back to Issues"})]})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsx("div",{className:"flex items-center gap-4",children:h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>e("/issues"),children:"← Back to Issues"})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"mr-4 flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(le,{variant:p==="formatted"?"outline":"ghost",size:"sm",onClick:()=>m("formatted"),className:`h-7 rounded-sm ${p==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(As,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(le,{variant:p==="markdown"?"outline":"ghost",size:"sm",onClick:()=>m("markdown"),className:`h-7 rounded-sm ${p==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(uc,{className:"mr-2 h-4 w-4"}),"Markdown"]})]}),n.archived?h.jsxs(le,{variant:"outline",size:"sm",onClick:()=>w(n.id),disabled:c,children:[h.jsx(Eg,{className:"mr-2 h-4 w-4"}),"Unarchive"]}):h.jsxs(le,{variant:"outline",size:"sm",onClick:()=>y(n.id),disabled:c,children:[h.jsx(Ia,{className:"mr-2 h-4 w-4"}),"Archive"]}),h.jsxs(le,{variant:"outline",size:"sm",onClick:()=>f(!0),disabled:c||u,children:[h.jsx(Da,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(ry,{issue:n,onUpdate:g,isUpdating:c,isDeleting:u,hideTopControls:!0,viewMode:p,onViewModeChange:m,showViewToggleInline:!1})}),h.jsx(qE,{issue:n,isOpen:d,onClose:()=>f(!1),onConfirm:b,isDeleting:u})]})}function rh(t){const e=Ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Xd(),a=cc({queryKey:t!==void 0?["specs",{archived:t}]:["specs"],queryFn:()=>Go.getAll(t)}),l=x.useCallback(m=>{(m.type==="spec_created"||m.type==="spec_updated"||m.type==="spec_deleted")&&e.invalidateQueries({queryKey:["specs"]})},[e]);x.useEffect(()=>{const m="useSpecs";return i(m,l),n&&r("spec"),()=>{o(m),s("spec")}},[n,r,s,i,o,l]);const c=xr({mutationFn:({id:m,data:g})=>Go.update(m,g),onMutate:async({id:m,data:g})=>{await e.cancelQueries({queryKey:["specs"]});const b=e.getQueryData(["specs"]);return e.setQueryData(["specs"],y=>y==null?void 0:y.map(w=>w.id===m?{...w,...g}:w)),{previousSpecs:b}},onError:(m,g,b)=>{b!=null&&b.previousSpecs&&e.setQueryData(["specs"],b.previousSpecs)},onSettled:()=>{e.invalidateQueries({queryKey:["specs"]})}}),u=xr({mutationFn:Go.create,onSuccess:()=>{e.invalidateQueries({queryKey:["specs"]})}}),d=xr({mutationFn:Go.delete,onSuccess:()=>{e.invalidateQueries({queryKey:["specs"]})}}),f=m=>c.mutate({id:m,data:{archived:!0}}),p=m=>c.mutate({id:m,data:{archived:!1}});return{specs:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error,updateSpec:c.mutate,updateSpecAsync:c.mutateAsync,createSpec:u.mutate,createSpecAsync:u.mutateAsync,deleteSpec:d.mutate,archiveSpec:f,unarchiveSpec:p,isUpdating:c.isPending,isCreating:u.isPending}}function G8(t){const e=Ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Xd(),a=cc({queryKey:["specs",t],queryFn:()=>Go.getById(t),enabled:!!t}),l=x.useCallback(c=>{c.type==="spec_updated"&&c.data.id===t&&e.invalidateQueries({queryKey:["specs",t]})},[t,e]);return x.useEffect(()=>{if(!t)return;const c=`useSpec-${t}`;return i(c,l),n&&r("spec",t),()=>{o(c),s("spec",t)}},[n,t,r,s,i,o,l]),{spec:a.data,isLoading:a.isLoading,isError:a.isError,error:a.error}}function J8(t){const e=Ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Xd(),a=cc({queryKey:["feedback",t],queryFn:()=>Go.getFeedback(t),enabled:!!t}),l=x.useCallback(c=>{(c.type==="feedback_created"||c.type==="feedback_updated"||c.type==="feedback_deleted")&&e.invalidateQueries({queryKey:["feedback",t]})},[t,e]);return x.useEffect(()=>{if(!t)return;const c=`useSpecFeedback-${t}`;return i(c,l),n&&r("all"),()=>{o(c),s("all")}},[n,t,r,s,i,o,l]),{feedback:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error}}const Y8={0:"bg-red-600 dark:bg-red-700",1:"bg-orange-600 dark:bg-orange-700",2:"bg-yellow-600 dark:bg-yellow-700",3:"bg-blue-600 dark:bg-blue-700",4:"bg-gray-600 dark:bg-gray-700"},Z8={0:"P0",1:"P1",2:"P2",3:"P3",4:"P4"};function X8({spec:t,onClick:e}){const n=x.useCallback(()=>{e==null||e(t)},[t,e]),r=t.content?t.content.slice(0,200)+(t.content.length>200?"...":""):"";return h.jsx(Bt,{className:`cursor-pointer border border-border p-4 transition-shadow hover:shadow-md ${t.archived?"opacity-60":""}`,onClick:n,children:h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.id})}),t.priority!==void 0&&t.priority<=3&&h.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs text-white ${Y8[t.priority]}`,children:Z8[t.priority]})]}),h.jsx("h3",{className:"line-clamp-2 text-lg font-semibold",children:t.title}),r&&h.jsx("p",{className:"line-clamp-3 text-sm text-muted-foreground",children:r}),h.jsx("div",{className:"flex flex-col gap-2",children:t.file_path&&h.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:t.file_path})})]})})}function eA({specs:t,loading:e=!1,emptyMessage:n="No specs found"}){const r=kr(),s=i=>{r(`/specs/${i.id}`)};return e?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),h.jsx("p",{className:"text-muted-foreground",children:"Loading specs..."})]})}):!t||t.length===0?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-lg text-muted-foreground",children:n}),h.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create a new spec to get started"})]})}):h.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(i=>h.jsx(X8,{spec:i,onClick:s},i.id))})}const v0="sudocode:specEditor:viewMode";function Q8({spec:t,onSave:e,onCancel:n}){const{createSpecAsync:r,updateSpecAsync:s,isCreating:i}=rh(),[o,a]=x.useState((t==null?void 0:t.title)||""),[l,c]=x.useState((t==null?void 0:t.content)||""),[u,d]=x.useState((t==null?void 0:t.priority)??3),[f,p]=x.useState(null),[m,g]=x.useState(()=>{const w=localStorage.getItem(v0);return w!==null?JSON.parse(w):"formatted"}),b=x.useRef(null);x.useEffect(()=>{localStorage.setItem(v0,JSON.stringify(m))},[m]),x.useEffect(()=>{if(m==="markdown"&&b.current){const w=b.current;w.style.height="auto",w.style.height=`${w.scrollHeight}px`}},[l,m]);const y=async w=>{if(w.preventDefault(),p(null),!o.trim()){p("Title is required");return}try{const v={title:o.trim(),content:l.trim()||void 0,priority:u};if(t){const k=await s({id:t.id,data:v});e==null||e(k)}else{const k=await r(v);e==null||e(k)}}catch(v){p(v instanceof Error?v.message:"Failed to save spec")}};return h.jsx(Bt,{className:"p-6",children:h.jsx("form",{onSubmit:y,children:h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{children:h.jsx("h2",{className:"mb-4 text-2xl font-bold",children:t?"Edit Spec":"New Spec"})}),f&&h.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:f}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"title",className:"mb-2 block text-sm font-medium",children:"Title *"}),h.jsx("input",{id:"title",type:"text",value:o,onChange:w=>a(w.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Enter spec title"})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("label",{htmlFor:"content",className:"text-sm font-medium",children:"Content"}),h.jsxs("div",{className:"flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(le,{variant:m==="formatted"?"outline":"ghost",size:"sm",onClick:()=>g("formatted"),className:`h-7 rounded-sm ${m==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(As,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(le,{variant:m==="markdown"?"outline":"ghost",size:"sm",onClick:()=>g("markdown"),className:`h-7 rounded-sm ${m==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(uc,{className:"mr-2 h-4 w-4"}),"Markdown"]})]})]}),h.jsx(Bt,{className:"overflow-hidden rounded-md border",children:m==="formatted"?h.jsx(Zf,{content:l,editable:!0,onChange:w=>c(w),onSave:w=>c(w),onCancel:()=>{t&&c(t.content||"")},className:"min-h-[300px]",placeholder:"Spec content (markdown supported)..."}):h.jsx("div",{className:"p-4",children:h.jsx("textarea",{ref:b,id:"content",value:l,onChange:w=>c(w.target.value),className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",placeholder:"Spec content (markdown supported)...",spellCheck:!1,style:{minHeight:"300px"},disabled:i})})})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"priority",className:"mb-2 block text-sm font-medium",children:"Priority"}),h.jsxs("select",{id:"priority",value:u,onChange:w=>d(Number(w.target.value)),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[h.jsx("option",{value:0,children:"Critical (0)"}),h.jsx("option",{value:1,children:"High (1)"}),h.jsx("option",{value:2,children:"Medium (2)"}),h.jsx("option",{value:3,children:"Low (3)"}),h.jsx("option",{value:4,children:"None (4)"})]})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[n&&h.jsx(le,{type:"button",variant:"outline",onClick:n,disabled:i,children:"Cancel"}),h.jsx(le,{type:"submit",disabled:i,children:i?"Saving...":t?"Update":"Create"})]})]})})})}const w0="sudocode:specs:sortOption";function e7(){const{specs:t,isLoading:e}=rh(),[n,r]=x.useState(!1),[s,i]=x.useState(""),[o,a]=x.useState(()=>{try{const f=localStorage.getItem(w0);if(f&&["priority","newest","last-updated"].includes(f))return f}catch(f){console.error("Failed to load sort preference from localStorage:",f)}return"priority"}),l=kr(),c=f=>{r(!1),l(`/specs/${f.id}`)},u=f=>{const p=f;a(p);try{localStorage.setItem(w0,p)}catch(m){console.error("Failed to save sort preference to localStorage:",m)}},d=x.useMemo(()=>[...s?t.filter(m=>{const g=s.toLowerCase();return m.title.toLowerCase().includes(g)||m.content&&m.content.toLowerCase().includes(g)}):t].sort((m,g)=>{switch(o){case"priority":return m.priority!==g.priority?m.priority-g.priority:new Date(g.created_at).getTime()-new Date(m.created_at).getTime();case"newest":return new Date(g.created_at).getTime()-new Date(m.created_at).getTime();case"last-updated":return new Date(g.updated_at).getTime()-new Date(m.updated_at).getTime();default:return 0}}),[t,s,o]);return n?h.jsx("div",{className:"flex-1 p-8",children:h.jsx(Q8,{onSave:c,onCancel:()=>r(!1)})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Specs"}),h.jsx(ct,{variant:"secondary",children:t.length})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"relative",children:[h.jsx(tf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(Ms,{type:"text",placeholder:"Filter specs...",value:s,onChange:f=>i(f.target.value),className:"h-9 w-64 pl-8"})]}),h.jsxs(le,{onClick:()=>l("/specs/archived"),variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-foreground",children:[h.jsx(Ia,{className:"h-4 w-4"}),"Archived"]}),h.jsxs(le,{onClick:()=>r(!0),variant:"default",size:"sm",className:"text-primary-foreground hover:bg-primary/90",children:[h.jsx(ho,{className:"mr-2 h-4 w-4"}),"Create Spec"]})]})]}),h.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden px-8 py-4",children:[h.jsx("div",{className:"mb-4 flex justify-end",children:h.jsxs(In,{value:o,onValueChange:u,children:[h.jsx(vn,{className:"h-9 w-[180px]",children:h.jsx(Dn,{})}),h.jsxs(wn,{children:[h.jsx(Ct,{value:"priority",children:"Priority"}),h.jsx(Ct,{value:"newest",children:"Newest"}),h.jsx(Ct,{value:"last-updated",children:"Last Updated"})]})]})}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(eA,{specs:d,loading:e})})]})]})}function t7(t){const e=Ts(),n=xr({mutationFn:i=>mh.create(i),onSuccess:()=>{e.invalidateQueries({queryKey:["feedback",t]})}}),r=xr({mutationFn:({id:i,data:o})=>mh.update(i,o),onMutate:async({id:i,data:o})=>{await e.cancelQueries({queryKey:["feedback",t]});const a=e.getQueryData(["feedback",t]);return e.setQueryData(["feedback",t],l=>l==null?void 0:l.map(c=>{if(c.id!==i)return c;const u={};return o.content!==void 0&&(u.content=o.content),o.feedback_type!==void 0&&(u.feedback_type=o.feedback_type),o.dismissed!==void 0&&(u.dismissed=o.dismissed),o.anchor!==void 0&&(u.anchor=typeof o.anchor=="string"?o.anchor:JSON.stringify(o.anchor)),{...c,...u}})),{previousFeedback:a}},onError:(i,o,a)=>{a!=null&&a.previousFeedback&&e.setQueryData(["feedback",t],a.previousFeedback)},onSettled:()=>{e.invalidateQueries({queryKey:["feedback",t]})}}),s=xr({mutationFn:i=>mh.delete(i),onMutate:async i=>{await e.cancelQueries({queryKey:["feedback",t]});const o=e.getQueryData(["feedback",t]);return e.setQueryData(["feedback",t],a=>a==null?void 0:a.filter(l=>l.id!==i)),{previousFeedback:o}},onError:(i,o,a)=>{a!=null&&a.previousFeedback&&e.setQueryData(["feedback",t],a.previousFeedback)},onSettled:()=>{e.invalidateQueries({queryKey:["feedback",t]})}});return{createFeedback:n.mutate,createFeedbackAsync:n.mutateAsync,updateFeedback:r.mutate,updateFeedbackAsync:r.mutateAsync,deleteFeedback:s.mutate,deleteFeedbackAsync:s.mutateAsync,isCreating:n.isPending,isUpdating:r.isPending,isDeleting:s.isPending}}function n7({type:t,count:e=1,onClick:n,className:r=""}){const s=()=>{switch(t){case"comment":return h.jsx(ef,{className:"h-3 w-3"});case"suggestion":return h.jsx(Ak,{className:"h-3 w-3"});case"request":return h.jsx(fo,{className:"h-3 w-3"})}},i=()=>{switch(t){case"comment":return"bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800";case"suggestion":return"bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-700 dark:hover:bg-yellow-800";case"request":return"bg-orange-600 hover:bg-orange-700 dark:bg-orange-700 dark:hover:bg-orange-800"}};return h.jsxs("button",{onClick:n,className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium text-white transition-colors ${i()} ${r}`,title:`${e} ${t}${e>1?"s":""}`,children:[s(),e>1&&h.jsx("span",{children:e})]})}function r7({content:t,showLineNumbers:e=!0,highlightLines:n=[],feedback:r=[],selectedLine:s,onLineClick:i,onTextSelect:o,onFeedbackClick:a,editable:l=!1,onChange:c,className:u=""}){const d=x.useRef(null),f=x.useMemo(()=>t.split(`
562
+ `),[t]),p=x.useMemo(()=>{const y=new Map;return r.forEach(w=>{try{const v=w.anchor?JSON.parse(w.anchor):null;if(v!=null&&v.line_number){const k=y.get(v.line_number)||[];y.set(v.line_number,[...k,w])}else if(v!=null&&v.text_snippet){const k=v.text_snippet.replace(/\.\.\./g,"").trim();if(k){const N=t.split(`
563
+ `);for(let S=0;S<N.length;S++)if(N[S].includes(k)){const C=S+1,_=y.get(C)||[];y.set(C,[..._,w]);break}}}}catch(v){console.error("Failed to parse feedback anchor:",v)}}),y},[r,t]),m=y=>{i==null||i(y)},g=y=>{if(!o)return;const w=window.getSelection(),v=w==null?void 0:w.toString().trim();v&&v.length>0&&o(v,y)},b=y=>{c==null||c(y.target.value)};return x.useEffect(()=>{if(l&&d.current){const y=d.current;y.style.height="auto",y.style.height=`${y.scrollHeight}px`}},[t,l]),h.jsx(Bt,{className:`overflow-hidden ${u}`,children:h.jsx("div",{className:"relative",children:l?h.jsx("div",{className:"pl-2 pr-4 py-4",children:h.jsx("textarea",{ref:d,value:t,onChange:b,className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1})}):h.jsx("div",{className:`grid overflow-x-auto ${e?"grid-cols-[auto_1fr]":"grid-cols-1"}`,children:f.flatMap((y,w)=>{const v=w+1,k=p.get(v)||[],N=[];return e&&N.push(h.jsx("div",{className:`select-none border-r border-border bg-muted/30 pl-1 pr-2 py-1 text-right font-mono text-[10px] leading-6 text-muted-foreground transition-colors hover:bg-primary/10 ${n.includes(v)?"font-bold text-primary":""} ${s===v?"bg-primary/20":""}`,"data-line-number":v,onClick:()=>m(v),children:v},`line-${w}`)),N.push(h.jsx("div",{className:`group relative pl-2 pr-4 py-1 font-mono text-sm leading-6 ${n.includes(v)?"bg-primary/10":""} ${s===v?"bg-primary/20":""}`,"data-line":v,children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("pre",{className:"m-0 inline flex-1 cursor-pointer whitespace-pre-wrap break-words font-mono transition-colors hover:bg-muted/30",onClick:()=>m(v),onMouseUp:()=>g(v),children:y||" "}),k.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1",children:Array.from(new Set(k.map(S=>S.feedback_type))).map(S=>{const C=k.filter(_=>_.feedback_type===S);return h.jsx(n7,{type:S,count:C.length,onClick:()=>a==null?void 0:a(C[0])},S)})})]})},`content-${w}`)),N})})})})}function s7({content:t,feedback:e=[],selectedLine:n,onLineClick:r,onTextSelect:s,onFeedbackClick:i,onChange:o,viewMode:a="formatted",onViewModeChange:l,className:c=""}){return h.jsx(Bt,{className:`overflow-hidden ${c}`,children:a==="formatted"?h.jsx(Zf,{content:t,editable:!0,onChange:o,onCancel:()=>{},showLineNumbers:!0,selectedLine:n,onLineClick:r,placeholder:"Spec content..."}):h.jsx(r7,{content:t,feedback:e,selectedLine:n,onLineClick:r,onTextSelect:s,onFeedbackClick:i,showLineNumbers:!1,editable:!0,onChange:o})})}const i7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,a7={};function k0(t,e){return(a7.jsx?o7:i7).test(t)}var jo={},Ap,S0;function l7(){if(S0)return Ap;S0=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
564
+ `,c="/",u="*",d="",f="comment",p="declaration";function m(b,y){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];y=y||{};var w=1,v=1;function k(z){var j=z.match(e);j&&(w+=j.length);var q=z.lastIndexOf(l);v=~q?z.length-q:v+z.length}function N(){var z={line:w,column:v};return function(j){return j.position=new S(z),O(),j}}function S(z){this.start=z,this.end={line:w,column:v},this.source=y.source}S.prototype.content=b;function C(z){var j=new Error(y.source+":"+w+":"+v+": "+z);if(j.reason=z,j.filename=y.source,j.line=w,j.column=v,j.source=b,!y.silent)throw j}function _(z){var j=z.exec(b);if(j){var q=j[0];return k(q),b=b.slice(q.length),j}}function O(){_(n)}function T(z){var j;for(z=z||[];j=I();)j!==!1&&z.push(j);return z}function I(){var z=N();if(!(c!=b.charAt(0)||u!=b.charAt(1))){for(var j=2;d!=b.charAt(j)&&(u!=b.charAt(j)||c!=b.charAt(j+1));)++j;if(j+=2,d===b.charAt(j-1))return C("End of comment missing");var q=b.slice(2,j-2);return v+=2,k(q),b=b.slice(j),v+=2,z({type:f,comment:q})}}function D(){var z=N(),j=_(r);if(j){if(I(),!_(s))return C("property missing ':'");var q=_(i),re=z({type:p,property:g(j[0].replace(t,d)),value:q?g(q[0].replace(t,d)):d});return _(o),re}}function V(){var z=[];T(z);for(var j;j=D();)j!==!1&&(z.push(j),T(z));return z}return O(),V()}function g(b){return b?b.replace(a,d):d}return Ap=m,Ap}var E0;function c7(){if(E0)return jo;E0=1;var t=jo&&jo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jo,"__esModule",{value:!0}),jo.default=n;const e=t(l7());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const o=(0,e.default)(r),a=typeof s=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?s(c,u,l):u&&(i=i||{},i[c]=u)}),i}return jo}var nl={},C0;function u7(){if(C0)return nl;C0=1,Object.defineProperty(nl,"__esModule",{value:!0}),nl.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(c){return!c||n.test(c)||t.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(s,a):c=c.replace(r,a),c.replace(e,o))};return nl.camelCase=l,nl}var rl,N0;function d7(){if(N0)return rl;N0=1;var t=rl&&rl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(c7()),n=u7();function r(s,i){var o={};return!s||typeof s!="string"||(0,e.default)(s,function(a,l){a&&l&&(o[(0,n.camelCase)(a,i)]=l)}),o}return r.default=r,rl=r,rl}var f7=d7();const h7=lc(f7),cy={}.hasOwnProperty,p7=new Map,m7=/[A-Z]/g,g7=new Set(["table","tbody","thead","tfoot","tr"]),b7=new Set(["td","th"]),tA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function y7(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=N7(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=C7(n,e.jsx,e.jsxs)}const s={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"?Tc:iT,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=nA(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function nA(t,e,n){if(e.type==="element")return x7(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return v7(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return k7(t,e,n);if(e.type==="mdxjsEsm")return w7(t,e);if(e.type==="root")return S7(t,e,n);if(e.type==="text")return E7(t,e)}function x7(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Tc,t.schema=s),t.ancestors.push(e);const i=sA(t,e.tagName,!1),o=_7(t,e);let a=dy(t,e);return g7.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Jf(l):!0})),rA(t,o,i,e),uy(o,a),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function v7(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)}ec(t,e.position)}function w7(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ec(t,e.position)}function k7(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Tc,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:sA(t,e.name,!0),o=T7(t,e),a=dy(t,e);return rA(t,o,i,e),uy(o,a),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function S7(t,e,n){const r={};return uy(r,dy(t,e)),t.create(e,t.Fragment,r,n)}function E7(t,e){return e.value}function rA(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function uy(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function C7(t,e,n){return r;function r(s,i,o,a){const c=Array.isArray(o.children)?n:e;return a?c(i,o,a):c(i,o)}}function N7(t,e){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=qb(r);return e(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function _7(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&cy.call(e.properties,s)){const i=A7(t,s,e.properties[s]);if(i){const[o,a]=i;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&b7.has(e.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function T7(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else ec(t,e.position);else{const s=r.name;let i;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,i=t.evaluater.evaluateExpression(a.expression)}else ec(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function dy(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:p7;for(;++r<e.children.length;){const i=e.children[r];let o;if(t.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=s.get(l)||0;o=l+"-"+c,s.set(l,c+1)}}const a=nA(t,i,o);a!==void 0&&n.push(a)}return n}function A7(t,e,n){const r=sT(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?aT(n):lT(n)),r.property==="style"){let s=typeof n=="object"?n:M7(t,String(n));return t.stylePropertyNameCase==="css"&&(s=R7(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&r.space?g6[r.property]||r.property:r.attribute,n]}}function M7(t,e){try{return h7(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,s=new Nn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=tA+"#cannot-parse-style-attribute",s}}function sA(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,o;for(;++i<s.length;){const a=k0(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=k0(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const s=r.value;return cy.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(r);ec(t)}function ec(t,e){const n=new Nn("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=tA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function R7(t){const e={};let n;for(n in t)cy.call(t,n)&&(e[O7(n)]=t[n]);return e}function O7(t){let e=t.replace(m7,I7);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function I7(t){return"-"+t.toLowerCase()}const Mp={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="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_0=[],T0={allowDangerousHtml:!0},L7=/^(https?|ircs?|mailto|xmpp)$/i,P7=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function iA(t){const e=j7(t),n=z7(t);return F7(e.runSync(e.parse(n),n),t)}function j7(t){const e=t.rehypePlugins||_0,n=t.remarkPlugins||_0,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...T0}:T0;return t_().use(g_).use(n).use(Y_,r).use(e)}function z7(t){const e=t.children||"",n=new e_;return typeof e=="string"&&(n.value=e),n}function F7(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||B7;for(const u of P7)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+D7+u.id,void 0);return e.className&&(t={type:"element",tagName:"div",properties:{className:e.className},children:t.type==="root"?t.children:[t]}),Ub(t,c),y7(t,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let p;for(p in Mp)if(Object.hasOwn(Mp,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],g=Mp[p];(g===null||g.includes(u.tagName))&&(u.properties[p]=l(String(m||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&r&&typeof d=="number"&&(p=!r(u,d,f)),p&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function B7(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||L7.test(t.slice(0,e))?t:""}function $7({feedback:t,onDismiss:e,onDelete:n,onClick:r,className:s="",maxHeight:i=500,isCompact:o=!1}){const[a,l]=x.useState(!1),[c,u]=x.useState(!o),d=kr();let f=null;try{t.anchor&&(f=JSON.parse(t.anchor))}catch(b){console.error("Failed to parse feedback anchor:",b)}const p=b=>{switch(b){case"comment":return h.jsx(ef,{className:"h-4 w-4"});case"suggestion":return h.jsx(Ak,{className:"h-4 w-4"});case"request":return h.jsx(fo,{className:"h-4 w-4"})}},m=b=>{switch(b){case"comment":return"text-blue-600 bg-blue-50";case"suggestion":return"text-yellow-600 bg-yellow-50";case"request":return"text-orange-600 bg-orange-50"}},g=()=>f?f.line_number?`L${f.line_number}`:f.section_heading?`§ ${f.section_heading}`:f.text_snippet?`"${f.text_snippet.slice(0,30)}${f.text_snippet.length>30?"...":""}"`:null:null;return h.jsx(Bt,{className:`relative cursor-pointer rounded-lg border-2 bg-card shadow-sm transition-all hover:border-primary/30 hover:shadow-lg ${t.dismissed?"opacity-60":""} ${s}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:r,children:h.jsxs("div",{className:"p-3",children:[h.jsxs("div",{className:"mb-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:`flex-shrink-0 rounded-full p-1.5 ${m(t.feedback_type)}`,title:t.feedback_type,children:p(t.feedback_type)}),h.jsx("button",{className:"text-xs font-medium text-foreground hover:text-primary hover:underline",onClick:b=>{b.stopPropagation(),d(`/issues/${t.issue_id}`)},children:t.issue_id})]}),(e||n)&&h.jsxs("div",{className:"flex flex-shrink-0 gap-1 transition-opacity duration-150",style:{opacity:a?1:0},children:[!t.dismissed&&e&&h.jsx(le,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),e(t.id)},title:"Dismiss",className:"h-6 w-6 p-0",children:h.jsx(Tk,{className:"h-3 w-3"})}),t.dismissed&&e&&h.jsx(le,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),e(t.id)},title:"Restore",className:"h-6 w-6 p-0",children:h.jsx(hl,{className:"h-3 w-3"})}),n&&h.jsx(le,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),n(t.id)},title:"Delete",className:"h-6 w-6 p-0",children:h.jsx(Da,{className:"h-3 w-3"})})]})]}),h.jsxs("div",{className:"ml-9 flex items-center gap-2 text-xs text-muted-foreground",children:[f&&g()&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"flex-shrink-0",children:g()}),h.jsx("span",{className:"flex-shrink-0",children:"•"})]}),h.jsx("span",{className:"flex-shrink-0",children:Bu(new Date(t.created_at.endsWith("Z")?t.created_at:t.created_at+"Z"),{addSuffix:!0})})]})]}),h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none text-sm text-foreground",style:{maxHeight:c?`${i}px`:"3rem",overflowY:"auto",overflowX:"auto"},children:h.jsx(iA,{remarkPlugins:[H_],components:{p:({children:b})=>h.jsx("p",{className:"my-1 break-words",children:b}),h1:({children:b})=>h.jsx("h1",{className:"my-1 text-lg font-bold break-words",children:b}),h2:({children:b})=>h.jsx("h2",{className:"my-1 text-base font-bold break-words",children:b}),h3:({children:b})=>h.jsx("h3",{className:"my-1 text-sm font-bold break-words",children:b}),ul:({children:b})=>h.jsx("ul",{className:"my-1 pl-4",children:b}),ol:({children:b})=>h.jsx("ol",{className:"my-1 pl-4",children:b}),li:({children:b})=>h.jsx("li",{className:"my-0.5 break-words",children:b}),code:({children:b,className:y})=>!y?h.jsx("code",{className:"break-words rounded bg-muted px-1 py-0.5 font-mono text-xs",children:b}):h.jsx("code",{className:`my-1 block overflow-x-auto rounded bg-muted p-2 font-mono text-xs ${y||""}`,children:b}),pre:({children:b})=>h.jsx("pre",{className:"my-1 overflow-x-auto",children:b}),blockquote:({children:b})=>h.jsx("blockquote",{className:"my-1 border-l-2 border-muted-foreground/30 pl-2 italic break-words",children:b}),a:({href:b,children:y})=>h.jsx("a",{href:b,className:"break-all text-primary underline hover:text-primary/80",target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),children:y}),strong:({children:b})=>h.jsx("strong",{className:"font-semibold",children:b}),em:({children:b})=>h.jsx("em",{className:"italic",children:b})},children:t.content})}),t.content.length>100&&h.jsx("button",{className:"mt-1 text-xs text-primary hover:underline",onClick:b=>{b.stopPropagation(),u(!c)},children:c?"Show less":"Show more"})]})})}function H7({positions:t,cardHeight:e=120,minSpacing:n=8,measuredHeights:r}){return x.useMemo(()=>{const s=new Map,i=Array.from(t.entries()).map(([a,l])=>({id:a,idealTop:l})).sort((a,l)=>a.idealTop-l.idealTop),o=[];for(const a of i){const l=(r==null?void 0:r.get(a.id))??e;let c=a.idealTop,u=!0;for(;u;){u=!1;for(const f of o){const p=f.actualTop+f.height+n,m=c+l;if(c<p&&m>f.actualTop){c=p,u=!0;break}}}const d={id:a.id,idealTop:a.idealTop,actualTop:c,height:l};o.push(d),s.set(a.id,d)}return s},[t,e,n,r])}const A0="sudocode:specs:showRelationshipsCollapsed";function U7(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function V7({feedback:t,positions:e,onFeedbackClick:n,onDismiss:r,onDelete:s,addFeedbackButton:i,className:o="",relationships:a,currentEntityId:l,onDeleteRelationship:c,onCreateRelationship:u}){const d=x.useRef(null),f=x.useRef(new Map),[p,m]=x.useState(new Map),[g,b]=x.useState(!1),[y,w]=x.useState(()=>{const _=localStorage.getItem(A0);return _!==null?JSON.parse(_):!1}),v=(_,O,T)=>{u&&(u(_,O,T),b(!1))};x.useEffect(()=>{localStorage.setItem(A0,JSON.stringify(y))},[y]);const k=x.useCallback(()=>{const _=new Map;let O=!1;t.forEach(T=>{const I=f.current.get(T.id);if(I){const V=I.getBoundingClientRect().height,z=p.get(T.id);z===void 0||Math.abs(V-z)>5?(_.set(T.id,V),O=!0):_.set(T.id,z)}}),O&&m(_)},[t,p]);x.useEffect(()=>{const _=setTimeout(k,100),O=setInterval(k,500),T=()=>{k()};return window.addEventListener("resize",T),()=>{clearTimeout(_),clearInterval(O),window.removeEventListener("resize",T)}},[k]);const N=x.useCallback(_=>O=>{O?f.current.set(_,O):f.current.delete(_)},[]),S=x.useMemo(()=>{const _=new Map,O=16;return t.forEach(T=>{const I=U7(T.anchor);if(!I||!I.line_number)_.set(T.id,O);else{const D=e.get(T.id);D!==void 0&&_.set(T.id,Math.max(D,O))}}),_},[t,e]),C=H7({positions:S,cardHeight:130,minSpacing:8,measuredHeights:p});return h.jsxs("div",{className:`flex h-full w-64 flex-col bg-background pr-4 sm:w-80 md:w-96 lg:w-[28rem] xl:w-[30rem] 2xl:w-[40rem] ${o}`,children:[l&&h.jsxs("div",{className:"p-2",children:[h.jsxs("div",{className:"mb-2 flex cursor-pointer items-center justify-between rounded-md border p-2",onClick:()=>w(!y),children:[h.jsxs("div",{className:"flex items-center gap-2",children:[y?h.jsx(Rl,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(Ng,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Relationships"}),a&&a.length>0&&h.jsx(ct,{variant:"secondary",children:a.length})]}),u&&h.jsxs(le,{variant:"outline",size:"xs",onClick:_=>{_.stopPropagation(),b(!0)},className:"h-6",children:[h.jsx(ho,{className:"mr-1 h-4 w-4"}),"Add"]})]}),!y&&a&&a.length>0&&h.jsx(GE,{relationships:a,currentEntityId:l,currentEntityType:"spec",onDelete:c,showEmpty:!1,showGroupHeaders:!1})]}),h.jsx(Mo,{open:g,onOpenChange:b,children:h.jsxs(Ci,{children:[h.jsx(Ni,{children:h.jsx(_i,{children:"Add Relationship"})}),l&&h.jsx(ZE,{fromId:l,fromType:"spec",onSubmit:v,onCancel:()=>b(!1)})]})}),i&&h.jsx("div",{className:"p-2",children:i}),h.jsx("div",{className:"relative min-h-full flex-1",children:h.jsxs("div",{ref:d,className:"relative w-full pt-4",children:[t.map(_=>{const O=C.get(_.id);return O?h.jsx("div",{ref:N(_.id),className:"absolute w-full px-1",style:{top:`${O.actualTop}px`,zIndex:10},children:h.jsx($7,{feedback:_,onClick:()=>n==null?void 0:n(_),onDismiss:r?()=>r(_.id):void 0,onDelete:s?()=>s(_.id):void 0,maxHeight:800,isCompact:!1})},_.id):null}),t.length>0&&h.jsx("div",{style:{height:`${Math.max(...Array.from(C.values()).map(_=>_.actualTop+_.height))+100}px`,pointerEvents:"none"}})]})})]})}function W7({issues:t=[],selectedIssueId:e,onIssueSelect:n,issueId:r,lineNumber:s,textSnippet:i,onSubmit:o,onCancel:a,className:l=""}){const[c,u]=x.useState("comment"),[d,f]=x.useState(""),[p,m]=x.useState(!1),g=e||r,b=async y=>{if(y.preventDefault(),!!d.trim()){m(!0);try{let w;(s||i)&&(w={line_number:s,text_snippet:i,anchor_status:"valid",last_verified_at:new Date().toISOString()}),await o({type:c,content:d.trim(),anchor:w}),f(""),u("comment")}finally{m(!1)}}};return h.jsxs("form",{onSubmit:b,className:`space-y-4 ${l}`,children:[(s||i)&&h.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-sm",children:[s&&h.jsxs("div",{className:"font-medium",children:["Line ",s]}),i&&h.jsxs("div",{className:"text-muted-foreground",children:['"',i.slice(0,60),i.length>60?"...":"",'"']})]}),t.length>0&&n&&h.jsxs("div",{children:[h.jsx(Yt,{htmlFor:"issue-select",children:"Issue"}),h.jsxs(In,{value:g,onValueChange:n,children:[h.jsx(vn,{id:"issue-select",children:h.jsx(Dn,{placeholder:"Select an issue..."})}),h.jsx(wn,{children:t.map(y=>h.jsxs(Ct,{value:y.id,children:[y.id,": ",y.title]},y.id))})]})]}),h.jsxs("div",{children:[h.jsx(Yt,{htmlFor:"feedback-type",children:"Type"}),h.jsxs(In,{value:c,onValueChange:y=>u(y),children:[h.jsx(vn,{id:"feedback-type",children:h.jsx(Dn,{})}),h.jsxs(wn,{children:[h.jsx(Ct,{value:"comment",children:"Comment"}),h.jsx(Ct,{value:"suggestion",children:"Suggestion"}),h.jsx(Ct,{value:"request",children:"Request"})]})]})]}),h.jsxs("div",{children:[h.jsx(Yt,{htmlFor:"feedback-content",children:"Content"}),h.jsx(_f,{id:"feedback-content",placeholder:"Enter your feedback...",value:d,onChange:y=>f(y.target.value),rows:4,required:!0,className:"resize-none"})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(le,{type:"submit",disabled:!d.trim()||!g||p,children:p?"Adding...":"Add Feedback"}),h.jsx(le,{type:"button",variant:"outline",onClick:a,children:"Cancel"})]})]})}function q7({issues:t,lineNumber:e,textSnippet:n,onSubmit:r,triggerButton:s}){const[i,o]=x.useState(!1),[a,l]=x.useState(),c=async u=>{a&&(await r({issueId:a,...u}),o(!1),l(void 0))};return h.jsxs(Mo,{open:i,onOpenChange:o,children:[h.jsx(hO,{asChild:!0,children:s||h.jsxs(le,{variant:"outline",size:"sm",children:[h.jsx(Tg,{className:"mr-2 h-4 w-4"}),"Add Feedback"]})}),h.jsxs(Ci,{className:"sm:max-w-[500px]",children:[h.jsxs(Ni,{children:[h.jsx(_i,{children:"Add Feedback"}),h.jsxs(sf,{children:["Add a comment, suggestion, or request to this spec.",e&&` Anchored to line ${e}.`]})]}),h.jsx(W7,{issues:t,selectedIssueId:a,onIssueSelect:l,lineNumber:e,textSnippet:n,onSubmit:c,onCancel:()=>o(!1)})]})]})}function K7(t,e){let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>t(...r),e)}}function G7(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function J7(t,e){const[n,r]=x.useState(new Map),s=x.useRef(null),i=x.useRef(null);return x.useEffect(()=>{const o=()=>{const u=new Map,d=e.current;if(!d){r(u);return}t.forEach(f=>{var g;const p=G7(f.anchor);if(!p)return;let m=d.querySelector(`[data-feedback-id="${f.id}"]`);if(!m&&p.line_number!==void 0&&(m=d.querySelector(`[data-line-number="${p.line_number}"]`),!m)){const b=Array.from(d.querySelectorAll("[data-line-number]"));if(b.length>0&&p.line_number>0){let y=null,w=0;for(const v of b){const k=parseInt(v.getAttribute("data-line-number")||"0");k>0&&k<=p.line_number&&k>w&&(w=k,y=v)}m=y||b[0]}}if(!m&&p.text_snippet){const b=p.text_snippet.replace(/\.\.\./g,"").trim();if(b){const y=Array.from(d.querySelectorAll("[data-line-number]"));for(const w of y)if((g=w.textContent)!=null&&g.includes(b)){m=w;break}}}if(m){let b=0,y=m;for(;y&&y!==d;)b+=y.offsetTop,y=y.offsetParent;u.set(f.id,b)}}),r(u)},a=()=>{i.current!==null&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(o)},l=K7(o,100),c=e.current;return c==null||c.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",l),s.current=setTimeout(o,50),()=>{c==null||c.removeEventListener("scroll",a),window.removeEventListener("resize",l),s.current&&clearTimeout(s.current),i.current!==null&&cancelAnimationFrame(i.current)}},[t,e]),n}const Y7=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}],M0="sudocode:specs:showFeedbackPanel",R0="sudocode:details:viewMode";function Z7(){const{id:t}=xg(),e=kr(),{spec:n,isLoading:r,isError:s}=G8(t||""),{feedback:i}=J8(t||""),{issues:o}=df(),{updateSpec:a,isUpdating:l,archiveSpec:c,unarchiveSpec:u}=rh(),{createFeedback:d,updateFeedback:f,deleteFeedback:p}=t7(t||""),[m,g]=x.useState(null),[b,y]=x.useState(null),[w,v]=x.useState(()=>{const de=localStorage.getItem(M0);return de!==null?JSON.parse(de):!0}),[k,N]=x.useState(()=>{const de=localStorage.getItem(R0);return de!==null?JSON.parse(de):"formatted"}),[S,C]=x.useState(""),[_,O]=x.useState(""),[T,I]=x.useState(2),[D,V]=x.useState(!1),[z,j]=x.useState([]),[q,re]=x.useState(!1),G=x.useRef(null),ue=x.useRef(a),A=x.useRef({title:S,content:_,priority:T,hasChanges:D}),ce=x.useRef(t),ye=x.useRef(null),E=J7(i,ye);if(x.useEffect(()=>{ue.current=a},[a]),x.useEffect(()=>{A.current={title:S,content:_,priority:T,hasChanges:D}},[S,_,T,D]),x.useEffect(()=>{ce.current=t},[t]),x.useEffect(()=>{G.current&&(clearTimeout(G.current),G.current=null),V(!1)},[t]),x.useEffect(()=>{n&&(C(n.title),O(n.content||""),I(n.priority??2),V(!1))},[n]),x.useEffect(()=>{(async()=>{if(t){re(!0);try{const se=await Qo.getForEntity(t,"spec");let it=[];if(Array.isArray(se))it=se;else if(se&&typeof se=="object"&&"outgoing"in se&&"incoming"in se){const Ye=se;it=[...Ye.outgoing||[],...Ye.incoming||[]]}j(it)}catch(se){console.error("Failed to fetch relationships:",se),j([])}finally{re(!1)}}})()},[t]),x.useEffect(()=>{if(!(!D||!t))return G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{ue.current({id:t,data:{title:S,content:_,priority:T}}),V(!1)},1e3),()=>{G.current&&clearTimeout(G.current)}},[S,_,T,D]),x.useEffect(()=>()=>{const{hasChanges:de,title:se,content:it,priority:Ye}=A.current,ie=ce.current;de&&ie&&ue.current&&ue.current({id:ie,data:{title:se,content:it,priority:Ye}})},[]),x.useEffect(()=>{localStorage.setItem(M0,JSON.stringify(w))},[w]),x.useEffect(()=>{localStorage.setItem(R0,JSON.stringify(k))},[k]),r)return h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),h.jsx("p",{className:"text-muted-foreground",children:"Loading spec..."})]})});if(s||!n)return h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Spec not found"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"The spec you're looking for doesn't exist or has been deleted."}),h.jsx(le,{onClick:()=>e("/specs"),children:"Back to Specs"})]})});const P=de=>{g(de),y(null),v(!0)},F=(de,se)=>{y(de),g(se),v(!0)},$=de=>{try{const se=de.anchor?JSON.parse(de.anchor):null;se!=null&&se.line_number&&g(se.line_number)}catch(se){console.error("Failed to parse feedback anchor:",se)}},L=de=>{C(de),V(!0)},H=de=>{O(de),V(!0)},J=de=>{I(de),V(!0)},ne=de=>{const se=i.find(it=>it.id===de);se&&f({id:de,data:{dismissed:!se.dismissed}})},xe=de=>{p(de)},ge=async de=>{if(!t){console.error("Cannot create feedback without spec ID");return}await d({spec_id:t,issue_id:de.issueId,feedback_type:de.type,content:de.content,anchor:de.anchor})},Pe=async de=>{try{await Qo.delete({from_id:de.from_id,from_type:de.from_type,to_id:de.to_id,to_type:de.to_type,relationship_type:de.relationship_type}),j(z.filter(se=>!(se.from_id===de.from_id&&se.to_id===de.to_id&&se.relationship_type===de.relationship_type)))}catch(se){console.error("Failed to delete relationship:",se)}},Ze=async(de,se,it)=>{if(t)try{const Ye=await Qo.create({from_id:t,from_type:"spec",to_id:de,to_type:se,relationship_type:it});j([...z,Ye])}catch(Ye){console.error("Failed to create relationship:",Ye)}};return h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-2 sm:p-4",children:[h.jsx("div",{className:"flex items-center gap-2 sm:gap-4",children:h.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>e("/specs"),children:["← ",h.jsx("span",{className:"hidden sm:inline",children:"Back to Specs"})]})}),h.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[h.jsx("div",{className:"flex items-center gap-1 sm:gap-2",children:h.jsxs("div",{className:"inline-flex rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(le,{variant:k==="formatted"?"outline":"ghost",size:"sm",onClick:()=>N("formatted"),className:`h-7 rounded-sm ${k==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(As,{className:"h-4 w-4 sm:mr-2"}),h.jsx("span",{className:"hidden sm:inline",children:"Formatted"})]}),h.jsxs(le,{variant:k==="source"?"outline":"ghost",size:"sm",onClick:()=>N("source"),className:`h-7 rounded-sm ${k==="source"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(uc,{className:"h-4 w-4 sm:mr-2"}),h.jsx("span",{className:"hidden sm:inline",children:"Markdown"})]})]})}),h.jsx(po,{children:h.jsxs(gr,{children:[h.jsx(br,{asChild:!0,children:h.jsxs(le,{variant:"outline",size:"sm",onClick:()=>v(!w),children:[w?h.jsx(nR,{className:"h-4 w-4"}):h.jsx(ef,{className:"h-4 w-4"}),i.length>0&&h.jsx("span",{className:"ml-2 rounded-full bg-primary px-2 py-0.5 text-xs text-primary-foreground",children:i.length})]})}),h.jsx(er,{children:h.jsxs("p",{children:[w?"Hide":"Show"," feedback"]})})]})}),n.archived?h.jsxs(le,{variant:"outline",size:"sm",onClick:()=>u(n.id),disabled:l,children:[h.jsx(Eg,{className:"h-4 w-4 sm:mr-2"}),h.jsx("span",{className:"hidden sm:inline",children:"Unarchive"})]}):h.jsxs(le,{variant:"outline",size:"sm",onClick:()=>c(n.id),disabled:l,children:[h.jsx(Ia,{className:"h-4 w-4 sm:mr-2"}),h.jsx("span",{className:"hidden sm:inline",children:"Archive"})]})]})]}),h.jsx("div",{ref:ye,className:"flex flex-1 overflow-auto xl:justify-center",children:h.jsxs("div",{className:"flex w-full 2xl:max-w-[128rem]",children:[h.jsx("div",{className:"flex-1 px-3 py-4 sm:px-6 lg:px-12 xl:px-16",children:h.jsxs("div",{className:"mx-auto max-w-full space-y-3",children:[h.jsxs("div",{className:"space-y-2 pb-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:n.id}),h.jsx("div",{className:"text-xs italic text-muted-foreground",children:l?"Saving...":D?"Unsaved changes...":"All changes saved"})]}),h.jsx(Ms,{value:S,onChange:de=>L(de.target.value),disabled:l,placeholder:"Spec title...",className:"border-none bg-transparent px-0 text-2xl font-semibold shadow-none focus-visible:ring-0"})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Rk,{className:"h-4 w-4 text-muted-foreground"}),h.jsxs(In,{value:String(T),onValueChange:de=>J(parseInt(de)),disabled:l,children:[h.jsx(vn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:h.jsx(Dn,{placeholder:"Priority"})}),h.jsx(wn,{children:Y7.map(de=>h.jsx(Ct,{value:de.value,children:de.label},de.value))})]})]}),h.jsx("div",{className:"ml-auto flex items-center gap-4 text-xs text-muted-foreground",children:n.updated_at&&h.jsxs("div",{className:"ml-auto flex items-center text-xs text-muted-foreground",children:["Updated"," ",Bu(new Date(n.updated_at.endsWith("Z")?n.updated_at:n.updated_at+"Z"),{addSuffix:!0})]})})]}),_!==void 0?h.jsx(s7,{content:_,feedback:i,selectedLine:m,onLineClick:P,onTextSelect:F,onFeedbackClick:$,onChange:H,viewMode:k,onViewModeChange:N}):h.jsx(Bt,{className:"p-8 text-center",children:h.jsx("p",{className:"text-muted-foreground",children:"No content available for this spec."})})]})}),w&&h.jsx(V7,{feedback:i,positions:E,relationships:z,currentEntityId:t,onFeedbackClick:$,onDismiss:ne,onDelete:xe,onDeleteRelationship:Pe,onCreateRelationship:Ze,addFeedbackButton:h.jsx("div",{className:"flex justify-center",children:h.jsx(q7,{issues:o,lineNumber:m||void 0,onSubmit:ge,triggerButton:h.jsxs(le,{variant:"secondary",size:"sm",children:[h.jsx(Tg,{className:"mr-2 h-4 w-4"}),"Add Feedback"]})})})})]})})]})}function X7(){const t=kr(),{issues:e,isLoading:n,isError:r,error:s,updateIssue:i,deleteIssue:o,unarchiveIssue:a,isUpdating:l,isDeleting:c}=df(!0),[u,d]=x.useState(),[f,p]=x.useState(""),m=x.useMemo(()=>{const k=f?e.filter(S=>{const C=f.toLowerCase();return S.title.toLowerCase().includes(C)||S.content&&S.content.toLowerCase().includes(C)}):e,N={open:[],in_progress:[],blocked:[],needs_review:[],closed:[]};return k.forEach(S=>{const C=S.status.toLowerCase();N[C]?N[C].push(S):N.open.push(S)}),Object.keys(N).forEach(S=>{const C=S;C==="closed"?N[C].sort((_,O)=>{const T=_.closed_at?new Date(_.closed_at).getTime():0;return(O.closed_at?new Date(O.closed_at).getTime():0)-T}):N[C].sort((_,O)=>_.priority!==O.priority?_.priority-O.priority:new Date(_.created_at).getTime()-new Date(O.created_at).getTime())}),N},[e,f]),g=x.useCallback(k=>{d(k)},[]),b=x.useCallback(()=>{d(void 0)},[]),y=x.useCallback(k=>{u&&i({id:u.id,data:k})},[u,i]),w=x.useCallback(()=>{u&&(o(u.id),d(void 0))},[u,o]),v=x.useCallback(k=>{a(k)},[a]);return n?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsx("p",{className:"text-muted-foreground",children:"Loading archived issues..."})}):r?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsxs("p",{className:"text-destructive",children:["Error loading archived issues: ",(s==null?void 0:s.message)||"Unknown error"]})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>t("/issues"),className:"h-8 w-8 p-0",children:h.jsx(Qd,{className:"h-4 w-4"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Archived Issues"}),h.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," archived issues"]})]})]}),h.jsxs("div",{className:"relative",children:[h.jsx(tf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(Ms,{type:"text",placeholder:"Filter issues...",value:f,onChange:k=>p(k.target.value),className:"h-9 w-64 pl-8"})]})]}),h.jsx("div",{className:"flex flex-1 overflow-hidden",children:u?h.jsxs(ay,{direction:"horizontal",className:"h-full min-h-0",onLayout:k=>{if(k.length===2)try{localStorage.setItem("archivedIssuesPage.panelSizes",JSON.stringify(k))}catch{}},children:[h.jsx(Zl,{id:"kanban",order:1,defaultSize:(()=>{try{const k=localStorage.getItem("archivedIssuesPage.panelSizes");if(k){const N=JSON.parse(k);if(Array.isArray(N)&&N.length===2)return N[0]}}catch{}return 66})(),minSize:30,className:"min-w-0 min-h-0 overflow-auto",children:h.jsx(Fu,{groupedIssues:m,onDragEnd:()=>{},onViewIssueDetails:g,selectedIssue:u})}),h.jsxs(ly,{className:"relative z-30 w-1 bg-border cursor-col-resize group touch-none focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",children:[h.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border"}),h.jsxs("div",{className:"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-1 bg-muted/90 border border-border rounded-full px-1.5 py-3 opacity-70 group-hover:opacity-100 group-focus:opacity-100 transition-opacity shadow-sm",children:[h.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground"})]})]}),h.jsx(Zl,{id:"details",order:2,defaultSize:(()=>{try{const k=localStorage.getItem("archivedIssuesPage.panelSizes");if(k){const N=JSON.parse(k);if(Array.isArray(N)&&N.length===2)return N[1]}}catch{}return 34})(),minSize:20,className:"min-w-0 min-h-0 overflow-hidden border-l bg-background shadow-lg",children:h.jsx(ry,{issue:u,onClose:b,onUpdate:y,onDelete:w,onUnarchive:v,isUpdating:l,isDeleting:c})})]}):h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(Fu,{groupedIssues:m,onDragEnd:()=>{},onViewIssueDetails:g,selectedIssue:u})})})]})}function Q7(){const{specs:t,isLoading:e}=rh(!0),n=kr(),[r,s]=x.useState(""),i=r?t.filter(o=>{const a=r.toLowerCase();return o.title.toLowerCase().includes(a)||o.content&&o.content.toLowerCase().includes(a)}):t;return h.jsxs("div",{className:"flex-1 p-8",children:[h.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx(le,{variant:"ghost",size:"sm",onClick:()=>n("/specs"),className:"h-8 w-8 p-0",children:h.jsx(Qd,{className:"h-4 w-4"})}),h.jsx("h1",{className:"text-3xl font-bold",children:"Archived Specs"})]}),h.jsx("p",{className:"text-muted-foreground ml-10",children:e?"Loading...":`${t.length} archived spec${t.length!==1?"s":""}`})]}),h.jsxs("div",{className:"relative",children:[h.jsx(tf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(Ms,{type:"text",placeholder:"Filter specs...",value:r,onChange:o=>s(o.target.value),className:"h-9 w-64 pl-8"})]})]}),h.jsx(eA,{specs:i,loading:e})]})}var st;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(st||(st={}));var O0;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(O0||(O0={}));const be=st.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ks=t=>{switch(typeof t){case"undefined":return be.undefined;case"string":return be.string;case"number":return Number.isNaN(t)?be.nan:be.number;case"boolean":return be.boolean;case"function":return be.function;case"bigint":return be.bigint;case"symbol":return be.symbol;case"object":return Array.isArray(t)?be.array:t===null?be.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?be.promise:typeof Map<"u"&&t instanceof Map?be.map:typeof Set<"u"&&t instanceof Set?be.set:typeof Date<"u"&&t instanceof Date?be.date:be.object;default:return be.unknown}},Q=st.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ns extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Ns))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,st.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ns.create=t=>new Ns(t);const og=(t,e)=>{let n;switch(t.code){case Q.invalid_type:t.received===be.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,st.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${st.joinValues(t.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${st.joinValues(t.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${st.joinValues(t.options)}, received '${t.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:st.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Q.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Q.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=e.defaultError,st.assertNever(t)}return{message:n}};let eJ=og;function tJ(){return eJ}const nJ=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function me(t,e){const n=tJ(),r=nJ({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===og?void 0:og].filter(s=>!!s)});t.common.issues.push(r)}class ir{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return Le;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return ir.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Le;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const Le=Object.freeze({status:"aborted"}),fl=t=>({status:"dirty",value:t}),Sr=t=>({status:"valid",value:t}),I0=t=>t.status==="aborted",D0=t=>t.status==="dirty",Ma=t=>t.status==="valid",Bd=t=>typeof Promise<"u"&&t instanceof Promise;var ve;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ve||(ve={}));class Si{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const L0=(t,e)=>{if(Ma(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ns(t.common.issues);return this._error=n,this._error}}};function Je(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class rt{get description(){return this._def.description}_getType(e){return Ks(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ir,ctx:{common:e.parent.common,data:e.data,parsedType:Ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Bd(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)},s=this._parseSync({data:e,path:r.path,parent:r});return L0(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Ma(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Ma(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ks(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Bd(s)?s:Promise.resolve(s));return L0(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:Q.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new To({schema:this,typeName:ze.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ss.create(this,this._def)}nullable(){return Ao.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zr.create(this)}promise(){return qd.create(this,this._def)}or(e){return Hd.create([this,e],this._def)}and(e){return Ud.create(this,e,this._def)}transform(e){return new To({...Je(this._def),schema:this,typeName:ze.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Kd({...Je(this._def),innerType:this,defaultValue:n,typeName:ze.ZodDefault})}brand(){return new cA({typeName:ze.ZodBranded,type:this,...Je(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Gd({...Je(this._def),innerType:this,catchValue:n,typeName:ze.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return hy.create(this,e)}readonly(){return Jd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const rJ=/^c[^\s-]{8,}$/i,sJ=/^[0-9a-z]+$/,iJ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oJ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,aJ=/^[a-z0-9_-]{21}$/i,lJ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cJ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,uJ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dJ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Rp;const fJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,pJ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,mJ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gJ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bJ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,oA="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",yJ=new RegExp(`^${oA}$`);function aA(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function xJ(t){return new RegExp(`^${aA(t)}$`)}function vJ(t){let e=`${oA}T${aA(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function wJ(t,e){return!!((e==="v4"||!e)&&fJ.test(t)||(e==="v6"||!e)&&pJ.test(t))}function kJ(t,e){if(!lJ.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function SJ(t,e){return!!((e==="v4"||!e)&&hJ.test(t)||(e==="v6"||!e)&&mJ.test(t))}class fi extends rt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==be.string){const i=this._getOrReturnCtx(e);return me(i,{code:Q.invalid_type,expected:be.string,received:i.parsedType}),Le}const r=new ir;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),me(s,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),me(s,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?me(s,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&me(s,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")uJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"email",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Rp||(Rp=new RegExp(dJ,"u")),Rp.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"emoji",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")oJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"uuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")aJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"nanoid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")rJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"cuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")sJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"cuid2",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")iJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"ulid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),me(s,{validation:"url",code:Q.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"regex",code:Q.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),me(s,{code:Q.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),me(s,{code:Q.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),me(s,{code:Q.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?vJ(i).test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{code:Q.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?yJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{code:Q.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?xJ(i).test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{code:Q.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?cJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"duration",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?wJ(e.data,i.version)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"ip",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?kJ(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"jwt",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?SJ(e.data,i.version)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"cidr",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?gJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"base64",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?bJ.test(e.data)||(s=this._getOrReturnCtx(e,s),me(s,{validation:"base64url",code:Q.invalid_string,message:i.message}),r.dirty()):st.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:Q.invalid_string,...ve.errToObj(r)})}_addCheck(e){return new fi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ve.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ve.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ve.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ve.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ve.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ve.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ve.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ve.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ve.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ve.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ve.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ve.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ve.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...ve.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ve.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ve.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ve.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ve.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ve.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ve.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ve.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ve.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ve.errToObj(n)})}nonempty(e){return this.min(1,ve.errToObj(e))}trim(){return new fi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new fi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new fi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}fi.create=t=>new fi({checks:[],typeName:ze.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Je(t)});function EJ(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class Ra extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==be.number){const i=this._getOrReturnCtx(e);return me(i,{code:Q.invalid_type,expected:be.number,received:i.parsedType}),Le}let r;const s=new ir;for(const i of this._def.checks)i.kind==="int"?st.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),me(r,{code:Q.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),me(r,{code:Q.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),me(r,{code:Q.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?EJ(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),me(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),me(r,{code:Q.not_finite,message:i.message}),s.dirty()):st.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ve.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ve.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ve.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ve.toString(n))}setLimit(e,n,r,s){return new Ra({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ve.toString(s)}]})}_addCheck(e){return new Ra({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ve.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ve.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&st.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Ra.create=t=>new Ra({checks:[],typeName:ze.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Je(t)});class tc extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==be.bigint)return this._getInvalidInput(e);let r;const s=new ir;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),me(r,{code:Q.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),me(r,{code:Q.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),me(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):st.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return me(n,{code:Q.invalid_type,expected:be.bigint,received:n.parsedType}),Le}gte(e,n){return this.setLimit("min",e,!0,ve.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ve.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ve.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ve.toString(n))}setLimit(e,n,r,s){return new tc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ve.toString(s)}]})}_addCheck(e){return new tc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}tc.create=t=>new tc({checks:[],typeName:ze.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Je(t)});class P0 extends rt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==be.boolean){const r=this._getOrReturnCtx(e);return me(r,{code:Q.invalid_type,expected:be.boolean,received:r.parsedType}),Le}return Sr(e.data)}}P0.create=t=>new P0({typeName:ze.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Je(t)});class $d extends rt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==be.date){const i=this._getOrReturnCtx(e);return me(i,{code:Q.invalid_type,expected:be.date,received:i.parsedType}),Le}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return me(i,{code:Q.invalid_date}),Le}const r=new ir;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),me(s,{code:Q.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),me(s,{code:Q.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):st.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new $d({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ve.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ve.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}$d.create=t=>new $d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ze.ZodDate,...Je(t)});class j0 extends rt{_parse(e){if(this._getType(e)!==be.symbol){const r=this._getOrReturnCtx(e);return me(r,{code:Q.invalid_type,expected:be.symbol,received:r.parsedType}),Le}return Sr(e.data)}}j0.create=t=>new j0({typeName:ze.ZodSymbol,...Je(t)});class ag extends rt{_parse(e){if(this._getType(e)!==be.undefined){const r=this._getOrReturnCtx(e);return me(r,{code:Q.invalid_type,expected:be.undefined,received:r.parsedType}),Le}return Sr(e.data)}}ag.create=t=>new ag({typeName:ze.ZodUndefined,...Je(t)});class lg extends rt{_parse(e){if(this._getType(e)!==be.null){const r=this._getOrReturnCtx(e);return me(r,{code:Q.invalid_type,expected:be.null,received:r.parsedType}),Le}return Sr(e.data)}}lg.create=t=>new lg({typeName:ze.ZodNull,...Je(t)});class cg extends rt{constructor(){super(...arguments),this._any=!0}_parse(e){return Sr(e.data)}}cg.create=t=>new cg({typeName:ze.ZodAny,...Je(t)});class z0 extends rt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Sr(e.data)}}z0.create=t=>new z0({typeName:ze.ZodUnknown,...Je(t)});class Ei extends rt{_parse(e){const n=this._getOrReturnCtx(e);return me(n,{code:Q.invalid_type,expected:be.never,received:n.parsedType}),Le}}Ei.create=t=>new Ei({typeName:ze.ZodNever,...Je(t)});class F0 extends rt{_parse(e){if(this._getType(e)!==be.undefined){const r=this._getOrReturnCtx(e);return me(r,{code:Q.invalid_type,expected:be.void,received:r.parsedType}),Le}return Sr(e.data)}}F0.create=t=>new F0({typeName:ze.ZodVoid,...Je(t)});class Zr extends rt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==be.array)return me(n,{code:Q.invalid_type,expected:be.array,received:n.parsedType}),Le;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(me(n,{code:o?Q.too_big:Q.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(me(n,{code:Q.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(me(n,{code:Q.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Si(n,o,n.path,a)))).then(o=>ir.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Si(n,o,n.path,a)));return ir.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Zr({...this._def,minLength:{value:e,message:ve.toString(n)}})}max(e,n){return new Zr({...this._def,maxLength:{value:e,message:ve.toString(n)}})}length(e,n){return new Zr({...this._def,exactLength:{value:e,message:ve.toString(n)}})}nonempty(e){return this.min(1,e)}}Zr.create=(t,e)=>new Zr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ze.ZodArray,...Je(e)});function qo(t){if(t instanceof Wt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ss.create(qo(r))}return new Wt({...t._def,shape:()=>e})}else return t instanceof Zr?new Zr({...t._def,type:qo(t.element)}):t instanceof Ss?Ss.create(qo(t.unwrap())):t instanceof Ao?Ao.create(qo(t.unwrap())):t instanceof No?No.create(t.items.map(e=>qo(e))):t}class Wt extends rt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=st.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==be.object){const c=this._getOrReturnCtx(e);return me(c,{code:Q.invalid_type,expected:be.object,received:c.parsedType}),Le}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ei&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],d=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Si(s,d,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ei){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(me(s,{code:Q.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Si(s,d,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>ir.mergeObjectSync(r,c)):ir.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ve.errToObj,new Wt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ve.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Wt({...this._def,unknownKeys:"strip"})}passthrough(){return new Wt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Wt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Wt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ze.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Wt({...this._def,catchall:e})}pick(e){const n={};for(const r of st.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Wt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of st.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Wt({...this._def,shape:()=>n})}deepPartial(){return qo(this)}partial(e){const n={};for(const r of st.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Wt({...this._def,shape:()=>n})}required(e){const n={};for(const r of st.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ss;)i=i._def.innerType;n[r]=i}return new Wt({...this._def,shape:()=>n})}keyof(){return lA(st.objectKeys(this.shape))}}Wt.create=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strip",catchall:Ei.create(),typeName:ze.ZodObject,...Je(e)});Wt.strictCreate=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strict",catchall:Ei.create(),typeName:ze.ZodObject,...Je(e)});Wt.lazycreate=(t,e)=>new Wt({shape:t,unknownKeys:"strip",catchall:Ei.create(),typeName:ze.ZodObject,...Je(e)});class Hd extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ns(a.ctx.common.issues));return me(n,{code:Q.invalid_union,unionErrors:o}),Le}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ns(l));return me(n,{code:Q.invalid_union,unionErrors:a}),Le}}get options(){return this._def.options}}Hd.create=(t,e)=>new Hd({options:t,typeName:ze.ZodUnion,...Je(e)});const hs=t=>t instanceof dg?hs(t.schema):t instanceof To?hs(t.innerType()):t instanceof Vd?[t.value]:t instanceof _o?t.options:t instanceof Wd?st.objectValues(t.enum):t instanceof Kd?hs(t._def.innerType):t instanceof ag?[void 0]:t instanceof lg?[null]:t instanceof Ss?[void 0,...hs(t.unwrap())]:t instanceof Ao?[null,...hs(t.unwrap())]:t instanceof cA||t instanceof Jd?hs(t.unwrap()):t instanceof Gd?hs(t._def.innerType):[];class fy extends rt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==be.object)return me(n,{code:Q.invalid_type,expected:be.object,received:n.parsedType}),Le;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(me(n,{code:Q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Le)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=hs(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new fy({typeName:ze.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Je(r)})}}function ug(t,e){const n=Ks(t),r=Ks(e);if(t===e)return{valid:!0,data:t};if(n===be.object&&r===be.object){const s=st.objectKeys(e),i=st.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=ug(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===be.array&&r===be.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=ug(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===be.date&&r===be.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Ud extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(I0(i)||I0(o))return Le;const a=ug(i.value,o.value);return a.valid?((D0(i)||D0(o))&&n.dirty(),{status:n.value,value:a.data}):(me(r,{code:Q.invalid_intersection_types}),Le)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ud.create=(t,e,n)=>new Ud({left:t,right:e,typeName:ze.ZodIntersection,...Je(n)});class No extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==be.array)return me(r,{code:Q.invalid_type,expected:be.array,received:r.parsedType}),Le;if(r.data.length<this._def.items.length)return me(r,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Le;!this._def.rest&&r.data.length>this._def.items.length&&(me(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Si(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>ir.mergeArray(n,o)):ir.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new No({...this._def,rest:e})}}No.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new No({items:t,typeName:ze.ZodTuple,rest:null,...Je(e)})};class B0 extends rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==be.map)return me(r,{code:Q.invalid_type,expected:be.map,received:r.parsedType}),Le;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Si(r,a,r.path,[c,"key"])),value:i._parse(new Si(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Le;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Le;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}B0.create=(t,e,n)=>new B0({valueType:e,keyType:t,typeName:ze.ZodMap,...Je(n)});class nc extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==be.set)return me(r,{code:Q.invalid_type,expected:be.set,received:r.parsedType}),Le;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(me(r,{code:Q.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(me(r,{code:Q.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Le;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Si(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new nc({...this._def,minSize:{value:e,message:ve.toString(n)}})}max(e,n){return new nc({...this._def,maxSize:{value:e,message:ve.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}nc.create=(t,e)=>new nc({valueType:t,minSize:null,maxSize:null,typeName:ze.ZodSet,...Je(e)});class dg extends rt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dg.create=(t,e)=>new dg({getter:t,typeName:ze.ZodLazy,...Je(e)});class Vd extends rt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return me(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),Le}return{status:"valid",value:e.data}}get value(){return this._def.value}}Vd.create=(t,e)=>new Vd({value:t,typeName:ze.ZodLiteral,...Je(e)});function lA(t,e){return new _o({values:t,typeName:ze.ZodEnum,...Je(e)})}class _o extends rt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return me(n,{expected:st.joinValues(r),received:n.parsedType,code:Q.invalid_type}),Le}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return me(n,{received:n.data,code:Q.invalid_enum_value,options:r}),Le}return Sr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return _o.create(e,{...this._def,...n})}exclude(e,n=this._def){return _o.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}_o.create=lA;class Wd extends rt{_parse(e){const n=st.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==be.string&&r.parsedType!==be.number){const s=st.objectValues(n);return me(r,{expected:st.joinValues(s),received:r.parsedType,code:Q.invalid_type}),Le}if(this._cache||(this._cache=new Set(st.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=st.objectValues(n);return me(r,{received:r.data,code:Q.invalid_enum_value,options:s}),Le}return Sr(e.data)}get enum(){return this._def.values}}Wd.create=(t,e)=>new Wd({values:t,typeName:ze.ZodNativeEnum,...Je(e)});class qd extends rt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==be.promise&&n.common.async===!1)return me(n,{code:Q.invalid_type,expected:be.promise,received:n.parsedType}),Le;const r=n.parsedType===be.promise?n.data:Promise.resolve(n.data);return Sr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}qd.create=(t,e)=>new qd({type:t,typeName:ze.ZodPromise,...Je(e)});class To extends rt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{me(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Le;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Le:l.status==="dirty"||n.value==="dirty"?fl(l.value):l});{if(n.value==="aborted")return Le;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Le:a.status==="dirty"||n.value==="dirty"?fl(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Le:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Le:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ma(o))return Le;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ma(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):Le);st.assertNever(s)}}To.create=(t,e,n)=>new To({schema:t,typeName:ze.ZodEffects,effect:e,...Je(n)});To.createWithPreprocess=(t,e,n)=>new To({schema:e,effect:{type:"preprocess",transform:t},typeName:ze.ZodEffects,...Je(n)});class Ss extends rt{_parse(e){return this._getType(e)===be.undefined?Sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ss.create=(t,e)=>new Ss({innerType:t,typeName:ze.ZodOptional,...Je(e)});class Ao extends rt{_parse(e){return this._getType(e)===be.null?Sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ao.create=(t,e)=>new Ao({innerType:t,typeName:ze.ZodNullable,...Je(e)});class Kd extends rt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===be.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Kd.create=(t,e)=>new Kd({innerType:t,typeName:ze.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Je(e)});class Gd extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Bd(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ns(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ns(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Gd.create=(t,e)=>new Gd({innerType:t,typeName:ze.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Je(e)});class $0 extends rt{_parse(e){if(this._getType(e)!==be.nan){const r=this._getOrReturnCtx(e);return me(r,{code:Q.invalid_type,expected:be.nan,received:r.parsedType}),Le}return{status:"valid",value:e.data}}}$0.create=t=>new $0({typeName:ze.ZodNaN,...Je(t)});class cA extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class hy extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Le:i.status==="dirty"?(n.dirty(),fl(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Le:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new hy({in:e,out:n,typeName:ze.ZodPipeline})}}class Jd extends rt{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Ma(s)&&(s.value=Object.freeze(s.value)),s);return Bd(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Jd.create=(t,e)=>new Jd({innerType:t,typeName:ze.ZodReadonly,...Je(e)});var ze;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ze||(ze={}));const Ie=fi.create,CJ=Ra.create,_s=cg.create;Ei.create;const aa=Zr.create,Di=Wt.create,uA=Hd.create,dA=fy.create;Ud.create;No.create;const Ke=Vd.create;_o.create;const NJ=Wd.create;qd.create;Ss.create;Ao.create;var _J=Di({name:Ie(),arguments:Ie()}),TJ=Di({id:Ie(),type:Ke("function"),function:_J}),sh=Di({id:Ie(),role:Ie(),content:Ie().optional(),name:Ie().optional()}),AJ=sh.extend({role:Ke("developer"),content:Ie()}),MJ=sh.extend({role:Ke("system"),content:Ie()}),RJ=sh.extend({role:Ke("assistant"),content:Ie().optional(),toolCalls:aa(TJ).optional()}),OJ=sh.extend({role:Ke("user"),content:Ie()}),IJ=Di({id:Ie(),content:Ie(),role:Ke("tool"),toolCallId:Ie(),error:Ie().optional()}),fA=dA("role",[AJ,MJ,RJ,OJ,IJ]);uA([Ke("developer"),Ke("system"),Ke("assistant"),Ke("user"),Ke("tool")]);var DJ=Di({description:Ie(),value:Ie()}),LJ=Di({name:Ie(),description:Ie(),parameters:_s()});Di({threadId:Ie(),runId:Ie(),state:_s(),messages:aa(fA),tools:aa(LJ),context:aa(DJ),forwardedProps:_s()});var PJ=_s(),hA=uA([Ke("developer"),Ke("system"),Ke("assistant"),Ke("user")]),bn=(t=>(t.TEXT_MESSAGE_START="TEXT_MESSAGE_START",t.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",t.TEXT_MESSAGE_END="TEXT_MESSAGE_END",t.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",t.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",t.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",t.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",t.TOOL_CALL_START="TOOL_CALL_START",t.TOOL_CALL_ARGS="TOOL_CALL_ARGS",t.TOOL_CALL_END="TOOL_CALL_END",t.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",t.TOOL_CALL_RESULT="TOOL_CALL_RESULT",t.THINKING_START="THINKING_START",t.THINKING_END="THINKING_END",t.STATE_SNAPSHOT="STATE_SNAPSHOT",t.STATE_DELTA="STATE_DELTA",t.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",t.RAW="RAW",t.CUSTOM="CUSTOM",t.RUN_STARTED="RUN_STARTED",t.RUN_FINISHED="RUN_FINISHED",t.RUN_ERROR="RUN_ERROR",t.STEP_STARTED="STEP_STARTED",t.STEP_FINISHED="STEP_FINISHED",t))(bn||{}),Dt=Di({type:NJ(bn),timestamp:CJ().optional(),rawEvent:_s().optional()}),jJ=Dt.extend({type:Ke("TEXT_MESSAGE_START"),messageId:Ie(),role:hA.default("assistant")}),pA=Dt.extend({type:Ke("TEXT_MESSAGE_CONTENT"),messageId:Ie(),delta:Ie().refine(t=>t.length>0,"Delta must not be an empty string")}),zJ=Dt.extend({type:Ke("TEXT_MESSAGE_END"),messageId:Ie()}),FJ=Dt.extend({type:Ke("TEXT_MESSAGE_CHUNK"),messageId:Ie().optional(),role:hA.optional(),delta:Ie().optional()}),BJ=Dt.extend({type:Ke("THINKING_TEXT_MESSAGE_START")}),$J=pA.omit({messageId:!0,type:!0}).extend({type:Ke("THINKING_TEXT_MESSAGE_CONTENT")}),HJ=Dt.extend({type:Ke("THINKING_TEXT_MESSAGE_END")}),UJ=Dt.extend({type:Ke("TOOL_CALL_START"),toolCallId:Ie(),toolCallName:Ie(),parentMessageId:Ie().optional()}),VJ=Dt.extend({type:Ke("TOOL_CALL_ARGS"),toolCallId:Ie(),delta:Ie()}),WJ=Dt.extend({type:Ke("TOOL_CALL_END"),toolCallId:Ie()}),qJ=Dt.extend({messageId:Ie(),type:Ke("TOOL_CALL_RESULT"),toolCallId:Ie(),content:Ie(),role:Ke("tool").optional()}),KJ=Dt.extend({type:Ke("TOOL_CALL_CHUNK"),toolCallId:Ie().optional(),toolCallName:Ie().optional(),parentMessageId:Ie().optional(),delta:Ie().optional()}),GJ=Dt.extend({type:Ke("THINKING_START"),title:Ie().optional()}),JJ=Dt.extend({type:Ke("THINKING_END")}),YJ=Dt.extend({type:Ke("STATE_SNAPSHOT"),snapshot:PJ}),ZJ=Dt.extend({type:Ke("STATE_DELTA"),delta:aa(_s())}),XJ=Dt.extend({type:Ke("MESSAGES_SNAPSHOT"),messages:aa(fA)}),QJ=Dt.extend({type:Ke("RAW"),event:_s(),source:Ie().optional()}),eY=Dt.extend({type:Ke("CUSTOM"),name:Ie(),value:_s()}),tY=Dt.extend({type:Ke("RUN_STARTED"),threadId:Ie(),runId:Ie()}),nY=Dt.extend({type:Ke("RUN_FINISHED"),threadId:Ie(),runId:Ie(),result:_s().optional()}),rY=Dt.extend({type:Ke("RUN_ERROR"),message:Ie(),code:Ie().optional()}),sY=Dt.extend({type:Ke("STEP_STARTED"),stepName:Ie()}),iY=Dt.extend({type:Ke("STEP_FINISHED"),stepName:Ie()});dA("type",[jJ,pA,zJ,FJ,GJ,JJ,BJ,$J,HJ,UJ,VJ,WJ,KJ,qJ,YJ,ZJ,XJ,QJ,eY,tY,nY,rY,sY,iY]);function oY(t){const{executionId:e,autoConnect:n=!0,reconnectOnError:r=!1,endpoint:s,onEvent:i}=t,[o,a]=x.useState("idle"),[l,c]=x.useState({runId:null,threadId:null,status:"idle",currentStep:null,error:null,startTime:null,endTime:null}),[u,d]=x.useState(new Map),[f,p]=x.useState(new Map),[m,g]=x.useState({}),[b,y]=x.useState(null),w=x.useRef(null),v=x.useRef(null),k=x.useRef(i),N=x.useRef(!1);x.useEffect(()=>{k.current=i},[i]);const S=x.useCallback(E=>{var P,F;c($=>({...$,runId:E.runId,threadId:E.threadId,status:"running",startTime:E.timestamp||Date.now()})),(F=(P=k.current)==null?void 0:P.onRunStarted)==null||F.call(P,E)},[]),C=x.useCallback(E=>{var P,F;c($=>({...$,status:"completed",endTime:E.timestamp||Date.now()})),(F=(P=k.current)==null?void 0:P.onRunFinished)==null||F.call(P,E),N.current=!0,w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),_=x.useCallback(E=>{var P,F;c($=>({...$,status:"error",error:E.message,endTime:E.timestamp||Date.now()})),y(new Error(E.message)),(F=(P=k.current)==null?void 0:P.onRunError)==null||F.call(P,E),N.current=!0,w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),O=x.useCallback(E=>{var P,F;c($=>({...$,currentStep:E.stepName})),(F=(P=k.current)==null?void 0:P.onStepStarted)==null||F.call(P,E)},[]),T=x.useCallback(E=>{var P,F;(F=(P=k.current)==null?void 0:P.onStepFinished)==null||F.call(P,E)},[]),I=x.useCallback(E=>{d(P=>{const F=new Map(P);return F.set(E.messageId,{messageId:E.messageId,role:E.role||"assistant",content:"",complete:!1,timestamp:E.timestamp||Date.now()}),F})},[]),D=x.useCallback(E=>{d(P=>{var L,H;const F=new Map(P),$=F.get(E.messageId);if($){const J={...$,content:$.content+E.delta};F.set(E.messageId,J),(H=(L=k.current)==null?void 0:L.onMessage)==null||H.call(L,J)}return F})},[]),V=x.useCallback(E=>{d(P=>{var L,H;const F=new Map(P),$=F.get(E.messageId);if($){const J={...$,complete:!0};F.set(E.messageId,J),(H=(L=k.current)==null?void 0:L.onMessage)==null||H.call(L,J)}return F})},[]),z=x.useCallback(E=>{var P,F;p($=>{const L=new Map($);return L.set(E.toolCallId,{toolCallId:E.toolCallId,toolCallName:E.toolCallName,args:"",status:"started",startTime:E.timestamp||Date.now()}),L}),(F=(P=k.current)==null?void 0:P.onToolCallStart)==null||F.call(P,E)},[]),j=x.useCallback(E=>{p(P=>{const F=new Map(P),$=F.get(E.toolCallId);return $&&F.set(E.toolCallId,{...$,args:$.args+E.delta,status:"executing"}),F})},[]),q=x.useCallback(E=>{var P,F;p($=>{const L=new Map($),H=L.get(E.toolCallId);return H&&L.set(E.toolCallId,{...H,endTime:E.timestamp||Date.now()}),L}),(F=(P=k.current)==null?void 0:P.onToolCallEnd)==null||F.call(P,E)},[]),re=x.useCallback(E=>{p(P=>{const F=new Map(P),$=F.get(E.toolCallId);return $&&F.set(E.toolCallId,{...$,result:E.content,status:"completed"}),F})},[]),G=x.useCallback(E=>{var P,F;g(E.snapshot),(F=(P=k.current)==null?void 0:P.onStateUpdate)==null||F.call(P,E.snapshot)},[]),ue=x.useCallback(E=>{g(P=>{var $,L;let F={...P};for(const H of E.delta)if(H.op==="replace"){const J=H.path.slice(1);F={...F,[J]:H.value}}else if(H.op==="add"){const J=H.path.slice(1);F={...F,[J]:H.value}}return(L=($=k.current)==null?void 0:$.onStateUpdate)==null||L.call($,F),F})},[]),A=x.useCallback(()=>{if(N.current){console.debug("[SSE] Skipping connection - execution already completed");return}if(w.current){console.warn("EventSource already connected");return}const E=s||`/api/executions/${e}/stream`;console.debug("[SSE]. Connecting to SSE stream",{executionId:e,url:E,timestamp:new Date().toISOString()}),a("connecting"),y(null);try{const P=new EventSource(E);w.current=P,P.onopen=()=>{console.debug("[SSE]. SSE connection established",{executionId:e,timestamp:new Date().toISOString()}),a("connected")},P.onerror=F=>{if(console.error("EventSource error:",F),N.current){ce();return}a("error"),y(new Error("SSE connection error")),r&&v.current===null&&(console.debug("[SSE] Reconnecting in 3 seconds..."),v.current=setTimeout(()=>{v.current=null,ce(),A()},3e3))},P.addEventListener(bn.RUN_STARTED,F=>{S(JSON.parse(F.data))}),P.addEventListener(bn.RUN_FINISHED,F=>{C(JSON.parse(F.data))}),P.addEventListener(bn.RUN_ERROR,F=>{_(JSON.parse(F.data))}),P.addEventListener(bn.STEP_STARTED,F=>{O(JSON.parse(F.data))}),P.addEventListener(bn.STEP_FINISHED,F=>{T(JSON.parse(F.data))}),P.addEventListener(bn.TEXT_MESSAGE_START,F=>{I(JSON.parse(F.data))}),P.addEventListener(bn.TEXT_MESSAGE_CONTENT,F=>{D(JSON.parse(F.data))}),P.addEventListener(bn.TEXT_MESSAGE_END,F=>{V(JSON.parse(F.data))}),P.addEventListener(bn.TOOL_CALL_START,F=>{z(JSON.parse(F.data))}),P.addEventListener(bn.TOOL_CALL_ARGS,F=>{j(JSON.parse(F.data))}),P.addEventListener(bn.TOOL_CALL_END,F=>{q(JSON.parse(F.data))}),P.addEventListener(bn.TOOL_CALL_RESULT,F=>{re(JSON.parse(F.data))}),P.addEventListener(bn.STATE_SNAPSHOT,F=>{G(JSON.parse(F.data))}),P.addEventListener(bn.STATE_DELTA,F=>{ue(JSON.parse(F.data))})}catch(P){console.error("Failed to create EventSource:",P),a("error"),y(P instanceof Error?P:new Error("Unknown error"))}},[e,s,r,S,C,_,O,T,I,D,V,z,j,q,re,G,ue]),ce=x.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null),w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),ye=x.useCallback(()=>{N.current=!1,ce(),A()},[ce,A]);return x.useEffect(()=>(n&&A(),()=>{v.current&&(clearTimeout(v.current),v.current=null),w.current&&(w.current.close(),w.current=null,a("disconnected"))}),[n,e]),{connectionStatus:o,execution:l,messages:u,toolCalls:f,state:m,error:b,connect:A,disconnect:ce,reconnect:ye,isConnected:o==="connected"}}function aY(t,e){var s,i,o,a,l,c;const n=[],r=Date.now();switch(t.type){case"assistant":{const u=((s=t.message)==null?void 0:s.content)||[];for(const d of u)if(d.type==="text"&&d.text)n.push({type:"CUSTOM",timestamp:r,name:"TEXT_MESSAGE_CONTENT",value:{content:d.text}});else if(d.type==="tool_use"){const f=d.id||`tool-${Date.now()}`;n.push({type:"TOOL_CALL_START",timestamp:r,toolCallId:f,toolCallName:d.name||"unknown"},{type:"TOOL_CALL_ARGS",timestamp:r,toolCallId:f,delta:JSON.stringify(d.input||{})})}break}case"tool_result":{const u=((i=t.result)==null?void 0:i.tool_use_id)||"unknown",f=((a=(((o=t.result)==null?void 0:o.content)||[]).find(p=>p.type==="text"))==null?void 0:a.text)||"";n.push({type:"TOOL_CALL_END",timestamp:r,toolCallId:u},{type:"TOOL_CALL_RESULT",timestamp:r,messageId:`msg-${u}`,toolCallId:u,content:f});break}case"result":{if(t.usage){const u=t.usage;n.push({type:"CUSTOM",timestamp:r,name:"USAGE_UPDATE",value:{inputTokens:u.input_tokens||0,outputTokens:u.output_tokens||0,cacheTokens:u.cache_read_input_tokens||0,totalTokens:(u.input_tokens||0)+(u.output_tokens||0)}})}break}case"error":{n.push({type:"RUN_ERROR",timestamp:r,message:((l=t.error)==null?void 0:l.message)||"Unknown error",errorType:(c=t.error)==null?void 0:c.type});break}}return n}async function lY(t){const e=[];let n=0;for(let r=0;r<t.length;r++){const s=t[r].trim();if(s)try{const i=JSON.parse(s),o=aY(i,n);e.push(...o),n+=o.length}catch(i){console.warn(`[parseExecutionLogs] Failed to parse log line ${r+1}:`,i instanceof Error?i.message:String(i))}}return e}function cY(t){const[e,n]=x.useState([]),[r,s]=x.useState(!0),[i,o]=x.useState(null),[a,l]=x.useState(null);return x.useEffect(()=>{s(!0),o(null),n([]),l(null);const c=new AbortController;async function u(){try{const d=await fetch(`/api/executions/${t}/logs`,{signal:c.signal});if(!d.ok)throw d.status===404?new Error(`Execution not found: ${t}`):new Error(`Failed to fetch execution logs: ${d.status} ${d.statusText}`);const f=await d.json();if(!f.success)throw new Error(f.message||"Failed to fetch execution logs");const p=await lY(f.data.logs);n(p),l(f.data.metadata)}catch(d){if(d instanceof Error&&d.name==="AbortError")return;const f=d instanceof Error?d:new Error("Unknown error fetching execution logs");o(f),console.error("[useExecutionLogs] Error:",f)}finally{c.signal.aborted||s(!1)}}return u(),()=>{c.abort()}},[t]),{events:e,loading:r,error:i,metadata:a}}function uY({messages:t,toolCalls:e,renderMarkdown:n=!0,className:r=""}){const s=x.useMemo(()=>{const i=[];return t.forEach(o=>{i.push({type:"message",timestamp:o.timestamp,data:o})}),e.forEach(o=>{i.push({type:"tool_call",timestamp:o.startTime,data:o})}),i.sort((o,a)=>o.timestamp-a.timestamp)},[t,e]);return s.length===0?null:h.jsx("div",{className:`space-y-3 ${r}`,children:s.map(i=>{if(i.type==="message"){const o=i.data;return h.jsxs("div",{className:"flex gap-3 items-start",children:[h.jsx("div",{className:"mt-1 flex-shrink-0",children:h.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-primary/10",children:h.jsx(ef,{className:"h-4 w-4 text-primary"})})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx(ct,{variant:"outline",className:"text-xs",children:o.role}),!o.complete&&h.jsx(pi,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),h.jsx("div",{className:"rounded-lg bg-muted/50 p-3 text-sm",children:n?h.jsx(iA,{className:"prose prose-sm max-w-none dark:prose-invert",components:{p:({children:a})=>h.jsx("p",{className:"mb-2 last:mb-0",children:a}),code:({inline:a,children:l,...c})=>a?h.jsx("code",{className:"bg-background px-1 py-0.5 rounded text-xs",...c,children:l}):h.jsx("pre",{className:"bg-background p-2 rounded overflow-x-auto",children:h.jsx("code",{...c,children:l})}),ul:({children:a})=>h.jsx("ul",{className:"list-disc pl-4 mb-2",children:a}),ol:({children:a})=>h.jsx("ol",{className:"list-decimal pl-4 mb-2",children:a}),li:({children:a})=>h.jsx("li",{className:"mb-1",children:a}),a:({children:a,href:l})=>h.jsx("a",{href:l,className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",children:a})},children:o.content}):h.jsx("div",{className:"whitespace-pre-wrap",children:o.content})})]})]},`msg-${o.messageId}`)}else{const o=i.data;return h.jsxs("div",{className:"flex gap-3 items-start",children:[h.jsx("div",{className:"mt-1 flex-shrink-0",children:h.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-blue-500/10",children:h.jsx(uR,{className:"h-4 w-4 text-blue-500"})})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsxs("div",{className:"rounded-lg border bg-card p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"font-medium",children:o.toolCallName}),h.jsx(ct,{variant:o.status==="completed"?"default":o.status==="error"?"destructive":"secondary",className:"text-xs",children:o.status})]}),o.endTime&&h.jsxs("span",{className:"text-xs text-muted-foreground",children:[((o.endTime-o.startTime)/1e3).toFixed(2),"s"]})]}),o.args&&h.jsxs("details",{className:"mt-2",children:[h.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"Arguments"}),h.jsx("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto",children:o.args})]}),o.result&&h.jsxs("details",{className:"mt-2",open:o.status==="completed",children:[h.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"Result"}),h.jsx("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-40",children:o.result})]}),o.error&&h.jsx("div",{className:"mt-2 text-xs text-destructive bg-destructive/10 p-2 rounded",children:o.error})]})})]},`tool-${o.toolCallId}`)}})})}function dY({executionId:t,execution:e,onComplete:n,onError:r,className:s=""}){const i=x.useMemo(()=>e?["preparing","pending","running","paused"].includes(e.status):!0,[e]),o=oY({executionId:t,autoConnect:i}),a=cY(t),{connectionStatus:l,execution:c,messages:u,toolCalls:d,state:f,error:p,isConnected:m}=x.useMemo(()=>{var v;if(i)return{connectionStatus:o.connectionStatus,execution:o.execution,messages:o.messages,toolCalls:o.toolCalls,state:o.state,error:o.error,isConnected:o.isConnected};{const k=new Map,N=new Map,S={};return a.events&&a.events.forEach(C=>{if(C.type==="TEXT_MESSAGE_CONTENT"||C.name==="TEXT_MESSAGE_CONTENT"){const _=C.value||C;k.set(k.size,{id:k.size,content:_.content||_.text,timestamp:C.timestamp||Date.now()})}else if(C.type==="TOOL_CALL_START"||C.name==="TOOL_CALL_START"){const _=C.value||C;N.set(_.toolCallId,{id:_.toolCallId,name:_.name,status:"running",timestamp:C.timestamp||Date.now()})}else if(C.type==="TOOL_CALL_RESULT"||C.name==="TOOL_CALL_RESULT"){const _=C.value||C,O=N.get(_.toolCallId);O&&N.set(_.toolCallId,{...O,status:"completed",result:_.result})}}),{connectionStatus:a.loading?"connecting":a.error?"error":"connected",execution:{status:(e==null?void 0:e.status)||"completed",runId:t,currentStep:void 0,error:(v=a.error)==null?void 0:v.message,startTime:void 0,endTime:void 0},messages:k,toolCalls:N,state:S,error:a.error,isConnected:!1}}},[i,o,a,t,e]);x.useEffect(()=>{c.status==="completed"&&n&&n()},[c.status,n]),x.useEffect(()=>{p&&r&&r(p)},[p,r]);const g=d.size,b=Array.from(d.values()).filter(v=>v.status==="completed").length,y=u.size,w=()=>l==="connecting"?h.jsxs(ct,{variant:"outline",className:"flex items-center gap-1",children:[h.jsx(pi,{className:"h-3 w-3 animate-spin"}),"Connecting..."]}):l==="error"||c.status==="error"?h.jsxs(ct,{variant:"destructive",className:"flex items-center gap-1",children:[h.jsx(Zo,{className:"h-3 w-3"}),"Error"]}):c.status==="completed"?h.jsxs(ct,{variant:"default",className:"flex items-center gap-1 bg-green-600",children:[h.jsx(Cg,{className:"h-3 w-3"}),"Completed"]}):c.status==="running"?h.jsxs(ct,{variant:"default",className:"flex items-center gap-1",children:[h.jsx(pi,{className:"h-3 w-3 animate-spin"}),"Running"]}):h.jsxs(ct,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(fo,{className:"h-3 w-3"}),"Idle"]});return l==="connecting"&&c.status==="idle"?h.jsx(Bt,{className:`p-6 ${s}`,children:h.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[h.jsx(pi,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{children:"Connecting to execution stream..."})]})}):h.jsxs(Bt,{className:`flex flex-col ${s}`,children:[h.jsxs("div",{className:"border-b px-6 py-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("h3",{className:"font-semibold",children:"Execution Monitor"}),w()]}),h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[c.runId&&h.jsxs("span",{className:"font-mono text-xs",children:["Run: ",c.runId.slice(0,8)]}),m&&h.jsx(ct,{variant:"outline",className:"text-xs",children:"Live"})]})]}),c.currentStep&&h.jsxs("div",{className:"mt-3 text-sm text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Current step:"})," ",c.currentStep]}),f.progress!==void 0&&f.totalSteps&&h.jsxs("div",{className:"mt-3",children:[h.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground mb-1",children:[h.jsx("span",{children:"Progress"}),h.jsxs("span",{children:[f.progress," / ",f.totalSteps]})]}),h.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:h.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${f.progress/f.totalSteps*100}%`}})})]})]}),h.jsxs("div",{className:"flex-1 overflow-auto px-6 py-4",children:[(p||c.error)&&h.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-4 mb-4",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(Zo,{className:"h-5 w-5 text-destructive mt-0.5"}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h4",{className:"font-semibold text-destructive",children:"Error"}),h.jsx("p",{className:"text-sm text-destructive/90 mt-1",children:c.error||(p==null?void 0:p.message)})]})]})}),(y>0||g>0)&&h.jsx(uY,{messages:u,toolCalls:d,renderMarkdown:!0}),y===0&&g===0&&!p&&!c.error&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center text-muted-foreground",children:[h.jsx(fo,{className:"h-8 w-8 mb-2"}),h.jsx("p",{className:"text-sm",children:"No execution activity yet"}),h.jsx("p",{className:"text-xs mt-1",children:m?"Waiting for events...":"Connecting..."})]})]}),h.jsx("div",{className:"border-t px-6 py-3 bg-muted/30",children:h.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:g})," tool calls"]}),h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:b})," completed"]}),h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:y})," messages"]})]}),f.tokenUsage&&h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:f.tokenUsage})," tokens"]}),f.cost&&h.jsx("span",{children:h.jsxs("span",{className:"font-medium",children:["$",f.cost.toFixed(4)]})})]}),c.startTime&&c.endTime&&h.jsxs("span",{children:["Duration:"," ",h.jsxs("span",{className:"font-medium",children:[((c.endTime-c.startTime)/1e3).toFixed(2),"s"]})]})]})})]})}function fY({open:t,onSubmit:e,onCancel:n}){const[r,s]=x.useState(""),[i,o]=x.useState(!1),[a,l]=x.useState(null),c=async()=>{if(r.trim().length===0){l("Feedback cannot be empty");return}o(!0),l(null);try{await e(r.trim()),s(""),l(null)}catch(p){l(p instanceof Error?p.message:"Failed to submit feedback")}finally{o(!1)}},u=()=>{i||(s(""),l(null),n())},d=p=>{!p&&!i&&u()},f=r.trim().length>0&&!i;return h.jsx(Mo,{open:t,onOpenChange:d,children:h.jsxs(Ci,{className:"max-w-2xl",children:[h.jsxs(Ni,{children:[h.jsx(_i,{children:"Continue Execution"}),h.jsx(sf,{children:"Provide additional feedback to continue the agent's work in the same environment."})]}),h.jsxs("div",{className:"space-y-4",children:[a&&h.jsx("div",{className:"rounded-lg border border-destructive bg-destructive/10 p-3",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(fo,{className:"h-5 w-5 text-destructive mt-0.5 flex-shrink-0"}),h.jsx("p",{className:"text-sm text-destructive",children:a})]})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Yt,{htmlFor:"feedback",children:"Feedback"}),h.jsx(_f,{id:"feedback",value:r,onChange:p=>s(p.target.value),rows:8,placeholder:`Provide feedback or additional instructions for the agent.
565
+
566
+ Examples:
567
+ • "Please add error handling for edge cases"
568
+ • "Can you explain the approach you took?"
569
+ • "Also add tests for this functionality"`,className:"resize-none",disabled:i}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"The agent will continue working in the same environment with this feedback."})]})]}),h.jsxs(Og,{children:[h.jsx(le,{variant:"outline",onClick:u,disabled:i,children:"Cancel"}),h.jsx(le,{onClick:c,disabled:!f,children:i?"Submitting...":"Continue"})]})]})})}function hY({worktreePath:t,isOpen:e,onClose:n,onConfirm:r,isDeleting:s=!1}){return t?h.jsx(Gg,{open:e,onOpenChange:n,children:h.jsxs(vf,{children:[h.jsxs(wf,{children:[h.jsx(Sf,{children:"Delete Worktree"}),h.jsxs(Ef,{children:["Are you sure you want to delete the worktree? This action cannot be undone.",h.jsx("br",{}),h.jsx("br",{}),h.jsx("strong",{children:"Worktree path:"}),h.jsx("br",{}),h.jsx("code",{className:"text-xs",children:t})]})]}),h.jsxs(kf,{children:[h.jsx(Nf,{disabled:s,children:"Cancel"}),h.jsx(Cf,{onClick:r,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?"Deleting...":"Delete"})]})]})}):null}function pY({executionId:t,onFollowUpCreated:e}){const[n,r]=x.useState(null),[s,i]=x.useState(!0),[o,a]=x.useState(null),[l,c]=x.useState(!1),[u,d]=x.useState(!1),[f,p]=x.useState(!1),[m,g]=x.useState(!1),[b,y]=x.useState(!1);x.useEffect(()=>{(async()=>{i(!0),a(null);try{const D=await ur.getById(t);if(r(D),D.worktree_path)try{const V=await ur.worktreeExists(t);y(V.exists)}catch(V){console.error("Failed to check worktree status:",V),y(!1)}}catch(D){a(D instanceof Error?D.message:"Failed to load execution")}finally{i(!1)}})()},[t]);const w=x.useCallback(async()=>{try{const I=await ur.getById(t);if(r(I),I.worktree_path)try{const D=await ur.worktreeExists(t);y(D.exists)}catch(D){console.error("Failed to check worktree status:",D),y(!1)}}catch(I){console.error("Failed to reload execution:",I)}},[t]),v=x.useCallback(I=>{a(I.message)},[]),k=async()=>{if(n){p(!0);try{await ur.cancel(t);const I=await ur.getById(t);r(I)}catch(I){a(I instanceof Error?I.message:"Failed to cancel execution")}finally{p(!1)}}},N=async I=>{const D=await ur.createFollowUp(t,{feedback:I});c(!1),e&&e(D.id)},S=async()=>{if(!(!n||!n.worktree_path)){g(!0);try{await ur.deleteWorktree(t),y(!1);const I=await ur.getById(t);r(I),d(!1)}catch(I){a(I instanceof Error?I.message:"Failed to delete worktree")}finally{g(!1)}}},C=I=>{switch(I){case"preparing":return h.jsxs(ct,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(Ol,{className:"h-3 w-3"}),"Preparing"]});case"pending":return h.jsxs(ct,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(Ol,{className:"h-3 w-3"}),"Pending"]});case"running":return h.jsxs(ct,{variant:"default",className:"flex items-center gap-1",children:[h.jsx(pi,{className:"h-3 w-3 animate-spin"}),"Running"]});case"paused":return h.jsxs(ct,{variant:"outline",className:"flex items-center gap-1",children:[h.jsx(Mk,{className:"h-3 w-3"}),"Paused"]});case"completed":return h.jsxs(ct,{variant:"default",className:"flex items-center gap-1 bg-green-600",children:[h.jsx(Cg,{className:"h-3 w-3"}),"Completed"]});case"failed":return h.jsxs(ct,{variant:"destructive",className:"flex items-center gap-1",children:[h.jsx(Zo,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return h.jsxs(ct,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(hl,{className:"h-3 w-3"}),"Cancelled"]});case"stopped":return h.jsxs(ct,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(hl,{className:"h-3 w-3"}),"Stopped"]});default:return h.jsxs(ct,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(fo,{className:"h-3 w-3"}),String(I).charAt(0).toUpperCase()+String(I).slice(1)]})}};if(s)return h.jsx(Bt,{className:"p-6",children:h.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[h.jsx(pi,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{children:"Loading execution..."})]})});if(o||!n)return h.jsx(Bt,{className:"p-6",children:h.jsxs("div",{className:"flex items-start gap-2 text-destructive",children:[h.jsx(Zo,{className:"mt-0.5 h-5 w-5"}),h.jsxs("div",{children:[h.jsx("h4",{className:"font-semibold",children:"Error Loading Execution"}),h.jsx("p",{className:"mt-1 text-sm",children:o||"Execution not found"})]})]})});const _=n.status==="running",O=n.status==="completed"||n.status==="failed"||n.status==="stopped",T=n.worktree_path&&b;return h.jsxs("div",{className:"space-y-4",children:[h.jsx(Bt,{className:"p-6",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex-1 space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("h2",{className:"text-xl font-semibold",children:"Execution"}),C(n.status)]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"ID:"}),h.jsx("span",{className:"ml-2 font-mono",children:n.id})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Issue:"}),h.jsx("span",{className:"ml-2 font-mono",children:n.issue_id})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Mode:"}),h.jsx("span",{className:"ml-2 capitalize",children:n.mode})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Model:"}),h.jsx("span",{className:"ml-2",children:n.model})]}),n.target_branch&&h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Base Branch:"}),h.jsx("span",{className:"ml-2 font-mono",children:n.target_branch})]}),n.worktree_path&&h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Worktree:"}),h.jsx("span",{className:"ml-2 font-mono text-xs",children:n.worktree_path}),b?h.jsx(ct,{variant:"secondary",className:"ml-2 text-xs",children:"exists"}):h.jsx(ct,{variant:"outline",className:"ml-2 text-xs text-muted-foreground",children:"deleted"})]})]}),h.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground",children:[n.created_at&&h.jsxs("div",{children:["Created:"," ",new Date(n.created_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]}),n.started_at&&h.jsxs("div",{children:["Started:"," ",new Date(n.started_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]}),n.completed_at&&h.jsxs("div",{children:["Completed:"," ",new Date(n.completed_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]})]}),n.error&&h.jsx("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 p-3 text-sm",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(Zo,{className:"mt-0.5 h-4 w-4 text-destructive"}),h.jsxs("div",{children:[h.jsx("h5",{className:"font-medium text-destructive",children:"Execution Error"}),h.jsx("p",{className:"mt-1 text-destructive/90",children:n.error})]})]})})]}),h.jsxs("div",{className:"ml-4 flex gap-2",children:[_&&h.jsx(le,{variant:"destructive",size:"sm",onClick:k,disabled:f,children:f?h.jsxs(h.Fragment,{children:[h.jsx(pi,{className:"mr-2 h-4 w-4 animate-spin"}),"Cancelling..."]}):h.jsxs(h.Fragment,{children:[h.jsx(hl,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),O&&h.jsxs(le,{variant:"default",size:"sm",onClick:()=>c(!0),children:[h.jsx(Tg,{className:"mr-2 h-4 w-4"}),"Follow Up"]}),T&&h.jsxs(le,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:m,children:[h.jsx(Da,{className:"mr-2 h-4 w-4"}),"Delete Worktree"]})]})]})}),(n.status==="running"||n.status==="preparing"||n.status==="pending"||n.status==="paused"||n.status==="completed"||n.status==="failed"||n.status==="cancelled"||n.status==="stopped")&&h.jsx(dY,{executionId:t,execution:n,onComplete:w,onError:v}),h.jsx(fY,{open:l,onSubmit:N,onCancel:()=>c(!1)}),h.jsx(hY,{worktreePath:n.worktree_path,isOpen:u,onClose:()=>d(!1),onConfirm:S,isDeleting:m})]})}function mY(){const{id:t}=xg(),e=kr();if(!t)return h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Invalid Execution"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"No execution ID provided."}),h.jsx(le,{onClick:()=>e("/issues"),children:"Back to Issues"})]})});const n=r=>{e(`/executions/${r}`)};return h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsx("div",{className:"flex items-center justify-between border-b bg-background p-4",children:h.jsx("div",{className:"flex items-center gap-4",children:h.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>e(-1),children:[h.jsx(Qd,{className:"mr-2 h-4 w-4"}),"Back"]})})}),h.jsx("div",{className:"flex-1 overflow-auto p-6",children:h.jsx(pY,{executionId:t,onFollowUpCreated:n})})]})}const gY=new yM({defaultOptions:{queries:{staleTime:3e4,gcTime:36e5,refetchOnWindowFocus:!1,retry:1}}});function bY(){return h.jsx(xM,{client:gY,children:h.jsx(IM,{children:h.jsx(RM,{children:h.jsx(VA,{children:h.jsx(WA,{children:h.jsxs(ss,{path:"/",element:h.jsx(KI,{}),children:[h.jsx(ss,{index:!0,element:h.jsx(qA,{to:"/issues",replace:!0})}),h.jsx(ss,{path:"issues",element:h.jsx(q8,{})}),h.jsx(ss,{path:"issues/archived",element:h.jsx(X7,{})}),h.jsx(ss,{path:"issues/:id",element:h.jsx(K8,{})}),h.jsx(ss,{path:"specs",element:h.jsx(e7,{})}),h.jsx(ss,{path:"specs/archived",element:h.jsx(Q7,{})}),h.jsx(ss,{path:"specs/:id",element:h.jsx(Z7,{})}),h.jsx(ss,{path:"executions/:id",element:h.jsx(mY,{})})]})})})})})})}JA.createRoot(document.getElementById("root")).render(h.jsx(ht.StrictMode,{children:h.jsx(bY,{})}));
570
+ //# sourceMappingURL=index-BvlblDHK.js.map