diff --git a/_app/immutable/chunks/entry.D3HXvipR.js b/_app/immutable/chunks/entry.BP3GXasi.js similarity index 91% rename from _app/immutable/chunks/entry.D3HXvipR.js rename to _app/immutable/chunks/entry.BP3GXasi.js index adb9bd2..4894267 100644 --- a/_app/immutable/chunks/entry.D3HXvipR.js +++ b/_app/immutable/chunks/entry.BP3GXasi.js @@ -1,3 +1,3 @@ -import{z as ie}from"./scheduler.COxbwMzl.js";import{w as pt}from"./index.C2Jzycuw.js";new URL("sveltekit-internal://");function ce(t,n){return t==="/"||n==="ignore"?t:n==="never"?t.endsWith("/")?t.slice(0,-1):t:n==="always"&&!t.endsWith("/")?t+"/":t}function le(t){return t.split("%25").map(decodeURI).join("%25")}function fe(t){for(const n in t)t[n]=decodeURIComponent(t[n]);return t}function ct({href:t}){return t.split("#")[0]}const ue=["href","pathname","search","toString","toJSON"];function de(t,n,e){const a=new URL(t);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(r,o){if(o==="get"||o==="getAll"||o==="has")return s=>(e(s),r[o](s));n();const i=Reflect.get(r,o);return typeof i=="function"?i.bind(r):i}}),enumerable:!0,configurable:!0});for(const r of ue)Object.defineProperty(a,r,{get(){return n(),t[r]},enumerable:!0,configurable:!0});return a}const he="/__data.json",pe=".html__data.json";function ge(t){return t.endsWith(".html")?t.replace(/\.html$/,pe):t.replace(/\/$/,"")+he}function me(...t){let n=5381;for(const e of t)if(typeof e=="string"){let a=e.length;for(;a;)n=n*33^e.charCodeAt(--a)}else if(ArrayBuffer.isView(e)){const a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);let r=a.length;for(;r;)n=n*33^a[--r]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function _e(t){const n=atob(t),e=new Uint8Array(n.length);for(let a=0;a((t instanceof Request?t.method:(n==null?void 0:n.method)||"GET")!=="GET"&&G.delete(gt(t)),$t(t,n));const G=new Map;function ye(t,n){const e=gt(t,n),a=document.querySelector(e);if(a!=null&&a.textContent){let{body:r,...o}=JSON.parse(a.textContent);const i=a.getAttribute("data-ttl");return i&&G.set(e,{body:r,init:o,ttl:1e3*Number(i)}),a.getAttribute("data-b64")!==null&&(r=_e(r)),Promise.resolve(new Response(r,o))}return window.fetch(t,n)}function we(t,n,e){if(G.size>0){const a=gt(t,e),r=G.get(a);if(r){if(performance.now(){const r=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(a);if(r)return n.push({name:r[1],matcher:r[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(a);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!a)return;const i=a.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return lt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return lt(String.fromCharCode(...c.slice(2).split("-").map(l=>parseInt(l,16))));const u=ve.exec(c),[,h,g,d,_]=u;return n.push({name:d,matcher:_,optional:!!h,rest:!!g,chained:g?f===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return lt(c)}).join("")}).join("")}/?$`),params:n}}function Ee(t){return!/^\([^)]+\)$/.test(t)}function ke(t){return t.slice(1).split("/").filter(Ee)}function Se(t,n,e){const a={},r=t.slice(1),o=r.filter(s=>s!==void 0);let i=0;for(let s=0;su).join("/"),i=0),f===void 0){c.rest&&(a[c.name]="");continue}if(!c.matcher||e[c.matcher](f)){a[c.name]=f;const u=n[s+1],h=r[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(a).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return a}function lt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ae({nodes:t,server_loads:n,dictionary:e,matchers:a}){const r=new Set(n);return Object.entries(e).map(([s,[c,f,u]])=>{const{pattern:h,params:g}=be(s),d={id:s,exec:_=>{const l=h.exec(_);if(l)return Se(l,g,a)},errors:[1,...u||[]].map(_=>t[_]),layouts:[0,...f||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,t[s]]}function i(s){return s===void 0?s:[r.has(s),t[s]]}}function Ct(t,n=JSON.parse){try{return n(sessionStorage[t])}catch{}}function It(t,n,e=JSON.stringify){const a=e(n);try{sessionStorage[t]=a}catch{}}var jt;const P=((jt=globalThis.__sveltekit_senx5r)==null?void 0:jt.base)??"/LightNote";var Dt;const Re=((Dt=globalThis.__sveltekit_senx5r)==null?void 0:Dt.assets)??P,Ie="1721698873523",Vt="sveltekit:snapshot",Ft="sveltekit:scroll",Gt="sveltekit:states",Le="sveltekit:pageurl",D="sveltekit:history",q="sveltekit:navigation",z={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},K=location.origin;function Mt(t){if(t instanceof URL)return t;let n=document.baseURI;if(!n){const e=document.getElementsByTagName("base");n=e.length?e[0].href:document.URL}return new URL(t,n)}function mt(){return{x:pageXOffset,y:pageYOffset}}function O(t,n){return t.getAttribute(`data-sveltekit-${n}`)}const Lt={...z,"":z.hover};function qt(t){let n=t.assignedSlot??t.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function Ht(t,n){for(;t&&t!==n;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=qt(t)}}function ut(t,n){let e;try{e=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI)}catch{}const a=t instanceof SVGAElement?t.target.baseVal:t.target,r=!e||!!a||nt(e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(e==null?void 0:e.origin)===K&&t.hasAttribute("download");return{url:e,external:r,target:a,download:o}}function J(t){let n=null,e=null,a=null,r=null,o=null,i=null,s=t;for(;s&&s!==document.documentElement;)a===null&&(a=O(s,"preload-code")),r===null&&(r=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),e===null&&(e=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=qt(s);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Lt[a??"off"],preload_data:Lt[r??"off"],keepfocus:c(n),noscroll:c(e),reload:c(o),replace_state:c(i)}}function Pt(t){const n=pt(t);let e=!0;function a(){e=!0,n.update(i=>i)}function r(i){e=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||e&&c!==s)&&i(s=c)})}return{notify:a,set:r,subscribe:o}}function Pe(){const{set:t,subscribe:n}=pt(!1);let e;async function a(){clearTimeout(e);try{const r=await fetch(`${Re}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const i=(await r.json()).version!==Ie;return i&&(t(!0),clearTimeout(e)),i}catch{return!1}}return{subscribe:n,check:a}}function nt(t,n){return t.origin!==K||!t.pathname.startsWith(n)}const xe=-1,Te=-2,Ue=-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===xe)return;if(o===Ue)return NaN;if(o===Ne)return 1/0;if(o===Oe)return-1/0;if(o===je)return-0;if(i)throw new Error("Invalid input");if(o in a)return a[o];const s=e[o];if(!s||typeof s!="object")a[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],f=n==null?void 0:n[c];if(f)return a[o]=f(r(s[1]));switch(c){case"Date":a[o]=new Date(s[1]);break;case"Set":const u=new Set;a[o]=u;for(let d=1;dn!=null)}class at{constructor(n,e){this.status=n,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Kt{constructor(n,e){this.status=n,this.location=e}}class _t extends Error{constructor(n,e,a){super(a),this.status=n,this.text=e}}const Ve="x-sveltekit-invalidated",Fe="x-sveltekit-trailing-slash";function W(t){return t instanceof at||t instanceof _t?t.status:500}function Ge(t){return t instanceof _t?t.text:"Internal Error"}const N=Ct(Ft)??{},H=Ct(Vt)??{},T={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 xt(){}let rt,dt,X,x,ht,V;const Yt=[],Z=[];let R=null;const zt=[],qe=[];let j=[],y={branch:[],error:null,url:null},wt=!1,Q=!1,Tt=!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),x=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 Ut(){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:T,components:Z},hydrate:e}),Xt(L);const r={from:null,to:{params:y.params,route:{id:((o=y.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(i=>i(r)),Q=!0}async function et({url:t,params:n,branch:e,status:a,error:r,route:o,form:i}){let s="never";if(P&&(t.pathname===P||t.pathname===P+"/"))s="always";else for(const d of e)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);t.pathname=ce(t.pathname,s),t.search=t.search;const c={type:"loaded",state:{url:t,params:n,branch:e,error:r,route:o},props:{constructors:Ce(e).map(d=>d.node.component),page:I}};i!==void 0&&(c.props.form=i);let f={},u=!I,h=0;for(let d=0;d(s&&(c.route=!0),l[m])}),params:new Proxy(a,{get:(l,m)=>(s&&c.params.add(m),l[m])}),data:(o==null?void 0:o.data)??null,url:de(e,()=>{s&&(c.url=!0)},l=>{s&&c.search_params.add(l)}),async fetch(l,m){let b;l instanceof Request?(b=l.url,m={body:l.method==="GET"||l.method==="HEAD"?void 0:await l.blob(),cache:l.cache,credentials:l.credentials,headers:l.headers,integrity:l.integrity,keepalive:l.keepalive,method:l.method,mode:l.mode,redirect:l.redirect,referrer:l.referrer,referrerPolicy:l.referrerPolicy,signal:l.signal,...m}):b=l;const A=new URL(b,e);return s&&d(A.href),A.origin===e.origin&&(b=A.href.slice(e.origin.length)),Q?we(b,A.href,m):ye(b,m)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(l){s=!1;try{return l()}finally{s=!0}}};i=await f.universal.load.call(null,_)??null}return{node:f,loader:t,server:o,universal:(h=f.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=f.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Nt(t,n,e,a,r,o){if(vt)return!0;if(!r)return!1;if(r.parent&&t||r.route&&n||r.url&&e)return!0;for(const i of r.search_params)if(a.has(i))return!0;for(const i of r.params)if(o[i]!==y.params[i])return!0;for(const i of r.dependencies)if(Yt.some(s=>s(new URL(i))))return!0;return!1}function kt(t,n){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?n??null:null}function Ke(t,n){if(!t)return new Set(n.searchParams.keys());const e=new Set([...t.searchParams.keys(),...n.searchParams.keys()]);for(const a of e){const r=t.searchParams.getAll(a),o=n.searchParams.getAll(a);r.every(i=>o.includes(i))&&o.every(i=>r.includes(i))&&e.delete(a)}return e}function Ot({error:t,url:n,route:e,params:a}){return{type:"loaded",state:{error:t,url:n,route:e,params:a,branch:[]},props:{page:I,constructors:[]}}}async function te({id:t,invalidating:n,url:e,params:a,route:r,preload:o}){if((R==null?void 0:R.id)===t)return M.delete(R.token),R.promise;const{errors:i,layouts:s,leaf:c}=r,f=[...s,c];i.forEach(p=>p==null?void 0:p().catch(()=>{})),f.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let u=null;const h=y.url?t!==y.url.pathname+y.url.search:!1,g=y.route?r.id!==y.route.id:!1,d=Ke(y.url,e);let _=!1;const l=f.map((p,v)=>{var U;const E=y.branch[v],k=!!(p!=null&&p[0])&&((E==null?void 0:E.loader)!==p[1]||Nt(_,g,h,d,(U=E.server)==null?void 0:U.uses,a));return k&&(_=!0),k});if(l.some(Boolean)){try{u=await re(e,l)}catch(p){const v=await $(p,{url:e,params:a,route:{id:t}});return M.has(o)?Ot({error:v,url:e,params:a,route:r}):ot({status:W(p),error:v,url:e,route:r})}if(u.type==="redirect")return u}const m=u==null?void 0:u.nodes;let b=!1;const A=f.map(async(p,v)=>{var st;if(!p)return;const E=y.branch[v],k=m==null?void 0:m[v];if((!k||k.type==="skip")&&p[1]===(E==null?void 0:E.loader)&&!Nt(b,g,h,d,(st=E.universal)==null?void 0:st.uses,a))return E;if(b=!0,(k==null?void 0:k.type)==="error")throw k;return Et({loader:p[1],url:e,params:a,route:r,parent:async()=>{var Rt;const At={};for(let it=0;it{});const w=[];for(let p=0;pPromise.resolve({}),server_data_node:kt(o)}),c={node:await X(),loader:X,universal:null,server:null,data:null};return await et({url:e,params:r,branch:[s,c],status:t,error:n,route:null})}function St(t,n){if(!t||nt(t,P))return;let e;try{e=V.hooks.reroute({url:new URL(t)})??t.pathname}catch{return}const a=ee(e);for(const r of rt){const o=r.exec(a);if(o)return{id:t.pathname+t.search,invalidating:n,route:r,params:fe(o),url:t}}}function ee(t){return le(t.slice(P.length)||"/")}function ne({url:t,type:n,intent:e,delta:a}){let r=!1;const o=se(y,e,t,n);a!==void 0&&(o.navigation.delta=a);const i={...o.navigation,cancel:()=>{r=!0,o.reject(new Error("navigation cancelled"))}};return B||zt.forEach(s=>s(i)),r?null:o}async function Y({type:t,url:n,popped:e,keepfocus:a,noscroll:r,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:f=xt,block:u=xt}){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&&T.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 T.updated.check()&&await C(n);if(He(),yt(d),Wt(_),l.props.page.url.pathname!==n.pathname&&(n.pathname=l.props.page.url.pathname),i=e?e.state:i,!e){const w=o?0:1,p={[D]:S+=w,[q]:L+=w,[Gt]:i};(o?history.replaceState:history.pushState).call(history,p,"",n),o||Me(S,L)}if(R=null,l.props.page.state=i,Q){y=l.state,l.props.page&&(l.props.page.url=n);const w=(await Promise.all(qe.map(p=>p(g.navigation)))).filter(p=>typeof p=="function");if(w.length>0){let p=function(){j=j.filter(v=>!w.includes(v))};w.push(p),j.push(...w)}bt.$set(l.props),Jt=!0}else Qt(l,ht,!1);const{activeElement:m}=document;await ie();const b=e?e.scroll:r?mt():null;if(Tt){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(),Tt=!0,l.props.page&&(I=l.props.page),B=!1,t==="popstate"&&Xt(L),g.fulfil(void 0),j.forEach(w=>w(g.navigation)),T.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;x.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(t),t=setTimeout(()=>{a(i,2)},20)});function n(o){a(o.composedPath()[0],1)}x.addEventListener("mousedown",n),x.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,x);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 x.querySelectorAll("a")){const{url:i,external:s,download:c}=ut(o,P);if(s||c)continue;const f=J(o);f.reload||(f.preload_code===z.viewport&&e.observe(o),f.preload_code===z.eager&&ft(i.pathname))}}j.push(r),r()}function $(t,n){if(t instanceof at)return t.body;const e=W(t),a=Ge(t);return V.hooks.handleError({error:t,event:n,status:e,message:a})??{message:a}}function Je(t,n={}){return t=Mt(t),t.origin!==K?Promise.reject(new Error("goto: invalid URL")):Zt(t,n,0)}function We(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let a=!1;if(Ut(),!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"&&Ut()}),(n=navigator.connection)!=null&&n.saveData||ze(),x.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],x);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})}),x.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&&T.navigating.set(null)});function t(e){y.url=e,T.page.set({...I,url:e}),T.page.notify()}}async function Xe(t,{status:n=200,error:e,node_ids:a,params:r,route:o,data:i,form:s}){wt=!0;const c=new URL(location.href);({params:r={},route:o={id:null}}=St(c,!1)||{});let f;try{const u=a.map(async(d,_)=>{const l=i[_];return l!=null&&l.uses&&(l.uses=oe(l.uses)),Et({loader:V.nodes[d],url:c,params:r,route:o,parent:async()=>{const m={};for(let b=0;b<_;b+=1)Object.assign(m,(await u[b]).data);return m},server_data_node:kt(l)})}),h=await Promise.all(u),g=rt.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let _=0;_o?"1":"0").join(""));const a=await $t(e.href);if(!a.ok){let o;throw(r=a.headers.get("content-type"))!=null&&r.includes("application/json")?o=await a.json():a.status===404?o="Not Found":a.status===500&&(o="Internal Error"),new at(a.status,o)}return new Promise(async o=>{var h;const i=new Map,s=a.body.getReader(),c=new TextDecoder;function f(g){return De(g,{Promise:d=>new Promise((_,l)=>{i.set(d,{fulfil:_,reject:l})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?` +import{z as ie}from"./scheduler.COxbwMzl.js";import{w as pt}from"./index.C2Jzycuw.js";new URL("sveltekit-internal://");function ce(t,n){return t==="/"||n==="ignore"?t:n==="never"?t.endsWith("/")?t.slice(0,-1):t:n==="always"&&!t.endsWith("/")?t+"/":t}function le(t){return t.split("%25").map(decodeURI).join("%25")}function fe(t){for(const n in t)t[n]=decodeURIComponent(t[n]);return t}function ct({href:t}){return t.split("#")[0]}const ue=["href","pathname","search","toString","toJSON"];function de(t,n,e){const a=new URL(t);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(r,o){if(o==="get"||o==="getAll"||o==="has")return s=>(e(s),r[o](s));n();const i=Reflect.get(r,o);return typeof i=="function"?i.bind(r):i}}),enumerable:!0,configurable:!0});for(const r of ue)Object.defineProperty(a,r,{get(){return n(),t[r]},enumerable:!0,configurable:!0});return a}const he="/__data.json",pe=".html__data.json";function ge(t){return t.endsWith(".html")?t.replace(/\.html$/,pe):t.replace(/\/$/,"")+he}function me(...t){let n=5381;for(const e of t)if(typeof e=="string"){let a=e.length;for(;a;)n=n*33^e.charCodeAt(--a)}else if(ArrayBuffer.isView(e)){const a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);let r=a.length;for(;r;)n=n*33^a[--r]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function _e(t){const n=atob(t),e=new Uint8Array(n.length);for(let a=0;a((t instanceof Request?t.method:(n==null?void 0:n.method)||"GET")!=="GET"&&G.delete(gt(t)),$t(t,n));const G=new Map;function ye(t,n){const e=gt(t,n),a=document.querySelector(e);if(a!=null&&a.textContent){let{body:r,...o}=JSON.parse(a.textContent);const i=a.getAttribute("data-ttl");return i&&G.set(e,{body:r,init:o,ttl:1e3*Number(i)}),a.getAttribute("data-b64")!==null&&(r=_e(r)),Promise.resolve(new Response(r,o))}return window.fetch(t,n)}function we(t,n,e){if(G.size>0){const a=gt(t,e),r=G.get(a);if(r){if(performance.now(){const r=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(a);if(r)return n.push({name:r[1],matcher:r[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(a);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!a)return;const i=a.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return lt(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return lt(String.fromCharCode(...c.slice(2).split("-").map(l=>parseInt(l,16))));const u=ve.exec(c),[,h,g,d,_]=u;return n.push({name:d,matcher:_,optional:!!h,rest:!!g,chained:g?f===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return lt(c)}).join("")}).join("")}/?$`),params:n}}function Ee(t){return!/^\([^)]+\)$/.test(t)}function ke(t){return t.slice(1).split("/").filter(Ee)}function Se(t,n,e){const a={},r=t.slice(1),o=r.filter(s=>s!==void 0);let i=0;for(let s=0;su).join("/"),i=0),f===void 0){c.rest&&(a[c.name]="");continue}if(!c.matcher||e[c.matcher](f)){a[c.name]=f;const u=n[s+1],h=r[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(a).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return a}function lt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ae({nodes:t,server_loads:n,dictionary:e,matchers:a}){const r=new Set(n);return Object.entries(e).map(([s,[c,f,u]])=>{const{pattern:h,params:g}=be(s),d={id:s,exec:_=>{const l=h.exec(_);if(l)return Se(l,g,a)},errors:[1,...u||[]].map(_=>t[_]),layouts:[0,...f||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,t[s]]}function i(s){return s===void 0?s:[r.has(s),t[s]]}}function Ct(t,n=JSON.parse){try{return n(sessionStorage[t])}catch{}}function It(t,n,e=JSON.stringify){const a=e(n);try{sessionStorage[t]=a}catch{}}var jt;const P=((jt=globalThis.__sveltekit_o75wc7)==null?void 0:jt.base)??"/LightNote";var Dt;const Re=((Dt=globalThis.__sveltekit_o75wc7)==null?void 0:Dt.assets)??P,Ie="1721703645325",Vt="sveltekit:snapshot",Ft="sveltekit:scroll",Gt="sveltekit:states",Le="sveltekit:pageurl",D="sveltekit:history",q="sveltekit:navigation",z={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},K=location.origin;function Mt(t){if(t instanceof URL)return t;let n=document.baseURI;if(!n){const e=document.getElementsByTagName("base");n=e.length?e[0].href:document.URL}return new URL(t,n)}function mt(){return{x:pageXOffset,y:pageYOffset}}function O(t,n){return t.getAttribute(`data-sveltekit-${n}`)}const Lt={...z,"":z.hover};function qt(t){let n=t.assignedSlot??t.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function Ht(t,n){for(;t&&t!==n;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=qt(t)}}function ut(t,n){let e;try{e=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI)}catch{}const a=t instanceof SVGAElement?t.target.baseVal:t.target,r=!e||!!a||nt(e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(e==null?void 0:e.origin)===K&&t.hasAttribute("download");return{url:e,external:r,target:a,download:o}}function J(t){let n=null,e=null,a=null,r=null,o=null,i=null,s=t;for(;s&&s!==document.documentElement;)a===null&&(a=O(s,"preload-code")),r===null&&(r=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),e===null&&(e=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=qt(s);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Lt[a??"off"],preload_data:Lt[r??"off"],keepfocus:c(n),noscroll:c(e),reload:c(o),replace_state:c(i)}}function Pt(t){const n=pt(t);let e=!0;function a(){e=!0,n.update(i=>i)}function r(i){e=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||e&&c!==s)&&i(s=c)})}return{notify:a,set:r,subscribe:o}}function Pe(){const{set:t,subscribe:n}=pt(!1);let e;async function a(){clearTimeout(e);try{const r=await fetch(`${Re}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const i=(await r.json()).version!==Ie;return i&&(t(!0),clearTimeout(e)),i}catch{return!1}}return{subscribe:n,check:a}}function nt(t,n){return t.origin!==K||!t.pathname.startsWith(n)}const Te=-1,Ue=-2,xe=-3,Ne=-4,Oe=-5,je=-6;function De(t,n){if(typeof t=="number")return r(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const e=t,a=Array(e.length);function r(o,i=!1){if(o===Te)return;if(o===xe)return NaN;if(o===Ne)return 1/0;if(o===Oe)return-1/0;if(o===je)return-0;if(i)throw new Error("Invalid input");if(o in a)return a[o];const s=e[o];if(!s||typeof s!="object")a[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],f=n==null?void 0:n[c];if(f)return a[o]=f(r(s[1]));switch(c){case"Date":a[o]=new Date(s[1]);break;case"Set":const u=new Set;a[o]=u;for(let d=1;dn!=null)}class at{constructor(n,e){this.status=n,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Kt{constructor(n,e){this.status=n,this.location=e}}class _t extends Error{constructor(n,e,a){super(a),this.status=n,this.text=e}}const Ve="x-sveltekit-invalidated",Fe="x-sveltekit-trailing-slash";function W(t){return t instanceof at||t instanceof _t?t.status:500}function Ge(t){return t instanceof _t?t.text:"Internal Error"}const N=Ct(Ft)??{},H=Ct(Vt)??{},U={url:Pt({}),page:Pt({}),navigating:pt(null),updated:Pe()};function yt(t){N[t]=mt()}function Me(t,n){let e=t+1;for(;N[e];)delete N[e],e+=1;for(e=n+1;H[e];)delete H[e],e+=1}function C(t){return location.href=t.href,new Promise(()=>{})}function Tt(){}let rt,dt,X,T,ht,V;const Yt=[],Z=[];let R=null;const zt=[],qe=[];let j=[],y={branch:[],error:null,url:null},wt=!1,Q=!1,Ut=!0,B=!1,F=!1,Jt=!1,vt=!1,bt,S,L,I,tt;const M=new Set;async function en(t,n,e){var r,o;document.URL!==location.href&&(location.href=location.href),V=t,rt=Ae(t),T=document.documentElement,ht=n,dt=t.nodes[0],X=t.nodes[1],dt(),X(),S=(r=history.state)==null?void 0:r[D],L=(o=history.state)==null?void 0:o[q],S||(S=L=Date.now(),history.replaceState({...history.state,[D]:S,[q]:L},""));const a=N[S];a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y)),e?await Xe(ht,e):Je(location.href,{replaceState:!0}),We()}function He(){Yt.length=0,vt=!1}function Wt(t){Z.some(n=>n==null?void 0:n.snapshot)&&(H[t]=Z.map(n=>{var e;return(e=n==null?void 0:n.snapshot)==null?void 0:e.capture()}))}function Xt(t){var n;(n=H[t])==null||n.forEach((e,a)=>{var r,o;(o=(r=Z[a])==null?void 0:r.snapshot)==null||o.restore(e)})}function xt(){yt(S),It(Ft,N),Wt(L),It(Vt,H)}async function Zt(t,n,e,a){return Y({type:"goto",url:Mt(t),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:e,nav_token:a,accept:()=>{n.invalidateAll&&(vt=!0)}})}async function Be(t){if(t.id!==(R==null?void 0:R.id)){const n={};M.add(n),R={id:t.id,token:n,promise:te({...t,preload:n}).then(e=>(M.delete(n),e.type==="loaded"&&e.state.error&&(R=null),e))}}return R.promise}async function ft(t){const n=rt.find(e=>e.exec(ee(t)));n&&await Promise.all([...n.layouts,n.leaf].map(e=>e==null?void 0:e[1]()))}function Qt(t,n,e){var o;y=t.state;const a=document.querySelector("style[data-sveltekit]");a&&a.remove(),I=t.props.page,bt=new V.root({target:n,props:{...t.props,stores:U,components:Z},hydrate:e}),Xt(L);const r={from:null,to:{params:y.params,route:{id:((o=y.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(i=>i(r)),Q=!0}async function et({url:t,params:n,branch:e,status:a,error:r,route:o,form:i}){let s="never";if(P&&(t.pathname===P||t.pathname===P+"/"))s="always";else for(const d of e)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);t.pathname=ce(t.pathname,s),t.search=t.search;const c={type:"loaded",state:{url:t,params:n,branch:e,error:r,route:o},props:{constructors:Ce(e).map(d=>d.node.component),page:I}};i!==void 0&&(c.props.form=i);let f={},u=!I,h=0;for(let d=0;d(s&&(c.route=!0),l[m])}),params:new Proxy(a,{get:(l,m)=>(s&&c.params.add(m),l[m])}),data:(o==null?void 0:o.data)??null,url:de(e,()=>{s&&(c.url=!0)},l=>{s&&c.search_params.add(l)}),async fetch(l,m){let b;l instanceof Request?(b=l.url,m={body:l.method==="GET"||l.method==="HEAD"?void 0:await l.blob(),cache:l.cache,credentials:l.credentials,headers:l.headers,integrity:l.integrity,keepalive:l.keepalive,method:l.method,mode:l.mode,redirect:l.redirect,referrer:l.referrer,referrerPolicy:l.referrerPolicy,signal:l.signal,...m}):b=l;const A=new URL(b,e);return s&&d(A.href),A.origin===e.origin&&(b=A.href.slice(e.origin.length)),Q?we(b,A.href,m):ye(b,m)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(l){s=!1;try{return l()}finally{s=!0}}};i=await f.universal.load.call(null,_)??null}return{node:f,loader:t,server:o,universal:(h=f.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=f.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Nt(t,n,e,a,r,o){if(vt)return!0;if(!r)return!1;if(r.parent&&t||r.route&&n||r.url&&e)return!0;for(const i of r.search_params)if(a.has(i))return!0;for(const i of r.params)if(o[i]!==y.params[i])return!0;for(const i of r.dependencies)if(Yt.some(s=>s(new URL(i))))return!0;return!1}function kt(t,n){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?n??null:null}function Ke(t,n){if(!t)return new Set(n.searchParams.keys());const e=new Set([...t.searchParams.keys(),...n.searchParams.keys()]);for(const a of e){const r=t.searchParams.getAll(a),o=n.searchParams.getAll(a);r.every(i=>o.includes(i))&&o.every(i=>r.includes(i))&&e.delete(a)}return e}function Ot({error:t,url:n,route:e,params:a}){return{type:"loaded",state:{error:t,url:n,route:e,params:a,branch:[]},props:{page:I,constructors:[]}}}async function te({id:t,invalidating:n,url:e,params:a,route:r,preload:o}){if((R==null?void 0:R.id)===t)return M.delete(R.token),R.promise;const{errors:i,layouts:s,leaf:c}=r,f=[...s,c];i.forEach(p=>p==null?void 0:p().catch(()=>{})),f.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let u=null;const h=y.url?t!==y.url.pathname+y.url.search:!1,g=y.route?r.id!==y.route.id:!1,d=Ke(y.url,e);let _=!1;const l=f.map((p,v)=>{var x;const E=y.branch[v],k=!!(p!=null&&p[0])&&((E==null?void 0:E.loader)!==p[1]||Nt(_,g,h,d,(x=E.server)==null?void 0:x.uses,a));return k&&(_=!0),k});if(l.some(Boolean)){try{u=await re(e,l)}catch(p){const v=await $(p,{url:e,params:a,route:{id:t}});return M.has(o)?Ot({error:v,url:e,params:a,route:r}):ot({status:W(p),error:v,url:e,route:r})}if(u.type==="redirect")return u}const m=u==null?void 0:u.nodes;let b=!1;const A=f.map(async(p,v)=>{var st;if(!p)return;const E=y.branch[v],k=m==null?void 0:m[v];if((!k||k.type==="skip")&&p[1]===(E==null?void 0:E.loader)&&!Nt(b,g,h,d,(st=E.universal)==null?void 0:st.uses,a))return E;if(b=!0,(k==null?void 0:k.type)==="error")throw k;return Et({loader:p[1],url:e,params:a,route:r,parent:async()=>{var Rt;const At={};for(let it=0;it{});const w=[];for(let p=0;pPromise.resolve({}),server_data_node:kt(o)}),c={node:await X(),loader:X,universal:null,server:null,data:null};return await et({url:e,params:r,branch:[s,c],status:t,error:n,route:null})}function St(t,n){if(!t||nt(t,P))return;let e;try{e=V.hooks.reroute({url:new URL(t)})??t.pathname}catch{return}const a=ee(e);for(const r of rt){const o=r.exec(a);if(o)return{id:t.pathname+t.search,invalidating:n,route:r,params:fe(o),url:t}}}function ee(t){return le(t.slice(P.length)||"/")}function ne({url:t,type:n,intent:e,delta:a}){let r=!1;const o=se(y,e,t,n);a!==void 0&&(o.navigation.delta=a);const i={...o.navigation,cancel:()=>{r=!0,o.reject(new Error("navigation cancelled"))}};return B||zt.forEach(s=>s(i)),r?null:o}async function Y({type:t,url:n,popped:e,keepfocus:a,noscroll:r,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:f=Tt,block:u=Tt}){const h=St(n,!1),g=ne({url:n,type:t,delta:e==null?void 0:e.delta,intent:h});if(!g){u();return}const d=S,_=L;f(),B=!0,Q&&U.navigating.set(g.navigation),tt=c;let l=h&&await te(h);if(!l){if(nt(n,P))return await C(n);l=await ae(n,{id:null},await $(new _t(404,"Not Found",`Not found: ${n.pathname}`),{url:n,params:{},route:{id:null}}),404)}if(n=(h==null?void 0:h.url)||n,tt!==c)return g.reject(new Error("navigation aborted")),!1;if(l.type==="redirect")if(s>=20)l=await ot({status:500,error:await $(new Error("Redirect loop"),{url:n,params:{},route:{id:null}}),url:n,route:{id:null}});else return Zt(new URL(l.location,n).href,{},s+1,c),!1;else l.props.page.status>=400&&await U.updated.check()&&await C(n);if(He(),yt(d),Wt(_),l.props.page.url.pathname!==n.pathname&&(n.pathname=l.props.page.url.pathname),i=e?e.state:i,!e){const w=o?0:1,p={[D]:S+=w,[q]:L+=w,[Gt]:i};(o?history.replaceState:history.pushState).call(history,p,"",n),o||Me(S,L)}if(R=null,l.props.page.state=i,Q){y=l.state,l.props.page&&(l.props.page.url=n);const w=(await Promise.all(qe.map(p=>p(g.navigation)))).filter(p=>typeof p=="function");if(w.length>0){let p=function(){j=j.filter(v=>!w.includes(v))};w.push(p),j.push(...w)}bt.$set(l.props),Jt=!0}else Qt(l,ht,!1);const{activeElement:m}=document;await ie();const b=e?e.scroll:r?mt():null;if(Ut){const w=n.hash&&document.getElementById(decodeURIComponent(n.hash.slice(1)));b?scrollTo(b.x,b.y):w?w.scrollIntoView():scrollTo(0,0)}const A=document.activeElement!==m&&document.activeElement!==document.body;!a&&!A&&Ze(),Ut=!0,l.props.page&&(I=l.props.page),B=!1,t==="popstate"&&Xt(L),g.fulfil(void 0),j.forEach(w=>w(g.navigation)),U.navigating.set(null)}async function ae(t,n,e,a){return t.origin===K&&t.pathname===location.pathname&&!wt?await ot({status:a,error:e,url:t,route:n}):await C(t)}function ze(){let t;T.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(t),t=setTimeout(()=>{a(i,2)},20)});function n(o){a(o.composedPath()[0],1)}T.addEventListener("mousedown",n),T.addEventListener("touchstart",n,{passive:!0});const e=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&(ft(i.target.href),e.unobserve(i.target))},{threshold:0});function a(o,i){const s=Ht(o,T);if(!s)return;const{url:c,external:f,download:u}=ut(s,P);if(f||u)return;const h=J(s);if(!h.reload)if(i<=h.preload_data){const g=St(c,!1);g&&Be(g)}else i<=h.preload_code&&ft(c.pathname)}function r(){e.disconnect();for(const o of T.querySelectorAll("a")){const{url:i,external:s,download:c}=ut(o,P);if(s||c)continue;const f=J(o);f.reload||(f.preload_code===z.viewport&&e.observe(o),f.preload_code===z.eager&&ft(i.pathname))}}j.push(r),r()}function $(t,n){if(t instanceof at)return t.body;const e=W(t),a=Ge(t);return V.hooks.handleError({error:t,event:n,status:e,message:a})??{message:a}}function Je(t,n={}){return t=Mt(t),t.origin!==K?Promise.reject(new Error("goto: invalid URL")):Zt(t,n,0)}function We(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let a=!1;if(xt(),!B){const r=se(y,void 0,null,"leave"),o={...r.navigation,cancel:()=>{a=!0,r.reject(new Error("navigation cancelled"))}};zt.forEach(i=>i(o))}a?(e.preventDefault(),e.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&xt()}),(n=navigator.connection)!=null&&n.saveData||ze(),T.addEventListener("click",e=>{var g;if(e.button||e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;const a=Ht(e.composedPath()[0],T);if(!a)return;const{url:r,external:o,target:i,download:s}=ut(a,P);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=J(a);if(!(a instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;if(o||c.reload){ne({url:r,type:"link"})?B=!0:e.preventDefault();return}const[u,h]=r.href.split("#");if(h!==void 0&&u===ct(location)){const[,d]=y.url.href.split("#");if(d===h){e.preventDefault(),h===""||h==="top"&&a.ownerDocument.getElementById("top")===null?window.scrollTo({top:0}):(g=a.ownerDocument.getElementById(h))==null||g.scrollIntoView();return}if(F=!0,yt(S),t(r),!c.replace_state)return;F=!1}e.preventDefault(),Y({type:"link",url:r,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??r.href===location.href})}),T.addEventListener("submit",e=>{if(e.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(e.target),r=e.submitter;if(((r==null?void 0:r.formMethod)||a.method)!=="get")return;const i=new URL((r==null?void 0:r.hasAttribute("formaction"))&&(r==null?void 0:r.formAction)||a.action);if(nt(i,P))return;const s=e.target,c=J(s);if(c.reload)return;e.preventDefault(),e.stopPropagation();const f=new FormData(s),u=r==null?void 0:r.getAttribute("name");u&&f.append(u,(r==null?void 0:r.getAttribute("value"))??""),i.search=new URLSearchParams(f).toString(),Y({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href})}),addEventListener("popstate",async e=>{var a;if((a=e.state)!=null&&a[D]){const r=e.state[D];if(tt={},r===S)return;const o=N[r],i=e.state[Gt]??{},s=new URL(e.state[Le]??location.href),c=e.state[q],f=ct(location)===ct(y.url);if(c===L&&(Jt||f)){t(s),N[S]=mt(),o&&scrollTo(o.x,o.y),i!==I.state&&(I={...I,state:i},bt.$set({page:I})),S=r;return}const h=r-S;await Y({type:"popstate",url:s,popped:{state:i,scroll:o,delta:h},accept:()=>{S=r,L=c},block:()=>{history.go(-h)},nav_token:tt})}else if(!F){const r=new URL(location.href);t(r)}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[D]:++S,[q]:L},"",location.href))});for(const e of document.querySelectorAll("link"))e.rel==="icon"&&(e.href=e.href);addEventListener("pageshow",e=>{e.persisted&&U.navigating.set(null)});function t(e){y.url=e,U.page.set({...I,url:e}),U.page.notify()}}async function Xe(t,{status:n=200,error:e,node_ids:a,params:r,route:o,data:i,form:s}){wt=!0;const c=new URL(location.href);({params:r={},route:o={id:null}}=St(c,!1)||{});let f;try{const u=a.map(async(d,_)=>{const l=i[_];return l!=null&&l.uses&&(l.uses=oe(l.uses)),Et({loader:V.nodes[d],url:c,params:r,route:o,parent:async()=>{const m={};for(let b=0;b<_;b+=1)Object.assign(m,(await u[b]).data);return m},server_data_node:kt(l)})}),h=await Promise.all(u),g=rt.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let _=0;_o?"1":"0").join(""));const a=await $t(e.href);if(!a.ok){let o;throw(r=a.headers.get("content-type"))!=null&&r.includes("application/json")?o=await a.json():a.status===404?o="Not Found":a.status===500&&(o="Internal Error"),new at(a.status,o)}return new Promise(async o=>{var h;const i=new Map,s=a.body.getReader(),c=new TextDecoder;function f(g){return De(g,{Promise:d=>new Promise((_,l)=>{i.set(d,{fulfil:_,reject:l})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?` `:c.decode(d,{stream:!0});;){const _=u.indexOf(` -`);if(_===-1)break;const l=JSON.parse(u.slice(0,_));if(u=u.slice(_+1),l.type==="redirect")return o(l);if(l.type==="data")(h=l.nodes)==null||h.forEach(m=>{(m==null?void 0:m.type)==="data"&&(m.uses=oe(m.uses),m.data=f(m.data))}),o(l);else if(l.type==="chunk"){const{id:m,data:b,error:A}=l,w=i.get(m);i.delete(m),A?w.reject(f(A)):w.fulfil(f(b))}}}})}function oe(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url),search_params:new Set((t==null?void 0:t.search_params)??[])}}function Ze(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const n=document.body,e=n.getAttribute("tabindex");n.tabIndex=-1,n.focus({preventScroll:!0,focusVisible:!1}),e!==null?n.setAttribute("tabindex",e):n.removeAttribute("tabindex");const a=getSelection();if(a&&a.type!=="None"){const r=[];for(let o=0;o{if(a.rangeCount===r.length){for(let o=0;o{r=u,o=h});return i.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((c=t.route)==null?void 0:c.id)??null},url:t.url},to:e&&{params:(n==null?void 0:n.params)??null,route:{id:((f=n==null?void 0:n.route)==null?void 0:f.id)??null},url:e},willUnload:!n,type:a,complete:i},fulfil:r,reject:o}}export{en as a,T as s}; +`);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.Dj2rprIj.js b/_app/immutable/entry/app.Cg-YLXxd.js similarity index 95% rename from _app/immutable/entry/app.Dj2rprIj.js rename to _app/immutable/entry/app.Cg-YLXxd.js index 904f2e8..63a3d80 100644 --- a/_app/immutable/entry/app.Dj2rprIj.js +++ b/_app/immutable/entry/app.Cg-YLXxd.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.BKxPGPMB.js","../chunks/entry.D3HXvipR.js","../nodes/2.CdnkV1QR.js","../assets/2.CaKj4uVh.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.CmLJlOek.js","../chunks/entry.BP3GXasi.js","../nodes/2.BVIeHMD0.js","../assets/2.CaKj4uVh.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.BKxPGPMB.js"),__vite__mapDeps([6,1,2,7,4]),import.meta.url),()=>C(()=>import("../nodes/2.CdnkV1QR.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.CmLJlOek.js"),__vite__mapDeps([6,1,2,7,4]),import.meta.url),()=>C(()=>import("../nodes/2.BVIeHMD0.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.B5BX5IwX.js b/_app/immutable/entry/start.B5BX5IwX.js deleted file mode 100644 index 5096b7f..0000000 --- a/_app/immutable/entry/start.B5BX5IwX.js +++ /dev/null @@ -1 +0,0 @@ -import{a as t}from"../chunks/entry.D3HXvipR.js";export{t as start}; diff --git a/_app/immutable/entry/start.CtPwPORu.js b/_app/immutable/entry/start.CtPwPORu.js new file mode 100644 index 0000000..773ed16 --- /dev/null +++ b/_app/immutable/entry/start.CtPwPORu.js @@ -0,0 +1 @@ +import{a as t}from"../chunks/entry.BP3GXasi.js";export{t as start}; diff --git a/_app/immutable/nodes/1.BKxPGPMB.js b/_app/immutable/nodes/1.CmLJlOek.js similarity index 93% rename from _app/immutable/nodes/1.BKxPGPMB.js rename to _app/immutable/nodes/1.CmLJlOek.js index 80f0e1c..2473d54 100644 --- a/_app/immutable/nodes/1.BKxPGPMB.js +++ b/_app/immutable/nodes/1.CmLJlOek.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.D3HXvipR.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.BP3GXasi.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.CdnkV1QR.js b/_app/immutable/nodes/2.BVIeHMD0.js similarity index 91% rename from _app/immutable/nodes/2.CdnkV1QR.js rename to _app/immutable/nodes/2.BVIeHMD0.js index dd30fd7..292517c 100644 --- a/_app/immutable/nodes/2.CdnkV1QR.js +++ b/_app/immutable/nodes/2.BVIeHMD0.js @@ -1,9 +1,9 @@ -import{X as W1,z as Nf,o as Jt,Y as K1,a as ae,p as We,j as oe,g as j,Z as Te,_ as A,$ as J,a0 as pe,x as rt,C as te,e as Fe,c as ze,d as Ve,a1 as rs,a2 as ce,D as ne,E as re,F as ie,r as It,a3 as Rt,i as q1,a4 as J1,a5 as G1,m as Mn,a6 as Ie,J as Ss,n as Ce,a7 as Ag,a8 as Tg,a9 as xl,k as $e,aa as Y1,L as X1,b as be,h as ye,ab as Q1,v as Pr,ac as Zd,u as Z1,w as ev,ad as eh,t as Po,f as Lo}from"../chunks/scheduler.COxbwMzl.js";import{S as ue,i as fe,g as On,t as S,c as $n,a as k,f as ja,h as Wa,j as Il,b as x,d as I,m as R,e as P,k as th}from"../chunks/index.DiXqLa_v.js";import{d as Ka,w as is,r as Df,a as nh}from"../chunks/index.C2Jzycuw.js";import{t as tv}from"../chunks/mode.C0a2Dozw.js";function rh(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function le(n,e){const t={},r={},i={$$scope:1};let s=n.length;for(;s--;){const o=n[s],l=e[s];if(l){for(const a in o)a in l||(r[a]=1);for(const a in l)i[a]||(t[a]=l[a],i[a]=1);n[s]=l}else for(const a in o)i[a]=1}for(const o in r)o in t||(t[o]=void 0);return t}function Ne(n){return typeof n=="object"&&n!==null?n:{}}function Ot(n){this.content=n}Ot.prototype={constructor:Ot,find:function(n){for(var e=0;e>1}};Ot.from=function(n){if(n instanceof Ot)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ot(e)};function Eg(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Eg(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Mg(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;ce&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new H(r,i)}cutByIndex(e,t){return e==t?H.empty:e==0&&t==this.content.length?this:new H(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new H(i,s)}addToStart(e){return new H([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new H(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Go(r+1,o):Go(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return H.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new H(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return H.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};je.none=[];class Pl extends Error{}class G{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=$g(this.content,e+this.openStart,t);return r&&new G(r,this.openStart,this.openEnd)}removeBetween(e,t){return new G(Og(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return G.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new G(H.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new G(e,r,i)}}G.empty=new G(H.empty,0,0);function Og(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Og(s.content,e-i-1,t-i-1)))}function $g(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=$g(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function nv(n,e,t){if(t.openStart>n.depth)throw new Pl("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Pl("Inconsistent open depths");return Ng(n,e,t,0)}function Ng(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Ks(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(ci(n.nodeAfter,r),s++));for(let l=s;li&&ku(n,e,i+1),o=r.depth>i&&ku(t,r,i+1),l=[];return Ks(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Dg(s,o),ci(ui(s,xg(n,e,t,r,i+1)),l)):(s&&ci(ui(s,Ll(n,e,i+1)),l),Ks(e,t,i,l),o&&ci(ui(o,Ll(t,r,i+1)),l)),Ks(r,null,i,l),new H(l)}function Ll(n,e,t){let r=[];if(Ks(null,n,t,r),n.depth>t){let i=ku(n,e,t+1);ci(ui(i,Ll(n,e,t+1)),r)}return Ks(e,null,t,r),new H(r)}function rv(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(H.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class ao{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Bl(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new ao(t,r,s)}static resolveCached(e,t){let r=ih.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ig(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=H.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=H.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};fi.prototype.text=void 0;class Fl extends fi{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ig(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Fl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fl(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ig(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class yi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new lv(e,t);if(r.next==null)return yi.empty;let i=Rg(r);r.next&&r.err("Unexpected trailing text");let s=pv(hv(i));return mv(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` -`)}}yi.empty=new yi(!0);class lv{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Rg(n){let e=[];do e.push(av(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function av(n){let e=[];do e.push(cv(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function cv(n){let e=dv(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=uv(n,e);else break;return e}function sh(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function uv(n,e){let t=sh(n),r=t;return n.eat(",")&&(n.next!="}"?r=sh(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function fv(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function dv(n){if(n.eat("(")){let e=Rg(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=fv(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function hv(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new yi(r.indexOf(n.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new Vg(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function gv(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class bv{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?gv(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class qa{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=zg(e,i.attrs),this.excluded=null;let s=Lg(this.attrs);this.instance=s?new je(this,s):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Bg(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new qa(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}}class Hg{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ot.from(e.nodes),t.marks=Ot.from(e.marks||{}),this.nodes=lh.compile(this.spec.nodes,this),this.marks=qa.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=yi.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?ah(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:ah(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof lh){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Fl(r,r.defaultAttrs,e,je.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return fi.fromJSON(this,e)}markFromJSON(e){return je.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ah(n,e){let t=[];for(let r=0;r-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function yv(n){return n.tag!=null}function vv(n){return n.style!=null}let xf=class Cu{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(yv(i))this.tags.push(i);else if(vv(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new uh(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new uh(this,t,!0);return r.addAll(e,t.from,t.to),G.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=fh(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=fh(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Cu(e,Cu.schemaRules(e)))}};const Ug={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},wv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jg={ol:!0,ul:!0},zl=1,Vl=2,qs=4;function ch(n,e,t){return e!=null?(e?zl:0)|(e==="full"?Vl:0):n&&n.whitespace=="pre"?zl|Vl:t&~qs}class Yo{constructor(e,t,r,i,s,o,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=l,this.content=[],this.activeMarks=je.none,this.stashMarks=[],this.match=o||(l&qs?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(H.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zl)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=H.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(H.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t>1}};Ot.from=function(n){if(n instanceof Ot)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ot(e)};function Eg(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Eg(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Mg(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;ce&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new H(r,i)}cutByIndex(e,t){return e==t?H.empty:e==0&&t==this.content.length?this:new H(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new H(i,s)}addToStart(e){return new H([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new H(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Go(r+1,o):Go(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return H.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new H(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return H.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};We.none=[];class Pl extends Error{}class G{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=$g(this.content,e+this.openStart,t);return r&&new G(r,this.openStart,this.openEnd)}removeBetween(e,t){return new G(Og(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return G.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new G(H.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new G(e,r,i)}}G.empty=new G(H.empty,0,0);function Og(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Og(s.content,e-i-1,t-i-1)))}function $g(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=$g(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function nv(n,e,t){if(t.openStart>n.depth)throw new Pl("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Pl("Inconsistent open depths");return Ng(n,e,t,0)}function Ng(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Ks(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(ci(n.nodeAfter,r),s++));for(let l=s;li&&ku(n,e,i+1),o=r.depth>i&&ku(t,r,i+1),l=[];return Ks(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Dg(s,o),ci(ui(s,xg(n,e,t,r,i+1)),l)):(s&&ci(ui(s,Ll(n,e,i+1)),l),Ks(e,t,i,l),o&&ci(ui(o,Ll(t,r,i+1)),l)),Ks(r,null,i,l),new H(l)}function Ll(n,e,t){let r=[];if(Ks(null,n,t,r),n.depth>t){let i=ku(n,e,t+1);ci(ui(i,Ll(n,e,t+1)),r)}return Ks(e,null,t,r),new H(r)}function rv(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(H.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class ao{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Bl(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new ao(t,r,s)}static resolveCached(e,t){let r=ih.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ig(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=H.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=H.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};fi.prototype.text=void 0;class Fl extends fi{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ig(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Fl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fl(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ig(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class yi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new lv(e,t);if(r.next==null)return yi.empty;let i=Rg(r);r.next&&r.err("Unexpected trailing text");let s=pv(hv(i));return mv(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` +`)}}yi.empty=new yi(!0);class lv{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Rg(n){let e=[];do e.push(av(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function av(n){let e=[];do e.push(cv(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function cv(n){let e=dv(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=uv(n,e);else break;return e}function sh(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function uv(n,e){let t=sh(n),r=t;return n.eat(",")&&(n.next!="}"?r=sh(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function fv(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function dv(n){if(n.eat("(")){let e=Rg(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=fv(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function hv(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new yi(r.indexOf(n.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new Vg(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function gv(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class bv{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?gv(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class qa{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=zg(e,i.attrs),this.excluded=null;let s=Lg(this.attrs);this.instance=s?new We(this,s):null}create(e=null){return!e&&this.instance?this.instance:new We(this,Bg(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new qa(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}}class Hg{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ot.from(e.nodes),t.marks=Ot.from(e.marks||{}),this.nodes=lh.compile(this.spec.nodes,this),this.marks=qa.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=yi.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?ah(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:ah(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof lh){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Fl(r,r.defaultAttrs,e,We.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return fi.fromJSON(this,e)}markFromJSON(e){return We.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ah(n,e){let t=[];for(let r=0;r-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function yv(n){return n.tag!=null}function vv(n){return n.style!=null}let xf=class Cu{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(yv(i))this.tags.push(i);else if(vv(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new uh(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new uh(this,t,!0);return r.addAll(e,t.from,t.to),G.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=fh(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=fh(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Cu(e,Cu.schemaRules(e)))}};const Ug={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},wv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jg={ol:!0,ul:!0},zl=1,Vl=2,qs=4;function ch(n,e,t){return e!=null?(e?zl:0)|(e==="full"?Vl:0):n&&n.whitespace=="pre"?zl|Vl:t&~qs}class Yo{constructor(e,t,r,i,s,o,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=l,this.content=[],this.activeMarks=We.none,this.stashMarks=[],this.match=o||(l&qs?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(H.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zl)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=H.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(H.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;tthis.addAll(e)),o&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=je.none,r=je.none;if(e.length)for(let i=0;i{a.clearMark(c)&&(r=c.addToSet(r))}):t=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(t),a.consuming===!1)l=a;else break}}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;ithis.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=_v(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function kv(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Sv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function fh(n){let e={};for(let t in n)e[t]=n[t];return e}function Cv(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&gl(Ec(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return gl(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Oi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=dh(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return dh(e.marks)}}function dh(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ec(n){return n.document||window.document}const hh=new WeakMap;function Av(n){let e=hh.get(n);return e===void 0&&hh.set(n,e=Tv(n)),e}function Tv(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let d=f.indexOf(" ");d>0?a.setAttributeNS(f.slice(0,d),f.slice(d+1),c[f]):a.setAttribute(f,c[f])}}for(let f=u;fu)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=gl(n,d,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Wg=65535,Kg=Math.pow(2,16);function Ev(n,e){return n+e*Kg}function ph(n){return n&Wg}function Mv(n){return(n-(n&Wg))/Kg}const qg=1,Jg=2,bl=4,Gg=8;class _u{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Gg)>0}get deletedBefore(){return(this.delInfo&(qg|bl))>0}get deletedAfter(){return(this.delInfo&(Jg|bl))>0}get deletedAcross(){return(this.delInfo&bl)>0}}class rn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&rn.empty)return rn.empty}recover(e){let t=0,r=ph(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],u=this.ranges[l+o],f=a+c;if(e<=f){let d=c?e==a?-1:e==f?1:t:t,h=a+i+(d<0?0:u);if(r)return h;let p=e==(t<0?a:f)?null:Ev(l/3,e-a),m=e==a?Jg:e==f?qg:bl;return(t<0?e!=a:e!=f)&&(m|=Gg),new _u(h,m,p)}i+=u-c}return r?e+i:new _u(e+i,0,null)}touches(e,t){let r=0,i=ph(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Ji;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,s)}invert(){return new Kn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Dr(t.pos,r.pos,this.mark)}merge(e){return e instanceof Dr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Dr(t.from,t.to,e.markFromJSON(t.mark))}}zt.jsonID("addMark",Dr);class Kn extends zt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new G(If(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,r)}invert(){return new Dr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Kn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Kn(t.from,t.to,e.markFromJSON(t.mark))}}zt.jsonID("removeMark",Kn);class xr extends zt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return lt.fromReplace(e,this.pos,this.pos+1,new G(H.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new vt(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new vt(t.from,t.to,t.gapFrom,t.gapTo,G.fromJSON(e,t.slice),t.insert,!!t.structure)}}zt.jsonID("replaceAround",vt);function Au(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Ov(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let d=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(f);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function $v(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof qa){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;un.step(new Kn(o.from,o.to,o.style)))}function Yg(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a=0;a--)n.step(o[a])}function Nv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Cs(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,u=H.from(r.node(p).copy(u)),f++):a--;let d=H.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=H.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new vt(i,s,i,s,new G(r,0,0),t.length,!0))}function Pv(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&Fv(n.doc,n.mapping.slice(s).map(l),r)){let a=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!h?a=!1:!d&&h&&(a=!0)}a===!1&&Bv(n,o,l,s),Yg(n,n.mapping.slice(s).map(l,1),r,void 0,a===null);let c=n.mapping.slice(s),u=c.map(l,1),f=c.map(l+o.nodeSize,1);return n.step(new vt(u,f,u+1,f-1,new G(H.from(r.create(i,null,o.marks)),0,0),1,!0)),a===!0&&Lv(n,o,l,s),!1}})}function Lv(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Bv(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(` -`))}})}function Fv(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function zv(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new vt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new G(H.from(o),0,0),1,!0))}function Gi(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Vv(n,e,t=1,r){let i=n.doc.resolve(e),s=H.empty,o=H.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=H.from(i.node(l).copy(s));let u=r&&r[c];o=H.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new yt(e,e,new G(s.append(o),t,t),!0))}function Wr(n,e){let t=n.resolve(e),r=t.index();return Xg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Xg(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Ja(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Xg(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Hv(n,e,t){let r=new yt(e-t,e+t,G.empty,!0);n.step(r)}function Uv(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let f=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Ga(n,e,t=e,r=G.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Zg(i,s,r)?new yt(e,t,r):new jv(i,s,r).fit()}function Zg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class jv{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=H.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=H.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new G(s,o,l);return e>-1?new vt(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new yt(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Oc(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,f=null;if(t==1&&(o?c.matchType(o.type)||(f=c.fillBefore(H.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Oc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Oc(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new G(Vs(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new G(Vs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(f=g,u.push(eb(m.mark(d.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Hs(this.placed,t,H.from(u)),this.frontier[t].match=f,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],u=$c(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Hs(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Hs(this.placed,this.depth,H.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(H.empty,!0);t.childCount&&(this.placed=Hs(this.placed,this.frontier.length,t))}}function Vs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Vs(n.firstChild.content,e-1,t)))}function Hs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Hs(n.lastChild.content,e-1,t)))}function Oc(n,e){for(let t=0;t1&&(r=r.replaceChild(0,eb(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(H.empty,!0)))),n.copy(r)}function $c(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Wv(t,s.content,o)?l:null}function Wv(n,e,t){for(let r=t;r0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(d)>-1?l=d:i.before(d)==h&&o.splice(1,0,-d)}let a=o.indexOf(l),c=[],u=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(c.push(p),h==r.openStart)break;d=p.content}for(let d=u-1;d>=0;d--){let h=c[d],p=Kv(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>f));d--){let h=o[d];h<0||(e=i.before(h),t=s.after(h))}}function tb(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(H.empty,!0))}return n}function Jv(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Uv(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new G(H.from(r),0,0))}function Gv(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=nb(r,i);for(let o=0;o0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function nb(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Yi extends zt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return lt.fromReplace(e,this.pos,this.pos+1,new G(H.from(i),0,t.isLeaf?0:1))}getMap(){return rn.empty}invert(e){return new Yi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Yi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yi(t.pos,t.attr,t.value)}}zt.jsonID("attr",Yi);class co extends zt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return lt.ok(r)}getMap(){return rn.empty}invert(e){return new co(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new co(t.attr,t.value)}}zt.jsonID("docAttr",co);let ls=class extends Error{};ls=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};ls.prototype=Object.create(Error.prototype);ls.prototype.constructor=ls;ls.prototype.name="TransformError";class rb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ji}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ls(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=G.empty){let i=Ga(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new G(H.from(r),0,0))}delete(e,t){return this.replace(e,t,G.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return qv(this,e,t,r),this}replaceRangeWith(e,t,r){return Jv(this,e,t,r),this}deleteRange(e,t){return Gv(this,e,t),this}lift(e,t){return Dv(this,e,t),this}join(e,t=1){return Hv(this,e,t),this}wrap(e,t){return Rv(this,e,t),this}setBlockType(e,t=e,r,i=null){return Pv(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return zv(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Yi(e,t,r)),this}setDocAttribute(e,t){return this.step(new co(e,t)),this}addNodeMark(e,t){return this.step(new xr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof je)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new ss(e,t)),this}split(e,t=1,r){return Vv(this,e,t,r),this}addMark(e,t,r){return Ov(this,e,t,r),this}removeMark(e,t,r){return $v(this,e,t,r),this}clearIncompatible(e,t,r){return Yg(this,e,t,r),this}}const Nc=Object.create(null);class Ae{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Yv(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;s--){let o=t<0?Hi(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Hi(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new An(e.node(0))}static atStart(e){return Hi(e,e,0,0,1)||new An(e)}static atEnd(e){return Hi(e,e,e.content.size,e.childCount,-1)||new An(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Nc[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Nc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Nc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ve.between(this.$anchor,this.$head).getBookmark()}}Ae.prototype.visible=!0;class Yv{constructor(e,t){this.$from=e,this.$to=t}}let gh=!1;function bh(n){!gh&&!n.parent.inlineContent&&(gh=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ve extends Ae{constructor(e,t=e){bh(e),bh(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Ae.near(r);let i=e.resolve(t.map(this.anchor));return new ve(i.parent.inlineContent?i:r,r)}replace(e,t=G.empty){if(super.replace(e,t),t==G.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ve&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ya(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ve(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=Ae.findFrom(t,r,!0)||Ae.findFrom(t,-r,!0);if(s)t=s.$head;else return Ae.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(Ae.findFrom(e,-r,!0)||Ae.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&de.isSelectable(l))return de.create(n,t-(i<0?l.nodeSize:0))}else{let a=Hi(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function yh(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(Ae.near(n.doc.resolve(o),t))}const vh=1,Xo=2,wh=4;let Qv=class extends rb{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xo,this}ensureMarks(e){return je.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Xo)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Xo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||je.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(Ae.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wh,this}get scrolledIntoView(){return(this.updated&wh)>0}};function kh(n,e){return!e||!n?n:n.bind(e)}class Us{constructor(e,t,r){this.name=e,this.init=kh(t.init,r),this.apply=kh(t.apply,r)}}const Zv=[new Us("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Us("selection",{init(n,e){return n.selection||Ae.atStart(e.doc)},apply(n){return n.selection}}),new Us("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Us("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Dc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Zv.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Us(r.key,r.spec.state,r))})}}class Ki{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Dc(e.schema,e.plugins),s=new Ki(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=fi.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=Ae.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function ib(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ib(i,e,{})),t[r]=i}return t}class ut{constructor(e){this.spec=e,this.props={},e.props&&ib(e.props,this,this.props),this.key=e.key?e.key.key:sb("plugin")}getState(e){return e[this.key]}}const xc=Object.create(null);function sb(n){return n in xc?n+"$"+ ++xc[n]:(xc[n]=0,n+"$")}class Vt{constructor(e="key"){this.key=sb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const $t=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},uo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Tu=null;const lr=function(n,e,t){let r=Tu||(Tu=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},ew=function(){Tu=null},vi=function(n,e,t,r){return t&&(Sh(n,e,t,r,-1)||Sh(n,e,t,r,1))},tw=/^(img|br|input|textarea|hr)$/i;function Sh(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Wn(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Bo(n)||tw.test(n.nodeName)||n.contentEditable=="false")return!1;e=$t(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Wn(n):0}else return!1}}function Wn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function nw(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Wn(n)}else if(n.parentNode&&!Bo(n))e=$t(n),n=n.parentNode;else return null}}function rw(n,e){for(;;){if(n.nodeType==3&&e2),fn=as||(Gn?/Mac/.test(Gn.platform):!1),lw=Gn?/Win/.test(Gn.platform):!1,Sn=/Android \d/.test(Kr),Fo=!!Ch&&"webkitFontSmoothing"in Ch.documentElement.style,aw=Fo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cw(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function rr(n,e){return typeof n=="number"?n:n[e]}function uw(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function _h(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=uo(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?cw(s):uw(l),u=0,f=0;if(e.topc.bottom-rr(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+rr(i,"top")-c.top:e.bottom-c.bottom+rr(i,"bottom")),e.leftc.right-rr(r,"right")&&(u=e.right-c.right+rr(i,"right")),u||f)if(a)s.defaultView.scrollBy(u,f);else{let d=l.scrollLeft,h=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let p=l.scrollLeft-d,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function fw(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:ab(n.dom)}}function ab(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=uo(r));return e}function dw({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;cb(t,r==0?0:r-e)}function cb(n,e){for(let t=0;t=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?pw(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:ub(t,i)}function pw(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Lf(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function mw(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function bw(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right-1?i:n.docView.posFromDOM(e,t,-1)}function fb(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;Fo&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=bw(n,r,i,e))}l==null&&(l=gw(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ah(n){return n.top=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,xs(Cr(lr(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Wn(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ic(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==Wn(r))){let a=r.childNodes[i-1],c=a.nodeType==3?lr(a,Wn(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return xs(Cr(c,1),!1)}if(s==null&&i=0)}function xs(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ic(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function hb(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function ww(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return hb(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=db(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=lr(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const kw=/[\u0590-\u08ac]/;function Sw(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return!kw.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:hb(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,f),a&&(a!=u||c!=f)&&l.extend&&l.extend(a,c)}catch{}return d!=null&&(l.caretBidiLevel=d),g})}let Th=null,Eh=null,Mh=!1;function Cw(n,e,t){return Th==e&&Eh==t?Mh:(Th=e,Eh=t,Mh=t=="up"||t=="down"?ww(n,e,t):Sw(n,e,t))}const pn=0,Oh=1,ii=2,Yn=3;class zo{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=pn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t$t(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof mb){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof pb&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?$t(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let f=l;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=$t(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;uh&&ot){let h=l;l=a,a=h}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?ii:Oh,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Yn:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ii:Yn}r=o}this.dirty=ii}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ii:Oh;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==pn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class _w extends zo{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class wi extends zo{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=Oi.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new wi(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Yn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=pn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=Du(s,0,e,r));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,f=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Oi.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let d=u;return u=yb(u,r,t),c?a=new Aw(e,t,r,i,u,f||null,d,c,s,o+1):t.isText?new Qa(e,t,r,i,u,d,s):new Br(e,t,r,i,u,f||null,d,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>H.empty)}return e}matchesNode(e,t,r){return this.dirty==pn&&e.eq(this.node)&&Nu(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Ew(this,o&&o.node,e);$w(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,f,d)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,f,d)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,u,f,h,e)||a.updateNextNode(c,u,f,e,d,i)||a.addNode(c,u,f,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ii)&&(o&&this.protectLocalComposition(e,o),gb(this.contentDOM,this.children,e),as&&Nw(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ve)||rt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=Dw(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new _w(this,s,t,i);e.input.compositionNodes.push(o),this.children=Du(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Yn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=pn}updateOuterDeco(e){if(Nu(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=bb(this.dom,this.nodeDOM,$u(this.outerDeco,this.node,t),$u(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function $h(n,e,t,r,i){yb(r,e,n);let s=new Br(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Qa extends Br{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Yn||this.dirty!=pn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=pn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=pn,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new Qa(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Yn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class mb extends zo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==pn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Aw extends Br{constructor(e,t,r,i,s,o,l,a,c,u){super(e,t,r,i,s,o,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==Yn)return!1;if(this.spec.update){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function gb(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=wi.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof wi)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function Ow(n,e){return n.type.side-e.type.side}function $w(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let g=p;o!g.inline):l.slice();r(d,m,e.forChild(s,d),h),s=p}}function Nw(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Dw(n,e,t,r){for(let i=0,s=0;i=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Du(n,e,t,r,i){let s=[];for(let o=0,l=0;o=t||u<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,r)))}return s}function Bf(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Xa(t)){for(a=l;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&de.isSelectable(u)&&i.parent&&!(u.isInline&&iw(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new de(o==f?l:r.resolve(f))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;a=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!vb(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Iw(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,$t(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Xt&&Lr<=11&&(r.disabled=!0,r.disabled=!1)}function wb(n,e){if(e instanceof de){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Rh(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Rh(n)}function Rh(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ff(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ve.between(e,t,r)}function Ph(n){return n.editable&&!n.hasFocus()?!1:kb(n)}function kb(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Rw(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return vi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function xu(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ae.findFrom(s,e)}function Tr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Lh(n,e,t){let r=n.state.selection;if(r instanceof ve)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Tr(n,new ve(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=xu(n.state,e);return i&&i instanceof de?Tr(n,i):!1}else if(!(fn&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?de.isSelectable(s)?Tr(n,new de(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Fo?Tr(n,new ve(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof de&&r.node.isInline)return Tr(n,new ve(e>0?r.$to:r.$from));{let i=xu(n.state,e);return i?Tr(n,i):!1}}}function Hl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gs(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Fi(n,e){return e<0?Pw(n):Lw(n)}function Pw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Nn&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Gs(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Sb(t))break;{let l=t.previousSibling;for(;l&&Gs(l,-1);)i=t.parentNode,s=$t(l),l=l.previousSibling;if(l)t=l,r=Hl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Iu(n,t,r):i&&Iu(n,i,s)}function Lw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Hl(t),s,o;for(;;)if(r{n.state==i&&cr(n)},50)}function Bh(n,e){let t=n.state.doc.resolve(e);if(!(Ft||lw)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Fh(n,e,t){let r=n.state.selection;if(r instanceof ve&&!r.empty||t.indexOf("s")>-1||fn&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=xu(n.state,e);if(o&&o instanceof de)return Tr(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof An?Ae.near(o,e):Ae.findFrom(o,e);return l?Tr(n,l):!1}return!1}function zh(n,e){if(!(n.state.selection instanceof ve))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Vh(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function zw(n){if(!Ut||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Vh(n,r,"true"),setTimeout(()=>Vh(n,r,"false"),20)}return!1}function Vw(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Hw(n,e){let t=e.keyCode,r=Vw(e);if(t==8||fn&&t==72&&r=="c")return zh(n,-1)||Fi(n,-1);if(t==46&&!e.shiftKey||fn&&t==68&&r=="c")return zh(n,1)||Fi(n,1);if(t==13||t==27)return!0;if(t==37||fn&&t==66&&r=="c"){let i=t==37?Bh(n,n.state.selection.from)=="ltr"?-1:1:-1;return Lh(n,i,r)||Fi(n,i)}else if(t==39||fn&&t==70&&r=="c"){let i=t==39?Bh(n,n.state.selection.from)=="ltr"?1:-1:1;return Lh(n,i,r)||Fi(n,i)}else{if(t==38||fn&&t==80&&r=="c")return Fh(n,-1,r)||Fi(n,-1);if(t==40||fn&&t==78&&r=="c")return zw(n)||Fh(n,1,r)||Fi(n,1);if(r==(fn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Cb(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||Oi.fromSchema(n.state.schema),l=Ob(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=Mb[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let d=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` +`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=We.none,r=We.none;if(e.length)for(let i=0;i{a.clearMark(c)&&(r=c.addToSet(r))}):t=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(t),a.consuming===!1)l=a;else break}}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;ithis.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=_v(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function kv(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Sv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function fh(n){let e={};for(let t in n)e[t]=n[t];return e}function Cv(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&gl(Ec(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return gl(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Oi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=dh(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return dh(e.marks)}}function dh(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ec(n){return n.document||window.document}const hh=new WeakMap;function Av(n){let e=hh.get(n);return e===void 0&&hh.set(n,e=Tv(n)),e}function Tv(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let d=f.indexOf(" ");d>0?a.setAttributeNS(f.slice(0,d),f.slice(d+1),c[f]):a.setAttribute(f,c[f])}}for(let f=u;fu)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=gl(n,d,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Wg=65535,Kg=Math.pow(2,16);function Ev(n,e){return n+e*Kg}function ph(n){return n&Wg}function Mv(n){return(n-(n&Wg))/Kg}const qg=1,Jg=2,bl=4,Gg=8;class _u{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Gg)>0}get deletedBefore(){return(this.delInfo&(qg|bl))>0}get deletedAfter(){return(this.delInfo&(Jg|bl))>0}get deletedAcross(){return(this.delInfo&bl)>0}}class rn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&rn.empty)return rn.empty}recover(e){let t=0,r=ph(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],u=this.ranges[l+o],f=a+c;if(e<=f){let d=c?e==a?-1:e==f?1:t:t,h=a+i+(d<0?0:u);if(r)return h;let p=e==(t<0?a:f)?null:Ev(l/3,e-a),m=e==a?Jg:e==f?qg:bl;return(t<0?e!=a:e!=f)&&(m|=Gg),new _u(h,m,p)}i+=u-c}return r?e+i:new _u(e+i,0,null)}touches(e,t){let r=0,i=ph(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Ji;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,s)}invert(){return new Kn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Dr(t.pos,r.pos,this.mark)}merge(e){return e instanceof Dr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Dr(t.from,t.to,e.markFromJSON(t.mark))}}zt.jsonID("addMark",Dr);class Kn extends zt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new G(If(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return lt.fromReplace(e,this.from,this.to,r)}invert(){return new Dr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Kn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Kn(t.from,t.to,e.markFromJSON(t.mark))}}zt.jsonID("removeMark",Kn);class xr extends zt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return lt.fromReplace(e,this.pos,this.pos+1,new G(H.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new vt(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new vt(t.from,t.to,t.gapFrom,t.gapTo,G.fromJSON(e,t.slice),t.insert,!!t.structure)}}zt.jsonID("replaceAround",vt);function Au(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Ov(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let d=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(f);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function $v(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof qa){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;un.step(new Kn(o.from,o.to,o.style)))}function Yg(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a=0;a--)n.step(o[a])}function Nv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Cs(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,u=H.from(r.node(p).copy(u)),f++):a--;let d=H.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=H.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new vt(i,s,i,s,new G(r,0,0),t.length,!0))}function Pv(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&Fv(n.doc,n.mapping.slice(s).map(l),r)){let a=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!h?a=!1:!d&&h&&(a=!0)}a===!1&&Bv(n,o,l,s),Yg(n,n.mapping.slice(s).map(l,1),r,void 0,a===null);let c=n.mapping.slice(s),u=c.map(l,1),f=c.map(l+o.nodeSize,1);return n.step(new vt(u,f,u+1,f-1,new G(H.from(r.create(i,null,o.marks)),0,0),1,!0)),a===!0&&Lv(n,o,l,s),!1}})}function Lv(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Bv(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function Fv(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function zv(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new vt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new G(H.from(o),0,0),1,!0))}function Gi(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Vv(n,e,t=1,r){let i=n.doc.resolve(e),s=H.empty,o=H.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=H.from(i.node(l).copy(s));let u=r&&r[c];o=H.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new yt(e,e,new G(s.append(o),t,t),!0))}function Wr(n,e){let t=n.resolve(e),r=t.index();return Xg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Xg(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Ja(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Xg(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Hv(n,e,t){let r=new yt(e-t,e+t,G.empty,!0);n.step(r)}function Uv(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let f=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Ga(n,e,t=e,r=G.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Zg(i,s,r)?new yt(e,t,r):new jv(i,s,r).fit()}function Zg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class jv{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=H.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=H.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new G(s,o,l);return e>-1?new vt(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new yt(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Oc(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,f=null;if(t==1&&(o?c.matchType(o.type)||(f=c.fillBefore(H.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Oc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new G(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Oc(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new G(Vs(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new G(Vs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(f=g,u.push(eb(m.mark(d.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Hs(this.placed,t,H.from(u)),this.frontier[t].match=f,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],u=$c(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Hs(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Hs(this.placed,this.depth,H.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(H.empty,!0);t.childCount&&(this.placed=Hs(this.placed,this.frontier.length,t))}}function Vs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Vs(n.firstChild.content,e-1,t)))}function Hs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Hs(n.lastChild.content,e-1,t)))}function Oc(n,e){for(let t=0;t1&&(r=r.replaceChild(0,eb(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(H.empty,!0)))),n.copy(r)}function $c(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Wv(t,s.content,o)?l:null}function Wv(n,e,t){for(let r=t;r0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(d)>-1?l=d:i.before(d)==h&&o.splice(1,0,-d)}let a=o.indexOf(l),c=[],u=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(c.push(p),h==r.openStart)break;d=p.content}for(let d=u-1;d>=0;d--){let h=c[d],p=Kv(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>f));d--){let h=o[d];h<0||(e=i.before(h),t=s.after(h))}}function tb(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(H.empty,!0))}return n}function Jv(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Uv(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new G(H.from(r),0,0))}function Gv(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=nb(r,i);for(let o=0;o0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function nb(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Yi extends zt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return lt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return lt.fromReplace(e,this.pos,this.pos+1,new G(H.from(i),0,t.isLeaf?0:1))}getMap(){return rn.empty}invert(e){return new Yi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Yi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yi(t.pos,t.attr,t.value)}}zt.jsonID("attr",Yi);class co extends zt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return lt.ok(r)}getMap(){return rn.empty}invert(e){return new co(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new co(t.attr,t.value)}}zt.jsonID("docAttr",co);let ls=class extends Error{};ls=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};ls.prototype=Object.create(Error.prototype);ls.prototype.constructor=ls;ls.prototype.name="TransformError";class rb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ji}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ls(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=G.empty){let i=Ga(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new G(H.from(r),0,0))}delete(e,t){return this.replace(e,t,G.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return qv(this,e,t,r),this}replaceRangeWith(e,t,r){return Jv(this,e,t,r),this}deleteRange(e,t){return Gv(this,e,t),this}lift(e,t){return Dv(this,e,t),this}join(e,t=1){return Hv(this,e,t),this}wrap(e,t){return Rv(this,e,t),this}setBlockType(e,t=e,r,i=null){return Pv(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return zv(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Yi(e,t,r)),this}setDocAttribute(e,t){return this.step(new co(e,t)),this}addNodeMark(e,t){return this.step(new xr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof We)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new ss(e,t)),this}split(e,t=1,r){return Vv(this,e,t,r),this}addMark(e,t,r){return Ov(this,e,t,r),this}removeMark(e,t,r){return $v(this,e,t,r),this}clearIncompatible(e,t,r){return Yg(this,e,t,r),this}}const Nc=Object.create(null);class Ae{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Yv(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;s--){let o=t<0?Hi(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Hi(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new An(e.node(0))}static atStart(e){return Hi(e,e,0,0,1)||new An(e)}static atEnd(e){return Hi(e,e,e.content.size,e.childCount,-1)||new An(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Nc[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Nc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Nc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ve.between(this.$anchor,this.$head).getBookmark()}}Ae.prototype.visible=!0;class Yv{constructor(e,t){this.$from=e,this.$to=t}}let gh=!1;function bh(n){!gh&&!n.parent.inlineContent&&(gh=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ve extends Ae{constructor(e,t=e){bh(e),bh(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Ae.near(r);let i=e.resolve(t.map(this.anchor));return new ve(i.parent.inlineContent?i:r,r)}replace(e,t=G.empty){if(super.replace(e,t),t==G.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ve&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ya(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ve(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=Ae.findFrom(t,r,!0)||Ae.findFrom(t,-r,!0);if(s)t=s.$head;else return Ae.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(Ae.findFrom(e,-r,!0)||Ae.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&de.isSelectable(l))return de.create(n,t-(i<0?l.nodeSize:0))}else{let a=Hi(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function yh(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(Ae.near(n.doc.resolve(o),t))}const vh=1,Xo=2,wh=4;let Qv=class extends rb{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xo,this}ensureMarks(e){return We.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Xo)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Xo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||We.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(Ae.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wh,this}get scrolledIntoView(){return(this.updated&wh)>0}};function kh(n,e){return!e||!n?n:n.bind(e)}class Us{constructor(e,t,r){this.name=e,this.init=kh(t.init,r),this.apply=kh(t.apply,r)}}const Zv=[new Us("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Us("selection",{init(n,e){return n.selection||Ae.atStart(e.doc)},apply(n){return n.selection}}),new Us("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Us("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Dc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Zv.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Us(r.key,r.spec.state,r))})}}class Ki{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Dc(e.schema,e.plugins),s=new Ki(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=fi.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=Ae.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function ib(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ib(i,e,{})),t[r]=i}return t}class ut{constructor(e){this.spec=e,this.props={},e.props&&ib(e.props,this,this.props),this.key=e.key?e.key.key:sb("plugin")}getState(e){return e[this.key]}}const xc=Object.create(null);function sb(n){return n in xc?n+"$"+ ++xc[n]:(xc[n]=0,n+"$")}class Vt{constructor(e="key"){this.key=sb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const $t=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},uo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Tu=null;const lr=function(n,e,t){let r=Tu||(Tu=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},ew=function(){Tu=null},vi=function(n,e,t,r){return t&&(Sh(n,e,t,r,-1)||Sh(n,e,t,r,1))},tw=/^(img|br|input|textarea|hr)$/i;function Sh(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Wn(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Bo(n)||tw.test(n.nodeName)||n.contentEditable=="false")return!1;e=$t(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Wn(n):0}else return!1}}function Wn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function nw(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Wn(n)}else if(n.parentNode&&!Bo(n))e=$t(n),n=n.parentNode;else return null}}function rw(n,e){for(;;){if(n.nodeType==3&&e2),fn=as||(Gn?/Mac/.test(Gn.platform):!1),lw=Gn?/Win/.test(Gn.platform):!1,Sn=/Android \d/.test(Kr),Fo=!!Ch&&"webkitFontSmoothing"in Ch.documentElement.style,aw=Fo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cw(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function rr(n,e){return typeof n=="number"?n:n[e]}function uw(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function _h(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=uo(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?cw(s):uw(l),u=0,f=0;if(e.topc.bottom-rr(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+rr(i,"top")-c.top:e.bottom-c.bottom+rr(i,"bottom")),e.leftc.right-rr(r,"right")&&(u=e.right-c.right+rr(i,"right")),u||f)if(a)s.defaultView.scrollBy(u,f);else{let d=l.scrollLeft,h=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let p=l.scrollLeft-d,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function fw(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:ab(n.dom)}}function ab(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=uo(r));return e}function dw({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;cb(t,r==0?0:r-e)}function cb(n,e){for(let t=0;t=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?pw(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:ub(t,i)}function pw(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Lf(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function mw(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function bw(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right-1?i:n.docView.posFromDOM(e,t,-1)}function fb(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;Fo&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=bw(n,r,i,e))}l==null&&(l=gw(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ah(n){return n.top=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,xs(Cr(lr(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Wn(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ic(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==Wn(r))){let a=r.childNodes[i-1],c=a.nodeType==3?lr(a,Wn(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return xs(Cr(c,1),!1)}if(s==null&&i=0)}function xs(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ic(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function hb(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function ww(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return hb(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=db(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=lr(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const kw=/[\u0590-\u08ac]/;function Sw(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return!kw.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:hb(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,f),a&&(a!=u||c!=f)&&l.extend&&l.extend(a,c)}catch{}return d!=null&&(l.caretBidiLevel=d),g})}let Th=null,Eh=null,Mh=!1;function Cw(n,e,t){return Th==e&&Eh==t?Mh:(Th=e,Eh=t,Mh=t=="up"||t=="down"?ww(n,e,t):Sw(n,e,t))}const pn=0,Oh=1,ii=2,Yn=3;class zo{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=pn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t$t(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof mb){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof pb&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?$t(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let f=l;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=$t(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;uh&&ot){let h=l;l=a,a=h}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?ii:Oh,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Yn:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ii:Yn}r=o}this.dirty=ii}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ii:Oh;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==pn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class _w extends zo{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class wi extends zo{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=Oi.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new wi(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Yn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=pn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=Du(s,0,e,r));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,f=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Oi.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let d=u;return u=yb(u,r,t),c?a=new Aw(e,t,r,i,u,f||null,d,c,s,o+1):t.isText?new Qa(e,t,r,i,u,d,s):new Br(e,t,r,i,u,f||null,d,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>H.empty)}return e}matchesNode(e,t,r){return this.dirty==pn&&e.eq(this.node)&&Nu(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Ew(this,o&&o.node,e);$w(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?We.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,f,d)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,f,d)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,u,f,h,e)||a.updateNextNode(c,u,f,e,d,i)||a.addNode(c,u,f,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ii)&&(o&&this.protectLocalComposition(e,o),gb(this.contentDOM,this.children,e),as&&Nw(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ve)||rt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=Dw(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new _w(this,s,t,i);e.input.compositionNodes.push(o),this.children=Du(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Yn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=pn}updateOuterDeco(e){if(Nu(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=bb(this.dom,this.nodeDOM,$u(this.outerDeco,this.node,t),$u(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function $h(n,e,t,r,i){yb(r,e,n);let s=new Br(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Qa extends Br{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Yn||this.dirty!=pn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=pn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=pn,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new Qa(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Yn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class mb extends zo{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==pn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Aw extends Br{constructor(e,t,r,i,s,o,l,a,c,u){super(e,t,r,i,s,o,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==Yn)return!1;if(this.spec.update){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function gb(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=wi.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof wi)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function Ow(n,e){return n.type.side-e.type.side}function $w(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let g=p;o!g.inline):l.slice();r(d,m,e.forChild(s,d),h),s=p}}function Nw(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Dw(n,e,t,r){for(let i=0,s=0;i=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Du(n,e,t,r,i){let s=[];for(let o=0,l=0;o=t||u<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,r)))}return s}function Bf(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Xa(t)){for(a=l;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&de.isSelectable(u)&&i.parent&&!(u.isInline&&iw(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new de(o==f?l:r.resolve(f))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;a=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!vb(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Iw(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,$t(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Xt&&Lr<=11&&(r.disabled=!0,r.disabled=!1)}function wb(n,e){if(e instanceof de){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Rh(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Rh(n)}function Rh(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ff(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ve.between(e,t,r)}function Ph(n){return n.editable&&!n.hasFocus()?!1:kb(n)}function kb(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Rw(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return vi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function xu(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Ae.findFrom(s,e)}function Tr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Lh(n,e,t){let r=n.state.selection;if(r instanceof ve)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Tr(n,new ve(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=xu(n.state,e);return i&&i instanceof de?Tr(n,i):!1}else if(!(fn&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?de.isSelectable(s)?Tr(n,new de(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Fo?Tr(n,new ve(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof de&&r.node.isInline)return Tr(n,new ve(e>0?r.$to:r.$from));{let i=xu(n.state,e);return i?Tr(n,i):!1}}}function Hl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gs(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Fi(n,e){return e<0?Pw(n):Lw(n)}function Pw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Nn&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Gs(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Sb(t))break;{let l=t.previousSibling;for(;l&&Gs(l,-1);)i=t.parentNode,s=$t(l),l=l.previousSibling;if(l)t=l,r=Hl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Iu(n,t,r):i&&Iu(n,i,s)}function Lw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Hl(t),s,o;for(;;)if(r{n.state==i&&cr(n)},50)}function Bh(n,e){let t=n.state.doc.resolve(e);if(!(Ft||lw)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Fh(n,e,t){let r=n.state.selection;if(r instanceof ve&&!r.empty||t.indexOf("s")>-1||fn&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=xu(n.state,e);if(o&&o instanceof de)return Tr(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof An?Ae.near(o,e):Ae.findFrom(o,e);return l?Tr(n,l):!1}return!1}function zh(n,e){if(!(n.state.selection instanceof ve))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Vh(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function zw(n){if(!Ut||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Vh(n,r,"true"),setTimeout(()=>Vh(n,r,"false"),20)}return!1}function Vw(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Hw(n,e){let t=e.keyCode,r=Vw(e);if(t==8||fn&&t==72&&r=="c")return zh(n,-1)||Fi(n,-1);if(t==46&&!e.shiftKey||fn&&t==68&&r=="c")return zh(n,1)||Fi(n,1);if(t==13||t==27)return!0;if(t==37||fn&&t==66&&r=="c"){let i=t==37?Bh(n,n.state.selection.from)=="ltr"?-1:1:-1;return Lh(n,i,r)||Fi(n,i)}else if(t==39||fn&&t==70&&r=="c"){let i=t==39?Bh(n,n.state.selection.from)=="ltr"?1:-1:1;return Lh(n,i,r)||Fi(n,i)}else{if(t==38||fn&&t==80&&r=="c")return Fh(n,-1,r)||Fi(n,-1);if(t==40||fn&&t==78&&r=="c")return zw(n)||Fh(n,1,r)||Fi(n,1);if(r==(fn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Cb(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||Oi.fromSchema(n.state.schema),l=Ob(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=Mb[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let d=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` `);return{dom:a,text:d,slice:e}}function _b(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",d=>{e=d(e,s||r,n)}),s)return e?new G(H.from(n.state.schema.text(e.replace(/\r\n?/g,` `))),0,0):G.empty;let f=n.someProp("clipboardTextParser",d=>d(e,i,r,n));if(f)l=f;else{let d=i.marks(),{schema:h}=n.state,p=Oi.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),o=Ww(t),Fo&&Kw(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||xf.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!Uw.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)l=qw(Hh(l,+u[1],+u[2]),u[4]);else if(l=G.maxOpen(jw(l.content,i),!0),l.openStart||l.openEnd){let f=0,d=0;for(let h=l.content.firstChild;f{l=f(l,n)}),l}const Uw=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function jw(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Tb(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Eb(o[o.length-1],s.length));let u=Ab(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return H.from(o)}return n}function Ab(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,H.from(n));return n}function Tb(n,e,t,r,i){if(i1&&(s=0),i=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(H.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function Hh(n,e,t){return e]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ob().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Mb[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=n,i)for(let s=0;s=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=H.from(a.create(r[l+1],i)),s++,o++}return new G(i,s,o)}const jt={},Wt={},Jw={touchstart:!0,touchmove:!0};class Gw{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Yw(n){for(let e in jt){let t=jt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Qw(n,r)&&!zf(n,r)&&(n.editable||!(r.type in Wt))&&t(n,r)},Jw[e]?{passive:!0}:void 0)}Ut&&n.dom.addEventListener("input",()=>null),Pu(n)}function Ir(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Xw(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Pu(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>zf(n,r))})}function zf(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Qw(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Zw(n,e){!zf(n,e)&&jt[e.type]&&(n.editable||!(e.type in Wt))&&jt[e.type](n,e)}Wt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Nb(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Sn&&Ft&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),as&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,ei(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Hw(n,t)?t.preventDefault():Ir(n,"key")};Wt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Wt.keypress=(n,e)=>{let t=e;if(Nb(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||fn&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ve)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Za(n){return{left:n.clientX,top:n.clientY}}function ek(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Vf(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Xi(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function tk(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&de.isSelectable(r)?(Xi(n,new de(t),"pointer"),!0):!1}function nk(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof de&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(de.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Xi(n,de.create(n.state.doc,i),"pointer"),!0):!1}function rk(n,e,t,r,i){return Vf(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?nk(n,t):tk(n,t))}function ik(n,e,t,r){return Vf(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function sk(n,e,t,r){return Vf(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||ok(n,t,r)}function ok(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Xi(n,ve.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)Xi(n,ve.create(r,l+1,l+1+o.content.size),"pointer");else if(de.isSelectable(o))Xi(n,de.create(r,l),"pointer");else continue;return!0}}function Hf(n){return Ul(n)}const $b=fn?"metaKey":"ctrlKey";jt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Hf(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&ek(t,n.input.lastClick)&&!t[$b]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(Za(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new lk(n,o,t,!!r)):(s=="doubleClick"?ik:sk)(n,o.pos,o.inside,t)?t.preventDefault():Ir(n,"pointer"))};class lk{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[$b],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof de&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Nn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ir(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>cr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Za(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ir(this.view,"pointer"):rk(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ut&&this.mightDrag&&!this.mightDrag.node.isAtom||Ft&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Xi(this.view,Ae.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Ir(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ir(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}jt.touchstart=n=>{n.input.lastTouch=Date.now(),Hf(n),Ir(n,"pointer")};jt.touchmove=n=>{n.input.lastTouch=Date.now(),Ir(n,"pointer")};jt.contextmenu=n=>Hf(n);function Nb(n,e){return n.composing?!0:Ut&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ak=Sn?5e3:-1;Wt.compositionstart=Wt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ul(n,!0),n.markCursor=null;else if(Ul(n),Nn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){n.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}Db(n,ak)};Wt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Db(n,20))};function Db(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ul(n),e))}function xb(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=uk());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function ck(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=nw(e.focusNode,e.focusOffset),r=rw(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function uk(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ul(n,e=!1){if(!(Sn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),xb(n),e||n.docView&&n.docView.dirty){let t=Bf(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function fk(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const fo=Xt&&Lr<15||as&&aw<604;jt.copy=Wt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=fo?null:t.clipboardData,o=r.content(),{dom:l,text:a}=Cb(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):fk(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function dk(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function hk(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ho(n,r.value,null,i,e):ho(n,r.textContent,r.innerHTML,i,e)},50)}function ho(n,e,t,r,i){let s=_b(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||G.empty)))return!0;if(!s)return!1;let o=dk(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ib(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Wt.paste=(n,e)=>{let t=e;if(n.composing&&!Sn)return;let r=fo?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ho(n,Ib(r),r.getData("text/html"),i,t)?t.preventDefault():hk(n,t)};class Rb{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Pb=fn?"altKey":"ctrlKey";jt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Za(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof de?i.to-1:i.to))){if(r&&r.mightDrag)o=de.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(o=de.create(n.state.doc,f.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=Cb(n,l);(!t.dataTransfer.files.length||!Ft||lb>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(fo?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",fo||t.dataTransfer.setData("text/plain",c),n.dragging=new Rb(u,!t[Pb],o)};jt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Wt.dragover=Wt.dragenter=(n,e)=>e.preventDefault();Wt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Za(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=_b(n,Ib(t.dataTransfer),fo?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&!t[Pb]);if(n.someProp("handleDrop",p=>p(n,t,o||G.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?Qg(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=c.doc;if(f?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(d))return;let h=c.doc.resolve(u);if(f&&de.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new de(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,_)=>p=_),c.setSelection(Ff(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};jt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&cr(n)},20))};jt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};jt.beforeinput=(n,e)=>{if(Ft&&Sn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,ei(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Wt)jt[n]=Wt[n];function po(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class jl{constructor(e,t){this.toDOM=e,this.spec=t||di,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new sn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof jl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&po(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Fr{constructor(e,t){this.attrs=e,this.spec=t||di}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new sn(s,o,this)}valid(e,t){return t.from=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;oe){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==Bt||e.maps.length==0?this:this.mapInner(e,t,0,0,r||di)}mapInner(e,t,r,i,s){let o;for(let l=0;l{let c=a+r,u;if(u=Bb(t,l,c)){for(i||(i=this.children.slice());sl&&f.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;ls&&a.type instanceof Fr){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;ci.map(e,t,di));return Or.from(r)}forChild(e,t){if(t.isLeaf)return ot.empty;let r=[];for(let i=0;it instanceof ot)?e:e.reduce((t,r)=>t.concat(r instanceof ot?r:r.members),[]))}}}function pk(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,u=s;c{let g=m-p-(h-d);for(let b=0;b_+u-f)continue;let E=l[b]+u-f;h>=E?l[b+1]=d<=E?-2:-1:d>=u&&g&&(l[b]+=g,l[b+1]+=g)}f+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let d=t.map(n[c+1]+s,-1),h=d-i,{index:p,offset:m}=r.content.findIndex(f),g=r.maybeChild(p);if(g&&m==f&&m+g.nodeSize==h){let b=l[c+2].mapInner(t,g,u+1,n[c]+s+1,o);b!=Bt?(l[c]=f,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=mk(l,n,e,t,i,s,o),u=Wl(c,r,0,o);e=u.local;for(let f=0;ft&&o.to{let c=Bb(n,l,a+t);if(c){s=!0;let u=Wl(c,l,t+a+1,r);u!=Bt&&i.push(a,a+l.nodeSize,u)}});let o=Lb(s?Fb(n):n,-t).sort(hi);for(let l=0;l0;)e++;n.splice(e,0,t)}function Pc(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Bt&&e.push(r)}),n.cursorWrapper&&e.push(ot.create(n.state.doc,[n.cursorWrapper.deco])),Or.from(e)}const gk={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bk=Xt&&Lr<=11;class yk{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class vk{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new yk,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),bk&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,gk)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ph(this.view)){if(this.suppressingSelectionUpdates)return cr(this.view);if(Xt&&Lr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&vi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=uo(s))t.add(s);for(let s=e.anchorNode;s;s=uo(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ph(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;uf.nodeName=="BR");if(u.length==2){let[f,d]=u;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of u){let h=d.parentNode;h&&h.nodeName=="LI"&&(!f||Sk(e,f)!=h)&&d.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),wk(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||cr(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;ui;g--){let b=r.childNodes[g-1],_=b.pmViewDesc;if(b.nodeName=="BR"&&!_){s=g;break}if(!_||_.size)break}let f=n.state.doc,d=n.someProp("domParser")||xf.fromSchema(n.state.schema),h=f.resolve(o),p=null,m=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:_k,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:l}}function _k(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ut&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Ut&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Ak=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Tk(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,Z=Bf(n,M);if(Z&&!n.state.selection.eq(Z)){if(Ft&&Sn&&n.input.lastKeyCode===13&&Date.now()-100y(n,ei(13,"Enter"))))return;let $=n.state.tr.setSelection(Z);M=="pointer"?$.setMeta("pointer",!0):M=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),n.dispatch($)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=Ck(n,e,t),u=n.state.doc,f=u.slice(c.from,c.to),d,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Sn)&&i.some(M=>M.nodeType==1&&!Ak.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,ei(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof ve&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let M=Jh(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let Z=n.state.tr.setSelection(M);s&&Z.setMeta("composition",s),n.dispatch(Z)}}return}n.input.domChangeCount++,n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Xt&&Lr<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),_=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,E;if((as&&n.input.lastIOSEnter>Date.now()-225&&(!_||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!_&&m.posM(n,ei(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&Mk(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",M=>M(n,ei(8,"Backspace")))){Sn&&Ft&&n.domObserver.suppressSelectionUpdates();return}Ft&&Sn&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),Sn&&!_&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,ei(13,"Enter"))})},20));let v=p.start,z=p.endA,C,L,F;if(_){if(m.pos==g.pos)Xt&&Lr<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>cr(n),20)),C=n.state.tr.delete(v,z),L=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(F=Ek(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))C=n.state.tr,F.type=="add"?C.addMark(v,z,F.mark):C.removeMark(v,z,F.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",Z=>Z(n,v,z,M)))return;C=n.state.tr.insertText(M,v,z)}}if(C||(C=n.state.tr.replace(v,z,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let M=Jh(n,C.doc,c.sel);M&&!(Ft&&Sn&&n.composing&&M.empty&&(p.start!=p.endB||n.input.lastAndroidDeletee.content.size?null:Ff(n,e.resolve(t.anchor),e.resolve(t.head))}function Ek(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let u=0;uu.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;ut||Lc(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Ok(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o=o?s-r:0;s-=a,s&&s=l?s-r:0;s-=a,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}class $k{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Gw,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ep),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Qh(this),Xh(this),this.nodeViews=Zh(this),this.docView=$h(this.state.doc,Yh(this),Pc(this),this.dom,this),this.domObserver=new vk(this,(r,i,s,o)=>Tk(this,r,i,s,o)),this.domObserver.start(),Yw(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Pu(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ep),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(xb(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Zh(this);Dk(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Pu(this),this.editable=Qh(this),Xh(this);let a=Pc(this),c=Yh(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(o=!0);let d=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&fw(this);if(o){this.domObserver.stop();let h=f&&(Xt||Ft)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Nk(i.selection,e.selection);if(f){let p=Ft?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ck(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=$h(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Rw(this))?cr(this,h):(wb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():d&&dw(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof de){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&_h(this,t.getBoundingClientRect(),e)}else _h(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Rb(e.slice,e.move,i<0?void 0:de.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return yw(this,e)}coordsAtPos(e,t=1){return db(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Cw(this,t||this.state,e)}pasteHTML(e,t){return ho(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ho(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Xw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Pc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ew())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Zw(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return Ut&&this.root.nodeType===11&&sw(this.dom.ownerDocument)==this.dom&&kk(this,e)||e}domSelection(){return this.root.getSelection()}}function Yh(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[sn.node(0,n.state.doc.content.size,e)]}function Xh(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:sn.widget(n.state.selection.head,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Qh(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Nk(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Zh(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Dk(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function ep(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var zr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Kl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xk=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ik=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Nt=0;Nt<10;Nt++)zr[48+Nt]=zr[96+Nt]=String(Nt);for(var Nt=1;Nt<=24;Nt++)zr[Nt+111]="F"+Nt;for(var Nt=65;Nt<=90;Nt++)zr[Nt]=String.fromCharCode(Nt+32),Kl[Nt]=String.fromCharCode(Nt);for(var Bc in zr)Kl.hasOwnProperty(Bc)||(Kl[Bc]=zr[Bc]);function Rk(n){var e=xk&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ik&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Kl:zr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Pk=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Lk(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l127)&&(s=zr[r.keyCode])&&s!=i){let l=e[Fc(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const zk=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Vb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Vk=(n,e,t)=>{let r=Vb(n,t);if(!r)return!1;let i=Wf(r);if(!i){let o=r.blockRange(),l=o&&Cs(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&Wb(n,i,e))return!0;if(r.parent.content.size==0&&(cs(s,"end")||de.isSelectable(s))){let o=Ga(n.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size{let r=Vb(n,t);if(!r)return!1;let i=Wf(r);return i?Hb(n,i,e):!1},Uk=(n,e,t)=>{let r=Ub(n,t);if(!r)return!1;let i=Kf(r);return i?Hb(n,i,e):!1};function Hb(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Ga(n.doc,s,a,G.empty);if(!c||c.from!=s||c instanceof yt&&c.slice.size>=a-s)return!1;if(t){let u=n.tr.step(c);u.setSelection(ve.create(u.doc,s)),t(u.scrollIntoView())}return!0}function cs(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const jk=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Wf(r)}let o=s&&s.nodeBefore;return!o||!de.isSelectable(o)?!1:(e&&e(n.tr.setSelection(de.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Wf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ub(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=Ub(n,t);if(!r)return!1;let i=Kf(r);if(!i)return!1;let s=i.nodeAfter;if(Wb(n,i,e))return!0;if(r.parent.content.size==0&&(cs(s,"start")||de.isSelectable(s))){let o=Ga(n.doc,r.before(),r.after(),G.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof de,i;if(r){if(t.node.isTextblock||!Wr(n.doc,t.from))return!1;i=t.from}else if(i=Ja(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(de.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Jk=(n,e)=>{let t=n.selection,r;if(t instanceof de){if(t.node.isTextblock||!Wr(n.doc,t.to))return!1;r=t.to}else if(r=Ja(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Gk=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Cs(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},Yk=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` @@ -92,12 +92,12 @@ img.ProseMirror-separator { */var ly=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Gl=ly.join(","),ay=typeof Element>"u",Si=ay?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Yl=!ay&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n==null?void 0:n.ownerDocument},Xl=function n(e,t){var r;t===void 0&&(t=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",o=s||t&&e&&n(e.parentNode);return o},D_=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},cy=function(e,t,r){if(Xl(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Gl));return t&&Si.call(e,Gl)&&i.unshift(e),i=i.filter(r),i},uy=function n(e,t,r){for(var i=[],s=Array.from(e);s.length;){var o=s.shift();if(!Xl(o,!1))if(o.tagName==="SLOT"){var l=o.assignedElements(),a=l.length?l:o.children,c=n(a,!0,r);r.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{var u=Si.call(o,Gl);u&&r.filter(o)&&(t||!e.includes(o))&&i.push(o);var f=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),d=!Xl(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(f&&d){var h=n(f===!0?o.children:f.children,!0,r);r.flatten?i.push.apply(i,h):i.push({scopeParent:o,candidates:h})}else s.unshift.apply(s,o.children)}}return i},fy=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ni=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||D_(e))&&!fy(e)?0:e.tabIndex},x_=function(e,t){var r=ni(e);return r<0&&t&&!fy(e)?0:r},I_=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},dy=function(e){return e.tagName==="INPUT"},R_=function(e){return dy(e)&&e.type==="hidden"},P_=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},L_=function(e,t){for(var r=0;rsummary:first-of-type"),o=s?e.parentElement:e;if(Si.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var l=e;e;){var a=e.parentElement,c=Yl(e);if(a&&!a.shadowRoot&&i(a)===!0)return mp(e);e.assignedSlot?e=e.assignedSlot:!a&&c!==e.ownerDocument?e=c.host:e=a}e=l}if(V_(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return mp(e);return!1},U_=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r=0)},W_=function n(e){var t=[],r=[];return e.forEach(function(i,s){var o=!!i.scopeParent,l=o?i.scopeParent:i,a=x_(l,o),c=o?n(i.candidates):l;a===0?o?t.push.apply(t,c):t.push(l):r.push({documentOrder:s,tabIndex:a,item:i,isScope:o,content:c})}),r.sort(I_).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(t)},K_=function(e,t){t=t||{};var r;return t.getShadowRoot?r=uy([e],t.includeContainer,{filter:Uu.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:j_}):r=cy(e,t.includeContainer,Uu.bind(null,t)),W_(r)},q_=function(e,t){t=t||{};var r;return t.getShadowRoot?r=uy([e],t.includeContainer,{filter:Ql.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=cy(e,t.includeContainer,Ql.bind(null,t)),r},zi=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Si.call(e,Gl)===!1?!1:Uu(t,e)},J_=ly.concat("iframe").join(","),jc=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Si.call(e,J_)===!1?!1:Ql(t,e)};/*! * focus-trap 7.5.4 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE -*/function gp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bp(n){for(var e=1;e0){var r=e[e.length-1];r!==t&&r.pause()}var i=e.indexOf(t);i===-1||e.splice(i,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},Q_=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Z_=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},Ys=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},eA=function(e){return Ys(e)&&!e.shiftKey},tA=function(e){return Ys(e)&&e.shiftKey},vp=function(e){return setTimeout(e,0)},wp=function(e,t){var r=-1;return e.every(function(i,s){return t(i)?(r=s,!1):!0}),r},Is=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?O-1:0),T=1;T=0)y=r.activeElement;else{var w=o.tabbableGroups[0],O=w&&w.firstTabbableNode;y=O||u("fallbackFocus")}if(!y)throw new Error("Your focus-trap needs to have at least one focusable element");return y},d=function(){if(o.containerGroups=o.containers.map(function(y){var w=K_(y,s.tabbableOptions),O=q_(y,s.tabbableOptions),B=w.length>0?w[0]:void 0,T=w.length>0?w[w.length-1]:void 0,V=O.find(function(se){return zi(se)}),K=O.slice().reverse().find(function(se){return zi(se)}),Y=!!w.find(function(se){return ni(se)>0});return{container:y,tabbableNodes:w,focusableNodes:O,posTabIndexesFound:Y,firstTabbableNode:B,lastTabbableNode:T,firstDomTabbableNode:V,lastDomTabbableNode:K,nextTabbableNode:function(ge){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,me=w.indexOf(ge);return me<0?we?O.slice(O.indexOf(ge)+1).find(function(Ke){return zi(Ke)}):O.slice(0,O.indexOf(ge)).reverse().find(function(Ke){return zi(Ke)}):w[me+(we?1:-1)]}}}),o.tabbableGroups=o.containerGroups.filter(function(y){return y.tabbableNodes.length>0}),o.tabbableGroups.length<=0&&!u("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find(function(y){return y.posTabIndexesFound})&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function $(y){var w=y.activeElement;if(w)return w.shadowRoot&&w.shadowRoot.activeElement!==null?$(w.shadowRoot):w},p=function $(y){if(y!==!1&&y!==h(document)){if(!y||!y.focus){$(f());return}y.focus({preventScroll:!!s.preventScroll}),o.mostRecentlyFocusedNode=y,Q_(y)&&y.select()}},m=function(y){var w=u("setReturnFocus",y);return w||(w===!1?!1:y)},g=function(y){var w=y.target,O=y.event,B=y.isBackward,T=B===void 0?!1:B;w=w||tl(O),d();var V=null;if(o.tabbableGroups.length>0){var K=c(w,O),Y=K>=0?o.containerGroups[K]:void 0;if(K<0)T?V=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:V=o.tabbableGroups[0].firstTabbableNode;else if(T){var se=wp(o.tabbableGroups,function(et){var Qe=et.firstTabbableNode;return w===Qe});if(se<0&&(Y.container===w||jc(w,s.tabbableOptions)&&!zi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w,!1))&&(se=K),se>=0){var ge=se===0?o.tabbableGroups.length-1:se-1,we=o.tabbableGroups[ge];V=ni(w)>=0?we.lastTabbableNode:we.lastDomTabbableNode}else Ys(O)||(V=Y.nextTabbableNode(w,!1))}else{var me=wp(o.tabbableGroups,function(et){var Qe=et.lastTabbableNode;return w===Qe});if(me<0&&(Y.container===w||jc(w,s.tabbableOptions)&&!zi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w))&&(me=K),me>=0){var Ke=me===o.tabbableGroups.length-1?0:me+1,Be=o.tabbableGroups[Ke];V=ni(w)>=0?Be.firstTabbableNode:Be.firstDomTabbableNode}else Ys(O)||(V=Y.nextTabbableNode(w))}}else V=u("fallbackFocus");return V},b=function(y){var w=tl(y);if(!(c(w,y)>=0)){if(Is(s.clickOutsideDeactivates,y)){l.deactivate({returnFocus:s.returnFocusOnDeactivate});return}Is(s.allowOutsideClick,y)||y.preventDefault()}},_=function(y){var w=tl(y),O=c(w,y)>=0;if(O||w instanceof Document)O&&(o.mostRecentlyFocusedNode=w);else{y.stopImmediatePropagation();var B,T=!0;if(o.mostRecentlyFocusedNode)if(ni(o.mostRecentlyFocusedNode)>0){var V=c(o.mostRecentlyFocusedNode),K=o.containerGroups[V].tabbableNodes;if(K.length>0){var Y=K.findIndex(function(se){return se===o.mostRecentlyFocusedNode});Y>=0&&(s.isKeyForward(o.recentNavEvent)?Y+1=0&&(B=K[Y-1],T=!1))}}else o.containerGroups.some(function(se){return se.tabbableNodes.some(function(ge){return ni(ge)>0})})||(T=!1);else T=!1;T&&(B=g({target:o.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(o.recentNavEvent)})),p(B||o.mostRecentlyFocusedNode||f())}o.recentNavEvent=void 0},E=function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;o.recentNavEvent=y;var O=g({event:y,isBackward:w});O&&(Ys(y)&&y.preventDefault(),p(O))},v=function(y){if(Z_(y)&&Is(s.escapeDeactivates,y)!==!1){y.preventDefault(),l.deactivate();return}(s.isKeyForward(y)||s.isKeyBackward(y))&&E(y,s.isKeyBackward(y))},z=function(y){var w=tl(y);c(w,y)>=0||Is(s.clickOutsideDeactivates,y)||Is(s.allowOutsideClick,y)||(y.preventDefault(),y.stopImmediatePropagation())},C=function(){if(o.active)return yp.activateTrap(i,l),o.delayInitialFocusTimer=s.delayInitialFocus?vp(function(){p(f())}):p(f()),r.addEventListener("focusin",_,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",z,{capture:!0,passive:!1}),r.addEventListener("keydown",v,{capture:!0,passive:!1}),l},L=function(){if(o.active)return r.removeEventListener("focusin",_,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",z,!0),r.removeEventListener("keydown",v,!0),l},F=function(y){var w=y.some(function(O){var B=Array.from(O.removedNodes);return B.some(function(T){return T===o.mostRecentlyFocusedNode})});w&&p(f())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(F):void 0,Z=function(){M&&(M.disconnect(),o.active&&!o.paused&&o.containers.map(function(y){M.observe(y,{subtree:!0,childList:!0})}))};return l={get active(){return o.active},get paused(){return o.paused},activate:function(y){if(o.active)return this;var w=a(y,"onActivate"),O=a(y,"onPostActivate"),B=a(y,"checkCanFocusTrap");B||d(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,w==null||w();var T=function(){B&&d(),C(),Z(),O==null||O()};return B?(B(o.containers.concat()).then(T,T),this):(T(),this)},deactivate:function(y){if(!o.active)return this;var w=bp({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},y);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,L(),o.active=!1,o.paused=!1,Z(),yp.deactivateTrap(i,l);var O=a(w,"onDeactivate"),B=a(w,"onPostDeactivate"),T=a(w,"checkCanReturnFocus"),V=a(w,"returnFocus","returnFocusOnDeactivate");O==null||O();var K=function(){vp(function(){V&&p(m(o.nodeFocusedBeforeActivation)),B==null||B()})};return V&&T?(T(m(o.nodeFocusedBeforeActivation)).then(K,K),this):(K(),this)},pause:function(y){if(o.paused||!o.active)return this;var w=a(y,"onPause"),O=a(y,"onPostPause");return o.paused=!0,w==null||w(),L(),Z(),O==null||O(),this},unpause:function(y){if(!o.paused||!o.active)return this;var w=a(y,"onUnpause"),O=a(y,"onPostUnpause");return o.paused=!1,w==null||w(),d(),C(),Z(),O==null||O(),this},updateContainerElements:function(y){var w=[].concat(y).filter(Boolean);return o.containers=w.map(function(O){return typeof O=="string"?r.querySelector(O):O}),o.active&&d(),Z(),this}},l.updateContainerElements(e),l};function iA(n={}){let e;const{immediate:t,...r}=n,i=is(!1),s=is(!1),o=f=>e==null?void 0:e.activate(f),l=f=>{e==null||e.deactivate(f)},a=()=>{e&&(e.pause(),s.set(!0))},c=()=>{e&&(e.unpause(),s.set(!1))};return{useFocusTrap:f=>(e=rA(f,{...r,onActivate(){var d;i.set(!0),(d=n.onActivate)==null||d.call(n)},onDeactivate(){var d;i.set(!1),(d=n.onDeactivate)==null||d.call(n)}}),t&&o(),{destroy(){l(),e=void 0}}),hasFocus:nh(i),isPaused:nh(s),activate:o,deactivate:l,pause:a,unpause:c}}const sA=(n,e="body")=>{let t;if(!Vr(e)&&typeof e!="string")return{destroy:gt};async function r(s){if(e=s,typeof e=="string"){if(t=document.querySelector(e),t===null&&(await Nf(),t=document.querySelector(e)),t===null)throw new Error(`No element found matching css selector: "${e}"`)}else if(e instanceof HTMLElement)t=e;else throw new TypeError(`Unknown portal target type: ${e===null?"null":typeof e}. Allowed types: string (CSS selector) or HTMLElement.`);n.dataset.portal="",t.appendChild(n),n.hidden=!1}function i(){n.remove()}return r(e),{update:r,destroy:i}};function oA(){return{elements:{root:_r("label",{action:e=>({destroy:js(e,"mousedown",r=>{!r.defaultPrevented&&r.detail>1&&r.preventDefault()})})})}}}const{name:Qr}=o_("dialog"),lA={preventScroll:!0,closeOnEscape:!0,closeOnOutsideClick:!0,role:"dialog",defaultOpen:!1,portal:"body",forceVisible:!1,openFocus:void 0,closeFocus:void 0,onOutsideClick:void 0},Wc=is([]),aA=["content","title","description"];function cA(n){const e={...lA,...n},t=dp(d_(e,"ids")),{preventScroll:r,closeOnEscape:i,closeOnOutsideClick:s,role:o,portal:l,forceVisible:a,openFocus:c,closeFocus:u,onOutsideClick:f}=t,d=is(null),h=dp({...b_(aA),...e.ids}),p=e.open??is(e.defaultOpen),m=h_(p,e==null?void 0:e.onOpenChange),g=Ka([m,a],([$,y])=>$||y);let b=gt;function _($){const y=$.currentTarget,w=$.currentTarget;!Vr(y)||!Vr(w)||(m.set(!0),d.set(w))}function E(){m.set(!1),hp({prop:Jt(u),defaultEl:Jt(d)})}Ar([m],([$])=>{ry(100).then(()=>{$?Wc.update(y=>(y.push(Jt(h.content)),y)):Wc.update(y=>y.filter(w=>w!==Jt(h.content)))})});const v=_r(Qr("trigger"),{stores:[m],returned:([$])=>({"aria-haspopup":"dialog","aria-expanded":$,type:"button"}),action:$=>({destroy:vl(js($,"click",w=>{_(w)}),js($,"keydown",w=>{w.key!==Ws.ENTER&&w.key!==Ws.SPACE||(w.preventDefault(),_(w))}))})}),z=_r(Qr("overlay"),{stores:[g],returned:([$])=>({hidden:$?void 0:!0,tabindex:-1,style:Hu({display:$?void 0:"none"}),"aria-hidden":!0,"data-state":$?"open":"closed"}),action:$=>{let y=gt;if(Jt(i)){const w=pp($,{handler:()=>{E()}});w&&w.destroy&&(y=w.destroy)}return{destroy(){y()}}}}),C=_r(Qr("content"),{stores:[g,h.content,h.description,h.title],returned:([$,y,w,O])=>({id:y,role:Jt(o),"aria-describedby":w,"aria-labelledby":O,"aria-modal":$?"true":void 0,"data-state":$?"open":"closed",tabindex:-1,hidden:$?void 0:!0,style:Hu({display:$?void 0:"none"})}),action:$=>{let y=gt,w=gt;const O=vl(Ar([m],([B])=>{if(!B)return;const T=iA({immediate:!1,escapeDeactivates:!0,clickOutsideDeactivates:!0,returnFocusOnDeactivate:!1,fallbackFocus:$});y=T.activate,w=T.deactivate;const V=T.useFocusTrap($);return V&&V.destroy?V.destroy:T.deactivate}),Ar([s,m],([B,T])=>$_($,{enabled:T,handler:V=>{var se;if((se=Jt(f))==null||se(V),V.defaultPrevented)return;const K=Jt(Wc),Y=s_(K)===Jt(h.content);B&&Y&&E()}}).destroy),Ar([i],([B])=>{if(!B)return gt;const T=pp($,{handler:()=>{E()}});return T&&T.destroy?T.destroy:gt}),Ar([g],([B])=>{Nf().then(()=>{B?y():w()})}));return{destroy:()=>{b(),O()}}}}),L=_r(Qr("portalled"),{stores:l,returned:$=>({"data-portal":$?"":void 0}),action:$=>{const y=Ar([l],([w])=>{if(!w)return gt;const O=M_($,w);if(O===null)return gt;const B=sA($,O);return B&&B.destroy?B.destroy:gt});return{destroy(){y()}}}}),F=_r(Qr("title"),{stores:[h.title],returned:([$])=>({id:$})}),M=_r(Qr("description"),{stores:[h.description],returned:([$])=>({id:$})}),Z=_r(Qr("close"),{returned:()=>({type:"button"}),action:$=>({destroy:vl(js($,"click",()=>{E()}),js($,"keydown",w=>{w.key!==Ws.SPACE&&w.key!==Ws.ENTER||(w.preventDefault(),E())}))})});return Ar([m,r],([$,y])=>{if(l_){if(y&&$&&(b=A_()),$){const w=document.getElementById(Jt(h.content));hp({prop:Jt(c),defaultEl:w})}return()=>{Jt(a)||b()}}}),{ids:h,elements:{content:C,trigger:v,title:F,description:M,overlay:z,close:Z,portalled:L},states:{open:m},options:t}}function hy(n,e){const t={};return e.forEach(r=>{t[r]={[`data-${n}-${r}`]:""}}),r=>t[r]}function td(){const n=K1();return e=>{const{originalEvent:t}=e.detail,{cancelable:r}=e,i=t.type;n(i,{originalEvent:t,currentTarget:t.currentTarget},{cancelable:r})||e.preventDefault()}}function uA(n){const e={};for(const t in n){const r=n[t];r!==void 0&&(e[t]=r)}return e}function fA(n){return function(e,t){if(t===void 0)return;const r=n[e];r&&r.set(t)}}function dA(n,e){const t=[];return e.builders.forEach(r=>{const i=r.action(n);i&&t.push(i)}),{destroy:()=>{t.forEach(r=>{r.destroy&&r.destroy()})}}}function kp(n){const e={};return n.forEach(t=>{Object.keys(t).forEach(r=>{r!=="action"&&(e[r]=t[r])})}),e}function hA(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&Kc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),oe(s,t,o),r=!0},p(s,o){s[1],e?ae(e,s[1]?"a":"button")?(i.d(1),i=Kc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=Kc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function pA(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&qc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),oe(s,t,o),r=!0},p(s,o){s[1],e?ae(e,s[1]?"a":"button")?(i.d(1),i=qc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=qc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function Kc(n){let e,t,r,i,s;const o=n[7].default,l=te(o,n,n[6],null);let a=[{type:t=n[1]?void 0:n[2]},{href:n[1]},{tabindex:"0"},n[5],n[4]],c={};for(let u=0;u{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function gA(n,e,t){const r=["href","type","builders","el"];let i=Te(e,r),{$$slots:s={},$$scope:o}=e,{href:l=void 0}=e,{type:a=void 0}=e,{builders:c=[]}=e,{el:u=void 0}=e;const f={"data-button-root":""};function d(M){pe.call(this,n,M)}function h(M){pe.call(this,n,M)}function p(M){pe.call(this,n,M)}function m(M){pe.call(this,n,M)}function g(M){pe.call(this,n,M)}function b(M){pe.call(this,n,M)}function _(M){pe.call(this,n,M)}function E(M){pe.call(this,n,M)}function v(M){pe.call(this,n,M)}function z(M){pe.call(this,n,M)}function C(M){pe.call(this,n,M)}function L(M){pe.call(this,n,M)}function F(M){rt[M?"unshift":"push"](()=>{u=M,t(0,u)})}return n.$$set=M=>{e=A(A({},e),J(M)),t(5,i=Te(e,r)),"href"in M&&t(1,l=M.href),"type"in M&&t(2,a=M.type),"builders"in M&&t(3,c=M.builders),"el"in M&&t(0,u=M.el),"$$scope"in M&&t(6,o=M.$$scope)},[u,l,a,c,f,i,o,s,d,h,p,m,g,b,_,E,v,z,C,L,F]}let bA=class extends ue{constructor(e){super(),fe(this,e,gA,mA,ae,{href:1,type:2,builders:3,el:0})}};function py(){return{NAME:"dialog",PARTS:["close","content","description","overlay","portal","title","trigger"]}}function yA(n){const{NAME:e,PARTS:t}=py(),r=hy(e,t),i={...cA({...uA(n),role:"dialog",forceVisible:!0}),getAttrs:r};return J1(e,i),{...i,updateOption:fA(i.options)}}function $i(){const{NAME:n}=py();return G1(n)}const vA=n=>({ids:n&1}),Sp=n=>({ids:n[0]});function wA(n){let e;const t=n[12].default,r=te(t,n,n[11],Sp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,[s]){r&&r.p&&(!e||s&2049)&&ne(r,t,i,i[11],e?ie(t,i[11],s,vA):re(i[11]),Sp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function kA(n,e,t){let r,{$$slots:i={},$$scope:s}=e,{preventScroll:o=void 0}=e,{closeOnEscape:l=void 0}=e,{closeOnOutsideClick:a=void 0}=e,{portal:c=void 0}=e,{open:u=void 0}=e,{onOpenChange:f=void 0}=e,{openFocus:d=void 0}=e,{closeFocus:h=void 0}=e,{onOutsideClick:p=void 0}=e;const{states:{open:m},updateOption:g,ids:b}=yA({closeOnEscape:l,preventScroll:o,closeOnOutsideClick:a,portal:c,forceVisible:!0,defaultOpen:u,openFocus:d,closeFocus:h,onOutsideClick:p,onOpenChange:({next:E})=>(u!==E&&(f==null||f(E),t(2,u=E)),E)}),_=Ka([b.content,b.description,b.title],([E,v,z])=>({content:E,description:v,title:z}));return Mn(n,_,E=>t(0,r=E)),n.$$set=E=>{"preventScroll"in E&&t(3,o=E.preventScroll),"closeOnEscape"in E&&t(4,l=E.closeOnEscape),"closeOnOutsideClick"in E&&t(5,a=E.closeOnOutsideClick),"portal"in E&&t(6,c=E.portal),"open"in E&&t(2,u=E.open),"onOpenChange"in E&&t(7,f=E.onOpenChange),"openFocus"in E&&t(8,d=E.openFocus),"closeFocus"in E&&t(9,h=E.closeFocus),"onOutsideClick"in E&&t(10,p=E.onOutsideClick),"$$scope"in E&&t(11,s=E.$$scope)},n.$$.update=()=>{n.$$.dirty&4&&u!==void 0&&m.set(u),n.$$.dirty&8&&g("preventScroll",o),n.$$.dirty&16&&g("closeOnEscape",l),n.$$.dirty&32&&g("closeOnOutsideClick",a),n.$$.dirty&64&&g("portal",c),n.$$.dirty&256&&g("openFocus",d),n.$$.dirty&512&&g("closeFocus",h),n.$$.dirty&1024&&g("onOutsideClick",p)},[r,_,u,o,l,a,c,f,d,h,p,s,i]}class SA extends ue{constructor(e){super(),fe(this,e,kA,wA,ae,{preventScroll:3,closeOnEscape:4,closeOnOutsideClick:5,portal:6,open:2,onOpenChange:7,openFocus:8,closeFocus:9,onOutsideClick:10})}}const CA=n=>({builder:n&8}),Cp=n=>({builder:n[3]}),_A=n=>({builder:n&8}),_p=n=>({builder:n[3]});function AA(n){let e=n[1],t,r,i=n[1]&&Jc(n);return{c(){i&&i.c(),t=We()},l(s){i&&i.l(s),t=We()},m(s,o){i&&i.m(s,o),oe(s,t,o),r=!0},p(s,o){s[1]?e?ae(e,s[1])?(i.d(1),i=Jc(s),e=s[1],i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=Jc(s),e=s[1],i.c(),i.m(t.parentNode,t)):e&&(i.d(1),i=null,e=s[1])},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function TA(n){let e;const t=n[9].default,r=te(t,n,n[8],_p);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&264)&&ne(r,t,i,i[8],e?ie(t,i[8],s,_A):re(i[8]),_p)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function Jc(n){let e,t,r,i;const s=n[9].default,o=te(s,n,n[8],Cp);let l=[n[3],n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function MA(n,e,t){let r;const i=["level","asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{level:c="h2"}=e,{asChild:u=!1}=e,{id:f=void 0}=e,{el:d=void 0}=e;const{elements:{title:h},ids:p,getAttrs:m}=$i();Mn(n,h,_=>t(7,o=_));const g=m("title");function b(_){rt[_?"unshift":"push"](()=>{d=_,t(0,d)})}return n.$$set=_=>{e=A(A({},e),J(_)),t(5,s=Te(e,i)),"level"in _&&t(1,c=_.level),"asChild"in _&&t(2,u=_.asChild),"id"in _&&t(6,f=_.id),"el"in _&&t(0,d=_.el),"$$scope"in _&&t(8,a=_.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&f&&p.title.set(f),n.$$.dirty&128&&t(3,r=o),n.$$.dirty&8&&Object.assign(r,g)},[d,c,u,r,h,s,f,o,a,l,b]}let OA=class extends ue{constructor(e){super(),fe(this,e,MA,EA,ae,{level:1,asChild:2,id:6,el:0})}};const $A=n=>({builder:n&4}),Ap=n=>({builder:n[2]}),NA=n=>({builder:n&4}),Tp=n=>({builder:n[2]});function DA(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],Ap);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function RA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{close:f},getAttrs:d}=$i();Mn(n,f,g=>t(6,o=g));const h=td(),p=d("close");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=A(A({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class PA extends ue{constructor(e){super(),fe(this,e,RA,IA,ae,{asChild:1,el:0})}}const LA=n=>({builder:n&4}),Ep=n=>({builder:n[2]}),BA=n=>({builder:n&4}),Mp=n=>({builder:n[2]});function FA(n){let e,t,r,i;const s=n[7].default,o=te(s,n,n[6],Ep);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function HA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{portalled:f},getAttrs:d}=$i();Mn(n,f,m=>t(5,o=m));const h=d("portal");function p(m){rt[m?"unshift":"push"](()=>{u=m,t(0,u)})}return n.$$set=m=>{e=A(A({},e),J(m)),t(4,s=Te(e,i)),"asChild"in m&&t(1,c=m.asChild),"el"in m&&t(0,u=m.el),"$$scope"in m&&t(6,a=m.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,h)},[u,c,r,f,s,o,a,l,p]}let UA=class extends ue{constructor(e){super(),fe(this,e,HA,VA,ae,{asChild:1,el:0})}};const jA=n=>({builder:n[0]&256}),Op=n=>({builder:n[8]}),WA=n=>({builder:n[0]&256}),$p=n=>({builder:n[8]}),KA=n=>({builder:n[0]&256}),Np=n=>({builder:n[8]}),qA=n=>({builder:n[0]&256}),Dp=n=>({builder:n[8]}),JA=n=>({builder:n[0]&256}),xp=n=>({builder:n[8]}),GA=n=>({builder:n[0]&256}),Ip=n=>({builder:n[8]});function YA(n){let e,t,r,i;const s=n[16].default,o=te(s,n,n[15],Op);let l=[n[8],n[12]],a={};for(let c=0;c{t=Wa(e,n[3],n[4]),t.start()})),r=!0)},o(u){S(l,u),r=!1},d(u){u&&j(e),l&&l.d(u),n[34](null),i=!1,It(s)}}}function ZA(n){let e,t,r,i,s,o;const l=n[16].default,a=te(l,n,n[15],Dp);let c=[n[8],n[12]],u={};for(let f=0;f{i&&(r&&r.end(1),t=Wa(e,n[3],n[4]),t.start())}),i=!0)},o(f){S(a,f),t&&t.invalidate(),f&&(r=ja(e,n[5],n[6])),i=!1},d(f){f&&j(e),a&&a.d(f),n[33](null),f&&r&&r.end(),s=!1,It(o)}}}function eT(n){let e,t,r,i,s;const o=n[16].default,l=te(o,n,n[15],xp);let a=[n[8],n[12]],c={};for(let u=0;u{r&&(t||(t=Il(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(u){S(l,u),u&&(t||(t=Il(e,n[1],n[2],!1)),t.run(0)),r=!1},d(u){u&&j(e),l&&l.d(u),n[32](null),u&&t&&t.end(),i=!1,It(s)}}}function tT(n){let e;const t=n[16].default,r=te(t,n,n[15],Ip);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[0]&33024)&&ne(r,t,i,i[15],e?ie(t,i[15],s,GA):re(i[15]),Ip)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function nT(n){let e,t,r,i;const s=[tT,eT,ZA,QA,XA,YA],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=We()},l(a){t&&t.l(a),r=We()},m(a,c){~e&&o[e].m(a,c),oe(a,r,c),i=!0},p(a,c){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(On(),S(o[u],1,1,()=>{o[u]=null}),$n()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function rT(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","id","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{id:b=void 0}=e,{el:_=void 0}=e;const{elements:{content:E},states:{open:v},ids:z,getAttrs:C}=$i();Mn(n,E,W=>t(14,o=W)),Mn(n,v,W=>t(9,l=W));const L=C("content");function F(W){pe.call(this,n,W)}function M(W){pe.call(this,n,W)}function Z(W){pe.call(this,n,W)}function $(W){pe.call(this,n,W)}function y(W){pe.call(this,n,W)}function w(W){pe.call(this,n,W)}function O(W){pe.call(this,n,W)}function B(W){pe.call(this,n,W)}function T(W){pe.call(this,n,W)}function V(W){pe.call(this,n,W)}function K(W){pe.call(this,n,W)}function Y(W){pe.call(this,n,W)}function se(W){pe.call(this,n,W)}function ge(W){pe.call(this,n,W)}function we(W){pe.call(this,n,W)}function me(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function Ke(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function Be(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function et(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function Qe(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}return n.$$set=W=>{e=A(A({},e),J(W)),t(12,s=Te(e,i)),"transition"in W&&t(1,u=W.transition),"transitionConfig"in W&&t(2,f=W.transitionConfig),"inTransition"in W&&t(3,d=W.inTransition),"inTransitionConfig"in W&&t(4,h=W.inTransitionConfig),"outTransition"in W&&t(5,p=W.outTransition),"outTransitionConfig"in W&&t(6,m=W.outTransitionConfig),"asChild"in W&&t(7,g=W.asChild),"id"in W&&t(13,b=W.id),"el"in W&&t(0,_=W.el),"$$scope"in W&&t(15,c=W.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&8192&&b&&z.content.set(b),n.$$.dirty[0]&16384&&t(8,r=o),n.$$.dirty[0]&256&&Object.assign(r,L)},[_,u,f,d,h,p,m,g,r,l,E,v,s,b,o,c,a,F,M,Z,$,y,w,O,B,T,V,K,Y,se,ge,we,me,Ke,Be,et,Qe]}let iT=class extends ue{constructor(e){super(),fe(this,e,rT,nT,ae,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,id:13,el:0},null,[-1,-1])}};const sT=n=>({builder:n&256}),Rp=n=>({builder:n[8]});function oT(n){let e,t,r,i=[n[8],n[12]],s={};for(let o=0;o{t=Wa(e,n[3],n[4]),t.start()}))},o:Ce,d(l){l&&j(e),n[23](null),r=!1,It(i)}}}function cT(n){let e,t,r,i,s,o,l=[n[8],n[12]],a={};for(let c=0;c{i&&(r&&r.end(1),t=Wa(e,n[3],n[4]),t.start())}),i=!0)},o(c){t&&t.invalidate(),c&&(r=ja(e,n[5],n[6])),i=!1},d(c){c&&j(e),n[22](null),c&&r&&r.end(),s=!1,It(o)}}}function uT(n){let e,t,r,i,s,o=[n[8],n[12]],l={};for(let a=0;a{r&&(t||(t=Il(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(a){a&&(t||(t=Il(e,n[1],n[2],!1)),t.run(0)),r=!1},d(a){a&&j(e),n[21](null),a&&t&&t.end(),i=!1,It(s)}}}function fT(n){let e;const t=n[15].default,r=te(t,n,n[14],Rp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16640)&&ne(r,t,i,i[14],e?ie(t,i[14],s,sT):re(i[14]),Rp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function dT(n){let e,t,r,i;const s=[fT,uT,cT,aT,lT,oT],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=We()},l(a){t&&t.l(a),r=We()},m(a,c){~e&&o[e].m(a,c),oe(a,r,c),i=!0},p(a,[c]){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(On(),S(o[u],1,1,()=>{o[u]=null}),$n()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function hT(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{el:b=void 0}=e;const{elements:{overlay:_},states:{open:E},getAttrs:v}=$i();Mn(n,_,T=>t(13,o=T)),Mn(n,E,T=>t(9,l=T));const z=v("overlay");function C(T){pe.call(this,n,T)}function L(T){pe.call(this,n,T)}function F(T){pe.call(this,n,T)}function M(T){pe.call(this,n,T)}function Z(T){pe.call(this,n,T)}function $(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function y(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function w(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function O(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function B(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}return n.$$set=T=>{e=A(A({},e),J(T)),t(12,s=Te(e,i)),"transition"in T&&t(1,u=T.transition),"transitionConfig"in T&&t(2,f=T.transitionConfig),"inTransition"in T&&t(3,d=T.inTransition),"inTransitionConfig"in T&&t(4,h=T.inTransitionConfig),"outTransition"in T&&t(5,p=T.outTransition),"outTransitionConfig"in T&&t(6,m=T.outTransitionConfig),"asChild"in T&&t(7,g=T.asChild),"el"in T&&t(0,b=T.el),"$$scope"in T&&t(14,c=T.$$scope)},n.$$.update=()=>{n.$$.dirty&8192&&t(8,r=o),n.$$.dirty&256&&Object.assign(r,z)},[b,u,f,d,h,p,m,g,r,l,_,E,s,o,c,a,C,L,F,M,Z,$,y,w,O,B]}let pT=class extends ue{constructor(e){super(),fe(this,e,hT,dT,ae,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,el:0})}};const mT=n=>({builder:n&4}),Pp=n=>({builder:n[2]}),gT=n=>({builder:n&4}),Lp=n=>({builder:n[2]});function bT(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],Pp);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function wT(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{trigger:f},getAttrs:d}=$i();Mn(n,f,g=>t(6,o=g));const h=td(),p=d("trigger");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=A(A({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class kT extends ue{constructor(e){super(),fe(this,e,wT,vT,ae,{asChild:1,el:0})}}const ST=n=>({builder:n&4}),Bp=n=>({builder:n[2]}),CT=n=>({builder:n&4}),Fp=n=>({builder:n[2]});function _T(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],Bp);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function ET(n,e,t){let r;const i=["asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{id:u=void 0}=e,{el:f=void 0}=e;const{elements:{description:d},ids:h,getAttrs:p}=$i();Mn(n,d,b=>t(6,o=b));const m=p("description");function g(b){rt[b?"unshift":"push"](()=>{f=b,t(0,f)})}return n.$$set=b=>{e=A(A({},e),J(b)),t(4,s=Te(e,i)),"asChild"in b&&t(1,c=b.asChild),"id"in b&&t(5,u=b.id),"el"in b&&t(0,f=b.el),"$$scope"in b&&t(7,a=b.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&u&&h.description.set(u),n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,m)},[f,c,r,d,s,u,o,a,l,g]}let MT=class extends ue{constructor(e){super(),fe(this,e,ET,TT,ae,{asChild:1,id:5,el:0})}};function OT(){const n="label",t=hy(n,["root"]);return{NAME:n,getAttrs:t}}const $T=n=>({builder:n&4}),zp=n=>({builder:n[2]}),NT=n=>({builder:n&4}),Vp=n=>({builder:n[2]});function DT(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],zp);let l=[n[2],n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function RT(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{root:f}}=oA();Mn(n,f,g=>t(6,o=g));const d=td(),{getAttrs:h}=OT(),p=h("root");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=A(A({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,d,s,o,a,l,m]}let PT=class extends ue{constructor(e){super(),fe(this,e,RT,IT,ae,{asChild:1,el:0})}};function my(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;el(s)))==null?void 0:o.classGroupId}const Hp=/^\[(.+)\]$/;function FT(n){if(Hp.test(n)){const e=Hp.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}}function zT(n){const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return HT(Object.entries(n.classGroups),t).forEach(([s,o])=>{ju(o,r,s,e)}),r}function ju(n,e,t,r){n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Up(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(VT(i)){ju(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{ju(o,Up(e,s),t,r)})})}function Up(n,e){let t=n;return e.split(nd).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t}function VT(n){return n.isThemeGetter}function HT(n,e){return e?n.map(([t,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[e+o,l])):s);return[t,i]}):n}function UT(n){if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;function i(s,o){t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)}return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}}const by="!";function jT(n){const e=n.separator,t=e.length===1,r=e[0],i=e.length;return function(o){const l=[];let a=0,c=0,u;for(let m=0;mc?u-c:void 0;return{modifiers:l,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}}}function WT(n){if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e}function KT(n){return{cache:UT(n.cacheSize),splitModifiers:jT(n),...BT(n)}}const qT=/\s+/;function JT(n,e){const{splitModifiers:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=new Set;return n.trim().split(qT).map(o=>{const{modifiers:l,hasImportantModifier:a,baseClassName:c,maybePostfixModifierPosition:u}=t(o);let f=r(u?c.substring(0,u):c),d=!!u;if(!f){if(!u)return{isTailwindClass:!1,originalClassName:o};if(f=r(c),!f)return{isTailwindClass:!1,originalClassName:o};d=!1}const h=WT(l).join(":");return{isTailwindClass:!0,modifierId:a?h+by:h,classGroupId:f,originalClassName:o,hasPostfixModifier:d}}).reverse().filter(o=>{if(!o.isTailwindClass)return!0;const{modifierId:l,classGroupId:a,hasPostfixModifier:c}=o,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(f=>s.add(l+f)),!0)}).reverse().map(o=>o.originalClassName).join(" ")}function GT(){let n=0,e,t,r="";for(;nf(u),n());return t=KT(c),r=t.cache.get,i=t.cache.set,s=l,l(a)}function l(a){const c=r(a);if(c)return c;const u=JT(a,t);return i(a,u),u}return function(){return s(GT.apply(null,arguments))}}function Ye(n){const e=t=>t[n]||[];return e.isThemeGetter=!0,e}const vy=/^\[(?:([a-z-]+):)?(.+)\]$/i,XT=/^\d+\/\d+$/,QT=new Set(["px","full","screen"]),ZT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function ir(n){return oi(n)||QT.has(n)||XT.test(n)}function yr(n){return _s(n,"length",fE)}function oi(n){return!!n&&!Number.isNaN(Number(n))}function nl(n){return _s(n,"number",oi)}function Rs(n){return!!n&&Number.isInteger(Number(n))}function iE(n){return n.endsWith("%")&&oi(n.slice(0,-1))}function ke(n){return vy.test(n)}function vr(n){return ZT.test(n)}const sE=new Set(["length","size","percentage"]);function oE(n){return _s(n,sE,wy)}function lE(n){return _s(n,"position",wy)}const aE=new Set(["image","url"]);function cE(n){return _s(n,aE,hE)}function uE(n){return _s(n,"",dE)}function Ps(){return!0}function _s(n,e,t){const r=vy.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1}function fE(n){return eE.test(n)&&!tE.test(n)}function wy(){return!1}function dE(n){return nE.test(n)}function hE(n){return rE.test(n)}function pE(){const n=Ye("colors"),e=Ye("spacing"),t=Ye("blur"),r=Ye("brightness"),i=Ye("borderColor"),s=Ye("borderRadius"),o=Ye("borderSpacing"),l=Ye("borderWidth"),a=Ye("contrast"),c=Ye("grayscale"),u=Ye("hueRotate"),f=Ye("invert"),d=Ye("gap"),h=Ye("gradientColorStops"),p=Ye("gradientColorStopPositions"),m=Ye("inset"),g=Ye("margin"),b=Ye("opacity"),_=Ye("padding"),E=Ye("saturate"),v=Ye("scale"),z=Ye("sepia"),C=Ye("skew"),L=Ye("space"),F=Ye("translate"),M=()=>["auto","contain","none"],Z=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",ke,e],y=()=>[ke,e],w=()=>["",ir,yr],O=()=>["auto",oi,ke],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],K=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",ke],se=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ge=()=>[oi,nl],we=()=>[oi,ke];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[ir,yr],blur:["none","",vr,ke],brightness:ge(),borderColor:[n],borderRadius:["none","","full",vr,ke],borderSpacing:y(),borderWidth:w(),contrast:ge(),grayscale:Y(),hueRotate:we(),invert:Y(),gap:y(),gradientColorStops:[n],gradientColorStopPositions:[iE,yr],inset:$(),margin:$(),opacity:ge(),padding:y(),saturate:ge(),scale:ge(),sepia:Y(),skew:we(),space:y(),translate:y()},classGroups:{aspect:[{aspect:["auto","square","video",ke]}],container:["container"],columns:[{columns:[vr]}],"break-after":[{"break-after":se()}],"break-before":[{"break-before":se()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),ke]}],overflow:[{overflow:Z()}],"overflow-x":[{"overflow-x":Z()}],"overflow-y":[{"overflow-y":Z()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rs,ke]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ke]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",Rs,ke]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Rs,ke]},ke]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Rs,ke]},ke]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ke]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ke,e]}],"min-w":[{"min-w":[ke,e,"min","max","fit"]}],"max-w":[{"max-w":[ke,e,"none","full","min","max","fit","prose",{screen:[vr]},vr]}],h:[{h:[ke,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ke,e,"auto","min","max","fit"]}],"font-size":[{text:["base",vr,yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",nl]}],"font-family":[{font:[Ps]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ke]}],"line-clamp":[{"line-clamp":["none",oi,nl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ir,ke]}],"list-image":[{"list-image":["none",ke]}],"list-style-type":[{list:["none","disc","decimal",ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ir,yr]}],"underline-offset":[{"underline-offset":["auto",ir,ke]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),lE]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",oE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cE]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:T()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[ir,ke]}],"outline-w":[{outline:[ir,yr]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:w()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ir,yr]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",vr,uE]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":V()}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",vr,ke]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[E]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ke]}],duration:[{duration:we()}],ease:[{ease:["linear","in","out","in-out",ke]}],delay:[{delay:we()}],animate:[{animate:["none","spin","ping","pulse","bounce",ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[v]}],"scale-x":[{"scale-x":[v]}],"scale-y":[{"scale-y":[v]}],rotate:[{rotate:[Rs,ke]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ke]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[ir,yr,nl]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const mE=YT(pE);function gE(n){const e=n-1;return e*e*e+1}function _t(...n){return mE(LT(n))}const bE=(n,e={y:-8,x:0,start:.95,duration:150})=>{const t=getComputedStyle(n),r=t.transform==="none"?"":t.transform,i=(o,l,a)=>{const[c,u]=l,[f,d]=a;return(o-c)/(u-c)*(d-f)+f},s=o=>Object.keys(o).reduce((l,a)=>o[a]===void 0?l:l+`${a}:${o[a]};`,"");return{duration:e.duration??200,delay:0,css:o=>{const l=i(o,[0,1],[e.y??5,0]),a=i(o,[0,1],[e.x??0,0]),c=i(o,[0,1],[e.start??.95,1]);return s({transform:`${r} translate3d(${a}px, ${l}px, 0) scale(${c})`,opacity:o})},easing:gE}};function yE(n){let e;const t=n[5].default,r=te(t,n,n[8],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&256)&&ne(r,t,i,i[8],e?ie(t,i[8],s,null):re(i[8]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function vE(n){let e,t;const r=[{builders:n[3]},{class:_t(Yp({variant:n[1],size:n[2],className:n[0]}))},{type:"button"},n[4]];let i={$$slots:{default:[yE]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},e),J(h)),t(4,i=Te(e,r)),"class"in h&&t(0,l=h.class),"variant"in h&&t(1,a=h.variant),"size"in h&&t(2,c=h.size),"builders"in h&&t(3,u=h.builders),"$$scope"in h&&t(8,o=h.$$scope)},[l,a,c,u,i,s,f,d,o]}class Re extends ue{constructor(e){super(),fe(this,e,wE,vE,ae,{class:0,variant:1,size:2,builders:3})}}var jp=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,en=n=>!n||typeof n!="object"||Object.keys(n).length===0,kE=(n,e)=>JSON.stringify(n)===JSON.stringify(e);function ky(n,e){n.forEach(function(t){Array.isArray(t)?ky(t,e):e.push(t)})}function Sy(n){let e=[];return ky(n,e),e}var Cy=(...n)=>Sy(n).filter(Boolean),_y=(n,e)=>{let t={},r=Object.keys(n),i=Object.keys(e);for(let s of r)if(i.includes(s)){let o=n[s],l=e[s];typeof o=="object"&&typeof l=="object"?t[s]=_y(o,l):Array.isArray(o)||Array.isArray(l)?t[s]=Cy(l,o):t[s]=l+" "+o}else t[s]=n[s];for(let s of i)r.includes(s)||(t[s]=e[s]);return t},Wp=n=>!n||typeof n!="string"?n:n.replace(/\s+/g," ").trim();function SE(){for(var n=0,e,t,r="";nn&&(e=0,r=t,t=new Map)}return{get:function(o){var l=t.get(o);if(l!==void 0)return l;if((l=r.get(o))!==void 0)return i(o,l),l},set:function(o,l){t.has(o)?t.set(o,l):i(o,l)}}}var Ey="!";function OE(n){var e=n.separator||":",t=e.length===1,r=e[0],i=e.length;return function(o){for(var l=[],a=0,c=0,u,f=0;fc?u-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}}}function $E(n){if(n.length<=1)return n;var e=[],t=[];return n.forEach(function(r){var i=r[0]==="[";i?(e.push.apply(e,t.sort().concat([r])),t=[]):t.push(r)}),e.push.apply(e,t.sort()),e}function NE(n){return{cache:ME(n.cacheSize),splitModifiers:OE(n),...CE(n)}}var DE=/\s+/;function xE(n,e){var t=e.splitModifiers,r=e.getClassGroupId,i=e.getConflictingClassGroupIds,s=new Set;return n.trim().split(DE).map(function(o){var l=t(o),a=l.modifiers,c=l.hasImportantModifier,u=l.baseClassName,f=l.maybePostfixModifierPosition,d=r(f?u.substring(0,f):u),h=!!f;if(!d){if(!f)return{isTailwindClass:!1,originalClassName:o};if(d=r(u),!d)return{isTailwindClass:!1,originalClassName:o};h=!1}var p=$E(a).join(":"),m=c?p+Ey:p;return{isTailwindClass:!0,modifierId:m,classGroupId:d,originalClassName:o,hasPostfixModifier:h}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var l=o.modifierId,a=o.classGroupId,c=o.hasPostfixModifier,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(function(f){return s.add(l+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Ku(){for(var n=arguments.length,e=new Array(n),t=0;t1?e-1:0),r=1;rn||void 0,bo=(...n)=>Ny(Sy(n).filter(Boolean).join(" ")),Gc=null,Zl={},Gu=!1,Fs=(...n)=>e=>e.twMerge?((!Gc||Gu)&&(Gu=!1,Gc=en(Zl)?XE:YE(Zl)),Ny(Gc(bo(n)))):bo(n),Gp=(n,e)=>{for(let t in e)n.hasOwnProperty(t)?n[t]=bo(n[t],e[t]):n[t]=e[t];return n},ZE=(n,e)=>{let{extend:t=null,slots:r={},variants:i={},compoundVariants:s=[],compoundSlots:o=[],defaultVariants:l={}}=n,a={...QE,...e},c=t!=null&&t.base?bo(t.base,n==null?void 0:n.base):n==null?void 0:n.base,u=t!=null&&t.variants&&!en(t.variants)?_y(i,t.variants):i,f=t!=null&&t.defaultVariants&&!en(t.defaultVariants)?{...t.defaultVariants,...l}:l;!en(a.twMergeConfig)&&!kE(a.twMergeConfig,Zl)&&(Gu=!0,Zl=a.twMergeConfig);let d=en(t==null?void 0:t.slots),h=en(r)?{}:{base:bo(n==null?void 0:n.base,d&&(t==null?void 0:t.base)),...r},p=d?h:Gp({...t==null?void 0:t.slots},en(h)?{base:n==null?void 0:n.base}:h),m=b=>{if(en(u)&&en(r)&&d)return Fs(c,b==null?void 0:b.class,b==null?void 0:b.className)(a);if(s&&!Array.isArray(s))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof s}`);if(o&&!Array.isArray(o))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof o}`);let _=(y,w,O=[],B)=>{let T=O;if(typeof w=="string")T=T.concat(Wp(w).split(" ").map(V=>`${y}:${V}`));else if(Array.isArray(w))T=T.concat(w.reduce((V,K)=>V.concat(`${y}:${K}`),[]));else if(typeof w=="object"&&typeof B=="string"){for(let V in w)if(w.hasOwnProperty(V)&&V===B){let K=w[V];if(K&&typeof K=="string"){let Y=Wp(K);T[B]?T[B]=T[B].concat(Y.split(" ").map(se=>`${y}:${se}`)):T[B]=Y.split(" ").map(se=>`${y}:${se}`)}else Array.isArray(K)&&K.length>0&&(T[B]=K.reduce((Y,se)=>Y.concat(`${y}:${se}`),[]))}}return T},E=(y,w=u,O=null,B=null)=>{var T;let V=w[y];if(!V||en(V))return null;let K=(T=B==null?void 0:B[y])!=null?T:b==null?void 0:b[y];if(K===null)return null;let Y=jp(K),se=Array.isArray(a.responsiveVariants)&&a.responsiveVariants.length>0||a.responsiveVariants===!0,ge=f==null?void 0:f[y],we=[];if(typeof Y=="object"&&se)for(let[Ke,Be]of Object.entries(Y)){let et=V[Be];if(Ke==="initial"){ge=Be;continue}Array.isArray(a.responsiveVariants)&&!a.responsiveVariants.includes(Ke)||(we=_(Ke,et,we,O))}let me=V[Y]||V[jp(ge)];return typeof we=="object"&&typeof O=="string"&&we[O]?Gp(we,me):we.length>0?(we.push(me),we):me},v=()=>u?Object.keys(u).map(y=>E(y,u)):null,z=(y,w)=>{if(!u||typeof u!="object")return null;let O=new Array;for(let B in u){let T=E(B,u,y,w),V=y==="base"&&typeof T=="string"?T:T&&T[y];V&&(O[O.length]=V)}return O},C={};for(let y in b)b[y]!==void 0&&(C[y]=b[y]);let L=(y,w)=>{var O;let B=typeof(b==null?void 0:b[y])=="object"?{[y]:(O=b[y])==null?void 0:O.initial}:{};return{...f,...C,...B,...w}},F=(y=[],w)=>{let O=[];for(let{class:B,className:T,...V}of y){let K=!0;for(let[Y,se]of Object.entries(V)){let ge=L(Y,w);if(Array.isArray(se)){if(!se.includes(ge[Y])){K=!1;break}}else if(ge[Y]!==se){K=!1;break}}K&&(B&&O.push(B),T&&O.push(T))}return O},M=y=>{let w=F(s,y),O=F(t==null?void 0:t.compoundVariants,y);return Cy(O,w)},Z=y=>{let w=M(y);if(!Array.isArray(w))return w;let O={};for(let B of w)if(typeof B=="string"&&(O.base=Fs(O.base,B)(a)),typeof B=="object")for(let[T,V]of Object.entries(B))O[T]=Fs(O[T],V)(a);return O},$=y=>{if(o.length<1)return null;let w={};for(let{slots:O=[],class:B,className:T,...V}of o){if(!en(V)){let K=!0;for(let Y of Object.keys(V)){let se=L(Y,y)[Y];if(se===void 0||(Array.isArray(V[Y])?!V[Y].includes(se):V[Y]!==se)){K=!1;break}}if(!K)continue}for(let K of O)w[K]=w[K]||[],w[K].push([B,T])}return w};if(!en(r)||!d){let y={};if(typeof p=="object"&&!en(p))for(let w of Object.keys(p))y[w]=O=>{var B,T;return Fs(p[w],z(w,O),((B=Z(O))!=null?B:[])[w],((T=$(O))!=null?T:[])[w],O==null?void 0:O.class,O==null?void 0:O.className)(a)};return y}return Fs(c,v(),M(),b==null?void 0:b.class,b==null?void 0:b.className)(a)},g=()=>{if(!(!u||typeof u!="object"))return Object.keys(u)};return m.variantKeys=g(),m.extend=t,m.base=c,m.slots=p,m.variants=u,m.defaultVariants=f,m.compoundSlots=o,m.compoundVariants=s,m};const Yp=ZE({base:"inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});/** +*/function gp(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bp(n){for(var e=1;e0){var r=e[e.length-1];r!==t&&r.pause()}var i=e.indexOf(t);i===-1||e.splice(i,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},Q_=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Z_=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},Ys=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},eA=function(e){return Ys(e)&&!e.shiftKey},tA=function(e){return Ys(e)&&e.shiftKey},vp=function(e){return setTimeout(e,0)},wp=function(e,t){var r=-1;return e.every(function(i,s){return t(i)?(r=s,!1):!0}),r},Is=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?O-1:0),T=1;T=0)y=r.activeElement;else{var w=o.tabbableGroups[0],O=w&&w.firstTabbableNode;y=O||u("fallbackFocus")}if(!y)throw new Error("Your focus-trap needs to have at least one focusable element");return y},d=function(){if(o.containerGroups=o.containers.map(function(y){var w=K_(y,s.tabbableOptions),O=q_(y,s.tabbableOptions),B=w.length>0?w[0]:void 0,T=w.length>0?w[w.length-1]:void 0,V=O.find(function(se){return zi(se)}),K=O.slice().reverse().find(function(se){return zi(se)}),Y=!!w.find(function(se){return ni(se)>0});return{container:y,tabbableNodes:w,focusableNodes:O,posTabIndexesFound:Y,firstTabbableNode:B,lastTabbableNode:T,firstDomTabbableNode:V,lastDomTabbableNode:K,nextTabbableNode:function(ge){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,me=w.indexOf(ge);return me<0?we?O.slice(O.indexOf(ge)+1).find(function(qe){return zi(qe)}):O.slice(0,O.indexOf(ge)).reverse().find(function(qe){return zi(qe)}):w[me+(we?1:-1)]}}}),o.tabbableGroups=o.containerGroups.filter(function(y){return y.tabbableNodes.length>0}),o.tabbableGroups.length<=0&&!u("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find(function(y){return y.posTabIndexesFound})&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function $(y){var w=y.activeElement;if(w)return w.shadowRoot&&w.shadowRoot.activeElement!==null?$(w.shadowRoot):w},p=function $(y){if(y!==!1&&y!==h(document)){if(!y||!y.focus){$(f());return}y.focus({preventScroll:!!s.preventScroll}),o.mostRecentlyFocusedNode=y,Q_(y)&&y.select()}},m=function(y){var w=u("setReturnFocus",y);return w||(w===!1?!1:y)},g=function(y){var w=y.target,O=y.event,B=y.isBackward,T=B===void 0?!1:B;w=w||tl(O),d();var V=null;if(o.tabbableGroups.length>0){var K=c(w,O),Y=K>=0?o.containerGroups[K]:void 0;if(K<0)T?V=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:V=o.tabbableGroups[0].firstTabbableNode;else if(T){var se=wp(o.tabbableGroups,function(et){var Qe=et.firstTabbableNode;return w===Qe});if(se<0&&(Y.container===w||jc(w,s.tabbableOptions)&&!zi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w,!1))&&(se=K),se>=0){var ge=se===0?o.tabbableGroups.length-1:se-1,we=o.tabbableGroups[ge];V=ni(w)>=0?we.lastTabbableNode:we.lastDomTabbableNode}else Ys(O)||(V=Y.nextTabbableNode(w,!1))}else{var me=wp(o.tabbableGroups,function(et){var Qe=et.lastTabbableNode;return w===Qe});if(me<0&&(Y.container===w||jc(w,s.tabbableOptions)&&!zi(w,s.tabbableOptions)&&!Y.nextTabbableNode(w))&&(me=K),me>=0){var qe=me===o.tabbableGroups.length-1?0:me+1,Be=o.tabbableGroups[qe];V=ni(w)>=0?Be.firstTabbableNode:Be.firstDomTabbableNode}else Ys(O)||(V=Y.nextTabbableNode(w))}}else V=u("fallbackFocus");return V},b=function(y){var w=tl(y);if(!(c(w,y)>=0)){if(Is(s.clickOutsideDeactivates,y)){l.deactivate({returnFocus:s.returnFocusOnDeactivate});return}Is(s.allowOutsideClick,y)||y.preventDefault()}},_=function(y){var w=tl(y),O=c(w,y)>=0;if(O||w instanceof Document)O&&(o.mostRecentlyFocusedNode=w);else{y.stopImmediatePropagation();var B,T=!0;if(o.mostRecentlyFocusedNode)if(ni(o.mostRecentlyFocusedNode)>0){var V=c(o.mostRecentlyFocusedNode),K=o.containerGroups[V].tabbableNodes;if(K.length>0){var Y=K.findIndex(function(se){return se===o.mostRecentlyFocusedNode});Y>=0&&(s.isKeyForward(o.recentNavEvent)?Y+1=0&&(B=K[Y-1],T=!1))}}else o.containerGroups.some(function(se){return se.tabbableNodes.some(function(ge){return ni(ge)>0})})||(T=!1);else T=!1;T&&(B=g({target:o.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(o.recentNavEvent)})),p(B||o.mostRecentlyFocusedNode||f())}o.recentNavEvent=void 0},E=function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;o.recentNavEvent=y;var O=g({event:y,isBackward:w});O&&(Ys(y)&&y.preventDefault(),p(O))},v=function(y){if(Z_(y)&&Is(s.escapeDeactivates,y)!==!1){y.preventDefault(),l.deactivate();return}(s.isKeyForward(y)||s.isKeyBackward(y))&&E(y,s.isKeyBackward(y))},z=function(y){var w=tl(y);c(w,y)>=0||Is(s.clickOutsideDeactivates,y)||Is(s.allowOutsideClick,y)||(y.preventDefault(),y.stopImmediatePropagation())},C=function(){if(o.active)return yp.activateTrap(i,l),o.delayInitialFocusTimer=s.delayInitialFocus?vp(function(){p(f())}):p(f()),r.addEventListener("focusin",_,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",z,{capture:!0,passive:!1}),r.addEventListener("keydown",v,{capture:!0,passive:!1}),l},L=function(){if(o.active)return r.removeEventListener("focusin",_,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",z,!0),r.removeEventListener("keydown",v,!0),l},F=function(y){var w=y.some(function(O){var B=Array.from(O.removedNodes);return B.some(function(T){return T===o.mostRecentlyFocusedNode})});w&&p(f())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(F):void 0,Z=function(){M&&(M.disconnect(),o.active&&!o.paused&&o.containers.map(function(y){M.observe(y,{subtree:!0,childList:!0})}))};return l={get active(){return o.active},get paused(){return o.paused},activate:function(y){if(o.active)return this;var w=a(y,"onActivate"),O=a(y,"onPostActivate"),B=a(y,"checkCanFocusTrap");B||d(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,w==null||w();var T=function(){B&&d(),C(),Z(),O==null||O()};return B?(B(o.containers.concat()).then(T,T),this):(T(),this)},deactivate:function(y){if(!o.active)return this;var w=bp({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},y);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,L(),o.active=!1,o.paused=!1,Z(),yp.deactivateTrap(i,l);var O=a(w,"onDeactivate"),B=a(w,"onPostDeactivate"),T=a(w,"checkCanReturnFocus"),V=a(w,"returnFocus","returnFocusOnDeactivate");O==null||O();var K=function(){vp(function(){V&&p(m(o.nodeFocusedBeforeActivation)),B==null||B()})};return V&&T?(T(m(o.nodeFocusedBeforeActivation)).then(K,K),this):(K(),this)},pause:function(y){if(o.paused||!o.active)return this;var w=a(y,"onPause"),O=a(y,"onPostPause");return o.paused=!0,w==null||w(),L(),Z(),O==null||O(),this},unpause:function(y){if(!o.paused||!o.active)return this;var w=a(y,"onUnpause"),O=a(y,"onPostUnpause");return o.paused=!1,w==null||w(),d(),C(),Z(),O==null||O(),this},updateContainerElements:function(y){var w=[].concat(y).filter(Boolean);return o.containers=w.map(function(O){return typeof O=="string"?r.querySelector(O):O}),o.active&&d(),Z(),this}},l.updateContainerElements(e),l};function iA(n={}){let e;const{immediate:t,...r}=n,i=is(!1),s=is(!1),o=f=>e==null?void 0:e.activate(f),l=f=>{e==null||e.deactivate(f)},a=()=>{e&&(e.pause(),s.set(!0))},c=()=>{e&&(e.unpause(),s.set(!1))};return{useFocusTrap:f=>(e=rA(f,{...r,onActivate(){var d;i.set(!0),(d=n.onActivate)==null||d.call(n)},onDeactivate(){var d;i.set(!1),(d=n.onDeactivate)==null||d.call(n)}}),t&&o(),{destroy(){l(),e=void 0}}),hasFocus:nh(i),isPaused:nh(s),activate:o,deactivate:l,pause:a,unpause:c}}const sA=(n,e="body")=>{let t;if(!Vr(e)&&typeof e!="string")return{destroy:gt};async function r(s){if(e=s,typeof e=="string"){if(t=document.querySelector(e),t===null&&(await Nf(),t=document.querySelector(e)),t===null)throw new Error(`No element found matching css selector: "${e}"`)}else if(e instanceof HTMLElement)t=e;else throw new TypeError(`Unknown portal target type: ${e===null?"null":typeof e}. Allowed types: string (CSS selector) or HTMLElement.`);n.dataset.portal="",t.appendChild(n),n.hidden=!1}function i(){n.remove()}return r(e),{update:r,destroy:i}};function oA(){return{elements:{root:_r("label",{action:e=>({destroy:js(e,"mousedown",r=>{!r.defaultPrevented&&r.detail>1&&r.preventDefault()})})})}}}const{name:Qr}=o_("dialog"),lA={preventScroll:!0,closeOnEscape:!0,closeOnOutsideClick:!0,role:"dialog",defaultOpen:!1,portal:"body",forceVisible:!1,openFocus:void 0,closeFocus:void 0,onOutsideClick:void 0},Wc=is([]),aA=["content","title","description"];function cA(n){const e={...lA,...n},t=dp(d_(e,"ids")),{preventScroll:r,closeOnEscape:i,closeOnOutsideClick:s,role:o,portal:l,forceVisible:a,openFocus:c,closeFocus:u,onOutsideClick:f}=t,d=is(null),h=dp({...b_(aA),...e.ids}),p=e.open??is(e.defaultOpen),m=h_(p,e==null?void 0:e.onOpenChange),g=Ka([m,a],([$,y])=>$||y);let b=gt;function _($){const y=$.currentTarget,w=$.currentTarget;!Vr(y)||!Vr(w)||(m.set(!0),d.set(w))}function E(){m.set(!1),hp({prop:Jt(u),defaultEl:Jt(d)})}Ar([m],([$])=>{ry(100).then(()=>{$?Wc.update(y=>(y.push(Jt(h.content)),y)):Wc.update(y=>y.filter(w=>w!==Jt(h.content)))})});const v=_r(Qr("trigger"),{stores:[m],returned:([$])=>({"aria-haspopup":"dialog","aria-expanded":$,type:"button"}),action:$=>({destroy:vl(js($,"click",w=>{_(w)}),js($,"keydown",w=>{w.key!==Ws.ENTER&&w.key!==Ws.SPACE||(w.preventDefault(),_(w))}))})}),z=_r(Qr("overlay"),{stores:[g],returned:([$])=>({hidden:$?void 0:!0,tabindex:-1,style:Hu({display:$?void 0:"none"}),"aria-hidden":!0,"data-state":$?"open":"closed"}),action:$=>{let y=gt;if(Jt(i)){const w=pp($,{handler:()=>{E()}});w&&w.destroy&&(y=w.destroy)}return{destroy(){y()}}}}),C=_r(Qr("content"),{stores:[g,h.content,h.description,h.title],returned:([$,y,w,O])=>({id:y,role:Jt(o),"aria-describedby":w,"aria-labelledby":O,"aria-modal":$?"true":void 0,"data-state":$?"open":"closed",tabindex:-1,hidden:$?void 0:!0,style:Hu({display:$?void 0:"none"})}),action:$=>{let y=gt,w=gt;const O=vl(Ar([m],([B])=>{if(!B)return;const T=iA({immediate:!1,escapeDeactivates:!0,clickOutsideDeactivates:!0,returnFocusOnDeactivate:!1,fallbackFocus:$});y=T.activate,w=T.deactivate;const V=T.useFocusTrap($);return V&&V.destroy?V.destroy:T.deactivate}),Ar([s,m],([B,T])=>$_($,{enabled:T,handler:V=>{var se;if((se=Jt(f))==null||se(V),V.defaultPrevented)return;const K=Jt(Wc),Y=s_(K)===Jt(h.content);B&&Y&&E()}}).destroy),Ar([i],([B])=>{if(!B)return gt;const T=pp($,{handler:()=>{E()}});return T&&T.destroy?T.destroy:gt}),Ar([g],([B])=>{Nf().then(()=>{B?y():w()})}));return{destroy:()=>{b(),O()}}}}),L=_r(Qr("portalled"),{stores:l,returned:$=>({"data-portal":$?"":void 0}),action:$=>{const y=Ar([l],([w])=>{if(!w)return gt;const O=M_($,w);if(O===null)return gt;const B=sA($,O);return B&&B.destroy?B.destroy:gt});return{destroy(){y()}}}}),F=_r(Qr("title"),{stores:[h.title],returned:([$])=>({id:$})}),M=_r(Qr("description"),{stores:[h.description],returned:([$])=>({id:$})}),Z=_r(Qr("close"),{returned:()=>({type:"button"}),action:$=>({destroy:vl(js($,"click",()=>{E()}),js($,"keydown",w=>{w.key!==Ws.SPACE&&w.key!==Ws.ENTER||(w.preventDefault(),E())}))})});return Ar([m,r],([$,y])=>{if(l_){if(y&&$&&(b=A_()),$){const w=document.getElementById(Jt(h.content));hp({prop:Jt(c),defaultEl:w})}return()=>{Jt(a)||b()}}}),{ids:h,elements:{content:C,trigger:v,title:F,description:M,overlay:z,close:Z,portalled:L},states:{open:m},options:t}}function hy(n,e){const t={};return e.forEach(r=>{t[r]={[`data-${n}-${r}`]:""}}),r=>t[r]}function td(){const n=K1();return e=>{const{originalEvent:t}=e.detail,{cancelable:r}=e,i=t.type;n(i,{originalEvent:t,currentTarget:t.currentTarget},{cancelable:r})||e.preventDefault()}}function uA(n){const e={};for(const t in n){const r=n[t];r!==void 0&&(e[t]=r)}return e}function fA(n){return function(e,t){if(t===void 0)return;const r=n[e];r&&r.set(t)}}function dA(n,e){const t=[];return e.builders.forEach(r=>{const i=r.action(n);i&&t.push(i)}),{destroy:()=>{t.forEach(r=>{r.destroy&&r.destroy()})}}}function kp(n){const e={};return n.forEach(t=>{Object.keys(t).forEach(r=>{r!=="action"&&(e[r]=t[r])})}),e}function hA(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&Kc(n);return{c(){i&&i.c(),t=Ke()},l(s){i&&i.l(s),t=Ke()},m(s,o){i&&i.m(s,o),oe(s,t,o),r=!0},p(s,o){s[1],e?ae(e,s[1]?"a":"button")?(i.d(1),i=Kc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=Kc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function pA(n){let e=n[1]?"a":"button",t,r,i=(n[1]?"a":"button")&&qc(n);return{c(){i&&i.c(),t=Ke()},l(s){i&&i.l(s),t=Ke()},m(s,o){i&&i.m(s,o),oe(s,t,o),r=!0},p(s,o){s[1],e?ae(e,s[1]?"a":"button")?(i.d(1),i=qc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=qc(s),e=s[1]?"a":"button",i.c(),i.m(t.parentNode,t))},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function Kc(n){let e,t,r,i,s;const o=n[7].default,l=te(o,n,n[6],null);let a=[{type:t=n[1]?void 0:n[2]},{href:n[1]},{tabindex:"0"},n[5],n[4]],c={};for(let u=0;u{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function gA(n,e,t){const r=["href","type","builders","el"];let i=Te(e,r),{$$slots:s={},$$scope:o}=e,{href:l=void 0}=e,{type:a=void 0}=e,{builders:c=[]}=e,{el:u=void 0}=e;const f={"data-button-root":""};function d(M){pe.call(this,n,M)}function h(M){pe.call(this,n,M)}function p(M){pe.call(this,n,M)}function m(M){pe.call(this,n,M)}function g(M){pe.call(this,n,M)}function b(M){pe.call(this,n,M)}function _(M){pe.call(this,n,M)}function E(M){pe.call(this,n,M)}function v(M){pe.call(this,n,M)}function z(M){pe.call(this,n,M)}function C(M){pe.call(this,n,M)}function L(M){pe.call(this,n,M)}function F(M){rt[M?"unshift":"push"](()=>{u=M,t(0,u)})}return n.$$set=M=>{e=A(A({},e),J(M)),t(5,i=Te(e,r)),"href"in M&&t(1,l=M.href),"type"in M&&t(2,a=M.type),"builders"in M&&t(3,c=M.builders),"el"in M&&t(0,u=M.el),"$$scope"in M&&t(6,o=M.$$scope)},[u,l,a,c,f,i,o,s,d,h,p,m,g,b,_,E,v,z,C,L,F]}let bA=class extends ue{constructor(e){super(),fe(this,e,gA,mA,ae,{href:1,type:2,builders:3,el:0})}};function py(){return{NAME:"dialog",PARTS:["close","content","description","overlay","portal","title","trigger"]}}function yA(n){const{NAME:e,PARTS:t}=py(),r=hy(e,t),i={...cA({...uA(n),role:"dialog",forceVisible:!0}),getAttrs:r};return J1(e,i),{...i,updateOption:fA(i.options)}}function $i(){const{NAME:n}=py();return G1(n)}const vA=n=>({ids:n&1}),Sp=n=>({ids:n[0]});function wA(n){let e;const t=n[12].default,r=te(t,n,n[11],Sp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,[s]){r&&r.p&&(!e||s&2049)&&ne(r,t,i,i[11],e?ie(t,i[11],s,vA):re(i[11]),Sp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function kA(n,e,t){let r,{$$slots:i={},$$scope:s}=e,{preventScroll:o=void 0}=e,{closeOnEscape:l=void 0}=e,{closeOnOutsideClick:a=void 0}=e,{portal:c=void 0}=e,{open:u=void 0}=e,{onOpenChange:f=void 0}=e,{openFocus:d=void 0}=e,{closeFocus:h=void 0}=e,{onOutsideClick:p=void 0}=e;const{states:{open:m},updateOption:g,ids:b}=yA({closeOnEscape:l,preventScroll:o,closeOnOutsideClick:a,portal:c,forceVisible:!0,defaultOpen:u,openFocus:d,closeFocus:h,onOutsideClick:p,onOpenChange:({next:E})=>(u!==E&&(f==null||f(E),t(2,u=E)),E)}),_=Ka([b.content,b.description,b.title],([E,v,z])=>({content:E,description:v,title:z}));return Mn(n,_,E=>t(0,r=E)),n.$$set=E=>{"preventScroll"in E&&t(3,o=E.preventScroll),"closeOnEscape"in E&&t(4,l=E.closeOnEscape),"closeOnOutsideClick"in E&&t(5,a=E.closeOnOutsideClick),"portal"in E&&t(6,c=E.portal),"open"in E&&t(2,u=E.open),"onOpenChange"in E&&t(7,f=E.onOpenChange),"openFocus"in E&&t(8,d=E.openFocus),"closeFocus"in E&&t(9,h=E.closeFocus),"onOutsideClick"in E&&t(10,p=E.onOutsideClick),"$$scope"in E&&t(11,s=E.$$scope)},n.$$.update=()=>{n.$$.dirty&4&&u!==void 0&&m.set(u),n.$$.dirty&8&&g("preventScroll",o),n.$$.dirty&16&&g("closeOnEscape",l),n.$$.dirty&32&&g("closeOnOutsideClick",a),n.$$.dirty&64&&g("portal",c),n.$$.dirty&256&&g("openFocus",d),n.$$.dirty&512&&g("closeFocus",h),n.$$.dirty&1024&&g("onOutsideClick",p)},[r,_,u,o,l,a,c,f,d,h,p,s,i]}class SA extends ue{constructor(e){super(),fe(this,e,kA,wA,ae,{preventScroll:3,closeOnEscape:4,closeOnOutsideClick:5,portal:6,open:2,onOpenChange:7,openFocus:8,closeFocus:9,onOutsideClick:10})}}const CA=n=>({builder:n&8}),Cp=n=>({builder:n[3]}),_A=n=>({builder:n&8}),_p=n=>({builder:n[3]});function AA(n){let e=n[1],t,r,i=n[1]&&Jc(n);return{c(){i&&i.c(),t=Ke()},l(s){i&&i.l(s),t=Ke()},m(s,o){i&&i.m(s,o),oe(s,t,o),r=!0},p(s,o){s[1]?e?ae(e,s[1])?(i.d(1),i=Jc(s),e=s[1],i.c(),i.m(t.parentNode,t)):i.p(s,o):(i=Jc(s),e=s[1],i.c(),i.m(t.parentNode,t)):e&&(i.d(1),i=null,e=s[1])},i(s){r||(k(i,s),r=!0)},o(s){S(i,s),r=!1},d(s){s&&j(t),i&&i.d(s)}}}function TA(n){let e;const t=n[9].default,r=te(t,n,n[8],_p);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&264)&&ne(r,t,i,i[8],e?ie(t,i[8],s,_A):re(i[8]),_p)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function Jc(n){let e,t,r,i;const s=n[9].default,o=te(s,n,n[8],Cp);let l=[n[3],n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function MA(n,e,t){let r;const i=["level","asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{level:c="h2"}=e,{asChild:u=!1}=e,{id:f=void 0}=e,{el:d=void 0}=e;const{elements:{title:h},ids:p,getAttrs:m}=$i();Mn(n,h,_=>t(7,o=_));const g=m("title");function b(_){rt[_?"unshift":"push"](()=>{d=_,t(0,d)})}return n.$$set=_=>{e=A(A({},e),J(_)),t(5,s=Te(e,i)),"level"in _&&t(1,c=_.level),"asChild"in _&&t(2,u=_.asChild),"id"in _&&t(6,f=_.id),"el"in _&&t(0,d=_.el),"$$scope"in _&&t(8,a=_.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&f&&p.title.set(f),n.$$.dirty&128&&t(3,r=o),n.$$.dirty&8&&Object.assign(r,g)},[d,c,u,r,h,s,f,o,a,l,b]}let OA=class extends ue{constructor(e){super(),fe(this,e,MA,EA,ae,{level:1,asChild:2,id:6,el:0})}};const $A=n=>({builder:n&4}),Ap=n=>({builder:n[2]}),NA=n=>({builder:n&4}),Tp=n=>({builder:n[2]});function DA(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],Ap);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function RA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{close:f},getAttrs:d}=$i();Mn(n,f,g=>t(6,o=g));const h=td(),p=d("close");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=A(A({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class PA extends ue{constructor(e){super(),fe(this,e,RA,IA,ae,{asChild:1,el:0})}}const LA=n=>({builder:n&4}),Ep=n=>({builder:n[2]}),BA=n=>({builder:n&4}),Mp=n=>({builder:n[2]});function FA(n){let e,t,r,i;const s=n[7].default,o=te(s,n,n[6],Ep);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function HA(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{portalled:f},getAttrs:d}=$i();Mn(n,f,m=>t(5,o=m));const h=d("portal");function p(m){rt[m?"unshift":"push"](()=>{u=m,t(0,u)})}return n.$$set=m=>{e=A(A({},e),J(m)),t(4,s=Te(e,i)),"asChild"in m&&t(1,c=m.asChild),"el"in m&&t(0,u=m.el),"$$scope"in m&&t(6,a=m.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,h)},[u,c,r,f,s,o,a,l,p]}let UA=class extends ue{constructor(e){super(),fe(this,e,HA,VA,ae,{asChild:1,el:0})}};const jA=n=>({builder:n[0]&256}),Op=n=>({builder:n[8]}),WA=n=>({builder:n[0]&256}),$p=n=>({builder:n[8]}),KA=n=>({builder:n[0]&256}),Np=n=>({builder:n[8]}),qA=n=>({builder:n[0]&256}),Dp=n=>({builder:n[8]}),JA=n=>({builder:n[0]&256}),xp=n=>({builder:n[8]}),GA=n=>({builder:n[0]&256}),Ip=n=>({builder:n[8]});function YA(n){let e,t,r,i;const s=n[16].default,o=te(s,n,n[15],Op);let l=[n[8],n[12]],a={};for(let c=0;c{t=Wa(e,n[3],n[4]),t.start()})),r=!0)},o(u){S(l,u),r=!1},d(u){u&&j(e),l&&l.d(u),n[34](null),i=!1,It(s)}}}function ZA(n){let e,t,r,i,s,o;const l=n[16].default,a=te(l,n,n[15],Dp);let c=[n[8],n[12]],u={};for(let f=0;f{i&&(r&&r.end(1),t=Wa(e,n[3],n[4]),t.start())}),i=!0)},o(f){S(a,f),t&&t.invalidate(),f&&(r=ja(e,n[5],n[6])),i=!1},d(f){f&&j(e),a&&a.d(f),n[33](null),f&&r&&r.end(),s=!1,It(o)}}}function eT(n){let e,t,r,i,s;const o=n[16].default,l=te(o,n,n[15],xp);let a=[n[8],n[12]],c={};for(let u=0;u{r&&(t||(t=Il(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(u){S(l,u),u&&(t||(t=Il(e,n[1],n[2],!1)),t.run(0)),r=!1},d(u){u&&j(e),l&&l.d(u),n[32](null),u&&t&&t.end(),i=!1,It(s)}}}function tT(n){let e;const t=n[16].default,r=te(t,n,n[15],Ip);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s[0]&33024)&&ne(r,t,i,i[15],e?ie(t,i[15],s,GA):re(i[15]),Ip)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function nT(n){let e,t,r,i;const s=[tT,eT,ZA,QA,XA,YA],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=Ke()},l(a){t&&t.l(a),r=Ke()},m(a,c){~e&&o[e].m(a,c),oe(a,r,c),i=!0},p(a,c){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(On(),S(o[u],1,1,()=>{o[u]=null}),$n()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function rT(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","id","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{id:b=void 0}=e,{el:_=void 0}=e;const{elements:{content:E},states:{open:v},ids:z,getAttrs:C}=$i();Mn(n,E,W=>t(14,o=W)),Mn(n,v,W=>t(9,l=W));const L=C("content");function F(W){pe.call(this,n,W)}function M(W){pe.call(this,n,W)}function Z(W){pe.call(this,n,W)}function $(W){pe.call(this,n,W)}function y(W){pe.call(this,n,W)}function w(W){pe.call(this,n,W)}function O(W){pe.call(this,n,W)}function B(W){pe.call(this,n,W)}function T(W){pe.call(this,n,W)}function V(W){pe.call(this,n,W)}function K(W){pe.call(this,n,W)}function Y(W){pe.call(this,n,W)}function se(W){pe.call(this,n,W)}function ge(W){pe.call(this,n,W)}function we(W){pe.call(this,n,W)}function me(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function qe(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function Be(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function et(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}function Qe(W){rt[W?"unshift":"push"](()=>{_=W,t(0,_)})}return n.$$set=W=>{e=A(A({},e),J(W)),t(12,s=Te(e,i)),"transition"in W&&t(1,u=W.transition),"transitionConfig"in W&&t(2,f=W.transitionConfig),"inTransition"in W&&t(3,d=W.inTransition),"inTransitionConfig"in W&&t(4,h=W.inTransitionConfig),"outTransition"in W&&t(5,p=W.outTransition),"outTransitionConfig"in W&&t(6,m=W.outTransitionConfig),"asChild"in W&&t(7,g=W.asChild),"id"in W&&t(13,b=W.id),"el"in W&&t(0,_=W.el),"$$scope"in W&&t(15,c=W.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&8192&&b&&z.content.set(b),n.$$.dirty[0]&16384&&t(8,r=o),n.$$.dirty[0]&256&&Object.assign(r,L)},[_,u,f,d,h,p,m,g,r,l,E,v,s,b,o,c,a,F,M,Z,$,y,w,O,B,T,V,K,Y,se,ge,we,me,qe,Be,et,Qe]}let iT=class extends ue{constructor(e){super(),fe(this,e,rT,nT,ae,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,id:13,el:0},null,[-1,-1])}};const sT=n=>({builder:n&256}),Rp=n=>({builder:n[8]});function oT(n){let e,t,r,i=[n[8],n[12]],s={};for(let o=0;o{t=Wa(e,n[3],n[4]),t.start()}))},o:Ce,d(l){l&&j(e),n[23](null),r=!1,It(i)}}}function cT(n){let e,t,r,i,s,o,l=[n[8],n[12]],a={};for(let c=0;c{i&&(r&&r.end(1),t=Wa(e,n[3],n[4]),t.start())}),i=!0)},o(c){t&&t.invalidate(),c&&(r=ja(e,n[5],n[6])),i=!1},d(c){c&&j(e),n[22](null),c&&r&&r.end(),s=!1,It(o)}}}function uT(n){let e,t,r,i,s,o=[n[8],n[12]],l={};for(let a=0;a{r&&(t||(t=Il(e,n[1],n[2],!0)),t.run(1))}),r=!0)},o(a){a&&(t||(t=Il(e,n[1],n[2],!1)),t.run(0)),r=!1},d(a){a&&j(e),n[21](null),a&&t&&t.end(),i=!1,It(s)}}}function fT(n){let e;const t=n[15].default,r=te(t,n,n[14],Rp);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&16640)&&ne(r,t,i,i[14],e?ie(t,i[14],s,sT):re(i[14]),Rp)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function dT(n){let e,t,r,i;const s=[fT,uT,cT,aT,lT,oT],o=[];function l(a,c){return a[7]&&a[9]?0:a[1]&&a[9]?1:a[3]&&a[5]&&a[9]?2:a[3]&&a[9]?3:a[5]&&a[9]?4:a[9]?5:-1}return~(e=l(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),r=Ke()},l(a){t&&t.l(a),r=Ke()},m(a,c){~e&&o[e].m(a,c),oe(a,r,c),i=!0},p(a,[c]){let u=e;e=l(a),e===u?~e&&o[e].p(a,c):(t&&(On(),S(o[u],1,1,()=>{o[u]=null}),$n()),~e?(t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r)):t=null)},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),~e&&o[e].d(a)}}}function hT(n,e,t){let r;const i=["transition","transitionConfig","inTransition","inTransitionConfig","outTransition","outTransitionConfig","asChild","el"];let s=Te(e,i),o,l,{$$slots:a={},$$scope:c}=e,{transition:u=void 0}=e,{transitionConfig:f=void 0}=e,{inTransition:d=void 0}=e,{inTransitionConfig:h=void 0}=e,{outTransition:p=void 0}=e,{outTransitionConfig:m=void 0}=e,{asChild:g=!1}=e,{el:b=void 0}=e;const{elements:{overlay:_},states:{open:E},getAttrs:v}=$i();Mn(n,_,T=>t(13,o=T)),Mn(n,E,T=>t(9,l=T));const z=v("overlay");function C(T){pe.call(this,n,T)}function L(T){pe.call(this,n,T)}function F(T){pe.call(this,n,T)}function M(T){pe.call(this,n,T)}function Z(T){pe.call(this,n,T)}function $(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function y(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function w(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function O(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}function B(T){rt[T?"unshift":"push"](()=>{b=T,t(0,b)})}return n.$$set=T=>{e=A(A({},e),J(T)),t(12,s=Te(e,i)),"transition"in T&&t(1,u=T.transition),"transitionConfig"in T&&t(2,f=T.transitionConfig),"inTransition"in T&&t(3,d=T.inTransition),"inTransitionConfig"in T&&t(4,h=T.inTransitionConfig),"outTransition"in T&&t(5,p=T.outTransition),"outTransitionConfig"in T&&t(6,m=T.outTransitionConfig),"asChild"in T&&t(7,g=T.asChild),"el"in T&&t(0,b=T.el),"$$scope"in T&&t(14,c=T.$$scope)},n.$$.update=()=>{n.$$.dirty&8192&&t(8,r=o),n.$$.dirty&256&&Object.assign(r,z)},[b,u,f,d,h,p,m,g,r,l,_,E,s,o,c,a,C,L,F,M,Z,$,y,w,O,B]}let pT=class extends ue{constructor(e){super(),fe(this,e,hT,dT,ae,{transition:1,transitionConfig:2,inTransition:3,inTransitionConfig:4,outTransition:5,outTransitionConfig:6,asChild:7,el:0})}};const mT=n=>({builder:n&4}),Pp=n=>({builder:n[2]}),gT=n=>({builder:n&4}),Lp=n=>({builder:n[2]});function bT(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],Pp);let l=[n[2],{type:"button"},n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function wT(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{trigger:f},getAttrs:d}=$i();Mn(n,f,g=>t(6,o=g));const h=td(),p=d("trigger");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=A(A({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,h,s,o,a,l,m]}class kT extends ue{constructor(e){super(),fe(this,e,wT,vT,ae,{asChild:1,el:0})}}const ST=n=>({builder:n&4}),Bp=n=>({builder:n[2]}),CT=n=>({builder:n&4}),Fp=n=>({builder:n[2]});function _T(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],Bp);let l=[n[2],n[4]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function ET(n,e,t){let r;const i=["asChild","id","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{id:u=void 0}=e,{el:f=void 0}=e;const{elements:{description:d},ids:h,getAttrs:p}=$i();Mn(n,d,b=>t(6,o=b));const m=p("description");function g(b){rt[b?"unshift":"push"](()=>{f=b,t(0,f)})}return n.$$set=b=>{e=A(A({},e),J(b)),t(4,s=Te(e,i)),"asChild"in b&&t(1,c=b.asChild),"id"in b&&t(5,u=b.id),"el"in b&&t(0,f=b.el),"$$scope"in b&&t(7,a=b.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&u&&h.description.set(u),n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,m)},[f,c,r,d,s,u,o,a,l,g]}let MT=class extends ue{constructor(e){super(),fe(this,e,ET,TT,ae,{asChild:1,id:5,el:0})}};function OT(){const n="label",t=hy(n,["root"]);return{NAME:n,getAttrs:t}}const $T=n=>({builder:n&4}),zp=n=>({builder:n[2]}),NT=n=>({builder:n&4}),Vp=n=>({builder:n[2]});function DT(n){let e,t,r,i;const s=n[8].default,o=te(s,n,n[7],zp);let l=[n[2],n[5]],a={};for(let c=0;c{o[u]=null}),$n(),t=o[e],t?t.p(a,c):(t=o[e]=s[e](a),t.c()),k(t,1),t.m(r.parentNode,r))},i(a){i||(k(t),i=!0)},o(a){S(t),i=!1},d(a){a&&j(r),o[e].d(a)}}}function RT(n,e,t){let r;const i=["asChild","el"];let s=Te(e,i),o,{$$slots:l={},$$scope:a}=e,{asChild:c=!1}=e,{el:u=void 0}=e;const{elements:{root:f}}=oA();Mn(n,f,g=>t(6,o=g));const d=td(),{getAttrs:h}=OT(),p=h("root");function m(g){rt[g?"unshift":"push"](()=>{u=g,t(0,u)})}return n.$$set=g=>{e=A(A({},e),J(g)),t(5,s=Te(e,i)),"asChild"in g&&t(1,c=g.asChild),"el"in g&&t(0,u=g.el),"$$scope"in g&&t(7,a=g.$$scope)},n.$$.update=()=>{n.$$.dirty&64&&t(2,r=o),n.$$.dirty&4&&Object.assign(r,p)},[u,c,r,f,d,s,o,a,l,m]}let PT=class extends ue{constructor(e){super(),fe(this,e,RT,IT,ae,{asChild:1,el:0})}};function my(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;el(s)))==null?void 0:o.classGroupId}const Hp=/^\[(.+)\]$/;function FT(n){if(Hp.test(n)){const e=Hp.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}}function zT(n){const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return HT(Object.entries(n.classGroups),t).forEach(([s,o])=>{ju(o,r,s,e)}),r}function ju(n,e,t,r){n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Up(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(VT(i)){ju(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{ju(o,Up(e,s),t,r)})})}function Up(n,e){let t=n;return e.split(nd).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t}function VT(n){return n.isThemeGetter}function HT(n,e){return e?n.map(([t,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[e+o,l])):s);return[t,i]}):n}function UT(n){if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;function i(s,o){t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)}return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}}const by="!";function jT(n){const e=n.separator,t=e.length===1,r=e[0],i=e.length;return function(o){const l=[];let a=0,c=0,u;for(let m=0;mc?u-c:void 0;return{modifiers:l,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}}}function WT(n){if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e}function KT(n){return{cache:UT(n.cacheSize),splitModifiers:jT(n),...BT(n)}}const qT=/\s+/;function JT(n,e){const{splitModifiers:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=new Set;return n.trim().split(qT).map(o=>{const{modifiers:l,hasImportantModifier:a,baseClassName:c,maybePostfixModifierPosition:u}=t(o);let f=r(u?c.substring(0,u):c),d=!!u;if(!f){if(!u)return{isTailwindClass:!1,originalClassName:o};if(f=r(c),!f)return{isTailwindClass:!1,originalClassName:o};d=!1}const h=WT(l).join(":");return{isTailwindClass:!0,modifierId:a?h+by:h,classGroupId:f,originalClassName:o,hasPostfixModifier:d}}).reverse().filter(o=>{if(!o.isTailwindClass)return!0;const{modifierId:l,classGroupId:a,hasPostfixModifier:c}=o,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(f=>s.add(l+f)),!0)}).reverse().map(o=>o.originalClassName).join(" ")}function GT(){let n=0,e,t,r="";for(;nf(u),n());return t=KT(c),r=t.cache.get,i=t.cache.set,s=l,l(a)}function l(a){const c=r(a);if(c)return c;const u=JT(a,t);return i(a,u),u}return function(){return s(GT.apply(null,arguments))}}function Ye(n){const e=t=>t[n]||[];return e.isThemeGetter=!0,e}const vy=/^\[(?:([a-z-]+):)?(.+)\]$/i,XT=/^\d+\/\d+$/,QT=new Set(["px","full","screen"]),ZT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function ir(n){return oi(n)||QT.has(n)||XT.test(n)}function yr(n){return _s(n,"length",fE)}function oi(n){return!!n&&!Number.isNaN(Number(n))}function nl(n){return _s(n,"number",oi)}function Rs(n){return!!n&&Number.isInteger(Number(n))}function iE(n){return n.endsWith("%")&&oi(n.slice(0,-1))}function ke(n){return vy.test(n)}function vr(n){return ZT.test(n)}const sE=new Set(["length","size","percentage"]);function oE(n){return _s(n,sE,wy)}function lE(n){return _s(n,"position",wy)}const aE=new Set(["image","url"]);function cE(n){return _s(n,aE,hE)}function uE(n){return _s(n,"",dE)}function Ps(){return!0}function _s(n,e,t){const r=vy.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1}function fE(n){return eE.test(n)&&!tE.test(n)}function wy(){return!1}function dE(n){return nE.test(n)}function hE(n){return rE.test(n)}function pE(){const n=Ye("colors"),e=Ye("spacing"),t=Ye("blur"),r=Ye("brightness"),i=Ye("borderColor"),s=Ye("borderRadius"),o=Ye("borderSpacing"),l=Ye("borderWidth"),a=Ye("contrast"),c=Ye("grayscale"),u=Ye("hueRotate"),f=Ye("invert"),d=Ye("gap"),h=Ye("gradientColorStops"),p=Ye("gradientColorStopPositions"),m=Ye("inset"),g=Ye("margin"),b=Ye("opacity"),_=Ye("padding"),E=Ye("saturate"),v=Ye("scale"),z=Ye("sepia"),C=Ye("skew"),L=Ye("space"),F=Ye("translate"),M=()=>["auto","contain","none"],Z=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",ke,e],y=()=>[ke,e],w=()=>["",ir,yr],O=()=>["auto",oi,ke],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],K=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",ke],se=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ge=()=>[oi,nl],we=()=>[oi,ke];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[ir,yr],blur:["none","",vr,ke],brightness:ge(),borderColor:[n],borderRadius:["none","","full",vr,ke],borderSpacing:y(),borderWidth:w(),contrast:ge(),grayscale:Y(),hueRotate:we(),invert:Y(),gap:y(),gradientColorStops:[n],gradientColorStopPositions:[iE,yr],inset:$(),margin:$(),opacity:ge(),padding:y(),saturate:ge(),scale:ge(),sepia:Y(),skew:we(),space:y(),translate:y()},classGroups:{aspect:[{aspect:["auto","square","video",ke]}],container:["container"],columns:[{columns:[vr]}],"break-after":[{"break-after":se()}],"break-before":[{"break-before":se()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),ke]}],overflow:[{overflow:Z()}],"overflow-x":[{"overflow-x":Z()}],"overflow-y":[{"overflow-y":Z()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rs,ke]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ke]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",Rs,ke]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Rs,ke]},ke]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Rs,ke]},ke]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ke]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ke,e]}],"min-w":[{"min-w":[ke,e,"min","max","fit"]}],"max-w":[{"max-w":[ke,e,"none","full","min","max","fit","prose",{screen:[vr]},vr]}],h:[{h:[ke,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ke,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ke,e,"auto","min","max","fit"]}],"font-size":[{text:["base",vr,yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",nl]}],"font-family":[{font:[Ps]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ke]}],"line-clamp":[{"line-clamp":["none",oi,nl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ir,ke]}],"list-image":[{"list-image":["none",ke]}],"list-style-type":[{list:["none","disc","decimal",ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ir,yr]}],"underline-offset":[{"underline-offset":["auto",ir,ke]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),lE]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",oE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cE]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:T()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[ir,ke]}],"outline-w":[{outline:[ir,yr]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:w()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ir,yr]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",vr,uE]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":V()}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",vr,ke]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[E]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ke]}],duration:[{duration:we()}],ease:[{ease:["linear","in","out","in-out",ke]}],delay:[{delay:we()}],animate:[{animate:["none","spin","ping","pulse","bounce",ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[v]}],"scale-x":[{"scale-x":[v]}],"scale-y":[{"scale-y":[v]}],rotate:[{rotate:[Rs,ke]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ke]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[ir,yr,nl]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const mE=YT(pE);function gE(n){const e=n-1;return e*e*e+1}function _t(...n){return mE(LT(n))}const bE=(n,e={y:-8,x:0,start:.95,duration:150})=>{const t=getComputedStyle(n),r=t.transform==="none"?"":t.transform,i=(o,l,a)=>{const[c,u]=l,[f,d]=a;return(o-c)/(u-c)*(d-f)+f},s=o=>Object.keys(o).reduce((l,a)=>o[a]===void 0?l:l+`${a}:${o[a]};`,"");return{duration:e.duration??200,delay:0,css:o=>{const l=i(o,[0,1],[e.y??5,0]),a=i(o,[0,1],[e.x??0,0]),c=i(o,[0,1],[e.start??.95,1]);return s({transform:`${r} translate3d(${a}px, ${l}px, 0) scale(${c})`,opacity:o})},easing:gE}};function yE(n){let e;const t=n[5].default,r=te(t,n,n[8],null);return{c(){r&&r.c()},l(i){r&&r.l(i)},m(i,s){r&&r.m(i,s),e=!0},p(i,s){r&&r.p&&(!e||s&256)&&ne(r,t,i,i[8],e?ie(t,i[8],s,null):re(i[8]),null)},i(i){e||(k(r,i),e=!0)},o(i){S(r,i),e=!1},d(i){r&&r.d(i)}}}function vE(n){let e,t;const r=[{builders:n[3]},{class:_t(Yp({variant:n[1],size:n[2],className:n[0]}))},{type:"button"},n[4]];let i={$$slots:{default:[yE]},$$scope:{ctx:n}};for(let s=0;s{e=A(A({},e),J(h)),t(4,i=Te(e,r)),"class"in h&&t(0,l=h.class),"variant"in h&&t(1,a=h.variant),"size"in h&&t(2,c=h.size),"builders"in h&&t(3,u=h.builders),"$$scope"in h&&t(8,o=h.$$scope)},[l,a,c,u,i,s,f,d,o]}class Re extends ue{constructor(e){super(),fe(this,e,wE,vE,ae,{class:0,variant:1,size:2,builders:3})}}var jp=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,en=n=>!n||typeof n!="object"||Object.keys(n).length===0,kE=(n,e)=>JSON.stringify(n)===JSON.stringify(e);function ky(n,e){n.forEach(function(t){Array.isArray(t)?ky(t,e):e.push(t)})}function Sy(n){let e=[];return ky(n,e),e}var Cy=(...n)=>Sy(n).filter(Boolean),_y=(n,e)=>{let t={},r=Object.keys(n),i=Object.keys(e);for(let s of r)if(i.includes(s)){let o=n[s],l=e[s];typeof o=="object"&&typeof l=="object"?t[s]=_y(o,l):Array.isArray(o)||Array.isArray(l)?t[s]=Cy(l,o):t[s]=l+" "+o}else t[s]=n[s];for(let s of i)r.includes(s)||(t[s]=e[s]);return t},Wp=n=>!n||typeof n!="string"?n:n.replace(/\s+/g," ").trim();function SE(){for(var n=0,e,t,r="";nn&&(e=0,r=t,t=new Map)}return{get:function(o){var l=t.get(o);if(l!==void 0)return l;if((l=r.get(o))!==void 0)return i(o,l),l},set:function(o,l){t.has(o)?t.set(o,l):i(o,l)}}}var Ey="!";function OE(n){var e=n.separator||":",t=e.length===1,r=e[0],i=e.length;return function(o){for(var l=[],a=0,c=0,u,f=0;fc?u-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}}}function $E(n){if(n.length<=1)return n;var e=[],t=[];return n.forEach(function(r){var i=r[0]==="[";i?(e.push.apply(e,t.sort().concat([r])),t=[]):t.push(r)}),e.push.apply(e,t.sort()),e}function NE(n){return{cache:ME(n.cacheSize),splitModifiers:OE(n),...CE(n)}}var DE=/\s+/;function xE(n,e){var t=e.splitModifiers,r=e.getClassGroupId,i=e.getConflictingClassGroupIds,s=new Set;return n.trim().split(DE).map(function(o){var l=t(o),a=l.modifiers,c=l.hasImportantModifier,u=l.baseClassName,f=l.maybePostfixModifierPosition,d=r(f?u.substring(0,f):u),h=!!f;if(!d){if(!f)return{isTailwindClass:!1,originalClassName:o};if(d=r(u),!d)return{isTailwindClass:!1,originalClassName:o};h=!1}var p=$E(a).join(":"),m=c?p+Ey:p;return{isTailwindClass:!0,modifierId:m,classGroupId:d,originalClassName:o,hasPostfixModifier:h}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var l=o.modifierId,a=o.classGroupId,c=o.hasPostfixModifier,u=l+a;return s.has(u)?!1:(s.add(u),i(a,c).forEach(function(f){return s.add(l+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Ku(){for(var n=arguments.length,e=new Array(n),t=0;t1?e-1:0),r=1;rn||void 0,bo=(...n)=>Ny(Sy(n).filter(Boolean).join(" ")),Gc=null,Zl={},Gu=!1,Fs=(...n)=>e=>e.twMerge?((!Gc||Gu)&&(Gu=!1,Gc=en(Zl)?XE:YE(Zl)),Ny(Gc(bo(n)))):bo(n),Gp=(n,e)=>{for(let t in e)n.hasOwnProperty(t)?n[t]=bo(n[t],e[t]):n[t]=e[t];return n},ZE=(n,e)=>{let{extend:t=null,slots:r={},variants:i={},compoundVariants:s=[],compoundSlots:o=[],defaultVariants:l={}}=n,a={...QE,...e},c=t!=null&&t.base?bo(t.base,n==null?void 0:n.base):n==null?void 0:n.base,u=t!=null&&t.variants&&!en(t.variants)?_y(i,t.variants):i,f=t!=null&&t.defaultVariants&&!en(t.defaultVariants)?{...t.defaultVariants,...l}:l;!en(a.twMergeConfig)&&!kE(a.twMergeConfig,Zl)&&(Gu=!0,Zl=a.twMergeConfig);let d=en(t==null?void 0:t.slots),h=en(r)?{}:{base:bo(n==null?void 0:n.base,d&&(t==null?void 0:t.base)),...r},p=d?h:Gp({...t==null?void 0:t.slots},en(h)?{base:n==null?void 0:n.base}:h),m=b=>{if(en(u)&&en(r)&&d)return Fs(c,b==null?void 0:b.class,b==null?void 0:b.className)(a);if(s&&!Array.isArray(s))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof s}`);if(o&&!Array.isArray(o))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof o}`);let _=(y,w,O=[],B)=>{let T=O;if(typeof w=="string")T=T.concat(Wp(w).split(" ").map(V=>`${y}:${V}`));else if(Array.isArray(w))T=T.concat(w.reduce((V,K)=>V.concat(`${y}:${K}`),[]));else if(typeof w=="object"&&typeof B=="string"){for(let V in w)if(w.hasOwnProperty(V)&&V===B){let K=w[V];if(K&&typeof K=="string"){let Y=Wp(K);T[B]?T[B]=T[B].concat(Y.split(" ").map(se=>`${y}:${se}`)):T[B]=Y.split(" ").map(se=>`${y}:${se}`)}else Array.isArray(K)&&K.length>0&&(T[B]=K.reduce((Y,se)=>Y.concat(`${y}:${se}`),[]))}}return T},E=(y,w=u,O=null,B=null)=>{var T;let V=w[y];if(!V||en(V))return null;let K=(T=B==null?void 0:B[y])!=null?T:b==null?void 0:b[y];if(K===null)return null;let Y=jp(K),se=Array.isArray(a.responsiveVariants)&&a.responsiveVariants.length>0||a.responsiveVariants===!0,ge=f==null?void 0:f[y],we=[];if(typeof Y=="object"&&se)for(let[qe,Be]of Object.entries(Y)){let et=V[Be];if(qe==="initial"){ge=Be;continue}Array.isArray(a.responsiveVariants)&&!a.responsiveVariants.includes(qe)||(we=_(qe,et,we,O))}let me=V[Y]||V[jp(ge)];return typeof we=="object"&&typeof O=="string"&&we[O]?Gp(we,me):we.length>0?(we.push(me),we):me},v=()=>u?Object.keys(u).map(y=>E(y,u)):null,z=(y,w)=>{if(!u||typeof u!="object")return null;let O=new Array;for(let B in u){let T=E(B,u,y,w),V=y==="base"&&typeof T=="string"?T:T&&T[y];V&&(O[O.length]=V)}return O},C={};for(let y in b)b[y]!==void 0&&(C[y]=b[y]);let L=(y,w)=>{var O;let B=typeof(b==null?void 0:b[y])=="object"?{[y]:(O=b[y])==null?void 0:O.initial}:{};return{...f,...C,...B,...w}},F=(y=[],w)=>{let O=[];for(let{class:B,className:T,...V}of y){let K=!0;for(let[Y,se]of Object.entries(V)){let ge=L(Y,w);if(Array.isArray(se)){if(!se.includes(ge[Y])){K=!1;break}}else if(ge[Y]!==se){K=!1;break}}K&&(B&&O.push(B),T&&O.push(T))}return O},M=y=>{let w=F(s,y),O=F(t==null?void 0:t.compoundVariants,y);return Cy(O,w)},Z=y=>{let w=M(y);if(!Array.isArray(w))return w;let O={};for(let B of w)if(typeof B=="string"&&(O.base=Fs(O.base,B)(a)),typeof B=="object")for(let[T,V]of Object.entries(B))O[T]=Fs(O[T],V)(a);return O},$=y=>{if(o.length<1)return null;let w={};for(let{slots:O=[],class:B,className:T,...V}of o){if(!en(V)){let K=!0;for(let Y of Object.keys(V)){let se=L(Y,y)[Y];if(se===void 0||(Array.isArray(V[Y])?!V[Y].includes(se):V[Y]!==se)){K=!1;break}}if(!K)continue}for(let K of O)w[K]=w[K]||[],w[K].push([B,T])}return w};if(!en(r)||!d){let y={};if(typeof p=="object"&&!en(p))for(let w of Object.keys(p))y[w]=O=>{var B,T;return Fs(p[w],z(w,O),((B=Z(O))!=null?B:[])[w],((T=$(O))!=null?T:[])[w],O==null?void 0:O.class,O==null?void 0:O.className)(a)};return y}return Fs(c,v(),M(),b==null?void 0:b.class,b==null?void 0:b.className)(a)},g=()=>{if(!(!u||typeof u!="object"))return Object.keys(u)};return m.variantKeys=g(),m.extend=t,m.base=c,m.slots=p,m.variants=u,m.defaultVariants=f,m.compoundSlots=o,m.compoundVariants=s,m};const Yp=ZE({base:"inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}});/** * @license lucide-svelte v0.316.0 - ISC This source code is licensed under the ISC license. See the LICENSE file in the root directory of this source tree. - */const eM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Xp=eM;function Qp(n,e,t){const r=n.slice();return r[10]=e[t][0],r[11]=e[t][1],r}function Yc(n){let e,t=[n[11]],r={};for(let i=0;i{t(7,e=A(A({},e),J(h))),t(6,i=Te(e,r)),"name"in h&&t(0,l=h.name),"color"in h&&t(1,a=h.color),"size"in h&&t(2,c=h.size),"strokeWidth"in h&&t(3,u=h.strokeWidth),"absoluteStrokeWidth"in h&&t(4,f=h.absoluteStrokeWidth),"iconNode"in h&&t(5,d=h.iconNode),"$$scope"in h&&t(8,o=h.$$scope)},e=J(e),[l,a,c,u,f,d,i,e,o,s]}class He extends ue{constructor(e){super(),fe(this,e,nM,tM,ae,{name:0,color:1,size:2,strokeWidth:3,absoluteStrokeWidth:4,iconNode:5})}}function rM(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 iM(n){let e,t;const r=[{name:"align-center"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[rM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class oM extends ue{constructor(e){super(),fe(this,e,sM,iM,ae,{})}}function lM(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 aM(n){let e,t;const r=[{name:"align-left"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[lM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class uM extends ue{constructor(e){super(),fe(this,e,cM,aM,ae,{})}}function fM(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 dM(n){let e,t;const r=[{name:"align-right"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[fM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class pM extends ue{constructor(e){super(),fe(this,e,hM,dM,ae,{})}}function mM(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 gM(n){let e,t;const r=[{name:"bold"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[mM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let Dy=class extends ue{constructor(e){super(),fe(this,e,bM,gM,ae,{})}};function yM(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 vM(n){let e,t;const r=[{name:"book-plus"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[yM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class kM extends ue{constructor(e){super(),fe(this,e,wM,vM,ae,{})}}function SM(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 CM(n){let e,t;const r=[{name:"braces"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[SM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class AM extends ue{constructor(e){super(),fe(this,e,_M,CM,ae,{})}}function TM(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 EM(n){let e,t;const r=[{name:"code"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[TM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let xy=class extends ue{constructor(e){super(),fe(this,e,MM,EM,ae,{})}};function OM(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 $M(n){let e,t;const r=[{name:"file-down"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[OM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class DM extends ue{constructor(e){super(),fe(this,e,NM,$M,ae,{})}}function xM(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 IM(n){let e,t;const r=[{name:"file-up"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[xM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class PM extends ue{constructor(e){super(),fe(this,e,RM,IM,ae,{})}}function LM(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 BM(n){let e,t;const r=[{name:"heading-1"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[LM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class zM extends ue{constructor(e){super(),fe(this,e,FM,BM,ae,{})}}function VM(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 HM(n){let e,t;const r=[{name:"heading-2"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[VM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class jM extends ue{constructor(e){super(),fe(this,e,UM,HM,ae,{})}}function WM(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 KM(n){let e,t;const r=[{name:"heading-3"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[WM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class JM extends ue{constructor(e){super(),fe(this,e,qM,KM,ae,{})}}function GM(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 YM(n){let e,t;const r=[{name:"image-plus"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[GM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class QM extends ue{constructor(e){super(),fe(this,e,XM,YM,ae,{})}}function ZM(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 e2(n){let e,t;const r=[{name:"italic"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[ZM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let Iy=class extends ue{constructor(e){super(),fe(this,e,t2,e2,ae,{})}};function n2(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 r2(n){let e,t;const r=[{name:"link-2-off"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[n2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class s2 extends ue{constructor(e){super(),fe(this,e,i2,r2,ae,{})}}function o2(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 l2(n){let e,t;const r=[{name:"link-2"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[o2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class c2 extends ue{constructor(e){super(),fe(this,e,a2,l2,ae,{})}}function u2(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 f2(n){let e,t;const r=[{name:"list-ordered"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[u2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class h2 extends ue{constructor(e){super(),fe(this,e,d2,f2,ae,{})}}function p2(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 m2(n){let e,t;const r=[{name:"list"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[p2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class b2 extends ue{constructor(e){super(),fe(this,e,g2,m2,ae,{})}}function y2(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 v2(n){let e,t;const r=[{name:"monitor-play"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[y2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class k2 extends ue{constructor(e){super(),fe(this,e,w2,v2,ae,{})}}function S2(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 C2(n){let e,t;const r=[{name:"pilcrow"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[S2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class A2 extends ue{constructor(e){super(),fe(this,e,_2,C2,ae,{})}}function T2(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 E2(n){let e,t;const r=[{name:"redo"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[T2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class O2 extends ue{constructor(e){super(),fe(this,e,M2,E2,ae,{})}}function $2(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 N2(n){let e,t;const r=[{name:"screen-share-off"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[$2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class x2 extends ue{constructor(e){super(),fe(this,e,D2,N2,ae,{})}}function I2(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 R2(n){let e,t;const r=[{name:"screen-share"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[I2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class L2 extends ue{constructor(e){super(),fe(this,e,P2,R2,ae,{})}}function B2(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 F2(n){let e,t;const r=[{name:"separator-horizontal"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[B2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class V2 extends ue{constructor(e){super(),fe(this,e,z2,F2,ae,{})}}function H2(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 U2(n){let e,t;const r=[{name:"strikethrough"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[H2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class Ry extends ue{constructor(e){super(),fe(this,e,j2,U2,ae,{})}}function W2(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 K2(n){let e,t;const r=[{name:"sun-moon"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[W2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class J2 extends ue{constructor(e){super(),fe(this,e,q2,K2,ae,{})}}function G2(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 Y2(n){let e,t;const r=[{name:"text-quote"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[G2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class Q2 extends ue{constructor(e){super(),fe(this,e,X2,Y2,ae,{})}}function Z2(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 eO(n){let e,t;const r=[{name:"underline"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[Z2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let Py=class extends ue{constructor(e){super(),fe(this,e,tO,eO,ae,{})}};function nO(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 rO(n){let e,t;const r=[{name:"undo"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[nO]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class sO extends ue{constructor(e){super(),fe(this,e,iO,rO,ae,{})}}function oO(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 lO(n){let e,t;const r=[{name:"x"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[oO]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class cO extends ue{constructor(e){super(),fe(this,e,aO,lO,ae,{})}}const uO=` + */const eM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Xp=eM;function Qp(n,e,t){const r=n.slice();return r[10]=e[t][0],r[11]=e[t][1],r}function Yc(n){let e,t=[n[11]],r={};for(let i=0;i{t(7,e=A(A({},e),J(h))),t(6,i=Te(e,r)),"name"in h&&t(0,l=h.name),"color"in h&&t(1,a=h.color),"size"in h&&t(2,c=h.size),"strokeWidth"in h&&t(3,u=h.strokeWidth),"absoluteStrokeWidth"in h&&t(4,f=h.absoluteStrokeWidth),"iconNode"in h&&t(5,d=h.iconNode),"$$scope"in h&&t(8,o=h.$$scope)},e=J(e),[l,a,c,u,f,d,i,e,o,s]}class He extends ue{constructor(e){super(),fe(this,e,nM,tM,ae,{name:0,color:1,size:2,strokeWidth:3,absoluteStrokeWidth:4,iconNode:5})}}function rM(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 iM(n){let e,t;const r=[{name:"align-center"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[rM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class oM extends ue{constructor(e){super(),fe(this,e,sM,iM,ae,{})}}function lM(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 aM(n){let e,t;const r=[{name:"align-left"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[lM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class uM extends ue{constructor(e){super(),fe(this,e,cM,aM,ae,{})}}function fM(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 dM(n){let e,t;const r=[{name:"align-right"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[fM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class pM extends ue{constructor(e){super(),fe(this,e,hM,dM,ae,{})}}function mM(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 gM(n){let e,t;const r=[{name:"bold"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[mM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let Dy=class extends ue{constructor(e){super(),fe(this,e,bM,gM,ae,{})}};function yM(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 vM(n){let e,t;const r=[{name:"book-plus"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[yM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class kM extends ue{constructor(e){super(),fe(this,e,wM,vM,ae,{})}}function SM(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 CM(n){let e,t;const r=[{name:"braces"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[SM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class AM extends ue{constructor(e){super(),fe(this,e,_M,CM,ae,{})}}function TM(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 EM(n){let e,t;const r=[{name:"code"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[TM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let xy=class extends ue{constructor(e){super(),fe(this,e,MM,EM,ae,{})}};function OM(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 $M(n){let e,t;const r=[{name:"file-down"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[OM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class DM extends ue{constructor(e){super(),fe(this,e,NM,$M,ae,{})}}function xM(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 IM(n){let e,t;const r=[{name:"file-up"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[xM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class PM extends ue{constructor(e){super(),fe(this,e,RM,IM,ae,{})}}function LM(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 BM(n){let e,t;const r=[{name:"heading-1"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[LM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class zM extends ue{constructor(e){super(),fe(this,e,FM,BM,ae,{})}}function VM(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 HM(n){let e,t;const r=[{name:"heading-2"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[VM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class jM extends ue{constructor(e){super(),fe(this,e,UM,HM,ae,{})}}function WM(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 KM(n){let e,t;const r=[{name:"heading-3"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[WM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class JM extends ue{constructor(e){super(),fe(this,e,qM,KM,ae,{})}}function GM(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 YM(n){let e,t;const r=[{name:"image-plus"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[GM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class QM extends ue{constructor(e){super(),fe(this,e,XM,YM,ae,{})}}function ZM(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 e2(n){let e,t;const r=[{name:"italic"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[ZM]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let Iy=class extends ue{constructor(e){super(),fe(this,e,t2,e2,ae,{})}};function n2(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 r2(n){let e,t;const r=[{name:"link-2-off"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[n2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class s2 extends ue{constructor(e){super(),fe(this,e,i2,r2,ae,{})}}function o2(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 l2(n){let e,t;const r=[{name:"link-2"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[o2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class c2 extends ue{constructor(e){super(),fe(this,e,a2,l2,ae,{})}}function u2(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 f2(n){let e,t;const r=[{name:"list-ordered"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[u2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class h2 extends ue{constructor(e){super(),fe(this,e,d2,f2,ae,{})}}function p2(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 m2(n){let e,t;const r=[{name:"list"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[p2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class b2 extends ue{constructor(e){super(),fe(this,e,g2,m2,ae,{})}}function y2(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 v2(n){let e,t;const r=[{name:"monitor-play"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[y2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class k2 extends ue{constructor(e){super(),fe(this,e,w2,v2,ae,{})}}function S2(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 C2(n){let e,t;const r=[{name:"pilcrow"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[S2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class A2 extends ue{constructor(e){super(),fe(this,e,_2,C2,ae,{})}}function T2(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 E2(n){let e,t;const r=[{name:"redo"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[T2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class O2 extends ue{constructor(e){super(),fe(this,e,M2,E2,ae,{})}}function $2(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 N2(n){let e,t;const r=[{name:"screen-share-off"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[$2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class x2 extends ue{constructor(e){super(),fe(this,e,D2,N2,ae,{})}}function I2(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 R2(n){let e,t;const r=[{name:"screen-share"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[I2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class L2 extends ue{constructor(e){super(),fe(this,e,P2,R2,ae,{})}}function B2(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 F2(n){let e,t;const r=[{name:"separator-horizontal"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[B2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class V2 extends ue{constructor(e){super(),fe(this,e,z2,F2,ae,{})}}function H2(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 U2(n){let e,t;const r=[{name:"strikethrough"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[H2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class Ry extends ue{constructor(e){super(),fe(this,e,j2,U2,ae,{})}}function W2(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 K2(n){let e,t;const r=[{name:"sun-moon"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[W2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class J2 extends ue{constructor(e){super(),fe(this,e,q2,K2,ae,{})}}function G2(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 Y2(n){let e,t;const r=[{name:"text-quote"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[G2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class Q2 extends ue{constructor(e){super(),fe(this,e,X2,Y2,ae,{})}}function Z2(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 eO(n){let e,t;const r=[{name:"underline"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[Z2]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}let Py=class extends ue{constructor(e){super(),fe(this,e,tO,eO,ae,{})}};function nO(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 rO(n){let e,t;const r=[{name:"undo"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[nO]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class sO extends ue{constructor(e){super(),fe(this,e,iO,rO,ae,{})}}function oO(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 lO(n){let e,t;const r=[{name:"x"},n[1],{iconNode:n[0]}];let i={$$slots:{default:[oO]},$$scope:{ctx:n}};for(let s=0;s{t(1,e=A(A({},e),J(o))),"$$scope"in o&&t(3,i=o.$$scope)},e=J(e),[s,e,r,i]}class cO extends ue{constructor(e){super(),fe(this,e,aO,lO,ae,{})}}const uO=`

LightNote

LightNote has been developed utilizing SvelteKit, -`;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=` +`;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..."),localStorage.removeItem("connected"),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(qe,Be){return qe.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(qe){return qe})){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,qe=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],qe[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,Ue=v==="x"?Qt:Zt,Je=v==="x"?bn:yn,Tt=C[z],Et=z==="y"?"height":"width",er=Tt+g[Ue],Mt=Tt-g[Je],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 qe(){a=!1}function Be(){var N=O();N.addEventListener("mousedown",we,!0),N.addEventListener("touchend",we,Zr),N.addEventListener("touchstart",qe,Zr),N.addEventListener("touchmove",me,Zr)}function et(){var N=O();N.removeEventListener("mousedown",we,!0),N.removeEventListener("touchend",we,Zr),N.removeEventListener("touchstart",qe,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 Ue(){Je();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 Je(){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,Ue()}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&&(Ue(),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&&(Je(),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=` `,nN="️",rN="‍";let ll=null,al=null;function iN(n){n===void 0&&(n=[]);const e={};Gt.groups=e;const t=new Gt;ll==null&&(ll=Sm(Y$)),al==null&&(al=Sm(X$)),q(t,"'",ba),q(t,"{",eo),q(t,"}",to),q(t,"[",na),q(t,"]",ra),q(t,"(",ia),q(t,")",sa),q(t,"<",oa),q(t,">",la),q(t,"(",aa),q(t,")",ca),q(t,"「",ua),q(t,"」",fa),q(t,"『",da),q(t,"』",ha),q(t,"<",pa),q(t,">",ma),q(t,"&",ga),q(t,"*",ya),q(t,"@",Er),q(t,"`",wa),q(t,"^",ka),q(t,":",$r),q(t,",",pd),q(t,"$",Sa),q(t,".",Vn),q(t,"=",Ca),q(t,"!",md),q(t,"-",Hn),q(t,"%",_a),q(t,"|",Aa),q(t,"+",Ta),q(t,"#",Ea),q(t,"?",Ma),q(t,'"',gd),q(t,"/",Un),q(t,";",bd),q(t,"~",no),q(t,"_",Oa),q(t,"\\",va);const r=cn(t,iu,dd,{[ef]:!0});cn(r,iu,r);const i=cn(t,Vi,or,{[tf]:!0});cn(i,Vi,i);const s=cn(t,nu,sf,{[nf]:!0});cn(s,Vi),cn(s,nu,s);const o=cn(t,wm,r0,{[ym]:!0});q(t,km,hd,{[ym]:!0}),q(o,km),cn(o,wm,o);const l=cn(t,ru,i0,{[n0]:!0});cn(l,ru,l),q(l,nN,l);const a=q(l,rN);cn(a,ru,l);const c=[[Vi,i]],u=[[Vi,null],[nu,s]];for(let f=0;ff[0]>d[0]?1:-1);for(let f=0;f=0?p[rf]=!0:Vi.test(d)?iu.test(d)?p[kl]=!0:p[tf]=!0:p[ef]=!0,vm(t,d,d,p)}return vm(t,"localhost",wo,{ascii:!0}),t.jd=new Gt($a),{start:t,tokens:ms({groups:e},s0)}}function sN(n,e){const t=oN(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o=0&&(f+=t[o].length,d++),c+=t[o].length,s+=t[o].length,o++;s-=f,o-=d,c-=f,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function oN(n){const e=[],t=n.length;let r=0;for(;r56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function kr(n,e,t,r,i){let s;const o=e.length;for(let l=0;l=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const ko={defaultProtocol:"http",events:null,format:Cm,formatHref:Cm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function yd(n,e){e===void 0&&(e=null);let t=ms({},ko);n&&(t=ms(t,n instanceof yd?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;st?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=ko.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&ms(o,u),{tagName:i,attributes:o,content:s,eventListeners:f}}};function cc(n,e){class t extends o0{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const _m=cc("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Am=cc("text"),lN=cc("nl"),cl=cc("url",{isLink:!0,toHref(n){return n===void 0&&(n=ko.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==wo&&n[1].t===$r}}),un=n=>new Gt(n);function aN(n){let{groups:e}=n;const t=e.domain.concat([ga,ya,Er,va,wa,ka,Sa,Ca,Hn,dd,_a,Aa,Ta,Ea,Un,$a,no,Oa]),r=[ba,$r,pd,Vn,md,Ma,gd,bd,oa,la,eo,to,ra,na,ia,sa,aa,ca,ua,fa,da,ha,pa,ma],i=[ga,ba,ya,va,wa,ka,Sa,Ca,Hn,eo,to,_a,Aa,Ta,Ea,Ma,Un,$a,no,Oa],s=un(),o=q(s,no);_e(o,i,o),_e(o,e.domain,o);const l=un(),a=un(),c=un();_e(s,e.domain,l),_e(s,e.scheme,a),_e(s,e.slashscheme,c),_e(l,i,o),_e(l,e.domain,l);const u=q(l,Er);q(o,Er,u),q(a,Er,u),q(c,Er,u);const f=q(o,Vn);_e(f,i,o),_e(f,e.domain,o);const d=un();_e(u,e.domain,d),_e(d,e.domain,d);const h=q(d,Vn);_e(h,e.domain,d);const p=un(_m);_e(h,e.tld,p),_e(h,e.utld,p),q(u,wo,p);const m=q(d,Hn);_e(m,e.domain,d),_e(p,e.domain,d),q(p,Vn,h),q(p,Hn,m);const g=q(p,$r);_e(g,e.numeric,_m);const b=q(l,Hn),_=q(l,Vn);_e(b,e.domain,l),_e(_,i,o),_e(_,e.domain,l);const E=un(cl);_e(_,e.tld,E),_e(_,e.utld,E),_e(E,e.domain,l),_e(E,i,o),q(E,Vn,_),q(E,Hn,b),q(E,Er,u);const v=q(E,$r),z=un(cl);_e(v,e.numeric,z);const C=un(cl),L=un();_e(C,t,C),_e(C,r,L),_e(L,t,C),_e(L,r,L),q(E,Un,C),q(z,Un,C);const F=q(a,$r),M=q(c,$r),Z=q(M,Un),$=q(Z,Un);_e(a,e.domain,l),q(a,Vn,_),q(a,Hn,b),_e(c,e.domain,l),q(c,Vn,_),q(c,Hn,b),_e(F,e.domain,C),q(F,Un,C),_e($,e.domain,C),_e($,t,C),q($,Un,C);const y=[[eo,to],[na,ra],[ia,sa],[oa,la],[aa,ca],[ua,fa],[da,ha],[pa,ma]];for(let w=0;w=0&&d++,i++,u++;if(d<0)i-=u,i0&&(s.push(su(Am,e,o)),o=[]),i-=d,u-=d;const h=f.t,p=t.slice(i-u,i);s.push(su(h,e,p))}}return o.length>0&&s.push(su(Am,e,o)),s}function su(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const uN=typeof console<"u"&&console&&console.warn||(()=>{}),fN="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",tt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function dN(){Gt.groups={},tt.scanner=null,tt.parser=null,tt.tokenQueue=[],tt.pluginQueue=[],tt.customSchemes=[],tt.initialized=!1}function Tm(n,e){if(e===void 0&&(e=!1),tt.initialized&&uN(`linkifyjs: already initialized - will not register custom scheme "${n}" ${fN}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" @@ -224,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,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,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,onClose(){window.confirm(`Connection closed. Reconnect to ${qe}/${Ge}?`)?location.replace(`${location.protocol}//${location.host}${location.pathname}?endpoint=${qe}&workspace=${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}; +`},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&&Ge(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 Ge(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,Ge(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class 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))=>Ge(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 je))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 je&&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 je&&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)}}},Ge=(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 je&&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(Ge(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 je){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 je&&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 je&&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 je(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 je(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 je(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 je(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 je(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 je(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?Ge(this.doc,r=>{c1(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?Ge(this.doc,t=>{WI(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?Ge(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?Ge(this.doc,t=>{Pa(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?Ge(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?Ge(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 je(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 je(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 je(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 je(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 Ge(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)})}Ge(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=[];Ge(e,r=>{const i=new Map,s=new Map;let o=this.target._start,l=null;const a={};let c="",u=0,f=0;const d=()=>{if(l!==null){let h=null;switch(l){case"delete":f>0&&(h={delete:f}),f=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},i.size>0&&(h.attributes={},i.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),c="";break;case"retain":u>0&&(h={retain:u},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?Ge(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?Ge(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?Ge(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?Ge(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?Ge(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?Ge(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?Ge(this.doc,t=>{Pa(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?Ge(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?Ge(this.doc,r=>{c1(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)Ge(this.doc,r=>{const i=e&&e instanceof 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?Ge(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?Ge(this.doc,t=>{Pa(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?Ge(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 je);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 je(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 je(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 je 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===je&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===je&&(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===je){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 je)||!(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,qe,Be,et,Qe,W,ft,Kt,dt,Rn,At,Pn,Pt,Pe,ht,Ue,Je,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]),Je=new Re({props:{class:"mx-0.5 h-8 px-2",$$slots:{default:[b3]},$$scope:{ctx:n}}}),Je.$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),qe=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"),Ue=be(),x(Je.$$.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),qe=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}),Ue=ye(X),I(Je.$$.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,qe),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,Ue),R(Je,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}),Je.$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(Je.$$.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(Je.$$.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(Je),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 Ue=Pe.get("endpoint"),Je=Pe.get("workspace");if(!Ue)throw new Error("Invalid endpoint",{cause:"InvalidMetadata"});if(!Je)throw new Error("Invalid workspace",{cause:"InvalidMetadata"});t(5,c=Ue),t(6,u=Je);const Tt=new L1({url:Ue,maxAttempts:1});t(4,a=new VP({websocketProvider:Tt,name:Je,onConnect(){localStorage.setItem("connected",JSON.stringify({endpoint:Ue,workspace:Je}))},onClose(){localStorage.getItem("connected")?window.confirm(`Connection closed. Reconnect to ${Ue}/${Je}?`)?location.replace(`${location.protocol}//${location.host}${location.pathname}?endpoint=${Ue}&workspace=${Je}`):(localStorage.removeItem("connected"),location.replace(`${location.protocol}//${location.host}${location.pathname}`)):(window.alert(`Failed to connect to ${Ue}/${Je}`),location.replace(`${location.protocol}//${location.host}${location.pathname}`))},connect:!1})),await a.connect(),localStorage.setItem("shared",JSON.stringify({endpoint:Ue,workspace:Je})),ht=uL(a,s)}catch(Ue){Ue instanceof Error&&Ue.cause==="InvalidMetadata"?window.alert(`Failed to start sharing with ${location.search}: ${Ue.toString()}`):window.alert(`Failed to start sharing with ${location.search}`),console.error(Ue),location.replace(`${location.protocol}//${location.host}${location.pathname}`)}else{try{const Ue=localStorage.getItem("shared");if(Ue){const{endpoint:Je,workspace:Tt}=JSON.parse(Ue);t(5,c=Je),t(6,u=Tt)}else t(5,c=""),t(6,u="")}catch(Ue){t(5,c=""),t(6,u=""),console.error(Ue)}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:Ue}){try{localStorage.setItem("auto-saved",Ue.getHTML())}catch(Je){console.error(Je)}},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 qe=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,qe,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 b1efb46..8b3d0b2 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1721698873523"} \ No newline at end of file +{"version":"1721703645325"} \ No newline at end of file diff --git a/index.html b/index.html index e7a85b5..aa9ddb2 100644 --- a/index.html +++ b/index.html @@ -10,15 +10,15 @@ - - + + - + -