diff --git a/_app/immutable/chunks/entry.GCuWv2E9.js b/_app/immutable/chunks/entry.CaTbHwiC.js similarity index 99% rename from _app/immutable/chunks/entry.GCuWv2E9.js rename to _app/immutable/chunks/entry.CaTbHwiC.js index b9b1fe7..4131d3b 100644 --- a/_app/immutable/chunks/entry.GCuWv2E9.js +++ b/_app/immutable/chunks/entry.CaTbHwiC.js @@ -1,3 +1,3 @@ -import{z as ie}from"./scheduler.COxbwMzl.js";import{w as pt}from"./index.C2Jzycuw.js";new URL("sveltekit-internal://");function ce(t,n){return t==="/"||n==="ignore"?t:n==="never"?t.endsWith("/")?t.slice(0,-1):t:n==="always"&&!t.endsWith("/")?t+"/":t}function le(t){return t.split("%25").map(decodeURI).join("%25")}function fe(t){for(const n in t)t[n]=decodeURIComponent(t[n]);return t}function ct({href:t}){return t.split("#")[0]}const ue=["href","pathname","search","toString","toJSON"];function de(t,n,e){const a=new URL(t);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(r,o){if(o==="get"||o==="getAll"||o==="has")return s=>(e(s),r[o](s));n();const i=Reflect.get(r,o);return typeof i=="function"?i.bind(r):i}}),enumerable:!0,configurable:!0});for(const r of ue)Object.defineProperty(a,r,{get(){return n(),t[r]},enumerable:!0,configurable:!0});return a}const he="/__data.json",pe=".html__data.json";function ge(t){return t.endsWith(".html")?t.replace(/\.html$/,pe):t.replace(/\/$/,"")+he}function me(...t){let n=5381;for(const e of t)if(typeof e=="string"){let a=e.length;for(;a;)n=n*33^e.charCodeAt(--a)}else if(ArrayBuffer.isView(e)){const a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);let r=a.length;for(;r;)n=n*33^a[--r]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function _e(t){const n=atob(t),e=new Uint8Array(n.length);for(let a=0;a((t instanceof Request?t.method:(n==null?void 0:n.method)||"GET")!=="GET"&&G.delete(gt(t)),$t(t,n));const G=new Map;function ye(t,n){const e=gt(t,n),a=document.querySelector(e);if(a!=null&&a.textContent){let{body:r,...o}=JSON.parse(a.textContent);const i=a.getAttribute("data-ttl");return i&&G.set(e,{body:r,init:o,ttl:1e3*Number(i)}),a.getAttribute("data-b64")!==null&&(r=_e(r)),Promise.resolve(new Response(r,o))}return window.fetch(t,n)}function we(t,n,e){if(G.size>0){const a=gt(t,e),r=G.get(a);if(r){if(performance.now(){const r=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(a);if(r)return n.push({name:r[1],matcher:r[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(a);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!a)return;const i=a.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return lt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return lt(String.fromCharCode(...c.slice(2).split("-").map(l=>parseInt(l,16))));const u=ve.exec(c),[,h,g,d,_]=u;return n.push({name:d,matcher:_,optional:!!h,rest:!!g,chained:g?f===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return lt(c)}).join("")}).join("")}/?$`),params:n}}function Ee(t){return!/^\([^)]+\)$/.test(t)}function ke(t){return t.slice(1).split("/").filter(Ee)}function Se(t,n,e){const a={},r=t.slice(1),o=r.filter(s=>s!==void 0);let i=0;for(let s=0;su).join("/"),i=0),f===void 0){c.rest&&(a[c.name]="");continue}if(!c.matcher||e[c.matcher](f)){a[c.name]=f;const u=n[s+1],h=r[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(a).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return a}function lt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ae({nodes:t,server_loads:n,dictionary:e,matchers:a}){const r=new Set(n);return Object.entries(e).map(([s,[c,f,u]])=>{const{pattern:h,params:g}=be(s),d={id:s,exec:_=>{const l=h.exec(_);if(l)return Se(l,g,a)},errors:[1,...u||[]].map(_=>t[_]),layouts:[0,...f||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,t[s]]}function i(s){return s===void 0?s:[r.has(s),t[s]]}}function Ct(t,n=JSON.parse){try{return n(sessionStorage[t])}catch{}}function It(t,n,e=JSON.stringify){const a=e(n);try{sessionStorage[t]=a}catch{}}var jt;const P=((jt=globalThis.__sveltekit_mchsmo)==null?void 0:jt.base)??"/LightNote";var Dt;const Re=((Dt=globalThis.__sveltekit_mchsmo)==null?void 0:Dt.assets)??P,Ie="1721141985451",Vt="sveltekit:snapshot",Ft="sveltekit:scroll",Gt="sveltekit:states",Le="sveltekit:pageurl",D="sveltekit:history",q="sveltekit:navigation",z={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},K=location.origin;function Mt(t){if(t instanceof URL)return t;let n=document.baseURI;if(!n){const e=document.getElementsByTagName("base");n=e.length?e[0].href:document.URL}return new URL(t,n)}function mt(){return{x:pageXOffset,y:pageYOffset}}function O(t,n){return t.getAttribute(`data-sveltekit-${n}`)}const Lt={...z,"":z.hover};function qt(t){let n=t.assignedSlot??t.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function Ht(t,n){for(;t&&t!==n;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=qt(t)}}function ut(t,n){let e;try{e=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI)}catch{}const a=t instanceof SVGAElement?t.target.baseVal:t.target,r=!e||!!a||nt(e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(e==null?void 0:e.origin)===K&&t.hasAttribute("download");return{url:e,external:r,target:a,download:o}}function J(t){let n=null,e=null,a=null,r=null,o=null,i=null,s=t;for(;s&&s!==document.documentElement;)a===null&&(a=O(s,"preload-code")),r===null&&(r=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),e===null&&(e=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=qt(s);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Lt[a??"off"],preload_data:Lt[r??"off"],keepfocus:c(n),noscroll:c(e),reload:c(o),replace_state:c(i)}}function Pt(t){const n=pt(t);let e=!0;function a(){e=!0,n.update(i=>i)}function r(i){e=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||e&&c!==s)&&i(s=c)})}return{notify:a,set:r,subscribe:o}}function Pe(){const{set:t,subscribe:n}=pt(!1);let e;async function a(){clearTimeout(e);try{const r=await fetch(`${Re}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const i=(await r.json()).version!==Ie;return i&&(t(!0),clearTimeout(e)),i}catch{return!1}}return{subscribe:n,check:a}}function nt(t,n){return t.origin!==K||!t.pathname.startsWith(n)}const Te=-1,Ue=-2,xe=-3,Ne=-4,Oe=-5,je=-6;function De(t,n){if(typeof t=="number")return r(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const e=t,a=Array(e.length);function r(o,i=!1){if(o===Te)return;if(o===xe)return NaN;if(o===Ne)return 1/0;if(o===Oe)return-1/0;if(o===je)return-0;if(i)throw new Error("Invalid input");if(o in a)return a[o];const s=e[o];if(!s||typeof s!="object")a[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],f=n==null?void 0:n[c];if(f)return a[o]=f(r(s[1]));switch(c){case"Date":a[o]=new Date(s[1]);break;case"Set":const u=new Set;a[o]=u;for(let d=1;dn!=null)}class at{constructor(n,e){this.status=n,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Kt{constructor(n,e){this.status=n,this.location=e}}class _t extends Error{constructor(n,e,a){super(a),this.status=n,this.text=e}}const Ve="x-sveltekit-invalidated",Fe="x-sveltekit-trailing-slash";function W(t){return t instanceof at||t instanceof _t?t.status:500}function Ge(t){return t instanceof _t?t.text:"Internal Error"}const N=Ct(Ft)??{},H=Ct(Vt)??{},U={url:Pt({}),page:Pt({}),navigating:pt(null),updated:Pe()};function yt(t){N[t]=mt()}function Me(t,n){let e=t+1;for(;N[e];)delete N[e],e+=1;for(e=n+1;H[e];)delete H[e],e+=1}function C(t){return location.href=t.href,new Promise(()=>{})}function Tt(){}let rt,dt,X,T,ht,V;const Yt=[],Z=[];let R=null;const zt=[],qe=[];let j=[],y={branch:[],error:null,url:null},wt=!1,Q=!1,Ut=!0,B=!1,F=!1,Jt=!1,vt=!1,bt,S,L,I,tt;const M=new Set;async function en(t,n,e){var r,o;document.URL!==location.href&&(location.href=location.href),V=t,rt=Ae(t),T=document.documentElement,ht=n,dt=t.nodes[0],X=t.nodes[1],dt(),X(),S=(r=history.state)==null?void 0:r[D],L=(o=history.state)==null?void 0:o[q],S||(S=L=Date.now(),history.replaceState({...history.state,[D]:S,[q]:L},""));const a=N[S];a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y)),e?await Xe(ht,e):Je(location.href,{replaceState:!0}),We()}function He(){Yt.length=0,vt=!1}function Wt(t){Z.some(n=>n==null?void 0:n.snapshot)&&(H[t]=Z.map(n=>{var e;return(e=n==null?void 0:n.snapshot)==null?void 0:e.capture()}))}function Xt(t){var n;(n=H[t])==null||n.forEach((e,a)=>{var r,o;(o=(r=Z[a])==null?void 0:r.snapshot)==null||o.restore(e)})}function xt(){yt(S),It(Ft,N),Wt(L),It(Vt,H)}async function Zt(t,n,e,a){return Y({type:"goto",url:Mt(t),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:e,nav_token:a,accept:()=>{n.invalidateAll&&(vt=!0)}})}async function Be(t){if(t.id!==(R==null?void 0:R.id)){const n={};M.add(n),R={id:t.id,token:n,promise:te({...t,preload:n}).then(e=>(M.delete(n),e.type==="loaded"&&e.state.error&&(R=null),e))}}return R.promise}async function ft(t){const n=rt.find(e=>e.exec(ee(t)));n&&await Promise.all([...n.layouts,n.leaf].map(e=>e==null?void 0:e[1]()))}function Qt(t,n,e){var o;y=t.state;const a=document.querySelector("style[data-sveltekit]");a&&a.remove(),I=t.props.page,bt=new V.root({target:n,props:{...t.props,stores:U,components:Z},hydrate:e}),Xt(L);const r={from:null,to:{params:y.params,route:{id:((o=y.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(i=>i(r)),Q=!0}async function et({url:t,params:n,branch:e,status:a,error:r,route:o,form:i}){let s="never";if(P&&(t.pathname===P||t.pathname===P+"/"))s="always";else for(const d of e)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);t.pathname=ce(t.pathname,s),t.search=t.search;const c={type:"loaded",state:{url:t,params:n,branch:e,error:r,route:o},props:{constructors:Ce(e).map(d=>d.node.component),page:I}};i!==void 0&&(c.props.form=i);let f={},u=!I,h=0;for(let d=0;d(s&&(c.route=!0),l[m])}),params:new Proxy(a,{get:(l,m)=>(s&&c.params.add(m),l[m])}),data:(o==null?void 0:o.data)??null,url:de(e,()=>{s&&(c.url=!0)},l=>{s&&c.search_params.add(l)}),async fetch(l,m){let b;l instanceof Request?(b=l.url,m={body:l.method==="GET"||l.method==="HEAD"?void 0:await l.blob(),cache:l.cache,credentials:l.credentials,headers:l.headers,integrity:l.integrity,keepalive:l.keepalive,method:l.method,mode:l.mode,redirect:l.redirect,referrer:l.referrer,referrerPolicy:l.referrerPolicy,signal:l.signal,...m}):b=l;const A=new URL(b,e);return s&&d(A.href),A.origin===e.origin&&(b=A.href.slice(e.origin.length)),Q?we(b,A.href,m):ye(b,m)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(l){s=!1;try{return l()}finally{s=!0}}};i=await f.universal.load.call(null,_)??null}return{node:f,loader:t,server:o,universal:(h=f.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=f.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Nt(t,n,e,a,r,o){if(vt)return!0;if(!r)return!1;if(r.parent&&t||r.route&&n||r.url&&e)return!0;for(const i of r.search_params)if(a.has(i))return!0;for(const i of r.params)if(o[i]!==y.params[i])return!0;for(const i of r.dependencies)if(Yt.some(s=>s(new URL(i))))return!0;return!1}function kt(t,n){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?n??null:null}function Ke(t,n){if(!t)return new Set(n.searchParams.keys());const e=new Set([...t.searchParams.keys(),...n.searchParams.keys()]);for(const a of e){const r=t.searchParams.getAll(a),o=n.searchParams.getAll(a);r.every(i=>o.includes(i))&&o.every(i=>r.includes(i))&&e.delete(a)}return e}function Ot({error:t,url:n,route:e,params:a}){return{type:"loaded",state:{error:t,url:n,route:e,params:a,branch:[]},props:{page:I,constructors:[]}}}async function te({id:t,invalidating:n,url:e,params:a,route:r,preload:o}){if((R==null?void 0:R.id)===t)return M.delete(R.token),R.promise;const{errors:i,layouts:s,leaf:c}=r,f=[...s,c];i.forEach(p=>p==null?void 0:p().catch(()=>{})),f.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let u=null;const h=y.url?t!==y.url.pathname+y.url.search:!1,g=y.route?r.id!==y.route.id:!1,d=Ke(y.url,e);let _=!1;const l=f.map((p,v)=>{var x;const E=y.branch[v],k=!!(p!=null&&p[0])&&((E==null?void 0:E.loader)!==p[1]||Nt(_,g,h,d,(x=E.server)==null?void 0:x.uses,a));return k&&(_=!0),k});if(l.some(Boolean)){try{u=await re(e,l)}catch(p){const v=await $(p,{url:e,params:a,route:{id:t}});return M.has(o)?Ot({error:v,url:e,params:a,route:r}):ot({status:W(p),error:v,url:e,route:r})}if(u.type==="redirect")return u}const m=u==null?void 0:u.nodes;let b=!1;const A=f.map(async(p,v)=>{var st;if(!p)return;const E=y.branch[v],k=m==null?void 0:m[v];if((!k||k.type==="skip")&&p[1]===(E==null?void 0:E.loader)&&!Nt(b,g,h,d,(st=E.universal)==null?void 0:st.uses,a))return E;if(b=!0,(k==null?void 0:k.type)==="error")throw k;return Et({loader:p[1],url:e,params:a,route:r,parent:async()=>{var Rt;const At={};for(let it=0;it{});const w=[];for(let p=0;pPromise.resolve({}),server_data_node:kt(o)}),c={node:await X(),loader:X,universal:null,server:null,data:null};return await et({url:e,params:r,branch:[s,c],status:t,error:n,route:null})}function St(t,n){if(!t||nt(t,P))return;let e;try{e=V.hooks.reroute({url:new URL(t)})??t.pathname}catch{return}const a=ee(e);for(const r of rt){const o=r.exec(a);if(o)return{id:t.pathname+t.search,invalidating:n,route:r,params:fe(o),url:t}}}function ee(t){return le(t.slice(P.length)||"/")}function ne({url:t,type:n,intent:e,delta:a}){let r=!1;const o=se(y,e,t,n);a!==void 0&&(o.navigation.delta=a);const i={...o.navigation,cancel:()=>{r=!0,o.reject(new Error("navigation cancelled"))}};return B||zt.forEach(s=>s(i)),r?null:o}async function Y({type:t,url:n,popped:e,keepfocus:a,noscroll:r,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:f=Tt,block:u=Tt}){const h=St(n,!1),g=ne({url:n,type:t,delta:e==null?void 0:e.delta,intent:h});if(!g){u();return}const d=S,_=L;f(),B=!0,Q&&U.navigating.set(g.navigation),tt=c;let l=h&&await te(h);if(!l){if(nt(n,P))return await C(n);l=await ae(n,{id:null},await $(new _t(404,"Not Found",`Not found: ${n.pathname}`),{url:n,params:{},route:{id:null}}),404)}if(n=(h==null?void 0:h.url)||n,tt!==c)return g.reject(new Error("navigation aborted")),!1;if(l.type==="redirect")if(s>=20)l=await ot({status:500,error:await $(new Error("Redirect loop"),{url:n,params:{},route:{id:null}}),url:n,route:{id:null}});else return Zt(new URL(l.location,n).href,{},s+1,c),!1;else l.props.page.status>=400&&await U.updated.check()&&await C(n);if(He(),yt(d),Wt(_),l.props.page.url.pathname!==n.pathname&&(n.pathname=l.props.page.url.pathname),i=e?e.state:i,!e){const w=o?0:1,p={[D]:S+=w,[q]:L+=w,[Gt]:i};(o?history.replaceState:history.pushState).call(history,p,"",n),o||Me(S,L)}if(R=null,l.props.page.state=i,Q){y=l.state,l.props.page&&(l.props.page.url=n);const w=(await Promise.all(qe.map(p=>p(g.navigation)))).filter(p=>typeof p=="function");if(w.length>0){let p=function(){j=j.filter(v=>!w.includes(v))};w.push(p),j.push(...w)}bt.$set(l.props),Jt=!0}else Qt(l,ht,!1);const{activeElement:m}=document;await ie();const b=e?e.scroll:r?mt():null;if(Ut){const w=n.hash&&document.getElementById(decodeURIComponent(n.hash.slice(1)));b?scrollTo(b.x,b.y):w?w.scrollIntoView():scrollTo(0,0)}const A=document.activeElement!==m&&document.activeElement!==document.body;!a&&!A&&Ze(),Ut=!0,l.props.page&&(I=l.props.page),B=!1,t==="popstate"&&Xt(L),g.fulfil(void 0),j.forEach(w=>w(g.navigation)),U.navigating.set(null)}async function ae(t,n,e,a){return t.origin===K&&t.pathname===location.pathname&&!wt?await ot({status:a,error:e,url:t,route:n}):await C(t)}function ze(){let t;T.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(t),t=setTimeout(()=>{a(i,2)},20)});function n(o){a(o.composedPath()[0],1)}T.addEventListener("mousedown",n),T.addEventListener("touchstart",n,{passive:!0});const e=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&(ft(i.target.href),e.unobserve(i.target))},{threshold:0});function a(o,i){const s=Ht(o,T);if(!s)return;const{url:c,external:f,download:u}=ut(s,P);if(f||u)return;const h=J(s);if(!h.reload)if(i<=h.preload_data){const g=St(c,!1);g&&Be(g)}else i<=h.preload_code&&ft(c.pathname)}function r(){e.disconnect();for(const o of T.querySelectorAll("a")){const{url:i,external:s,download:c}=ut(o,P);if(s||c)continue;const f=J(o);f.reload||(f.preload_code===z.viewport&&e.observe(o),f.preload_code===z.eager&&ft(i.pathname))}}j.push(r),r()}function $(t,n){if(t instanceof at)return t.body;const e=W(t),a=Ge(t);return V.hooks.handleError({error:t,event:n,status:e,message:a})??{message:a}}function Je(t,n={}){return t=Mt(t),t.origin!==K?Promise.reject(new Error("goto: invalid URL")):Zt(t,n,0)}function We(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let a=!1;if(xt(),!B){const r=se(y,void 0,null,"leave"),o={...r.navigation,cancel:()=>{a=!0,r.reject(new Error("navigation cancelled"))}};zt.forEach(i=>i(o))}a?(e.preventDefault(),e.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&xt()}),(n=navigator.connection)!=null&&n.saveData||ze(),T.addEventListener("click",e=>{var g;if(e.button||e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;const a=Ht(e.composedPath()[0],T);if(!a)return;const{url:r,external:o,target:i,download:s}=ut(a,P);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=J(a);if(!(a instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;if(o||c.reload){ne({url:r,type:"link"})?B=!0:e.preventDefault();return}const[u,h]=r.href.split("#");if(h!==void 0&&u===ct(location)){const[,d]=y.url.href.split("#");if(d===h){e.preventDefault(),h===""||h==="top"&&a.ownerDocument.getElementById("top")===null?window.scrollTo({top:0}):(g=a.ownerDocument.getElementById(h))==null||g.scrollIntoView();return}if(F=!0,yt(S),t(r),!c.replace_state)return;F=!1}e.preventDefault(),Y({type:"link",url:r,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??r.href===location.href})}),T.addEventListener("submit",e=>{if(e.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(e.target),r=e.submitter;if(((r==null?void 0:r.formMethod)||a.method)!=="get")return;const i=new URL((r==null?void 0:r.hasAttribute("formaction"))&&(r==null?void 0:r.formAction)||a.action);if(nt(i,P))return;const s=e.target,c=J(s);if(c.reload)return;e.preventDefault(),e.stopPropagation();const f=new FormData(s),u=r==null?void 0:r.getAttribute("name");u&&f.append(u,(r==null?void 0:r.getAttribute("value"))??""),i.search=new URLSearchParams(f).toString(),Y({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href})}),addEventListener("popstate",async e=>{var a;if((a=e.state)!=null&&a[D]){const r=e.state[D];if(tt={},r===S)return;const o=N[r],i=e.state[Gt]??{},s=new URL(e.state[Le]??location.href),c=e.state[q],f=ct(location)===ct(y.url);if(c===L&&(Jt||f)){t(s),N[S]=mt(),o&&scrollTo(o.x,o.y),i!==I.state&&(I={...I,state:i},bt.$set({page:I})),S=r;return}const h=r-S;await Y({type:"popstate",url:s,popped:{state:i,scroll:o,delta:h},accept:()=>{S=r,L=c},block:()=>{history.go(-h)},nav_token:tt})}else if(!F){const r=new URL(location.href);t(r)}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[D]:++S,[q]:L},"",location.href))});for(const e of document.querySelectorAll("link"))e.rel==="icon"&&(e.href=e.href);addEventListener("pageshow",e=>{e.persisted&&U.navigating.set(null)});function t(e){y.url=e,U.page.set({...I,url:e}),U.page.notify()}}async function Xe(t,{status:n=200,error:e,node_ids:a,params:r,route:o,data:i,form:s}){wt=!0;const c=new URL(location.href);({params:r={},route:o={id:null}}=St(c,!1)||{});let f;try{const u=a.map(async(d,_)=>{const l=i[_];return l!=null&&l.uses&&(l.uses=oe(l.uses)),Et({loader:V.nodes[d],url:c,params:r,route:o,parent:async()=>{const m={};for(let b=0;b<_;b+=1)Object.assign(m,(await u[b]).data);return m},server_data_node:kt(l)})}),h=await Promise.all(u),g=rt.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let _=0;_o?"1":"0").join(""));const a=await $t(e.href);if(!a.ok){let o;throw(r=a.headers.get("content-type"))!=null&&r.includes("application/json")?o=await a.json():a.status===404?o="Not Found":a.status===500&&(o="Internal Error"),new at(a.status,o)}return new Promise(async o=>{var h;const i=new Map,s=a.body.getReader(),c=new TextDecoder;function f(g){return De(g,{Promise:d=>new Promise((_,l)=>{i.set(d,{fulfil:_,reject:l})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?` +import{z as ie}from"./scheduler.COxbwMzl.js";import{w as pt}from"./index.C2Jzycuw.js";new URL("sveltekit-internal://");function ce(t,n){return t==="/"||n==="ignore"?t:n==="never"?t.endsWith("/")?t.slice(0,-1):t:n==="always"&&!t.endsWith("/")?t+"/":t}function le(t){return t.split("%25").map(decodeURI).join("%25")}function fe(t){for(const n in t)t[n]=decodeURIComponent(t[n]);return t}function ct({href:t}){return t.split("#")[0]}const ue=["href","pathname","search","toString","toJSON"];function de(t,n,e){const a=new URL(t);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(r,o){if(o==="get"||o==="getAll"||o==="has")return s=>(e(s),r[o](s));n();const i=Reflect.get(r,o);return typeof i=="function"?i.bind(r):i}}),enumerable:!0,configurable:!0});for(const r of ue)Object.defineProperty(a,r,{get(){return n(),t[r]},enumerable:!0,configurable:!0});return a}const he="/__data.json",pe=".html__data.json";function ge(t){return t.endsWith(".html")?t.replace(/\.html$/,pe):t.replace(/\/$/,"")+he}function me(...t){let n=5381;for(const e of t)if(typeof e=="string"){let a=e.length;for(;a;)n=n*33^e.charCodeAt(--a)}else if(ArrayBuffer.isView(e)){const a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);let r=a.length;for(;r;)n=n*33^a[--r]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function _e(t){const n=atob(t),e=new Uint8Array(n.length);for(let a=0;a((t instanceof Request?t.method:(n==null?void 0:n.method)||"GET")!=="GET"&&G.delete(gt(t)),$t(t,n));const G=new Map;function ye(t,n){const e=gt(t,n),a=document.querySelector(e);if(a!=null&&a.textContent){let{body:r,...o}=JSON.parse(a.textContent);const i=a.getAttribute("data-ttl");return i&&G.set(e,{body:r,init:o,ttl:1e3*Number(i)}),a.getAttribute("data-b64")!==null&&(r=_e(r)),Promise.resolve(new Response(r,o))}return window.fetch(t,n)}function we(t,n,e){if(G.size>0){const a=gt(t,e),r=G.get(a);if(r){if(performance.now(){const r=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(a);if(r)return n.push({name:r[1],matcher:r[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(a);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!a)return;const i=a.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return lt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return lt(String.fromCharCode(...c.slice(2).split("-").map(l=>parseInt(l,16))));const u=ve.exec(c),[,h,g,d,_]=u;return n.push({name:d,matcher:_,optional:!!h,rest:!!g,chained:g?f===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return lt(c)}).join("")}).join("")}/?$`),params:n}}function Ee(t){return!/^\([^)]+\)$/.test(t)}function ke(t){return t.slice(1).split("/").filter(Ee)}function Se(t,n,e){const a={},r=t.slice(1),o=r.filter(s=>s!==void 0);let i=0;for(let s=0;su).join("/"),i=0),f===void 0){c.rest&&(a[c.name]="");continue}if(!c.matcher||e[c.matcher](f)){a[c.name]=f;const u=n[s+1],h=r[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(a).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return a}function lt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ae({nodes:t,server_loads:n,dictionary:e,matchers:a}){const r=new Set(n);return Object.entries(e).map(([s,[c,f,u]])=>{const{pattern:h,params:g}=be(s),d={id:s,exec:_=>{const l=h.exec(_);if(l)return Se(l,g,a)},errors:[1,...u||[]].map(_=>t[_]),layouts:[0,...f||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,t[s]]}function i(s){return s===void 0?s:[r.has(s),t[s]]}}function Ct(t,n=JSON.parse){try{return n(sessionStorage[t])}catch{}}function It(t,n,e=JSON.stringify){const a=e(n);try{sessionStorage[t]=a}catch{}}var jt;const P=((jt=globalThis.__sveltekit_2dwuos)==null?void 0:jt.base)??"/LightNote";var Dt;const Re=((Dt=globalThis.__sveltekit_2dwuos)==null?void 0:Dt.assets)??P,Ie="1721143806325",Vt="sveltekit:snapshot",Ft="sveltekit:scroll",Gt="sveltekit:states",Le="sveltekit:pageurl",D="sveltekit:history",q="sveltekit:navigation",z={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},K=location.origin;function Mt(t){if(t instanceof URL)return t;let n=document.baseURI;if(!n){const e=document.getElementsByTagName("base");n=e.length?e[0].href:document.URL}return new URL(t,n)}function mt(){return{x:pageXOffset,y:pageYOffset}}function O(t,n){return t.getAttribute(`data-sveltekit-${n}`)}const Lt={...z,"":z.hover};function qt(t){let n=t.assignedSlot??t.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function Ht(t,n){for(;t&&t!==n;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=qt(t)}}function ut(t,n){let e;try{e=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI)}catch{}const a=t instanceof SVGAElement?t.target.baseVal:t.target,r=!e||!!a||nt(e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(e==null?void 0:e.origin)===K&&t.hasAttribute("download");return{url:e,external:r,target:a,download:o}}function J(t){let n=null,e=null,a=null,r=null,o=null,i=null,s=t;for(;s&&s!==document.documentElement;)a===null&&(a=O(s,"preload-code")),r===null&&(r=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),e===null&&(e=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=qt(s);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Lt[a??"off"],preload_data:Lt[r??"off"],keepfocus:c(n),noscroll:c(e),reload:c(o),replace_state:c(i)}}function Pt(t){const n=pt(t);let e=!0;function a(){e=!0,n.update(i=>i)}function r(i){e=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||e&&c!==s)&&i(s=c)})}return{notify:a,set:r,subscribe:o}}function Pe(){const{set:t,subscribe:n}=pt(!1);let e;async function a(){clearTimeout(e);try{const r=await fetch(`${Re}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const i=(await r.json()).version!==Ie;return i&&(t(!0),clearTimeout(e)),i}catch{return!1}}return{subscribe:n,check:a}}function nt(t,n){return t.origin!==K||!t.pathname.startsWith(n)}const Te=-1,Ue=-2,xe=-3,Ne=-4,Oe=-5,je=-6;function De(t,n){if(typeof t=="number")return r(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const e=t,a=Array(e.length);function r(o,i=!1){if(o===Te)return;if(o===xe)return NaN;if(o===Ne)return 1/0;if(o===Oe)return-1/0;if(o===je)return-0;if(i)throw new Error("Invalid input");if(o in a)return a[o];const s=e[o];if(!s||typeof s!="object")a[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],f=n==null?void 0:n[c];if(f)return a[o]=f(r(s[1]));switch(c){case"Date":a[o]=new Date(s[1]);break;case"Set":const u=new Set;a[o]=u;for(let d=1;dn!=null)}class at{constructor(n,e){this.status=n,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Kt{constructor(n,e){this.status=n,this.location=e}}class _t extends Error{constructor(n,e,a){super(a),this.status=n,this.text=e}}const Ve="x-sveltekit-invalidated",Fe="x-sveltekit-trailing-slash";function W(t){return t instanceof at||t instanceof _t?t.status:500}function Ge(t){return t instanceof _t?t.text:"Internal Error"}const N=Ct(Ft)??{},H=Ct(Vt)??{},U={url:Pt({}),page:Pt({}),navigating:pt(null),updated:Pe()};function yt(t){N[t]=mt()}function Me(t,n){let e=t+1;for(;N[e];)delete N[e],e+=1;for(e=n+1;H[e];)delete H[e],e+=1}function C(t){return location.href=t.href,new Promise(()=>{})}function Tt(){}let rt,dt,X,T,ht,V;const Yt=[],Z=[];let R=null;const zt=[],qe=[];let j=[],y={branch:[],error:null,url:null},wt=!1,Q=!1,Ut=!0,B=!1,F=!1,Jt=!1,vt=!1,bt,S,L,I,tt;const M=new Set;async function en(t,n,e){var r,o;document.URL!==location.href&&(location.href=location.href),V=t,rt=Ae(t),T=document.documentElement,ht=n,dt=t.nodes[0],X=t.nodes[1],dt(),X(),S=(r=history.state)==null?void 0:r[D],L=(o=history.state)==null?void 0:o[q],S||(S=L=Date.now(),history.replaceState({...history.state,[D]:S,[q]:L},""));const a=N[S];a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y)),e?await Xe(ht,e):Je(location.href,{replaceState:!0}),We()}function He(){Yt.length=0,vt=!1}function Wt(t){Z.some(n=>n==null?void 0:n.snapshot)&&(H[t]=Z.map(n=>{var e;return(e=n==null?void 0:n.snapshot)==null?void 0:e.capture()}))}function Xt(t){var n;(n=H[t])==null||n.forEach((e,a)=>{var r,o;(o=(r=Z[a])==null?void 0:r.snapshot)==null||o.restore(e)})}function xt(){yt(S),It(Ft,N),Wt(L),It(Vt,H)}async function Zt(t,n,e,a){return Y({type:"goto",url:Mt(t),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:e,nav_token:a,accept:()=>{n.invalidateAll&&(vt=!0)}})}async function Be(t){if(t.id!==(R==null?void 0:R.id)){const n={};M.add(n),R={id:t.id,token:n,promise:te({...t,preload:n}).then(e=>(M.delete(n),e.type==="loaded"&&e.state.error&&(R=null),e))}}return R.promise}async function ft(t){const n=rt.find(e=>e.exec(ee(t)));n&&await Promise.all([...n.layouts,n.leaf].map(e=>e==null?void 0:e[1]()))}function Qt(t,n,e){var o;y=t.state;const a=document.querySelector("style[data-sveltekit]");a&&a.remove(),I=t.props.page,bt=new V.root({target:n,props:{...t.props,stores:U,components:Z},hydrate:e}),Xt(L);const r={from:null,to:{params:y.params,route:{id:((o=y.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(i=>i(r)),Q=!0}async function et({url:t,params:n,branch:e,status:a,error:r,route:o,form:i}){let s="never";if(P&&(t.pathname===P||t.pathname===P+"/"))s="always";else for(const d of e)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);t.pathname=ce(t.pathname,s),t.search=t.search;const c={type:"loaded",state:{url:t,params:n,branch:e,error:r,route:o},props:{constructors:Ce(e).map(d=>d.node.component),page:I}};i!==void 0&&(c.props.form=i);let f={},u=!I,h=0;for(let d=0;d(s&&(c.route=!0),l[m])}),params:new Proxy(a,{get:(l,m)=>(s&&c.params.add(m),l[m])}),data:(o==null?void 0:o.data)??null,url:de(e,()=>{s&&(c.url=!0)},l=>{s&&c.search_params.add(l)}),async fetch(l,m){let b;l instanceof Request?(b=l.url,m={body:l.method==="GET"||l.method==="HEAD"?void 0:await l.blob(),cache:l.cache,credentials:l.credentials,headers:l.headers,integrity:l.integrity,keepalive:l.keepalive,method:l.method,mode:l.mode,redirect:l.redirect,referrer:l.referrer,referrerPolicy:l.referrerPolicy,signal:l.signal,...m}):b=l;const A=new URL(b,e);return s&&d(A.href),A.origin===e.origin&&(b=A.href.slice(e.origin.length)),Q?we(b,A.href,m):ye(b,m)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(l){s=!1;try{return l()}finally{s=!0}}};i=await f.universal.load.call(null,_)??null}return{node:f,loader:t,server:o,universal:(h=f.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=f.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Nt(t,n,e,a,r,o){if(vt)return!0;if(!r)return!1;if(r.parent&&t||r.route&&n||r.url&&e)return!0;for(const i of r.search_params)if(a.has(i))return!0;for(const i of r.params)if(o[i]!==y.params[i])return!0;for(const i of r.dependencies)if(Yt.some(s=>s(new URL(i))))return!0;return!1}function kt(t,n){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?n??null:null}function Ke(t,n){if(!t)return new Set(n.searchParams.keys());const e=new Set([...t.searchParams.keys(),...n.searchParams.keys()]);for(const a of e){const r=t.searchParams.getAll(a),o=n.searchParams.getAll(a);r.every(i=>o.includes(i))&&o.every(i=>r.includes(i))&&e.delete(a)}return e}function Ot({error:t,url:n,route:e,params:a}){return{type:"loaded",state:{error:t,url:n,route:e,params:a,branch:[]},props:{page:I,constructors:[]}}}async function te({id:t,invalidating:n,url:e,params:a,route:r,preload:o}){if((R==null?void 0:R.id)===t)return M.delete(R.token),R.promise;const{errors:i,layouts:s,leaf:c}=r,f=[...s,c];i.forEach(p=>p==null?void 0:p().catch(()=>{})),f.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let u=null;const h=y.url?t!==y.url.pathname+y.url.search:!1,g=y.route?r.id!==y.route.id:!1,d=Ke(y.url,e);let _=!1;const l=f.map((p,v)=>{var x;const E=y.branch[v],k=!!(p!=null&&p[0])&&((E==null?void 0:E.loader)!==p[1]||Nt(_,g,h,d,(x=E.server)==null?void 0:x.uses,a));return k&&(_=!0),k});if(l.some(Boolean)){try{u=await re(e,l)}catch(p){const v=await $(p,{url:e,params:a,route:{id:t}});return M.has(o)?Ot({error:v,url:e,params:a,route:r}):ot({status:W(p),error:v,url:e,route:r})}if(u.type==="redirect")return u}const m=u==null?void 0:u.nodes;let b=!1;const A=f.map(async(p,v)=>{var st;if(!p)return;const E=y.branch[v],k=m==null?void 0:m[v];if((!k||k.type==="skip")&&p[1]===(E==null?void 0:E.loader)&&!Nt(b,g,h,d,(st=E.universal)==null?void 0:st.uses,a))return E;if(b=!0,(k==null?void 0:k.type)==="error")throw k;return Et({loader:p[1],url:e,params:a,route:r,parent:async()=>{var Rt;const At={};for(let it=0;it{});const w=[];for(let p=0;pPromise.resolve({}),server_data_node:kt(o)}),c={node:await X(),loader:X,universal:null,server:null,data:null};return await et({url:e,params:r,branch:[s,c],status:t,error:n,route:null})}function St(t,n){if(!t||nt(t,P))return;let e;try{e=V.hooks.reroute({url:new URL(t)})??t.pathname}catch{return}const a=ee(e);for(const r of rt){const o=r.exec(a);if(o)return{id:t.pathname+t.search,invalidating:n,route:r,params:fe(o),url:t}}}function ee(t){return le(t.slice(P.length)||"/")}function ne({url:t,type:n,intent:e,delta:a}){let r=!1;const o=se(y,e,t,n);a!==void 0&&(o.navigation.delta=a);const i={...o.navigation,cancel:()=>{r=!0,o.reject(new Error("navigation cancelled"))}};return B||zt.forEach(s=>s(i)),r?null:o}async function Y({type:t,url:n,popped:e,keepfocus:a,noscroll:r,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:f=Tt,block:u=Tt}){const h=St(n,!1),g=ne({url:n,type:t,delta:e==null?void 0:e.delta,intent:h});if(!g){u();return}const d=S,_=L;f(),B=!0,Q&&U.navigating.set(g.navigation),tt=c;let l=h&&await te(h);if(!l){if(nt(n,P))return await C(n);l=await ae(n,{id:null},await $(new _t(404,"Not Found",`Not found: ${n.pathname}`),{url:n,params:{},route:{id:null}}),404)}if(n=(h==null?void 0:h.url)||n,tt!==c)return g.reject(new Error("navigation aborted")),!1;if(l.type==="redirect")if(s>=20)l=await ot({status:500,error:await $(new Error("Redirect loop"),{url:n,params:{},route:{id:null}}),url:n,route:{id:null}});else return Zt(new URL(l.location,n).href,{},s+1,c),!1;else l.props.page.status>=400&&await U.updated.check()&&await C(n);if(He(),yt(d),Wt(_),l.props.page.url.pathname!==n.pathname&&(n.pathname=l.props.page.url.pathname),i=e?e.state:i,!e){const w=o?0:1,p={[D]:S+=w,[q]:L+=w,[Gt]:i};(o?history.replaceState:history.pushState).call(history,p,"",n),o||Me(S,L)}if(R=null,l.props.page.state=i,Q){y=l.state,l.props.page&&(l.props.page.url=n);const w=(await Promise.all(qe.map(p=>p(g.navigation)))).filter(p=>typeof p=="function");if(w.length>0){let p=function(){j=j.filter(v=>!w.includes(v))};w.push(p),j.push(...w)}bt.$set(l.props),Jt=!0}else Qt(l,ht,!1);const{activeElement:m}=document;await ie();const b=e?e.scroll:r?mt():null;if(Ut){const w=n.hash&&document.getElementById(decodeURIComponent(n.hash.slice(1)));b?scrollTo(b.x,b.y):w?w.scrollIntoView():scrollTo(0,0)}const A=document.activeElement!==m&&document.activeElement!==document.body;!a&&!A&&Ze(),Ut=!0,l.props.page&&(I=l.props.page),B=!1,t==="popstate"&&Xt(L),g.fulfil(void 0),j.forEach(w=>w(g.navigation)),U.navigating.set(null)}async function ae(t,n,e,a){return t.origin===K&&t.pathname===location.pathname&&!wt?await ot({status:a,error:e,url:t,route:n}):await C(t)}function ze(){let t;T.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(t),t=setTimeout(()=>{a(i,2)},20)});function n(o){a(o.composedPath()[0],1)}T.addEventListener("mousedown",n),T.addEventListener("touchstart",n,{passive:!0});const e=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&(ft(i.target.href),e.unobserve(i.target))},{threshold:0});function a(o,i){const s=Ht(o,T);if(!s)return;const{url:c,external:f,download:u}=ut(s,P);if(f||u)return;const h=J(s);if(!h.reload)if(i<=h.preload_data){const g=St(c,!1);g&&Be(g)}else i<=h.preload_code&&ft(c.pathname)}function r(){e.disconnect();for(const o of T.querySelectorAll("a")){const{url:i,external:s,download:c}=ut(o,P);if(s||c)continue;const f=J(o);f.reload||(f.preload_code===z.viewport&&e.observe(o),f.preload_code===z.eager&&ft(i.pathname))}}j.push(r),r()}function $(t,n){if(t instanceof at)return t.body;const e=W(t),a=Ge(t);return V.hooks.handleError({error:t,event:n,status:e,message:a})??{message:a}}function Je(t,n={}){return t=Mt(t),t.origin!==K?Promise.reject(new Error("goto: invalid URL")):Zt(t,n,0)}function We(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let a=!1;if(xt(),!B){const r=se(y,void 0,null,"leave"),o={...r.navigation,cancel:()=>{a=!0,r.reject(new Error("navigation cancelled"))}};zt.forEach(i=>i(o))}a?(e.preventDefault(),e.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&xt()}),(n=navigator.connection)!=null&&n.saveData||ze(),T.addEventListener("click",e=>{var g;if(e.button||e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;const a=Ht(e.composedPath()[0],T);if(!a)return;const{url:r,external:o,target:i,download:s}=ut(a,P);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=J(a);if(!(a instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;if(o||c.reload){ne({url:r,type:"link"})?B=!0:e.preventDefault();return}const[u,h]=r.href.split("#");if(h!==void 0&&u===ct(location)){const[,d]=y.url.href.split("#");if(d===h){e.preventDefault(),h===""||h==="top"&&a.ownerDocument.getElementById("top")===null?window.scrollTo({top:0}):(g=a.ownerDocument.getElementById(h))==null||g.scrollIntoView();return}if(F=!0,yt(S),t(r),!c.replace_state)return;F=!1}e.preventDefault(),Y({type:"link",url:r,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??r.href===location.href})}),T.addEventListener("submit",e=>{if(e.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(e.target),r=e.submitter;if(((r==null?void 0:r.formMethod)||a.method)!=="get")return;const i=new URL((r==null?void 0:r.hasAttribute("formaction"))&&(r==null?void 0:r.formAction)||a.action);if(nt(i,P))return;const s=e.target,c=J(s);if(c.reload)return;e.preventDefault(),e.stopPropagation();const f=new FormData(s),u=r==null?void 0:r.getAttribute("name");u&&f.append(u,(r==null?void 0:r.getAttribute("value"))??""),i.search=new URLSearchParams(f).toString(),Y({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href})}),addEventListener("popstate",async e=>{var a;if((a=e.state)!=null&&a[D]){const r=e.state[D];if(tt={},r===S)return;const o=N[r],i=e.state[Gt]??{},s=new URL(e.state[Le]??location.href),c=e.state[q],f=ct(location)===ct(y.url);if(c===L&&(Jt||f)){t(s),N[S]=mt(),o&&scrollTo(o.x,o.y),i!==I.state&&(I={...I,state:i},bt.$set({page:I})),S=r;return}const h=r-S;await Y({type:"popstate",url:s,popped:{state:i,scroll:o,delta:h},accept:()=>{S=r,L=c},block:()=>{history.go(-h)},nav_token:tt})}else if(!F){const r=new URL(location.href);t(r)}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[D]:++S,[q]:L},"",location.href))});for(const e of document.querySelectorAll("link"))e.rel==="icon"&&(e.href=e.href);addEventListener("pageshow",e=>{e.persisted&&U.navigating.set(null)});function t(e){y.url=e,U.page.set({...I,url:e}),U.page.notify()}}async function Xe(t,{status:n=200,error:e,node_ids:a,params:r,route:o,data:i,form:s}){wt=!0;const c=new URL(location.href);({params:r={},route:o={id:null}}=St(c,!1)||{});let f;try{const u=a.map(async(d,_)=>{const l=i[_];return l!=null&&l.uses&&(l.uses=oe(l.uses)),Et({loader:V.nodes[d],url:c,params:r,route:o,parent:async()=>{const m={};for(let b=0;b<_;b+=1)Object.assign(m,(await u[b]).data);return m},server_data_node:kt(l)})}),h=await Promise.all(u),g=rt.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let _=0;_o?"1":"0").join(""));const a=await $t(e.href);if(!a.ok){let o;throw(r=a.headers.get("content-type"))!=null&&r.includes("application/json")?o=await a.json():a.status===404?o="Not Found":a.status===500&&(o="Internal Error"),new at(a.status,o)}return new Promise(async o=>{var h;const i=new Map,s=a.body.getReader(),c=new TextDecoder;function f(g){return De(g,{Promise:d=>new Promise((_,l)=>{i.set(d,{fulfil:_,reject:l})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?` `:c.decode(d,{stream:!0});;){const _=u.indexOf(` `);if(_===-1)break;const l=JSON.parse(u.slice(0,_));if(u=u.slice(_+1),l.type==="redirect")return o(l);if(l.type==="data")(h=l.nodes)==null||h.forEach(m=>{(m==null?void 0:m.type)==="data"&&(m.uses=oe(m.uses),m.data=f(m.data))}),o(l);else if(l.type==="chunk"){const{id:m,data:b,error:A}=l,w=i.get(m);i.delete(m),A?w.reject(f(A)):w.fulfil(f(b))}}}})}function oe(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url),search_params:new Set((t==null?void 0:t.search_params)??[])}}function Ze(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const n=document.body,e=n.getAttribute("tabindex");n.tabIndex=-1,n.focus({preventScroll:!0,focusVisible:!1}),e!==null?n.setAttribute("tabindex",e):n.removeAttribute("tabindex");const a=getSelection();if(a&&a.type!=="None"){const r=[];for(let o=0;o{if(a.rangeCount===r.length){for(let o=0;o{r=u,o=h});return i.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((c=t.route)==null?void 0:c.id)??null},url:t.url},to:e&&{params:(n==null?void 0:n.params)??null,route:{id:((f=n==null?void 0:n.route)==null?void 0:f.id)??null},url:e},willUnload:!n,type:a,complete:i},fulfil:r,reject:o}}export{en as a,U as s}; diff --git a/_app/immutable/entry/app.DTY6vauA.js b/_app/immutable/entry/app.dffdSjRO.js similarity index 95% rename from _app/immutable/entry/app.DTY6vauA.js rename to _app/immutable/entry/app.dffdSjRO.js index 13e621b..59f3fa9 100644 --- a/_app/immutable/entry/app.DTY6vauA.js +++ b/_app/immutable/entry/app.dffdSjRO.js @@ -1,7 +1,7 @@ function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["../nodes/0.mbNbF3Ep.js","../chunks/scheduler.COxbwMzl.js","../chunks/index.DiXqLa_v.js","../chunks/mode.C0a2Dozw.js","../chunks/index.C2Jzycuw.js","../assets/0.WZSu26TF.css","../nodes/1.xxAJsduD.js","../chunks/entry.GCuWv2E9.js","../nodes/2.UL52MShq.js","../assets/2.CEMiwHi2.css"] + __vite__mapDeps.viteFileDeps = ["../nodes/0.mbNbF3Ep.js","../chunks/scheduler.COxbwMzl.js","../chunks/index.DiXqLa_v.js","../chunks/mode.C0a2Dozw.js","../chunks/index.C2Jzycuw.js","../assets/0.WZSu26TF.css","../nodes/1.Csb9u2tu.js","../chunks/entry.CaTbHwiC.js","../nodes/2.BZLrxuGJ.js","../assets/2.CEMiwHi2.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } -import{a as V,b as B,p as d,h as U,j as k,g as p,q as j,u as z,e as W,c as F,d as G,v as A,w as h,t as H,f as J,l as K,x as q,y as E,z as Q}from"../chunks/scheduler.COxbwMzl.js";import{S as X,i as Y,t as g,c as L,a as w,g as S,b as y,d as D,m as R,e as P}from"../chunks/index.DiXqLa_v.js";const Z="modulepreload",M=function(a,e){return new URL(a,e).href},I={},C=function(e,n,i){let s=Promise.resolve();if(n&&n.length>0){const u=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),r=(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"));s=Promise.all(n.map(o=>{if(o=M(o,i),o in I)return;I[o]=!0;const f=o.endsWith(".css"),l=f?'[rel="stylesheet"]':"";if(!!i)for(let b=u.length-1;b>=0;b--){const v=u[b];if(v.href===o&&(!f||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${l}`))return;const _=document.createElement("link");if(_.rel=f?"stylesheet":Z,f||(_.as="script",_.crossOrigin=""),_.href=o,r&&_.setAttribute("nonce",r),document.head.appendChild(_),f)return new Promise((b,v)=>{_.addEventListener("load",b),_.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${o}`)))})}))}return s.then(()=>e()).catch(u=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=u,window.dispatchEvent(t),!t.defaultPrevented)throw u})},re={};function $(a){let e,n,i;var s=a[1][0];function u(t,r){return{props:{data:t[3],form:t[2]}}}return s&&(e=E(s,u(a)),a[12](e)),{c(){e&&y(e.$$.fragment),n=d()},l(t){e&&D(e.$$.fragment,t),n=d()},m(t,r){e&&R(e,t,r),k(t,n,r),i=!0},p(t,r){if(r&2&&s!==(s=t[1][0])){if(e){S();const o=e;g(o.$$.fragment,1,0,()=>{P(o,1)}),L()}s?(e=E(s,u(t)),t[12](e),y(e.$$.fragment),w(e.$$.fragment,1),R(e,n.parentNode,n)):e=null}else if(s){const o={};r&8&&(o.data=t[3]),r&4&&(o.form=t[2]),e.$set(o)}},i(t){i||(e&&w(e.$$.fragment,t),i=!0)},o(t){e&&g(e.$$.fragment,t),i=!1},d(t){t&&p(n),a[12](null),e&&P(e,t)}}}function x(a){let e,n,i;var s=a[1][0];function u(t,r){return{props:{data:t[3],$$slots:{default:[ee]},$$scope:{ctx:t}}}}return s&&(e=E(s,u(a)),a[11](e)),{c(){e&&y(e.$$.fragment),n=d()},l(t){e&&D(e.$$.fragment,t),n=d()},m(t,r){e&&R(e,t,r),k(t,n,r),i=!0},p(t,r){if(r&2&&s!==(s=t[1][0])){if(e){S();const o=e;g(o.$$.fragment,1,0,()=>{P(o,1)}),L()}s?(e=E(s,u(t)),t[11](e),y(e.$$.fragment),w(e.$$.fragment,1),R(e,n.parentNode,n)):e=null}else if(s){const o={};r&8&&(o.data=t[3]),r&8215&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)}},i(t){i||(e&&w(e.$$.fragment,t),i=!0)},o(t){e&&g(e.$$.fragment,t),i=!1},d(t){t&&p(n),a[11](null),e&&P(e,t)}}}function ee(a){let e,n,i;var s=a[1][1];function u(t,r){return{props:{data:t[4],form:t[2]}}}return s&&(e=E(s,u(a)),a[10](e)),{c(){e&&y(e.$$.fragment),n=d()},l(t){e&&D(e.$$.fragment,t),n=d()},m(t,r){e&&R(e,t,r),k(t,n,r),i=!0},p(t,r){if(r&2&&s!==(s=t[1][1])){if(e){S();const o=e;g(o.$$.fragment,1,0,()=>{P(o,1)}),L()}s?(e=E(s,u(t)),t[10](e),y(e.$$.fragment),w(e.$$.fragment,1),R(e,n.parentNode,n)):e=null}else if(s){const o={};r&16&&(o.data=t[4]),r&4&&(o.form=t[2]),e.$set(o)}},i(t){i||(e&&w(e.$$.fragment,t),i=!0)},o(t){e&&g(e.$$.fragment,t),i=!1},d(t){t&&p(n),a[10](null),e&&P(e,t)}}}function N(a){let e,n=a[6]&&O(a);return{c(){e=W("div"),n&&n.c(),this.h()},l(i){e=F(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var s=G(e);n&&n.l(s),s.forEach(p),this.h()},h(){A(e,"id","svelte-announcer"),A(e,"aria-live","assertive"),A(e,"aria-atomic","true"),h(e,"position","absolute"),h(e,"left","0"),h(e,"top","0"),h(e,"clip","rect(0 0 0 0)"),h(e,"clip-path","inset(50%)"),h(e,"overflow","hidden"),h(e,"white-space","nowrap"),h(e,"width","1px"),h(e,"height","1px")},m(i,s){k(i,e,s),n&&n.m(e,null)},p(i,s){i[6]?n?n.p(i,s):(n=O(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(i){i&&p(e),n&&n.d()}}}function O(a){let e;return{c(){e=H(a[7])},l(n){e=J(n,a[7])},m(n,i){k(n,e,i)},p(n,i){i&128&&K(e,n[7])},d(n){n&&p(e)}}}function te(a){let e,n,i,s,u;const t=[x,$],r=[];function o(l,m){return l[1][1]?0:1}e=o(a),n=r[e]=t[e](a);let f=a[5]&&N(a);return{c(){n.c(),i=B(),f&&f.c(),s=d()},l(l){n.l(l),i=U(l),f&&f.l(l),s=d()},m(l,m){r[e].m(l,m),k(l,i,m),f&&f.m(l,m),k(l,s,m),u=!0},p(l,[m]){let _=e;e=o(l),e===_?r[e].p(l,m):(S(),g(r[_],1,1,()=>{r[_]=null}),L(),n=r[e],n?n.p(l,m):(n=r[e]=t[e](l),n.c()),w(n,1),n.m(i.parentNode,i)),l[5]?f?f.p(l,m):(f=N(l),f.c(),f.m(s.parentNode,s)):f&&(f.d(1),f=null)},i(l){u||(w(n),u=!0)},o(l){g(n),u=!1},d(l){l&&(p(i),p(s)),r[e].d(l),f&&f.d(l)}}}function ne(a,e,n){let{stores:i}=e,{page:s}=e,{constructors:u}=e,{components:t=[]}=e,{form:r}=e,{data_0:o=null}=e,{data_1:f=null}=e;j(i.page.notify);let l=!1,m=!1,_=null;z(()=>{const c=i.page.subscribe(()=>{l&&(n(6,m=!0),Q().then(()=>{n(7,_=document.title||"untitled page")}))});return n(5,l=!0),c});function b(c){q[c?"unshift":"push"](()=>{t[1]=c,n(0,t)})}function v(c){q[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}function T(c){q[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}return a.$$set=c=>{"stores"in c&&n(8,i=c.stores),"page"in c&&n(9,s=c.page),"constructors"in c&&n(1,u=c.constructors),"components"in c&&n(0,t=c.components),"form"in c&&n(2,r=c.form),"data_0"in c&&n(3,o=c.data_0),"data_1"in c&&n(4,f=c.data_1)},a.$$.update=()=>{a.$$.dirty&768&&i.page.set(s)},[t,u,r,o,f,l,m,_,i,s,b,v,T]}class oe extends X{constructor(e){super(),Y(this,e,ne,te,V,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const ae=[()=>C(()=>import("../nodes/0.mbNbF3Ep.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),()=>C(()=>import("../nodes/1.xxAJsduD.js"),__vite__mapDeps([6,1,2,7,4]),import.meta.url),()=>C(()=>import("../nodes/2.UL52MShq.js"),__vite__mapDeps([8,1,2,4,3,9]),import.meta.url)],le=[],fe={"/":[2]},ce={handleError:({error:a})=>{console.error(a)},reroute:()=>{}};export{fe as dictionary,ce as hooks,re as matchers,ae as nodes,oe as root,le as server_loads}; +import{a as V,b as B,p as d,h as U,j as k,g as p,q as j,u as z,e as W,c as F,d as G,v as A,w as h,t as H,f as J,l as K,x as q,y as E,z as Q}from"../chunks/scheduler.COxbwMzl.js";import{S as X,i as Y,t as g,c as L,a as w,g as S,b as y,d as D,m as R,e as P}from"../chunks/index.DiXqLa_v.js";const Z="modulepreload",M=function(a,e){return new URL(a,e).href},I={},C=function(e,n,i){let s=Promise.resolve();if(n&&n.length>0){const u=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),r=(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"));s=Promise.all(n.map(o=>{if(o=M(o,i),o in I)return;I[o]=!0;const f=o.endsWith(".css"),l=f?'[rel="stylesheet"]':"";if(!!i)for(let b=u.length-1;b>=0;b--){const v=u[b];if(v.href===o&&(!f||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${l}`))return;const _=document.createElement("link");if(_.rel=f?"stylesheet":Z,f||(_.as="script",_.crossOrigin=""),_.href=o,r&&_.setAttribute("nonce",r),document.head.appendChild(_),f)return new Promise((b,v)=>{_.addEventListener("load",b),_.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${o}`)))})}))}return s.then(()=>e()).catch(u=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=u,window.dispatchEvent(t),!t.defaultPrevented)throw u})},re={};function $(a){let e,n,i;var s=a[1][0];function u(t,r){return{props:{data:t[3],form:t[2]}}}return s&&(e=E(s,u(a)),a[12](e)),{c(){e&&y(e.$$.fragment),n=d()},l(t){e&&D(e.$$.fragment,t),n=d()},m(t,r){e&&R(e,t,r),k(t,n,r),i=!0},p(t,r){if(r&2&&s!==(s=t[1][0])){if(e){S();const o=e;g(o.$$.fragment,1,0,()=>{P(o,1)}),L()}s?(e=E(s,u(t)),t[12](e),y(e.$$.fragment),w(e.$$.fragment,1),R(e,n.parentNode,n)):e=null}else if(s){const o={};r&8&&(o.data=t[3]),r&4&&(o.form=t[2]),e.$set(o)}},i(t){i||(e&&w(e.$$.fragment,t),i=!0)},o(t){e&&g(e.$$.fragment,t),i=!1},d(t){t&&p(n),a[12](null),e&&P(e,t)}}}function x(a){let e,n,i;var s=a[1][0];function u(t,r){return{props:{data:t[3],$$slots:{default:[ee]},$$scope:{ctx:t}}}}return s&&(e=E(s,u(a)),a[11](e)),{c(){e&&y(e.$$.fragment),n=d()},l(t){e&&D(e.$$.fragment,t),n=d()},m(t,r){e&&R(e,t,r),k(t,n,r),i=!0},p(t,r){if(r&2&&s!==(s=t[1][0])){if(e){S();const o=e;g(o.$$.fragment,1,0,()=>{P(o,1)}),L()}s?(e=E(s,u(t)),t[11](e),y(e.$$.fragment),w(e.$$.fragment,1),R(e,n.parentNode,n)):e=null}else if(s){const o={};r&8&&(o.data=t[3]),r&8215&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)}},i(t){i||(e&&w(e.$$.fragment,t),i=!0)},o(t){e&&g(e.$$.fragment,t),i=!1},d(t){t&&p(n),a[11](null),e&&P(e,t)}}}function ee(a){let e,n,i;var s=a[1][1];function u(t,r){return{props:{data:t[4],form:t[2]}}}return s&&(e=E(s,u(a)),a[10](e)),{c(){e&&y(e.$$.fragment),n=d()},l(t){e&&D(e.$$.fragment,t),n=d()},m(t,r){e&&R(e,t,r),k(t,n,r),i=!0},p(t,r){if(r&2&&s!==(s=t[1][1])){if(e){S();const o=e;g(o.$$.fragment,1,0,()=>{P(o,1)}),L()}s?(e=E(s,u(t)),t[10](e),y(e.$$.fragment),w(e.$$.fragment,1),R(e,n.parentNode,n)):e=null}else if(s){const o={};r&16&&(o.data=t[4]),r&4&&(o.form=t[2]),e.$set(o)}},i(t){i||(e&&w(e.$$.fragment,t),i=!0)},o(t){e&&g(e.$$.fragment,t),i=!1},d(t){t&&p(n),a[10](null),e&&P(e,t)}}}function N(a){let e,n=a[6]&&O(a);return{c(){e=W("div"),n&&n.c(),this.h()},l(i){e=F(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var s=G(e);n&&n.l(s),s.forEach(p),this.h()},h(){A(e,"id","svelte-announcer"),A(e,"aria-live","assertive"),A(e,"aria-atomic","true"),h(e,"position","absolute"),h(e,"left","0"),h(e,"top","0"),h(e,"clip","rect(0 0 0 0)"),h(e,"clip-path","inset(50%)"),h(e,"overflow","hidden"),h(e,"white-space","nowrap"),h(e,"width","1px"),h(e,"height","1px")},m(i,s){k(i,e,s),n&&n.m(e,null)},p(i,s){i[6]?n?n.p(i,s):(n=O(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(i){i&&p(e),n&&n.d()}}}function O(a){let e;return{c(){e=H(a[7])},l(n){e=J(n,a[7])},m(n,i){k(n,e,i)},p(n,i){i&128&&K(e,n[7])},d(n){n&&p(e)}}}function te(a){let e,n,i,s,u;const t=[x,$],r=[];function o(l,m){return l[1][1]?0:1}e=o(a),n=r[e]=t[e](a);let f=a[5]&&N(a);return{c(){n.c(),i=B(),f&&f.c(),s=d()},l(l){n.l(l),i=U(l),f&&f.l(l),s=d()},m(l,m){r[e].m(l,m),k(l,i,m),f&&f.m(l,m),k(l,s,m),u=!0},p(l,[m]){let _=e;e=o(l),e===_?r[e].p(l,m):(S(),g(r[_],1,1,()=>{r[_]=null}),L(),n=r[e],n?n.p(l,m):(n=r[e]=t[e](l),n.c()),w(n,1),n.m(i.parentNode,i)),l[5]?f?f.p(l,m):(f=N(l),f.c(),f.m(s.parentNode,s)):f&&(f.d(1),f=null)},i(l){u||(w(n),u=!0)},o(l){g(n),u=!1},d(l){l&&(p(i),p(s)),r[e].d(l),f&&f.d(l)}}}function ne(a,e,n){let{stores:i}=e,{page:s}=e,{constructors:u}=e,{components:t=[]}=e,{form:r}=e,{data_0:o=null}=e,{data_1:f=null}=e;j(i.page.notify);let l=!1,m=!1,_=null;z(()=>{const c=i.page.subscribe(()=>{l&&(n(6,m=!0),Q().then(()=>{n(7,_=document.title||"untitled page")}))});return n(5,l=!0),c});function b(c){q[c?"unshift":"push"](()=>{t[1]=c,n(0,t)})}function v(c){q[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}function T(c){q[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}return a.$$set=c=>{"stores"in c&&n(8,i=c.stores),"page"in c&&n(9,s=c.page),"constructors"in c&&n(1,u=c.constructors),"components"in c&&n(0,t=c.components),"form"in c&&n(2,r=c.form),"data_0"in c&&n(3,o=c.data_0),"data_1"in c&&n(4,f=c.data_1)},a.$$.update=()=>{a.$$.dirty&768&&i.page.set(s)},[t,u,r,o,f,l,m,_,i,s,b,v,T]}class oe extends X{constructor(e){super(),Y(this,e,ne,te,V,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const ae=[()=>C(()=>import("../nodes/0.mbNbF3Ep.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),()=>C(()=>import("../nodes/1.Csb9u2tu.js"),__vite__mapDeps([6,1,2,7,4]),import.meta.url),()=>C(()=>import("../nodes/2.BZLrxuGJ.js"),__vite__mapDeps([8,1,2,4,3,9]),import.meta.url)],le=[],fe={"/":[2]},ce={handleError:({error:a})=>{console.error(a)},reroute:()=>{}};export{fe as dictionary,ce as hooks,re as matchers,ae as nodes,oe as root,le as server_loads}; diff --git a/_app/immutable/entry/start.BxRmslfr.js b/_app/immutable/entry/start.BxRmslfr.js deleted file mode 100644 index 00a5db5..0000000 --- a/_app/immutable/entry/start.BxRmslfr.js +++ /dev/null @@ -1 +0,0 @@ -import{a as t}from"../chunks/entry.GCuWv2E9.js";export{t as start}; diff --git a/_app/immutable/entry/start.zF79ugB9.js b/_app/immutable/entry/start.zF79ugB9.js new file mode 100644 index 0000000..ad9184f --- /dev/null +++ b/_app/immutable/entry/start.zF79ugB9.js @@ -0,0 +1 @@ +import{a as t}from"../chunks/entry.CaTbHwiC.js";export{t as start}; diff --git a/_app/immutable/nodes/1.xxAJsduD.js b/_app/immutable/nodes/1.Csb9u2tu.js similarity index 93% rename from _app/immutable/nodes/1.xxAJsduD.js rename to _app/immutable/nodes/1.Csb9u2tu.js index d15f9d8..5a471af 100644 --- a/_app/immutable/nodes/1.xxAJsduD.js +++ b/_app/immutable/nodes/1.Csb9u2tu.js @@ -1 +1 @@ -import{a as S,e as _,t as f,b as x,c as d,d as g,f as h,g as l,h as j,j as m,k as v,l as $,n as E,m as k}from"../chunks/scheduler.COxbwMzl.js";import{S as q,i as y}from"../chunks/index.DiXqLa_v.js";import{s as C}from"../chunks/entry.GCuWv2E9.js";const H=()=>{const s=C;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},P={subscribe(s){return H().page.subscribe(s)}};function w(s){var b;let t,r=s[0].status+"",o,n,i,c=((b=s[0].error)==null?void 0:b.message)+"",u;return{c(){t=_("h1"),o=f(r),n=x(),i=_("p"),u=f(c)},l(e){t=d(e,"H1",{});var a=g(t);o=h(a,r),a.forEach(l),n=j(e),i=d(e,"P",{});var p=g(i);u=h(p,c),p.forEach(l)},m(e,a){m(e,t,a),v(t,o),m(e,n,a),m(e,i,a),v(i,u)},p(e,[a]){var p;a&1&&r!==(r=e[0].status+"")&&$(o,r),a&1&&c!==(c=((p=e[0].error)==null?void 0:p.message)+"")&&$(u,c)},i:E,o:E,d(e){e&&(l(t),l(n),l(i))}}}function z(s,t,r){let o;return k(s,P,n=>r(0,o=n)),[o]}let F=class extends q{constructor(t){super(),y(this,t,z,w,S,{})}};export{F as component}; +import{a as S,e as _,t as f,b as x,c as d,d as g,f as h,g as l,h as j,j as m,k as v,l as $,n as E,m as k}from"../chunks/scheduler.COxbwMzl.js";import{S as q,i as y}from"../chunks/index.DiXqLa_v.js";import{s as C}from"../chunks/entry.CaTbHwiC.js";const H=()=>{const s=C;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},P={subscribe(s){return H().page.subscribe(s)}};function w(s){var b;let t,r=s[0].status+"",o,n,i,c=((b=s[0].error)==null?void 0:b.message)+"",u;return{c(){t=_("h1"),o=f(r),n=x(),i=_("p"),u=f(c)},l(e){t=d(e,"H1",{});var a=g(t);o=h(a,r),a.forEach(l),n=j(e),i=d(e,"P",{});var p=g(i);u=h(p,c),p.forEach(l)},m(e,a){m(e,t,a),v(t,o),m(e,n,a),m(e,i,a),v(i,u)},p(e,[a]){var p;a&1&&r!==(r=e[0].status+"")&&$(o,r),a&1&&c!==(c=((p=e[0].error)==null?void 0:p.message)+"")&&$(u,c)},i:E,o:E,d(e){e&&(l(t),l(n),l(i))}}}function z(s,t,r){let o;return k(s,P,n=>r(0,o=n)),[o]}let F=class extends q{constructor(t){super(),y(this,t,z,w,S,{})}};export{F as component}; diff --git a/_app/immutable/nodes/2.UL52MShq.js b/_app/immutable/nodes/2.BZLrxuGJ.js similarity index 84% rename from _app/immutable/nodes/2.UL52MShq.js rename to _app/immutable/nodes/2.BZLrxuGJ.js index 9690b61..6e8b4f7 100644 --- a/_app/immutable/nodes/2.UL52MShq.js +++ b/_app/immutable/nodes/2.BZLrxuGJ.js @@ -1,15 +1,15 @@ -import{X as E1,z as Mf,o as jt,Y as M1,a as ce,p as We,j as ne,g as j,Z as Te,_ as T,$ as J,a0 as pe,x as nt,C as re,e as ze,c as Ve,d as He,a1 as ts,a2 as ae,D as ie,E as se,F as oe,r as Nt,a3 as Dt,i as O1,a4 as $1,a5 as N1,m as An,a6 as xe,J as ws,n as Oe,a7 as mg,a8 as gg,a9 as $l,k as Ie,aa as D1,L as x1,b as ve,h as we,ab as I1,v as Ir,ac as Kd,u as R1,w as P1,ad as Jd,t as Po,f as Lo}from"../chunks/scheduler.COxbwMzl.js";import{S as fe,i as de,g as Tn,t as S,c as En,a as k,f as Va,h as Ha,j as Nl,b as x,d as I,m as R,e as P,k as Gd}from"../chunks/index.DiXqLa_v.js";import{d as Ua,w as ns,r as Of,a as Yd}from"../chunks/index.C2Jzycuw.js";import{t as L1}from"../chunks/mode.C0a2Dozw.js";function Xd(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function le(n,e){const t={},r={},i={$$scope:1};let s=n.length;for(;s--;){const o=n[s],l=e[s];if(l){for(const a in o)a in l||(r[a]=1);for(const a in l)i[a]||(t[a]=l[a],i[a]=1);n[s]=l}else for(const a in o)i[a]=1}for(const o in r)o in t||(t[o]=void 0);return t}function Re(n){return typeof n=="object"&&n!==null?n:{}}function At(n){this.content=n}At.prototype={constructor:At,find:function(n){for(var e=0;e>1}};At.from=function(n){if(n instanceof At)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new At(e)};function bg(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=bg(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function yg(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;ce&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new V(r,i)}cutByIndex(e,t){return e==t?V.empty:e==0&&t==this.content.length?this:new V(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new V(i,s)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Go(r+1,o):Go(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return V.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};je.none=[];class xl extends Error{}class G{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=wg(this.content,e+this.openStart,t);return r&&new G(r,this.openStart,this.openEnd)}removeBetween(e,t){return new G(vg(this.content,e+this.openStart,t+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,t){if(!t)return G.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new G(V.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new G(e,r,i)}}G.empty=new G(V.empty,0,0);function vg(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vg(s.content,e-i-1,t-i-1)))}function wg(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=wg(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function B1(n,e,t){if(t.openStart>n.depth)throw new xl("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new xl("Inconsistent open depths");return kg(n,e,t,0)}function kg(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function qs(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(ai(n.nodeAfter,r),s++));for(let l=s;li&&vu(n,e,i+1),o=r.depth>i&&vu(t,r,i+1),l=[];return qs(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Sg(s,o),ai(ci(s,Cg(n,e,t,r,i+1)),l)):(s&&ai(ci(s,Il(n,e,i+1)),l),qs(e,t,i,l),o&&ai(ci(o,Il(t,r,i+1)),l)),qs(r,null,i,l),new V(l)}function Il(n,e,t){let r=[];if(qs(null,n,t,r),n.depth>t){let i=vu(n,e,t+1);ai(ci(i,Il(n,e,t+1)),r)}return qs(e,null,t,r),new V(r)}function F1(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(V.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class ao{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Rl(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=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new ao(t,r,s)}static resolveCached(e,t){for(let i=0;ie&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),_g(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=V.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=V.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};ui.prototype.text=void 0;class Pl extends ui{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):_g(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Pl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Pl(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function _g(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class bi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new H1(e,t);if(r.next==null)return bi.empty;let i=Ag(r);r.next&&r.err("Unexpected trailing text");let s=G1(J1(i));return Y1(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` +import{X as E1,z as Mf,o as jt,Y as M1,a as ce,p as We,j as ne,g as j,Z as Te,_ as T,$ as J,a0 as pe,x as rt,C as re,e as Fe,c as ze,d as He,a1 as ts,a2 as ae,D as ie,E as se,F as oe,r as Nt,a3 as Dt,i as O1,a4 as $1,a5 as N1,m as Tn,a6 as xe,J as ws,n as Oe,a7 as mg,a8 as gg,a9 as $l,k as Ie,aa as D1,L as x1,b as ve,h as we,ab as I1,v as Ir,ac as Kd,u as R1,w as P1,ad as Jd,t as Po,f as Lo}from"../chunks/scheduler.COxbwMzl.js";import{S as fe,i as de,g as En,t as S,c as Mn,a as k,f as Va,h as Ha,j as Nl,b as x,d as I,m as R,e as P,k as Gd}from"../chunks/index.DiXqLa_v.js";import{d as Ua,w as ns,r as Of,a as Yd}from"../chunks/index.C2Jzycuw.js";import{t as L1}from"../chunks/mode.C0a2Dozw.js";function Xd(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function le(n,e){const t={},r={},i={$$scope:1};let s=n.length;for(;s--;){const o=n[s],l=e[s];if(l){for(const a in o)a in l||(r[a]=1);for(const a in l)i[a]||(t[a]=l[a],i[a]=1);n[s]=l}else for(const a in o)i[a]=1}for(const o in r)o in t||(t[o]=void 0);return t}function Re(n){return typeof n=="object"&&n!==null?n:{}}function At(n){this.content=n}At.prototype={constructor:At,find:function(n){for(var e=0;e>1}};At.from=function(n){if(n instanceof At)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new At(e)};function bg(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=bg(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function yg(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;ce&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new V(r,i)}cutByIndex(e,t){return e==t?V.empty:e==0&&t==this.content.length?this:new V(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new V(i,s)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Go(r+1,o):Go(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return V.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};je.none=[];class xl extends Error{}class G{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=wg(this.content,e+this.openStart,t);return r&&new G(r,this.openStart,this.openEnd)}removeBetween(e,t){return new G(vg(this.content,e+this.openStart,t+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,t){if(!t)return G.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new G(V.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new G(e,r,i)}}G.empty=new G(V.empty,0,0);function vg(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vg(s.content,e-i-1,t-i-1)))}function wg(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=wg(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function B1(n,e,t){if(t.openStart>n.depth)throw new xl("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new xl("Inconsistent open depths");return kg(n,e,t,0)}function kg(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function qs(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(ai(n.nodeAfter,r),s++));for(let l=s;li&&vu(n,e,i+1),o=r.depth>i&&vu(t,r,i+1),l=[];return qs(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Sg(s,o),ai(ci(s,Cg(n,e,t,r,i+1)),l)):(s&&ai(ci(s,Il(n,e,i+1)),l),qs(e,t,i,l),o&&ai(ci(o,Il(t,r,i+1)),l)),qs(r,null,i,l),new V(l)}function Il(n,e,t){let r=[];if(qs(null,n,t,r),n.depth>t){let i=vu(n,e,t+1);ai(ci(i,Il(n,e,t+1)),r)}return qs(e,null,t,r),new V(r)}function F1(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(V.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class ao{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Rl(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=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new ao(t,r,s)}static resolveCached(e,t){for(let i=0;ie&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),_g(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=V.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=V.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};ui.prototype.text=void 0;class Pl extends ui{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):_g(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Pl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Pl(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function _g(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class bi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new H1(e,t);if(r.next==null)return bi.empty;let i=Ag(r);r.next&&r.err("Unexpected trailing text");let s=G1(J1(i));return Y1(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` `)}}bi.empty=new bi(!0);class H1{constructor(e,t){this.string=e,this.nodeTypes=t,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 Ag(n){let e=[];do e.push(U1(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function U1(n){let e=[];do e.push(j1(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function j1(n){let e=K1(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=W1(n,e);else break;return e}function Qd(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function W1(n,e){let t=Qd(n),r=t;return n.eat(",")&&(n.next!="}"?r=Qd(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function q1(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function K1(n){if(n.eat("(")){let e=Ag(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=q1(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function J1(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new bi(r.indexOf(n.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new $g(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class X1{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class ja{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Og(i.attrs),this.excluded=null;let s=Eg(this.attrs);this.instance=s?new je(this,s):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Mg(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ja(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}}class Q1{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=At.from(e.nodes),t.marks=At.from(e.marks||{}),this.nodes=eh.compile(this.spec.nodes,this),this.marks=ja.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;s.contentMatch=r[o]||(r[o]=bi.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=l=="_"?null:l?th(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:th(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof eh){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(t,r,i)}text(e,t){let r=this.nodes.text;return new Pl(r,r.defaultAttrs,e,je.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return ui.fromJSON(this,e)}markFromJSON(e){return je.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function th(n,e){let t=[];for(let r=0;r-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}let $f=class ku{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new rh(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new rh(this,t,!0);return r.addAll(e,t.from,t.to),G.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=ih(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ih(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ku(e,ku.schemaRules(e)))}};const Ng={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},Z1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Dg={ol:!0,ul:!0},Ll=1,Bl=2,Ks=4;function nh(n,e,t){return e!=null?(e?Ll:0)|(e==="full"?Bl:0):n&&n.whitespace=="pre"?Ll|Bl:t&~Ks}class Yo{constructor(e,t,r,i,s,o,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=l,this.content=[],this.activeMarks=je.none,this.stashMarks=[],this.match=o||(l&Ks?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(V.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ll)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=V.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;tthis.addAll(e)),o&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=je.none,r=je.none;for(let i=0;i{o.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;ithis.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=iv(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function ev(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Dg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function tv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function nv(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function ih(n){let e={};for(let t in n)e[t]=n[t];return e}function rv(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&jn.renderSpec(Cc(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;uc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:d,contentDOM:h}=jn.renderSpec(e,f,r);if(l.appendChild(d),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new jn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=sh(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return sh(e.marks)}}function sh(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Cc(n){return n.document||window.document}const xg=65535,Ig=Math.pow(2,16);function sv(n,e){return n+e*Ig}function oh(n){return n&xg}function ov(n){return(n-(n&xg))/Ig}const Rg=1,Pg=2,pl=4,Lg=8;class Su{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Lg)>0}get deletedBefore(){return(this.delInfo&(Rg|pl))>0}get deletedAfter(){return(this.delInfo&(Pg|pl))>0}get deletedAcross(){return(this.delInfo&pl)>0}}class en{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&en.empty)return en.empty}recover(e){let t=0,r=oh(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],u=this.ranges[l+o],f=a+c;if(e<=f){let d=c?e==a?-1:e==f?1:t:t,h=a+i+(d<0?0:u);if(r)return h;let p=e==(t<0?a:f)?null:sv(l/3,e-a),m=e==a?Pg:e==f?Rg:pl;return(t<0?e!=a:e!=f)&&(m|=Lg),new Su(h,m,p)}i+=u-c}return r?e+i:new Su(e+i,0,null)}touches(e,t){let r=0,i=oh(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new qi;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ot.fromReplace(e,this.from,this.to,s)}invert(){return new Wn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new $r(t.pos,r.pos,this.mark)}merge(e){return e instanceof $r&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $r(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new $r(t.from,t.to,e.markFromJSON(t.mark))}}Rt.jsonID("addMark",$r);class Wn extends Rt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new G(Nf(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ot.fromReplace(e,this.from,this.to,r)}invert(){return new $r(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Wn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Wn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Wn(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Wn(t.from,t.to,e.markFromJSON(t.mark))}}Rt.jsonID("removeMark",Wn);class Nr extends Rt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ot.fromReplace(e,this.pos,this.pos+1,new G(V.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new wt(t.pos,r.pos,i,s,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new wt(t.from,t.to,t.gapFrom,t.gapTo,G.fromJSON(e,t.slice),t.insert,!!t.structure)}}Rt.jsonID("replaceAround",wt);function Cu(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function lv(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let d=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(f);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function av(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof ja){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;un.step(new Wn(o.from,o.to,o.style)))}function cv(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l=0;l--)n.step(s[l])}function uv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function ks(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,u=V.from(r.node(p).copy(u)),f++):a--;let d=V.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=V.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new wt(i,s,i,s,new G(r,0,0),t.length,!0))}function mv(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&gv(n.doc,n.mapping.slice(s).map(l),r)){n.clearIncompatible(n.mapping.slice(s).map(l,1),r);let a=n.mapping.slice(s),c=a.map(l,1),u=a.map(l+o.nodeSize,1);return n.step(new wt(c,u,c+1,u-1,new G(V.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function gv(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function bv(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new wt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new G(V.from(o),0,0),1,!0))}function Ki(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function yv(n,e,t=1,r){let i=n.doc.resolve(e),s=V.empty,o=V.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=V.from(i.node(l).copy(s));let u=r&&r[c];o=V.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new vt(e,e,new G(s.append(o),t,t),!0))}function Ur(n,e){let t=n.resolve(e),r=t.index();return Bg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Bg(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Wa(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Bg(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function vv(n,e,t){let r=new vt(e-t,e+t,G.empty,!0);n.step(r)}function wv(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let f=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function qa(n,e,t=e,r=G.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return zg(i,s,r)?new vt(e,t,r):new kv(i,s,r).fit()}function zg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class kv{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=V.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=V.from(e.node(i).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(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new G(s,o,l);return e>-1?new wt(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new vt(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ac(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,f=null;if(t==1&&(o?c.matchType(o.type)||(f=c.fillBefore(V.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ac(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ac(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new G(Vs(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new G(Vs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(f=g,u.push(Vg(m.mark(d.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Hs(this.placed,t,V.from(u)),this.frontier[t].match=f,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],u=Tc(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Hs(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Hs(this.placed,this.depth,V.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(V.empty,!0);t.childCount&&(this.placed=Hs(this.placed,this.frontier.length,t))}}function Vs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Vs(n.firstChild.content,e-1,t)))}function Hs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Hs(n.lastChild.content,e-1,t)))}function Ac(n,e){for(let t=0;t1&&(r=r.replaceChild(0,Vg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(V.empty,!0)))),n.copy(r)}function Tc(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Sv(t,s.content,o)?l:null}function Sv(n,e,t){for(let r=t;r0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(d)>-1?l=d:i.before(d)==h&&o.splice(1,0,-d)}let a=o.indexOf(l),c=[],u=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(c.push(p),h==r.openStart)break;d=p.content}for(let d=u-1;d>=0;d--){let h=c[d],p=Cv(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>f));d--){let h=o[d];h<0||(e=i.before(h),t=s.after(h))}}function Hg(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(V.empty,!0))}return n}function Av(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=wv(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new G(V.from(r),0,0))}function Tv(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=Ug(r,i);for(let o=0;o0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function Ug(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Ji extends Rt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ot.fromReplace(e,this.pos,this.pos+1,new G(V.from(i),0,t.isLeaf?0:1))}getMap(){return en.empty}invert(e){return new Ji(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ji(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ji(t.pos,t.attr,t.value)}}Rt.jsonID("attr",Ji);class co extends Rt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ot.ok(r)}getMap(){return en.empty}invert(e){return new co(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new co(t.attr,t.value)}}Rt.jsonID("docAttr",co);let is=class extends Error{};is=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};is.prototype=Object.create(Error.prototype);is.prototype.constructor=is;is.prototype.name="TransformError";class jg{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new qi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new is(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=G.empty){let i=qa(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new G(V.from(r),0,0))}delete(e,t){return this.replace(e,t,G.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return _v(this,e,t,r),this}replaceRangeWith(e,t,r){return Av(this,e,t,r),this}deleteRange(e,t){return Tv(this,e,t),this}lift(e,t){return fv(this,e,t),this}join(e,t=1){return vv(this,e,t),this}wrap(e,t){return pv(this,e,t),this}setBlockType(e,t=e,r,i=null){return mv(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return bv(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ji(e,t,r)),this}setDocAttribute(e,t){return this.step(new co(e,t)),this}addNodeMark(e,t){return this.step(new Nr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof je)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new rs(e,t)),this}split(e,t=1,r){return yv(this,e,t,r),this}addMark(e,t,r){return lv(this,e,t,r),this}removeMark(e,t,r){return av(this,e,t,r),this}clearIncompatible(e,t,r){return cv(this,e,t,r),this}}const Ec=Object.create(null);class Ae{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Ev(e.min(t),e.max(t))]}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 t=0;t=0;s--){let o=t<0?zi(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):zi(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Sn(e.node(0))}static atStart(e){return zi(e,e,0,0,1)||new Sn(e)}static atEnd(e){return zi(e,e,e.content.size,e.childCount,-1)||new Sn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ec[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ec)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ec[e]=t,t.prototype.jsonID=e,t}getBookmark(){return be.between(this.$anchor,this.$head).getBookmark()}}Ae.prototype.visible=!0;class Ev{constructor(e,t){this.$from=e,this.$to=t}}let ah=!1;function ch(n){!ah&&!n.parent.inlineContent&&(ah=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class be extends Ae{constructor(e,t=e){ch(e),ch(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Ae.near(r);let i=e.resolve(t.map(this.anchor));return new be(i.parent.inlineContent?i:r,r)}replace(e,t=G.empty){if(super.replace(e,t),t==G.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof be&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ka(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new be(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=Ae.findFrom(t,r,!0)||Ae.findFrom(t,-r,!0);if(s)t=s.$head;else return Ae.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(Ae.findFrom(e,-r,!0)||Ae.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&ue.isSelectable(l))return ue.create(n,t-(i<0?l.nodeSize:0))}else{let a=zi(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function uh(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(Ae.near(n.doc.resolve(o),t))}const fh=1,Xo=2,dh=4;let Ov=class extends jg{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.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xo,this}ensureMarks(e){return je.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&Xo)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Xo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||je.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(Ae.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=dh,this}get scrolledIntoView(){return(this.updated&dh)>0}};function hh(n,e){return!e||!n?n:n.bind(e)}class Us{constructor(e,t,r){this.name=e,this.init=hh(t.init,r),this.apply=hh(t.apply,r)}}const $v=[new Us("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Us("selection",{init(n,e){return n.selection||Ae.atStart(e.doc)},apply(n){return n.selection}}),new Us("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Us("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Mc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=$v.slice(),t&&t.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 Us(r.key,r.spec.state,r))})}}class ji{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,t=-1){for(let r=0;rr.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 i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Mc(e.schema,e.plugins),s=new ji(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=ui.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=Ae.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Wg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Wg(i,e,{})),t[r]=i}return t}class ut{constructor(e){this.spec=e,this.props={},e.props&&Wg(e.props,this,this.props),this.key=e.key?e.key.key:qg("plugin")}getState(e){return e[this.key]}}const Oc=Object.create(null);function qg(n){return n in Oc?n+"$"+ ++Oc[n]:(Oc[n]=0,n+"$")}class Pt{constructor(e="key"){this.key=qg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Tt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},uo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let _u=null;const sr=function(n,e,t){let r=_u||(_u=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Nv=function(){_u=null},yi=function(n,e,t,r){return t&&(ph(n,e,t,r,-1)||ph(n,e,t,r,1))},Dv=/^(img|br|input|textarea|hr)$/i;function ph(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Un(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Bo(n)||Dv.test(n.nodeName)||n.contentEditable=="false")return!1;e=Tt(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Un(n):0}else return!1}}function Un(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function xv(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Un(n)}else if(n.parentNode&&!Bo(n))e=Tt(n),n=n.parentNode;else return null}}function Iv(n,e){for(;;){if(n.nodeType==3&&e2),cn=ss||(Jn?/Mac/.test(Jn.platform):!1),Fv=Jn?/Win/.test(Jn.platform):!1,vn=/Android \d/.test(jr),Fo=!!mh&&"webkitFontSmoothing"in mh.documentElement.style,zv=Fo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Vv(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function tr(n,e){return typeof n=="number"?n:n[e]}function Hv(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function gh(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=uo(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?Vv(s):Hv(l),u=0,f=0;if(e.topc.bottom-tr(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+tr(i,"top")-c.top:e.bottom-c.bottom+tr(i,"bottom")),e.leftc.right-tr(r,"right")&&(u=e.right-c.right+tr(i,"right")),u||f)if(a)s.defaultView.scrollBy(u,f);else{let d=l.scrollLeft,h=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let p=l.scrollLeft-d,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Uv(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Jg(n.dom)}}function Jg(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=uo(r));return e}function jv({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Gg(t,r==0?0:r-e)}function Gg(n,e){for(let t=0;t=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?qv(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Yg(t,i)}function qv(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function If(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Kv(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function Gv(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!o||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!o&&(o=!0,a.left>r.left||a.top>r.top?i=l.posBefore:(a.right-1?i:n.docView.posFromDOM(e,t,-1)}function Xg(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;Fo&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Gv(n,r,i,e))}l==null&&(l=Jv(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function bh(n){return n.top=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,xs(kr(sr(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Un(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return $c(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==Un(r))){let a=r.childNodes[i-1],c=a.nodeType==3?sr(a,Un(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return xs(kr(c,1),!1)}if(s==null&&i=0)}function xs(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function $c(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Zg(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Qv(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Zg(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Qg(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=sr(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Zv=/[\u0590-\u08ac]/;function ew(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return!Zv.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Zg(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,f),a&&(a!=u||c!=f)&&l.extend&&l.extend(a,c)}catch{}return d!=null&&(l.caretBidiLevel=d),g})}let yh=null,vh=null,wh=!1;function tw(n,e,t){return yh==e&&vh==t?wh:(yh=e,vh=t,wh=t=="up"||t=="down"?Qv(n,e,t):ew(n,e,t))}const dn=0,kh=1,ri=2,Gn=3;class zo{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=dn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tTt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof tb){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof eb&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Tt(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let f=l;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=Tt(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;uh&&ot){let h=l;l=a,a=h}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?ri:kh,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Gn:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ri:Gn}r=o}this.dirty=ri}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ri:kh;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==dn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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 side(){return this.widget.type.side}}class nw extends zo{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class vi extends zo{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=jn.renderSpec(document,t.type.spec.toDOM(t,r))),new vi(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Gn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=dn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=$u(s,0,e,r));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,f=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=jn.renderSpec(document,t.type.spec.toDOM(t)));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let d=u;return u=ib(u,r,t),c?a=new rw(e,t,r,i,u,f||null,d,c,s,o+1):t.isText?new Ga(e,t,r,i,u,d,s):new Pr(e,t,r,i,u,f||null,d,s,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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>V.empty)}return e}matchesNode(e,t,r){return this.dirty==dn&&e.eq(this.node)&&Ou(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new sw(this,o&&o.node,e);aw(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,f,d)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,f,d)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,u,f,h,e)||a.updateNextNode(c,u,f,e,d,i)||a.addNode(c,u,f,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ri)&&(o&&this.protectLocalComposition(e,o),nb(this.contentDOM,this.children,e),ss&&cw(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof be)||rt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=uw(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new nw(this,s,t,i);e.input.compositionNodes.push(o),this.children=$u(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Gn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=dn}updateOuterDeco(e){if(Ou(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=rb(this.dom,this.nodeDOM,Mu(this.outerDeco,this.node,t),Mu(e,this.node,t)),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.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Sh(n,e,t,r,i){ib(r,e,n);let s=new Pr(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Ga extends Pr{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Gn||this.dirty!=dn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=dn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=dn,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new Ga(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Gn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class tb extends zo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==dn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class rw extends Pr{constructor(e,t,r,i,s,o,l,a,c,u){super(e,t,r,i,s,o,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==Gn)return!1;if(this.spec.update){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}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 nb(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=vi.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof vi)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function lw(n,e){return n.type.side-e.type.side}function aw(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let g=p;o!g.inline):l.slice();r(d,m,e.forChild(s,d),h),s=p}}function cw(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function uw(n,e,t,r){for(let i=0,s=0;i=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function $u(n,e,t,r,i){let s=[];for(let o=0,l=0;o=t||u<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,r)))}return s}function Rf(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Ja(t)){for(a=l;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&ue.isSelectable(u)&&i.parent&&!(u.isInline&&Rv(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new ue(o==f?l:r.resolve(f))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;a=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!sb(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function dw(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,Tt(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Kt&&Rr<=11&&(r.disabled=!0,r.disabled=!1)}function ob(n,e){if(e instanceof ue){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Eh(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Eh(n)}function Eh(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Pf(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||be.between(e,t,r)}function Mh(n){return n.editable&&!n.hasFocus()?!1:lb(n)}function lb(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function hw(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return yi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Nu(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ae.findFrom(s,e)}function _r(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Oh(n,e,t){let r=n.state.selection;if(r instanceof be)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return _r(n,new be(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Nu(n.state,e);return i&&i instanceof ue?_r(n,i):!1}else if(!(cn&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?ue.isSelectable(s)?_r(n,new ue(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Fo?_r(n,new be(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ue&&r.node.isInline)return _r(n,new be(e>0?r.$to:r.$from));{let i=Nu(n.state,e);return i?_r(n,i):!1}}}function Fl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gs(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Li(n,e){return e<0?pw(n):mw(n)}function pw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Mn&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Gs(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(ab(t))break;{let l=t.previousSibling;for(;l&&Gs(l,-1);)i=t.parentNode,s=Tt(l),l=l.previousSibling;if(l)t=l,r=Fl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Du(n,t,r):i&&Du(n,i,s)}function mw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Fl(t),s,o;for(;;)if(r{n.state==i&&lr(n)},50)}function $h(n,e){let t=n.state.doc.resolve(e);if(!(Lt||Fv)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Nh(n,e,t){let r=n.state.selection;if(r instanceof be&&!r.empty||t.indexOf("s")>-1||cn&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Nu(n.state,e);if(o&&o instanceof ue)return _r(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Sn?Ae.near(o,e):Ae.findFrom(o,e);return l?_r(n,l):!1}return!1}function Dh(n,e){if(!(n.state.selection instanceof be))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function xh(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function yw(n){if(!Ft||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;xh(n,r,"true"),setTimeout(()=>xh(n,r,"false"),20)}return!1}function vw(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function ww(n,e){let t=e.keyCode,r=vw(e);if(t==8||cn&&t==72&&r=="c")return Dh(n,-1)||Li(n,-1);if(t==46&&!e.shiftKey||cn&&t==68&&r=="c")return Dh(n,1)||Li(n,1);if(t==13||t==27)return!0;if(t==37||cn&&t==66&&r=="c"){let i=t==37?$h(n,n.state.selection.from)=="ltr"?-1:1:-1;return Oh(n,i,r)||Li(n,i)}else if(t==39||cn&&t==70&&r=="c"){let i=t==39?$h(n,n.state.selection.from)=="ltr"?1:-1:1;return Oh(n,i,r)||Li(n,i)}else{if(t==38||cn&&t==80&&r=="c")return Nh(n,-1,r)||Li(n,-1);if(t==40||cn&&t==78&&r=="c")return yw(n)||Nh(n,1,r)||Li(n,1);if(r==(cn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function cb(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||jn.fromSchema(n.state.schema),l=mb(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=pb[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let d=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` +`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=je.none,r=je.none;for(let i=0;i{o.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;ithis.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=iv(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function ev(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Dg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function tv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function nv(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function ih(n){let e={};for(let t in n)e[t]=n[t];return e}function rv(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Wn.renderSpec(Cc(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;uc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:d,contentDOM:h}=Wn.renderSpec(e,f,r);if(l.appendChild(d),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=sh(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return sh(e.marks)}}function sh(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Cc(n){return n.document||window.document}const xg=65535,Ig=Math.pow(2,16);function sv(n,e){return n+e*Ig}function oh(n){return n&xg}function ov(n){return(n-(n&xg))/Ig}const Rg=1,Pg=2,pl=4,Lg=8;class Su{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Lg)>0}get deletedBefore(){return(this.delInfo&(Rg|pl))>0}get deletedAfter(){return(this.delInfo&(Pg|pl))>0}get deletedAcross(){return(this.delInfo&pl)>0}}class tn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&tn.empty)return tn.empty}recover(e){let t=0,r=oh(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],u=this.ranges[l+o],f=a+c;if(e<=f){let d=c?e==a?-1:e==f?1:t:t,h=a+i+(d<0?0:u);if(r)return h;let p=e==(t<0?a:f)?null:sv(l/3,e-a),m=e==a?Pg:e==f?Rg:pl;return(t<0?e!=a:e!=f)&&(m|=Lg),new Su(h,m,p)}i+=u-c}return r?e+i:new Su(e+i,0,null)}touches(e,t){let r=0,i=oh(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new qi;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,s)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new $r(t.pos,r.pos,this.mark)}merge(e){return e instanceof $r&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $r(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new $r(t.from,t.to,e.markFromJSON(t.mark))}}Rt.jsonID("addMark",$r);class qn extends Rt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new G(Nf(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,r)}invert(){return new $r(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new qn(t.pos,r.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qn(t.from,t.to,e.markFromJSON(t.mark))}}Rt.jsonID("removeMark",qn);class Nr extends Rt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return lt.fromReplace(e,this.pos,this.pos+1,new G(V.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new wt(t.pos,r.pos,i,s,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new wt(t.from,t.to,t.gapFrom,t.gapTo,G.fromJSON(e,t.slice),t.insert,!!t.structure)}}Rt.jsonID("replaceAround",wt);function Cu(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function lv(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let d=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(f);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function av(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof ja){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;un.step(new qn(o.from,o.to,o.style)))}function cv(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l=0;l--)n.step(s[l])}function uv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function ks(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,u=V.from(r.node(p).copy(u)),f++):a--;let d=V.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=V.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new wt(i,s,i,s,new G(r,0,0),t.length,!0))}function mv(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&gv(n.doc,n.mapping.slice(s).map(l),r)){n.clearIncompatible(n.mapping.slice(s).map(l,1),r);let a=n.mapping.slice(s),c=a.map(l,1),u=a.map(l+o.nodeSize,1);return n.step(new wt(c,u,c+1,u-1,new G(V.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function gv(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function bv(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new wt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new G(V.from(o),0,0),1,!0))}function Ki(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function yv(n,e,t=1,r){let i=n.doc.resolve(e),s=V.empty,o=V.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=V.from(i.node(l).copy(s));let u=r&&r[c];o=V.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new vt(e,e,new G(s.append(o),t,t),!0))}function Ur(n,e){let t=n.resolve(e),r=t.index();return Bg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Bg(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Wa(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Bg(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function vv(n,e,t){let r=new vt(e-t,e+t,G.empty,!0);n.step(r)}function wv(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let f=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function qa(n,e,t=e,r=G.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return zg(i,s,r)?new vt(e,t,r):new kv(i,s,r).fit()}function zg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class kv{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=V.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=V.from(e.node(i).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(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new G(s,o,l);return e>-1?new wt(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new vt(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ac(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,f=null;if(t==1&&(o?c.matchType(o.type)||(f=c.fillBefore(V.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ac(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ac(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new G(Vs(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new G(Vs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(f=g,u.push(Vg(m.mark(d.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Hs(this.placed,t,V.from(u)),this.frontier[t].match=f,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],u=Tc(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Hs(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Hs(this.placed,this.depth,V.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(V.empty,!0);t.childCount&&(this.placed=Hs(this.placed,this.frontier.length,t))}}function Vs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Vs(n.firstChild.content,e-1,t)))}function Hs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Hs(n.lastChild.content,e-1,t)))}function Ac(n,e){for(let t=0;t1&&(r=r.replaceChild(0,Vg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(V.empty,!0)))),n.copy(r)}function Tc(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Sv(t,s.content,o)?l:null}function Sv(n,e,t){for(let r=t;r0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(d)>-1?l=d:i.before(d)==h&&o.splice(1,0,-d)}let a=o.indexOf(l),c=[],u=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(c.push(p),h==r.openStart)break;d=p.content}for(let d=u-1;d>=0;d--){let h=c[d],p=Cv(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>f));d--){let h=o[d];h<0||(e=i.before(h),t=s.after(h))}}function Hg(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(V.empty,!0))}return n}function Av(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=wv(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new G(V.from(r),0,0))}function Tv(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=Ug(r,i);for(let o=0;o0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function Ug(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Ji extends Rt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return lt.fromReplace(e,this.pos,this.pos+1,new G(V.from(i),0,t.isLeaf?0:1))}getMap(){return tn.empty}invert(e){return new Ji(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ji(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ji(t.pos,t.attr,t.value)}}Rt.jsonID("attr",Ji);class co extends Rt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return lt.ok(r)}getMap(){return tn.empty}invert(e){return new co(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new co(t.attr,t.value)}}Rt.jsonID("docAttr",co);let is=class extends Error{};is=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};is.prototype=Object.create(Error.prototype);is.prototype.constructor=is;is.prototype.name="TransformError";class jg{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new qi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new is(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=G.empty){let i=qa(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new G(V.from(r),0,0))}delete(e,t){return this.replace(e,t,G.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return _v(this,e,t,r),this}replaceRangeWith(e,t,r){return Av(this,e,t,r),this}deleteRange(e,t){return Tv(this,e,t),this}lift(e,t){return fv(this,e,t),this}join(e,t=1){return vv(this,e,t),this}wrap(e,t){return pv(this,e,t),this}setBlockType(e,t=e,r,i=null){return mv(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return bv(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ji(e,t,r)),this}setDocAttribute(e,t){return this.step(new co(e,t)),this}addNodeMark(e,t){return this.step(new Nr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof je)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new rs(e,t)),this}split(e,t=1,r){return yv(this,e,t,r),this}addMark(e,t,r){return lv(this,e,t,r),this}removeMark(e,t,r){return av(this,e,t,r),this}clearIncompatible(e,t,r){return cv(this,e,t,r),this}}const Ec=Object.create(null);class Ae{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Ev(e.min(t),e.max(t))]}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 t=0;t=0;s--){let o=t<0?zi(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):zi(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Cn(e.node(0))}static atStart(e){return zi(e,e,0,0,1)||new Cn(e)}static atEnd(e){return zi(e,e,e.content.size,e.childCount,-1)||new Cn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ec[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ec)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ec[e]=t,t.prototype.jsonID=e,t}getBookmark(){return be.between(this.$anchor,this.$head).getBookmark()}}Ae.prototype.visible=!0;class Ev{constructor(e,t){this.$from=e,this.$to=t}}let ah=!1;function ch(n){!ah&&!n.parent.inlineContent&&(ah=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class be extends Ae{constructor(e,t=e){ch(e),ch(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Ae.near(r);let i=e.resolve(t.map(this.anchor));return new be(i.parent.inlineContent?i:r,r)}replace(e,t=G.empty){if(super.replace(e,t),t==G.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof be&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ka(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new be(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=Ae.findFrom(t,r,!0)||Ae.findFrom(t,-r,!0);if(s)t=s.$head;else return Ae.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(Ae.findFrom(e,-r,!0)||Ae.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&ue.isSelectable(l))return ue.create(n,t-(i<0?l.nodeSize:0))}else{let a=zi(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function uh(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(Ae.near(n.doc.resolve(o),t))}const fh=1,Xo=2,dh=4;let Ov=class extends jg{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.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xo,this}ensureMarks(e){return je.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&Xo)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Xo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||je.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(Ae.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=dh,this}get scrolledIntoView(){return(this.updated&dh)>0}};function hh(n,e){return!e||!n?n:n.bind(e)}class Us{constructor(e,t,r){this.name=e,this.init=hh(t.init,r),this.apply=hh(t.apply,r)}}const $v=[new Us("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Us("selection",{init(n,e){return n.selection||Ae.atStart(e.doc)},apply(n){return n.selection}}),new Us("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Us("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Mc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=$v.slice(),t&&t.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 Us(r.key,r.spec.state,r))})}}class ji{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,t=-1){for(let r=0;rr.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 i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Mc(e.schema,e.plugins),s=new ji(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=ui.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=Ae.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Wg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Wg(i,e,{})),t[r]=i}return t}class ut{constructor(e){this.spec=e,this.props={},e.props&&Wg(e.props,this,this.props),this.key=e.key?e.key.key:qg("plugin")}getState(e){return e[this.key]}}const Oc=Object.create(null);function qg(n){return n in Oc?n+"$"+ ++Oc[n]:(Oc[n]=0,n+"$")}class Pt{constructor(e="key"){this.key=qg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Tt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},uo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let _u=null;const or=function(n,e,t){let r=_u||(_u=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Nv=function(){_u=null},yi=function(n,e,t,r){return t&&(ph(n,e,t,r,-1)||ph(n,e,t,r,1))},Dv=/^(img|br|input|textarea|hr)$/i;function ph(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:jn(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Bo(n)||Dv.test(n.nodeName)||n.contentEditable=="false")return!1;e=Tt(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?jn(n):0}else return!1}}function jn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function xv(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=jn(n)}else if(n.parentNode&&!Bo(n))e=Tt(n),n=n.parentNode;else return null}}function Iv(n,e){for(;;){if(n.nodeType==3&&e2),un=ss||(Gn?/Mac/.test(Gn.platform):!1),Fv=Gn?/Win/.test(Gn.platform):!1,wn=/Android \d/.test(jr),Fo=!!mh&&"webkitFontSmoothing"in mh.documentElement.style,zv=Fo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Vv(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function nr(n,e){return typeof n=="number"?n:n[e]}function Hv(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function gh(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=uo(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?Vv(s):Hv(l),u=0,f=0;if(e.topc.bottom-nr(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+nr(i,"top")-c.top:e.bottom-c.bottom+nr(i,"bottom")),e.leftc.right-nr(r,"right")&&(u=e.right-c.right+nr(i,"right")),u||f)if(a)s.defaultView.scrollBy(u,f);else{let d=l.scrollLeft,h=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let p=l.scrollLeft-d,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Uv(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Jg(n.dom)}}function Jg(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=uo(r));return e}function jv({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Gg(t,r==0?0:r-e)}function Gg(n,e){for(let t=0;t=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?qv(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Yg(t,i)}function qv(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function If(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Kv(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function Gv(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!o||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!o&&(o=!0,a.left>r.left||a.top>r.top?i=l.posBefore:(a.right-1?i:n.docView.posFromDOM(e,t,-1)}function Xg(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;Fo&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Gv(n,r,i,e))}l==null&&(l=Jv(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function bh(n){return n.top=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,xs(kr(or(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==jn(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return $c(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==jn(r))){let a=r.childNodes[i-1],c=a.nodeType==3?or(a,jn(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return xs(kr(c,1),!1)}if(s==null&&i=0)}function xs(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function $c(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Zg(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Qv(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Zg(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Qg(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=or(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Zv=/[\u0590-\u08ac]/;function ew(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return!Zv.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Zg(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,f),a&&(a!=u||c!=f)&&l.extend&&l.extend(a,c)}catch{}return d!=null&&(l.caretBidiLevel=d),g})}let yh=null,vh=null,wh=!1;function tw(n,e,t){return yh==e&&vh==t?wh:(yh=e,vh=t,wh=t=="up"||t=="down"?Qv(n,e,t):ew(n,e,t))}const hn=0,kh=1,ri=2,Yn=3;class zo{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=hn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tTt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof tb){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof eb&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Tt(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let f=l;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=Tt(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;uh&&ot){let h=l;l=a,a=h}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?ri:kh,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Yn:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ri:Yn}r=o}this.dirty=ri}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ri:kh;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==hn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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 side(){return this.widget.type.side}}class nw extends zo{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class vi extends zo{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=Wn.renderSpec(document,t.type.spec.toDOM(t,r))),new vi(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Yn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=hn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=$u(s,0,e,r));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,f=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Wn.renderSpec(document,t.type.spec.toDOM(t)));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let d=u;return u=ib(u,r,t),c?a=new rw(e,t,r,i,u,f||null,d,c,s,o+1):t.isText?new Ga(e,t,r,i,u,d,s):new Pr(e,t,r,i,u,f||null,d,s,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 t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>V.empty)}return e}matchesNode(e,t,r){return this.dirty==hn&&e.eq(this.node)&&Ou(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new sw(this,o&&o.node,e);aw(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,f,d)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,f,d)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,u,f,h,e)||a.updateNextNode(c,u,f,e,d,i)||a.addNode(c,u,f,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ri)&&(o&&this.protectLocalComposition(e,o),nb(this.contentDOM,this.children,e),ss&&cw(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof be)||rt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=uw(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new nw(this,s,t,i);e.input.compositionNodes.push(o),this.children=$u(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Yn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=hn}updateOuterDeco(e){if(Ou(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=rb(this.dom,this.nodeDOM,Mu(this.outerDeco,this.node,t),Mu(e,this.node,t)),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.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Sh(n,e,t,r,i){ib(r,e,n);let s=new Pr(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Ga extends Pr{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Yn||this.dirty!=hn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=hn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=hn,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new Ga(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Yn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class tb extends zo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==hn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class rw extends Pr{constructor(e,t,r,i,s,o,l,a,c,u){super(e,t,r,i,s,o,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==Yn)return!1;if(this.spec.update){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}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 nb(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=vi.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof vi)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function lw(n,e){return n.type.side-e.type.side}function aw(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let g=p;o!g.inline):l.slice();r(d,m,e.forChild(s,d),h),s=p}}function cw(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function uw(n,e,t,r){for(let i=0,s=0;i=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function $u(n,e,t,r,i){let s=[];for(let o=0,l=0;o=t||u<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,r)))}return s}function Rf(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Ja(t)){for(a=l;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&ue.isSelectable(u)&&i.parent&&!(u.isInline&&Rv(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new ue(o==f?l:r.resolve(f))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;a=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!sb(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function dw(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,Tt(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Kt&&Rr<=11&&(r.disabled=!0,r.disabled=!1)}function ob(n,e){if(e instanceof ue){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Eh(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Eh(n)}function Eh(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Pf(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||be.between(e,t,r)}function Mh(n){return n.editable&&!n.hasFocus()?!1:lb(n)}function lb(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function hw(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return yi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Nu(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ae.findFrom(s,e)}function _r(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Oh(n,e,t){let r=n.state.selection;if(r instanceof be)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return _r(n,new be(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Nu(n.state,e);return i&&i instanceof ue?_r(n,i):!1}else if(!(un&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?ue.isSelectable(s)?_r(n,new ue(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Fo?_r(n,new be(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ue&&r.node.isInline)return _r(n,new be(e>0?r.$to:r.$from));{let i=Nu(n.state,e);return i?_r(n,i):!1}}}function Fl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gs(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Li(n,e){return e<0?pw(n):mw(n)}function pw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(On&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Gs(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(ab(t))break;{let l=t.previousSibling;for(;l&&Gs(l,-1);)i=t.parentNode,s=Tt(l),l=l.previousSibling;if(l)t=l,r=Fl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Du(n,t,r):i&&Du(n,i,s)}function mw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Fl(t),s,o;for(;;)if(r{n.state==i&&ar(n)},50)}function $h(n,e){let t=n.state.doc.resolve(e);if(!(Lt||Fv)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Nh(n,e,t){let r=n.state.selection;if(r instanceof be&&!r.empty||t.indexOf("s")>-1||un&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Nu(n.state,e);if(o&&o instanceof ue)return _r(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Cn?Ae.near(o,e):Ae.findFrom(o,e);return l?_r(n,l):!1}return!1}function Dh(n,e){if(!(n.state.selection instanceof be))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function xh(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function yw(n){if(!Ft||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;xh(n,r,"true"),setTimeout(()=>xh(n,r,"false"),20)}return!1}function vw(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function ww(n,e){let t=e.keyCode,r=vw(e);if(t==8||un&&t==72&&r=="c")return Dh(n,-1)||Li(n,-1);if(t==46&&!e.shiftKey||un&&t==68&&r=="c")return Dh(n,1)||Li(n,1);if(t==13||t==27)return!0;if(t==37||un&&t==66&&r=="c"){let i=t==37?$h(n,n.state.selection.from)=="ltr"?-1:1:-1;return Oh(n,i,r)||Li(n,i)}else if(t==39||un&&t==70&&r=="c"){let i=t==39?$h(n,n.state.selection.from)=="ltr"?1:-1:1;return Oh(n,i,r)||Li(n,i)}else{if(t==38||un&&t==80&&r=="c")return Nh(n,-1,r)||Li(n,-1);if(t==40||un&&t==78&&r=="c")return yw(n)||Nh(n,1,r)||Li(n,1);if(r==(un?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function cb(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||Wn.fromSchema(n.state.schema),l=mb(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=pb[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let d=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` `);return{dom:a,text:d}}function ub(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",d=>{e=d(e,s||r,n)}),s)return e?new G(V.from(n.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0):G.empty;let f=n.someProp("clipboardTextParser",d=>d(e,i,r,n));if(f)l=f;else{let d=i.marks(),{schema:h}=n.state,p=jn.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=Cw(t),Fo&&_w(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 f=+u[3];f>0;f--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||$f.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!kw.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Aw(Ih(l,+u[1],+u[2]),u[4]);else if(l=G.maxOpen(Sw(l.content,i),!0),l.openStart||l.openEnd){let f=0,d=0;for(let h=l.content.firstChild;f{l=f(l,n)}),l}const kw=/^(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 Sw(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&db(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=hb(o[o.length-1],s.length));let u=fb(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return V.from(o)}return n}function fb(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,V.from(n));return n}function db(n,e,t,r,i){if(i1&&(s=0),i=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(V.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function Ih(n,e,t){return e]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=mb().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&pb[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=n,i)for(let s=0;s=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=V.from(a.create(r[l+1],i)),s++,o++}return new G(i,s,o)}const zt={},Vt={},Tw={touchstart:!0,touchmove:!0};class Ew{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=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 Mw(n){for(let e in zt){let t=zt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{$w(n,r)&&!Lf(n,r)&&(n.editable||!(r.type in Vt))&&t(n,r)},Tw[e]?{passive:!0}:void 0)}Ft&&n.dom.addEventListener("input",()=>null),Iu(n)}function Dr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Ow(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Iu(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Lf(n,r))})}function Lf(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function $w(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Nw(n,e){!Lf(n,e)&&zt[e.type]&&(n.editable||!(e.type in Vt))&&zt[e.type](n,e)}Vt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!bb(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(vn&&Lt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),ss&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Zr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ww(n,t)?t.preventDefault():Dr(n,"key")};Vt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Vt.keypress=(n,e)=>{let t=e;if(bb(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||cn&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof be)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Ya(n){return{left:n.clientX,top:n.clientY}}function Dw(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Bf(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Gi(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function xw(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ue.isSelectable(r)?(Gi(n,new ue(t),"pointer"),!0):!1}function Iw(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof ue&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(ue.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Gi(n,ue.create(n.state.doc,i),"pointer"),!0):!1}function Rw(n,e,t,r,i){return Bf(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Iw(n,t):xw(n,t))}function Pw(n,e,t,r){return Bf(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Lw(n,e,t,r){return Bf(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Bw(n,t,r)}function Bw(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Gi(n,be.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)Gi(n,be.create(r,l+1,l+1+o.content.size),"pointer");else if(ue.isSelectable(o))Gi(n,ue.create(r,l),"pointer");else continue;return!0}}function Ff(n){return zl(n)}const gb=cn?"metaKey":"ctrlKey";zt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Ff(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Dw(t,n.input.lastClick)&&!t[gb]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(Ya(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Fw(n,o,t,!!r)):(s=="doubleClick"?Pw:Lw)(n,o.pos,o.inside,t)?t.preventDefault():Dr(n,"pointer"))};class Fw{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[gb],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof ue&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Mn&&!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)),Dr(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(()=>lr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ya(e))),this.updateAllowDefault(e),this.allowDefault||!t?Dr(this.view,"pointer"):Rw(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ft&&this.mightDrag&&!this.mightDrag.node.isAtom||Lt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Gi(this.view,Ae.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Dr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Dr(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)}}zt.touchstart=n=>{n.input.lastTouch=Date.now(),Ff(n),Dr(n,"pointer")};zt.touchmove=n=>{n.input.lastTouch=Date.now(),Dr(n,"pointer")};zt.contextmenu=n=>Ff(n);function bb(n,e){return n.composing?!0:Ft&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const zw=vn?5e3:-1;Vt.compositionstart=Vt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),zl(n,!0),n.markCursor=null;else if(zl(n),Mn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){n.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}yb(n,zw)};Vt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,yb(n,20))};function yb(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>zl(n),e))}function vb(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Hw());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Vw(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=xv(e.focusNode,e.focusOffset),r=Iv(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t}function Hw(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function zl(n,e=!1){if(!(vn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),vb(n),e||n.docView&&n.docView.dirty){let t=Rf(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function Uw(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const fo=Kt&&Rr<15||ss&&zv<604;zt.copy=Vt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=fo?null:t.clipboardData,o=r.content(),{dom:l,text:a}=cb(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Uw(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jw(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Ww(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ho(n,r.value,null,i,e):ho(n,r.textContent,r.innerHTML,i,e)},50)}function ho(n,e,t,r,i){let s=ub(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||G.empty)))return!0;if(!s)return!1;let o=jw(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function wb(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Vt.paste=(n,e)=>{let t=e;if(n.composing&&!vn)return;let r=fo?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ho(n,wb(r),r.getData("text/html"),i,t)?t.preventDefault():Ww(n,t)};class kb{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Sb=cn?"altKey":"ctrlKey";zt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Ya(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ue?i.to-1:i.to))){if(r&&r.mightDrag)o=ue.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=ue.create(n.state.doc,u.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c}=cb(n,l);t.dataTransfer.clearData(),t.dataTransfer.setData(fo?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",fo||t.dataTransfer.setData("text/plain",c),n.dragging=new kb(l,!t[Sb],o)};zt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Vt.dragover=Vt.dragenter=(n,e)=>e.preventDefault();Vt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Ya(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=ub(n,wb(t.dataTransfer),fo?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&!t[Sb]);if(n.someProp("handleDrop",p=>p(n,t,o||G.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?Fg(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=c.doc;if(f?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(d))return;let h=c.doc.resolve(u);if(f&&ue.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new ue(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,C)=>p=C),c.setSelection(Pf(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};zt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&lr(n)},20))};zt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};zt.beforeinput=(n,e)=>{if(Lt&&vn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Zr(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Vt)zt[n]=Vt[n];function po(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Vl{constructor(e,t){this.toDOM=e,this.spec=t||fi,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new tn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Vl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&po(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Lr{constructor(e,t){this.attrs=e,this.spec=t||fi}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new tn(s,o,this)}valid(e,t){return t.from=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;oe){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==It||e.maps.length==0?this:this.mapInner(e,t,0,0,r||fi)}mapInner(e,t,r,i,s){let o;for(let l=0;l{let c=a+r,u;if(u=_b(t,l,c)){for(i||(i=this.children.slice());sl&&f.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;ls&&a.type instanceof Lr){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;ci.map(e,t,fi));return Er.from(r)}forChild(e,t){if(t.isLeaf)return st.empty;let r=[];for(let i=0;it instanceof st)?e:e.reduce((t,r)=>t.concat(r instanceof st?r:r.members),[]))}}}function qw(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,u=s;c{let g=m-p-(h-d);for(let b=0;bC+u-f)continue;let E=l[b]+u-f;h>=E?l[b+1]=d<=E?-2:-1:d>=u&&g&&(l[b]+=g,l[b+1]+=g)}f+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let d=t.map(n[c+1]+s,-1),h=d-i,{index:p,offset:m}=r.content.findIndex(f),g=r.maybeChild(p);if(g&&m==f&&m+g.nodeSize==h){let b=l[c+2].mapInner(t,g,u+1,n[c]+s+1,o);b!=It?(l[c]=f,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Kw(l,n,e,t,i,s,o),u=Hl(c,r,0,o);e=u.local;for(let f=0;ft&&o.to{let c=_b(n,l,a+t);if(c){s=!0;let u=Hl(c,l,t+a+1,r);u!=It&&i.push(a,a+l.nodeSize,u)}});let o=Cb(s?Ab(n):n,-t).sort(di);for(let l=0;l0;)e++;n.splice(e,0,t)}function Dc(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=It&&e.push(r)}),n.cursorWrapper&&e.push(st.create(n.state.doc,[n.cursorWrapper.deco])),Er.from(e)}const Jw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gw=Kt&&Rr<=11;class Yw{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 Xw{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Yw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Gw&&(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,Jw)),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 t=0;tthis.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(Mh(this.view)){if(this.suppressingSelectionUpdates)return lr(this.view);if(Kt&&Rr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&yi(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 t=new Set,r;for(let s=e.focusNode;s;s=uo(s))t.add(s);for(let s=e.anchorNode;s;s=uo(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Mh(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u1){let u=a.filter(f=>f.nodeName=="BR");if(u.length==2){let f=u[0],d=u[1];f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Qw(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||lr(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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;ui;g--){let b=r.childNodes[g-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){s=g;break}if(!C||C.size)break}let f=n.state.doc,d=n.someProp("domParser")||$f.fromSchema(n.state.schema),h=f.resolve(o),p=null,m=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:tk,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:l}}function tk(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ft&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Ft&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const nk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function rk(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,X=Rf(n,M);if(X&&!n.state.selection.eq(X)){if(Lt&&vn&&n.input.lastKeyCode===13&&Date.now()-100y(n,Zr(13,"Enter"))))return;let $=n.state.tr.setSelection(X);M=="pointer"?$.setMeta("pointer",!0):M=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),n.dispatch($)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=ek(n,e,t),u=n.state.doc,f=u.slice(c.from,c.to),d,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||vn)&&i.some(M=>M.nodeType==1&&!nk.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,Zr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof be&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let M=Fh(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let X=n.state.tr.setSelection(M);s&&X.setMeta("composition",s),n.dispatch(X)}}return}n.input.domChangeCount++,n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Kt&&Rr<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),C=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,E;if((ss&&n.input.lastIOSEnter>Date.now()-225&&(!C||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!C&&m.posM(n,Zr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&sk(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",M=>M(n,Zr(8,"Backspace")))){vn&&Lt&&n.domObserver.suppressSelectionUpdates();return}Lt&&vn&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),vn&&!C&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Zr(13,"Enter"))})},20));let v=p.start,H=p.endA,_,B,F;if(C){if(m.pos==g.pos)Kt&&Rr<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>lr(n),20)),_=n.state.tr.delete(v,H),B=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(F=ik(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))_=n.state.tr,F.type=="add"?_.addMark(v,H,F.mark):_.removeMark(v,H,F.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",X=>X(n,v,H,M)))return;_=n.state.tr.insertText(M,v,H)}}if(_||(_=n.state.tr.replace(v,H,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let M=Fh(n,_.doc,c.sel);M&&!(Lt&&vn&&n.composing&&M.empty&&(p.start!=p.endB||n.input.lastAndroidDeletee.content.size?null:Pf(n,e.resolve(t.anchor),e.resolve(t.head))}function ik(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let u=0;uu.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;ut||xc(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function ok(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o=o?s-r:0;s-=a,s&&s=l?s-r:0;s-=a,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}class lk{constructor(e,t){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 Ew,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Wh),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=Uh(this),Hh(this),this.nodeViews=jh(this),this.docView=Sh(this.state.doc,Vh(this),Dc(this),this.dom,this),this.domObserver=new Xw(this,(r,i,s,o)=>rk(this,r,i,s,o)),this.domObserver.start(),Mw(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Iu(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(vb(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=jh(this);ck(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Iu(this),this.editable=Uh(this),Hh(this);let a=Dc(this),c=Vh(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(o=!0);let d=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Uv(this);if(o){this.domObserver.stop();let h=f&&(Kt||Lt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ak(i.selection,e.selection);if(f){let p=Lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Vw(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Sh(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&hw(this))?lr(this,h):(ob(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():d&&jv(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ue){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&gh(this,t.getBoundingClientRect(),e)}else gh(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 t=0;t0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new kb(e.slice,e.move,i<0?void 0:ue.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Yv(this,e)}coordsAtPos(e,t=1){return Qg(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return tw(this,t||this.state,e)}pasteHTML(e,t){return ho(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ho(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Ow(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Dc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Nv())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Nw(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Ft&&this.root.nodeType===11&&Pv(this.dom.ownerDocument)==this.dom?Zw(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Vh(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[tn.node(0,n.state.doc.content.size,e)]}function Hh(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:tn.widget(n.state.selection.head,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Uh(n){return!n.someProp("editable",e=>e(n.state)===!1)}function ak(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function jh(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function ck(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Wh(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Br={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:"'"},Ul={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},uk=typeof navigator<"u"&&/Mac/.test(navigator.platform),fk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Et=0;Et<10;Et++)Br[48+Et]=Br[96+Et]=String(Et);for(var Et=1;Et<=24;Et++)Br[Et+111]="F"+Et;for(var Et=65;Et<=90;Et++)Br[Et]=String.fromCharCode(Et+32),Ul[Et]=String.fromCharCode(Et);for(var Ic in Br)Ul.hasOwnProperty(Ic)||(Ul[Ic]=Br[Ic]);function dk(n){var e=uk&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||fk&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ul:Br)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const hk=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function pk(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l127)&&(s=Br[r.keyCode])&&s!=i){let l=e[Rc(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const bk=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Eb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const yk=(n,e,t)=>{let r=Eb(n,t);if(!r)return!1;let i=Hf(r);if(!i){let o=r.blockRange(),l=o&&ks(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&Nb(n,i,e))return!0;if(r.parent.content.size==0&&(ls(s,"end")||ue.isSelectable(s))){let o=qa(n.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size{let r=Eb(n,t);if(!r)return!1;let i=Hf(r);return i?Mb(n,i,e):!1},wk=(n,e,t)=>{let r=Ob(n,t);if(!r)return!1;let i=Uf(r);return i?Mb(n,i,e):!1};function Mb(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=qa(n.doc,s,a,G.empty);if(!c||c.from!=s||c instanceof vt&&c.slice.size>=a-s)return!1;if(t){let u=n.tr.step(c);u.setSelection(be.create(u.doc,s)),t(u.scrollIntoView())}return!0}function ls(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const kk=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Hf(r)}let o=s&&s.nodeBefore;return!o||!ue.isSelectable(o)?!1:(e&&e(n.tr.setSelection(ue.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Hf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ob(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=Ob(n,t);if(!r)return!1;let i=Uf(r);if(!i)return!1;let s=i.nodeAfter;if(Nb(n,i,e))return!0;if(r.parent.content.size==0&&(ls(s,"start")||ue.isSelectable(s))){let o=qa(n.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof ue,i;if(r){if(t.node.isTextblock||!Ur(n.doc,t.from))return!1;i=t.from}else if(i=Wa(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(ue.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Ak=(n,e)=>{let t=n.selection,r;if(t instanceof ue){if(t.node.isTextblock||!Ur(n.doc,t.to))return!1;r=t.to}else if(r=Wa(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Tk=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&ks(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},Ek=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` -`).scrollIntoView()),!0)};function $b(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=$b(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(Ae.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ok=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Sn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=$b(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ki(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&ks(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Nk=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(ue.create(n.doc,i))),!0)};function Dk(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ur(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Nb(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(Dk(n,e,t))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(t){let f=e.pos+i.nodeSize,d=V.empty;for(let m=s.length-1;m>=0;m--)d=V.from(s[m].create(null,d));d=V.from(r.copy(d));let h=n.tr.step(new wt(e.pos-1,f,e.pos,f,new G(d,1,0),s.length,!0)),p=f+2*s.length;Ur(h.doc,p)&&h.join(p),t(h.scrollIntoView())}return!0}let a=Ae.findFrom(e,1),c=a&&a.$from.blockRange(a.$to),u=c&&ks(c);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(c,u).scrollIntoView()),!0;if(l&&ls(i,"start",!0)&&ls(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let h=i,p=1;for(;!h.isTextblock;h=h.firstChild)p++;if(f.canReplace(f.childCount,f.childCount,h.content)){if(t){let m=V.empty;for(let b=d.length-1;b>=0;b--)m=V.from(d[b].copy(m));let g=n.tr.step(new wt(e.pos-d.length,e.pos+i.nodeSize,e.pos+p,e.pos+i.nodeSize-p,new G(m,d.length,0),0,!0));t(g.scrollIntoView())}return!0}}return!1}function Db(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(be.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const xk=Db(-1),Ik=Db(1);function Rk(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&Df(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function qh(n,e=null){return function(t,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o=2&&i.node(o.depth-1).type.compatibleContent(n)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=t.doc.resolve(o.start-2);a=new Rl(u,u,o.depth),o.endIndex=0;u--)s=V.from(t[u].type.create(t[u].attrs,s));n.step(new wt(e.start-(r?2:0),e.end,e.start,e.end,new G(s,0,0),t.length,!0));let o=0;for(let u=0;uo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Fk(e,t,n,s):zk(e,t,s):!0:!1}}function Fk(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sm;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?V.empty:V.from(i))))return!1;let f=s.pos,d=f+o.nodeSize;return r.step(new wt(f-(l?1:0),d+(a?1:0),f+1,d-1,new G((l?V.empty:V.from(i.copy(V.empty))).append(a?V.empty:V.from(i.copy(V.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Vk(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=V.from(c?n.create():null),f=new G(V.from(n.create(null,V.from(l.type.create(null,u)))),c?3:1,0),d=s.start,h=s.end;t(e.tr.step(new wt(d-(c?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}function Xa(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;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 s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}class Qa{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const f=a(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,c=e||s.tr,u=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(c,t),b=h(...m)(g);return l.push(b),f}])),run:u};return f}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:Xa({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}let Hk=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function ee(n,e,t){return n.config[e]===void 0&&n.parent?ee(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ee(n.parent,e,t):null}):n.config[e]}function Za(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function xb(n){const e=[],{nodeExtensions:t,markExtensions:r}=Za(n),i=[...t,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=ee(o,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([d,h])=>{e.push({type:f,name:d,attribute:{...s,...h}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=ee(o,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,f])=>{const d={...s,...f};typeof(d==null?void 0:d.default)=="function"&&(d.default=d.default()),d!=null&&d.isRequired&&(d==null?void 0:d.default)===void 0&&delete d.default,e.push({type:o.name,name:u,attribute:d})})}),e}function Ct(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function tt(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?s.split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function Ru(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>tt(t,r),{})}function Ib(n){return typeof n=="function"}function _e(n,e=void 0,...t){return Ib(n)?e?n.bind(e)(...t):n(...t):n}function Uk(n={}){return Object.keys(n).length===0&&n.constructor===Object}function jk(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Kh(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):jk(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function Jh(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Uk(t)?!1:t!=null))}function Wk(n,e){var t;const r=xb(n),{nodeExtensions:i,markExtensions:s}=Za(n),o=(t=i.find(c=>ee(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},d=n.reduce((b,C)=>{const E=ee(C,"extendNodeSchema",f);return{...b,...E?E(c):{}}},{}),h=Jh({...d,content:_e(ee(c,"content",f)),marks:_e(ee(c,"marks",f)),group:_e(ee(c,"group",f)),inline:_e(ee(c,"inline",f)),atom:_e(ee(c,"atom",f)),selectable:_e(ee(c,"selectable",f)),draggable:_e(ee(c,"draggable",f)),code:_e(ee(c,"code",f)),defining:_e(ee(c,"defining",f)),isolating:_e(ee(c,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var C;return[b.name,{default:(C=b==null?void 0:b.attribute)===null||C===void 0?void 0:C.default}]}))}),p=_e(ee(c,"parseHTML",f));p&&(h.parseDOM=p.map(b=>Kh(b,u)));const m=ee(c,"renderHTML",f);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Ru(b,u)}));const g=ee(c,"renderText",f);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},d=n.reduce((g,b)=>{const C=ee(b,"extendMarkSchema",f);return{...g,...C?C(c):{}}},{}),h=Jh({...d,inclusive:_e(ee(c,"inclusive",f)),excludes:_e(ee(c,"excludes",f)),group:_e(ee(c,"group",f)),spanning:_e(ee(c,"spanning",f)),code:_e(ee(c,"code",f)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g==null?void 0:g.attribute)===null||b===void 0?void 0:b.default}]}))}),p=_e(ee(c,"parseHTML",f));p&&(h.parseDOM=p.map(g=>Kh(g,u)));const m=ee(c,"renderHTML",f);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Ru(g,u)})),[c.name,h]}));return new Q1({topNode:o,nodes:l,marks:a})}function Pc(n,e){return e.nodes[n]||e.marks[n]||null}function Gh(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const qk=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;const u=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=u.slice(0,Math.max(0,r-s))}),t};function jf(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class ec{constructor(e){this.find=e.find,this.handler=e.handler}}const Kk=(n,e)=>{if(jf(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Lc(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let u=!1;const f=qk(c)+s;return o.forEach(d=>{if(u)return;const h=Kk(f,d.find);if(!h)return;const p=a.state.tr,m=Xa({state:a.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:b,chain:C,can:E}=new Qa({editor:t,state:m});d.handler({state:m,range:g,match:h,commands:b,chain:C,can:E})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),u=!0)}),u}function Jk(n){const{editor:e,rules:t}=n,r=new ut({state:{init(){return null},apply(i,s){const o=i.getMeta(r);return o||(i.selectionSet||i.docChanged?null:s)}},props:{handleTextInput(i,s,o,l){return Lc({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Lc({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Lc({editor:e,from:o.pos,to:o.pos,text:` -`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Gk(n){return typeof n=="number"}class Yk{constructor(e){this.find=e.find,this.handler=e.handler}}const Xk=(n,e,t)=>{if(jf(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Qk(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Qa({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),b=h.textBetween(m-p,g-p,void 0,"");Xk(b,s.find,o).forEach(E=>{if(E.index===void 0)return;const v=m+E.index+1,H=v+E[0].length,_={from:t.tr.mapping.map(v),to:t.tr.mapping.map(H)},B=s.handler({state:t,range:_,match:E,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});f.push(B)})}),f.every(h=>h!==null)}function Zk(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null;return t.map(c=>new ut({view(u){const f=d=>{var h;r=!((h=u.dom.parentElement)===null||h===void 0)&&h.contains(d.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(u,f)=>(s=r===u.dom.parentElement,l=f,!1),paste:(u,f)=>{var d;const h=(d=f.clipboardData)===null||d===void 0?void 0:d.getData("text/html");return o=f,i=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(u,f,d)=>{const h=u[0],p=h.getMeta("uiEvent")==="paste"&&!i,m=h.getMeta("uiEvent")==="drop"&&!s;if(!p&&!m)return;const g=f.doc.content.findDiffStart(d.doc.content),b=f.doc.content.findDiffEnd(d.doc.content);if(!Gk(g)||!b||g===b.b)return;const C=d.tr,E=Xa({state:d,transaction:C});if(!(!Qk({editor:e,state:E,from:Math.max(g-1,0),to:b.b-1,rule:c,pasteEvent:o,dropEvent:l})||!C.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,C}}))}function eS(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class Wi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Wi.resolve(e),this.schema=Wk(this.extensions,t),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const s={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:Pc(r.name,this.schema)};r.type==="mark"&&(!((i=_e(ee(r,"keepOnSplit",s)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const o=ee(r,"onBeforeCreate",s);o&&this.editor.on("beforeCreate",o);const l=ee(r,"onCreate",s);l&&this.editor.on("create",l);const a=ee(r,"onUpdate",s);a&&this.editor.on("update",a);const c=ee(r,"onSelectionUpdate",s);c&&this.editor.on("selectionUpdate",c);const u=ee(r,"onTransaction",s);u&&this.editor.on("transaction",u);const f=ee(r,"onFocus",s);f&&this.editor.on("focus",f);const d=ee(r,"onBlur",s);d&&this.editor.on("blur",d);const h=ee(r,"onDestroy",s);h&&this.editor.on("destroy",h)})}static resolve(e){const t=Wi.sort(Wi.flatten(e)),r=eS(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=ee(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=ee(r,"priority")||100,o=ee(i,"priority")||100;return s>o?-1:s{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Pc(t.name,this.schema)},i=ee(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Wi.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{const l={name:o.name,options:o.options,storage:o.storage,editor:e,type:Pc(o.name,this.schema)},a=[],c=ee(o,"addKeyboardShortcuts",l);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>On.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}const f=gk(u);a.push(f);const d=ee(o,"addInputRules",l);Gh(o,e.options.enableInputRules)&&d&&r.push(...d());const h=ee(o,"addPasteRules",l);Gh(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=ee(o,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[Jk({editor:e,rules:r}),...Zk({editor:e,rules:i}),...s]}get attributes(){return xb(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Za(this.extensions);return Object.fromEntries(t.filter(r=>!!ee(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ct(r.name,this.schema)},o=ee(r,"addNodeView",s);if(!o)return[];const l=(a,c,u,f)=>{const d=Ru(a,i);return o()({editor:e,node:a,getPos:u,decorations:f,HTMLAttributes:d,extension:r})};return[r.name,l]}))}}function tS(n){return Object.prototype.toString.call(n).slice(8,-1)}function Bc(n){return tS(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function tc(n,e){const t={...n};return Bc(n)&&Bc(e)&&Object.keys(e).forEach(r=>{Bc(e[r])?r in n?t[r]=tc(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class Ot{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=_e(ee(this,"addOptions",{name:this.name}))),this.storage=_e(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ot(e)}configure(e={}){const t=this.extend();return t.options=tc(this.options,e),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Ot({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=_e(ee(t,"addOptions",{name:t.name})),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}}function Rb(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=` +`))),0,0):G.empty;let f=n.someProp("clipboardTextParser",d=>d(e,i,r,n));if(f)l=f;else{let d=i.marks(),{schema:h}=n.state,p=Wn.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=Cw(t),Fo&&_w(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 f=+u[3];f>0;f--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||$f.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!kw.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Aw(Ih(l,+u[1],+u[2]),u[4]);else if(l=G.maxOpen(Sw(l.content,i),!0),l.openStart||l.openEnd){let f=0,d=0;for(let h=l.content.firstChild;f{l=f(l,n)}),l}const kw=/^(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 Sw(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&db(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=hb(o[o.length-1],s.length));let u=fb(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return V.from(o)}return n}function fb(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,V.from(n));return n}function db(n,e,t,r,i){if(i1&&(s=0),i=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(V.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function Ih(n,e,t){return e]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=mb().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&pb[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=n,i)for(let s=0;s=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=V.from(a.create(r[l+1],i)),s++,o++}return new G(i,s,o)}const zt={},Vt={},Tw={touchstart:!0,touchmove:!0};class Ew{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=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 Mw(n){for(let e in zt){let t=zt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{$w(n,r)&&!Lf(n,r)&&(n.editable||!(r.type in Vt))&&t(n,r)},Tw[e]?{passive:!0}:void 0)}Ft&&n.dom.addEventListener("input",()=>null),Iu(n)}function Dr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Ow(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Iu(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Lf(n,r))})}function Lf(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function $w(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Nw(n,e){!Lf(n,e)&&zt[e.type]&&(n.editable||!(e.type in Vt))&&zt[e.type](n,e)}Vt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!bb(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(wn&&Lt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),ss&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Zr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ww(n,t)?t.preventDefault():Dr(n,"key")};Vt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Vt.keypress=(n,e)=>{let t=e;if(bb(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||un&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof be)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Ya(n){return{left:n.clientX,top:n.clientY}}function Dw(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Bf(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Gi(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function xw(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ue.isSelectable(r)?(Gi(n,new ue(t),"pointer"),!0):!1}function Iw(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof ue&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(ue.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Gi(n,ue.create(n.state.doc,i),"pointer"),!0):!1}function Rw(n,e,t,r,i){return Bf(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Iw(n,t):xw(n,t))}function Pw(n,e,t,r){return Bf(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Lw(n,e,t,r){return Bf(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Bw(n,t,r)}function Bw(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Gi(n,be.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)Gi(n,be.create(r,l+1,l+1+o.content.size),"pointer");else if(ue.isSelectable(o))Gi(n,ue.create(r,l),"pointer");else continue;return!0}}function Ff(n){return zl(n)}const gb=un?"metaKey":"ctrlKey";zt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Ff(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Dw(t,n.input.lastClick)&&!t[gb]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(Ya(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Fw(n,o,t,!!r)):(s=="doubleClick"?Pw:Lw)(n,o.pos,o.inside,t)?t.preventDefault():Dr(n,"pointer"))};class Fw{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[gb],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof ue&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&On&&!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)),Dr(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(()=>ar(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ya(e))),this.updateAllowDefault(e),this.allowDefault||!t?Dr(this.view,"pointer"):Rw(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ft&&this.mightDrag&&!this.mightDrag.node.isAtom||Lt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Gi(this.view,Ae.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Dr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Dr(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)}}zt.touchstart=n=>{n.input.lastTouch=Date.now(),Ff(n),Dr(n,"pointer")};zt.touchmove=n=>{n.input.lastTouch=Date.now(),Dr(n,"pointer")};zt.contextmenu=n=>Ff(n);function bb(n,e){return n.composing?!0:Ft&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const zw=wn?5e3:-1;Vt.compositionstart=Vt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),zl(n,!0),n.markCursor=null;else if(zl(n),On&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){n.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}yb(n,zw)};Vt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,yb(n,20))};function yb(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>zl(n),e))}function vb(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Hw());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Vw(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=xv(e.focusNode,e.focusOffset),r=Iv(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t}function Hw(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function zl(n,e=!1){if(!(wn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),vb(n),e||n.docView&&n.docView.dirty){let t=Rf(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function Uw(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const fo=Kt&&Rr<15||ss&&zv<604;zt.copy=Vt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=fo?null:t.clipboardData,o=r.content(),{dom:l,text:a}=cb(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Uw(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jw(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Ww(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ho(n,r.value,null,i,e):ho(n,r.textContent,r.innerHTML,i,e)},50)}function ho(n,e,t,r,i){let s=ub(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||G.empty)))return!0;if(!s)return!1;let o=jw(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function wb(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Vt.paste=(n,e)=>{let t=e;if(n.composing&&!wn)return;let r=fo?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ho(n,wb(r),r.getData("text/html"),i,t)?t.preventDefault():Ww(n,t)};class kb{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Sb=un?"altKey":"ctrlKey";zt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Ya(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ue?i.to-1:i.to))){if(r&&r.mightDrag)o=ue.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=ue.create(n.state.doc,u.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c}=cb(n,l);t.dataTransfer.clearData(),t.dataTransfer.setData(fo?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",fo||t.dataTransfer.setData("text/plain",c),n.dragging=new kb(l,!t[Sb],o)};zt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Vt.dragover=Vt.dragenter=(n,e)=>e.preventDefault();Vt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Ya(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=ub(n,wb(t.dataTransfer),fo?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&!t[Sb]);if(n.someProp("handleDrop",p=>p(n,t,o||G.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?Fg(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=c.doc;if(f?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(d))return;let h=c.doc.resolve(u);if(f&&ue.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new ue(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,C)=>p=C),c.setSelection(Pf(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};zt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&ar(n)},20))};zt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};zt.beforeinput=(n,e)=>{if(Lt&&wn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Zr(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Vt)zt[n]=Vt[n];function po(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Vl{constructor(e,t){this.toDOM=e,this.spec=t||fi,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new nn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Vl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&po(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Lr{constructor(e,t){this.attrs=e,this.spec=t||fi}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new nn(s,o,this)}valid(e,t){return t.from=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;oe){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==It||e.maps.length==0?this:this.mapInner(e,t,0,0,r||fi)}mapInner(e,t,r,i,s){let o;for(let l=0;l{let c=a+r,u;if(u=_b(t,l,c)){for(i||(i=this.children.slice());sl&&f.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;ls&&a.type instanceof Lr){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;ci.map(e,t,fi));return Er.from(r)}forChild(e,t){if(t.isLeaf)return ot.empty;let r=[];for(let i=0;it instanceof ot)?e:e.reduce((t,r)=>t.concat(r instanceof ot?r:r.members),[]))}}}function qw(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,u=s;c{let g=m-p-(h-d);for(let b=0;bC+u-f)continue;let E=l[b]+u-f;h>=E?l[b+1]=d<=E?-2:-1:d>=u&&g&&(l[b]+=g,l[b+1]+=g)}f+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let d=t.map(n[c+1]+s,-1),h=d-i,{index:p,offset:m}=r.content.findIndex(f),g=r.maybeChild(p);if(g&&m==f&&m+g.nodeSize==h){let b=l[c+2].mapInner(t,g,u+1,n[c]+s+1,o);b!=It?(l[c]=f,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Kw(l,n,e,t,i,s,o),u=Hl(c,r,0,o);e=u.local;for(let f=0;ft&&o.to{let c=_b(n,l,a+t);if(c){s=!0;let u=Hl(c,l,t+a+1,r);u!=It&&i.push(a,a+l.nodeSize,u)}});let o=Cb(s?Ab(n):n,-t).sort(di);for(let l=0;l0;)e++;n.splice(e,0,t)}function Dc(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=It&&e.push(r)}),n.cursorWrapper&&e.push(ot.create(n.state.doc,[n.cursorWrapper.deco])),Er.from(e)}const Jw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gw=Kt&&Rr<=11;class Yw{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 Xw{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Yw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Gw&&(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,Jw)),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 t=0;tthis.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(Mh(this.view)){if(this.suppressingSelectionUpdates)return ar(this.view);if(Kt&&Rr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&yi(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 t=new Set,r;for(let s=e.focusNode;s;s=uo(s))t.add(s);for(let s=e.anchorNode;s;s=uo(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Mh(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u1){let u=a.filter(f=>f.nodeName=="BR");if(u.length==2){let f=u[0],d=u[1];f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Qw(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ar(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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;ui;g--){let b=r.childNodes[g-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){s=g;break}if(!C||C.size)break}let f=n.state.doc,d=n.someProp("domParser")||$f.fromSchema(n.state.schema),h=f.resolve(o),p=null,m=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:tk,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:l}}function tk(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ft&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Ft&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const nk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function rk(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,X=Rf(n,M);if(X&&!n.state.selection.eq(X)){if(Lt&&wn&&n.input.lastKeyCode===13&&Date.now()-100y(n,Zr(13,"Enter"))))return;let $=n.state.tr.setSelection(X);M=="pointer"?$.setMeta("pointer",!0):M=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),n.dispatch($)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=ek(n,e,t),u=n.state.doc,f=u.slice(c.from,c.to),d,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||wn)&&i.some(M=>M.nodeType==1&&!nk.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,Zr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof be&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let M=Fh(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let X=n.state.tr.setSelection(M);s&&X.setMeta("composition",s),n.dispatch(X)}}return}n.input.domChangeCount++,n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Kt&&Rr<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),C=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,E;if((ss&&n.input.lastIOSEnter>Date.now()-225&&(!C||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!C&&m.posM(n,Zr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&sk(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",M=>M(n,Zr(8,"Backspace")))){wn&&Lt&&n.domObserver.suppressSelectionUpdates();return}Lt&&wn&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),wn&&!C&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Zr(13,"Enter"))})},20));let v=p.start,H=p.endA,_,B,F;if(C){if(m.pos==g.pos)Kt&&Rr<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>ar(n),20)),_=n.state.tr.delete(v,H),B=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(F=ik(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))_=n.state.tr,F.type=="add"?_.addMark(v,H,F.mark):_.removeMark(v,H,F.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",X=>X(n,v,H,M)))return;_=n.state.tr.insertText(M,v,H)}}if(_||(_=n.state.tr.replace(v,H,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let M=Fh(n,_.doc,c.sel);M&&!(Lt&&wn&&n.composing&&M.empty&&(p.start!=p.endB||n.input.lastAndroidDeletee.content.size?null:Pf(n,e.resolve(t.anchor),e.resolve(t.head))}function ik(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let u=0;uu.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;ut||xc(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function ok(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o=o?s-r:0;s-=a,s&&s=l?s-r:0;s-=a,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}class lk{constructor(e,t){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 Ew,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Wh),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=Uh(this),Hh(this),this.nodeViews=jh(this),this.docView=Sh(this.state.doc,Vh(this),Dc(this),this.dom,this),this.domObserver=new Xw(this,(r,i,s,o)=>rk(this,r,i,s,o)),this.domObserver.start(),Mw(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Iu(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(vb(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=jh(this);ck(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Iu(this),this.editable=Uh(this),Hh(this);let a=Dc(this),c=Vh(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(o=!0);let d=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Uv(this);if(o){this.domObserver.stop();let h=f&&(Kt||Lt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ak(i.selection,e.selection);if(f){let p=Lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Vw(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Sh(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&hw(this))?ar(this,h):(ob(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():d&&jv(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ue){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&gh(this,t.getBoundingClientRect(),e)}else gh(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 t=0;t0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new kb(e.slice,e.move,i<0?void 0:ue.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Yv(this,e)}coordsAtPos(e,t=1){return Qg(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return tw(this,t||this.state,e)}pasteHTML(e,t){return ho(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ho(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Ow(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Dc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Nv())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Nw(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Ft&&this.root.nodeType===11&&Pv(this.dom.ownerDocument)==this.dom?Zw(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Vh(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[nn.node(0,n.state.doc.content.size,e)]}function Hh(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:nn.widget(n.state.selection.head,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Uh(n){return!n.someProp("editable",e=>e(n.state)===!1)}function ak(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function jh(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function ck(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Wh(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Br={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:"'"},Ul={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},uk=typeof navigator<"u"&&/Mac/.test(navigator.platform),fk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Et=0;Et<10;Et++)Br[48+Et]=Br[96+Et]=String(Et);for(var Et=1;Et<=24;Et++)Br[Et+111]="F"+Et;for(var Et=65;Et<=90;Et++)Br[Et]=String.fromCharCode(Et+32),Ul[Et]=String.fromCharCode(Et);for(var Ic in Br)Ul.hasOwnProperty(Ic)||(Ul[Ic]=Br[Ic]);function dk(n){var e=uk&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||fk&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ul:Br)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const hk=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function pk(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l127)&&(s=Br[r.keyCode])&&s!=i){let l=e[Rc(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const bk=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Eb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const yk=(n,e,t)=>{let r=Eb(n,t);if(!r)return!1;let i=Hf(r);if(!i){let o=r.blockRange(),l=o&&ks(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&Nb(n,i,e))return!0;if(r.parent.content.size==0&&(ls(s,"end")||ue.isSelectable(s))){let o=qa(n.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size{let r=Eb(n,t);if(!r)return!1;let i=Hf(r);return i?Mb(n,i,e):!1},wk=(n,e,t)=>{let r=Ob(n,t);if(!r)return!1;let i=Uf(r);return i?Mb(n,i,e):!1};function Mb(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=qa(n.doc,s,a,G.empty);if(!c||c.from!=s||c instanceof vt&&c.slice.size>=a-s)return!1;if(t){let u=n.tr.step(c);u.setSelection(be.create(u.doc,s)),t(u.scrollIntoView())}return!0}function ls(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const kk=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Hf(r)}let o=s&&s.nodeBefore;return!o||!ue.isSelectable(o)?!1:(e&&e(n.tr.setSelection(ue.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Hf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ob(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=Ob(n,t);if(!r)return!1;let i=Uf(r);if(!i)return!1;let s=i.nodeAfter;if(Nb(n,i,e))return!0;if(r.parent.content.size==0&&(ls(s,"start")||ue.isSelectable(s))){let o=qa(n.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof ue,i;if(r){if(t.node.isTextblock||!Ur(n.doc,t.from))return!1;i=t.from}else if(i=Wa(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(ue.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Ak=(n,e)=>{let t=n.selection,r;if(t instanceof ue){if(t.node.isTextblock||!Ur(n.doc,t.to))return!1;r=t.to}else if(r=Wa(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Tk=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&ks(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},Ek=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` +`).scrollIntoView()),!0)};function $b(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=$b(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(Ae.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ok=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Cn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=$b(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ki(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&ks(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Nk=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(ue.create(n.doc,i))),!0)};function Dk(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ur(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Nb(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(Dk(n,e,t))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(t){let f=e.pos+i.nodeSize,d=V.empty;for(let m=s.length-1;m>=0;m--)d=V.from(s[m].create(null,d));d=V.from(r.copy(d));let h=n.tr.step(new wt(e.pos-1,f,e.pos,f,new G(d,1,0),s.length,!0)),p=f+2*s.length;Ur(h.doc,p)&&h.join(p),t(h.scrollIntoView())}return!0}let a=Ae.findFrom(e,1),c=a&&a.$from.blockRange(a.$to),u=c&&ks(c);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(c,u).scrollIntoView()),!0;if(l&&ls(i,"start",!0)&&ls(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let h=i,p=1;for(;!h.isTextblock;h=h.firstChild)p++;if(f.canReplace(f.childCount,f.childCount,h.content)){if(t){let m=V.empty;for(let b=d.length-1;b>=0;b--)m=V.from(d[b].copy(m));let g=n.tr.step(new wt(e.pos-d.length,e.pos+i.nodeSize,e.pos+p,e.pos+i.nodeSize-p,new G(m,d.length,0),0,!0));t(g.scrollIntoView())}return!0}}return!1}function Db(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(be.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const xk=Db(-1),Ik=Db(1);function Rk(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&Df(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function qh(n,e=null){return function(t,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o=2&&i.node(o.depth-1).type.compatibleContent(n)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=t.doc.resolve(o.start-2);a=new Rl(u,u,o.depth),o.endIndex=0;u--)s=V.from(t[u].type.create(t[u].attrs,s));n.step(new wt(e.start-(r?2:0),e.end,e.start,e.end,new G(s,0,0),t.length,!0));let o=0;for(let u=0;uo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Fk(e,t,n,s):zk(e,t,s):!0:!1}}function Fk(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sm;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?V.empty:V.from(i))))return!1;let f=s.pos,d=f+o.nodeSize;return r.step(new wt(f-(l?1:0),d+(a?1:0),f+1,d-1,new G((l?V.empty:V.from(i.copy(V.empty))).append(a?V.empty:V.from(i.copy(V.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Vk(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=V.from(c?n.create():null),f=new G(V.from(n.create(null,V.from(l.type.create(null,u)))),c?3:1,0),d=s.start,h=s.end;t(e.tr.step(new wt(d-(c?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}function Xa(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;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 s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}class Qa{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const f=a(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,c=e||s.tr,u=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(c,t),b=h(...m)(g);return l.push(b),f}])),run:u};return f}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:Xa({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}let Hk=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function ee(n,e,t){return n.config[e]===void 0&&n.parent?ee(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ee(n.parent,e,t):null}):n.config[e]}function Za(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function xb(n){const e=[],{nodeExtensions:t,markExtensions:r}=Za(n),i=[...t,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=ee(o,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([d,h])=>{e.push({type:f,name:d,attribute:{...s,...h}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=ee(o,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,f])=>{const d={...s,...f};typeof(d==null?void 0:d.default)=="function"&&(d.default=d.default()),d!=null&&d.isRequired&&(d==null?void 0:d.default)===void 0&&delete d.default,e.push({type:o.name,name:u,attribute:d})})}),e}function Ct(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function nt(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?s.split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function Ru(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>nt(t,r),{})}function Ib(n){return typeof n=="function"}function _e(n,e=void 0,...t){return Ib(n)?e?n.bind(e)(...t):n(...t):n}function Uk(n={}){return Object.keys(n).length===0&&n.constructor===Object}function jk(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Kh(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):jk(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function Jh(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Uk(t)?!1:t!=null))}function Wk(n,e){var t;const r=xb(n),{nodeExtensions:i,markExtensions:s}=Za(n),o=(t=i.find(c=>ee(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},d=n.reduce((b,C)=>{const E=ee(C,"extendNodeSchema",f);return{...b,...E?E(c):{}}},{}),h=Jh({...d,content:_e(ee(c,"content",f)),marks:_e(ee(c,"marks",f)),group:_e(ee(c,"group",f)),inline:_e(ee(c,"inline",f)),atom:_e(ee(c,"atom",f)),selectable:_e(ee(c,"selectable",f)),draggable:_e(ee(c,"draggable",f)),code:_e(ee(c,"code",f)),defining:_e(ee(c,"defining",f)),isolating:_e(ee(c,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var C;return[b.name,{default:(C=b==null?void 0:b.attribute)===null||C===void 0?void 0:C.default}]}))}),p=_e(ee(c,"parseHTML",f));p&&(h.parseDOM=p.map(b=>Kh(b,u)));const m=ee(c,"renderHTML",f);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Ru(b,u)}));const g=ee(c,"renderText",f);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},d=n.reduce((g,b)=>{const C=ee(b,"extendMarkSchema",f);return{...g,...C?C(c):{}}},{}),h=Jh({...d,inclusive:_e(ee(c,"inclusive",f)),excludes:_e(ee(c,"excludes",f)),group:_e(ee(c,"group",f)),spanning:_e(ee(c,"spanning",f)),code:_e(ee(c,"code",f)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g==null?void 0:g.attribute)===null||b===void 0?void 0:b.default}]}))}),p=_e(ee(c,"parseHTML",f));p&&(h.parseDOM=p.map(g=>Kh(g,u)));const m=ee(c,"renderHTML",f);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Ru(g,u)})),[c.name,h]}));return new Q1({topNode:o,nodes:l,marks:a})}function Pc(n,e){return e.nodes[n]||e.marks[n]||null}function Gh(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const qk=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;const u=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=u.slice(0,Math.max(0,r-s))}),t};function jf(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class ec{constructor(e){this.find=e.find,this.handler=e.handler}}const Kk=(n,e)=>{if(jf(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Lc(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let u=!1;const f=qk(c)+s;return o.forEach(d=>{if(u)return;const h=Kk(f,d.find);if(!h)return;const p=a.state.tr,m=Xa({state:a.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:b,chain:C,can:E}=new Qa({editor:t,state:m});d.handler({state:m,range:g,match:h,commands:b,chain:C,can:E})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),u=!0)}),u}function Jk(n){const{editor:e,rules:t}=n,r=new ut({state:{init(){return null},apply(i,s){const o=i.getMeta(r);return o||(i.selectionSet||i.docChanged?null:s)}},props:{handleTextInput(i,s,o,l){return Lc({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Lc({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Lc({editor:e,from:o.pos,to:o.pos,text:` +`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Gk(n){return typeof n=="number"}class Yk{constructor(e){this.find=e.find,this.handler=e.handler}}const Xk=(n,e,t)=>{if(jf(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Qk(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Qa({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),b=h.textBetween(m-p,g-p,void 0,"");Xk(b,s.find,o).forEach(E=>{if(E.index===void 0)return;const v=m+E.index+1,H=v+E[0].length,_={from:t.tr.mapping.map(v),to:t.tr.mapping.map(H)},B=s.handler({state:t,range:_,match:E,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});f.push(B)})}),f.every(h=>h!==null)}function Zk(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null;return t.map(c=>new ut({view(u){const f=d=>{var h;r=!((h=u.dom.parentElement)===null||h===void 0)&&h.contains(d.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(u,f)=>(s=r===u.dom.parentElement,l=f,!1),paste:(u,f)=>{var d;const h=(d=f.clipboardData)===null||d===void 0?void 0:d.getData("text/html");return o=f,i=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(u,f,d)=>{const h=u[0],p=h.getMeta("uiEvent")==="paste"&&!i,m=h.getMeta("uiEvent")==="drop"&&!s;if(!p&&!m)return;const g=f.doc.content.findDiffStart(d.doc.content),b=f.doc.content.findDiffEnd(d.doc.content);if(!Gk(g)||!b||g===b.b)return;const C=d.tr,E=Xa({state:d,transaction:C});if(!(!Qk({editor:e,state:E,from:Math.max(g-1,0),to:b.b-1,rule:c,pasteEvent:o,dropEvent:l})||!C.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,C}}))}function eS(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class Wi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Wi.resolve(e),this.schema=Wk(this.extensions,t),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const s={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:Pc(r.name,this.schema)};r.type==="mark"&&(!((i=_e(ee(r,"keepOnSplit",s)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const o=ee(r,"onBeforeCreate",s);o&&this.editor.on("beforeCreate",o);const l=ee(r,"onCreate",s);l&&this.editor.on("create",l);const a=ee(r,"onUpdate",s);a&&this.editor.on("update",a);const c=ee(r,"onSelectionUpdate",s);c&&this.editor.on("selectionUpdate",c);const u=ee(r,"onTransaction",s);u&&this.editor.on("transaction",u);const f=ee(r,"onFocus",s);f&&this.editor.on("focus",f);const d=ee(r,"onBlur",s);d&&this.editor.on("blur",d);const h=ee(r,"onDestroy",s);h&&this.editor.on("destroy",h)})}static resolve(e){const t=Wi.sort(Wi.flatten(e)),r=eS(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=ee(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=ee(r,"priority")||100,o=ee(i,"priority")||100;return s>o?-1:s{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Pc(t.name,this.schema)},i=ee(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Wi.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{const l={name:o.name,options:o.options,storage:o.storage,editor:e,type:Pc(o.name,this.schema)},a=[],c=ee(o,"addKeyboardShortcuts",l);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>$n.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}const f=gk(u);a.push(f);const d=ee(o,"addInputRules",l);Gh(o,e.options.enableInputRules)&&d&&r.push(...d());const h=ee(o,"addPasteRules",l);Gh(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=ee(o,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[Jk({editor:e,rules:r}),...Zk({editor:e,rules:i}),...s]}get attributes(){return xb(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Za(this.extensions);return Object.fromEntries(t.filter(r=>!!ee(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ct(r.name,this.schema)},o=ee(r,"addNodeView",s);if(!o)return[];const l=(a,c,u,f)=>{const d=Ru(a,i);return o()({editor:e,node:a,getPos:u,decorations:f,HTMLAttributes:d,extension:r})};return[r.name,l]}))}}function tS(n){return Object.prototype.toString.call(n).slice(8,-1)}function Bc(n){return tS(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function tc(n,e){const t={...n};return Bc(n)&&Bc(e)&&Object.keys(e).forEach(r=>{Bc(e[r])?r in n?t[r]=tc(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class Ot{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=_e(ee(this,"addOptions",{name:this.name}))),this.storage=_e(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ot(e)}configure(e={}){const t=this.extend();return t.options=tc(this.options,e),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Ot({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=_e(ee(t,"addOptions",{name:t.name})),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}}function Rb(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=` -`,textSerializers:o={}}=t||{};let l="",a=!0;return n.nodesBetween(r,i,(c,u,f,d)=>{var h;const p=o==null?void 0:o[c.type.name];p?(c.isBlock&&!a&&(l+=s,a=!0),f&&(l+=p({node:c,pos:u,parent:f,index:d,range:e}))):c.isText?(l+=(h=c==null?void 0:c.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,i-u),a=!1):c.isBlock&&!a&&(l+=s,a=!0)}),l}function Pb(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const nS=Ot.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new ut({key:new Pt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),a=Pb(t);return Rb(r,{from:o,to:l},{textSerializers:a})}}})]}}),rS=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),iS=(n=!1)=>({commands:e})=>e.setContent("",n),sS=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,f=c.resolve(u.map(a)),d=c.resolve(u.map(a+l.nodeSize)),h=f.blockRange(d);if(!h)return;const p=ks(h);if(l.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},oS=n=>e=>n(e),lS=()=>({state:n,dispatch:e})=>Ok(n,e),aS=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new be(r.doc.resolve(o-1))),!0},cS=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1},uS=n=>({tr:e,state:t,dispatch:r})=>{const i=Ct(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},fS=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},dS=()=>({state:n,dispatch:e})=>bk(n,e),hS=()=>({commands:n})=>n.keyboardShortcut("Enter"),pS=()=>({state:n,dispatch:e})=>Mk(n,e);function jl(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:jf(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Pu(n,e,t={}){return n.find(r=>r.type===e&&jl(r.attrs,t))}function mS(n,e,t={}){return!!Pu(n,e,t)}function Wf(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=Pu([...r.node.marks],e,t);if(!i)return;let s=r.index,o=n.start()+r.offset,l=s+1,a=o+r.node.nodeSize;for(Pu([...r.node.marks],e,t);s>0&&i.isInSet(n.parent.child(s-1).marks);)s-=1,o-=n.parent.child(s).nodeSize;for(;l({tr:t,state:r,dispatch:i})=>{const s=Wr(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){const f=Wf(a,s,e);if(f&&f.from<=c&&f.to>=u){const d=be.create(o,f.from,f.to);t.setSelection(d)}}return!0},bS=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{Kf()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!qf(t.state.selection))return o(),!0;const l=Lb(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},vS=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),wS=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Bb=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Bb(r)}return n};function Yh(n){const e=`${n}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Bb(t)}function Wl(n,e,t){if(t={slice:!0,parseOptions:{},...t},typeof n=="object"&&n!==null)try{return Array.isArray(n)&&n.length>0?V.fromArray(n.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Wl("",e,t)}if(typeof n=="string"){const r=$f.fromSchema(e);return t.slice?r.parseSlice(Yh(n),t.parseOptions).content:r.parse(Yh(n),t.parseOptions)}return Wl("",e,t)}function kS(n,e,t){const r=n.steps.length-1;if(r{o===0&&(o=u)}),n.setSelection(Ae.near(n.doc.resolve(o),t))}const SS=n=>n.toString().startsWith("<"),CS=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{if(i){t={parseOptions:{},updateSelection:!0,...t};const o=Wl(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(o.toString()==="<>")return!0;let{from:l,to:a}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},c=!0,u=!0;if((SS(o)?o:[o]).forEach(d=>{d.check(),c=c?d.isText&&d.marks.length===0:!1,u=u?d.isBlock:!1}),l===a&&u){const{parent:d}=r.doc.resolve(l);d.isTextblock&&!d.type.spec.code&&!d.childCount&&(l-=1,a+=1)}c?Array.isArray(e)?r.insertText(e.map(d=>d.text||"").join(""),l,a):typeof e=="object"&&e&&e.text?r.insertText(e.text,l,a):r.insertText(e,l,a):r.replaceWith(l,a,o),t.updateSelection&&kS(r,r.steps.length-1,-1)}return!0},_S=()=>({state:n,dispatch:e})=>_k(n,e),AS=()=>({state:n,dispatch:e})=>Ak(n,e),TS=()=>({state:n,dispatch:e})=>yk(n,e),ES=()=>({state:n,dispatch:e})=>Sk(n,e),MS=()=>({tr:n,state:e,dispatch:t})=>{try{const r=Wa(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},OS=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Wa(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},$S=()=>({state:n,dispatch:e})=>vk(n,e),NS=()=>({state:n,dispatch:e})=>wk(n,e);function Jf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function DS(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let l=0;l({editor:e,view:t,tr:r,dispatch:i})=>{const s=DS(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function mo(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?Ct(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;const h=Math.max(r,d),p=Math.min(i,d+f.nodeSize);l.push({node:f,from:h,to:p})});const a=i-r,c=l.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>jl(f.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((f,d)=>f+d.to-d.from,0)>=a}const IS=(n,e={})=>({state:t,dispatch:r})=>{const i=Ct(n,t.schema);return mo(t,i,e)?Tk(t,r):!1},RS=()=>({state:n,dispatch:e})=>$k(n,e),PS=n=>({state:e,dispatch:t})=>{const r=Ct(n,e.schema);return Bk(r)(e,t)},LS=()=>({state:n,dispatch:e})=>Ek(n,e);function nc(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Xh(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const BS=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=nc(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=Ct(n,r.schema)),l==="mark"&&(o=Wr(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{s&&s===c.type&&t.setNodeMarkup(u,void 0,Xh(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&t.addMark(u,u+c.nodeSize,o.create(Xh(f.attrs,e)))})})}),!0):!1},FS=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),zS=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),VS=()=>({state:n,dispatch:e})=>kk(n,e),HS=()=>({state:n,dispatch:e})=>Ck(n,e),US=()=>({state:n,dispatch:e})=>Nk(n,e),jS=()=>({state:n,dispatch:e})=>Ik(n,e),WS=()=>({state:n,dispatch:e})=>xk(n,e);function Fb(n,e,t={}){return Wl(n,e,{slice:!1,parseOptions:t})}const qS=(n,e=!1,t={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,l=Fb(n,i.schema,t);return s&&r.replaceWith(0,o.content.size,l).setMeta("preventUpdate",!e),!0};function rc(n,e){const t=Wr(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function KS(n,e){const t=new jg(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function JS(n){for(let e=0;e{t(i)&&r.push({node:i,pos:s})}),r}function YS(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Gf(n){return e=>YS(e.$from,n)}function XS(n,e){const t=jn.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function QS(n,e){const t={from:0,to:n.content.size};return Rb(n,t,e)}function ZS(n,e){const t=Ct(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function zb(n,e){const t=nc(typeof e=="string"?e:e.name,n.schema);return t==="node"?ZS(n,e):t==="mark"?rc(n,e):{}}function eC(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function tC(n){const e=eC(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function nC(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),f=e.invert().map(c,-1),d=e.invert().map(u);r.push({oldRange:{from:f,to:d},newRange:{from:c,to:u}})})}),tC(r)}function Yf(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n-1),o=Wf(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function ml(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Lu(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?Wr(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>jl(f.attrs,t,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:f,$to:d})=>{const h=f.pos,p=d.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,g),C=Math.min(p,g+m.nodeSize),E=C-b;o+=E,l.push(...m.marks.map(v=>({mark:v,from:b,to:C})))})}),o===0)return!1;const a=l.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>jl(f.mark.attrs,t,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),c=l.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,d)=>f+d.to-d.from,0);return(a>0?a+c:a)>=o}function rC(n,e,t={}){if(!e)return mo(n,null,t)||Lu(n,null,t);const r=nc(e,n.schema);return r==="node"?mo(n,e,t):r==="mark"?Lu(n,e,t):!1}function Qh(n,e){const{nodeExtensions:t}=Za(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=_e(ee(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function iC(n){var e;const t=(e=n.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=n.toJSON();return JSON.stringify(t)===JSON.stringify(r)}function sC(n){return n instanceof ue}function oC(n,e,t){const i=n.state.doc.content.size,s=or(e,0,i),o=or(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),d=Math.max(l.right,a.right),h=d-f,p=u-c,b={top:c,bottom:u,left:f,right:d,width:h,height:p,x:f,y:c};return{...b,toJSON:()=>b}}function lC(n,e,t){var r;const{selection:i}=e;let s=null;if(qf(i)&&(s=i.$cursor),s){const l=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,f,d)=>{if(c)return!1;if(u.isInline){const h=!d||d.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}const aC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=Wr(n,r.schema);if(i)if(o){const c=rc(r,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(d,h)=>{const p=Math.max(h,u),m=Math.min(h+d.nodeSize,f);d.marks.find(b=>b.type===a)?d.marks.forEach(b=>{a===b.type&&t.addMark(p,m,a.create({...b.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return lC(r,t,a)},cC=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),uC=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=Ct(n,t.schema);return s.isTextblock?i().command(({commands:o})=>qh(s,e)(t)?!0:o.clearNodes()).command(({state:o})=>qh(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},fC=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=or(n,0,r.content.size),s=ue.create(r,i);e.setSelection(s)}return!0},dC=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=be.atStart(r).from,l=be.atEnd(r).to,a=or(i,o,l),c=or(s,o,l),u=be.create(r,a,c);e.setSelection(u)}return!0},hC=n=>({state:e,dispatch:t})=>{const r=Ct(n,e.schema);return Vk(r)(e,t)};function Zh(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}const pC=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,u=ml(c,l.node().type.name,l.node().attrs);if(s instanceof ue&&s.node.isBlock)return!l.parentOffset||!Ki(o,l.pos)?!1:(r&&(n&&Zh(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const f=a.parentOffset===a.parent.content.size;s instanceof be&&e.deleteSelection();const d=l.depth===0?void 0:JS(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&d?[{type:d,attrs:u}]:void 0,p=Ki(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ki(e.doc,e.mapping.map(l.pos),1,d?[{type:d}]:void 0)&&(p=!0,h=d?[{type:d,attrs:u}]:void 0),p&&(e.split(e.mapping.map(l.pos),1,h),d&&!f&&!l.parentOffset&&l.parent.type!==d)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&e.setNodeMarkup(e.mapping.map(l.before()),d)}n&&Zh(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},mC=n=>({tr:e,state:t,dispatch:r,editor:i})=>{var s;const o=Ct(n,t.schema),{$from:l,$to:a}=t.selection,c=t.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==o)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!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let g=V.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let B=l.depth-b;B>=l.depth-3;B-=1)g=V.from(l.node(B).copy(g));const C=l.indexAfter(-1){if(_>-1)return!1;B.isTextblock&&B.content.size===0&&(_=F+1)}),_>-1&&e.setSelection(be.near(e.doc.resolve(_))),e.scrollIntoView()}return!0}const d=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,h=ml(f,u.type.name,u.attrs),p=ml(f,l.node().type.name,l.node().attrs);e.delete(l.pos,a.pos);const m=d?[{type:o,attrs:h},{type:d,attrs:p}]:[{type:o,attrs:h}];if(!Ki(e.doc,l.pos,2))return!1;if(r){const{selection:g,storedMarks:b}=t,{splittableMarks:C}=i.extensionManager,E=b||g.$to.parentOffset&&g.$from.marks();if(e.split(l.pos,2,m).scrollIntoView(),!E||!r)return!0;const v=E.filter(H=>C.includes(H.type.name));e.ensureMarks(v)}return!0},Fc=(n,e)=>{const t=Gf(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ur(n.doc,t.pos)&&n.join(t.pos),!0},zc=(n,e)=>{const t=Gf(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ur(n.doc,r)&&n.join(r),!0},gC=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,h=Ct(n,o.schema),p=Ct(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:C}=m,E=b.blockRange(C),v=g||m.$to.parentOffset&&m.$from.marks();if(!E)return!1;const H=Gf(_=>Qh(_.type.name,f))(m);if(E.depth>=1&&H&&E.depth-H.depth<=1){if(H.node.type===h)return c.liftListItem(p);if(Qh(H.node.type.name,f)&&h.validContent(H.node.content)&&l)return a().command(()=>(s.setNodeMarkup(H.pos,h),!0)).command(()=>Fc(s,h)).command(()=>zc(s,h)).run()}return!t||!v||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Fc(s,h)).command(()=>zc(s,h)).run():a().command(()=>{const _=u().wrapInList(h,r),B=v.filter(F=>d.includes(F.type.name));return s.ensureMarks(B),_?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Fc(s,h)).command(()=>zc(s,h)).run()},bC=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Wr(n,r.schema);return Lu(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},yC=(n,e,t={})=>({state:r,commands:i})=>{const s=Ct(n,r.schema),o=Ct(e,r.schema);return mo(r,s,t)?i.setNode(o):i.setNode(s,t)},vC=(n,e={})=>({state:t,commands:r})=>{const i=Ct(n,t.schema);return mo(t,i,e)?r.lift(i):r.wrapIn(i,e)},wC=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},kC=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},SC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=Wr(n,r.schema),{$from:c,empty:u,ranges:f}=l;if(!i)return!0;if(u&&o){let{from:d,to:h}=l;const p=(s=c.marks().find(g=>g.type===a))===null||s===void 0?void 0:s.attrs,m=Wf(c,a,p);m&&(d=m.from,h=m.to),t.removeMark(d,h,a)}else f.forEach(d=>{t.removeMark(d.$from.pos,d.$to.pos,a)});return t.removeStoredMark(a),!0},CC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=nc(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=Ct(n,r.schema)),l==="mark"&&(o=Wr(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;r.doc.nodesBetween(c,u,(f,d)=>{s&&s===f.type&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(h=>{if(o===h.type){const p=Math.max(d,c),m=Math.min(d+f.nodeSize,u);t.addMark(p,m,o.create({...h.attrs,...e}))}})})}),!0):!1},_C=(n,e={})=>({state:t,dispatch:r})=>{const i=Ct(n,t.schema);return Rk(i,e)(t,r)},AC=(n,e={})=>({state:t,dispatch:r})=>{const i=Ct(n,t.schema);return Pk(i,e)(t,r)};var TC=Object.freeze({__proto__:null,blur:rS,clearContent:iS,clearNodes:sS,command:oS,createParagraphNear:lS,cut:aS,deleteCurrentNode:cS,deleteNode:uS,deleteRange:fS,deleteSelection:dS,enter:hS,exitCode:pS,extendMarkRange:gS,first:bS,focus:yS,forEach:vS,insertContent:wS,insertContentAt:CS,joinUp:_S,joinDown:AS,joinBackward:TS,joinForward:ES,joinItemBackward:MS,joinItemForward:OS,joinTextblockBackward:$S,joinTextblockForward:NS,keyboardShortcut:xS,lift:IS,liftEmptyBlock:RS,liftListItem:PS,newlineInCode:LS,resetAttributes:BS,scrollIntoView:FS,selectAll:zS,selectNodeBackward:VS,selectNodeForward:HS,selectParentNode:US,selectTextblockEnd:jS,selectTextblockStart:WS,setContent:qS,setMark:aC,setMeta:cC,setNode:uC,setNodeSelection:fC,setTextSelection:dC,sinkListItem:hC,splitBlock:pC,splitListItem:mC,toggleList:gC,toggleMark:bC,toggleNode:yC,toggleWrap:vC,undoInputRule:wC,unsetAllMarks:kC,unsetMark:SC,updateAttributes:CC,wrapIn:_C,wrapInList:AC});const EC=Ot.create({name:"commands",addCommands(){return{...TC}}}),MC=Ot.create({name:"editable",addProseMirrorPlugins(){return[new ut({key:new Pt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),OC=Ot.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ut({key:new Pt("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),$C=Ot.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:f}=a,{pos:d,parent:h}=f,p=f.parent.isTextblock?l.doc.resolve(d-1):f,m=p.parent.type.spec.isolating,g=f.pos-f.parentOffset,b=m&&p.parent.childCount===1?g===f.pos:Ae.atStart(c).from===d;return!u||!b||!h.type.isTextblock||h.textContent.length?!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:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 Kf()||Jf()?s:i},addProseMirrorPlugins(){return[new ut({key:new Pt("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(p=>p.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:s,to:o}=e.selection,l=Ae.atStart(e.doc).from,a=Ae.atEnd(e.doc).to;if(i||!(s===l&&o===a)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const f=t.tr,d=Xa({state:t,transaction:f}),{commands:h}=new Qa({editor:this.editor,state:d});if(h.clearNodes(),!!f.steps.length)return f}})]}}),NC=Ot.create({name:"tabindex",addProseMirrorPlugins(){return[new ut({key:new Pt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var DC=Object.freeze({__proto__:null,ClipboardTextSerializer:nS,Commands:EC,Editable:MC,FocusEvents:OC,Keymap:$C,Tabindex:NC});class ei{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}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!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=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}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,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),t=this.resolvedPos.doc.resolve(e);return new ei(t,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 ei(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 ei(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=this.pos+r+(i?0:1),o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const l=new ei(o,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new ei(o,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let l=0;l{if(s.node.type.name===e){if(Object.keys(t).length>0){const o=s.node.attrs,l=Object.keys(t);for(let a=0;a{var h;const p=o==null?void 0:o[c.type.name];p?(c.isBlock&&!a&&(l+=s,a=!0),f&&(l+=p({node:c,pos:u,parent:f,index:d,range:e}))):c.isText?(l+=(h=c==null?void 0:c.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,i-u),a=!1):c.isBlock&&!a&&(l+=s,a=!0)}),l}function Pb(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const nS=Ot.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new ut({key:new Pt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),a=Pb(t);return Rb(r,{from:o,to:l},{textSerializers:a})}}})]}}),rS=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),iS=(n=!1)=>({commands:e})=>e.setContent("",n),sS=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,f=c.resolve(u.map(a)),d=c.resolve(u.map(a+l.nodeSize)),h=f.blockRange(d);if(!h)return;const p=ks(h);if(l.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},oS=n=>e=>n(e),lS=()=>({state:n,dispatch:e})=>Ok(n,e),aS=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new be(r.doc.resolve(o-1))),!0},cS=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1},uS=n=>({tr:e,state:t,dispatch:r})=>{const i=Ct(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},fS=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},dS=()=>({state:n,dispatch:e})=>bk(n,e),hS=()=>({commands:n})=>n.keyboardShortcut("Enter"),pS=()=>({state:n,dispatch:e})=>Mk(n,e);function jl(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:jf(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Pu(n,e,t={}){return n.find(r=>r.type===e&&jl(r.attrs,t))}function mS(n,e,t={}){return!!Pu(n,e,t)}function Wf(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=Pu([...r.node.marks],e,t);if(!i)return;let s=r.index,o=n.start()+r.offset,l=s+1,a=o+r.node.nodeSize;for(Pu([...r.node.marks],e,t);s>0&&i.isInSet(n.parent.child(s-1).marks);)s-=1,o-=n.parent.child(s).nodeSize;for(;l({tr:t,state:r,dispatch:i})=>{const s=Wr(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){const f=Wf(a,s,e);if(f&&f.from<=c&&f.to>=u){const d=be.create(o,f.from,f.to);t.setSelection(d)}}return!0},bS=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{Kf()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!qf(t.state.selection))return o(),!0;const l=Lb(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},vS=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),wS=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Bb=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Bb(r)}return n};function Yh(n){const e=`${n}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Bb(t)}function Wl(n,e,t){if(t={slice:!0,parseOptions:{},...t},typeof n=="object"&&n!==null)try{return Array.isArray(n)&&n.length>0?V.fromArray(n.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Wl("",e,t)}if(typeof n=="string"){const r=$f.fromSchema(e);return t.slice?r.parseSlice(Yh(n),t.parseOptions).content:r.parse(Yh(n),t.parseOptions)}return Wl("",e,t)}function kS(n,e,t){const r=n.steps.length-1;if(r{o===0&&(o=u)}),n.setSelection(Ae.near(n.doc.resolve(o),t))}const SS=n=>n.toString().startsWith("<"),CS=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{if(i){t={parseOptions:{},updateSelection:!0,...t};const o=Wl(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(o.toString()==="<>")return!0;let{from:l,to:a}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},c=!0,u=!0;if((SS(o)?o:[o]).forEach(d=>{d.check(),c=c?d.isText&&d.marks.length===0:!1,u=u?d.isBlock:!1}),l===a&&u){const{parent:d}=r.doc.resolve(l);d.isTextblock&&!d.type.spec.code&&!d.childCount&&(l-=1,a+=1)}c?Array.isArray(e)?r.insertText(e.map(d=>d.text||"").join(""),l,a):typeof e=="object"&&e&&e.text?r.insertText(e.text,l,a):r.insertText(e,l,a):r.replaceWith(l,a,o),t.updateSelection&&kS(r,r.steps.length-1,-1)}return!0},_S=()=>({state:n,dispatch:e})=>_k(n,e),AS=()=>({state:n,dispatch:e})=>Ak(n,e),TS=()=>({state:n,dispatch:e})=>yk(n,e),ES=()=>({state:n,dispatch:e})=>Sk(n,e),MS=()=>({tr:n,state:e,dispatch:t})=>{try{const r=Wa(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},OS=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Wa(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},$S=()=>({state:n,dispatch:e})=>vk(n,e),NS=()=>({state:n,dispatch:e})=>wk(n,e);function Jf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function DS(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let l=0;l({editor:e,view:t,tr:r,dispatch:i})=>{const s=DS(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function mo(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?Ct(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;const h=Math.max(r,d),p=Math.min(i,d+f.nodeSize);l.push({node:f,from:h,to:p})});const a=i-r,c=l.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>jl(f.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((f,d)=>f+d.to-d.from,0)>=a}const IS=(n,e={})=>({state:t,dispatch:r})=>{const i=Ct(n,t.schema);return mo(t,i,e)?Tk(t,r):!1},RS=()=>({state:n,dispatch:e})=>$k(n,e),PS=n=>({state:e,dispatch:t})=>{const r=Ct(n,e.schema);return Bk(r)(e,t)},LS=()=>({state:n,dispatch:e})=>Ek(n,e);function nc(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Xh(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const BS=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=nc(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=Ct(n,r.schema)),l==="mark"&&(o=Wr(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{s&&s===c.type&&t.setNodeMarkup(u,void 0,Xh(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&t.addMark(u,u+c.nodeSize,o.create(Xh(f.attrs,e)))})})}),!0):!1},FS=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),zS=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),VS=()=>({state:n,dispatch:e})=>kk(n,e),HS=()=>({state:n,dispatch:e})=>Ck(n,e),US=()=>({state:n,dispatch:e})=>Nk(n,e),jS=()=>({state:n,dispatch:e})=>Ik(n,e),WS=()=>({state:n,dispatch:e})=>xk(n,e);function Fb(n,e,t={}){return Wl(n,e,{slice:!1,parseOptions:t})}const qS=(n,e=!1,t={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,l=Fb(n,i.schema,t);return s&&r.replaceWith(0,o.content.size,l).setMeta("preventUpdate",!e),!0};function rc(n,e){const t=Wr(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function KS(n,e){const t=new jg(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function JS(n){for(let e=0;e{t(i)&&r.push({node:i,pos:s})}),r}function YS(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Gf(n){return e=>YS(e.$from,n)}function XS(n,e){const t=Wn.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function QS(n,e){const t={from:0,to:n.content.size};return Rb(n,t,e)}function ZS(n,e){const t=Ct(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function zb(n,e){const t=nc(typeof e=="string"?e:e.name,n.schema);return t==="node"?ZS(n,e):t==="mark"?rc(n,e):{}}function eC(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function tC(n){const e=eC(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function nC(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),f=e.invert().map(c,-1),d=e.invert().map(u);r.push({oldRange:{from:f,to:d},newRange:{from:c,to:u}})})}),tC(r)}function Yf(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n-1),o=Wf(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function ml(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Lu(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?Wr(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>jl(f.attrs,t,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:f,$to:d})=>{const h=f.pos,p=d.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,g),C=Math.min(p,g+m.nodeSize),E=C-b;o+=E,l.push(...m.marks.map(v=>({mark:v,from:b,to:C})))})}),o===0)return!1;const a=l.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>jl(f.mark.attrs,t,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),c=l.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,d)=>f+d.to-d.from,0);return(a>0?a+c:a)>=o}function rC(n,e,t={}){if(!e)return mo(n,null,t)||Lu(n,null,t);const r=nc(e,n.schema);return r==="node"?mo(n,e,t):r==="mark"?Lu(n,e,t):!1}function Qh(n,e){const{nodeExtensions:t}=Za(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=_e(ee(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function iC(n){var e;const t=(e=n.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=n.toJSON();return JSON.stringify(t)===JSON.stringify(r)}function sC(n){return n instanceof ue}function oC(n,e,t){const i=n.state.doc.content.size,s=lr(e,0,i),o=lr(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),d=Math.max(l.right,a.right),h=d-f,p=u-c,b={top:c,bottom:u,left:f,right:d,width:h,height:p,x:f,y:c};return{...b,toJSON:()=>b}}function lC(n,e,t){var r;const{selection:i}=e;let s=null;if(qf(i)&&(s=i.$cursor),s){const l=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,f,d)=>{if(c)return!1;if(u.isInline){const h=!d||d.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}const aC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=Wr(n,r.schema);if(i)if(o){const c=rc(r,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(d,h)=>{const p=Math.max(h,u),m=Math.min(h+d.nodeSize,f);d.marks.find(b=>b.type===a)?d.marks.forEach(b=>{a===b.type&&t.addMark(p,m,a.create({...b.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return lC(r,t,a)},cC=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),uC=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=Ct(n,t.schema);return s.isTextblock?i().command(({commands:o})=>qh(s,e)(t)?!0:o.clearNodes()).command(({state:o})=>qh(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},fC=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=lr(n,0,r.content.size),s=ue.create(r,i);e.setSelection(s)}return!0},dC=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=be.atStart(r).from,l=be.atEnd(r).to,a=lr(i,o,l),c=lr(s,o,l),u=be.create(r,a,c);e.setSelection(u)}return!0},hC=n=>({state:e,dispatch:t})=>{const r=Ct(n,e.schema);return Vk(r)(e,t)};function Zh(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}const pC=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,u=ml(c,l.node().type.name,l.node().attrs);if(s instanceof ue&&s.node.isBlock)return!l.parentOffset||!Ki(o,l.pos)?!1:(r&&(n&&Zh(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const f=a.parentOffset===a.parent.content.size;s instanceof be&&e.deleteSelection();const d=l.depth===0?void 0:JS(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&d?[{type:d,attrs:u}]:void 0,p=Ki(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ki(e.doc,e.mapping.map(l.pos),1,d?[{type:d}]:void 0)&&(p=!0,h=d?[{type:d,attrs:u}]:void 0),p&&(e.split(e.mapping.map(l.pos),1,h),d&&!f&&!l.parentOffset&&l.parent.type!==d)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&e.setNodeMarkup(e.mapping.map(l.before()),d)}n&&Zh(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},mC=n=>({tr:e,state:t,dispatch:r,editor:i})=>{var s;const o=Ct(n,t.schema),{$from:l,$to:a}=t.selection,c=t.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==o)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!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let g=V.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let B=l.depth-b;B>=l.depth-3;B-=1)g=V.from(l.node(B).copy(g));const C=l.indexAfter(-1){if(_>-1)return!1;B.isTextblock&&B.content.size===0&&(_=F+1)}),_>-1&&e.setSelection(be.near(e.doc.resolve(_))),e.scrollIntoView()}return!0}const d=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,h=ml(f,u.type.name,u.attrs),p=ml(f,l.node().type.name,l.node().attrs);e.delete(l.pos,a.pos);const m=d?[{type:o,attrs:h},{type:d,attrs:p}]:[{type:o,attrs:h}];if(!Ki(e.doc,l.pos,2))return!1;if(r){const{selection:g,storedMarks:b}=t,{splittableMarks:C}=i.extensionManager,E=b||g.$to.parentOffset&&g.$from.marks();if(e.split(l.pos,2,m).scrollIntoView(),!E||!r)return!0;const v=E.filter(H=>C.includes(H.type.name));e.ensureMarks(v)}return!0},Fc=(n,e)=>{const t=Gf(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ur(n.doc,t.pos)&&n.join(t.pos),!0},zc=(n,e)=>{const t=Gf(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ur(n.doc,r)&&n.join(r),!0},gC=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,h=Ct(n,o.schema),p=Ct(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:C}=m,E=b.blockRange(C),v=g||m.$to.parentOffset&&m.$from.marks();if(!E)return!1;const H=Gf(_=>Qh(_.type.name,f))(m);if(E.depth>=1&&H&&E.depth-H.depth<=1){if(H.node.type===h)return c.liftListItem(p);if(Qh(H.node.type.name,f)&&h.validContent(H.node.content)&&l)return a().command(()=>(s.setNodeMarkup(H.pos,h),!0)).command(()=>Fc(s,h)).command(()=>zc(s,h)).run()}return!t||!v||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Fc(s,h)).command(()=>zc(s,h)).run():a().command(()=>{const _=u().wrapInList(h,r),B=v.filter(F=>d.includes(F.type.name));return s.ensureMarks(B),_?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Fc(s,h)).command(()=>zc(s,h)).run()},bC=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Wr(n,r.schema);return Lu(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},yC=(n,e,t={})=>({state:r,commands:i})=>{const s=Ct(n,r.schema),o=Ct(e,r.schema);return mo(r,s,t)?i.setNode(o):i.setNode(s,t)},vC=(n,e={})=>({state:t,commands:r})=>{const i=Ct(n,t.schema);return mo(t,i,e)?r.lift(i):r.wrapIn(i,e)},wC=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},kC=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},SC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=Wr(n,r.schema),{$from:c,empty:u,ranges:f}=l;if(!i)return!0;if(u&&o){let{from:d,to:h}=l;const p=(s=c.marks().find(g=>g.type===a))===null||s===void 0?void 0:s.attrs,m=Wf(c,a,p);m&&(d=m.from,h=m.to),t.removeMark(d,h,a)}else f.forEach(d=>{t.removeMark(d.$from.pos,d.$to.pos,a)});return t.removeStoredMark(a),!0},CC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=nc(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=Ct(n,r.schema)),l==="mark"&&(o=Wr(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;r.doc.nodesBetween(c,u,(f,d)=>{s&&s===f.type&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(h=>{if(o===h.type){const p=Math.max(d,c),m=Math.min(d+f.nodeSize,u);t.addMark(p,m,o.create({...h.attrs,...e}))}})})}),!0):!1},_C=(n,e={})=>({state:t,dispatch:r})=>{const i=Ct(n,t.schema);return Rk(i,e)(t,r)},AC=(n,e={})=>({state:t,dispatch:r})=>{const i=Ct(n,t.schema);return Pk(i,e)(t,r)};var TC=Object.freeze({__proto__:null,blur:rS,clearContent:iS,clearNodes:sS,command:oS,createParagraphNear:lS,cut:aS,deleteCurrentNode:cS,deleteNode:uS,deleteRange:fS,deleteSelection:dS,enter:hS,exitCode:pS,extendMarkRange:gS,first:bS,focus:yS,forEach:vS,insertContent:wS,insertContentAt:CS,joinUp:_S,joinDown:AS,joinBackward:TS,joinForward:ES,joinItemBackward:MS,joinItemForward:OS,joinTextblockBackward:$S,joinTextblockForward:NS,keyboardShortcut:xS,lift:IS,liftEmptyBlock:RS,liftListItem:PS,newlineInCode:LS,resetAttributes:BS,scrollIntoView:FS,selectAll:zS,selectNodeBackward:VS,selectNodeForward:HS,selectParentNode:US,selectTextblockEnd:jS,selectTextblockStart:WS,setContent:qS,setMark:aC,setMeta:cC,setNode:uC,setNodeSelection:fC,setTextSelection:dC,sinkListItem:hC,splitBlock:pC,splitListItem:mC,toggleList:gC,toggleMark:bC,toggleNode:yC,toggleWrap:vC,undoInputRule:wC,unsetAllMarks:kC,unsetMark:SC,updateAttributes:CC,wrapIn:_C,wrapInList:AC});const EC=Ot.create({name:"commands",addCommands(){return{...TC}}}),MC=Ot.create({name:"editable",addProseMirrorPlugins(){return[new ut({key:new Pt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),OC=Ot.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ut({key:new Pt("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),$C=Ot.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:f}=a,{pos:d,parent:h}=f,p=f.parent.isTextblock?l.doc.resolve(d-1):f,m=p.parent.type.spec.isolating,g=f.pos-f.parentOffset,b=m&&p.parent.childCount===1?g===f.pos:Ae.atStart(c).from===d;return!u||!b||!h.type.isTextblock||h.textContent.length?!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:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 Kf()||Jf()?s:i},addProseMirrorPlugins(){return[new ut({key:new Pt("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(p=>p.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:s,to:o}=e.selection,l=Ae.atStart(e.doc).from,a=Ae.atEnd(e.doc).to;if(i||!(s===l&&o===a)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const f=t.tr,d=Xa({state:t,transaction:f}),{commands:h}=new Qa({editor:this.editor,state:d});if(h.clearNodes(),!!f.steps.length)return f}})]}}),NC=Ot.create({name:"tabindex",addProseMirrorPlugins(){return[new ut({key:new Pt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var DC=Object.freeze({__proto__:null,ClipboardTextSerializer:nS,Commands:EC,Editable:MC,FocusEvents:OC,Keymap:$C,Tabindex:NC});class ei{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}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!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=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}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,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),t=this.resolvedPos.doc.resolve(e);return new ei(t,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 ei(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 ei(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=this.pos+r+(i?0:1),o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const l=new ei(o,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new ei(o,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let l=0;l{if(s.node.type.name===e){if(Object.keys(t).length>0){const o=s.node.attrs,l=Object.keys(t);for(let a=0;anull,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}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&&document&&(this.css=IC(xC,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const r=Ib(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const t=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(t))});this.view.updateState(r)}createExtensionManager(){const t=[...this.options.enableCoreExtensions?Object.values(DC):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Wi(t,this)}createCommandManager(){this.commandManager=new Qa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=Fb(this.options.content,this.schema,this.options.parseOptions),t=Lb(e,this.options.autofocus);this.view=new lk(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:ji.create({doc:e,selection:t||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)});return}const t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return zb(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return rC(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return XS(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=` -`,textSerializers:r={}}=e||{};return QS(this.state.doc,{blockSeparator:t,textSerializers:{...Pb(this.schema),...r}})}get isEmpty(){return iC(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new ei(t,this)}get $doc(){return this.$pos(0)}}function as(n){return new ec({find:n.find,handler:({state:e,range:t,match:r})=>{const i=_e(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=t.from+l.indexOf(o),u=c+o.length;if(Yf(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;ut.from&&s.delete(t.from+a,c);const d=t.from+a+o.length;s.addMark(t.from+a,d,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function Vb(n){return new ec({find:n.find,handler:({state:e,range:t,match:r})=>{const i=_e(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let l=t.to;const a=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>l?u=l:l=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(u,l,a)}else r[0]&&s.insert(o-1,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l));s.scrollIntoView()}})}function Bu(n){return new ec({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=_e(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function go(n){return new ec({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=_e(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&Df(a,n.type,s);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){const{selection:f,storedMarks:d}=e,{splittableMarks:h}=n.editor.extensionManager,p=d||f.$to.parentOffset&&f.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Ur(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)}})}class On{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=_e(ee(this,"addOptions",{name:this.name}))),this.storage=_e(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new On(e)}configure(e={}){const t=this.extend();return t.options=tc(this.options,e),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new On({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=_e(ee(t,"addOptions",{name:t.name})),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const a=o.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}class $t{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=_e(ee(this,"addOptions",{name:this.name}))),this.storage=_e(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new $t(e)}configure(e={}){const t=this.extend();return t.options=tc(this.options,e),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new $t({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=_e(ee(t,"addOptions",{name:t.name})),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}}function wi(n){return new Yk({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=_e(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=t.to;if(l){const u=a.search(/\S/),f=t.from+a.indexOf(l),d=f+l.length;if(Yf(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>f).length)return null;dt.from&&o.delete(t.from+u,f),c=t.from+u+l.length,o.addMark(t.from+u,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function PC(n){return n[n.length-1]}function Fu(n){return Object.keys(n).reduce((e,t)=>n[t]===void 0?e:e+`${t}:${n[t]};`,"")}Fu({position:"absolute",opacity:0,"pointer-events":"none",margin:0,transform:"translateX(-100%)"});function ep(n){function e(t){return t(n),()=>{}}return{subscribe:e}}const Qo=n=>new Proxy(n,{get(e,t,r){return Reflect.get(e,t,r)},ownKeys(e){return Reflect.ownKeys(e).filter(t=>t!=="action")}}),tp=n=>typeof n=="function";function Sr(n,e){const{stores:t,action:r,returned:i}=e??{},s=(()=>{if(t&&i)return Ua(t,l=>{const a=i(l);if(tp(a)){const c=(...u)=>Qo({...a(...u),[`data-melt-${n}`]:"",action:r??bt});return c.action=r??bt,c}return Qo({...a,[`data-melt-${n}`]:"",action:r??bt})});{const l=i,a=l==null?void 0:l();if(tp(a)){const c=(...u)=>Qo({...a(...u),[`data-melt-${n}`]:"",action:r??bt});return c.action=r??bt,ep(c)}return ep(Qo({...a,[`data-melt-${n}`]:"",action:r??bt}))}})(),o=r??(()=>{});return o.subscribe=s.subscribe,o}function LC(n){const e=s=>s?`${n}-${s}`:n,t=s=>`data-melt-${n}${s?`-${s}`:""}`,r=s=>`[data-melt-${n}${s?`-${s}`:""}]`;return{name:e,attribute:t,selector:r,getEl:s=>document.querySelector(r(s))}}const BC=typeof document<"u",Xf=n=>typeof n=="function";function Fr(n){return n instanceof HTMLElement}function FC(n){return n!==null&&typeof n=="object"}function zC(n){return FC(n)&&"subscribe"in n}function gl(...n){return(...e)=>{for(const t of n)typeof t=="function"&&t(...e)}}function bt(){}function Hb(n,e,t,r){const i=Array.isArray(e)?e:[e];return i.forEach(s=>n.addEventListener(s,t,r)),()=>{i.forEach(s=>n.removeEventListener(s,t,r))}}function js(n,e,t,r){const i=Array.isArray(e)?e:[e];if(typeof t=="function"){const s=HC(o=>t(o));return i.forEach(o=>n.addEventListener(o,s,r)),()=>{i.forEach(o=>n.removeEventListener(o,s,r))}}return()=>void 0}function VC(n){const e=n.currentTarget;if(!Fr(e))return null;const t=new CustomEvent(`m-${n.type}`,{detail:{originalEvent:n},cancelable:!0});return e.dispatchEvent(t),t}function HC(n){return e=>{const t=VC(e);if(!(t!=null&&t.defaultPrevented))return n(e)}}function UC(n,...e){const t={};for(const r of Object.keys(n))e.includes(r)||(t[r]=n[r]);return t}const jC=(n,e)=>{const t=(i,s)=>{n.update(o=>{const l=i(o);let a=l;return e&&(a=e({curr:o,next:l})),s==null||s(a),a})};return{...n,update:t,set:i=>{t(()=>i)}}};function Ub(n){return new Promise(e=>setTimeout(e,n))}let WC="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",qC=(n=21)=>{let e="",t=n;for(;t--;)e+=WC[Math.random()*64|0];return e};function KC(){return qC(10)}function JC(n){return n.reduce((e,t)=>(e[t]=KC(),e),{})}const Ws={ALT:"Alt",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",BACKSPACE:"Backspace",CAPS_LOCK:"CapsLock",CONTROL:"Control",DELETE:"Delete",END:"End",ENTER:"Enter",ESCAPE:"Escape",F1:"F1",F10:"F10",F11:"F11",F12:"F12",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",HOME:"Home",META:"Meta",PAGE_DOWN:"PageDown",PAGE_UP:"PageUp",SHIFT:"Shift",SPACE:" ",TAB:"Tab",CTRL:"Control",ASTERISK:"*",A:"a",P:"p"},jb=()=>typeof window<"u";function GC(){const n=navigator.userAgentData;return(n==null?void 0:n.platform)??navigator.platform}const Wb=n=>jb()&&n.test(GC().toLowerCase()),YC=()=>jb()&&!!navigator.maxTouchPoints,XC=()=>Wb(/^mac/)&&!YC(),QC=()=>Wb(/mac|iphone|ipad|ipod/i),ZC=()=>QC()&&!XC(),Vc="data-melt-scroll-lock";function np(n,e){if(!n)return;const t=n.style.cssText;return Object.assign(n.style,e),()=>{n.style.cssText=t}}function e_(n,e,t){if(!n)return;const r=n.style.getPropertyValue(e);return n.style.setProperty(e,t),()=>{r?n.style.setProperty(e,r):n.style.removeProperty(e)}}function t_(n){const e=n.getBoundingClientRect().left;return Math.round(e)+n.scrollLeft?"paddingLeft":"paddingRight"}function n_(n){const e=n??document,t=e.defaultView??window,{documentElement:r,body:i}=e;if(i.hasAttribute(Vc))return bt;i.setAttribute(Vc,"");const o=t.innerWidth-r.clientWidth,l=()=>e_(r,"--scrollbar-width",`${o}px`),a=t_(r),c=t.getComputedStyle(i)[a],u=()=>np(i,{overflow:"hidden",[a]:`calc(${c} + ${o}px)`}),f=()=>{const{scrollX:h,scrollY:p,visualViewport:m}=t,g=(m==null?void 0:m.offsetLeft)??0,b=(m==null?void 0:m.offsetTop)??0,C=np(i,{position:"fixed",overflow:"hidden",top:`${-(p-Math.floor(b))}px`,left:`${-(h-Math.floor(g))}px`,right:"0",[a]:`calc(${c} + ${o}px)`});return()=>{C==null||C(),t.scrollTo(h,p)}},d=[l(),ZC()?f():u()];return()=>{d.forEach(h=>h==null?void 0:h()),i.removeAttribute(Vc)}}const qb=n=>{try{E1(n)}catch{return n()}};function r_(n,e){let t=[];const r=l=>{t.push(l)},i=()=>{t.forEach(l=>l()),t=[]},s=Ua(n,l=>(i(),e(l,r)));return qb(i),{...s,subscribe:(...l)=>{const a=s.subscribe(...l);return()=>{a(),i()}}}}function Cr(n,e){const t=r_(n,(r,i)=>({stores:r,onUnsubscribe:i})).subscribe(({stores:r,onUnsubscribe:i})=>{const s=e(r);s&&i(s)});return qb(t),t}function rp(n){const e={};return Object.keys(n).forEach(t=>{const r=t,i=n[r];e[r]=ns(i)}),e}function i_(n){let e=n.parentElement;for(;Fr(e)&&!e.hasAttribute("data-portal");)e=e.parentElement;return e||"body"}function s_(n,e){const t=i_(n);return e!==void 0?e:t==="body"?document.body:null}async function ip(n){const{prop:e,defaultEl:t}=n;if(await Promise.all([Ub(1),Mf]),e===void 0){t==null||t.focus();return}const r=Xf(e)?e(t):e;if(typeof r=="string"){const i=document.querySelector(r);if(!Fr(i))return;i.focus()}else Fr(r)&&r.focus()}const o_=Of(void 0,n=>{function e(r){n(r),n(void 0)}return Hb(document,"pointerup",e,{passive:!1,capture:!0})}),l_=(n,e={})=>{let t={enabled:!0,...e};function r(){return typeof t.enabled=="boolean"?t.enabled:jt(t.enabled)}const i=o_.subscribe(s=>{var l;if(!r()||!s||s.target===n)return;const o=s.composedPath();if(!o.includes(n)){if(t.ignore){if(Xf(t.ignore)){if(t.ignore(s))return}else if(Array.isArray(t.ignore)&&t.ignore.length>0&&t.ignore.some(a=>a&&(s.target===a||o.includes(a))))return}(l=t.handler)==null||l.call(t,s)}});return{update(s){t={...t,...s}},destroy(){i()}}},a_=Of(void 0,n=>{function e(r){r&&r.key===Ws.ESCAPE&&n(r),n(void 0)}return Hb(document,"keydown",e,{passive:!1})}),sp=(n,e={})=>{let t=bt;function r(i={}){t();const s={enabled:!0,...i},o=zC(s.enabled)?s.enabled:Of(s.enabled);t=gl(a_.subscribe(l=>{var c;if(!l||!jt(o))return;const a=l.target;if(!(!Fr(a)||a.closest("[data-escapee]")!==n)){if(l.preventDefault(),s.ignore){if(Xf(s.ignore)){if(s.ignore(l))return}else if(Array.isArray(s.ignore)&&s.ignore.length>0&&s.ignore.some(u=>u&&a===u))return}(c=s.handler)==null||c.call(s,l)}}),Cr(o,l=>{l?n.dataset.escapee="":delete n.dataset.escapee}))}return r(e),{update:r,destroy(){n.removeAttribute("data-escapee"),t()}}};/*! +`,textSerializers:r={}}=e||{};return QS(this.state.doc,{blockSeparator:t,textSerializers:{...Pb(this.schema),...r}})}get isEmpty(){return iC(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new ei(t,this)}get $doc(){return this.$pos(0)}}function as(n){return new ec({find:n.find,handler:({state:e,range:t,match:r})=>{const i=_e(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=t.from+l.indexOf(o),u=c+o.length;if(Yf(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;ut.from&&s.delete(t.from+a,c);const d=t.from+a+o.length;s.addMark(t.from+a,d,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function Vb(n){return new ec({find:n.find,handler:({state:e,range:t,match:r})=>{const i=_e(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let l=t.to;const a=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>l?u=l:l=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(u,l,a)}else r[0]&&s.insert(o-1,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l));s.scrollIntoView()}})}function Bu(n){return new ec({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=_e(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function go(n){return new ec({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=_e(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&Df(a,n.type,s);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){const{selection:f,storedMarks:d}=e,{splittableMarks:h}=n.editor.extensionManager,p=d||f.$to.parentOffset&&f.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Ur(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)}})}class $n{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=_e(ee(this,"addOptions",{name:this.name}))),this.storage=_e(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new $n(e)}configure(e={}){const t=this.extend();return t.options=tc(this.options,e),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new $n({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=_e(ee(t,"addOptions",{name:t.name})),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const a=o.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}class $t{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=_e(ee(this,"addOptions",{name:this.name}))),this.storage=_e(ee(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new $t(e)}configure(e={}){const t=this.extend();return t.options=tc(this.options,e),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new $t({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=_e(ee(t,"addOptions",{name:t.name})),t.storage=_e(ee(t,"addStorage",{name:t.name,options:t.options})),t}}function wi(n){return new Yk({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=_e(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=t.to;if(l){const u=a.search(/\S/),f=t.from+a.indexOf(l),d=f+l.length;if(Yf(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>f).length)return null;dt.from&&o.delete(t.from+u,f),c=t.from+u+l.length,o.addMark(t.from+u,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function PC(n){return n[n.length-1]}function Fu(n){return Object.keys(n).reduce((e,t)=>n[t]===void 0?e:e+`${t}:${n[t]};`,"")}Fu({position:"absolute",opacity:0,"pointer-events":"none",margin:0,transform:"translateX(-100%)"});function ep(n){function e(t){return t(n),()=>{}}return{subscribe:e}}const Qo=n=>new Proxy(n,{get(e,t,r){return Reflect.get(e,t,r)},ownKeys(e){return Reflect.ownKeys(e).filter(t=>t!=="action")}}),tp=n=>typeof n=="function";function Sr(n,e){const{stores:t,action:r,returned:i}=e??{},s=(()=>{if(t&&i)return Ua(t,l=>{const a=i(l);if(tp(a)){const c=(...u)=>Qo({...a(...u),[`data-melt-${n}`]:"",action:r??bt});return c.action=r??bt,c}return Qo({...a,[`data-melt-${n}`]:"",action:r??bt})});{const l=i,a=l==null?void 0:l();if(tp(a)){const c=(...u)=>Qo({...a(...u),[`data-melt-${n}`]:"",action:r??bt});return c.action=r??bt,ep(c)}return ep(Qo({...a,[`data-melt-${n}`]:"",action:r??bt}))}})(),o=r??(()=>{});return o.subscribe=s.subscribe,o}function LC(n){const e=s=>s?`${n}-${s}`:n,t=s=>`data-melt-${n}${s?`-${s}`:""}`,r=s=>`[data-melt-${n}${s?`-${s}`:""}]`;return{name:e,attribute:t,selector:r,getEl:s=>document.querySelector(r(s))}}const BC=typeof document<"u",Xf=n=>typeof n=="function";function Fr(n){return n instanceof HTMLElement}function FC(n){return n!==null&&typeof n=="object"}function zC(n){return FC(n)&&"subscribe"in n}function gl(...n){return(...e)=>{for(const t of n)typeof t=="function"&&t(...e)}}function bt(){}function Hb(n,e,t,r){const i=Array.isArray(e)?e:[e];return i.forEach(s=>n.addEventListener(s,t,r)),()=>{i.forEach(s=>n.removeEventListener(s,t,r))}}function js(n,e,t,r){const i=Array.isArray(e)?e:[e];if(typeof t=="function"){const s=HC(o=>t(o));return i.forEach(o=>n.addEventListener(o,s,r)),()=>{i.forEach(o=>n.removeEventListener(o,s,r))}}return()=>void 0}function VC(n){const e=n.currentTarget;if(!Fr(e))return null;const t=new CustomEvent(`m-${n.type}`,{detail:{originalEvent:n},cancelable:!0});return e.dispatchEvent(t),t}function HC(n){return e=>{const t=VC(e);if(!(t!=null&&t.defaultPrevented))return n(e)}}function UC(n,...e){const t={};for(const r of Object.keys(n))e.includes(r)||(t[r]=n[r]);return t}const jC=(n,e)=>{const t=(i,s)=>{n.update(o=>{const l=i(o);let a=l;return e&&(a=e({curr:o,next:l})),s==null||s(a),a})};return{...n,update:t,set:i=>{t(()=>i)}}};function Ub(n){return new Promise(e=>setTimeout(e,n))}let WC="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",qC=(n=21)=>{let e="",t=n;for(;t--;)e+=WC[Math.random()*64|0];return e};function KC(){return qC(10)}function JC(n){return n.reduce((e,t)=>(e[t]=KC(),e),{})}const Ws={ALT:"Alt",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",BACKSPACE:"Backspace",CAPS_LOCK:"CapsLock",CONTROL:"Control",DELETE:"Delete",END:"End",ENTER:"Enter",ESCAPE:"Escape",F1:"F1",F10:"F10",F11:"F11",F12:"F12",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",HOME:"Home",META:"Meta",PAGE_DOWN:"PageDown",PAGE_UP:"PageUp",SHIFT:"Shift",SPACE:" ",TAB:"Tab",CTRL:"Control",ASTERISK:"*",A:"a",P:"p"},jb=()=>typeof window<"u";function GC(){const n=navigator.userAgentData;return(n==null?void 0:n.platform)??navigator.platform}const Wb=n=>jb()&&n.test(GC().toLowerCase()),YC=()=>jb()&&!!navigator.maxTouchPoints,XC=()=>Wb(/^mac/)&&!YC(),QC=()=>Wb(/mac|iphone|ipad|ipod/i),ZC=()=>QC()&&!XC(),Vc="data-melt-scroll-lock";function np(n,e){if(!n)return;const t=n.style.cssText;return Object.assign(n.style,e),()=>{n.style.cssText=t}}function e_(n,e,t){if(!n)return;const r=n.style.getPropertyValue(e);return n.style.setProperty(e,t),()=>{r?n.style.setProperty(e,r):n.style.removeProperty(e)}}function t_(n){const e=n.getBoundingClientRect().left;return Math.round(e)+n.scrollLeft?"paddingLeft":"paddingRight"}function n_(n){const e=n??document,t=e.defaultView??window,{documentElement:r,body:i}=e;if(i.hasAttribute(Vc))return bt;i.setAttribute(Vc,"");const o=t.innerWidth-r.clientWidth,l=()=>e_(r,"--scrollbar-width",`${o}px`),a=t_(r),c=t.getComputedStyle(i)[a],u=()=>np(i,{overflow:"hidden",[a]:`calc(${c} + ${o}px)`}),f=()=>{const{scrollX:h,scrollY:p,visualViewport:m}=t,g=(m==null?void 0:m.offsetLeft)??0,b=(m==null?void 0:m.offsetTop)??0,C=np(i,{position:"fixed",overflow:"hidden",top:`${-(p-Math.floor(b))}px`,left:`${-(h-Math.floor(g))}px`,right:"0",[a]:`calc(${c} + ${o}px)`});return()=>{C==null||C(),t.scrollTo(h,p)}},d=[l(),ZC()?f():u()];return()=>{d.forEach(h=>h==null?void 0:h()),i.removeAttribute(Vc)}}const qb=n=>{try{E1(n)}catch{return n()}};function r_(n,e){let t=[];const r=l=>{t.push(l)},i=()=>{t.forEach(l=>l()),t=[]},s=Ua(n,l=>(i(),e(l,r)));return qb(i),{...s,subscribe:(...l)=>{const a=s.subscribe(...l);return()=>{a(),i()}}}}function Cr(n,e){const t=r_(n,(r,i)=>({stores:r,onUnsubscribe:i})).subscribe(({stores:r,onUnsubscribe:i})=>{const s=e(r);s&&i(s)});return qb(t),t}function rp(n){const e={};return Object.keys(n).forEach(t=>{const r=t,i=n[r];e[r]=ns(i)}),e}function i_(n){let e=n.parentElement;for(;Fr(e)&&!e.hasAttribute("data-portal");)e=e.parentElement;return e||"body"}function s_(n,e){const t=i_(n);return e!==void 0?e:t==="body"?document.body:null}async function ip(n){const{prop:e,defaultEl:t}=n;if(await Promise.all([Ub(1),Mf]),e===void 0){t==null||t.focus();return}const r=Xf(e)?e(t):e;if(typeof r=="string"){const i=document.querySelector(r);if(!Fr(i))return;i.focus()}else Fr(r)&&r.focus()}const o_=Of(void 0,n=>{function e(r){n(r),n(void 0)}return Hb(document,"pointerup",e,{passive:!1,capture:!0})}),l_=(n,e={})=>{let t={enabled:!0,...e};function r(){return typeof t.enabled=="boolean"?t.enabled:jt(t.enabled)}const i=o_.subscribe(s=>{var l;if(!r()||!s||s.target===n)return;const o=s.composedPath();if(!o.includes(n)){if(t.ignore){if(Xf(t.ignore)){if(t.ignore(s))return}else if(Array.isArray(t.ignore)&&t.ignore.length>0&&t.ignore.some(a=>a&&(s.target===a||o.includes(a))))return}(l=t.handler)==null||l.call(t,s)}});return{update(s){t={...t,...s}},destroy(){i()}}},a_=Of(void 0,n=>{function e(r){r&&r.key===Ws.ESCAPE&&n(r),n(void 0)}return Hb(document,"keydown",e,{passive:!1})}),sp=(n,e={})=>{let t=bt;function r(i={}){t();const s={enabled:!0,...i},o=zC(s.enabled)?s.enabled:Of(s.enabled);t=gl(a_.subscribe(l=>{var c;if(!l||!jt(o))return;const a=l.target;if(!(!Fr(a)||a.closest("[data-escapee]")!==n)){if(l.preventDefault(),s.ignore){if(Xf(s.ignore)){if(s.ignore(l))return}else if(Array.isArray(s.ignore)&&s.ignore.length>0&&s.ignore.some(u=>u&&a===u))return}(c=s.handler)==null||c.call(s,l)}}),Cr(o,l=>{l?n.dataset.escapee="":delete n.dataset.escapee}))}return r(e),{update:r,destroy(){n.removeAttribute("data-escapee"),t()}}};/*! * tabbable 6.2.0 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE */var Kb=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ql=Kb.join(","),Jb=typeof Element>"u",ki=Jb?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Kl=!Jb&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n==null?void 0:n.ownerDocument},Jl=function n(e,t){var r;t===void 0&&(t=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",o=s||t&&e&&n(e.parentNode);return o},c_=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},Gb=function(e,t,r){if(Jl(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(ql));return t&&ki.call(e,ql)&&i.unshift(e),i=i.filter(r),i},Yb=function n(e,t,r){for(var i=[],s=Array.from(e);s.length;){var o=s.shift();if(!Jl(o,!1))if(o.tagName==="SLOT"){var l=o.assignedElements(),a=l.length?l:o.children,c=n(a,!0,r);r.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{var u=ki.call(o,ql);u&&r.filter(o)&&(t||!e.includes(o))&&i.push(o);var f=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),d=!Jl(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(f&&d){var h=n(f===!0?o.children:f.children,!0,r);r.flatten?i.push.apply(i,h):i.push({scopeParent:o,candidates:h})}else s.unshift.apply(s,o.children)}}return i},Xb=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ti=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||c_(e))&&!Xb(e)?0:e.tabIndex},u_=function(e,t){var r=ti(e);return r<0&&t&&!Xb(e)?0:r},f_=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Qb=function(e){return e.tagName==="INPUT"},d_=function(e){return Qb(e)&&e.type==="hidden"},h_=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},p_=function(e,t){for(var r=0;rsummary:first-of-type"),o=s?e.parentElement:e;if(ki.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var l=e;e;){var a=e.parentElement,c=Kl(e);if(a&&!a.shadowRoot&&i(a)===!0)return op(e);e.assignedSlot?e=e.assignedSlot:!a&&c!==e.ownerDocument?e=c.host:e=a}e=l}if(y_(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return op(e);return!1},w_=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r=0)},S_=function n(e){var t=[],r=[];return e.forEach(function(i,s){var o=!!i.scopeParent,l=o?i.scopeParent:i,a=u_(l,o),c=o?n(i.candidates):l;a===0?o?t.push.apply(t,c):t.push(l):r.push({documentOrder:s,tabIndex:a,item:i,isScope:o,content:c})}),r.sort(f_).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(t)},C_=function(e,t){t=t||{};var r;return t.getShadowRoot?r=Yb([e],t.includeContainer,{filter:zu.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:k_}):r=Gb(e,t.includeContainer,zu.bind(null,t)),S_(r)},__=function(e,t){t=t||{};var r;return t.getShadowRoot?r=Yb([e],t.includeContainer,{filter:Gl.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=Gb(e,t.includeContainer,Gl.bind(null,t)),r},Bi=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return ki.call(e,ql)===!1?!1:zu(t,e)},A_=Kb.concat("iframe").join(","),Hc=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return ki.call(e,A_)===!1?!1:Gl(t,e)};/*! * focus-trap 7.5.4 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE -*/function lp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ap(n){for(var e=1;e0){var r=e[e.length-1];r!==t&&r.pause()}var i=e.indexOf(t);i===-1||e.splice(i,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},O_=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},$_=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},Ys=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},N_=function(e){return Ys(e)&&!e.shiftKey},D_=function(e){return Ys(e)&&e.shiftKey},up=function(e){return setTimeout(e,0)},fp=function(e,t){var r=-1;return e.every(function(i,s){return t(i)?(r=s,!1):!0}),r},Is=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?O-1:0),A=1;A=0)y=r.activeElement;else{var w=o.tabbableGroups[0],O=w&&w.firstTabbableNode;y=O||u("fallbackFocus")}if(!y)throw new Error("Your focus-trap needs to have at least one focusable element");return y},d=function(){if(o.containerGroups=o.containers.map(function(y){var w=C_(y,s.tabbableOptions),O=__(y,s.tabbableOptions),L=w.length>0?w[0]:void 0,A=w.length>0?w[w.length-1]:void 0,z=O.find(function(te){return Bi(te)}),q=O.slice().reverse().find(function(te){return Bi(te)}),Y=!!w.find(function(te){return ti(te)>0});return{container:y,tabbableNodes:w,focusableNodes:O,posTabIndexesFound:Y,firstTabbableNode:L,lastTabbableNode:A,firstDomTabbableNode:z,lastDomTabbableNode:q,nextTabbableNode:function(ge){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,me=w.indexOf(ge);return me<0?ye?O.slice(O.indexOf(ge)+1).find(function(Ke){return Bi(Ke)}):O.slice(0,O.indexOf(ge)).reverse().find(function(Ke){return Bi(Ke)}):w[me+(ye?1:-1)]}}}),o.tabbableGroups=o.containerGroups.filter(function(y){return y.tabbableNodes.length>0}),o.tabbableGroups.length<=0&&!u("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find(function(y){return y.posTabIndexesFound})&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function $(y){var w=y.activeElement;if(w)return w.shadowRoot&&w.shadowRoot.activeElement!==null?$(w.shadowRoot):w},p=function $(y){if(y!==!1&&y!==h(document)){if(!y||!y.focus){$(f());return}y.focus({preventScroll:!!s.preventScroll}),o.mostRecentlyFocusedNode=y,O_(y)&&y.select()}},m=function(y){var w=u("setReturnFocus",y);return w||(w===!1?!1:y)},g=function(y){var w=y.target,O=y.event,L=y.isBackward,A=L===void 0?!1:L;w=w||Zo(O),d();var z=null;if(o.tabbableGroups.length>0){var q=c(w,O),Y=q>=0?o.containerGroups[q]:void 0;if(q<0)A?z=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:z=o.tabbableGroups[0].firstTabbableNode;else if(A){var te=fp(o.tabbableGroups,function(Qe){var Xe=Qe.firstTabbableNode;return w===Xe});if(te<0&&(Y.container===w||Hc(w,s.tabbableOptions)&&!Bi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w,!1))&&(te=q),te>=0){var ge=te===0?o.tabbableGroups.length-1:te-1,ye=o.tabbableGroups[ge];z=ti(w)>=0?ye.lastTabbableNode:ye.lastDomTabbableNode}else Ys(O)||(z=Y.nextTabbableNode(w,!1))}else{var me=fp(o.tabbableGroups,function(Qe){var Xe=Qe.lastTabbableNode;return w===Xe});if(me<0&&(Y.container===w||Hc(w,s.tabbableOptions)&&!Bi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w))&&(me=q),me>=0){var Ke=me===o.tabbableGroups.length-1?0:me+1,Fe=o.tabbableGroups[Ke];z=ti(w)>=0?Fe.firstTabbableNode:Fe.firstDomTabbableNode}else Ys(O)||(z=Y.nextTabbableNode(w))}}else z=u("fallbackFocus");return z},b=function(y){var w=Zo(y);if(!(c(w,y)>=0)){if(Is(s.clickOutsideDeactivates,y)){l.deactivate({returnFocus:s.returnFocusOnDeactivate});return}Is(s.allowOutsideClick,y)||y.preventDefault()}},C=function(y){var w=Zo(y),O=c(w,y)>=0;if(O||w instanceof Document)O&&(o.mostRecentlyFocusedNode=w);else{y.stopImmediatePropagation();var L,A=!0;if(o.mostRecentlyFocusedNode)if(ti(o.mostRecentlyFocusedNode)>0){var z=c(o.mostRecentlyFocusedNode),q=o.containerGroups[z].tabbableNodes;if(q.length>0){var Y=q.findIndex(function(te){return te===o.mostRecentlyFocusedNode});Y>=0&&(s.isKeyForward(o.recentNavEvent)?Y+1=0&&(L=q[Y-1],A=!1))}}else o.containerGroups.some(function(te){return te.tabbableNodes.some(function(ge){return ti(ge)>0})})||(A=!1);else A=!1;A&&(L=g({target:o.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(o.recentNavEvent)})),p(L||o.mostRecentlyFocusedNode||f())}o.recentNavEvent=void 0},E=function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;o.recentNavEvent=y;var O=g({event:y,isBackward:w});O&&(Ys(y)&&y.preventDefault(),p(O))},v=function(y){if($_(y)&&Is(s.escapeDeactivates,y)!==!1){y.preventDefault(),l.deactivate();return}(s.isKeyForward(y)||s.isKeyBackward(y))&&E(y,s.isKeyBackward(y))},H=function(y){var w=Zo(y);c(w,y)>=0||Is(s.clickOutsideDeactivates,y)||Is(s.allowOutsideClick,y)||(y.preventDefault(),y.stopImmediatePropagation())},_=function(){if(o.active)return cp.activateTrap(i,l),o.delayInitialFocusTimer=s.delayInitialFocus?up(function(){p(f())}):p(f()),r.addEventListener("focusin",C,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",H,{capture:!0,passive:!1}),r.addEventListener("keydown",v,{capture:!0,passive:!1}),l},B=function(){if(o.active)return r.removeEventListener("focusin",C,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",H,!0),r.removeEventListener("keydown",v,!0),l},F=function(y){var w=y.some(function(O){var L=Array.from(O.removedNodes);return L.some(function(A){return A===o.mostRecentlyFocusedNode})});w&&p(f())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(F):void 0,X=function(){M&&(M.disconnect(),o.active&&!o.paused&&o.containers.map(function(y){M.observe(y,{subtree:!0,childList:!0})}))};return l={get active(){return o.active},get paused(){return o.paused},activate:function(y){if(o.active)return this;var w=a(y,"onActivate"),O=a(y,"onPostActivate"),L=a(y,"checkCanFocusTrap");L||d(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,w==null||w();var A=function(){L&&d(),_(),X(),O==null||O()};return L?(L(o.containers.concat()).then(A,A),this):(A(),this)},deactivate:function(y){if(!o.active)return this;var w=ap({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},y);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,B(),o.active=!1,o.paused=!1,X(),cp.deactivateTrap(i,l);var O=a(w,"onDeactivate"),L=a(w,"onPostDeactivate"),A=a(w,"checkCanReturnFocus"),z=a(w,"returnFocus","returnFocusOnDeactivate");O==null||O();var q=function(){up(function(){z&&p(m(o.nodeFocusedBeforeActivation)),L==null||L()})};return z&&A?(A(m(o.nodeFocusedBeforeActivation)).then(q,q),this):(q(),this)},pause:function(y){if(o.paused||!o.active)return this;var w=a(y,"onPause"),O=a(y,"onPostPause");return o.paused=!0,w==null||w(),B(),X(),O==null||O(),this},unpause:function(y){if(!o.paused||!o.active)return this;var w=a(y,"onUnpause"),O=a(y,"onPostUnpause");return o.paused=!1,w==null||w(),d(),_(),X(),O==null||O(),this},updateContainerElements:function(y){var w=[].concat(y).filter(Boolean);return o.containers=w.map(function(O){return typeof O=="string"?r.querySelector(O):O}),o.active&&d(),X(),this}},l.updateContainerElements(e),l};function R_(n={}){let e;const{immediate:t,...r}=n,i=ns(!1),s=ns(!1),o=f=>e==null?void 0:e.activate(f),l=f=>{e==null||e.deactivate(f)},a=()=>{e&&(e.pause(),s.set(!0))},c=()=>{e&&(e.unpause(),s.set(!1))};return{useFocusTrap:f=>(e=I_(f,{...r,onActivate(){var d;i.set(!0),(d=n.onActivate)==null||d.call(n)},onDeactivate(){var d;i.set(!1),(d=n.onDeactivate)==null||d.call(n)}}),t&&o(),{destroy(){l(),e=void 0}}),hasFocus:Yd(i),isPaused:Yd(s),activate:o,deactivate:l,pause:a,unpause:c}}const P_=(n,e="body")=>{let t;if(!Fr(e)&&typeof e!="string")return{destroy:bt};async function r(s){if(e=s,typeof e=="string"){if(t=document.querySelector(e),t===null&&(await Mf(),t=document.querySelector(e)),t===null)throw new Error(`No element found matching css selector: "${e}"`)}else if(e instanceof HTMLElement)t=e;else throw new TypeError(`Unknown portal target type: ${e===null?"null":typeof e}. Allowed types: string (CSS selector) or HTMLElement.`);n.dataset.portal="",t.appendChild(n),n.hidden=!1}function i(){n.remove()}return r(e),{update:r,destroy:i}};function L_(){return{elements:{root:Sr("label",{action:e=>({destroy:js(e,"mousedown",r=>{!r.defaultPrevented&&r.detail>1&&r.preventDefault()})})})}}}const{name:Xr}=LC("dialog"),B_={preventScroll:!0,closeOnEscape:!0,closeOnOutsideClick:!0,role:"dialog",defaultOpen:!1,portal:"body",forceVisible:!1,openFocus:void 0,closeFocus:void 0,onOutsideClick:void 0},Uc=ns([]),F_=["content","title","description"];function z_(n){const e={...B_,...n},t=rp(UC(e,"ids")),{preventScroll:r,closeOnEscape:i,closeOnOutsideClick:s,role:o,portal:l,forceVisible:a,openFocus:c,closeFocus:u,onOutsideClick:f}=t,d=ns(null),h=rp({...JC(F_),...e.ids}),p=e.open??ns(e.defaultOpen),m=jC(p,e==null?void 0:e.onOpenChange),g=Ua([m,a],([$,y])=>$||y);let b=bt;function C($){const y=$.currentTarget,w=$.currentTarget;!Fr(y)||!Fr(w)||(m.set(!0),d.set(w))}function E(){m.set(!1),ip({prop:jt(u),defaultEl:jt(d)})}Cr([m],([$])=>{Ub(100).then(()=>{$?Uc.update(y=>(y.push(jt(h.content)),y)):Uc.update(y=>y.filter(w=>w!==jt(h.content)))})});const v=Sr(Xr("trigger"),{stores:[m],returned:([$])=>({"aria-haspopup":"dialog","aria-expanded":$,type:"button"}),action:$=>({destroy:gl(js($,"click",w=>{C(w)}),js($,"keydown",w=>{w.key!==Ws.ENTER&&w.key!==Ws.SPACE||(w.preventDefault(),C(w))}))})}),H=Sr(Xr("overlay"),{stores:[g],returned:([$])=>({hidden:$?void 0:!0,tabindex:-1,style:Fu({display:$?void 0:"none"}),"aria-hidden":!0,"data-state":$?"open":"closed"}),action:$=>{let y=bt;if(jt(i)){const w=sp($,{handler:()=>{E()}});w&&w.destroy&&(y=w.destroy)}return{destroy(){y()}}}}),_=Sr(Xr("content"),{stores:[g,h.content,h.description,h.title],returned:([$,y,w,O])=>({id:y,role:jt(o),"aria-describedby":w,"aria-labelledby":O,"aria-modal":$?"true":void 0,"data-state":$?"open":"closed",tabindex:-1,hidden:$?void 0:!0,style:Fu({display:$?void 0:"none"})}),action:$=>{let y=bt,w=bt;const O=gl(Cr([m],([L])=>{if(!L)return;const A=R_({immediate:!1,escapeDeactivates:!0,clickOutsideDeactivates:!0,returnFocusOnDeactivate:!1,fallbackFocus:$});y=A.activate,w=A.deactivate;const z=A.useFocusTrap($);return z&&z.destroy?z.destroy:A.deactivate}),Cr([s,m],([L,A])=>l_($,{enabled:A,handler:z=>{var te;if((te=jt(f))==null||te(z),z.defaultPrevented)return;const q=jt(Uc),Y=PC(q)===jt(h.content);L&&Y&&E()}}).destroy),Cr([i],([L])=>{if(!L)return bt;const A=sp($,{handler:()=>{E()}});return A&&A.destroy?A.destroy:bt}),Cr([g],([L])=>{Mf().then(()=>{L?y():w()})}));return{destroy:()=>{b(),O()}}}}),B=Sr(Xr("portalled"),{stores:l,returned:$=>({"data-portal":$?"":void 0}),action:$=>{const y=Cr([l],([w])=>{if(!w)return bt;const O=s_($,w);if(O===null)return bt;const L=P_($,O);return L&&L.destroy?L.destroy:bt});return{destroy(){y()}}}}),F=Sr(Xr("title"),{stores:[h.title],returned:([$])=>({id:$})}),M=Sr(Xr("description"),{stores:[h.description],returned:([$])=>({id:$})}),X=Sr(Xr("close"),{returned:()=>({type:"button"}),action:$=>({destroy:gl(js($,"click",()=>{E()}),js($,"keydown",w=>{w.key!==Ws.SPACE&&w.key!==Ws.ENTER||(w.preventDefault(),E())}))})});return Cr([m,r],([$,y])=>{if(BC){if(y&&$&&(b=n_()),$){const w=document.getElementById(jt(h.content));ip({prop:jt(c),defaultEl:w})}return()=>{jt(a)||b()}}}),{ids:h,elements:{content:_,trigger:v,title:F,description:M,overlay:H,close:X,portalled:B},states:{open:m},options:t}}function Zb(n,e){const t={};return e.forEach(r=>{t[r]={[`data-${n}-${r}`]:""}}),r=>t[r]}function Qf(){const n=M1();return e=>{const{originalEvent:t}=e.detail,{cancelable:r}=e,i=t.type;n(i,{originalEvent:t,currentTarget:t.currentTarget},{cancelable:r})||e.preventDefault()}}function V_(n){const e={};for(const t in n){const r=n[t];r!==void 0&&(e[t]=r)}return e}function H_(n){return function(e,t){if(t===void 0)return;const r=n[e];r&&r.set(t)}}function U_(n,e){const t=[];return e.builders.forEach(r=>{const i=r.action(n);i&&t.push(i)}),{destroy:()=>{t.forEach(r=>{r.destroy&&r.destroy()})}}}function dp(n){const e={};return n.forEach(t=>{Object.keys(t).forEach(r=>{r!=="action"&&(e[r]=t[r])})}),e}function j_(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&jc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),ne(s,t,o),r=!0},p(s,o){s[1],e?ce(e,s[1]?"a":"button")?(i.d(1),i=jc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=jc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function W_(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&Wc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),ne(s,t,o),r=!0},p(s,o){s[1],e?ce(e,s[1]?"a":"button")?(i.d(1),i=Wc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=Wc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function jc(n){let e,t,r,i,s;const o=n[7].default,l=re(o,n,n[6],null);let a=[{type:t=n[1]?void 0:n[2]},{href:n[1]},{tabindex:"0"},n[5],n[4]],c={};for(let u=0;u{o[u]=null}),En(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function K_(n,e,t){const r=["href","type","builders","el"];let i=Te(e,r),{$$slots:s={},$$scope:o}=e,{href:l=void 0}=e,{type:a=void 0}=e,{builders:c=[]}=e,{el:u=void 0}=e;const f={"data-button-root":""};function d(M){pe.call(this,n,M)}function h(M){pe.call(this,n,M)}function p(M){pe.call(this,n,M)}function m(M){pe.call(this,n,M)}function g(M){pe.call(this,n,M)}function b(M){pe.call(this,n,M)}function C(M){pe.call(this,n,M)}function E(M){pe.call(this,n,M)}function v(M){pe.call(this,n,M)}function H(M){pe.call(this,n,M)}function _(M){pe.call(this,n,M)}function B(M){pe.call(this,n,M)}function F(M){nt[M?"unshift":"push"](()=>{u=M,t(0,u)})}return n.$$set=M=>{e=T(T({},e),J(M)),t(5,i=Te(e,r)),"href"in M&&t(1,l=M.href),"type"in M&&t(2,a=M.type),"builders"in M&&t(3,c=M.builders),"el"in M&&t(0,u=M.el),"$$scope"in M&&t(6,o=M.$$scope)},[u,l,a,c,f,i,o,s,d,h,p,m,g,b,C,E,v,H,_,B,F]}let J_=class extends fe{constructor(e){super(),de(this,e,K_,q_,ce,{href:1,type:2,builders:3,el:0})}};function ey(){return{NAME:"dialog",PARTS:["close","content","description","overlay","portal","title","trigger"]}}function G_(n){const{NAME:e,PARTS:t}=ey(),r=Zb(e,t),i={...z_({...V_(n),role:"dialog",forceVisible:!0}),getAttrs:r};return $1(e,i),{...i,updateOption:H_(i.options)}}function Mi(){const{NAME:n}=ey();return N1(n)}const Y_=n=>({ids:n&1}),hp=n=>({ids:n[0]});function X_(n){let e;const t=n[12].default,r=re(t,n,n[11],hp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,[s]){r&&r.p&&(!e||s&2049)&&ie(r,t,i,i[11],e?oe(t,i[11],s,Y_):se(i[11]),hp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function Q_(n,e,t){let r,{$$slots:i={},$$scope:s}=e,{preventScroll:o=void 0}=e,{closeOnEscape:l=void 0}=e,{closeOnOutsideClick:a=void 0}=e,{portal:c=void 0}=e,{open:u=void 0}=e,{onOpenChange:f=void 0}=e,{openFocus:d=void 0}=e,{closeFocus:h=void 0}=e,{onOutsideClick:p=void 0}=e;const{states:{open:m},updateOption:g,ids:b}=G_({closeOnEscape:l,preventScroll:o,closeOnOutsideClick:a,portal:c,forceVisible:!0,defaultOpen:u,openFocus:d,closeFocus:h,onOutsideClick:p,onOpenChange:({next:E})=>(u!==E&&(f==null||f(E),t(2,u=E)),E)}),C=Ua([b.content,b.description,b.title],([E,v,H])=>({content:E,description:v,title:H}));return An(n,C,E=>t(0,r=E)),n.$$set=E=>{"preventScroll"in E&&t(3,o=E.preventScroll),"closeOnEscape"in E&&t(4,l=E.closeOnEscape),"closeOnOutsideClick"in E&&t(5,a=E.closeOnOutsideClick),"portal"in E&&t(6,c=E.portal),"open"in E&&t(2,u=E.open),"onOpenChange"in E&&t(7,f=E.onOpenChange),"openFocus"in E&&t(8,d=E.openFocus),"closeFocus"in E&&t(9,h=E.closeFocus),"onOutsideClick"in E&&t(10,p=E.onOutsideClick),"$$scope"in E&&t(11,s=E.$$scope)},n.$$.update=()=>{n.$$.dirty&4&&u!==void 0&&m.set(u),n.$$.dirty&8&&g("preventScroll",o),n.$$.dirty&16&&g("closeOnEscape",l),n.$$.dirty&32&&g("closeOnOutsideClick",a),n.$$.dirty&64&&g("portal",c),n.$$.dirty&256&&g("openFocus",d),n.$$.dirty&512&&g("closeFocus",h),n.$$.dirty&1024&&g("onOutsideClick",p)},[r,C,u,o,l,a,c,f,d,h,p,s,i]}class Z_ extends fe{constructor(e){super(),de(this,e,Q_,X_,ce,{preventScroll:3,closeOnEscape:4,closeOnOutsideClick:5,portal:6,open:2,onOpenChange:7,openFocus:8,closeFocus:9,onOutsideClick:10})}}const eA=n=>({builder:n&8}),pp=n=>({builder:n[3]}),tA=n=>({builder:n&8}),mp=n=>({builder:n[3]});function nA(n){let e=n[1],t,r,i=n[1]&&qc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),ne(s,t,o),r=!0},p(s,o){s[1]?e?ce(e,s[1])?(i.d(1),i=qc(s),e=s[1],i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=qc(s),e=s[1],i.c(),i.m(t.parentNode,t)):e&&(i.d(1),i=null,e=s[1])},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function rA(n){let e;const t=n[9].default,r=re(t,n,n[8],mp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&264)&&ie(r,t,i,i[8],e?oe(t,i[8],s,tA):se(i[8]),mp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function qc(n){let e,t,r,i;const s=n[9].default,o=re(s,n,n[8],pp);let l=[n[3],n[5]],a={};for(let c=0;c{o[u]=null}),En(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function sA(n,e,t){let r;const i=["level","asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{level:c="h2"}=e,{asChild:u=!1}=e,{id:f=void 0}=e,{el:d=void 0}=e;const{elements:{title:h},ids:p,getAttrs:m}=Mi();An(n,h,C=>t(7,o=C));const g=m("title");function b(C){nt[C?"unshift":"push"](()=>{d=C,t(0,d)})}return n.$$set=C=>{e=T(T({},e),J(C)),t(5,s=Te(e,i)),"level"in C&&t(1,c=C.level),"asChild"in C&&t(2,u=C.asChild),"id"in C&&t(6,f=C.id),"el"in C&&t(0,d=C.el),"$$scope"in C&&t(8,a=C.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&f&&p.title.set(f),n.$$.dirty&128&&t(3,r=o),n.$$.dirty&8&&Object.assign(r,g)},[d,c,u,r,h,s,f,o,a,l,b]}let oA=class extends fe{constructor(e){super(),de(this,e,sA,iA,ce,{level:1,asChild:2,id:6,el:0})}};const lA=n=>({builder:n&4}),gp=n=>({builder:n[2]}),aA=n=>({builder:n&4}),bp=n=>({builder:n[2]});function cA(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],gp);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),En(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function dA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{close:f},getAttrs:d}=Mi();An(n,f,g=>t(6,o=g));const h=Qf(),p=d("close");function m(g){nt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=T(T({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class hA extends fe{constructor(e){super(),de(this,e,dA,fA,ce,{asChild:1,el:0})}}const pA=n=>({builder:n&4}),yp=n=>({builder:n[2]}),mA=n=>({builder:n&4}),vp=n=>({builder:n[2]});function gA(n){let e,t,r,i;const s=n[7].default,o=re(s,n,n[6],yp);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),En(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function vA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{portalled:f},getAttrs:d}=Mi();An(n,f,m=>t(5,o=m));const h=d("portal");function p(m){nt[m?"unshift":"push"](()=>{u=m,t(0,u)})}return n.$$set=m=>{e=T(T({},e),J(m)),t(4,s=Te(e,i)),"asChild"in m&&t(1,c=m.asChild),"el"in m&&t(0,u=m.el),"$$scope"in m&&t(6,a=m.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,h)},[u,c,r,f,s,o,a,l,p]}let wA=class extends fe{constructor(e){super(),de(this,e,vA,yA,ce,{asChild:1,el:0})}};const kA=n=>({builder:n[0]&256}),wp=n=>({builder:n[8]}),SA=n=>({builder:n[0]&256}),kp=n=>({builder:n[8]}),CA=n=>({builder:n[0]&256}),Sp=n=>({builder:n[8]}),_A=n=>({builder:n[0]&256}),Cp=n=>({builder:n[8]}),AA=n=>({builder:n[0]&256}),_p=n=>({builder:n[8]}),TA=n=>({builder:n[0]&256}),Ap=n=>({builder:n[8]});function EA(n){let e,t,r,i;const s=n[16].default,o=re(s,n,n[15],wp);let l=[n[8],n[12]],a={};for(let c=0;c{t=Ha(e,n[3],n[4]),t.start()})),r=!0)},o(u){S(l,u),r=!1},d(u){u&&j(e),l&&l.d(u),n[34](null),i=!1,Nt(s)}}}function $A(n){let e,t,r,i,s,o;const l=n[16].default,a=re(l,n,n[15],Cp);let c=[n[8],n[12]],u={};for(let f=0;f{i&&(r&&r.end(1),t=Ha(e,n[3],n[4]),t.start())}),i=!0)},o(f){S(a,f),t&&t.invalidate(),f&&(r=Va(e,n[5],n[6])),i=!1},d(f){f&&j(e),a&&a.d(f),n[33](null),f&&r&&r.end(),s=!1,Nt(o)}}}function NA(n){let e,t,r,i,s;const o=n[16].default,l=re(o,n,n[15],_p);let a=[n[8],n[12]],c={};for(let u=0;u{r&&(t||(t=Nl(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(u){S(l,u),u&&(t||(t=Nl(e,n[1],n[2],!1)),t.run(0)),r=!1},d(u){u&&j(e),l&&l.d(u),n[32](null),u&&t&&t.end(),i=!1,Nt(s)}}}function DA(n){let e;const t=n[16].default,r=re(t,n,n[15],Ap);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[0]&33024)&&ie(r,t,i,i[15],e?oe(t,i[15],s,TA):se(i[15]),Ap)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function xA(n){let e,t,r,i;const s=[DA,NA,$A,OA,MA,EA],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=We()},l(a){t&&t.l(a),r=We()},m(a,c){~e&&o[e].m(a,c),ne(a,r,c),i=!0},p(a,c){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(Tn(),S(o[u],1,1,()=>{o[u]=null}),En()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function IA(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","id","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{id:b=void 0}=e,{el:C=void 0}=e;const{elements:{content:E},states:{open:v},ids:H,getAttrs:_}=Mi();An(n,E,W=>t(14,o=W)),An(n,v,W=>t(9,l=W));const B=_("content");function F(W){pe.call(this,n,W)}function M(W){pe.call(this,n,W)}function X(W){pe.call(this,n,W)}function $(W){pe.call(this,n,W)}function y(W){pe.call(this,n,W)}function w(W){pe.call(this,n,W)}function O(W){pe.call(this,n,W)}function L(W){pe.call(this,n,W)}function A(W){pe.call(this,n,W)}function z(W){pe.call(this,n,W)}function q(W){pe.call(this,n,W)}function Y(W){pe.call(this,n,W)}function te(W){pe.call(this,n,W)}function ge(W){pe.call(this,n,W)}function ye(W){pe.call(this,n,W)}function me(W){nt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Ke(W){nt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Fe(W){nt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Qe(W){nt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Xe(W){nt[W?"unshift":"push"](()=>{C=W,t(0,C)})}return n.$$set=W=>{e=T(T({},e),J(W)),t(12,s=Te(e,i)),"transition"in W&&t(1,u=W.transition),"transitionConfig"in W&&t(2,f=W.transitionConfig),"inTransition"in W&&t(3,d=W.inTransition),"inTransitionConfig"in W&&t(4,h=W.inTransitionConfig),"outTransition"in W&&t(5,p=W.outTransition),"outTransitionConfig"in W&&t(6,m=W.outTransitionConfig),"asChild"in W&&t(7,g=W.asChild),"id"in W&&t(13,b=W.id),"el"in W&&t(0,C=W.el),"$$scope"in W&&t(15,c=W.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&8192&&b&&H.content.set(b),n.$$.dirty[0]&16384&&t(8,r=o),n.$$.dirty[0]&256&&Object.assign(r,B)},[C,u,f,d,h,p,m,g,r,l,E,v,s,b,o,c,a,F,M,X,$,y,w,O,L,A,z,q,Y,te,ge,ye,me,Ke,Fe,Qe,Xe]}let RA=class extends fe{constructor(e){super(),de(this,e,IA,xA,ce,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,id:13,el:0},null,[-1,-1])}};const PA=n=>({builder:n&256}),Tp=n=>({builder:n[8]});function LA(n){let e,t,r,i=[n[8],n[12]],s={};for(let o=0;o{t=Ha(e,n[3],n[4]),t.start()}))},o:Oe,d(l){l&&j(e),n[23](null),r=!1,Nt(i)}}}function zA(n){let e,t,r,i,s,o,l=[n[8],n[12]],a={};for(let c=0;c{i&&(r&&r.end(1),t=Ha(e,n[3],n[4]),t.start())}),i=!0)},o(c){t&&t.invalidate(),c&&(r=Va(e,n[5],n[6])),i=!1},d(c){c&&j(e),n[22](null),c&&r&&r.end(),s=!1,Nt(o)}}}function VA(n){let e,t,r,i,s,o=[n[8],n[12]],l={};for(let a=0;a{r&&(t||(t=Nl(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(a){a&&(t||(t=Nl(e,n[1],n[2],!1)),t.run(0)),r=!1},d(a){a&&j(e),n[21](null),a&&t&&t.end(),i=!1,Nt(s)}}}function HA(n){let e;const t=n[15].default,r=re(t,n,n[14],Tp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16640)&&ie(r,t,i,i[14],e?oe(t,i[14],s,PA):se(i[14]),Tp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function UA(n){let e,t,r,i;const s=[HA,VA,zA,FA,BA,LA],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=We()},l(a){t&&t.l(a),r=We()},m(a,c){~e&&o[e].m(a,c),ne(a,r,c),i=!0},p(a,[c]){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(Tn(),S(o[u],1,1,()=>{o[u]=null}),En()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function jA(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{el:b=void 0}=e;const{elements:{overlay:C},states:{open:E},getAttrs:v}=Mi();An(n,C,A=>t(13,o=A)),An(n,E,A=>t(9,l=A));const H=v("overlay");function _(A){pe.call(this,n,A)}function B(A){pe.call(this,n,A)}function F(A){pe.call(this,n,A)}function M(A){pe.call(this,n,A)}function X(A){pe.call(this,n,A)}function $(A){nt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function y(A){nt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function w(A){nt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function O(A){nt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function L(A){nt[A?"unshift":"push"](()=>{b=A,t(0,b)})}return n.$$set=A=>{e=T(T({},e),J(A)),t(12,s=Te(e,i)),"transition"in A&&t(1,u=A.transition),"transitionConfig"in A&&t(2,f=A.transitionConfig),"inTransition"in A&&t(3,d=A.inTransition),"inTransitionConfig"in A&&t(4,h=A.inTransitionConfig),"outTransition"in A&&t(5,p=A.outTransition),"outTransitionConfig"in A&&t(6,m=A.outTransitionConfig),"asChild"in A&&t(7,g=A.asChild),"el"in A&&t(0,b=A.el),"$$scope"in A&&t(14,c=A.$$scope)},n.$$.update=()=>{n.$$.dirty&8192&&t(8,r=o),n.$$.dirty&256&&Object.assign(r,H)},[b,u,f,d,h,p,m,g,r,l,C,E,s,o,c,a,_,B,F,M,X,$,y,w,O,L]}let WA=class extends fe{constructor(e){super(),de(this,e,jA,UA,ce,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,el:0})}};const qA=n=>({builder:n&4}),Ep=n=>({builder:n[2]}),KA=n=>({builder:n&4}),Mp=n=>({builder:n[2]});function JA(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],Ep);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),En(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function XA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{trigger:f},getAttrs:d}=Mi();An(n,f,g=>t(6,o=g));const h=Qf(),p=d("trigger");function m(g){nt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=T(T({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class QA extends fe{constructor(e){super(),de(this,e,XA,YA,ce,{asChild:1,el:0})}}const ZA=n=>({builder:n&4}),Op=n=>({builder:n[2]}),eT=n=>({builder:n&4}),$p=n=>({builder:n[2]});function tT(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],Op);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),En(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function iT(n,e,t){let r;const i=["asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{id:u=void 0}=e,{el:f=void 0}=e;const{elements:{description:d},ids:h,getAttrs:p}=Mi();An(n,d,b=>t(6,o=b));const m=p("description");function g(b){nt[b?"unshift":"push"](()=>{f=b,t(0,f)})}return n.$$set=b=>{e=T(T({},e),J(b)),t(4,s=Te(e,i)),"asChild"in b&&t(1,c=b.asChild),"id"in b&&t(5,u=b.id),"el"in b&&t(0,f=b.el),"$$scope"in b&&t(7,a=b.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&u&&h.description.set(u),n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,m)},[f,c,r,d,s,u,o,a,l,g]}let sT=class extends fe{constructor(e){super(),de(this,e,iT,rT,ce,{asChild:1,id:5,el:0})}};function oT(){const n="label",t=Zb(n,["root"]);return{NAME:n,getAttrs:t}}const lT=n=>({builder:n&4}),Np=n=>({builder:n[2]}),aT=n=>({builder:n&4}),Dp=n=>({builder:n[2]});function cT(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],Np);let l=[n[2],n[5]],a={};for(let c=0;c{o[u]=null}),En(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function dT(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{root:f}}=L_();An(n,f,g=>t(6,o=g));const d=Qf(),{getAttrs:h}=oT(),p=h("root");function m(g){nt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=T(T({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,d,s,o,a,l,m]}let hT=class extends fe{constructor(e){super(),de(this,e,dT,fT,ce,{asChild:1,el:0})}};function ty(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;el(s)))==null?void 0:o.classGroupId}const xp=/^\[(.+)\]$/;function gT(n){if(xp.test(n)){const e=xp.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}}function bT(n){const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return vT(Object.entries(n.classGroups),t).forEach(([s,o])=>{Vu(o,r,s,e)}),r}function Vu(n,e,t,r){n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Ip(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(yT(i)){Vu(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Vu(o,Ip(e,s),t,r)})})}function Ip(n,e){let t=n;return e.split(Zf).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t}function yT(n){return n.isThemeGetter}function vT(n,e){return e?n.map(([t,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[e+o,l])):s);return[t,i]}):n}function wT(n){if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;function i(s,o){t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)}return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}}const ry="!";function kT(n){const e=n.separator,t=e.length===1,r=e[0],i=e.length;return function(o){const l=[];let a=0,c=0,u;for(let m=0;mc?u-c:void 0;return{modifiers:l,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}}}function ST(n){if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e}function CT(n){return{cache:wT(n.cacheSize),splitModifiers:kT(n),...mT(n)}}const _T=/\s+/;function AT(n,e){const{splitModifiers:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=new Set;return n.trim().split(_T).map(o=>{const{modifiers:l,hasImportantModifier:a,baseClassName:c,maybePostfixModifierPosition:u}=t(o);let f=r(u?c.substring(0,u):c),d=!!u;if(!f){if(!u)return{isTailwindClass:!1,originalClassName:o};if(f=r(c),!f)return{isTailwindClass:!1,originalClassName:o};d=!1}const h=ST(l).join(":");return{isTailwindClass:!0,modifierId:a?h+ry:h,classGroupId:f,originalClassName:o,hasPostfixModifier:d}}).reverse().filter(o=>{if(!o.isTailwindClass)return!0;const{modifierId:l,classGroupId:a,hasPostfixModifier:c}=o,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(f=>s.add(l+f)),!0)}).reverse().map(o=>o.originalClassName).join(" ")}function TT(){let n=0,e,t,r="";for(;nf(u),n());return t=CT(c),r=t.cache.get,i=t.cache.set,s=l,l(a)}function l(a){const c=r(a);if(c)return c;const u=AT(a,t);return i(a,u),u}return function(){return s(TT.apply(null,arguments))}}function Ge(n){const e=t=>t[n]||[];return e.isThemeGetter=!0,e}const sy=/^\[(?:([a-z-]+):)?(.+)\]$/i,MT=/^\d+\/\d+$/,OT=new Set(["px","full","screen"]),$T=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NT=/\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$/,DT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,IT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function nr(n){return si(n)||OT.has(n)||MT.test(n)}function gr(n){return Ss(n,"length",HT)}function si(n){return!!n&&!Number.isNaN(Number(n))}function el(n){return Ss(n,"number",si)}function Rs(n){return!!n&&Number.isInteger(Number(n))}function RT(n){return n.endsWith("%")&&si(n.slice(0,-1))}function ke(n){return sy.test(n)}function br(n){return $T.test(n)}const PT=new Set(["length","size","percentage"]);function LT(n){return Ss(n,PT,oy)}function BT(n){return Ss(n,"position",oy)}const FT=new Set(["image","url"]);function zT(n){return Ss(n,FT,jT)}function VT(n){return Ss(n,"",UT)}function Ps(){return!0}function Ss(n,e,t){const r=sy.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1}function HT(n){return NT.test(n)&&!DT.test(n)}function oy(){return!1}function UT(n){return xT.test(n)}function jT(n){return IT.test(n)}function WT(){const n=Ge("colors"),e=Ge("spacing"),t=Ge("blur"),r=Ge("brightness"),i=Ge("borderColor"),s=Ge("borderRadius"),o=Ge("borderSpacing"),l=Ge("borderWidth"),a=Ge("contrast"),c=Ge("grayscale"),u=Ge("hueRotate"),f=Ge("invert"),d=Ge("gap"),h=Ge("gradientColorStops"),p=Ge("gradientColorStopPositions"),m=Ge("inset"),g=Ge("margin"),b=Ge("opacity"),C=Ge("padding"),E=Ge("saturate"),v=Ge("scale"),H=Ge("sepia"),_=Ge("skew"),B=Ge("space"),F=Ge("translate"),M=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",ke,e],y=()=>[ke,e],w=()=>["",nr,gr],O=()=>["auto",si,ke],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],A=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],q=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",ke],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ge=()=>[si,el],ye=()=>[si,ke];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[nr,gr],blur:["none","",br,ke],brightness:ge(),borderColor:[n],borderRadius:["none","","full",br,ke],borderSpacing:y(),borderWidth:w(),contrast:ge(),grayscale:Y(),hueRotate:ye(),invert:Y(),gap:y(),gradientColorStops:[n],gradientColorStopPositions:[RT,gr],inset:$(),margin:$(),opacity:ge(),padding:y(),saturate:ge(),scale:ge(),sepia:Y(),skew:ye(),space:y(),translate:y()},classGroups:{aspect:[{aspect:["auto","square","video",ke]}],container:["container"],columns:[{columns:[br]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"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:[...L(),ke]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rs,ke]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ke]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",Rs,ke]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Rs,ke]},ke]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Rs,ke]},ke]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ke]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ke,e]}],"min-w":[{"min-w":[ke,e,"min","max","fit"]}],"max-w":[{"max-w":[ke,e,"none","full","min","max","fit","prose",{screen:[br]},br]}],h:[{h:[ke,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ke,e,"auto","min","max","fit"]}],"font-size":[{text:["base",br,gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",el]}],"font-family":[{font:[Ps]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ke]}],"line-clamp":[{"line-clamp":["none",si,el]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",nr,ke]}],"list-image":[{"list-image":["none",ke]}],"list-style-type":[{list:["none","disc","decimal",ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...A(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",nr,gr]}],"underline-offset":[{"underline-offset":["auto",nr,ke]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke]}],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",ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),BT]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LT]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},zT]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...A(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:A()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...A()]}],"outline-offset":[{"outline-offset":[nr,ke]}],"outline-w":[{outline:[nr,gr]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:w()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[nr,gr]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",br,VT]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":z()}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",br,ke]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[E]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"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",ke]}],duration:[{duration:ye()}],ease:[{ease:["linear","in","out","in-out",ke]}],delay:[{delay:ye()}],animate:[{animate:["none","spin","ping","pulse","bounce",ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[v]}],"scale-x":[{"scale-x":[v]}],"scale-y":[{"scale-y":[v]}],rotate:[{rotate:[Rs,ke]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ke]}],accent:[{accent:["auto",n]}],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",ke]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"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",ke]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[nr,gr,el]}],stroke:[{stroke:[n,"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-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"]}}}const qT=ET(WT);function KT(n){const e=n-1;return e*e*e+1}function _t(...n){return qT(pT(n))}const JT=(n,e={y:-8,x:0,start:.95,duration:150})=>{const t=getComputedStyle(n),r=t.transform==="none"?"":t.transform,i=(o,l,a)=>{const[c,u]=l,[f,d]=a;return(o-c)/(u-c)*(d-f)+f},s=o=>Object.keys(o).reduce((l,a)=>o[a]===void 0?l:l+`${a}:${o[a]};`,"");return{duration:e.duration??200,delay:0,css:o=>{const l=i(o,[0,1],[e.y??5,0]),a=i(o,[0,1],[e.x??0,0]),c=i(o,[0,1],[e.start??.95,1]);return s({transform:`${r} translate3d(${a}px, ${l}px, 0) scale(${c})`,opacity:o})},easing:KT}};function GT(n){let e;const t=n[5].default,r=re(t,n,n[8],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&256)&&ie(r,t,i,i[8],e?oe(t,i[8],s,null):se(i[8]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function YT(n){let e,t;const r=[{builders:n[3]},{class:_t(Vp({variant:n[1],size:n[2],className:n[0]}))},{type:"button"},n[4]];let i={$$slots:{default:[GT]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(h)),t(4,i=Te(e,r)),"class"in h&&t(0,l=h.class),"variant"in h&&t(1,a=h.variant),"size"in h&&t(2,c=h.size),"builders"in h&&t(3,u=h.builders),"$$scope"in h&&t(8,o=h.$$scope)},[l,a,c,u,i,s,f,d,o]}class Be extends fe{constructor(e){super(),de(this,e,XT,YT,ce,{class:0,variant:1,size:2,builders:3})}}var Rp=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Xt=n=>!n||typeof n!="object"||Object.keys(n).length===0,QT=(n,e)=>JSON.stringify(n)===JSON.stringify(e);function ly(n,e){n.forEach(function(t){Array.isArray(t)?ly(t,e):e.push(t)})}function ay(n){let e=[];return ly(n,e),e}var cy=(...n)=>ay(n).filter(Boolean),uy=(n,e)=>{let t={},r=Object.keys(n),i=Object.keys(e);for(let s of r)if(i.includes(s)){let o=n[s],l=e[s];typeof o=="object"&&typeof l=="object"?t[s]=uy(o,l):Array.isArray(o)||Array.isArray(l)?t[s]=cy(l,o):t[s]=l+" "+o}else t[s]=n[s];for(let s of i)r.includes(s)||(t[s]=e[s]);return t},Pp=n=>!n||typeof n!="string"?n:n.replace(/\s+/g," ").trim();function ZT(){for(var n=0,e,t,r="";nn&&(e=0,r=t,t=new Map)}return{get:function(o){var l=t.get(o);if(l!==void 0)return l;if((l=r.get(o))!==void 0)return i(o,l),l},set:function(o,l){t.has(o)?t.set(o,l):i(o,l)}}}var hy="!";function oE(n){var e=n.separator||":",t=e.length===1,r=e[0],i=e.length;return function(o){for(var l=[],a=0,c=0,u,f=0;fc?u-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}}}function lE(n){if(n.length<=1)return n;var e=[],t=[];return n.forEach(function(r){var i=r[0]==="[";i?(e.push.apply(e,t.sort().concat([r])),t=[]):t.push(r)}),e.push.apply(e,t.sort()),e}function aE(n){return{cache:sE(n.cacheSize),splitModifiers:oE(n),...eE(n)}}var cE=/\s+/;function uE(n,e){var t=e.splitModifiers,r=e.getClassGroupId,i=e.getConflictingClassGroupIds,s=new Set;return n.trim().split(cE).map(function(o){var l=t(o),a=l.modifiers,c=l.hasImportantModifier,u=l.baseClassName,f=l.maybePostfixModifierPosition,d=r(f?u.substring(0,f):u),h=!!f;if(!d){if(!f)return{isTailwindClass:!1,originalClassName:o};if(d=r(u),!d)return{isTailwindClass:!1,originalClassName:o};h=!1}var p=lE(a).join(":"),m=c?p+hy:p;return{isTailwindClass:!0,modifierId:m,classGroupId:d,originalClassName:o,hasPostfixModifier:h}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var l=o.modifierId,a=o.classGroupId,c=o.hasPostfixModifier,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(function(f){return s.add(l+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Uu(){for(var n=arguments.length,e=new Array(n),t=0;t1?e-1:0),r=1;rn||void 0,bo=(...n)=>by(ay(n).filter(Boolean).join(" ")),Kc=null,Yl={},qu=!1,Fs=(...n)=>e=>e.twMerge?((!Kc||qu)&&(qu=!1,Kc=Xt(Yl)?ME:EE(Yl)),by(Kc(bo(n)))):bo(n),zp=(n,e)=>{for(let t in e)n.hasOwnProperty(t)?n[t]=bo(n[t],e[t]):n[t]=e[t];return n},$E=(n,e)=>{let{extend:t=null,slots:r={},variants:i={},compoundVariants:s=[],compoundSlots:o=[],defaultVariants:l={}}=n,a={...OE,...e},c=t!=null&&t.base?bo(t.base,n==null?void 0:n.base):n==null?void 0:n.base,u=t!=null&&t.variants&&!Xt(t.variants)?uy(i,t.variants):i,f=t!=null&&t.defaultVariants&&!Xt(t.defaultVariants)?{...t.defaultVariants,...l}:l;!Xt(a.twMergeConfig)&&!QT(a.twMergeConfig,Yl)&&(qu=!0,Yl=a.twMergeConfig);let d=Xt(t==null?void 0:t.slots),h=Xt(r)?{}:{base:bo(n==null?void 0:n.base,d&&(t==null?void 0:t.base)),...r},p=d?h:zp({...t==null?void 0:t.slots},Xt(h)?{base:n==null?void 0:n.base}:h),m=b=>{if(Xt(u)&&Xt(r)&&d)return Fs(c,b==null?void 0:b.class,b==null?void 0:b.className)(a);if(s&&!Array.isArray(s))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof s}`);if(o&&!Array.isArray(o))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof o}`);let C=(y,w,O=[],L)=>{let A=O;if(typeof w=="string")A=A.concat(Pp(w).split(" ").map(z=>`${y}:${z}`));else if(Array.isArray(w))A=A.concat(w.reduce((z,q)=>z.concat(`${y}:${q}`),[]));else if(typeof w=="object"&&typeof L=="string"){for(let z in w)if(w.hasOwnProperty(z)&&z===L){let q=w[z];if(q&&typeof q=="string"){let Y=Pp(q);A[L]?A[L]=A[L].concat(Y.split(" ").map(te=>`${y}:${te}`)):A[L]=Y.split(" ").map(te=>`${y}:${te}`)}else Array.isArray(q)&&q.length>0&&(A[L]=q.reduce((Y,te)=>Y.concat(`${y}:${te}`),[]))}}return A},E=(y,w=u,O=null,L=null)=>{var A;let z=w[y];if(!z||Xt(z))return null;let q=(A=L==null?void 0:L[y])!=null?A:b==null?void 0:b[y];if(q===null)return null;let Y=Rp(q),te=Array.isArray(a.responsiveVariants)&&a.responsiveVariants.length>0||a.responsiveVariants===!0,ge=f==null?void 0:f[y],ye=[];if(typeof Y=="object"&&te)for(let[Ke,Fe]of Object.entries(Y)){let Qe=z[Fe];if(Ke==="initial"){ge=Fe;continue}Array.isArray(a.responsiveVariants)&&!a.responsiveVariants.includes(Ke)||(ye=C(Ke,Qe,ye,O))}let me=z[Y]||z[Rp(ge)];return typeof ye=="object"&&typeof O=="string"&&ye[O]?zp(ye,me):ye.length>0?(ye.push(me),ye):me},v=()=>u?Object.keys(u).map(y=>E(y,u)):null,H=(y,w)=>{if(!u||typeof u!="object")return null;let O=new Array;for(let L in u){let A=E(L,u,y,w),z=y==="base"&&typeof A=="string"?A:A&&A[y];z&&(O[O.length]=z)}return O},_={};for(let y in b)b[y]!==void 0&&(_[y]=b[y]);let B=(y,w)=>{var O;let L=typeof(b==null?void 0:b[y])=="object"?{[y]:(O=b[y])==null?void 0:O.initial}:{};return{...f,..._,...L,...w}},F=(y=[],w)=>{let O=[];for(let{class:L,className:A,...z}of y){let q=!0;for(let[Y,te]of Object.entries(z)){let ge=B(Y,w);if(Array.isArray(te)){if(!te.includes(ge[Y])){q=!1;break}}else if(ge[Y]!==te){q=!1;break}}q&&(L&&O.push(L),A&&O.push(A))}return O},M=y=>{let w=F(s,y),O=F(t==null?void 0:t.compoundVariants,y);return cy(O,w)},X=y=>{let w=M(y);if(!Array.isArray(w))return w;let O={};for(let L of w)if(typeof L=="string"&&(O.base=Fs(O.base,L)(a)),typeof L=="object")for(let[A,z]of Object.entries(L))O[A]=Fs(O[A],z)(a);return O},$=y=>{if(o.length<1)return null;let w={};for(let{slots:O=[],class:L,className:A,...z}of o){if(!Xt(z)){let q=!0;for(let Y of Object.keys(z)){let te=B(Y,y)[Y];if(te===void 0||(Array.isArray(z[Y])?!z[Y].includes(te):z[Y]!==te)){q=!1;break}}if(!q)continue}for(let q of O)w[q]=w[q]||[],w[q].push([L,A])}return w};if(!Xt(r)||!d){let y={};if(typeof p=="object"&&!Xt(p))for(let w of Object.keys(p))y[w]=O=>{var L,A;return Fs(p[w],H(w,O),((L=X(O))!=null?L:[])[w],((A=$(O))!=null?A:[])[w],O==null?void 0:O.class,O==null?void 0:O.className)(a)};return y}return Fs(c,v(),M(),b==null?void 0:b.class,b==null?void 0:b.className)(a)},g=()=>{if(!(!u||typeof u!="object"))return Object.keys(u)};return m.variantKeys=g(),m.extend=t,m.base=c,m.slots=p,m.variants=u,m.defaultVariants=f,m.compoundSlots=o,m.compoundVariants=s,m};const Vp=$E({base:"inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});/** +*/function lp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ap(n){for(var e=1;e0){var r=e[e.length-1];r!==t&&r.pause()}var i=e.indexOf(t);i===-1||e.splice(i,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},O_=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},$_=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},Ys=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},N_=function(e){return Ys(e)&&!e.shiftKey},D_=function(e){return Ys(e)&&e.shiftKey},up=function(e){return setTimeout(e,0)},fp=function(e,t){var r=-1;return e.every(function(i,s){return t(i)?(r=s,!1):!0}),r},Is=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?O-1:0),A=1;A=0)y=r.activeElement;else{var w=o.tabbableGroups[0],O=w&&w.firstTabbableNode;y=O||u("fallbackFocus")}if(!y)throw new Error("Your focus-trap needs to have at least one focusable element");return y},d=function(){if(o.containerGroups=o.containers.map(function(y){var w=C_(y,s.tabbableOptions),O=__(y,s.tabbableOptions),L=w.length>0?w[0]:void 0,A=w.length>0?w[w.length-1]:void 0,z=O.find(function(te){return Bi(te)}),q=O.slice().reverse().find(function(te){return Bi(te)}),Y=!!w.find(function(te){return ti(te)>0});return{container:y,tabbableNodes:w,focusableNodes:O,posTabIndexesFound:Y,firstTabbableNode:L,lastTabbableNode:A,firstDomTabbableNode:z,lastDomTabbableNode:q,nextTabbableNode:function(ge){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,me=w.indexOf(ge);return me<0?ye?O.slice(O.indexOf(ge)+1).find(function(Ke){return Bi(Ke)}):O.slice(0,O.indexOf(ge)).reverse().find(function(Ke){return Bi(Ke)}):w[me+(ye?1:-1)]}}}),o.tabbableGroups=o.containerGroups.filter(function(y){return y.tabbableNodes.length>0}),o.tabbableGroups.length<=0&&!u("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find(function(y){return y.posTabIndexesFound})&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function $(y){var w=y.activeElement;if(w)return w.shadowRoot&&w.shadowRoot.activeElement!==null?$(w.shadowRoot):w},p=function $(y){if(y!==!1&&y!==h(document)){if(!y||!y.focus){$(f());return}y.focus({preventScroll:!!s.preventScroll}),o.mostRecentlyFocusedNode=y,O_(y)&&y.select()}},m=function(y){var w=u("setReturnFocus",y);return w||(w===!1?!1:y)},g=function(y){var w=y.target,O=y.event,L=y.isBackward,A=L===void 0?!1:L;w=w||Zo(O),d();var z=null;if(o.tabbableGroups.length>0){var q=c(w,O),Y=q>=0?o.containerGroups[q]:void 0;if(q<0)A?z=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:z=o.tabbableGroups[0].firstTabbableNode;else if(A){var te=fp(o.tabbableGroups,function(Ze){var Qe=Ze.firstTabbableNode;return w===Qe});if(te<0&&(Y.container===w||Hc(w,s.tabbableOptions)&&!Bi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w,!1))&&(te=q),te>=0){var ge=te===0?o.tabbableGroups.length-1:te-1,ye=o.tabbableGroups[ge];z=ti(w)>=0?ye.lastTabbableNode:ye.lastDomTabbableNode}else Ys(O)||(z=Y.nextTabbableNode(w,!1))}else{var me=fp(o.tabbableGroups,function(Ze){var Qe=Ze.lastTabbableNode;return w===Qe});if(me<0&&(Y.container===w||Hc(w,s.tabbableOptions)&&!Bi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w))&&(me=q),me>=0){var Ke=me===o.tabbableGroups.length-1?0:me+1,Be=o.tabbableGroups[Ke];z=ti(w)>=0?Be.firstTabbableNode:Be.firstDomTabbableNode}else Ys(O)||(z=Y.nextTabbableNode(w))}}else z=u("fallbackFocus");return z},b=function(y){var w=Zo(y);if(!(c(w,y)>=0)){if(Is(s.clickOutsideDeactivates,y)){l.deactivate({returnFocus:s.returnFocusOnDeactivate});return}Is(s.allowOutsideClick,y)||y.preventDefault()}},C=function(y){var w=Zo(y),O=c(w,y)>=0;if(O||w instanceof Document)O&&(o.mostRecentlyFocusedNode=w);else{y.stopImmediatePropagation();var L,A=!0;if(o.mostRecentlyFocusedNode)if(ti(o.mostRecentlyFocusedNode)>0){var z=c(o.mostRecentlyFocusedNode),q=o.containerGroups[z].tabbableNodes;if(q.length>0){var Y=q.findIndex(function(te){return te===o.mostRecentlyFocusedNode});Y>=0&&(s.isKeyForward(o.recentNavEvent)?Y+1=0&&(L=q[Y-1],A=!1))}}else o.containerGroups.some(function(te){return te.tabbableNodes.some(function(ge){return ti(ge)>0})})||(A=!1);else A=!1;A&&(L=g({target:o.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(o.recentNavEvent)})),p(L||o.mostRecentlyFocusedNode||f())}o.recentNavEvent=void 0},E=function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;o.recentNavEvent=y;var O=g({event:y,isBackward:w});O&&(Ys(y)&&y.preventDefault(),p(O))},v=function(y){if($_(y)&&Is(s.escapeDeactivates,y)!==!1){y.preventDefault(),l.deactivate();return}(s.isKeyForward(y)||s.isKeyBackward(y))&&E(y,s.isKeyBackward(y))},H=function(y){var w=Zo(y);c(w,y)>=0||Is(s.clickOutsideDeactivates,y)||Is(s.allowOutsideClick,y)||(y.preventDefault(),y.stopImmediatePropagation())},_=function(){if(o.active)return cp.activateTrap(i,l),o.delayInitialFocusTimer=s.delayInitialFocus?up(function(){p(f())}):p(f()),r.addEventListener("focusin",C,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",H,{capture:!0,passive:!1}),r.addEventListener("keydown",v,{capture:!0,passive:!1}),l},B=function(){if(o.active)return r.removeEventListener("focusin",C,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",H,!0),r.removeEventListener("keydown",v,!0),l},F=function(y){var w=y.some(function(O){var L=Array.from(O.removedNodes);return L.some(function(A){return A===o.mostRecentlyFocusedNode})});w&&p(f())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(F):void 0,X=function(){M&&(M.disconnect(),o.active&&!o.paused&&o.containers.map(function(y){M.observe(y,{subtree:!0,childList:!0})}))};return l={get active(){return o.active},get paused(){return o.paused},activate:function(y){if(o.active)return this;var w=a(y,"onActivate"),O=a(y,"onPostActivate"),L=a(y,"checkCanFocusTrap");L||d(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,w==null||w();var A=function(){L&&d(),_(),X(),O==null||O()};return L?(L(o.containers.concat()).then(A,A),this):(A(),this)},deactivate:function(y){if(!o.active)return this;var w=ap({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},y);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,B(),o.active=!1,o.paused=!1,X(),cp.deactivateTrap(i,l);var O=a(w,"onDeactivate"),L=a(w,"onPostDeactivate"),A=a(w,"checkCanReturnFocus"),z=a(w,"returnFocus","returnFocusOnDeactivate");O==null||O();var q=function(){up(function(){z&&p(m(o.nodeFocusedBeforeActivation)),L==null||L()})};return z&&A?(A(m(o.nodeFocusedBeforeActivation)).then(q,q),this):(q(),this)},pause:function(y){if(o.paused||!o.active)return this;var w=a(y,"onPause"),O=a(y,"onPostPause");return o.paused=!0,w==null||w(),B(),X(),O==null||O(),this},unpause:function(y){if(!o.paused||!o.active)return this;var w=a(y,"onUnpause"),O=a(y,"onPostUnpause");return o.paused=!1,w==null||w(),d(),_(),X(),O==null||O(),this},updateContainerElements:function(y){var w=[].concat(y).filter(Boolean);return o.containers=w.map(function(O){return typeof O=="string"?r.querySelector(O):O}),o.active&&d(),X(),this}},l.updateContainerElements(e),l};function R_(n={}){let e;const{immediate:t,...r}=n,i=ns(!1),s=ns(!1),o=f=>e==null?void 0:e.activate(f),l=f=>{e==null||e.deactivate(f)},a=()=>{e&&(e.pause(),s.set(!0))},c=()=>{e&&(e.unpause(),s.set(!1))};return{useFocusTrap:f=>(e=I_(f,{...r,onActivate(){var d;i.set(!0),(d=n.onActivate)==null||d.call(n)},onDeactivate(){var d;i.set(!1),(d=n.onDeactivate)==null||d.call(n)}}),t&&o(),{destroy(){l(),e=void 0}}),hasFocus:Yd(i),isPaused:Yd(s),activate:o,deactivate:l,pause:a,unpause:c}}const P_=(n,e="body")=>{let t;if(!Fr(e)&&typeof e!="string")return{destroy:bt};async function r(s){if(e=s,typeof e=="string"){if(t=document.querySelector(e),t===null&&(await Mf(),t=document.querySelector(e)),t===null)throw new Error(`No element found matching css selector: "${e}"`)}else if(e instanceof HTMLElement)t=e;else throw new TypeError(`Unknown portal target type: ${e===null?"null":typeof e}. Allowed types: string (CSS selector) or HTMLElement.`);n.dataset.portal="",t.appendChild(n),n.hidden=!1}function i(){n.remove()}return r(e),{update:r,destroy:i}};function L_(){return{elements:{root:Sr("label",{action:e=>({destroy:js(e,"mousedown",r=>{!r.defaultPrevented&&r.detail>1&&r.preventDefault()})})})}}}const{name:Xr}=LC("dialog"),B_={preventScroll:!0,closeOnEscape:!0,closeOnOutsideClick:!0,role:"dialog",defaultOpen:!1,portal:"body",forceVisible:!1,openFocus:void 0,closeFocus:void 0,onOutsideClick:void 0},Uc=ns([]),F_=["content","title","description"];function z_(n){const e={...B_,...n},t=rp(UC(e,"ids")),{preventScroll:r,closeOnEscape:i,closeOnOutsideClick:s,role:o,portal:l,forceVisible:a,openFocus:c,closeFocus:u,onOutsideClick:f}=t,d=ns(null),h=rp({...JC(F_),...e.ids}),p=e.open??ns(e.defaultOpen),m=jC(p,e==null?void 0:e.onOpenChange),g=Ua([m,a],([$,y])=>$||y);let b=bt;function C($){const y=$.currentTarget,w=$.currentTarget;!Fr(y)||!Fr(w)||(m.set(!0),d.set(w))}function E(){m.set(!1),ip({prop:jt(u),defaultEl:jt(d)})}Cr([m],([$])=>{Ub(100).then(()=>{$?Uc.update(y=>(y.push(jt(h.content)),y)):Uc.update(y=>y.filter(w=>w!==jt(h.content)))})});const v=Sr(Xr("trigger"),{stores:[m],returned:([$])=>({"aria-haspopup":"dialog","aria-expanded":$,type:"button"}),action:$=>({destroy:gl(js($,"click",w=>{C(w)}),js($,"keydown",w=>{w.key!==Ws.ENTER&&w.key!==Ws.SPACE||(w.preventDefault(),C(w))}))})}),H=Sr(Xr("overlay"),{stores:[g],returned:([$])=>({hidden:$?void 0:!0,tabindex:-1,style:Fu({display:$?void 0:"none"}),"aria-hidden":!0,"data-state":$?"open":"closed"}),action:$=>{let y=bt;if(jt(i)){const w=sp($,{handler:()=>{E()}});w&&w.destroy&&(y=w.destroy)}return{destroy(){y()}}}}),_=Sr(Xr("content"),{stores:[g,h.content,h.description,h.title],returned:([$,y,w,O])=>({id:y,role:jt(o),"aria-describedby":w,"aria-labelledby":O,"aria-modal":$?"true":void 0,"data-state":$?"open":"closed",tabindex:-1,hidden:$?void 0:!0,style:Fu({display:$?void 0:"none"})}),action:$=>{let y=bt,w=bt;const O=gl(Cr([m],([L])=>{if(!L)return;const A=R_({immediate:!1,escapeDeactivates:!0,clickOutsideDeactivates:!0,returnFocusOnDeactivate:!1,fallbackFocus:$});y=A.activate,w=A.deactivate;const z=A.useFocusTrap($);return z&&z.destroy?z.destroy:A.deactivate}),Cr([s,m],([L,A])=>l_($,{enabled:A,handler:z=>{var te;if((te=jt(f))==null||te(z),z.defaultPrevented)return;const q=jt(Uc),Y=PC(q)===jt(h.content);L&&Y&&E()}}).destroy),Cr([i],([L])=>{if(!L)return bt;const A=sp($,{handler:()=>{E()}});return A&&A.destroy?A.destroy:bt}),Cr([g],([L])=>{Mf().then(()=>{L?y():w()})}));return{destroy:()=>{b(),O()}}}}),B=Sr(Xr("portalled"),{stores:l,returned:$=>({"data-portal":$?"":void 0}),action:$=>{const y=Cr([l],([w])=>{if(!w)return bt;const O=s_($,w);if(O===null)return bt;const L=P_($,O);return L&&L.destroy?L.destroy:bt});return{destroy(){y()}}}}),F=Sr(Xr("title"),{stores:[h.title],returned:([$])=>({id:$})}),M=Sr(Xr("description"),{stores:[h.description],returned:([$])=>({id:$})}),X=Sr(Xr("close"),{returned:()=>({type:"button"}),action:$=>({destroy:gl(js($,"click",()=>{E()}),js($,"keydown",w=>{w.key!==Ws.SPACE&&w.key!==Ws.ENTER||(w.preventDefault(),E())}))})});return Cr([m,r],([$,y])=>{if(BC){if(y&&$&&(b=n_()),$){const w=document.getElementById(jt(h.content));ip({prop:jt(c),defaultEl:w})}return()=>{jt(a)||b()}}}),{ids:h,elements:{content:_,trigger:v,title:F,description:M,overlay:H,close:X,portalled:B},states:{open:m},options:t}}function Zb(n,e){const t={};return e.forEach(r=>{t[r]={[`data-${n}-${r}`]:""}}),r=>t[r]}function Qf(){const n=M1();return e=>{const{originalEvent:t}=e.detail,{cancelable:r}=e,i=t.type;n(i,{originalEvent:t,currentTarget:t.currentTarget},{cancelable:r})||e.preventDefault()}}function V_(n){const e={};for(const t in n){const r=n[t];r!==void 0&&(e[t]=r)}return e}function H_(n){return function(e,t){if(t===void 0)return;const r=n[e];r&&r.set(t)}}function U_(n,e){const t=[];return e.builders.forEach(r=>{const i=r.action(n);i&&t.push(i)}),{destroy:()=>{t.forEach(r=>{r.destroy&&r.destroy()})}}}function dp(n){const e={};return n.forEach(t=>{Object.keys(t).forEach(r=>{r!=="action"&&(e[r]=t[r])})}),e}function j_(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&jc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),ne(s,t,o),r=!0},p(s,o){s[1],e?ce(e,s[1]?"a":"button")?(i.d(1),i=jc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=jc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function W_(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&Wc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),ne(s,t,o),r=!0},p(s,o){s[1],e?ce(e,s[1]?"a":"button")?(i.d(1),i=Wc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=Wc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function jc(n){let e,t,r,i,s;const o=n[7].default,l=re(o,n,n[6],null);let a=[{type:t=n[1]?void 0:n[2]},{href:n[1]},{tabindex:"0"},n[5],n[4]],c={};for(let u=0;u{o[u]=null}),Mn(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function K_(n,e,t){const r=["href","type","builders","el"];let i=Te(e,r),{$$slots:s={},$$scope:o}=e,{href:l=void 0}=e,{type:a=void 0}=e,{builders:c=[]}=e,{el:u=void 0}=e;const f={"data-button-root":""};function d(M){pe.call(this,n,M)}function h(M){pe.call(this,n,M)}function p(M){pe.call(this,n,M)}function m(M){pe.call(this,n,M)}function g(M){pe.call(this,n,M)}function b(M){pe.call(this,n,M)}function C(M){pe.call(this,n,M)}function E(M){pe.call(this,n,M)}function v(M){pe.call(this,n,M)}function H(M){pe.call(this,n,M)}function _(M){pe.call(this,n,M)}function B(M){pe.call(this,n,M)}function F(M){rt[M?"unshift":"push"](()=>{u=M,t(0,u)})}return n.$$set=M=>{e=T(T({},e),J(M)),t(5,i=Te(e,r)),"href"in M&&t(1,l=M.href),"type"in M&&t(2,a=M.type),"builders"in M&&t(3,c=M.builders),"el"in M&&t(0,u=M.el),"$$scope"in M&&t(6,o=M.$$scope)},[u,l,a,c,f,i,o,s,d,h,p,m,g,b,C,E,v,H,_,B,F]}let J_=class extends fe{constructor(e){super(),de(this,e,K_,q_,ce,{href:1,type:2,builders:3,el:0})}};function ey(){return{NAME:"dialog",PARTS:["close","content","description","overlay","portal","title","trigger"]}}function G_(n){const{NAME:e,PARTS:t}=ey(),r=Zb(e,t),i={...z_({...V_(n),role:"dialog",forceVisible:!0}),getAttrs:r};return $1(e,i),{...i,updateOption:H_(i.options)}}function Mi(){const{NAME:n}=ey();return N1(n)}const Y_=n=>({ids:n&1}),hp=n=>({ids:n[0]});function X_(n){let e;const t=n[12].default,r=re(t,n,n[11],hp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,[s]){r&&r.p&&(!e||s&2049)&&ie(r,t,i,i[11],e?oe(t,i[11],s,Y_):se(i[11]),hp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function Q_(n,e,t){let r,{$$slots:i={},$$scope:s}=e,{preventScroll:o=void 0}=e,{closeOnEscape:l=void 0}=e,{closeOnOutsideClick:a=void 0}=e,{portal:c=void 0}=e,{open:u=void 0}=e,{onOpenChange:f=void 0}=e,{openFocus:d=void 0}=e,{closeFocus:h=void 0}=e,{onOutsideClick:p=void 0}=e;const{states:{open:m},updateOption:g,ids:b}=G_({closeOnEscape:l,preventScroll:o,closeOnOutsideClick:a,portal:c,forceVisible:!0,defaultOpen:u,openFocus:d,closeFocus:h,onOutsideClick:p,onOpenChange:({next:E})=>(u!==E&&(f==null||f(E),t(2,u=E)),E)}),C=Ua([b.content,b.description,b.title],([E,v,H])=>({content:E,description:v,title:H}));return Tn(n,C,E=>t(0,r=E)),n.$$set=E=>{"preventScroll"in E&&t(3,o=E.preventScroll),"closeOnEscape"in E&&t(4,l=E.closeOnEscape),"closeOnOutsideClick"in E&&t(5,a=E.closeOnOutsideClick),"portal"in E&&t(6,c=E.portal),"open"in E&&t(2,u=E.open),"onOpenChange"in E&&t(7,f=E.onOpenChange),"openFocus"in E&&t(8,d=E.openFocus),"closeFocus"in E&&t(9,h=E.closeFocus),"onOutsideClick"in E&&t(10,p=E.onOutsideClick),"$$scope"in E&&t(11,s=E.$$scope)},n.$$.update=()=>{n.$$.dirty&4&&u!==void 0&&m.set(u),n.$$.dirty&8&&g("preventScroll",o),n.$$.dirty&16&&g("closeOnEscape",l),n.$$.dirty&32&&g("closeOnOutsideClick",a),n.$$.dirty&64&&g("portal",c),n.$$.dirty&256&&g("openFocus",d),n.$$.dirty&512&&g("closeFocus",h),n.$$.dirty&1024&&g("onOutsideClick",p)},[r,C,u,o,l,a,c,f,d,h,p,s,i]}class Z_ extends fe{constructor(e){super(),de(this,e,Q_,X_,ce,{preventScroll:3,closeOnEscape:4,closeOnOutsideClick:5,portal:6,open:2,onOpenChange:7,openFocus:8,closeFocus:9,onOutsideClick:10})}}const eA=n=>({builder:n&8}),pp=n=>({builder:n[3]}),tA=n=>({builder:n&8}),mp=n=>({builder:n[3]});function nA(n){let e=n[1],t,r,i=n[1]&&qc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),ne(s,t,o),r=!0},p(s,o){s[1]?e?ce(e,s[1])?(i.d(1),i=qc(s),e=s[1],i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=qc(s),e=s[1],i.c(),i.m(t.parentNode,t)):e&&(i.d(1),i=null,e=s[1])},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function rA(n){let e;const t=n[9].default,r=re(t,n,n[8],mp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&264)&&ie(r,t,i,i[8],e?oe(t,i[8],s,tA):se(i[8]),mp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function qc(n){let e,t,r,i;const s=n[9].default,o=re(s,n,n[8],pp);let l=[n[3],n[5]],a={};for(let c=0;c{o[u]=null}),Mn(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function sA(n,e,t){let r;const i=["level","asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{level:c="h2"}=e,{asChild:u=!1}=e,{id:f=void 0}=e,{el:d=void 0}=e;const{elements:{title:h},ids:p,getAttrs:m}=Mi();Tn(n,h,C=>t(7,o=C));const g=m("title");function b(C){rt[C?"unshift":"push"](()=>{d=C,t(0,d)})}return n.$$set=C=>{e=T(T({},e),J(C)),t(5,s=Te(e,i)),"level"in C&&t(1,c=C.level),"asChild"in C&&t(2,u=C.asChild),"id"in C&&t(6,f=C.id),"el"in C&&t(0,d=C.el),"$$scope"in C&&t(8,a=C.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&f&&p.title.set(f),n.$$.dirty&128&&t(3,r=o),n.$$.dirty&8&&Object.assign(r,g)},[d,c,u,r,h,s,f,o,a,l,b]}let oA=class extends fe{constructor(e){super(),de(this,e,sA,iA,ce,{level:1,asChild:2,id:6,el:0})}};const lA=n=>({builder:n&4}),gp=n=>({builder:n[2]}),aA=n=>({builder:n&4}),bp=n=>({builder:n[2]});function cA(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],gp);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),Mn(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function dA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{close:f},getAttrs:d}=Mi();Tn(n,f,g=>t(6,o=g));const h=Qf(),p=d("close");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=T(T({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class hA extends fe{constructor(e){super(),de(this,e,dA,fA,ce,{asChild:1,el:0})}}const pA=n=>({builder:n&4}),yp=n=>({builder:n[2]}),mA=n=>({builder:n&4}),vp=n=>({builder:n[2]});function gA(n){let e,t,r,i;const s=n[7].default,o=re(s,n,n[6],yp);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),Mn(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function vA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{portalled:f},getAttrs:d}=Mi();Tn(n,f,m=>t(5,o=m));const h=d("portal");function p(m){rt[m?"unshift":"push"](()=>{u=m,t(0,u)})}return n.$$set=m=>{e=T(T({},e),J(m)),t(4,s=Te(e,i)),"asChild"in m&&t(1,c=m.asChild),"el"in m&&t(0,u=m.el),"$$scope"in m&&t(6,a=m.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,h)},[u,c,r,f,s,o,a,l,p]}let wA=class extends fe{constructor(e){super(),de(this,e,vA,yA,ce,{asChild:1,el:0})}};const kA=n=>({builder:n[0]&256}),wp=n=>({builder:n[8]}),SA=n=>({builder:n[0]&256}),kp=n=>({builder:n[8]}),CA=n=>({builder:n[0]&256}),Sp=n=>({builder:n[8]}),_A=n=>({builder:n[0]&256}),Cp=n=>({builder:n[8]}),AA=n=>({builder:n[0]&256}),_p=n=>({builder:n[8]}),TA=n=>({builder:n[0]&256}),Ap=n=>({builder:n[8]});function EA(n){let e,t,r,i;const s=n[16].default,o=re(s,n,n[15],wp);let l=[n[8],n[12]],a={};for(let c=0;c{t=Ha(e,n[3],n[4]),t.start()})),r=!0)},o(u){S(l,u),r=!1},d(u){u&&j(e),l&&l.d(u),n[34](null),i=!1,Nt(s)}}}function $A(n){let e,t,r,i,s,o;const l=n[16].default,a=re(l,n,n[15],Cp);let c=[n[8],n[12]],u={};for(let f=0;f{i&&(r&&r.end(1),t=Ha(e,n[3],n[4]),t.start())}),i=!0)},o(f){S(a,f),t&&t.invalidate(),f&&(r=Va(e,n[5],n[6])),i=!1},d(f){f&&j(e),a&&a.d(f),n[33](null),f&&r&&r.end(),s=!1,Nt(o)}}}function NA(n){let e,t,r,i,s;const o=n[16].default,l=re(o,n,n[15],_p);let a=[n[8],n[12]],c={};for(let u=0;u{r&&(t||(t=Nl(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(u){S(l,u),u&&(t||(t=Nl(e,n[1],n[2],!1)),t.run(0)),r=!1},d(u){u&&j(e),l&&l.d(u),n[32](null),u&&t&&t.end(),i=!1,Nt(s)}}}function DA(n){let e;const t=n[16].default,r=re(t,n,n[15],Ap);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[0]&33024)&&ie(r,t,i,i[15],e?oe(t,i[15],s,TA):se(i[15]),Ap)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function xA(n){let e,t,r,i;const s=[DA,NA,$A,OA,MA,EA],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=We()},l(a){t&&t.l(a),r=We()},m(a,c){~e&&o[e].m(a,c),ne(a,r,c),i=!0},p(a,c){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(En(),S(o[u],1,1,()=>{o[u]=null}),Mn()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function IA(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","id","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{id:b=void 0}=e,{el:C=void 0}=e;const{elements:{content:E},states:{open:v},ids:H,getAttrs:_}=Mi();Tn(n,E,W=>t(14,o=W)),Tn(n,v,W=>t(9,l=W));const B=_("content");function F(W){pe.call(this,n,W)}function M(W){pe.call(this,n,W)}function X(W){pe.call(this,n,W)}function $(W){pe.call(this,n,W)}function y(W){pe.call(this,n,W)}function w(W){pe.call(this,n,W)}function O(W){pe.call(this,n,W)}function L(W){pe.call(this,n,W)}function A(W){pe.call(this,n,W)}function z(W){pe.call(this,n,W)}function q(W){pe.call(this,n,W)}function Y(W){pe.call(this,n,W)}function te(W){pe.call(this,n,W)}function ge(W){pe.call(this,n,W)}function ye(W){pe.call(this,n,W)}function me(W){rt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Ke(W){rt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Be(W){rt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Ze(W){rt[W?"unshift":"push"](()=>{C=W,t(0,C)})}function Qe(W){rt[W?"unshift":"push"](()=>{C=W,t(0,C)})}return n.$$set=W=>{e=T(T({},e),J(W)),t(12,s=Te(e,i)),"transition"in W&&t(1,u=W.transition),"transitionConfig"in W&&t(2,f=W.transitionConfig),"inTransition"in W&&t(3,d=W.inTransition),"inTransitionConfig"in W&&t(4,h=W.inTransitionConfig),"outTransition"in W&&t(5,p=W.outTransition),"outTransitionConfig"in W&&t(6,m=W.outTransitionConfig),"asChild"in W&&t(7,g=W.asChild),"id"in W&&t(13,b=W.id),"el"in W&&t(0,C=W.el),"$$scope"in W&&t(15,c=W.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&8192&&b&&H.content.set(b),n.$$.dirty[0]&16384&&t(8,r=o),n.$$.dirty[0]&256&&Object.assign(r,B)},[C,u,f,d,h,p,m,g,r,l,E,v,s,b,o,c,a,F,M,X,$,y,w,O,L,A,z,q,Y,te,ge,ye,me,Ke,Be,Ze,Qe]}let RA=class extends fe{constructor(e){super(),de(this,e,IA,xA,ce,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,id:13,el:0},null,[-1,-1])}};const PA=n=>({builder:n&256}),Tp=n=>({builder:n[8]});function LA(n){let e,t,r,i=[n[8],n[12]],s={};for(let o=0;o{t=Ha(e,n[3],n[4]),t.start()}))},o:Oe,d(l){l&&j(e),n[23](null),r=!1,Nt(i)}}}function zA(n){let e,t,r,i,s,o,l=[n[8],n[12]],a={};for(let c=0;c{i&&(r&&r.end(1),t=Ha(e,n[3],n[4]),t.start())}),i=!0)},o(c){t&&t.invalidate(),c&&(r=Va(e,n[5],n[6])),i=!1},d(c){c&&j(e),n[22](null),c&&r&&r.end(),s=!1,Nt(o)}}}function VA(n){let e,t,r,i,s,o=[n[8],n[12]],l={};for(let a=0;a{r&&(t||(t=Nl(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(a){a&&(t||(t=Nl(e,n[1],n[2],!1)),t.run(0)),r=!1},d(a){a&&j(e),n[21](null),a&&t&&t.end(),i=!1,Nt(s)}}}function HA(n){let e;const t=n[15].default,r=re(t,n,n[14],Tp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16640)&&ie(r,t,i,i[14],e?oe(t,i[14],s,PA):se(i[14]),Tp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function UA(n){let e,t,r,i;const s=[HA,VA,zA,FA,BA,LA],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=We()},l(a){t&&t.l(a),r=We()},m(a,c){~e&&o[e].m(a,c),ne(a,r,c),i=!0},p(a,[c]){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(En(),S(o[u],1,1,()=>{o[u]=null}),Mn()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function jA(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{el:b=void 0}=e;const{elements:{overlay:C},states:{open:E},getAttrs:v}=Mi();Tn(n,C,A=>t(13,o=A)),Tn(n,E,A=>t(9,l=A));const H=v("overlay");function _(A){pe.call(this,n,A)}function B(A){pe.call(this,n,A)}function F(A){pe.call(this,n,A)}function M(A){pe.call(this,n,A)}function X(A){pe.call(this,n,A)}function $(A){rt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function y(A){rt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function w(A){rt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function O(A){rt[A?"unshift":"push"](()=>{b=A,t(0,b)})}function L(A){rt[A?"unshift":"push"](()=>{b=A,t(0,b)})}return n.$$set=A=>{e=T(T({},e),J(A)),t(12,s=Te(e,i)),"transition"in A&&t(1,u=A.transition),"transitionConfig"in A&&t(2,f=A.transitionConfig),"inTransition"in A&&t(3,d=A.inTransition),"inTransitionConfig"in A&&t(4,h=A.inTransitionConfig),"outTransition"in A&&t(5,p=A.outTransition),"outTransitionConfig"in A&&t(6,m=A.outTransitionConfig),"asChild"in A&&t(7,g=A.asChild),"el"in A&&t(0,b=A.el),"$$scope"in A&&t(14,c=A.$$scope)},n.$$.update=()=>{n.$$.dirty&8192&&t(8,r=o),n.$$.dirty&256&&Object.assign(r,H)},[b,u,f,d,h,p,m,g,r,l,C,E,s,o,c,a,_,B,F,M,X,$,y,w,O,L]}let WA=class extends fe{constructor(e){super(),de(this,e,jA,UA,ce,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,el:0})}};const qA=n=>({builder:n&4}),Ep=n=>({builder:n[2]}),KA=n=>({builder:n&4}),Mp=n=>({builder:n[2]});function JA(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],Ep);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),Mn(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function XA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{trigger:f},getAttrs:d}=Mi();Tn(n,f,g=>t(6,o=g));const h=Qf(),p=d("trigger");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=T(T({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class QA extends fe{constructor(e){super(),de(this,e,XA,YA,ce,{asChild:1,el:0})}}const ZA=n=>({builder:n&4}),Op=n=>({builder:n[2]}),eT=n=>({builder:n&4}),$p=n=>({builder:n[2]});function tT(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],Op);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),Mn(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function iT(n,e,t){let r;const i=["asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{id:u=void 0}=e,{el:f=void 0}=e;const{elements:{description:d},ids:h,getAttrs:p}=Mi();Tn(n,d,b=>t(6,o=b));const m=p("description");function g(b){rt[b?"unshift":"push"](()=>{f=b,t(0,f)})}return n.$$set=b=>{e=T(T({},e),J(b)),t(4,s=Te(e,i)),"asChild"in b&&t(1,c=b.asChild),"id"in b&&t(5,u=b.id),"el"in b&&t(0,f=b.el),"$$scope"in b&&t(7,a=b.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&u&&h.description.set(u),n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,m)},[f,c,r,d,s,u,o,a,l,g]}let sT=class extends fe{constructor(e){super(),de(this,e,iT,rT,ce,{asChild:1,id:5,el:0})}};function oT(){const n="label",t=Zb(n,["root"]);return{NAME:n,getAttrs:t}}const lT=n=>({builder:n&4}),Np=n=>({builder:n[2]}),aT=n=>({builder:n&4}),Dp=n=>({builder:n[2]});function cT(n){let e,t,r,i;const s=n[8].default,o=re(s,n,n[7],Np);let l=[n[2],n[5]],a={};for(let c=0;c{o[u]=null}),Mn(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function dT(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{root:f}}=L_();Tn(n,f,g=>t(6,o=g));const d=Qf(),{getAttrs:h}=oT(),p=h("root");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=T(T({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,d,s,o,a,l,m]}let hT=class extends fe{constructor(e){super(),de(this,e,dT,fT,ce,{asChild:1,el:0})}};function ty(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;el(s)))==null?void 0:o.classGroupId}const xp=/^\[(.+)\]$/;function gT(n){if(xp.test(n)){const e=xp.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}}function bT(n){const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return vT(Object.entries(n.classGroups),t).forEach(([s,o])=>{Vu(o,r,s,e)}),r}function Vu(n,e,t,r){n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Ip(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(yT(i)){Vu(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Vu(o,Ip(e,s),t,r)})})}function Ip(n,e){let t=n;return e.split(Zf).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t}function yT(n){return n.isThemeGetter}function vT(n,e){return e?n.map(([t,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[e+o,l])):s);return[t,i]}):n}function wT(n){if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;function i(s,o){t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)}return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}}const ry="!";function kT(n){const e=n.separator,t=e.length===1,r=e[0],i=e.length;return function(o){const l=[];let a=0,c=0,u;for(let m=0;mc?u-c:void 0;return{modifiers:l,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}}}function ST(n){if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e}function CT(n){return{cache:wT(n.cacheSize),splitModifiers:kT(n),...mT(n)}}const _T=/\s+/;function AT(n,e){const{splitModifiers:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=new Set;return n.trim().split(_T).map(o=>{const{modifiers:l,hasImportantModifier:a,baseClassName:c,maybePostfixModifierPosition:u}=t(o);let f=r(u?c.substring(0,u):c),d=!!u;if(!f){if(!u)return{isTailwindClass:!1,originalClassName:o};if(f=r(c),!f)return{isTailwindClass:!1,originalClassName:o};d=!1}const h=ST(l).join(":");return{isTailwindClass:!0,modifierId:a?h+ry:h,classGroupId:f,originalClassName:o,hasPostfixModifier:d}}).reverse().filter(o=>{if(!o.isTailwindClass)return!0;const{modifierId:l,classGroupId:a,hasPostfixModifier:c}=o,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(f=>s.add(l+f)),!0)}).reverse().map(o=>o.originalClassName).join(" ")}function TT(){let n=0,e,t,r="";for(;nf(u),n());return t=CT(c),r=t.cache.get,i=t.cache.set,s=l,l(a)}function l(a){const c=r(a);if(c)return c;const u=AT(a,t);return i(a,u),u}return function(){return s(TT.apply(null,arguments))}}function Ye(n){const e=t=>t[n]||[];return e.isThemeGetter=!0,e}const sy=/^\[(?:([a-z-]+):)?(.+)\]$/i,MT=/^\d+\/\d+$/,OT=new Set(["px","full","screen"]),$T=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NT=/\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$/,DT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,IT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function rr(n){return si(n)||OT.has(n)||MT.test(n)}function gr(n){return Ss(n,"length",HT)}function si(n){return!!n&&!Number.isNaN(Number(n))}function el(n){return Ss(n,"number",si)}function Rs(n){return!!n&&Number.isInteger(Number(n))}function RT(n){return n.endsWith("%")&&si(n.slice(0,-1))}function ke(n){return sy.test(n)}function br(n){return $T.test(n)}const PT=new Set(["length","size","percentage"]);function LT(n){return Ss(n,PT,oy)}function BT(n){return Ss(n,"position",oy)}const FT=new Set(["image","url"]);function zT(n){return Ss(n,FT,jT)}function VT(n){return Ss(n,"",UT)}function Ps(){return!0}function Ss(n,e,t){const r=sy.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1}function HT(n){return NT.test(n)&&!DT.test(n)}function oy(){return!1}function UT(n){return xT.test(n)}function jT(n){return IT.test(n)}function WT(){const n=Ye("colors"),e=Ye("spacing"),t=Ye("blur"),r=Ye("brightness"),i=Ye("borderColor"),s=Ye("borderRadius"),o=Ye("borderSpacing"),l=Ye("borderWidth"),a=Ye("contrast"),c=Ye("grayscale"),u=Ye("hueRotate"),f=Ye("invert"),d=Ye("gap"),h=Ye("gradientColorStops"),p=Ye("gradientColorStopPositions"),m=Ye("inset"),g=Ye("margin"),b=Ye("opacity"),C=Ye("padding"),E=Ye("saturate"),v=Ye("scale"),H=Ye("sepia"),_=Ye("skew"),B=Ye("space"),F=Ye("translate"),M=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",ke,e],y=()=>[ke,e],w=()=>["",rr,gr],O=()=>["auto",si,ke],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],A=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],q=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",ke],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ge=()=>[si,el],ye=()=>[si,ke];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[rr,gr],blur:["none","",br,ke],brightness:ge(),borderColor:[n],borderRadius:["none","","full",br,ke],borderSpacing:y(),borderWidth:w(),contrast:ge(),grayscale:Y(),hueRotate:ye(),invert:Y(),gap:y(),gradientColorStops:[n],gradientColorStopPositions:[RT,gr],inset:$(),margin:$(),opacity:ge(),padding:y(),saturate:ge(),scale:ge(),sepia:Y(),skew:ye(),space:y(),translate:y()},classGroups:{aspect:[{aspect:["auto","square","video",ke]}],container:["container"],columns:[{columns:[br]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"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:[...L(),ke]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rs,ke]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ke]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",Rs,ke]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Rs,ke]},ke]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Rs,ke]},ke]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ke]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ke,e]}],"min-w":[{"min-w":[ke,e,"min","max","fit"]}],"max-w":[{"max-w":[ke,e,"none","full","min","max","fit","prose",{screen:[br]},br]}],h:[{h:[ke,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ke,e,"auto","min","max","fit"]}],"font-size":[{text:["base",br,gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",el]}],"font-family":[{font:[Ps]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ke]}],"line-clamp":[{"line-clamp":["none",si,el]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",rr,ke]}],"list-image":[{"list-image":["none",ke]}],"list-style-type":[{list:["none","disc","decimal",ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...A(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",rr,gr]}],"underline-offset":[{"underline-offset":["auto",rr,ke]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke]}],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",ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),BT]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LT]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},zT]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...A(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:A()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...A()]}],"outline-offset":[{"outline-offset":[rr,ke]}],"outline-w":[{outline:[rr,gr]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:w()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[rr,gr]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",br,VT]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":z()}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",br,ke]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[E]}],sepia:[{sepia:[H]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[H]}],"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",ke]}],duration:[{duration:ye()}],ease:[{ease:["linear","in","out","in-out",ke]}],delay:[{delay:ye()}],animate:[{animate:["none","spin","ping","pulse","bounce",ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[v]}],"scale-x":[{"scale-x":[v]}],"scale-y":[{"scale-y":[v]}],rotate:[{rotate:[Rs,ke]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ke]}],accent:[{accent:["auto",n]}],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",ke]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"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",ke]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[rr,gr,el]}],stroke:[{stroke:[n,"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-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"]}}}const qT=ET(WT);function KT(n){const e=n-1;return e*e*e+1}function _t(...n){return qT(pT(n))}const JT=(n,e={y:-8,x:0,start:.95,duration:150})=>{const t=getComputedStyle(n),r=t.transform==="none"?"":t.transform,i=(o,l,a)=>{const[c,u]=l,[f,d]=a;return(o-c)/(u-c)*(d-f)+f},s=o=>Object.keys(o).reduce((l,a)=>o[a]===void 0?l:l+`${a}:${o[a]};`,"");return{duration:e.duration??200,delay:0,css:o=>{const l=i(o,[0,1],[e.y??5,0]),a=i(o,[0,1],[e.x??0,0]),c=i(o,[0,1],[e.start??.95,1]);return s({transform:`${r} translate3d(${a}px, ${l}px, 0) scale(${c})`,opacity:o})},easing:KT}};function GT(n){let e;const t=n[5].default,r=re(t,n,n[8],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&256)&&ie(r,t,i,i[8],e?oe(t,i[8],s,null):se(i[8]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function YT(n){let e,t;const r=[{builders:n[3]},{class:_t(Vp({variant:n[1],size:n[2],className:n[0]}))},{type:"button"},n[4]];let i={$$slots:{default:[GT]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(h)),t(4,i=Te(e,r)),"class"in h&&t(0,l=h.class),"variant"in h&&t(1,a=h.variant),"size"in h&&t(2,c=h.size),"builders"in h&&t(3,u=h.builders),"$$scope"in h&&t(8,o=h.$$scope)},[l,a,c,u,i,s,f,d,o]}class Le extends fe{constructor(e){super(),de(this,e,XT,YT,ce,{class:0,variant:1,size:2,builders:3})}}var Rp=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Qt=n=>!n||typeof n!="object"||Object.keys(n).length===0,QT=(n,e)=>JSON.stringify(n)===JSON.stringify(e);function ly(n,e){n.forEach(function(t){Array.isArray(t)?ly(t,e):e.push(t)})}function ay(n){let e=[];return ly(n,e),e}var cy=(...n)=>ay(n).filter(Boolean),uy=(n,e)=>{let t={},r=Object.keys(n),i=Object.keys(e);for(let s of r)if(i.includes(s)){let o=n[s],l=e[s];typeof o=="object"&&typeof l=="object"?t[s]=uy(o,l):Array.isArray(o)||Array.isArray(l)?t[s]=cy(l,o):t[s]=l+" "+o}else t[s]=n[s];for(let s of i)r.includes(s)||(t[s]=e[s]);return t},Pp=n=>!n||typeof n!="string"?n:n.replace(/\s+/g," ").trim();function ZT(){for(var n=0,e,t,r="";nn&&(e=0,r=t,t=new Map)}return{get:function(o){var l=t.get(o);if(l!==void 0)return l;if((l=r.get(o))!==void 0)return i(o,l),l},set:function(o,l){t.has(o)?t.set(o,l):i(o,l)}}}var hy="!";function oE(n){var e=n.separator||":",t=e.length===1,r=e[0],i=e.length;return function(o){for(var l=[],a=0,c=0,u,f=0;fc?u-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}}}function lE(n){if(n.length<=1)return n;var e=[],t=[];return n.forEach(function(r){var i=r[0]==="[";i?(e.push.apply(e,t.sort().concat([r])),t=[]):t.push(r)}),e.push.apply(e,t.sort()),e}function aE(n){return{cache:sE(n.cacheSize),splitModifiers:oE(n),...eE(n)}}var cE=/\s+/;function uE(n,e){var t=e.splitModifiers,r=e.getClassGroupId,i=e.getConflictingClassGroupIds,s=new Set;return n.trim().split(cE).map(function(o){var l=t(o),a=l.modifiers,c=l.hasImportantModifier,u=l.baseClassName,f=l.maybePostfixModifierPosition,d=r(f?u.substring(0,f):u),h=!!f;if(!d){if(!f)return{isTailwindClass:!1,originalClassName:o};if(d=r(u),!d)return{isTailwindClass:!1,originalClassName:o};h=!1}var p=lE(a).join(":"),m=c?p+hy:p;return{isTailwindClass:!0,modifierId:m,classGroupId:d,originalClassName:o,hasPostfixModifier:h}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var l=o.modifierId,a=o.classGroupId,c=o.hasPostfixModifier,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(function(f){return s.add(l+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Uu(){for(var n=arguments.length,e=new Array(n),t=0;t1?e-1:0),r=1;rn||void 0,bo=(...n)=>by(ay(n).filter(Boolean).join(" ")),Kc=null,Yl={},qu=!1,Fs=(...n)=>e=>e.twMerge?((!Kc||qu)&&(qu=!1,Kc=Qt(Yl)?ME:EE(Yl)),by(Kc(bo(n)))):bo(n),zp=(n,e)=>{for(let t in e)n.hasOwnProperty(t)?n[t]=bo(n[t],e[t]):n[t]=e[t];return n},$E=(n,e)=>{let{extend:t=null,slots:r={},variants:i={},compoundVariants:s=[],compoundSlots:o=[],defaultVariants:l={}}=n,a={...OE,...e},c=t!=null&&t.base?bo(t.base,n==null?void 0:n.base):n==null?void 0:n.base,u=t!=null&&t.variants&&!Qt(t.variants)?uy(i,t.variants):i,f=t!=null&&t.defaultVariants&&!Qt(t.defaultVariants)?{...t.defaultVariants,...l}:l;!Qt(a.twMergeConfig)&&!QT(a.twMergeConfig,Yl)&&(qu=!0,Yl=a.twMergeConfig);let d=Qt(t==null?void 0:t.slots),h=Qt(r)?{}:{base:bo(n==null?void 0:n.base,d&&(t==null?void 0:t.base)),...r},p=d?h:zp({...t==null?void 0:t.slots},Qt(h)?{base:n==null?void 0:n.base}:h),m=b=>{if(Qt(u)&&Qt(r)&&d)return Fs(c,b==null?void 0:b.class,b==null?void 0:b.className)(a);if(s&&!Array.isArray(s))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof s}`);if(o&&!Array.isArray(o))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof o}`);let C=(y,w,O=[],L)=>{let A=O;if(typeof w=="string")A=A.concat(Pp(w).split(" ").map(z=>`${y}:${z}`));else if(Array.isArray(w))A=A.concat(w.reduce((z,q)=>z.concat(`${y}:${q}`),[]));else if(typeof w=="object"&&typeof L=="string"){for(let z in w)if(w.hasOwnProperty(z)&&z===L){let q=w[z];if(q&&typeof q=="string"){let Y=Pp(q);A[L]?A[L]=A[L].concat(Y.split(" ").map(te=>`${y}:${te}`)):A[L]=Y.split(" ").map(te=>`${y}:${te}`)}else Array.isArray(q)&&q.length>0&&(A[L]=q.reduce((Y,te)=>Y.concat(`${y}:${te}`),[]))}}return A},E=(y,w=u,O=null,L=null)=>{var A;let z=w[y];if(!z||Qt(z))return null;let q=(A=L==null?void 0:L[y])!=null?A:b==null?void 0:b[y];if(q===null)return null;let Y=Rp(q),te=Array.isArray(a.responsiveVariants)&&a.responsiveVariants.length>0||a.responsiveVariants===!0,ge=f==null?void 0:f[y],ye=[];if(typeof Y=="object"&&te)for(let[Ke,Be]of Object.entries(Y)){let Ze=z[Be];if(Ke==="initial"){ge=Be;continue}Array.isArray(a.responsiveVariants)&&!a.responsiveVariants.includes(Ke)||(ye=C(Ke,Ze,ye,O))}let me=z[Y]||z[Rp(ge)];return typeof ye=="object"&&typeof O=="string"&&ye[O]?zp(ye,me):ye.length>0?(ye.push(me),ye):me},v=()=>u?Object.keys(u).map(y=>E(y,u)):null,H=(y,w)=>{if(!u||typeof u!="object")return null;let O=new Array;for(let L in u){let A=E(L,u,y,w),z=y==="base"&&typeof A=="string"?A:A&&A[y];z&&(O[O.length]=z)}return O},_={};for(let y in b)b[y]!==void 0&&(_[y]=b[y]);let B=(y,w)=>{var O;let L=typeof(b==null?void 0:b[y])=="object"?{[y]:(O=b[y])==null?void 0:O.initial}:{};return{...f,..._,...L,...w}},F=(y=[],w)=>{let O=[];for(let{class:L,className:A,...z}of y){let q=!0;for(let[Y,te]of Object.entries(z)){let ge=B(Y,w);if(Array.isArray(te)){if(!te.includes(ge[Y])){q=!1;break}}else if(ge[Y]!==te){q=!1;break}}q&&(L&&O.push(L),A&&O.push(A))}return O},M=y=>{let w=F(s,y),O=F(t==null?void 0:t.compoundVariants,y);return cy(O,w)},X=y=>{let w=M(y);if(!Array.isArray(w))return w;let O={};for(let L of w)if(typeof L=="string"&&(O.base=Fs(O.base,L)(a)),typeof L=="object")for(let[A,z]of Object.entries(L))O[A]=Fs(O[A],z)(a);return O},$=y=>{if(o.length<1)return null;let w={};for(let{slots:O=[],class:L,className:A,...z}of o){if(!Qt(z)){let q=!0;for(let Y of Object.keys(z)){let te=B(Y,y)[Y];if(te===void 0||(Array.isArray(z[Y])?!z[Y].includes(te):z[Y]!==te)){q=!1;break}}if(!q)continue}for(let q of O)w[q]=w[q]||[],w[q].push([L,A])}return w};if(!Qt(r)||!d){let y={};if(typeof p=="object"&&!Qt(p))for(let w of Object.keys(p))y[w]=O=>{var L,A;return Fs(p[w],H(w,O),((L=X(O))!=null?L:[])[w],((A=$(O))!=null?A:[])[w],O==null?void 0:O.class,O==null?void 0:O.className)(a)};return y}return Fs(c,v(),M(),b==null?void 0:b.class,b==null?void 0:b.className)(a)},g=()=>{if(!(!u||typeof u!="object"))return Object.keys(u)};return m.variantKeys=g(),m.extend=t,m.base=c,m.slots=p,m.variants=u,m.defaultVariants=f,m.compoundSlots=o,m.compoundVariants=s,m};const Vp=$E({base:"inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});/** * @license lucide-svelte v0.316.0 - ISC This source code is licensed under the ISC license. @@ -205,14 +205,14 @@ See the LICENSE file in the root directory of this source tree. } -`;function P2(n){const e=localStorage.getItem("edited")??`light_note_${Date.now()}`,t=window.prompt("Please insert file name",e);if(!t)return;if(t.trim().length===0){window.alert(`Invalid file name. filename: ${t}`);return}localStorage.setItem("edited",t);const r=n.getHTML(),i=new Blob([R2,r],{type:"text/html;charset=utf-8"}),s=document.createElement("a");s.setAttribute("href",window.URL.createObjectURL(i)),s.setAttribute("download",t),s.click()}async function L2(n,e){e&&(localStorage.setItem("edited",e[0].name),n.commands.setContent(await e[0].text()))}function B2(n){const e=n.getAttributes("link").href,t=window.prompt("Please insert link url",e);if(t!==null){if(t.trim().length===0){n.chain().focus().extendMarkRange("link").unsetLink().run();return}n.chain().focus().extendMarkRange("link").setLink({href:t}).run()}}function F2(n){n.commands.clearContent(),n.commands.focus()}function z2(n){const e=window.prompt("Please insert image url");!e||e.trim().length===0||n.chain().focus().setImage({src:e}).run()}function Gc(n,e){try{if(!n||!(n.startsWith("ws://")||n.startsWith("wss://")))throw new Error("Invalid endpoint. endpoint should start with ws:// or wss://");if(!e)throw new Error("Invalid workspace");localStorage.setItem("sharing",JSON.stringify({endpoint:n,workspace:e})),localStorage.setItem("shared",JSON.stringify({endpoint:n,workspace:e})),location.reload()}catch(t){window.alert(t.toString()),console.error(t)}}function V2(n){localStorage.removeItem("sharing"),n&&(window.alert("Disconnecting..."),location.reload())}var Jt="top",pn="bottom",mn="right",Gt="left",td="auto",Vo=[Jt,pn,mn,Gt],cs="start",yo="end",H2="clippingParents",Sy="viewport",zs="popper",U2="reference",Wp=Vo.reduce(function(n,e){return n.concat([e+"-"+cs,e+"-"+yo])},[]),Cy=[].concat(Vo,[td]).reduce(function(n,e){return n.concat([e,e+"-"+cs,e+"-"+yo])},[]),j2="beforeRead",W2="read",q2="afterRead",K2="beforeMain",J2="main",G2="afterMain",Y2="beforeWrite",X2="write",Q2="afterWrite",Z2=[j2,W2,q2,K2,J2,G2,Y2,X2,Q2];function Yn(n){return n?(n.nodeName||"").toLowerCase():null}function sn(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Si(n){var e=sn(n).Element;return n instanceof e||n instanceof Element}function hn(n){var e=sn(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function nd(n){if(typeof ShadowRoot>"u")return!1;var e=sn(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function eO(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!hn(s)||!Yn(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var l=i[o];l===!1?s.removeAttribute(o):s.setAttribute(o,l===!0?"":l)}))})}function tO(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),l=o.reduce(function(a,c){return a[c]="",a},{});!hn(i)||!Yn(i)||(Object.assign(i.style,l),Object.keys(s).forEach(function(a){i.removeAttribute(a)}))})}}const _y={name:"applyStyles",enabled:!0,phase:"write",fn:eO,effect:tO,requires:["computeStyles"]};function Kn(n){return n.split("-")[0]}var hi=Math.max,Xl=Math.min,us=Math.round;function Ku(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ay(){return!/^((?!chrome|android).)*safari/i.test(Ku())}function fs(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,s=1;e&&hn(n)&&(i=n.offsetWidth>0&&us(r.width)/n.offsetWidth||1,s=n.offsetHeight>0&&us(r.height)/n.offsetHeight||1);var o=Si(n)?sn(n):window,l=o.visualViewport,a=!Ay()&&t,c=(r.left+(a&&l?l.offsetLeft:0))/i,u=(r.top+(a&&l?l.offsetTop:0))/s,f=r.width/i,d=r.height/s;return{width:f,height:d,top:u,right:c+f,bottom:u+d,left:c,x:c,y:u}}function rd(n){var e=fs(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function Ty(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&nd(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ur(n){return sn(n).getComputedStyle(n)}function nO(n){return["table","td","th"].indexOf(Yn(n))>=0}function qr(n){return((Si(n)?n.ownerDocument:n.document)||window.document).documentElement}function ic(n){return Yn(n)==="html"?n:n.assignedSlot||n.parentNode||(nd(n)?n.host:null)||qr(n)}function qp(n){return!hn(n)||ur(n).position==="fixed"?null:n.offsetParent}function rO(n){var e=/firefox/i.test(Ku()),t=/Trident/i.test(Ku());if(t&&hn(n)){var r=ur(n);if(r.position==="fixed")return null}var i=ic(n);for(nd(i)&&(i=i.host);hn(i)&&["html","body"].indexOf(Yn(i))<0;){var s=ur(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Ho(n){for(var e=sn(n),t=qp(n);t&&nO(t)&&ur(t).position==="static";)t=qp(t);return t&&(Yn(t)==="html"||Yn(t)==="body"&&ur(t).position==="static")?e:t||rO(n)||e}function id(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Xs(n,e,t){return hi(n,Xl(e,t))}function iO(n,e,t){var r=Xs(n,e,t);return r>t?t:r}function Ey(){return{top:0,right:0,bottom:0,left:0}}function My(n){return Object.assign({},Ey(),n)}function Oy(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var sO=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,My(typeof e!="number"?e:Oy(e,Vo))};function oO(n){var e,t=n.state,r=n.name,i=n.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,l=Kn(t.placement),a=id(l),c=[Gt,mn].indexOf(l)>=0,u=c?"height":"width";if(!(!s||!o)){var f=sO(i.padding,t),d=rd(s),h=a==="y"?Jt:Gt,p=a==="y"?pn:mn,m=t.rects.reference[u]+t.rects.reference[a]-o[a]-t.rects.popper[u],g=o[a]-t.rects.reference[a],b=Ho(s),C=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,E=m/2-g/2,v=f[h],H=C-d[u]-f[p],_=C/2-d[u]/2+E,B=Xs(v,_,H),F=a;t.modifiersData[r]=(e={},e[F]=B,e.centerOffset=B-_,e)}}function lO(n){var e=n.state,t=n.options,r=t.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Ty(e.elements.popper,i)&&(e.elements.arrow=i))}const aO={name:"arrow",enabled:!0,phase:"main",fn:oO,effect:lO,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ds(n){return n.split("-")[1]}var cO={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uO(n,e){var t=n.x,r=n.y,i=e.devicePixelRatio||1;return{x:us(t*i)/i||0,y:us(r*i)/i||0}}function Kp(n){var e,t=n.popper,r=n.popperRect,i=n.placement,s=n.variation,o=n.offsets,l=n.position,a=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,f=n.isFixed,d=o.x,h=d===void 0?0:d,p=o.y,m=p===void 0?0:p,g=typeof u=="function"?u({x:h,y:m}):{x:h,y:m};h=g.x,m=g.y;var b=o.hasOwnProperty("x"),C=o.hasOwnProperty("y"),E=Gt,v=Jt,H=window;if(c){var _=Ho(t),B="clientHeight",F="clientWidth";if(_===sn(t)&&(_=qr(t),ur(_).position!=="static"&&l==="absolute"&&(B="scrollHeight",F="scrollWidth")),_=_,i===Jt||(i===Gt||i===mn)&&s===yo){v=pn;var M=f&&_===H&&H.visualViewport?H.visualViewport.height:_[B];m-=M-r.height,m*=a?1:-1}if(i===Gt||(i===Jt||i===pn)&&s===yo){E=mn;var X=f&&_===H&&H.visualViewport?H.visualViewport.width:_[F];h-=X-r.width,h*=a?1:-1}}var $=Object.assign({position:l},c&&cO),y=u===!0?uO({x:h,y:m},sn(t)):{x:h,y:m};if(h=y.x,m=y.y,a){var w;return Object.assign({},$,(w={},w[v]=C?"0":"",w[E]=b?"0":"",w.transform=(H.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",w))}return Object.assign({},$,(e={},e[v]=C?m+"px":"",e[E]=b?h+"px":"",e.transform="",e))}function fO(n){var e=n.state,t=n.options,r=t.gpuAcceleration,i=r===void 0?!0:r,s=t.adaptive,o=s===void 0?!0:s,l=t.roundOffsets,a=l===void 0?!0:l,c={placement:Kn(e.placement),variation:ds(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Kp(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Kp(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const dO={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:fO,data:{}};var nl={passive:!0};function hO(n){var e=n.state,t=n.instance,r=n.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,l=o===void 0?!0:o,a=sn(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",t.update,nl)}),l&&a.addEventListener("resize",t.update,nl),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",t.update,nl)}),l&&a.removeEventListener("resize",t.update,nl)}}const pO={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:hO,data:{}};var mO={left:"right",right:"left",bottom:"top",top:"bottom"};function bl(n){return n.replace(/left|right|bottom|top/g,function(e){return mO[e]})}var gO={start:"end",end:"start"};function Jp(n){return n.replace(/start|end/g,function(e){return gO[e]})}function sd(n){var e=sn(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function od(n){return fs(qr(n)).left+sd(n).scrollLeft}function bO(n,e){var t=sn(n),r=qr(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;var c=Ay();(c||!c&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:s,height:o,x:l+od(n),y:a}}function yO(n){var e,t=qr(n),r=sd(n),i=(e=n.ownerDocument)==null?void 0:e.body,s=hi(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=hi(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),l=-r.scrollLeft+od(n),a=-r.scrollTop;return ur(i||t).direction==="rtl"&&(l+=hi(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:l,y:a}}function ld(n){var e=ur(n),t=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+r)}function $y(n){return["html","body","#document"].indexOf(Yn(n))>=0?n.ownerDocument.body:hn(n)&&ld(n)?n:$y(ic(n))}function Qs(n,e){var t;e===void 0&&(e=[]);var r=$y(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=sn(r),o=i?[s].concat(s.visualViewport||[],ld(r)?r:[]):r,l=e.concat(o);return i?l:l.concat(Qs(ic(o)))}function Ju(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function vO(n,e){var t=fs(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Gp(n,e,t){return e===Sy?Ju(bO(n,t)):Si(e)?vO(e,t):Ju(yO(qr(n)))}function wO(n){var e=Qs(ic(n)),t=["absolute","fixed"].indexOf(ur(n).position)>=0,r=t&&hn(n)?Ho(n):n;return Si(r)?e.filter(function(i){return Si(i)&&Ty(i,r)&&Yn(i)!=="body"}):[]}function kO(n,e,t,r){var i=e==="clippingParents"?wO(n):[].concat(e),s=[].concat(i,[t]),o=s[0],l=s.reduce(function(a,c){var u=Gp(n,c,r);return a.top=hi(u.top,a.top),a.right=Xl(u.right,a.right),a.bottom=Xl(u.bottom,a.bottom),a.left=hi(u.left,a.left),a},Gp(n,o,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function Ny(n){var e=n.reference,t=n.element,r=n.placement,i=r?Kn(r):null,s=r?ds(r):null,o=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(i){case Jt:a={x:o,y:e.y-t.height};break;case pn:a={x:o,y:e.y+e.height};break;case mn:a={x:e.x+e.width,y:l};break;case Gt:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var c=i?id(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case cs:a[c]=a[c]-(e[u]/2-t[u]/2);break;case yo:a[c]=a[c]+(e[u]/2-t[u]/2);break}}return a}function vo(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=r===void 0?n.placement:r,s=t.strategy,o=s===void 0?n.strategy:s,l=t.boundary,a=l===void 0?H2:l,c=t.rootBoundary,u=c===void 0?Sy:c,f=t.elementContext,d=f===void 0?zs:f,h=t.altBoundary,p=h===void 0?!1:h,m=t.padding,g=m===void 0?0:m,b=My(typeof g!="number"?g:Oy(g,Vo)),C=d===zs?U2:zs,E=n.rects.popper,v=n.elements[p?C:d],H=kO(Si(v)?v:v.contextElement||qr(n.elements.popper),a,u,o),_=fs(n.elements.reference),B=Ny({reference:_,element:E,strategy:"absolute",placement:i}),F=Ju(Object.assign({},E,B)),M=d===zs?F:_,X={top:H.top-M.top+b.top,bottom:M.bottom-H.bottom+b.bottom,left:H.left-M.left+b.left,right:M.right-H.right+b.right},$=n.modifiersData.offset;if(d===zs&&$){var y=$[i];Object.keys(X).forEach(function(w){var O=[mn,pn].indexOf(w)>=0?1:-1,L=[Jt,pn].indexOf(w)>=0?"y":"x";X[w]+=y[L]*O})}return X}function SO(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,l=t.flipVariations,a=t.allowedAutoPlacements,c=a===void 0?Cy:a,u=ds(r),f=u?l?Wp:Wp.filter(function(p){return ds(p)===u}):Vo,d=f.filter(function(p){return c.indexOf(p)>=0});d.length===0&&(d=f);var h=d.reduce(function(p,m){return p[m]=vo(n,{placement:m,boundary:i,rootBoundary:s,padding:o})[Kn(m)],p},{});return Object.keys(h).sort(function(p,m){return h[p]-h[m]})}function CO(n){if(Kn(n)===td)return[];var e=bl(n);return[Jp(n),e,Jp(e)]}function _O(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,l=o===void 0?!0:o,a=t.fallbackPlacements,c=t.padding,u=t.boundary,f=t.rootBoundary,d=t.altBoundary,h=t.flipVariations,p=h===void 0?!0:h,m=t.allowedAutoPlacements,g=e.options.placement,b=Kn(g),C=b===g,E=a||(C||!p?[bl(g)]:CO(g)),v=[g].concat(E).reduce(function(Ke,Fe){return Ke.concat(Kn(Fe)===td?SO(e,{placement:Fe,boundary:u,rootBoundary:f,padding:c,flipVariations:p,allowedAutoPlacements:m}):Fe)},[]),H=e.rects.reference,_=e.rects.popper,B=new Map,F=!0,M=v[0],X=0;X=0,L=O?"width":"height",A=vo(e,{placement:$,boundary:u,rootBoundary:f,altBoundary:d,padding:c}),z=O?w?mn:Gt:w?pn:Jt;H[L]>_[L]&&(z=bl(z));var q=bl(z),Y=[];if(s&&Y.push(A[y]<=0),l&&Y.push(A[z]<=0,A[q]<=0),Y.every(function(Ke){return Ke})){M=$,F=!1;break}B.set($,Y)}if(F)for(var te=p?3:1,ge=function(Fe){var Qe=v.find(function(Xe){var W=B.get(Xe);if(W)return W.slice(0,Fe).every(function(ft){return ft})});if(Qe)return M=Qe,"break"},ye=te;ye>0;ye--){var me=ge(ye);if(me==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const AO={name:"flip",enabled:!0,phase:"main",fn:_O,requiresIfExists:["offset"],data:{_skip:!1}};function Yp(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function Xp(n){return[Jt,mn,pn,Gt].some(function(e){return n[e]>=0})}function TO(n){var e=n.state,t=n.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=vo(e,{elementContext:"reference"}),l=vo(e,{altBoundary:!0}),a=Yp(o,r),c=Yp(l,i,s),u=Xp(a),f=Xp(c);e.modifiersData[t]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const EO={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:TO};function MO(n,e,t){var r=Kn(n),i=[Gt,Jt].indexOf(r)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=s[0],l=s[1];return o=o||0,l=(l||0)*i,[Gt,mn].indexOf(r)>=0?{x:l,y:o}:{x:o,y:l}}function OO(n){var e=n.state,t=n.options,r=n.name,i=t.offset,s=i===void 0?[0,0]:i,o=Cy.reduce(function(u,f){return u[f]=MO(f,e.rects,s),u},{}),l=o[e.placement],a=l.x,c=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const $O={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:OO};function NO(n){var e=n.state,t=n.name;e.modifiersData[t]=Ny({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const DO={name:"popperOffsets",enabled:!0,phase:"read",fn:NO,data:{}};function xO(n){return n==="x"?"y":"x"}function IO(n){var e=n.state,t=n.options,r=n.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,l=o===void 0?!1:o,a=t.boundary,c=t.rootBoundary,u=t.altBoundary,f=t.padding,d=t.tether,h=d===void 0?!0:d,p=t.tetherOffset,m=p===void 0?0:p,g=vo(e,{boundary:a,rootBoundary:c,padding:f,altBoundary:u}),b=Kn(e.placement),C=ds(e.placement),E=!C,v=id(b),H=xO(v),_=e.modifiersData.popperOffsets,B=e.rects.reference,F=e.rects.popper,M=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,X=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),$=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,y={x:0,y:0};if(_){if(s){var w,O=v==="y"?Jt:Gt,L=v==="y"?pn:mn,A=v==="y"?"height":"width",z=_[v],q=z+g[O],Y=z-g[L],te=h?-F[A]/2:0,ge=C===cs?B[A]:F[A],ye=C===cs?-F[A]:-B[A],me=e.elements.arrow,Ke=h&&me?rd(me):{width:0,height:0},Fe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Ey(),Qe=Fe[O],Xe=Fe[L],W=Xs(0,B[A],Ke[A]),ft=E?B[A]/2-te-W-Qe-X.mainAxis:ge-W-Qe-X.mainAxis,Ht=E?-B[A]/2+te+W+Xe+X.mainAxis:ye+W+Xe+X.mainAxis,dt=e.elements.arrow&&Ho(e.elements.arrow),xn=dt?v==="y"?dt.clientTop||0:dt.clientLeft||0:0,Ee=(w=$==null?void 0:$[v])!=null?w:0,on=z+ft-Ee-xn,Le=z+Ht-Ee,at=Xs(h?Xl(q,on):q,z,h?hi(Y,Le):Y);_[v]=at,y[v]=at-z}if(l){var ht,hr=v==="x"?Jt:Gt,Ut=v==="x"?pn:mn,Yt=_[H],pt=H==="y"?"height":"width",In=Yt+g[hr],bn=Yt-g[Ut],pr=[Jt,Gt].indexOf(b)!==-1,D=(ht=$==null?void 0:$[H])!=null?ht:0,U=pr?In:Yt-B[pt]-F[pt]-D+X.altAxis,Q=pr?Yt+B[pt]+F[pt]-D-X.altAxis:bn,Zn=h&&pr?iO(U,Yt,Q):Xs(h?U:In,Yt,h?Q:bn);_[H]=Zn,y[H]=Zn-Yt}e.modifiersData[r]=y}}const RO={name:"preventOverflow",enabled:!0,phase:"main",fn:IO,requiresIfExists:["offset"]};function PO(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function LO(n){return n===sn(n)||!hn(n)?sd(n):PO(n)}function BO(n){var e=n.getBoundingClientRect(),t=us(e.width)/n.offsetWidth||1,r=us(e.height)/n.offsetHeight||1;return t!==1||r!==1}function FO(n,e,t){t===void 0&&(t=!1);var r=hn(e),i=hn(e)&&BO(e),s=qr(e),o=fs(n,i,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!t)&&((Yn(e)!=="body"||ld(s))&&(l=LO(e)),hn(e)?(a=fs(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):s&&(a.x=od(s))),{x:o.left+l.scrollLeft-a.x,y:o.top+l.scrollTop-a.y,width:o.width,height:o.height}}function zO(n){var e=new Map,t=new Set,r=[];n.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(l){if(!t.has(l)){var a=e.get(l);a&&i(a)}}),r.push(s)}return n.forEach(function(s){t.has(s.name)||i(s)}),r}function VO(n){var e=zO(n);return Z2.reduce(function(t,r){return t.concat(e.filter(function(i){return i.phase===r}))},[])}function HO(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function UO(n){var e=n.reduce(function(t,r){var i=t[r.name];return t[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var Qp={placement:"bottom",modifiers:[],strategy:"absolute"};function Zp(){for(var n=arguments.length,e=new Array(n),t=0;t-1}function Py(n,e){return typeof n=="function"?n.apply(void 0,e):n}function em(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function GO(n){return n.split(/\s+/).filter(Boolean)}function Hi(n){return[].concat(n)}function tm(n,e){n.indexOf(e)===-1&&n.push(e)}function YO(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function XO(n){return n.split("-")[0]}function Ql(n){return[].slice.call(n)}function nm(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function Zs(){return document.createElement("div")}function sc(n){return["Element","Fragment"].some(function(e){return ad(n,e)})}function QO(n){return ad(n,"NodeList")}function ZO(n){return ad(n,"MouseEvent")}function e$(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function t$(n){return sc(n)?[n]:QO(n)?Ql(n):Array.isArray(n)?n:Ql(document.querySelectorAll(n))}function Xc(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function rm(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function n$(n){var e,t=Hi(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function r$(n,e){var t=e.clientX,r=e.clientY;return n.every(function(i){var s=i.popperRect,o=i.popperState,l=i.props,a=l.interactiveBorder,c=XO(o.placement),u=o.modifiersData.offset;if(!u)return!0;var f=c==="bottom"?u.top.y:0,d=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,p=c==="left"?u.right.x:0,m=s.top-r+f>a,g=r-s.bottom-d>a,b=s.left-t+h>a,C=t-s.right-p>a;return m||g||b||C})}function Qc(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){n[r](i,t)})}function im(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var Hn={isTouch:!1},sm=0;function i$(){Hn.isTouch||(Hn.isTouch=!0,window.performance&&document.addEventListener("mousemove",Ly))}function Ly(){var n=performance.now();n-sm<20&&(Hn.isTouch=!1,document.removeEventListener("mousemove",Ly)),sm=n}function s$(){var n=document.activeElement;if(e$(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function o$(){document.addEventListener("touchstart",i$,Qr),window.addEventListener("blur",s$)}var l$=typeof window<"u"&&typeof document<"u",a$=l$?!!window.msCrypto:!1,c$={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},u$={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},kn=Object.assign({appendTo:Ry,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},c$,u$),f$=Object.keys(kn),d$=function(e){var t=Object.keys(e);t.forEach(function(r){kn[r]=e[r]})};function By(n){var e=n.plugins||[],t=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var l;r[s]=n[s]!==void 0?n[s]:(l=kn[s])!=null?l:o}return r},{});return Object.assign({},n,t)}function h$(n,e){var t=e?Object.keys(By(Object.assign({},kn,{plugins:e}))):f$,r=t.reduce(function(i,s){var o=(n.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function om(n,e){var t=Object.assign({},e,{content:Py(e.content,[n])},e.ignoreAttributes?{}:h$(n,e.plugins));return t.aria=Object.assign({},kn.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var p$=function(){return"innerHTML"};function Gu(n,e){n[p$()]=e}function lm(n){var e=Zs();return n===!0?e.className=xy:(e.className=Iy,sc(n)?e.appendChild(n):Gu(e,n)),e}function am(n,e){sc(e.content)?(Gu(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Gu(n,e.content):n.textContent=e.content)}function Yu(n){var e=n.firstElementChild,t=Ql(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(Dy)}),arrow:t.find(function(r){return r.classList.contains(xy)||r.classList.contains(Iy)}),backdrop:t.find(function(r){return r.classList.contains(JO)})}}function Fy(n){var e=Zs(),t=Zs();t.className=KO,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=Zs();r.className=Dy,r.setAttribute("data-state","hidden"),am(r,n.props),e.appendChild(t),t.appendChild(r),i(n.props,n.props);function i(s,o){var l=Yu(e),a=l.box,c=l.content,u=l.arrow;o.theme?a.setAttribute("data-theme",o.theme):a.removeAttribute("data-theme"),typeof o.animation=="string"?a.setAttribute("data-animation",o.animation):a.removeAttribute("data-animation"),o.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?a.setAttribute("role",o.role):a.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&am(c,n.props),o.arrow?u?s.arrow!==o.arrow&&(a.removeChild(u),a.appendChild(lm(o.arrow))):a.appendChild(lm(o.arrow)):u&&a.removeChild(u)}return{popper:e,onUpdate:i}}Fy.$$tippy=!0;var m$=1,rl=[],Zc=[];function g$(n,e){var t=om(n,Object.assign({},kn,By(nm(e)))),r,i,s,o=!1,l=!1,a=!1,c=!1,u,f,d,h=[],p=em(on,t.interactiveDebounce),m,g=m$++,b=null,C=YO(t.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:n,popper:Zs(),popperInstance:b,props:t,state:E,plugins:C,clearDelayTimeouts:U,setProps:Q,setContent:Zn,show:Di,hide:xi,hideWithInteractivity:Ii,enable:pr,disable:D,unmount:$s,destroy:Ns};if(!t.render)return v;var H=t.render(v),_=H.popper,B=H.onUpdate;_.setAttribute("data-tippy-root",""),_.id="tippy-"+v.id,v.popper=_,n._tippy=v,_._tippy=v;var F=C.map(function(N){return N.fn(v)}),M=n.hasAttribute("aria-expanded");return dt(),te(),z(),q("onCreate",[v]),t.showOnCreate&&In(),_.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),_.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&O().addEventListener("mousemove",p)}),v;function X(){var N=v.props.touch;return Array.isArray(N)?N:[N,0]}function $(){return X()[0]==="hold"}function y(){var N;return!!((N=v.props.render)!=null&&N.$$tippy)}function w(){return m||n}function O(){var N=w().parentNode;return N?n$(N):document}function L(){return Yu(_)}function A(N){return v.state.isMounted&&!v.state.isVisible||Hn.isTouch||u&&u.type==="focus"?0:Yc(v.props.delay,N?0:1,kn.delay)}function z(N){N===void 0&&(N=!1),_.style.pointerEvents=v.props.interactive&&!N?"":"none",_.style.zIndex=""+v.props.zIndex}function q(N,Z,he){if(he===void 0&&(he=!0),F.forEach(function($e){$e[N]&&$e[N].apply($e,Z)}),he){var Pe;(Pe=v.props)[N].apply(Pe,Z)}}function Y(){var N=v.props.aria;if(N.content){var Z="aria-"+N.content,he=_.id,Pe=Hi(v.props.triggerTarget||n);Pe.forEach(function($e){var ct=$e.getAttribute(Z);if(v.state.isVisible)$e.setAttribute(Z,ct?ct+" "+he:he);else{var xt=ct&&ct.replace(he,"").trim();xt?$e.setAttribute(Z,xt):$e.removeAttribute(Z)}})}}function te(){if(!(M||!v.props.aria.expanded)){var N=Hi(v.props.triggerTarget||n);N.forEach(function(Z){v.props.interactive?Z.setAttribute("aria-expanded",v.state.isVisible&&Z===w()?"true":"false"):Z.removeAttribute("aria-expanded")})}}function ge(){O().removeEventListener("mousemove",p),rl=rl.filter(function(N){return N!==p})}function ye(N){if(!(Hn.isTouch&&(a||N.type==="mousedown"))){var Z=N.composedPath&&N.composedPath()[0]||N.target;if(!(v.props.interactive&&im(_,Z))){if(Hi(v.props.triggerTarget||n).some(function(he){return im(he,Z)})){if(Hn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else q("onClickOutside",[v,N]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),l=!0,setTimeout(function(){l=!1}),v.state.isMounted||Qe())}}}function me(){a=!0}function Ke(){a=!1}function Fe(){var N=O();N.addEventListener("mousedown",ye,!0),N.addEventListener("touchend",ye,Qr),N.addEventListener("touchstart",Ke,Qr),N.addEventListener("touchmove",me,Qr)}function Qe(){var N=O();N.removeEventListener("mousedown",ye,!0),N.removeEventListener("touchend",ye,Qr),N.removeEventListener("touchstart",Ke,Qr),N.removeEventListener("touchmove",me,Qr)}function Xe(N,Z){ft(N,function(){!v.state.isVisible&&_.parentNode&&_.parentNode.contains(_)&&Z()})}function W(N,Z){ft(N,Z)}function ft(N,Z){var he=L().box;function Pe($e){$e.target===he&&(Qc(he,"remove",Pe),Z())}if(N===0)return Z();Qc(he,"remove",f),Qc(he,"add",Pe),f=Pe}function Ht(N,Z,he){he===void 0&&(he=!1);var Pe=Hi(v.props.triggerTarget||n);Pe.forEach(function($e){$e.addEventListener(N,Z,he),h.push({node:$e,eventType:N,handler:Z,options:he})})}function dt(){$()&&(Ht("touchstart",Ee,{passive:!0}),Ht("touchend",Le,{passive:!0})),GO(v.props.trigger).forEach(function(N){if(N!=="manual")switch(Ht(N,Ee),N){case"mouseenter":Ht("mouseleave",Le);break;case"focus":Ht(a$?"focusout":"blur",at);break;case"focusin":Ht("focusout",at);break}})}function xn(){h.forEach(function(N){var Z=N.node,he=N.eventType,Pe=N.handler,$e=N.options;Z.removeEventListener(he,Pe,$e)}),h=[]}function Ee(N){var Z,he=!1;if(!(!v.state.isEnabled||ht(N)||l)){var Pe=((Z=u)==null?void 0:Z.type)==="focus";u=N,m=N.currentTarget,te(),!v.state.isVisible&&ZO(N)&&rl.forEach(function($e){return $e(N)}),N.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?he=!0:In(N),N.type==="click"&&(o=!he),he&&!Pe&&bn(N)}}function on(N){var Z=N.target,he=w().contains(Z)||_.contains(Z);if(!(N.type==="mousemove"&&he)){var Pe=pt().concat(_).map(function($e){var ct,xt=$e._tippy,Rn=(ct=xt.popperInstance)==null?void 0:ct.state;return Rn?{popperRect:$e.getBoundingClientRect(),popperState:Rn,props:t}:null}).filter(Boolean);r$(Pe,N)&&(ge(),bn(N))}}function Le(N){var Z=ht(N)||v.props.trigger.indexOf("click")>=0&&o;if(!Z){if(v.props.interactive){v.hideWithInteractivity(N);return}bn(N)}}function at(N){v.props.trigger.indexOf("focusin")<0&&N.target!==w()||v.props.interactive&&N.relatedTarget&&_.contains(N.relatedTarget)||bn(N)}function ht(N){return Hn.isTouch?$()!==N.type.indexOf("touch")>=0:!1}function hr(){Ut();var N=v.props,Z=N.popperOptions,he=N.placement,Pe=N.offset,$e=N.getReferenceClientRect,ct=N.moveTransition,xt=y()?Yu(_).arrow:null,Rn=$e?{getBoundingClientRect:$e,contextElement:$e.contextElement||w()}:n,Ri={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(mr){var er=mr.state;if(y()){var Ds=L(),Gr=Ds.box;["placement","reference-hidden","escaped"].forEach(function(Yr){Yr==="placement"?Gr.setAttribute("data-placement",er.placement):er.attributes.popper["data-popper-"+Yr]?Gr.setAttribute("data-"+Yr,""):Gr.removeAttribute("data-"+Yr)}),er.attributes.popper={}}}},Pn=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ct}},Ri];y()&&xt&&Pn.push({name:"arrow",options:{element:xt,padding:3}}),Pn.push.apply(Pn,(Z==null?void 0:Z.modifiers)||[]),v.popperInstance=qO(Rn,_,Object.assign({},Z,{placement:he,onFirstUpdate:d,modifiers:Pn}))}function Ut(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Yt(){var N=v.props.appendTo,Z,he=w();v.props.interactive&&N===Ry||N==="parent"?Z=he.parentNode:Z=Py(N,[he]),Z.contains(_)||Z.appendChild(_),v.state.isMounted=!0,hr()}function pt(){return Ql(_.querySelectorAll("[data-tippy-root]"))}function In(N){v.clearDelayTimeouts(),N&&q("onTrigger",[v,N]),Fe();var Z=A(!0),he=X(),Pe=he[0],$e=he[1];Hn.isTouch&&Pe==="hold"&&$e&&(Z=$e),Z?r=setTimeout(function(){v.show()},Z):v.show()}function bn(N){if(v.clearDelayTimeouts(),q("onUntrigger",[v,N]),!v.state.isVisible){Qe();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&o)){var Z=A(!1);Z?i=setTimeout(function(){v.state.isVisible&&v.hide()},Z):s=requestAnimationFrame(function(){v.hide()})}}function pr(){v.state.isEnabled=!0}function D(){v.hide(),v.state.isEnabled=!1}function U(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function Q(N){if(!v.state.isDestroyed){q("onBeforeUpdate",[v,N]),xn();var Z=v.props,he=om(n,Object.assign({},Z,nm(N),{ignoreAttributes:!0}));v.props=he,dt(),Z.interactiveDebounce!==he.interactiveDebounce&&(ge(),p=em(on,he.interactiveDebounce)),Z.triggerTarget&&!he.triggerTarget?Hi(Z.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):he.triggerTarget&&n.removeAttribute("aria-expanded"),te(),z(),B&&B(Z,he),v.popperInstance&&(hr(),pt().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),q("onAfterUpdate",[v,N])}}function Zn(N){v.setProps({content:N})}function Di(){var N=v.state.isVisible,Z=v.state.isDestroyed,he=!v.state.isEnabled,Pe=Hn.isTouch&&!v.props.touch,$e=Yc(v.props.duration,0,kn.duration);if(!(N||Z||he||Pe)&&!w().hasAttribute("disabled")&&(q("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,y()&&(_.style.visibility="visible"),z(),Fe(),v.state.isMounted||(_.style.transition="none"),y()){var ct=L(),xt=ct.box,Rn=ct.content;Xc([xt,Rn],0)}d=function(){var Pn;if(!(!v.state.isVisible||c)){if(c=!0,_.offsetHeight,_.style.transition=v.props.moveTransition,y()&&v.props.animation){var Jr=L(),mr=Jr.box,er=Jr.content;Xc([mr,er],$e),rm([mr,er],"visible")}Y(),te(),tm(Zc,v),(Pn=v.popperInstance)==null||Pn.forceUpdate(),q("onMount",[v]),v.props.animation&&y()&&W($e,function(){v.state.isShown=!0,q("onShown",[v])})}},Yt()}}function xi(){var N=!v.state.isVisible,Z=v.state.isDestroyed,he=!v.state.isEnabled,Pe=Yc(v.props.duration,1,kn.duration);if(!(N||Z||he)&&(q("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,o=!1,y()&&(_.style.visibility="hidden"),ge(),Qe(),z(!0),y()){var $e=L(),ct=$e.box,xt=$e.content;v.props.animation&&(Xc([ct,xt],Pe),rm([ct,xt],"hidden"))}Y(),te(),v.props.animation?y()&&Xe(Pe,v.unmount):v.unmount()}}function Ii(N){O().addEventListener("mousemove",p),tm(rl,p),p(N)}function $s(){v.state.isVisible&&v.hide(),v.state.isMounted&&(Ut(),pt().forEach(function(N){N._tippy.unmount()}),_.parentNode&&_.parentNode.removeChild(_),Zc=Zc.filter(function(N){return N!==v}),v.state.isMounted=!1,q("onHidden",[v]))}function Ns(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),xn(),delete n._tippy,v.state.isDestroyed=!0,q("onDestroy",[v]))}}function Uo(n,e){e===void 0&&(e={});var t=kn.plugins.concat(e.plugins||[]);o$();var r=Object.assign({},e,{plugins:t}),i=t$(n),s=i.reduce(function(o,l){var a=l&&g$(l,r);return a&&o.push(a),o},[]);return sc(n)?s[0]:s}Uo.defaultProps=kn;Uo.setDefaultProps=d$;Uo.currentInput=Hn;Object.assign({},_y,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});Uo.setDefaultProps({render:Fy});class b${constructor({editor:e,element:t,view:r,tippyOptions:i={},updateDelay:s=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:l,state:a,from:c,to:u})=>{const{doc:f,selection:d}=a,{empty:h}=d,p=!f.textBetween(c,u).length&&qf(a.selection),m=this.element.contains(document.activeElement);return!(!(l.hasFocus()||m)||h||p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(l.relatedTarget))||this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,a)=>{const c=!(a!=null&&a.selection.eq(l.state.selection)),u=!(a!=null&&a.doc.eq(l.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,c,u,a)},this.updateDelay))},this.updateHandler=(l,a,c,u)=>{var f,d,h;const{state:p,composing:m}=l,{selection:g}=p;if(m||!a&&!c)return;this.createTooltip();const{ranges:C}=g,E=Math.min(...C.map(_=>_.$from.pos)),v=Math.max(...C.map(_=>_.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:l,state:p,oldState:u,from:E,to:v}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(sC(p.selection)){let _=l.nodeDOM(E);const B=_.dataset.nodeViewWrapper?_:_.querySelector("[data-node-view-wrapper]");if(B&&(_=B.firstChild),_)return _.getBoundingClientRect()}return oC(l,E,v)})}),this.show()},this.editor=e,this.element=t,this.view=r,this.updateDelay=s,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.tippy||!t||(this.tippy=Uo(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:r}=e,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const s=!(t!=null&&t.selection.eq(e.state.selection)),o=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,s,o,t)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,t;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const y$=n=>new ut({key:typeof n.pluginKey=="string"?new Pt(n.pluginKey):n.pluginKey,view:e=>new b$({view:e,...n})}),zy=Ot.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[y$({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}}),v$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",w$="ελ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",hs=(n,e)=>{for(const t in e)n[t]=e[t];return n},Xu="numeric",Qu="ascii",Zu="alpha",yl="asciinumeric",il="alphanumeric",ef="domain",Vy="emoji",k$="scheme",S$="slashscheme",cm="whitespace";function C$(n,e){return n in e||(e[n]=[]),e[n]}function li(n,e,t){e[Xu]&&(e[yl]=!0,e[il]=!0),e[Qu]&&(e[yl]=!0,e[Zu]=!0),e[yl]&&(e[il]=!0),e[Zu]&&(e[il]=!0),e[il]&&(e[ef]=!0),e[Vy]&&(e[ef]=!0);for(const r in e){const i=C$(r,t);i.indexOf(n)<0&&i.push(n)}}function _$(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Wt(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}Wt.groups={};Wt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,i),ln=(n,e,t,r,i)=>n.tr(e,t,r,i),um=(n,e,t,r,i)=>n.ts(e,t,r,i),K=(n,e,t,r,i)=>n.tt(e,t,r,i),ir="WORD",tf="UWORD",wo="LOCALHOST",nf="TLD",rf="UTLD",vl="SCHEME",Ui="SLASH_SCHEME",cd="NUM",Hy="WS",ud="NL",eo="OPENBRACE",to="CLOSEBRACE",Zl="OPENBRACKET",ea="CLOSEBRACKET",ta="OPENPAREN",na="CLOSEPAREN",ra="OPENANGLEBRACKET",ia="CLOSEANGLEBRACKET",sa="FULLWIDTHLEFTPAREN",oa="FULLWIDTHRIGHTPAREN",la="LEFTCORNERBRACKET",aa="RIGHTCORNERBRACKET",ca="LEFTWHITECORNERBRACKET",ua="RIGHTWHITECORNERBRACKET",fa="FULLWIDTHLESSTHAN",da="FULLWIDTHGREATERTHAN",ha="AMPERSAND",pa="APOSTROPHE",ma="ASTERISK",Ar="AT",ga="BACKSLASH",ba="BACKTICK",ya="CARET",Mr="COLON",fd="COMMA",va="DOLLAR",Fn="DOT",wa="EQUALS",dd="EXCLAMATION",zn="HYPHEN",ka="PERCENT",Sa="PIPE",Ca="PLUS",_a="POUND",Aa="QUERY",hd="QUOTE",pd="SEMI",Vn="SLASH",no="TILDE",Ta="UNDERSCORE",Uy="EMOJI",Ea="SYM";var jy=Object.freeze({__proto__:null,WORD:ir,UWORD:tf,LOCALHOST:wo,TLD:nf,UTLD:rf,SCHEME:vl,SLASH_SCHEME:Ui,NUM:cd,WS:Hy,NL:ud,OPENBRACE:eo,CLOSEBRACE:to,OPENBRACKET:Zl,CLOSEBRACKET:ea,OPENPAREN:ta,CLOSEPAREN:na,OPENANGLEBRACKET:ra,CLOSEANGLEBRACKET:ia,FULLWIDTHLEFTPAREN:sa,FULLWIDTHRIGHTPAREN:oa,LEFTCORNERBRACKET:la,RIGHTCORNERBRACKET:aa,LEFTWHITECORNERBRACKET:ca,RIGHTWHITECORNERBRACKET:ua,FULLWIDTHLESSTHAN:fa,FULLWIDTHGREATERTHAN:da,AMPERSAND:ha,APOSTROPHE:pa,ASTERISK:ma,AT:Ar,BACKSLASH:ga,BACKTICK:ba,CARET:ya,COLON:Mr,COMMA:fd,DOLLAR:va,DOT:Fn,EQUALS:wa,EXCLAMATION:dd,HYPHEN:zn,PERCENT:ka,PIPE:Sa,PLUS:Ca,POUND:_a,QUERY:Aa,QUOTE:hd,SEMI:pd,SLASH:Vn,TILDE:no,UNDERSCORE:Ta,EMOJI:Uy,SYM:Ea});const Fi=/[a-z]/,eu=new RegExp("\\p{L}","u"),tu=new RegExp("\\p{Emoji}","u"),nu=/\d/,fm=/\s/,dm=` -`,A$="️",T$="‍";let sl=null,ol=null;function E$(n){n===void 0&&(n=[]);const e={};Wt.groups=e;const t=new Wt;sl==null&&(sl=hm(v$)),ol==null&&(ol=hm(w$)),K(t,"'",pa),K(t,"{",eo),K(t,"}",to),K(t,"[",Zl),K(t,"]",ea),K(t,"(",ta),K(t,")",na),K(t,"<",ra),K(t,">",ia),K(t,"(",sa),K(t,")",oa),K(t,"「",la),K(t,"」",aa),K(t,"『",ca),K(t,"』",ua),K(t,"<",fa),K(t,">",da),K(t,"&",ha),K(t,"*",ma),K(t,"@",Ar),K(t,"`",ba),K(t,"^",ya),K(t,":",Mr),K(t,",",fd),K(t,"$",va),K(t,".",Fn),K(t,"=",wa),K(t,"!",dd),K(t,"-",zn),K(t,"%",ka),K(t,"|",Sa),K(t,"+",Ca),K(t,"#",_a),K(t,"?",Aa),K(t,'"',hd),K(t,"/",Vn),K(t,";",pd),K(t,"~",no),K(t,"_",Ta),K(t,"\\",ga);const r=ln(t,nu,cd,{[Xu]:!0});ln(r,nu,r);const i=ln(t,Fi,ir,{[Qu]:!0});ln(i,Fi,i);const s=ln(t,eu,tf,{[Zu]:!0});ln(s,Fi),ln(s,eu,s);const o=ln(t,fm,Hy,{[cm]:!0});K(t,dm,ud,{[cm]:!0}),K(o,dm),ln(o,fm,o);const l=ln(t,tu,Uy,{[Vy]:!0});ln(l,tu,l),K(l,A$,l);const a=K(l,T$);ln(a,tu,l);const c=[[Fi,i]],u=[[Fi,null],[eu,s]];for(let f=0;ff[0]>d[0]?1:-1);for(let f=0;f=0?p[ef]=!0:Fi.test(d)?nu.test(d)?p[yl]=!0:p[Qu]=!0:p[Xu]=!0,um(t,d,d,p)}return um(t,"localhost",wo,{ascii:!0}),t.jd=new Wt(Ea),{start:t,tokens:hs({groups:e},jy)}}function M$(n,e){const t=O$(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o=0&&(f+=t[o].length,d++),c+=t[o].length,s+=t[o].length,o++;s-=f,o-=d,c-=f,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function O$(n){const e=[],t=n.length;let r=0;for(;r56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function vr(n,e,t,r,i){let s;const o=e.length;for(let l=0;l=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const ko={defaultProtocol:"http",events:null,format:pm,formatHref:pm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function md(n,e){e===void 0&&(e=null);let t=hs({},ko);n&&(t=hs(t,n instanceof md?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;st?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=ko.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&hs(o,u),{tagName:i,attributes:o,content:s,eventListeners:f}}};function oc(n,e){class t extends Wy{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const mm=oc("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gm=oc("text"),$$=oc("nl"),ll=oc("url",{isLink:!0,toHref(n){return n===void 0&&(n=ko.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==wo&&n[1].t===Mr}}),an=n=>new Wt(n);function N$(n){let{groups:e}=n;const t=e.domain.concat([ha,ma,Ar,ga,ba,ya,va,wa,zn,cd,ka,Sa,Ca,_a,Vn,Ea,no,Ta]),r=[pa,Mr,fd,Fn,dd,Aa,hd,pd,ra,ia,eo,to,ea,Zl,ta,na,sa,oa,la,aa,ca,ua,fa,da],i=[ha,pa,ma,ga,ba,ya,va,wa,zn,eo,to,ka,Sa,Ca,_a,Aa,Vn,Ea,no,Ta],s=an(),o=K(s,no);Ce(o,i,o),Ce(o,e.domain,o);const l=an(),a=an(),c=an();Ce(s,e.domain,l),Ce(s,e.scheme,a),Ce(s,e.slashscheme,c),Ce(l,i,o),Ce(l,e.domain,l);const u=K(l,Ar);K(o,Ar,u),K(a,Ar,u),K(c,Ar,u);const f=K(o,Fn);Ce(f,i,o),Ce(f,e.domain,o);const d=an();Ce(u,e.domain,d),Ce(d,e.domain,d);const h=K(d,Fn);Ce(h,e.domain,d);const p=an(mm);Ce(h,e.tld,p),Ce(h,e.utld,p),K(u,wo,p);const m=K(d,zn);Ce(m,e.domain,d),Ce(p,e.domain,d),K(p,Fn,h),K(p,zn,m);const g=K(p,Mr);Ce(g,e.numeric,mm);const b=K(l,zn),C=K(l,Fn);Ce(b,e.domain,l),Ce(C,i,o),Ce(C,e.domain,l);const E=an(ll);Ce(C,e.tld,E),Ce(C,e.utld,E),Ce(E,e.domain,l),Ce(E,i,o),K(E,Fn,C),K(E,zn,b),K(E,Ar,u);const v=K(E,Mr),H=an(ll);Ce(v,e.numeric,H);const _=an(ll),B=an();Ce(_,t,_),Ce(_,r,B),Ce(B,t,_),Ce(B,r,B),K(E,Vn,_),K(H,Vn,_);const F=K(a,Mr),M=K(c,Mr),X=K(M,Vn),$=K(X,Vn);Ce(a,e.domain,l),K(a,Fn,C),K(a,zn,b),Ce(c,e.domain,l),K(c,Fn,C),K(c,zn,b),Ce(F,e.domain,_),K(F,Vn,_),Ce($,e.domain,_),Ce($,t,_),K($,Vn,_);const y=[[eo,to],[Zl,ea],[ta,na],[ra,ia],[sa,oa],[la,aa],[ca,ua],[fa,da]];for(let w=0;w=0&&d++,i++,u++;if(d<0)i-=u,i0&&(s.push(ru(gm,e,o)),o=[]),i-=d,u-=d;const h=f.t,p=t.slice(i-u,i);s.push(ru(h,e,p))}}return o.length>0&&s.push(ru(gm,e,o)),s}function ru(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const x$=typeof console<"u"&&console&&console.warn||(()=>{}),I$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ze={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function R$(){Wt.groups={},Ze.scanner=null,Ze.parser=null,Ze.tokenQueue=[],Ze.pluginQueue=[],Ze.customSchemes=[],Ze.initialized=!1}function bm(n,e){if(e===void 0&&(e=!1),Ze.initialized&&x$(`linkifyjs: already initialized - will not register custom scheme "${n}" ${I$}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. +`;function P2(n){const e=localStorage.getItem("edited")??`light_note_${Date.now()}`,t=window.prompt("Please insert file name",e);if(!t)return;if(t.trim().length===0){window.alert(`Invalid file name. filename: ${t}`);return}localStorage.setItem("edited",t);const r=n.getHTML(),i=new Blob([R2,r],{type:"text/html;charset=utf-8"}),s=document.createElement("a");s.setAttribute("href",window.URL.createObjectURL(i)),s.setAttribute("download",t),s.click()}async function L2(n,e){e&&(localStorage.setItem("edited",e[0].name),n.commands.setContent(await e[0].text()))}function B2(n){const e=n.getAttributes("link").href,t=window.prompt("Please insert link url",e);if(t!==null){if(t.trim().length===0){n.chain().focus().extendMarkRange("link").unsetLink().run();return}n.chain().focus().extendMarkRange("link").setLink({href:t}).run()}}function F2(n){n.commands.clearContent(),n.commands.focus()}function z2(n){const e=window.prompt("Please insert image url");!e||e.trim().length===0||n.chain().focus().setImage({src:e}).run()}function Gc(n,e){try{if(!n||!(n.startsWith("ws://")||n.startsWith("wss://")))throw new Error("Invalid endpoint. endpoint should start with ws:// or wss://");if(!e)throw new Error("Invalid workspace");location.replace(`${location.protocol}//${location.host}${location.pathname}?endpoint=${n}&workspace=${e}`)}catch(t){window.alert(t.toString()),console.error(t)}}function V2(n){localStorage.removeItem("sharing"),n&&(window.alert("Disconnecting..."),location.replace(`${location.protocol}//${location.host}${location.pathname}`))}var Jt="top",mn="bottom",gn="right",Gt="left",td="auto",Vo=[Jt,mn,gn,Gt],cs="start",yo="end",H2="clippingParents",Sy="viewport",zs="popper",U2="reference",Wp=Vo.reduce(function(n,e){return n.concat([e+"-"+cs,e+"-"+yo])},[]),Cy=[].concat(Vo,[td]).reduce(function(n,e){return n.concat([e,e+"-"+cs,e+"-"+yo])},[]),j2="beforeRead",W2="read",q2="afterRead",K2="beforeMain",J2="main",G2="afterMain",Y2="beforeWrite",X2="write",Q2="afterWrite",Z2=[j2,W2,q2,K2,J2,G2,Y2,X2,Q2];function Xn(n){return n?(n.nodeName||"").toLowerCase():null}function on(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Si(n){var e=on(n).Element;return n instanceof e||n instanceof Element}function pn(n){var e=on(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function nd(n){if(typeof ShadowRoot>"u")return!1;var e=on(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function eO(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!pn(s)||!Xn(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var l=i[o];l===!1?s.removeAttribute(o):s.setAttribute(o,l===!0?"":l)}))})}function tO(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),l=o.reduce(function(a,c){return a[c]="",a},{});!pn(i)||!Xn(i)||(Object.assign(i.style,l),Object.keys(s).forEach(function(a){i.removeAttribute(a)}))})}}const _y={name:"applyStyles",enabled:!0,phase:"write",fn:eO,effect:tO,requires:["computeStyles"]};function Jn(n){return n.split("-")[0]}var hi=Math.max,Xl=Math.min,us=Math.round;function Ku(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ay(){return!/^((?!chrome|android).)*safari/i.test(Ku())}function fs(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,s=1;e&&pn(n)&&(i=n.offsetWidth>0&&us(r.width)/n.offsetWidth||1,s=n.offsetHeight>0&&us(r.height)/n.offsetHeight||1);var o=Si(n)?on(n):window,l=o.visualViewport,a=!Ay()&&t,c=(r.left+(a&&l?l.offsetLeft:0))/i,u=(r.top+(a&&l?l.offsetTop:0))/s,f=r.width/i,d=r.height/s;return{width:f,height:d,top:u,right:c+f,bottom:u+d,left:c,x:c,y:u}}function rd(n){var e=fs(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function Ty(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&nd(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fr(n){return on(n).getComputedStyle(n)}function nO(n){return["table","td","th"].indexOf(Xn(n))>=0}function qr(n){return((Si(n)?n.ownerDocument:n.document)||window.document).documentElement}function ic(n){return Xn(n)==="html"?n:n.assignedSlot||n.parentNode||(nd(n)?n.host:null)||qr(n)}function qp(n){return!pn(n)||fr(n).position==="fixed"?null:n.offsetParent}function rO(n){var e=/firefox/i.test(Ku()),t=/Trident/i.test(Ku());if(t&&pn(n)){var r=fr(n);if(r.position==="fixed")return null}var i=ic(n);for(nd(i)&&(i=i.host);pn(i)&&["html","body"].indexOf(Xn(i))<0;){var s=fr(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Ho(n){for(var e=on(n),t=qp(n);t&&nO(t)&&fr(t).position==="static";)t=qp(t);return t&&(Xn(t)==="html"||Xn(t)==="body"&&fr(t).position==="static")?e:t||rO(n)||e}function id(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Xs(n,e,t){return hi(n,Xl(e,t))}function iO(n,e,t){var r=Xs(n,e,t);return r>t?t:r}function Ey(){return{top:0,right:0,bottom:0,left:0}}function My(n){return Object.assign({},Ey(),n)}function Oy(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var sO=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,My(typeof e!="number"?e:Oy(e,Vo))};function oO(n){var e,t=n.state,r=n.name,i=n.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,l=Jn(t.placement),a=id(l),c=[Gt,gn].indexOf(l)>=0,u=c?"height":"width";if(!(!s||!o)){var f=sO(i.padding,t),d=rd(s),h=a==="y"?Jt:Gt,p=a==="y"?mn:gn,m=t.rects.reference[u]+t.rects.reference[a]-o[a]-t.rects.popper[u],g=o[a]-t.rects.reference[a],b=Ho(s),C=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,E=m/2-g/2,v=f[h],H=C-d[u]-f[p],_=C/2-d[u]/2+E,B=Xs(v,_,H),F=a;t.modifiersData[r]=(e={},e[F]=B,e.centerOffset=B-_,e)}}function lO(n){var e=n.state,t=n.options,r=t.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Ty(e.elements.popper,i)&&(e.elements.arrow=i))}const aO={name:"arrow",enabled:!0,phase:"main",fn:oO,effect:lO,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ds(n){return n.split("-")[1]}var cO={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uO(n,e){var t=n.x,r=n.y,i=e.devicePixelRatio||1;return{x:us(t*i)/i||0,y:us(r*i)/i||0}}function Kp(n){var e,t=n.popper,r=n.popperRect,i=n.placement,s=n.variation,o=n.offsets,l=n.position,a=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,f=n.isFixed,d=o.x,h=d===void 0?0:d,p=o.y,m=p===void 0?0:p,g=typeof u=="function"?u({x:h,y:m}):{x:h,y:m};h=g.x,m=g.y;var b=o.hasOwnProperty("x"),C=o.hasOwnProperty("y"),E=Gt,v=Jt,H=window;if(c){var _=Ho(t),B="clientHeight",F="clientWidth";if(_===on(t)&&(_=qr(t),fr(_).position!=="static"&&l==="absolute"&&(B="scrollHeight",F="scrollWidth")),_=_,i===Jt||(i===Gt||i===gn)&&s===yo){v=mn;var M=f&&_===H&&H.visualViewport?H.visualViewport.height:_[B];m-=M-r.height,m*=a?1:-1}if(i===Gt||(i===Jt||i===mn)&&s===yo){E=gn;var X=f&&_===H&&H.visualViewport?H.visualViewport.width:_[F];h-=X-r.width,h*=a?1:-1}}var $=Object.assign({position:l},c&&cO),y=u===!0?uO({x:h,y:m},on(t)):{x:h,y:m};if(h=y.x,m=y.y,a){var w;return Object.assign({},$,(w={},w[v]=C?"0":"",w[E]=b?"0":"",w.transform=(H.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",w))}return Object.assign({},$,(e={},e[v]=C?m+"px":"",e[E]=b?h+"px":"",e.transform="",e))}function fO(n){var e=n.state,t=n.options,r=t.gpuAcceleration,i=r===void 0?!0:r,s=t.adaptive,o=s===void 0?!0:s,l=t.roundOffsets,a=l===void 0?!0:l,c={placement:Jn(e.placement),variation:ds(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Kp(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Kp(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const dO={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:fO,data:{}};var nl={passive:!0};function hO(n){var e=n.state,t=n.instance,r=n.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,l=o===void 0?!0:o,a=on(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",t.update,nl)}),l&&a.addEventListener("resize",t.update,nl),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",t.update,nl)}),l&&a.removeEventListener("resize",t.update,nl)}}const pO={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:hO,data:{}};var mO={left:"right",right:"left",bottom:"top",top:"bottom"};function bl(n){return n.replace(/left|right|bottom|top/g,function(e){return mO[e]})}var gO={start:"end",end:"start"};function Jp(n){return n.replace(/start|end/g,function(e){return gO[e]})}function sd(n){var e=on(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function od(n){return fs(qr(n)).left+sd(n).scrollLeft}function bO(n,e){var t=on(n),r=qr(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;var c=Ay();(c||!c&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:s,height:o,x:l+od(n),y:a}}function yO(n){var e,t=qr(n),r=sd(n),i=(e=n.ownerDocument)==null?void 0:e.body,s=hi(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=hi(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),l=-r.scrollLeft+od(n),a=-r.scrollTop;return fr(i||t).direction==="rtl"&&(l+=hi(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:l,y:a}}function ld(n){var e=fr(n),t=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+r)}function $y(n){return["html","body","#document"].indexOf(Xn(n))>=0?n.ownerDocument.body:pn(n)&&ld(n)?n:$y(ic(n))}function Qs(n,e){var t;e===void 0&&(e=[]);var r=$y(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=on(r),o=i?[s].concat(s.visualViewport||[],ld(r)?r:[]):r,l=e.concat(o);return i?l:l.concat(Qs(ic(o)))}function Ju(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function vO(n,e){var t=fs(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Gp(n,e,t){return e===Sy?Ju(bO(n,t)):Si(e)?vO(e,t):Ju(yO(qr(n)))}function wO(n){var e=Qs(ic(n)),t=["absolute","fixed"].indexOf(fr(n).position)>=0,r=t&&pn(n)?Ho(n):n;return Si(r)?e.filter(function(i){return Si(i)&&Ty(i,r)&&Xn(i)!=="body"}):[]}function kO(n,e,t,r){var i=e==="clippingParents"?wO(n):[].concat(e),s=[].concat(i,[t]),o=s[0],l=s.reduce(function(a,c){var u=Gp(n,c,r);return a.top=hi(u.top,a.top),a.right=Xl(u.right,a.right),a.bottom=Xl(u.bottom,a.bottom),a.left=hi(u.left,a.left),a},Gp(n,o,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function Ny(n){var e=n.reference,t=n.element,r=n.placement,i=r?Jn(r):null,s=r?ds(r):null,o=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(i){case Jt:a={x:o,y:e.y-t.height};break;case mn:a={x:o,y:e.y+e.height};break;case gn:a={x:e.x+e.width,y:l};break;case Gt:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var c=i?id(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case cs:a[c]=a[c]-(e[u]/2-t[u]/2);break;case yo:a[c]=a[c]+(e[u]/2-t[u]/2);break}}return a}function vo(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=r===void 0?n.placement:r,s=t.strategy,o=s===void 0?n.strategy:s,l=t.boundary,a=l===void 0?H2:l,c=t.rootBoundary,u=c===void 0?Sy:c,f=t.elementContext,d=f===void 0?zs:f,h=t.altBoundary,p=h===void 0?!1:h,m=t.padding,g=m===void 0?0:m,b=My(typeof g!="number"?g:Oy(g,Vo)),C=d===zs?U2:zs,E=n.rects.popper,v=n.elements[p?C:d],H=kO(Si(v)?v:v.contextElement||qr(n.elements.popper),a,u,o),_=fs(n.elements.reference),B=Ny({reference:_,element:E,strategy:"absolute",placement:i}),F=Ju(Object.assign({},E,B)),M=d===zs?F:_,X={top:H.top-M.top+b.top,bottom:M.bottom-H.bottom+b.bottom,left:H.left-M.left+b.left,right:M.right-H.right+b.right},$=n.modifiersData.offset;if(d===zs&&$){var y=$[i];Object.keys(X).forEach(function(w){var O=[gn,mn].indexOf(w)>=0?1:-1,L=[Jt,mn].indexOf(w)>=0?"y":"x";X[w]+=y[L]*O})}return X}function SO(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,l=t.flipVariations,a=t.allowedAutoPlacements,c=a===void 0?Cy:a,u=ds(r),f=u?l?Wp:Wp.filter(function(p){return ds(p)===u}):Vo,d=f.filter(function(p){return c.indexOf(p)>=0});d.length===0&&(d=f);var h=d.reduce(function(p,m){return p[m]=vo(n,{placement:m,boundary:i,rootBoundary:s,padding:o})[Jn(m)],p},{});return Object.keys(h).sort(function(p,m){return h[p]-h[m]})}function CO(n){if(Jn(n)===td)return[];var e=bl(n);return[Jp(n),e,Jp(e)]}function _O(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,l=o===void 0?!0:o,a=t.fallbackPlacements,c=t.padding,u=t.boundary,f=t.rootBoundary,d=t.altBoundary,h=t.flipVariations,p=h===void 0?!0:h,m=t.allowedAutoPlacements,g=e.options.placement,b=Jn(g),C=b===g,E=a||(C||!p?[bl(g)]:CO(g)),v=[g].concat(E).reduce(function(Ke,Be){return Ke.concat(Jn(Be)===td?SO(e,{placement:Be,boundary:u,rootBoundary:f,padding:c,flipVariations:p,allowedAutoPlacements:m}):Be)},[]),H=e.rects.reference,_=e.rects.popper,B=new Map,F=!0,M=v[0],X=0;X=0,L=O?"width":"height",A=vo(e,{placement:$,boundary:u,rootBoundary:f,altBoundary:d,padding:c}),z=O?w?gn:Gt:w?mn:Jt;H[L]>_[L]&&(z=bl(z));var q=bl(z),Y=[];if(s&&Y.push(A[y]<=0),l&&Y.push(A[z]<=0,A[q]<=0),Y.every(function(Ke){return Ke})){M=$,F=!1;break}B.set($,Y)}if(F)for(var te=p?3:1,ge=function(Be){var Ze=v.find(function(Qe){var W=B.get(Qe);if(W)return W.slice(0,Be).every(function(ft){return ft})});if(Ze)return M=Ze,"break"},ye=te;ye>0;ye--){var me=ge(ye);if(me==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const AO={name:"flip",enabled:!0,phase:"main",fn:_O,requiresIfExists:["offset"],data:{_skip:!1}};function Yp(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function Xp(n){return[Jt,gn,mn,Gt].some(function(e){return n[e]>=0})}function TO(n){var e=n.state,t=n.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=vo(e,{elementContext:"reference"}),l=vo(e,{altBoundary:!0}),a=Yp(o,r),c=Yp(l,i,s),u=Xp(a),f=Xp(c);e.modifiersData[t]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const EO={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:TO};function MO(n,e,t){var r=Jn(n),i=[Gt,Jt].indexOf(r)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=s[0],l=s[1];return o=o||0,l=(l||0)*i,[Gt,gn].indexOf(r)>=0?{x:l,y:o}:{x:o,y:l}}function OO(n){var e=n.state,t=n.options,r=n.name,i=t.offset,s=i===void 0?[0,0]:i,o=Cy.reduce(function(u,f){return u[f]=MO(f,e.rects,s),u},{}),l=o[e.placement],a=l.x,c=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const $O={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:OO};function NO(n){var e=n.state,t=n.name;e.modifiersData[t]=Ny({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const DO={name:"popperOffsets",enabled:!0,phase:"read",fn:NO,data:{}};function xO(n){return n==="x"?"y":"x"}function IO(n){var e=n.state,t=n.options,r=n.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,l=o===void 0?!1:o,a=t.boundary,c=t.rootBoundary,u=t.altBoundary,f=t.padding,d=t.tether,h=d===void 0?!0:d,p=t.tetherOffset,m=p===void 0?0:p,g=vo(e,{boundary:a,rootBoundary:c,padding:f,altBoundary:u}),b=Jn(e.placement),C=ds(e.placement),E=!C,v=id(b),H=xO(v),_=e.modifiersData.popperOffsets,B=e.rects.reference,F=e.rects.popper,M=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,X=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),$=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,y={x:0,y:0};if(_){if(s){var w,O=v==="y"?Jt:Gt,L=v==="y"?mn:gn,A=v==="y"?"height":"width",z=_[v],q=z+g[O],Y=z-g[L],te=h?-F[A]/2:0,ge=C===cs?B[A]:F[A],ye=C===cs?-F[A]:-B[A],me=e.elements.arrow,Ke=h&&me?rd(me):{width:0,height:0},Be=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Ey(),Ze=Be[O],Qe=Be[L],W=Xs(0,B[A],Ke[A]),ft=E?B[A]/2-te-W-Ze-X.mainAxis:ge-W-Ze-X.mainAxis,Ht=E?-B[A]/2+te+W+Qe+X.mainAxis:ye+W+Qe+X.mainAxis,dt=e.elements.arrow&&Ho(e.elements.arrow),In=dt?v==="y"?dt.clientTop||0:dt.clientLeft||0:0,Ee=(w=$==null?void 0:$[v])!=null?w:0,Yt=z+ft-Ee-In,ht=z+Ht-Ee,Ve=Xs(h?Xl(q,Yt):q,z,h?hi(Y,ht):Y);_[v]=Ve,y[v]=Ve-z}if(l){var Je,ln=v==="x"?Jt:Gt,Ut=v==="x"?mn:gn,Xt=_[H],pt=H==="y"?"height":"width",Rn=Xt+g[ln],yn=Xt-g[Ut],pr=[Jt,Gt].indexOf(b)!==-1,D=(Je=$==null?void 0:$[H])!=null?Je:0,U=pr?Rn:Xt-B[pt]-F[pt]-D+X.altAxis,Q=pr?Xt+B[pt]+F[pt]-D-X.altAxis:yn,er=h&&pr?iO(U,Xt,Q):Xs(h?U:Rn,Xt,h?Q:yn);_[H]=er,y[H]=er-Xt}e.modifiersData[r]=y}}const RO={name:"preventOverflow",enabled:!0,phase:"main",fn:IO,requiresIfExists:["offset"]};function PO(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function LO(n){return n===on(n)||!pn(n)?sd(n):PO(n)}function BO(n){var e=n.getBoundingClientRect(),t=us(e.width)/n.offsetWidth||1,r=us(e.height)/n.offsetHeight||1;return t!==1||r!==1}function FO(n,e,t){t===void 0&&(t=!1);var r=pn(e),i=pn(e)&&BO(e),s=qr(e),o=fs(n,i,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!t)&&((Xn(e)!=="body"||ld(s))&&(l=LO(e)),pn(e)?(a=fs(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):s&&(a.x=od(s))),{x:o.left+l.scrollLeft-a.x,y:o.top+l.scrollTop-a.y,width:o.width,height:o.height}}function zO(n){var e=new Map,t=new Set,r=[];n.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(l){if(!t.has(l)){var a=e.get(l);a&&i(a)}}),r.push(s)}return n.forEach(function(s){t.has(s.name)||i(s)}),r}function VO(n){var e=zO(n);return Z2.reduce(function(t,r){return t.concat(e.filter(function(i){return i.phase===r}))},[])}function HO(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function UO(n){var e=n.reduce(function(t,r){var i=t[r.name];return t[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var Qp={placement:"bottom",modifiers:[],strategy:"absolute"};function Zp(){for(var n=arguments.length,e=new Array(n),t=0;t-1}function Py(n,e){return typeof n=="function"?n.apply(void 0,e):n}function em(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function GO(n){return n.split(/\s+/).filter(Boolean)}function Hi(n){return[].concat(n)}function tm(n,e){n.indexOf(e)===-1&&n.push(e)}function YO(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function XO(n){return n.split("-")[0]}function Ql(n){return[].slice.call(n)}function nm(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function Zs(){return document.createElement("div")}function sc(n){return["Element","Fragment"].some(function(e){return ad(n,e)})}function QO(n){return ad(n,"NodeList")}function ZO(n){return ad(n,"MouseEvent")}function e$(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function t$(n){return sc(n)?[n]:QO(n)?Ql(n):Array.isArray(n)?n:Ql(document.querySelectorAll(n))}function Xc(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function rm(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function n$(n){var e,t=Hi(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function r$(n,e){var t=e.clientX,r=e.clientY;return n.every(function(i){var s=i.popperRect,o=i.popperState,l=i.props,a=l.interactiveBorder,c=XO(o.placement),u=o.modifiersData.offset;if(!u)return!0;var f=c==="bottom"?u.top.y:0,d=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,p=c==="left"?u.right.x:0,m=s.top-r+f>a,g=r-s.bottom-d>a,b=s.left-t+h>a,C=t-s.right-p>a;return m||g||b||C})}function Qc(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){n[r](i,t)})}function im(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var Un={isTouch:!1},sm=0;function i$(){Un.isTouch||(Un.isTouch=!0,window.performance&&document.addEventListener("mousemove",Ly))}function Ly(){var n=performance.now();n-sm<20&&(Un.isTouch=!1,document.removeEventListener("mousemove",Ly)),sm=n}function s$(){var n=document.activeElement;if(e$(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function o$(){document.addEventListener("touchstart",i$,Qr),window.addEventListener("blur",s$)}var l$=typeof window<"u"&&typeof document<"u",a$=l$?!!window.msCrypto:!1,c$={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},u$={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Sn=Object.assign({appendTo:Ry,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},c$,u$),f$=Object.keys(Sn),d$=function(e){var t=Object.keys(e);t.forEach(function(r){Sn[r]=e[r]})};function By(n){var e=n.plugins||[],t=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var l;r[s]=n[s]!==void 0?n[s]:(l=Sn[s])!=null?l:o}return r},{});return Object.assign({},n,t)}function h$(n,e){var t=e?Object.keys(By(Object.assign({},Sn,{plugins:e}))):f$,r=t.reduce(function(i,s){var o=(n.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function om(n,e){var t=Object.assign({},e,{content:Py(e.content,[n])},e.ignoreAttributes?{}:h$(n,e.plugins));return t.aria=Object.assign({},Sn.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var p$=function(){return"innerHTML"};function Gu(n,e){n[p$()]=e}function lm(n){var e=Zs();return n===!0?e.className=xy:(e.className=Iy,sc(n)?e.appendChild(n):Gu(e,n)),e}function am(n,e){sc(e.content)?(Gu(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Gu(n,e.content):n.textContent=e.content)}function Yu(n){var e=n.firstElementChild,t=Ql(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(Dy)}),arrow:t.find(function(r){return r.classList.contains(xy)||r.classList.contains(Iy)}),backdrop:t.find(function(r){return r.classList.contains(JO)})}}function Fy(n){var e=Zs(),t=Zs();t.className=KO,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=Zs();r.className=Dy,r.setAttribute("data-state","hidden"),am(r,n.props),e.appendChild(t),t.appendChild(r),i(n.props,n.props);function i(s,o){var l=Yu(e),a=l.box,c=l.content,u=l.arrow;o.theme?a.setAttribute("data-theme",o.theme):a.removeAttribute("data-theme"),typeof o.animation=="string"?a.setAttribute("data-animation",o.animation):a.removeAttribute("data-animation"),o.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?a.setAttribute("role",o.role):a.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&am(c,n.props),o.arrow?u?s.arrow!==o.arrow&&(a.removeChild(u),a.appendChild(lm(o.arrow))):a.appendChild(lm(o.arrow)):u&&a.removeChild(u)}return{popper:e,onUpdate:i}}Fy.$$tippy=!0;var m$=1,rl=[],Zc=[];function g$(n,e){var t=om(n,Object.assign({},Sn,By(nm(e)))),r,i,s,o=!1,l=!1,a=!1,c=!1,u,f,d,h=[],p=em(Yt,t.interactiveDebounce),m,g=m$++,b=null,C=YO(t.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:n,popper:Zs(),popperInstance:b,props:t,state:E,plugins:C,clearDelayTimeouts:U,setProps:Q,setContent:er,show:Di,hide:xi,hideWithInteractivity:Ii,enable:pr,disable:D,unmount:$s,destroy:Ns};if(!t.render)return v;var H=t.render(v),_=H.popper,B=H.onUpdate;_.setAttribute("data-tippy-root",""),_.id="tippy-"+v.id,v.popper=_,n._tippy=v,_._tippy=v;var F=C.map(function(N){return N.fn(v)}),M=n.hasAttribute("aria-expanded");return dt(),te(),z(),q("onCreate",[v]),t.showOnCreate&&Rn(),_.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),_.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&O().addEventListener("mousemove",p)}),v;function X(){var N=v.props.touch;return Array.isArray(N)?N:[N,0]}function $(){return X()[0]==="hold"}function y(){var N;return!!((N=v.props.render)!=null&&N.$$tippy)}function w(){return m||n}function O(){var N=w().parentNode;return N?n$(N):document}function L(){return Yu(_)}function A(N){return v.state.isMounted&&!v.state.isVisible||Un.isTouch||u&&u.type==="focus"?0:Yc(v.props.delay,N?0:1,Sn.delay)}function z(N){N===void 0&&(N=!1),_.style.pointerEvents=v.props.interactive&&!N?"":"none",_.style.zIndex=""+v.props.zIndex}function q(N,Z,he){if(he===void 0&&(he=!0),F.forEach(function($e){$e[N]&&$e[N].apply($e,Z)}),he){var Pe;(Pe=v.props)[N].apply(Pe,Z)}}function Y(){var N=v.props.aria;if(N.content){var Z="aria-"+N.content,he=_.id,Pe=Hi(v.props.triggerTarget||n);Pe.forEach(function($e){var ct=$e.getAttribute(Z);if(v.state.isVisible)$e.setAttribute(Z,ct?ct+" "+he:he);else{var xt=ct&&ct.replace(he,"").trim();xt?$e.setAttribute(Z,xt):$e.removeAttribute(Z)}})}}function te(){if(!(M||!v.props.aria.expanded)){var N=Hi(v.props.triggerTarget||n);N.forEach(function(Z){v.props.interactive?Z.setAttribute("aria-expanded",v.state.isVisible&&Z===w()?"true":"false"):Z.removeAttribute("aria-expanded")})}}function ge(){O().removeEventListener("mousemove",p),rl=rl.filter(function(N){return N!==p})}function ye(N){if(!(Un.isTouch&&(a||N.type==="mousedown"))){var Z=N.composedPath&&N.composedPath()[0]||N.target;if(!(v.props.interactive&&im(_,Z))){if(Hi(v.props.triggerTarget||n).some(function(he){return im(he,Z)})){if(Un.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else q("onClickOutside",[v,N]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),l=!0,setTimeout(function(){l=!1}),v.state.isMounted||Ze())}}}function me(){a=!0}function Ke(){a=!1}function Be(){var N=O();N.addEventListener("mousedown",ye,!0),N.addEventListener("touchend",ye,Qr),N.addEventListener("touchstart",Ke,Qr),N.addEventListener("touchmove",me,Qr)}function Ze(){var N=O();N.removeEventListener("mousedown",ye,!0),N.removeEventListener("touchend",ye,Qr),N.removeEventListener("touchstart",Ke,Qr),N.removeEventListener("touchmove",me,Qr)}function Qe(N,Z){ft(N,function(){!v.state.isVisible&&_.parentNode&&_.parentNode.contains(_)&&Z()})}function W(N,Z){ft(N,Z)}function ft(N,Z){var he=L().box;function Pe($e){$e.target===he&&(Qc(he,"remove",Pe),Z())}if(N===0)return Z();Qc(he,"remove",f),Qc(he,"add",Pe),f=Pe}function Ht(N,Z,he){he===void 0&&(he=!1);var Pe=Hi(v.props.triggerTarget||n);Pe.forEach(function($e){$e.addEventListener(N,Z,he),h.push({node:$e,eventType:N,handler:Z,options:he})})}function dt(){$()&&(Ht("touchstart",Ee,{passive:!0}),Ht("touchend",ht,{passive:!0})),GO(v.props.trigger).forEach(function(N){if(N!=="manual")switch(Ht(N,Ee),N){case"mouseenter":Ht("mouseleave",ht);break;case"focus":Ht(a$?"focusout":"blur",Ve);break;case"focusin":Ht("focusout",Ve);break}})}function In(){h.forEach(function(N){var Z=N.node,he=N.eventType,Pe=N.handler,$e=N.options;Z.removeEventListener(he,Pe,$e)}),h=[]}function Ee(N){var Z,he=!1;if(!(!v.state.isEnabled||Je(N)||l)){var Pe=((Z=u)==null?void 0:Z.type)==="focus";u=N,m=N.currentTarget,te(),!v.state.isVisible&&ZO(N)&&rl.forEach(function($e){return $e(N)}),N.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?he=!0:Rn(N),N.type==="click"&&(o=!he),he&&!Pe&&yn(N)}}function Yt(N){var Z=N.target,he=w().contains(Z)||_.contains(Z);if(!(N.type==="mousemove"&&he)){var Pe=pt().concat(_).map(function($e){var ct,xt=$e._tippy,Pn=(ct=xt.popperInstance)==null?void 0:ct.state;return Pn?{popperRect:$e.getBoundingClientRect(),popperState:Pn,props:t}:null}).filter(Boolean);r$(Pe,N)&&(ge(),yn(N))}}function ht(N){var Z=Je(N)||v.props.trigger.indexOf("click")>=0&&o;if(!Z){if(v.props.interactive){v.hideWithInteractivity(N);return}yn(N)}}function Ve(N){v.props.trigger.indexOf("focusin")<0&&N.target!==w()||v.props.interactive&&N.relatedTarget&&_.contains(N.relatedTarget)||yn(N)}function Je(N){return Un.isTouch?$()!==N.type.indexOf("touch")>=0:!1}function ln(){Ut();var N=v.props,Z=N.popperOptions,he=N.placement,Pe=N.offset,$e=N.getReferenceClientRect,ct=N.moveTransition,xt=y()?Yu(_).arrow:null,Pn=$e?{getBoundingClientRect:$e,contextElement:$e.contextElement||w()}:n,Ri={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(mr){var tr=mr.state;if(y()){var Ds=L(),Gr=Ds.box;["placement","reference-hidden","escaped"].forEach(function(Yr){Yr==="placement"?Gr.setAttribute("data-placement",tr.placement):tr.attributes.popper["data-popper-"+Yr]?Gr.setAttribute("data-"+Yr,""):Gr.removeAttribute("data-"+Yr)}),tr.attributes.popper={}}}},Ln=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ct}},Ri];y()&&xt&&Ln.push({name:"arrow",options:{element:xt,padding:3}}),Ln.push.apply(Ln,(Z==null?void 0:Z.modifiers)||[]),v.popperInstance=qO(Pn,_,Object.assign({},Z,{placement:he,onFirstUpdate:d,modifiers:Ln}))}function Ut(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Xt(){var N=v.props.appendTo,Z,he=w();v.props.interactive&&N===Ry||N==="parent"?Z=he.parentNode:Z=Py(N,[he]),Z.contains(_)||Z.appendChild(_),v.state.isMounted=!0,ln()}function pt(){return Ql(_.querySelectorAll("[data-tippy-root]"))}function Rn(N){v.clearDelayTimeouts(),N&&q("onTrigger",[v,N]),Be();var Z=A(!0),he=X(),Pe=he[0],$e=he[1];Un.isTouch&&Pe==="hold"&&$e&&(Z=$e),Z?r=setTimeout(function(){v.show()},Z):v.show()}function yn(N){if(v.clearDelayTimeouts(),q("onUntrigger",[v,N]),!v.state.isVisible){Ze();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&o)){var Z=A(!1);Z?i=setTimeout(function(){v.state.isVisible&&v.hide()},Z):s=requestAnimationFrame(function(){v.hide()})}}function pr(){v.state.isEnabled=!0}function D(){v.hide(),v.state.isEnabled=!1}function U(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function Q(N){if(!v.state.isDestroyed){q("onBeforeUpdate",[v,N]),In();var Z=v.props,he=om(n,Object.assign({},Z,nm(N),{ignoreAttributes:!0}));v.props=he,dt(),Z.interactiveDebounce!==he.interactiveDebounce&&(ge(),p=em(Yt,he.interactiveDebounce)),Z.triggerTarget&&!he.triggerTarget?Hi(Z.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):he.triggerTarget&&n.removeAttribute("aria-expanded"),te(),z(),B&&B(Z,he),v.popperInstance&&(ln(),pt().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),q("onAfterUpdate",[v,N])}}function er(N){v.setProps({content:N})}function Di(){var N=v.state.isVisible,Z=v.state.isDestroyed,he=!v.state.isEnabled,Pe=Un.isTouch&&!v.props.touch,$e=Yc(v.props.duration,0,Sn.duration);if(!(N||Z||he||Pe)&&!w().hasAttribute("disabled")&&(q("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,y()&&(_.style.visibility="visible"),z(),Be(),v.state.isMounted||(_.style.transition="none"),y()){var ct=L(),xt=ct.box,Pn=ct.content;Xc([xt,Pn],0)}d=function(){var Ln;if(!(!v.state.isVisible||c)){if(c=!0,_.offsetHeight,_.style.transition=v.props.moveTransition,y()&&v.props.animation){var Jr=L(),mr=Jr.box,tr=Jr.content;Xc([mr,tr],$e),rm([mr,tr],"visible")}Y(),te(),tm(Zc,v),(Ln=v.popperInstance)==null||Ln.forceUpdate(),q("onMount",[v]),v.props.animation&&y()&&W($e,function(){v.state.isShown=!0,q("onShown",[v])})}},Xt()}}function xi(){var N=!v.state.isVisible,Z=v.state.isDestroyed,he=!v.state.isEnabled,Pe=Yc(v.props.duration,1,Sn.duration);if(!(N||Z||he)&&(q("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,o=!1,y()&&(_.style.visibility="hidden"),ge(),Ze(),z(!0),y()){var $e=L(),ct=$e.box,xt=$e.content;v.props.animation&&(Xc([ct,xt],Pe),rm([ct,xt],"hidden"))}Y(),te(),v.props.animation?y()&&Qe(Pe,v.unmount):v.unmount()}}function Ii(N){O().addEventListener("mousemove",p),tm(rl,p),p(N)}function $s(){v.state.isVisible&&v.hide(),v.state.isMounted&&(Ut(),pt().forEach(function(N){N._tippy.unmount()}),_.parentNode&&_.parentNode.removeChild(_),Zc=Zc.filter(function(N){return N!==v}),v.state.isMounted=!1,q("onHidden",[v]))}function Ns(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),In(),delete n._tippy,v.state.isDestroyed=!0,q("onDestroy",[v]))}}function Uo(n,e){e===void 0&&(e={});var t=Sn.plugins.concat(e.plugins||[]);o$();var r=Object.assign({},e,{plugins:t}),i=t$(n),s=i.reduce(function(o,l){var a=l&&g$(l,r);return a&&o.push(a),o},[]);return sc(n)?s[0]:s}Uo.defaultProps=Sn;Uo.setDefaultProps=d$;Uo.currentInput=Un;Object.assign({},_y,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});Uo.setDefaultProps({render:Fy});class b${constructor({editor:e,element:t,view:r,tippyOptions:i={},updateDelay:s=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:l,state:a,from:c,to:u})=>{const{doc:f,selection:d}=a,{empty:h}=d,p=!f.textBetween(c,u).length&&qf(a.selection),m=this.element.contains(document.activeElement);return!(!(l.hasFocus()||m)||h||p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(l.relatedTarget))||this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,a)=>{const c=!(a!=null&&a.selection.eq(l.state.selection)),u=!(a!=null&&a.doc.eq(l.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,c,u,a)},this.updateDelay))},this.updateHandler=(l,a,c,u)=>{var f,d,h;const{state:p,composing:m}=l,{selection:g}=p;if(m||!a&&!c)return;this.createTooltip();const{ranges:C}=g,E=Math.min(...C.map(_=>_.$from.pos)),v=Math.max(...C.map(_=>_.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:l,state:p,oldState:u,from:E,to:v}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(sC(p.selection)){let _=l.nodeDOM(E);const B=_.dataset.nodeViewWrapper?_:_.querySelector("[data-node-view-wrapper]");if(B&&(_=B.firstChild),_)return _.getBoundingClientRect()}return oC(l,E,v)})}),this.show()},this.editor=e,this.element=t,this.view=r,this.updateDelay=s,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.tippy||!t||(this.tippy=Uo(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:r}=e,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const s=!(t!=null&&t.selection.eq(e.state.selection)),o=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,s,o,t)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,t;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const y$=n=>new ut({key:typeof n.pluginKey=="string"?new Pt(n.pluginKey):n.pluginKey,view:e=>new b$({view:e,...n})}),zy=Ot.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[y$({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}}),v$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",w$="ελ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",hs=(n,e)=>{for(const t in e)n[t]=e[t];return n},Xu="numeric",Qu="ascii",Zu="alpha",yl="asciinumeric",il="alphanumeric",ef="domain",Vy="emoji",k$="scheme",S$="slashscheme",cm="whitespace";function C$(n,e){return n in e||(e[n]=[]),e[n]}function li(n,e,t){e[Xu]&&(e[yl]=!0,e[il]=!0),e[Qu]&&(e[yl]=!0,e[Zu]=!0),e[yl]&&(e[il]=!0),e[Zu]&&(e[il]=!0),e[il]&&(e[ef]=!0),e[Vy]&&(e[ef]=!0);for(const r in e){const i=C$(r,t);i.indexOf(n)<0&&i.push(n)}}function _$(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Wt(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}Wt.groups={};Wt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,i),an=(n,e,t,r,i)=>n.tr(e,t,r,i),um=(n,e,t,r,i)=>n.ts(e,t,r,i),K=(n,e,t,r,i)=>n.tt(e,t,r,i),sr="WORD",tf="UWORD",wo="LOCALHOST",nf="TLD",rf="UTLD",vl="SCHEME",Ui="SLASH_SCHEME",cd="NUM",Hy="WS",ud="NL",eo="OPENBRACE",to="CLOSEBRACE",Zl="OPENBRACKET",ea="CLOSEBRACKET",ta="OPENPAREN",na="CLOSEPAREN",ra="OPENANGLEBRACKET",ia="CLOSEANGLEBRACKET",sa="FULLWIDTHLEFTPAREN",oa="FULLWIDTHRIGHTPAREN",la="LEFTCORNERBRACKET",aa="RIGHTCORNERBRACKET",ca="LEFTWHITECORNERBRACKET",ua="RIGHTWHITECORNERBRACKET",fa="FULLWIDTHLESSTHAN",da="FULLWIDTHGREATERTHAN",ha="AMPERSAND",pa="APOSTROPHE",ma="ASTERISK",Ar="AT",ga="BACKSLASH",ba="BACKTICK",ya="CARET",Mr="COLON",fd="COMMA",va="DOLLAR",zn="DOT",wa="EQUALS",dd="EXCLAMATION",Vn="HYPHEN",ka="PERCENT",Sa="PIPE",Ca="PLUS",_a="POUND",Aa="QUERY",hd="QUOTE",pd="SEMI",Hn="SLASH",no="TILDE",Ta="UNDERSCORE",Uy="EMOJI",Ea="SYM";var jy=Object.freeze({__proto__:null,WORD:sr,UWORD:tf,LOCALHOST:wo,TLD:nf,UTLD:rf,SCHEME:vl,SLASH_SCHEME:Ui,NUM:cd,WS:Hy,NL:ud,OPENBRACE:eo,CLOSEBRACE:to,OPENBRACKET:Zl,CLOSEBRACKET:ea,OPENPAREN:ta,CLOSEPAREN:na,OPENANGLEBRACKET:ra,CLOSEANGLEBRACKET:ia,FULLWIDTHLEFTPAREN:sa,FULLWIDTHRIGHTPAREN:oa,LEFTCORNERBRACKET:la,RIGHTCORNERBRACKET:aa,LEFTWHITECORNERBRACKET:ca,RIGHTWHITECORNERBRACKET:ua,FULLWIDTHLESSTHAN:fa,FULLWIDTHGREATERTHAN:da,AMPERSAND:ha,APOSTROPHE:pa,ASTERISK:ma,AT:Ar,BACKSLASH:ga,BACKTICK:ba,CARET:ya,COLON:Mr,COMMA:fd,DOLLAR:va,DOT:zn,EQUALS:wa,EXCLAMATION:dd,HYPHEN:Vn,PERCENT:ka,PIPE:Sa,PLUS:Ca,POUND:_a,QUERY:Aa,QUOTE:hd,SEMI:pd,SLASH:Hn,TILDE:no,UNDERSCORE:Ta,EMOJI:Uy,SYM:Ea});const Fi=/[a-z]/,eu=new RegExp("\\p{L}","u"),tu=new RegExp("\\p{Emoji}","u"),nu=/\d/,fm=/\s/,dm=` +`,A$="️",T$="‍";let sl=null,ol=null;function E$(n){n===void 0&&(n=[]);const e={};Wt.groups=e;const t=new Wt;sl==null&&(sl=hm(v$)),ol==null&&(ol=hm(w$)),K(t,"'",pa),K(t,"{",eo),K(t,"}",to),K(t,"[",Zl),K(t,"]",ea),K(t,"(",ta),K(t,")",na),K(t,"<",ra),K(t,">",ia),K(t,"(",sa),K(t,")",oa),K(t,"「",la),K(t,"」",aa),K(t,"『",ca),K(t,"』",ua),K(t,"<",fa),K(t,">",da),K(t,"&",ha),K(t,"*",ma),K(t,"@",Ar),K(t,"`",ba),K(t,"^",ya),K(t,":",Mr),K(t,",",fd),K(t,"$",va),K(t,".",zn),K(t,"=",wa),K(t,"!",dd),K(t,"-",Vn),K(t,"%",ka),K(t,"|",Sa),K(t,"+",Ca),K(t,"#",_a),K(t,"?",Aa),K(t,'"',hd),K(t,"/",Hn),K(t,";",pd),K(t,"~",no),K(t,"_",Ta),K(t,"\\",ga);const r=an(t,nu,cd,{[Xu]:!0});an(r,nu,r);const i=an(t,Fi,sr,{[Qu]:!0});an(i,Fi,i);const s=an(t,eu,tf,{[Zu]:!0});an(s,Fi),an(s,eu,s);const o=an(t,fm,Hy,{[cm]:!0});K(t,dm,ud,{[cm]:!0}),K(o,dm),an(o,fm,o);const l=an(t,tu,Uy,{[Vy]:!0});an(l,tu,l),K(l,A$,l);const a=K(l,T$);an(a,tu,l);const c=[[Fi,i]],u=[[Fi,null],[eu,s]];for(let f=0;ff[0]>d[0]?1:-1);for(let f=0;f=0?p[ef]=!0:Fi.test(d)?nu.test(d)?p[yl]=!0:p[Qu]=!0:p[Xu]=!0,um(t,d,d,p)}return um(t,"localhost",wo,{ascii:!0}),t.jd=new Wt(Ea),{start:t,tokens:hs({groups:e},jy)}}function M$(n,e){const t=O$(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o=0&&(f+=t[o].length,d++),c+=t[o].length,s+=t[o].length,o++;s-=f,o-=d,c-=f,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function O$(n){const e=[],t=n.length;let r=0;for(;r56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function vr(n,e,t,r,i){let s;const o=e.length;for(let l=0;l=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const ko={defaultProtocol:"http",events:null,format:pm,formatHref:pm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function md(n,e){e===void 0&&(e=null);let t=hs({},ko);n&&(t=hs(t,n instanceof md?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;st?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=ko.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&hs(o,u),{tagName:i,attributes:o,content:s,eventListeners:f}}};function oc(n,e){class t extends Wy{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const mm=oc("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gm=oc("text"),$$=oc("nl"),ll=oc("url",{isLink:!0,toHref(n){return n===void 0&&(n=ko.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==wo&&n[1].t===Mr}}),cn=n=>new Wt(n);function N$(n){let{groups:e}=n;const t=e.domain.concat([ha,ma,Ar,ga,ba,ya,va,wa,Vn,cd,ka,Sa,Ca,_a,Hn,Ea,no,Ta]),r=[pa,Mr,fd,zn,dd,Aa,hd,pd,ra,ia,eo,to,ea,Zl,ta,na,sa,oa,la,aa,ca,ua,fa,da],i=[ha,pa,ma,ga,ba,ya,va,wa,Vn,eo,to,ka,Sa,Ca,_a,Aa,Hn,Ea,no,Ta],s=cn(),o=K(s,no);Ce(o,i,o),Ce(o,e.domain,o);const l=cn(),a=cn(),c=cn();Ce(s,e.domain,l),Ce(s,e.scheme,a),Ce(s,e.slashscheme,c),Ce(l,i,o),Ce(l,e.domain,l);const u=K(l,Ar);K(o,Ar,u),K(a,Ar,u),K(c,Ar,u);const f=K(o,zn);Ce(f,i,o),Ce(f,e.domain,o);const d=cn();Ce(u,e.domain,d),Ce(d,e.domain,d);const h=K(d,zn);Ce(h,e.domain,d);const p=cn(mm);Ce(h,e.tld,p),Ce(h,e.utld,p),K(u,wo,p);const m=K(d,Vn);Ce(m,e.domain,d),Ce(p,e.domain,d),K(p,zn,h),K(p,Vn,m);const g=K(p,Mr);Ce(g,e.numeric,mm);const b=K(l,Vn),C=K(l,zn);Ce(b,e.domain,l),Ce(C,i,o),Ce(C,e.domain,l);const E=cn(ll);Ce(C,e.tld,E),Ce(C,e.utld,E),Ce(E,e.domain,l),Ce(E,i,o),K(E,zn,C),K(E,Vn,b),K(E,Ar,u);const v=K(E,Mr),H=cn(ll);Ce(v,e.numeric,H);const _=cn(ll),B=cn();Ce(_,t,_),Ce(_,r,B),Ce(B,t,_),Ce(B,r,B),K(E,Hn,_),K(H,Hn,_);const F=K(a,Mr),M=K(c,Mr),X=K(M,Hn),$=K(X,Hn);Ce(a,e.domain,l),K(a,zn,C),K(a,Vn,b),Ce(c,e.domain,l),K(c,zn,C),K(c,Vn,b),Ce(F,e.domain,_),K(F,Hn,_),Ce($,e.domain,_),Ce($,t,_),K($,Hn,_);const y=[[eo,to],[Zl,ea],[ta,na],[ra,ia],[sa,oa],[la,aa],[ca,ua],[fa,da]];for(let w=0;w=0&&d++,i++,u++;if(d<0)i-=u,i0&&(s.push(ru(gm,e,o)),o=[]),i-=d,u-=d;const h=f.t,p=t.slice(i-u,i);s.push(ru(h,e,p))}}return o.length>0&&s.push(ru(gm,e,o)),s}function ru(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const x$=typeof console<"u"&&console&&console.warn||(()=>{}),I$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",et={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function R$(){Wt.groups={},et.scanner=null,et.parser=null,et.tokenQueue=[],et.pluginQueue=[],et.customSchemes=[],et.initialized=!1}function bm(n,e){if(e===void 0&&(e=!1),et.initialized&&x$(`linkifyjs: already initialized - will not register custom scheme "${n}" ${I$}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" -3. "-" cannot repeat`);Ze.customSchemes.push([n,e])}function P$(){Ze.scanner=E$(Ze.customSchemes);for(let n=0;n{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=KS(t.doc,[...e]);if(nC(l).forEach(({newRange:c})=>{const u=GS(r.doc,c,h=>h.isTextblock);let f,d;if(u.length>1?(f=u[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(f=u[0],d=r.doc.textBetween(f.pos,c.to,void 0," ")),f&&d){const h=d.split(" ").filter(g=>g!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;gd(p).filter(g=>g.isLink).map(g=>({...g,from:m+g.start+1,to:m+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>n.validate?n.validate(g.value):!0).forEach(g=>{Yf(g.from,g.to,r.doc).some(b=>b.mark.type===n.type)||o.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!o.steps.length)return o}})}function F$(n){return new ut({key:new Pt("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0)return!1;let o=r.target;const l=[];for(;o.nodeName!=="DIV";)l.push(o),o=o.parentNode;if(!l.find(d=>d.nodeName==="A"))return!1;const a=zb(e.state,n.type.name),c=r.target,u=(i=c==null?void 0:c.href)!==null&&i!==void 0?i:a.href,f=(s=c==null?void 0:c.target)!==null&&s!==void 0?s:a.target;return c&&u?(window.open(u,f),!0):!1}}})}function z$(n){return new ut({key:new Pt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=gd(l).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}const qy=On.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){bm(n);return}bm(n.scheme,n.optionalSlashes)})},onDestroy(){R$()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",tt(this.options.HTMLAttributes,{...n,href:""}),0]:["a",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[wi({find:n=>{const e=[];if(n){const t=gd(n).filter(r=>r.isLink);t.length&&t.forEach(r=>e.push({text:r.value,data:{href:r.href},index:r.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(B$({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(F$({type:this.type})),this.options.linkOnPaste&&n.push(z$({editor:this.editor,type:this.type})),n}}),Ky=Ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ut({key:new Pt("placeholder"),props:{decorations:({doc:n,selection:e})=>{var t;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!r)return null;const{firstChild:o}=n.content,l=o&&o.type.isLeaf,a=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((t=n.type.contentMatch.defaultType)===null||t===void 0?void 0:t.name),u=n.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!l||!a);return n.descendants((f,d)=>{const h=i>=d&&i<=d+f.nodeSize,p=!f.isLeaf&&!f.childCount;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];u&&m.push(this.options.emptyEditorClass);const g=tn.node(d,d+f.nodeSize,{class:m.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:d,hasAnchor:h}):this.options.placeholder});s.push(g)}return this.options.includeChildren}),st.create(n,s)}}})]}}),Jy=Ot.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),V$=/^\s*>\s$/,H$=$t.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[go({find:V$,type:this.type})]}}),U$=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,j$=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,W$=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,q$=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,K$=On.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[as({find:U$,type:this.type}),as({find:W$,type:this.type})]},addPasteRules(){return[wi({find:j$,type:this.type}),wi({find:q$,type:this.type})]}}),J$=$t.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",tt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ym=On.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=rc(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),vm=/^\s*([-+*])\s$/,G$=$t.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:n}){return["ul",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(J$.name,this.editor.getAttributes(ym.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=go({find:vm,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=go({find:vm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ym.name),editor:this.editor})),[n]}}),Y$=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,X$=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,Q$=On.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[as({find:Y$,type:this.type})]},addPasteRules(){return[wi({find:X$,type:this.type})]}}),Z$=/^```([a-z]+)?[\s\n]$/,eN=/^~~~([a-z]+)?[\s\n]$/,tN=$t.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",tt(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` +3. "-" cannot repeat`);et.customSchemes.push([n,e])}function P$(){et.scanner=E$(et.customSchemes);for(let n=0;n{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=KS(t.doc,[...e]);if(nC(l).forEach(({newRange:c})=>{const u=GS(r.doc,c,h=>h.isTextblock);let f,d;if(u.length>1?(f=u[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(f=u[0],d=r.doc.textBetween(f.pos,c.to,void 0," ")),f&&d){const h=d.split(" ").filter(g=>g!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;gd(p).filter(g=>g.isLink).map(g=>({...g,from:m+g.start+1,to:m+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>n.validate?n.validate(g.value):!0).forEach(g=>{Yf(g.from,g.to,r.doc).some(b=>b.mark.type===n.type)||o.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!o.steps.length)return o}})}function F$(n){return new ut({key:new Pt("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0)return!1;let o=r.target;const l=[];for(;o.nodeName!=="DIV";)l.push(o),o=o.parentNode;if(!l.find(d=>d.nodeName==="A"))return!1;const a=zb(e.state,n.type.name),c=r.target,u=(i=c==null?void 0:c.href)!==null&&i!==void 0?i:a.href,f=(s=c==null?void 0:c.target)!==null&&s!==void 0?s:a.target;return c&&u?(window.open(u,f),!0):!1}}})}function z$(n){return new ut({key:new Pt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=gd(l).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}const qy=$n.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){bm(n);return}bm(n.scheme,n.optionalSlashes)})},onDestroy(){R$()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",nt(this.options.HTMLAttributes,{...n,href:""}),0]:["a",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[wi({find:n=>{const e=[];if(n){const t=gd(n).filter(r=>r.isLink);t.length&&t.forEach(r=>e.push({text:r.value,data:{href:r.href},index:r.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(B$({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(F$({type:this.type})),this.options.linkOnPaste&&n.push(z$({editor:this.editor,type:this.type})),n}}),Ky=Ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ut({key:new Pt("placeholder"),props:{decorations:({doc:n,selection:e})=>{var t;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!r)return null;const{firstChild:o}=n.content,l=o&&o.type.isLeaf,a=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((t=n.type.contentMatch.defaultType)===null||t===void 0?void 0:t.name),u=n.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!l||!a);return n.descendants((f,d)=>{const h=i>=d&&i<=d+f.nodeSize,p=!f.isLeaf&&!f.childCount;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];u&&m.push(this.options.emptyEditorClass);const g=nn.node(d,d+f.nodeSize,{class:m.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:d,hasAnchor:h}):this.options.placeholder});s.push(g)}return this.options.includeChildren}),ot.create(n,s)}}})]}}),Jy=Ot.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),V$=/^\s*>\s$/,H$=$t.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[go({find:V$,type:this.type})]}}),U$=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,j$=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,W$=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,q$=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,K$=$n.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[as({find:U$,type:this.type}),as({find:W$,type:this.type})]},addPasteRules(){return[wi({find:j$,type:this.type}),wi({find:q$,type:this.type})]}}),J$=$t.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",nt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ym=$n.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=rc(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),vm=/^\s*([-+*])\s$/,G$=$t.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:n}){return["ul",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(J$.name,this.editor.getAttributes(ym.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=go({find:vm,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=go({find:vm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ym.name),editor:this.editor})),[n]}}),Y$=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,X$=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,Q$=$n.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[as({find:Y$,type:this.type})]},addPasteRules(){return[wi({find:X$,type:this.type})]}}),Z$=/^```([a-z]+)?[\s\n]$/,eN=/^~~~([a-z]+)?[\s\n]$/,tN=$t.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",nt(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` `);return!s||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0||r.nodeAt(l)?!1:n.commands.exitCode()}}},addInputRules(){return[Bu({find:Z$,type:this.type,getAttributes:n=>({language:n[1]})}),Bu({find:eN,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ut({key:new Pt("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!t||!s)return!1;const{tr:o}=n.state;return o.replaceSelectionWith(this.type.create({language:s})),o.setSelection(be.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(t.replace(/\r\n?/g,` -`)),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),nN=$t.create({name:"doc",topNode:!0,content:"block+"});function rN(n={}){return new ut({view(e){return new iN(e,n)}})}class iN{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let u=c.getBoundingClientRect(),f=l?u.bottom:u.top;l&&a&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let l=i.getBoundingClientRect();s=l.left-i.scrollLeft,o=l.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Fg(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const sN=Ot.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[rN(this.options)]}});class et extends Ae{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return et.valid(r)?new et(r):Ae.near(r)}content(){return G.empty}eq(e){return e instanceof et&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new et(e.resolve(t.pos))}getBookmark(){return new bd(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!oN(e)||!lN(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&et.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(et.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ue.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(et.valid(l))return l}return null}}}et.prototype.visible=!1;et.findFrom=et.findGapCursorFrom;Ae.jsonID("gapcursor",et);class bd{constructor(e){this.pos=e}map(e){return new bd(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return et.valid(t)?new et(t):Ae.near(t)}}function oN(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function lN(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function aN(){return new ut({props:{decorations:dN,createSelectionBetween(n,e,t){return e.pos==t.pos&&et.valid(t)?new et(t):null},handleClick:uN,handleKeyDown:cN,handleDOMEvents:{beforeinput:fN}}})}const cN=Tb({ArrowLeft:al("horiz",-1),ArrowRight:al("horiz",1),ArrowUp:al("vert",-1),ArrowDown:al("vert",1)});function al(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof be){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=et.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new et(c))),!0):!1}}function uN(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!et.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&ue.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new et(r))),!0)}function fN(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof et))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=V.empty;for(let o=r.length-1;o>=0;o--)i=V.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new G(i,0,0));return s.setSelection(be.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function dN(n){if(!(n.selection instanceof et))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",st.create(n.doc,[tn.widget(n.selection.head,e,{key:"gapcursor"})])}const hN=Ot.create({name:"gapCursor",addProseMirrorPlugins(){return[aN()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=_e(ee(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),pN=$t.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",tt(this.options.HTMLAttributes,n)]},renderText(){return` -`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const f=a.filter(d=>l.includes(d.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),mN=$t.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,tt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Bu({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Ma=200,kt=function(){};kt.prototype.append=function(e){return e.length?(e=kt.from(e),!this.length&&e||e.length=t?kt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};kt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};kt.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};kt.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};kt.from=function(e){return e instanceof kt?e:e&&e.length?new Gy(e):kt.empty};var Gy=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ma)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ma)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(kt);kt.empty=new Gy([]);var gN=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(kt);const bN=500;class wn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),s=i.maps.length),s--,u.push(f);return}if(i){u.push(new wr(f.map));let h=f.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new wr(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(s)):f.selection,a=new wn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;uvN&&(l=yN(l,c),o-=c),new wn(l.append(s),o)}remapping(e,t){let r=new qi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new wn(this.items.append(e.map(t=>new wr(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(d=>{d.selection&&l--},i);let a=t;this.items.forEach(d=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(d.step){let m=e.steps[h].invert(e.docs[h]),g=d.selection&&d.selection.map(s.slice(a+1,h));g&&l++,r.push(new wr(p,m,g))}else r.push(new wr(p))},i);let c=[];for(let d=t;dbN&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let f=new wr(c.invert(),a,u),d,h=i.length-1;(d=i.length&&i[h].merge(f))?i[h]=d:i.push(f)}}else o.map&&r--},this.items.length,0),new wn(kt.from(i.reverse()),s)}}wn.empty=new wn(kt.empty,0);function yN(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}let wr=class Yy{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Yy(t.getMap().invert(),t,this.selection)}}};class Tr{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const vN=20;function wN(n,e,t,r){let i=t.getMeta(pi),s;if(i)return i.historyState;t.getMeta(CN)&&(n=new Tr(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(pi))return o.getMeta(pi).redo?new Tr(n.done.addTransform(t,void 0,r,wl(e)),n.undone,wm(t.mapping.maps[t.steps.length-1]),n.prevTime,n.prevComposition):new Tr(n.done,n.undone.addTransform(t,void 0,r,wl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!kN(t,n.prevRanges)),c=o?iu(n.prevRanges,t.mapping):wm(t.mapping.maps[t.steps.length-1]);return new Tr(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,wl(e)),wn.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Tr(n.done.rebased(t,s),n.undone.rebased(t,s),iu(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Tr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),iu(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function kN(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s=e[s]&&(t=!0)}),t}function wm(n){let e=[];return n.forEach((t,r,i,s)=>e.push(i,s)),e}function iu(n,e){if(!n)return null;let t=[];for(let r=0;r{let i=pi.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=SN(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Qy=Xy(!1,!0),Zy=Xy(!0,!0),AN=Ot.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Qy(n,e),redo:()=>({state:n,dispatch:e})=>Zy(n,e)}},addProseMirrorPlugins(){return[_N(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()}}}),TN=$t.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",tt(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{$to:t}=e.selection,r=n();return t.parentOffset===0?r.insertContentAt(Math.max(t.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:l}=i.selection,a=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(be.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(ue.create(i.doc,l.pos)):i.setSelection(be.create(i.doc,l.pos));else{const c=(o=l.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();c&&(i.insert(a,c),i.setSelection(be.create(i.doc,a+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Vb({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),EN=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,MN=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,ON=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,$N=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,NN=On.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[as({find:EN,type:this.type}),as({find:ON,type:this.type})]},addPasteRules(){return[wi({find:MN,type:this.type}),wi({find:$N,type:this.type})]}}),DN=$t.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",tt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),xN=$t.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",tt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Sm=On.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=rc(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Cm=/^(\d+)\.\s$/,IN=$t.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",tt(this.options.HTMLAttributes,t),0]:["ol",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(xN.name,this.editor.getAttributes(Sm.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=go({find:Cm,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=go({find:Cm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sm.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),RN=$t.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),PN=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,LN=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,BN=On.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",tt(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return Jf()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[as({find:PN,type:this.type})]},addPasteRules(){return[wi({find:LN,type:this.type})]}}),FN=$t.create({name:"text",group:"inline"}),e0=Ot.create({name:"starterKit",addExtensions(){var n,e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;const C=[];return this.options.blockquote!==!1&&C.push(H$.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&C.push(K$.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&C.push(G$.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&C.push(Q$.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&C.push(tN.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&C.push(nN.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&C.push(sN.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&C.push(hN.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&C.push(pN.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&C.push(mN.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&C.push(AN.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&C.push(TN.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&C.push(NN.configure((d=this.options)===null||d===void 0?void 0:d.italic)),this.options.listItem!==!1&&C.push(DN.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&C.push(IN.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&C.push(RN.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&C.push(BN.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&C.push(FN.configure((b=this.options)===null||b===void 0?void 0:b.text)),C}}),zN=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,t0=$t.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},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}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",tt(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Vb({find:zN,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});function VN(n){return[e0,zy.configure({element:n}),qy.configure({openOnClick:!1,autolink:!0}),t0.configure({inline:!0}),Jy.configure({types:["heading","paragraph"]}),Ky]}const HN=Math.floor,UN=(n,e)=>nn>e?n:e,n0=128,kl=127,WN=Number.MAX_SAFE_INTEGER,qN=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iSo.encode(n),JN=So?KN:qN;let ro=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ro&&ro.decode(new Uint8Array).length===1&&(ro=null);const Oa=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},lc=(n,e)=>{for(;e>kl;)Oa(n,n0|kl&e),e=HN(e/128);Oa(n,kl&e)},sf=new Uint8Array(3e4),GN=sf.length/3,YN=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;lc(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=UN(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(jN(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},eD=(n,e)=>{lc(n,e.byteLength),ZN(n,e)},r0=n=>new Error(n),tD=r0("Unexpected end of array"),nD=r0("Integer out of Range"),rD=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},iD=n=>rD(n,yd(n)),_m=n=>n.arr[n.pos++],yd=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posWN)throw nD}throw tD},sD=n=>{let e=yd(n);if(e===0)return"";{let t=String.fromCodePoint(_m(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(_m(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},oD=n=>ro.decode(iD(n)),Am=ro?oD:sD;var Co;(function(n){n[n.Token=0]="Token",n[n.PermissionDenied=1]="PermissionDenied",n[n.Authenticated=2]="Authenticated"})(Co||(Co={}));const lD=(n,e)=>{lc(n,Co.Token),QN(n,e)},aD=(n,e,t)=>{switch(yd(n)){case Co.PermissionDenied:{e(Am(n));break}case Co.Authenticated:{t(Am(n));break}}},cD={code:1009,reason:"Message Too Big"},Tm={code:4401,reason:"Unauthorized"},uD={code:4403,reason:"Forbidden"},Em=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t}));var of;(function(n){n[n.Connecting=0]="Connecting",n[n.Open=1]="Open",n[n.Closing=2]="Closing",n[n.Closed=3]="Closed"})(of||(of={}));const Cn=()=>new Map,lf=n=>{const e=Cn();return n.forEach((t,r)=>{e.set(r,t)}),e},Kr=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},fD=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},dD=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},Ci=()=>new Set,ou=n=>n[n.length-1],hD=(n,e)=>{for(let t=0;t{for(let t=0;t{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return zr((this._observers.get(e)||Cn()).values()).forEach(r=>r(...t))}destroy(){this._observers=Cn()}}const fr=Math.floor,Sl=Math.abs,ac=(n,e)=>nn>e?n:e,s0=n=>n!==0?n<0:1/n<0,Mm=1,Om=2,lu=4,au=8,_o=32,ar=64,nn=128,cc=31,cf=63,mi=127,mD=2147483647,o0=Number.MAX_SAFE_INTEGER,gD=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&fr(n)===n),bD=n=>n.toLowerCase(),yD=/^\s*/g,vD=n=>n.replace(yD,""),wD=/([A-Z])/g,$m=(n,e)=>vD(n.replace(wD,t=>`${e}${bD(t)}`)),kD=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iAo.encode(n),CD=Ao?SD:kD;let io=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});io&&io.decode(new Uint8Array).length===1&&(io=null);let jo=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const uc=()=>new jo,_D=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array(_D(n));let t=0;for(let r=0;r{const t=n.cbuf.length;t-n.cpos{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},uf=gt,De=(n,e)=>{for(;e>mi;)gt(n,nn|mi&e),e=fr(e/128);gt(n,mi&e)},vd=(n,e)=>{const t=s0(e);for(t&&(e=-e),gt(n,(e>cf?nn:0)|(t?ar:0)|cf&e),e=fr(e/64);e>0;)gt(n,(e>mi?nn:0)|mi&e),e=fr(e/128)},ff=new Uint8Array(3e4),TD=ff.length/3,ED=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;De(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=ac(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array($i(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},Qt=(n,e)=>{De(n,e.byteLength),fc(n,e)},wd=(n,e)=>{AD(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},OD=(n,e)=>wd(n,4).setFloat32(0,e,!1),$D=(n,e)=>wd(n,8).setFloat64(0,e,!1),ND=(n,e)=>wd(n,8).setBigInt64(0,e,!1),Nm=new DataView(new ArrayBuffer(4)),DD=n=>(Nm.setFloat32(0,n),Nm.getFloat32(0)===n),To=(n,e)=>{switch(typeof e){case"string":gt(n,119),Yi(n,e);break;case"number":gD(e)&&Sl(e)<=mD?(gt(n,125),vd(n,e)):DD(e)?(gt(n,124),OD(n,e)):(gt(n,123),$D(n,e));break;case"bigint":gt(n,122),ND(n,e);break;case"object":if(e===null)gt(n,126);else if(af(e)){gt(n,117),De(n,e.length);for(let t=0;t0&&De(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const xm=n=>{n.count>0&&(vd(n.encoder,n.count===1?n.s:-n.s),n.count>1&&De(n.encoder,n.count-2))};class Cl{constructor(){this.encoder=new jo,this.s=0,this.count=0}write(e){this.s===e?this.count++:(xm(this),this.count=1,this.s=e)}toUint8Array(){return xm(this),qn(this.encoder)}}const Im=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);vd(n.encoder,e),n.count>1&&De(n.encoder,n.count-2)}};class cu{constructor(){this.encoder=new jo,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Im(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Im(this),qn(this.encoder)}}class xD{constructor(){this.sarr=[],this.s="",this.lensE=new Cl}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new jo;return this.sarr.push(this.s),this.s="",Yi(e,this.sarr.join("")),fc(e,this.lensE.toUint8Array()),qn(e)}}const Vr=n=>new Error(n),_n=()=>{throw Vr("Method unimplemented")},gn=()=>{throw Vr("Unexpected case")},l0=Vr("Unexpected end of array"),a0=Vr("Integer out of Range");let dc=class{constructor(e){this.arr=e,this.pos=0}};const Cs=n=>new dc(n),ID=n=>n.pos!==n.arr.length,RD=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},Zt=n=>RD(n,Me(n)),ps=n=>n.arr[n.pos++],Me=n=>{let e=0,t=1;const r=n.arr.length;for(;n.poso0)throw a0}throw l0},kd=n=>{let e=n.arr[n.pos++],t=e&cf,r=64;const i=(e&ar)>0?-1:1;if(!(e&nn))return i*t;const s=n.arr.length;for(;n.poso0)throw a0}throw l0},PD=n=>{let e=Me(n);if(e===0)return"";{let t=String.fromCodePoint(ps(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(ps(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},LD=n=>io.decode(Zt(n)),Xi=io?LD:PD,Sd=(n,e)=>{const t=new DataView(n.arr.buffer,n.arr.byteOffset+n.pos,e);return n.pos+=e,t},BD=n=>Sd(n,4).getFloat32(0,!1),FD=n=>Sd(n,8).getFloat64(0,!1),zD=n=>Sd(n,8).getBigInt64(0,!1),VD=[n=>{},n=>null,kd,BD,FD,zD,n=>!1,n=>!0,Xi,n=>{const e=Me(n),t={};for(let r=0;r{const e=Me(n),t=[];for(let r=0;rVD[127-ps(n)](n);class Rm extends dc{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),ID(this)?this.count=Me(this)+1:this.count=-1),this.count--,this.s}}class _l extends dc{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=kd(this);const e=s0(this.s);this.count=1,e&&(this.s=-this.s,this.count=Me(this)+2)}return this.count--,this.s}}class uu extends dc{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=kd(this),t=e&1;this.diff=fr(e/2),this.count=1,t&&(this.count=Me(this)+2)}return this.s+=this.diff,this.count--,this.s}}class HD{constructor(e){this.decoder=new _l(e),this.str=Xi(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const UD=crypto.getRandomValues.bind(crypto),jD=Math.random,c0=()=>UD(new Uint32Array(1))[0],WD=n=>n[fr(jD()*n.length)],qD="10000000-1000-4000-8000"+-1e11,KD=()=>qD.replace(/[018]/g,n=>(n^c0()&15>>n/4).toString(16)),JD=Date.now,Pm=n=>new Promise(n);Promise.all.bind(Promise);const Lm=n=>n===void 0?null:n;let GD=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},u0=new GD,YD=!0;try{typeof localStorage<"u"&&localStorage&&(u0=localStorage,YD=!1)}catch{}const XD=u0,QD=Object.assign,f0=Object.keys,ZD=(n,e)=>{for(const t in n)e(n[t],t)},Bm=n=>f0(n).length,ex=n=>{for(const e in n)return!1;return!0},tx=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},nx=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),rx=(n,e)=>n===e||Bm(n)===Bm(e)&&tx(n,(t,r)=>(t!==void 0||nx(e,r))&&e[r]===t),Cd=(n,e,t=0)=>{try{for(;tn,sx=(n,e)=>e.includes(n);var d0={};const ms=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",ox=typeof window<"u"&&typeof document<"u"&&!ms;let Ln;const lx=()=>{if(Ln===void 0)if(ms){Ln=Cn();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");Ln.set(`--${$m(e,"-")}`,t),Ln.set(`-${$m(e,"-")}`,t)}})):Ln=Cn();return Ln},df=n=>lx().has(n),hf=n=>Lm(ms?d0[n.toUpperCase().replaceAll("-","_")]:XD.getItem(n)),ax=n=>df("--"+n)||hf(n)!==null;ax("production");const Fm=ms&&sx(d0.FORCE_COLOR,["true","1","2"]),cx=!df("no-colors")&&(!ms||process.stdout.isTTY||Fm)&&(!ms||df("color")||Fm||hf("COLORTERM")!==null||(hf("TERM")||"").includes("color")),ux=n=>new Uint8Array(n),fx=n=>{const e=ux(n.byteLength);return e.set(n),e};class dx{constructor(e,t){this.left=e,this.right=t}}const rr=(n,e)=>new dx(n,e),hx=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const px=n=>fD(n,(e,t)=>`${t}:${e};`).join(""),mx=n=>class{constructor(t){this._=t}destroy(){n(this._)}},gx=mx(clearTimeout),pf=(n,e)=>new gx(setTimeout(e,n)),dr=Symbol,h0=dr(),p0=dr(),bx=dr(),yx=dr(),vx=dr(),m0=dr(),wx=dr(),_d=dr(),kx=dr(),Sx=n=>{var r;n.length===1&&((r=n[0])==null?void 0:r.constructor)===Function&&(n=n[0]());const e=[];let t=0;for(;t{var o;n.length===1&&((o=n[0])==null?void 0:o.constructor)===Function&&(n=n[0]());const e=[],t=[],r=Cn();let i=[],s=0;for(;s0||c.length>0?(e.push("%c"+l),t.push(c)):e.push(l)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s{console.log(...g0(n)),b0.forEach(e=>e.print(n))},Tx=(...n)=>{console.warn(...g0(n)),n.unshift(_d),b0.forEach(e=>e.print(n))},b0=Ci(),y0=n=>({[Symbol.iterator](){return this},next:n}),Ex=(n,e)=>y0(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),fu=(n,e)=>y0(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Ad{constructor(e,t){this.clock=e,this.len=t}}class _s{constructor(){this.clients=new Map}}const Hr=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);for(let o=0;o{let t=0,r=n.length-1;for(;t<=r;){const i=fr((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e{const t=n.clients.get(e.client);return t!==void 0&&Mx(t,e.clock)!==null},Td=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t=s.clock?i.len=$i(i.len,s.clock+s.len-i.clock):(r{const e=new _s;for(let t=0;t{if(!e.clients.has(i)){const s=r.slice();for(let o=t+1;o{Kr(n.clients,e,()=>[]).push(new Ad(t,r))},v0=()=>new _s,w0=n=>{const e=v0();return n.clients.forEach((t,r)=>{const i=[];for(let s=0;s0&&e.clients.set(r,i)}),e},Ts=(n,e)=>{De(n.restEncoder,e.clients.size),zr(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),De(n.restEncoder,t);const i=r.length;De(n.restEncoder,i);for(let s=0;s{const e=new _s,t=Me(n.restDecoder);for(let r=0;r0){const o=Kr(e.clients,i,()=>[]);for(let l=0;l{const r=new _s,i=Me(n.restDecoder);for(let s=0;s0){const s=new _i;return De(s.restEncoder,0),Ts(s,r),s.toUint8Array()}return null},k0=c0;class Es extends i0{constructor({guid:e=KD(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=k0(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new N0,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Pm(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>Pm(c=>{const u=f=>{(f===void 0||f===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Je(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(zr(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Je(this,e,t)}get(e,t=Mt){const r=Kr(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==Mt&&i!==t)if(i===Mt){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Zi)}getText(e=""){return this.get(e,Ai)}getMap(e=""){return this.get(e,bs)}getXmlElement(e=""){return this.get(e,Bt)}getXmlFragment(e=""){return this.get(e,Ti)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){zr(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Es({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,Je(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class S0{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Me(this.restDecoder)}readDsLen(){return Me(this.restDecoder)}}class C0 extends S0{readLeftID(){return Se(Me(this.restDecoder),Me(this.restDecoder))}readRightID(){return Se(Me(this.restDecoder),Me(this.restDecoder))}readClient(){return Me(this.restDecoder)}readInfo(){return ps(this.restDecoder)}readString(){return Xi(this.restDecoder)}readParentInfo(){return Me(this.restDecoder)===1}readTypeRef(){return Me(this.restDecoder)}readLen(){return Me(this.restDecoder)}readAny(){return Eo(this.restDecoder)}readBuf(){return fx(Zt(this.restDecoder))}readJSON(){return JSON.parse(Xi(this.restDecoder))}readKey(){return Xi(this.restDecoder)}}class Ox{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Me(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Me(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class gs extends Ox{constructor(e){super(e),this.keys=[],Me(e),this.keyClockDecoder=new uu(Zt(e)),this.clientDecoder=new _l(Zt(e)),this.leftClockDecoder=new uu(Zt(e)),this.rightClockDecoder=new uu(Zt(e)),this.infoDecoder=new Rm(Zt(e),ps),this.stringDecoder=new HD(Zt(e)),this.parentInfoDecoder=new Rm(Zt(e),ps),this.typeRefDecoder=new _l(Zt(e)),this.lenDecoder=new _l(Zt(e))}readLeftID(){return new Qi(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Qi(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Eo(this.restDecoder)}readBuf(){return Zt(this.restDecoder)}readJSON(){return Eo(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e{r=$i(r,e[0].id.clock);const i=Xn(e,r);De(n.restEncoder,e.length-i),n.writeClient(t),De(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o{const r=new Map;t.forEach((i,s)=>{rt(e,s)>i&&r.set(s,i)}),qo(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),De(n.restEncoder,r.size),zr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{$x(n,e.clients.get(i),i,s)})},Nx=(n,e)=>{const t=Cn(),r=Me(n.restDecoder);for(let i=0;i{const r=[];let i=zr(t.keys()).sort((h,p)=>h-p);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let h=t.get(i[i.length-1]);for(;h.refs.length===h.i;)if(i.pop(),i.length>0)h=t.get(i[i.length-1]);else return null;return h};let o=s();if(o===null)return null;const l=new N0,a=new Map,c=(h,p)=>{const m=a.get(h);(m==null||m>p)&&a.set(h,p)};let u=o.refs[o.i++];const f=new Map,d=()=>{for(const h of r){const p=h.id.client,m=t.get(p);m?(m.i--,l.clients.set(p,m.refs.slice(m.i)),t.delete(p),m.i=0,m.refs=[]):l.clients.set(p,[h]),i=i.filter(g=>g!==p)}r.length=0};for(;;){if(u.constructor!==fn){const p=Kr(f,u.id.client,()=>rt(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),d();else{const m=u.getMissing(n,e);if(m!==null){r.push(u);const g=t.get(m)||{refs:[],i:0};if(g.refs.length===g.i)c(m,rt(e,m)),d();else{u=g.refs[g.i++];continue}}else(p===0||p0)u=r.pop();else if(o!==null&&o.i0){const h=new _i;return Md(h,l,new Map),De(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},xx=(n,e)=>Md(n,e.doc.store,e.beforeState),Ix=(n,e,t,r=new gs(n))=>Je(e,i=>{i.local=!1;let s=!1;const o=i.doc,l=o.store,a=Nx(r,o),c=Dx(i,l,a),u=l.pendingStructs;if(u){for(const[d,h]of u.missing)if(hh)&&u.missing.set(d,h)}u.update=Na([u.update,c.update])}}else l.pendingStructs=c;const f=zm(r,i,l);if(l.pendingDs){const d=new gs(Cs(l.pendingDs));Me(d.restDecoder);const h=zm(d,i,l);f&&h?l.pendingDs=Na([f,h]):l.pendingDs=f||h}else l.pendingDs=f;if(s){const d=l.pendingStructs.update;l.pendingStructs=null,T0(i.doc,d)}},t,!1),T0=(n,e,t,r=gs)=>{const i=Cs(e);Ix(i,n,t,new r(i))},Rx=(n,e,t)=>T0(n,e,t,C0),Px=(n,e,t=new Map)=>{Md(n,e.store,t),Ts(n,w0(e.store))},Lx=(n,e=new Uint8Array([0]),t=new _i)=>{const r=E0(e);Px(t,n,r);const i=[t.toUint8Array()];if(n.store.pendingDs&&i.push(n.store.pendingDs),n.store.pendingStructs&&i.push(rI(n.store.pendingStructs.update,e)),i.length>1){if(t.constructor===Wo)return tI(i.map((s,o)=>o===0?s:sI(s)));if(t.constructor===_i)return Na(i)}return i[0]},Bx=(n,e)=>Lx(n,e,new Wo),Fx=n=>{const e=new Map,t=Me(n.restDecoder);for(let r=0;rFx(new S0(Cs(n))),M0=(n,e)=>(De(n.restEncoder,e.size),zr(e.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{De(n.restEncoder,t),De(n.restEncoder,r)}),n),zx=(n,e)=>M0(n,qo(e.store)),Vx=(n,e=new A0)=>(n instanceof Map?M0(e,n):zx(e,n),e.toUint8Array()),Hx=n=>Vx(n,new _0);class Ux{constructor(){this.l=[]}}const Vm=()=>new Ux,Hm=(n,e)=>n.l.push(e),Um=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},O0=(n,e,t)=>Cd(n.l,[e,t]);class Qi{constructor(e,t){this.client=e,this.clock=t}}const cl=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,Se=(n,e)=>new Qi(n,e),Oo=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw gn()},$o=(n,e)=>{for(;e!==null;){if(e.parent===n)return!0;e=e.parent._item}return!1};class $a{constructor(e,t,r,i=0){this.type=e,this.tname=t,this.item=r,this.assoc=i}}class jx{constructor(e,t,r=0){this.type=e,this.index=t,this.assoc=r}}const Wx=(n,e,t=0)=>new jx(n,e,t),ul=(n,e,t)=>{let r=null,i=null;return n._item===null?i=Oo(n):r=Se(n._item.id.client,n._item.id.clock),new $a(r,i,e,t)},du=(n,e,t=0)=>{let r=n._start;if(t<0){if(e===0)return ul(n,null,t);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return ul(n,Se(r.id.client,r.id.clock+e),t);e-=r.length}if(r.right===null&&t<0)return ul(n,r.lastId,t);r=r.right}return ul(n,null,t)},qx=(n,e)=>{const t=e.store,r=n.item,i=n.type,s=n.tname,o=n.assoc;let l=null,a=0;if(r!==null){if(rt(t,r.client)<=r.clock)return null;const c=vf(t,r),u=c.item;if(!(u instanceof Ue))return null;if(l=u.parent,l._item===null||!l._item.deleted){a=u.deleted||!u.countable?0:c.diff+(o>=0?0:1);let f=u.left;for(;f!==null;)!f.deleted&&f.countable&&(a+=f.length),f=f.left}}else{if(s!==null)l=e.get(s);else if(i!==null){if(rt(t,i.client)<=i.clock)return null;const{item:c}=vf(t,i);if(c instanceof Ue&&c.content instanceof Dn)l=c.content.type;else return null}else throw gn();o>=0?a=l._length:a=0}return Wx(l,a,n.assoc)};class Od{constructor(e,t){this.ds=e,this.sv=t}}const $0=(n,e)=>new Od(n,e),Kx=n=>$0(w0(n.store),qo(n.store)),ni=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!As(e.ds,n.id),gf=(n,e)=>{const t=Kr(n.meta,gf,Ci),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i{}),t.add(e))};class N0{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const qo=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},rt=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},D0=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw gn()}t.push(e)},Xn=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=fr(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e{const t=n.clients.get(e.client);return t[Xn(t,e.clock)]},Al=Jx,bf=(n,e,t)=>{const r=Xn(e,t),i=e[r];return i.id.clock{const t=n.doc.store.clients.get(e.client);return t[bf(n,t,e.clock)]},jm=(n,e,t)=>{const r=e.clients.get(t.client),i=Xn(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==un&&r.splice(i+1,0,Pa(n,s,t.clock-s.id.clock+1)),s},Gx=(n,e,t)=>{const r=n.clients.get(e.id.client);r[Xn(r,e.id.clock)]=t},x0=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=bf(n,e,t),l;do l=e[o++],se.deleteSet.clients.size===0&&!dD(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Td(e.deleteSet),xx(n,e),Ts(n,e.deleteSet),!0),qm=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Kr(n.changed,e,Ci).add(t)},Tl=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Ue&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},Xx=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const l=i[o],a=l.clock+l.len;for(let c=Xn(s,l.clock),u=s[c];c{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],l=ac(i.length-1,1+Xn(i,o.clock+o.len-1));for(let a=l,c=i[a];a>0&&c.id.clock>=o.clock;c=i[a])a-=1+Tl(i,a)}})},I0=(n,e)=>{if(el.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(t,a)})),l.push(()=>{t.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,f)=>u.path.length-f.path.length),O0(c._dEH,a,t))})}),l.push(()=>r.emit("afterTransaction",[t,r])),Cd(l,[]),t._needFormattingCleanup&&vI(t)}finally{r.gc&&Xx(s,i,r.gcFilter),Qx(s,i),t.afterState.forEach((u,f)=>{const d=t.beforeState.get(f)||0;if(d!==u){const h=i.clients.get(f),p=$i(Xn(h,d),1);for(let m=h.length-1;m>=p;)m-=1+Tl(h,m)}});for(let u=o.length-1;u>=0;u--){const{client:f,clock:d}=o[u].id,h=i.clients.get(f),p=Xn(h,d);p+11||p>0&&Tl(h,p)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Ax(_d,h0,"[yjs] ",p0,m0,"Changed the client-id because another client seems to be using it."),r.clientID=k0()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new Wo;Wm(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new _i;Wm(u,t)&&r.emit("updateV2",[u.toUint8Array(),t.origin,r,t])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=t;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,t]),c.forEach(u=>u.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):I0(n,e+1)}}},Je=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new Yx(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const l=n._transaction===i[0];n._transaction=null,l&&I0(i,0)}}return o};class Zx{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}}const Km=(n,e,t)=>{Hr(n,t.deletions,r=>{r instanceof Ue&&e.scope.some(i=>$o(i,r))&&Ld(r,!1)})},Jm=(n,e,t)=>{let r=null;const i=n.doc,s=n.scope;if(Je(i,o=>{for(;e.length>0&&n.currStackItem===null;){const l=i.store,a=e.pop(),c=new Set,u=[];let f=!1;Hr(o,a.insertions,d=>{if(d instanceof Ue){if(d.redone!==null){let{item:h,diff:p}=vf(l,d.id);p>0&&(h=qt(o,Se(h.id.client,h.id.clock+p))),d=h}!d.deleted&&s.some(h=>$o(h,d))&&u.push(d)}}),Hr(o,a.deletions,d=>{d instanceof Ue&&s.some(h=>$o(h,d))&&!As(a.insertions,d.id)&&c.add(d)}),c.forEach(d=>{f=e1(o,d,c,a.insertions,n.ignoreRemoteMapChanges,n)!==null||f});for(let d=u.length-1;d>=0;d--){const h=u[d];n.deleteFilter(h)&&(h.delete(o),f=!0)}n.currStackItem=f?a:null}o.changed.forEach((l,a)=>{l.has(null)&&a._searchMarker&&(a._searchMarker.length=0)}),r=o},n),n.currStackItem!=null){const o=r.changedParentTypes;n.emit("stack-item-popped",[{stackItem:n.currStackItem,type:t,changedParentTypes:o,origin:n},n]),n.currStackItem=null}return n.currStackItem};class R0 extends i0{constructor(e,{captureTimeout:t=500,captureTransaction:r=a=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=af(e)?e[0].doc:e.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=t,this.afterTransactionHandler=a=>{if(!this.captureTransaction(a)||!this.scope.some(g=>a.changedParentTypes.has(g))||!this.trackedOrigins.has(a.origin)&&(!a.origin||!this.trackedOrigins.has(a.origin.constructor)))return;const c=this.undoing,u=this.redoing,f=c?this.redoStack:this.undoStack;c?this.stopCapturing():u||this.clear(!1,!0);const d=new _s;a.afterState.forEach((g,b)=>{const C=a.beforeState.get(b)||0,E=g-C;E>0&&Mo(d,b,C,E)});const h=JD();let p=!1;if(this.lastChange>0&&h-this.lastChange0&&!c&&!u){const g=f[f.length-1];g.deletions=mf([g.deletions,a.deleteSet]),g.insertions=mf([g.insertions,d])}else f.push(new Zx(a.deleteSet,d)),p=!0;!c&&!u&&(this.lastChange=h),Hr(a,a.deleteSet,g=>{g instanceof Ue&&this.scope.some(b=>$o(b,g))&&Ld(g,!0)});const m=[{stackItem:f[f.length-1],origin:a.origin,type:c?"redo":"undo",changedParentTypes:a.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){e=af(e)?e:[e],e.forEach(t=>{this.scope.every(r=>r!==t)&&(t.doc!==this.doc&&Tx("[yjs#509] Not same Y.Doc"),this.scope.push(t))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>Km(r,this,i)),this.undoStack=[]),t&&(this.redoStack.forEach(i=>Km(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Jm(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Jm(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*eI(n){const e=Me(n.restDecoder);for(let t=0;tNa(n,C0,Wo),nI=(n,e)=>{if(n.constructor===un){const{client:t,clock:r}=n.id;return new un(Se(t,r+e),n.length-e)}else if(n.constructor===fn){const{client:t,clock:r}=n.id;return new fn(Se(t,r+e),n.length-e)}else{const t=n,{client:r,clock:i}=t.id;return new Ue(Se(r,i+e),null,Se(r,i+e-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(e))}},Na=(n,e=gs,t=_i)=>{if(n.length===1)return n[0];const r=n.map(u=>new e(Cs(u)));let i=r.map(u=>new $d(u,!0)),s=null;const o=new t,l=new Nd(o);for(;i=i.filter(d=>d.curr!==null),i.sort((d,h)=>{if(d.curr.id.client===h.curr.id.client){const p=d.curr.id.clock-h.curr.id.clock;return p===0?d.curr.constructor===h.curr.constructor?0:d.curr.constructor===fn?1:-1:p}else return h.curr.id.client-d.curr.id.client}),i.length!==0;){const u=i[0],f=u.curr.id.client;if(s!==null){let d=u.curr,h=!1;for(;d!==null&&d.id.clock+d.length<=s.struct.id.clock+s.struct.length&&d.id.client>=s.struct.id.client;)d=u.next(),h=!0;if(d===null||d.id.client!==f||h&&d.id.clock>s.struct.id.clock+s.struct.length)continue;if(f!==s.struct.id.client)Or(l,s.struct,s.offset),s={struct:d,offset:0},u.next();else if(s.struct.id.clock+s.struct.length0&&(s.struct.constructor===fn?s.struct.length-=p:d=nI(d,p)),s.struct.mergeWith(d)||(Or(l,s.struct,s.offset),s={struct:d,offset:0},u.next())}}else s={struct:u.curr,offset:0},u.next();for(let d=u.curr;d!==null&&d.id.client===f&&d.id.clock===s.struct.id.clock+s.struct.length&&d.constructor!==fn;d=u.next())Or(l,s.struct,s.offset),s={struct:d,offset:0}}s!==null&&(Or(l,s.struct,s.offset),s=null),Dd(l);const a=r.map(u=>Ed(u)),c=mf(a);return Ts(o,c),o.toUint8Array()},rI=(n,e,t=gs,r=_i)=>{const i=E0(e),s=new r,o=new Nd(s),l=new t(Cs(n)),a=new $d(l,!1);for(;a.curr;){const u=a.curr,f=u.id.client,d=i.get(f)||0;if(a.curr.constructor===fn){a.next();continue}if(u.id.clock+u.length>d)for(Or(o,u,$i(d-u.id.clock,0)),a.next();a.curr&&a.curr.id.client===f;)Or(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===f&&a.curr.id.clock+a.curr.length<=d;)a.next()}Dd(o);const c=Ed(l);return Ts(s,c),s.toUint8Array()},P0=n=>{n.written>0&&(n.clientStructs.push({written:n.written,restEncoder:qn(n.encoder.restEncoder)}),n.encoder.restEncoder=uc(),n.written=0)},Or=(n,e,t)=>{n.written>0&&n.currClient!==e.id.client&&P0(n),n.written===0&&(n.currClient=e.id.client,n.encoder.writeClient(e.id.client),De(n.encoder.restEncoder,e.id.clock+t)),e.write(n.encoder,t),n.written++},Dd=n=>{P0(n);const e=n.encoder.restEncoder;De(e,n.clientStructs.length);for(let t=0;t{const i=new t(Cs(n)),s=new $d(i,!1),o=new r,l=new Nd(o);for(let c=s.curr;c!==null;c=s.next())Or(l,e(c),0);Dd(l);const a=Ed(i);return Ts(o,a),o.toUint8Array()},sI=n=>iI(n,ix,gs,Wo),Gm="You must not compute changes after the event-handler fired.";class hc{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=oI(this.currentTarget,this.target))}deletes(e){return As(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Vr(Gm);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,l;if(this.adds(s)){let a=s.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(s))if(a!==null&&this.deletes(a))o="delete",l=ou(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=ou(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=ou(s.content.getContent());else return;e.set(i,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Vr(Gm);const t=this.target,r=Ci(),i=Ci(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let l=null;const a=()=>{l&&s.push(l)};for(let c=t._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,i.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const oI=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)i.deleted||r++,i=i.right;t.unshift(r)}e=e._item.parent}return t},L0=80;let xd=0;class lI{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=xd++}}const aI=n=>{n.timestamp=xd++},B0=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=xd++},cI=(n,e,t)=>{if(n.length>=L0){const r=n.reduce((i,s)=>i.timestamp{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>Sl(e-s.index)e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return t!==null&&Sl(t.index-i){for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e0&&e===i.index)&&(i.index=$i(e,i.index+t))}},mc=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Kr(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;O0(r._eH,t,e)};class Mt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Vm(),this._dEH=Vm(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw _n()}clone(){throw _n()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Hm(this._eH,e)}observeDeep(e){Hm(this._dEH,e)}unobserve(e){Um(this._eH,e)}unobserveDeep(e){Um(this._dEH,e)}toJSON(){}}const F0=(n,e,t)=>{e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l0;l++)i.push(o[l]),r--;e=0}}s=s.right}return i},z0=n=>{const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i{const t=[];let r=n._start;for(;r!==null;){if(r.countable&&ni(r,e)){const i=r.content.getContent();for(let s=0;s{let t=0,r=n._start;for(;r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s{const t=[];return Do(n,(r,i)=>{t.push(e(r,i,n))}),t},uI=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},U0=(n,e)=>{const t=pc(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e{let i=t;const s=n.doc,o=s.clientID,l=s.store,a=t===null?e._start:t.right;let c=[];const u=()=>{c.length>0&&(i=new Ue(Se(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ei(c)),i.integrate(n,0),c=[])};r.forEach(f=>{if(f===null)c.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(f);break;default:switch(u(),f.constructor){case Uint8Array:case ArrayBuffer:i=new Ue(Se(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ko(new Uint8Array(f))),i.integrate(n,0);break;case Es:i=new Ue(Se(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Jo(f)),i.integrate(n,0);break;default:if(f instanceof Mt)i=new Ue(Se(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Dn(f)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},j0=()=>Vr("Length exceeded!"),W0=(n,e,t,r)=>{if(t>e._length)throw j0();if(t===0)return e._searchMarker&&No(e._searchMarker,t,r.length),Da(n,e,null,r);const i=t,s=pc(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Da(n,e,i,t)},q0=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=pc(e,t);let l=e._start;for(o!==null&&(l=o.p,t-=o.index);l!==null&&t>0;l=l.right)!l.deleted&&l.countable&&(t0&&l!==null;)l.deleted||(r0)throw j0();e._searchMarker&&No(e._searchMarker,i,-s+r)},xa=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Id=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new Ei([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:l=new Ei([r]);break;case Uint8Array:l=new Ko(r);break;case Es:l=new Jo(r);break;default:if(r instanceof Mt)l=new Dn(r);else throw new Error("Unexpected content type")}new Ue(Se(o,rt(s.store,o)),i,i&&i.lastId,null,null,e,t,l).integrate(n,0)},Rd=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},K0=n=>{const e={};return n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},J0=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted},dI=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&ni(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},fl=n=>Ex(n.entries(),e=>!e[1].deleted);class hI extends hc{constructor(e,t){super(e,t),this._transaction=t}}class Zi extends Mt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Zi;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Zi}clone(){const e=new Zi;return e.insert(0,this.toArray().map(t=>t instanceof Mt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,t){super._callObserver(e,t),mc(this,e,new hI(this,e))}insert(e,t){this.doc!==null?Je(this.doc,r=>{W0(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?Je(this.doc,t=>{fI(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?Je(this.doc,r=>{q0(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return U0(this,e)}toArray(){return z0(this)}slice(e=0,t=this.length){return F0(this,e,t)}toJSON(){return this.map(e=>e instanceof Mt?e.toJSON():e)}map(e){return H0(this,e)}forEach(e){Do(this,e)}[Symbol.iterator](){return uI(this)}_write(e){e.writeTypeRef(LI)}}const pI=n=>new Zi;class mI extends hc{constructor(e,t,r){super(e,t),this.keysChanged=r}}class bs extends Mt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new bs}clone(){const e=new bs;return this.forEach((t,r)=>{e.set(r,t instanceof Mt?t.clone():t)}),e}_callObserver(e,t){mc(this,e,new mI(this,e,t))}toJSON(){const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof Mt?i.toJSON():i}}),e}get size(){return[...fl(this._map)].length}keys(){return fu(fl(this._map),e=>e[0])}values(){return fu(fl(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return fu(fl(this._map),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Je(this.doc,t=>{xa(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?Je(this.doc,r=>{Id(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Rd(this,e)}has(e){return J0(this,e)}clear(){this.doc!==null?Je(this.doc,e=>{this.forEach(function(t,r,i){xa(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(BI)}}const gI=n=>new bs,xr=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&rx(n,e);class yf{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&gn(),this.right.content.constructor){case lt:this.right.deleted||Ms(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Ym=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case lt:e.right.deleted||Ms(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t{const i=new Map,s=r?pc(e,t):null;if(s){const o=new yf(s.p.left,s.p,s.index,i);return Ym(n,o,t-s.index)}else{const o=new yf(null,e._start,0,i);return Ym(n,o,t)}},G0=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===lt&&xr(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,l)=>{const a=t.left,c=t.right,u=new Ue(Se(s,rt(i.store,s)),a,a&&a.lastId,c,c&&c.id,e,null,new lt(l,o));u.integrate(n,0),t.right=u,t.forward()})},Ms=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},Y0=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===lt&&xr(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},X0=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const l in r){const a=r[l],c=t.currentAttributes.get(l)??null;if(!xr(c,a)){o.set(l,c);const{left:u,right:f}=t;t.right=new Ue(Se(s,rt(i.store,s)),u,u&&u.lastId,f,f&&f.id,e,null,new lt(l,a)),t.right.integrate(n,0),t.forward()}}return o},hu=(n,e,t,r,i)=>{t.currentAttributes.forEach((d,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;Y0(t,i);const l=X0(n,e,t,i),a=r.constructor===String?new $n(r):r instanceof Mt?new Dn(r):new Ni(r);let{left:c,right:u,index:f}=t;e._searchMarker&&No(e._searchMarker,t.index,a.getLength()),u=new Ue(Se(o,rt(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(n,0),t.right=u,t.index=f,t.forward(),G0(n,e,t,l)},Xm=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;Y0(t,i);const l=X0(n,e,t,i);e:for(;t.right!==null&&(r>0||l.size>0&&(t.right.deleted||t.right.content.constructor===lt));){if(!t.right.deleted)switch(t.right.content.constructor){case lt:{const{key:a,value:c}=t.right.content,u=i[a];if(u!==void 0){if(xr(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}t.right.delete(n)}else t.currentAttributes.set(a,c);break}default:r0){let a="";for(;r>0;r--)a+=` -`;t.right=new Ue(Se(o,rt(s.store,o)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new $n(a)),t.right.integrate(n,0),t.forward()}G0(n,e,t,l)},Q0=(n,e,t,r,i)=>{let s=e;const o=Cn();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===lt){const c=s.content;o.set(c.key,c)}s=s.right}let l=0,a=!1;for(;e!==s;){if(t===e&&(a=!0),!e.deleted){const c=e.content;switch(c.constructor){case lt:{const{key:u,value:f}=c,d=r.get(u)??null;(o.get(u)!==c||d===f)&&(e.delete(n),l++,!a&&(i.get(u)??null)===f&&d!==f&&(d===null?i.delete(u):i.set(u,d))),!a&&!e.deleted&&Ms(i,c);break}}}e=e.right}return l},bI=(n,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===lt){const r=e.content.key;t.has(r)?e.delete(n):t.add(r)}e=e.left}},yI=n=>{let e=0;return Je(n.doc,t=>{let r=n._start,i=n._start,s=Cn();const o=lf(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case lt:Ms(o,i.content);break;default:e+=Q0(t,r,i,s,o),s=lf(o),r=i;break}i=i.right}}),e},vI=n=>{const e=new Set,t=n.doc;for(const[r,i]of n.afterState.entries()){const s=n.beforeState.get(r)||0;i!==s&&x0(n,t.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===lt&&o.constructor!==un&&e.add(o.parent)})}Je(t,r=>{Hr(n,n.deleteSet,i=>{if(i instanceof un||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===lt?e.add(s):bI(r,i)});for(const i of e)yI(i)})},Qm=(n,e,t)=>{const r=t,i=lf(e.currentAttributes),s=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Dn:case Ni:case $n:t{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];Je(e,r=>{const i=new Map,s=new Map;let o=this.target._start,l=null;const a={};let c="",u=0,f=0;const d=()=>{if(l!==null){let h=null;switch(l){case"delete":f>0&&(h={delete:f}),f=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},i.size>0&&(h.attributes={},i.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),c="";break;case"retain":u>0&&(h={retain:u},ex(a)||(h.attributes=QD({},a))),u=0;break}h&&t.push(h),l=null}};for(;o!==null;){switch(o.content.constructor){case Dn:case Ni:this.adds(o)?this.deletes(o)||(d(),l="insert",c=o.content.getContent()[0],d()):this.deletes(o)?(l!=="delete"&&(d(),l="delete"),f+=1):o.deleted||(l!=="retain"&&(d(),l="retain"),u+=1);break;case $n:this.adds(o)?this.deletes(o)||(l!=="insert"&&(d(),l="insert"),c+=o.content.str):this.deletes(o)?(l!=="delete"&&(d(),l="delete"),f+=o.length):o.deleted||(l!=="retain"&&(d(),l="retain"),u+=o.length);break;case lt:{const{key:h,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const m=i.get(h)??null;xr(m,p)?p!==null&&o.delete(r):(l==="retain"&&d(),xr(p,s.get(h)??null)?delete a[h]:a[h]=p)}}else if(this.deletes(o)){s.set(h,p);const m=i.get(h)??null;xr(m,p)||(l==="retain"&&d(),a[h]=m)}else if(!o.deleted){s.set(h,p);const m=a[h];m!==void 0&&(xr(m,p)?m!==null&&o.delete(r):(l==="retain"&&d(),p===null?delete a[h]:a[h]=p))}o.deleted||(l==="insert"&&d(),Ms(i,o.content));break}}o=o.right}for(d();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class Ai extends Mt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Ai}clone(){const e=new Ai;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new wI(this,e,t);mc(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===$n&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?Je(this.doc,r=>{const i=new yf(null,this._start,0,new Map);for(let s=0;s0)&&hu(r,this,i,l,o.attributes||{})}else o.retain!==void 0?Xm(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Qm(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){const i=[],s=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const f={};let d=!1;s.forEach((p,m)=>{d=!0,f[m]=p});const h={insert:l};d&&(h.attributes=f),i.push(h),l=""}}const u=()=>{for(;a!==null;){if(ni(a,e)||t!==void 0&&ni(a,t))switch(a.content.constructor){case $n:{const f=s.get("ychange");e!==void 0&&!ni(a,e)?(f===void 0||f.user!==a.id.client||f.type!=="removed")&&(c(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):t!==void 0&&!ni(a,t)?(f===void 0||f.user!==a.id.client||f.type!=="added")&&(c(),s.set("ychange",r?r("added",a.id):{type:"added"})):f!==void 0&&(c(),s.delete("ychange")),l+=a.content.str;break}case Dn:case Ni:{c();const f={insert:a.content.getContent()[0]};if(s.size>0){const d={};f.attributes=d,s.forEach((h,p)=>{d[p]=h})}i.push(f);break}case lt:ni(a,e)&&(c(),Ms(s,a.content));break}a=a.right}c()};return e||t?Je(o,f=>{e&&gf(f,e),t&&gf(f,t),u()},"cleanup"):u(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?Je(i,s=>{const o=dl(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),hu(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?Je(i,s=>{const o=dl(s,this,e,!r);hu(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?Je(r,i=>{Qm(i,dl(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?Je(i,s=>{const o=dl(s,this,e,!1);o.right!==null&&Xm(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?Je(this.doc,t=>{xa(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?Je(this.doc,r=>{Id(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Rd(this,e)}getAttributes(){return K0(this)}_write(e){e.writeTypeRef(FI)}}const kI=n=>new Ai;class pu{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===Bt||t.constructor===Ti)&&t._start!==null)e=t._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Ti extends Mt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ti}clone(){const e=new Ti;return e.insert(0,this.toArray().map(t=>t instanceof Mt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new pu(this,e)}querySelector(e){e=e.toUpperCase();const r=new pu(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),zr(new pu(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){mc(this,e,new _I(this,t,e))}toString(){return H0(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Do(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?Je(this.doc,r=>{W0(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)Je(this.doc,r=>{const i=e&&e instanceof Mt?e._item:e;Da(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Vr("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?Je(this.doc,r=>{q0(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return z0(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return U0(this,e)}slice(e=0,t=this.length){return F0(this,e,t)}forEach(e){Do(this,e)}_write(e){e.writeTypeRef(VI)}}const SI=n=>new Ti;class Bt extends Ti{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new Bt(this.nodeName)}clone(){const e=new Bt(this.nodeName),t=this.getAttributes();return ZD(t,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Mt?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}`}removeAttribute(e){this.doc!==null?Je(this.doc,t=>{xa(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?Je(this.doc,r=>{Id(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Rd(this,e)}hasAttribute(e){return J0(this,e)}getAttributes(e){return e?dI(this,e):K0(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return Do(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(zI),e.writeKey(this.nodeName)}}const CI=n=>new Bt(n.readKey());class _I extends hc{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Ia extends bs{constructor(e){super(),this.hookName=e}_copy(){return new Ia(this.hookName)}clone(){const e=new Ia(this.hookName);return this.forEach((t,r)=>{e.set(r,t)}),e}toDOM(e=document,t={},r){const i=t[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(HI),e.writeKey(this.hookName)}}const AI=n=>new Ia(n.readKey());class rn extends Ai{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new rn}clone(){const e=new rn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.keyi.nodeName=0;i--)r+=``;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(UI)}}const TI=n=>new rn;class Pd{constructor(e,t){this.id=e,this.length=t}get deleted(){throw _n()}mergeWith(e){return!1}write(e,t,r){throw _n()}integrate(e,t){throw _n()}}const EI=0;class un extends Pd{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),D0(e.doc.store,this)}write(e,t){e.writeInfo(EI),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Ko{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Ko(this.content)}splice(e){throw _n()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const MI=n=>new Ko(n.readBuf());class xo{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new xo(this.len)}splice(e){const t=new xo(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Mo(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const OI=n=>new xo(n.readLen()),Z0=(n,e)=>new Es({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Jo{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Jo(Z0(this.doc.guid,this.opts))}splice(e){throw _n()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const $I=n=>new Jo(Z0(n.readString(),n.readAny()));class Ni{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Ni(this.embed)}splice(e){throw _n()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const NI=n=>new Ni(n.readJSON());class lt{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new lt(this.key,this.value)}splice(e){throw _n()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const DI=n=>new lt(n.readKey(),n.readJSON());class Ra{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ra(this.arr)}splice(e){const t=new Ra(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i{const e=n.readLen(),t=[];for(let r=0;r{const e=n.readLen(),t=[];for(let r=0;r=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const RI=n=>new $n(n.readString()),PI=[pI,gI,kI,CI,SI,AI,TI],LI=0,BI=1,FI=2,zI=3,VI=4,HI=5,UI=6;class Dn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Dn(this.type._copy())}splice(e){throw _n()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const jI=n=>new Dn(PI[n.readTypeRef()](n)),vf=(n,e)=>{let t=e,r=0,i;do r>0&&(t=Se(t.client,t.clock+r)),i=Al(n,t),r=t.clock-i.id.clock,t=i.redone;while(t!==null&&i instanceof Ue);return{item:i,diff:r}},Ld=(n,e)=>{for(;n!==null&&n.keep!==e;)n.keep=e,n=n.parent._item},Pa=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new Ue(Se(r,i+t),e,Se(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=Se(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s},Zm=(n,e)=>pD(n,t=>As(t.deletions,e)),e1=(n,e,t,r,i,s)=>{const o=n.doc,l=o.store,a=o.clientID,c=e.redone;if(c!==null)return qt(n,c);let u=e.parent._item,f=null,d;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!t.has(u)||e1(n,u,t,r,i,s)===null))return null;for(;u.redone!==null;)u=qt(n,u.redone)}const h=u===null?e.parent:u.content.type;if(e.parentSub===null){for(f=e.left,d=e;f!==null;){let b=f;for(;b!==null&&b.parent._item!==u;)b=b.redone===null?null:qt(n,b.redone);if(b!==null&&b.parent._item===u){f=b;break}f=f.left}for(;d!==null;){let b=d;for(;b!==null&&b.parent._item!==u;)b=b.redone===null?null:qt(n,b.redone);if(b!==null&&b.parent._item===u){d=b;break}d=d.right}}else if(d=null,e.right&&!i){for(f=e;f!==null&&f.right!==null&&(f.right.redone||As(r,f.right.id)||Zm(s.undoStack,f.right.id)||Zm(s.redoStack,f.right.id));)for(f=f.right;f.redone;)f=qt(n,f.redone);if(f&&f.right!==null)return null}else f=h._map.get(e.parentSub)||null;const p=rt(l,a),m=Se(a,p),g=new Ue(m,f,f&&f.lastId,d,d&&d.id,h,e.parentSub,e.content.copy());return e.redone=m,Ld(g,!0),g.integrate(n,0),g};class Ue extends Pd{constructor(e,t,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?Om:0}set marker(e){(this.info&au)>0!==e&&(this.info^=au)}get marker(){return(this.info&au)>0}get keep(){return(this.info&Mm)>0}set keep(e){this.keep!==e&&(this.info^=Mm)}get countable(){return(this.info&Om)>0}get deleted(){return(this.info&lu)>0}set deleted(e){this.deleted!==e&&(this.info^=lu)}markDeleted(){this.info|=lu}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=rt(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=rt(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Qi&&this.id.client!==this.parent.client&&this.parent.clock>=rt(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=jm(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=qt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===un||this.right&&this.right.constructor===un)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Ue&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Ue&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Qi){const r=Al(t,this.parent);r.constructor===un?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=jm(e,e.doc.store,Se(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),cl(this.origin,i.origin)){if(i.id.client{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Mo(e.deleteSet,this.id.client,this.id.clock,this.length),qm(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw gn();this.content.gc(e),t?Gx(e,this,new un(this.id,this.length)):this.content=new xo(this.length)}write(e,t){const r=t>0?Se(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&cc|(r===null?0:nn)|(i===null?0:ar)|(s===null?0:_o);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Oo(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===Qi?(e.writeParentInfo(!1),e.writeLeftID(l)):gn();s!==null&&e.writeString(s)}this.content.write(e,t)}}const t1=(n,e)=>WI[e&cc](n),WI=[()=>{gn()},OI,xI,MI,RI,NI,DI,jI,II,$I,()=>{gn()}],qI=10;class fn extends Pd{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){gn()}write(e,t){e.writeInfo(qI),De(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const n1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},r1="__ $YJS$ __";n1[r1]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");n1[r1]=!0;function KI(n){return n||(n={}),{delay:n.delay===void 0?200:n.delay,initialDelay:n.initialDelay===void 0?0:n.initialDelay,minDelay:n.minDelay===void 0?0:n.minDelay,maxDelay:n.maxDelay===void 0?0:n.maxDelay,factor:n.factor===void 0?0:n.factor,maxAttempts:n.maxAttempts===void 0?3:n.maxAttempts,timeout:n.timeout===void 0?0:n.timeout,jitter:n.jitter===!0,initialJitter:n.initialJitter===!0,handleError:n.handleError===void 0?null:n.handleError,handleTimeout:n.handleTimeout===void 0?null:n.handleTimeout,beforeAttempt:n.beforeAttempt===void 0?null:n.beforeAttempt,calculateDelay:n.calculateDelay===void 0?null:n.calculateDelay}}async function mu(n){return new Promise(e=>setTimeout(e,n))}function JI(n,e){let t=e.delay;if(t===0)return 0;if(e.factor&&(t*=Math.pow(e.factor,n.attemptNum-1),e.maxDelay!==0&&(t=Math.min(t,e.maxDelay))),e.jitter){const r=Math.ceil(e.minDelay),i=Math.floor(t);t=Math.floor(Math.random()*(i-r+1))+r}return Math.round(t)}async function GI(n,e){const t=KI(e);for(const l of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const a=t[l];if(!Number.isInteger(a)||a<0)throw new Error(`Value for ${l} must be an integer greater than or equal to 0`)}if(t.factor.constructor!==Number||t.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(t.delay{if(t.handleError&&await t.handleError(a,r,t),r.aborted||r.attemptsRemaining===0)throw a;r.attemptNum++;const c=i(r,t);return c&&await mu(c),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,t.timeout?new Promise((a,c)=>{const u=setTimeout(()=>{if(t.handleTimeout)try{a(t.handleTimeout(r,t))}catch(f){c(f)}else{const f=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${t.timeout})`);f.code="ATTEMPT_TIMEOUT",c(f)}},t.timeout);n(r,t).then(f=>{clearTimeout(u),a(f)}).catch(f=>{clearTimeout(u),l(f).then(a).catch(c)})}):n(r,t).catch(l)}const o=t.calculateDelay?t.calculateDelay(r,t):t.initialDelay;if(o&&await mu(o),r.attemptNum<1&&t.initialJitter){const l=i(r,t);l&&await mu(l)}return s()}var i1={};const es=()=>new Map,s1=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},o1=()=>new Set,YI=Array.from,XI=String.fromCharCode,QI=n=>n.toLowerCase(),ZI=/^\s*/g,eR=n=>n.replace(ZI,""),tR=/([A-Z])/g,eg=(n,e)=>eR(n.replace(tR,t=>`${e}${QI(t)}`)),nR=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iIo.encode(n),iR=Io?rR:nR;let so=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});so&&so.decode(new Uint8Array).length===1&&(so=null);const tg=n=>n===void 0?null:n;class sR{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let l1=new sR,Bd=!0;try{typeof localStorage<"u"&&localStorage&&(l1=localStorage,Bd=!1)}catch{}const a1=l1,oR=n=>Bd||addEventListener("storage",n),lR=n=>Bd||removeEventListener("storage",n),aR=Object.keys,cR=(n,e)=>{const t=[];for(const r in n)t.push(e(n[r],r));return t},ng=n=>aR(n).length,uR=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),fR=(n,e)=>n===e,oo=(n,e)=>{if(n==null||e==null)return fR(n,e);if(n.constructor!==e.constructor)return!1;if(n===e)return!0;switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;te.includes(n),ys=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",c1=typeof window<"u"&&typeof document<"u"&&!ys;let Bn;const hR=()=>{if(Bn===void 0)if(ys){Bn=es();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");Bn.set(`--${eg(e,"-")}`,t),Bn.set(`-${eg(e,"-")}`,t)}})):Bn=es();return Bn},wf=n=>hR().has(n),kf=n=>tg(ys?i1[n.toUpperCase()]:a1.getItem(n)),pR=n=>wf("--"+n)||kf(n)!==null;pR("production");const rg=ys&&dR(i1.FORCE_COLOR,["true","1","2"]);!wf("no-colors")&&(!ys||process.stdout.isTTY||rg)&&(!ys||wf("color")||rg||kf("COLORTERM")!==null||(kf("TERM")||"").includes("color"));const u1=Math.floor,mR=(n,e)=>nn>e?n:e,bR=64,La=128,yR=63,lo=127,f1=Number.MAX_SAFE_INTEGER;class vR{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Fd=()=>new vR,d1=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array(d1(n));let t=0;for(let r=0;r{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},St=(n,e)=>{for(;e>lo;)Ba(n,La|lo&e),e=u1(e/128);Ba(n,lo&e)},Sf=new Uint8Array(3e4),wR=Sf.length/3,kR=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;St(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=mR(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(gR(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},Os=(n,e)=>{St(n,e.byteLength),CR(n,e)},h1=n=>new Error(n),p1=h1("Unexpected end of array"),m1=h1("Integer out of Range");class _R{constructor(e){this.arr=e,this.pos=0}}const g1=n=>new _R(n),AR=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},gc=n=>AR(n,gi(n)),ig=n=>n.arr[n.pos++],gi=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posf1)throw m1}throw p1},TR=n=>{let e=n.arr[n.pos++],t=e&yR,r=64;const i=(e&bR)>0?-1:1;if(!(e&La))return i*t;const s=n.arr.length;for(;n.posf1)throw m1}throw p1},ER=n=>{let e=gi(n);if(e===0)return"";{let t=String.fromCodePoint(ig(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(ig(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},MR=n=>so.decode(gc(n)),bc=so?MR:ER,OR=n=>{const e=n.pos,t=bc(n);return n.pos=e,t},$R=n=>new Uint8Array(n),NR=(n,e,t)=>new Uint8Array(n,e,t),DR=n=>new Uint8Array(n),xR=n=>{let e="";for(let t=0;tBuffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),RR=n=>{const e=atob(n),t=$R(e.length);for(let r=0;r{const e=Buffer.from(n,"base64");return NR(e.buffer,e.byteOffset,e.byteLength)},LR=c1?xR:IR,BR=c1?RR:PR,b1=new Map;class FR{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:BR(t.newValue||"")}),oR(this._onChange)}postMessage(e){a1.setItem(this.room,LR(DR(e)))}close(){lR(this._onChange)}}const zR=typeof BroadcastChannel>"u"?FR:BroadcastChannel,Vd=n=>s1(b1,n,()=>{const e=o1(),t=new zR(n);return t.onmessage=r=>e.forEach(i=>i(r.data,"broadcastchannel")),{bc:t,subs:e}}),VR=(n,e)=>(Vd(n).subs.add(e),e),HR=(n,e)=>{const t=Vd(n),r=t.subs.delete(e);return r&&t.subs.size===0&&(t.bc.close(),b1.delete(n)),r},UR=(n,e,t=null)=>{const r=Vd(n);r.bc.postMessage(e),r.subs.forEach(i=>i(e,t))},jR=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},vs=Date.now;class WR{constructor(){this._observers=es()}on(e,t){s1(this._observers,e,o1).add(t)}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return YI((this._observers.get(e)||es()).values()).forEach(r=>r(...t))}destroy(){this._observers=es()}}const gu=3e4;class qR extends WR{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=vs();this.getLocalState()!==null&&gu/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&gu<=t-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&El(this,r,"timeout")},u1(gu/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,r=this.meta.get(t),i=r===void 0?0:r.clock+1,s=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:i,lastUpdated:vs()});const o=[],l=[],a=[],c=[];e===null?c.push(t):s==null?e!=null&&o.push(t):(l.push(t),oo(s,e)||a.push(t)),(o.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:o,updated:a,removed:c},"local"]),this.emit("update",[{added:o,updated:l,removed:c},"local"])}setLocalStateField(e,t){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:t})}getStates(){return this.states}}const El=(n,e,t)=>{const r=[];for(let i=0;i0&&(n.emit("change",[{added:[],updated:[],removed:r},t]),n.emit("update",[{added:[],updated:[],removed:r},t]))},Cf=(n,e,t=n.states)=>{const r=e.length,i=Fd();St(i,r);for(let s=0;s{const r=g1(e),i=vs(),s=[],o=[],l=[],a=[],c=gi(r);for(let u=0;u0||l.length>0||a.length>0)&&n.emit("change",[{added:s,updated:l,removed:a},t]),(s.length>0||o.length>0||a.length>0)&&n.emit("update",[{added:s,updated:o,removed:a},t])};class y1{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}const JR=n=>cR(n,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");var yt;(function(n){n[n.Sync=0]="Sync",n[n.Awareness=1]="Awareness",n[n.Auth=2]="Auth",n[n.QueryAwareness=3]="QueryAwareness",n[n.Stateless=5]="Stateless",n[n.CLOSE=7]="CLOSE",n[n.SyncStatus=8]="SyncStatus"})(yt||(yt={}));var mt;(function(n){n.Connecting="connecting",n.Connected="connected",n.Disconnected="disconnected"})(mt||(mt={}));class Ml{constructor(e){this.data=e,this.encoder=Fd(),this.decoder=g1(new Uint8Array(this.data))}peekVarString(){return OR(this.decoder)}readVarUint(){return gi(this.decoder)}readVarString(){return bc(this.decoder)}readVarUint8Array(){return gc(this.decoder)}writeVarUint(e){return St(this.encoder,e)}writeVarString(e){return Nn(this.encoder,e)}writeVarUint8Array(e){return Os(this.encoder,e)}length(){return d1(this.encoder)}}class v1 extends y1{constructor(e){super(),this.messageQueue=[],this.configuration={url:"",document:void 0,WebSocketPolyfill:void 0,parameters:{},connect:!0,broadcast:!0,forceSyncInterval:!1,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,quiet:!1,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=mt.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={forceSync:null,connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on("open",this.configuration.onOpen),this.on("open",this.onOpen.bind(this)),this.on("connect",this.configuration.onConnect),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("status",this.configuration.onStatus),this.on("status",this.onStatus.bind(this)),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("close",this.onClose.bind(this)),this.on("message",this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),typeof e.connect<"u"&&(this.shouldConnect=e.connect),this.shouldConnect&&this.connect()}async onOpen(e){this.receivedOnOpenPayload=e}async onStatus(e){this.receivedOnStatusPayload=e}attach(e){let t;return this.configuration.providerMap.set(e.configuration.name,e),this.status===mt.Disconnected&&this.shouldConnect&&(t=this.connect()),this.receivedOnOpenPayload&&e.onOpen(this.receivedOnOpenPayload),this.receivedOnStatusPayload&&e.onStatus(this.receivedOnStatusPayload),t}detach(e){this.configuration.providerMap.delete(e.configuration.name)}setConfiguration(e={}){this.configuration={...this.configuration,...e}}async connect(){if(this.status===mt.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:GI(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,beforeAttempt:o=>{(!this.shouldConnect||i)&&o.abort()}}).catch(o=>{if(o&&o.code!=="ATTEMPT_ABORTED")throw o}),cancelFunc:()=>{i=!0}}},{retryPromise:t,cancelFunc:r}=e();return this.cancelWebsocketRetry=r,t}attachWebSocketListeners(e,t){const{identifier:r}=e,i=c=>this.emit("message",c),s=c=>this.emit("close",{event:c}),o=c=>this.emit("open",c),l=c=>{t(c)};this.webSocketHandlers[r]={message:i,close:s,open:o,error:l};const a=this.webSocketHandlers[e.identifier];Object.keys(a).forEach(c=>{e.addEventListener(c,a[c])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,t=this.webSocketHandlers[e];Object.keys(t).forEach(r=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(r,t[r]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,t)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const r=new this.configuration.WebSocketPolyfill(this.url);r.binaryType="arraybuffer",r.identifier=this.identifier,this.attachWebSocketListeners(r,t),this.webSocket=r,this.status=mt.Connecting,this.emit("status",{status:mt.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){var t;this.resolveConnectionAttempt(),this.lastMessageReceived=vs();const i=new Ml(e.data).peekVarString();(t=this.configuration.providerMap.get(i))===null||t===void 0||t.onMessage(e)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=mt.Connected,this.emit("status",{status:mt.Connected}),this.emit("connect"),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var e;(e=this.connectionAttempt)===null||e===void 0||e.reject(),this.connectionAttempt=null}checkConnection(){var e;this.status===mt.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=vs()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):((e=this.webSocket)===null||e===void 0||e.close(),this.messageQueue=[])))}get serverUrl(){for(;this.configuration.url[this.configuration.url.length-1]==="/";)return this.configuration.url.slice(0,this.configuration.url.length-1);return this.configuration.url}get url(){const e=JR(this.configuration.parameters);return`${this.serverUrl}${e.length===0?"":`?${e}`}`}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch{}}send(e){var t;((t=this.webSocket)===null||t===void 0?void 0:t.readyState)===of.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){if(this.closeTries=0,this.cleanupWebSocket(),this.status===mt.Connected&&(this.status=mt.Disconnected,this.emit("status",{status:mt.Disconnected}),this.emit("disconnect",{event:e})),e.code===Tm.code&&(e.reason===Tm.reason?console.warn("[HocuspocusProvider] An authentication token is required, but you didn’t send one. Try adding a `token` to your HocuspocusProvider configuration. Won’t try again."):console.warn(`[HocuspocusProvider] Connection closed with status Unauthorized: ${e.reason}`),this.shouldConnect=!1),e.code===uD.code&&!this.configuration.quiet){console.warn("[HocuspocusProvider] The provided authentication token isn’t allowed to connect to this server. Will try again.");return}e.code===cD.code&&(console.warn(`[HocuspocusProvider] Connection closed with status MessageTooBig: ${e.reason}`),this.shouldConnect=!1),this.connectionAttempt?this.rejectConnectionAttempt():this.shouldConnect&&this.connect(),!this.shouldConnect&&this.status!==mt.Disconnected&&(this.status=mt.Disconnected,this.emit("status",{status:mt.Disconnected}),this.emit("disconnect",{event:e}))}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}const w1=0,Hd=1,k1=2,GR=(n,e)=>{St(n,w1);const t=Hx(e);Os(n,t)},S1=(n,e,t)=>{St(n,Hd),Os(n,Bx(e,t))},YR=(n,e,t)=>S1(e,t,gc(n)),C1=(n,e,t)=>{try{Rx(e,gc(n),t)}catch(r){console.error("Caught error while handling a Yjs update",r)}},XR=(n,e)=>{St(n,k1),Os(n,e)},QR=C1,ZR=(n,e,t,r)=>{const i=gi(n);switch(i){case w1:YR(n,e,t);break;case Hd:C1(n,t,r);break;case k1:QR(n,t,r);break;default:throw new Error("Unknown message type")}return i};class Qn{constructor(){this.encoder=Fd()}get(e){return e.encoder}toUint8Array(){return zd(this.encoder)}}class sg{constructor(e){this.broadcasted=!1,this.message=e}setBroadcasted(e){return this.broadcasted=e,this}apply(e,t){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case yt.Sync:this.applySyncMessage(e,t);break;case yt.Awareness:this.applyAwarenessMessage(e);break;case yt.Auth:this.applyAuthMessage(e);break;case yt.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case yt.Stateless:e.receiveStateless(bc(r.decoder));break;case yt.SyncStatus:this.applySyncStatusMessage(e,TR(r.decoder)===1);break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}r.length()>s+1&&(this.broadcasted?e.broadcast(Qn,{encoder:r.encoder}):e.send(Qn,{encoder:r.encoder}))}applySyncMessage(e,t){const{message:r}=this;r.writeVarUint(yt.Sync);const i=ZR(r.decoder,r.encoder,e.document,e);t&&i===Hd&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;KR(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){const{message:t}=this;aD(t.decoder,e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;t.writeVarUint(yt.Awareness),t.writeVarUint8Array(Cf(e.awareness,Array.from(e.awareness.getStates().keys())))}}class og{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return zd(this.encoder)}send(e){e==null||e.send(this.create())}broadcast(e){UR(e,this.create())}}class e3 extends Qn{constructor(){super(...arguments),this.type=yt.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return Nn(this.encoder,e.documentName),St(this.encoder,this.type),lD(this.encoder,e.token),this.encoder}}class hl extends Qn{constructor(){super(...arguments),this.type=yt.Awareness,this.description="Awareness states update"}get(e){if(typeof e.awareness>"u")throw new Error("The awareness message requires awareness as an argument");if(typeof e.clients>"u")throw new Error("The awareness message requires clients as an argument");Nn(this.encoder,e.documentName),St(this.encoder,this.type);let t;return e.states===void 0?t=Cf(e.awareness,e.clients):t=Cf(e.awareness,e.clients,e.states),Os(this.encoder,t),this.encoder}}class t3 extends Qn{constructor(){super(...arguments),this.type=yt.CLOSE,this.description="Ask the server to close the connection"}get(e){return Nn(this.encoder,e.documentName),St(this.encoder,this.type),this.encoder}}class n3 extends Qn{constructor(){super(...arguments),this.type=yt.QueryAwareness,this.description="Queries awareness states"}get(e){return Nn(this.encoder,e.documentName),St(this.encoder,this.type),this.encoder}}class r3 extends Qn{constructor(){super(...arguments),this.type=yt.Stateless,this.description="A stateless message"}get(e){var t;return Nn(this.encoder,e.documentName),St(this.encoder,this.type),Nn(this.encoder,(t=e.payload)!==null&&t!==void 0?t:""),this.encoder}}class bu extends Qn{constructor(){super(...arguments),this.type=yt.Sync,this.description="First sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step one message requires document as an argument");return Nn(this.encoder,e.documentName),St(this.encoder,this.type),GR(this.encoder,e.document),this.encoder}}class i3 extends Qn{constructor(){super(...arguments),this.type=yt.Sync,this.description="Second sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step two message requires document as an argument");return Nn(this.encoder,e.documentName),St(this.encoder,this.type),S1(this.encoder,e.document),this.encoder}}class s3 extends Qn{constructor(){super(...arguments),this.type=yt.Sync,this.description="A document update"}get(e){return Nn(this.encoder,e.documentName),St(this.encoder,this.type),XR(this.encoder,e.update),this.encoder}}class o3 extends Error{constructor(){super(...arguments),this.code=1001}}class l3 extends y1{constructor(e){var t,r,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,parameters:{},broadcast:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onSynced:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,quiet:!1,connect:!0,preserveConnection:!0},this.subscribedToBroadcastChannel=!1,this.isSynced=!1,this.unsyncedChanges=0,this.status=mt.Disconnected,this.isAuthenticated=!1,this.authorizedScope=void 0,this.mux=jR(),this.intervals={forceSync:null},this.isConnected=!0,this.boundBroadcastChannelSubscriber=this.broadcastChannelSubscriber.bind(this),this.boundPageUnload=this.pageUnload.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.boundOnStatus=this.onStatus.bind(this),this.forwardConnect=s=>this.emit("connect",s),this.forwardOpen=s=>this.emit("open",s),this.forwardClose=s=>this.emit("close",s),this.forwardDisconnect=s=>this.emit("disconnect",s),this.forwardDestroy=s=>this.emit("destroy",s),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Es,this.configuration.awareness=e.awareness!==void 0?e.awareness:new qR(this.document),this.on("open",this.configuration.onOpen),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("synced",this.configuration.onSynced),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("stateless",this.configuration.onStateless),this.on("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),this.configuration.websocketProvider.on("connect",this.configuration.onConnect),this.configuration.websocketProvider.on("connect",this.forwardConnect),this.configuration.websocketProvider.on("open",this.boundOnOpen),this.configuration.websocketProvider.on("open",this.forwardOpen),this.configuration.websocketProvider.on("close",this.boundOnClose),this.configuration.websocketProvider.on("close",this.configuration.onClose),this.configuration.websocketProvider.on("close",this.forwardClose),this.configuration.websocketProvider.on("status",this.boundOnStatus),this.configuration.websocketProvider.on("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.on("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.on("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.on("destroy",this.forwardDestroy),(t=this.awareness)===null||t===void 0||t.on("update",()=>{this.emit("awarenessUpdate",{states:Em(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:Em(this.awareness.getStates())})}),this.document.on("update",this.documentUpdateHandler.bind(this)),(i=this.awareness)===null||i===void 0||i.on("update",this.awarenessUpdateHandler.bind(this)),this.registerEventListeners(),this.configuration.forceSyncInterval&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.configuration.websocketProvider.attach(this)}onStatus({status:e}){this.status=e,this.configuration.onStatus({status:e}),this.emit("status",{status:e})}setConfiguration(e={}){if(!e.websocketProvider&&e.url){const t=e;this.configuration.websocketProvider=new v1({url:t.url,connect:t.connect,parameters:t.parameters})}this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",this.unsyncedChanges)}decrementUnsyncedChanges(){this.unsyncedChanges-=1,this.unsyncedChanges===0&&(this.synced=!0),this.emit("unsyncedChanges",this.unsyncedChanges)}forceSync(){this.send(bu,{document:this.document,documentName:this.configuration.name})}pageUnload(){this.awareness&&El(this.awareness,[this.document.clientID],"window unload")}registerEventListeners(){typeof window>"u"||window.addEventListener("unload",this.boundPageUnload)}sendStateless(e){this.send(r3,{documentName:this.configuration.name,payload:e})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send(s3,{update:e,documentName:this.configuration.name},!0))}awarenessUpdateHandler({added:e,updated:t,removed:r},i){const s=e.concat(t).concat(r);this.send(hl,{awareness:this.awareness,clients:s,documentName:this.configuration.name},!0)}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,this.emit("synced",{state:e}),this.emit("sync",{state:e}))}receiveStateless(e){this.emit("stateless",{payload:e})}get isAuthenticationRequired(){return!!this.configuration.token&&!this.isAuthenticated}async connect(){return this.configuration.broadcast&&this.subscribeToBroadcastChannel(),this.configuration.websocketProvider.shouldConnect=!0,this.configuration.websocketProvider.attach(this)}disconnect(){this.disconnectBroadcastChannel(),this.configuration.websocketProvider.detach(this),this.isConnected=!1,this.configuration.preserveConnection||this.configuration.websocketProvider.disconnect()}async onOpen(e){this.isAuthenticated=!1,this.isConnected=!0,this.emit("open",{event:e});let t;try{t=await this.getToken()}catch(r){this.permissionDeniedHandler(`Failed to get token: ${r}`);return}this.isAuthenticationRequired&&this.send(e3,{token:t,documentName:this.configuration.name}),this.startSync()}async getToken(){return typeof this.configuration.token=="function"?await this.configuration.token():this.configuration.token}startSync(){this.incrementUnsyncedChanges(),this.send(bu,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(hl,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,t,r=!1){if(!this.isConnected)return;r&&this.mux(()=>{this.broadcast(e,t)});const i=new og(e,t);this.emit("outgoingMessage",{message:i.message}),i.send(this.configuration.websocketProvider)}onMessage(e){const t=new Ml(e.data),r=t.readVarString();t.writeVarString(r),this.emit("message",{event:e,message:new Ml(e.data)}),new sg(t).apply(this,!0)}onClose(e){this.isAuthenticated=!1,this.synced=!1,this.awareness&&El(this.awareness,Array.from(this.awareness.getStates().keys()).filter(t=>t!==this.document.clientID),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(El(this.awareness,[this.document.clientID],"provider destroy"),this.awareness.off("update",this.awarenessUpdateHandler),this.awareness.destroy()),this.document.off("update",this.documentUpdateHandler),this.removeAllListeners(),this.configuration.websocketProvider.off("connect",this.configuration.onConnect),this.configuration.websocketProvider.off("connect",this.forwardConnect),this.configuration.websocketProvider.off("open",this.boundOnOpen),this.configuration.websocketProvider.off("open",this.forwardOpen),this.configuration.websocketProvider.off("close",this.boundOnClose),this.configuration.websocketProvider.off("close",this.configuration.onClose),this.configuration.websocketProvider.off("close",this.forwardClose),this.configuration.websocketProvider.off("status",this.boundOnStatus),this.configuration.websocketProvider.off("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.off("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.off("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.off("destroy",this.forwardDestroy),this.send(t3,{documentName:this.configuration.name}),this.disconnect(),!(typeof window>"u")&&window.removeEventListener("unload",this.boundPageUnload)}permissionDeniedHandler(e){this.emit("authenticationFailed",{reason:e}),this.isAuthenticated=!1,this.disconnect(),this.status=mt.Disconnected}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit("authenticated")}get broadcastChannel(){return`${this.configuration.name}`}broadcastChannelSubscriber(e){this.mux(()=>{const t=new Ml(e),r=t.readVarString();t.writeVarString(r),new sg(t).setBroadcasted(!0).apply(this,!1)})}subscribeToBroadcastChannel(){this.subscribedToBroadcastChannel||(VR(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!0),this.mux(()=>{this.broadcast(bu,{document:this.document,documentName:this.configuration.name}),this.broadcast(i3,{document:this.document,documentName:this.configuration.name}),this.broadcast(n3,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.broadcast(hl,{awareness:this.awareness,clients:[this.document.clientID],document:this.document,documentName:this.configuration.name})})}disconnectBroadcastChannel(){this.awareness&&this.send(hl,{awareness:this.awareness,clients:[this.document.clientID],states:new Map,documentName:this.configuration.name},!0),this.subscribedToBroadcastChannel&&(HR(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!1)}broadcast(e,t){this.configuration.broadcast&&this.subscribedToBroadcastChannel&&new og(e,t).broadcast(this.broadcastChannel)}setAwarenessField(e,t){if(!this.awareness)throw new o3(`Cannot set awareness field "${e}" to ${JSON.stringify(t)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,t)}}crypto.getRandomValues.bind(crypto);const a3=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},c3=/[\uD800-\uDBFF]/,u3=/[\uDC00-\uDFFF]/,f3=(n,e)=>{let t=0,r=0;for(;t0&&c3.test(n[t-1])&&t--;r+t0&&u3.test(n[n.length-r])&&r--,{index:t,remove:n.length-t-r,insert:e.slice(t,e.length-r)}},d3=f3,it=new Pt("y-sync"),cr=new Pt("y-undo");new Pt("yjs-cursor");const Fa=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!As(e.ds,n.id),h3=[{light:"#ecd44433",dark:"#ecd444"}],p3=(n,e,t)=>{if(!n.has(t)){if(n.sizer.add(i)),e=e.filter(i=>!r.has(i))}n.set(t,WD(e))}return n.get(t)},m3=(n,{colors:e=h3,colorMapping:t=new Map,permanentUserData:r=null,onFirstRender:i=()=>{}}={})=>{let s=!1,o;const l=new ut({props:{editable:a=>{const c=it.getState(a);return c.snapshot==null&&c.prevSnapshot==null}},key:it,state:{init:(a,c)=>({type:n,doc:n.doc,binding:null,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:t,permanentUserData:r}),apply:(a,c)=>{const u=a.getMeta(it);if(u!==void 0){c=Object.assign({},c);for(const f in u)c[f]=u[f]}return c.addToHistory=a.getMeta("addToHistory")!==!1,c.isChangeOrigin=u!==void 0&&!!u.isChangeOrigin,c.isUndoRedoOperation=u!==void 0&&!!u.isChangeOrigin&&!!u.isUndoRedoOperation,c.binding!==null&&u!==void 0&&(u.snapshot!=null||u.prevSnapshot!=null)&&pf(0,()=>{c.binding==null||c.binding.isDestroyed||(u.restore==null?c.binding._renderSnapshot(u.snapshot,u.prevSnapshot,c):(c.binding._renderSnapshot(u.snapshot,u.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,c.binding.mux(()=>{c.binding._prosemirrorChanged(c.binding.prosemirrorView.state.doc)})))}),c}},view:a=>{const c=new b3(n,a);return o!=null&&o.destroy(),o=pf(0,()=>{c._forceRerender(),a.dispatch(a.state.tr.setMeta(it,{binding:c})),i()}),{update:()=>{const u=l.getState(a.state);if(u.snapshot==null&&u.prevSnapshot==null&&(s||a.state.doc.content.findDiffStart(a.state.doc.type.createAndFill().content)!==null)){if(s=!0,u.addToHistory===!1&&!u.isChangeOrigin){const f=cr.getState(a.state),d=f&&f.undoManager;d&&d.stopCapturing()}c.mux(()=>{u.doc.transact(f=>{f.meta.set("addToHistory",u.addToHistory),c._prosemirrorChanged(a.state.doc)},it)})}},destroy:()=>{o.destroy(),c.destroy()}}}});return l},g3=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null){const r=ug(t.doc,t.type,e.anchor,t.mapping),i=ug(t.doc,t.type,e.head,t.mapping);r!==null&&i!==null&&(n=n.setSelection(be.create(n.doc,r,i)))}},_f=(n,e)=>({anchor:cg(e.selection.anchor,n.type,n.mapping),head:cg(e.selection.head,n.type,n.mapping)});class b3{constructor(e,t){this.type=e,this.prosemirrorView=t,this.mux=a3(),this.isDestroyed=!1,this.mapping=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&(this.beforeTransactionSelection=_f(this,t.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),e.observeDeep(this._observeFunction),this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(ox&&this._domSelectionInView===null&&(pf(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection(),t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);const i=t.getBoundingClientRect(),s=hx.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,t){t||(t=$0(v0(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(it,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping=new Map,this.mux(()=>{const e=this.type.toArray().map(r=>Ol(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(e),0,0));t.setMeta(it,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping=new Map,this.mux(()=>{const e=this.type.toArray().map(r=>Ol(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(e),0,0));this.prosemirrorView.dispatch(t.setMeta(it,{isChangeOrigin:!0}))})}_renderSnapshot(e,t,r){e||(e=Kx(this.doc)),this.mapping=new Map,this.mux(()=>{this.doc.transact(i=>{const s=r.permanentUserData;s&&s.dss.forEach(c=>{Hr(i,c,u=>{})});const o=(c,u)=>{const f=c==="added"?s.getUserByClientId(u.client):s.getUserByDeletedId(u);return{user:f,type:c,color:p3(r.colorMapping,r.colors,f)}},l=V0(this.type,new Od(t.ds,e.sv)).map(c=>!c._item.deleted||Fa(c._item,e)||Fa(c._item,t)?Ol(c,this.prosemirrorView.state.schema,new Map,e,t,o):null).filter(c=>c!==null),a=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(l),0,0));this.prosemirrorView.dispatch(a.setMeta(it,{isChangeOrigin:!0}))},it)})}_typeChanged(e,t){const r=it.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(l,a)=>this.mapping.delete(a);Hr(t,t.deleteSet,l=>{if(l.constructor===Ue){const a=l.content.type;a&&this.mapping.delete(a)}}),t.changed.forEach(i),t.changedParentTypes.forEach(i);const s=this.type.toArray().map(l=>_1(l,this.prosemirrorView.state.schema,this.mapping)).filter(l=>l!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(s),0,0));g3(o,this.beforeTransactionSelection,this),o=o.setMeta(it,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof R0}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Tf(this.doc,this.type,e,this.mapping),this.beforeTransactionSelection=_f(this,this.prosemirrorView.state)},it)}destroy(){this.isDestroyed=!0,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions)}}const _1=(n,e,t,r,i,s)=>{const o=t.get(n);if(o===void 0){if(n instanceof Bt)return Ol(n,e,t,r,i,s);throw _n()}return o},Ol=(n,e,t,r,i,s)=>{const o=[],l=a=>{if(a.constructor===Bt){const c=_1(a,e,t,r,i,s);c!==null&&o.push(c)}else{const c=y3(a,e,t,r,i,s);c!==null&&c.forEach(u=>{u!==null&&o.push(u)})}};r===void 0||i===void 0?n.toArray().forEach(l):V0(n,new Od(i.ds,r.sv)).forEach(l);try{const a=n.getAttributes(r);r!==void 0&&(Fa(n._item,r)?Fa(n._item,i)||(a.ychange=s?s("added",n._item.id):{type:"added"}):a.ychange=s?s("removed",n._item.id):{type:"removed"});const c=e.node(n.nodeName,a,o);return t.set(n,c),c}catch{return n.doc.transact(c=>{n._item.delete(c)},it),t.delete(n),null}},y3=(n,e,t,r,i,s)=>{const o=[],l=n.toDelta(r,i,s);try{for(let a=0;a{n._item.delete(c)},it),null}return o},v3=(n,e)=>{const t=new rn,r=n.map(i=>({insert:i.text,attributes:T1(i.marks)}));return t.applyDelta(r),e.set(t,n),t},w3=(n,e)=>{const t=new Bt(n.type.name);for(const r in n.attrs){const i=n.attrs[r];i!==null&&r!=="ychange"&&t.setAttribute(r,i)}return t.insert(0,yc(n).map(r=>Af(r,e))),e.set(t,n),t},Af=(n,e)=>n instanceof Array?v3(n,e):w3(n,e),lg=n=>typeof n=="object"&&n!==null,Ud=(n,e)=>{const t=Object.keys(n).filter(i=>n[i]!==null);let r=t.length===Object.keys(e).filter(i=>e[i]!==null).length;for(let i=0;i{const e=n.content.content,t=[];for(let r=0;r{const t=n.toDelta();return t.length===e.length&&t.every((r,i)=>r.insert===e[i].text&&f0(r.attributes||{}).length===e[i].marks.length&&e[i].marks.every(s=>Ud(r.attributes[s.type.name]||{},s.attrs)))},Ro=(n,e)=>{if(n instanceof Bt&&!(e instanceof Array)&&Ef(n,e)){const t=yc(e);return n._length===t.length&&Ud(n.getAttributes(),e.attrs)&&n.toArray().every((r,i)=>Ro(r,t[i]))}return n instanceof rn&&e instanceof Array&&A1(n,e)},za=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,r)=>e[r]===t),ag=(n,e,t)=>{const r=n.toArray(),i=yc(e),s=i.length,o=r.length,l=ac(o,s);let a=0,c=0,u=!1;for(;a{let e="",t=n._start;const r={};for(;t!==null;)t.deleted||(t.countable&&t.content instanceof $n?e+=t.content.str:t.content instanceof lt&&(r[t.content.key]=null)),t=t.right;return{str:e,nAttrs:r}},S3=(n,e,t)=>{t.set(n,e);const{nAttrs:r,str:i}=k3(n),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,T1(c.marks))})),{insert:o,remove:l,index:a}=d3(i,s.map(c=>c.insert).join(""));n.delete(a,l),n.insert(a,o),n.applyDelta(s.map(c=>({retain:c.insert.length,attributes:c.attributes})))},T1=n=>{const e={};return n.forEach(t=>{t.type.name!=="ychange"&&(e[t.type.name]=t.attrs)}),e},Tf=(n,e,t,r)=>{if(e instanceof Bt&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(r.set(e,t),e instanceof Bt){const f=e.getAttributes(),d=t.attrs;for(const h in d)d[h]!==null?f[h]!==d[h]&&h!=="ychange"&&e.setAttribute(h,d[h]):e.removeAttribute(h);for(const h in f)d[h]===void 0&&e.removeAttribute(h)}const i=yc(t),s=i.length,o=e.toArray(),l=o.length,a=ac(s,l);let c=0,u=0;for(;c{for(;l-c-u>0&&s-c-u>0;){const d=o[c],h=i[c],p=o[l-u-1],m=i[s-u-1];if(d instanceof rn&&h instanceof Array)A1(d,h)||S3(d,h,r),c+=1;else{let g=d instanceof Bt&&Ef(d,h),b=p instanceof Bt&&Ef(p,m);if(g&&b){const C=ag(d,h,r),E=ag(p,m,r);C.foundMappedChild&&!E.foundMappedChild?b=!1:!C.foundMappedChild&&E.foundMappedChild||C.equalityFactor0&&(e.slice(c,c+f).forEach(d=>r.delete(d)),e.delete(c,f)),c+u!(e instanceof Array)&&n.nodeName===e.type.name,cg=(n,e,t)=>{if(n===0)return du(e,0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof rn){if(r._length>=n)return du(r,n);if(n-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,n--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(t.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&n1)return new $a(r._item===null?null:r._item.id,r._item===null?Oo(r):null,null);if(n-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(n===0)return r=r._item===null?r:r._item.parent,new $a(r._item===null?null:r._item.id,r._item===null?Oo(r):null,null);do r=r._item.parent,n--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw gn();if(n===0&&r.constructor!==rn&&r!==e)return C3(r._item.parent,r._item)}return du(e,e._length)},C3=(n,e)=>{let t=null,r=null;return n._item===null?r=Oo(n):t=Se(n._item.id.client,n._item.id.clock),new $a(t,r,e.id)},ug=(n,e,t,r)=>{const i=qx(t,n);if(i===null||i.type!==e&&!$o(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===rn)o=i.index;else if(s._item===null||!s._item.deleted){let l=s._first,a=0;for(;a{const e=cr.getState(n).undoManager;if(e!=null)return e.undo(),!0},A3=n=>{const e=cr.getState(n).undoManager;if(e!=null)return e.redo(),!0},T3=new Set(["paragraph"]),E3=(n,e)=>!(n instanceof Ue)||!(n.content instanceof Dn)||!(n.content.type instanceof Ai||n.content.type instanceof Bt&&e.has(n.content.type.nodeName))||n.content.type._length===0,M3=({protectedNodes:n=T3,trackedOrigins:e=[],undoManager:t=null}={})=>new ut({key:cr,state:{init:(r,i)=>{const s=it.getState(i),o=t||new R0(s.type,{trackedOrigins:new Set([it].concat(e)),deleteFilter:l=>E3(l,n),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const l=it.getState(o).binding,a=i.undoManager,c=a.undoStack.length>0,u=a.redoStack.length>0;return l?{undoManager:a,prevSel:_f(l,s),hasUndoOps:c,hasRedoOps:u}:c!==i.hasUndoOps||u!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):i}},view:r=>{const i=it.getState(r.state),s=cr.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const l=i.binding;l&&o.meta.set(l,cr.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const l=i.binding;l&&(l.beforeTransactionSelection=o.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),O3=Ot.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},onCreate(){this.editor.extensionManager.extensions.find(n=>n.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),cr.getState(e).undoManager.undoStack.length===0?!1:t?_3(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),cr.getState(e).undoManager.redoStack.length===0?!1:t?A3(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){const n=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),e=M3(),t=e.spec.view;e.spec.view=o=>{const{undoManager:l}=cr.getState(o.state);l.restore&&(l.restore(),l.restore=()=>{});const a=t?t(o):void 0;return{destroy:()=>{const c=l.trackedOrigins.has(l),u=l._observers;l.restore=()=>{c&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=u},a!=null&&a.destroy&&a.destroy()}}};const r=this.options.onFirstRender;return[m3(n,r?{onFirstRender:r}:{}),e]}});function $3(n,e){return[e0.configure({history:!1}),O3.configure({document:n.document}),zy.configure({element:e}),qy.configure({openOnClick:!1,autolink:!0}),t0.configure({inline:!0}),Jy.configure({types:["heading","paragraph"]}),Ky]}function N3(n){let e;const t=n[2].default,r=re(t,n,n[3],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8)&&ie(r,t,i,i[3],e?oe(t,i[3],s,null):se(i[3]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function D3(n){let e,t;const r=[{class:_t("text-lg font-semibold leading-none tracking-tight",n[0])},n[1]];let i={$$slots:{default:[N3]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(3,o=a.$$scope)},[l,i,s,o]}class I3 extends fe{constructor(e){super(),de(this,e,x3,D3,ce,{class:0})}}function R3(n){let e;const t=n[1].default,r=re(t,n,n[2],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&4)&&ie(r,t,i,i[2],e?oe(t,i[2],s,null):se(i[2]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function P3(n){let e,t;const r=[n[0]];let i={$$slots:{default:[R3]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(l)),t(0,i=Te(e,r)),"$$scope"in l&&t(2,o=l.$$scope)},[i,s,o]}class B3 extends fe{constructor(e){super(),de(this,e,L3,P3,ce,{})}}function F3(n){let e,t,r;const i=n[3].default,s=re(i,n,n[2],null);let o=[{class:t=_t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n[0])},n[1]],l={};for(let a=0;a{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(2,o=a.$$scope)},[l,i,o,s]}class V3 extends fe{constructor(e){super(),de(this,e,z3,F3,ce,{class:0})}}function H3(n){let e,t,r;const i=n[3].default,s=re(i,n,n[2],null);let o=[{class:t=_t("flex flex-col space-y-1.5 text-center sm:text-left",n[0])},n[1]],l={};for(let a=0;a{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(2,o=a.$$scope)},[l,i,o,s]}class j3 extends fe{constructor(e){super(),de(this,e,U3,H3,ce,{class:0})}}function W3(n,{delay:e=0,duration:t=400,easing:r=x1}={}){const i=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:r,css:s=>`opacity: ${s*i}`}}function q3(n){let e,t;const r=[{transition:n[1]},{transitionConfig:n[2]},{class:_t("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",n[0])},n[3]];let i={};for(let s=0;s{e=T(T({},e),J(a)),t(3,i=Te(e,r)),"class"in a&&t(0,s=a.class),"transition"in a&&t(1,o=a.transition),"transitionConfig"in a&&t(2,l=a.transitionConfig)},[s,o,l,i]}class J3 extends fe{constructor(e){super(),de(this,e,K3,q3,ce,{class:0,transition:1,transitionConfig:2})}}function G3(n){let e,t,r,i="Close",s;return e=new x2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment),t=ve(),r=ze("span"),r.textContent=i,this.h()},l(o){I(e.$$.fragment,o),t=we(o),r=Ve(o,"SPAN",{class:!0,"data-svelte-h":!0}),I1(r)!=="svelte-1pewzs3"&&(r.textContent=i),this.h()},h(){Ir(r,"class","sr-only")},m(o,l){R(e,o,l),ne(o,t,l),ne(o,r,l),s=!0},p:Oe,i(o){s||(k(e.$$.fragment,o),s=!0)},o(o){S(e.$$.fragment,o),s=!1},d(o){o&&(j(t),j(r)),P(e,o)}}}function Y3(n){let e,t,r;const i=n[4].default,s=re(i,n,n[5],null);return t=new hA({props:{class:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",$$slots:{default:[G3]},$$scope:{ctx:n}}}),{c(){s&&s.c(),e=ve(),x(t.$$.fragment)},l(o){s&&s.l(o),e=we(o),I(t.$$.fragment,o)},m(o,l){s&&s.m(o,l),ne(o,e,l),R(t,o,l),r=!0},p(o,l){s&&s.p&&(!r||l&32)&&ie(s,i,o,o[5],r?oe(i,o[5],l,null):se(o[5]),null);const a={};l&32&&(a.$$scope={dirty:l,ctx:o}),t.$set(a)},i(o){r||(k(s,o),k(t.$$.fragment,o),r=!0)},o(o){S(s,o),S(t.$$.fragment,o),r=!1},d(o){o&&j(e),s&&s.d(o),P(t,o)}}}function X3(n){let e,t,r,i;e=new J3({});const s=[{transition:n[1]},{transitionConfig:n[2]},{class:_t("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 sm:rounded-lg md:w-full",n[0])},n[3]];let o={$$slots:{default:[Y3]},$$scope:{ctx:n}};for(let l=0;l{e=T(T({},e),J(u)),t(3,i=Te(e,r)),"class"in u&&t(0,l=u.class),"transition"in u&&t(1,a=u.transition),"transitionConfig"in u&&t(2,c=u.transitionConfig),"$$scope"in u&&t(5,o=u.$$scope)},[l,a,c,i,s,o]}class eP extends fe{constructor(e){super(),de(this,e,Z3,Q3,ce,{class:0,transition:1,transitionConfig:2})}}function tP(n){let e;const t=n[2].default,r=re(t,n,n[3],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8)&&ie(r,t,i,i[3],e?oe(t,i[3],s,null):se(i[3]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function nP(n){let e,t;const r=[{class:_t("text-sm text-muted-foreground",n[0])},n[1]];let i={$$slots:{default:[tP]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(3,o=a.$$scope)},[l,i,s,o]}class iP extends fe{constructor(e){super(),de(this,e,rP,nP,ce,{class:0})}}const sP=Z_,oP=QA;function lP(n){let e;const t=n[2].default,r=re(t,n,n[4],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16)&&ie(r,t,i,i[4],e?oe(t,i[4],s,null):se(i[4]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function aP(n){let e,t;const r=[{class:_t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",n[0])},n[1]];let i={$$slots:{default:[lP]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(c)),t(1,i=Te(e,r)),"class"in c&&t(0,l=c.class),"$$scope"in c&&t(4,o=c.$$scope)},[l,i,s,a,o]}class fg extends fe{constructor(e){super(),de(this,e,cP,aP,ce,{class:0})}}function uP(n){let e,t,r,i,s=[{class:t=_t("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",n[1])},{readOnly:n[2]},n[3]],o={};for(let l=0;l{e=T(T({},e),J(F)),t(3,i=Te(e,r)),"class"in F&&t(1,s=F.class),"value"in F&&t(0,o=F.value),"readonly"in F&&t(2,l=F.readonly)},[o,s,l,i,a,c,u,f,d,h,p,m,g,b,C,E,v,H,_,B]}class dg extends fe{constructor(e){super(),de(this,e,fP,uP,ce,{class:1,value:0,readonly:2})}}function hg(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b,C,E,v,H,_,B,F,M,X,$,y,w,O,L,A,z,q,Y,te,ge,ye,me,Ke,Fe,Qe,Xe,W,ft,Ht,dt,xn,Ee,on,Le,at,ht,hr,Ut,Yt,pt,In,bn,pr;return r=new Be({props:{class:"mr-0.5 h-8 px-2",$$slots:{default:[dP]},$$scope:{ctx:n}}}),r.$on("click",n[7]),s=new Be({props:{disabled:!n[1].can().chain().focus().toggleBold().run(),variant:n[1].isActive("bold")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[hP]},$$scope:{ctx:n}}}),s.$on("click",n[8]),l=new Be({props:{disabled:!n[1].can().chain().focus().toggleItalic().run(),variant:n[1].isActive("italic")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[pP]},$$scope:{ctx:n}}}),l.$on("click",n[9]),c=new Be({props:{disabled:!n[1].can().chain().focus().toggleStrike().run(),variant:n[1].isActive("strike")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[mP]},$$scope:{ctx:n}}}),c.$on("click",n[10]),f=new Be({props:{disabled:!n[1].can().chain().focus().toggleCode().run(),variant:n[1].isActive("code")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[gP]},$$scope:{ctx:n}}}),f.$on("click",n[11]),h=new Be({props:{variant:n[1].isActive("paragraph")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[bP]},$$scope:{ctx:n}}}),h.$on("click",n[12]),m=new Be({props:{variant:n[1].isActive("heading",{level:1})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[yP]},$$scope:{ctx:n}}}),m.$on("click",n[13]),b=new Be({props:{variant:n[1].isActive("heading",{level:2})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[vP]},$$scope:{ctx:n}}}),b.$on("click",n[14]),E=new Be({props:{variant:n[1].isActive("heading",{level:3})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[wP]},$$scope:{ctx:n}}}),E.$on("click",n[15]),H=new Be({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"left"})?"default":"secondary",$$slots:{default:[kP]},$$scope:{ctx:n}}}),H.$on("click",n[16]),B=new Be({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"center"})?"default":"secondary",$$slots:{default:[SP]},$$scope:{ctx:n}}}),B.$on("click",n[17]),M=new Be({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"right"})?"default":"secondary",$$slots:{default:[CP]},$$scope:{ctx:n}}}),M.$on("click",n[18]),$=new Be({props:{variant:n[1].isActive("bulletList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[_P]},$$scope:{ctx:n}}}),$.$on("click",n[19]),w=new Be({props:{variant:n[1].isActive("orderedList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[AP]},$$scope:{ctx:n}}}),w.$on("click",n[20]),L=new Be({props:{variant:n[1].isActive("codeBlock")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[TP]},$$scope:{ctx:n}}}),L.$on("click",n[21]),z=new Be({props:{variant:n[1].isActive("blockquote")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[EP]},$$scope:{ctx:n}}}),z.$on("click",n[22]),Y=new Be({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[MP]},$$scope:{ctx:n}}}),Y.$on("click",n[23]),ge=new Be({props:{variant:n[1].isActive("link")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[OP]},$$scope:{ctx:n}}}),ge.$on("click",n[24]),me=new Be({props:{disabled:!n[1].isActive("link"),class:"mx-0.5 h-8 px-2",$$slots:{default:[$P]},$$scope:{ctx:n}}}),me.$on("click",n[25]),Fe=new Be({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[NP]},$$scope:{ctx:n}}}),Fe.$on("click",n[26]),Xe=new Be({props:{disabled:!n[1].can().chain().focus().undo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[DP]},$$scope:{ctx:n}}}),Xe.$on("click",n[27]),ft=new Be({props:{disabled:!n[1].can().chain().focus().redo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[xP]},$$scope:{ctx:n}}}),ft.$on("click",n[28]),dt=new Be({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[IP]},$$scope:{ctx:n}}}),dt.$on("click",n[29]),Le=new Be({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[RP]},$$scope:{ctx:n}}}),Le.$on("click",n[32]),ht=new sP({props:{closeOnOutsideClick:!1,$$slots:{default:[qP]},$$scope:{ctx:n}}}),Ut=new Be({props:{disabled:!n[4],class:"mx-0.5 h-8 px-2",$$slots:{default:[KP]},$$scope:{ctx:n}}}),Ut.$on("click",n[38]),pt=new Be({props:{class:"ml-0.5 h-8 px-2",$$slots:{default:[JP]},$$scope:{ctx:n}}}),pt.$on("click",L1),{c(){e=ze("div"),t=ze("nav"),x(r.$$.fragment),i=ve(),x(s.$$.fragment),o=ve(),x(l.$$.fragment),a=ve(),x(c.$$.fragment),u=ve(),x(f.$$.fragment),d=ve(),x(h.$$.fragment),p=ve(),x(m.$$.fragment),g=ve(),x(b.$$.fragment),C=ve(),x(E.$$.fragment),v=ve(),x(H.$$.fragment),_=ve(),x(B.$$.fragment),F=ve(),x(M.$$.fragment),X=ve(),x($.$$.fragment),y=ve(),x(w.$$.fragment),O=ve(),x(L.$$.fragment),A=ve(),x(z.$$.fragment),q=ve(),x(Y.$$.fragment),te=ve(),x(ge.$$.fragment),ye=ve(),x(me.$$.fragment),Ke=ve(),x(Fe.$$.fragment),Qe=ve(),x(Xe.$$.fragment),W=ve(),x(ft.$$.fragment),Ht=ve(),x(dt.$$.fragment),xn=ve(),Ee=ze("input"),on=ve(),x(Le.$$.fragment),at=ve(),x(ht.$$.fragment),hr=ve(),x(Ut.$$.fragment),Yt=ve(),x(pt.$$.fragment),this.h()},l(D){e=Ve(D,"DIV",{});var U=He(e);t=Ve(U,"NAV",{class:!0});var Q=He(t);I(r.$$.fragment,Q),i=we(Q),I(s.$$.fragment,Q),o=we(Q),I(l.$$.fragment,Q),a=we(Q),I(c.$$.fragment,Q),u=we(Q),I(f.$$.fragment,Q),d=we(Q),I(h.$$.fragment,Q),p=we(Q),I(m.$$.fragment,Q),g=we(Q),I(b.$$.fragment,Q),C=we(Q),I(E.$$.fragment,Q),v=we(Q),I(H.$$.fragment,Q),_=we(Q),I(B.$$.fragment,Q),F=we(Q),I(M.$$.fragment,Q),X=we(Q),I($.$$.fragment,Q),y=we(Q),I(w.$$.fragment,Q),O=we(Q),I(L.$$.fragment,Q),A=we(Q),I(z.$$.fragment,Q),q=we(Q),I(Y.$$.fragment,Q),te=we(Q),I(ge.$$.fragment,Q),ye=we(Q),I(me.$$.fragment,Q),Ke=we(Q),I(Fe.$$.fragment,Q),Qe=we(Q),I(Xe.$$.fragment,Q),W=we(Q),I(ft.$$.fragment,Q),Ht=we(Q),I(dt.$$.fragment,Q),xn=we(Q),Ee=Ve(Q,"INPUT",{type:!0,id:!0,style:!0}),on=we(Q),I(Le.$$.fragment,Q),at=we(Q),I(ht.$$.fragment,Q),hr=we(Q),I(Ut.$$.fragment,Q),Yt=we(Q),I(pt.$$.fragment,Q),Q.forEach(j),U.forEach(j),this.h()},h(){Ir(Ee,"type","file"),Ir(Ee,"id","selectedFile"),P1(Ee,"display","none"),Ir(t,"class","fixed left-0 top-0 z-10 flex w-full flex-row justify-start overflow-x-auto bg-white p-4 dark:bg-[color:hsl(240,10%,3.9%)] lg:justify-center")},m(D,U){ne(D,e,U),Ie(e,t),R(r,t,null),Ie(t,i),R(s,t,null),Ie(t,o),R(l,t,null),Ie(t,a),R(c,t,null),Ie(t,u),R(f,t,null),Ie(t,d),R(h,t,null),Ie(t,p),R(m,t,null),Ie(t,g),R(b,t,null),Ie(t,C),R(E,t,null),Ie(t,v),R(H,t,null),Ie(t,_),R(B,t,null),Ie(t,F),R(M,t,null),Ie(t,X),R($,t,null),Ie(t,y),R(w,t,null),Ie(t,O),R(L,t,null),Ie(t,A),R(z,t,null),Ie(t,q),R(Y,t,null),Ie(t,te),R(ge,t,null),Ie(t,ye),R(me,t,null),Ie(t,Ke),R(Fe,t,null),Ie(t,Qe),R(Xe,t,null),Ie(t,W),R(ft,t,null),Ie(t,Ht),R(dt,t,null),Ie(t,xn),Ie(t,Ee),Ie(t,on),R(Le,t,null),Ie(t,at),R(ht,t,null),Ie(t,hr),R(Ut,t,null),Ie(t,Yt),R(pt,t,null),In=!0,bn||(pr=[ae(Ee,"change",n[30]),ae(Ee,"change",n[31])],bn=!0)},p(D,U){const Q={};U[1]&32768&&(Q.$$scope={dirty:U,ctx:D}),r.$set(Q);const Zn={};U[0]&2&&(Zn.disabled=!D[1].can().chain().focus().toggleBold().run()),U[0]&2&&(Zn.variant=D[1].isActive("bold")?"default":"secondary"),U[1]&32768&&(Zn.$$scope={dirty:U,ctx:D}),s.$set(Zn);const Di={};U[0]&2&&(Di.disabled=!D[1].can().chain().focus().toggleItalic().run()),U[0]&2&&(Di.variant=D[1].isActive("italic")?"default":"secondary"),U[1]&32768&&(Di.$$scope={dirty:U,ctx:D}),l.$set(Di);const xi={};U[0]&2&&(xi.disabled=!D[1].can().chain().focus().toggleStrike().run()),U[0]&2&&(xi.variant=D[1].isActive("strike")?"default":"secondary"),U[1]&32768&&(xi.$$scope={dirty:U,ctx:D}),c.$set(xi);const Ii={};U[0]&2&&(Ii.disabled=!D[1].can().chain().focus().toggleCode().run()),U[0]&2&&(Ii.variant=D[1].isActive("code")?"default":"secondary"),U[1]&32768&&(Ii.$$scope={dirty:U,ctx:D}),f.$set(Ii);const $s={};U[0]&2&&($s.variant=D[1].isActive("paragraph")?"default":"secondary"),U[1]&32768&&($s.$$scope={dirty:U,ctx:D}),h.$set($s);const Ns={};U[0]&2&&(Ns.variant=D[1].isActive("heading",{level:1})?"default":"secondary"),U[1]&32768&&(Ns.$$scope={dirty:U,ctx:D}),m.$set(Ns);const N={};U[0]&2&&(N.variant=D[1].isActive("heading",{level:2})?"default":"secondary"),U[1]&32768&&(N.$$scope={dirty:U,ctx:D}),b.$set(N);const Z={};U[0]&2&&(Z.variant=D[1].isActive("heading",{level:3})?"default":"secondary"),U[1]&32768&&(Z.$$scope={dirty:U,ctx:D}),E.$set(Z);const he={};U[0]&2&&(he.variant=D[1].isActive({textAlign:"left"})?"default":"secondary"),U[1]&32768&&(he.$$scope={dirty:U,ctx:D}),H.$set(he);const Pe={};U[0]&2&&(Pe.variant=D[1].isActive({textAlign:"center"})?"default":"secondary"),U[1]&32768&&(Pe.$$scope={dirty:U,ctx:D}),B.$set(Pe);const $e={};U[0]&2&&($e.variant=D[1].isActive({textAlign:"right"})?"default":"secondary"),U[1]&32768&&($e.$$scope={dirty:U,ctx:D}),M.$set($e);const ct={};U[0]&2&&(ct.variant=D[1].isActive("bulletList")?"default":"secondary"),U[1]&32768&&(ct.$$scope={dirty:U,ctx:D}),$.$set(ct);const xt={};U[0]&2&&(xt.variant=D[1].isActive("orderedList")?"default":"secondary"),U[1]&32768&&(xt.$$scope={dirty:U,ctx:D}),w.$set(xt);const Rn={};U[0]&2&&(Rn.variant=D[1].isActive("codeBlock")?"default":"secondary"),U[1]&32768&&(Rn.$$scope={dirty:U,ctx:D}),L.$set(Rn);const Ri={};U[0]&2&&(Ri.variant=D[1].isActive("blockquote")?"default":"secondary"),U[1]&32768&&(Ri.$$scope={dirty:U,ctx:D}),z.$set(Ri);const Pn={};U[1]&32768&&(Pn.$$scope={dirty:U,ctx:D}),Y.$set(Pn);const Jr={};U[0]&2&&(Jr.variant=D[1].isActive("link")?"default":"secondary"),U[1]&32768&&(Jr.$$scope={dirty:U,ctx:D}),ge.$set(Jr);const mr={};U[0]&2&&(mr.disabled=!D[1].isActive("link")),U[1]&32768&&(mr.$$scope={dirty:U,ctx:D}),me.$set(mr);const er={};U[1]&32768&&(er.$$scope={dirty:U,ctx:D}),Fe.$set(er);const Ds={};U[0]&2&&(Ds.disabled=!D[1].can().chain().focus().undo().run()),U[1]&32768&&(Ds.$$scope={dirty:U,ctx:D}),Xe.$set(Ds);const Gr={};U[0]&2&&(Gr.disabled=!D[1].can().chain().focus().redo().run()),U[1]&32768&&(Gr.$$scope={dirty:U,ctx:D}),ft.$set(Gr);const Yr={};U[1]&32768&&(Yr.$$scope={dirty:U,ctx:D}),dt.$set(Yr);const jd={};U[1]&32768&&(jd.$$scope={dirty:U,ctx:D}),Le.$set(jd);const Wd={};U[0]&96|U[1]&32768&&(Wd.$$scope={dirty:U,ctx:D}),ht.$set(Wd);const vc={};U[0]&16&&(vc.disabled=!D[4]),U[1]&32768&&(vc.$$scope={dirty:U,ctx:D}),Ut.$set(vc);const qd={};U[1]&32768&&(qd.$$scope={dirty:U,ctx:D}),pt.$set(qd)},i(D){In||(k(r.$$.fragment,D),k(s.$$.fragment,D),k(l.$$.fragment,D),k(c.$$.fragment,D),k(f.$$.fragment,D),k(h.$$.fragment,D),k(m.$$.fragment,D),k(b.$$.fragment,D),k(E.$$.fragment,D),k(H.$$.fragment,D),k(B.$$.fragment,D),k(M.$$.fragment,D),k($.$$.fragment,D),k(w.$$.fragment,D),k(L.$$.fragment,D),k(z.$$.fragment,D),k(Y.$$.fragment,D),k(ge.$$.fragment,D),k(me.$$.fragment,D),k(Fe.$$.fragment,D),k(Xe.$$.fragment,D),k(ft.$$.fragment,D),k(dt.$$.fragment,D),k(Le.$$.fragment,D),k(ht.$$.fragment,D),k(Ut.$$.fragment,D),k(pt.$$.fragment,D),In=!0)},o(D){S(r.$$.fragment,D),S(s.$$.fragment,D),S(l.$$.fragment,D),S(c.$$.fragment,D),S(f.$$.fragment,D),S(h.$$.fragment,D),S(m.$$.fragment,D),S(b.$$.fragment,D),S(E.$$.fragment,D),S(H.$$.fragment,D),S(B.$$.fragment,D),S(M.$$.fragment,D),S($.$$.fragment,D),S(w.$$.fragment,D),S(L.$$.fragment,D),S(z.$$.fragment,D),S(Y.$$.fragment,D),S(ge.$$.fragment,D),S(me.$$.fragment,D),S(Fe.$$.fragment,D),S(Xe.$$.fragment,D),S(ft.$$.fragment,D),S(dt.$$.fragment,D),S(Le.$$.fragment,D),S(ht.$$.fragment,D),S(Ut.$$.fragment,D),S(pt.$$.fragment,D),In=!1},d(D){D&&j(e),P(r),P(s),P(l),P(c),P(f),P(h),P(m),P(b),P(E),P(H),P(B),P(M),P($),P(w),P(L),P(z),P(Y),P(ge),P(me),P(Fe),P(Xe),P(ft),P(dt),P(Le),P(ht),P(Ut),P(pt),bn=!1,Nt(pr)}}}function dP(n){let e,t;return e=new QE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function hP(n){let e,t;return e=new yy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function pP(n){let e,t;return e=new wy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function mP(n){let e,t;return e=new ky({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function gP(n){let e,t;return e=new vy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function bP(n){let e,t;return e=new QM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function yP(n){let e,t;return e=new bM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function vP(n){let e,t;return e=new kM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function wP(n){let e,t;return e=new AM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function kP(n){let e,t;return e=new VE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function SP(n){let e,t;return e=new LE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function CP(n){let e,t;return e=new WE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function _P(n){let e,t;return e=new JM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function AP(n){let e,t;return e=new jM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function TP(n){let e,t;return e=new nM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function EP(n){let e,t;return e=new A2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function MP(n){let e,t;return e=new p2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function OP(n){let e,t;return e=new zM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function $P(n){let e,t;return e=new PM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function NP(n){let e,t;return e=new OM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function DP(n){let e,t;return e=new O2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function xP(n){let e,t;return e=new n2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function IP(n){let e,t;return e=new cM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function RP(n){let e,t;return e=new hM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function PP(n){let e,t;return e=new u2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function LP(n){let e,t;return e=new Be({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[PP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p(r,i){const s={};i[1]&32768&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function BP(n){let e;return{c(){e=Po("Share")},l(t){e=Lo(t,"Share")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function FP(n){let e;return{c(){e=Po("Please input relay server endpoint and workspace name")},l(t){e=Lo(t,"Please input relay server endpoint and workspace name")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function zP(n){let e,t,r,i;return e=new I3({props:{$$slots:{default:[BP]},$$scope:{ctx:n}}}),r=new iP({props:{$$slots:{default:[FP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=ve(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=we(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),ne(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&32768&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[1]&32768&&(a.$$scope={dirty:o,ctx:s}),r.$set(a)},i(s){i||(k(e.$$.fragment,s),k(r.$$.fragment,s),i=!0)},o(s){S(e.$$.fragment,s),S(r.$$.fragment,s),i=!1},d(s){s&&j(t),P(e,s),P(r,s)}}}function VP(n){let e;return{c(){e=Po("Endpoint")},l(t){e=Lo(t,"Endpoint")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function HP(n){let e;return{c(){e=Po("Workspace")},l(t){e=Lo(t,"Workspace")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function UP(n){let e;return{c(){e=Po("Connect")},l(t){e=Lo(t,"Connect")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function jP(n){let e,t;return e=new Be({props:{class:"w-full",variant:"outline",$$slots:{default:[UP]},$$scope:{ctx:n}}}),e.$on("click",n[37]),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p(r,i){const s={};i[1]&32768&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function WP(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;e=new j3({props:{$$slots:{default:[zP]},$$scope:{ctx:n}}}),s=new fg({props:{for:"endpoint",class:"text-left",$$slots:{default:[VP]},$$scope:{ctx:n}}});function C(_){n[33](_)}let E={id:"endpoint",placeholder:"ws://localhost:1234",class:"col-span-3"};n[5]!==void 0&&(E.value=n[5]),l=new dg({props:E}),nt.push(()=>Gd(l,"value",C)),l.$on("keydown",n[34]),f=new fg({props:{for:"workspace",class:"text-left",$$slots:{default:[HP]},$$scope:{ctx:n}}});function v(_){n[35](_)}let H={id:"workspace",placeholder:"workspace",class:"col-span-3"};return n[6]!==void 0&&(H.value=n[6]),h=new dg({props:H}),nt.push(()=>Gd(h,"value",v)),h.$on("keydown",n[36]),g=new V3({props:{$$slots:{default:[jP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=ve(),r=ze("div"),i=ze("div"),x(s.$$.fragment),o=ve(),x(l.$$.fragment),c=ve(),u=ze("div"),x(f.$$.fragment),d=ve(),x(h.$$.fragment),m=ve(),x(g.$$.fragment),this.h()},l(_){I(e.$$.fragment,_),t=we(_),r=Ve(_,"DIV",{class:!0});var B=He(r);i=Ve(B,"DIV",{class:!0});var F=He(i);I(s.$$.fragment,F),o=we(F),I(l.$$.fragment,F),F.forEach(j),c=we(B),u=Ve(B,"DIV",{class:!0});var M=He(u);I(f.$$.fragment,M),d=we(M),I(h.$$.fragment,M),M.forEach(j),B.forEach(j),m=we(_),I(g.$$.fragment,_),this.h()},h(){Ir(i,"class","grid grid-cols-4 items-center gap-4"),Ir(u,"class","grid grid-cols-4 items-center gap-4"),Ir(r,"class","grid gap-4 py-4")},m(_,B){R(e,_,B),ne(_,t,B),ne(_,r,B),Ie(r,i),R(s,i,null),Ie(i,o),R(l,i,null),Ie(r,c),Ie(r,u),R(f,u,null),Ie(u,d),R(h,u,null),ne(_,m,B),R(g,_,B),b=!0},p(_,B){const F={};B[1]&32768&&(F.$$scope={dirty:B,ctx:_}),e.$set(F);const M={};B[1]&32768&&(M.$$scope={dirty:B,ctx:_}),s.$set(M);const X={};!a&&B[0]&32&&(a=!0,X.value=_[5],Jd(()=>a=!1)),l.$set(X);const $={};B[1]&32768&&($.$$scope={dirty:B,ctx:_}),f.$set($);const y={};!p&&B[0]&64&&(p=!0,y.value=_[6],Jd(()=>p=!1)),h.$set(y);const w={};B[0]&96|B[1]&32768&&(w.$$scope={dirty:B,ctx:_}),g.$set(w)},i(_){b||(k(e.$$.fragment,_),k(s.$$.fragment,_),k(l.$$.fragment,_),k(f.$$.fragment,_),k(h.$$.fragment,_),k(g.$$.fragment,_),b=!0)},o(_){S(e.$$.fragment,_),S(s.$$.fragment,_),S(l.$$.fragment,_),S(f.$$.fragment,_),S(h.$$.fragment,_),S(g.$$.fragment,_),b=!1},d(_){_&&(j(t),j(r),j(m)),P(e,_),P(s),P(l),P(f),P(h),P(g,_)}}}function qP(n){let e,t,r,i;return e=new oP({props:{$$slots:{default:[LP]},$$scope:{ctx:n}}}),r=new eP({props:{class:"sm:max-w-[425px]",$$slots:{default:[WP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=ve(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=we(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),ne(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&32768&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[0]&96|o[1]&32768&&(a.$$scope={dirty:o,ctx:s}),r.$set(a)},i(s){i||(k(e.$$.fragment,s),k(r.$$.fragment,s),i=!0)},o(s){S(e.$$.fragment,s),S(r.$$.fragment,s),i=!1},d(s){s&&j(t),P(e,s),P(r,s)}}}function KP(n){let e,t;return e=new o2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function JP(n){let e,t;return e=new k2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function pg(n){let e,t,r,i,s,o,l,a;return e=new Be({props:{variant:n[1].isActive("bold")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[GP]},$$scope:{ctx:n}}}),e.$on("click",n[39]),r=new Be({props:{variant:n[1].isActive("italic")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[YP]},$$scope:{ctx:n}}}),r.$on("click",n[40]),s=new Be({props:{variant:n[1].isActive("strike")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[XP]},$$scope:{ctx:n}}}),s.$on("click",n[41]),l=new Be({props:{variant:n[1].isActive("code")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[QP]},$$scope:{ctx:n}}}),l.$on("click",n[42]),{c(){x(e.$$.fragment),t=ve(),x(r.$$.fragment),i=ve(),x(s.$$.fragment),o=ve(),x(l.$$.fragment)},l(c){I(e.$$.fragment,c),t=we(c),I(r.$$.fragment,c),i=we(c),I(s.$$.fragment,c),o=we(c),I(l.$$.fragment,c)},m(c,u){R(e,c,u),ne(c,t,u),R(r,c,u),ne(c,i,u),R(s,c,u),ne(c,o,u),R(l,c,u),a=!0},p(c,u){const f={};u[0]&2&&(f.variant=c[1].isActive("bold")?"default":"secondary"),u[1]&32768&&(f.$$scope={dirty:u,ctx:c}),e.$set(f);const d={};u[0]&2&&(d.variant=c[1].isActive("italic")?"default":"secondary"),u[1]&32768&&(d.$$scope={dirty:u,ctx:c}),r.$set(d);const h={};u[0]&2&&(h.variant=c[1].isActive("strike")?"default":"secondary"),u[1]&32768&&(h.$$scope={dirty:u,ctx:c}),s.$set(h);const p={};u[0]&2&&(p.variant=c[1].isActive("code")?"default":"secondary"),u[1]&32768&&(p.$$scope={dirty:u,ctx:c}),l.$set(p)},i(c){a||(k(e.$$.fragment,c),k(r.$$.fragment,c),k(s.$$.fragment,c),k(l.$$.fragment,c),a=!0)},o(c){S(e.$$.fragment,c),S(r.$$.fragment,c),S(s.$$.fragment,c),S(l.$$.fragment,c),a=!1},d(c){c&&(j(t),j(i),j(o)),P(e,c),P(r,c),P(s,c),P(l,c)}}}function GP(n){let e,t;return e=new yy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function YP(n){let e,t;return e=new wy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function XP(n){let e,t;return e=new ky({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function QP(n){let e,t;return e=new vy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function ZP(n){let e,t,r,i,s,o=n[1]&&hg(n),l=n[1]&&pg(n);return{c(){o&&o.c(),e=ve(),t=ze("div"),l&&l.c(),r=ve(),i=ze("div"),this.h()},l(a){o&&o.l(a),e=we(a),t=Ve(a,"DIV",{class:!0});var c=He(t);l&&l.l(c),c.forEach(j),r=we(a),i=Ve(a,"DIV",{}),He(i).forEach(j),this.h()},h(){Ir(t,"class","bubble-menu rounded-md")},m(a,c){o&&o.m(a,c),ne(a,e,c),ne(a,t,c),l&&l.m(t,null),n[43](t),ne(a,r,c),ne(a,i,c),n[44](i),s=!0},p(a,c){a[1]?o?(o.p(a,c),c[0]&2&&k(o,1)):(o=hg(a),o.c(),k(o,1),o.m(e.parentNode,e)):o&&(Tn(),S(o,1,1,()=>{o=null}),En()),a[1]?l?(l.p(a,c),c[0]&2&&k(l,1)):(l=pg(a),l.c(),k(l,1),l.m(t,null)):l&&(Tn(),S(l,1,1,()=>{l=null}),En())},i(a){s||(k(o),k(l),s=!0)},o(a){S(o),S(l),s=!1},d(a){a&&(j(e),j(t),j(r),j(i)),o&&o.d(a),l&&l.d(),n[43](null),n[44](null)}}}function eL(n,e,t){let r,i,s,o,l="",a,c,u;R1(async()=>{const Ee=localStorage.getItem("sharing");let on;if(Ee)try{const{endpoint:Le,workspace:at}=JSON.parse(Ee);if(!Le)throw new Error("Invalid endpoint",{cause:"InvalidMetadata"});if(!at)throw new Error("Invalid workspace",{cause:"InvalidMetadata"});t(5,c=Le),t(6,u=at);const ht=new v1({url:Le,maxAttempts:1});t(4,a=new l3({websocketProvider:ht,name:at,onConnect(){window.alert(`Connected to ${Le}/${at}`)},onClose(){window.alert(`Failed to connect with ${Le}/${at}`),localStorage.removeItem("sharing"),location.reload()},connect:!1})),await a.connect(),on=$3(a,s)}catch(Le){Le instanceof Error&&Le.cause==="InvalidMetadata"?window.alert(`Failed to start sharing with ${Ee}: ${Le.toString()}`):window.alert(`Failed to start sharing with ${Ee}`),console.error(Le),localStorage.removeItem("sharing"),location.reload()}else{try{const Le=localStorage.getItem("shared");if(Le){const{endpoint:at,workspace:ht}=JSON.parse(Le);t(5,c=at),t(6,u=ht)}else t(5,c=""),t(6,u="")}catch(Le){t(5,c=""),t(6,u=""),console.error(Le)}on=VN(s),l=localStorage.getItem("auto-saved")??I2}t(1,i=new RC({element:r,editorProps:{attributes:{class:"mt-16 md:w-[708px] md:py-8 md:px-0 md:mx-auto p-4 outline-none"}},extensions:on,onUpdate({editor:Le}){try{localStorage.setItem("auto-saved",Le.getHTML())}catch(at){console.error(at)}},content:l,onTransaction:()=>{t(1,i)}})),i.commands.focus()});const f=()=>F2(i),d=()=>i.chain().focus().toggleBold().run(),h=()=>i.chain().focus().toggleItalic().run(),p=()=>i.chain().focus().toggleStrike().run(),m=()=>i.chain().focus().toggleCode().run(),g=()=>i.chain().focus().setParagraph().run(),b=()=>i.chain().focus().toggleHeading({level:1}).run(),C=()=>i.chain().focus().toggleHeading({level:2}).run(),E=()=>i.chain().focus().toggleHeading({level:3}).run(),v=()=>i.chain().focus().setTextAlign("left").run(),H=()=>i.chain().focus().setTextAlign("center").run(),_=()=>i.chain().focus().setTextAlign("right").run(),B=()=>i.chain().focus().toggleBulletList().run(),F=()=>i.chain().focus().toggleOrderedList().run(),M=()=>i.chain().focus().toggleCodeBlock().run(),X=()=>i.chain().focus().toggleBlockquote().run(),$=()=>i.chain().focus().setHorizontalRule().run(),y=()=>B2(i),w=()=>i.chain().focus().unsetLink().run(),O=()=>z2(i),L=()=>i.chain().focus().undo().run(),A=()=>i.chain().focus().redo().run(),z=()=>P2(i);function q(){o=this.files,t(3,o)}const Y=()=>L2(i,o),te=()=>{var Ee;return(Ee=document.getElementById("selectedFile"))==null?void 0:Ee.click()};function ge(Ee){c=Ee,t(5,c)}const ye=Ee=>{Ee.code==="Enter"&&(Ee.preventDefault(),Gc(c,u))};function me(Ee){u=Ee,t(6,u)}const Ke=Ee=>{Ee.code==="Enter"&&(Ee.preventDefault(),Gc(c,u))},Fe=()=>Gc(c,u),Qe=()=>V2(a),Xe=()=>i.chain().focus().toggleBold().run(),W=()=>i.chain().focus().toggleItalic().run(),ft=()=>i.chain().focus().toggleStrike().run(),Ht=()=>i.chain().focus().toggleCode().run();function dt(Ee){nt[Ee?"unshift":"push"](()=>{s=Ee,t(2,s)})}function xn(Ee){nt[Ee?"unshift":"push"](()=>{r=Ee,t(0,r)})}return[r,i,s,o,a,c,u,f,d,h,p,m,g,b,C,E,v,H,_,B,F,M,X,$,y,w,O,L,A,z,q,Y,te,ge,ye,me,Ke,Fe,Qe,Xe,W,ft,Ht,dt,xn]}class tL extends fe{constructor(e){super(),de(this,e,eL,ZP,ce,{},null,[-1,-1])}}function nL(n){let e,t,r;return t=new tL({}),{c(){e=ze("main"),x(t.$$.fragment)},l(i){e=Ve(i,"MAIN",{});var s=He(e);I(t.$$.fragment,s),s.forEach(j)},m(i,s){ne(i,e,s),R(t,e,null),r=!0},p:Oe,i(i){r||(k(t.$$.fragment,i),r=!0)},o(i){S(t.$$.fragment,i),r=!1},d(i){i&&j(e),P(t)}}}class CL extends fe{constructor(e){super(),de(this,e,null,nL,ce,{})}}export{CL as component}; +`)),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),nN=$t.create({name:"doc",topNode:!0,content:"block+"});function rN(n={}){return new ut({view(e){return new iN(e,n)}})}class iN{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let u=c.getBoundingClientRect(),f=l?u.bottom:u.top;l&&a&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let l=i.getBoundingClientRect();s=l.left-i.scrollLeft,o=l.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Fg(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const sN=Ot.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[rN(this.options)]}});class tt extends Ae{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return tt.valid(r)?new tt(r):Ae.near(r)}content(){return G.empty}eq(e){return e instanceof tt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new tt(e.resolve(t.pos))}getBookmark(){return new bd(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!oN(e)||!lN(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&tt.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(tt.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ue.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(tt.valid(l))return l}return null}}}tt.prototype.visible=!1;tt.findFrom=tt.findGapCursorFrom;Ae.jsonID("gapcursor",tt);class bd{constructor(e){this.pos=e}map(e){return new bd(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return tt.valid(t)?new tt(t):Ae.near(t)}}function oN(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function lN(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function aN(){return new ut({props:{decorations:dN,createSelectionBetween(n,e,t){return e.pos==t.pos&&tt.valid(t)?new tt(t):null},handleClick:uN,handleKeyDown:cN,handleDOMEvents:{beforeinput:fN}}})}const cN=Tb({ArrowLeft:al("horiz",-1),ArrowRight:al("horiz",1),ArrowUp:al("vert",-1),ArrowDown:al("vert",1)});function al(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof be){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=tt.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new tt(c))),!0):!1}}function uN(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!tt.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&ue.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new tt(r))),!0)}function fN(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof tt))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=V.empty;for(let o=r.length-1;o>=0;o--)i=V.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new G(i,0,0));return s.setSelection(be.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function dN(n){if(!(n.selection instanceof tt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ot.create(n.doc,[nn.widget(n.selection.head,e,{key:"gapcursor"})])}const hN=Ot.create({name:"gapCursor",addProseMirrorPlugins(){return[aN()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=_e(ee(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),pN=$t.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",nt(this.options.HTMLAttributes,n)]},renderText(){return` +`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const f=a.filter(d=>l.includes(d.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),mN=$t.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,nt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Bu({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Ma=200,kt=function(){};kt.prototype.append=function(e){return e.length?(e=kt.from(e),!this.length&&e||e.length=t?kt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};kt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};kt.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};kt.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};kt.from=function(e){return e instanceof kt?e:e&&e.length?new Gy(e):kt.empty};var Gy=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ma)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ma)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(kt);kt.empty=new Gy([]);var gN=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(kt);const bN=500;class kn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),s=i.maps.length),s--,u.push(f);return}if(i){u.push(new wr(f.map));let h=f.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new wr(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(s)):f.selection,a=new kn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;uvN&&(l=yN(l,c),o-=c),new kn(l.append(s),o)}remapping(e,t){let r=new qi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new kn(this.items.append(e.map(t=>new wr(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(d=>{d.selection&&l--},i);let a=t;this.items.forEach(d=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(d.step){let m=e.steps[h].invert(e.docs[h]),g=d.selection&&d.selection.map(s.slice(a+1,h));g&&l++,r.push(new wr(p,m,g))}else r.push(new wr(p))},i);let c=[];for(let d=t;dbN&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let f=new wr(c.invert(),a,u),d,h=i.length-1;(d=i.length&&i[h].merge(f))?i[h]=d:i.push(f)}}else o.map&&r--},this.items.length,0),new kn(kt.from(i.reverse()),s)}}kn.empty=new kn(kt.empty,0);function yN(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}let wr=class Yy{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Yy(t.getMap().invert(),t,this.selection)}}};class Tr{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const vN=20;function wN(n,e,t,r){let i=t.getMeta(pi),s;if(i)return i.historyState;t.getMeta(CN)&&(n=new Tr(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(pi))return o.getMeta(pi).redo?new Tr(n.done.addTransform(t,void 0,r,wl(e)),n.undone,wm(t.mapping.maps[t.steps.length-1]),n.prevTime,n.prevComposition):new Tr(n.done,n.undone.addTransform(t,void 0,r,wl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!kN(t,n.prevRanges)),c=o?iu(n.prevRanges,t.mapping):wm(t.mapping.maps[t.steps.length-1]);return new Tr(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,wl(e)),kn.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Tr(n.done.rebased(t,s),n.undone.rebased(t,s),iu(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Tr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),iu(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function kN(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s=e[s]&&(t=!0)}),t}function wm(n){let e=[];return n.forEach((t,r,i,s)=>e.push(i,s)),e}function iu(n,e){if(!n)return null;let t=[];for(let r=0;r{let i=pi.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=SN(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Qy=Xy(!1,!0),Zy=Xy(!0,!0),AN=Ot.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Qy(n,e),redo:()=>({state:n,dispatch:e})=>Zy(n,e)}},addProseMirrorPlugins(){return[_N(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()}}}),TN=$t.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",nt(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{$to:t}=e.selection,r=n();return t.parentOffset===0?r.insertContentAt(Math.max(t.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:l}=i.selection,a=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(be.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(ue.create(i.doc,l.pos)):i.setSelection(be.create(i.doc,l.pos));else{const c=(o=l.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();c&&(i.insert(a,c),i.setSelection(be.create(i.doc,a+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Vb({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),EN=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,MN=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,ON=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,$N=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,NN=$n.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[as({find:EN,type:this.type}),as({find:ON,type:this.type})]},addPasteRules(){return[wi({find:MN,type:this.type}),wi({find:$N,type:this.type})]}}),DN=$t.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",nt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),xN=$t.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",nt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Sm=$n.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=rc(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Cm=/^(\d+)\.\s$/,IN=$t.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",nt(this.options.HTMLAttributes,t),0]:["ol",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(xN.name,this.editor.getAttributes(Sm.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=go({find:Cm,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=go({find:Cm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sm.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),RN=$t.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),PN=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,LN=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,BN=$n.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return Jf()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[as({find:PN,type:this.type})]},addPasteRules(){return[wi({find:LN,type:this.type})]}}),FN=$t.create({name:"text",group:"inline"}),e0=Ot.create({name:"starterKit",addExtensions(){var n,e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;const C=[];return this.options.blockquote!==!1&&C.push(H$.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&C.push(K$.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&C.push(G$.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&C.push(Q$.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&C.push(tN.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&C.push(nN.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&C.push(sN.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&C.push(hN.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&C.push(pN.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&C.push(mN.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&C.push(AN.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&C.push(TN.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&C.push(NN.configure((d=this.options)===null||d===void 0?void 0:d.italic)),this.options.listItem!==!1&&C.push(DN.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&C.push(IN.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&C.push(RN.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&C.push(BN.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&C.push(FN.configure((b=this.options)===null||b===void 0?void 0:b.text)),C}}),zN=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,t0=$t.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},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}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",nt(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Vb({find:zN,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});function VN(n){return[e0,zy.configure({element:n}),qy.configure({openOnClick:!1,autolink:!0}),t0.configure({inline:!0}),Jy.configure({types:["heading","paragraph"]}),Ky]}const HN=Math.floor,UN=(n,e)=>nn>e?n:e,n0=128,kl=127,WN=Number.MAX_SAFE_INTEGER,qN=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iSo.encode(n),JN=So?KN:qN;let ro=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ro&&ro.decode(new Uint8Array).length===1&&(ro=null);const Oa=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},lc=(n,e)=>{for(;e>kl;)Oa(n,n0|kl&e),e=HN(e/128);Oa(n,kl&e)},sf=new Uint8Array(3e4),GN=sf.length/3,YN=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;lc(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=UN(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(jN(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},eD=(n,e)=>{lc(n,e.byteLength),ZN(n,e)},r0=n=>new Error(n),tD=r0("Unexpected end of array"),nD=r0("Integer out of Range"),rD=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},iD=n=>rD(n,yd(n)),_m=n=>n.arr[n.pos++],yd=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posWN)throw nD}throw tD},sD=n=>{let e=yd(n);if(e===0)return"";{let t=String.fromCodePoint(_m(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(_m(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},oD=n=>ro.decode(iD(n)),Am=ro?oD:sD;var Co;(function(n){n[n.Token=0]="Token",n[n.PermissionDenied=1]="PermissionDenied",n[n.Authenticated=2]="Authenticated"})(Co||(Co={}));const lD=(n,e)=>{lc(n,Co.Token),QN(n,e)},aD=(n,e,t)=>{switch(yd(n)){case Co.PermissionDenied:{e(Am(n));break}case Co.Authenticated:{t(Am(n));break}}},cD={code:1009,reason:"Message Too Big"},Tm={code:4401,reason:"Unauthorized"},uD={code:4403,reason:"Forbidden"},Em=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t}));var of;(function(n){n[n.Connecting=0]="Connecting",n[n.Open=1]="Open",n[n.Closing=2]="Closing",n[n.Closed=3]="Closed"})(of||(of={}));const _n=()=>new Map,lf=n=>{const e=_n();return n.forEach((t,r)=>{e.set(r,t)}),e},Kr=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},fD=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},dD=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},Ci=()=>new Set,ou=n=>n[n.length-1],hD=(n,e)=>{for(let t=0;t{for(let t=0;t{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return zr((this._observers.get(e)||_n()).values()).forEach(r=>r(...t))}destroy(){this._observers=_n()}}const dr=Math.floor,Sl=Math.abs,ac=(n,e)=>nn>e?n:e,s0=n=>n!==0?n<0:1/n<0,Mm=1,Om=2,lu=4,au=8,_o=32,cr=64,rn=128,cc=31,cf=63,mi=127,mD=2147483647,o0=Number.MAX_SAFE_INTEGER,gD=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&dr(n)===n),bD=n=>n.toLowerCase(),yD=/^\s*/g,vD=n=>n.replace(yD,""),wD=/([A-Z])/g,$m=(n,e)=>vD(n.replace(wD,t=>`${e}${bD(t)}`)),kD=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iAo.encode(n),CD=Ao?SD:kD;let io=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});io&&io.decode(new Uint8Array).length===1&&(io=null);let jo=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const uc=()=>new jo,_D=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array(_D(n));let t=0;for(let r=0;r{const t=n.cbuf.length;t-n.cpos{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},uf=gt,De=(n,e)=>{for(;e>mi;)gt(n,rn|mi&e),e=dr(e/128);gt(n,mi&e)},vd=(n,e)=>{const t=s0(e);for(t&&(e=-e),gt(n,(e>cf?rn:0)|(t?cr:0)|cf&e),e=dr(e/64);e>0;)gt(n,(e>mi?rn:0)|mi&e),e=dr(e/128)},ff=new Uint8Array(3e4),TD=ff.length/3,ED=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;De(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=ac(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array($i(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},Zt=(n,e)=>{De(n,e.byteLength),fc(n,e)},wd=(n,e)=>{AD(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},OD=(n,e)=>wd(n,4).setFloat32(0,e,!1),$D=(n,e)=>wd(n,8).setFloat64(0,e,!1),ND=(n,e)=>wd(n,8).setBigInt64(0,e,!1),Nm=new DataView(new ArrayBuffer(4)),DD=n=>(Nm.setFloat32(0,n),Nm.getFloat32(0)===n),To=(n,e)=>{switch(typeof e){case"string":gt(n,119),Yi(n,e);break;case"number":gD(e)&&Sl(e)<=mD?(gt(n,125),vd(n,e)):DD(e)?(gt(n,124),OD(n,e)):(gt(n,123),$D(n,e));break;case"bigint":gt(n,122),ND(n,e);break;case"object":if(e===null)gt(n,126);else if(af(e)){gt(n,117),De(n,e.length);for(let t=0;t0&&De(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const xm=n=>{n.count>0&&(vd(n.encoder,n.count===1?n.s:-n.s),n.count>1&&De(n.encoder,n.count-2))};class Cl{constructor(){this.encoder=new jo,this.s=0,this.count=0}write(e){this.s===e?this.count++:(xm(this),this.count=1,this.s=e)}toUint8Array(){return xm(this),Kn(this.encoder)}}const Im=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);vd(n.encoder,e),n.count>1&&De(n.encoder,n.count-2)}};class cu{constructor(){this.encoder=new jo,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Im(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Im(this),Kn(this.encoder)}}class xD{constructor(){this.sarr=[],this.s="",this.lensE=new Cl}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new jo;return this.sarr.push(this.s),this.s="",Yi(e,this.sarr.join("")),fc(e,this.lensE.toUint8Array()),Kn(e)}}const Vr=n=>new Error(n),An=()=>{throw Vr("Method unimplemented")},bn=()=>{throw Vr("Unexpected case")},l0=Vr("Unexpected end of array"),a0=Vr("Integer out of Range");let dc=class{constructor(e){this.arr=e,this.pos=0}};const Cs=n=>new dc(n),ID=n=>n.pos!==n.arr.length,RD=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},en=n=>RD(n,Me(n)),ps=n=>n.arr[n.pos++],Me=n=>{let e=0,t=1;const r=n.arr.length;for(;n.poso0)throw a0}throw l0},kd=n=>{let e=n.arr[n.pos++],t=e&cf,r=64;const i=(e&cr)>0?-1:1;if(!(e&rn))return i*t;const s=n.arr.length;for(;n.poso0)throw a0}throw l0},PD=n=>{let e=Me(n);if(e===0)return"";{let t=String.fromCodePoint(ps(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(ps(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},LD=n=>io.decode(en(n)),Xi=io?LD:PD,Sd=(n,e)=>{const t=new DataView(n.arr.buffer,n.arr.byteOffset+n.pos,e);return n.pos+=e,t},BD=n=>Sd(n,4).getFloat32(0,!1),FD=n=>Sd(n,8).getFloat64(0,!1),zD=n=>Sd(n,8).getBigInt64(0,!1),VD=[n=>{},n=>null,kd,BD,FD,zD,n=>!1,n=>!0,Xi,n=>{const e=Me(n),t={};for(let r=0;r{const e=Me(n),t=[];for(let r=0;rVD[127-ps(n)](n);class Rm extends dc{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),ID(this)?this.count=Me(this)+1:this.count=-1),this.count--,this.s}}class _l extends dc{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=kd(this);const e=s0(this.s);this.count=1,e&&(this.s=-this.s,this.count=Me(this)+2)}return this.count--,this.s}}class uu extends dc{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=kd(this),t=e&1;this.diff=dr(e/2),this.count=1,t&&(this.count=Me(this)+2)}return this.s+=this.diff,this.count--,this.s}}class HD{constructor(e){this.decoder=new _l(e),this.str=Xi(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const UD=crypto.getRandomValues.bind(crypto),jD=Math.random,c0=()=>UD(new Uint32Array(1))[0],WD=n=>n[dr(jD()*n.length)],qD="10000000-1000-4000-8000"+-1e11,KD=()=>qD.replace(/[018]/g,n=>(n^c0()&15>>n/4).toString(16)),JD=Date.now,Pm=n=>new Promise(n);Promise.all.bind(Promise);const Lm=n=>n===void 0?null:n;let GD=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},u0=new GD,YD=!0;try{typeof localStorage<"u"&&localStorage&&(u0=localStorage,YD=!1)}catch{}const XD=u0,QD=Object.assign,f0=Object.keys,ZD=(n,e)=>{for(const t in n)e(n[t],t)},Bm=n=>f0(n).length,ex=n=>{for(const e in n)return!1;return!0},tx=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},nx=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),rx=(n,e)=>n===e||Bm(n)===Bm(e)&&tx(n,(t,r)=>(t!==void 0||nx(e,r))&&e[r]===t),Cd=(n,e,t=0)=>{try{for(;tn,sx=(n,e)=>e.includes(n);var d0={};const ms=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",ox=typeof window<"u"&&typeof document<"u"&&!ms;let Bn;const lx=()=>{if(Bn===void 0)if(ms){Bn=_n();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");Bn.set(`--${$m(e,"-")}`,t),Bn.set(`-${$m(e,"-")}`,t)}})):Bn=_n();return Bn},df=n=>lx().has(n),hf=n=>Lm(ms?d0[n.toUpperCase().replaceAll("-","_")]:XD.getItem(n)),ax=n=>df("--"+n)||hf(n)!==null;ax("production");const Fm=ms&&sx(d0.FORCE_COLOR,["true","1","2"]),cx=!df("no-colors")&&(!ms||process.stdout.isTTY||Fm)&&(!ms||df("color")||Fm||hf("COLORTERM")!==null||(hf("TERM")||"").includes("color")),ux=n=>new Uint8Array(n),fx=n=>{const e=ux(n.byteLength);return e.set(n),e};class dx{constructor(e,t){this.left=e,this.right=t}}const ir=(n,e)=>new dx(n,e),hx=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const px=n=>fD(n,(e,t)=>`${t}:${e};`).join(""),mx=n=>class{constructor(t){this._=t}destroy(){n(this._)}},gx=mx(clearTimeout),pf=(n,e)=>new gx(setTimeout(e,n)),hr=Symbol,h0=hr(),p0=hr(),bx=hr(),yx=hr(),vx=hr(),m0=hr(),wx=hr(),_d=hr(),kx=hr(),Sx=n=>{var r;n.length===1&&((r=n[0])==null?void 0:r.constructor)===Function&&(n=n[0]());const e=[];let t=0;for(;t{var o;n.length===1&&((o=n[0])==null?void 0:o.constructor)===Function&&(n=n[0]());const e=[],t=[],r=_n();let i=[],s=0;for(;s0||c.length>0?(e.push("%c"+l),t.push(c)):e.push(l)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s{console.log(...g0(n)),b0.forEach(e=>e.print(n))},Tx=(...n)=>{console.warn(...g0(n)),n.unshift(_d),b0.forEach(e=>e.print(n))},b0=Ci(),y0=n=>({[Symbol.iterator](){return this},next:n}),Ex=(n,e)=>y0(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),fu=(n,e)=>y0(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Ad{constructor(e,t){this.clock=e,this.len=t}}class _s{constructor(){this.clients=new Map}}const Hr=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);for(let o=0;o{let t=0,r=n.length-1;for(;t<=r;){const i=dr((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e{const t=n.clients.get(e.client);return t!==void 0&&Mx(t,e.clock)!==null},Td=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t=s.clock?i.len=$i(i.len,s.clock+s.len-i.clock):(r{const e=new _s;for(let t=0;t{if(!e.clients.has(i)){const s=r.slice();for(let o=t+1;o{Kr(n.clients,e,()=>[]).push(new Ad(t,r))},v0=()=>new _s,w0=n=>{const e=v0();return n.clients.forEach((t,r)=>{const i=[];for(let s=0;s0&&e.clients.set(r,i)}),e},Ts=(n,e)=>{De(n.restEncoder,e.clients.size),zr(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),De(n.restEncoder,t);const i=r.length;De(n.restEncoder,i);for(let s=0;s{const e=new _s,t=Me(n.restDecoder);for(let r=0;r0){const o=Kr(e.clients,i,()=>[]);for(let l=0;l{const r=new _s,i=Me(n.restDecoder);for(let s=0;s0){const s=new _i;return De(s.restEncoder,0),Ts(s,r),s.toUint8Array()}return null},k0=c0;class Es extends i0{constructor({guid:e=KD(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=k0(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new N0,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Pm(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>Pm(c=>{const u=f=>{(f===void 0||f===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Ge(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(zr(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Ge(this,e,t)}get(e,t=Mt){const r=Kr(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==Mt&&i!==t)if(i===Mt){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Zi)}getText(e=""){return this.get(e,Ai)}getMap(e=""){return this.get(e,bs)}getXmlElement(e=""){return this.get(e,Bt)}getXmlFragment(e=""){return this.get(e,Ti)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){zr(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Es({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,Ge(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class S0{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Me(this.restDecoder)}readDsLen(){return Me(this.restDecoder)}}class C0 extends S0{readLeftID(){return Se(Me(this.restDecoder),Me(this.restDecoder))}readRightID(){return Se(Me(this.restDecoder),Me(this.restDecoder))}readClient(){return Me(this.restDecoder)}readInfo(){return ps(this.restDecoder)}readString(){return Xi(this.restDecoder)}readParentInfo(){return Me(this.restDecoder)===1}readTypeRef(){return Me(this.restDecoder)}readLen(){return Me(this.restDecoder)}readAny(){return Eo(this.restDecoder)}readBuf(){return fx(en(this.restDecoder))}readJSON(){return JSON.parse(Xi(this.restDecoder))}readKey(){return Xi(this.restDecoder)}}class Ox{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Me(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Me(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class gs extends Ox{constructor(e){super(e),this.keys=[],Me(e),this.keyClockDecoder=new uu(en(e)),this.clientDecoder=new _l(en(e)),this.leftClockDecoder=new uu(en(e)),this.rightClockDecoder=new uu(en(e)),this.infoDecoder=new Rm(en(e),ps),this.stringDecoder=new HD(en(e)),this.parentInfoDecoder=new Rm(en(e),ps),this.typeRefDecoder=new _l(en(e)),this.lenDecoder=new _l(en(e))}readLeftID(){return new Qi(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Qi(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Eo(this.restDecoder)}readBuf(){return en(this.restDecoder)}readJSON(){return Eo(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e{r=$i(r,e[0].id.clock);const i=Qn(e,r);De(n.restEncoder,e.length-i),n.writeClient(t),De(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o{const r=new Map;t.forEach((i,s)=>{it(e,s)>i&&r.set(s,i)}),qo(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),De(n.restEncoder,r.size),zr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{$x(n,e.clients.get(i),i,s)})},Nx=(n,e)=>{const t=_n(),r=Me(n.restDecoder);for(let i=0;i{const r=[];let i=zr(t.keys()).sort((h,p)=>h-p);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let h=t.get(i[i.length-1]);for(;h.refs.length===h.i;)if(i.pop(),i.length>0)h=t.get(i[i.length-1]);else return null;return h};let o=s();if(o===null)return null;const l=new N0,a=new Map,c=(h,p)=>{const m=a.get(h);(m==null||m>p)&&a.set(h,p)};let u=o.refs[o.i++];const f=new Map,d=()=>{for(const h of r){const p=h.id.client,m=t.get(p);m?(m.i--,l.clients.set(p,m.refs.slice(m.i)),t.delete(p),m.i=0,m.refs=[]):l.clients.set(p,[h]),i=i.filter(g=>g!==p)}r.length=0};for(;;){if(u.constructor!==dn){const p=Kr(f,u.id.client,()=>it(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),d();else{const m=u.getMissing(n,e);if(m!==null){r.push(u);const g=t.get(m)||{refs:[],i:0};if(g.refs.length===g.i)c(m,it(e,m)),d();else{u=g.refs[g.i++];continue}}else(p===0||p0)u=r.pop();else if(o!==null&&o.i0){const h=new _i;return Md(h,l,new Map),De(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},xx=(n,e)=>Md(n,e.doc.store,e.beforeState),Ix=(n,e,t,r=new gs(n))=>Ge(e,i=>{i.local=!1;let s=!1;const o=i.doc,l=o.store,a=Nx(r,o),c=Dx(i,l,a),u=l.pendingStructs;if(u){for(const[d,h]of u.missing)if(hh)&&u.missing.set(d,h)}u.update=Na([u.update,c.update])}}else l.pendingStructs=c;const f=zm(r,i,l);if(l.pendingDs){const d=new gs(Cs(l.pendingDs));Me(d.restDecoder);const h=zm(d,i,l);f&&h?l.pendingDs=Na([f,h]):l.pendingDs=f||h}else l.pendingDs=f;if(s){const d=l.pendingStructs.update;l.pendingStructs=null,T0(i.doc,d)}},t,!1),T0=(n,e,t,r=gs)=>{const i=Cs(e);Ix(i,n,t,new r(i))},Rx=(n,e,t)=>T0(n,e,t,C0),Px=(n,e,t=new Map)=>{Md(n,e.store,t),Ts(n,w0(e.store))},Lx=(n,e=new Uint8Array([0]),t=new _i)=>{const r=E0(e);Px(t,n,r);const i=[t.toUint8Array()];if(n.store.pendingDs&&i.push(n.store.pendingDs),n.store.pendingStructs&&i.push(rI(n.store.pendingStructs.update,e)),i.length>1){if(t.constructor===Wo)return tI(i.map((s,o)=>o===0?s:sI(s)));if(t.constructor===_i)return Na(i)}return i[0]},Bx=(n,e)=>Lx(n,e,new Wo),Fx=n=>{const e=new Map,t=Me(n.restDecoder);for(let r=0;rFx(new S0(Cs(n))),M0=(n,e)=>(De(n.restEncoder,e.size),zr(e.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{De(n.restEncoder,t),De(n.restEncoder,r)}),n),zx=(n,e)=>M0(n,qo(e.store)),Vx=(n,e=new A0)=>(n instanceof Map?M0(e,n):zx(e,n),e.toUint8Array()),Hx=n=>Vx(n,new _0);class Ux{constructor(){this.l=[]}}const Vm=()=>new Ux,Hm=(n,e)=>n.l.push(e),Um=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},O0=(n,e,t)=>Cd(n.l,[e,t]);class Qi{constructor(e,t){this.client=e,this.clock=t}}const cl=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,Se=(n,e)=>new Qi(n,e),Oo=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw bn()},$o=(n,e)=>{for(;e!==null;){if(e.parent===n)return!0;e=e.parent._item}return!1};class $a{constructor(e,t,r,i=0){this.type=e,this.tname=t,this.item=r,this.assoc=i}}class jx{constructor(e,t,r=0){this.type=e,this.index=t,this.assoc=r}}const Wx=(n,e,t=0)=>new jx(n,e,t),ul=(n,e,t)=>{let r=null,i=null;return n._item===null?i=Oo(n):r=Se(n._item.id.client,n._item.id.clock),new $a(r,i,e,t)},du=(n,e,t=0)=>{let r=n._start;if(t<0){if(e===0)return ul(n,null,t);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return ul(n,Se(r.id.client,r.id.clock+e),t);e-=r.length}if(r.right===null&&t<0)return ul(n,r.lastId,t);r=r.right}return ul(n,null,t)},qx=(n,e)=>{const t=e.store,r=n.item,i=n.type,s=n.tname,o=n.assoc;let l=null,a=0;if(r!==null){if(it(t,r.client)<=r.clock)return null;const c=vf(t,r),u=c.item;if(!(u instanceof Ue))return null;if(l=u.parent,l._item===null||!l._item.deleted){a=u.deleted||!u.countable?0:c.diff+(o>=0?0:1);let f=u.left;for(;f!==null;)!f.deleted&&f.countable&&(a+=f.length),f=f.left}}else{if(s!==null)l=e.get(s);else if(i!==null){if(it(t,i.client)<=i.clock)return null;const{item:c}=vf(t,i);if(c instanceof Ue&&c.content instanceof xn)l=c.content.type;else return null}else throw bn();o>=0?a=l._length:a=0}return Wx(l,a,n.assoc)};class Od{constructor(e,t){this.ds=e,this.sv=t}}const $0=(n,e)=>new Od(n,e),Kx=n=>$0(w0(n.store),qo(n.store)),ni=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!As(e.ds,n.id),gf=(n,e)=>{const t=Kr(n.meta,gf,Ci),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i{}),t.add(e))};class N0{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const qo=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},it=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},D0=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw bn()}t.push(e)},Qn=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=dr(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e{const t=n.clients.get(e.client);return t[Qn(t,e.clock)]},Al=Jx,bf=(n,e,t)=>{const r=Qn(e,t),i=e[r];return i.id.clock{const t=n.doc.store.clients.get(e.client);return t[bf(n,t,e.clock)]},jm=(n,e,t)=>{const r=e.clients.get(t.client),i=Qn(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==fn&&r.splice(i+1,0,Pa(n,s,t.clock-s.id.clock+1)),s},Gx=(n,e,t)=>{const r=n.clients.get(e.id.client);r[Qn(r,e.id.clock)]=t},x0=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=bf(n,e,t),l;do l=e[o++],se.deleteSet.clients.size===0&&!dD(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Td(e.deleteSet),xx(n,e),Ts(n,e.deleteSet),!0),qm=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Kr(n.changed,e,Ci).add(t)},Tl=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Ue&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},Xx=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const l=i[o],a=l.clock+l.len;for(let c=Qn(s,l.clock),u=s[c];c{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],l=ac(i.length-1,1+Qn(i,o.clock+o.len-1));for(let a=l,c=i[a];a>0&&c.id.clock>=o.clock;c=i[a])a-=1+Tl(i,a)}})},I0=(n,e)=>{if(el.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(t,a)})),l.push(()=>{t.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,f)=>u.path.length-f.path.length),O0(c._dEH,a,t))})}),l.push(()=>r.emit("afterTransaction",[t,r])),Cd(l,[]),t._needFormattingCleanup&&vI(t)}finally{r.gc&&Xx(s,i,r.gcFilter),Qx(s,i),t.afterState.forEach((u,f)=>{const d=t.beforeState.get(f)||0;if(d!==u){const h=i.clients.get(f),p=$i(Qn(h,d),1);for(let m=h.length-1;m>=p;)m-=1+Tl(h,m)}});for(let u=o.length-1;u>=0;u--){const{client:f,clock:d}=o[u].id,h=i.clients.get(f),p=Qn(h,d);p+11||p>0&&Tl(h,p)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Ax(_d,h0,"[yjs] ",p0,m0,"Changed the client-id because another client seems to be using it."),r.clientID=k0()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new Wo;Wm(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new _i;Wm(u,t)&&r.emit("updateV2",[u.toUint8Array(),t.origin,r,t])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=t;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,t]),c.forEach(u=>u.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):I0(n,e+1)}}},Ge=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new Yx(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const l=n._transaction===i[0];n._transaction=null,l&&I0(i,0)}}return o};class Zx{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}}const Km=(n,e,t)=>{Hr(n,t.deletions,r=>{r instanceof Ue&&e.scope.some(i=>$o(i,r))&&Ld(r,!1)})},Jm=(n,e,t)=>{let r=null;const i=n.doc,s=n.scope;if(Ge(i,o=>{for(;e.length>0&&n.currStackItem===null;){const l=i.store,a=e.pop(),c=new Set,u=[];let f=!1;Hr(o,a.insertions,d=>{if(d instanceof Ue){if(d.redone!==null){let{item:h,diff:p}=vf(l,d.id);p>0&&(h=qt(o,Se(h.id.client,h.id.clock+p))),d=h}!d.deleted&&s.some(h=>$o(h,d))&&u.push(d)}}),Hr(o,a.deletions,d=>{d instanceof Ue&&s.some(h=>$o(h,d))&&!As(a.insertions,d.id)&&c.add(d)}),c.forEach(d=>{f=e1(o,d,c,a.insertions,n.ignoreRemoteMapChanges,n)!==null||f});for(let d=u.length-1;d>=0;d--){const h=u[d];n.deleteFilter(h)&&(h.delete(o),f=!0)}n.currStackItem=f?a:null}o.changed.forEach((l,a)=>{l.has(null)&&a._searchMarker&&(a._searchMarker.length=0)}),r=o},n),n.currStackItem!=null){const o=r.changedParentTypes;n.emit("stack-item-popped",[{stackItem:n.currStackItem,type:t,changedParentTypes:o,origin:n},n]),n.currStackItem=null}return n.currStackItem};class R0 extends i0{constructor(e,{captureTimeout:t=500,captureTransaction:r=a=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=af(e)?e[0].doc:e.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=t,this.afterTransactionHandler=a=>{if(!this.captureTransaction(a)||!this.scope.some(g=>a.changedParentTypes.has(g))||!this.trackedOrigins.has(a.origin)&&(!a.origin||!this.trackedOrigins.has(a.origin.constructor)))return;const c=this.undoing,u=this.redoing,f=c?this.redoStack:this.undoStack;c?this.stopCapturing():u||this.clear(!1,!0);const d=new _s;a.afterState.forEach((g,b)=>{const C=a.beforeState.get(b)||0,E=g-C;E>0&&Mo(d,b,C,E)});const h=JD();let p=!1;if(this.lastChange>0&&h-this.lastChange0&&!c&&!u){const g=f[f.length-1];g.deletions=mf([g.deletions,a.deleteSet]),g.insertions=mf([g.insertions,d])}else f.push(new Zx(a.deleteSet,d)),p=!0;!c&&!u&&(this.lastChange=h),Hr(a,a.deleteSet,g=>{g instanceof Ue&&this.scope.some(b=>$o(b,g))&&Ld(g,!0)});const m=[{stackItem:f[f.length-1],origin:a.origin,type:c?"redo":"undo",changedParentTypes:a.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){e=af(e)?e:[e],e.forEach(t=>{this.scope.every(r=>r!==t)&&(t.doc!==this.doc&&Tx("[yjs#509] Not same Y.Doc"),this.scope.push(t))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>Km(r,this,i)),this.undoStack=[]),t&&(this.redoStack.forEach(i=>Km(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Jm(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Jm(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*eI(n){const e=Me(n.restDecoder);for(let t=0;tNa(n,C0,Wo),nI=(n,e)=>{if(n.constructor===fn){const{client:t,clock:r}=n.id;return new fn(Se(t,r+e),n.length-e)}else if(n.constructor===dn){const{client:t,clock:r}=n.id;return new dn(Se(t,r+e),n.length-e)}else{const t=n,{client:r,clock:i}=t.id;return new Ue(Se(r,i+e),null,Se(r,i+e-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(e))}},Na=(n,e=gs,t=_i)=>{if(n.length===1)return n[0];const r=n.map(u=>new e(Cs(u)));let i=r.map(u=>new $d(u,!0)),s=null;const o=new t,l=new Nd(o);for(;i=i.filter(d=>d.curr!==null),i.sort((d,h)=>{if(d.curr.id.client===h.curr.id.client){const p=d.curr.id.clock-h.curr.id.clock;return p===0?d.curr.constructor===h.curr.constructor?0:d.curr.constructor===dn?1:-1:p}else return h.curr.id.client-d.curr.id.client}),i.length!==0;){const u=i[0],f=u.curr.id.client;if(s!==null){let d=u.curr,h=!1;for(;d!==null&&d.id.clock+d.length<=s.struct.id.clock+s.struct.length&&d.id.client>=s.struct.id.client;)d=u.next(),h=!0;if(d===null||d.id.client!==f||h&&d.id.clock>s.struct.id.clock+s.struct.length)continue;if(f!==s.struct.id.client)Or(l,s.struct,s.offset),s={struct:d,offset:0},u.next();else if(s.struct.id.clock+s.struct.length0&&(s.struct.constructor===dn?s.struct.length-=p:d=nI(d,p)),s.struct.mergeWith(d)||(Or(l,s.struct,s.offset),s={struct:d,offset:0},u.next())}}else s={struct:u.curr,offset:0},u.next();for(let d=u.curr;d!==null&&d.id.client===f&&d.id.clock===s.struct.id.clock+s.struct.length&&d.constructor!==dn;d=u.next())Or(l,s.struct,s.offset),s={struct:d,offset:0}}s!==null&&(Or(l,s.struct,s.offset),s=null),Dd(l);const a=r.map(u=>Ed(u)),c=mf(a);return Ts(o,c),o.toUint8Array()},rI=(n,e,t=gs,r=_i)=>{const i=E0(e),s=new r,o=new Nd(s),l=new t(Cs(n)),a=new $d(l,!1);for(;a.curr;){const u=a.curr,f=u.id.client,d=i.get(f)||0;if(a.curr.constructor===dn){a.next();continue}if(u.id.clock+u.length>d)for(Or(o,u,$i(d-u.id.clock,0)),a.next();a.curr&&a.curr.id.client===f;)Or(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===f&&a.curr.id.clock+a.curr.length<=d;)a.next()}Dd(o);const c=Ed(l);return Ts(s,c),s.toUint8Array()},P0=n=>{n.written>0&&(n.clientStructs.push({written:n.written,restEncoder:Kn(n.encoder.restEncoder)}),n.encoder.restEncoder=uc(),n.written=0)},Or=(n,e,t)=>{n.written>0&&n.currClient!==e.id.client&&P0(n),n.written===0&&(n.currClient=e.id.client,n.encoder.writeClient(e.id.client),De(n.encoder.restEncoder,e.id.clock+t)),e.write(n.encoder,t),n.written++},Dd=n=>{P0(n);const e=n.encoder.restEncoder;De(e,n.clientStructs.length);for(let t=0;t{const i=new t(Cs(n)),s=new $d(i,!1),o=new r,l=new Nd(o);for(let c=s.curr;c!==null;c=s.next())Or(l,e(c),0);Dd(l);const a=Ed(i);return Ts(o,a),o.toUint8Array()},sI=n=>iI(n,ix,gs,Wo),Gm="You must not compute changes after the event-handler fired.";class hc{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=oI(this.currentTarget,this.target))}deletes(e){return As(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Vr(Gm);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,l;if(this.adds(s)){let a=s.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(s))if(a!==null&&this.deletes(a))o="delete",l=ou(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=ou(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=ou(s.content.getContent());else return;e.set(i,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Vr(Gm);const t=this.target,r=Ci(),i=Ci(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let l=null;const a=()=>{l&&s.push(l)};for(let c=t._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,i.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const oI=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)i.deleted||r++,i=i.right;t.unshift(r)}e=e._item.parent}return t},L0=80;let xd=0;class lI{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=xd++}}const aI=n=>{n.timestamp=xd++},B0=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=xd++},cI=(n,e,t)=>{if(n.length>=L0){const r=n.reduce((i,s)=>i.timestamp{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>Sl(e-s.index)e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return t!==null&&Sl(t.index-i){for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e0&&e===i.index)&&(i.index=$i(e,i.index+t))}},mc=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Kr(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;O0(r._eH,t,e)};class Mt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Vm(),this._dEH=Vm(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw An()}clone(){throw An()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Hm(this._eH,e)}observeDeep(e){Hm(this._dEH,e)}unobserve(e){Um(this._eH,e)}unobserveDeep(e){Um(this._dEH,e)}toJSON(){}}const F0=(n,e,t)=>{e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l0;l++)i.push(o[l]),r--;e=0}}s=s.right}return i},z0=n=>{const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i{const t=[];let r=n._start;for(;r!==null;){if(r.countable&&ni(r,e)){const i=r.content.getContent();for(let s=0;s{let t=0,r=n._start;for(;r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s{const t=[];return Do(n,(r,i)=>{t.push(e(r,i,n))}),t},uI=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},U0=(n,e)=>{const t=pc(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e{let i=t;const s=n.doc,o=s.clientID,l=s.store,a=t===null?e._start:t.right;let c=[];const u=()=>{c.length>0&&(i=new Ue(Se(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ei(c)),i.integrate(n,0),c=[])};r.forEach(f=>{if(f===null)c.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(f);break;default:switch(u(),f.constructor){case Uint8Array:case ArrayBuffer:i=new Ue(Se(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ko(new Uint8Array(f))),i.integrate(n,0);break;case Es:i=new Ue(Se(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Jo(f)),i.integrate(n,0);break;default:if(f instanceof Mt)i=new Ue(Se(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new xn(f)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},j0=()=>Vr("Length exceeded!"),W0=(n,e,t,r)=>{if(t>e._length)throw j0();if(t===0)return e._searchMarker&&No(e._searchMarker,t,r.length),Da(n,e,null,r);const i=t,s=pc(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Da(n,e,i,t)},q0=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=pc(e,t);let l=e._start;for(o!==null&&(l=o.p,t-=o.index);l!==null&&t>0;l=l.right)!l.deleted&&l.countable&&(t0&&l!==null;)l.deleted||(r0)throw j0();e._searchMarker&&No(e._searchMarker,i,-s+r)},xa=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Id=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new Ei([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:l=new Ei([r]);break;case Uint8Array:l=new Ko(r);break;case Es:l=new Jo(r);break;default:if(r instanceof Mt)l=new xn(r);else throw new Error("Unexpected content type")}new Ue(Se(o,it(s.store,o)),i,i&&i.lastId,null,null,e,t,l).integrate(n,0)},Rd=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},K0=n=>{const e={};return n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},J0=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted},dI=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&ni(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},fl=n=>Ex(n.entries(),e=>!e[1].deleted);class hI extends hc{constructor(e,t){super(e,t),this._transaction=t}}class Zi extends Mt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Zi;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Zi}clone(){const e=new Zi;return e.insert(0,this.toArray().map(t=>t instanceof Mt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,t){super._callObserver(e,t),mc(this,e,new hI(this,e))}insert(e,t){this.doc!==null?Ge(this.doc,r=>{W0(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?Ge(this.doc,t=>{fI(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?Ge(this.doc,r=>{q0(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return U0(this,e)}toArray(){return z0(this)}slice(e=0,t=this.length){return F0(this,e,t)}toJSON(){return this.map(e=>e instanceof Mt?e.toJSON():e)}map(e){return H0(this,e)}forEach(e){Do(this,e)}[Symbol.iterator](){return uI(this)}_write(e){e.writeTypeRef(LI)}}const pI=n=>new Zi;class mI extends hc{constructor(e,t,r){super(e,t),this.keysChanged=r}}class bs extends Mt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new bs}clone(){const e=new bs;return this.forEach((t,r)=>{e.set(r,t instanceof Mt?t.clone():t)}),e}_callObserver(e,t){mc(this,e,new mI(this,e,t))}toJSON(){const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof Mt?i.toJSON():i}}),e}get size(){return[...fl(this._map)].length}keys(){return fu(fl(this._map),e=>e[0])}values(){return fu(fl(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return fu(fl(this._map),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Ge(this.doc,t=>{xa(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?Ge(this.doc,r=>{Id(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Rd(this,e)}has(e){return J0(this,e)}clear(){this.doc!==null?Ge(this.doc,e=>{this.forEach(function(t,r,i){xa(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(BI)}}const gI=n=>new bs,xr=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&rx(n,e);class yf{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&bn(),this.right.content.constructor){case at:this.right.deleted||Ms(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Ym=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case at:e.right.deleted||Ms(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t{const i=new Map,s=r?pc(e,t):null;if(s){const o=new yf(s.p.left,s.p,s.index,i);return Ym(n,o,t-s.index)}else{const o=new yf(null,e._start,0,i);return Ym(n,o,t)}},G0=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===at&&xr(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,l)=>{const a=t.left,c=t.right,u=new Ue(Se(s,it(i.store,s)),a,a&&a.lastId,c,c&&c.id,e,null,new at(l,o));u.integrate(n,0),t.right=u,t.forward()})},Ms=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},Y0=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===at&&xr(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},X0=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const l in r){const a=r[l],c=t.currentAttributes.get(l)??null;if(!xr(c,a)){o.set(l,c);const{left:u,right:f}=t;t.right=new Ue(Se(s,it(i.store,s)),u,u&&u.lastId,f,f&&f.id,e,null,new at(l,a)),t.right.integrate(n,0),t.forward()}}return o},hu=(n,e,t,r,i)=>{t.currentAttributes.forEach((d,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;Y0(t,i);const l=X0(n,e,t,i),a=r.constructor===String?new Nn(r):r instanceof Mt?new xn(r):new Ni(r);let{left:c,right:u,index:f}=t;e._searchMarker&&No(e._searchMarker,t.index,a.getLength()),u=new Ue(Se(o,it(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(n,0),t.right=u,t.index=f,t.forward(),G0(n,e,t,l)},Xm=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;Y0(t,i);const l=X0(n,e,t,i);e:for(;t.right!==null&&(r>0||l.size>0&&(t.right.deleted||t.right.content.constructor===at));){if(!t.right.deleted)switch(t.right.content.constructor){case at:{const{key:a,value:c}=t.right.content,u=i[a];if(u!==void 0){if(xr(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}t.right.delete(n)}else t.currentAttributes.set(a,c);break}default:r0){let a="";for(;r>0;r--)a+=` +`;t.right=new Ue(Se(o,it(s.store,o)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new Nn(a)),t.right.integrate(n,0),t.forward()}G0(n,e,t,l)},Q0=(n,e,t,r,i)=>{let s=e;const o=_n();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===at){const c=s.content;o.set(c.key,c)}s=s.right}let l=0,a=!1;for(;e!==s;){if(t===e&&(a=!0),!e.deleted){const c=e.content;switch(c.constructor){case at:{const{key:u,value:f}=c,d=r.get(u)??null;(o.get(u)!==c||d===f)&&(e.delete(n),l++,!a&&(i.get(u)??null)===f&&d!==f&&(d===null?i.delete(u):i.set(u,d))),!a&&!e.deleted&&Ms(i,c);break}}}e=e.right}return l},bI=(n,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===at){const r=e.content.key;t.has(r)?e.delete(n):t.add(r)}e=e.left}},yI=n=>{let e=0;return Ge(n.doc,t=>{let r=n._start,i=n._start,s=_n();const o=lf(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case at:Ms(o,i.content);break;default:e+=Q0(t,r,i,s,o),s=lf(o),r=i;break}i=i.right}}),e},vI=n=>{const e=new Set,t=n.doc;for(const[r,i]of n.afterState.entries()){const s=n.beforeState.get(r)||0;i!==s&&x0(n,t.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===at&&o.constructor!==fn&&e.add(o.parent)})}Ge(t,r=>{Hr(n,n.deleteSet,i=>{if(i instanceof fn||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===at?e.add(s):bI(r,i)});for(const i of e)yI(i)})},Qm=(n,e,t)=>{const r=t,i=lf(e.currentAttributes),s=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case xn:case Ni:case Nn:t{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];Ge(e,r=>{const i=new Map,s=new Map;let o=this.target._start,l=null;const a={};let c="",u=0,f=0;const d=()=>{if(l!==null){let h=null;switch(l){case"delete":f>0&&(h={delete:f}),f=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},i.size>0&&(h.attributes={},i.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),c="";break;case"retain":u>0&&(h={retain:u},ex(a)||(h.attributes=QD({},a))),u=0;break}h&&t.push(h),l=null}};for(;o!==null;){switch(o.content.constructor){case xn:case Ni:this.adds(o)?this.deletes(o)||(d(),l="insert",c=o.content.getContent()[0],d()):this.deletes(o)?(l!=="delete"&&(d(),l="delete"),f+=1):o.deleted||(l!=="retain"&&(d(),l="retain"),u+=1);break;case Nn:this.adds(o)?this.deletes(o)||(l!=="insert"&&(d(),l="insert"),c+=o.content.str):this.deletes(o)?(l!=="delete"&&(d(),l="delete"),f+=o.length):o.deleted||(l!=="retain"&&(d(),l="retain"),u+=o.length);break;case at:{const{key:h,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const m=i.get(h)??null;xr(m,p)?p!==null&&o.delete(r):(l==="retain"&&d(),xr(p,s.get(h)??null)?delete a[h]:a[h]=p)}}else if(this.deletes(o)){s.set(h,p);const m=i.get(h)??null;xr(m,p)||(l==="retain"&&d(),a[h]=m)}else if(!o.deleted){s.set(h,p);const m=a[h];m!==void 0&&(xr(m,p)?m!==null&&o.delete(r):(l==="retain"&&d(),p===null?delete a[h]:a[h]=p))}o.deleted||(l==="insert"&&d(),Ms(i,o.content));break}}o=o.right}for(d();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class Ai extends Mt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Ai}clone(){const e=new Ai;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new wI(this,e,t);mc(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===Nn&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?Ge(this.doc,r=>{const i=new yf(null,this._start,0,new Map);for(let s=0;s0)&&hu(r,this,i,l,o.attributes||{})}else o.retain!==void 0?Xm(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Qm(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){const i=[],s=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const f={};let d=!1;s.forEach((p,m)=>{d=!0,f[m]=p});const h={insert:l};d&&(h.attributes=f),i.push(h),l=""}}const u=()=>{for(;a!==null;){if(ni(a,e)||t!==void 0&&ni(a,t))switch(a.content.constructor){case Nn:{const f=s.get("ychange");e!==void 0&&!ni(a,e)?(f===void 0||f.user!==a.id.client||f.type!=="removed")&&(c(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):t!==void 0&&!ni(a,t)?(f===void 0||f.user!==a.id.client||f.type!=="added")&&(c(),s.set("ychange",r?r("added",a.id):{type:"added"})):f!==void 0&&(c(),s.delete("ychange")),l+=a.content.str;break}case xn:case Ni:{c();const f={insert:a.content.getContent()[0]};if(s.size>0){const d={};f.attributes=d,s.forEach((h,p)=>{d[p]=h})}i.push(f);break}case at:ni(a,e)&&(c(),Ms(s,a.content));break}a=a.right}c()};return e||t?Ge(o,f=>{e&&gf(f,e),t&&gf(f,t),u()},"cleanup"):u(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?Ge(i,s=>{const o=dl(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),hu(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?Ge(i,s=>{const o=dl(s,this,e,!r);hu(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?Ge(r,i=>{Qm(i,dl(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?Ge(i,s=>{const o=dl(s,this,e,!1);o.right!==null&&Xm(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?Ge(this.doc,t=>{xa(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?Ge(this.doc,r=>{Id(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Rd(this,e)}getAttributes(){return K0(this)}_write(e){e.writeTypeRef(FI)}}const kI=n=>new Ai;class pu{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===Bt||t.constructor===Ti)&&t._start!==null)e=t._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Ti extends Mt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ti}clone(){const e=new Ti;return e.insert(0,this.toArray().map(t=>t instanceof Mt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new pu(this,e)}querySelector(e){e=e.toUpperCase();const r=new pu(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),zr(new pu(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){mc(this,e,new _I(this,t,e))}toString(){return H0(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Do(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?Ge(this.doc,r=>{W0(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)Ge(this.doc,r=>{const i=e&&e instanceof Mt?e._item:e;Da(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Vr("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?Ge(this.doc,r=>{q0(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return z0(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return U0(this,e)}slice(e=0,t=this.length){return F0(this,e,t)}forEach(e){Do(this,e)}_write(e){e.writeTypeRef(VI)}}const SI=n=>new Ti;class Bt extends Ti{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new Bt(this.nodeName)}clone(){const e=new Bt(this.nodeName),t=this.getAttributes();return ZD(t,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Mt?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}`}removeAttribute(e){this.doc!==null?Ge(this.doc,t=>{xa(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?Ge(this.doc,r=>{Id(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Rd(this,e)}hasAttribute(e){return J0(this,e)}getAttributes(e){return e?dI(this,e):K0(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return Do(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(zI),e.writeKey(this.nodeName)}}const CI=n=>new Bt(n.readKey());class _I extends hc{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Ia extends bs{constructor(e){super(),this.hookName=e}_copy(){return new Ia(this.hookName)}clone(){const e=new Ia(this.hookName);return this.forEach((t,r)=>{e.set(r,t)}),e}toDOM(e=document,t={},r){const i=t[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(HI),e.writeKey(this.hookName)}}const AI=n=>new Ia(n.readKey());class sn extends Ai{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new sn}clone(){const e=new sn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.keyi.nodeName=0;i--)r+=``;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(UI)}}const TI=n=>new sn;class Pd{constructor(e,t){this.id=e,this.length=t}get deleted(){throw An()}mergeWith(e){return!1}write(e,t,r){throw An()}integrate(e,t){throw An()}}const EI=0;class fn extends Pd{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),D0(e.doc.store,this)}write(e,t){e.writeInfo(EI),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Ko{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Ko(this.content)}splice(e){throw An()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const MI=n=>new Ko(n.readBuf());class xo{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new xo(this.len)}splice(e){const t=new xo(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Mo(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const OI=n=>new xo(n.readLen()),Z0=(n,e)=>new Es({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Jo{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Jo(Z0(this.doc.guid,this.opts))}splice(e){throw An()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const $I=n=>new Jo(Z0(n.readString(),n.readAny()));class Ni{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Ni(this.embed)}splice(e){throw An()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const NI=n=>new Ni(n.readJSON());class at{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new at(this.key,this.value)}splice(e){throw An()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const DI=n=>new at(n.readKey(),n.readJSON());class Ra{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ra(this.arr)}splice(e){const t=new Ra(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i{const e=n.readLen(),t=[];for(let r=0;r{const e=n.readLen(),t=[];for(let r=0;r=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const RI=n=>new Nn(n.readString()),PI=[pI,gI,kI,CI,SI,AI,TI],LI=0,BI=1,FI=2,zI=3,VI=4,HI=5,UI=6;class xn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new xn(this.type._copy())}splice(e){throw An()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const jI=n=>new xn(PI[n.readTypeRef()](n)),vf=(n,e)=>{let t=e,r=0,i;do r>0&&(t=Se(t.client,t.clock+r)),i=Al(n,t),r=t.clock-i.id.clock,t=i.redone;while(t!==null&&i instanceof Ue);return{item:i,diff:r}},Ld=(n,e)=>{for(;n!==null&&n.keep!==e;)n.keep=e,n=n.parent._item},Pa=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new Ue(Se(r,i+t),e,Se(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=Se(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s},Zm=(n,e)=>pD(n,t=>As(t.deletions,e)),e1=(n,e,t,r,i,s)=>{const o=n.doc,l=o.store,a=o.clientID,c=e.redone;if(c!==null)return qt(n,c);let u=e.parent._item,f=null,d;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!t.has(u)||e1(n,u,t,r,i,s)===null))return null;for(;u.redone!==null;)u=qt(n,u.redone)}const h=u===null?e.parent:u.content.type;if(e.parentSub===null){for(f=e.left,d=e;f!==null;){let b=f;for(;b!==null&&b.parent._item!==u;)b=b.redone===null?null:qt(n,b.redone);if(b!==null&&b.parent._item===u){f=b;break}f=f.left}for(;d!==null;){let b=d;for(;b!==null&&b.parent._item!==u;)b=b.redone===null?null:qt(n,b.redone);if(b!==null&&b.parent._item===u){d=b;break}d=d.right}}else if(d=null,e.right&&!i){for(f=e;f!==null&&f.right!==null&&(f.right.redone||As(r,f.right.id)||Zm(s.undoStack,f.right.id)||Zm(s.redoStack,f.right.id));)for(f=f.right;f.redone;)f=qt(n,f.redone);if(f&&f.right!==null)return null}else f=h._map.get(e.parentSub)||null;const p=it(l,a),m=Se(a,p),g=new Ue(m,f,f&&f.lastId,d,d&&d.id,h,e.parentSub,e.content.copy());return e.redone=m,Ld(g,!0),g.integrate(n,0),g};class Ue extends Pd{constructor(e,t,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?Om:0}set marker(e){(this.info&au)>0!==e&&(this.info^=au)}get marker(){return(this.info&au)>0}get keep(){return(this.info&Mm)>0}set keep(e){this.keep!==e&&(this.info^=Mm)}get countable(){return(this.info&Om)>0}get deleted(){return(this.info&lu)>0}set deleted(e){this.deleted!==e&&(this.info^=lu)}markDeleted(){this.info|=lu}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=it(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=it(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Qi&&this.id.client!==this.parent.client&&this.parent.clock>=it(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=jm(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=qt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===fn||this.right&&this.right.constructor===fn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Ue&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Ue&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Qi){const r=Al(t,this.parent);r.constructor===fn?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=jm(e,e.doc.store,Se(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),cl(this.origin,i.origin)){if(i.id.client{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Mo(e.deleteSet,this.id.client,this.id.clock,this.length),qm(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw bn();this.content.gc(e),t?Gx(e,this,new fn(this.id,this.length)):this.content=new xo(this.length)}write(e,t){const r=t>0?Se(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&cc|(r===null?0:rn)|(i===null?0:cr)|(s===null?0:_o);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Oo(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===Qi?(e.writeParentInfo(!1),e.writeLeftID(l)):bn();s!==null&&e.writeString(s)}this.content.write(e,t)}}const t1=(n,e)=>WI[e&cc](n),WI=[()=>{bn()},OI,xI,MI,RI,NI,DI,jI,II,$I,()=>{bn()}],qI=10;class dn extends Pd{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){bn()}write(e,t){e.writeInfo(qI),De(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const n1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},r1="__ $YJS$ __";n1[r1]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");n1[r1]=!0;function KI(n){return n||(n={}),{delay:n.delay===void 0?200:n.delay,initialDelay:n.initialDelay===void 0?0:n.initialDelay,minDelay:n.minDelay===void 0?0:n.minDelay,maxDelay:n.maxDelay===void 0?0:n.maxDelay,factor:n.factor===void 0?0:n.factor,maxAttempts:n.maxAttempts===void 0?3:n.maxAttempts,timeout:n.timeout===void 0?0:n.timeout,jitter:n.jitter===!0,initialJitter:n.initialJitter===!0,handleError:n.handleError===void 0?null:n.handleError,handleTimeout:n.handleTimeout===void 0?null:n.handleTimeout,beforeAttempt:n.beforeAttempt===void 0?null:n.beforeAttempt,calculateDelay:n.calculateDelay===void 0?null:n.calculateDelay}}async function mu(n){return new Promise(e=>setTimeout(e,n))}function JI(n,e){let t=e.delay;if(t===0)return 0;if(e.factor&&(t*=Math.pow(e.factor,n.attemptNum-1),e.maxDelay!==0&&(t=Math.min(t,e.maxDelay))),e.jitter){const r=Math.ceil(e.minDelay),i=Math.floor(t);t=Math.floor(Math.random()*(i-r+1))+r}return Math.round(t)}async function GI(n,e){const t=KI(e);for(const l of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const a=t[l];if(!Number.isInteger(a)||a<0)throw new Error(`Value for ${l} must be an integer greater than or equal to 0`)}if(t.factor.constructor!==Number||t.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(t.delay{if(t.handleError&&await t.handleError(a,r,t),r.aborted||r.attemptsRemaining===0)throw a;r.attemptNum++;const c=i(r,t);return c&&await mu(c),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,t.timeout?new Promise((a,c)=>{const u=setTimeout(()=>{if(t.handleTimeout)try{a(t.handleTimeout(r,t))}catch(f){c(f)}else{const f=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${t.timeout})`);f.code="ATTEMPT_TIMEOUT",c(f)}},t.timeout);n(r,t).then(f=>{clearTimeout(u),a(f)}).catch(f=>{clearTimeout(u),l(f).then(a).catch(c)})}):n(r,t).catch(l)}const o=t.calculateDelay?t.calculateDelay(r,t):t.initialDelay;if(o&&await mu(o),r.attemptNum<1&&t.initialJitter){const l=i(r,t);l&&await mu(l)}return s()}var i1={};const es=()=>new Map,s1=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},o1=()=>new Set,YI=Array.from,XI=String.fromCharCode,QI=n=>n.toLowerCase(),ZI=/^\s*/g,eR=n=>n.replace(ZI,""),tR=/([A-Z])/g,eg=(n,e)=>eR(n.replace(tR,t=>`${e}${QI(t)}`)),nR=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iIo.encode(n),iR=Io?rR:nR;let so=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});so&&so.decode(new Uint8Array).length===1&&(so=null);const tg=n=>n===void 0?null:n;class sR{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let l1=new sR,Bd=!0;try{typeof localStorage<"u"&&localStorage&&(l1=localStorage,Bd=!1)}catch{}const a1=l1,oR=n=>Bd||addEventListener("storage",n),lR=n=>Bd||removeEventListener("storage",n),aR=Object.keys,cR=(n,e)=>{const t=[];for(const r in n)t.push(e(n[r],r));return t},ng=n=>aR(n).length,uR=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),fR=(n,e)=>n===e,oo=(n,e)=>{if(n==null||e==null)return fR(n,e);if(n.constructor!==e.constructor)return!1;if(n===e)return!0;switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;te.includes(n),ys=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",c1=typeof window<"u"&&typeof document<"u"&&!ys;let Fn;const hR=()=>{if(Fn===void 0)if(ys){Fn=es();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");Fn.set(`--${eg(e,"-")}`,t),Fn.set(`-${eg(e,"-")}`,t)}})):Fn=es();return Fn},wf=n=>hR().has(n),kf=n=>tg(ys?i1[n.toUpperCase()]:a1.getItem(n)),pR=n=>wf("--"+n)||kf(n)!==null;pR("production");const rg=ys&&dR(i1.FORCE_COLOR,["true","1","2"]);!wf("no-colors")&&(!ys||process.stdout.isTTY||rg)&&(!ys||wf("color")||rg||kf("COLORTERM")!==null||(kf("TERM")||"").includes("color"));const u1=Math.floor,mR=(n,e)=>nn>e?n:e,bR=64,La=128,yR=63,lo=127,f1=Number.MAX_SAFE_INTEGER;class vR{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Fd=()=>new vR,d1=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array(d1(n));let t=0;for(let r=0;r{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},St=(n,e)=>{for(;e>lo;)Ba(n,La|lo&e),e=u1(e/128);Ba(n,lo&e)},Sf=new Uint8Array(3e4),wR=Sf.length/3,kR=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;St(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=mR(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(gR(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},Os=(n,e)=>{St(n,e.byteLength),CR(n,e)},h1=n=>new Error(n),p1=h1("Unexpected end of array"),m1=h1("Integer out of Range");class _R{constructor(e){this.arr=e,this.pos=0}}const g1=n=>new _R(n),AR=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},gc=n=>AR(n,gi(n)),ig=n=>n.arr[n.pos++],gi=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posf1)throw m1}throw p1},TR=n=>{let e=n.arr[n.pos++],t=e&yR,r=64;const i=(e&bR)>0?-1:1;if(!(e&La))return i*t;const s=n.arr.length;for(;n.posf1)throw m1}throw p1},ER=n=>{let e=gi(n);if(e===0)return"";{let t=String.fromCodePoint(ig(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(ig(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},MR=n=>so.decode(gc(n)),bc=so?MR:ER,OR=n=>{const e=n.pos,t=bc(n);return n.pos=e,t},$R=n=>new Uint8Array(n),NR=(n,e,t)=>new Uint8Array(n,e,t),DR=n=>new Uint8Array(n),xR=n=>{let e="";for(let t=0;tBuffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),RR=n=>{const e=atob(n),t=$R(e.length);for(let r=0;r{const e=Buffer.from(n,"base64");return NR(e.buffer,e.byteOffset,e.byteLength)},LR=c1?xR:IR,BR=c1?RR:PR,b1=new Map;class FR{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:BR(t.newValue||"")}),oR(this._onChange)}postMessage(e){a1.setItem(this.room,LR(DR(e)))}close(){lR(this._onChange)}}const zR=typeof BroadcastChannel>"u"?FR:BroadcastChannel,Vd=n=>s1(b1,n,()=>{const e=o1(),t=new zR(n);return t.onmessage=r=>e.forEach(i=>i(r.data,"broadcastchannel")),{bc:t,subs:e}}),VR=(n,e)=>(Vd(n).subs.add(e),e),HR=(n,e)=>{const t=Vd(n),r=t.subs.delete(e);return r&&t.subs.size===0&&(t.bc.close(),b1.delete(n)),r},UR=(n,e,t=null)=>{const r=Vd(n);r.bc.postMessage(e),r.subs.forEach(i=>i(e,t))},jR=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},vs=Date.now;class WR{constructor(){this._observers=es()}on(e,t){s1(this._observers,e,o1).add(t)}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return YI((this._observers.get(e)||es()).values()).forEach(r=>r(...t))}destroy(){this._observers=es()}}const gu=3e4;class qR extends WR{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=vs();this.getLocalState()!==null&&gu/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&gu<=t-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&El(this,r,"timeout")},u1(gu/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,r=this.meta.get(t),i=r===void 0?0:r.clock+1,s=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:i,lastUpdated:vs()});const o=[],l=[],a=[],c=[];e===null?c.push(t):s==null?e!=null&&o.push(t):(l.push(t),oo(s,e)||a.push(t)),(o.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:o,updated:a,removed:c},"local"]),this.emit("update",[{added:o,updated:l,removed:c},"local"])}setLocalStateField(e,t){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:t})}getStates(){return this.states}}const El=(n,e,t)=>{const r=[];for(let i=0;i0&&(n.emit("change",[{added:[],updated:[],removed:r},t]),n.emit("update",[{added:[],updated:[],removed:r},t]))},Cf=(n,e,t=n.states)=>{const r=e.length,i=Fd();St(i,r);for(let s=0;s{const r=g1(e),i=vs(),s=[],o=[],l=[],a=[],c=gi(r);for(let u=0;u0||l.length>0||a.length>0)&&n.emit("change",[{added:s,updated:l,removed:a},t]),(s.length>0||o.length>0||a.length>0)&&n.emit("update",[{added:s,updated:o,removed:a},t])};class y1{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}const JR=n=>cR(n,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");var yt;(function(n){n[n.Sync=0]="Sync",n[n.Awareness=1]="Awareness",n[n.Auth=2]="Auth",n[n.QueryAwareness=3]="QueryAwareness",n[n.Stateless=5]="Stateless",n[n.CLOSE=7]="CLOSE",n[n.SyncStatus=8]="SyncStatus"})(yt||(yt={}));var mt;(function(n){n.Connecting="connecting",n.Connected="connected",n.Disconnected="disconnected"})(mt||(mt={}));class Ml{constructor(e){this.data=e,this.encoder=Fd(),this.decoder=g1(new Uint8Array(this.data))}peekVarString(){return OR(this.decoder)}readVarUint(){return gi(this.decoder)}readVarString(){return bc(this.decoder)}readVarUint8Array(){return gc(this.decoder)}writeVarUint(e){return St(this.encoder,e)}writeVarString(e){return Dn(this.encoder,e)}writeVarUint8Array(e){return Os(this.encoder,e)}length(){return d1(this.encoder)}}class v1 extends y1{constructor(e){super(),this.messageQueue=[],this.configuration={url:"",document:void 0,WebSocketPolyfill:void 0,parameters:{},connect:!0,broadcast:!0,forceSyncInterval:!1,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,quiet:!1,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=mt.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={forceSync:null,connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on("open",this.configuration.onOpen),this.on("open",this.onOpen.bind(this)),this.on("connect",this.configuration.onConnect),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("status",this.configuration.onStatus),this.on("status",this.onStatus.bind(this)),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("close",this.onClose.bind(this)),this.on("message",this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),typeof e.connect<"u"&&(this.shouldConnect=e.connect),this.shouldConnect&&this.connect()}async onOpen(e){this.receivedOnOpenPayload=e}async onStatus(e){this.receivedOnStatusPayload=e}attach(e){let t;return this.configuration.providerMap.set(e.configuration.name,e),this.status===mt.Disconnected&&this.shouldConnect&&(t=this.connect()),this.receivedOnOpenPayload&&e.onOpen(this.receivedOnOpenPayload),this.receivedOnStatusPayload&&e.onStatus(this.receivedOnStatusPayload),t}detach(e){this.configuration.providerMap.delete(e.configuration.name)}setConfiguration(e={}){this.configuration={...this.configuration,...e}}async connect(){if(this.status===mt.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:GI(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,beforeAttempt:o=>{(!this.shouldConnect||i)&&o.abort()}}).catch(o=>{if(o&&o.code!=="ATTEMPT_ABORTED")throw o}),cancelFunc:()=>{i=!0}}},{retryPromise:t,cancelFunc:r}=e();return this.cancelWebsocketRetry=r,t}attachWebSocketListeners(e,t){const{identifier:r}=e,i=c=>this.emit("message",c),s=c=>this.emit("close",{event:c}),o=c=>this.emit("open",c),l=c=>{t(c)};this.webSocketHandlers[r]={message:i,close:s,open:o,error:l};const a=this.webSocketHandlers[e.identifier];Object.keys(a).forEach(c=>{e.addEventListener(c,a[c])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,t=this.webSocketHandlers[e];Object.keys(t).forEach(r=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(r,t[r]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,t)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const r=new this.configuration.WebSocketPolyfill(this.url);r.binaryType="arraybuffer",r.identifier=this.identifier,this.attachWebSocketListeners(r,t),this.webSocket=r,this.status=mt.Connecting,this.emit("status",{status:mt.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){var t;this.resolveConnectionAttempt(),this.lastMessageReceived=vs();const i=new Ml(e.data).peekVarString();(t=this.configuration.providerMap.get(i))===null||t===void 0||t.onMessage(e)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=mt.Connected,this.emit("status",{status:mt.Connected}),this.emit("connect"),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var e;(e=this.connectionAttempt)===null||e===void 0||e.reject(),this.connectionAttempt=null}checkConnection(){var e;this.status===mt.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=vs()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):((e=this.webSocket)===null||e===void 0||e.close(),this.messageQueue=[])))}get serverUrl(){for(;this.configuration.url[this.configuration.url.length-1]==="/";)return this.configuration.url.slice(0,this.configuration.url.length-1);return this.configuration.url}get url(){const e=JR(this.configuration.parameters);return`${this.serverUrl}${e.length===0?"":`?${e}`}`}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch{}}send(e){var t;((t=this.webSocket)===null||t===void 0?void 0:t.readyState)===of.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){if(this.closeTries=0,this.cleanupWebSocket(),this.status===mt.Connected&&(this.status=mt.Disconnected,this.emit("status",{status:mt.Disconnected}),this.emit("disconnect",{event:e})),e.code===Tm.code&&(e.reason===Tm.reason?console.warn("[HocuspocusProvider] An authentication token is required, but you didn’t send one. Try adding a `token` to your HocuspocusProvider configuration. Won’t try again."):console.warn(`[HocuspocusProvider] Connection closed with status Unauthorized: ${e.reason}`),this.shouldConnect=!1),e.code===uD.code&&!this.configuration.quiet){console.warn("[HocuspocusProvider] The provided authentication token isn’t allowed to connect to this server. Will try again.");return}e.code===cD.code&&(console.warn(`[HocuspocusProvider] Connection closed with status MessageTooBig: ${e.reason}`),this.shouldConnect=!1),this.connectionAttempt?this.rejectConnectionAttempt():this.shouldConnect&&this.connect(),!this.shouldConnect&&this.status!==mt.Disconnected&&(this.status=mt.Disconnected,this.emit("status",{status:mt.Disconnected}),this.emit("disconnect",{event:e}))}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}const w1=0,Hd=1,k1=2,GR=(n,e)=>{St(n,w1);const t=Hx(e);Os(n,t)},S1=(n,e,t)=>{St(n,Hd),Os(n,Bx(e,t))},YR=(n,e,t)=>S1(e,t,gc(n)),C1=(n,e,t)=>{try{Rx(e,gc(n),t)}catch(r){console.error("Caught error while handling a Yjs update",r)}},XR=(n,e)=>{St(n,k1),Os(n,e)},QR=C1,ZR=(n,e,t,r)=>{const i=gi(n);switch(i){case w1:YR(n,e,t);break;case Hd:C1(n,t,r);break;case k1:QR(n,t,r);break;default:throw new Error("Unknown message type")}return i};class Zn{constructor(){this.encoder=Fd()}get(e){return e.encoder}toUint8Array(){return zd(this.encoder)}}class sg{constructor(e){this.broadcasted=!1,this.message=e}setBroadcasted(e){return this.broadcasted=e,this}apply(e,t){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case yt.Sync:this.applySyncMessage(e,t);break;case yt.Awareness:this.applyAwarenessMessage(e);break;case yt.Auth:this.applyAuthMessage(e);break;case yt.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case yt.Stateless:e.receiveStateless(bc(r.decoder));break;case yt.SyncStatus:this.applySyncStatusMessage(e,TR(r.decoder)===1);break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}r.length()>s+1&&(this.broadcasted?e.broadcast(Zn,{encoder:r.encoder}):e.send(Zn,{encoder:r.encoder}))}applySyncMessage(e,t){const{message:r}=this;r.writeVarUint(yt.Sync);const i=ZR(r.decoder,r.encoder,e.document,e);t&&i===Hd&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;KR(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){const{message:t}=this;aD(t.decoder,e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;t.writeVarUint(yt.Awareness),t.writeVarUint8Array(Cf(e.awareness,Array.from(e.awareness.getStates().keys())))}}class og{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return zd(this.encoder)}send(e){e==null||e.send(this.create())}broadcast(e){UR(e,this.create())}}class e3 extends Zn{constructor(){super(...arguments),this.type=yt.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return Dn(this.encoder,e.documentName),St(this.encoder,this.type),lD(this.encoder,e.token),this.encoder}}class hl extends Zn{constructor(){super(...arguments),this.type=yt.Awareness,this.description="Awareness states update"}get(e){if(typeof e.awareness>"u")throw new Error("The awareness message requires awareness as an argument");if(typeof e.clients>"u")throw new Error("The awareness message requires clients as an argument");Dn(this.encoder,e.documentName),St(this.encoder,this.type);let t;return e.states===void 0?t=Cf(e.awareness,e.clients):t=Cf(e.awareness,e.clients,e.states),Os(this.encoder,t),this.encoder}}class t3 extends Zn{constructor(){super(...arguments),this.type=yt.CLOSE,this.description="Ask the server to close the connection"}get(e){return Dn(this.encoder,e.documentName),St(this.encoder,this.type),this.encoder}}class n3 extends Zn{constructor(){super(...arguments),this.type=yt.QueryAwareness,this.description="Queries awareness states"}get(e){return Dn(this.encoder,e.documentName),St(this.encoder,this.type),this.encoder}}class r3 extends Zn{constructor(){super(...arguments),this.type=yt.Stateless,this.description="A stateless message"}get(e){var t;return Dn(this.encoder,e.documentName),St(this.encoder,this.type),Dn(this.encoder,(t=e.payload)!==null&&t!==void 0?t:""),this.encoder}}class bu extends Zn{constructor(){super(...arguments),this.type=yt.Sync,this.description="First sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step one message requires document as an argument");return Dn(this.encoder,e.documentName),St(this.encoder,this.type),GR(this.encoder,e.document),this.encoder}}class i3 extends Zn{constructor(){super(...arguments),this.type=yt.Sync,this.description="Second sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step two message requires document as an argument");return Dn(this.encoder,e.documentName),St(this.encoder,this.type),S1(this.encoder,e.document),this.encoder}}class s3 extends Zn{constructor(){super(...arguments),this.type=yt.Sync,this.description="A document update"}get(e){return Dn(this.encoder,e.documentName),St(this.encoder,this.type),XR(this.encoder,e.update),this.encoder}}class o3 extends Error{constructor(){super(...arguments),this.code=1001}}class l3 extends y1{constructor(e){var t,r,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,parameters:{},broadcast:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onSynced:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,quiet:!1,connect:!0,preserveConnection:!0},this.subscribedToBroadcastChannel=!1,this.isSynced=!1,this.unsyncedChanges=0,this.status=mt.Disconnected,this.isAuthenticated=!1,this.authorizedScope=void 0,this.mux=jR(),this.intervals={forceSync:null},this.isConnected=!0,this.boundBroadcastChannelSubscriber=this.broadcastChannelSubscriber.bind(this),this.boundPageUnload=this.pageUnload.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.boundOnStatus=this.onStatus.bind(this),this.forwardConnect=s=>this.emit("connect",s),this.forwardOpen=s=>this.emit("open",s),this.forwardClose=s=>this.emit("close",s),this.forwardDisconnect=s=>this.emit("disconnect",s),this.forwardDestroy=s=>this.emit("destroy",s),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Es,this.configuration.awareness=e.awareness!==void 0?e.awareness:new qR(this.document),this.on("open",this.configuration.onOpen),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("synced",this.configuration.onSynced),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("stateless",this.configuration.onStateless),this.on("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),this.configuration.websocketProvider.on("connect",this.configuration.onConnect),this.configuration.websocketProvider.on("connect",this.forwardConnect),this.configuration.websocketProvider.on("open",this.boundOnOpen),this.configuration.websocketProvider.on("open",this.forwardOpen),this.configuration.websocketProvider.on("close",this.boundOnClose),this.configuration.websocketProvider.on("close",this.configuration.onClose),this.configuration.websocketProvider.on("close",this.forwardClose),this.configuration.websocketProvider.on("status",this.boundOnStatus),this.configuration.websocketProvider.on("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.on("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.on("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.on("destroy",this.forwardDestroy),(t=this.awareness)===null||t===void 0||t.on("update",()=>{this.emit("awarenessUpdate",{states:Em(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:Em(this.awareness.getStates())})}),this.document.on("update",this.documentUpdateHandler.bind(this)),(i=this.awareness)===null||i===void 0||i.on("update",this.awarenessUpdateHandler.bind(this)),this.registerEventListeners(),this.configuration.forceSyncInterval&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.configuration.websocketProvider.attach(this)}onStatus({status:e}){this.status=e,this.configuration.onStatus({status:e}),this.emit("status",{status:e})}setConfiguration(e={}){if(!e.websocketProvider&&e.url){const t=e;this.configuration.websocketProvider=new v1({url:t.url,connect:t.connect,parameters:t.parameters})}this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",this.unsyncedChanges)}decrementUnsyncedChanges(){this.unsyncedChanges-=1,this.unsyncedChanges===0&&(this.synced=!0),this.emit("unsyncedChanges",this.unsyncedChanges)}forceSync(){this.send(bu,{document:this.document,documentName:this.configuration.name})}pageUnload(){this.awareness&&El(this.awareness,[this.document.clientID],"window unload")}registerEventListeners(){typeof window>"u"||window.addEventListener("unload",this.boundPageUnload)}sendStateless(e){this.send(r3,{documentName:this.configuration.name,payload:e})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send(s3,{update:e,documentName:this.configuration.name},!0))}awarenessUpdateHandler({added:e,updated:t,removed:r},i){const s=e.concat(t).concat(r);this.send(hl,{awareness:this.awareness,clients:s,documentName:this.configuration.name},!0)}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,this.emit("synced",{state:e}),this.emit("sync",{state:e}))}receiveStateless(e){this.emit("stateless",{payload:e})}get isAuthenticationRequired(){return!!this.configuration.token&&!this.isAuthenticated}async connect(){return this.configuration.broadcast&&this.subscribeToBroadcastChannel(),this.configuration.websocketProvider.shouldConnect=!0,this.configuration.websocketProvider.attach(this)}disconnect(){this.disconnectBroadcastChannel(),this.configuration.websocketProvider.detach(this),this.isConnected=!1,this.configuration.preserveConnection||this.configuration.websocketProvider.disconnect()}async onOpen(e){this.isAuthenticated=!1,this.isConnected=!0,this.emit("open",{event:e});let t;try{t=await this.getToken()}catch(r){this.permissionDeniedHandler(`Failed to get token: ${r}`);return}this.isAuthenticationRequired&&this.send(e3,{token:t,documentName:this.configuration.name}),this.startSync()}async getToken(){return typeof this.configuration.token=="function"?await this.configuration.token():this.configuration.token}startSync(){this.incrementUnsyncedChanges(),this.send(bu,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(hl,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,t,r=!1){if(!this.isConnected)return;r&&this.mux(()=>{this.broadcast(e,t)});const i=new og(e,t);this.emit("outgoingMessage",{message:i.message}),i.send(this.configuration.websocketProvider)}onMessage(e){const t=new Ml(e.data),r=t.readVarString();t.writeVarString(r),this.emit("message",{event:e,message:new Ml(e.data)}),new sg(t).apply(this,!0)}onClose(e){this.isAuthenticated=!1,this.synced=!1,this.awareness&&El(this.awareness,Array.from(this.awareness.getStates().keys()).filter(t=>t!==this.document.clientID),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(El(this.awareness,[this.document.clientID],"provider destroy"),this.awareness.off("update",this.awarenessUpdateHandler),this.awareness.destroy()),this.document.off("update",this.documentUpdateHandler),this.removeAllListeners(),this.configuration.websocketProvider.off("connect",this.configuration.onConnect),this.configuration.websocketProvider.off("connect",this.forwardConnect),this.configuration.websocketProvider.off("open",this.boundOnOpen),this.configuration.websocketProvider.off("open",this.forwardOpen),this.configuration.websocketProvider.off("close",this.boundOnClose),this.configuration.websocketProvider.off("close",this.configuration.onClose),this.configuration.websocketProvider.off("close",this.forwardClose),this.configuration.websocketProvider.off("status",this.boundOnStatus),this.configuration.websocketProvider.off("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.off("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.off("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.off("destroy",this.forwardDestroy),this.send(t3,{documentName:this.configuration.name}),this.disconnect(),!(typeof window>"u")&&window.removeEventListener("unload",this.boundPageUnload)}permissionDeniedHandler(e){this.emit("authenticationFailed",{reason:e}),this.isAuthenticated=!1,this.disconnect(),this.status=mt.Disconnected}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit("authenticated")}get broadcastChannel(){return`${this.configuration.name}`}broadcastChannelSubscriber(e){this.mux(()=>{const t=new Ml(e),r=t.readVarString();t.writeVarString(r),new sg(t).setBroadcasted(!0).apply(this,!1)})}subscribeToBroadcastChannel(){this.subscribedToBroadcastChannel||(VR(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!0),this.mux(()=>{this.broadcast(bu,{document:this.document,documentName:this.configuration.name}),this.broadcast(i3,{document:this.document,documentName:this.configuration.name}),this.broadcast(n3,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.broadcast(hl,{awareness:this.awareness,clients:[this.document.clientID],document:this.document,documentName:this.configuration.name})})}disconnectBroadcastChannel(){this.awareness&&this.send(hl,{awareness:this.awareness,clients:[this.document.clientID],states:new Map,documentName:this.configuration.name},!0),this.subscribedToBroadcastChannel&&(HR(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!1)}broadcast(e,t){this.configuration.broadcast&&this.subscribedToBroadcastChannel&&new og(e,t).broadcast(this.broadcastChannel)}setAwarenessField(e,t){if(!this.awareness)throw new o3(`Cannot set awareness field "${e}" to ${JSON.stringify(t)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,t)}}crypto.getRandomValues.bind(crypto);const a3=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},c3=/[\uD800-\uDBFF]/,u3=/[\uDC00-\uDFFF]/,f3=(n,e)=>{let t=0,r=0;for(;t0&&c3.test(n[t-1])&&t--;r+t0&&u3.test(n[n.length-r])&&r--,{index:t,remove:n.length-t-r,insert:e.slice(t,e.length-r)}},d3=f3,st=new Pt("y-sync"),ur=new Pt("y-undo");new Pt("yjs-cursor");const Fa=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!As(e.ds,n.id),h3=[{light:"#ecd44433",dark:"#ecd444"}],p3=(n,e,t)=>{if(!n.has(t)){if(n.sizer.add(i)),e=e.filter(i=>!r.has(i))}n.set(t,WD(e))}return n.get(t)},m3=(n,{colors:e=h3,colorMapping:t=new Map,permanentUserData:r=null,onFirstRender:i=()=>{}}={})=>{let s=!1,o;const l=new ut({props:{editable:a=>{const c=st.getState(a);return c.snapshot==null&&c.prevSnapshot==null}},key:st,state:{init:(a,c)=>({type:n,doc:n.doc,binding:null,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:t,permanentUserData:r}),apply:(a,c)=>{const u=a.getMeta(st);if(u!==void 0){c=Object.assign({},c);for(const f in u)c[f]=u[f]}return c.addToHistory=a.getMeta("addToHistory")!==!1,c.isChangeOrigin=u!==void 0&&!!u.isChangeOrigin,c.isUndoRedoOperation=u!==void 0&&!!u.isChangeOrigin&&!!u.isUndoRedoOperation,c.binding!==null&&u!==void 0&&(u.snapshot!=null||u.prevSnapshot!=null)&&pf(0,()=>{c.binding==null||c.binding.isDestroyed||(u.restore==null?c.binding._renderSnapshot(u.snapshot,u.prevSnapshot,c):(c.binding._renderSnapshot(u.snapshot,u.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,c.binding.mux(()=>{c.binding._prosemirrorChanged(c.binding.prosemirrorView.state.doc)})))}),c}},view:a=>{const c=new b3(n,a);return o!=null&&o.destroy(),o=pf(0,()=>{c._forceRerender(),a.dispatch(a.state.tr.setMeta(st,{binding:c})),i()}),{update:()=>{const u=l.getState(a.state);if(u.snapshot==null&&u.prevSnapshot==null&&(s||a.state.doc.content.findDiffStart(a.state.doc.type.createAndFill().content)!==null)){if(s=!0,u.addToHistory===!1&&!u.isChangeOrigin){const f=ur.getState(a.state),d=f&&f.undoManager;d&&d.stopCapturing()}c.mux(()=>{u.doc.transact(f=>{f.meta.set("addToHistory",u.addToHistory),c._prosemirrorChanged(a.state.doc)},st)})}},destroy:()=>{o.destroy(),c.destroy()}}}});return l},g3=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null){const r=ug(t.doc,t.type,e.anchor,t.mapping),i=ug(t.doc,t.type,e.head,t.mapping);r!==null&&i!==null&&(n=n.setSelection(be.create(n.doc,r,i)))}},_f=(n,e)=>({anchor:cg(e.selection.anchor,n.type,n.mapping),head:cg(e.selection.head,n.type,n.mapping)});class b3{constructor(e,t){this.type=e,this.prosemirrorView=t,this.mux=a3(),this.isDestroyed=!1,this.mapping=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&(this.beforeTransactionSelection=_f(this,t.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),e.observeDeep(this._observeFunction),this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(ox&&this._domSelectionInView===null&&(pf(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection(),t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);const i=t.getBoundingClientRect(),s=hx.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,t){t||(t=$0(v0(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(st,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping=new Map,this.mux(()=>{const e=this.type.toArray().map(r=>Ol(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(e),0,0));t.setMeta(st,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping=new Map,this.mux(()=>{const e=this.type.toArray().map(r=>Ol(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(e),0,0));this.prosemirrorView.dispatch(t.setMeta(st,{isChangeOrigin:!0}))})}_renderSnapshot(e,t,r){e||(e=Kx(this.doc)),this.mapping=new Map,this.mux(()=>{this.doc.transact(i=>{const s=r.permanentUserData;s&&s.dss.forEach(c=>{Hr(i,c,u=>{})});const o=(c,u)=>{const f=c==="added"?s.getUserByClientId(u.client):s.getUserByDeletedId(u);return{user:f,type:c,color:p3(r.colorMapping,r.colors,f)}},l=V0(this.type,new Od(t.ds,e.sv)).map(c=>!c._item.deleted||Fa(c._item,e)||Fa(c._item,t)?Ol(c,this.prosemirrorView.state.schema,new Map,e,t,o):null).filter(c=>c!==null),a=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(l),0,0));this.prosemirrorView.dispatch(a.setMeta(st,{isChangeOrigin:!0}))},st)})}_typeChanged(e,t){const r=st.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(l,a)=>this.mapping.delete(a);Hr(t,t.deleteSet,l=>{if(l.constructor===Ue){const a=l.content.type;a&&this.mapping.delete(a)}}),t.changed.forEach(i),t.changedParentTypes.forEach(i);const s=this.type.toArray().map(l=>_1(l,this.prosemirrorView.state.schema,this.mapping)).filter(l=>l!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(V.from(s),0,0));g3(o,this.beforeTransactionSelection,this),o=o.setMeta(st,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof R0}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Tf(this.doc,this.type,e,this.mapping),this.beforeTransactionSelection=_f(this,this.prosemirrorView.state)},st)}destroy(){this.isDestroyed=!0,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions)}}const _1=(n,e,t,r,i,s)=>{const o=t.get(n);if(o===void 0){if(n instanceof Bt)return Ol(n,e,t,r,i,s);throw An()}return o},Ol=(n,e,t,r,i,s)=>{const o=[],l=a=>{if(a.constructor===Bt){const c=_1(a,e,t,r,i,s);c!==null&&o.push(c)}else{const c=y3(a,e,t,r,i,s);c!==null&&c.forEach(u=>{u!==null&&o.push(u)})}};r===void 0||i===void 0?n.toArray().forEach(l):V0(n,new Od(i.ds,r.sv)).forEach(l);try{const a=n.getAttributes(r);r!==void 0&&(Fa(n._item,r)?Fa(n._item,i)||(a.ychange=s?s("added",n._item.id):{type:"added"}):a.ychange=s?s("removed",n._item.id):{type:"removed"});const c=e.node(n.nodeName,a,o);return t.set(n,c),c}catch{return n.doc.transact(c=>{n._item.delete(c)},st),t.delete(n),null}},y3=(n,e,t,r,i,s)=>{const o=[],l=n.toDelta(r,i,s);try{for(let a=0;a{n._item.delete(c)},st),null}return o},v3=(n,e)=>{const t=new sn,r=n.map(i=>({insert:i.text,attributes:T1(i.marks)}));return t.applyDelta(r),e.set(t,n),t},w3=(n,e)=>{const t=new Bt(n.type.name);for(const r in n.attrs){const i=n.attrs[r];i!==null&&r!=="ychange"&&t.setAttribute(r,i)}return t.insert(0,yc(n).map(r=>Af(r,e))),e.set(t,n),t},Af=(n,e)=>n instanceof Array?v3(n,e):w3(n,e),lg=n=>typeof n=="object"&&n!==null,Ud=(n,e)=>{const t=Object.keys(n).filter(i=>n[i]!==null);let r=t.length===Object.keys(e).filter(i=>e[i]!==null).length;for(let i=0;i{const e=n.content.content,t=[];for(let r=0;r{const t=n.toDelta();return t.length===e.length&&t.every((r,i)=>r.insert===e[i].text&&f0(r.attributes||{}).length===e[i].marks.length&&e[i].marks.every(s=>Ud(r.attributes[s.type.name]||{},s.attrs)))},Ro=(n,e)=>{if(n instanceof Bt&&!(e instanceof Array)&&Ef(n,e)){const t=yc(e);return n._length===t.length&&Ud(n.getAttributes(),e.attrs)&&n.toArray().every((r,i)=>Ro(r,t[i]))}return n instanceof sn&&e instanceof Array&&A1(n,e)},za=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,r)=>e[r]===t),ag=(n,e,t)=>{const r=n.toArray(),i=yc(e),s=i.length,o=r.length,l=ac(o,s);let a=0,c=0,u=!1;for(;a{let e="",t=n._start;const r={};for(;t!==null;)t.deleted||(t.countable&&t.content instanceof Nn?e+=t.content.str:t.content instanceof at&&(r[t.content.key]=null)),t=t.right;return{str:e,nAttrs:r}},S3=(n,e,t)=>{t.set(n,e);const{nAttrs:r,str:i}=k3(n),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,T1(c.marks))})),{insert:o,remove:l,index:a}=d3(i,s.map(c=>c.insert).join(""));n.delete(a,l),n.insert(a,o),n.applyDelta(s.map(c=>({retain:c.insert.length,attributes:c.attributes})))},T1=n=>{const e={};return n.forEach(t=>{t.type.name!=="ychange"&&(e[t.type.name]=t.attrs)}),e},Tf=(n,e,t,r)=>{if(e instanceof Bt&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(r.set(e,t),e instanceof Bt){const f=e.getAttributes(),d=t.attrs;for(const h in d)d[h]!==null?f[h]!==d[h]&&h!=="ychange"&&e.setAttribute(h,d[h]):e.removeAttribute(h);for(const h in f)d[h]===void 0&&e.removeAttribute(h)}const i=yc(t),s=i.length,o=e.toArray(),l=o.length,a=ac(s,l);let c=0,u=0;for(;c{for(;l-c-u>0&&s-c-u>0;){const d=o[c],h=i[c],p=o[l-u-1],m=i[s-u-1];if(d instanceof sn&&h instanceof Array)A1(d,h)||S3(d,h,r),c+=1;else{let g=d instanceof Bt&&Ef(d,h),b=p instanceof Bt&&Ef(p,m);if(g&&b){const C=ag(d,h,r),E=ag(p,m,r);C.foundMappedChild&&!E.foundMappedChild?b=!1:!C.foundMappedChild&&E.foundMappedChild||C.equalityFactor0&&(e.slice(c,c+f).forEach(d=>r.delete(d)),e.delete(c,f)),c+u!(e instanceof Array)&&n.nodeName===e.type.name,cg=(n,e,t)=>{if(n===0)return du(e,0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof sn){if(r._length>=n)return du(r,n);if(n-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,n--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(t.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&n1)return new $a(r._item===null?null:r._item.id,r._item===null?Oo(r):null,null);if(n-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(n===0)return r=r._item===null?r:r._item.parent,new $a(r._item===null?null:r._item.id,r._item===null?Oo(r):null,null);do r=r._item.parent,n--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw bn();if(n===0&&r.constructor!==sn&&r!==e)return C3(r._item.parent,r._item)}return du(e,e._length)},C3=(n,e)=>{let t=null,r=null;return n._item===null?r=Oo(n):t=Se(n._item.id.client,n._item.id.clock),new $a(t,r,e.id)},ug=(n,e,t,r)=>{const i=qx(t,n);if(i===null||i.type!==e&&!$o(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===sn)o=i.index;else if(s._item===null||!s._item.deleted){let l=s._first,a=0;for(;a{const e=ur.getState(n).undoManager;if(e!=null)return e.undo(),!0},A3=n=>{const e=ur.getState(n).undoManager;if(e!=null)return e.redo(),!0},T3=new Set(["paragraph"]),E3=(n,e)=>!(n instanceof Ue)||!(n.content instanceof xn)||!(n.content.type instanceof Ai||n.content.type instanceof Bt&&e.has(n.content.type.nodeName))||n.content.type._length===0,M3=({protectedNodes:n=T3,trackedOrigins:e=[],undoManager:t=null}={})=>new ut({key:ur,state:{init:(r,i)=>{const s=st.getState(i),o=t||new R0(s.type,{trackedOrigins:new Set([st].concat(e)),deleteFilter:l=>E3(l,n),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const l=st.getState(o).binding,a=i.undoManager,c=a.undoStack.length>0,u=a.redoStack.length>0;return l?{undoManager:a,prevSel:_f(l,s),hasUndoOps:c,hasRedoOps:u}:c!==i.hasUndoOps||u!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):i}},view:r=>{const i=st.getState(r.state),s=ur.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const l=i.binding;l&&o.meta.set(l,ur.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const l=i.binding;l&&(l.beforeTransactionSelection=o.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),O3=Ot.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},onCreate(){this.editor.extensionManager.extensions.find(n=>n.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),ur.getState(e).undoManager.undoStack.length===0?!1:t?_3(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),ur.getState(e).undoManager.redoStack.length===0?!1:t?A3(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){const n=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),e=M3(),t=e.spec.view;e.spec.view=o=>{const{undoManager:l}=ur.getState(o.state);l.restore&&(l.restore(),l.restore=()=>{});const a=t?t(o):void 0;return{destroy:()=>{const c=l.trackedOrigins.has(l),u=l._observers;l.restore=()=>{c&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=u},a!=null&&a.destroy&&a.destroy()}}};const r=this.options.onFirstRender;return[m3(n,r?{onFirstRender:r}:{}),e]}});function $3(n,e){return[e0.configure({history:!1}),O3.configure({document:n.document}),zy.configure({element:e}),qy.configure({openOnClick:!1,autolink:!0}),t0.configure({inline:!0}),Jy.configure({types:["heading","paragraph"]}),Ky]}function N3(n){let e;const t=n[2].default,r=re(t,n,n[3],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8)&&ie(r,t,i,i[3],e?oe(t,i[3],s,null):se(i[3]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function D3(n){let e,t;const r=[{class:_t("text-lg font-semibold leading-none tracking-tight",n[0])},n[1]];let i={$$slots:{default:[N3]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(3,o=a.$$scope)},[l,i,s,o]}class I3 extends fe{constructor(e){super(),de(this,e,x3,D3,ce,{class:0})}}function R3(n){let e;const t=n[1].default,r=re(t,n,n[2],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&4)&&ie(r,t,i,i[2],e?oe(t,i[2],s,null):se(i[2]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function P3(n){let e,t;const r=[n[0]];let i={$$slots:{default:[R3]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(l)),t(0,i=Te(e,r)),"$$scope"in l&&t(2,o=l.$$scope)},[i,s,o]}class B3 extends fe{constructor(e){super(),de(this,e,L3,P3,ce,{})}}function F3(n){let e,t,r;const i=n[3].default,s=re(i,n,n[2],null);let o=[{class:t=_t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n[0])},n[1]],l={};for(let a=0;a{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(2,o=a.$$scope)},[l,i,o,s]}class V3 extends fe{constructor(e){super(),de(this,e,z3,F3,ce,{class:0})}}function H3(n){let e,t,r;const i=n[3].default,s=re(i,n,n[2],null);let o=[{class:t=_t("flex flex-col space-y-1.5 text-center sm:text-left",n[0])},n[1]],l={};for(let a=0;a{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(2,o=a.$$scope)},[l,i,o,s]}class j3 extends fe{constructor(e){super(),de(this,e,U3,H3,ce,{class:0})}}function W3(n,{delay:e=0,duration:t=400,easing:r=x1}={}){const i=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:r,css:s=>`opacity: ${s*i}`}}function q3(n){let e,t;const r=[{transition:n[1]},{transitionConfig:n[2]},{class:_t("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",n[0])},n[3]];let i={};for(let s=0;s{e=T(T({},e),J(a)),t(3,i=Te(e,r)),"class"in a&&t(0,s=a.class),"transition"in a&&t(1,o=a.transition),"transitionConfig"in a&&t(2,l=a.transitionConfig)},[s,o,l,i]}class J3 extends fe{constructor(e){super(),de(this,e,K3,q3,ce,{class:0,transition:1,transitionConfig:2})}}function G3(n){let e,t,r,i="Close",s;return e=new x2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment),t=ve(),r=Fe("span"),r.textContent=i,this.h()},l(o){I(e.$$.fragment,o),t=we(o),r=ze(o,"SPAN",{class:!0,"data-svelte-h":!0}),I1(r)!=="svelte-1pewzs3"&&(r.textContent=i),this.h()},h(){Ir(r,"class","sr-only")},m(o,l){R(e,o,l),ne(o,t,l),ne(o,r,l),s=!0},p:Oe,i(o){s||(k(e.$$.fragment,o),s=!0)},o(o){S(e.$$.fragment,o),s=!1},d(o){o&&(j(t),j(r)),P(e,o)}}}function Y3(n){let e,t,r;const i=n[4].default,s=re(i,n,n[5],null);return t=new hA({props:{class:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",$$slots:{default:[G3]},$$scope:{ctx:n}}}),{c(){s&&s.c(),e=ve(),x(t.$$.fragment)},l(o){s&&s.l(o),e=we(o),I(t.$$.fragment,o)},m(o,l){s&&s.m(o,l),ne(o,e,l),R(t,o,l),r=!0},p(o,l){s&&s.p&&(!r||l&32)&&ie(s,i,o,o[5],r?oe(i,o[5],l,null):se(o[5]),null);const a={};l&32&&(a.$$scope={dirty:l,ctx:o}),t.$set(a)},i(o){r||(k(s,o),k(t.$$.fragment,o),r=!0)},o(o){S(s,o),S(t.$$.fragment,o),r=!1},d(o){o&&j(e),s&&s.d(o),P(t,o)}}}function X3(n){let e,t,r,i;e=new J3({});const s=[{transition:n[1]},{transitionConfig:n[2]},{class:_t("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 sm:rounded-lg md:w-full",n[0])},n[3]];let o={$$slots:{default:[Y3]},$$scope:{ctx:n}};for(let l=0;l{e=T(T({},e),J(u)),t(3,i=Te(e,r)),"class"in u&&t(0,l=u.class),"transition"in u&&t(1,a=u.transition),"transitionConfig"in u&&t(2,c=u.transitionConfig),"$$scope"in u&&t(5,o=u.$$scope)},[l,a,c,i,s,o]}class eP extends fe{constructor(e){super(),de(this,e,Z3,Q3,ce,{class:0,transition:1,transitionConfig:2})}}function tP(n){let e;const t=n[2].default,r=re(t,n,n[3],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&8)&&ie(r,t,i,i[3],e?oe(t,i[3],s,null):se(i[3]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function nP(n){let e,t;const r=[{class:_t("text-sm text-muted-foreground",n[0])},n[1]];let i={$$slots:{default:[tP]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(a)),t(1,i=Te(e,r)),"class"in a&&t(0,l=a.class),"$$scope"in a&&t(3,o=a.$$scope)},[l,i,s,o]}class iP extends fe{constructor(e){super(),de(this,e,rP,nP,ce,{class:0})}}const sP=Z_,oP=QA;function lP(n){let e;const t=n[2].default,r=re(t,n,n[4],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16)&&ie(r,t,i,i[4],e?oe(t,i[4],s,null):se(i[4]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function aP(n){let e,t;const r=[{class:_t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",n[0])},n[1]];let i={$$slots:{default:[lP]},$$scope:{ctx:n}};for(let s=0;s{e=T(T({},e),J(c)),t(1,i=Te(e,r)),"class"in c&&t(0,l=c.class),"$$scope"in c&&t(4,o=c.$$scope)},[l,i,s,a,o]}class fg extends fe{constructor(e){super(),de(this,e,cP,aP,ce,{class:0})}}function uP(n){let e,t,r,i,s=[{class:t=_t("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",n[1])},{readOnly:n[2]},n[3]],o={};for(let l=0;l{e=T(T({},e),J(F)),t(3,i=Te(e,r)),"class"in F&&t(1,s=F.class),"value"in F&&t(0,o=F.value),"readonly"in F&&t(2,l=F.readonly)},[o,s,l,i,a,c,u,f,d,h,p,m,g,b,C,E,v,H,_,B]}class dg extends fe{constructor(e){super(),de(this,e,fP,uP,ce,{class:1,value:0,readonly:2})}}function hg(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b,C,E,v,H,_,B,F,M,X,$,y,w,O,L,A,z,q,Y,te,ge,ye,me,Ke,Be,Ze,Qe,W,ft,Ht,dt,In,Ee,Yt,ht,Ve,Je,ln,Ut,Xt,pt,Rn,yn,pr;return r=new Le({props:{class:"mr-0.5 h-8 px-2",$$slots:{default:[dP]},$$scope:{ctx:n}}}),r.$on("click",n[7]),s=new Le({props:{disabled:!n[1].can().chain().focus().toggleBold().run(),variant:n[1].isActive("bold")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[hP]},$$scope:{ctx:n}}}),s.$on("click",n[8]),l=new Le({props:{disabled:!n[1].can().chain().focus().toggleItalic().run(),variant:n[1].isActive("italic")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[pP]},$$scope:{ctx:n}}}),l.$on("click",n[9]),c=new Le({props:{disabled:!n[1].can().chain().focus().toggleStrike().run(),variant:n[1].isActive("strike")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[mP]},$$scope:{ctx:n}}}),c.$on("click",n[10]),f=new Le({props:{disabled:!n[1].can().chain().focus().toggleCode().run(),variant:n[1].isActive("code")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[gP]},$$scope:{ctx:n}}}),f.$on("click",n[11]),h=new Le({props:{variant:n[1].isActive("paragraph")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[bP]},$$scope:{ctx:n}}}),h.$on("click",n[12]),m=new Le({props:{variant:n[1].isActive("heading",{level:1})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[yP]},$$scope:{ctx:n}}}),m.$on("click",n[13]),b=new Le({props:{variant:n[1].isActive("heading",{level:2})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[vP]},$$scope:{ctx:n}}}),b.$on("click",n[14]),E=new Le({props:{variant:n[1].isActive("heading",{level:3})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[wP]},$$scope:{ctx:n}}}),E.$on("click",n[15]),H=new Le({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"left"})?"default":"secondary",$$slots:{default:[kP]},$$scope:{ctx:n}}}),H.$on("click",n[16]),B=new Le({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"center"})?"default":"secondary",$$slots:{default:[SP]},$$scope:{ctx:n}}}),B.$on("click",n[17]),M=new Le({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"right"})?"default":"secondary",$$slots:{default:[CP]},$$scope:{ctx:n}}}),M.$on("click",n[18]),$=new Le({props:{variant:n[1].isActive("bulletList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[_P]},$$scope:{ctx:n}}}),$.$on("click",n[19]),w=new Le({props:{variant:n[1].isActive("orderedList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[AP]},$$scope:{ctx:n}}}),w.$on("click",n[20]),L=new Le({props:{variant:n[1].isActive("codeBlock")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[TP]},$$scope:{ctx:n}}}),L.$on("click",n[21]),z=new Le({props:{variant:n[1].isActive("blockquote")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[EP]},$$scope:{ctx:n}}}),z.$on("click",n[22]),Y=new Le({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[MP]},$$scope:{ctx:n}}}),Y.$on("click",n[23]),ge=new Le({props:{variant:n[1].isActive("link")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[OP]},$$scope:{ctx:n}}}),ge.$on("click",n[24]),me=new Le({props:{disabled:!n[1].isActive("link"),class:"mx-0.5 h-8 px-2",$$slots:{default:[$P]},$$scope:{ctx:n}}}),me.$on("click",n[25]),Be=new Le({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[NP]},$$scope:{ctx:n}}}),Be.$on("click",n[26]),Qe=new Le({props:{disabled:!n[1].can().chain().focus().undo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[DP]},$$scope:{ctx:n}}}),Qe.$on("click",n[27]),ft=new Le({props:{disabled:!n[1].can().chain().focus().redo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[xP]},$$scope:{ctx:n}}}),ft.$on("click",n[28]),dt=new Le({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[IP]},$$scope:{ctx:n}}}),dt.$on("click",n[29]),ht=new Le({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[RP]},$$scope:{ctx:n}}}),ht.$on("click",n[32]),Je=new sP({props:{closeOnOutsideClick:!1,$$slots:{default:[qP]},$$scope:{ctx:n}}}),Ut=new Le({props:{disabled:!n[4],class:"mx-0.5 h-8 px-2",$$slots:{default:[KP]},$$scope:{ctx:n}}}),Ut.$on("click",n[38]),pt=new Le({props:{class:"ml-0.5 h-8 px-2",$$slots:{default:[JP]},$$scope:{ctx:n}}}),pt.$on("click",L1),{c(){e=Fe("div"),t=Fe("nav"),x(r.$$.fragment),i=ve(),x(s.$$.fragment),o=ve(),x(l.$$.fragment),a=ve(),x(c.$$.fragment),u=ve(),x(f.$$.fragment),d=ve(),x(h.$$.fragment),p=ve(),x(m.$$.fragment),g=ve(),x(b.$$.fragment),C=ve(),x(E.$$.fragment),v=ve(),x(H.$$.fragment),_=ve(),x(B.$$.fragment),F=ve(),x(M.$$.fragment),X=ve(),x($.$$.fragment),y=ve(),x(w.$$.fragment),O=ve(),x(L.$$.fragment),A=ve(),x(z.$$.fragment),q=ve(),x(Y.$$.fragment),te=ve(),x(ge.$$.fragment),ye=ve(),x(me.$$.fragment),Ke=ve(),x(Be.$$.fragment),Ze=ve(),x(Qe.$$.fragment),W=ve(),x(ft.$$.fragment),Ht=ve(),x(dt.$$.fragment),In=ve(),Ee=Fe("input"),Yt=ve(),x(ht.$$.fragment),Ve=ve(),x(Je.$$.fragment),ln=ve(),x(Ut.$$.fragment),Xt=ve(),x(pt.$$.fragment),this.h()},l(D){e=ze(D,"DIV",{});var U=He(e);t=ze(U,"NAV",{class:!0});var Q=He(t);I(r.$$.fragment,Q),i=we(Q),I(s.$$.fragment,Q),o=we(Q),I(l.$$.fragment,Q),a=we(Q),I(c.$$.fragment,Q),u=we(Q),I(f.$$.fragment,Q),d=we(Q),I(h.$$.fragment,Q),p=we(Q),I(m.$$.fragment,Q),g=we(Q),I(b.$$.fragment,Q),C=we(Q),I(E.$$.fragment,Q),v=we(Q),I(H.$$.fragment,Q),_=we(Q),I(B.$$.fragment,Q),F=we(Q),I(M.$$.fragment,Q),X=we(Q),I($.$$.fragment,Q),y=we(Q),I(w.$$.fragment,Q),O=we(Q),I(L.$$.fragment,Q),A=we(Q),I(z.$$.fragment,Q),q=we(Q),I(Y.$$.fragment,Q),te=we(Q),I(ge.$$.fragment,Q),ye=we(Q),I(me.$$.fragment,Q),Ke=we(Q),I(Be.$$.fragment,Q),Ze=we(Q),I(Qe.$$.fragment,Q),W=we(Q),I(ft.$$.fragment,Q),Ht=we(Q),I(dt.$$.fragment,Q),In=we(Q),Ee=ze(Q,"INPUT",{type:!0,id:!0,style:!0}),Yt=we(Q),I(ht.$$.fragment,Q),Ve=we(Q),I(Je.$$.fragment,Q),ln=we(Q),I(Ut.$$.fragment,Q),Xt=we(Q),I(pt.$$.fragment,Q),Q.forEach(j),U.forEach(j),this.h()},h(){Ir(Ee,"type","file"),Ir(Ee,"id","selectedFile"),P1(Ee,"display","none"),Ir(t,"class","fixed left-0 top-0 z-10 flex w-full flex-row justify-start overflow-x-auto bg-white p-4 dark:bg-[color:hsl(240,10%,3.9%)] lg:justify-center")},m(D,U){ne(D,e,U),Ie(e,t),R(r,t,null),Ie(t,i),R(s,t,null),Ie(t,o),R(l,t,null),Ie(t,a),R(c,t,null),Ie(t,u),R(f,t,null),Ie(t,d),R(h,t,null),Ie(t,p),R(m,t,null),Ie(t,g),R(b,t,null),Ie(t,C),R(E,t,null),Ie(t,v),R(H,t,null),Ie(t,_),R(B,t,null),Ie(t,F),R(M,t,null),Ie(t,X),R($,t,null),Ie(t,y),R(w,t,null),Ie(t,O),R(L,t,null),Ie(t,A),R(z,t,null),Ie(t,q),R(Y,t,null),Ie(t,te),R(ge,t,null),Ie(t,ye),R(me,t,null),Ie(t,Ke),R(Be,t,null),Ie(t,Ze),R(Qe,t,null),Ie(t,W),R(ft,t,null),Ie(t,Ht),R(dt,t,null),Ie(t,In),Ie(t,Ee),Ie(t,Yt),R(ht,t,null),Ie(t,Ve),R(Je,t,null),Ie(t,ln),R(Ut,t,null),Ie(t,Xt),R(pt,t,null),Rn=!0,yn||(pr=[ae(Ee,"change",n[30]),ae(Ee,"change",n[31])],yn=!0)},p(D,U){const Q={};U[1]&32768&&(Q.$$scope={dirty:U,ctx:D}),r.$set(Q);const er={};U[0]&2&&(er.disabled=!D[1].can().chain().focus().toggleBold().run()),U[0]&2&&(er.variant=D[1].isActive("bold")?"default":"secondary"),U[1]&32768&&(er.$$scope={dirty:U,ctx:D}),s.$set(er);const Di={};U[0]&2&&(Di.disabled=!D[1].can().chain().focus().toggleItalic().run()),U[0]&2&&(Di.variant=D[1].isActive("italic")?"default":"secondary"),U[1]&32768&&(Di.$$scope={dirty:U,ctx:D}),l.$set(Di);const xi={};U[0]&2&&(xi.disabled=!D[1].can().chain().focus().toggleStrike().run()),U[0]&2&&(xi.variant=D[1].isActive("strike")?"default":"secondary"),U[1]&32768&&(xi.$$scope={dirty:U,ctx:D}),c.$set(xi);const Ii={};U[0]&2&&(Ii.disabled=!D[1].can().chain().focus().toggleCode().run()),U[0]&2&&(Ii.variant=D[1].isActive("code")?"default":"secondary"),U[1]&32768&&(Ii.$$scope={dirty:U,ctx:D}),f.$set(Ii);const $s={};U[0]&2&&($s.variant=D[1].isActive("paragraph")?"default":"secondary"),U[1]&32768&&($s.$$scope={dirty:U,ctx:D}),h.$set($s);const Ns={};U[0]&2&&(Ns.variant=D[1].isActive("heading",{level:1})?"default":"secondary"),U[1]&32768&&(Ns.$$scope={dirty:U,ctx:D}),m.$set(Ns);const N={};U[0]&2&&(N.variant=D[1].isActive("heading",{level:2})?"default":"secondary"),U[1]&32768&&(N.$$scope={dirty:U,ctx:D}),b.$set(N);const Z={};U[0]&2&&(Z.variant=D[1].isActive("heading",{level:3})?"default":"secondary"),U[1]&32768&&(Z.$$scope={dirty:U,ctx:D}),E.$set(Z);const he={};U[0]&2&&(he.variant=D[1].isActive({textAlign:"left"})?"default":"secondary"),U[1]&32768&&(he.$$scope={dirty:U,ctx:D}),H.$set(he);const Pe={};U[0]&2&&(Pe.variant=D[1].isActive({textAlign:"center"})?"default":"secondary"),U[1]&32768&&(Pe.$$scope={dirty:U,ctx:D}),B.$set(Pe);const $e={};U[0]&2&&($e.variant=D[1].isActive({textAlign:"right"})?"default":"secondary"),U[1]&32768&&($e.$$scope={dirty:U,ctx:D}),M.$set($e);const ct={};U[0]&2&&(ct.variant=D[1].isActive("bulletList")?"default":"secondary"),U[1]&32768&&(ct.$$scope={dirty:U,ctx:D}),$.$set(ct);const xt={};U[0]&2&&(xt.variant=D[1].isActive("orderedList")?"default":"secondary"),U[1]&32768&&(xt.$$scope={dirty:U,ctx:D}),w.$set(xt);const Pn={};U[0]&2&&(Pn.variant=D[1].isActive("codeBlock")?"default":"secondary"),U[1]&32768&&(Pn.$$scope={dirty:U,ctx:D}),L.$set(Pn);const Ri={};U[0]&2&&(Ri.variant=D[1].isActive("blockquote")?"default":"secondary"),U[1]&32768&&(Ri.$$scope={dirty:U,ctx:D}),z.$set(Ri);const Ln={};U[1]&32768&&(Ln.$$scope={dirty:U,ctx:D}),Y.$set(Ln);const Jr={};U[0]&2&&(Jr.variant=D[1].isActive("link")?"default":"secondary"),U[1]&32768&&(Jr.$$scope={dirty:U,ctx:D}),ge.$set(Jr);const mr={};U[0]&2&&(mr.disabled=!D[1].isActive("link")),U[1]&32768&&(mr.$$scope={dirty:U,ctx:D}),me.$set(mr);const tr={};U[1]&32768&&(tr.$$scope={dirty:U,ctx:D}),Be.$set(tr);const Ds={};U[0]&2&&(Ds.disabled=!D[1].can().chain().focus().undo().run()),U[1]&32768&&(Ds.$$scope={dirty:U,ctx:D}),Qe.$set(Ds);const Gr={};U[0]&2&&(Gr.disabled=!D[1].can().chain().focus().redo().run()),U[1]&32768&&(Gr.$$scope={dirty:U,ctx:D}),ft.$set(Gr);const Yr={};U[1]&32768&&(Yr.$$scope={dirty:U,ctx:D}),dt.$set(Yr);const jd={};U[1]&32768&&(jd.$$scope={dirty:U,ctx:D}),ht.$set(jd);const Wd={};U[0]&96|U[1]&32768&&(Wd.$$scope={dirty:U,ctx:D}),Je.$set(Wd);const vc={};U[0]&16&&(vc.disabled=!D[4]),U[1]&32768&&(vc.$$scope={dirty:U,ctx:D}),Ut.$set(vc);const qd={};U[1]&32768&&(qd.$$scope={dirty:U,ctx:D}),pt.$set(qd)},i(D){Rn||(k(r.$$.fragment,D),k(s.$$.fragment,D),k(l.$$.fragment,D),k(c.$$.fragment,D),k(f.$$.fragment,D),k(h.$$.fragment,D),k(m.$$.fragment,D),k(b.$$.fragment,D),k(E.$$.fragment,D),k(H.$$.fragment,D),k(B.$$.fragment,D),k(M.$$.fragment,D),k($.$$.fragment,D),k(w.$$.fragment,D),k(L.$$.fragment,D),k(z.$$.fragment,D),k(Y.$$.fragment,D),k(ge.$$.fragment,D),k(me.$$.fragment,D),k(Be.$$.fragment,D),k(Qe.$$.fragment,D),k(ft.$$.fragment,D),k(dt.$$.fragment,D),k(ht.$$.fragment,D),k(Je.$$.fragment,D),k(Ut.$$.fragment,D),k(pt.$$.fragment,D),Rn=!0)},o(D){S(r.$$.fragment,D),S(s.$$.fragment,D),S(l.$$.fragment,D),S(c.$$.fragment,D),S(f.$$.fragment,D),S(h.$$.fragment,D),S(m.$$.fragment,D),S(b.$$.fragment,D),S(E.$$.fragment,D),S(H.$$.fragment,D),S(B.$$.fragment,D),S(M.$$.fragment,D),S($.$$.fragment,D),S(w.$$.fragment,D),S(L.$$.fragment,D),S(z.$$.fragment,D),S(Y.$$.fragment,D),S(ge.$$.fragment,D),S(me.$$.fragment,D),S(Be.$$.fragment,D),S(Qe.$$.fragment,D),S(ft.$$.fragment,D),S(dt.$$.fragment,D),S(ht.$$.fragment,D),S(Je.$$.fragment,D),S(Ut.$$.fragment,D),S(pt.$$.fragment,D),Rn=!1},d(D){D&&j(e),P(r),P(s),P(l),P(c),P(f),P(h),P(m),P(b),P(E),P(H),P(B),P(M),P($),P(w),P(L),P(z),P(Y),P(ge),P(me),P(Be),P(Qe),P(ft),P(dt),P(ht),P(Je),P(Ut),P(pt),yn=!1,Nt(pr)}}}function dP(n){let e,t;return e=new QE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function hP(n){let e,t;return e=new yy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function pP(n){let e,t;return e=new wy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function mP(n){let e,t;return e=new ky({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function gP(n){let e,t;return e=new vy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function bP(n){let e,t;return e=new QM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function yP(n){let e,t;return e=new bM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function vP(n){let e,t;return e=new kM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function wP(n){let e,t;return e=new AM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function kP(n){let e,t;return e=new VE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function SP(n){let e,t;return e=new LE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function CP(n){let e,t;return e=new WE({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function _P(n){let e,t;return e=new JM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function AP(n){let e,t;return e=new jM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function TP(n){let e,t;return e=new nM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function EP(n){let e,t;return e=new A2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function MP(n){let e,t;return e=new p2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function OP(n){let e,t;return e=new zM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function $P(n){let e,t;return e=new PM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function NP(n){let e,t;return e=new OM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function DP(n){let e,t;return e=new O2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function xP(n){let e,t;return e=new n2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function IP(n){let e,t;return e=new cM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function RP(n){let e,t;return e=new hM({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function PP(n){let e,t;return e=new u2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function LP(n){let e,t;return e=new Le({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[PP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p(r,i){const s={};i[1]&32768&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function BP(n){let e;return{c(){e=Po("Share")},l(t){e=Lo(t,"Share")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function FP(n){let e;return{c(){e=Po("Please input relay server endpoint and workspace name")},l(t){e=Lo(t,"Please input relay server endpoint and workspace name")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function zP(n){let e,t,r,i;return e=new I3({props:{$$slots:{default:[BP]},$$scope:{ctx:n}}}),r=new iP({props:{$$slots:{default:[FP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=ve(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=we(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),ne(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&32768&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[1]&32768&&(a.$$scope={dirty:o,ctx:s}),r.$set(a)},i(s){i||(k(e.$$.fragment,s),k(r.$$.fragment,s),i=!0)},o(s){S(e.$$.fragment,s),S(r.$$.fragment,s),i=!1},d(s){s&&j(t),P(e,s),P(r,s)}}}function VP(n){let e;return{c(){e=Po("Endpoint")},l(t){e=Lo(t,"Endpoint")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function HP(n){let e;return{c(){e=Po("Workspace")},l(t){e=Lo(t,"Workspace")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function UP(n){let e;return{c(){e=Po("Connect")},l(t){e=Lo(t,"Connect")},m(t,r){ne(t,e,r)},d(t){t&&j(e)}}}function jP(n){let e,t;return e=new Le({props:{class:"w-full",variant:"outline",$$slots:{default:[UP]},$$scope:{ctx:n}}}),e.$on("click",n[37]),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p(r,i){const s={};i[1]&32768&&(s.$$scope={dirty:i,ctx:r}),e.$set(s)},i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function WP(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;e=new j3({props:{$$slots:{default:[zP]},$$scope:{ctx:n}}}),s=new fg({props:{for:"endpoint",class:"text-left",$$slots:{default:[VP]},$$scope:{ctx:n}}});function C(_){n[33](_)}let E={id:"endpoint",placeholder:"ws://localhost:1234",class:"col-span-3"};n[5]!==void 0&&(E.value=n[5]),l=new dg({props:E}),rt.push(()=>Gd(l,"value",C)),l.$on("keydown",n[34]),f=new fg({props:{for:"workspace",class:"text-left",$$slots:{default:[HP]},$$scope:{ctx:n}}});function v(_){n[35](_)}let H={id:"workspace",placeholder:"workspace",class:"col-span-3"};return n[6]!==void 0&&(H.value=n[6]),h=new dg({props:H}),rt.push(()=>Gd(h,"value",v)),h.$on("keydown",n[36]),g=new V3({props:{$$slots:{default:[jP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=ve(),r=Fe("div"),i=Fe("div"),x(s.$$.fragment),o=ve(),x(l.$$.fragment),c=ve(),u=Fe("div"),x(f.$$.fragment),d=ve(),x(h.$$.fragment),m=ve(),x(g.$$.fragment),this.h()},l(_){I(e.$$.fragment,_),t=we(_),r=ze(_,"DIV",{class:!0});var B=He(r);i=ze(B,"DIV",{class:!0});var F=He(i);I(s.$$.fragment,F),o=we(F),I(l.$$.fragment,F),F.forEach(j),c=we(B),u=ze(B,"DIV",{class:!0});var M=He(u);I(f.$$.fragment,M),d=we(M),I(h.$$.fragment,M),M.forEach(j),B.forEach(j),m=we(_),I(g.$$.fragment,_),this.h()},h(){Ir(i,"class","grid grid-cols-4 items-center gap-4"),Ir(u,"class","grid grid-cols-4 items-center gap-4"),Ir(r,"class","grid gap-4 py-4")},m(_,B){R(e,_,B),ne(_,t,B),ne(_,r,B),Ie(r,i),R(s,i,null),Ie(i,o),R(l,i,null),Ie(r,c),Ie(r,u),R(f,u,null),Ie(u,d),R(h,u,null),ne(_,m,B),R(g,_,B),b=!0},p(_,B){const F={};B[1]&32768&&(F.$$scope={dirty:B,ctx:_}),e.$set(F);const M={};B[1]&32768&&(M.$$scope={dirty:B,ctx:_}),s.$set(M);const X={};!a&&B[0]&32&&(a=!0,X.value=_[5],Jd(()=>a=!1)),l.$set(X);const $={};B[1]&32768&&($.$$scope={dirty:B,ctx:_}),f.$set($);const y={};!p&&B[0]&64&&(p=!0,y.value=_[6],Jd(()=>p=!1)),h.$set(y);const w={};B[0]&96|B[1]&32768&&(w.$$scope={dirty:B,ctx:_}),g.$set(w)},i(_){b||(k(e.$$.fragment,_),k(s.$$.fragment,_),k(l.$$.fragment,_),k(f.$$.fragment,_),k(h.$$.fragment,_),k(g.$$.fragment,_),b=!0)},o(_){S(e.$$.fragment,_),S(s.$$.fragment,_),S(l.$$.fragment,_),S(f.$$.fragment,_),S(h.$$.fragment,_),S(g.$$.fragment,_),b=!1},d(_){_&&(j(t),j(r),j(m)),P(e,_),P(s),P(l),P(f),P(h),P(g,_)}}}function qP(n){let e,t,r,i;return e=new oP({props:{$$slots:{default:[LP]},$$scope:{ctx:n}}}),r=new eP({props:{class:"sm:max-w-[425px]",$$slots:{default:[WP]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=ve(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=we(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),ne(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&32768&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[0]&96|o[1]&32768&&(a.$$scope={dirty:o,ctx:s}),r.$set(a)},i(s){i||(k(e.$$.fragment,s),k(r.$$.fragment,s),i=!0)},o(s){S(e.$$.fragment,s),S(r.$$.fragment,s),i=!1},d(s){s&&j(t),P(e,s),P(r,s)}}}function KP(n){let e,t;return e=new o2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function JP(n){let e,t;return e=new k2({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function pg(n){let e,t,r,i,s,o,l,a;return e=new Le({props:{variant:n[1].isActive("bold")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[GP]},$$scope:{ctx:n}}}),e.$on("click",n[39]),r=new Le({props:{variant:n[1].isActive("italic")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[YP]},$$scope:{ctx:n}}}),r.$on("click",n[40]),s=new Le({props:{variant:n[1].isActive("strike")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[XP]},$$scope:{ctx:n}}}),s.$on("click",n[41]),l=new Le({props:{variant:n[1].isActive("code")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[QP]},$$scope:{ctx:n}}}),l.$on("click",n[42]),{c(){x(e.$$.fragment),t=ve(),x(r.$$.fragment),i=ve(),x(s.$$.fragment),o=ve(),x(l.$$.fragment)},l(c){I(e.$$.fragment,c),t=we(c),I(r.$$.fragment,c),i=we(c),I(s.$$.fragment,c),o=we(c),I(l.$$.fragment,c)},m(c,u){R(e,c,u),ne(c,t,u),R(r,c,u),ne(c,i,u),R(s,c,u),ne(c,o,u),R(l,c,u),a=!0},p(c,u){const f={};u[0]&2&&(f.variant=c[1].isActive("bold")?"default":"secondary"),u[1]&32768&&(f.$$scope={dirty:u,ctx:c}),e.$set(f);const d={};u[0]&2&&(d.variant=c[1].isActive("italic")?"default":"secondary"),u[1]&32768&&(d.$$scope={dirty:u,ctx:c}),r.$set(d);const h={};u[0]&2&&(h.variant=c[1].isActive("strike")?"default":"secondary"),u[1]&32768&&(h.$$scope={dirty:u,ctx:c}),s.$set(h);const p={};u[0]&2&&(p.variant=c[1].isActive("code")?"default":"secondary"),u[1]&32768&&(p.$$scope={dirty:u,ctx:c}),l.$set(p)},i(c){a||(k(e.$$.fragment,c),k(r.$$.fragment,c),k(s.$$.fragment,c),k(l.$$.fragment,c),a=!0)},o(c){S(e.$$.fragment,c),S(r.$$.fragment,c),S(s.$$.fragment,c),S(l.$$.fragment,c),a=!1},d(c){c&&(j(t),j(i),j(o)),P(e,c),P(r,c),P(s,c),P(l,c)}}}function GP(n){let e,t;return e=new yy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function YP(n){let e,t;return e=new wy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function XP(n){let e,t;return e=new ky({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function QP(n){let e,t;return e=new vy({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment)},l(r){I(e.$$.fragment,r)},m(r,i){R(e,r,i),t=!0},p:Oe,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function ZP(n){let e,t,r,i,s,o=n[1]&&hg(n),l=n[1]&&pg(n);return{c(){o&&o.c(),e=ve(),t=Fe("div"),l&&l.c(),r=ve(),i=Fe("div"),this.h()},l(a){o&&o.l(a),e=we(a),t=ze(a,"DIV",{class:!0});var c=He(t);l&&l.l(c),c.forEach(j),r=we(a),i=ze(a,"DIV",{}),He(i).forEach(j),this.h()},h(){Ir(t,"class","bubble-menu rounded-md")},m(a,c){o&&o.m(a,c),ne(a,e,c),ne(a,t,c),l&&l.m(t,null),n[43](t),ne(a,r,c),ne(a,i,c),n[44](i),s=!0},p(a,c){a[1]?o?(o.p(a,c),c[0]&2&&k(o,1)):(o=hg(a),o.c(),k(o,1),o.m(e.parentNode,e)):o&&(En(),S(o,1,1,()=>{o=null}),Mn()),a[1]?l?(l.p(a,c),c[0]&2&&k(l,1)):(l=pg(a),l.c(),k(l,1),l.m(t,null)):l&&(En(),S(l,1,1,()=>{l=null}),Mn())},i(a){s||(k(o),k(l),s=!0)},o(a){S(o),S(l),s=!1},d(a){a&&(j(e),j(t),j(r),j(i)),o&&o.d(a),l&&l.d(),n[43](null),n[44](null)}}}function eL(n,e,t){let r,i,s,o,l="",a,c,u;R1(async()=>{const Ee=new URLSearchParams(window.location.search);if(Ee.has("endpoint")&&Ee.has("workspace")){const Ve=Ee.get("endpoint"),Je=Ee.get("workspace");localStorage.setItem("sharing",JSON.stringify({endpoint:Ve,workspace:Je})),localStorage.setItem("shared",JSON.stringify({endpoint:Ve,workspace:Je}))}const Yt=localStorage.getItem("sharing");let ht;if(Yt)try{const{endpoint:Ve,workspace:Je}=JSON.parse(Yt);if(!Ve)throw new Error("Invalid endpoint",{cause:"InvalidMetadata"});if(!Je)throw new Error("Invalid workspace",{cause:"InvalidMetadata"});t(5,c=Ve),t(6,u=Je);const ln=new v1({url:Ve,maxAttempts:1});t(4,a=new l3({websocketProvider:ln,name:Je,onConnect(){window.alert(`Connected to ${Ve}/${Je}`)},onClose(){window.alert(`Failed to connect with ${Ve}/${Je}`),localStorage.removeItem("sharing"),location.reload()},connect:!1})),await a.connect(),ht=$3(a,s)}catch(Ve){Ve instanceof Error&&Ve.cause==="InvalidMetadata"?window.alert(`Failed to start sharing with ${Yt}: ${Ve.toString()}`):window.alert(`Failed to start sharing with ${Yt}`),console.error(Ve),localStorage.removeItem("sharing"),location.reload()}else{try{const Ve=localStorage.getItem("shared");if(Ve){const{endpoint:Je,workspace:ln}=JSON.parse(Ve);t(5,c=Je),t(6,u=ln)}else t(5,c=""),t(6,u="")}catch(Ve){t(5,c=""),t(6,u=""),console.error(Ve)}ht=VN(s),l=localStorage.getItem("auto-saved")??I2}t(1,i=new RC({element:r,editorProps:{attributes:{class:"mt-16 md:w-[708px] md:py-8 md:px-0 md:mx-auto p-4 outline-none"}},extensions:ht,onUpdate({editor:Ve}){try{localStorage.setItem("auto-saved",Ve.getHTML())}catch(Je){console.error(Je)}},content:l,onTransaction:()=>{t(1,i)}})),i.commands.focus()});const f=()=>F2(i),d=()=>i.chain().focus().toggleBold().run(),h=()=>i.chain().focus().toggleItalic().run(),p=()=>i.chain().focus().toggleStrike().run(),m=()=>i.chain().focus().toggleCode().run(),g=()=>i.chain().focus().setParagraph().run(),b=()=>i.chain().focus().toggleHeading({level:1}).run(),C=()=>i.chain().focus().toggleHeading({level:2}).run(),E=()=>i.chain().focus().toggleHeading({level:3}).run(),v=()=>i.chain().focus().setTextAlign("left").run(),H=()=>i.chain().focus().setTextAlign("center").run(),_=()=>i.chain().focus().setTextAlign("right").run(),B=()=>i.chain().focus().toggleBulletList().run(),F=()=>i.chain().focus().toggleOrderedList().run(),M=()=>i.chain().focus().toggleCodeBlock().run(),X=()=>i.chain().focus().toggleBlockquote().run(),$=()=>i.chain().focus().setHorizontalRule().run(),y=()=>B2(i),w=()=>i.chain().focus().unsetLink().run(),O=()=>z2(i),L=()=>i.chain().focus().undo().run(),A=()=>i.chain().focus().redo().run(),z=()=>P2(i);function q(){o=this.files,t(3,o)}const Y=()=>L2(i,o),te=()=>{var Ee;return(Ee=document.getElementById("selectedFile"))==null?void 0:Ee.click()};function ge(Ee){c=Ee,t(5,c)}const ye=Ee=>{Ee.code==="Enter"&&(Ee.preventDefault(),Gc(c,u))};function me(Ee){u=Ee,t(6,u)}const Ke=Ee=>{Ee.code==="Enter"&&(Ee.preventDefault(),Gc(c,u))},Be=()=>Gc(c,u),Ze=()=>V2(a),Qe=()=>i.chain().focus().toggleBold().run(),W=()=>i.chain().focus().toggleItalic().run(),ft=()=>i.chain().focus().toggleStrike().run(),Ht=()=>i.chain().focus().toggleCode().run();function dt(Ee){rt[Ee?"unshift":"push"](()=>{s=Ee,t(2,s)})}function In(Ee){rt[Ee?"unshift":"push"](()=>{r=Ee,t(0,r)})}return[r,i,s,o,a,c,u,f,d,h,p,m,g,b,C,E,v,H,_,B,F,M,X,$,y,w,O,L,A,z,q,Y,te,ge,ye,me,Ke,Be,Ze,Qe,W,ft,Ht,dt,In]}class tL extends fe{constructor(e){super(),de(this,e,eL,ZP,ce,{},null,[-1,-1])}}function nL(n){let e,t,r;return t=new tL({}),{c(){e=Fe("main"),x(t.$$.fragment)},l(i){e=ze(i,"MAIN",{});var s=He(e);I(t.$$.fragment,s),s.forEach(j)},m(i,s){ne(i,e,s),R(t,e,null),r=!0},p:Oe,i(i){r||(k(t.$$.fragment,i),r=!0)},o(i){S(t.$$.fragment,i),r=!1},d(i){i&&j(e),P(t)}}}class CL extends fe{constructor(e){super(),de(this,e,null,nL,ce,{})}}export{CL as component}; diff --git a/_app/version.json b/_app/version.json index 8b6db5c..673ed99 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1721141985451"} \ No newline at end of file +{"version":"1721143806325"} \ No newline at end of file diff --git a/index.html b/index.html index b75b926..64ef7df 100644 --- a/index.html +++ b/index.html @@ -10,15 +10,15 @@ - - + + - + -