diff --git a/_app/immutable/assets/2.CEMiwHi2.css b/_app/immutable/assets/2.DKJ6_X0v.css similarity index 72% rename from _app/immutable/assets/2.CEMiwHi2.css rename to _app/immutable/assets/2.DKJ6_X0v.css index 96ddc90..d2dcef4 100644 --- a/_app/immutable/assets/2.CEMiwHi2.css +++ b/_app/immutable/assets/2.DKJ6_X0v.css @@ -1 +1 @@ -.tiptap>*+*{margin-top:.75em}.tiptap h1{display:block;font-size:2em;margin:.67em 0;font-weight:700}.tiptap h2{display:block;font-size:1.5em;margin:.83em 0;font-weight:700}.tiptap h3{display:block;font-size:1.17em;margin:1em 0;font-weight:700}.tiptap p{display:block;margin:1em 0}.tiptap ul{display:block;list-style-type:disc;margin-top:1em;margin-bottom:1 em;margin-left:0;margin-right:0;padding-left:40px}.tiptap ol{display:block;list-style-type:decimal;margin:1em 0;padding-left:40px}.tiptap code{font-family:monospace;background-color:#6161611a;color:#dc143c}.tiptap pre{display:block;font-family:monospace;white-space:pre-wrap;background:#6161611a;color:#616161;margin:1em 0;padding:1rem}.tiptap pre code{color:inherit;padding:0;background:none}.tiptap img{display:inline-block;height:auto;max-width:100%}.tiptap blockquote{padding-left:1rem;border-left:2px solid #616161}.tiptap hr{display:block;margin:.5em auto;border-style:inset;border-width:1px;border-color:#616161}.tiptap a:link{text-decoration:underline;cursor:auto}.tiptap p.is-editor-empty:first-child:before{color:#adb5bd;content:attr(data-placeholder);float:left;height:0;pointer-events:none}.bubble-menu{display:flex;background-color:hsl(var(--secondary)/var(--tw-bg-opacity))}.dark .tiptap pre{color:#fff} +.tiptap>*+*{margin-top:.75em}.tiptap h1{display:block;font-size:2em;margin:.67em 0;font-weight:700}.tiptap h2{display:block;font-size:1.5em;margin:.83em 0;font-weight:700}.tiptap h3{display:block;font-size:1.17em;margin:1em 0;font-weight:700}.tiptap p{display:block;margin:1em 0}.tiptap ul{display:block;list-style-type:disc;margin-top:1em;margin-bottom:1 em;margin-left:0;margin-right:0;padding-left:40px}.tiptap ol{display:block;list-style-type:decimal;margin:1em 0;padding-left:40px}.tiptap code{font-family:monospace;background-color:#6161611a;color:#dc143c}.tiptap pre{display:block;font-family:monospace;white-space:pre-wrap;background:#6161611a;color:#616161;margin:1em 0;padding:1rem}.tiptap pre code{color:inherit;padding:0;background:none}.tiptap img{display:inline-block;height:auto;max-width:100%}.tiptap blockquote{padding-left:1rem;border-left:2px solid #616161}.tiptap hr{display:block;margin:.5em auto;border-style:inset;border-width:1px;border-color:#616161}.tiptap a:link{text-decoration:none;color:#1e90ff}.tiptap a:link:hover{text-decoration:underline;cursor:pointer}.tiptap p.is-editor-empty:first-child:before{color:#adb5bd;content:attr(data-placeholder);float:left;height:0;pointer-events:none}.bubble-menu{display:flex;background-color:hsl(var(--secondary)/var(--tw-bg-opacity))}.dark .tiptap pre{color:#fff} diff --git a/_app/immutable/assets/_page.CEMiwHi2.css b/_app/immutable/assets/_page.DKJ6_X0v.css similarity index 72% rename from _app/immutable/assets/_page.CEMiwHi2.css rename to _app/immutable/assets/_page.DKJ6_X0v.css index 96ddc90..d2dcef4 100644 --- a/_app/immutable/assets/_page.CEMiwHi2.css +++ b/_app/immutable/assets/_page.DKJ6_X0v.css @@ -1 +1 @@ -.tiptap>*+*{margin-top:.75em}.tiptap h1{display:block;font-size:2em;margin:.67em 0;font-weight:700}.tiptap h2{display:block;font-size:1.5em;margin:.83em 0;font-weight:700}.tiptap h3{display:block;font-size:1.17em;margin:1em 0;font-weight:700}.tiptap p{display:block;margin:1em 0}.tiptap ul{display:block;list-style-type:disc;margin-top:1em;margin-bottom:1 em;margin-left:0;margin-right:0;padding-left:40px}.tiptap ol{display:block;list-style-type:decimal;margin:1em 0;padding-left:40px}.tiptap code{font-family:monospace;background-color:#6161611a;color:#dc143c}.tiptap pre{display:block;font-family:monospace;white-space:pre-wrap;background:#6161611a;color:#616161;margin:1em 0;padding:1rem}.tiptap pre code{color:inherit;padding:0;background:none}.tiptap img{display:inline-block;height:auto;max-width:100%}.tiptap blockquote{padding-left:1rem;border-left:2px solid #616161}.tiptap hr{display:block;margin:.5em auto;border-style:inset;border-width:1px;border-color:#616161}.tiptap a:link{text-decoration:underline;cursor:auto}.tiptap p.is-editor-empty:first-child:before{color:#adb5bd;content:attr(data-placeholder);float:left;height:0;pointer-events:none}.bubble-menu{display:flex;background-color:hsl(var(--secondary)/var(--tw-bg-opacity))}.dark .tiptap pre{color:#fff} +.tiptap>*+*{margin-top:.75em}.tiptap h1{display:block;font-size:2em;margin:.67em 0;font-weight:700}.tiptap h2{display:block;font-size:1.5em;margin:.83em 0;font-weight:700}.tiptap h3{display:block;font-size:1.17em;margin:1em 0;font-weight:700}.tiptap p{display:block;margin:1em 0}.tiptap ul{display:block;list-style-type:disc;margin-top:1em;margin-bottom:1 em;margin-left:0;margin-right:0;padding-left:40px}.tiptap ol{display:block;list-style-type:decimal;margin:1em 0;padding-left:40px}.tiptap code{font-family:monospace;background-color:#6161611a;color:#dc143c}.tiptap pre{display:block;font-family:monospace;white-space:pre-wrap;background:#6161611a;color:#616161;margin:1em 0;padding:1rem}.tiptap pre code{color:inherit;padding:0;background:none}.tiptap img{display:inline-block;height:auto;max-width:100%}.tiptap blockquote{padding-left:1rem;border-left:2px solid #616161}.tiptap hr{display:block;margin:.5em auto;border-style:inset;border-width:1px;border-color:#616161}.tiptap a:link{text-decoration:none;color:#1e90ff}.tiptap a:link:hover{text-decoration:underline;cursor:pointer}.tiptap p.is-editor-empty:first-child:before{color:#adb5bd;content:attr(data-placeholder);float:left;height:0;pointer-events:none}.bubble-menu{display:flex;background-color:hsl(var(--secondary)/var(--tw-bg-opacity))}.dark .tiptap pre{color:#fff} diff --git a/_app/immutable/chunks/entry.BluMd_RY.js b/_app/immutable/chunks/entry.DOCLaeaS.js similarity index 82% rename from _app/immutable/chunks/entry.BluMd_RY.js rename to _app/immutable/chunks/entry.DOCLaeaS.js index 6be0f65..4ce0fa5 100644 --- a/_app/immutable/chunks/entry.BluMd_RY.js +++ b/_app/immutable/chunks/entry.DOCLaeaS.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 Ot;const P=((Ot=globalThis.__sveltekit_18yj54j)==null?void 0:Ot.base)??"/LightNote";var Dt;const Re=((Dt=globalThis.__sveltekit_18yj54j)==null?void 0:Dt.assets)??P,Ie="1721574121160",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 j(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=j(s,"preload-code")),r===null&&(r=j(s,"preload-data")),n===null&&(n=j(s,"keepfocus")),e===null&&(e=j(s,"noscroll")),o===null&&(o=j(s,"reload")),i===null&&(i=j(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,je=-5,Oe=-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===je)return-1/0;if(o===Oe)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 O=[],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()};O.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 jt({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)?jt({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(){O=O.filter(v=>!w.includes(v))};w.push(p),O.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),O.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))}}O.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"&&q.delete(gt(t)),$t(t,n));const q=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&&q.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(q.size>0){const a=gt(t,e),r=q.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 ke(t){return!/^\([^)]+\)$/.test(t)}function Ee(t){return t.slice(1).split("/").filter(ke)}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_1nk4aqb)==null?void 0:jt.base)??"/LightNote";var Dt;const Re=((Dt=globalThis.__sveltekit_1nk4aqb)==null?void 0:Dt.assets)??P,Ie="1721609464587",Vt="sveltekit:snapshot",Ft="sveltekit:scroll",qt="sveltekit:states",Le="sveltekit:pageurl",D="sveltekit:history",M="sveltekit:navigation",z={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},K=location.origin;function Gt(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 Mt(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=Mt(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=Mt(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 qe(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 Ge(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=[],Me=[];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 G=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[M],S||(S=L=Date.now(),history.replaceState({...history.state,[D]:S,[M]: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:Gt(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={};G.add(n),R={id:t.id,token:n,promise:te({...t,preload:n}).then(e=>(G.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 Et(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 G.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 k=y.branch[v],E=!!(p!=null&&p[0])&&((k==null?void 0:k.loader)!==p[1]||Nt(_,g,h,d,(x=k.server)==null?void 0:x.uses,a));return E&&(_=!0),E});if(l.some(Boolean)){try{u=await re(e,l)}catch(p){const v=await $(p,{url:e,params:a,route:{id:t}});return G.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 k=y.branch[v],E=m==null?void 0:m[v];if((!E||E.type==="skip")&&p[1]===(k==null?void 0:k.loader)&&!Nt(b,g,h,d,(st=k.universal)==null?void 0:st.uses,a))return k;if(b=!0,(E==null?void 0:E.type)==="error")throw E;return kt({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:Et(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,[M]:L+=w,[qt]:i};(o?history.replaceState:history.pushState).call(history,p,"",n),o||Ge(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(Me.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=qe(t);return V.hooks.handleError({error:t,event:n,status:e,message:a})??{message:a}}function Je(t,n={}){return t=Gt(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[qt]??{},s=new URL(e.state[Le]??location.href),c=e.state[M],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,[M]: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)),kt({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:Et(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.CPGM96y9.js b/_app/immutable/entry/app.Ckop7-nd.js similarity index 95% rename from _app/immutable/entry/app.CPGM96y9.js rename to _app/immutable/entry/app.Ckop7-nd.js index 861a648..b8e1de8 100644 --- a/_app/immutable/entry/app.CPGM96y9.js +++ b/_app/immutable/entry/app.Ckop7-nd.js @@ -1,7 +1,7 @@ function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["../nodes/0.C1-CIf8s.js","../chunks/scheduler.COxbwMzl.js","../chunks/index.DiXqLa_v.js","../chunks/mode.C0a2Dozw.js","../chunks/index.C2Jzycuw.js","../assets/0.B3Dy2eec.css","../nodes/1.fkVt32cC.js","../chunks/entry.BluMd_RY.js","../nodes/2.Zw7HdySI.js","../assets/2.CEMiwHi2.css"] + __vite__mapDeps.viteFileDeps = ["../nodes/0.C1-CIf8s.js","../chunks/scheduler.COxbwMzl.js","../chunks/index.DiXqLa_v.js","../chunks/mode.C0a2Dozw.js","../chunks/index.C2Jzycuw.js","../assets/0.B3Dy2eec.css","../nodes/1.DiI3CTM3.js","../chunks/entry.DOCLaeaS.js","../nodes/2.BHrfwx2D.js","../assets/2.DKJ6_X0v.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.C1-CIf8s.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),()=>C(()=>import("../nodes/1.fkVt32cC.js"),__vite__mapDeps([6,1,2,7,4]),import.meta.url),()=>C(()=>import("../nodes/2.Zw7HdySI.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.C1-CIf8s.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),()=>C(()=>import("../nodes/1.DiI3CTM3.js"),__vite__mapDeps([6,1,2,7,4]),import.meta.url),()=>C(()=>import("../nodes/2.BHrfwx2D.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.CRF6KTVq.js b/_app/immutable/entry/start.CRF6KTVq.js new file mode 100644 index 0000000..a963469 --- /dev/null +++ b/_app/immutable/entry/start.CRF6KTVq.js @@ -0,0 +1 @@ +import{a as t}from"../chunks/entry.DOCLaeaS.js";export{t as start}; diff --git a/_app/immutable/entry/start.CxG73acX.js b/_app/immutable/entry/start.CxG73acX.js deleted file mode 100644 index 1a5d294..0000000 --- a/_app/immutable/entry/start.CxG73acX.js +++ /dev/null @@ -1 +0,0 @@ -import{a as t}from"../chunks/entry.BluMd_RY.js";export{t as start}; diff --git a/_app/immutable/nodes/1.fkVt32cC.js b/_app/immutable/nodes/1.DiI3CTM3.js similarity index 93% rename from _app/immutable/nodes/1.fkVt32cC.js rename to _app/immutable/nodes/1.DiI3CTM3.js index 2582f97..6dc31da 100644 --- a/_app/immutable/nodes/1.fkVt32cC.js +++ b/_app/immutable/nodes/1.DiI3CTM3.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.BluMd_RY.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.DOCLaeaS.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.Zw7HdySI.js b/_app/immutable/nodes/2.BHrfwx2D.js similarity index 86% rename from _app/immutable/nodes/2.Zw7HdySI.js rename to _app/immutable/nodes/2.BHrfwx2D.js index 23f9a18..22a1d16 100644 --- a/_app/immutable/nodes/2.Zw7HdySI.js +++ b/_app/immutable/nodes/2.BHrfwx2D.js @@ -206,6 +206,14 @@ https://code0xff.github.io/LightNote?endpoint={porxy_url}&workspace={workspace}< img { max-width: 708px; } + a:link { + text-decoration: none; + color: #1e90ff; + } + a:link:hover { + text-decoration: underline; + cursor: pointer; + } `;function dO(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([fO,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 hO(n,e){e&&(localStorage.setItem("edited",e[0].name),n.commands.setContent(await e[0].text()))}function pO(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 mO(n){n.commands.clearContent(),n.commands.focus()}function gO(n){const e=window.prompt("Please insert image url");!e||e.trim().length===0||n.chain().focus().setImage({src:e}).run()}function Xc(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 bO(n){n&&(window.alert("Disconnecting..."),location.replace(`${location.protocol}//${location.host}${location.pathname}`))}function yO(n){const e=window.prompt("Please insert youtube url");!e||e.trim().length===0||n.commands.setYoutubeVideo({src:e,width:640,height:480})}var Qt="top",bn="bottom",yn="right",Zt="left",id="auto",Vo=[Qt,bn,yn,Zt],fs="start",yo="end",vO="clippingParents",Ly="viewport",zs="popper",wO="reference",em=Vo.reduce(function(n,e){return n.concat([e+"-"+fs,e+"-"+yo])},[]),By=[].concat(Vo,[id]).reduce(function(n,e){return n.concat([e,e+"-"+fs,e+"-"+yo])},[]),kO="beforeRead",SO="read",CO="afterRead",_O="beforeMain",AO="main",TO="afterMain",EO="beforeWrite",MO="write",OO="afterWrite",$O=[kO,SO,CO,_O,AO,TO,EO,MO,OO];function Xn(n){return n?(n.nodeName||"").toLowerCase():null}function an(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Ci(n){var e=an(n).Element;return n instanceof e||n instanceof Element}function mn(n){var e=an(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function sd(n){if(typeof ShadowRoot>"u")return!1;var e=an(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function NO(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];!mn(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 DO(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},{});!mn(i)||!Xn(i)||(Object.assign(i.style,l),Object.keys(s).forEach(function(a){i.removeAttribute(a)}))})}}const Fy={name:"applyStyles",enabled:!0,phase:"write",fn:NO,effect:DO,requires:["computeStyles"]};function Jn(n){return n.split("-")[0]}var pi=Math.max,ea=Math.min,ds=Math.round;function Yu(){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 zy(){return!/^((?!chrome|android).)*safari/i.test(Yu())}function hs(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,s=1;e&&mn(n)&&(i=n.offsetWidth>0&&ds(r.width)/n.offsetWidth||1,s=n.offsetHeight>0&&ds(r.height)/n.offsetHeight||1);var o=Ci(n)?an(n):window,l=o.visualViewport,a=!zy()&&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 od(n){var e=hs(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 Vy(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&sd(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function dr(n){return an(n).getComputedStyle(n)}function xO(n){return["table","td","th"].indexOf(Xn(n))>=0}function Jr(n){return((Ci(n)?n.ownerDocument:n.document)||window.document).documentElement}function lc(n){return Xn(n)==="html"?n:n.assignedSlot||n.parentNode||(sd(n)?n.host:null)||Jr(n)}function tm(n){return!mn(n)||dr(n).position==="fixed"?null:n.offsetParent}function IO(n){var e=/firefox/i.test(Yu()),t=/Trident/i.test(Yu());if(t&&mn(n)){var r=dr(n);if(r.position==="fixed")return null}var i=lc(n);for(sd(i)&&(i=i.host);mn(i)&&["html","body"].indexOf(Xn(i))<0;){var s=dr(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=an(n),t=tm(n);t&&xO(t)&&dr(t).position==="static";)t=tm(t);return t&&(Xn(t)==="html"||Xn(t)==="body"&&dr(t).position==="static")?e:t||IO(n)||e}function ld(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Xs(n,e,t){return pi(n,ea(e,t))}function RO(n,e,t){var r=Xs(n,e,t);return r>t?t:r}function Hy(){return{top:0,right:0,bottom:0,left:0}}function Uy(n){return Object.assign({},Hy(),n)}function jy(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var PO=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Uy(typeof e!="number"?e:jy(e,Vo))};function LO(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=ld(l),c=[Zt,yn].indexOf(l)>=0,u=c?"height":"width";if(!(!s||!o)){var f=PO(i.padding,t),d=od(s),h=a==="y"?Qt:Zt,p=a==="y"?bn:yn,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),_=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,E=m/2-g/2,v=f[h],z=_-d[u]-f[p],C=_/2-d[u]/2+E,L=Xs(v,C,z),F=a;t.modifiersData[r]=(e={},e[F]=L,e.centerOffset=L-C,e)}}function BO(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)||Vy(e.elements.popper,i)&&(e.elements.arrow=i))}const FO={name:"arrow",enabled:!0,phase:"main",fn:LO,effect:BO,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ps(n){return n.split("-")[1]}var zO={top:"auto",right:"auto",bottom:"auto",left:"auto"};function VO(n,e){var t=n.x,r=n.y,i=e.devicePixelRatio||1;return{x:ds(t*i)/i||0,y:ds(r*i)/i||0}}function nm(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"),_=o.hasOwnProperty("y"),E=Zt,v=Qt,z=window;if(c){var C=Ho(t),L="clientHeight",F="clientWidth";if(C===an(t)&&(C=Jr(t),dr(C).position!=="static"&&l==="absolute"&&(L="scrollHeight",F="scrollWidth")),C=C,i===Qt||(i===Zt||i===yn)&&s===yo){v=bn;var M=f&&C===z&&z.visualViewport?z.visualViewport.height:C[L];m-=M-r.height,m*=a?1:-1}if(i===Zt||(i===Qt||i===bn)&&s===yo){E=yn;var Z=f&&C===z&&z.visualViewport?z.visualViewport.width:C[F];h-=Z-r.width,h*=a?1:-1}}var $=Object.assign({position:l},c&&zO),y=u===!0?VO({x:h,y:m},an(t)):{x:h,y:m};if(h=y.x,m=y.y,a){var w;return Object.assign({},$,(w={},w[v]=_?"0":"",w[E]=b?"0":"",w.transform=(z.devicePixelRatio||1)<=1?"translate("+h+"px, "+m+"px)":"translate3d("+h+"px, "+m+"px, 0)",w))}return Object.assign({},$,(e={},e[v]=_?m+"px":"",e[E]=b?h+"px":"",e.transform="",e))}function HO(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:ps(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,nm(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,nm(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 UO={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:HO,data:{}};var il={passive:!0};function jO(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=an(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",t.update,il)}),l&&a.addEventListener("resize",t.update,il),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",t.update,il)}),l&&a.removeEventListener("resize",t.update,il)}}const WO={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:jO,data:{}};var KO={left:"right",right:"left",bottom:"top",top:"bottom"};function wl(n){return n.replace(/left|right|bottom|top/g,function(e){return KO[e]})}var qO={start:"end",end:"start"};function rm(n){return n.replace(/start|end/g,function(e){return qO[e]})}function ad(n){var e=an(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function cd(n){return hs(Jr(n)).left+ad(n).scrollLeft}function JO(n,e){var t=an(n),r=Jr(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;var c=zy();(c||!c&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:s,height:o,x:l+cd(n),y:a}}function GO(n){var e,t=Jr(n),r=ad(n),i=(e=n.ownerDocument)==null?void 0:e.body,s=pi(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=pi(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),l=-r.scrollLeft+cd(n),a=-r.scrollTop;return dr(i||t).direction==="rtl"&&(l+=pi(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:l,y:a}}function ud(n){var e=dr(n),t=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+r)}function Wy(n){return["html","body","#document"].indexOf(Xn(n))>=0?n.ownerDocument.body:mn(n)&&ud(n)?n:Wy(lc(n))}function Qs(n,e){var t;e===void 0&&(e=[]);var r=Wy(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=an(r),o=i?[s].concat(s.visualViewport||[],ud(r)?r:[]):r,l=e.concat(o);return i?l:l.concat(Qs(lc(o)))}function Xu(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function YO(n,e){var t=hs(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 im(n,e,t){return e===Ly?Xu(JO(n,t)):Ci(e)?YO(e,t):Xu(GO(Jr(n)))}function XO(n){var e=Qs(lc(n)),t=["absolute","fixed"].indexOf(dr(n).position)>=0,r=t&&mn(n)?Ho(n):n;return Ci(r)?e.filter(function(i){return Ci(i)&&Vy(i,r)&&Xn(i)!=="body"}):[]}function QO(n,e,t,r){var i=e==="clippingParents"?XO(n):[].concat(e),s=[].concat(i,[t]),o=s[0],l=s.reduce(function(a,c){var u=im(n,c,r);return a.top=pi(u.top,a.top),a.right=ea(u.right,a.right),a.bottom=ea(u.bottom,a.bottom),a.left=pi(u.left,a.left),a},im(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 Ky(n){var e=n.reference,t=n.element,r=n.placement,i=r?Jn(r):null,s=r?ps(r):null,o=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(i){case Qt:a={x:o,y:e.y-t.height};break;case bn:a={x:o,y:e.y+e.height};break;case yn:a={x:e.x+e.width,y:l};break;case Zt:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var c=i?ld(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case fs: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?vO:l,c=t.rootBoundary,u=c===void 0?Ly: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=Uy(typeof g!="number"?g:jy(g,Vo)),_=d===zs?wO:zs,E=n.rects.popper,v=n.elements[p?_:d],z=QO(Ci(v)?v:v.contextElement||Jr(n.elements.popper),a,u,o),C=hs(n.elements.reference),L=Ky({reference:C,element:E,strategy:"absolute",placement:i}),F=Xu(Object.assign({},E,L)),M=d===zs?F:C,Z={top:z.top-M.top+b.top,bottom:M.bottom-z.bottom+b.bottom,left:z.left-M.left+b.left,right:M.right-z.right+b.right},$=n.modifiersData.offset;if(d===zs&&$){var y=$[i];Object.keys(Z).forEach(function(w){var O=[yn,bn].indexOf(w)>=0?1:-1,B=[Qt,bn].indexOf(w)>=0?"y":"x";Z[w]+=y[B]*O})}return Z}function ZO(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?By:a,u=ps(r),f=u?l?em:em.filter(function(p){return ps(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 e$(n){if(Jn(n)===id)return[];var e=wl(n);return[rm(n),e,rm(e)]}function t$(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),_=b===g,E=a||(_||!p?[wl(g)]:e$(g)),v=[g].concat(E).reduce(function(Ke,Be){return Ke.concat(Jn(Be)===id?ZO(e,{placement:Be,boundary:u,rootBoundary:f,padding:c,flipVariations:p,allowedAutoPlacements:m}):Be)},[]),z=e.rects.reference,C=e.rects.popper,L=new Map,F=!0,M=v[0],Z=0;Z=0,B=O?"width":"height",T=vo(e,{placement:$,boundary:u,rootBoundary:f,altBoundary:d,padding:c}),V=O?w?yn:Zt:w?bn:Qt;z[B]>C[B]&&(V=wl(V));var K=wl(V),Y=[];if(s&&Y.push(T[y]<=0),l&&Y.push(T[V]<=0,T[K]<=0),Y.every(function(Ke){return Ke})){M=$,F=!1;break}L.set($,Y)}if(F)for(var se=p?3:1,ge=function(Be){var et=v.find(function(Qe){var W=L.get(Qe);if(W)return W.slice(0,Be).every(function(ft){return ft})});if(et)return M=et,"break"},we=se;we>0;we--){var me=ge(we);if(me==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const n$={name:"flip",enabled:!0,phase:"main",fn:t$,requiresIfExists:["offset"],data:{_skip:!1}};function sm(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 om(n){return[Qt,yn,bn,Zt].some(function(e){return n[e]>=0})}function r$(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=sm(o,r),c=sm(l,i,s),u=om(a),f=om(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 i$={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:r$};function s$(n,e,t){var r=Jn(n),i=[Zt,Qt].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,[Zt,yn].indexOf(r)>=0?{x:l,y:o}:{x:o,y:l}}function o$(n){var e=n.state,t=n.options,r=n.name,i=t.offset,s=i===void 0?[0,0]:i,o=By.reduce(function(u,f){return u[f]=s$(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 l$={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:o$};function a$(n){var e=n.state,t=n.name;e.modifiersData[t]=Ky({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const c$={name:"popperOffsets",enabled:!0,phase:"read",fn:a$,data:{}};function u$(n){return n==="x"?"y":"x"}function f$(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),_=ps(e.placement),E=!_,v=ld(b),z=u$(v),C=e.modifiersData.popperOffsets,L=e.rects.reference,F=e.rects.popper,M=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,Z=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(C){if(s){var w,O=v==="y"?Qt:Zt,B=v==="y"?bn:yn,T=v==="y"?"height":"width",V=C[v],K=V+g[O],Y=V-g[B],se=h?-F[T]/2:0,ge=_===fs?L[T]:F[T],we=_===fs?-F[T]:-L[T],me=e.elements.arrow,Ke=h&&me?od(me):{width:0,height:0},Be=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Hy(),et=Be[O],Qe=Be[B],W=Xs(0,L[T],Ke[T]),ft=E?L[T]/2-se-W-et-Z.mainAxis:ge-W-et-Z.mainAxis,Kt=E?-L[T]/2+se+W+Qe+Z.mainAxis:we+W+Qe+Z.mainAxis,dt=e.elements.arrow&&Ho(e.elements.arrow),Rn=dt?v==="y"?dt.clientTop||0:dt.clientLeft||0:0,At=(w=$==null?void 0:$[v])!=null?w:0,Pn=V+ft-At-Rn,Pt=V+Kt-At,Pe=Xs(h?ea(K,Pn):K,V,h?pi(Y,Pt):Y);C[v]=Pe,y[v]=Pe-V}if(l){var ht,qe=v==="x"?Qt:Zt,Ge=v==="x"?bn:yn,Tt=C[z],Et=z==="y"?"height":"width",er=Tt+g[qe],Mt=Tt-g[Ge],tr=[Qt,Zt].indexOf(b)!==-1,qt=(ht=$==null?void 0:$[z])!=null?ht:0,nr=tr?er:Tt-L[Et]-F[Et]-qt+Z.altAxis,mr=tr?Tt+L[Et]+F[Et]-qt-Z.altAxis:Mt,Yr=h&&tr?RO(nr,Tt,mr):Xs(h?nr:er,Tt,h?mr:Mt);C[z]=Yr,y[z]=Yr-Tt}e.modifiersData[r]=y}}const d$={name:"preventOverflow",enabled:!0,phase:"main",fn:f$,requiresIfExists:["offset"]};function h$(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function p$(n){return n===an(n)||!mn(n)?ad(n):h$(n)}function m$(n){var e=n.getBoundingClientRect(),t=ds(e.width)/n.offsetWidth||1,r=ds(e.height)/n.offsetHeight||1;return t!==1||r!==1}function g$(n,e,t){t===void 0&&(t=!1);var r=mn(e),i=mn(e)&&m$(e),s=Jr(e),o=hs(n,i,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!t)&&((Xn(e)!=="body"||ud(s))&&(l=p$(e)),mn(e)?(a=hs(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):s&&(a.x=cd(s))),{x:o.left+l.scrollLeft-a.x,y:o.top+l.scrollTop-a.y,width:o.width,height:o.height}}function b$(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 y$(n){var e=b$(n);return $O.reduce(function(t,r){return t.concat(e.filter(function(i){return i.phase===r}))},[])}function v$(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function w$(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 lm={placement:"bottom",modifiers:[],strategy:"absolute"};function am(){for(var n=arguments.length,e=new Array(n),t=0;t-1}function Xy(n,e){return typeof n=="function"?n.apply(void 0,e):n}function cm(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function T$(n){return n.split(/\s+/).filter(Boolean)}function ji(n){return[].concat(n)}function um(n,e){n.indexOf(e)===-1&&n.push(e)}function E$(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function M$(n){return n.split("-")[0]}function ta(n){return[].slice.call(n)}function fm(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 ac(n){return["Element","Fragment"].some(function(e){return fd(n,e)})}function O$(n){return fd(n,"NodeList")}function $$(n){return fd(n,"MouseEvent")}function N$(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function D$(n){return ac(n)?[n]:O$(n)?ta(n):Array.isArray(n)?n:ta(document.querySelectorAll(n))}function Zc(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function dm(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function x$(n){var e,t=ji(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function I$(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=M$(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,_=t-s.right-p>a;return m||g||b||_})}function eu(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){n[r](i,t)})}function hm(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 jn={isTouch:!1},pm=0;function R$(){jn.isTouch||(jn.isTouch=!0,window.performance&&document.addEventListener("mousemove",Qy))}function Qy(){var n=performance.now();n-pm<20&&(jn.isTouch=!1,document.removeEventListener("mousemove",Qy)),pm=n}function P$(){var n=document.activeElement;if(N$(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function L$(){document.addEventListener("touchstart",R$,Zr),window.addEventListener("blur",P$)}var B$=typeof window<"u"&&typeof document<"u",F$=B$?!!window.msCrypto:!1,z$={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},V$={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},_n=Object.assign({appendTo:Yy,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},z$,V$),H$=Object.keys(_n),U$=function(e){var t=Object.keys(e);t.forEach(function(r){_n[r]=e[r]})};function Zy(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=_n[s])!=null?l:o}return r},{});return Object.assign({},n,t)}function j$(n,e){var t=e?Object.keys(Zy(Object.assign({},_n,{plugins:e}))):H$,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 mm(n,e){var t=Object.assign({},e,{content:Xy(e.content,[n])},e.ignoreAttributes?{}:j$(n,e.plugins));return t.aria=Object.assign({},_n.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 W$=function(){return"innerHTML"};function Qu(n,e){n[W$()]=e}function gm(n){var e=Zs();return n===!0?e.className=Jy:(e.className=Gy,ac(n)?e.appendChild(n):Qu(e,n)),e}function bm(n,e){ac(e.content)?(Qu(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Qu(n,e.content):n.textContent=e.content)}function Zu(n){var e=n.firstElementChild,t=ta(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(qy)}),arrow:t.find(function(r){return r.classList.contains(Jy)||r.classList.contains(Gy)}),backdrop:t.find(function(r){return r.classList.contains(A$)})}}function e0(n){var e=Zs(),t=Zs();t.className=_$,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=Zs();r.className=qy,r.setAttribute("data-state","hidden"),bm(r,n.props),e.appendChild(t),t.appendChild(r),i(n.props,n.props);function i(s,o){var l=Zu(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)&&bm(c,n.props),o.arrow?u?s.arrow!==o.arrow&&(a.removeChild(u),a.appendChild(gm(o.arrow))):a.appendChild(gm(o.arrow)):u&&a.removeChild(u)}return{popper:e,onUpdate:i}}e0.$$tippy=!0;var K$=1,sl=[],tu=[];function q$(n,e){var t=mm(n,Object.assign({},_n,Zy(fm(e)))),r,i,s,o=!1,l=!1,a=!1,c=!1,u,f,d,h=[],p=cm(Pn,t.interactiveDebounce),m,g=K$++,b=null,_=E$(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:_,clearDelayTimeouts:nr,setProps:mr,setContent:Yr,show:D,hide:U,hideWithInteractivity:X,enable:tr,disable:qt,unmount:Ii,destroy:Ri};if(!t.render)return v;var z=t.render(v),C=z.popper,L=z.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+v.id,v.popper=C,n._tippy=v,C._tippy=v;var F=_.map(function(N){return N.fn(v)}),M=n.hasAttribute("aria-expanded");return dt(),se(),V(),K("onCreate",[v]),t.showOnCreate&&er(),C.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&O().addEventListener("mousemove",p)}),v;function Z(){var N=v.props.touch;return Array.isArray(N)?N:[N,0]}function $(){return Z()[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?x$(N):document}function B(){return Zu(C)}function T(N){return v.state.isMounted&&!v.state.isVisible||jn.isTouch||u&&u.type==="focus"?0:Qc(v.props.delay,N?0:1,_n.delay)}function V(N){N===void 0&&(N=!1),C.style.pointerEvents=v.props.interactive&&!N?"":"none",C.style.zIndex=""+v.props.zIndex}function K(N,Q,he){if(he===void 0&&(he=!0),F.forEach(function(Oe){Oe[N]&&Oe[N].apply(Oe,Q)}),he){var Le;(Le=v.props)[N].apply(Le,Q)}}function Y(){var N=v.props.aria;if(N.content){var Q="aria-"+N.content,he=C.id,Le=ji(v.props.triggerTarget||n);Le.forEach(function(Oe){var ct=Oe.getAttribute(Q);if(v.state.isVisible)Oe.setAttribute(Q,ct?ct+" "+he:he);else{var Lt=ct&&ct.replace(he,"").trim();Lt?Oe.setAttribute(Q,Lt):Oe.removeAttribute(Q)}})}}function se(){if(!(M||!v.props.aria.expanded)){var N=ji(v.props.triggerTarget||n);N.forEach(function(Q){v.props.interactive?Q.setAttribute("aria-expanded",v.state.isVisible&&Q===w()?"true":"false"):Q.removeAttribute("aria-expanded")})}}function ge(){O().removeEventListener("mousemove",p),sl=sl.filter(function(N){return N!==p})}function we(N){if(!(jn.isTouch&&(a||N.type==="mousedown"))){var Q=N.composedPath&&N.composedPath()[0]||N.target;if(!(v.props.interactive&&hm(C,Q))){if(ji(v.props.triggerTarget||n).some(function(he){return hm(he,Q)})){if(jn.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else K("onClickOutside",[v,N]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),l=!0,setTimeout(function(){l=!1}),v.state.isMounted||et())}}}function me(){a=!0}function Ke(){a=!1}function Be(){var N=O();N.addEventListener("mousedown",we,!0),N.addEventListener("touchend",we,Zr),N.addEventListener("touchstart",Ke,Zr),N.addEventListener("touchmove",me,Zr)}function et(){var N=O();N.removeEventListener("mousedown",we,!0),N.removeEventListener("touchend",we,Zr),N.removeEventListener("touchstart",Ke,Zr),N.removeEventListener("touchmove",me,Zr)}function Qe(N,Q){ft(N,function(){!v.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&Q()})}function W(N,Q){ft(N,Q)}function ft(N,Q){var he=B().box;function Le(Oe){Oe.target===he&&(eu(he,"remove",Le),Q())}if(N===0)return Q();eu(he,"remove",f),eu(he,"add",Le),f=Le}function Kt(N,Q,he){he===void 0&&(he=!1);var Le=ji(v.props.triggerTarget||n);Le.forEach(function(Oe){Oe.addEventListener(N,Q,he),h.push({node:Oe,eventType:N,handler:Q,options:he})})}function dt(){$()&&(Kt("touchstart",At,{passive:!0}),Kt("touchend",Pt,{passive:!0})),T$(v.props.trigger).forEach(function(N){if(N!=="manual")switch(Kt(N,At),N){case"mouseenter":Kt("mouseleave",Pt);break;case"focus":Kt(F$?"focusout":"blur",Pe);break;case"focusin":Kt("focusout",Pe);break}})}function Rn(){h.forEach(function(N){var Q=N.node,he=N.eventType,Le=N.handler,Oe=N.options;Q.removeEventListener(he,Le,Oe)}),h=[]}function At(N){var Q,he=!1;if(!(!v.state.isEnabled||ht(N)||l)){var Le=((Q=u)==null?void 0:Q.type)==="focus";u=N,m=N.currentTarget,se(),!v.state.isVisible&&$$(N)&&sl.forEach(function(Oe){return Oe(N)}),N.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?he=!0:er(N),N.type==="click"&&(o=!he),he&&!Le&&Mt(N)}}function Pn(N){var Q=N.target,he=w().contains(Q)||C.contains(Q);if(!(N.type==="mousemove"&&he)){var Le=Et().concat(C).map(function(Oe){var ct,Lt=Oe._tippy,Ln=(ct=Lt.popperInstance)==null?void 0:ct.state;return Ln?{popperRect:Oe.getBoundingClientRect(),popperState:Ln,props:t}:null}).filter(Boolean);I$(Le,N)&&(ge(),Mt(N))}}function Pt(N){var Q=ht(N)||v.props.trigger.indexOf("click")>=0&&o;if(!Q){if(v.props.interactive){v.hideWithInteractivity(N);return}Mt(N)}}function Pe(N){v.props.trigger.indexOf("focusin")<0&&N.target!==w()||v.props.interactive&&N.relatedTarget&&C.contains(N.relatedTarget)||Mt(N)}function ht(N){return jn.isTouch?$()!==N.type.indexOf("touch")>=0:!1}function qe(){Ge();var N=v.props,Q=N.popperOptions,he=N.placement,Le=N.offset,Oe=N.getReferenceClientRect,ct=N.moveTransition,Lt=y()?Zu(C).arrow:null,Ln=Oe?{getBoundingClientRect:Oe,contextElement:Oe.contextElement||w()}:n,Pi={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(gr){var Bn=gr.state;if(y()){var Ds=B(),Li=Ds.box;["placement","reference-hidden","escaped"].forEach(function(br){br==="placement"?Li.setAttribute("data-placement",Bn.placement):Bn.attributes.popper["data-popper-"+br]?Li.setAttribute("data-"+br,""):Li.removeAttribute("data-"+br)}),Bn.attributes.popper={}}}},wn=[{name:"offset",options:{offset:Le}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ct}},Pi];y()&&Lt&&wn.push({name:"arrow",options:{element:Lt,padding:3}}),wn.push.apply(wn,(Q==null?void 0:Q.modifiers)||[]),v.popperInstance=C$(Ln,C,Object.assign({},Q,{placement:he,onFirstUpdate:d,modifiers:wn}))}function Ge(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Tt(){var N=v.props.appendTo,Q,he=w();v.props.interactive&&N===Yy||N==="parent"?Q=he.parentNode:Q=Xy(N,[he]),Q.contains(C)||Q.appendChild(C),v.state.isMounted=!0,qe()}function Et(){return ta(C.querySelectorAll("[data-tippy-root]"))}function er(N){v.clearDelayTimeouts(),N&&K("onTrigger",[v,N]),Be();var Q=T(!0),he=Z(),Le=he[0],Oe=he[1];jn.isTouch&&Le==="hold"&&Oe&&(Q=Oe),Q?r=setTimeout(function(){v.show()},Q):v.show()}function Mt(N){if(v.clearDelayTimeouts(),K("onUntrigger",[v,N]),!v.state.isVisible){et();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&o)){var Q=T(!1);Q?i=setTimeout(function(){v.state.isVisible&&v.hide()},Q):s=requestAnimationFrame(function(){v.hide()})}}function tr(){v.state.isEnabled=!0}function qt(){v.hide(),v.state.isEnabled=!1}function nr(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function mr(N){if(!v.state.isDestroyed){K("onBeforeUpdate",[v,N]),Rn();var Q=v.props,he=mm(n,Object.assign({},Q,fm(N),{ignoreAttributes:!0}));v.props=he,dt(),Q.interactiveDebounce!==he.interactiveDebounce&&(ge(),p=cm(Pn,he.interactiveDebounce)),Q.triggerTarget&&!he.triggerTarget?ji(Q.triggerTarget).forEach(function(Le){Le.removeAttribute("aria-expanded")}):he.triggerTarget&&n.removeAttribute("aria-expanded"),se(),V(),L&&L(Q,he),v.popperInstance&&(qe(),Et().forEach(function(Le){requestAnimationFrame(Le._tippy.popperInstance.forceUpdate)})),K("onAfterUpdate",[v,N])}}function Yr(N){v.setProps({content:N})}function D(){var N=v.state.isVisible,Q=v.state.isDestroyed,he=!v.state.isEnabled,Le=jn.isTouch&&!v.props.touch,Oe=Qc(v.props.duration,0,_n.duration);if(!(N||Q||he||Le)&&!w().hasAttribute("disabled")&&(K("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,y()&&(C.style.visibility="visible"),V(),Be(),v.state.isMounted||(C.style.transition="none"),y()){var ct=B(),Lt=ct.box,Ln=ct.content;Zc([Lt,Ln],0)}d=function(){var wn;if(!(!v.state.isVisible||c)){if(c=!0,C.offsetHeight,C.style.transition=v.props.moveTransition,y()&&v.props.animation){var Xr=B(),gr=Xr.box,Bn=Xr.content;Zc([gr,Bn],Oe),dm([gr,Bn],"visible")}Y(),se(),um(tu,v),(wn=v.popperInstance)==null||wn.forceUpdate(),K("onMount",[v]),v.props.animation&&y()&&W(Oe,function(){v.state.isShown=!0,K("onShown",[v])})}},Tt()}}function U(){var N=!v.state.isVisible,Q=v.state.isDestroyed,he=!v.state.isEnabled,Le=Qc(v.props.duration,1,_n.duration);if(!(N||Q||he)&&(K("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,o=!1,y()&&(C.style.visibility="hidden"),ge(),et(),V(!0),y()){var Oe=B(),ct=Oe.box,Lt=Oe.content;v.props.animation&&(Zc([ct,Lt],Le),dm([ct,Lt],"hidden"))}Y(),se(),v.props.animation?y()&&Qe(Le,v.unmount):v.unmount()}}function X(N){O().addEventListener("mousemove",p),um(sl,p),p(N)}function Ii(){v.state.isVisible&&v.hide(),v.state.isMounted&&(Ge(),Et().forEach(function(N){N._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),tu=tu.filter(function(N){return N!==v}),v.state.isMounted=!1,K("onHidden",[v]))}function Ri(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Rn(),delete n._tippy,v.state.isDestroyed=!0,K("onDestroy",[v]))}}function Uo(n,e){e===void 0&&(e={});var t=_n.plugins.concat(e.plugins||[]);L$();var r=Object.assign({},e,{plugins:t}),i=D$(n),s=i.reduce(function(o,l){var a=l&&q$(l,r);return a&&o.push(a),o},[]);return ac(n)?s[0]:s}Uo.defaultProps=_n;Uo.setDefaultProps=U$;Uo.currentInput=jn;Object.assign({},Fy,{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:e0});class J${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&&Gf(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:_}=g,E=Math.min(..._.map(C=>C.$from.pos)),v=Math.max(..._.map(C=>C.$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(MC(p.selection)){let C=l.nodeDOM(E);const L=C.dataset.nodeViewWrapper?C:C.querySelector("[data-node-view-wrapper]");if(L&&(C=L.firstChild),C)return C.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 G$=n=>new ut({key:typeof n.pluginKey=="string"?new Vt(n.pluginKey):n.pluginKey,view:e=>new J$({view:e,...n})}),t0=xt.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[G$({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}}),Y$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",X$="ελ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",ms=(n,e)=>{for(const t in e)n[t]=e[t];return n},ef="numeric",tf="ascii",nf="alpha",kl="asciinumeric",ol="alphanumeric",rf="domain",n0="emoji",Q$="scheme",Z$="slashscheme",ym="whitespace";function eN(n,e){return n in e||(e[n]=[]),e[n]}function ai(n,e,t){e[ef]&&(e[kl]=!0,e[ol]=!0),e[tf]&&(e[kl]=!0,e[nf]=!0),e[kl]&&(e[ol]=!0),e[nf]&&(e[ol]=!0),e[ol]&&(e[rf]=!0),e[n0]&&(e[rf]=!0);for(const r in e){const i=eN(r,t);i.indexOf(n)<0&&i.push(n)}}function tN(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Gt(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}Gt.groups={};Gt.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),cn=(n,e,t,r,i)=>n.tr(e,t,r,i),vm=(n,e,t,r,i)=>n.ts(e,t,r,i),q=(n,e,t,r,i)=>n.tt(e,t,r,i),or="WORD",sf="UWORD",wo="LOCALHOST",of="TLD",lf="UTLD",Sl="SCHEME",Wi="SLASH_SCHEME",dd="NUM",r0="WS",hd="NL",eo="OPENBRACE",to="CLOSEBRACE",na="OPENBRACKET",ra="CLOSEBRACKET",ia="OPENPAREN",sa="CLOSEPAREN",oa="OPENANGLEBRACKET",la="CLOSEANGLEBRACKET",aa="FULLWIDTHLEFTPAREN",ca="FULLWIDTHRIGHTPAREN",ua="LEFTCORNERBRACKET",fa="RIGHTCORNERBRACKET",da="LEFTWHITECORNERBRACKET",ha="RIGHTWHITECORNERBRACKET",pa="FULLWIDTHLESSTHAN",ma="FULLWIDTHGREATERTHAN",ga="AMPERSAND",ba="APOSTROPHE",ya="ASTERISK",Er="AT",va="BACKSLASH",wa="BACKTICK",ka="CARET",$r="COLON",pd="COMMA",Sa="DOLLAR",Vn="DOT",Ca="EQUALS",md="EXCLAMATION",Hn="HYPHEN",_a="PERCENT",Aa="PIPE",Ta="PLUS",Ea="POUND",Ma="QUERY",gd="QUOTE",bd="SEMI",Un="SLASH",no="TILDE",Oa="UNDERSCORE",i0="EMOJI",$a="SYM";var s0=Object.freeze({__proto__:null,WORD:or,UWORD:sf,LOCALHOST:wo,TLD:of,UTLD:lf,SCHEME:Sl,SLASH_SCHEME:Wi,NUM:dd,WS:r0,NL:hd,OPENBRACE:eo,CLOSEBRACE:to,OPENBRACKET:na,CLOSEBRACKET:ra,OPENPAREN:ia,CLOSEPAREN:sa,OPENANGLEBRACKET:oa,CLOSEANGLEBRACKET:la,FULLWIDTHLEFTPAREN:aa,FULLWIDTHRIGHTPAREN:ca,LEFTCORNERBRACKET:ua,RIGHTCORNERBRACKET:fa,LEFTWHITECORNERBRACKET:da,RIGHTWHITECORNERBRACKET:ha,FULLWIDTHLESSTHAN:pa,FULLWIDTHGREATERTHAN:ma,AMPERSAND:ga,APOSTROPHE:ba,ASTERISK:ya,AT:Er,BACKSLASH:va,BACKTICK:wa,CARET:ka,COLON:$r,COMMA:pd,DOLLAR:Sa,DOT:Vn,EQUALS:Ca,EXCLAMATION:md,HYPHEN:Hn,PERCENT:_a,PIPE:Aa,PLUS:Ta,POUND:Ea,QUERY:Ma,QUOTE:gd,SEMI:bd,SLASH:Un,TILDE:no,UNDERSCORE:Oa,EMOJI:i0,SYM:$a});const Vi=/[a-z]/,nu=new RegExp("\\p{L}","u"),ru=new RegExp("\\p{Emoji}","u"),iu=/\d/,wm=/\s/,km=` @@ -216,6 +224,6 @@ https://code0xff.github.io/LightNote?endpoint={porxy_url}&workspace={workspace}< `);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[Vu({find:$N,type:this.type,getAttributes:n=>({language:n[1]})}),Vu({find:NN,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ut({key:new Vt("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(ve.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}}})]}}),xN=Ct.create({name:"doc",topNode:!0,content:"block+"});function IN(n={}){return new ut({view(e){return new RN(e,n)}})}class RN{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=Qg(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 PN=xt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[IN(this.options)]}});class nt extends Ae{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return nt.valid(r)?new nt(r):Ae.near(r)}content(){return G.empty}eq(e){return e instanceof nt&&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 nt(e.resolve(t.pos))}getBookmark(){return new wd(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!LN(e)||!BN(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&&nt.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(nt.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!de.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(nt.valid(l))return l}return null}}}nt.prototype.visible=!1;nt.findFrom=nt.findGapCursorFrom;Ae.jsonID("gapcursor",nt);class wd{constructor(e){this.pos=e}map(e){return new wd(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return nt.valid(t)?new nt(t):Ae.near(t)}}function LN(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 BN(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 FN(){return new ut({props:{decorations:UN,createSelectionBetween(n,e,t){return e.pos==t.pos&&nt.valid(t)?new nt(t):null},handleClick:VN,handleKeyDown:zN,handleDOMEvents:{beforeinput:HN}}})}const zN=zb({ArrowLeft:ul("horiz",-1),ArrowRight:ul("horiz",1),ArrowUp:ul("vert",-1),ArrowDown:ul("vert",1)});function ul(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 ve){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=nt.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new nt(c))),!0):!1}}function VN(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!nt.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&de.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new nt(r))),!0)}function HN(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof nt))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=H.empty;for(let o=r.length-1;o>=0;o--)i=H.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new G(i,0,0));return s.setSelection(ve.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function UN(n){if(!(n.selection instanceof nt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ot.create(n.doc,[sn.widget(n.selection.head,e,{key:"gapcursor"})])}const jN=xt.create({name:"gapCursor",addProseMirrorPlugins(){return[FN()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Ee(ee(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),WN=Ct.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",Ze(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()}}}),KN=Ct.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]}`,Ze(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=>Vu({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Na=200,wt=function(){};wt.prototype.append=function(e){return e.length?(e=wt.from(e),!this.length&&e||e.length=t?wt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};wt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};wt.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)};wt.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};wt.from=function(e){return e instanceof wt?e:e&&e.length?new u0(e):wt.empty};var u0=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<=Na)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Na)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}(wt);wt.empty=new u0([]);var qN=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}(wt);const JN=500;class Cn{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 Sr(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 Sr(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 Cn(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;uYN&&(l=GN(l,c),o-=c),new Cn(l.append(s),o)}remapping(e,t){let r=new Ji;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 Cn(this.items.append(e.map(t=>new Sr(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 Sr(p,m,g))}else r.push(new Sr(p))},i);let c=[];for(let d=t;dJN&&(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 Sr(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 Cn(wt.from(i.reverse()),s)}}Cn.empty=new Cn(wt.empty,0);function GN(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}let Sr=class f0{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 f0(t.getMap().invert(),t,this.selection)}}};class Mr{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const YN=20;function XN(n,e,t,r){let i=t.getMeta(mi),s;if(i)return i.historyState;t.getMeta(eD)&&(n=new Mr(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(mi))return o.getMeta(mi).redo?new Mr(n.done.addTransform(t,void 0,r,Cl(e)),n.undone,Om(t.mapping.maps),n.prevTime,n.prevComposition):new Mr(n.done,n.undone.addTransform(t,void 0,r,Cl(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||!QN(t,n.prevRanges)),c=o?ou(n.prevRanges,t.mapping):Om(t.mapping.maps);return new Mr(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Cl(e)),Cn.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Mr(n.done.rebased(t,s),n.undone.rebased(t,s),ou(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Mr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),ou(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function QN(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 Om(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function ou(n,e){if(!n)return null;let t=[];for(let r=0;r{let i=mi.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=ZN(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const h0=d0(!1,!0),p0=d0(!0,!0),nD=xt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>h0(n,e),redo:()=>({state:n,dispatch:e})=>p0(n,e)}},addProseMirrorPlugins(){return[tD(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()}}}),rD=Ct.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Ze(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(ve.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(de.create(i.doc,l.pos)):i.setSelection(ve.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(ve.create(i.doc,a+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ty({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),iD=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,sD=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,oD=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,lD=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,aD=gn.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",Ze(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[us({find:iD,type:this.type}),us({find:oD,type:this.type})]},addPasteRules(){return[ki({find:sD,type:this.type}),ki({find:lD,type:this.type})]}}),cD=Ct.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ze(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)}}}),uD=Ct.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ze(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)}}}),Nm=gn.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=oc(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Dm=/^(\d+)\.\s$/,fD=Ct.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",Ze(this.options.HTMLAttributes,t),0]:["ol",Ze(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(uD.name,this.editor.getAttributes(Nm.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:Dm,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:Dm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Nm.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),dD=Ct.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hD=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,pD=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,mD=gn.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",Ze(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 Xf()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[us({find:hD,type:this.type})]},addPasteRules(){return[ki({find:pD,type:this.type})]}}),gD=Ct.create({name:"text",group:"inline"}),m0=xt.create({name:"starterKit",addExtensions(){var n,e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;const _=[];return this.options.blockquote!==!1&&_.push(vN.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&_.push(_N.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&_.push(TN.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&_.push(ON.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&_.push(DN.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&_.push(xN.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&_.push(PN.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&_.push(jN.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&_.push(WN.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&_.push(KN.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&_.push(nD.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&_.push(rD.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&_.push(aD.configure((d=this.options)===null||d===void 0?void 0:d.italic)),this.options.listItem!==!1&&_.push(cD.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&_.push(fD.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&_.push(dD.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&_.push(mD.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&_.push(gD.configure((b=this.options)===null||b===void 0?void 0:b.text)),_}}),bD=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,g0=Ct.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",Ze(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[ty({find:bD,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),yD=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/,vD=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g,b0=n=>n.match(yD),xm=n=>n?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",wD=n=>{const{url:e,allowFullscreen:t,autoplay:r,ccLanguage:i,ccLoadPolicy:s,controls:o,disableKBcontrols:l,enableIFrameApi:a,endTime:c,interfaceLanguage:u,ivLoadPolicy:f,loop:d,modestBranding:h,nocookie:p,origin:m,playlist:g,progressBarColor:b,startAt:_}=n;if(!b0(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const L=e.split("/").pop();return L?`${xm(p)}${L}`:null}const v=/(?:v=|shorts\/)([-\w]+)/gm.exec(e);if(!v||!v[1])return null;let z=`${xm(p)}${v[1]}`;const C=[];return t===!1&&C.push("fs=0"),r&&C.push("autoplay=1"),i&&C.push(`cc_lang_pref=${i}`),s&&C.push("cc_load_policy=1"),o||C.push("controls=0"),l&&C.push("disablekb=1"),a&&C.push("enablejsapi=1"),c&&C.push(`end=${c}`),u&&C.push(`hl=${u}`),f&&C.push(`iv_load_policy=${f}`),d&&C.push("loop=1"),h&&C.push("modestbranding=1"),m&&C.push(`origin=${m}`),g&&C.push(`playlist=${g}`),_&&C.push(`start=${_}`),b&&C.push(`color=${b}`),C.length&&(z+=`?${C.join("&")}`),z},y0=Ct.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:n=>({commands:e})=>b0(n.src)?e.insertContent({type:this.name,attrs:n}):!1}},addPasteRules(){return this.options.addPasteHandler?[i_({find:vD,type:this.type,getAttributes:n=>({src:n.input})})]:[]},renderHTML({HTMLAttributes:n}){const e=wD({url:n.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:n.start||0});return n.src=e,["div",{"data-youtube-video":""},["iframe",Ze(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor},n)]]}}),v0=gn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function kD(n){return[m0,t0.configure({element:n}),l0.configure({openOnClick:!1,autolink:!0}),g0.configure({inline:!0}),c0.configure({types:["heading","paragraph"]}),a0,y0.configure({inline:!0}),v0]}const SD=Math.floor,CD=(n,e)=>nn>e?n:e,w0=128,_l=127,AD=Number.MAX_SAFE_INTEGER,TD=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iSo.encode(n),MD=So?ED:TD;let ro=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ro&&ro.decode(new Uint8Array).length===1&&(ro=null);const Da=(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},uc=(n,e)=>{for(;e>_l;)Da(n,w0|_l&e),e=SD(e/128);Da(n,_l&e)},af=new Uint8Array(3e4),OD=af.length/3,$D=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;uc(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=CD(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(_D(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},ID=(n,e)=>{uc(n,e.byteLength),xD(n,e)},k0=n=>new Error(n),RD=k0("Unexpected end of array"),PD=k0("Integer out of Range"),LD=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},BD=n=>LD(n,kd(n)),Im=n=>n.arr[n.pos++],kd=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posAD)throw PD}throw RD},FD=n=>{let e=kd(n);if(e===0)return"";{let t=String.fromCodePoint(Im(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(Im(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))}},zD=n=>ro.decode(BD(n)),Rm=ro?zD:FD;var Co;(function(n){n[n.Token=0]="Token",n[n.PermissionDenied=1]="PermissionDenied",n[n.Authenticated=2]="Authenticated"})(Co||(Co={}));const VD=(n,e)=>{uc(n,Co.Token),DD(n,e)},HD=(n,e,t)=>{switch(kd(n)){case Co.PermissionDenied:{e(Rm(n));break}case Co.Authenticated:{t(Rm(n));break}}},UD={code:1009,reason:"Message Too Big"},Pm={code:4401,reason:"Unauthorized"},jD={code:4403,reason:"Forbidden"},Lm=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t}));var cf;(function(n){n[n.Connecting=0]="Connecting",n[n.Open=1]="Open",n[n.Closing=2]="Closing",n[n.Closed=3]="Closed"})(cf||(cf={}));const Tn=()=>new Map,uf=n=>{const e=Tn();return n.forEach((t,r)=>{e.set(r,t)}),e},Gr=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},WD=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},KD=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},_i=()=>new Set,au=n=>n[n.length-1],qD=(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 Hr((this._observers.get(e)||Tn()).values()).forEach(r=>r(...t))}destroy(){this._observers=Tn()}}const hr=Math.floor,Al=Math.abs,fc=(n,e)=>nn>e?n:e,C0=n=>n!==0?n<0:1/n<0,Bm=1,Fm=2,cu=4,uu=8,_o=32,ur=64,on=128,dc=31,df=63,gi=127,GD=2147483647,_0=Number.MAX_SAFE_INTEGER,YD=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&hr(n)===n),XD=n=>n.toLowerCase(),QD=/^\s*/g,ZD=n=>n.replace(QD,""),ex=/([A-Z])/g,zm=(n,e)=>ZD(n.replace(ex,t=>`${e}${XD(t)}`)),tx=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iAo.encode(n),rx=Ao?nx:tx;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 hc=()=>new jo,ix=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array(ix(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},hf=mt,xe=(n,e)=>{for(;e>gi;)mt(n,on|gi&e),e=hr(e/128);mt(n,gi&e)},Sd=(n,e)=>{const t=C0(e);for(t&&(e=-e),mt(n,(e>df?on:0)|(t?ur:0)|df&e),e=hr(e/64);e>0;)mt(n,(e>gi?on:0)|gi&e),e=hr(e/128)},pf=new Uint8Array(3e4),ox=pf.length/3,lx=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;xe(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=fc(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(Di(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},tn=(n,e)=>{xe(n,e.byteLength),pc(n,e)},Cd=(n,e)=>{sx(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},cx=(n,e)=>Cd(n,4).setFloat32(0,e,!1),ux=(n,e)=>Cd(n,8).setFloat64(0,e,!1),fx=(n,e)=>Cd(n,8).setBigInt64(0,e,!1),Vm=new DataView(new ArrayBuffer(4)),dx=n=>(Vm.setFloat32(0,n),Vm.getFloat32(0)===n),To=(n,e)=>{switch(typeof e){case"string":mt(n,119),Qi(n,e);break;case"number":YD(e)&&Al(e)<=GD?(mt(n,125),Sd(n,e)):dx(e)?(mt(n,124),cx(n,e)):(mt(n,123),ux(n,e));break;case"bigint":mt(n,122),fx(n,e);break;case"object":if(e===null)mt(n,126);else if(ff(e)){mt(n,117),xe(n,e.length);for(let t=0;t0&&xe(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Um=n=>{n.count>0&&(Sd(n.encoder,n.count===1?n.s:-n.s),n.count>1&&xe(n.encoder,n.count-2))};class Tl{constructor(){this.encoder=new jo,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Um(this),this.count=1,this.s=e)}toUint8Array(){return Um(this),qn(this.encoder)}}const jm=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);Sd(n.encoder,e),n.count>1&&xe(n.encoder,n.count-2)}};class fu{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++):(jm(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return jm(this),qn(this.encoder)}}class hx{constructor(){this.sarr=[],this.s="",this.lensE=new Tl}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="",Qi(e,this.sarr.join("")),pc(e,this.lensE.toUint8Array()),qn(e)}}const Ur=n=>new Error(n),En=()=>{throw Ur("Method unimplemented")},vn=()=>{throw Ur("Unexpected case")},A0=Ur("Unexpected end of array"),T0=Ur("Integer out of Range");let mc=class{constructor(e){this.arr=e,this.pos=0}};const As=n=>new mc(n),px=n=>n.pos!==n.arr.length,mx=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},nn=n=>mx(n,Me(n)),gs=n=>n.arr[n.pos++],Me=n=>{let e=0,t=1;const r=n.arr.length;for(;n.pos_0)throw T0}throw A0},_d=n=>{let e=n.arr[n.pos++],t=e&df,r=64;const i=(e&ur)>0?-1:1;if(!(e&on))return i*t;const s=n.arr.length;for(;n.pos_0)throw T0}throw A0},gx=n=>{let e=Me(n);if(e===0)return"";{let t=String.fromCodePoint(gs(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(gs(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))}},bx=n=>io.decode(nn(n)),Zi=io?bx:gx,Ad=(n,e)=>{const t=new DataView(n.arr.buffer,n.arr.byteOffset+n.pos,e);return n.pos+=e,t},yx=n=>Ad(n,4).getFloat32(0,!1),vx=n=>Ad(n,8).getFloat64(0,!1),wx=n=>Ad(n,8).getBigInt64(0,!1),kx=[n=>{},n=>null,_d,yx,vx,wx,n=>!1,n=>!0,Zi,n=>{const e=Me(n),t={};for(let r=0;r{const e=Me(n),t=[];for(let r=0;rkx[127-gs(n)](n);class Wm extends mc{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),px(this)?this.count=Me(this)+1:this.count=-1),this.count--,this.s}}class El extends mc{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=_d(this);const e=C0(this.s);this.count=1,e&&(this.s=-this.s,this.count=Me(this)+2)}return this.count--,this.s}}class du extends mc{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=_d(this),t=e&1;this.diff=hr(e/2),this.count=1,t&&(this.count=Me(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Sx{constructor(e){this.decoder=new El(e),this.str=Zi(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 Cx=crypto.getRandomValues.bind(crypto),_x=Math.random,E0=()=>Cx(new Uint32Array(1))[0],Ax=n=>n[hr(_x()*n.length)],Tx="10000000-1000-4000-8000"+-1e11,Ex=()=>Tx.replace(/[018]/g,n=>(n^E0()&15>>n/4).toString(16)),Mx=Date.now,Km=n=>new Promise(n);Promise.all.bind(Promise);const qm=n=>n===void 0?null:n;let Ox=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},M0=new Ox,$x=!0;try{typeof localStorage<"u"&&localStorage&&(M0=localStorage,$x=!1)}catch{}const Nx=M0,Dx=Object.assign,O0=Object.keys,xx=(n,e)=>{for(const t in n)e(n[t],t)},Jm=n=>O0(n).length,Ix=n=>{for(const e in n)return!1;return!0},Rx=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},Px=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),Lx=(n,e)=>n===e||Jm(n)===Jm(e)&&Rx(n,(t,r)=>(t!==void 0||Px(e,r))&&e[r]===t),Td=(n,e,t=0)=>{try{for(;tn,Fx=(n,e)=>e.includes(n);var $0={};const bs=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",zx=typeof window<"u"&&typeof document<"u"&&!bs;let Fn;const Vx=()=>{if(Fn===void 0)if(bs){Fn=Tn();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");Fn.set(`--${zm(e,"-")}`,t),Fn.set(`-${zm(e,"-")}`,t)}})):Fn=Tn();return Fn},mf=n=>Vx().has(n),gf=n=>qm(bs?$0[n.toUpperCase().replaceAll("-","_")]:Nx.getItem(n)),Hx=n=>mf("--"+n)||gf(n)!==null;Hx("production");const Gm=bs&&Fx($0.FORCE_COLOR,["true","1","2"]),Ux=!mf("no-colors")&&(!bs||process.stdout.isTTY||Gm)&&(!bs||mf("color")||Gm||gf("COLORTERM")!==null||(gf("TERM")||"").includes("color")),jx=n=>new Uint8Array(n),Wx=n=>{const e=jx(n.byteLength);return e.set(n),e};class Kx{constructor(e,t){this.left=e,this.right=t}}const sr=(n,e)=>new Kx(n,e),qx=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const Jx=n=>WD(n,(e,t)=>`${t}:${e};`).join(""),Gx=n=>class{constructor(t){this._=t}destroy(){n(this._)}},Yx=Gx(clearTimeout),bf=(n,e)=>new Yx(setTimeout(e,n)),pr=Symbol,N0=pr(),D0=pr(),Xx=pr(),Qx=pr(),Zx=pr(),x0=pr(),eI=pr(),Ed=pr(),tI=pr(),nI=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=Tn();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(...I0(n)),R0.forEach(e=>e.print(n))},oI=(...n)=>{console.warn(...I0(n)),n.unshift(Ed),R0.forEach(e=>e.print(n))},R0=_i(),P0=n=>({[Symbol.iterator](){return this},next:n}),lI=(n,e)=>P0(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),hu=(n,e)=>P0(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Md{constructor(e,t){this.clock=e,this.len=t}}class Ts{constructor(){this.clients=new Map}}const jr=(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=hr((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&&aI(t,e.clock)!==null},Od=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=Di(i.len,s.clock+s.len-i.clock):(r{const e=new Ts;for(let t=0;t{if(!e.clients.has(i)){const s=r.slice();for(let o=t+1;o{Gr(n.clients,e,()=>[]).push(new Md(t,r))},L0=()=>new Ts,B0=n=>{const e=L0();return n.clients.forEach((t,r)=>{const i=[];for(let s=0;s0&&e.clients.set(r,i)}),e},Ms=(n,e)=>{xe(n.restEncoder,e.clients.size),Hr(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),xe(n.restEncoder,t);const i=r.length;xe(n.restEncoder,i);for(let s=0;s{const e=new Ts,t=Me(n.restDecoder);for(let r=0;r0){const o=Gr(e.clients,i,()=>[]);for(let l=0;l{const r=new Ts,i=Me(n.restDecoder);for(let s=0;s0){const s=new Ai;return xe(s.restEncoder,0),Ms(s,r),s.toUint8Array()}return null},F0=E0;class Os extends S0{constructor({guid:e=Ex(),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=F0(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new G0,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=Km(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>Km(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(Hr(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Je(this,e,t)}get(e,t=Dt){const r=Gr(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==Dt&&i!==t)if(i===Dt){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,ts)}getText(e=""){return this.get(e,Ti)}getMap(e=""){return this.get(e,vs)}getXmlElement(e=""){return this.get(e,Ht)}getXmlFragment(e=""){return this.get(e,Ei)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){Hr(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Os({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 z0{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Me(this.restDecoder)}readDsLen(){return Me(this.restDecoder)}}class V0 extends z0{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 gs(this.restDecoder)}readString(){return Zi(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 Wx(nn(this.restDecoder))}readJSON(){return JSON.parse(Zi(this.restDecoder))}readKey(){return Zi(this.restDecoder)}}class cI{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 ys extends cI{constructor(e){super(e),this.keys=[],Me(e),this.keyClockDecoder=new du(nn(e)),this.clientDecoder=new El(nn(e)),this.leftClockDecoder=new du(nn(e)),this.rightClockDecoder=new du(nn(e)),this.infoDecoder=new Wm(nn(e),gs),this.stringDecoder=new Sx(nn(e)),this.parentInfoDecoder=new Wm(nn(e),gs),this.typeRefDecoder=new El(nn(e)),this.lenDecoder=new El(nn(e))}readLeftID(){return new es(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new es(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 nn(this.restDecoder)}readJSON(){return Eo(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e{r=Di(r,e[0].id.clock);const i=Qn(e,r);xe(n.restEncoder,e.length-i),n.writeClient(t),xe(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)}),Ko(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),xe(n.restEncoder,r.size),Hr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{uI(n,e.clients.get(i),i,s)})},fI=(n,e)=>{const t=Tn(),r=Me(n.restDecoder);for(let i=0;i{const r=[];let i=Hr(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 G0,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!==hn){const p=Gr(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 Ai;return Nd(h,l,new Map),xe(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},hI=(n,e)=>Nd(n,e.doc.store,e.beforeState),pI=(n,e,t,r=new ys(n))=>Je(e,i=>{i.local=!1;let s=!1;const o=i.doc,l=o.store,a=fI(r,o),c=dI(i,l,a),u=l.pendingStructs;if(u){for(const[d,h]of u.missing)if(hh)&&u.missing.set(d,h)}u.update=Ia([u.update,c.update])}}else l.pendingStructs=c;const f=Ym(r,i,l);if(l.pendingDs){const d=new ys(As(l.pendingDs));Me(d.restDecoder);const h=Ym(d,i,l);f&&h?l.pendingDs=Ia([f,h]):l.pendingDs=f||h}else l.pendingDs=f;if(s){const d=l.pendingStructs.update;l.pendingStructs=null,j0(i.doc,d)}},t,!1),j0=(n,e,t,r=ys)=>{const i=As(e);pI(i,n,t,new r(i))},mI=(n,e,t)=>j0(n,e,t,V0),gI=(n,e,t=new Map)=>{Nd(n,e.store,t),Ms(n,B0(e.store))},bI=(n,e=new Uint8Array([0]),t=new Ai)=>{const r=W0(e);gI(t,n,r);const i=[t.toUint8Array()];if(n.store.pendingDs&&i.push(n.store.pendingDs),n.store.pendingStructs&&i.push(LI(n.store.pendingStructs.update,e)),i.length>1){if(t.constructor===Wo)return RI(i.map((s,o)=>o===0?s:FI(s)));if(t.constructor===Ai)return Ia(i)}return i[0]},yI=(n,e)=>bI(n,e,new Wo),vI=n=>{const e=new Map,t=Me(n.restDecoder);for(let r=0;rvI(new z0(As(n))),K0=(n,e)=>(xe(n.restEncoder,e.size),Hr(e.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{xe(n.restEncoder,t),xe(n.restEncoder,r)}),n),wI=(n,e)=>K0(n,Ko(e.store)),kI=(n,e=new U0)=>(n instanceof Map?K0(e,n):wI(e,n),e.toUint8Array()),SI=n=>kI(n,new H0);class CI{constructor(){this.l=[]}}const Xm=()=>new CI,Qm=(n,e)=>n.l.push(e),Zm=(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.")},q0=(n,e,t)=>Td(n.l,[e,t]);class es{constructor(e,t){this.client=e,this.clock=t}}const fl=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,Se=(n,e)=>new es(n,e),Oo=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw vn()},$o=(n,e)=>{for(;e!==null;){if(e.parent===n)return!0;e=e.parent._item}return!1};class xa{constructor(e,t,r,i=0){this.type=e,this.tname=t,this.item=r,this.assoc=i}}class _I{constructor(e,t,r=0){this.type=e,this.index=t,this.assoc=r}}const AI=(n,e,t=0)=>new _I(n,e,t),dl=(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 xa(r,i,e,t)},pu=(n,e,t=0)=>{let r=n._start;if(t<0){if(e===0)return dl(n,null,t);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return dl(n,Se(r.id.client,r.id.clock+e),t);e-=r.length}if(r.right===null&&t<0)return dl(n,r.lastId,t);r=r.right}return dl(n,null,t)},TI=(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=Sf(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}=Sf(t,i);if(c instanceof Ue&&c.content instanceof In)l=c.content.type;else return null}else throw vn();o>=0?a=l._length:a=0}return AI(l,a,n.assoc)};class Dd{constructor(e,t){this.ds=e,this.sv=t}}const J0=(n,e)=>new Dd(n,e),EI=n=>J0(B0(n.store),Ko(n.store)),ri=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!Es(e.ds,n.id),vf=(n,e)=>{const t=Gr(n.meta,vf,_i),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i{}),t.add(e))};class G0{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Ko=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},Y0=(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 vn()}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=hr(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)]},Ml=MI,wf=(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[wf(n,t,e.clock)]},eg=(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!==dn&&r.splice(i+1,0,Fa(n,s,t.clock-s.id.clock+1)),s},OI=(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=wf(n,e,t),l;do l=e[o++],se.deleteSet.clients.size===0&&!KD(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Od(e.deleteSet),hI(n,e),Ms(n,e.deleteSet),!0),ng=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Gr(n.changed,e,_i).add(t)},Ol=(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},NI=(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=fc(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+Ol(i,a)}})},Q0=(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),q0(c._dEH,a,t))})}),l.push(()=>r.emit("afterTransaction",[t,r])),Td(l,[]),t._needFormattingCleanup&&ZI(t)}finally{r.gc&&NI(s,i,r.gcFilter),DI(s,i),t.afterState.forEach((u,f)=>{const d=t.beforeState.get(f)||0;if(d!==u){const h=i.clients.get(f),p=Di(Qn(h,d),1);for(let m=h.length-1;m>=p;)m-=1+Ol(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&&Ol(h,p)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(sI(Ed,N0,"[yjs] ",D0,x0,"Changed the client-id because another client seems to be using it."),r.clientID=F0()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new Wo;tg(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new Ai;tg(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])):Q0(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 $I(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&&Q0(i,0)}}return o};class xI{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}}const rg=(n,e,t)=>{jr(n,t.deletions,r=>{r instanceof Ue&&e.scope.some(i=>$o(i,r))&&zd(r,!1)})},ig=(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;jr(o,a.insertions,d=>{if(d instanceof Ue){if(d.redone!==null){let{item:h,diff:p}=Sf(l,d.id);p>0&&(h=Yt(o,Se(h.id.client,h.id.clock+p))),d=h}!d.deleted&&s.some(h=>$o(h,d))&&u.push(d)}}),jr(o,a.deletions,d=>{d instanceof Ue&&s.some(h=>$o(h,d))&&!Es(a.insertions,d.id)&&c.add(d)}),c.forEach(d=>{f=y1(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 Z0 extends S0{constructor(e,{captureTimeout:t=500,captureTransaction:r=a=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=ff(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 Ts;a.afterState.forEach((g,b)=>{const _=a.beforeState.get(b)||0,E=g-_;E>0&&Mo(d,b,_,E)});const h=Mx();let p=!1;if(this.lastChange>0&&h-this.lastChange0&&!c&&!u){const g=f[f.length-1];g.deletions=yf([g.deletions,a.deleteSet]),g.insertions=yf([g.insertions,d])}else f.push(new xI(a.deleteSet,d)),p=!0;!c&&!u&&(this.lastChange=h),jr(a,a.deleteSet,g=>{g instanceof Ue&&this.scope.some(b=>$o(b,g))&&zd(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=ff(e)?e:[e],e.forEach(t=>{this.scope.every(r=>r!==t)&&(t.doc!==this.doc&&oI("[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=>rg(r,this,i)),this.undoStack=[]),t&&(this.redoStack.forEach(i=>rg(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=ig(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=ig(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*II(n){const e=Me(n.restDecoder);for(let t=0;tIa(n,V0,Wo),PI=(n,e)=>{if(n.constructor===dn){const{client:t,clock:r}=n.id;return new dn(Se(t,r+e),n.length-e)}else if(n.constructor===hn){const{client:t,clock:r}=n.id;return new hn(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))}},Ia=(n,e=ys,t=Ai)=>{if(n.length===1)return n[0];const r=n.map(u=>new e(As(u)));let i=r.map(u=>new xd(u,!0)),s=null;const o=new t,l=new Id(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===hn?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)Nr(l,s.struct,s.offset),s={struct:d,offset:0},u.next();else if(s.struct.id.clock+s.struct.length0&&(s.struct.constructor===hn?s.struct.length-=p:d=PI(d,p)),s.struct.mergeWith(d)||(Nr(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!==hn;d=u.next())Nr(l,s.struct,s.offset),s={struct:d,offset:0}}s!==null&&(Nr(l,s.struct,s.offset),s=null),Rd(l);const a=r.map(u=>$d(u)),c=yf(a);return Ms(o,c),o.toUint8Array()},LI=(n,e,t=ys,r=Ai)=>{const i=W0(e),s=new r,o=new Id(s),l=new t(As(n)),a=new xd(l,!1);for(;a.curr;){const u=a.curr,f=u.id.client,d=i.get(f)||0;if(a.curr.constructor===hn){a.next();continue}if(u.id.clock+u.length>d)for(Nr(o,u,Di(d-u.id.clock,0)),a.next();a.curr&&a.curr.id.client===f;)Nr(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()}Rd(o);const c=$d(l);return Ms(s,c),s.toUint8Array()},e1=n=>{n.written>0&&(n.clientStructs.push({written:n.written,restEncoder:qn(n.encoder.restEncoder)}),n.encoder.restEncoder=hc(),n.written=0)},Nr=(n,e,t)=>{n.written>0&&n.currClient!==e.id.client&&e1(n),n.written===0&&(n.currClient=e.id.client,n.encoder.writeClient(e.id.client),xe(n.encoder.restEncoder,e.id.clock+t)),e.write(n.encoder,t),n.written++},Rd=n=>{e1(n);const e=n.encoder.restEncoder;xe(e,n.clientStructs.length);for(let t=0;t{const i=new t(As(n)),s=new xd(i,!1),o=new r,l=new Id(o);for(let c=s.curr;c!==null;c=s.next())Nr(l,e(c),0);Rd(l);const a=$d(i);return Ms(o,a),o.toUint8Array()},FI=n=>BI(n,Bx,ys,Wo),sg="You must not compute changes after the event-handler fired.";class gc{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=zI(this.currentTarget,this.target))}deletes(e){return Es(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ur(sg);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=au(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=au(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=au(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 Ur(sg);const t=this.target,r=_i(),i=_i(),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 zI=(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},t1=80;let Pd=0;class VI{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Pd++}}const HI=n=>{n.timestamp=Pd++},n1=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=Pd++},UI=(n,e,t)=>{if(n.length>=t1){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)=>Al(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&&Al(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=Di(e,i.index+t))}},yc=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Gr(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;q0(r._eH,t,e)};class Dt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Xm(),this._dEH=Xm(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw En()}clone(){throw En()}_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){Qm(this._eH,e)}observeDeep(e){Qm(this._dEH,e)}unobserve(e){Zm(this._eH,e)}unobserveDeep(e){Zm(this._dEH,e)}toJSON(){}}const r1=(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},i1=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&&ri(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},jI=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}}}},l1=(n,e)=>{const t=bc(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 Mi(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 qo(new Uint8Array(f))),i.integrate(n,0);break;case Os: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 Dt)i=new Ue(Se(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new In(f)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},a1=()=>Ur("Length exceeded!"),c1=(n,e,t,r)=>{if(t>e._length)throw a1();if(t===0)return e._searchMarker&&No(e._searchMarker,t,r.length),Ra(n,e,null,r);const i=t,s=bc(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 Ra(n,e,i,t)},u1=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=bc(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 a1();e._searchMarker&&No(e._searchMarker,i,-s+r)},Pa=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Ld=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new Mi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:l=new Mi([r]);break;case Uint8Array:l=new qo(r);break;case Os:l=new Jo(r);break;default:if(r instanceof Dt)l=new In(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)},Bd=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},f1=n=>{const e={};return n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},d1=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted},KI=(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&&ri(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},hl=n=>lI(n.entries(),e=>!e[1].deleted);class qI extends gc{constructor(e,t){super(e,t),this._transaction=t}}class ts extends Dt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new ts;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ts}clone(){const e=new ts;return e.insert(0,this.toArray().map(t=>t instanceof Dt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,t){super._callObserver(e,t),yc(this,e,new qI(this,e))}insert(e,t){this.doc!==null?Je(this.doc,r=>{c1(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?Je(this.doc,t=>{WI(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?Je(this.doc,r=>{u1(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return l1(this,e)}toArray(){return i1(this)}slice(e=0,t=this.length){return r1(this,e,t)}toJSON(){return this.map(e=>e instanceof Dt?e.toJSON():e)}map(e){return o1(this,e)}forEach(e){Do(this,e)}[Symbol.iterator](){return jI(this)}_write(e){e.writeTypeRef(bR)}}const JI=n=>new ts;class GI extends gc{constructor(e,t,r){super(e,t),this.keysChanged=r}}class vs extends Dt{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 vs}clone(){const e=new vs;return this.forEach((t,r)=>{e.set(r,t instanceof Dt?t.clone():t)}),e}_callObserver(e,t){yc(this,e,new GI(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 Dt?i.toJSON():i}}),e}get size(){return[...hl(this._map)].length}keys(){return hu(hl(this._map),e=>e[0])}values(){return hu(hl(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return hu(hl(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=>{Pa(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?Je(this.doc,r=>{Ld(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Bd(this,e)}has(e){return d1(this,e)}clear(){this.doc!==null?Je(this.doc,e=>{this.forEach(function(t,r,i){Pa(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(yR)}}const YI=n=>new vs,Rr=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&Lx(n,e);class kf{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&vn(),this.right.content.constructor){case at:this.right.deleted||$s(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 og=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case at:e.right.deleted||$s(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t{const i=new Map,s=r?bc(e,t):null;if(s){const o=new kf(s.p.left,s.p,s.index,i);return og(n,o,t-s.index)}else{const o=new kf(null,e._start,0,i);return og(n,o,t)}},h1=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===at&&Rr(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()})},$s=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},p1=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===at&&Rr(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},m1=(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(!Rr(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},mu=(n,e,t,r,i)=>{t.currentAttributes.forEach((d,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;p1(t,i);const l=m1(n,e,t,i),a=r.constructor===String?new Dn(r):r instanceof Dt?new In(r):new xi(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(),h1(n,e,t,l)},lg=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;p1(t,i);const l=m1(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(Rr(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+=` +`},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()}}}),KN=Ct.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]}`,Ze(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=>Vu({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Na=200,wt=function(){};wt.prototype.append=function(e){return e.length?(e=wt.from(e),!this.length&&e||e.length=t?wt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};wt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};wt.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)};wt.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};wt.from=function(e){return e instanceof wt?e:e&&e.length?new u0(e):wt.empty};var u0=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<=Na)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Na)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}(wt);wt.empty=new u0([]);var qN=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}(wt);const JN=500;class Cn{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 Sr(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 Sr(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 Cn(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;uYN&&(l=GN(l,c),o-=c),new Cn(l.append(s),o)}remapping(e,t){let r=new Ji;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 Cn(this.items.append(e.map(t=>new Sr(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 Sr(p,m,g))}else r.push(new Sr(p))},i);let c=[];for(let d=t;dJN&&(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 Sr(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 Cn(wt.from(i.reverse()),s)}}Cn.empty=new Cn(wt.empty,0);function GN(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}let Sr=class f0{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 f0(t.getMap().invert(),t,this.selection)}}};class Mr{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const YN=20;function XN(n,e,t,r){let i=t.getMeta(mi),s;if(i)return i.historyState;t.getMeta(eD)&&(n=new Mr(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(mi))return o.getMeta(mi).redo?new Mr(n.done.addTransform(t,void 0,r,Cl(e)),n.undone,Om(t.mapping.maps),n.prevTime,n.prevComposition):new Mr(n.done,n.undone.addTransform(t,void 0,r,Cl(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||!QN(t,n.prevRanges)),c=o?ou(n.prevRanges,t.mapping):Om(t.mapping.maps);return new Mr(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Cl(e)),Cn.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Mr(n.done.rebased(t,s),n.undone.rebased(t,s),ou(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Mr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),ou(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function QN(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 Om(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function ou(n,e){if(!n)return null;let t=[];for(let r=0;r{let i=mi.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=ZN(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const h0=d0(!1,!0),p0=d0(!0,!0),nD=xt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>h0(n,e),redo:()=>({state:n,dispatch:e})=>p0(n,e)}},addProseMirrorPlugins(){return[tD(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()}}}),rD=Ct.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Ze(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(ve.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(de.create(i.doc,l.pos)):i.setSelection(ve.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(ve.create(i.doc,a+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ty({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),iD=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,sD=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,oD=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,lD=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,aD=gn.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",Ze(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[us({find:iD,type:this.type}),us({find:oD,type:this.type})]},addPasteRules(){return[ki({find:sD,type:this.type}),ki({find:lD,type:this.type})]}}),cD=Ct.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ze(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)}}}),uD=Ct.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ze(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)}}}),Nm=gn.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=oc(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Dm=/^(\d+)\.\s$/,fD=Ct.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",Ze(this.options.HTMLAttributes,t),0]:["ol",Ze(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(uD.name,this.editor.getAttributes(Nm.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:Dm,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:Dm,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Nm.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),dD=Ct.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hD=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,pD=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,mD=gn.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",Ze(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 Xf()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[us({find:hD,type:this.type})]},addPasteRules(){return[ki({find:pD,type:this.type})]}}),gD=Ct.create({name:"text",group:"inline"}),m0=xt.create({name:"starterKit",addExtensions(){var n,e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;const _=[];return this.options.blockquote!==!1&&_.push(vN.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&_.push(_N.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&_.push(TN.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&_.push(ON.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&_.push(DN.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&_.push(xN.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&_.push(PN.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&_.push(jN.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&_.push(WN.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&_.push(KN.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&_.push(nD.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&_.push(rD.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&_.push(aD.configure((d=this.options)===null||d===void 0?void 0:d.italic)),this.options.listItem!==!1&&_.push(cD.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&_.push(fD.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&_.push(dD.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&_.push(mD.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&_.push(gD.configure((b=this.options)===null||b===void 0?void 0:b.text)),_}}),bD=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,g0=Ct.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",Ze(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[ty({find:bD,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),yD=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/,vD=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g,b0=n=>n.match(yD),xm=n=>n?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",wD=n=>{const{url:e,allowFullscreen:t,autoplay:r,ccLanguage:i,ccLoadPolicy:s,controls:o,disableKBcontrols:l,enableIFrameApi:a,endTime:c,interfaceLanguage:u,ivLoadPolicy:f,loop:d,modestBranding:h,nocookie:p,origin:m,playlist:g,progressBarColor:b,startAt:_}=n;if(!b0(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const L=e.split("/").pop();return L?`${xm(p)}${L}`:null}const v=/(?:v=|shorts\/)([-\w]+)/gm.exec(e);if(!v||!v[1])return null;let z=`${xm(p)}${v[1]}`;const C=[];return t===!1&&C.push("fs=0"),r&&C.push("autoplay=1"),i&&C.push(`cc_lang_pref=${i}`),s&&C.push("cc_load_policy=1"),o||C.push("controls=0"),l&&C.push("disablekb=1"),a&&C.push("enablejsapi=1"),c&&C.push(`end=${c}`),u&&C.push(`hl=${u}`),f&&C.push(`iv_load_policy=${f}`),d&&C.push("loop=1"),h&&C.push("modestbranding=1"),m&&C.push(`origin=${m}`),g&&C.push(`playlist=${g}`),_&&C.push(`start=${_}`),b&&C.push(`color=${b}`),C.length&&(z+=`?${C.join("&")}`),z},y0=Ct.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:n=>({commands:e})=>b0(n.src)?e.insertContent({type:this.name,attrs:n}):!1}},addPasteRules(){return this.options.addPasteHandler?[i_({find:vD,type:this.type,getAttributes:n=>({src:n.input})})]:[]},renderHTML({HTMLAttributes:n}){const e=wD({url:n.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:n.start||0});return n.src=e,["div",{"data-youtube-video":""},["iframe",Ze(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor},n)]]}}),v0=gn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function kD(n){return[m0,t0.configure({element:n}),l0,g0.configure({inline:!0}),c0.configure({types:["heading","paragraph"]}),a0,y0.configure({inline:!0}),v0]}const SD=Math.floor,CD=(n,e)=>nn>e?n:e,w0=128,_l=127,AD=Number.MAX_SAFE_INTEGER,TD=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iSo.encode(n),MD=So?ED:TD;let ro=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ro&&ro.decode(new Uint8Array).length===1&&(ro=null);const Da=(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},uc=(n,e)=>{for(;e>_l;)Da(n,w0|_l&e),e=SD(e/128);Da(n,_l&e)},af=new Uint8Array(3e4),OD=af.length/3,$D=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;uc(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=CD(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(_D(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},ID=(n,e)=>{uc(n,e.byteLength),xD(n,e)},k0=n=>new Error(n),RD=k0("Unexpected end of array"),PD=k0("Integer out of Range"),LD=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},BD=n=>LD(n,kd(n)),Im=n=>n.arr[n.pos++],kd=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posAD)throw PD}throw RD},FD=n=>{let e=kd(n);if(e===0)return"";{let t=String.fromCodePoint(Im(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(Im(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))}},zD=n=>ro.decode(BD(n)),Rm=ro?zD:FD;var Co;(function(n){n[n.Token=0]="Token",n[n.PermissionDenied=1]="PermissionDenied",n[n.Authenticated=2]="Authenticated"})(Co||(Co={}));const VD=(n,e)=>{uc(n,Co.Token),DD(n,e)},HD=(n,e,t)=>{switch(kd(n)){case Co.PermissionDenied:{e(Rm(n));break}case Co.Authenticated:{t(Rm(n));break}}},UD={code:1009,reason:"Message Too Big"},Pm={code:4401,reason:"Unauthorized"},jD={code:4403,reason:"Forbidden"},Lm=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t}));var cf;(function(n){n[n.Connecting=0]="Connecting",n[n.Open=1]="Open",n[n.Closing=2]="Closing",n[n.Closed=3]="Closed"})(cf||(cf={}));const Tn=()=>new Map,uf=n=>{const e=Tn();return n.forEach((t,r)=>{e.set(r,t)}),e},Gr=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},WD=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},KD=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},_i=()=>new Set,au=n=>n[n.length-1],qD=(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 Hr((this._observers.get(e)||Tn()).values()).forEach(r=>r(...t))}destroy(){this._observers=Tn()}}const hr=Math.floor,Al=Math.abs,fc=(n,e)=>nn>e?n:e,C0=n=>n!==0?n<0:1/n<0,Bm=1,Fm=2,cu=4,uu=8,_o=32,ur=64,on=128,dc=31,df=63,gi=127,GD=2147483647,_0=Number.MAX_SAFE_INTEGER,YD=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&hr(n)===n),XD=n=>n.toLowerCase(),QD=/^\s*/g,ZD=n=>n.replace(QD,""),ex=/([A-Z])/g,zm=(n,e)=>ZD(n.replace(ex,t=>`${e}${XD(t)}`)),tx=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iAo.encode(n),rx=Ao?nx:tx;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 hc=()=>new jo,ix=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array(ix(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},hf=mt,xe=(n,e)=>{for(;e>gi;)mt(n,on|gi&e),e=hr(e/128);mt(n,gi&e)},Sd=(n,e)=>{const t=C0(e);for(t&&(e=-e),mt(n,(e>df?on:0)|(t?ur:0)|df&e),e=hr(e/64);e>0;)mt(n,(e>gi?on:0)|gi&e),e=hr(e/128)},pf=new Uint8Array(3e4),ox=pf.length/3,lx=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;xe(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=fc(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(Di(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},tn=(n,e)=>{xe(n,e.byteLength),pc(n,e)},Cd=(n,e)=>{sx(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},cx=(n,e)=>Cd(n,4).setFloat32(0,e,!1),ux=(n,e)=>Cd(n,8).setFloat64(0,e,!1),fx=(n,e)=>Cd(n,8).setBigInt64(0,e,!1),Vm=new DataView(new ArrayBuffer(4)),dx=n=>(Vm.setFloat32(0,n),Vm.getFloat32(0)===n),To=(n,e)=>{switch(typeof e){case"string":mt(n,119),Qi(n,e);break;case"number":YD(e)&&Al(e)<=GD?(mt(n,125),Sd(n,e)):dx(e)?(mt(n,124),cx(n,e)):(mt(n,123),ux(n,e));break;case"bigint":mt(n,122),fx(n,e);break;case"object":if(e===null)mt(n,126);else if(ff(e)){mt(n,117),xe(n,e.length);for(let t=0;t0&&xe(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Um=n=>{n.count>0&&(Sd(n.encoder,n.count===1?n.s:-n.s),n.count>1&&xe(n.encoder,n.count-2))};class Tl{constructor(){this.encoder=new jo,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Um(this),this.count=1,this.s=e)}toUint8Array(){return Um(this),qn(this.encoder)}}const jm=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);Sd(n.encoder,e),n.count>1&&xe(n.encoder,n.count-2)}};class fu{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++):(jm(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return jm(this),qn(this.encoder)}}class hx{constructor(){this.sarr=[],this.s="",this.lensE=new Tl}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="",Qi(e,this.sarr.join("")),pc(e,this.lensE.toUint8Array()),qn(e)}}const Ur=n=>new Error(n),En=()=>{throw Ur("Method unimplemented")},vn=()=>{throw Ur("Unexpected case")},A0=Ur("Unexpected end of array"),T0=Ur("Integer out of Range");let mc=class{constructor(e){this.arr=e,this.pos=0}};const As=n=>new mc(n),px=n=>n.pos!==n.arr.length,mx=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},nn=n=>mx(n,Me(n)),gs=n=>n.arr[n.pos++],Me=n=>{let e=0,t=1;const r=n.arr.length;for(;n.pos_0)throw T0}throw A0},_d=n=>{let e=n.arr[n.pos++],t=e&df,r=64;const i=(e&ur)>0?-1:1;if(!(e&on))return i*t;const s=n.arr.length;for(;n.pos_0)throw T0}throw A0},gx=n=>{let e=Me(n);if(e===0)return"";{let t=String.fromCodePoint(gs(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(gs(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))}},bx=n=>io.decode(nn(n)),Zi=io?bx:gx,Ad=(n,e)=>{const t=new DataView(n.arr.buffer,n.arr.byteOffset+n.pos,e);return n.pos+=e,t},yx=n=>Ad(n,4).getFloat32(0,!1),vx=n=>Ad(n,8).getFloat64(0,!1),wx=n=>Ad(n,8).getBigInt64(0,!1),kx=[n=>{},n=>null,_d,yx,vx,wx,n=>!1,n=>!0,Zi,n=>{const e=Me(n),t={};for(let r=0;r{const e=Me(n),t=[];for(let r=0;rkx[127-gs(n)](n);class Wm extends mc{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),px(this)?this.count=Me(this)+1:this.count=-1),this.count--,this.s}}class El extends mc{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=_d(this);const e=C0(this.s);this.count=1,e&&(this.s=-this.s,this.count=Me(this)+2)}return this.count--,this.s}}class du extends mc{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=_d(this),t=e&1;this.diff=hr(e/2),this.count=1,t&&(this.count=Me(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Sx{constructor(e){this.decoder=new El(e),this.str=Zi(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 Cx=crypto.getRandomValues.bind(crypto),_x=Math.random,E0=()=>Cx(new Uint32Array(1))[0],Ax=n=>n[hr(_x()*n.length)],Tx="10000000-1000-4000-8000"+-1e11,Ex=()=>Tx.replace(/[018]/g,n=>(n^E0()&15>>n/4).toString(16)),Mx=Date.now,Km=n=>new Promise(n);Promise.all.bind(Promise);const qm=n=>n===void 0?null:n;let Ox=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},M0=new Ox,$x=!0;try{typeof localStorage<"u"&&localStorage&&(M0=localStorage,$x=!1)}catch{}const Nx=M0,Dx=Object.assign,O0=Object.keys,xx=(n,e)=>{for(const t in n)e(n[t],t)},Jm=n=>O0(n).length,Ix=n=>{for(const e in n)return!1;return!0},Rx=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},Px=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),Lx=(n,e)=>n===e||Jm(n)===Jm(e)&&Rx(n,(t,r)=>(t!==void 0||Px(e,r))&&e[r]===t),Td=(n,e,t=0)=>{try{for(;tn,Fx=(n,e)=>e.includes(n);var $0={};const bs=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",zx=typeof window<"u"&&typeof document<"u"&&!bs;let Fn;const Vx=()=>{if(Fn===void 0)if(bs){Fn=Tn();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");Fn.set(`--${zm(e,"-")}`,t),Fn.set(`-${zm(e,"-")}`,t)}})):Fn=Tn();return Fn},mf=n=>Vx().has(n),gf=n=>qm(bs?$0[n.toUpperCase().replaceAll("-","_")]:Nx.getItem(n)),Hx=n=>mf("--"+n)||gf(n)!==null;Hx("production");const Gm=bs&&Fx($0.FORCE_COLOR,["true","1","2"]),Ux=!mf("no-colors")&&(!bs||process.stdout.isTTY||Gm)&&(!bs||mf("color")||Gm||gf("COLORTERM")!==null||(gf("TERM")||"").includes("color")),jx=n=>new Uint8Array(n),Wx=n=>{const e=jx(n.byteLength);return e.set(n),e};class Kx{constructor(e,t){this.left=e,this.right=t}}const sr=(n,e)=>new Kx(n,e),qx=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const Jx=n=>WD(n,(e,t)=>`${t}:${e};`).join(""),Gx=n=>class{constructor(t){this._=t}destroy(){n(this._)}},Yx=Gx(clearTimeout),bf=(n,e)=>new Yx(setTimeout(e,n)),pr=Symbol,N0=pr(),D0=pr(),Xx=pr(),Qx=pr(),Zx=pr(),x0=pr(),eI=pr(),Ed=pr(),tI=pr(),nI=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=Tn();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(...I0(n)),R0.forEach(e=>e.print(n))},oI=(...n)=>{console.warn(...I0(n)),n.unshift(Ed),R0.forEach(e=>e.print(n))},R0=_i(),P0=n=>({[Symbol.iterator](){return this},next:n}),lI=(n,e)=>P0(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),hu=(n,e)=>P0(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Md{constructor(e,t){this.clock=e,this.len=t}}class Ts{constructor(){this.clients=new Map}}const jr=(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=hr((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&&aI(t,e.clock)!==null},Od=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=Di(i.len,s.clock+s.len-i.clock):(r{const e=new Ts;for(let t=0;t{if(!e.clients.has(i)){const s=r.slice();for(let o=t+1;o{Gr(n.clients,e,()=>[]).push(new Md(t,r))},L0=()=>new Ts,B0=n=>{const e=L0();return n.clients.forEach((t,r)=>{const i=[];for(let s=0;s0&&e.clients.set(r,i)}),e},Ms=(n,e)=>{xe(n.restEncoder,e.clients.size),Hr(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),xe(n.restEncoder,t);const i=r.length;xe(n.restEncoder,i);for(let s=0;s{const e=new Ts,t=Me(n.restDecoder);for(let r=0;r0){const o=Gr(e.clients,i,()=>[]);for(let l=0;l{const r=new Ts,i=Me(n.restDecoder);for(let s=0;s0){const s=new Ai;return xe(s.restEncoder,0),Ms(s,r),s.toUint8Array()}return null},F0=E0;class Os extends S0{constructor({guid:e=Ex(),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=F0(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new G0,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=Km(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>Km(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(Hr(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Je(this,e,t)}get(e,t=Dt){const r=Gr(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==Dt&&i!==t)if(i===Dt){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,ts)}getText(e=""){return this.get(e,Ti)}getMap(e=""){return this.get(e,vs)}getXmlElement(e=""){return this.get(e,Ht)}getXmlFragment(e=""){return this.get(e,Ei)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){Hr(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Os({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 z0{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Me(this.restDecoder)}readDsLen(){return Me(this.restDecoder)}}class V0 extends z0{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 gs(this.restDecoder)}readString(){return Zi(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 Wx(nn(this.restDecoder))}readJSON(){return JSON.parse(Zi(this.restDecoder))}readKey(){return Zi(this.restDecoder)}}class cI{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 ys extends cI{constructor(e){super(e),this.keys=[],Me(e),this.keyClockDecoder=new du(nn(e)),this.clientDecoder=new El(nn(e)),this.leftClockDecoder=new du(nn(e)),this.rightClockDecoder=new du(nn(e)),this.infoDecoder=new Wm(nn(e),gs),this.stringDecoder=new Sx(nn(e)),this.parentInfoDecoder=new Wm(nn(e),gs),this.typeRefDecoder=new El(nn(e)),this.lenDecoder=new El(nn(e))}readLeftID(){return new es(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new es(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 nn(this.restDecoder)}readJSON(){return Eo(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e{r=Di(r,e[0].id.clock);const i=Qn(e,r);xe(n.restEncoder,e.length-i),n.writeClient(t),xe(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)}),Ko(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),xe(n.restEncoder,r.size),Hr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{uI(n,e.clients.get(i),i,s)})},fI=(n,e)=>{const t=Tn(),r=Me(n.restDecoder);for(let i=0;i{const r=[];let i=Hr(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 G0,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!==hn){const p=Gr(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 Ai;return Nd(h,l,new Map),xe(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},hI=(n,e)=>Nd(n,e.doc.store,e.beforeState),pI=(n,e,t,r=new ys(n))=>Je(e,i=>{i.local=!1;let s=!1;const o=i.doc,l=o.store,a=fI(r,o),c=dI(i,l,a),u=l.pendingStructs;if(u){for(const[d,h]of u.missing)if(hh)&&u.missing.set(d,h)}u.update=Ia([u.update,c.update])}}else l.pendingStructs=c;const f=Ym(r,i,l);if(l.pendingDs){const d=new ys(As(l.pendingDs));Me(d.restDecoder);const h=Ym(d,i,l);f&&h?l.pendingDs=Ia([f,h]):l.pendingDs=f||h}else l.pendingDs=f;if(s){const d=l.pendingStructs.update;l.pendingStructs=null,j0(i.doc,d)}},t,!1),j0=(n,e,t,r=ys)=>{const i=As(e);pI(i,n,t,new r(i))},mI=(n,e,t)=>j0(n,e,t,V0),gI=(n,e,t=new Map)=>{Nd(n,e.store,t),Ms(n,B0(e.store))},bI=(n,e=new Uint8Array([0]),t=new Ai)=>{const r=W0(e);gI(t,n,r);const i=[t.toUint8Array()];if(n.store.pendingDs&&i.push(n.store.pendingDs),n.store.pendingStructs&&i.push(LI(n.store.pendingStructs.update,e)),i.length>1){if(t.constructor===Wo)return RI(i.map((s,o)=>o===0?s:FI(s)));if(t.constructor===Ai)return Ia(i)}return i[0]},yI=(n,e)=>bI(n,e,new Wo),vI=n=>{const e=new Map,t=Me(n.restDecoder);for(let r=0;rvI(new z0(As(n))),K0=(n,e)=>(xe(n.restEncoder,e.size),Hr(e.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{xe(n.restEncoder,t),xe(n.restEncoder,r)}),n),wI=(n,e)=>K0(n,Ko(e.store)),kI=(n,e=new U0)=>(n instanceof Map?K0(e,n):wI(e,n),e.toUint8Array()),SI=n=>kI(n,new H0);class CI{constructor(){this.l=[]}}const Xm=()=>new CI,Qm=(n,e)=>n.l.push(e),Zm=(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.")},q0=(n,e,t)=>Td(n.l,[e,t]);class es{constructor(e,t){this.client=e,this.clock=t}}const fl=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,Se=(n,e)=>new es(n,e),Oo=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw vn()},$o=(n,e)=>{for(;e!==null;){if(e.parent===n)return!0;e=e.parent._item}return!1};class xa{constructor(e,t,r,i=0){this.type=e,this.tname=t,this.item=r,this.assoc=i}}class _I{constructor(e,t,r=0){this.type=e,this.index=t,this.assoc=r}}const AI=(n,e,t=0)=>new _I(n,e,t),dl=(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 xa(r,i,e,t)},pu=(n,e,t=0)=>{let r=n._start;if(t<0){if(e===0)return dl(n,null,t);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return dl(n,Se(r.id.client,r.id.clock+e),t);e-=r.length}if(r.right===null&&t<0)return dl(n,r.lastId,t);r=r.right}return dl(n,null,t)},TI=(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=Sf(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}=Sf(t,i);if(c instanceof Ue&&c.content instanceof In)l=c.content.type;else return null}else throw vn();o>=0?a=l._length:a=0}return AI(l,a,n.assoc)};class Dd{constructor(e,t){this.ds=e,this.sv=t}}const J0=(n,e)=>new Dd(n,e),EI=n=>J0(B0(n.store),Ko(n.store)),ri=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!Es(e.ds,n.id),vf=(n,e)=>{const t=Gr(n.meta,vf,_i),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i{}),t.add(e))};class G0{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Ko=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},Y0=(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 vn()}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=hr(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)]},Ml=MI,wf=(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[wf(n,t,e.clock)]},eg=(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!==dn&&r.splice(i+1,0,Fa(n,s,t.clock-s.id.clock+1)),s},OI=(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=wf(n,e,t),l;do l=e[o++],se.deleteSet.clients.size===0&&!KD(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Od(e.deleteSet),hI(n,e),Ms(n,e.deleteSet),!0),ng=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Gr(n.changed,e,_i).add(t)},Ol=(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},NI=(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=fc(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+Ol(i,a)}})},Q0=(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),q0(c._dEH,a,t))})}),l.push(()=>r.emit("afterTransaction",[t,r])),Td(l,[]),t._needFormattingCleanup&&ZI(t)}finally{r.gc&&NI(s,i,r.gcFilter),DI(s,i),t.afterState.forEach((u,f)=>{const d=t.beforeState.get(f)||0;if(d!==u){const h=i.clients.get(f),p=Di(Qn(h,d),1);for(let m=h.length-1;m>=p;)m-=1+Ol(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&&Ol(h,p)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(sI(Ed,N0,"[yjs] ",D0,x0,"Changed the client-id because another client seems to be using it."),r.clientID=F0()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new Wo;tg(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new Ai;tg(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])):Q0(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 $I(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&&Q0(i,0)}}return o};class xI{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}}const rg=(n,e,t)=>{jr(n,t.deletions,r=>{r instanceof Ue&&e.scope.some(i=>$o(i,r))&&zd(r,!1)})},ig=(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;jr(o,a.insertions,d=>{if(d instanceof Ue){if(d.redone!==null){let{item:h,diff:p}=Sf(l,d.id);p>0&&(h=Yt(o,Se(h.id.client,h.id.clock+p))),d=h}!d.deleted&&s.some(h=>$o(h,d))&&u.push(d)}}),jr(o,a.deletions,d=>{d instanceof Ue&&s.some(h=>$o(h,d))&&!Es(a.insertions,d.id)&&c.add(d)}),c.forEach(d=>{f=y1(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 Z0 extends S0{constructor(e,{captureTimeout:t=500,captureTransaction:r=a=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:l=ff(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 Ts;a.afterState.forEach((g,b)=>{const _=a.beforeState.get(b)||0,E=g-_;E>0&&Mo(d,b,_,E)});const h=Mx();let p=!1;if(this.lastChange>0&&h-this.lastChange0&&!c&&!u){const g=f[f.length-1];g.deletions=yf([g.deletions,a.deleteSet]),g.insertions=yf([g.insertions,d])}else f.push(new xI(a.deleteSet,d)),p=!0;!c&&!u&&(this.lastChange=h),jr(a,a.deleteSet,g=>{g instanceof Ue&&this.scope.some(b=>$o(b,g))&&zd(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=ff(e)?e:[e],e.forEach(t=>{this.scope.every(r=>r!==t)&&(t.doc!==this.doc&&oI("[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=>rg(r,this,i)),this.undoStack=[]),t&&(this.redoStack.forEach(i=>rg(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=ig(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=ig(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*II(n){const e=Me(n.restDecoder);for(let t=0;tIa(n,V0,Wo),PI=(n,e)=>{if(n.constructor===dn){const{client:t,clock:r}=n.id;return new dn(Se(t,r+e),n.length-e)}else if(n.constructor===hn){const{client:t,clock:r}=n.id;return new hn(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))}},Ia=(n,e=ys,t=Ai)=>{if(n.length===1)return n[0];const r=n.map(u=>new e(As(u)));let i=r.map(u=>new xd(u,!0)),s=null;const o=new t,l=new Id(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===hn?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)Nr(l,s.struct,s.offset),s={struct:d,offset:0},u.next();else if(s.struct.id.clock+s.struct.length0&&(s.struct.constructor===hn?s.struct.length-=p:d=PI(d,p)),s.struct.mergeWith(d)||(Nr(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!==hn;d=u.next())Nr(l,s.struct,s.offset),s={struct:d,offset:0}}s!==null&&(Nr(l,s.struct,s.offset),s=null),Rd(l);const a=r.map(u=>$d(u)),c=yf(a);return Ms(o,c),o.toUint8Array()},LI=(n,e,t=ys,r=Ai)=>{const i=W0(e),s=new r,o=new Id(s),l=new t(As(n)),a=new xd(l,!1);for(;a.curr;){const u=a.curr,f=u.id.client,d=i.get(f)||0;if(a.curr.constructor===hn){a.next();continue}if(u.id.clock+u.length>d)for(Nr(o,u,Di(d-u.id.clock,0)),a.next();a.curr&&a.curr.id.client===f;)Nr(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()}Rd(o);const c=$d(l);return Ms(s,c),s.toUint8Array()},e1=n=>{n.written>0&&(n.clientStructs.push({written:n.written,restEncoder:qn(n.encoder.restEncoder)}),n.encoder.restEncoder=hc(),n.written=0)},Nr=(n,e,t)=>{n.written>0&&n.currClient!==e.id.client&&e1(n),n.written===0&&(n.currClient=e.id.client,n.encoder.writeClient(e.id.client),xe(n.encoder.restEncoder,e.id.clock+t)),e.write(n.encoder,t),n.written++},Rd=n=>{e1(n);const e=n.encoder.restEncoder;xe(e,n.clientStructs.length);for(let t=0;t{const i=new t(As(n)),s=new xd(i,!1),o=new r,l=new Id(o);for(let c=s.curr;c!==null;c=s.next())Nr(l,e(c),0);Rd(l);const a=$d(i);return Ms(o,a),o.toUint8Array()},FI=n=>BI(n,Bx,ys,Wo),sg="You must not compute changes after the event-handler fired.";class gc{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=zI(this.currentTarget,this.target))}deletes(e){return Es(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ur(sg);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=au(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=au(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=au(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 Ur(sg);const t=this.target,r=_i(),i=_i(),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 zI=(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},t1=80;let Pd=0;class VI{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Pd++}}const HI=n=>{n.timestamp=Pd++},n1=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=Pd++},UI=(n,e,t)=>{if(n.length>=t1){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)=>Al(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&&Al(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=Di(e,i.index+t))}},yc=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Gr(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;q0(r._eH,t,e)};class Dt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Xm(),this._dEH=Xm(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw En()}clone(){throw En()}_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){Qm(this._eH,e)}observeDeep(e){Qm(this._dEH,e)}unobserve(e){Zm(this._eH,e)}unobserveDeep(e){Zm(this._dEH,e)}toJSON(){}}const r1=(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},i1=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&&ri(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},jI=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}}}},l1=(n,e)=>{const t=bc(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 Mi(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 qo(new Uint8Array(f))),i.integrate(n,0);break;case Os: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 Dt)i=new Ue(Se(o,it(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new In(f)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},a1=()=>Ur("Length exceeded!"),c1=(n,e,t,r)=>{if(t>e._length)throw a1();if(t===0)return e._searchMarker&&No(e._searchMarker,t,r.length),Ra(n,e,null,r);const i=t,s=bc(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 Ra(n,e,i,t)},u1=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=bc(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 a1();e._searchMarker&&No(e._searchMarker,i,-s+r)},Pa=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Ld=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new Mi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:l=new Mi([r]);break;case Uint8Array:l=new qo(r);break;case Os:l=new Jo(r);break;default:if(r instanceof Dt)l=new In(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)},Bd=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},f1=n=>{const e={};return n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},d1=(n,e)=>{const t=n._map.get(e);return t!==void 0&&!t.deleted},KI=(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&&ri(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},hl=n=>lI(n.entries(),e=>!e[1].deleted);class qI extends gc{constructor(e,t){super(e,t),this._transaction=t}}class ts extends Dt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new ts;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ts}clone(){const e=new ts;return e.insert(0,this.toArray().map(t=>t instanceof Dt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,t){super._callObserver(e,t),yc(this,e,new qI(this,e))}insert(e,t){this.doc!==null?Je(this.doc,r=>{c1(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?Je(this.doc,t=>{WI(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?Je(this.doc,r=>{u1(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return l1(this,e)}toArray(){return i1(this)}slice(e=0,t=this.length){return r1(this,e,t)}toJSON(){return this.map(e=>e instanceof Dt?e.toJSON():e)}map(e){return o1(this,e)}forEach(e){Do(this,e)}[Symbol.iterator](){return jI(this)}_write(e){e.writeTypeRef(bR)}}const JI=n=>new ts;class GI extends gc{constructor(e,t,r){super(e,t),this.keysChanged=r}}class vs extends Dt{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 vs}clone(){const e=new vs;return this.forEach((t,r)=>{e.set(r,t instanceof Dt?t.clone():t)}),e}_callObserver(e,t){yc(this,e,new GI(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 Dt?i.toJSON():i}}),e}get size(){return[...hl(this._map)].length}keys(){return hu(hl(this._map),e=>e[0])}values(){return hu(hl(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return hu(hl(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=>{Pa(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?Je(this.doc,r=>{Ld(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Bd(this,e)}has(e){return d1(this,e)}clear(){this.doc!==null?Je(this.doc,e=>{this.forEach(function(t,r,i){Pa(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(yR)}}const YI=n=>new vs,Rr=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&Lx(n,e);class kf{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&vn(),this.right.content.constructor){case at:this.right.deleted||$s(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 og=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case at:e.right.deleted||$s(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t{const i=new Map,s=r?bc(e,t):null;if(s){const o=new kf(s.p.left,s.p,s.index,i);return og(n,o,t-s.index)}else{const o=new kf(null,e._start,0,i);return og(n,o,t)}},h1=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===at&&Rr(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()})},$s=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},p1=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===at&&Rr(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},m1=(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(!Rr(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},mu=(n,e,t,r,i)=>{t.currentAttributes.forEach((d,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;p1(t,i);const l=m1(n,e,t,i),a=r.constructor===String?new Dn(r):r instanceof Dt?new In(r):new xi(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(),h1(n,e,t,l)},lg=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;p1(t,i);const l=m1(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(Rr(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 Dn(a)),t.right.integrate(n,0),t.forward()}h1(n,e,t,l)},g1=(n,e,t,r,i)=>{let s=e;const o=Tn();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&&$s(i,c);break}}}e=e.right}return l},XI=(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}},QI=n=>{let e=0;return Je(n.doc,t=>{let r=n._start,i=n._start,s=Tn();const o=uf(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case at:$s(o,i.content);break;default:e+=g1(t,r,i,s,o),s=uf(o),r=i;break}i=i.right}}),e},ZI=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!==dn&&e.add(o.parent)})}Je(t,r=>{jr(n,n.deleteSet,i=>{if(i instanceof dn||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===at?e.add(s):XI(r,i)});for(const i of e)QI(i)})},ag=(n,e,t)=>{const r=t,i=uf(e.currentAttributes),s=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case In:case xi:case Dn: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},Ix(a)||(h.attributes=Dx({},a))),u=0;break}h&&t.push(h),l=null}};for(;o!==null;){switch(o.content.constructor){case In:case xi: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 Dn: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;Rr(m,p)?p!==null&&o.delete(r):(l==="retain"&&d(),Rr(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;Rr(m,p)||(l==="retain"&&d(),a[h]=m)}else if(!o.deleted){s.set(h,p);const m=a[h];m!==void 0&&(Rr(m,p)?m!==null&&o.delete(r):(l==="retain"&&d(),p===null?delete a[h]:a[h]=p))}o.deleted||(l==="insert"&&d(),$s(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 Ti extends Dt{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 Ti}clone(){const e=new Ti;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new eR(this,e,t);yc(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===Dn&&(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 kf(null,this._start,0,new Map);for(let s=0;s0)&&mu(r,this,i,l,o.attributes||{})}else o.retain!==void 0?lg(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&ag(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(ri(a,e)||t!==void 0&&ri(a,t))switch(a.content.constructor){case Dn:{const f=s.get("ychange");e!==void 0&&!ri(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&&!ri(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 In:case xi:{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:ri(a,e)&&(c(),$s(s,a.content));break}a=a.right}c()};return e||t?Je(o,f=>{e&&vf(f,e),t&&vf(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=pl(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),mu(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=pl(s,this,e,!r);mu(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=>{ag(i,pl(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=pl(s,this,e,!1);o.right!==null&&lg(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?Je(this.doc,t=>{Pa(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?Je(this.doc,r=>{Ld(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Bd(this,e)}getAttributes(){return f1(this)}_write(e){e.writeTypeRef(vR)}}const tR=n=>new Ti;class gu{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===Ht||t.constructor===Ei)&&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 Ei extends Dt{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 Ei}clone(){const e=new Ei;return e.insert(0,this.toArray().map(t=>t instanceof Dt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new gu(this,e)}querySelector(e){e=e.toUpperCase();const r=new gu(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Hr(new gu(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){yc(this,e,new iR(this,t,e))}toString(){return o1(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=>{c1(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 Dt?e._item:e;Ra(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 Ur("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?Je(this.doc,r=>{u1(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return i1(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return l1(this,e)}slice(e=0,t=this.length){return r1(this,e,t)}forEach(e){Do(this,e)}_write(e){e.writeTypeRef(kR)}}const nR=n=>new Ei;class Ht extends Ei{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 Ht(this.nodeName)}clone(){const e=new Ht(this.nodeName),t=this.getAttributes();return xx(t,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Dt?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=>{Pa(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?Je(this.doc,r=>{Ld(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Bd(this,e)}hasAttribute(e){return d1(this,e)}getAttributes(e){return e?KI(this,e):f1(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(wR),e.writeKey(this.nodeName)}}const rR=n=>new Ht(n.readKey());class iR extends gc{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 La extends vs{constructor(e){super(),this.hookName=e}_copy(){return new La(this.hookName)}clone(){const e=new La(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(SR),e.writeKey(this.hookName)}}const sR=n=>new La(n.readKey());class ln extends Ti{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 ln}clone(){const e=new ln;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(CR)}}const oR=n=>new ln;class Fd{constructor(e,t){this.id=e,this.length=t}get deleted(){throw En()}mergeWith(e){return!1}write(e,t,r){throw En()}integrate(e,t){throw En()}}const lR=0;class dn extends Fd{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),Y0(e.doc.store,this)}write(e,t){e.writeInfo(lR),e.writeLen(this.length-t)}getMissing(e,t){return null}}class qo{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new qo(this.content)}splice(e){throw En()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const aR=n=>new qo(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 cR=n=>new xo(n.readLen()),b1=(n,e)=>new Os({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(b1(this.doc.guid,this.opts))}splice(e){throw En()}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 uR=n=>new Jo(b1(n.readString(),n.readAny()));class xi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new xi(this.embed)}splice(e){throw En()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const fR=n=>new xi(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 En()}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 dR=n=>new at(n.readKey(),n.readJSON());class Ba{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ba(this.arr)}splice(e){const t=new Ba(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 mR=n=>new Dn(n.readString()),gR=[JI,YI,tR,rR,nR,sR,oR],bR=0,yR=1,vR=2,wR=3,kR=4,SR=5,CR=6;class In{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new In(this.type._copy())}splice(e){throw En()}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 _R=n=>new In(gR[n.readTypeRef()](n)),Sf=(n,e)=>{let t=e,r=0,i;do r>0&&(t=Se(t.client,t.clock+r)),i=Ml(n,t),r=t.clock-i.id.clock,t=i.redone;while(t!==null&&i instanceof Ue);return{item:i,diff:r}},zd=(n,e)=>{for(;n!==null&&n.keep!==e;)n.keep=e,n=n.parent._item},Fa=(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},cg=(n,e)=>JD(n,t=>Es(t.deletions,e)),y1=(n,e,t,r,i,s)=>{const o=n.doc,l=o.store,a=o.clientID,c=e.redone;if(c!==null)return Yt(n,c);let u=e.parent._item,f=null,d;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!t.has(u)||y1(n,u,t,r,i,s)===null))return null;for(;u.redone!==null;)u=Yt(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:Yt(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:Yt(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||Es(r,f.right.id)||cg(s.undoStack,f.right.id)||cg(s.redoStack,f.right.id));)for(f=f.right;f.redone;)f=Yt(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,zd(g,!0),g.integrate(n,0),g};class Ue extends Fd{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()?Fm:0}set marker(e){(this.info&uu)>0!==e&&(this.info^=uu)}get marker(){return(this.info&uu)>0}get keep(){return(this.info&Bm)>0}set keep(e){this.keep!==e&&(this.info^=Bm)}get countable(){return(this.info&Fm)>0}get deleted(){return(this.info&cu)>0}set deleted(e){this.deleted!==e&&(this.info^=cu)}markDeleted(){this.info|=cu}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===es&&this.id.client!==this.parent.client&&this.parent.clock>=it(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=eg(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Yt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===dn||this.right&&this.right.constructor===dn)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===es){const r=Ml(t,this.parent);r.constructor===dn?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=eg(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),fl(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),ng(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw vn();this.content.gc(e),t?OI(e,this,new dn(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()&dc|(r===null?0:on)|(i===null?0:ur)|(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===es?(e.writeParentInfo(!1),e.writeLeftID(l)):vn();s!==null&&e.writeString(s)}this.content.write(e,t)}}const v1=(n,e)=>AR[e&dc](n),AR=[()=>{vn()},cR,hR,aR,mR,fR,dR,_R,pR,uR,()=>{vn()}],TR=10;class hn extends Fd{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){vn()}write(e,t){e.writeInfo(TR),xe(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const w1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},k1="__ $YJS$ __";w1[k1]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");w1[k1]=!0;function ER(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 bu(n){return new Promise(e=>setTimeout(e,n))}function MR(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 OR(n,e){const t=ER(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 bu(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 bu(o),r.attemptNum<1&&t.initialJitter){const l=i(r,t);l&&await bu(l)}return s()}var S1={};const ns=()=>new Map,C1=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},_1=()=>new Set,$R=Array.from,NR=String.fromCharCode,DR=n=>n.toLowerCase(),xR=/^\s*/g,IR=n=>n.replace(xR,""),RR=/([A-Z])/g,ug=(n,e)=>IR(n.replace(RR,t=>`${e}${DR(t)}`)),PR=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iIo.encode(n),BR=Io?LR:PR;let so=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});so&&so.decode(new Uint8Array).length===1&&(so=null);const fg=n=>n===void 0?null:n;class FR{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let A1=new FR,Vd=!0;try{typeof localStorage<"u"&&localStorage&&(A1=localStorage,Vd=!1)}catch{}const T1=A1,zR=n=>Vd||addEventListener("storage",n),VR=n=>Vd||removeEventListener("storage",n),HR=Object.keys,UR=(n,e)=>{const t=[];for(const r in n)t.push(e(n[r],r));return t},dg=n=>HR(n).length,jR=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),WR=(n,e)=>n===e,oo=(n,e)=>{if(n==null||e==null)return WR(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),ws=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",E1=typeof window<"u"&&typeof document<"u"&&!ws;let zn;const qR=()=>{if(zn===void 0)if(ws){zn=ns();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");zn.set(`--${ug(e,"-")}`,t),zn.set(`-${ug(e,"-")}`,t)}})):zn=ns();return zn},Cf=n=>qR().has(n),_f=n=>fg(ws?S1[n.toUpperCase()]:T1.getItem(n)),JR=n=>Cf("--"+n)||_f(n)!==null;JR("production");const hg=ws&&KR(S1.FORCE_COLOR,["true","1","2"]);!Cf("no-colors")&&(!ws||process.stdout.isTTY||hg)&&(!ws||Cf("color")||hg||_f("COLORTERM")!==null||(_f("TERM")||"").includes("color"));const M1=Math.floor,GR=(n,e)=>nn>e?n:e,XR=64,za=128,QR=63,lo=127,O1=Number.MAX_SAFE_INTEGER;class ZR{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Hd=()=>new ZR,$1=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array($1(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},kt=(n,e)=>{for(;e>lo;)Va(n,za|lo&e),e=M1(e/128);Va(n,lo&e)},Af=new Uint8Array(3e4),eP=Af.length/3,tP=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;kt(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=GR(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(YR(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},Ns=(n,e)=>{kt(n,e.byteLength),rP(n,e)},N1=n=>new Error(n),D1=N1("Unexpected end of array"),x1=N1("Integer out of Range");class iP{constructor(e){this.arr=e,this.pos=0}}const I1=n=>new iP(n),sP=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},vc=n=>sP(n,bi(n)),pg=n=>n.arr[n.pos++],bi=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posO1)throw x1}throw D1},oP=n=>{let e=n.arr[n.pos++],t=e&QR,r=64;const i=(e&XR)>0?-1:1;if(!(e&za))return i*t;const s=n.arr.length;for(;n.posO1)throw x1}throw D1},lP=n=>{let e=bi(n);if(e===0)return"";{let t=String.fromCodePoint(pg(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(pg(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))}},aP=n=>so.decode(vc(n)),wc=so?aP:lP,cP=n=>{const e=n.pos,t=wc(n);return n.pos=e,t},uP=n=>new Uint8Array(n),fP=(n,e,t)=>new Uint8Array(n,e,t),dP=n=>new Uint8Array(n),hP=n=>{let e="";for(let t=0;tBuffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),mP=n=>{const e=atob(n),t=uP(e.length);for(let r=0;r{const e=Buffer.from(n,"base64");return fP(e.buffer,e.byteOffset,e.byteLength)},bP=E1?hP:pP,yP=E1?mP:gP,R1=new Map;class vP{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:yP(t.newValue||"")}),zR(this._onChange)}postMessage(e){T1.setItem(this.room,bP(dP(e)))}close(){VR(this._onChange)}}const wP=typeof BroadcastChannel>"u"?vP:BroadcastChannel,jd=n=>C1(R1,n,()=>{const e=_1(),t=new wP(n);return t.onmessage=r=>e.forEach(i=>i(r.data,"broadcastchannel")),{bc:t,subs:e}}),kP=(n,e)=>(jd(n).subs.add(e),e),SP=(n,e)=>{const t=jd(n),r=t.subs.delete(e);return r&&t.subs.size===0&&(t.bc.close(),R1.delete(n)),r},CP=(n,e,t=null)=>{const r=jd(n);r.bc.postMessage(e),r.subs.forEach(i=>i(e,t))},_P=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},ks=Date.now;class AP{constructor(){this._observers=ns()}on(e,t){C1(this._observers,e,_1).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 $R((this._observers.get(e)||ns()).values()).forEach(r=>r(...t))}destroy(){this._observers=ns()}}const yu=3e4;class TP extends AP{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=ks();this.getLocalState()!==null&&yu/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&yu<=t-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&$l(this,r,"timeout")},M1(yu/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:ks()});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 $l=(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]))},Tf=(n,e,t=n.states)=>{const r=e.length,i=Hd();kt(i,r);for(let s=0;s{const r=I1(e),i=ks(),s=[],o=[],l=[],a=[],c=bi(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 P1{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 MP=n=>UR(n,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");var bt;(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"})(bt||(bt={}));var pt;(function(n){n.Connecting="connecting",n.Connected="connected",n.Disconnected="disconnected"})(pt||(pt={}));class Nl{constructor(e){this.data=e,this.encoder=Hd(),this.decoder=I1(new Uint8Array(this.data))}peekVarString(){return cP(this.decoder)}readVarUint(){return bi(this.decoder)}readVarString(){return wc(this.decoder)}readVarUint8Array(){return vc(this.decoder)}writeVarUint(e){return kt(this.encoder,e)}writeVarString(e){return xn(this.encoder,e)}writeVarUint8Array(e){return Ns(this.encoder,e)}length(){return $1(this.encoder)}}class L1 extends P1{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=pt.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===pt.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===pt.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:OR(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=pt.Connecting,this.emit("status",{status:pt.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){var t;this.resolveConnectionAttempt(),this.lastMessageReceived=ks();const i=new Nl(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=pt.Connected,this.emit("status",{status:pt.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===pt.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=ks()-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=MP(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)===cf.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){if(this.closeTries=0,this.cleanupWebSocket(),this.status===pt.Connected&&(this.status=pt.Disconnected,this.emit("status",{status:pt.Disconnected}),this.emit("disconnect",{event:e})),e.code===Pm.code&&(e.reason===Pm.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===jD.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===UD.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!==pt.Disconnected&&(this.status=pt.Disconnected,this.emit("status",{status:pt.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 B1=0,Wd=1,F1=2,OP=(n,e)=>{kt(n,B1);const t=SI(e);Ns(n,t)},z1=(n,e,t)=>{kt(n,Wd),Ns(n,yI(e,t))},$P=(n,e,t)=>z1(e,t,vc(n)),V1=(n,e,t)=>{try{mI(e,vc(n),t)}catch(r){console.error("Caught error while handling a Yjs update",r)}},NP=(n,e)=>{kt(n,F1),Ns(n,e)},DP=V1,xP=(n,e,t,r)=>{const i=bi(n);switch(i){case B1:$P(n,e,t);break;case Wd:V1(n,t,r);break;case F1:DP(n,t,r);break;default:throw new Error("Unknown message type")}return i};class Zn{constructor(){this.encoder=Hd()}get(e){return e.encoder}toUint8Array(){return Ud(this.encoder)}}class mg{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 bt.Sync:this.applySyncMessage(e,t);break;case bt.Awareness:this.applyAwarenessMessage(e);break;case bt.Auth:this.applyAuthMessage(e);break;case bt.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case bt.Stateless:e.receiveStateless(wc(r.decoder));break;case bt.SyncStatus:this.applySyncStatusMessage(e,oP(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(bt.Sync);const i=xP(r.decoder,r.encoder,e.document,e);t&&i===Wd&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;EP(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){const{message:t}=this;HD(t.decoder,e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;t.writeVarUint(bt.Awareness),t.writeVarUint8Array(Tf(e.awareness,Array.from(e.awareness.getStates().keys())))}}class gg{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return Ud(this.encoder)}send(e){e==null||e.send(this.create())}broadcast(e){CP(e,this.create())}}class IP extends Zn{constructor(){super(...arguments),this.type=bt.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return xn(this.encoder,e.documentName),kt(this.encoder,this.type),VD(this.encoder,e.token),this.encoder}}class ml extends Zn{constructor(){super(...arguments),this.type=bt.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");xn(this.encoder,e.documentName),kt(this.encoder,this.type);let t;return e.states===void 0?t=Tf(e.awareness,e.clients):t=Tf(e.awareness,e.clients,e.states),Ns(this.encoder,t),this.encoder}}class RP extends Zn{constructor(){super(...arguments),this.type=bt.CLOSE,this.description="Ask the server to close the connection"}get(e){return xn(this.encoder,e.documentName),kt(this.encoder,this.type),this.encoder}}class PP extends Zn{constructor(){super(...arguments),this.type=bt.QueryAwareness,this.description="Queries awareness states"}get(e){return xn(this.encoder,e.documentName),kt(this.encoder,this.type),this.encoder}}class LP extends Zn{constructor(){super(...arguments),this.type=bt.Stateless,this.description="A stateless message"}get(e){var t;return xn(this.encoder,e.documentName),kt(this.encoder,this.type),xn(this.encoder,(t=e.payload)!==null&&t!==void 0?t:""),this.encoder}}class vu extends Zn{constructor(){super(...arguments),this.type=bt.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 xn(this.encoder,e.documentName),kt(this.encoder,this.type),OP(this.encoder,e.document),this.encoder}}class BP extends Zn{constructor(){super(...arguments),this.type=bt.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 xn(this.encoder,e.documentName),kt(this.encoder,this.type),z1(this.encoder,e.document),this.encoder}}class FP extends Zn{constructor(){super(...arguments),this.type=bt.Sync,this.description="A document update"}get(e){return xn(this.encoder,e.documentName),kt(this.encoder,this.type),NP(this.encoder,e.update),this.encoder}}class zP extends Error{constructor(){super(...arguments),this.code=1001}}class VP extends P1{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=pt.Disconnected,this.isAuthenticated=!1,this.authorizedScope=void 0,this.mux=_P(),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 Os,this.configuration.awareness=e.awareness!==void 0?e.awareness:new TP(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:Lm(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:Lm(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 L1({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(vu,{document:this.document,documentName:this.configuration.name})}pageUnload(){this.awareness&&$l(this.awareness,[this.document.clientID],"window unload")}registerEventListeners(){typeof window>"u"||window.addEventListener("unload",this.boundPageUnload)}sendStateless(e){this.send(LP,{documentName:this.configuration.name,payload:e})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send(FP,{update:e,documentName:this.configuration.name},!0))}awarenessUpdateHandler({added:e,updated:t,removed:r},i){const s=e.concat(t).concat(r);this.send(ml,{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(IP,{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(vu,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(ml,{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 gg(e,t);this.emit("outgoingMessage",{message:i.message}),i.send(this.configuration.websocketProvider)}onMessage(e){const t=new Nl(e.data),r=t.readVarString();t.writeVarString(r),this.emit("message",{event:e,message:new Nl(e.data)}),new mg(t).apply(this,!0)}onClose(e){this.isAuthenticated=!1,this.synced=!1,this.awareness&&$l(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&&($l(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(RP,{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=pt.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 Nl(e),r=t.readVarString();t.writeVarString(r),new mg(t).setBroadcasted(!0).apply(this,!1)})}subscribeToBroadcastChannel(){this.subscribedToBroadcastChannel||(kP(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!0),this.mux(()=>{this.broadcast(vu,{document:this.document,documentName:this.configuration.name}),this.broadcast(BP,{document:this.document,documentName:this.configuration.name}),this.broadcast(PP,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.broadcast(ml,{awareness:this.awareness,clients:[this.document.clientID],document:this.document,documentName:this.configuration.name})})}disconnectBroadcastChannel(){this.awareness&&this.send(ml,{awareness:this.awareness,clients:[this.document.clientID],states:new Map,documentName:this.configuration.name},!0),this.subscribedToBroadcastChannel&&(SP(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!1)}broadcast(e,t){this.configuration.broadcast&&this.subscribedToBroadcastChannel&&new gg(e,t).broadcast(this.broadcastChannel)}setAwarenessField(e,t){if(!this.awareness)throw new zP(`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 HP=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},UP=/[\uD800-\uDBFF]/,jP=/[\uDC00-\uDFFF]/,WP=(n,e)=>{let t=0,r=0;for(;t0&&UP.test(n[t-1])&&t--;r+t0&&jP.test(n[n.length-r])&&r--,{index:t,remove:n.length-t-r,insert:e.slice(t,e.length-r)}},KP=WP,st=new Vt("y-sync"),fr=new Vt("y-undo");new Vt("yjs-cursor");const Ha=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!Es(e.ds,n.id),qP=[{light:"#ecd44433",dark:"#ecd444"}],JP=(n,e,t)=>{if(!n.has(t)){if(n.sizer.add(i)),e=e.filter(i=>!r.has(i))}n.set(t,Ax(e))}return n.get(t)},GP=(n,{colors:e=qP,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)&&bf(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 XP(n,a);return o!=null&&o.destroy(),o=bf(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=fr.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},YP=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null){const r=wg(t.doc,t.type,e.anchor,t.mapping),i=wg(t.doc,t.type,e.head,t.mapping);r!==null&&i!==null&&(n=n.setSelection(ve.create(n.doc,r,i)))}},Ef=(n,e)=>({anchor:vg(e.selection.anchor,n.type,n.mapping),head:vg(e.selection.head,n.type,n.mapping)});class XP{constructor(e,t){this.type=e,this.prosemirrorView=t,this.mux=HP(),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=Ef(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()?(zx&&this._domSelectionInView===null&&(bf(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=qx.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=J0(L0(),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=>Dl(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(H.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=>Dl(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(H.from(e),0,0));this.prosemirrorView.dispatch(t.setMeta(st,{isChangeOrigin:!0}))})}_renderSnapshot(e,t,r){e||(e=EI(this.doc)),this.mapping=new Map,this.mux(()=>{this.doc.transact(i=>{const s=r.permanentUserData;s&&s.dss.forEach(c=>{jr(i,c,u=>{})});const o=(c,u)=>{const f=c==="added"?s.getUserByClientId(u.client):s.getUserByDeletedId(u);return{user:f,type:c,color:JP(r.colorMapping,r.colors,f)}},l=s1(this.type,new Dd(t.ds,e.sv)).map(c=>!c._item.deleted||Ha(c._item,e)||Ha(c._item,t)?Dl(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(H.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);jr(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=>H1(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(H.from(s),0,0));YP(o,this.beforeTransactionSelection,this),o=o.setMeta(st,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof Z0}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Of(this.doc,this.type,e,this.mapping),this.beforeTransactionSelection=Ef(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 H1=(n,e,t,r,i,s)=>{const o=t.get(n);if(o===void 0){if(n instanceof Ht)return Dl(n,e,t,r,i,s);throw En()}return o},Dl=(n,e,t,r,i,s)=>{const o=[],l=a=>{if(a.constructor===Ht){const c=H1(a,e,t,r,i,s);c!==null&&o.push(c)}else{const c=QP(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):s1(n,new Dd(i.ds,r.sv)).forEach(l);try{const a=n.getAttributes(r);r!==void 0&&(Ha(n._item,r)?Ha(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}},QP=(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},ZP=(n,e)=>{const t=new ln,r=n.map(i=>({insert:i.text,attributes:j1(i.marks)}));return t.applyDelta(r),e.set(t,n),t},eL=(n,e)=>{const t=new Ht(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,kc(n).map(r=>Mf(r,e))),e.set(t,n),t},Mf=(n,e)=>n instanceof Array?ZP(n,e):eL(n,e),bg=n=>typeof n=="object"&&n!==null,Kd=(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&&O0(r.attributes||{}).length===e[i].marks.length&&e[i].marks.every(s=>Kd(r.attributes[s.type.name]||{},s.attrs)))},Ro=(n,e)=>{if(n instanceof Ht&&!(e instanceof Array)&&$f(n,e)){const t=kc(e);return n._length===t.length&&Kd(n.getAttributes(),e.attrs)&&n.toArray().every((r,i)=>Ro(r,t[i]))}return n instanceof ln&&e instanceof Array&&U1(n,e)},Ua=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,r)=>e[r]===t),yg=(n,e,t)=>{const r=n.toArray(),i=kc(e),s=i.length,o=r.length,l=fc(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 Dn?e+=t.content.str:t.content instanceof at&&(r[t.content.key]=null)),t=t.right;return{str:e,nAttrs:r}},nL=(n,e,t)=>{t.set(n,e);const{nAttrs:r,str:i}=tL(n),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,j1(c.marks))})),{insert:o,remove:l,index:a}=KP(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})))},j1=n=>{const e={};return n.forEach(t=>{t.type.name!=="ychange"&&(e[t.type.name]=t.attrs)}),e},Of=(n,e,t,r)=>{if(e instanceof Ht&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(r.set(e,t),e instanceof Ht){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=kc(t),s=i.length,o=e.toArray(),l=o.length,a=fc(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 ln&&h instanceof Array)U1(d,h)||nL(d,h,r),c+=1;else{let g=d instanceof Ht&&$f(d,h),b=p instanceof Ht&&$f(p,m);if(g&&b){const _=yg(d,h,r),E=yg(p,m,r);_.foundMappedChild&&!E.foundMappedChild?b=!1:!_.foundMappedChild&&E.foundMappedChild||_.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,vg=(n,e,t)=>{if(n===0)return pu(e,0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof ln){if(r._length>=n)return pu(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 xa(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 xa(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 vn();if(n===0&&r.constructor!==ln&&r!==e)return rL(r._item.parent,r._item)}return pu(e,e._length)},rL=(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 xa(t,r,e.id)},wg=(n,e,t,r)=>{const i=TI(t,n);if(i===null||i.type!==e&&!$o(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===ln)o=i.index;else if(s._item===null||!s._item.deleted){let l=s._first,a=0;for(;a{const e=fr.getState(n).undoManager;if(e!=null)return e.undo(),!0},sL=n=>{const e=fr.getState(n).undoManager;if(e!=null)return e.redo(),!0},oL=new Set(["paragraph"]),lL=(n,e)=>!(n instanceof Ue)||!(n.content instanceof In)||!(n.content.type instanceof Ti||n.content.type instanceof Ht&&e.has(n.content.type.nodeName))||n.content.type._length===0,aL=({protectedNodes:n=oL,trackedOrigins:e=[],undoManager:t=null}={})=>new ut({key:fr,state:{init:(r,i)=>{const s=st.getState(i),o=t||new Z0(s.type,{trackedOrigins:new Set([st].concat(e)),deleteFilter:l=>lL(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:Ef(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=fr.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const l=i.binding;l&&o.meta.set(l,fr.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()}}}}),cL=xt.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),fr.getState(e).undoManager.undoStack.length===0?!1:t?iL(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),fr.getState(e).undoManager.redoStack.length===0?!1:t?sL(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=aL(),t=e.spec.view;e.spec.view=o=>{const{undoManager:l}=fr.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[GP(n,r?{onFirstRender:r}:{}),e]}});function uL(n,e){return[m0.configure({history:!1}),cL.configure({document:n.document}),t0.configure({element:e}),l0.configure({openOnClick:!1,autolink:!0}),g0.configure({inline:!0}),c0.configure({types:["heading","paragraph"]}),a0,y0.configure({inline:!0}),v0]}function fL(n){let e;const t=n[2].default,r=te(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)&&ne(r,t,i,i[3],e?ie(t,i[3],s,null):re(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 dL(n){let e,t;const r=[{class:_t("text-lg font-semibold leading-none tracking-tight",n[0])},n[1]];let i={$$slots:{default:[fL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},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 pL extends ue{constructor(e){super(),fe(this,e,hL,dL,ae,{class:0})}}function mL(n){let e;const t=n[1].default,r=te(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)&&ne(r,t,i,i[2],e?ie(t,i[2],s,null):re(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 gL(n){let e,t;const r=[n[0]];let i={$$slots:{default:[mL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},e),J(l)),t(0,i=Te(e,r)),"$$scope"in l&&t(2,o=l.$$scope)},[i,s,o]}class yL extends ue{constructor(e){super(),fe(this,e,bL,gL,ae,{})}}function vL(n){let e,t,r;const i=n[3].default,s=te(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=A(A({},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 kL extends ue{constructor(e){super(),fe(this,e,wL,vL,ae,{class:0})}}function SL(n){let e,t,r;const i=n[3].default,s=te(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=A(A({},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 _L extends ue{constructor(e){super(),fe(this,e,CL,SL,ae,{class:0})}}function AL(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 TL(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=A(A({},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 ML extends ue{constructor(e){super(),fe(this,e,EL,TL,ae,{class:0,transition:1,transitionConfig:2})}}function OL(n){let e,t,r,i="Close",s;return e=new cO({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment),t=be(),r=Fe("span"),r.textContent=i,this.h()},l(o){I(e.$$.fragment,o),t=ye(o),r=ze(o,"SPAN",{class:!0,"data-svelte-h":!0}),Q1(r)!=="svelte-1pewzs3"&&(r.textContent=i),this.h()},h(){Pr(r,"class","sr-only")},m(o,l){R(e,o,l),oe(o,t,l),oe(o,r,l),s=!0},p:Ce,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 $L(n){let e,t,r;const i=n[4].default,s=te(i,n,n[5],null);return t=new PA({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:[OL]},$$scope:{ctx:n}}}),{c(){s&&s.c(),e=be(),x(t.$$.fragment)},l(o){s&&s.l(o),e=ye(o),I(t.$$.fragment,o)},m(o,l){s&&s.m(o,l),oe(o,e,l),R(t,o,l),r=!0},p(o,l){s&&s.p&&(!r||l&32)&&ne(s,i,o,o[5],r?ie(i,o[5],l,null):re(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 NL(n){let e,t,r,i;e=new ML({});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:[$L]},$$scope:{ctx:n}};for(let l=0;l{e=A(A({},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 IL extends ue{constructor(e){super(),fe(this,e,xL,DL,ae,{class:0,transition:1,transitionConfig:2})}}function RL(n){let e;const t=n[2].default,r=te(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)&&ne(r,t,i,i[3],e?ie(t,i[3],s,null):re(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 PL(n){let e,t;const r=[{class:_t("text-sm text-muted-foreground",n[0])},n[1]];let i={$$slots:{default:[RL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},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 BL extends ue{constructor(e){super(),fe(this,e,LL,PL,ae,{class:0})}}const FL=SA,zL=kT;function VL(n){let e;const t=n[2].default,r=te(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)&&ne(r,t,i,i[4],e?ie(t,i[4],s,null):re(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 HL(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:[VL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},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 kg extends ue{constructor(e){super(),fe(this,e,UL,HL,ae,{class:0})}}function jL(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=A(A({},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,_,E,v,z,C,L]}class Sg extends ue{constructor(e){super(),fe(this,e,WL,jL,ae,{class:1,value:0,readonly:2})}}function Cg(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b,_,E,v,z,C,L,F,M,Z,$,y,w,O,B,T,V,K,Y,se,ge,we,me,Ke,Be,et,Qe,W,ft,Kt,dt,Rn,At,Pn,Pt,Pe,ht,qe,Ge,Tt,Et,er,Mt,tr,qt,nr,mr,Yr;return r=new Re({props:{class:"mr-0.5 h-8 px-2",$$slots:{default:[KL]},$$scope:{ctx:n}}}),r.$on("click",n[7]),s=new Re({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:[qL]},$$scope:{ctx:n}}}),s.$on("click",n[8]),l=new Re({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:[JL]},$$scope:{ctx:n}}}),l.$on("click",n[9]),c=new Re({props:{disabled:!n[1].can().chain().focus().toggleUnderline().run(),variant:n[1].isActive("underline")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[GL]},$$scope:{ctx:n}}}),c.$on("click",n[10]),f=new Re({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:[YL]},$$scope:{ctx:n}}}),f.$on("click",n[11]),h=new Re({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:[XL]},$$scope:{ctx:n}}}),h.$on("click",n[12]),m=new Re({props:{variant:n[1].isActive("paragraph")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[QL]},$$scope:{ctx:n}}}),m.$on("click",n[13]),b=new Re({props:{variant:n[1].isActive("heading",{level:1})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[ZL]},$$scope:{ctx:n}}}),b.$on("click",n[14]),E=new Re({props:{variant:n[1].isActive("heading",{level:2})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[e3]},$$scope:{ctx:n}}}),E.$on("click",n[15]),z=new Re({props:{variant:n[1].isActive("heading",{level:3})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[t3]},$$scope:{ctx:n}}}),z.$on("click",n[16]),L=new Re({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"left"})?"default":"secondary",$$slots:{default:[n3]},$$scope:{ctx:n}}}),L.$on("click",n[17]),M=new Re({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"center"})?"default":"secondary",$$slots:{default:[r3]},$$scope:{ctx:n}}}),M.$on("click",n[18]),$=new Re({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"right"})?"default":"secondary",$$slots:{default:[i3]},$$scope:{ctx:n}}}),$.$on("click",n[19]),w=new Re({props:{variant:n[1].isActive("bulletList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[s3]},$$scope:{ctx:n}}}),w.$on("click",n[20]),B=new Re({props:{variant:n[1].isActive("orderedList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[o3]},$$scope:{ctx:n}}}),B.$on("click",n[21]),V=new Re({props:{variant:n[1].isActive("codeBlock")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[l3]},$$scope:{ctx:n}}}),V.$on("click",n[22]),Y=new Re({props:{variant:n[1].isActive("blockquote")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[a3]},$$scope:{ctx:n}}}),Y.$on("click",n[23]),ge=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[c3]},$$scope:{ctx:n}}}),ge.$on("click",n[24]),me=new Re({props:{variant:n[1].isActive("link")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[u3]},$$scope:{ctx:n}}}),me.$on("click",n[25]),Be=new Re({props:{disabled:!n[1].isActive("link"),class:"mx-0.5 h-8 px-2",$$slots:{default:[f3]},$$scope:{ctx:n}}}),Be.$on("click",n[26]),Qe=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[d3]},$$scope:{ctx:n}}}),Qe.$on("click",n[27]),ft=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[h3]},$$scope:{ctx:n}}}),ft.$on("click",n[28]),dt=new Re({props:{disabled:!n[1].can().chain().focus().undo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[p3]},$$scope:{ctx:n}}}),dt.$on("click",n[29]),At=new Re({props:{disabled:!n[1].can().chain().focus().redo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[m3]},$$scope:{ctx:n}}}),At.$on("click",n[30]),Pt=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[g3]},$$scope:{ctx:n}}}),Pt.$on("click",n[31]),Ge=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[b3]},$$scope:{ctx:n}}}),Ge.$on("click",n[34]),Et=new FL({props:{closeOnOutsideClick:!1,$$slots:{default:[M3]},$$scope:{ctx:n}}}),Mt=new Re({props:{disabled:!n[4],class:"mx-0.5 h-8 px-2",$$slots:{default:[O3]},$$scope:{ctx:n}}}),Mt.$on("click",n[40]),qt=new Re({props:{class:"ml-0.5 h-8 px-2",$$slots:{default:[$3]},$$scope:{ctx:n}}}),qt.$on("click",tv),{c(){e=Fe("div"),t=Fe("nav"),x(r.$$.fragment),i=be(),x(s.$$.fragment),o=be(),x(l.$$.fragment),a=be(),x(c.$$.fragment),u=be(),x(f.$$.fragment),d=be(),x(h.$$.fragment),p=be(),x(m.$$.fragment),g=be(),x(b.$$.fragment),_=be(),x(E.$$.fragment),v=be(),x(z.$$.fragment),C=be(),x(L.$$.fragment),F=be(),x(M.$$.fragment),Z=be(),x($.$$.fragment),y=be(),x(w.$$.fragment),O=be(),x(B.$$.fragment),T=be(),x(V.$$.fragment),K=be(),x(Y.$$.fragment),se=be(),x(ge.$$.fragment),we=be(),x(me.$$.fragment),Ke=be(),x(Be.$$.fragment),et=be(),x(Qe.$$.fragment),W=be(),x(ft.$$.fragment),Kt=be(),x(dt.$$.fragment),Rn=be(),x(At.$$.fragment),Pn=be(),x(Pt.$$.fragment),Pe=be(),ht=Fe("input"),qe=be(),x(Ge.$$.fragment),Tt=be(),x(Et.$$.fragment),er=be(),x(Mt.$$.fragment),tr=be(),x(qt.$$.fragment),this.h()},l(D){e=ze(D,"DIV",{});var U=Ve(e);t=ze(U,"NAV",{class:!0});var X=Ve(t);I(r.$$.fragment,X),i=ye(X),I(s.$$.fragment,X),o=ye(X),I(l.$$.fragment,X),a=ye(X),I(c.$$.fragment,X),u=ye(X),I(f.$$.fragment,X),d=ye(X),I(h.$$.fragment,X),p=ye(X),I(m.$$.fragment,X),g=ye(X),I(b.$$.fragment,X),_=ye(X),I(E.$$.fragment,X),v=ye(X),I(z.$$.fragment,X),C=ye(X),I(L.$$.fragment,X),F=ye(X),I(M.$$.fragment,X),Z=ye(X),I($.$$.fragment,X),y=ye(X),I(w.$$.fragment,X),O=ye(X),I(B.$$.fragment,X),T=ye(X),I(V.$$.fragment,X),K=ye(X),I(Y.$$.fragment,X),se=ye(X),I(ge.$$.fragment,X),we=ye(X),I(me.$$.fragment,X),Ke=ye(X),I(Be.$$.fragment,X),et=ye(X),I(Qe.$$.fragment,X),W=ye(X),I(ft.$$.fragment,X),Kt=ye(X),I(dt.$$.fragment,X),Rn=ye(X),I(At.$$.fragment,X),Pn=ye(X),I(Pt.$$.fragment,X),Pe=ye(X),ht=ze(X,"INPUT",{type:!0,id:!0,style:!0}),qe=ye(X),I(Ge.$$.fragment,X),Tt=ye(X),I(Et.$$.fragment,X),er=ye(X),I(Mt.$$.fragment,X),tr=ye(X),I(qt.$$.fragment,X),X.forEach(j),U.forEach(j),this.h()},h(){Pr(ht,"type","file"),Pr(ht,"id","selectedFile"),ev(ht,"display","none"),Pr(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){oe(D,e,U),$e(e,t),R(r,t,null),$e(t,i),R(s,t,null),$e(t,o),R(l,t,null),$e(t,a),R(c,t,null),$e(t,u),R(f,t,null),$e(t,d),R(h,t,null),$e(t,p),R(m,t,null),$e(t,g),R(b,t,null),$e(t,_),R(E,t,null),$e(t,v),R(z,t,null),$e(t,C),R(L,t,null),$e(t,F),R(M,t,null),$e(t,Z),R($,t,null),$e(t,y),R(w,t,null),$e(t,O),R(B,t,null),$e(t,T),R(V,t,null),$e(t,K),R(Y,t,null),$e(t,se),R(ge,t,null),$e(t,we),R(me,t,null),$e(t,Ke),R(Be,t,null),$e(t,et),R(Qe,t,null),$e(t,W),R(ft,t,null),$e(t,Kt),R(dt,t,null),$e(t,Rn),R(At,t,null),$e(t,Pn),R(Pt,t,null),$e(t,Pe),$e(t,ht),$e(t,qe),R(Ge,t,null),$e(t,Tt),R(Et,t,null),$e(t,er),R(Mt,t,null),$e(t,tr),R(qt,t,null),nr=!0,mr||(Yr=[ce(ht,"change",n[32]),ce(ht,"change",n[33])],mr=!0)},p(D,U){const X={};U[1]&262144&&(X.$$scope={dirty:U,ctx:D}),r.$set(X);const Ii={};U[0]&2&&(Ii.disabled=!D[1].can().chain().focus().toggleBold().run()),U[0]&2&&(Ii.variant=D[1].isActive("bold")?"default":"secondary"),U[1]&262144&&(Ii.$$scope={dirty:U,ctx:D}),s.$set(Ii);const Ri={};U[0]&2&&(Ri.disabled=!D[1].can().chain().focus().toggleItalic().run()),U[0]&2&&(Ri.variant=D[1].isActive("italic")?"default":"secondary"),U[1]&262144&&(Ri.$$scope={dirty:U,ctx:D}),l.$set(Ri);const N={};U[0]&2&&(N.disabled=!D[1].can().chain().focus().toggleUnderline().run()),U[0]&2&&(N.variant=D[1].isActive("underline")?"default":"secondary"),U[1]&262144&&(N.$$scope={dirty:U,ctx:D}),c.$set(N);const Q={};U[0]&2&&(Q.disabled=!D[1].can().chain().focus().toggleStrike().run()),U[0]&2&&(Q.variant=D[1].isActive("strike")?"default":"secondary"),U[1]&262144&&(Q.$$scope={dirty:U,ctx:D}),f.$set(Q);const he={};U[0]&2&&(he.disabled=!D[1].can().chain().focus().toggleCode().run()),U[0]&2&&(he.variant=D[1].isActive("code")?"default":"secondary"),U[1]&262144&&(he.$$scope={dirty:U,ctx:D}),h.$set(he);const Le={};U[0]&2&&(Le.variant=D[1].isActive("paragraph")?"default":"secondary"),U[1]&262144&&(Le.$$scope={dirty:U,ctx:D}),m.$set(Le);const Oe={};U[0]&2&&(Oe.variant=D[1].isActive("heading",{level:1})?"default":"secondary"),U[1]&262144&&(Oe.$$scope={dirty:U,ctx:D}),b.$set(Oe);const ct={};U[0]&2&&(ct.variant=D[1].isActive("heading",{level:2})?"default":"secondary"),U[1]&262144&&(ct.$$scope={dirty:U,ctx:D}),E.$set(ct);const Lt={};U[0]&2&&(Lt.variant=D[1].isActive("heading",{level:3})?"default":"secondary"),U[1]&262144&&(Lt.$$scope={dirty:U,ctx:D}),z.$set(Lt);const Ln={};U[0]&2&&(Ln.variant=D[1].isActive({textAlign:"left"})?"default":"secondary"),U[1]&262144&&(Ln.$$scope={dirty:U,ctx:D}),L.$set(Ln);const Pi={};U[0]&2&&(Pi.variant=D[1].isActive({textAlign:"center"})?"default":"secondary"),U[1]&262144&&(Pi.$$scope={dirty:U,ctx:D}),M.$set(Pi);const wn={};U[0]&2&&(wn.variant=D[1].isActive({textAlign:"right"})?"default":"secondary"),U[1]&262144&&(wn.$$scope={dirty:U,ctx:D}),$.$set(wn);const Xr={};U[0]&2&&(Xr.variant=D[1].isActive("bulletList")?"default":"secondary"),U[1]&262144&&(Xr.$$scope={dirty:U,ctx:D}),w.$set(Xr);const gr={};U[0]&2&&(gr.variant=D[1].isActive("orderedList")?"default":"secondary"),U[1]&262144&&(gr.$$scope={dirty:U,ctx:D}),B.$set(gr);const Bn={};U[0]&2&&(Bn.variant=D[1].isActive("codeBlock")?"default":"secondary"),U[1]&262144&&(Bn.$$scope={dirty:U,ctx:D}),V.$set(Bn);const Ds={};U[0]&2&&(Ds.variant=D[1].isActive("blockquote")?"default":"secondary"),U[1]&262144&&(Ds.$$scope={dirty:U,ctx:D}),Y.$set(Ds);const Li={};U[1]&262144&&(Li.$$scope={dirty:U,ctx:D}),ge.$set(Li);const br={};U[0]&2&&(br.variant=D[1].isActive("link")?"default":"secondary"),U[1]&262144&&(br.$$scope={dirty:U,ctx:D}),me.$set(br);const Sc={};U[0]&2&&(Sc.disabled=!D[1].isActive("link")),U[1]&262144&&(Sc.$$scope={dirty:U,ctx:D}),Be.$set(Sc);const qd={};U[1]&262144&&(qd.$$scope={dirty:U,ctx:D}),Qe.$set(qd);const Jd={};U[1]&262144&&(Jd.$$scope={dirty:U,ctx:D}),ft.$set(Jd);const Cc={};U[0]&2&&(Cc.disabled=!D[1].can().chain().focus().undo().run()),U[1]&262144&&(Cc.$$scope={dirty:U,ctx:D}),dt.$set(Cc);const _c={};U[0]&2&&(_c.disabled=!D[1].can().chain().focus().redo().run()),U[1]&262144&&(_c.$$scope={dirty:U,ctx:D}),At.$set(_c);const Gd={};U[1]&262144&&(Gd.$$scope={dirty:U,ctx:D}),Pt.$set(Gd);const Yd={};U[1]&262144&&(Yd.$$scope={dirty:U,ctx:D}),Ge.$set(Yd);const Xd={};U[0]&96|U[1]&262144&&(Xd.$$scope={dirty:U,ctx:D}),Et.$set(Xd);const Ac={};U[0]&16&&(Ac.disabled=!D[4]),U[1]&262144&&(Ac.$$scope={dirty:U,ctx:D}),Mt.$set(Ac);const Qd={};U[1]&262144&&(Qd.$$scope={dirty:U,ctx:D}),qt.$set(Qd)},i(D){nr||(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(z.$$.fragment,D),k(L.$$.fragment,D),k(M.$$.fragment,D),k($.$$.fragment,D),k(w.$$.fragment,D),k(B.$$.fragment,D),k(V.$$.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(At.$$.fragment,D),k(Pt.$$.fragment,D),k(Ge.$$.fragment,D),k(Et.$$.fragment,D),k(Mt.$$.fragment,D),k(qt.$$.fragment,D),nr=!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(z.$$.fragment,D),S(L.$$.fragment,D),S(M.$$.fragment,D),S($.$$.fragment,D),S(w.$$.fragment,D),S(B.$$.fragment,D),S(V.$$.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(At.$$.fragment,D),S(Pt.$$.fragment,D),S(Ge.$$.fragment,D),S(Et.$$.fragment,D),S(Mt.$$.fragment,D),S(qt.$$.fragment,D),nr=!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(z),P(L),P(M),P($),P(w),P(B),P(V),P(Y),P(ge),P(me),P(Be),P(Qe),P(ft),P(dt),P(At),P(Pt),P(Ge),P(Et),P(Mt),P(qt),mr=!1,It(Yr)}}}function KL(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function qL(n){let e,t;return e=new Dy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function JL(n){let e,t;return e=new Iy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function GL(n){let e,t;return e=new Py({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function YL(n){let e,t;return e=new Ry({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function XL(n){let e,t;return e=new xy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function QL(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function ZL(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function e3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function t3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function n3(n){let e,t;return e=new uM({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function r3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function i3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function s3(n){let e,t;return e=new b2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function o3(n){let e,t;return e=new h2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function l3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function a3(n){let e,t;return e=new Q2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function c3(n){let e,t;return e=new V2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function u3(n){let e,t;return e=new c2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function f3(n){let e,t;return e=new s2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function d3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function h3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function p3(n){let e,t;return e=new sO({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function m3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function g3(n){let e,t;return e=new DM({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function b3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function y3(n){let e,t;return e=new L2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function v3(n){let e,t;return e=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[y3]},$$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]&262144&&(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 w3(n){let e;return{c(){e=Po("Share")},l(t){e=Lo(t,"Share")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function k3(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){oe(t,e,r)},d(t){t&&j(e)}}}function S3(n){let e,t,r,i;return e=new pL({props:{$$slots:{default:[w3]},$$scope:{ctx:n}}}),r=new BL({props:{$$slots:{default:[k3]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=be(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=ye(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),oe(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&262144&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[1]&262144&&(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 C3(n){let e;return{c(){e=Po("Endpoint")},l(t){e=Lo(t,"Endpoint")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function _3(n){let e;return{c(){e=Po("Workspace")},l(t){e=Lo(t,"Workspace")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function A3(n){let e;return{c(){e=Po("Connect")},l(t){e=Lo(t,"Connect")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function T3(n){let e,t;return e=new Re({props:{class:"w-full",variant:"outline",$$slots:{default:[A3]},$$scope:{ctx:n}}}),e.$on("click",n[39]),{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]&262144&&(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 E3(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;e=new _L({props:{$$slots:{default:[S3]},$$scope:{ctx:n}}}),s=new kg({props:{for:"endpoint",class:"text-left",$$slots:{default:[C3]},$$scope:{ctx:n}}});function _(C){n[35](C)}let E={id:"endpoint",placeholder:"ws://localhost:1234",class:"col-span-3"};n[5]!==void 0&&(E.value=n[5]),l=new Sg({props:E}),rt.push(()=>th(l,"value",_)),l.$on("keydown",n[36]),f=new kg({props:{for:"workspace",class:"text-left",$$slots:{default:[_3]},$$scope:{ctx:n}}});function v(C){n[37](C)}let z={id:"workspace",placeholder:"workspace",class:"col-span-3"};return n[6]!==void 0&&(z.value=n[6]),h=new Sg({props:z}),rt.push(()=>th(h,"value",v)),h.$on("keydown",n[38]),g=new kL({props:{$$slots:{default:[T3]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=be(),r=Fe("div"),i=Fe("div"),x(s.$$.fragment),o=be(),x(l.$$.fragment),c=be(),u=Fe("div"),x(f.$$.fragment),d=be(),x(h.$$.fragment),m=be(),x(g.$$.fragment),this.h()},l(C){I(e.$$.fragment,C),t=ye(C),r=ze(C,"DIV",{class:!0});var L=Ve(r);i=ze(L,"DIV",{class:!0});var F=Ve(i);I(s.$$.fragment,F),o=ye(F),I(l.$$.fragment,F),F.forEach(j),c=ye(L),u=ze(L,"DIV",{class:!0});var M=Ve(u);I(f.$$.fragment,M),d=ye(M),I(h.$$.fragment,M),M.forEach(j),L.forEach(j),m=ye(C),I(g.$$.fragment,C),this.h()},h(){Pr(i,"class","grid grid-cols-4 items-center gap-4"),Pr(u,"class","grid grid-cols-4 items-center gap-4"),Pr(r,"class","grid gap-4 py-4")},m(C,L){R(e,C,L),oe(C,t,L),oe(C,r,L),$e(r,i),R(s,i,null),$e(i,o),R(l,i,null),$e(r,c),$e(r,u),R(f,u,null),$e(u,d),R(h,u,null),oe(C,m,L),R(g,C,L),b=!0},p(C,L){const F={};L[1]&262144&&(F.$$scope={dirty:L,ctx:C}),e.$set(F);const M={};L[1]&262144&&(M.$$scope={dirty:L,ctx:C}),s.$set(M);const Z={};!a&&L[0]&32&&(a=!0,Z.value=C[5],eh(()=>a=!1)),l.$set(Z);const $={};L[1]&262144&&($.$$scope={dirty:L,ctx:C}),f.$set($);const y={};!p&&L[0]&64&&(p=!0,y.value=C[6],eh(()=>p=!1)),h.$set(y);const w={};L[0]&96|L[1]&262144&&(w.$$scope={dirty:L,ctx:C}),g.$set(w)},i(C){b||(k(e.$$.fragment,C),k(s.$$.fragment,C),k(l.$$.fragment,C),k(f.$$.fragment,C),k(h.$$.fragment,C),k(g.$$.fragment,C),b=!0)},o(C){S(e.$$.fragment,C),S(s.$$.fragment,C),S(l.$$.fragment,C),S(f.$$.fragment,C),S(h.$$.fragment,C),S(g.$$.fragment,C),b=!1},d(C){C&&(j(t),j(r),j(m)),P(e,C),P(s),P(l),P(f),P(h),P(g,C)}}}function M3(n){let e,t,r,i;return e=new zL({props:{$$slots:{default:[v3]},$$scope:{ctx:n}}}),r=new IL({props:{class:"sm:max-w-[425px]",$$slots:{default:[E3]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=be(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=ye(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),oe(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&262144&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[0]&96|o[1]&262144&&(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 O3(n){let e,t;return e=new x2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function $3(n){let e,t;return e=new J2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function _g(n){let e,t,r,i,s,o,l,a,c,u;return e=new Re({props:{variant:n[1].isActive("bold")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[N3]},$$scope:{ctx:n}}}),e.$on("click",n[41]),r=new Re({props:{variant:n[1].isActive("italic")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[D3]},$$scope:{ctx:n}}}),r.$on("click",n[42]),s=new Re({props:{variant:n[1].isActive("strike")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[x3]},$$scope:{ctx:n}}}),s.$on("click",n[43]),l=new Re({props:{variant:n[1].isActive("underline")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[I3]},$$scope:{ctx:n}}}),l.$on("click",n[44]),c=new Re({props:{variant:n[1].isActive("code")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[R3]},$$scope:{ctx:n}}}),c.$on("click",n[45]),{c(){x(e.$$.fragment),t=be(),x(r.$$.fragment),i=be(),x(s.$$.fragment),o=be(),x(l.$$.fragment),a=be(),x(c.$$.fragment)},l(f){I(e.$$.fragment,f),t=ye(f),I(r.$$.fragment,f),i=ye(f),I(s.$$.fragment,f),o=ye(f),I(l.$$.fragment,f),a=ye(f),I(c.$$.fragment,f)},m(f,d){R(e,f,d),oe(f,t,d),R(r,f,d),oe(f,i,d),R(s,f,d),oe(f,o,d),R(l,f,d),oe(f,a,d),R(c,f,d),u=!0},p(f,d){const h={};d[0]&2&&(h.variant=f[1].isActive("bold")?"default":"secondary"),d[1]&262144&&(h.$$scope={dirty:d,ctx:f}),e.$set(h);const p={};d[0]&2&&(p.variant=f[1].isActive("italic")?"default":"secondary"),d[1]&262144&&(p.$$scope={dirty:d,ctx:f}),r.$set(p);const m={};d[0]&2&&(m.variant=f[1].isActive("strike")?"default":"secondary"),d[1]&262144&&(m.$$scope={dirty:d,ctx:f}),s.$set(m);const g={};d[0]&2&&(g.variant=f[1].isActive("underline")?"default":"secondary"),d[1]&262144&&(g.$$scope={dirty:d,ctx:f}),l.$set(g);const b={};d[0]&2&&(b.variant=f[1].isActive("code")?"default":"secondary"),d[1]&262144&&(b.$$scope={dirty:d,ctx:f}),c.$set(b)},i(f){u||(k(e.$$.fragment,f),k(r.$$.fragment,f),k(s.$$.fragment,f),k(l.$$.fragment,f),k(c.$$.fragment,f),u=!0)},o(f){S(e.$$.fragment,f),S(r.$$.fragment,f),S(s.$$.fragment,f),S(l.$$.fragment,f),S(c.$$.fragment,f),u=!1},d(f){f&&(j(t),j(i),j(o),j(a)),P(e,f),P(r,f),P(s,f),P(l,f),P(c,f)}}}function N3(n){let e,t;return e=new Dy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function D3(n){let e,t;return e=new Iy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function x3(n){let e,t;return e=new Ry({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function I3(n){let e,t;return e=new Py({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function R3(n){let e,t;return e=new xy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function P3(n){let e,t,r,i,s,o=n[1]&&Cg(n),l=n[1]&&_g(n);return{c(){o&&o.c(),e=be(),t=Fe("div"),l&&l.c(),r=be(),i=Fe("div"),this.h()},l(a){o&&o.l(a),e=ye(a),t=ze(a,"DIV",{class:!0});var c=Ve(t);l&&l.l(c),c.forEach(j),r=ye(a),i=ze(a,"DIV",{}),Ve(i).forEach(j),this.h()},h(){Pr(t,"class","bubble-menu rounded-md")},m(a,c){o&&o.m(a,c),oe(a,e,c),oe(a,t,c),l&&l.m(t,null),n[46](t),oe(a,r,c),oe(a,i,c),n[47](i),s=!0},p(a,c){a[1]?o?(o.p(a,c),c[0]&2&&k(o,1)):(o=Cg(a),o.c(),k(o,1),o.m(e.parentNode,e)):o&&(On(),S(o,1,1,()=>{o=null}),$n()),a[1]?l?(l.p(a,c),c[0]&2&&k(l,1)):(l=_g(a),l.c(),k(l,1),l.m(t,null)):l&&(On(),S(l,1,1,()=>{l=null}),$n())},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[46](null),n[47](null)}}}function L3(n,e,t){let r,i,s,o,l="",a,c,u;Z1(async()=>{const Pe=new URLSearchParams(location.search);let ht;if(Pe.has("endpoint")&&Pe.has("workspace"))try{const qe=Pe.get("endpoint"),Ge=Pe.get("workspace");if(!qe)throw new Error("Invalid endpoint",{cause:"InvalidMetadata"});if(!Ge)throw new Error("Invalid workspace",{cause:"InvalidMetadata"});t(5,c=qe),t(6,u=Ge);const Tt=new L1({url:qe,maxAttempts:1});t(4,a=new VP({websocketProvider:Tt,name:Ge,onConnect(){window.alert(`Connected to ${qe}/${Ge}`)},onClose(){window.alert(`Failed to connect with ${qe}/${Ge}`),location.replace(`${location.protocol}//${location.host}${location.pathname}`)},connect:!1})),await a.connect(),localStorage.setItem("shared",JSON.stringify({endpoint:qe,workspace:Ge})),ht=uL(a,s)}catch(qe){qe instanceof Error&&qe.cause==="InvalidMetadata"?window.alert(`Failed to start sharing with ${location.search}: ${qe.toString()}`):window.alert(`Failed to start sharing with ${location.search}`),console.error(qe),location.replace(`${location.protocol}//${location.host}${location.pathname}`)}else{try{const qe=localStorage.getItem("shared");if(qe){const{endpoint:Ge,workspace:Tt}=JSON.parse(qe);t(5,c=Ge),t(6,u=Tt)}else t(5,c=""),t(6,u="")}catch(qe){t(5,c=""),t(6,u=""),console.error(qe)}ht=kD(s),l=localStorage.getItem("auto-saved")??uO}t(1,i=new r_({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:qe}){try{localStorage.setItem("auto-saved",qe.getHTML())}catch(Ge){console.error(Ge)}},content:l,onTransaction:()=>{t(1,i)}})),i.commands.focus()});const f=()=>mO(i),d=()=>i.chain().focus().toggleBold().run(),h=()=>i.chain().focus().toggleItalic().run(),p=()=>i.chain().focus().toggleUnderline().run(),m=()=>i.chain().focus().toggleStrike().run(),g=()=>i.chain().focus().toggleCode().run(),b=()=>i.chain().focus().setParagraph().run(),_=()=>i.chain().focus().toggleHeading({level:1}).run(),E=()=>i.chain().focus().toggleHeading({level:2}).run(),v=()=>i.chain().focus().toggleHeading({level:3}).run(),z=()=>i.chain().focus().setTextAlign("left").run(),C=()=>i.chain().focus().setTextAlign("center").run(),L=()=>i.chain().focus().setTextAlign("right").run(),F=()=>i.chain().focus().toggleBulletList().run(),M=()=>i.chain().focus().toggleOrderedList().run(),Z=()=>i.chain().focus().toggleCodeBlock().run(),$=()=>i.chain().focus().toggleBlockquote().run(),y=()=>i.chain().focus().setHorizontalRule().run(),w=()=>pO(i),O=()=>i.chain().focus().unsetLink().run(),B=()=>gO(i),T=()=>yO(i),V=()=>i.chain().focus().undo().run(),K=()=>i.chain().focus().redo().run(),Y=()=>dO(i);function se(){o=this.files,t(3,o)}const ge=()=>hO(i,o),we=()=>{var Pe;return(Pe=document.getElementById("selectedFile"))==null?void 0:Pe.click()};function me(Pe){c=Pe,t(5,c)}const Ke=Pe=>{Pe.code==="Enter"&&(Pe.preventDefault(),Xc(c,u))};function Be(Pe){u=Pe,t(6,u)}const et=Pe=>{Pe.code==="Enter"&&(Pe.preventDefault(),Xc(c,u))},Qe=()=>Xc(c,u),W=()=>bO(a),ft=()=>i.chain().focus().toggleBold().run(),Kt=()=>i.chain().focus().toggleItalic().run(),dt=()=>i.chain().focus().toggleStrike().run(),Rn=()=>i.chain().focus().toggleUnderline().run(),At=()=>i.chain().focus().toggleCode().run();function Pn(Pe){rt[Pe?"unshift":"push"](()=>{s=Pe,t(2,s)})}function Pt(Pe){rt[Pe?"unshift":"push"](()=>{r=Pe,t(0,r)})}return[r,i,s,o,a,c,u,f,d,h,p,m,g,b,_,E,v,z,C,L,F,M,Z,$,y,w,O,B,T,V,K,Y,se,ge,we,me,Ke,Be,et,Qe,W,ft,Kt,dt,Rn,At,Pn,Pt]}class B3 extends ue{constructor(e){super(),fe(this,e,L3,P3,ae,{},null,[-1,-1])}}function F3(n){let e,t,r;return t=new B3({}),{c(){e=Fe("main"),x(t.$$.fragment)},l(i){e=ze(i,"MAIN",{});var s=Ve(e);I(t.$$.fragment,s),s.forEach(j)},m(i,s){oe(i,e,s),R(t,e,null),r=!0},p:Ce,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 l4 extends ue{constructor(e){super(),fe(this,e,null,F3,ae,{})}}export{l4 as component}; +`?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&mu(r,this,i,l,o.attributes||{})}else o.retain!==void 0?lg(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&ag(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(ri(a,e)||t!==void 0&&ri(a,t))switch(a.content.constructor){case Dn:{const f=s.get("ychange");e!==void 0&&!ri(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&&!ri(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 In:case xi:{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:ri(a,e)&&(c(),$s(s,a.content));break}a=a.right}c()};return e||t?Je(o,f=>{e&&vf(f,e),t&&vf(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=pl(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),mu(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=pl(s,this,e,!r);mu(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=>{ag(i,pl(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=pl(s,this,e,!1);o.right!==null&&lg(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?Je(this.doc,t=>{Pa(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?Je(this.doc,r=>{Ld(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Bd(this,e)}getAttributes(){return f1(this)}_write(e){e.writeTypeRef(vR)}}const tR=n=>new Ti;class gu{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===Ht||t.constructor===Ei)&&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 Ei extends Dt{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 Ei}clone(){const e=new Ei;return e.insert(0,this.toArray().map(t=>t instanceof Dt?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new gu(this,e)}querySelector(e){e=e.toUpperCase();const r=new gu(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Hr(new gu(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){yc(this,e,new iR(this,t,e))}toString(){return o1(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=>{c1(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 Dt?e._item:e;Ra(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 Ur("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?Je(this.doc,r=>{u1(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return i1(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return l1(this,e)}slice(e=0,t=this.length){return r1(this,e,t)}forEach(e){Do(this,e)}_write(e){e.writeTypeRef(kR)}}const nR=n=>new Ei;class Ht extends Ei{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 Ht(this.nodeName)}clone(){const e=new Ht(this.nodeName),t=this.getAttributes();return xx(t,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Dt?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=>{Pa(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?Je(this.doc,r=>{Ld(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Bd(this,e)}hasAttribute(e){return d1(this,e)}getAttributes(e){return e?KI(this,e):f1(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(wR),e.writeKey(this.nodeName)}}const rR=n=>new Ht(n.readKey());class iR extends gc{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 La extends vs{constructor(e){super(),this.hookName=e}_copy(){return new La(this.hookName)}clone(){const e=new La(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(SR),e.writeKey(this.hookName)}}const sR=n=>new La(n.readKey());class ln extends Ti{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 ln}clone(){const e=new ln;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(CR)}}const oR=n=>new ln;class Fd{constructor(e,t){this.id=e,this.length=t}get deleted(){throw En()}mergeWith(e){return!1}write(e,t,r){throw En()}integrate(e,t){throw En()}}const lR=0;class dn extends Fd{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),Y0(e.doc.store,this)}write(e,t){e.writeInfo(lR),e.writeLen(this.length-t)}getMissing(e,t){return null}}class qo{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new qo(this.content)}splice(e){throw En()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const aR=n=>new qo(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 cR=n=>new xo(n.readLen()),b1=(n,e)=>new Os({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(b1(this.doc.guid,this.opts))}splice(e){throw En()}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 uR=n=>new Jo(b1(n.readString(),n.readAny()));class xi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new xi(this.embed)}splice(e){throw En()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const fR=n=>new xi(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 En()}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 dR=n=>new at(n.readKey(),n.readJSON());class Ba{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ba(this.arr)}splice(e){const t=new Ba(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 mR=n=>new Dn(n.readString()),gR=[JI,YI,tR,rR,nR,sR,oR],bR=0,yR=1,vR=2,wR=3,kR=4,SR=5,CR=6;class In{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new In(this.type._copy())}splice(e){throw En()}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 _R=n=>new In(gR[n.readTypeRef()](n)),Sf=(n,e)=>{let t=e,r=0,i;do r>0&&(t=Se(t.client,t.clock+r)),i=Ml(n,t),r=t.clock-i.id.clock,t=i.redone;while(t!==null&&i instanceof Ue);return{item:i,diff:r}},zd=(n,e)=>{for(;n!==null&&n.keep!==e;)n.keep=e,n=n.parent._item},Fa=(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},cg=(n,e)=>JD(n,t=>Es(t.deletions,e)),y1=(n,e,t,r,i,s)=>{const o=n.doc,l=o.store,a=o.clientID,c=e.redone;if(c!==null)return Yt(n,c);let u=e.parent._item,f=null,d;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!t.has(u)||y1(n,u,t,r,i,s)===null))return null;for(;u.redone!==null;)u=Yt(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:Yt(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:Yt(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||Es(r,f.right.id)||cg(s.undoStack,f.right.id)||cg(s.redoStack,f.right.id));)for(f=f.right;f.redone;)f=Yt(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,zd(g,!0),g.integrate(n,0),g};class Ue extends Fd{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()?Fm:0}set marker(e){(this.info&uu)>0!==e&&(this.info^=uu)}get marker(){return(this.info&uu)>0}get keep(){return(this.info&Bm)>0}set keep(e){this.keep!==e&&(this.info^=Bm)}get countable(){return(this.info&Fm)>0}get deleted(){return(this.info&cu)>0}set deleted(e){this.deleted!==e&&(this.info^=cu)}markDeleted(){this.info|=cu}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===es&&this.id.client!==this.parent.client&&this.parent.clock>=it(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=eg(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Yt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===dn||this.right&&this.right.constructor===dn)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===es){const r=Ml(t,this.parent);r.constructor===dn?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=eg(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),fl(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),ng(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw vn();this.content.gc(e),t?OI(e,this,new dn(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()&dc|(r===null?0:on)|(i===null?0:ur)|(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===es?(e.writeParentInfo(!1),e.writeLeftID(l)):vn();s!==null&&e.writeString(s)}this.content.write(e,t)}}const v1=(n,e)=>AR[e&dc](n),AR=[()=>{vn()},cR,hR,aR,mR,fR,dR,_R,pR,uR,()=>{vn()}],TR=10;class hn extends Fd{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){vn()}write(e,t){e.writeInfo(TR),xe(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const w1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},k1="__ $YJS$ __";w1[k1]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");w1[k1]=!0;function ER(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 bu(n){return new Promise(e=>setTimeout(e,n))}function MR(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 OR(n,e){const t=ER(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 bu(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 bu(o),r.attemptNum<1&&t.initialJitter){const l=i(r,t);l&&await bu(l)}return s()}var S1={};const ns=()=>new Map,C1=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},_1=()=>new Set,$R=Array.from,NR=String.fromCharCode,DR=n=>n.toLowerCase(),xR=/^\s*/g,IR=n=>n.replace(xR,""),RR=/([A-Z])/g,ug=(n,e)=>IR(n.replace(RR,t=>`${e}${DR(t)}`)),PR=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;iIo.encode(n),BR=Io?LR:PR;let so=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});so&&so.decode(new Uint8Array).length===1&&(so=null);const fg=n=>n===void 0?null:n;class FR{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let A1=new FR,Vd=!0;try{typeof localStorage<"u"&&localStorage&&(A1=localStorage,Vd=!1)}catch{}const T1=A1,zR=n=>Vd||addEventListener("storage",n),VR=n=>Vd||removeEventListener("storage",n),HR=Object.keys,UR=(n,e)=>{const t=[];for(const r in n)t.push(e(n[r],r));return t},dg=n=>HR(n).length,jR=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),WR=(n,e)=>n===e,oo=(n,e)=>{if(n==null||e==null)return WR(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),ws=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",E1=typeof window<"u"&&typeof document<"u"&&!ws;let zn;const qR=()=>{if(zn===void 0)if(ws){zn=ns();const n=process.argv;let e=null;for(let t=0;t{if(n.length!==0){const[e,t]=n.split("=");zn.set(`--${ug(e,"-")}`,t),zn.set(`-${ug(e,"-")}`,t)}})):zn=ns();return zn},Cf=n=>qR().has(n),_f=n=>fg(ws?S1[n.toUpperCase()]:T1.getItem(n)),JR=n=>Cf("--"+n)||_f(n)!==null;JR("production");const hg=ws&&KR(S1.FORCE_COLOR,["true","1","2"]);!Cf("no-colors")&&(!ws||process.stdout.isTTY||hg)&&(!ws||Cf("color")||hg||_f("COLORTERM")!==null||(_f("TERM")||"").includes("color"));const M1=Math.floor,GR=(n,e)=>nn>e?n:e,XR=64,za=128,QR=63,lo=127,O1=Number.MAX_SAFE_INTEGER;class ZR{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Hd=()=>new ZR,$1=n=>{let e=n.cpos;for(let t=0;t{const e=new Uint8Array($1(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},kt=(n,e)=>{for(;e>lo;)Va(n,za|lo&e),e=M1(e/128);Va(n,lo&e)},Af=new Uint8Array(3e4),eP=Af.length/3,tP=(n,e)=>{if(e.length{const t=unescape(encodeURIComponent(e)),r=t.length;kt(n,r);for(let i=0;i{const t=n.cbuf.length,r=n.cpos,i=GR(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(YR(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},Ns=(n,e)=>{kt(n,e.byteLength),rP(n,e)},N1=n=>new Error(n),D1=N1("Unexpected end of array"),x1=N1("Integer out of Range");class iP{constructor(e){this.arr=e,this.pos=0}}const I1=n=>new iP(n),sP=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},vc=n=>sP(n,bi(n)),pg=n=>n.arr[n.pos++],bi=n=>{let e=0,t=1;const r=n.arr.length;for(;n.posO1)throw x1}throw D1},oP=n=>{let e=n.arr[n.pos++],t=e&QR,r=64;const i=(e&XR)>0?-1:1;if(!(e&za))return i*t;const s=n.arr.length;for(;n.posO1)throw x1}throw D1},lP=n=>{let e=bi(n);if(e===0)return"";{let t=String.fromCodePoint(pg(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(pg(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))}},aP=n=>so.decode(vc(n)),wc=so?aP:lP,cP=n=>{const e=n.pos,t=wc(n);return n.pos=e,t},uP=n=>new Uint8Array(n),fP=(n,e,t)=>new Uint8Array(n,e,t),dP=n=>new Uint8Array(n),hP=n=>{let e="";for(let t=0;tBuffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),mP=n=>{const e=atob(n),t=uP(e.length);for(let r=0;r{const e=Buffer.from(n,"base64");return fP(e.buffer,e.byteOffset,e.byteLength)},bP=E1?hP:pP,yP=E1?mP:gP,R1=new Map;class vP{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:yP(t.newValue||"")}),zR(this._onChange)}postMessage(e){T1.setItem(this.room,bP(dP(e)))}close(){VR(this._onChange)}}const wP=typeof BroadcastChannel>"u"?vP:BroadcastChannel,jd=n=>C1(R1,n,()=>{const e=_1(),t=new wP(n);return t.onmessage=r=>e.forEach(i=>i(r.data,"broadcastchannel")),{bc:t,subs:e}}),kP=(n,e)=>(jd(n).subs.add(e),e),SP=(n,e)=>{const t=jd(n),r=t.subs.delete(e);return r&&t.subs.size===0&&(t.bc.close(),R1.delete(n)),r},CP=(n,e,t=null)=>{const r=jd(n);r.bc.postMessage(e),r.subs.forEach(i=>i(e,t))},_P=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},ks=Date.now;class AP{constructor(){this._observers=ns()}on(e,t){C1(this._observers,e,_1).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 $R((this._observers.get(e)||ns()).values()).forEach(r=>r(...t))}destroy(){this._observers=ns()}}const yu=3e4;class TP extends AP{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=ks();this.getLocalState()!==null&&yu/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&yu<=t-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&$l(this,r,"timeout")},M1(yu/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:ks()});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 $l=(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]))},Tf=(n,e,t=n.states)=>{const r=e.length,i=Hd();kt(i,r);for(let s=0;s{const r=I1(e),i=ks(),s=[],o=[],l=[],a=[],c=bi(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 P1{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 MP=n=>UR(n,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");var bt;(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"})(bt||(bt={}));var pt;(function(n){n.Connecting="connecting",n.Connected="connected",n.Disconnected="disconnected"})(pt||(pt={}));class Nl{constructor(e){this.data=e,this.encoder=Hd(),this.decoder=I1(new Uint8Array(this.data))}peekVarString(){return cP(this.decoder)}readVarUint(){return bi(this.decoder)}readVarString(){return wc(this.decoder)}readVarUint8Array(){return vc(this.decoder)}writeVarUint(e){return kt(this.encoder,e)}writeVarString(e){return xn(this.encoder,e)}writeVarUint8Array(e){return Ns(this.encoder,e)}length(){return $1(this.encoder)}}class L1 extends P1{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=pt.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===pt.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===pt.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:OR(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=pt.Connecting,this.emit("status",{status:pt.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){var t;this.resolveConnectionAttempt(),this.lastMessageReceived=ks();const i=new Nl(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=pt.Connected,this.emit("status",{status:pt.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===pt.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=ks()-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=MP(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)===cf.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){if(this.closeTries=0,this.cleanupWebSocket(),this.status===pt.Connected&&(this.status=pt.Disconnected,this.emit("status",{status:pt.Disconnected}),this.emit("disconnect",{event:e})),e.code===Pm.code&&(e.reason===Pm.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===jD.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===UD.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!==pt.Disconnected&&(this.status=pt.Disconnected,this.emit("status",{status:pt.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 B1=0,Wd=1,F1=2,OP=(n,e)=>{kt(n,B1);const t=SI(e);Ns(n,t)},z1=(n,e,t)=>{kt(n,Wd),Ns(n,yI(e,t))},$P=(n,e,t)=>z1(e,t,vc(n)),V1=(n,e,t)=>{try{mI(e,vc(n),t)}catch(r){console.error("Caught error while handling a Yjs update",r)}},NP=(n,e)=>{kt(n,F1),Ns(n,e)},DP=V1,xP=(n,e,t,r)=>{const i=bi(n);switch(i){case B1:$P(n,e,t);break;case Wd:V1(n,t,r);break;case F1:DP(n,t,r);break;default:throw new Error("Unknown message type")}return i};class Zn{constructor(){this.encoder=Hd()}get(e){return e.encoder}toUint8Array(){return Ud(this.encoder)}}class mg{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 bt.Sync:this.applySyncMessage(e,t);break;case bt.Awareness:this.applyAwarenessMessage(e);break;case bt.Auth:this.applyAuthMessage(e);break;case bt.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case bt.Stateless:e.receiveStateless(wc(r.decoder));break;case bt.SyncStatus:this.applySyncStatusMessage(e,oP(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(bt.Sync);const i=xP(r.decoder,r.encoder,e.document,e);t&&i===Wd&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;EP(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){const{message:t}=this;HD(t.decoder,e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:t}=this;t.writeVarUint(bt.Awareness),t.writeVarUint8Array(Tf(e.awareness,Array.from(e.awareness.getStates().keys())))}}class gg{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return Ud(this.encoder)}send(e){e==null||e.send(this.create())}broadcast(e){CP(e,this.create())}}class IP extends Zn{constructor(){super(...arguments),this.type=bt.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return xn(this.encoder,e.documentName),kt(this.encoder,this.type),VD(this.encoder,e.token),this.encoder}}class ml extends Zn{constructor(){super(...arguments),this.type=bt.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");xn(this.encoder,e.documentName),kt(this.encoder,this.type);let t;return e.states===void 0?t=Tf(e.awareness,e.clients):t=Tf(e.awareness,e.clients,e.states),Ns(this.encoder,t),this.encoder}}class RP extends Zn{constructor(){super(...arguments),this.type=bt.CLOSE,this.description="Ask the server to close the connection"}get(e){return xn(this.encoder,e.documentName),kt(this.encoder,this.type),this.encoder}}class PP extends Zn{constructor(){super(...arguments),this.type=bt.QueryAwareness,this.description="Queries awareness states"}get(e){return xn(this.encoder,e.documentName),kt(this.encoder,this.type),this.encoder}}class LP extends Zn{constructor(){super(...arguments),this.type=bt.Stateless,this.description="A stateless message"}get(e){var t;return xn(this.encoder,e.documentName),kt(this.encoder,this.type),xn(this.encoder,(t=e.payload)!==null&&t!==void 0?t:""),this.encoder}}class vu extends Zn{constructor(){super(...arguments),this.type=bt.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 xn(this.encoder,e.documentName),kt(this.encoder,this.type),OP(this.encoder,e.document),this.encoder}}class BP extends Zn{constructor(){super(...arguments),this.type=bt.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 xn(this.encoder,e.documentName),kt(this.encoder,this.type),z1(this.encoder,e.document),this.encoder}}class FP extends Zn{constructor(){super(...arguments),this.type=bt.Sync,this.description="A document update"}get(e){return xn(this.encoder,e.documentName),kt(this.encoder,this.type),NP(this.encoder,e.update),this.encoder}}class zP extends Error{constructor(){super(...arguments),this.code=1001}}class VP extends P1{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=pt.Disconnected,this.isAuthenticated=!1,this.authorizedScope=void 0,this.mux=_P(),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 Os,this.configuration.awareness=e.awareness!==void 0?e.awareness:new TP(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:Lm(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:Lm(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 L1({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(vu,{document:this.document,documentName:this.configuration.name})}pageUnload(){this.awareness&&$l(this.awareness,[this.document.clientID],"window unload")}registerEventListeners(){typeof window>"u"||window.addEventListener("unload",this.boundPageUnload)}sendStateless(e){this.send(LP,{documentName:this.configuration.name,payload:e})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send(FP,{update:e,documentName:this.configuration.name},!0))}awarenessUpdateHandler({added:e,updated:t,removed:r},i){const s=e.concat(t).concat(r);this.send(ml,{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(IP,{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(vu,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(ml,{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 gg(e,t);this.emit("outgoingMessage",{message:i.message}),i.send(this.configuration.websocketProvider)}onMessage(e){const t=new Nl(e.data),r=t.readVarString();t.writeVarString(r),this.emit("message",{event:e,message:new Nl(e.data)}),new mg(t).apply(this,!0)}onClose(e){this.isAuthenticated=!1,this.synced=!1,this.awareness&&$l(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&&($l(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(RP,{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=pt.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 Nl(e),r=t.readVarString();t.writeVarString(r),new mg(t).setBroadcasted(!0).apply(this,!1)})}subscribeToBroadcastChannel(){this.subscribedToBroadcastChannel||(kP(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!0),this.mux(()=>{this.broadcast(vu,{document:this.document,documentName:this.configuration.name}),this.broadcast(BP,{document:this.document,documentName:this.configuration.name}),this.broadcast(PP,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.broadcast(ml,{awareness:this.awareness,clients:[this.document.clientID],document:this.document,documentName:this.configuration.name})})}disconnectBroadcastChannel(){this.awareness&&this.send(ml,{awareness:this.awareness,clients:[this.document.clientID],states:new Map,documentName:this.configuration.name},!0),this.subscribedToBroadcastChannel&&(SP(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!1)}broadcast(e,t){this.configuration.broadcast&&this.subscribedToBroadcastChannel&&new gg(e,t).broadcast(this.broadcastChannel)}setAwarenessField(e,t){if(!this.awareness)throw new zP(`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 HP=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},UP=/[\uD800-\uDBFF]/,jP=/[\uDC00-\uDFFF]/,WP=(n,e)=>{let t=0,r=0;for(;t0&&UP.test(n[t-1])&&t--;r+t0&&jP.test(n[n.length-r])&&r--,{index:t,remove:n.length-t-r,insert:e.slice(t,e.length-r)}},KP=WP,st=new Vt("y-sync"),fr=new Vt("y-undo");new Vt("yjs-cursor");const Ha=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!Es(e.ds,n.id),qP=[{light:"#ecd44433",dark:"#ecd444"}],JP=(n,e,t)=>{if(!n.has(t)){if(n.sizer.add(i)),e=e.filter(i=>!r.has(i))}n.set(t,Ax(e))}return n.get(t)},GP=(n,{colors:e=qP,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)&&bf(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 XP(n,a);return o!=null&&o.destroy(),o=bf(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=fr.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},YP=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null){const r=wg(t.doc,t.type,e.anchor,t.mapping),i=wg(t.doc,t.type,e.head,t.mapping);r!==null&&i!==null&&(n=n.setSelection(ve.create(n.doc,r,i)))}},Ef=(n,e)=>({anchor:vg(e.selection.anchor,n.type,n.mapping),head:vg(e.selection.head,n.type,n.mapping)});class XP{constructor(e,t){this.type=e,this.prosemirrorView=t,this.mux=HP(),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=Ef(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()?(zx&&this._domSelectionInView===null&&(bf(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=qx.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=J0(L0(),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=>Dl(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(H.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=>Dl(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new G(H.from(e),0,0));this.prosemirrorView.dispatch(t.setMeta(st,{isChangeOrigin:!0}))})}_renderSnapshot(e,t,r){e||(e=EI(this.doc)),this.mapping=new Map,this.mux(()=>{this.doc.transact(i=>{const s=r.permanentUserData;s&&s.dss.forEach(c=>{jr(i,c,u=>{})});const o=(c,u)=>{const f=c==="added"?s.getUserByClientId(u.client):s.getUserByDeletedId(u);return{user:f,type:c,color:JP(r.colorMapping,r.colors,f)}},l=s1(this.type,new Dd(t.ds,e.sv)).map(c=>!c._item.deleted||Ha(c._item,e)||Ha(c._item,t)?Dl(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(H.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);jr(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=>H1(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(H.from(s),0,0));YP(o,this.beforeTransactionSelection,this),o=o.setMeta(st,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof Z0}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Of(this.doc,this.type,e,this.mapping),this.beforeTransactionSelection=Ef(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 H1=(n,e,t,r,i,s)=>{const o=t.get(n);if(o===void 0){if(n instanceof Ht)return Dl(n,e,t,r,i,s);throw En()}return o},Dl=(n,e,t,r,i,s)=>{const o=[],l=a=>{if(a.constructor===Ht){const c=H1(a,e,t,r,i,s);c!==null&&o.push(c)}else{const c=QP(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):s1(n,new Dd(i.ds,r.sv)).forEach(l);try{const a=n.getAttributes(r);r!==void 0&&(Ha(n._item,r)?Ha(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}},QP=(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},ZP=(n,e)=>{const t=new ln,r=n.map(i=>({insert:i.text,attributes:j1(i.marks)}));return t.applyDelta(r),e.set(t,n),t},eL=(n,e)=>{const t=new Ht(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,kc(n).map(r=>Mf(r,e))),e.set(t,n),t},Mf=(n,e)=>n instanceof Array?ZP(n,e):eL(n,e),bg=n=>typeof n=="object"&&n!==null,Kd=(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&&O0(r.attributes||{}).length===e[i].marks.length&&e[i].marks.every(s=>Kd(r.attributes[s.type.name]||{},s.attrs)))},Ro=(n,e)=>{if(n instanceof Ht&&!(e instanceof Array)&&$f(n,e)){const t=kc(e);return n._length===t.length&&Kd(n.getAttributes(),e.attrs)&&n.toArray().every((r,i)=>Ro(r,t[i]))}return n instanceof ln&&e instanceof Array&&U1(n,e)},Ua=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,r)=>e[r]===t),yg=(n,e,t)=>{const r=n.toArray(),i=kc(e),s=i.length,o=r.length,l=fc(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 Dn?e+=t.content.str:t.content instanceof at&&(r[t.content.key]=null)),t=t.right;return{str:e,nAttrs:r}},nL=(n,e,t)=>{t.set(n,e);const{nAttrs:r,str:i}=tL(n),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,j1(c.marks))})),{insert:o,remove:l,index:a}=KP(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})))},j1=n=>{const e={};return n.forEach(t=>{t.type.name!=="ychange"&&(e[t.type.name]=t.attrs)}),e},Of=(n,e,t,r)=>{if(e instanceof Ht&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(r.set(e,t),e instanceof Ht){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=kc(t),s=i.length,o=e.toArray(),l=o.length,a=fc(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 ln&&h instanceof Array)U1(d,h)||nL(d,h,r),c+=1;else{let g=d instanceof Ht&&$f(d,h),b=p instanceof Ht&&$f(p,m);if(g&&b){const _=yg(d,h,r),E=yg(p,m,r);_.foundMappedChild&&!E.foundMappedChild?b=!1:!_.foundMappedChild&&E.foundMappedChild||_.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,vg=(n,e,t)=>{if(n===0)return pu(e,0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof ln){if(r._length>=n)return pu(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 xa(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 xa(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 vn();if(n===0&&r.constructor!==ln&&r!==e)return rL(r._item.parent,r._item)}return pu(e,e._length)},rL=(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 xa(t,r,e.id)},wg=(n,e,t,r)=>{const i=TI(t,n);if(i===null||i.type!==e&&!$o(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===ln)o=i.index;else if(s._item===null||!s._item.deleted){let l=s._first,a=0;for(;a{const e=fr.getState(n).undoManager;if(e!=null)return e.undo(),!0},sL=n=>{const e=fr.getState(n).undoManager;if(e!=null)return e.redo(),!0},oL=new Set(["paragraph"]),lL=(n,e)=>!(n instanceof Ue)||!(n.content instanceof In)||!(n.content.type instanceof Ti||n.content.type instanceof Ht&&e.has(n.content.type.nodeName))||n.content.type._length===0,aL=({protectedNodes:n=oL,trackedOrigins:e=[],undoManager:t=null}={})=>new ut({key:fr,state:{init:(r,i)=>{const s=st.getState(i),o=t||new Z0(s.type,{trackedOrigins:new Set([st].concat(e)),deleteFilter:l=>lL(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:Ef(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=fr.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const l=i.binding;l&&o.meta.set(l,fr.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()}}}}),cL=xt.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),fr.getState(e).undoManager.undoStack.length===0?!1:t?iL(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),fr.getState(e).undoManager.redoStack.length===0?!1:t?sL(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=aL(),t=e.spec.view;e.spec.view=o=>{const{undoManager:l}=fr.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[GP(n,r?{onFirstRender:r}:{}),e]}});function uL(n,e){return[m0.configure({history:!1}),cL.configure({document:n.document}),t0.configure({element:e}),l0,g0.configure({inline:!0}),c0.configure({types:["heading","paragraph"]}),a0,y0.configure({inline:!0}),v0]}function fL(n){let e;const t=n[2].default,r=te(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)&&ne(r,t,i,i[3],e?ie(t,i[3],s,null):re(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 dL(n){let e,t;const r=[{class:_t("text-lg font-semibold leading-none tracking-tight",n[0])},n[1]];let i={$$slots:{default:[fL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},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 pL extends ue{constructor(e){super(),fe(this,e,hL,dL,ae,{class:0})}}function mL(n){let e;const t=n[1].default,r=te(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)&&ne(r,t,i,i[2],e?ie(t,i[2],s,null):re(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 gL(n){let e,t;const r=[n[0]];let i={$$slots:{default:[mL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},e),J(l)),t(0,i=Te(e,r)),"$$scope"in l&&t(2,o=l.$$scope)},[i,s,o]}class yL extends ue{constructor(e){super(),fe(this,e,bL,gL,ae,{})}}function vL(n){let e,t,r;const i=n[3].default,s=te(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=A(A({},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 kL extends ue{constructor(e){super(),fe(this,e,wL,vL,ae,{class:0})}}function SL(n){let e,t,r;const i=n[3].default,s=te(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=A(A({},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 _L extends ue{constructor(e){super(),fe(this,e,CL,SL,ae,{class:0})}}function AL(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 TL(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=A(A({},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 ML extends ue{constructor(e){super(),fe(this,e,EL,TL,ae,{class:0,transition:1,transitionConfig:2})}}function OL(n){let e,t,r,i="Close",s;return e=new cO({props:{class:"h-4 w-4"}}),{c(){x(e.$$.fragment),t=be(),r=Fe("span"),r.textContent=i,this.h()},l(o){I(e.$$.fragment,o),t=ye(o),r=ze(o,"SPAN",{class:!0,"data-svelte-h":!0}),Q1(r)!=="svelte-1pewzs3"&&(r.textContent=i),this.h()},h(){Pr(r,"class","sr-only")},m(o,l){R(e,o,l),oe(o,t,l),oe(o,r,l),s=!0},p:Ce,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 $L(n){let e,t,r;const i=n[4].default,s=te(i,n,n[5],null);return t=new PA({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:[OL]},$$scope:{ctx:n}}}),{c(){s&&s.c(),e=be(),x(t.$$.fragment)},l(o){s&&s.l(o),e=ye(o),I(t.$$.fragment,o)},m(o,l){s&&s.m(o,l),oe(o,e,l),R(t,o,l),r=!0},p(o,l){s&&s.p&&(!r||l&32)&&ne(s,i,o,o[5],r?ie(i,o[5],l,null):re(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 NL(n){let e,t,r,i;e=new ML({});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:[$L]},$$scope:{ctx:n}};for(let l=0;l{e=A(A({},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 IL extends ue{constructor(e){super(),fe(this,e,xL,DL,ae,{class:0,transition:1,transitionConfig:2})}}function RL(n){let e;const t=n[2].default,r=te(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)&&ne(r,t,i,i[3],e?ie(t,i[3],s,null):re(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 PL(n){let e,t;const r=[{class:_t("text-sm text-muted-foreground",n[0])},n[1]];let i={$$slots:{default:[RL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},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 BL extends ue{constructor(e){super(),fe(this,e,LL,PL,ae,{class:0})}}const FL=SA,zL=kT;function VL(n){let e;const t=n[2].default,r=te(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)&&ne(r,t,i,i[4],e?ie(t,i[4],s,null):re(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 HL(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:[VL]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},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 kg extends ue{constructor(e){super(),fe(this,e,UL,HL,ae,{class:0})}}function jL(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=A(A({},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,_,E,v,z,C,L]}class Sg extends ue{constructor(e){super(),fe(this,e,WL,jL,ae,{class:1,value:0,readonly:2})}}function Cg(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b,_,E,v,z,C,L,F,M,Z,$,y,w,O,B,T,V,K,Y,se,ge,we,me,Ke,Be,et,Qe,W,ft,Kt,dt,Rn,At,Pn,Pt,Pe,ht,qe,Ge,Tt,Et,er,Mt,tr,qt,nr,mr,Yr;return r=new Re({props:{class:"mr-0.5 h-8 px-2",$$slots:{default:[KL]},$$scope:{ctx:n}}}),r.$on("click",n[7]),s=new Re({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:[qL]},$$scope:{ctx:n}}}),s.$on("click",n[8]),l=new Re({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:[JL]},$$scope:{ctx:n}}}),l.$on("click",n[9]),c=new Re({props:{disabled:!n[1].can().chain().focus().toggleUnderline().run(),variant:n[1].isActive("underline")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[GL]},$$scope:{ctx:n}}}),c.$on("click",n[10]),f=new Re({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:[YL]},$$scope:{ctx:n}}}),f.$on("click",n[11]),h=new Re({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:[XL]},$$scope:{ctx:n}}}),h.$on("click",n[12]),m=new Re({props:{variant:n[1].isActive("paragraph")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[QL]},$$scope:{ctx:n}}}),m.$on("click",n[13]),b=new Re({props:{variant:n[1].isActive("heading",{level:1})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[ZL]},$$scope:{ctx:n}}}),b.$on("click",n[14]),E=new Re({props:{variant:n[1].isActive("heading",{level:2})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[e3]},$$scope:{ctx:n}}}),E.$on("click",n[15]),z=new Re({props:{variant:n[1].isActive("heading",{level:3})?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[t3]},$$scope:{ctx:n}}}),z.$on("click",n[16]),L=new Re({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"left"})?"default":"secondary",$$slots:{default:[n3]},$$scope:{ctx:n}}}),L.$on("click",n[17]),M=new Re({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"center"})?"default":"secondary",$$slots:{default:[r3]},$$scope:{ctx:n}}}),M.$on("click",n[18]),$=new Re({props:{class:"mx-0.5 h-8 px-2",variant:n[1].isActive({textAlign:"right"})?"default":"secondary",$$slots:{default:[i3]},$$scope:{ctx:n}}}),$.$on("click",n[19]),w=new Re({props:{variant:n[1].isActive("bulletList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[s3]},$$scope:{ctx:n}}}),w.$on("click",n[20]),B=new Re({props:{variant:n[1].isActive("orderedList")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[o3]},$$scope:{ctx:n}}}),B.$on("click",n[21]),V=new Re({props:{variant:n[1].isActive("codeBlock")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[l3]},$$scope:{ctx:n}}}),V.$on("click",n[22]),Y=new Re({props:{variant:n[1].isActive("blockquote")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[a3]},$$scope:{ctx:n}}}),Y.$on("click",n[23]),ge=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[c3]},$$scope:{ctx:n}}}),ge.$on("click",n[24]),me=new Re({props:{variant:n[1].isActive("link")?"default":"secondary",class:"mx-0.5 h-8 px-2",$$slots:{default:[u3]},$$scope:{ctx:n}}}),me.$on("click",n[25]),Be=new Re({props:{disabled:!n[1].isActive("link"),class:"mx-0.5 h-8 px-2",$$slots:{default:[f3]},$$scope:{ctx:n}}}),Be.$on("click",n[26]),Qe=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[d3]},$$scope:{ctx:n}}}),Qe.$on("click",n[27]),ft=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[h3]},$$scope:{ctx:n}}}),ft.$on("click",n[28]),dt=new Re({props:{disabled:!n[1].can().chain().focus().undo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[p3]},$$scope:{ctx:n}}}),dt.$on("click",n[29]),At=new Re({props:{disabled:!n[1].can().chain().focus().redo().run(),class:"mx-0.5 h-8 px-2",$$slots:{default:[m3]},$$scope:{ctx:n}}}),At.$on("click",n[30]),Pt=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[g3]},$$scope:{ctx:n}}}),Pt.$on("click",n[31]),Ge=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[b3]},$$scope:{ctx:n}}}),Ge.$on("click",n[34]),Et=new FL({props:{closeOnOutsideClick:!1,$$slots:{default:[M3]},$$scope:{ctx:n}}}),Mt=new Re({props:{disabled:!n[4],class:"mx-0.5 h-8 px-2",$$slots:{default:[O3]},$$scope:{ctx:n}}}),Mt.$on("click",n[40]),qt=new Re({props:{class:"ml-0.5 h-8 px-2",$$slots:{default:[$3]},$$scope:{ctx:n}}}),qt.$on("click",tv),{c(){e=Fe("div"),t=Fe("nav"),x(r.$$.fragment),i=be(),x(s.$$.fragment),o=be(),x(l.$$.fragment),a=be(),x(c.$$.fragment),u=be(),x(f.$$.fragment),d=be(),x(h.$$.fragment),p=be(),x(m.$$.fragment),g=be(),x(b.$$.fragment),_=be(),x(E.$$.fragment),v=be(),x(z.$$.fragment),C=be(),x(L.$$.fragment),F=be(),x(M.$$.fragment),Z=be(),x($.$$.fragment),y=be(),x(w.$$.fragment),O=be(),x(B.$$.fragment),T=be(),x(V.$$.fragment),K=be(),x(Y.$$.fragment),se=be(),x(ge.$$.fragment),we=be(),x(me.$$.fragment),Ke=be(),x(Be.$$.fragment),et=be(),x(Qe.$$.fragment),W=be(),x(ft.$$.fragment),Kt=be(),x(dt.$$.fragment),Rn=be(),x(At.$$.fragment),Pn=be(),x(Pt.$$.fragment),Pe=be(),ht=Fe("input"),qe=be(),x(Ge.$$.fragment),Tt=be(),x(Et.$$.fragment),er=be(),x(Mt.$$.fragment),tr=be(),x(qt.$$.fragment),this.h()},l(D){e=ze(D,"DIV",{});var U=Ve(e);t=ze(U,"NAV",{class:!0});var X=Ve(t);I(r.$$.fragment,X),i=ye(X),I(s.$$.fragment,X),o=ye(X),I(l.$$.fragment,X),a=ye(X),I(c.$$.fragment,X),u=ye(X),I(f.$$.fragment,X),d=ye(X),I(h.$$.fragment,X),p=ye(X),I(m.$$.fragment,X),g=ye(X),I(b.$$.fragment,X),_=ye(X),I(E.$$.fragment,X),v=ye(X),I(z.$$.fragment,X),C=ye(X),I(L.$$.fragment,X),F=ye(X),I(M.$$.fragment,X),Z=ye(X),I($.$$.fragment,X),y=ye(X),I(w.$$.fragment,X),O=ye(X),I(B.$$.fragment,X),T=ye(X),I(V.$$.fragment,X),K=ye(X),I(Y.$$.fragment,X),se=ye(X),I(ge.$$.fragment,X),we=ye(X),I(me.$$.fragment,X),Ke=ye(X),I(Be.$$.fragment,X),et=ye(X),I(Qe.$$.fragment,X),W=ye(X),I(ft.$$.fragment,X),Kt=ye(X),I(dt.$$.fragment,X),Rn=ye(X),I(At.$$.fragment,X),Pn=ye(X),I(Pt.$$.fragment,X),Pe=ye(X),ht=ze(X,"INPUT",{type:!0,id:!0,style:!0}),qe=ye(X),I(Ge.$$.fragment,X),Tt=ye(X),I(Et.$$.fragment,X),er=ye(X),I(Mt.$$.fragment,X),tr=ye(X),I(qt.$$.fragment,X),X.forEach(j),U.forEach(j),this.h()},h(){Pr(ht,"type","file"),Pr(ht,"id","selectedFile"),ev(ht,"display","none"),Pr(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){oe(D,e,U),$e(e,t),R(r,t,null),$e(t,i),R(s,t,null),$e(t,o),R(l,t,null),$e(t,a),R(c,t,null),$e(t,u),R(f,t,null),$e(t,d),R(h,t,null),$e(t,p),R(m,t,null),$e(t,g),R(b,t,null),$e(t,_),R(E,t,null),$e(t,v),R(z,t,null),$e(t,C),R(L,t,null),$e(t,F),R(M,t,null),$e(t,Z),R($,t,null),$e(t,y),R(w,t,null),$e(t,O),R(B,t,null),$e(t,T),R(V,t,null),$e(t,K),R(Y,t,null),$e(t,se),R(ge,t,null),$e(t,we),R(me,t,null),$e(t,Ke),R(Be,t,null),$e(t,et),R(Qe,t,null),$e(t,W),R(ft,t,null),$e(t,Kt),R(dt,t,null),$e(t,Rn),R(At,t,null),$e(t,Pn),R(Pt,t,null),$e(t,Pe),$e(t,ht),$e(t,qe),R(Ge,t,null),$e(t,Tt),R(Et,t,null),$e(t,er),R(Mt,t,null),$e(t,tr),R(qt,t,null),nr=!0,mr||(Yr=[ce(ht,"change",n[32]),ce(ht,"change",n[33])],mr=!0)},p(D,U){const X={};U[1]&262144&&(X.$$scope={dirty:U,ctx:D}),r.$set(X);const Ii={};U[0]&2&&(Ii.disabled=!D[1].can().chain().focus().toggleBold().run()),U[0]&2&&(Ii.variant=D[1].isActive("bold")?"default":"secondary"),U[1]&262144&&(Ii.$$scope={dirty:U,ctx:D}),s.$set(Ii);const Ri={};U[0]&2&&(Ri.disabled=!D[1].can().chain().focus().toggleItalic().run()),U[0]&2&&(Ri.variant=D[1].isActive("italic")?"default":"secondary"),U[1]&262144&&(Ri.$$scope={dirty:U,ctx:D}),l.$set(Ri);const N={};U[0]&2&&(N.disabled=!D[1].can().chain().focus().toggleUnderline().run()),U[0]&2&&(N.variant=D[1].isActive("underline")?"default":"secondary"),U[1]&262144&&(N.$$scope={dirty:U,ctx:D}),c.$set(N);const Q={};U[0]&2&&(Q.disabled=!D[1].can().chain().focus().toggleStrike().run()),U[0]&2&&(Q.variant=D[1].isActive("strike")?"default":"secondary"),U[1]&262144&&(Q.$$scope={dirty:U,ctx:D}),f.$set(Q);const he={};U[0]&2&&(he.disabled=!D[1].can().chain().focus().toggleCode().run()),U[0]&2&&(he.variant=D[1].isActive("code")?"default":"secondary"),U[1]&262144&&(he.$$scope={dirty:U,ctx:D}),h.$set(he);const Le={};U[0]&2&&(Le.variant=D[1].isActive("paragraph")?"default":"secondary"),U[1]&262144&&(Le.$$scope={dirty:U,ctx:D}),m.$set(Le);const Oe={};U[0]&2&&(Oe.variant=D[1].isActive("heading",{level:1})?"default":"secondary"),U[1]&262144&&(Oe.$$scope={dirty:U,ctx:D}),b.$set(Oe);const ct={};U[0]&2&&(ct.variant=D[1].isActive("heading",{level:2})?"default":"secondary"),U[1]&262144&&(ct.$$scope={dirty:U,ctx:D}),E.$set(ct);const Lt={};U[0]&2&&(Lt.variant=D[1].isActive("heading",{level:3})?"default":"secondary"),U[1]&262144&&(Lt.$$scope={dirty:U,ctx:D}),z.$set(Lt);const Ln={};U[0]&2&&(Ln.variant=D[1].isActive({textAlign:"left"})?"default":"secondary"),U[1]&262144&&(Ln.$$scope={dirty:U,ctx:D}),L.$set(Ln);const Pi={};U[0]&2&&(Pi.variant=D[1].isActive({textAlign:"center"})?"default":"secondary"),U[1]&262144&&(Pi.$$scope={dirty:U,ctx:D}),M.$set(Pi);const wn={};U[0]&2&&(wn.variant=D[1].isActive({textAlign:"right"})?"default":"secondary"),U[1]&262144&&(wn.$$scope={dirty:U,ctx:D}),$.$set(wn);const Xr={};U[0]&2&&(Xr.variant=D[1].isActive("bulletList")?"default":"secondary"),U[1]&262144&&(Xr.$$scope={dirty:U,ctx:D}),w.$set(Xr);const gr={};U[0]&2&&(gr.variant=D[1].isActive("orderedList")?"default":"secondary"),U[1]&262144&&(gr.$$scope={dirty:U,ctx:D}),B.$set(gr);const Bn={};U[0]&2&&(Bn.variant=D[1].isActive("codeBlock")?"default":"secondary"),U[1]&262144&&(Bn.$$scope={dirty:U,ctx:D}),V.$set(Bn);const Ds={};U[0]&2&&(Ds.variant=D[1].isActive("blockquote")?"default":"secondary"),U[1]&262144&&(Ds.$$scope={dirty:U,ctx:D}),Y.$set(Ds);const Li={};U[1]&262144&&(Li.$$scope={dirty:U,ctx:D}),ge.$set(Li);const br={};U[0]&2&&(br.variant=D[1].isActive("link")?"default":"secondary"),U[1]&262144&&(br.$$scope={dirty:U,ctx:D}),me.$set(br);const Sc={};U[0]&2&&(Sc.disabled=!D[1].isActive("link")),U[1]&262144&&(Sc.$$scope={dirty:U,ctx:D}),Be.$set(Sc);const qd={};U[1]&262144&&(qd.$$scope={dirty:U,ctx:D}),Qe.$set(qd);const Jd={};U[1]&262144&&(Jd.$$scope={dirty:U,ctx:D}),ft.$set(Jd);const Cc={};U[0]&2&&(Cc.disabled=!D[1].can().chain().focus().undo().run()),U[1]&262144&&(Cc.$$scope={dirty:U,ctx:D}),dt.$set(Cc);const _c={};U[0]&2&&(_c.disabled=!D[1].can().chain().focus().redo().run()),U[1]&262144&&(_c.$$scope={dirty:U,ctx:D}),At.$set(_c);const Gd={};U[1]&262144&&(Gd.$$scope={dirty:U,ctx:D}),Pt.$set(Gd);const Yd={};U[1]&262144&&(Yd.$$scope={dirty:U,ctx:D}),Ge.$set(Yd);const Xd={};U[0]&96|U[1]&262144&&(Xd.$$scope={dirty:U,ctx:D}),Et.$set(Xd);const Ac={};U[0]&16&&(Ac.disabled=!D[4]),U[1]&262144&&(Ac.$$scope={dirty:U,ctx:D}),Mt.$set(Ac);const Qd={};U[1]&262144&&(Qd.$$scope={dirty:U,ctx:D}),qt.$set(Qd)},i(D){nr||(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(z.$$.fragment,D),k(L.$$.fragment,D),k(M.$$.fragment,D),k($.$$.fragment,D),k(w.$$.fragment,D),k(B.$$.fragment,D),k(V.$$.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(At.$$.fragment,D),k(Pt.$$.fragment,D),k(Ge.$$.fragment,D),k(Et.$$.fragment,D),k(Mt.$$.fragment,D),k(qt.$$.fragment,D),nr=!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(z.$$.fragment,D),S(L.$$.fragment,D),S(M.$$.fragment,D),S($.$$.fragment,D),S(w.$$.fragment,D),S(B.$$.fragment,D),S(V.$$.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(At.$$.fragment,D),S(Pt.$$.fragment,D),S(Ge.$$.fragment,D),S(Et.$$.fragment,D),S(Mt.$$.fragment,D),S(qt.$$.fragment,D),nr=!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(z),P(L),P(M),P($),P(w),P(B),P(V),P(Y),P(ge),P(me),P(Be),P(Qe),P(ft),P(dt),P(At),P(Pt),P(Ge),P(Et),P(Mt),P(qt),mr=!1,It(Yr)}}}function KL(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function qL(n){let e,t;return e=new Dy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function JL(n){let e,t;return e=new Iy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function GL(n){let e,t;return e=new Py({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function YL(n){let e,t;return e=new Ry({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function XL(n){let e,t;return e=new xy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function QL(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function ZL(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function e3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function t3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function n3(n){let e,t;return e=new uM({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function r3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function i3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function s3(n){let e,t;return e=new b2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function o3(n){let e,t;return e=new h2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function l3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function a3(n){let e,t;return e=new Q2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function c3(n){let e,t;return e=new V2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function u3(n){let e,t;return e=new c2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function f3(n){let e,t;return e=new s2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function d3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function h3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function p3(n){let e,t;return e=new sO({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function m3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function g3(n){let e,t;return e=new DM({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function b3(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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function y3(n){let e,t;return e=new L2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function v3(n){let e,t;return e=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[y3]},$$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]&262144&&(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 w3(n){let e;return{c(){e=Po("Share")},l(t){e=Lo(t,"Share")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function k3(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){oe(t,e,r)},d(t){t&&j(e)}}}function S3(n){let e,t,r,i;return e=new pL({props:{$$slots:{default:[w3]},$$scope:{ctx:n}}}),r=new BL({props:{$$slots:{default:[k3]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=be(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=ye(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),oe(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&262144&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[1]&262144&&(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 C3(n){let e;return{c(){e=Po("Endpoint")},l(t){e=Lo(t,"Endpoint")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function _3(n){let e;return{c(){e=Po("Workspace")},l(t){e=Lo(t,"Workspace")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function A3(n){let e;return{c(){e=Po("Connect")},l(t){e=Lo(t,"Connect")},m(t,r){oe(t,e,r)},d(t){t&&j(e)}}}function T3(n){let e,t;return e=new Re({props:{class:"w-full",variant:"outline",$$slots:{default:[A3]},$$scope:{ctx:n}}}),e.$on("click",n[39]),{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]&262144&&(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 E3(n){let e,t,r,i,s,o,l,a,c,u,f,d,h,p,m,g,b;e=new _L({props:{$$slots:{default:[S3]},$$scope:{ctx:n}}}),s=new kg({props:{for:"endpoint",class:"text-left",$$slots:{default:[C3]},$$scope:{ctx:n}}});function _(C){n[35](C)}let E={id:"endpoint",placeholder:"ws://localhost:1234",class:"col-span-3"};n[5]!==void 0&&(E.value=n[5]),l=new Sg({props:E}),rt.push(()=>th(l,"value",_)),l.$on("keydown",n[36]),f=new kg({props:{for:"workspace",class:"text-left",$$slots:{default:[_3]},$$scope:{ctx:n}}});function v(C){n[37](C)}let z={id:"workspace",placeholder:"workspace",class:"col-span-3"};return n[6]!==void 0&&(z.value=n[6]),h=new Sg({props:z}),rt.push(()=>th(h,"value",v)),h.$on("keydown",n[38]),g=new kL({props:{$$slots:{default:[T3]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=be(),r=Fe("div"),i=Fe("div"),x(s.$$.fragment),o=be(),x(l.$$.fragment),c=be(),u=Fe("div"),x(f.$$.fragment),d=be(),x(h.$$.fragment),m=be(),x(g.$$.fragment),this.h()},l(C){I(e.$$.fragment,C),t=ye(C),r=ze(C,"DIV",{class:!0});var L=Ve(r);i=ze(L,"DIV",{class:!0});var F=Ve(i);I(s.$$.fragment,F),o=ye(F),I(l.$$.fragment,F),F.forEach(j),c=ye(L),u=ze(L,"DIV",{class:!0});var M=Ve(u);I(f.$$.fragment,M),d=ye(M),I(h.$$.fragment,M),M.forEach(j),L.forEach(j),m=ye(C),I(g.$$.fragment,C),this.h()},h(){Pr(i,"class","grid grid-cols-4 items-center gap-4"),Pr(u,"class","grid grid-cols-4 items-center gap-4"),Pr(r,"class","grid gap-4 py-4")},m(C,L){R(e,C,L),oe(C,t,L),oe(C,r,L),$e(r,i),R(s,i,null),$e(i,o),R(l,i,null),$e(r,c),$e(r,u),R(f,u,null),$e(u,d),R(h,u,null),oe(C,m,L),R(g,C,L),b=!0},p(C,L){const F={};L[1]&262144&&(F.$$scope={dirty:L,ctx:C}),e.$set(F);const M={};L[1]&262144&&(M.$$scope={dirty:L,ctx:C}),s.$set(M);const Z={};!a&&L[0]&32&&(a=!0,Z.value=C[5],eh(()=>a=!1)),l.$set(Z);const $={};L[1]&262144&&($.$$scope={dirty:L,ctx:C}),f.$set($);const y={};!p&&L[0]&64&&(p=!0,y.value=C[6],eh(()=>p=!1)),h.$set(y);const w={};L[0]&96|L[1]&262144&&(w.$$scope={dirty:L,ctx:C}),g.$set(w)},i(C){b||(k(e.$$.fragment,C),k(s.$$.fragment,C),k(l.$$.fragment,C),k(f.$$.fragment,C),k(h.$$.fragment,C),k(g.$$.fragment,C),b=!0)},o(C){S(e.$$.fragment,C),S(s.$$.fragment,C),S(l.$$.fragment,C),S(f.$$.fragment,C),S(h.$$.fragment,C),S(g.$$.fragment,C),b=!1},d(C){C&&(j(t),j(r),j(m)),P(e,C),P(s),P(l),P(f),P(h),P(g,C)}}}function M3(n){let e,t,r,i;return e=new zL({props:{$$slots:{default:[v3]},$$scope:{ctx:n}}}),r=new IL({props:{class:"sm:max-w-[425px]",$$slots:{default:[E3]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=be(),x(r.$$.fragment)},l(s){I(e.$$.fragment,s),t=ye(s),I(r.$$.fragment,s)},m(s,o){R(e,s,o),oe(s,t,o),R(r,s,o),i=!0},p(s,o){const l={};o[1]&262144&&(l.$$scope={dirty:o,ctx:s}),e.$set(l);const a={};o[0]&96|o[1]&262144&&(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 O3(n){let e,t;return e=new x2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function $3(n){let e,t;return e=new J2({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function _g(n){let e,t,r,i,s,o,l,a,c,u;return e=new Re({props:{variant:n[1].isActive("bold")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[N3]},$$scope:{ctx:n}}}),e.$on("click",n[41]),r=new Re({props:{variant:n[1].isActive("italic")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[D3]},$$scope:{ctx:n}}}),r.$on("click",n[42]),s=new Re({props:{variant:n[1].isActive("strike")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[x3]},$$scope:{ctx:n}}}),s.$on("click",n[43]),l=new Re({props:{variant:n[1].isActive("underline")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[I3]},$$scope:{ctx:n}}}),l.$on("click",n[44]),c=new Re({props:{variant:n[1].isActive("code")?"default":"secondary",class:"h-8 px-2",$$slots:{default:[R3]},$$scope:{ctx:n}}}),c.$on("click",n[45]),{c(){x(e.$$.fragment),t=be(),x(r.$$.fragment),i=be(),x(s.$$.fragment),o=be(),x(l.$$.fragment),a=be(),x(c.$$.fragment)},l(f){I(e.$$.fragment,f),t=ye(f),I(r.$$.fragment,f),i=ye(f),I(s.$$.fragment,f),o=ye(f),I(l.$$.fragment,f),a=ye(f),I(c.$$.fragment,f)},m(f,d){R(e,f,d),oe(f,t,d),R(r,f,d),oe(f,i,d),R(s,f,d),oe(f,o,d),R(l,f,d),oe(f,a,d),R(c,f,d),u=!0},p(f,d){const h={};d[0]&2&&(h.variant=f[1].isActive("bold")?"default":"secondary"),d[1]&262144&&(h.$$scope={dirty:d,ctx:f}),e.$set(h);const p={};d[0]&2&&(p.variant=f[1].isActive("italic")?"default":"secondary"),d[1]&262144&&(p.$$scope={dirty:d,ctx:f}),r.$set(p);const m={};d[0]&2&&(m.variant=f[1].isActive("strike")?"default":"secondary"),d[1]&262144&&(m.$$scope={dirty:d,ctx:f}),s.$set(m);const g={};d[0]&2&&(g.variant=f[1].isActive("underline")?"default":"secondary"),d[1]&262144&&(g.$$scope={dirty:d,ctx:f}),l.$set(g);const b={};d[0]&2&&(b.variant=f[1].isActive("code")?"default":"secondary"),d[1]&262144&&(b.$$scope={dirty:d,ctx:f}),c.$set(b)},i(f){u||(k(e.$$.fragment,f),k(r.$$.fragment,f),k(s.$$.fragment,f),k(l.$$.fragment,f),k(c.$$.fragment,f),u=!0)},o(f){S(e.$$.fragment,f),S(r.$$.fragment,f),S(s.$$.fragment,f),S(l.$$.fragment,f),S(c.$$.fragment,f),u=!1},d(f){f&&(j(t),j(i),j(o),j(a)),P(e,f),P(r,f),P(s,f),P(l,f),P(c,f)}}}function N3(n){let e,t;return e=new Dy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function D3(n){let e,t;return e=new Iy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function x3(n){let e,t;return e=new Ry({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function I3(n){let e,t;return e=new Py({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function R3(n){let e,t;return e=new xy({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:Ce,i(r){t||(k(e.$$.fragment,r),t=!0)},o(r){S(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function P3(n){let e,t,r,i,s,o=n[1]&&Cg(n),l=n[1]&&_g(n);return{c(){o&&o.c(),e=be(),t=Fe("div"),l&&l.c(),r=be(),i=Fe("div"),this.h()},l(a){o&&o.l(a),e=ye(a),t=ze(a,"DIV",{class:!0});var c=Ve(t);l&&l.l(c),c.forEach(j),r=ye(a),i=ze(a,"DIV",{}),Ve(i).forEach(j),this.h()},h(){Pr(t,"class","bubble-menu rounded-md")},m(a,c){o&&o.m(a,c),oe(a,e,c),oe(a,t,c),l&&l.m(t,null),n[46](t),oe(a,r,c),oe(a,i,c),n[47](i),s=!0},p(a,c){a[1]?o?(o.p(a,c),c[0]&2&&k(o,1)):(o=Cg(a),o.c(),k(o,1),o.m(e.parentNode,e)):o&&(On(),S(o,1,1,()=>{o=null}),$n()),a[1]?l?(l.p(a,c),c[0]&2&&k(l,1)):(l=_g(a),l.c(),k(l,1),l.m(t,null)):l&&(On(),S(l,1,1,()=>{l=null}),$n())},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[46](null),n[47](null)}}}function L3(n,e,t){let r,i,s,o,l="",a,c,u;Z1(async()=>{const Pe=new URLSearchParams(location.search);let ht;if(Pe.has("endpoint")&&Pe.has("workspace"))try{const qe=Pe.get("endpoint"),Ge=Pe.get("workspace");if(!qe)throw new Error("Invalid endpoint",{cause:"InvalidMetadata"});if(!Ge)throw new Error("Invalid workspace",{cause:"InvalidMetadata"});t(5,c=qe),t(6,u=Ge);const Tt=new L1({url:qe,maxAttempts:1});t(4,a=new VP({websocketProvider:Tt,name:Ge,onConnect(){window.alert(`Connected to ${qe}/${Ge}`)},onClose(){window.alert(`Failed to connect with ${qe}/${Ge}`),location.replace(`${location.protocol}//${location.host}${location.pathname}`)},connect:!1})),await a.connect(),localStorage.setItem("shared",JSON.stringify({endpoint:qe,workspace:Ge})),ht=uL(a,s)}catch(qe){qe instanceof Error&&qe.cause==="InvalidMetadata"?window.alert(`Failed to start sharing with ${location.search}: ${qe.toString()}`):window.alert(`Failed to start sharing with ${location.search}`),console.error(qe),location.replace(`${location.protocol}//${location.host}${location.pathname}`)}else{try{const qe=localStorage.getItem("shared");if(qe){const{endpoint:Ge,workspace:Tt}=JSON.parse(qe);t(5,c=Ge),t(6,u=Tt)}else t(5,c=""),t(6,u="")}catch(qe){t(5,c=""),t(6,u=""),console.error(qe)}ht=kD(s),l=localStorage.getItem("auto-saved")??uO}t(1,i=new r_({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:qe}){try{localStorage.setItem("auto-saved",qe.getHTML())}catch(Ge){console.error(Ge)}},content:l,onTransaction:()=>{t(1,i)}})),i.commands.focus()});const f=()=>mO(i),d=()=>i.chain().focus().toggleBold().run(),h=()=>i.chain().focus().toggleItalic().run(),p=()=>i.chain().focus().toggleUnderline().run(),m=()=>i.chain().focus().toggleStrike().run(),g=()=>i.chain().focus().toggleCode().run(),b=()=>i.chain().focus().setParagraph().run(),_=()=>i.chain().focus().toggleHeading({level:1}).run(),E=()=>i.chain().focus().toggleHeading({level:2}).run(),v=()=>i.chain().focus().toggleHeading({level:3}).run(),z=()=>i.chain().focus().setTextAlign("left").run(),C=()=>i.chain().focus().setTextAlign("center").run(),L=()=>i.chain().focus().setTextAlign("right").run(),F=()=>i.chain().focus().toggleBulletList().run(),M=()=>i.chain().focus().toggleOrderedList().run(),Z=()=>i.chain().focus().toggleCodeBlock().run(),$=()=>i.chain().focus().toggleBlockquote().run(),y=()=>i.chain().focus().setHorizontalRule().run(),w=()=>pO(i),O=()=>i.chain().focus().unsetLink().run(),B=()=>gO(i),T=()=>yO(i),V=()=>i.chain().focus().undo().run(),K=()=>i.chain().focus().redo().run(),Y=()=>dO(i);function se(){o=this.files,t(3,o)}const ge=()=>hO(i,o),we=()=>{var Pe;return(Pe=document.getElementById("selectedFile"))==null?void 0:Pe.click()};function me(Pe){c=Pe,t(5,c)}const Ke=Pe=>{Pe.code==="Enter"&&(Pe.preventDefault(),Xc(c,u))};function Be(Pe){u=Pe,t(6,u)}const et=Pe=>{Pe.code==="Enter"&&(Pe.preventDefault(),Xc(c,u))},Qe=()=>Xc(c,u),W=()=>bO(a),ft=()=>i.chain().focus().toggleBold().run(),Kt=()=>i.chain().focus().toggleItalic().run(),dt=()=>i.chain().focus().toggleStrike().run(),Rn=()=>i.chain().focus().toggleUnderline().run(),At=()=>i.chain().focus().toggleCode().run();function Pn(Pe){rt[Pe?"unshift":"push"](()=>{s=Pe,t(2,s)})}function Pt(Pe){rt[Pe?"unshift":"push"](()=>{r=Pe,t(0,r)})}return[r,i,s,o,a,c,u,f,d,h,p,m,g,b,_,E,v,z,C,L,F,M,Z,$,y,w,O,B,T,V,K,Y,se,ge,we,me,Ke,Be,et,Qe,W,ft,Kt,dt,Rn,At,Pn,Pt]}class B3 extends ue{constructor(e){super(),fe(this,e,L3,P3,ae,{},null,[-1,-1])}}function F3(n){let e,t,r;return t=new B3({}),{c(){e=Fe("main"),x(t.$$.fragment)},l(i){e=ze(i,"MAIN",{});var s=Ve(e);I(t.$$.fragment,s),s.forEach(j)},m(i,s){oe(i,e,s),R(t,e,null),r=!0},p:Ce,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 l4 extends ue{constructor(e){super(),fe(this,e,null,F3,ae,{})}}export{l4 as component}; diff --git a/_app/version.json b/_app/version.json index 7a7c336..94aa7ea 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1721574121160"} \ No newline at end of file +{"version":"1721609464587"} \ No newline at end of file diff --git a/index.html b/index.html index a185796..df8f942 100644 --- a/index.html +++ b/index.html @@ -9,16 +9,16 @@ - - - + + + - + -