@inkeep/open-knowledge 0.7.0-beta.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +20 -20
- package/dist/constants-TIaTTdiI.mjs +2 -0
- package/dist/{dist-B9Pgan6B.mjs → dist-8f5sZjjU.mjs} +1 -1
- package/dist/{dist-BHuGIbSz.mjs → dist-D-D0ROxy.mjs} +71 -6
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-qcesYcns.mjs → init-Crl56koT.mjs} +6 -6
- package/dist/init-kWgObjIf.mjs +1 -0
- package/dist/{loader-BPHvhEMs.mjs → loader-CWTimQxz.mjs} +2 -2
- package/dist/loader-Dk7DlcV0.mjs +1 -0
- package/dist/{preview-VC5U8FHG.mjs → preview-CI2t6ZHI.mjs} +2 -2
- package/dist/preview-q0rtsl75.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-C_nGfN8W.js → ActivityModeContent-oe_KmZ6Y.js} +1 -1
- package/dist/public/assets/{DocumentContext-CBm8YLGb.js → DocumentContext-DbnbvMHR.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-BpLMuvP2.js +7 -0
- package/dist/public/assets/{SourceEditor-CJhongAn.js → SourceEditor-BEQlTn2N.js} +1 -1
- package/dist/public/assets/config-validation-events-COByjXe4.js +12 -0
- package/dist/public/assets/index-BA5hvX-L.css +1 -0
- package/dist/public/assets/{index-BygiiNXL.js → index-Boa7vp1g.js} +82 -82
- package/dist/public/assets/{typing-burst-detector-DqGeUwWw.js → typing-burst-detector-Cik-Z5me.js} +1 -1
- package/dist/public/index.html +5 -5
- package/dist/{repair-launch-json-QLidg_qz.mjs → repair-launch-json-DWpeccLv.mjs} +2 -2
- package/dist/repair-mcp-configs-CYHG9O47.mjs +2 -0
- package/dist/{src-C0UvyFGN.mjs → src-zdkJjt77.mjs} +2 -2
- package/dist/start-BEIQv4Al.mjs +1 -0
- package/dist/{start-DX2j8TK1.mjs → start-BqJk2pfE.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-DmMHHbcR.mjs +0 -2
- package/dist/init-B358og4T.mjs +0 -1
- package/dist/loader-hevFzcPC.mjs +0 -1
- package/dist/preview-koAhH80-.mjs +0 -1
- package/dist/public/assets/SettingsDialogBody-DIeeG5r2.js +0 -7
- package/dist/public/assets/config-validation-events-DQ9eENI7.js +0 -12
- package/dist/public/assets/index-DAl4JRRH.css +0 -1
- package/dist/repair-mcp-configs-oPvTLgXm.mjs +0 -2
- package/dist/start-CnK8ECbf.mjs +0 -1
|
@@ -3,7 +3,7 @@ import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2e
|
|
|
3
3
|
`)}},If=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Kd]?qd(e,t):au(e)?nu(e,e=>ru(t,t=>If(e,t))):Jd(e)?ef(e,(e,n)=>If(e,t[n])):!1,Lf=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),If(t,n)}equals(e){return this.constructor===e.constructor&&cf(this.shape,e.shape)}[Pf](){return!0}[Kd](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){hd()}get nullable(){return gp(this,jp)}get optional(){return new Jf(this)}cast(e){return Fp(e,this),e}expect(e){return Fp(e,this),e}},Rf=class extends Lf{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},zf=(e,t=null)=>new Rf(e,t);zf(Rf);var Bf=class extends Lf{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},Vf=e=>new Bf(e);zf(Bf);var Hf=class extends Lf{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},Uf=(...e)=>new Hf(e),Wf=zf(Hf),Gf=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),Kf=e=>{if(Ep.check(e))return[Gf(e)];if(Wf.check(e))return e.shape.map(e=>e+``);if(Tp.check(e))return[`[+-]?\\d+.?\\d*`];if(Dp.check(e))return[`.*`];if(_p.check(e))return e.shape.map(Kf).flat(1);gd()};zf(class extends Lf{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(Kf).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var qf=Symbol(`optional`),Jf=class extends Lf{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[qf](){return!0}},Yf=zf(Jf),Xf=class extends Lf{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new Xf,zf(Xf);var Zf=class e extends Lf{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):ef(this.shape,(n,r)=>{let i=this._isPartial&&!tf(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},Qf=e=>new Zf(e),$f=zf(Zf),ep=Vf(e=>e!=null&&(e.constructor===Object||e.constructor==null)),tp=class extends Lf{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&ef(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}},np=(e,t)=>new tp(e,t),rp=zf(tp),ip=class extends Lf{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&ef(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},ap=(...e)=>new ip(e);zf(ip);var op=class extends Lf{constructor(e){super(),this.shape=e.length===1?e[0]:new hp(e)}check(e,t){let n=au(e)&&nu(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},sp=(...e)=>new op(e),cp=zf(op),lp=Vf(e=>au(e)),up=class extends Lf{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},dp=(e,t=null)=>new up(e,t);zf(up);var fp=dp(Lf),pp=zf(class extends Lf{constructor(e){super(),this.len=e.length-1,this.args=ap(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),mp=Vf(e=>typeof e==`function`);zf(class extends Lf{constructor(e){super(),this.shape=e}check(e,t){let n=nu(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var hp=class extends Lf{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=ru(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},gp=(...e)=>e.findIndex(e=>_p.check(e))>=0?gp(...e.map(e=>Pp(e)).map(e=>_p.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new hp(e),_p=zf(hp),vp=()=>!0,yp=Vf(vp),bp=zf(Bf,e=>e.shape===vp),xp=Vf(e=>typeof e==`bigint`),Sp=Vf(e=>e===xp),Cp=Vf(e=>typeof e==`symbol`);Vf(e=>e===Cp);var wp=Vf(e=>typeof e==`number`),Tp=Vf(e=>e===wp),Ep=Vf(e=>typeof e==`string`),Dp=Vf(e=>e===Ep),Op=Vf(e=>typeof e==`boolean`),kp=Vf(e=>e===Op),Ap=Uf(void 0);zf(Hf,e=>e.shape.length===1&&e.shape[0]===void 0),Uf(void 0);var jp=Uf(null),Mp=zf(Hf,e=>e.shape.length===1&&e.shape[0]===null);zf(Uint8Array),zf(Rf,e=>e.shape===Uint8Array);var Np=gp(wp,Ep,jp,Ap,xp,Op,Cp);(()=>{let e=sp(yp),t=np(Ep,yp),n=gp(wp,Ep,jp,Op,e,t);return e.shape=n,t.shape.values=n,n})();var Pp=e=>{if(fp.check(e))return e;if(ep.check(e)){let t={};for(let n in e)t[n]=Pp(e[n]);return Qf(t)}else if(lp.check(e))return gp(...e.map(Pp));else if(Np.check(e))return Uf(e);else if(mp.check(e))return zf(e);gd()},Fp=vf?()=>{}:(e,t)=>{let n=new Ff;if(!t.check(e,n))throw md(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},Ip=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Pp(e),h:t}),this}else(e){return this.if(yp,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw md(`Unhandled pattern`)}}},Lp=(e=>new Ip(e))(yp).if(Tp,(e,t)=>Of(t,Du,Eu)).if(Dp,(e,t)=>Mf(t)).if(kp,(e,t)=>Df(t)).if(Sp,(e,t)=>BigInt(Of(t,Du,Eu))).if(_p,(e,t)=>Rp(t,Nf(t,e.shape))).if($f,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(Yf.check(i)){if(Df(t))continue;i=i.shape}n[r]=Lp(i,t)}return n}).if(cp,(e,t)=>{let n=[],r=kf(t,0,42);for(let i=0;i<r;i++)n.push(Rp(t,e.shape));return n}).if(Wf,(e,t)=>Nf(t,e.shape)).if(Mp,(e,t)=>null).if(pp,(e,t)=>{let n=Rp(t,e.res);return()=>n}).if(bp,(e,t)=>Rp(t,Nf(t,[wp,Ep,jp,Ap,xp,Op,sp(wp),np(gp(`a`,`b`,`c`),wp)]))).if(rp,(e,t)=>{let n={},r=Of(t,0,3);for(let i=0;i<r;i++){let r=Rp(t,e.shape.keys);n[r]=Rp(t,e.shape.values)}return n}).done(),Rp=(e,t)=>Lp(Pp(t),e),zp=typeof document<`u`?document:{},Bp=e=>zp.createElement(e),Vp=()=>zp.createDocumentFragment();Vf(e=>e.nodeType===$p);var Hp=e=>zp.createTextNode(e);typeof DOMParser<`u`&&new DOMParser;var Up=(e,t)=>(Ef(t,(t,n)=>{n===!1?e.removeAttribute(t):n===!0?e.setAttribute(t,``):e.setAttribute(t,n)}),e),Wp=e=>{let t=Vp();for(let n=0;n<e.length;n++)Yp(t,e[n]);return t},Gp=(e,t)=>(Yp(e,Wp(t)),e),Kp=(e,t=[],n=[])=>Gp(Up(Bp(e),t),n);Vf(e=>e.nodeType===Xp);var qp=Hp;Vf(e=>e.nodeType===Zp);var Jp=e=>Xl(e,(e,t)=>`${t}:${e};`).join(``),Yp=(e,t)=>e.appendChild(t),Xp=zp.ELEMENT_NODE,Zp=zp.TEXT_NODE;zp.CDATA_SECTION_NODE,zp.COMMENT_NODE;var Qp=zp.DOCUMENT_NODE;zp.DOCUMENT_TYPE_NODE;var $p=zp.DOCUMENT_FRAGMENT_NODE;Vf(e=>e.nodeType===Qp);var em=(e=>class{constructor(e){this._=e}destroy(){e(this._)}})(clearTimeout),tm=(e,t)=>new em(setTimeout(t,e)),nm=Symbol,rm=nm(),im=nm(),am=nm(),om=nm(),sm=nm(),cm=nm(),lm=nm(),um=nm(),dm=nm(),fm=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};Vd();var pm={[rm]:Tf(`font-weight`,`bold`),[im]:Tf(`font-weight`,`normal`),[am]:Tf(`color`,`blue`),[sm]:Tf(`color`,`green`),[om]:Tf(`color`,`grey`),[cm]:Tf(`color`,`red`),[lm]:Tf(`color`,`purple`),[um]:Tf(`color`,`orange`),[dm]:Tf(`color`,`black`)},mm=yf?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=ql(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=pm[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=Jp(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i}:fm,hm=(...e)=>{console.log(...mm(e)),_m.forEach(t=>t.print(e))},gm=(...e)=>{console.warn(...mm(e)),e.unshift(um),_m.forEach(t=>t.print(e))},_m=Ql(),vm=e=>({[Symbol.iterator](){return this},next:e}),ym=(e,t)=>vm(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),bm=(e,t)=>vm(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),xm=class{constructor(e,t){this.clock=e,this.len=t}},Sm=class{constructor(){this.clients=new Map}},Cm=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])Hh(e,i,o.clock,o.len,n)}}),wm=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=cu((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},Tm=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&wm(n,t.clock)!==null},Em=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new xm(r.clock,du(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},Dm=e=>{let t=new Sm;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)eu(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return Em(t),t},Om=(e,t,n,r)=>{Yl(e.clients,t,()=>[]).push(new xm(n,r))},km=()=>new Sm,Am=e=>{let t=km();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new xm(i,a))}}r.length>0&&t.clients.set(n,r)}),t},jm=(e,t)=>{Ju(e.restEncoder,t.clients.size),tu(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),Ju(e.restEncoder,t);let r=n.length;Ju(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},Mm=e=>{let t=new Sm,n=Td(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=Td(e.restDecoder),r=Td(e.restDecoder);if(r>0){let i=Yl(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new xm(e.readDsClock(),e.readDsLen()))}}return t},Nm=(e,t,n)=>{let r=new Sm,i=Td(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=Td(e.restDecoder),a=Td(e.restDecoder),o=n.clients.get(i)||[],s=Ph(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&Om(r,i,s,a-s);let e=Ih(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,av(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,av(t,c,a-c.id.clock)),c.delete(t))}else Om(r,i,n,a-n)}}if(r.clients.size>0){let e=new Um;return Ju(e.restEncoder,0),jm(e,r),e.toUint8Array()}return null},Pm=Ld,Fm=class e extends ou{constructor({guid:e=Bd(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=Pm(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Mh,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Hd(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>Hd(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&Xh(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(tu(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Xh(this,e,t)}get(e,t=Eg){let n=Yl(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==Eg&&r!==t)if(r===Eg){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=``){return this.get(e,qg)}getText(e=``){return this.get(e,m_)}getMap(e=``){return this.get(e,Xg)}getXmlElement(e=``){return this.get(e,y_)}getXmlFragment(e=``){return this.get(e,__)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,tu(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,Xh(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},Im=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Td(this.restDecoder)}readDsLen(){return Td(this.restDecoder)}},Lm=class extends Im{readLeftID(){return mh(Td(this.restDecoder),Td(this.restDecoder))}readRightID(){return mh(Td(this.restDecoder),Td(this.restDecoder))}readClient(){return Td(this.restDecoder)}readInfo(){return wd(this.restDecoder)}readString(){return Dd(this.restDecoder)}readParentInfo(){return Td(this.restDecoder)===1}readTypeRef(){return Td(this.restDecoder)}readLen(){return Td(this.restDecoder)}readAny(){return Ad(this.restDecoder)}readBuf(){return Sf(Cd(this.restDecoder))}readJSON(){return JSON.parse(Dd(this.restDecoder))}readKey(){return Dd(this.restDecoder)}},Rm=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Td(this.restDecoder),this.dsCurrVal}readDsLen(){let e=Td(this.restDecoder)+1;return this.dsCurrVal+=e,e}},zm=class extends Rm{constructor(e){super(e),this.keys=[],Td(e),this.keyClockDecoder=new Nd(Cd(e)),this.clientDecoder=new Md(Cd(e)),this.leftClockDecoder=new Nd(Cd(e)),this.rightClockDecoder=new Nd(Cd(e)),this.infoDecoder=new jd(Cd(e),wd),this.stringDecoder=new Pd(Cd(e)),this.parentInfoDecoder=new jd(Cd(e),wd),this.typeRefDecoder=new Md(Cd(e)),this.lenDecoder=new Md(Cd(e))}readLeftID(){return new fh(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new fh(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 Ad(this.restDecoder)}readBuf(){return Cd(this.restDecoder)}readJSON(){return Ad(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},Bm=class{constructor(){this.restEncoder=Vu()}toUint8Array(){return Wu(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Ju(this.restEncoder,e)}writeDsLen(e){Ju(this.restEncoder,e)}},Vm=class extends Bm{writeLeftID(e){Ju(this.restEncoder,e.client),Ju(this.restEncoder,e.clock)}writeRightID(e){Ju(this.restEncoder,e.client),Ju(this.restEncoder,e.clock)}writeClient(e){Ju(this.restEncoder,e)}writeInfo(e){qu(this.restEncoder,e)}writeString(e){Qu(this.restEncoder,e)}writeParentInfo(e){Ju(this.restEncoder,+!!e)}writeTypeRef(e){Ju(this.restEncoder,e)}writeLen(e){Ju(this.restEncoder,e)}writeAny(e){sd(this.restEncoder,e)}writeBuf(e){ed(this.restEncoder,e)}writeJSON(e){Qu(this.restEncoder,JSON.stringify(e))}writeKey(e){Qu(this.restEncoder,e)}},Hm=class{constructor(){this.restEncoder=Vu(),this.dsCurrVal=0}toUint8Array(){return Wu(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,Ju(this.restEncoder,t)}writeDsLen(e){e===0&&gd(),Ju(this.restEncoder,e-1),this.dsCurrVal+=e}},Um=class extends Hm{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new fd,this.clientEncoder=new ud,this.leftClockEncoder=new fd,this.rightClockEncoder=new fd,this.infoEncoder=new cd(qu),this.stringEncoder=new pd,this.parentInfoEncoder=new cd(qu),this.typeRefEncoder=new ud,this.lenEncoder=new ud}toUint8Array(){let e=Vu();return Ju(e,0),ed(e,this.keyClockEncoder.toUint8Array()),ed(e,this.clientEncoder.toUint8Array()),ed(e,this.leftClockEncoder.toUint8Array()),ed(e,this.rightClockEncoder.toUint8Array()),ed(e,Wu(this.infoEncoder)),ed(e,this.stringEncoder.toUint8Array()),ed(e,Wu(this.parentInfoEncoder)),ed(e,this.typeRefEncoder.toUint8Array()),ed(e,this.lenEncoder.toUint8Array()),$u(e,Wu(this.restEncoder)),Wu(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){sd(this.restEncoder,e)}writeBuf(e){ed(this.restEncoder,e)}writeJSON(e){sd(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},Wm=(e,t,n,r)=>{r=du(r,t[0].id.clock);let i=Ih(t,r);Ju(e.restEncoder,t.length-i),e.writeClient(n),Ju(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},Gm=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{Ph(t,n)>e&&r.set(n,e)}),Nh(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),Ju(e.restEncoder,r.size),tu(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{Wm(e,t.clients.get(n),n,r)})},Km=(e,t)=>{let n=ql(),r=Td(e.restDecoder);for(let i=0;i<r;i++){let r=Td(e.restDecoder),i=Array(r),a=e.readClient(),o=Td(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new O_(mh(a,o),t),o+=t;break}case 10:{let t=Td(e.restDecoder);i[n]=new fv(mh(a,o),t),o+=t;break}default:{let s=(r&192)==0,c=new cv(mh(a,o),null,(r&128)==128?e.readLeftID():null,null,(r&64)==64?e.readRightID():null,s?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,s&&(r&32)==32?e.readString():null,lv(e,r));i[n]=c,o+=c.length}}}}return n},qm=(e,t,n)=>{let r=[],i=tu(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new Mh,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,s.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):s.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(u.constructor!==fv){let i=Yl(d,u.id.client,()=>Ph(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,Ph(t,a)),f();else{u=e.refs[e.i++];continue}}else (i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new Um;return Gm(e,s,new Map),Ju(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},Jm=(e,t)=>Gm(e,t.doc.store,t.beforeState),Ym=(e,t,n,r=new zm(e))=>Xh(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=qm(e,i,Km(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<Ph(i,e)){t=!0;break}if(a){for(let[e,t]of a.missing){let n=o.missing.get(e);(n==null||n>t)&&o.missing.set(e,t)}o.update=og([o.update,a.update])}}else i.pendingStructs=a;let s=Nm(r,e,i);if(i.pendingDs){let t=new zm(bd(i.pendingDs));Td(t.restDecoder);let n=Nm(t,e,i);s&&n?i.pendingDs=og([s,n]):i.pendingDs=s||n}else i.pendingDs=s;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,Xm(e.doc,t)}},n,!1),Xm=(e,t,n,r=zm)=>{let i=bd(t);Ym(i,e,n,new r(i))},Zm=(e,t,n)=>Xm(e,t,n,Lm),Qm=(e,t,n=new Map)=>{Gm(e,t.store,n),jm(e,Am(t.store))},$m=(e,t=new Uint8Array([0]),n=new Um)=>{Qm(n,e,nh(t));let r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(sg(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===Vm)return ig(r.map((e,t)=>t===0?e:fg(e)));if(n.constructor===Um)return og(r)}return r[0]},eh=(e,t)=>$m(e,t,new Vm),th=e=>{let t=new Map,n=Td(e.restDecoder);for(let r=0;r<n;r++){let n=Td(e.restDecoder),r=Td(e.restDecoder);t.set(n,r)}return t},nh=e=>th(new Im(bd(e))),rh=(e,t)=>(Ju(e.restEncoder,t.size),tu(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{Ju(e.restEncoder,t),Ju(e.restEncoder,n)}),e),ih=(e,t)=>rh(e,Nh(t.store)),ah=(e,t=new Hm)=>(e instanceof Map?rh(t,e):ih(t,e),t.toUint8Array()),oh=e=>ah(e,new Bm),sh=class{constructor(){this.l=[]}},ch=()=>new sh,lh=(e,t)=>e.l.push(t),uh=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},dh=(e,t,n)=>of(e.l,[t,n]),fh=class{constructor(e,t){this.client=e,this.clock=t}},ph=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,mh=(e,t)=>new fh(e,t),hh=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw gd()},gh=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},_h=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},vh=e=>{let t={};return e.type&&(t.type=e.type),e.tname&&(t.tname=e.tname),e.item&&(t.item=e.item),e.assoc!=null&&(t.assoc=e.assoc),t},yh=e=>new _h(e.type==null?null:mh(e.type.client,e.type.clock),e.tname??null,e.item==null?null:mh(e.item.client,e.item.clock),e.assoc==null?0:e.assoc),bh=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}},xh=(e,t,n=0)=>new bh(e,t,n),Sh=(e,t,n)=>{let r=null,i=null;return e._item===null?i=hh(e):r=mh(e._item.id.client,e._item.id.clock),new _h(r,i,t,n)},Ch=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return Sh(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return Sh(e,mh(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return Sh(e,r.lastId,n);r=r.right}return Sh(e,null,n)},wh=(e,t)=>{let n=Lh(e,t);return{item:n,diff:t.clock-n.id.clock}},Th=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(Ph(r,i.client)<=i.clock)return null;let e=n?rv(r,i):wh(r,i),t=e.item;if(!(t instanceof cv))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(Ph(r,a.client)<=a.clock)return null;let{item:e}=n?rv(r,a):{item:Lh(r,a)};if(e instanceof cv&&e.content instanceof tv)c=e.content.type;else return null}else throw gd();l=s>=0?c._length:0}return xh(c,l,e.assoc)},Eh=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&ph(e.item,t.item)&&ph(e.type,t.type)&&e.assoc===t.assoc,Dh=class{constructor(e,t){this.ds=e,this.sv=t}},Oh=(e,t)=>new Dh(e,t);Oh(km(),new Map);var kh=e=>Oh(Am(e.store),Nh(e.store)),Ah=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Tm(t.ds,e.id),jh=(e,t)=>{let n=Yl(e.meta,jh,Ql),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<Ph(r,n)&&zh(e,mh(n,t))}),Cm(e,t.ds,e=>{}),n.add(t))},Mh=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},Nh=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},Ph=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},Fh=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw gd()}n.push(t)},Ih=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=cu(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=cu((n+r)/2)}throw gd()},Lh=(e,t)=>{let n=e.clients.get(t.client);return n[Ih(n,t.clock)]},Rh=(e,t,n)=>{let r=Ih(t,n),i=t[r];return i.id.clock<n&&i instanceof cv?(t.splice(r+1,0,av(e,i,n-i.id.clock)),r+1):r},zh=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[Rh(e,n,t.clock)]},Bh=(e,t,n)=>{let r=t.clients.get(n.client),i=Ih(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==O_&&r.splice(i+1,0,av(e,a,n.clock-a.id.clock+1)),a},Vh=(e,t,n)=>{let r=e.clients.get(t.id.client);r[Ih(r,t.id.clock)]=n},Hh=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=Rh(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&Rh(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},Uh=class{constructor(e,t,n){this.doc=e,this.deleteSet=new Sm,this.beforeState=Nh(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},Wh=(e,t)=>t.deleteSet.clients.size===0&&!Zl(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(Em(t.deleteSet),Jm(e,t),jm(e,t.deleteSet),!0),Gh=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Yl(e.changed,t,Ql).add(n)},Kh=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof cv&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},qh=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=Ih(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof cv&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},Jh=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=uu(r.length-1,1+Ih(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+Kh(r,e)}})},Yh=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{Em(a),n.afterState=Nh(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&(t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{dh(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&d_(n)})}),of(e,[])}finally{r.gc&&qh(a,i,r.gcFilter),Jh(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=du(Ih(e,r),1);for(let t=e.length-1;t>=n;)t-=1+Kh(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=Ih(r,n);a+1<r.length&&Kh(r,a+1)>1||a>0&&Kh(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(hm(um,rm,`[yjs] `,im,cm,`Changed the client-id because another client seems to be using it.`),r.clientID=Pm()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new Vm;Wh(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new Um;Wh(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):Yh(e,t+1)}}},Xh=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new Uh(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&Yh(i,0)}}return o},Zh=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}},Qh=(e,t,n)=>{Cm(e,n.deletions,n=>{n instanceof cv&&t.scope.some(t=>t===e.doc||gh(t,n))&&iv(n,!1)})},$h=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;Xh(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;Cm(n,o.insertions,e=>{if(e instanceof cv){if(e.redone!==null){let{item:t,diff:i}=rv(r,e.id);i>0&&(t=zh(n,mh(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||gh(t,e))&&c.push(e)}}),Cm(n,o.deletions,e=>{e instanceof cv&&a.some(t=>t===n.doc||gh(t,e))&&!Tm(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=sv(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o},eg=class extends ou{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=au(e)?e[0].doc:e instanceof Fm?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new Sm;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&Om(i,n,r,a)});let a=Vd(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=Dm([t.deletions,e.deleteSet]),t.insertions=Dm([t.insertions,i])}else r.push(new Zh(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),Cm(e,e.deleteSet,t=>{t instanceof cv&&this.scope.some(n=>n===e.doc||gh(n,t))&&iv(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,()=>{this.destroy()})}addToScope(e){let t=new Set(this.scope);e=au(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof Eg?e.doc!==this.doc:e!==this.doc)&&gm(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}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(n=>{e&&(this.undoStack.forEach(e=>Qh(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>Qh(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=$h(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=$h(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*tg(e){let t=Td(e.restDecoder);for(let n=0;n<t;n++){let t=Td(e.restDecoder),n=e.readClient(),r=Td(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=Td(e.restDecoder);yield new fv(mh(n,r),t),r+=t}else if(31&t){let i=(t&192)==0,a=new cv(mh(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,lv(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new O_(mh(n,r),t),r+=t}}}}var ng=class{constructor(e,t){this.gen=tg(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===fv);return this.curr}},rg=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},ig=e=>og(e,Lm,Vm),ag=(e,t)=>{if(e.constructor===O_){let{client:n,clock:r}=e.id;return new O_(mh(n,r+t),e.length-t)}else if(e.constructor===fv){let{client:n,clock:r}=e.id;return new fv(mh(n,r+t),e.length-t)}else{let n=e,{client:r,clock:i}=n.id;return new cv(mh(r,i+t),null,mh(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},og=(e,t=zm,n=Um)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(bd(e))),i=r.map(e=>new ng(e,!0)),a=null,o=new n,s=new rg(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===fv?1:-1:n}else return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)lg(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock)if(a.struct.constructor===fv)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{lg(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new fv(mh(t,a.struct.id.clock+a.struct.length),e),offset:0}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===fv?a.struct.length-=t:n=ag(n,t)),a.struct.mergeWith(n)||(lg(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==fv;n=e.next())lg(s,a.struct,a.offset),a={struct:n,offset:0}}return a!==null&&(lg(s,a.struct,a.offset),a=null),ug(s),jm(o,Dm(r.map(e=>Mm(e)))),o.toUint8Array()},sg=(e,t,n=zm,r=Um)=>{let i=nh(t),a=new r,o=new rg(a),s=new n(bd(e)),c=new ng(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===fv){c.next();continue}if(e.id.clock+e.length>n)for(lg(o,e,du(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)lg(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}return ug(o),jm(a,Mm(s)),a.toUint8Array()},cg=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:Wu(e.encoder.restEncoder)}),e.encoder.restEncoder=Vu(),e.written=0)},lg=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&cg(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),Ju(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},ug=e=>{cg(e);let t=e.encoder.restEncoder;Ju(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];Ju(t,r.written),$u(t,r.restEncoder)}},dg=(e,t,n,r)=>{let i=new n(bd(e)),a=new ng(i,!1),o=new r,s=new rg(o);for(let e=a.curr;e!==null;e=a.next())lg(s,t(e),0);return ug(s),jm(o,Mm(i)),o.toUint8Array()},fg=e=>dg(e,sf,zm,Vm),pg=`You must not compute changes after the event-handler fired.`,mg=class{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||=hg(this.currentTarget,this.target)}deletes(e){return Tm(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw md(pg);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r))if(e!==null&&this.deletes(e))i=`delete`,a=$l(e.content.getContent());else return;else e!==null&&this.deletes(e)?(i=`update`,a=$l(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=$l(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),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 md(pg);let t=this.target,n=Ql(),r=Ql(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},hg=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},gg=()=>{gm(`Invalid access: Add Yjs type to a document before reading data.`)},_g=80,vg=0,yg=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=vg++}},bg=e=>{e.timestamp=vg++},xg=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=vg++},Sg=(e,t,n)=>{if(e.length>=_g){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return xg(r,t,n),r}else{let r=new yg(t,n);return e.push(r),r}},Cg=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>lu(t-e.index)<lu(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,bg(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)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 n!==null&&lu(n.index-i)<r.parent.length/_g?(xg(n,r,i),n):Sg(e._searchMarker,r,i)},wg=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=du(t,i.index+n))}},Tg=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;Yl(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;dh(r._eH,n,t)},Eg=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=ch(),this._dEH=ch(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw hd()}clone(){throw hd()}_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){lh(this._eH,e)}observeDeep(e){lh(this._dEH,e)}unobserve(e){uh(this._eH,e)}unobserveDeep(e){uh(this._dEH,e)}toJSON(){}},Dg=(e,t,n)=>{e.doc??gg(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},Og=e=>{e.doc??gg();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},kg=(e,t)=>{let n=[],r=e._start;for(;r!==null;){if(r.countable&&Ah(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},Ag=(e,t)=>{let n=0,r=e._start;for(e.doc??gg();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},jg=(e,t)=>{let n=[];return Ag(e,(r,i)=>{n.push(t(r,i,e))}),n},Mg=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},Ng=(e,t)=>{e.doc??gg();let n=Cg(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Pg=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new cv(mh(o,Ph(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new U_(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new cv(mh(o,Ph(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new k_(new Uint8Array(n))),i.integrate(e,0);break;case Fm:i=new cv(mh(o,Ph(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new P_(n)),i.integrate(e,0);break;default:if(n instanceof Eg)i=new cv(mh(o,Ph(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new tv(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},Fg=()=>md(`Length exceeded!`),Ig=(e,t,n,r)=>{if(n>t._length)throw Fg();if(n===0)return t._searchMarker&&wg(t._searchMarker,n,r.length),Pg(e,t,null,r);let i=n,a=Cg(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&zh(e,mh(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&wg(t._searchMarker,i,r.length),Pg(e,t,o,r)},Lg=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return Pg(e,t,r,n)},Rg=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=Cg(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&zh(e,mh(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&zh(e,mh(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw Fg();t._searchMarker&&wg(t._searchMarker,i,-a+r)},zg=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},Bg=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new U_([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new U_([r]);break;case Uint8Array:s=new k_(r);break;case Fm:s=new P_(r);break;default:if(r instanceof Eg)s=new tv(r);else throw Error(`Unexpected content type`)}new cv(mh(o,Ph(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},Vg=(e,t)=>{e.doc??gg();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Hg=e=>{let t={};return e.doc??gg(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},Ug=(e,t)=>{e.doc??gg();let n=e._map.get(t);return n!==void 0&&!n.deleted},Wg=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Ah(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},Gg=e=>(e.doc??gg(),ym(e._map.entries(),e=>!e[1].deleted)),Kg=class extends mg{},qg=class e extends Eg{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof Eg?e.clone():e)),t}get length(){return this.doc??gg(),this._length}_callObserver(e,t){super._callObserver(e,t),Tg(this,e,new Kg(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):Xh(this.doc,n=>{Ig(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):Xh(this.doc,t=>{Lg(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):Xh(this.doc,n=>{Rg(n,this,e,t)})}get(e){return Ng(this,e)}toArray(){return Og(this)}slice(e=0,t=this.length){return Dg(this,e,t)}toJSON(){return this.map(e=>e instanceof Eg?e.toJSON():e)}map(e){return jg(this,e)}forEach(e){Ag(this,e)}[Symbol.iterator](){return Mg(this)}_write(e){e.writeTypeRef(J_)}},Jg=e=>new qg,Yg=class extends mg{constructor(e,t,n){super(e,t),this.keysChanged=n}},Xg=class e extends Eg{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((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof Eg?e.clone():e)}),t}_callObserver(e,t){Tg(this,e,new Yg(this,e,t))}toJSON(){this.doc??gg();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof Eg?r.toJSON():r}}),e}get size(){return[...Gg(this)].length}keys(){return bm(Gg(this),e=>e[0])}values(){return bm(Gg(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return bm(Gg(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??gg(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):Xh(this.doc,t=>{zg(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):Xh(this.doc,n=>{Bg(n,this,e,t)}),t}get(e){return Vg(this,e)}has(e){return Ug(this,e)}clear(){this.doc===null?this._prelimContent.clear():Xh(this.doc,e=>{this.forEach(function(t,n,r){zg(e,r,n)})})}_write(e){e.writeTypeRef(Y_)}},Zg=e=>new Xg,Qg=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&nf(e,t),$g=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&gd(),this.right.content.constructor){case R_:this.right.deleted||r_(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}},e_=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case R_:t.right.deleted||r_(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&zh(e,mh(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},t_=(e,t,n,r)=>{let i=new Map,a=r?Cg(t,n):null;return a?e_(e,new $g(a.p.left,a.p,a.index,i),n-a.index):e_(e,new $g(null,t._start,0,i),n)},n_=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===R_&&Qg(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new cv(mh(a,Ph(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new R_(o,r));l.integrate(e,0),n.right=l,n.forward()})},r_=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},i_=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===R_&&Qg(t[e.right.content.key]??null,e.right.content.value));)e.forward()},a_=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!Qg(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new cv(mh(a,Ph(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new R_(s,c)),n.right.integrate(e,0),n.forward()}}return o},o_=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;i_(n,i);let s=a_(e,t,n,i),c=r.constructor===String?new G_(r):r instanceof Eg?new tv(r):new I_(r),{left:l,right:u,index:d}=n;t._searchMarker&&wg(t._searchMarker,n.index,c.getLength()),u=new cv(mh(o,Ph(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),n_(e,t,n,s)},s_=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;i_(n,i);let s=a_(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===R_));){if(!n.right.deleted)switch(n.right.content.constructor){case R_:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(Qg(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&zh(e,mh(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
|
|
4
4
|
`;n.right=new cv(mh(o,Ph(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new G_(i)),n.right.integrate(e,0),n.forward()}n_(e,t,n,s)},c_=(e,t,n,r,i)=>{let a=t,o=ql();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===R_){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case R_:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&r_(i,n);break}}}t=t.right}return s},l_=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===R_){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},u_=e=>{let t=0;return Xh(e.doc,n=>{let r=e._start,i=e._start,a=ql(),o=Jl(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case R_:r_(o,i.content);break;default:t+=c_(n,r,i,a,o),a=Jl(o),r=i;break}i=i.right}}),t},d_=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&Hh(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===R_&&e.constructor!==O_&&t.add(e.parent)})}Xh(n,n=>{Cm(e,e.deleteSet,e=>{if(e instanceof O_||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===R_?t.add(r):l_(n,e)});for(let e of t)u_(e)})},f_=(e,t,n)=>{let r=n,i=Jl(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case tv:case I_:case G_:n<t.right.length&&zh(e,mh(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}a&&c_(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&wg(o._searchMarker,t.index,-r+n),t},p_=class extends mg{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){return this._changes===null&&(this._changes={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set}),this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];Xh(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},$d(o)||(e.attributes=Yd({},o))),c=0;break}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case tv:case I_:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case G_:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case R_:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(Qg(n.get(t)??null,s)?s!==null&&i.delete(e):(a===`retain`&&u(),Qg(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;Qg(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(Qg(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),r_(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},m_=class e extends Eg{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??gg(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new p_(this,e,t);Tg(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??gg();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===G_&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):Xh(this.doc,n=>{let r=new $g(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
|
|
5
5
|
`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&o_(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&f_(n,r,a.delete):s_(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??gg();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(Ah(s,e)||t!==void 0&&Ah(s,t))switch(s.content.constructor){case G_:{let r=i.get(`ychange`);e!==void 0&&!Ah(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!Ah(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case tv:case I_:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case R_:Ah(s,e)&&(c(),r_(i,s.content));break}s=s.right}c()};return e||t?Xh(a,n=>{e&&jh(n,e),t&&jh(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):Xh(r,r=>{let i=t_(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),o_(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):Xh(r,r=>{let i=t_(r,this,e,!n);o_(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):Xh(n,n=>{f_(n,t_(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):Xh(r,r=>{let i=t_(r,this,e,!1);i.right!==null&&s_(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):Xh(this.doc,t=>{zg(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):Xh(this.doc,n=>{Bg(n,this,e,t)})}getAttribute(e){return Vg(this,e)}getAttributes(){return Hg(this)}_write(e){e.writeTypeRef(X_)}},h_=e=>new m_,g_=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??gg()}[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===y_||t.constructor===__)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}else e=e.parent===this._root?null: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 e extends Eg{constructor(){super(),this._prelimContent=[]}get firstChild(){let 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 e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof Eg?e.clone():e)),t}get length(){return this.doc??gg(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new g_(this,e)}querySelector(e){e=e.toUpperCase();let t=new g_(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),tu(new g_(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Tg(this,e,new x_(this,t,e))}toString(){return jg(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),Ag(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):Xh(this.doc,n=>{Ig(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)Xh(this.doc,n=>{let r=e&&e instanceof Eg?e._item:e;Pg(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw md(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):Xh(this.doc,n=>{Rg(n,this,e,t)})}toArray(){return Og(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Ng(this,e)}slice(e=0,t=this.length){return Dg(this,e,t)}forEach(e){Ag(this,e)}_write(e){e.writeTypeRef(Q_)}},v_=e=>new __,y_=class e extends __{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return Zd(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof Eg?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):Xh(this.doc,t=>{zg(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):Xh(this.doc,n=>{Bg(n,this,e,t)})}getAttribute(e){return Vg(this,e)}hasAttribute(e){return Ug(this,e)}getAttributes(e){return e?Wg(this,e):Hg(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return Ag(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(Z_),e.writeKey(this.nodeName)}},b_=e=>new y_(e.readKey()),x_=class extends mg{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},S_=class e extends Xg{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef($_),e.writeKey(this.hookName)}},C_=e=>new S_(e.readKey()),w_=class e extends m_{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(ev)}},T_=e=>new w_,E_=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw hd()}mergeWith(e){return!1}write(e,t,n){throw hd()}integrate(e,t){throw hd()}},D_=0,O_=class extends E_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Fh(e.doc.store,this)}write(e,t){e.writeInfo(D_),e.writeLen(this.length-t)}getMissing(e,t){return null}},k_=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw hd()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},A_=e=>new k_(e.readBuf()),j_=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Om(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}},M_=e=>new j_(e.readLen()),N_=(e,t)=>new Fm({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),P_=class e{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;let 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 e(N_(this.doc.guid,this.opts))}splice(e){throw hd()}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}},F_=e=>new P_(N_(e.readString(),e.readAny())),I_=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw hd()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},L_=e=>new I_(e.readJSON()),R_=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw hd()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},z_=e=>new R_(e.readKey(),e.readJSON()),B_=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},V_=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new B_(n)},H_=gf(`node_env`)===`development`,U_=class e{constructor(e){this.arr=e,H_&&af(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},W_=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new U_(n)},G_=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}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}},K_=e=>new G_(e.readString()),q_=[Jg,Zg,h_,b_,v_,C_,T_],J_=0,Y_=1,X_=2,Z_=3,Q_=4,$_=5,ev=6,tv=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw hd()}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(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.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(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},nv=e=>new tv(q_[e.readTypeRef()](e)),rv=(e,t)=>{let n=t,r=0,i;do r>0&&(n=mh(n.client,n.clock+r)),i=Lh(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof cv);return{item:i,diff:r}},iv=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},av=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new cv(mh(r,i+n),t,mh(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=mh(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},ov=(e,t)=>ru(e,e=>Tm(e.deletions,t)),sv=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return zh(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||sv(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=zh(e,u.redone)}let p=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:zh(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:zh(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||Tm(r,d.right.id)||ov(a.undoStack,d.right.id)||ov(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=zh(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;let m=mh(c,Ph(s,c)),h=new cv(m,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=m,iv(h,!0),h.integrate(e,0),h},cv=class e extends E_{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ph(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ph(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===fh&&this.id.client!==this.parent.client&&this.parent.clock>=Ph(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=Bh(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=zh(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===O_||this.right&&this.right.constructor===O_)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===fh){let e=Lh(n,this.parent);e.constructor===O_?this.parent=null:this.parent=e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Bh(e,e.doc.store,mh(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 t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),ph(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(ph(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(Lh(e.doc.store,n.origin)))r.has(Lh(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null)this.right=this.left.right,this.left.right=this;else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Fh(e.doc.store,this),this.content.integrate(e,this),Gh(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new O_(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:mh(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ph(e.origin,this.lastId)&&this.right===e&&ph(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.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){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Om(e.deleteSet,this.id.client,this.id.clock,this.length),Gh(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw gd();this.content.gc(e),t?Vh(e,this,new O_(this.id,this.length)):this.content=new j_(this.length)}write(e,t){let n=t>0?mh(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=hh(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===fh?(e.writeParentInfo(!1),e.writeLeftID(t)):gd();i!==null&&e.writeString(i)}this.content.write(e,t)}},lv=(e,t)=>uv[t&31](e),uv=[()=>{gd()},M_,V_,A_,K_,L_,z_,nv,W_,F_,()=>{gd()}],dv=10,fv=class extends E_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){gd()}write(e,t){e.writeInfo(dv),Ju(e.restEncoder,this.length-t)}getMissing(e,t){return null}},pv=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},mv=`__ $YJS$ __`;pv[mv]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),pv[mv]=!0;var hv=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},gv=/[\uD800-\uDBFF]/,_v=/[\uDC00-\uDFFF]/,vv=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&gv.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&_v.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},yv=(e,t)=>e>>>t|e<<32-t,bv=e=>yv(e,2)^yv(e,13)^yv(e,22),xv=e=>yv(e,6)^yv(e,11)^yv(e,25),Sv=e=>yv(e,7)^yv(e,18)^e>>>3,Cv=e=>yv(e,17)^yv(e,19)^e>>>10,wv=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Tv=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ev=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(Tv),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,t=this._W;for(let e=16;e<64;e++)t[e]=Cv(t[e-2])+t[e-7]+Sv(t[e-15])+t[e-16];let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7];for(let e=0,u,d;e<64;e++)u=l+xv(o)+(o&s^~o&c)+wv[e]+t[e]>>>0,d=bv(n)+(n&r^n&i^r&i)>>>0,l=c,c=s,s=o,o=a+u>>>0,a=i,i=r,r=n,n=u+d>>>0;e[0]+=n,e[1]+=r,e[2]+=i,e[3]+=a,e[4]+=o,e[5]+=s,e[6]+=c,e[7]+=l}digest(e){let t=0;for(;t+56<=e.length;){let n=0;for(;n<16&&t+3<e.length;n++)this._W[n]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!=0){for(this._W.fill(0,n,16);t<e.length;)this._W[n]|=e[t]<<(3-t%4)*8,t++;this._W[n]|=128<<(3-t%4)*8}this._updateHash()}let n=t%64!=0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let n=3;n>=0&&t<e.length;n--)this._W[r]|=e[t++]<<n*8;n||(this._W[r-(t%4==0?0:1)]|=128<<(3-t%4)*8),this._W[14]=e.byteLength/Tu,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let e=0;e<this._H.length;e++)for(let t=0;t<4;t++)i[e*4+t]=this._H[e]>>>(3-t)*8;return i}},Dv=e=>new Ev().digest(e),Ov=new W(`y-sync`),kv=new W(`y-undo`),Av=new W(`yjs-cursor`),jv=e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)},Mv=e=>xf(jv(Dv(Cf(e)))),Nv=()=>({mapping:new Map,isOMark:new Map}),Pv=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!Tm(t.ds,e.id),Fv=[{light:`#ecd44433`,dark:`#ecd444`}],Iv=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){let n=Ql();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,Rd(t))}return e.get(n)},Lv=(e,{colors:t=Fv,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:a}={})=>{let o=!1,s=new Vv(e,a),c=new Gt({props:{editable:e=>{let t=Ov.getState(e);return t.snapshot==null&&t.prevSnapshot==null}},key:Ov,state:{init:(i,a)=>({type:e,doc:e.doc,binding:s,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(Ov);if(n!==void 0){t=Object.assign({},t);for(let e in n)t[e]=n[e]}return t.addToHistory=e.getMeta(`addToHistory`)!==!1,t.isChangeOrigin=n!==void 0&&!!n.isChangeOrigin,t.isUndoRedoOperation=n!==void 0&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,s.prosemirrorView!==null&&n!==void 0&&(n.snapshot!=null||n.prevSnapshot!=null)&&tm(0,()=>{s.prosemirrorView!=null&&(n.restore==null?s._renderSnapshot(n.snapshot,n.prevSnapshot,t):(s._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,s.mux(()=>{s._prosemirrorChanged(s.prosemirrorView.state.doc)})))}),t}},view:e=>(s.initView(e),a??s._forceRerender(),i(),{update:()=>{let t=c.getState(e.state);if(t.snapshot==null&&t.prevSnapshot==null&&(o||e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content)!==null)){if(o=!0,t.addToHistory===!1&&!t.isChangeOrigin){let t=kv.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}s.mux(()=>{t.doc.transact(n=>{n.meta.set(`addToHistory`,t.addToHistory),s._prosemirrorChanged(e.state.doc)},Ov)})}},destroy:()=>{s.destroy()}})});return c},Rv=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type===`all`)e.setSelection(new Re(e.doc));else if(t.type===`node`){let r=gy(n.doc,n.type,t.anchor,n.mapping);e.setSelection(zv(e,r))}else{let r=gy(n.doc,n.type,t.anchor,n.mapping),i=gy(n.doc,n.type,t.head,n.mapping);r!==null&&i!==null&&e.setSelection(vt.between(e.doc.resolve(r),e.doc.resolve(i)))}},zv=(e,t)=>{let n=e.doc.resolve(t);return n.nodeAfter?pt.create(e.doc,t):vt.near(n)},Bv=(e,t)=>({type:t.selection.jsonID,anchor:my(t.selection.anchor,e.type,e.mapping),head:my(t.selection.head,e.type,e.mapping)}),Vv=class{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=hv(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Bv(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta(`addToHistory`,!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(df&&this._domSelectionInView===null&&(tm(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let 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);let n=t.getBoundingClientRect(),r=zp.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||=Oh(km(),new Map),this.prosemirrorView.dispatch(this._tr.setMeta(Ov,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>Uv(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new sn(Me.from(e),0,0));t.setMeta(Ov,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection===null?this.prosemirrorView.state.selection:null,t=this.type.toArray().map(e=>Uv(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new sn(Me.from(t),0,0));if(e){let t=uu(du(e.anchor,0),n.doc.content.size),r=uu(du(e.head,0),n.doc.content.size);n.setSelection(vt.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(Ov,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||=kh(this.doc),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&gd(),r=new Fm({gc:!1}),Xm(r,t),t=kh(r),Xm(r,e),e=kh(r),i._item===null){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[];i=e[Ih(e,i._item.id.clock)].content.type}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let a=n.permanentUserData;a&&a.dss.forEach(e=>{Cm(r,e,e=>{})});let o=(e,t)=>{let r=e===`added`?a.getUserByClientId(t.client):a.getUserByDeletedId(t);return{user:r,type:e,color:Iv(n.colorMapping,n.colors,r)}},s=kg(i,new Dh(t.ds,e.sv)).map(n=>!n._item.deleted||Pv(n._item,e)||Pv(n._item,t)?Uv(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>e!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new sn(Me.from(s),0,0));this.prosemirrorView.dispatch(c.setMeta(Ov,{isChangeOrigin:!0}))},Ov)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;let n=Ov.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);Cm(t,t.deleteSet,e=>{if(e.constructor===cv){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e);let n=this.type.toArray().map(e=>Hv(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new sn(Me.from(n),0,0));Rv(r,this.beforeTransactionSelection,this),r=r.setMeta(Ov,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof eg}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&r.scrollIntoView(),this.prosemirrorView.dispatch(r)})}_prosemirrorChanged(e){this.doc.transact(()=>{sy(this.doc,this.type,e,this),this.beforeTransactionSelection=Bv(this,this.prosemirrorView.state)},Ov)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.on(`afterAllTransactions`,this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.off(`afterAllTransactions`,this.afterAllTransactions))}},Hv=(e,t,n,r,i,a)=>{let o=n.mapping.get(e);if(o===void 0){if(e instanceof y_)return Uv(e,t,n,r,i,a);throw hd()}return o},Uv=(e,t,n,r,i,a)=>{let o=[],s=e=>{if(e instanceof y_){let s=Hv(e,t,n,r,i,a);s!==null&&o.push(s)}else{let s=e._item.right?.content?.type;s instanceof m_&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(e.applyDelta([{retain:e.length},...s.toDelta()]),s.doc.transact(e=>{s._item.delete(e)}));let c=Wv(e,t,n,r,i,a);c!==null&&c.forEach(e=>{e!==null&&o.push(e)})}};r===void 0||i===void 0?e.toArray().forEach(s):kg(e,new Dh(i.ds,r.sv)).forEach(s);try{let s=e.getAttributes(r);r!==void 0&&(Pv(e._item,r)?Pv(e._item,i)||(s.ychange=a?a(`added`,e._item.id):{type:`added`}):s.ychange=a?a(`removed`,e._item.id):{type:`removed`});let c=t.node(e.nodeName,s,o);return n.mapping.set(e,c),c}catch(r){console.warn(`[y-prosemirror] schema.node(`+e.nodeName+`) threw:`,String(r&&r.message||r));let i=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};if(t.nodes[e.nodeName]&&t.nodes[e.nodeName].spec&&t.nodes[e.nodeName].spec.inline)i.inline++;else if(i.block++,t.nodes.rawMdxFallback)try{let i=t.node(`rawMdxFallback`,{reason:String(r&&r.message||r)},[t.text(e.nodeName)]);return n.mapping.set(e,i),i}catch(e){console.warn(`[y-prosemirror] rawMdxFallback substitution also failed:`,String(e&&e.message||e))}return n.mapping.delete(e),null}},Wv=(e,t,n,r,i,a)=>{let o=[],s=e.toDelta(r,i,a);try{for(let e=0;e<s.length;e++){let n=s[e];o.push(t.text(n.insert,ay(n.attributes,t)))}}catch(e){console.warn(`[y-prosemirror] schema.text() threw:`,String(e&&e.message||e));let t=globalThis.__okYpsCounters=globalThis.__okYpsCounters||{block:0,inline:0};return t.inline++,null}return o},Gv=(e,t)=>{let n=new w_,r=e.map(e=>({insert:e.text,attributes:oy(e.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},Kv=(e,t)=>{let n=new y_(e.type.name);for(let t in e.attrs){let r=e.attrs[t];r!==null&&t!==`ychange`&&n.setAttribute(t,r)}return n.insert(0,Xv(e).map(e=>qv(e,t))),t.mapping.set(n,e),n},qv=(e,t)=>e instanceof Array?Gv(e,t):Kv(e,t),Jv=e=>typeof e==`object`&&!!e,Yv=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==null),r=n.length===Object.keys(t).filter(e=>t[e]!==null).length;for(let i=0;i<n.length&&r;i++){let a=n[i],o=e[a],s=t[a];r=a===`ychange`||o===s||Jv(o)&&Jv(s)&&Yv(o,s)}return r},Xv=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},Zv=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&Xd(e.attributes||{}).length===t[n].marks.length&&ef(e.attributes,(e,r)=>{let i=iy(r),a=t[n].marks;return a.find(e=>e.type.name===i)?Yv(e,a.find(e=>e.type.name===i)?.attrs):!1}))},Qv=(e,t)=>{if(e instanceof y_&&!(t instanceof Array)&&cy(e,t)){let n=Xv(t);return e._length===n.length&&Yv(e.getAttributes(),t.attrs)&&e.toArray().every((e,t)=>Qv(e,n[t]))}return e instanceof w_&&t instanceof Array&&Zv(e,t)},$v=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),ey=(e,t,n)=>{let r=e.toArray(),i=Xv(t),a=i.length,o=r.length,s=uu(o,a),c=0,l=0,u=!1;for(;c<s;c++){let e=r[c],t=i[c];if($v(n.mapping.get(e),t))u=!0;else if(!Qv(e,t))break}for(;c+l<s;l++){let e=r[o-l-1],t=i[a-l-1];if($v(n.mapping.get(e),t))u=!0;else if(!Qv(e,t))break}return{equalityFactor:c+l,foundMappedChild:u}},ty=e=>{let t=``,n=e._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof G_?t+=n.content.str:n.content instanceof R_&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},ny=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=ty(e),a=t.map(e=>({insert:e.text,attributes:Object.assign({},r,oy(e.marks,n))})),{insert:o,remove:s,index:c}=vv(i,a.map(e=>e.insert).join(``));e.delete(c,s),e.insert(c,o),e.applyDelta(a.map(e=>({retain:e.insert.length,attributes:e.attributes})))},ry=/(.*)(--[a-zA-Z0-9+/=]{8})$/,iy=e=>ry.exec(e)?.[1]??e,ay=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(iy(r),e[r]));return n},oy=(e,t)=>{let n={};return e.forEach(e=>{if(e.type.name!==`ychange`){let r=Yl(t.isOMark,e.type,()=>!e.type.excludes(e.type));n[r?`${e.type.name}--${Mv(e.toJSON())}`:e.type.name]=e.attrs}}),n},sy=(e,t,n,r)=>{if(t instanceof y_&&t.nodeName!==n.type.name)throw Error(`node name mismatch!`);if(r.mapping.set(t,n),t instanceof y_){let e=t.getAttributes(),r=n.attrs;for(let n in r)r[n]===null?t.removeAttribute(n):e[n]!==r[n]&&n!==`ychange`&&t.setAttribute(n,r[n]);for(let n in e)r[n]===void 0&&t.removeAttribute(n)}let i=Xv(n),a=i.length,o=t.toArray(),s=o.length,c=uu(a,s),l=0,u=0;for(;l<c;l++){let e=o[l],t=i[l];if(!$v(r.mapping.get(e),t))if(Qv(e,t))r.mapping.set(e,t);else break}for(;u+l+1<c;u++){let e=o[s-u-1],t=i[a-u-1];if(!$v(r.mapping.get(e),t))if(Qv(e,t))r.mapping.set(e,t);else break}e.transact(()=>{for(;s-l-u>0&&a-l-u>0;){let n=o[l],c=i[l],d=o[s-u-1],f=i[a-u-1];if(n instanceof w_&&c instanceof Array)Zv(n,c)||ny(n,c,r),l+=1;else{let i=n instanceof y_&&cy(n,c),a=d instanceof y_&&cy(d,f);if(i&&a){let e=ey(n,c,r),t=ey(d,f,r);e.foundMappedChild&&!t.foundMappedChild?a=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:a=!1}i?(sy(e,n,c,r),l+=1):a?(sy(e,d,f,r),u+=1):(r.mapping.delete(t.get(l)),t.delete(l,1),t.insert(l,[qv(c,r)]),l+=1)}}let n=s-l-u;if(s===1&&a===0&&o[0]instanceof w_?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(l,l+n).forEach(e=>r.mapping.delete(e)),t.delete(l,n)),l+u<a){let e=[];for(let t=l;t<a-u;t++)e.push(qv(i[t],r));t.insert(l,e)}},Ov)},cy=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,ly=null,uy=class{constructor(e,t,n){this.view=e,this.key=t,this.value=n}apply(){let e=Ov.getState(this.view.state);if(e&&e.binding&&!e.binding.isDestroyed){let e=this.view.state.tr;e.setMeta(this.key,this.value),this.view.dispatch(e)}}},dy=class e{constructor(e=[]){this.entries=e}getFirst(){return this.entries[0]}dequeueFirst(){return this.entries.shift()}isEmpty(){return this.entries.length===0}static fromViewsToUpdate(){let t=ly;ly=null;let n=[];return t.forEach((e,t)=>{e.forEach((e,r)=>{n.push(new uy(t,r,e))})}),new e(n)}},fy=(e=dy.fromViewsToUpdate(),t=!1)=>{let n=!0;for(;!e.isEmpty();){let r=e.getFirst();try{r.apply()}catch(r){if(r instanceof RangeError){t&&n&&e.dequeueFirst(),e.isEmpty()||tm(0,()=>fy(e,!0));return}throw r}n=!1,e.dequeueFirst()}},py=(e,t,n)=>{ly||(ly=new Map,tm(0,fy)),Yl(ly,e,ql).set(t,n)},my=(e,t,n)=>{if(e===0)return Ch(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof w_){if(r._length>=e)return Ch(r,e,-1);if(e-=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,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new _h(r._item===null?null:r._item.id,r._item===null?hh(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new _h(r._item===null?null:r._item.id,r._item===null?hh(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw gd();if(e===0&&r.constructor!==w_&&r!==t)return hy(r._item.parent,r._item)}return Ch(t,t._length,-1)},hy=(e,t)=>{let n=null,r=null;return e._item===null?r=hh(e):n=mh(e._item.id.client,e._item.id.clock),new _h(n,r,t.id)},gy=(e,t,n,r)=>{let i=Th(n,e);if(i===null||i.type!==t&&!gh(t,i.type._item))return null;let a=i.type,o=0;if(a.constructor===w_)o=i.index;else if(a._item===null||!a._item.deleted){let e=a._first,t=0;for(;t<a._length&&t<i.index&&e!==null;){if(!e.deleted){let n=e.content.type;t++,n instanceof w_?o+=n._length:o+=r.get(n).nodeSize}e=e.right}o+=1}for(;a!==t&&a._item!==null;){let e=a._item.parent;if(e._item===null||!e._item.deleted){o+=1;let t=e._first;for(;t!==null;){let e=t.content.type;if(e===a)break;t.deleted||(e instanceof w_?o+=e._length:o+=r.get(e).nodeSize),t=t.right}}a=e}return o-1},_y=(e,t)=>{let n=Nv(),r=e.toArray().map(e=>Uv(e,t,n)).filter(e=>e!==null);return{doc:t.topNodeType.create(null,Me.fromArray(r)),meta:n,mapping:n.mapping}},vy=(e,t,n)=>e!==t,yy=e=>{let t=document.createElement(`span`);t.classList.add(`ProseMirror-yjs-cursor`),t.setAttribute(`style`,`border-color: ${e.color}`);let n=document.createElement(`div`);n.setAttribute(`style`,`background-color: ${e.color}`),n.insertBefore(document.createTextNode(e.name),null);let r=document.createTextNode(``),i=document.createTextNode(``);return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(i,null),t},by=e=>({style:`background-color: ${e.color}70`,class:`ProseMirror-yjs-selection`}),xy=/^#[0-9a-fA-F]{6}$/,Sy=(e,t,n,r,i)=>{let a=Ov.getState(e);if(a==null||a.doc==null||a.binding==null)return Tt.create(e.doc,[]);let o=a.doc,s=[];return a.snapshot!=null||a.prevSnapshot!=null||a.binding.mapping.size===0?Tt.create(e.doc,[]):(t.getStates().forEach((t,c)=>{if(n(o.clientID,c,t)&&t.cursor!=null){let n=t.user||{};n.color==null?n.color=`#ffa500`:xy.test(n.color)||console.warn(`A user uses an unsupported color format`,n),n.name??=`User: ${c}`;let l=gy(o,a.type,yh(t.cursor.anchor),a.binding.mapping),u=gy(o,a.type,yh(t.cursor.head),a.binding.mapping);if(l!==null&&u!==null){let t=du(e.doc.content.size-1,0);l=uu(l,t),u=uu(u,t),s.push(Pe.widget(u,()=>r(n,c),{key:c+``,side:10}));let a=uu(l,u),o=du(l,u);s.push(Pe.inline(a,o,i(n,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Tt.create(e.doc,s))},Cy=(e,{awarenessStateFilter:t=vy,cursorBuilder:n=yy,selectionBuilder:r=by,getSelection:i=e=>e.selection}={},a=`cursor`)=>new Gt({key:Av,state:{init(i,a){return Sy(a,e,t,n,r)},apply(i,a,o,s){let c=Ov.getState(s),l=i.getMeta(Av);return c&&c.isChangeOrigin||l&&l.awarenessUpdated?Sy(s,e,t,n,r):a.map(i.mapping,i.doc)}},props:{decorations:e=>Av.getState(e)},view:t=>{let n=()=>{t.docView&&py(t,Av,{awarenessUpdated:!0})},r=()=>{let n=Ov.getState(t.state),r=e.getLocalState()||{};if(t.hasFocus()){let o=i(t.state),s=my(o.anchor,n.type,n.binding.mapping),c=my(o.head,n.type,n.binding.mapping);(r.cursor==null||!Eh(yh(r.cursor.anchor),s)||!Eh(yh(r.cursor.head),c))&&e.setLocalStateField(a,{anchor:s,head:c})}else r.cursor!=null&&gy(n.doc,n.type,yh(r.cursor.anchor),n.binding.mapping)!==null&&e.setLocalStateField(a,null)};return e.on(`change`,n),t.dom.addEventListener(`focusin`,r),t.dom.addEventListener(`focusout`,r),{update:r,destroy:()=>{t.dom.removeEventListener(`focusin`,r),t.dom.removeEventListener(`focusout`,r),e.off(`change`,n),e.setLocalStateField(a,null)}}}}),wy=e=>{let t=kv.getState(e).undoManager;if(t!=null)return t.undo(),!0},Ty=e=>{let t=kv.getState(e).undoManager;if(t!=null)return t.redo(),!0},Ey=new Set([`paragraph`]),Dy=(e,t)=>!(e instanceof cv)||!(e.content instanceof tv)||!(e.content.type instanceof m_||e.content.type instanceof y_&&t.has(e.content.type.nodeName))||e.content.type._length===0,Oy=({protectedNodes:e=Ey,trackedOrigins:t=[],undoManager:n=null}={})=>new Gt({key:kv,state:{init:(r,i)=>{let a=Ov.getState(i),o=n||new eg(a.type,{trackedOrigins:new Set([Ov].concat(t)),deleteFilter:t=>Dy(t,e),captureTransaction:e=>e.meta.get(`addToHistory`)!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=Ov.getState(r).binding,a=t.undoManager,o=a.undoStack.length>0,s=a.redoStack.length>0;return i?{undoManager:a,prevSel:Bv(i,n),hasUndoOps:o,hasRedoOps:s}:o!==t.hasUndoOps||s!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):t}},view:e=>{let t=Ov.getState(e.state),n=kv.getState(e.state).undoManager;return n.on(`stack-item-added`,({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,kv.getState(e.state).prevSel)}),n.on(`stack-item-popped`,({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy()}}}});function ky(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=I(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function Ay(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
6
|
-
`);return/\s/.test(n)}):!1}var jy=new W(`suggestion`);function My({pluginKey:e=jy,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=ky,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!Ay(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let T=new Gt({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=T.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=T.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=T.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),Tt.create(e.doc,[Pe.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var Ny=My;function Py(e){return e.kind===`create`?`create:${e.value}`:`tag:${e.value}`}function Fy(e){if(e.kind===`create`){let t=e.value;return _._({id:`XPqe3B`,values:{tagValue:t}})}let t=_._({id:`pckX1A`,values:{0:e.count}}),n=e.value;return _._({id:`m2T1Xj`,values:{tagValue:n,uses:t}})}function Iy(e){let t=(0,J.c)(38),{items:n,query:r,selectedIndex:a,onSelect:s,onHover:c,loading:l,error:u}=e,d=l===void 0?!1:l,f=u===void 0?null:u,{_:p}=i(),m=(0,Y.useRef)(null),h=(0,Y.useId)(),g=a>=0&&a<n.length?`${h}-option-${a}`:void 0,_,v;t[0]===a?(_=t[1],v=t[2]):(_=()=>{let e=m.current;if(!e)return;let t=e.querySelectorAll(`[role="option"]`).item(a);t&&t.scrollIntoView({block:`nearest`})},v=[a],t[0]=a,t[1]=_,t[2]=v),(0,Y.useEffect)(_,v);let y=Ly;if(d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{ref:m,role:`status`,"aria-live":`polite`,className:`w-64 rounded-lg border bg-popover p-2 shadow-md text-sm text-muted-foreground`,style:e,onMouseDown:y,children:(0,X.jsx)(o,{id:`a_u4ck`})}),t[4]=n):n=t[4],n}if(n.length===0){let e;if(t[5]!==p||t[6]!==f||t[7]!==r){let n=r.trim();e=f??p(n?{id:`9R7pRC`,values:{trimmed:n}}:{id:`KRJ6xh`}),t[5]=p,t[6]=f,t[7]=r,t[8]=e}else e=t[8];let n=e,i;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(i={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[9]=i):i=t[9];let a;return t[10]===n?a=t[11]:(a=(0,X.jsx)(`div`,{ref:m,role:`status`,"aria-live":`polite`,className:`w-64 rounded-lg border bg-popover p-2 shadow-md text-sm text-muted-foreground`,style:i,onMouseDown:y,children:n}),t[10]=n,t[11]=a),a}let b=a>=0&&a<n.length?n[a]:null,x;t[12]===p?x=t[13]:(x=p({id:`SCoBBH`}),t[12]=p,t[13]=x);let S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[14]=S):S=t[14];let C;t[15]===b?C=t[16]:(C=b?Fy(b):``,t[15]=b,t[16]=C);let w;t[17]===C?w=t[18]:(w=(0,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:C}),t[17]=C,t[18]=w);let T;t[19]===f?T=t[20]:(T=f&&(0,X.jsx)(`div`,{className:`rounded-md px-2 py-1.5 text-xs text-amber-700 dark:text-amber-300`,children:f}),t[19]=f,t[20]=T);let E;if(t[21]!==n||t[22]!==h||t[23]!==c||t[24]!==s||t[25]!==a){let e;t[27]!==h||t[28]!==c||t[29]!==s||t[30]!==a?(e=(e,t)=>{let n=t===a,r=Py(e),i=e.kind===`create`;return(0,X.jsxs)(`button`,{id:`${h}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-selected":n,"data-testid":i?`tag-suggestion-create`:`tag-suggestion-tag-${e.value}`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),s(e)},onPointerMove:c?()=>c(t):void 0,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-xs text-muted-foreground`,children:`#`}),(0,X.jsx)(`span`,{className:`truncate font-medium flex-1`,children:e.value}),i?(0,X.jsx)(`span`,{className:`shrink-0 rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary`,children:(0,X.jsx)(o,{id:`isRobC`})}):(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:e.count})]},r)},t[27]=h,t[28]=c,t[29]=s,t[30]=a,t[31]=e):e=t[31],E=n.map(e),t[21]=n,t[22]=h,t[23]=c,t[24]=s,t[25]=a,t[26]=E}else E=t[26];let D;return t[32]!==g||t[33]!==E||t[34]!==x||t[35]!==w||t[36]!==T?(D=(0,X.jsxs)(`div`,{ref:m,role:`listbox`,"aria-label":x,"aria-activedescendant":g,tabIndex:-1,onMouseDown:y,className:`w-64 overflow-y-auto subtle-scrollbar rounded-lg border bg-popover p-1 shadow-md`,style:S,children:[w,T,E]}),t[32]=g,t[33]=E,t[34]=x,t[35]=w,t[36]=T,t[37]=D):D=t[37],D}function Ly(e){return e.preventDefault()}var Ry=new WeakMap;function zy(e,t){Ry.set(e,t)}function By(e){return Ry.get(e)??!1}function Vy(e,t){let n=document.createElement(`div`);n.style.position=`fixed`,n.style.zIndex=`50`,n.style.visibility=`hidden`,document.body.appendChild(n);let r={getBoundingClientRect:()=>e()?.clientRect?.()??new DOMRect,get contextElement(){return e()?.editor.view.dom}},i=!1,a=!1,o=()=>{n.isConnected&&(n.style.removeProperty(`--suggestion-menu-max-height`),ge(r,n,{placement:`bottom-start`,middleware:[jt(4),xe(),M({padding:8}),Ee({apply({availableHeight:e}){n.isConnected&&n.style.setProperty(`--suggestion-menu-max-height`,`${Math.min(e,window.innerHeight*.4)}px`)}})]}).then(({x:e,y:t})=>{n.isConnected&&(n.style.left=`${e}px`,n.style.top=`${t}px`,i&&!a&&(n.style.removeProperty(`visibility`),a=!0))}).catch(e=>{n.isConnected&&console.warn(`[${t}] computePosition failed`,e)}))};return{popup:n,doPosition:o,startAutoUpdate:()=>E(r,n,o),reveal:()=>{a||(i=!0,o())}}}function Hy(e){e.stopAutoUpdate?.(),e.stopAutoUpdate=null,e.popup?.remove(),e.popup=null}var Uy=new W(`tagSuggestion`),Wy=8,Gy=/^[a-zA-Z][\w/-]*$/;async function Ky(){let e=await fetch(`/api/tags`);if(!e.ok)throw Error(`/api/tags responded with ${e.status}`);let t=await e.json();return Array.isArray(t.tags)?t.tags:[]}function qy(e,t){let n=t.trim(),r=n.toLowerCase(),i=n===``?e.slice():e.filter(e=>e.name.toLowerCase().includes(r));return i.sort((e,t)=>{let n=+!e.name.toLowerCase().startsWith(r),i=+!t.name.toLowerCase().startsWith(r);return n===i?t.count===e.count?e.name.localeCompare(t.name):t.count-e.count:n-i}),i}function Jy(e,t){let n=qy(e,t).slice(0,Wy).map(e=>({kind:`tag`,value:e.name,count:e.count,isLeaf:e.isLeaf})),r=t.trim();return r&&Gy.test(r)&&!e.some(e=>e.name===r)&&n.unshift({kind:`create`,value:r}),n}function Yy(e){let{$position:t}=e,n=t.parent.textBetween(0,t.parentOffset,void 0,``).match(/(^|[\s])#([a-zA-Z][\w/-]*)?$/);if(!n)return null;let r=n[2]??``,i=t.start(),a=n[1].length;return{range:{from:i+((n.index??0)+a),to:t.pos},query:r,text:`#${r}`}}function Xy(e){let t=[],n=!1,r=null,i=null;return Ny({editor:e,pluginKey:Uy,char:`#`,allowedPrefixes:null,findSuggestionMatch:Yy,allow:({editor:e})=>!By(e),items:async({query:e})=>{if(!n){r||=Ky();try{t=await r,i=null}catch(e){console.error(`[tag-suggestion] Failed to fetch tags:`,e),i=`Failed to load tags. Press Escape and type # again to retry, or continue typing to create a new tag.`,t=[]}finally{n=!0,r=null}}return Jy(t,e)},command:({editor:e,range:t,props:n})=>{try{let r=n.value;if(!r||!Gy.test(r))return;e.chain().focus().deleteRange(t).insertContent({type:`tag`,attrs:{value:r}}).insertContent(` `).run()}catch(e){console.error(`[tag-suggestion] command failed`,{item:n,range:t},e)}},render:()=>{let e=null,a=null,o=0,s={popup:null,stopAutoUpdate:null},c=null,l=null,u=e=>{a?.command(e)},d=e=>{o!==e&&(o=e,p(null))};function f(e,t,r){let a=t===null?!n:t;return{items:e.items,query:e.query??``,selectedIndex:o,onSelect:r,onHover:d,loading:a,error:i}}let p=t=>{!e||!a||e.updateProps(f(a,t,u))};return{onBeforeStart(t){a=t,o=0;let n=Vy(()=>a,`tag-suggestion`);s.popup=n.popup,c=n.doPosition,l=n.reveal,e=new Bl(Iy,{props:f(t,!0,u),editor:t.editor}),n.popup.appendChild(e.element),s.stopAutoUpdate=n.startAutoUpdate()},onStart(e){a=e,o=0,p(null),l?.()},onUpdate(e){a=e,o=Math.min(o,Math.max(0,e.items.length-1)),p(null),c?.()},onKeyDown({event:e}){if(!a)return!1;let t=a.items;if(e.key===`ArrowDown`)return t.length===0?!1:(o=(o+1)%t.length,p(null),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(o=(o-1+t.length)%t.length,p(null),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[o];if(e)return a.command(e),!0;let n=(a.query??``).trim();return n&&Gy.test(n)?(a.command({kind:`create`,value:n}),!0):!1}return e.key,!1},onExit(){Hy(s),c=null,l=null,e?.destroy(),e=null,a=null,o=0,t=[],i=null,n=!1,r=null}}}})}var Zy=1,Qy=.9,$y=.8,eb=.17,tb=.1,nb=.999,rb=.9999,ib=.99,ab=/[\\\/_+.#"@\[\(\{&]/,ob=/[\\\/_+.#"@\[\(\{&]/g,sb=/[\s-]/,cb=/[\s-]/g;function lb(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Zy:ib;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=lb(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Zy:ab.test(e.charAt(l-1))?(d*=$y,p=e.slice(i,l-1).match(ob),p&&i>0&&(d*=nb**+p.length)):sb.test(e.charAt(l-1))?(d*=Qy,m=e.slice(i,l-1).match(cb),m&&i>0&&(d*=nb**+m.length)):(d*=eb,i>0&&(d*=nb**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=rb)),(d<tb&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=lb(e,t,n,r,l+1,a+2,o),f*tb>d&&(d=f*tb)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ub(e){return e.toLowerCase().replace(cb,` `)}function db(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,lb(e,t,ub(e),ub(t),0,0,{})}var fb=`[cmdk-group=""]`,pb=`[cmdk-group-items=""]`,mb=`[cmdk-group-heading=""]`,hb=`[cmdk-item=""]`,gb=`${hb}:not([aria-disabled="true"])`,_b=`cmdk-item-select`,vb=`data-value`,yb=(e,t,n)=>db(e,t,n),bb=Y.createContext(void 0),xb=()=>Y.useContext(bb),Sb=Y.createContext(void 0),Cb=()=>Y.useContext(Sb),wb=Y.createContext(void 0),Tb=Y.forwardRef((e,t)=>{let n=zb(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=zb(()=>new Set),i=zb(()=>new Map),a=zb(()=>new Map),o=zb(()=>new Set),s=Lb(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=En(),y=En(),b=En(),x=Y.useRef(null),S=Hb();Rb(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Rb(()=>{S(6,k)},[]);let C=Y.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=Y.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??yb;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(pb);t?t.appendChild(e.parentElement===t?e:e.closest(`${pb} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${pb} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${fb}[${vb}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(vb);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(fb)?.querySelector(mb))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${hb}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(gb)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(vb))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(vb))}function P(e){let t=A()?.closest(fb),n;for(;t&&!n;)t=e>0?Fb(t,fb):Ib(t,fb),n=t?.querySelector(gb);n?C.setState(`value`,n.getAttribute(vb)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return Y.createElement(Sn.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(_b);t.dispatchEvent(e)}}}}},Y.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Gb},c),Wb(e,e=>Y.createElement(Sb.Provider,{value:C},Y.createElement(bb.Provider,{value:w},e))))}),Eb=Y.forwardRef((e,t)=>{let n=En(),r=Y.useRef(null),i=Y.useContext(wb),a=xb(),o=Lb(e),s=o.current?.forceMount??i?.forceMount;Rb(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Vb(n,r,[e.value,e.children,r],e.keywords),l=Cb(),u=Bb(e=>e.value&&e.value===c.current),d=Bb(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);Y.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(_b,f),()=>t.removeEventListener(_b,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return Y.createElement(Sn.div,{ref:jn(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Db=Y.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=En(),s=Y.useRef(null),c=Y.useRef(null),l=En(),u=xb(),d=Bb(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);Rb(()=>u.group(o),[]),Vb(o,s,[e.value,e.heading,c]);let f=Y.useMemo(()=>({id:o,forceMount:i}),[i]);return Y.createElement(Sn.div,{ref:jn(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&Y.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Wb(e,e=>Y.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Y.createElement(wb.Provider,{value:f},e))))}),Ob=Y.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Y.useRef(null),a=Bb(e=>!e.search);return!n&&!a?null:Y.createElement(Sn.div,{ref:jn(i,t),...r,"cmdk-separator":``,role:`separator`})}),kb=Y.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Cb(),o=Bb(e=>e.search),s=Bb(e=>e.selectedItemId),c=xb();return Y.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Y.createElement(Sn.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ab=Y.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Y.useRef(null),o=Y.useRef(null),s=Bb(e=>e.selectedItemId),c=xb();return Y.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Y.createElement(Sn.div,{ref:jn(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Wb(e,e=>Y.createElement(`div`,{ref:jn(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),jb=Y.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Y.createElement(Vn,{open:n,onOpenChange:r},Y.createElement(Wn,{container:o},Y.createElement(Ln,{"cmdk-overlay":``,className:i}),Y.createElement(In,{"aria-label":e.label,"cmdk-dialog":``,className:a},Y.createElement(Tb,{ref:t,...s}))))}),Mb=Y.forwardRef((e,t)=>Bb(e=>e.filtered.count===0)?Y.createElement(Sn.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Nb=Y.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Y.createElement(Sn.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Wb(e,e=>Y.createElement(`div`,{"aria-hidden":!0},e)))}),Pb=Object.assign(Tb,{List:Ab,Item:Eb,Input:kb,Group:Db,Separator:Ob,Dialog:jb,Empty:Mb,Loading:Nb});function Fb(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ib(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Lb(e){let t=Y.useRef(e);return Rb(()=>{t.current=e}),t}var Rb=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function zb(e){let t=Y.useRef();return t.current===void 0&&(t.current=e()),t}function Bb(e){let t=Cb(),n=()=>e(t.snapshot());return Y.useSyncExternalStore(t.subscribe,n,n)}function Vb(e,t,n,r=[]){let i=Y.useRef(),a=xb();return Rb(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(vb,s),i.current=s}),i}var Hb=()=>{let[e,t]=Y.useState(),n=zb(()=>new Map);return Rb(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ub(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Wb({asChild:e,children:t},n){return e&&Y.isValidElement(t)?Y.cloneElement(Ub(t),{ref:t.ref},n(t.props.children)):n(t)}var Gb={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function Kb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb,{"data-slot":`command`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qb(e){let t=(0,J.c)(34),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({title:o,description:s,children:n,className:r,showCloseButton:c,commandProps:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`Command Palette`:o,u=s===void 0?`Search for a command to run`:s,d=c===void 0?!0:c,f;t[8]===i?f=t[9]:(f=i??{},t[8]=i,t[9]=f);let p,m;t[10]===f?(p=t[11],m=t[12]):({className:p,...m}=f,t[10]=f,t[11]=p,t[12]=m);let h;t[13]===r?h=t[14]:(h=pn(`top-[12vh] translate-y-0 overflow-hidden p-0`,r),t[13]=r,t[14]=h);let g;t[15]===l?g=t[16]:(g=(0,X.jsx)(Fn,{className:`sr-only`,children:l}),t[15]=l,t[16]=g);let _;t[17]===u?_=t[18]:(_=(0,X.jsx)(Pn,{className:`sr-only`,children:u}),t[17]=u,t[18]=_);let v;t[19]===p?v=t[20]:(v=pn(`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,p),t[19]=p,t[20]=v);let y;t[21]!==n||t[22]!==m||t[23]!==v?(y=(0,X.jsx)(Kb,{className:v,...m,children:n}),t[21]=n,t[22]=m,t[23]=v,t[24]=y):y=t[24];let b;t[25]!==d||t[26]!==h||t[27]!==g||t[28]!==_||t[29]!==y?(b=(0,X.jsxs)(zn,{className:h,showCloseButton:d,children:[g,_,y]}),t[25]=d,t[26]=h,t[27]=g,t[28]=_,t[29]=y,t[30]=b):b=t[30];let x;return t[31]!==a||t[32]!==b?(x=(0,X.jsx)(qn,{...a,children:b}),t[31]=a,t[32]=b,t[33]=x):x=t[33],x}function Jb(e){let t=(0,J.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(ba,{className:`size-4 shrink-0 opacity-50`}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=pn(`flex w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,X.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex items-center gap-2 border-b px-3`,children:[i,(0,X.jsx)(Pb.Input,{"data-slot":`command-input`,className:a,...r})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function Yb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb.List,{"data-slot":`command-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xb(e){let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Pb.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e}),t[0]=e,t[1]=n),n}function Zb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-mono [&_[cmdk-group-heading]]:uppercase **:[[cmdk-group-heading]]:tracking-wider`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb.Item,{"data-slot":`command-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $b(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`ml-auto text-muted-foreground text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`span`,{"data-slot":`command-shortcut`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function ex(e,t){let n=null,r;try{n=await e.json()}catch(e){r=e}if(e.ok)return r!==void 0&&console.warn(`[parse-server-response] 2xx response with non-JSON body:`,r instanceof Error?r.message:String(r)),{ok:!0,body:r===void 0?n:null};if(r!==void 0){let t=r instanceof Error?r.message:String(r);return{ok:!1,title:`Server error (HTTP ${e.status}): ${t}`}}return{ok:!1,title:d(n)??t}}function tx(e,t,n,r){let i=e.safeParse(t);return i.success?i.data:(console.warn(`[parse-server-response] schema drift:`,n,`bodyShape=`,typeof t==`object`&&t?Object.keys(t):typeof t,`issues=`,i.error.issues),r)}var nx=new Map,rx=null;function ix(){return dc(`PREWARM_CORRELATION_WINDOW_MS`,5e3)}function ax(){if(rx!==null)return;let e=Math.max(50,Math.floor(ix()/2));rx=setTimeout(()=>{rx=null,ox(Date.now()),nx.size>0&&ax()},e)}function ox(e){let t=ix();for(let[n,r]of nx)e-r.emittedAt>=t&&(nx.delete(n),Z.count(`ok/sidebar/prewarm`,{hit:!1}))}function sx(e,t,n=Date.now()){nx.has(e)&&Z.count(`ok/sidebar/prewarm`,{hit:!1}),nx.set(e,{poolEventId:t,emittedAt:n}),ax()}function cx(e,t,n=Date.now()){let r=nx.get(e);return!r||r.poolEventId!==t||n-r.emittedAt>=ix()?!1:(nx.delete(e),Z(`ok/sidebar/prewarm-clicked`,{docName:e,t:n,poolEventId:t}),Z.count(`ok/sidebar/prewarm`,{hit:!0}),!0)}en({event:p(`ok-branch-switched-clear-failed`),branch:pe(),docName:pe(),reason:pe()});async function lx(e,t){let n=[];for(let[r,i]of e.entries)i.kind===`active`&&i.persistence!==null&&n.push(i.persistence.clearData().catch(e=>{let n={event:`ok-branch-switched-clear-failed`,docName:r,branch:t,reason:e instanceof Error?e.message:String(e)};console.warn(JSON.stringify(n))}));await Promise.all(n),e.clearBufferedUpdates(),e.recycleAllEntries()}function ux(e){let t=!1;return()=>{t?e():t=!0}}function dx(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}async function fx(e,t=``){let n;try{n=await fetch(`${t}/api/server-info`,{signal:AbortSignal.timeout(5e3)})}catch{return}if(!n.ok)return;let r;try{r=await n.json()}catch{return}let i=St.safeParse(r);if(!i.success){console.warn(JSON.stringify({event:`ok-server-info-schema-mismatch`,issues:i.error.issues}));return}if(e.setExpectedServerInstanceId(i.data.serverInstanceId),i.data.currentBranch!==void 0&&e.compareAndUpdateObservedBranch(i.data.currentBranch)&&lx(e,i.data.currentBranch),i.data.currentDiskAckSVs!==void 0){let t={};for(let[e,n]of Object.entries(i.data.currentDiskAckSVs))try{t[e]=dx(n)}catch{}e.observeDiskAckBatch(t)}}async function px(e){let t;try{t=await fetch(`/api/config`,{signal:e,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return{status:`error`,code:`network`}}if(t.status===404||t.status===501)return{status:`absent`};if(!t.ok)return{status:`error`,code:t.status};let n;try{n=await t.json()}catch{return{status:`error`,code:`invalid-body`}}if(typeof n!=`object`||!n||Array.isArray(n))return{status:`error`,code:`invalid-body`};let r=n;return{status:`ok`,config:{collabUrl:typeof r.collabUrl==`string`?r.collabUrl:null,previewUrl:typeof r.previewUrl==`string`?r.previewUrl:null,port:typeof r.port==`number`?r.port:0}}}function mx(e){return Sx(e,qt)}function hx(e){return Sx(e,Je)}function gx(e){return Sx(e,Vt)}function _x(e){return Sx(e,gt)}function vx(e){return Sx(e,ze)}function yx(e){let t=Sx(e,Ue);if(!t)return null;try{return{docName:t.docName,sv:bx(t.sv)}}catch{return null}}function bx(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function xx(e,t){let n=hx(e);if(n){t.onServerInfo?.(n);return}let r=gx(e);if(r){t.onBranchSwitched?.(r);return}let i=yx(e);if(i){t.onDiskAck?.(i);return}let a=mx(e);if(a){t.onDerivedView?.(a);return}let o=_x(e);if(o){t.onConfigValidationRejected?.(o);return}let s=vx(e);if(s){t.onConfigIgnoreNestedError?.(s);return}t.onUnknown?.(e)}function Sx(e,t){let n;try{n=JSON.parse(e)}catch{return null}let r=t.safeParse(n);return r.success?r.data:null}function Cx(){return typeof location>`u`?`ws://localhost/collab`:`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/collab`}function wx(e){if(e===void 0)return null;let t=e.okDesktop;return!t||!t.config.collabUrl||t.config.collabUrl.length===0?null:t}function Tx(e){return{collabUrl:e.collabUrl,attempts:0,terminal:!1,lastError:null}}var Ex=2e3,Dx=15e3;function Ox(e){let t=e.terminalAfterMs??3e4,n=e.initialDelayMs??Ex,r=e.maxDelayMs??Dx,i=e.log??{info:console.info,warn:console.warn},a=new AbortController,o=null,s=n,c=0,l=!1,u=!1,d=null,f=e.now(),p=async()=>{c+=1;let n=null;try{let t=await e.fetchConfig(a.signal);t.status===`absent`?(n=e.fallbackUrl(),d=null):t.status===`ok`&&t.config.collabUrl!==null?(n=t.config.collabUrl,d=null):t.status===`ok`?(u||(u=!0,i.info(`[collab-url] ok ui responded but server.lock has no port yet — retrying`)),d={kind:`null-collab`}):t.status===`error`&&(i.warn(`[collab-url] /api/config error (${t.code}) — retrying in ${s}ms`),d={kind:`error`,code:t.code})}catch(e){if(e.name===`AbortError`)return;d={kind:`error`,code:`network`}}if(!l){if(n!==null){e.onStateChange({collabUrl:n,attempts:c,terminal:!1,lastError:null});return}if(e.now()-f>=t){e.onStateChange({collabUrl:null,attempts:c,terminal:!0,lastError:d});return}e.onStateChange({collabUrl:null,attempts:c,terminal:!1,lastError:d}),o=e.setTimeout(()=>{p()},s),s=Math.min(s*2,r)}};return p(),{cancel:()=>{l=!0,a.abort(),o!==null&&(e.clearTimeout(o),o=null)}}}function kx(){let e=(0,J.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={collabUrl:null,attempts:0,terminal:!1,lastError:null},e[0]=t):t=e[0];let[n,r]=(0,Y.useState)(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i={token:0},e[1]=i):i=e[1];let a=(0,Y.useRef)(i),[o,s]=(0,Y.useState)(0),c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=a.current.token=a.current.token+1,t=wx(window);if(t){r(Tx(t.config));let n=t.onProjectSwitched(t=>{e===a.current.token&&r(Tx(t))});return()=>{n()}}let n=Ox({fetchConfig:px,fallbackUrl:Cx,now:Date.now,setTimeout:Nx,clearTimeout:Mx,onStateChange:t=>{e===a.current.token&&r(t)}});return()=>{n.cancel()}},e[2]=c):c=e[2];let l;e[3]===o?l=e[4]:(l=[o],e[3]=o,e[4]=l),(0,Y.useEffect)(c,l);let u;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a.current.token=a.current.token+1,r(jx),s(Ax)},e[5]=u):u=e[5];let d=u,f;return e[6]===n?f=e[7]:(f={...n,retry:d},e[6]=n,e[7]=f),f}function Ax(e){return e+1}function jx(e){return{...e,terminal:!1,lastError:null}}function Mx(e){return globalThis.clearTimeout(e)}function Nx(e,t){return globalThis.setTimeout(e,t)}var Px=new Map,Fx=new Set;function Ix(){for(let e of Fx)e()}function Lx(e,t){Px.set(e,t),Ix()}function Rx(e,t){Px.get(e)===t&&(Px.delete(e),Ix())}function zx(e){return Px.get(e)??null}function Bx(e){return Fx.add(e),()=>Fx.delete(e)}var Vx=new Map;function Hx(e){return Vx.get(e)}function Ux(e,t){Vx.set(e,t)}function Wx(e){Vx.delete(e)}var Gx=`open-knowledge-app`,Kx=new Map,qx=new Set,Jx=1024,Yx=1024;function Xx(){return nr.getTracer(Gx)}function Zx(e,t,n){if(qx.has(e))return null;let r=Kx.get(e);if(r)return r;if(Kx.size>=Yx){let e=Kx.keys().next().value;if(e!==void 0){let t=Kx.get(e);Kx.delete(e);try{t?.span.end()}catch(e){console.warn(`[otel-spans] eviction span.end failed:`,e instanceof Error?e:String(e))}}}let i={span:Xx().startSpan(`ok.cold-mount`,{attributes:{"mount.id":e,...t},startTime:n}),startTimeMs:n};return Kx.set(e,i),i}function Qx(e,t,n,r,i){try{let a=Zx(e,n,r),o=a?nr.setSpan(rr.active(),a.span):rr.active();Xx().startSpan(t,{attributes:{"mount.id":e,...n},startTime:r},o).end(i??Date.now())}catch(e){console.warn(`[otel-spans] emitColdMountChild failed:`,e instanceof Error?e:String(e))}}function $x(e,t){try{let n=Kx.get(e);if(n&&(Kx.delete(e),n.span.end(t??Date.now())),!qx.has(e)){if(qx.size>=Jx){let e=qx.values().next().value;e!==void 0&&qx.delete(e)}qx.add(e)}}catch(e){console.warn(`[otel-spans] finalizeColdMountSpan failed:`,e instanceof Error?e:String(e))}}var eS=class extends Error{docName;constructor(e){super(`Mount aborted for "${e}"`),this.name=`MountAbortError`,this.docName=e}};function tS(){return dc(`MOUNT_STALLED_THRESHOLD_MS`,1e4)}function nS(e){e.stalledHandle!==null&&(clearTimeout(e.stalledHandle),e.stalledHandle=null)}function rS(e,t,n){if(e.stalledMarkEmitted)return;e.stalledMarkEmitted=!0;let r=n-e.createdAt;Z(`ok/mount/stalled`,{docName:t,mountId:e.mountId,elapsedMs:r})}var iS=new Map,aS=new Set;function oS(e){aS.add(e);for(let[t,n]of iS)if(n.stalledMarkEmitted&&!n.settled)try{e(t,n.mountId)}catch{}return()=>{aS.delete(e)}}function sS(e,t){for(let n of aS)try{n(e,t.mountId)}catch{}}var cS=!1;function lS(){typeof document>`u`||document.visibilityState===`visible`&&fS(Date.now())}function uS(){cS||typeof document>`u`||typeof document.addEventListener==`function`&&(document.addEventListener(`visibilitychange`,lS),cS=!0)}function dS(){cS&&(typeof document>`u`||typeof document.removeEventListener==`function`&&(document.removeEventListener(`visibilitychange`,lS),cS=!1))}function fS(e){let t=tS();for(let[n,r]of iS)r.settled||r.stalledMarkEmitted||e-r.createdAt<t||(rS(r,n,e),sS(n,r))}function pS(e){let{docName:t,mountId:n,construct:r,sizeStats:i}=e,a=iS.get(t);if(a)return a.promise;let o=new AbortController,s=Date.now(),c=()=>{},l=()=>{},u=new Promise((e,t)=>{c=e,l=t}),d={promise:u,rejectFn:l,controller:o,mountId:n,createdAt:s,settled:!1,resolved:!1,preMountEditor:null,stalledHandle:null,stalledMarkEmitted:!1};return d.stalledHandle=setTimeout(()=>{d.settled||(rS(d,t,Date.now()),sS(t,d))},tS()),o.signal.addEventListener(`abort`,()=>{d.settled||(d.settled=!0,nS(d),d.preMountEditor&&=(_S(t,d.preMountEditor,`aborted`),null),iS.delete(t),iS.size===0&&dS(),Z(`ok/mount/reject`,{docName:t,mountId:d.mountId,reason:`aborted`}),l(new eS(t)),$x(d.mountId))}),iS.set(t,d),uS(),Z(`ok/mount/create`,{docName:t,mountId:d.mountId}),vS({docName:t,construct:r,sizeStats:i,entry:d,resolveFn:c,rejectFn:l}).catch(e=>{if(d.preMountEditor&&=(_S(t,d.preMountEditor,`backstop`),null),d.settled){Z(`ok/mount/post-settle-throw`,{docName:t,mountId:d.mountId,message:e instanceof Error?e.message:String(e)});return}d.settled=!0,nS(d);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:d.mountId,reason:`unhandled-body-throw`}),l(n),$x(d.mountId)}),u}function mS(e){return iS.get(e)?.resolved===!0}function hS(e){return iS.get(e)?.controller??null}function gS(e){let t=iS.get(e);t&&(t.settled=!0,nS(t),t.preMountEditor&&=(_S(e,t.preMountEditor,`aborted`),null),iS.delete(e),iS.size===0&&dS(),Z(`ok/mount/invalidate`,{docName:e,mountId:t.mountId}),$x(t.mountId),t.controller.abort())}function _S(e,t,n){let r=yS(t);try{t.destroy()}catch(t){Z(`ok/mount/destroy-failed`,{docName:e,stage:n,message:t instanceof Error?t.message:String(t)})}r&&(r.restore=void 0)}async function vS(e){let{docName:t,construct:n,sizeStats:r,entry:i,resolveFn:a,rejectFn:o}=e,s=document.createElement(`div`);if($S(t)!==void 0){let e=LS({docName:t,container:s,factory:()=>{throw Error(`mount-promise: V2 cache contract violation — factory invoked on HIT for "${t}"`)}});i.settled=!0,i.resolved=!0,nS(i),a(e);return}if(await scheduler.yield(),i.controller.signal.aborted)return;let c=null;try{c=n()}catch(e){i.settled=!0,nS(i);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:i.mountId,reason:`construct-failed`}),o(n),$x(i.mountId);return}if(i.preMountEditor=c.editor,await scheduler.yield(),i.controller.signal.aborted){i.preMountEditor=null;return}try{c.editor.mount(s)}catch(e){_S(t,c.editor,`mount-failed`),i.preMountEditor=null,i.settled=!0,nS(i);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:i.mountId,reason:`mount-failed`}),o(n),$x(i.mountId);return}let l;try{l=LS({docName:t,container:s,sizeStats:r,factory:()=>c})}catch(e){_S(t,c.editor,`v2-register-failed`),i.preMountEditor=null,i.settled=!0,nS(i);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:i.mountId,reason:`v2-register-failed`}),o(n),$x(i.mountId);return}i.preMountEditor=null,i.settled=!0,i.resolved=!0,nS(i);let u=Date.now()-i.createdAt;Z(`ok/mount/resolve`,{docName:t,mountId:i.mountId,elapsedMs:u}),Z.histogram(`ok/mount/resolve-elapsed-ms`,{docName:t,mountId:i.mountId},u),a(l);let d=Date.now();Qx(i.mountId,`ok.mount-promise`,{"doc.name":t,elapsed_ms:u},i.createdAt,d),$x(i.mountId,d)}function yS(e){try{let t=e.state;return kv.getState(t)?.undoManager??null}catch(e){return Z(`ok/cache/undo-manager-read-failed`,{message:e instanceof Error?e.message:String(e)}),null}}var bS=dc(`MAX_CACHE`,10),xS=dc(`VIEW_COUNT_CACHE_THRESHOLD`,50),SS=dc(`BYTES_CACHE_THRESHOLD`,8e6);function CS(e){return!(e.viewCount>0&&e.viewCount>=xS||e.bytes>SS)}var wS=new Map,TS=new Map,ES=new Map;function DS(e,t){if(ES.size>=bS){let e=ES.keys().next().value;e!==void 0&&ES.delete(e)}ES.set(e,t),Z(`ok/cache/snapshot-stored`,{toDocName:e,htmlBytes:t.html.length,hasScroll:t.scrollTop>0,hasSelection:t.selection!==null})}function OS(e){return ES.get(e)??null}function kS(e){if(!ES.has(e))return;let t=ES.get(e)??null;ES.delete(e),Z(`ok/cache/snapshot-consumed`,{docName:e,hit:t!==null,hasScroll:t!==null&&t.scrollTop>0,hasSelection:t!==null&&t.selection!==null})}function AS(){try{return typeof document>`u`?0:document.querySelector(`[data-testid="editor-scroll-container"]`)?.scrollTop??0}catch(e){return Z(`ok/cache/snapshot-scroll-read-failed`,{message:e instanceof Error?e.message:String(e)}),0}}function jS(e){try{let t=e.state.selection;return t instanceof vt?{type:`text`,anchor:t.anchor,head:t.head}:t instanceof pt?{type:`node`,from:t.from}:null}catch(e){return Z(`ok/cache/snapshot-selection-read-failed`,{message:e instanceof Error?e.message:String(e)}),null}}function MS(e){for(let t of e)try{let e=$S(t.fromDocName);e&&!e.editor.isDestroyed?DS(t.toDocName,{html:e.editor.getHTML(),scrollTop:AS(),selection:jS(e.editor)}):Z(`ok/cache/snapshot-skipped`,{fromDocName:t.fromDocName})}catch(e){Z(`ok/cache/snapshot-capture-failed`,{fromDocName:t.fromDocName,message:e instanceof Error?e.message:String(e)})}}var NS=[],PS=[],FS=new Set;function IS(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-parking`,``),e.style.display=`none`,e.style.position=`absolute`,e.style.left=`-99999px`,e}function LS(e){let{docName:t,container:n,factory:r,sizeStats:i}=e;if(i&&!CS(i)){let e=r(n);return Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`size-gate`}),{editor:e.editor,ydoc:e.ydoc,ytext:e.ytext,provider:e.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null,__uncached:!0}}let a=wS.get(t);if(a){if(Z(`ok/cache/reparent-start`,{docName:t,mountId:Hx(t),kind:`tiptap`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),GS(a,n),a.activeMountKey=t,qS(NS,t),n.scrollTop=a.scrollTop,a.hadFocus)try{a.editor.commands.focus()}catch{}return Z(`ok/cache/reparent-end`,{docName:t,mountId:Hx(t),kind:`tiptap`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),Z(`ok/cache/hit`,{docName:t,mountId:Hx(t),kind:`tiptap`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!0,kind:`tiptap`}),a}for(;wS.size>=bS;){let e=JS(NS,t);if(!e)break;zS(e)}let o=r(n),s={editor:o.editor,ydoc:o.ydoc,ytext:o.ytext,provider:o.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null};return wS.set(t,s),qS(NS,t),Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`cold`,kind:`tiptap`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!1,kind:`tiptap`}),s}function RS(e){let t=e.activeMountKey;if(e.__uncached){t&&gS(t);let n=yS(e.editor);try{e.editor.destroy()}catch(e){Z(`ok/cache/park-destroy-failed`,{docName:t??``,kind:`tiptap`,message:e instanceof Error?e.message:String(e)})}n&&(n.restore=void 0),e.activeMountKey=null;return}let n=US(e.editor);if(n){e.hadFocus=WS(n.dom),e.scrollTop=(n.scrollDOM??n.dom.parentElement??n.dom).scrollTop??0;let t=n.dom.parentElement;t&&t.removeChild(n.dom),e.parkingNode||=IS(),e.parkingNode&&e.parkingNode.appendChild(n.dom)}e.activeMountKey=null}function zS(e){gS(e);let t=wS.get(e);if(!t)return!1;let n=yS(t.editor);try{t.editor.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`tiptap`,stage:`editor`,message:t instanceof Error?t.message:String(t)})}n&&(n.restore=void 0);try{t.provider.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`tiptap`,stage:`provider`,message:t instanceof Error?t.message:String(t)})}try{t.ydoc.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`tiptap`,stage:`ydoc`,message:t instanceof Error?t.message:String(t)})}wS.delete(e);let r=NS.indexOf(e);return r!==-1&&NS.splice(r,1),Z(`ok/cache/evict`,{docName:e,kind:`tiptap`}),!0}function BS(e){let{docName:t,container:n,factory:r,sizeStats:i}=e;if(i&&!CS(i)){let e=r(n);return Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`size-gate`,kind:`cm`}),{view:e.view,ydoc:e.ydoc,ytext:e.ytext,provider:e.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null,__uncached:!0}}let a=TS.get(t);if(a){if(Z(`ok/cache/reparent-start`,{docName:t,mountId:Hx(t),kind:`cm`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),KS(a,n),a.activeMountKey=t,qS(PS,t),n.scrollTop=a.scrollTop,a.hadFocus)try{a.view.focus()}catch{}return Z(`ok/cache/reparent-end`,{docName:t,mountId:Hx(t),kind:`cm`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),Z(`ok/cache/hit`,{docName:t,mountId:Hx(t),kind:`cm`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!0,kind:`cm`}),a}for(;TS.size>=bS;){let e=JS(PS,t);if(!e)break;HS(e)}let o=r(n),s={view:o.view,ydoc:o.ydoc,ytext:o.ytext,provider:o.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null};return TS.set(t,s),qS(PS,t),Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`cold`,kind:`cm`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!1,kind:`cm`}),s}function VS(e){if(e.__uncached){try{e.view.destroy()}catch(t){Z(`ok/cache/park-destroy-failed`,{docName:e.activeMountKey??``,kind:`cm`,message:t instanceof Error?t.message:String(t)})}e.activeMountKey=null;return}let t=e.view.dom;e.hadFocus=WS(t),e.scrollTop=(e.view.scrollDOM??t).scrollTop??0;let n=t.parentElement;n&&n.removeChild(t),e.parkingNode||=IS(),e.parkingNode&&e.parkingNode.appendChild(t),e.activeMountKey=null}function HS(e){let t=TS.get(e);if(!t)return!1;try{t.view.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`cm`,stage:`view`,message:t instanceof Error?t.message:String(t)})}try{t.provider.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`cm`,stage:`provider`,message:t instanceof Error?t.message:String(t)})}try{t.ydoc.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`cm`,stage:`ydoc`,message:t instanceof Error?t.message:String(t)})}TS.delete(e);let n=PS.indexOf(e);return n!==-1&&PS.splice(n,1),Z(`ok/cache/evict`,{docName:e,kind:`cm`}),!0}function US(e){return e.editorView??null}function WS(e){if(typeof document>`u`)return!1;let t=document.activeElement;return t?t===e?!0:e.contains(t):!1}function GS(e,t){let n=US(e.editor);if(!n)return;let r=n.dom,i=r.parentElement;i&&i!==t&&i.removeChild(r),r.parentElement!==t&&t.appendChild(r)}function KS(e,t){let n=e.view.dom,r=n.parentElement;r&&r!==t&&r.removeChild(n),n.parentElement!==t&&t.appendChild(n)}function qS(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1),e.push(t)}function JS(e,t){for(let n of e)if(n!==t&&!FS.has(n))return n;Z(`ok/cache/evict-fallback-activity-saturated`,{mountingDocName:t,lruLength:e.length,activityMountCount:FS.size});for(let n of e)if(n!==t)return n;return null}function YS(e){let t=FS,n=new Set(e);for(let e of t){if(n.has(e))continue;let t=ZS(e);if(t)try{t.disconnect(),Z(`ok/cache/disconnect`,{docName:e})}catch(t){Z(`ok/cache/disconnect-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}}for(let e of n){if(t.has(e))continue;let n=ZS(e);if(!n)continue;let r=t=>{Z(`ok/cache/connect-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})};try{let t=n.connect();t&&typeof t.then==`function`?t.then(()=>Z(`ok/cache/connect`,{docName:e}),e=>r(e)):Z(`ok/cache/connect`,{docName:e})}catch(e){r(e)}}FS=n}var XS=null;function ZS(e){let t=wS.get(e);if(t)return t.provider;let n=TS.get(e);if(n)return n.provider;if(XS){let t=XS.entries.get(e);if(t)return t.provider}return null}function QS(e){XS=e;let t=e.onEvict(e=>{zS(e),HS(e)});return()=>{t(),XS===e&&(XS=null)}}function $S(e){return wS.get(e)}var eC=`ok-editor-tabs-v1:`,tC=`\0folder:`,nC=`\0asset:`,rC=`\0doc-tab:`;function iC(e){let t=e.lastIndexOf(rC);return t<0?{baseTabId:e,instanceSuffix:``}:{baseTabId:e.slice(0,t),instanceSuffix:e.slice(t)}}function aC(e){return iC(e).baseTabId}function oC(e){if(typeof e!=`string`||e.length===0)return!1;let t=aC(e);return t.startsWith(tC)?t.length>8:t.startsWith(nC)?t.length>7:!0}function sC(e){return e}function cC(e,t){return`${aC(e)}${rC}${t}`}function lC(e,t){return uC(e,sC(t))}function uC(e,t){let n=yC(e,2**53-1),r=aC(t);if(!n.includes(r))return r;let i=1,a;do a=cC(r,i),i++;while(n.includes(a));return a}function dC(e,t){let n=aC(t);return yC(e,2**53-1).find(e=>aC(e)===n)??null}function fC(e,t){return aC(e)===aC(t)}function pC(e){return`${tC}${e}`}function mC(e){return`${nC}${e}`}function hC(e,t){let n=e.lastIndexOf(`/`),r=n<0?e:e.slice(n+1),i=`${r}${t}`;return n<0?{baseName:r,extension:t,label:i,prefix:``}:{baseName:r,extension:t,label:i,prefix:`${e.slice(0,n)}/`}}function gC(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return sC(e.docName);case`folder`:return pC(e.folderPath);case`missing`:return sC(e.target);case`asset`:return mC(e.assetPath)}}function _C(e){let t=aC(e);return t.startsWith(tC)?{kind:`folder`,folderPath:t.slice(8)}:t.startsWith(nC)?{kind:`asset`,assetPath:t.slice(7)}:{kind:`doc`,docName:t}}function vC(e){let t=_C(e);return t.kind===`doc`?t.docName:null}function yC(e,t){if(!Array.isArray(e)||t<=0)return[];let n=[],r=new Set;for(let i of e)if(oC(i)&&!r.has(i)&&(r.add(i),n.push(i),n.length>=t))break;return n}function bC(e,t){let n=new Set(yC(t,2**53-1));return yC(e,2**53-1).filter(e=>n.has(e))}function xC(e,t,n){if(t<=0)return[];let r=new Set(yC(n,2**53-1)),i=yC(e,2**53-1);if(r.size===0&&i.length<=t)return i;let a=[],o=0;for(let e=i.length-1;e>=0;e--){let n=i[e];if(r.has(n)){a.push(n);continue}o>=t||(o++,a.push(n))}return a.reverse()}function SC(e,t,n){let r=bC(e,n);return!yC(n,2**53-1).includes(t)||r.includes(t)?r:[...r,t]}function CC(e,t){return yC(e,2**53-1).filter(e=>e!==t)}function wC(e,t){let n=new Set(yC(t,2**53-1));return yC(e,2**53-1).filter(e=>!n.has(e))}function TC(e,t,n){let r=yC(e,2**53-1),i=bC(t,r),a=r.indexOf(n);if(a<0)return i;let o=i.includes(n),s=a<i.length;return o===s?i:s?SC(i,n,r):CC(i,n)}function EC(e,t,n,r=[]){let i=xC(e,n,r);return!oC(t)||i.includes(t)?i:xC([...i,t],n,r)}function DC(e,t,n,r,i=[]){let a=xC(e,r,i);if(!oC(n))return a;if(!t||t===n)return EC(a,n,r,i);let o=a.filter(e=>e!==n),s=o.indexOf(t);if(s<0)return EC(o,n,r,i);let c=[...o];return c[s]=n,xC(c,r,i)}function OC(e,t,n){return kC(e,sC(t),n)}function kC(e,t,{behavior:n,currentTabId:r,limit:i,pinnedTabIds:a=[]}){let o=xC(e,i,a),s=aC(t);if(r&&o.includes(r)&&aC(r)===s)return{tabs:o,activeTabId:r};if(n!==`replace-active`)return{tabs:EC(o,s,i,a),activeTabId:s};let c=dC(o,s);if(c)return{tabs:o,activeTabId:c};let l=uC(o,s);return{tabs:DC(o,r,l,i,a),activeTabId:l}}function AC(e,t){return e.filter(e=>e!==t)}function jC(e,t,n){let r=yC(t,2**53-1),i=new Set(r),a=new Set(n),o=new Set,s=[];for(let t of e)o.has(t)||!i.has(t)&&!a.has(t)||(o.add(t),s.push(t));for(let e of[...r,...n])o.has(e)||(o.add(e),s.push(e));return s}function MC(e,{pages:t,folderPaths:n,assetPaths:r,keepMissingDocName:i=null}){return yC(e,2**53-1).filter(e=>{let a=_C(e);return a.kind===`folder`?n.has(a.folderPath):a.kind===`asset`?r.has(a.assetPath):t.has(a.docName)||a.docName===i})}function NC(e,t,n,r=[],i=[]){if(t.length===0&&r.length===0)return yC(e,n);let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=[],s=new Set;for(let t of e){let{instanceSuffix:e}=iC(t),c=_C(t),l=`${c.kind===`doc`?a.get(c.docName)??aC(t):c.kind===`folder`?pC(FC(c.folderPath,r)):mC(FC(c.assetPath,r))}${e}`;if(!s.has(l)&&(s.add(l),o.push(l),i.length===0&&o.length>=n))break}return i.length===0?o:xC(o,n,i.map(e=>{let t=_C(e);return t.kind===`doc`?a.get(t.docName)??e:t.kind===`folder`?pC(FC(t.folderPath,r)):mC(FC(t.assetPath,r))}))}function PC(e,t,n=[]){return NC(e,t,2**53-1,n)}function FC(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function IC(e,t,n){if(t!==n)return t;let r=e.indexOf(n);return r<0?e[0]??null:e[r+1]??e[r-1]??null}function LC(e,t,n){if(!t)return null;let r=new Set(n);if(!r.has(t))return t;let i=e.indexOf(t);if(i<0)return e.find(e=>!r.has(e))??null;for(let t=i+1;t<e.length;t++)if(!r.has(e[t]))return e[t];for(let t=i-1;t>=0;t--)if(!r.has(e[t]))return e[t];return null}function RC(e,t){if(typeof e!=`object`||!e)return{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null};let n=e,r=yC(n.openTabs,2**53-1),i=bC(n.pinnedTabIds,r),a=i.length===0?yC(n.openTabs,t):xC(r,t,i),o=bC(n.pinnedTabIds,a),s=typeof n.activeTabId==`string`&&a.includes(n.activeTabId)?n.activeTabId:typeof n.activeDocName==`string`&&a.includes(n.activeDocName)?n.activeDocName:null,c=s?_C(s):null;return{openTabs:a,pinnedTabIds:o,activeDocName:c?.kind===`doc`?c.docName:null,activeTabId:s,updatedAt:typeof n.updatedAt==`string`?n.updatedAt:null}}function zC(e,t,n=[],r=()=>new Date){let i=yC(e,2**53-1),a=t&&i.includes(t)?t:null,o=a?_C(a):null;return{openTabs:i,pinnedTabIds:bC(n,i),activeDocName:o?.kind===`doc`?o.docName:null,activeTabId:a,updatedAt:r().toISOString()}}function BC(e){return`${eC}${e}`}function VC(e,t,n){if(!e)return{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null};try{let r=e.getItem(t);return r?RC(JSON.parse(r),n):{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null}}catch(e){return console.warn(`[editor-tabs] failed to read local tab session:`,e),{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null}}}function HC(e,t,n){if(e)try{e.setItem(t,JSON.stringify(n))}catch(e){console.warn(`[editor-tabs] failed to write local tab session:`,e)}}var UC=Math.floor,WC=(e,t)=>e<t?e:t,GC=(e,t)=>e>t?e:t;Number.isNaN;var KC=128,qC=1<<17,JC=1<<18,YC=1<<19,XC=1<<20,ZC=1<<21,QC=1<<22,$C=1<<23,ew=1<<24,tw=1<<25,nw=1<<26,rw=1<<27,iw=1<<28,aw=1<<29,ow=1<<30,sw=127;qC-1,JC-1,YC-1,XC-1,ZC-1,QC-1,$C-1,ew-1,tw-1,nw-1,rw-1,iw-1,aw-1,ow-1;var cw=2**53-1;Number.isInteger,Number.isNaN,Number.parseInt;var lw=String.fromCharCode;String.fromCodePoint,lw(65535);var uw=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},dw=typeof TextEncoder<`u`?new TextEncoder:null,fw=dw?e=>dw.encode(e):uw,pw=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});pw&&pw.decode(new Uint8Array).length===1&&(pw=null);var mw=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},hw=(e,t)=>{for(;t>sw;)mw(e,KC|sw&t),t=UC(t/128);mw(e,sw&t)},gw=new Uint8Array(3e4),_w=gw.length/3,vw=dw&&dw.encodeInto?(e,t)=>{if(t.length<_w){let n=dw.encodeInto(t,gw).written||0;hw(e,n);for(let t=0;t<n;t++)mw(e,gw[t])}else bw(e,fw(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;hw(e,r);for(let t=0;t<r;t++)mw(e,n.codePointAt(t))},yw=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=WC(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(GC(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},bw=(e,t)=>{hw(e,t.byteLength),yw(e,t)},xw=e=>Error(e),Sw=xw(`Unexpected end of array`),Cw=xw(`Integer out of Range`),ww=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},Tw=e=>ww(e,Dw(e)),Ew=e=>e.arr[e.pos++],Dw=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&sw)*n,n*=128,r<KC)return t;if(t>cw)throw Cw}throw Sw},Ow=pw?e=>pw.decode(Tw(e)):e=>{let t=Dw(e);if(t===0)return``;{let n=String.fromCodePoint(Ew(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Ew(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},kw=function(e){return e[e.Token=0]=`Token`,e[e.PermissionDenied=1]=`PermissionDenied`,e[e.Authenticated=2]=`Authenticated`,e}({}),Aw=(e,t)=>{hw(e,kw.Token),vw(e,t)},jw=(e,t,n,r)=>{switch(Dw(e)){case kw.Token:t();break;case kw.PermissionDenied:n(Ow(e));break;case kw.Authenticated:r(Ow(e));break;default:}},Mw=e=>Array.from(e.entries()).map(([e,t])=>({clientId:e,...t})),Nw=`\0`;function Pw(e,t){return e+Nw+t}function Fw(e){let t=e.indexOf(Nw);return t===-1?{documentName:e,sessionId:null}:{documentName:e.substring(0,t),sessionId:e.substring(t+1)}}var Iw=function(e){return e[e.Connecting=0]=`Connecting`,e[e.Open=1]=`Open`,e[e.Closing=2]=`Closing`,e[e.Closed=3]=`Closed`,e}({});function Lw(e){return e||={},{delay:e.delay===void 0?200:e.delay,initialDelay:e.initialDelay===void 0?0:e.initialDelay,minDelay:e.minDelay===void 0?0:e.minDelay,maxDelay:e.maxDelay===void 0?0:e.maxDelay,factor:e.factor===void 0?0:e.factor,maxAttempts:e.maxAttempts===void 0?3:e.maxAttempts,timeout:e.timeout===void 0?0:e.timeout,jitter:e.jitter===!0,initialJitter:e.initialJitter===!0,handleError:e.handleError===void 0?null:e.handleError,handleTimeout:e.handleTimeout===void 0?null:e.handleTimeout,beforeAttempt:e.beforeAttempt===void 0?null:e.beforeAttempt,calculateDelay:e.calculateDelay===void 0?null:e.calculateDelay}}async function Rw(e){return new Promise(t=>setTimeout(t,e))}function zw(e,t){let n=t.delay;if(n===0)return 0;if(t.factor&&(n*=t.factor**(e.attemptNum-1),t.maxDelay!==0&&(n=Math.min(n,t.maxDelay))),t.jitter){let e=Math.ceil(t.minDelay);n=Math.floor(Math.random()*(Math.floor(n)-e+1))+e}return Math.round(n)}async function Bw(e,t){let n=Lw(t);for(let e of[`delay`,`initialDelay`,`minDelay`,`maxDelay`,`maxAttempts`,`timeout`]){let t=n[e];if(!Number.isInteger(t)||t<0)throw Error(`Value for ${e} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw Error(`Value for factor must be a number greater than or equal to 0`);if(n.delay<n.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);let r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||zw;async function a(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){let e=Error(`Attempt aborted`);throw e.code=`ATTEMPT_ABORTED`,e}let t=async e=>{if(n.handleError&&await n.handleError(e,r,n),r.aborted||r.attemptsRemaining===0)throw e;r.attemptNum++;let t=i(r,n);return t&&await Rw(t),a()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((i,a)=>{let o=setTimeout(()=>{if(n.handleTimeout)try{i(n.handleTimeout(r,n))}catch(e){a(e)}else{let e=Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);e.code=`ATTEMPT_TIMEOUT`,a(e)}},n.timeout);e(r,n).then(e=>{clearTimeout(o),i(e)}).catch(e=>{clearTimeout(o),t(e).then(i).catch(a)})}):e(r,n).catch(t)}let o=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(o&&await Rw(o),r.attemptNum<1&&n.initialJitter){let e=i(r,n);e&&await Rw(e)}return a()}var Vw=Math.floor,Hw=(e,t)=>e<t?e:t,Uw=(e,t)=>e>t?e:t;Number.isNaN;var Ww=64,Gw=128,Kw=1<<17,qw=1<<18,Jw=1<<19,Yw=1<<20,Xw=1<<21,Zw=1<<22,Qw=1<<23,$w=1<<24,eT=1<<25,tT=1<<26,nT=1<<27,rT=1<<28,iT=1<<29,aT=1<<30,oT=63,sT=127;Kw-1,qw-1,Jw-1,Yw-1,Xw-1,Zw-1,Qw-1,$w-1,eT-1,tT-1,nT-1,rT-1,iT-1,aT-1;var cT=2**53-1;Number.isInteger,Number.isNaN,Number.parseInt;var lT=()=>new Set,uT=Array.from;Array.isArray;var dT=String.fromCharCode;String.fromCodePoint,dT(65535);var fT=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},pT=typeof TextEncoder<`u`?new TextEncoder:null,mT=pT?e=>pT.encode(e):fT,hT=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});hT&&hT.decode(new Uint8Array).length===1&&(hT=null);var gT=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},_T=()=>new gT,vT=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},yT=e=>{let t=new Uint8Array(vT(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},bT=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},xT=(e,t)=>{for(;t>sT;)bT(e,Gw|sT&t),t=Vw(t/128);bT(e,sT&t)},ST=new Uint8Array(3e4),CT=ST.length/3,wT=pT&&pT.encodeInto?(e,t)=>{if(t.length<CT){let n=pT.encodeInto(t,ST).written||0;xT(e,n);for(let t=0;t<n;t++)bT(e,ST[t])}else ET(e,mT(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;xT(e,r);for(let t=0;t<r;t++)bT(e,n.codePointAt(t))},TT=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=Hw(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Uw(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},ET=(e,t)=>{xT(e,t.byteLength),TT(e,t)},DT=e=>Error(e),OT=DT(`Unexpected end of array`),kT=DT(`Integer out of Range`),AT=class{constructor(e){this.arr=e,this.pos=0}},jT=e=>new AT(e),MT=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},NT=e=>MT(e,FT(e)),PT=e=>e.arr[e.pos++],FT=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&sT)*n,n*=128,r<Gw)return t;if(t>cT)throw kT}throw OT},IT=e=>{let t=e.arr[e.pos++],n=t&oT,r=64,i=(t&Ww)>0?-1:1;if((t&Gw)===0)return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&sT)*r,r*=128,t<Gw)return i*n;if(n>cT)throw kT}throw OT},LT=hT?e=>hT.decode(NT(e)):e=>{let t=FT(e);if(t===0)return``;{let n=String.fromCodePoint(PT(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(PT(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},RT=e=>{let t=e.pos,n=LT(e);return e.pos=t,n},zT=Date.now,BT=()=>new Map,VT=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},HT=class{constructor(){this._observers=BT()}on(e,t){VT(this._observers,e,lT).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return uT((this._observers.get(e)||BT()).values()).forEach(e=>e(...t))}destroy(){this._observers=BT()}},UT=Symbol(`Equality`),WT=Object.keys,GT=e=>WT(e).length,KT=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),qT=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[UT]!=null)return e[UT](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!qT(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(GT(e)!==GT(t))return!1;for(let n in e)if(!KT(e,n)||!qT(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qT(e[n],t[n]))return!1;break;default:return!1}return!0},JT=3e4,YT=class extends HT{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=zT();this.getLocalState()!==null&&JT/2<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&JT<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&XT(this,t,`timeout`)},Vw(JT/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){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:zT()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null&&a.push(t):(o.push(t),qT(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)&&this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},XT=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:zT()})}r.push(i)}}r.length>0&&(e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},ZT=(e,t,n=e.states)=>{let r=t.length,i=_T();xT(i,r);for(let a=0;a<r;a++){let r=t[a],o=n.get(r)||null,s=e.meta.get(r).clock;xT(i,r),xT(i,s),wT(i,JSON.stringify(o))}return yT(i)},QT=(e,t,n)=>{let r=jT(t),i=zT(),a=[],o=[],s=[],c=[],l=FT(r);for(let t=0;t<l;t++){let t=FT(r),n=FT(r),l=JSON.parse(LT(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0?0:u.clock;(f<n||f===n&&l===null&&e.states.has(t))&&(l===null?t===e.clientID&&e.getLocalState()!=null?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),u===void 0&&l!==null?a.push(t):u!==void 0&&l===null?c.push(t):l!==null&&(qT(l,d)||s.push(t),o.push(t)))}(a.length>0||s.length>0||c.length>0)&&e.emit(`change`,[{added:a,updated:s,removed:c},n]),(a.length>0||o.length>0||c.length>0)&&e.emit(`update`,[{added:a,updated:o,removed:c},n])},$T=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}},eE=class{constructor(e){this.data=e,this.encoder=_T(),this.decoder=jT(new Uint8Array(this.data))}peekVarString(){return RT(this.decoder)}readVarUint(){return FT(this.decoder)}readVarString(){return LT(this.decoder)}readVarUint8Array(){return NT(this.decoder)}writeVarUint(e){return xT(this.encoder,e)}writeVarString(e){return wT(this.encoder,e)}writeVarUint8Array(e){return ET(this.encoder,e)}length(){return vT(this.encoder)}},tE=function(e){return e[e.Sync=0]=`Sync`,e[e.Awareness=1]=`Awareness`,e[e.Auth=2]=`Auth`,e[e.QueryAwareness=3]=`QueryAwareness`,e[e.Stateless=5]=`Stateless`,e[e.CLOSE=7]=`CLOSE`,e[e.SyncStatus=8]=`SyncStatus`,e[e.Ping=9]=`Ping`,e[e.Pong=10]=`Pong`,e}({}),nE=function(e){return e.Connecting=`connecting`,e.Connected=`connected`,e.Disconnected=`disconnected`,e}({}),rE=class{constructor(){this.encoder=_T()}get(e){return e.encoder}toUint8Array(){return yT(this.encoder)}},iE=class extends rE{constructor(...e){super(...e),this.type=tE.CLOSE,this.description=`Ask the server to close the connection`}get(e){return wT(this.encoder,e.documentName),xT(this.encoder,this.type),this.encoder}},aE=class e extends $T{static{this.DEDUPLICATABLE_TYPES=new Set([tE.Awareness,tE.QueryAwareness])}constructor(e){super(),this.messageQueue=[],this.configuration={url:``,autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,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,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=nE.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=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(`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),this.shouldConnect&&this.connect()}async onOpen(e){this.status=nE.Connected,this.emit(`status`,{status:nE.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){let t=e.effectiveName,n=this.configuration.providerMap.get(t);if(n&&n!==e&&n.isAuthenticated)throw Error(`Cannot attach two providers with the same effective name "${t}". Use sessionAwareness: true to multiplex providers with the same document name.`);this.configuration.providerMap.set(t,e),this.status===nE.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===nE.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){let t=e.effectiveName;this.configuration.providerMap.has(t)&&(e.send(iE,{documentName:t}),this.configuration.providerMap.delete(t))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===nE.Connected)return;this.cancelWebsocketRetry&&=(this.cancelWebsocketRetry(),void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;let{retryPromise:e,cancelFunc:t}=(()=>{let e=!1;return{retryPromise:Bw(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,handleTimeout:this.configuration.handleTimeout,beforeAttempt:t=>{(!this.shouldConnect||e)&&t.abort()}}).catch(e=>{if(e&&e.code!==`ATTEMPT_ABORTED`)throw e}),cancelFunc:()=>{e=!0}}})();return this.cancelWebsocketRetry=t,e}attachWebSocketListeners(e,t){let{identifier:n}=e,r=e=>this.emit(`message`,e),i=e=>this.emit(`close`,{event:e}),a=e=>this.emit(`open`,e),o=e=>{t(e)};this.webSocketHandlers[n]={message:r,close:i,open:a,error:o};let s=this.webSocketHandlers[e.identifier];Object.keys(s).forEach(t=>{e.addEventListener(t,s[t])})}cleanupWebSocket(){if(!this.webSocket)return;let{identifier:e}=this.webSocket,t=this.webSocketHandlers[e];Object.keys(t).forEach(n=>{this.webSocket?.removeEventListener(n,t[n]),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;let n=new this.configuration.WebSocketPolyfill(this.url);n.binaryType=`arraybuffer`,n.identifier=this.identifier,this.attachWebSocketListeners(n,t),this.webSocket=n,this.status=nE.Connecting,this.emit(`status`,{status:nE.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){this.resolveConnectionAttempt(),this.lastMessageReceived=zT();let t=new Uint8Array(e.data);if(t.length===1&&t[0]===tE.Ping){this.sendPong();return}let n=new eE(t).peekVarString();this.configuration.providerMap.get(n)?.onMessage(e)}sendPong(){let e=_T();xT(e,tE.Pong),this.send(yT(e))}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=nE.Connected,this.emit(`status`,{status:nE.Connected}),this.emit(`connect`),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){this.connectionAttempt?.reject(),this.connectionAttempt=null}checkConnection(){this.status===nE.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=zT()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:`forced`}}),this.closeTries=0):(this.webSocket?.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]===`/`;)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}parseQueuedMessage(e){try{let t=jT(e);return{documentName:LT(t),messageType:FT(t)}}catch{return null}}addToQueue(t){if(t instanceof Uint8Array){let n=this.parseQueuedMessage(t);n&&e.DEDUPLICATABLE_TYPES.has(n.messageType)&&(this.messageQueue=this.messageQueue.filter(e=>{if(!(e instanceof Uint8Array))return!0;let t=this.parseQueuedMessage(e);return t?!(t.documentName===n.documentName&&t.messageType===n.messageType):!0}))}this.messageQueue.push(t)}send(e){this.webSocket?.readyState===Iw.Open?this.webSocket.send(e):this.addToQueue(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=nE.Disconnected,this.emit(`status`,{status:nE.Disconnected}),this.emit(`disconnect`,{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit(`destroy`),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}},oE=0,sE=1,cE=2,lE=(e,t)=>{xT(e,oE),ET(e,oh(t))},uE=(e,t,n)=>{xT(e,sE),ET(e,eh(t,n))},dE=(e,t,n)=>uE(t,n,NT(e)),fE=(e,t,n,r)=>{try{Zm(t,NT(e),n)}catch(e){r?.(e),console.error(`Caught error while handling a Yjs update`,e)}},pE=(e,t)=>{xT(e,cE),ET(e,t)},mE=fE,hE=(e,t,n,r,i)=>{let a=FT(e);switch(a){case oE:dE(e,t,n);break;case sE:fE(e,n,r,i);break;case cE:mE(e,n,r,i);break;default:throw Error(`Unknown message type`)}return a},gE=class{constructor(e){this.message=e}apply(e,t){let{message:n}=this,r=n.readVarUint(),i=n.length();switch(r){case tE.Sync:this.applySyncMessage(e,t);break;case tE.Awareness:this.applyAwarenessMessage(e);break;case tE.Auth:this.applyAuthMessage(e);break;case tE.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case tE.Stateless:e.receiveStateless(LT(n.decoder));break;case tE.SyncStatus:this.applySyncStatusMessage(e,IT(n.decoder)===1);break;case tE.CLOSE:let i={code:1e3,reason:LT(n.decoder)};e.onClose(),e.configuration.onClose({event:i}),e.forwardClose({event:i});break;default:console.error(`Can’t apply message of unknown type: ${r}`)}n.length()>i+1&&e.send(rE,{encoder:n.encoder})}applySyncMessage(e,t){let{message:n}=this;n.writeVarUint(tE.Sync);let r=hE(n.decoder,n.encoder,e.document,e);t&&r===sE&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;QT(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){let{message:t}=this;jw(t.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;t.writeVarUint(tE.Awareness),t.writeVarUint8Array(ZT(e.awareness,Array.from(e.awareness.getStates().keys())))}},_E=class{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return yT(this.encoder)}send(e){e?.send(this.create())}},vE=`4.0.0-rc.1`,yE=class extends rE{constructor(...e){super(...e),this.type=tE.Auth,this.description=`Authentication`}get(e){if(e.token===void 0)throw Error("The authentication message requires `token` as an argument.");return wT(this.encoder,e.documentName),xT(this.encoder,this.type),Aw(this.encoder,e.token),wT(this.encoder,vE),this.encoder}},bE=class extends rE{constructor(...e){super(...e),this.type=tE.Awareness,this.description=`Awareness states update`}get(e){if(e.awareness===void 0)throw Error(`The awareness message requires awareness as an argument`);if(e.clients===void 0)throw Error(`The awareness message requires clients as an argument`);wT(this.encoder,e.documentName),xT(this.encoder,this.type);let t;return t=e.states===void 0?ZT(e.awareness,e.clients):ZT(e.awareness,e.clients,e.states),ET(this.encoder,t),this.encoder}},xE=class extends rE{constructor(...e){super(...e),this.type=tE.Stateless,this.description=`A stateless message`}get(e){return wT(this.encoder,e.documentName),xT(this.encoder,this.type),wT(this.encoder,e.payload??``),this.encoder}},SE=class extends rE{constructor(...e){super(...e),this.type=tE.Sync,this.description=`First sync step`}get(e){if(e.document===void 0)throw Error(`The sync step one message requires document as an argument`);return wT(this.encoder,e.documentName),xT(this.encoder,this.type),lE(this.encoder,e.document),this.encoder}},CE=class extends rE{constructor(...e){super(...e),this.type=tE.Sync,this.description=`A document update`}get(e){return wT(this.encoder,e.documentName),xT(this.encoder,this.type),pE(this.encoder,e.update),this.encoder}},wE=class extends Error{constructor(...e){super(...e),this.code=1001}},TE=class extends $T{get effectiveName(){return this.configuration.sessionAwareness?Pw(this.configuration.name,this.sessionId):this.configuration.name}constructor(e){super(),this.configuration={name:``,document:void 0,awareness:void 0,token:null,sessionAwareness:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.sessionId=Math.random().toString(36).slice(2),this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit(`connect`),this.forwardStatus=e=>this.emit(`status`,e),this.forwardClose=e=>this.emit(`close`,e),this.forwardDisconnect=e=>this.emit(`disconnect`,e),this.forwardDestroy=()=>this.emit(`destroy`),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Fm,this.configuration.awareness=e.awareness===void 0?new YT(this.document):e.awareness,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(`unsyncedChanges`,this.configuration.onUnsyncedChanges),this.on(`authenticated`,this.configuration.onAuthenticated),this.on(`authenticationFailed`,this.configuration.onAuthenticationFailed),this.awareness?.on(`update`,()=>{this.emit(`awarenessUpdate`,{states:Mw(this.awareness.getStates())})}),this.awareness?.on(`change`,()=>{this.emit(`awarenessChange`,{states:Mw(this.awareness.getStates())})}),this.document.on(`update`,this.boundDocumentUpdateHandler),this.awareness?.on(`update`,this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval==`number`&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new aE(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&--this.unsyncedChanges,this.unsyncedChanges===0&&(this.synced=!0),this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(SE,{document:this.document,documentName:this.effectiveName})}pageHide(){this.awareness&&XT(this.awareness,[this.document.clientID],`page hide`)}registerEventListeners(){typeof window>`u`||!(`addEventListener`in window)||window.addEventListener(`pagehide`,this.boundPageHide)}sendStateless(e){this.send(xE,{documentName:this.effectiveName,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(e){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${e}`);return}this.send(yE,{token:e??``,documentName:this.effectiveName})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send(CE,{update:e,documentName:this.effectiveName}))}awarenessUpdateHandler({added:e,updated:t,removed:n},r){let i=e.concat(t).concat(n);this.send(bE,{awareness:this.awareness,clients:i,documentName:this.effectiveName})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit(`synced`,{state:e}))}receiveStateless(e){this.emit(`stateless`,{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn(`HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn(`HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}async onOpen(e){this.isAuthenticated=!1,this.emit(`open`,{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token==`function`?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(SE,{document:this.document,documentName:this.effectiveName}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(bE,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.effectiveName})}send(e,t){if(!this._isAttached)return;let n=new _E(e,t);this.emit(`outgoingMessage`,{message:n.message}),n.send(this.configuration.websocketProvider)}onMessage(e){let t=new eE(e.data),{documentName:n}=Fw(t.readVarString());t.writeVarString(this.effectiveName),this.emit(`message`,{event:e,message:new eE(e.data)}),new gE(t).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&XT(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit(`destroy`),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(XT(this.awareness,[this.document.clientID],`provider destroy`),this.awareness.off(`update`,this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off(`update`,this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>`u`||!(`removeEventListener`in window))&&window.removeEventListener(`pagehide`,this.boundPageHide)}detach(){this.configuration.websocketProvider.off(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.off(`connect`,this.forwardConnect),this.configuration.websocketProvider.off(`status`,this.forwardStatus),this.configuration.websocketProvider.off(`status`,this.configuration.onStatus),this.configuration.websocketProvider.off(`open`,this.boundOnOpen),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(`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.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||=(this.configuration.websocketProvider.on(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.on(`connect`,this.forwardConnect),this.configuration.websocketProvider.on(`status`,this.configuration.onStatus),this.configuration.websocketProvider.on(`status`,this.forwardStatus),this.configuration.websocketProvider.on(`open`,this.boundOnOpen),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(`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),this.configuration.websocketProvider.attach(this),!0)}permissionDeniedHandler(e){this.emit(`authenticationFailed`,{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit(`authenticated`,{scope:e})}setAwarenessField(e,t){if(!this.awareness)throw new wE(`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)}},EE=e=>Hd((t,n)=>{e.onerror=e=>n(Error(e.target.error)),e.onsuccess=e=>t(e.target.result)}),DE=(e,t)=>Hd((n,r)=>{let i=indexedDB.open(e);i.onupgradeneeded=e=>t(e.target.result),i.onerror=e=>r(md(e.target.error)),i.onsuccess=e=>{let t=e.target.result;t.onversionchange=()=>{t.close()},n(t)}}),OE=e=>EE(indexedDB.deleteDatabase(e)),kE=(e,t)=>t.forEach(t=>e.createObjectStore.apply(e,t)),AE=(e,t,n=`readwrite`)=>{let r=e.transaction(t,n);return t.map(e=>VE(r,e))},jE=(e,t)=>EE(e.count(t)),ME=(e,t)=>EE(e.get(t)),NE=(e,t)=>EE(e.delete(t)),PE=(e,t,n)=>EE(e.put(t,n)),FE=(e,t)=>EE(e.add(t)),IE=(e,t,n)=>EE(e.getAll(t,n)),LE=(e,t,n)=>{let r=null;return BE(e,t,e=>(r=e,!1),n).then(()=>r)},RE=(e,t=null)=>LE(e,t,`prev`),zE=(e,t)=>Hd((n,r)=>{e.onerror=r,e.onsuccess=async e=>{let r=e.target.result;if(r===null||await t(r)===!1)return n();r.continue()}}),BE=(e,t,n,r=`next`)=>zE(e.openKeyCursor(t,r),e=>n(e.key)),VE=(e,t)=>e.objectStore(t),HE=(e,t)=>IDBKeyRange.upperBound(e,t),UE=(e,t)=>IDBKeyRange.lowerBound(e,t),WE=`custom`,GE=`updates`,KE=(e,t=()=>{},n=()=>{})=>{let[r]=AE(e.db,[GE]);return IE(r,UE(e._dbref,!1)).then(i=>{e._destroyed||(t(r),Xh(e.doc,()=>{i.forEach(t=>Zm(e.doc,t))},e,!1),n(r))}).then(()=>RE(r).then(t=>{e._dbref=t+1})).then(()=>jE(r).then(t=>{e._dbsize=t})).then(()=>r)},qE=(e,t=!0)=>KE(e).then(n=>{(t||e._dbsize>=500)&&FE(n,eh(e.doc)).then(()=>NE(n,HE(e._dbref,!0))).then(()=>jE(n).then(t=>{e._dbsize=t}))}),JE=class extends su{constructor(e,t){super(),this.doc=t,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=DE(e,e=>kE(e,[[`updates`,{autoIncrement:!0}],[`custom`]])),this.whenSynced=Hd(e=>this.on(`synced`,()=>e(this))),this._db.then(e=>{this.db=e,KE(this,async e=>{await jE(e)>0&&FE(e,eh(t))},()=>{if(this._destroyed)return this;this.synced=!0,this.emit(`synced`,[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(e,t)=>{if(this.db&&t!==this){let[t]=AE(this.db,[GE]);FE(t,e).catch(e=>{globalThis.__okYdbWriteWarned||(globalThis.__okYdbWriteWarned=!0,console.warn(JSON.stringify({event:`ok-ydb-write-failed`,cause:e?.name??`unknown`,message:e?.message??String(e)})))}),++this._dbsize>=500&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{qE(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},t.on(`update`,this._storeUpdate),this.destroy=this.destroy.bind(this),t.on(`destroy`,this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off(`update`,this._storeUpdate),this.doc.off(`destroy`,this.destroy),this._destroyed=!0,this._db.then(e=>{e.close()})}clearData(){return this.destroy().then(()=>{OE(this.name)})}get(e){return this._db.then(t=>{let[n]=AE(t,[WE],`readonly`);return ME(n,e)})}set(e,t){return this._db.then(n=>{let[r]=AE(n,[WE]);return PE(r,t,e)})}del(e){return this._db.then(t=>{let[n]=AE(t,[WE]);return NE(n,e)})}};function YE(){return!0}var XE=class{_idb;_dbName;whenSynced;constructor({branch:e,serverInstanceId:t,docName:n,doc:r}){if(typeof t!=`string`||t.length===0)throw Error(`createClientPersistence: serverInstanceId is required and must be non-empty`);this._dbName=`ok-ydoc:${e}:${t}:${n}`;let i=YE()?0:performance.now();this._idb=new JE(this._dbName,r),this.whenSynced=this._idb.whenSynced.then(()=>{if(!YE()){let e=performance.now();Z(`ok/pool/idb-whensynced`,{docName:n,durationMs:Math.round((e-i)*1e3)/1e3},{startTime:i,duration:e-i})}return this})}get synced(){return this._idb.synced}async destroy(){let e=YE()?0:performance.now();try{await this._idb.destroy()}finally{if(!YE()){let t=performance.now();Z(`ok/pool/idb-destroy`,{dbName:this._dbName,durationMs:Math.round((t-e)*1e3)/1e3},{startTime:e,duration:t-e})}}}async clearData(){let e=YE()?0:performance.now();try{await this._idb.destroy();let e=this._dbName;await new Promise((t,n)=>{let r=indexedDB.deleteDatabase(e);r.onsuccess=()=>t(),r.onerror=()=>n(r.error),r.onblocked=()=>{console.warn(JSON.stringify({event:`ok-client-persistence-clear-blocked`,dbName:e}))}})}finally{if(!YE()){let t=performance.now();Z(`ok/pool/idb-cleardata`,{dbName:this._dbName,durationMs:Math.round((t-e)*1e3)/1e3},{startTime:e,duration:t-e})}}}};function ZE(e){return new XE(e)}function QE(e){return oh(e)}function $E(e,t){return t===null?eh(e):eh(e,t)}function eD(e,t){if(e===null)return t;if(t===null)return e;let n=nh(e),r=nh(t),i=new Map;for(let[e,t]of n)i.set(e,t);for(let[e,t]of r){let n=i.get(e);(n===void 0||t>n)&&i.set(e,t)}return oh(i)}function tD(e){let t={};if(ir.inject(rr.active(),t),!t.traceparent)return e;let n=e.includes(`?`)?`&`:`?`,r=[`traceparent=${encodeURIComponent(t.traceparent)}`];return t.tracestate&&r.push(`tracestate=${encodeURIComponent(t.tracestate)}`),`${e}${n}${r.join(`&`)}`}var nD=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:i})=>new Gt({key:e||new W(`fileHandler`),props:{handleDrop(e,n){if(!r||!n.dataTransfer?.files.length)return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY}),o=Array.from(n.dataTransfer.files);return i&&(o=o.filter(e=>i.includes(e.type))),o.length===0?!1:(n.preventDefault(),n.stopPropagation(),r(t,o,a?.pos||0),!0)},handlePaste(e,r){if(!n||!r.clipboardData?.files.length)return!1;let a=Array.from(r.clipboardData.files),o=r.clipboardData.getData(`text/html`);return i&&(a=a.filter(e=>i.includes(e.type))),!(a.length===0||(r.preventDefault(),r.stopPropagation(),n(t,a,o),o.length>0))}}}),rD=D.create({name:`fileHandler`,addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0}},addProseMirrorPlugins(){return[nD({key:new W(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste})]}});function iD(e,t){let{state:n,view:r}=e;if(!n.selection.empty||!r.endOfTextblock(t))return!1;let i=n.selection.$head,a=t===`down`||t===`right`,o=null,s=-1;if(a){let e=i.after();if(e>=n.doc.content.size)return!1;o=n.doc.nodeAt(e),s=e}else{let e=i.before();if(e<=0||(o=n.doc.resolve(e).nodeBefore,!o))return!1;s=e-o.nodeSize}if(!o||o.type.name!==`jsxComponent`||o.childCount!==0||!pt.isSelectable(o))return!1;try{let t=pt.create(n.doc,s);return e.view.dispatch(n.tr.setSelection(t).scrollIntoView()),!0}catch(e){if(!(e instanceof RangeError))throw e;return Ae(t),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:t,tier:`L0`,reason:e.message.slice(0,500)})),!0}}function aD(e){let{state:t,view:n}=e;if(!(t.selection instanceof vt)||!t.selection.empty||!n.endOfTextblock(`up`))return!1;let r=t.selection.$head,i=-1;for(let e=r.depth-1;e>=1;e--)if(r.node(e).type.name===`jsxComponent`){i=e;break}if(i<0)return!1;for(let e=r.depth;e>i;e--)if(r.index(e-1)!==0)return!1;let a=r.before(i);try{let n=t.doc.resolve(a),r=Ke.findFrom(n,-1,!0);return!r||!(r instanceof vt)?!1:(e.view.dispatch(t.tr.setSelection(r).scrollIntoView()),!0)}catch(e){if(!(e instanceof RangeError))throw e;return Ae(`up`),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:`up`,tier:`L2c`,reason:e.message.slice(0,500)})),!0}}var oD=D.create({name:`keyboardNav`,priority:50,addKeyboardShortcuts(){return{Escape:({editor:e})=>{let{state:t}=e;if(t.selection instanceof pt){let n=t.selection.from+t.selection.node.nodeSize,r=t.doc.resolve(Math.min(n,t.doc.content.size)),i=vt.near(r);return e.view.dispatch(t.tr.setSelection(i)),!0}return t.selection instanceof vt?e.commands.selectParentNode():!1},ArrowUp:({editor:e})=>{if(iD(e,`up`)||aD(e))return!0;let{state:t}=e;if(!(t.selection instanceof pt))return!1;let n=t.selection.from,r=t.doc.resolve(n);if(r.index(r.depth)===0)return!1;let i=r.before(r.depth);if(i<=0)return!1;let a=t.doc.resolve(i-1).nodeBefore;if(!a||i-1-a.nodeSize+1<0)return!1;try{let n=pt.create(t.doc,i-a.nodeSize);return e.view.dispatch(t.tr.setSelection(n).scrollIntoView()),!0}catch(e){if(!(e instanceof RangeError))throw e;return Ae(`up`),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:`up`,tier:`L2`,reason:e.message.slice(0,500)})),!1}},ArrowDown:({editor:e})=>{if(iD(e,`down`))return!0;let{state:t}=e;if(!(t.selection instanceof pt))return!1;let n=t.selection.from+t.selection.node.nodeSize;if(n>=t.doc.content.size)return!1;try{if(!t.doc.nodeAt(n))return!1;let r=pt.create(t.doc,n);return e.view.dispatch(t.tr.setSelection(r).scrollIntoView()),!0}catch(e){if(!(e instanceof RangeError))throw e;return Ae(`down`),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:`down`,tier:`L2`,reason:e.message.slice(0,500)})),!1}},ArrowLeft:({editor:e})=>iD(e,`left`),ArrowRight:({editor:e})=>iD(e,`right`),Enter:({editor:e})=>{let{state:t}=e;if(!(t.selection instanceof vt)||!t.selection.empty)return!1;let n=t.selection.$from,r=n.parent;if(r.type.name!==`paragraph`||r.textContent!==``||n.depth<2)return!1;let i=-1;for(let e=n.depth-1;e>=1;e--)if(n.node(e).type.name===`jsxComponent`){i=e;break}if(i<0)return!1;let a=n.node(i);if(n.index(i)!==a.childCount-1)return!1;let o=n.after(i);if(o>t.doc.content.size)return!1;let s=t.tr,c=n.before(n.depth),l=n.after(n.depth);s.delete(c,l);let u=o-(l-c),d=t.schema.nodes.paragraph.create();s.insert(u,d);let f=u+1;return s.setSelection(vt.create(s.doc,f)),e.view.dispatch(s.scrollIntoView()),!0}}}}),sD={query:``,options:{caseSensitive:!1,wholeWord:!1},activeIndex:0,matches:[]},cD=/[A-Za-z0-9_]/;function lD(e){return e!==void 0&&cD.test(e)}function uD(e,t,n){return!lD(e[t-1])&&!lD(e[n])}function dD(e,t,n){if(t.length===0)return[];let r=n.caseSensitive?e:e.toLocaleLowerCase(),i=n.caseSensitive?t:t.toLocaleLowerCase(),a=[],o=0;for(;o<=r.length-i.length;){let t=r.indexOf(i,o);if(t===-1)break;let s=t+i.length;(!n.wholeWord||uD(e,t,s))&&a.push({start:t,end:s,text:e.slice(t,s)}),o=s}return a}function fD(e,t,n){if(t.length===0)return[];let r=[];return e.descendants((e,i)=>{if(!(!e.isText||typeof e.text!=`string`))for(let a of dD(e.text,t,n))r.push({from:i+a.start,to:i+a.end,text:a.text})}),r}var pD=new W(`findReplace`);function mD(e,t){return t<=0||!Number.isFinite(e)?0:Math.min(Math.max(Math.trunc(e),0),t-1)}function hD(e,t,n,r){let i=fD(e.doc,t,n);return{query:t,options:n,activeIndex:mD(r,i.length),matches:i}}function gD(e,t,n){return t<=0?0:(mD(e,t)+n+t)%t}function _D(e,t,n){if(e.length===0)return 0;let r=t+n,i=e.findIndex(e=>e.from>=r);return i===-1?0:i}function vD(e,t,n){if(t.matches.length===0)return null;let r=e.tr;for(let e of[...t.matches].reverse())r.insertText(n,e.from,e.to);let i=fD(r.doc,t.query,t.options),a=mD(0,i.length),o=i[a];return r.setMeta(pD,{type:`setActiveIndex`,activeIndex:a}),o&&r.setSelection(vt.create(r.doc,o.from,o.to)),r.scrollIntoView()}function yD(e,t){let n=pD.getState(e)?.matches[t];return n?e.tr.setMeta(pD,{type:`setActiveIndex`,activeIndex:t}).setSelection(vt.create(e.doc,n.from,n.to)).scrollIntoView():null}function bD(e){return pD.getState(e)??sD}function xD(){return new Gt({key:pD,state:{init:()=>sD,apply(e,t,n,r){let i=e.getMeta(pD);if(i?.type===`clear`)return sD;let a=t.query,o=t.options,s=t.activeIndex;if(i?.type===`setQuery`)a=i.query,o={...o,...i.options},s=i.activeIndex??0;else if(i?.type===`setOptions`)o={...o,...i.options},s=i.activeIndex??s;else if(i?.type===`setActiveIndex`)s=i.activeIndex;else if(!e.docChanged)return t;return a.length===0?{query:a,options:o,activeIndex:0,matches:[]}:hD(r,a,o,s)}},props:{decorations(e){let t=pD.getState(e);return!t||t.matches.length===0?null:Tt.create(e.doc,t.matches.map((e,n)=>Pe.inline(e.from,e.to,{class:n===t.activeIndex?`ok-find-match ok-find-match-active`:`ok-find-match`})))}}})}var SD=D.create({name:`findReplace`,addCommands(){return{setFindQuery:(e,t)=>({state:n,dispatch:r})=>(r&&r(n.tr.setMeta(pD,{type:`setQuery`,query:e,options:t?.options,activeIndex:t?.activeIndex})),!0),setFindOptions:(e,t)=>({state:n,dispatch:r})=>(r&&r(n.tr.setMeta(pD,{type:`setOptions`,options:e,activeIndex:t})),!0),setActiveFindIndex:e=>({state:t,dispatch:n})=>(n&&n(t.tr.setMeta(pD,{type:`setActiveIndex`,activeIndex:e})),!0),selectNextFindMatch:()=>({state:e,dispatch:t})=>{let n=bD(e),r=yD(e,gD(n.activeIndex,n.matches.length,1));return r?(t?.(r),!0):!1},selectPreviousFindMatch:()=>({state:e,dispatch:t})=>{let n=bD(e),r=yD(e,gD(n.activeIndex,n.matches.length,-1));return r?(t?.(r),!0):!1},replaceCurrentFindMatch:e=>({state:t,dispatch:n})=>{let r=bD(t),i=r.matches[r.activeIndex];if(!i||!n)return!1;let a=t.tr.insertText(e,i.from,i.to),o=fD(a.doc,r.query,r.options),s=_D(o,i.from,e.length),c=o[s];return a.setMeta(pD,{type:`setActiveIndex`,activeIndex:s}),c&&a.setSelection(vt.create(a.doc,c.from,c.to)),a.scrollIntoView(),n(a),!0},replaceAllFindMatches:e=>({state:t,dispatch:n})=>{let r=bD(t);if(!n)return!1;let i=vD(t,r,e);return i?(n(i),!0):!1},clearFindMatches:()=>({state:e,dispatch:t})=>(t&&t(e.tr.setMeta(pD,{type:`clear`})),!0)}},addProseMirrorPlugins(){return[xD()]}}),CD=new WeakMap;function wD(e,t){if(t===null){CD.delete(e);return}CD.set(e,t)}function TD(e){return CD.get(e)??null}function ED(e){return`pagesBySlug`in e}function DD(e){return ED(e)?e.pages:e}function OD(e,t){return ED(e)?e.assetPaths??new Set:t??new Set}function kD(e,t){let n=S(e);if(n){if(ED(t))return t.pagesBySlug.get(n);for(let e of t)if(S(e)===n)return e}}function AD(e){let t=e.trim();if(!t)return null;let n=S(t);return n?{target:n,alias:n===t?null:t,anchor:null}:null}function jD(e){let t=e.trim();if(!t)return[];let n=S(t);return n.length>0&&n!==t?[n]:[]}function MD(e,t){let n=e.trim();if(!n)return;let r=DD(t);if(r.has(n))return n;let i=kD(n,t);if(i)return i;for(let e of jD(n))if(r.has(e))return e}function ND(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function PD(e,t){let n=ND(e);if(!n)return null;if(t.has(n))return n;let r=n.toLowerCase();for(let e of t)if(e.toLowerCase()===r)return e;if(n.includes(`/`))return null;let i=[...t].filter(e=>{let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1)).toLowerCase()===r});return i.length===0?null:i.sort((e,t)=>e.localeCompare(t))[0]??null}function FD(e,t,n){let r=e.trim();if(!r)return!1;if(PD(r,OD(t,n)))return!0;let i=DD(t);return i.has(r)||jD(r).some(e=>i.has(e))?!0:kD(r,t)!==void 0}var ID=class extends Error{status;instance;constructor(e,t={}){super(e,t.cause===void 0?void 0:{cause:t.cause}),this.name=`HttpResponseParseError`,this.status=t.status,this.instance=t.instance}},LD=new W(`imageUpload`);function RD(e){let t=document.createElement(`div`);t.className=`image-upload-skeleton w-full h-40 rounded-md bg-muted animate-pulse motion-reduce:animate-none my-2`,t.setAttribute(`data-upload-widget`,`loading`),t.setAttribute(`role`,`status`);let n=e?.name;return t.setAttribute(`aria-label`,n?_._({id:`KDuPiY`,values:{fileName:n}}):_._({id:`bGa3Fk`})),t}var zD=new Gt({key:LD,state:{init(){return{decorations:Tt.empty,uploads:new Map}},apply(e,t){let n=t.decorations.map(e.mapping,e.doc),r=new Map;for(let[n,i]of t.uploads)r.set(n,e.mapping.map(i));let i=e.getMeta(LD);if(!i)return{decorations:n,uploads:r};if(i.type===`add`){let t=Pe.widget(i.pos,i.widget,{id:i.id,stopEvent:()=>!0}),a=n.add(e.doc,[t]),o=new Map(r);return o.set(i.id,e.mapping.map(i.pos)),{decorations:a,uploads:o}}if(i.type===`remove`){let e=n.find(void 0,void 0,e=>e.id===i.id),t=n.remove(e),a=new Map(r);return a.delete(i.id),{decorations:t,uploads:a}}return{decorations:n,uploads:r}}},props:{decorations(e){return LD.getState(e)?.decorations??Tt.empty}}});function BD(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function VD(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function HD(e){return e.split(`/`).filter(e=>e!==``)}function UD(e,t){let n=BD(e),r=BD(t),i=VD(e);if(n===r)return i;let a=HD(r),o=HD(n),s=0;for(;s<a.length&&s<o.length&&a[s]===o[s];)s++;let c=a.length-s,l=o.slice(s);return c===0?`./${[...l,i].join(`/`)}`:[...Array(c).fill(`..`),...l,i].join(`/`)}function WD(e){return TD(e)}function GD(e,t){return{type:`jsxComponent`,attrs:{componentName:e===`jsx-img`?`img`:e===`jsx-video`?`video`:`audio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!0,props:e===`jsx-img`?{src:t}:{src:t,controls:!0}}}}function KD(e){let t=ue(e);return t===`md`||t===`mdx`?{kind:`wiki-link`,ext:t}:j.has(t)?{kind:`jsx-img`,ext:t}:Kt.has(t)?{kind:`jsx-video`,ext:t}:Rt.has(t)?{kind:`jsx-audio`,ext:t}:V.has(t)?{kind:`jsx-file`,ext:t}:Ve.has(t)?{kind:`wikiembed`,ext:t}:{kind:`markdown-link`,ext:t}}async function qD(e,t,n){let r=WD(t),i=r?`${r}.md`:``;if(!i){Yn.error(_._({id:`z5pqI8`}));return}let a=crypto.randomUUID(),o=RD(e);t.view.dispatch(t.state.tr.setMeta(LD,{type:`add`,id:a,pos:n,widget:o}));let s=new FormData;s.append(`file`,e),s.append(`parentDocName`,i);let c;try{c=await fetch(`/api/upload`,{method:`POST`,body:s})}catch(e){console.error(`[uploadAndInsert] Network error:`,e),JD(t,a);return}let l;try{l=await c.json()}catch(e){console.error(`[uploadAndInsert] Response is not JSON:`,e),JD(t,a);return}if(!c.ok){let e=Te.safeParse(l);if(!e.success){let n=new ID(`Upload response did not match ProblemDetails.`,{cause:e.error,status:c.status});console.error(`[uploadAndInsert] Server error (unparseable):`,n),JD(t,a);return}console.error(`[uploadAndInsert] Server error:`,e.data),JD(t,a,e.data.title);return}let u=mt.safeParse(l);if(!u.success){let e=new ID(`Upload success response did not match UploadAssetSuccess.`,{cause:u.error,status:c.status});console.error(`[uploadAndInsert] Response missing src:`,e),JD(t,a);return}let d=u.data,f=d.src,p=d.deduped===!0,m=BD(i),h=typeof d.path==`string`&&d.path.length>0?d.path:m?`${m}/${f}`:f;p&&Yn.info(_._({id:`VbqhBI`,values:{assetContentPath:h}}));let g=KD(e.name),{state:v}=t,y=LD.getState(v)?.uploads.get(a)??n,b=v.tr.setMeta(LD,{type:`remove`,id:a}),x=UD(h,i),S=`/${h}`;if(g.kind===`jsx-file`){if(!v.schema.nodes.jsxComponent){console.error(`[uploadAndInsert] jsxComponent node missing from schema`),JD(t,a);return}let n={type:`jsxComponent`,attrs:{componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!0,props:{src:S,target:f,alias:null,anchor:null,size:ye(e.size)}}};t.chain().command(({tr:e})=>(e.setMeta(LD,{type:`remove`,id:a}),!0)).focus().insertContentAt(y,n).command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=e.mapping.map(y);return e.doc.nodeAt(n)?.type.name===`jsxComponent`&&e.setSelection(pt.create(e.doc,n)),!0}).run();return}if(g.kind===`jsx-img`||g.kind===`jsx-video`||g.kind===`jsx-audio`){if(!v.schema.nodes.jsxComponent){console.error(`[uploadAndInsert] jsxComponent node missing from schema`),JD(t,a);return}let e=GD(g.kind,S);t.chain().command(({tr:e})=>(e.setMeta(LD,{type:`remove`,id:a}),!0)).focus().insertContentAt(y,e).command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=e.mapping.map(y);return e.doc.nodeAt(n)?.type.name===`jsxComponent`&&e.setSelection(pt.create(e.doc,n)),!0}).run();return}if(g.kind===`wikiembed`){let e=v.schema.nodes.wikiLinkEmbed;if(!e){console.error(`[uploadAndInsert] wikiLinkEmbed node missing from schema`),JD(t,a);return}b.insert(y,e.create({target:f,alias:null,anchor:null,resolvedSrc:S}))}else if(g.kind===`wiki-link`){let n=v.schema.nodes.wikiLink;if(!n){console.error(`[uploadAndInsert] wikiLink node missing from schema`),JD(t,a);return}let r=AD(e.name.replace(/\.(md|mdx)$/i,``));r?b.insert(y,n.create(r)):b.insert(y,v.schema.text(e.name))}else{let t=v.schema.marks.link;if(t){let n=v.schema.text(e.name,[t.create({href:x})]);b.insert(y,n)}else b.insert(y,v.schema.text(e.name))}t.view.dispatch(b)}function JD(e,t,n){e.view.dispatch(e.state.tr.setMeta(LD,{type:`remove`,id:t})),Yn.error(n??_._({id:`b3Thhd`}))}var YD=new Set;function XD(e){YD.add(e)}function ZD(e){return YD.delete(e)}var QD=new W(`markIdentity`);function $D(){return{byId:new Map,counter:0}}function eO(e,t,n,r,i){let a=[];for(let e of t.byId.values()){let t=i?i.map(e.from,-1):e.from,n=i?i.map(e.to,1):e.to;n<=t||a.push({id:e.id,markType:e.markType,attrs:e.attrs,from:t,to:n})}let o=new Map,s=new Set,c=t.counter;return e.descendants((e,t)=>{if(!(!e.isInline||e.marks.length===0))for(let i of e.marks){if(!n.has(i.type.name)||r&&!r(i))continue;let l=null;for(let e of a)if(!s.has(e.id)&&e.markType===i.type.name&&tO(e.attrs,i.attrs)&&!(t<e.from||t>=e.to)){l=e.id;break}let u=l??`m${++c}`;s.add(u);let d=t,f=t+e.nodeSize,p=o.get(u);p?p.to=Math.max(p.to,f):o.set(u,{id:u,markType:i.type.name,attrs:i.attrs,from:d,to:f})}}),{byId:o,counter:c}}function tO(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(n!==i&&!(typeof n==`object`&&n&&typeof i==`object`&&i&&tO(n,i)))return!1}return!0}function nO(e,t,n,r){let i=new Set(t.byId.keys());for(let[r,i]of t.byId)e.has(r)||n?.(i);for(let t of e)i.has(t)||r?.(t);return i}function rO(e){let{markTypes:t,predicate:n,onRegister:r,onDeregister:i}=e,a=new Set(t);return new Gt({key:QD,state:{init(e,t){return eO(t.doc,$D(),a,n)},apply(e,t,r,i){return e.docChanged?eO(i.doc,t,a,n,e.mapping):t}},view(){let e=new Set;return{update(t){let n=QD.getState(t.state);n&&(e=nO(e,n,r,i))},destroy(){for(let t of e)i?.(t);e=new Set}}}})}var iO=300,aO=150,oO=500,sO=class{registry=new Map;_activeNodeId=null;listeners=new Set;_snapshot={activeNodeId:null,active:null};register(e){this.registry.set(e.nodeId,e),this._activeNodeId===e.nodeId&&this.refreshSnapshot()}deregister(e){this.registry.delete(e)&&this._activeNodeId===e&&(this._activeNodeId=null,this.refreshSnapshot())}setActiveNode(e){this._activeNodeId!==e&&(e!==null&&!this.registry.has(e)||(this._activeNodeId=e,this.refreshSnapshot()))}getActiveNode(){return this._activeNodeId}getRegistration(e){return this.registry.get(e)}hasRegistration(e){return this.registry.has(e)}clear(){this.registry.clear(),this._activeNodeId=null,this.refreshSnapshot()}getSnapshot=()=>this._snapshot;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});refreshSnapshot(){let e=this._activeNodeId==null?null:this.registry.get(this._activeNodeId)??null;this._snapshot={activeNodeId:this._activeNodeId,active:e};for(let e of this.listeners)e()}};function cO(e,t){let n=e??null;for(;n&&typeof n==`object`;){let e=n.getAttribute;if(typeof e==`function`){let r=e.call(n,`data-mark-id`);if(r&&t.hasRegistration(r))return r;let i=e.call(n,`data-node-id`);if(i&&t.hasRegistration(i))return i}n=n.parentElement??null}return null}function lO(e){return e?e.closest(`[data-ok-prop-panel]`)!==null:!1}function uO(){return typeof document>`u`?!1:document.querySelector(`[data-ok-layer-spawned]`)!==null}var dO=e=>{let t=(0,J.c)(18),{store:n}=e,r;t[0]===n?r=t[1]:(r=()=>n.getSnapshot(),t[0]=n,t[1]=r);let[i,a]=(0,Y.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>(a(n.getSnapshot()),n.subscribe(()=>{a(n.getSnapshot())})),s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Y.useEffect)(o,s);let{active:c}=i;if(!c)return null;let l;t[5]===n?l=t[6]:(l=()=>n.setActiveNode(null),t[5]=n,t[6]=l);let u,d,f;if(t[7]!==c.controls||t[8]!==c.nodeId||t[9]!==c.type||t[10]!==l){let e={nodeId:c.nodeId,type:c.type,deactivate:l};u=c.controls.propPanel?.(e),d=c.controls.toolbar?.(e),f=c.controls.breadcrumb?.(e),t[7]=c.controls,t[8]=c.nodeId,t[9]=c.type,t[10]=l,t[11]=u,t[12]=d,t[13]=f}else u=t[11],d=t[12],f=t[13];let p;return t[14]!==u||t[15]!==d||t[16]!==f?(p=(0,X.jsxs)(X.Fragment,{children:[u,d,f]}),t[14]=u,t[15]=d,t[16]=f,t[17]=p):p=t[17],p};function fO(e){return e.editorView?.dom??null}function pO(e,t){let n=e;for(;n;){if(n.getAttribute?.(`data-mark-id`)===t||n.getAttribute?.(`data-node-id`)===t)return!0;n=n.parentElement}return!1}function mO(e){let{editor:t}=e,n=new sO,r=fO(t),i=!1,a=null,o=null,s=null,c=null,l=null,u=()=>{a!==null&&(clearTimeout(a),a=null),s=null},d=()=>{o!==null&&(clearTimeout(o),o=null)},f=()=>{c!==null&&(clearTimeout(c),c=null)},p=e=>{if(n.getActiveNode()===e){d();return}s===e&&a!==null||(u(),d(),s=e,a=setTimeout(()=>{a=null,s=null,n.setActiveNode(e)},iO))},m=()=>{n.getActiveNode()!==null&&o===null&&(o=setTimeout(()=>{o=null,!uO()&&n.setActiveNode(null)},aO))},h=null,g=!1,_=e=>{try{g=!0,e.focus({preventScroll:!0})}catch{}finally{g=!1}},v=n.subscribe(()=>{let e=n.getActiveNode();if(e!==null){if(typeof document<`u`){let t=document.activeElement;h=t&&pO(t,e)?t:null}return}if(typeof document>`u`)return;let i=h;if(h=null,i&&document.contains(i)&&typeof i.focus==`function`){_(i);return}let a=r??fO(t);a&&typeof a.focus==`function`&&_(a)}),y=e=>{let t=e;if(t.button!==2){if(t.metaKey||t.ctrlKey||t.button===1){u(),t.button===1&&t.preventDefault?.();return}if(t.pointerType===`touch`){let t=cO(e.target,n);if(t===null)return;f(),c=setTimeout(()=>{c=null,l=t,n.setActiveNode(t)},oO);return}u()}},b=()=>{f()},x=e=>{e.pointerType===`touch`&&c!==null&&f()},S=e=>{let t=e;if(t.button===2||t.type===`click`&&t.button===1)return;let r=cO(e.target,n);if(r===null)return;if(l!==null){let e=l===r;if(l=null,e){t.preventDefault?.();return}}let i=t.metaKey||t.ctrlKey||t.button===1,a=n.getRegistration(r);if(a?.handlePrimary&&a.handlePrimary({nodeId:r,type:a.type,newTab:i})){t.preventDefault?.(),i||(u(),d(),n.getActiveNode()===r&&n.setActiveNode(null));return}i||(u(),d(),n.setActiveNode(r))},C=e=>{let t=e;if(t.key===`Escape`){n.getActiveNode()!==null&&(u(),d(),n.setActiveNode(null),t.preventDefault?.());return}if(t.key===`Tab`&&!t.shiftKey&&!t.altKey&&!t.metaKey&&!t.ctrlKey){let r=cO(e.target,n);if(r!==null&&n.getActiveNode()===r){let e=document.querySelector(`[data-ok-prop-panel]`);if(e){let n=e.querySelector(`button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])`);if(n){t.preventDefault?.(),n.focus();return}}}return}let r=t.key===`Enter`,i=t.key===` `||t.key===`Spacebar`;if(!r&&!i)return;let a=cO(e.target,n);if(a===null||i&&((e.target instanceof Element?e.target:null)?.closest(`[data-mark-id], [data-node-id]`)??null)?.getAttribute(`role`)===`link`)return;let o=n.getRegistration(a);if(t.preventDefault?.(),o?.handlePrimary&&o.handlePrimary({nodeId:a,type:o.type,newTab:!1})){u(),d(),n.getActiveNode()===a&&n.setActiveNode(null);return}n.setActiveNode(a)},w=e=>{let t=e;if(t.pointerType!==`mouse`)return;let r=t.target;if(!(r instanceof Element))return;if(lO(r)){d();return}let i=cO(r,n);i!==null&&p(i)},T=e=>{let t=e;if(t.pointerType!==`mouse`)return;let r=t.target,i=t.relatedTarget;if(!(r instanceof Element))return;let a=i instanceof Element?i:null,o=cO(r,n);if(o!==null){if(a&&lO(a)){d();return}if(a&&cO(a,n)===o)return;s===o&&u(),m();return}if(lO(r)){if(a&&lO(a))return;let e=n.getActiveNode();if(e!==null&&a&&cO(a,n)===e)return;m()}},E=e=>{if(g)return;let t=e.target;if(!(t instanceof Element))return;let r=cO(t,n);r!==null&&(u(),d(),n.setActiveNode(r))},D=e=>{let t=e;if(n.getActiveNode()===null)return;let r=t.relatedTarget,i=r instanceof Element?r:null;i&&lO(i)||i&&cO(i,n)!==null||m()},O=e=>{if(n.getActiveNode()===null)return;let t=e.target;t&&(r?.contains(t)||t instanceof Element&&(t.closest(`[data-ok-interaction-layer]`)||t.closest(`[data-ok-prop-panel]`)||t.closest(`[data-ok-layer-spawned]`))||(u(),d(),n.setActiveNode(null)))},k=()=>{i||(r=fO(t),r&&(r.addEventListener(`pointerdown`,y,!0),r.addEventListener(`pointerup`,b,!0),r.addEventListener(`pointercancel`,b,!0),r.addEventListener(`pointermove`,x,!0),r.addEventListener(`click`,S,!0),r.addEventListener(`auxclick`,S,!0),r.addEventListener(`keydown`,C,!0),typeof document<`u`&&(document.addEventListener(`pointerover`,w,!0),document.addEventListener(`pointerout`,T,!0),document.addEventListener(`focusin`,E,!0),document.addEventListener(`focusout`,D,!0),document.addEventListener(`pointerdown`,O,!0)),i=!0))},A=()=>{i&&=(r?.removeEventListener(`pointerdown`,y,!0),r?.removeEventListener(`pointerup`,b,!0),r?.removeEventListener(`pointercancel`,b,!0),r?.removeEventListener(`pointermove`,x,!0),r?.removeEventListener(`click`,S,!0),r?.removeEventListener(`auxclick`,S,!0),r?.removeEventListener(`keydown`,C,!0),typeof document<`u`&&(document.removeEventListener(`pointerover`,w,!0),document.removeEventListener(`pointerout`,T,!0),document.removeEventListener(`focusin`,E,!0),document.removeEventListener(`focusout`,D,!0),document.removeEventListener(`pointerdown`,O,!0)),!1)};return k(),{register(e){n.register(e),i||k()},deregister(e){n.deregister(e)},setActiveNode(e){n.setActiveNode(e)},getActiveNode(){return n.getActiveNode()},getRegistration(e){return n.getRegistration(e)},destroy(){A(),u(),d(),f(),v(),n.clear()},store:n}}var hO=e=>{let t=(0,J.c)(2),{store:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{"data-ok-interaction-layer":``,className:`contents`,children:(0,X.jsx)(dO,{store:n})}),t[0]=n,t[1]=r),r},gO=new WeakMap;function _O(e){let t=gO.get(e);if(t)return t;let n=mO({editor:e});return gO.set(e,n),e.on(`destroy`,()=>{n.destroy(),gO.delete(e)}),n}var vO={AppWindow:Si,ChevronRight:Zn,CopyPlus:Ii,FileText:Hi,Film:Gi,GitBranch:Ji,Image:$i,LayoutPanelTop:na,MessageSquareWarning:da,PanelTop:ha,Paperclip:ga,Sigma:Ca,SquarePlay:Ta,Volume2:Na,Workflow:Pa,ZoomIn:Ia};function yO(e){return e&&Object.hasOwn(vO,e)?vO[e]:Ei}var bO={ChevronRight:Zn};function xO(e){if(!e||!e.startsWith(`lucide:`))return null;let t=e.slice(7);return Object.hasOwn(bO,t)?bO[t]:null}function SO(e){let t=(0,J.c)(24),n;t[0]===e.icon?n=t[1]:(n=xO(e.icon),t[0]=e.icon,t[1]=n);let r=n,i=r?`custom`:void 0,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Zn,{size:14,className:`accordion-chevron`,"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=r?(0,X.jsx)(r,{size:16,className:`accordion-icon`,"aria-hidden":`true`}):null,t[3]=r,t[4]=o);let s=e.title??`Accordion`,c;t[5]===s?c=t[6]:(c=(0,X.jsx)(`span`,{className:`accordion-title`,children:s}),t[5]=s,t[6]=c);let l;t[7]===e.description?l=t[8]:(l=e.description?(0,X.jsx)(`span`,{className:`accordion-description`,children:e.description}):null,t[7]=e.description,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`span`,{className:`accordion-title-group`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==u?(d=(0,X.jsxs)(`summary`,{className:`accordion-summary`,contentEditable:!1,children:[a,o,u]}),t[12]=o,t[13]=u,t[14]=d):d=t[14];let f;t[15]===e.children?f=t[16]:(f=(0,X.jsx)(`div`,{className:`accordion-body`,children:e.children}),t[15]=e.children,t[16]=f);let p;return t[17]!==e.defaultOpen||t[18]!==e.id||t[19]!==e.name||t[20]!==i||t[21]!==d||t[22]!==f?(p=(0,X.jsxs)(`details`,{className:`accordion`,"data-accordion-icon":i,open:e.defaultOpen,id:e.id,name:e.name,children:[d,f]}),t[17]=e.defaultOpen,t[18]=e.id,t[19]=e.name,t[20]=i,t[21]=d,t[22]=f,t[23]=p):p=t[23],p}function CO(e){return e!==!1}function wO(e){let t=(0,J.c)(12),n;t[0]===e.src?n=t[1]:(n=e.src===void 0?void 0:ae(e.src),t[0]=e.src,t[1]=n);let r=e.title,i;t[2]===e.controls?i=t[3]:(i=CO(e.controls),t[2]=e.controls,t[3]=i);let a;return t[4]!==e.autoplay||t[5]!==e.loop||t[6]!==e.muted||t[7]!==e.preload||t[8]!==e.title||t[9]!==n||t[10]!==i?(a=(0,X.jsx)(`audio`,{className:`ok-audio`,src:n,title:r,controls:i,autoPlay:e.autoplay,loop:e.loop,muted:e.muted,preload:e.preload}),t[4]=e.autoplay,t[5]=e.loop,t[6]=e.muted,t[7]=e.preload,t[8]=e.title,t[9]=n,t[10]=i,t[11]=a):a=t[11],a}var TO={note:ea,tip:ra,important:da,warning:g,caution:pa,abstract:Pi,info:Ti,todo:ca,success:ut,question:Mi,failure:Ni,danger:Fa,bug:Di,example:Ki,quote:ya},EO={Info:ea,Lightbulb:ra,MessageSquareWarning:da,AlertTriangle:g,AlertOctagon:pa,ClipboardList:Pi,BookOpen:Ti,ListTodo:ca,CircleCheck:ut,CircleHelp:Mi,CircleX:Ni,Zap:Fa,Bug:Di,FlaskConical:Ki,Quote:ya};function DO(e,t){if(!e||!e.startsWith(`lucide:`))return TO[t];let n=e.slice(7);return Object.hasOwn(EO,n)?EO[n]:TO[t]}var OO=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]);function kO(e){return typeof e==`string`&&OO.has(e)?e:`note`}function AO(e){let t=(0,J.c)(29),n,r;t[0]!==e.icon||t[1]!==e.type?(r=kO(e.type),n=DO(e.icon,r),t[0]=e.icon,t[1]=e.type,t[2]=n,t[3]=r):(n=t[2],r=t[3]);let i=n,a;t[4]===e.color?a=t[5]:(a=e.color?{"--callout-type-color":e.color}:{},t[4]=e.color,t[5]=a);let s=a,c;t[6]!==i||t[7]!==e.title?(c=e.title||i?(0,X.jsxs)(`span`,{className:`callout-header`,contentEditable:!1,children:[(0,X.jsx)(i,{size:16,className:`callout-icon`,"aria-hidden":`true`}),e.title?(0,X.jsx)(`span`,{className:`callout-title`,children:e.title}):null]}):null,t[6]=i,t[7]=e.title,t[8]=c):c=t[8];let l=c;if(e.collapsible){let n=e.defaultOpen??!0,i;t[9]===l?i=t[10]:(i=l??(0,X.jsx)(`span`,{className:`callout-title`,children:(0,X.jsx)(o,{id:`URmyfc`})}),t[9]=l,t[10]=i);let a;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ki,{size:16,className:`callout-chevron`,"aria-hidden":`true`}),t[11]=a):a=t[11];let c;t[12]===i?c=t[13]:(c=(0,X.jsxs)(`summary`,{className:`callout-summary`,contentEditable:!1,children:[i,a]}),t[12]=i,t[13]=c);let u;t[14]===e.children?u=t[15]:(u=(0,X.jsx)(`div`,{className:`callout-body`,children:e.children}),t[14]=e.children,t[15]=u);let d;return t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==u||t[20]!==r?(d=(0,X.jsxs)(`details`,{className:`callout callout-collapsible`,"data-callout-type":r,open:n,style:s,children:[c,u]}),t[16]=n,t[17]=s,t[18]=c,t[19]=u,t[20]=r,t[21]=d):d=t[21],d}let u;t[22]===e.children?u=t[23]:(u=(0,X.jsx)(`div`,{className:`callout-body`,children:e.children}),t[22]=e.children,t[23]=u);let d;return t[24]!==l||t[25]!==s||t[26]!==u||t[27]!==r?(d=(0,X.jsxs)(`div`,{className:`callout callout-static`,"data-callout-type":r,style:s,children:[l,u]}),t[24]=l,t[25]=s,t[26]=u,t[27]=r,t[28]=d):d=t[28],d}var jO=(0,Y.createContext)(null);function MO(e){let t=(0,J.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(jO.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function NO(){return(0,Y.use)(jO)}var PO=[{key:`tl`,dx:-1,dy:-1,cursor:`nwse-resize`,className:`ok-resize-handle ok-resize-handle--tl`},{key:`t`,dx:0,dy:-1,cursor:`ns-resize`,className:`ok-resize-handle ok-resize-handle--t`},{key:`tr`,dx:1,dy:-1,cursor:`nesw-resize`,className:`ok-resize-handle ok-resize-handle--tr`},{key:`r`,dx:1,dy:0,cursor:`ew-resize`,className:`ok-resize-handle ok-resize-handle--r`},{key:`br`,dx:1,dy:1,cursor:`nwse-resize`,className:`ok-resize-handle ok-resize-handle--br`},{key:`b`,dx:0,dy:1,cursor:`ns-resize`,className:`ok-resize-handle ok-resize-handle--b`},{key:`bl`,dx:-1,dy:1,cursor:`nesw-resize`,className:`ok-resize-handle ok-resize-handle--bl`},{key:`l`,dx:-1,dy:0,cursor:`ew-resize`,className:`ok-resize-handle ok-resize-handle--l`}];function FO(e){let t=(0,J.c)(7),{targetRef:n,onResize:r,onResizeEnd:a,bounds:o}=e,{_:s}=i(),c=(0,Y.useRef)(null),l;t[0]!==o?.maxHeight||t[1]!==o?.maxWidth||t[2]!==o?.minHeight||t[3]!==o?.minWidth?(l=function(e,t){let n=t===`w`?o?.minWidth??64:o?.minHeight??64,r=t===`w`?o?.maxWidth??1/0:o?.maxHeight??1/0;return Math.max(n,Math.min(r,e))},t[0]=o?.maxHeight,t[1]=o?.maxWidth,t[2]=o?.minHeight,t[3]=o?.minWidth,t[4]=l):l=t[4];let u=l,d=function(e,t){let i=n.current;if(!i)return;e.preventDefault(),e.stopPropagation();let o=i.getBoundingClientRect();c.current={handle:t,startX:e.clientX,startY:e.clientY,startWidth:o.width,startHeight:o.height,latestWidth:o.width,latestHeight:o.height,hasMoved:!1},document.body.style.setProperty(`cursor`,t.cursor),document.body.style.setProperty(`user-select`,`none`);let s=function(e){let t=c.current;if(!t)return;let n=(e.clientX-t.startX)*t.handle.dx,i=(e.clientY-t.startY)*t.handle.dy,a=t.handle.dx===0?t.startWidth:u(t.startWidth+n,`w`),o=t.handle.dy===0?t.startHeight:u(t.startHeight+i,`h`);t.latestWidth=a,t.latestHeight=o,t.hasMoved=!0,r({width:a,height:o})};function l(){let e=c.current;if(!e)return;let t={width:e.latestWidth,height:e.latestHeight},n=e.hasMoved;c.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,l),window.removeEventListener(`pointercancel`,l),n&&a?.(t)}window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,l),window.addEventListener(`pointercancel`,l)},f=PO.map(e=>{let t=e.key;return(0,X.jsx)(`button`,{type:`button`,className:pn(e.className),"aria-label":s({id:`NxW-md`,values:{handleKey:t}}),tabIndex:-1,style:{cursor:e.cursor},onPointerDown:t=>d(t,e)},t)}),p;return t[5]===f?p=t[6]:(p=(0,X.jsx)(`div`,{className:`ok-resize-overlay`,contentEditable:!1,"aria-hidden":`true`,children:f}),t[5]=f,t[6]=p),p}var IO=`26rem`,LO=`Embedded content`,RO=/^https?:\/\//i;function zO(e){try{return new URL(e).origin!==window.location.origin}catch{return!1}}function BO(e){return!(typeof e!=`string`||!RO.test(e)||!zO(e))}function VO(e){let t=(0,J.c)(21),{src:n,title:r,width:i,height:a}=e,o=(0,Y.useRef)(null),s=NO(),c=i||void 0,l=a||IO,u;t[0]!==c||t[1]!==l?(u={width:c,height:l},t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f,p;if(t[3]!==a||t[4]!==i?(f=()=>{let e=o.current;e&&(e.style.width=i||``,e.style.height=a||IO)},p=[i,a],t[3]=a,t[4]=i,t[5]=f,t[6]=p):(f=t[5],p=t[6]),(0,Y.useEffect)(f,p),!BO(n)){let e=`Embed a URL`;typeof n==`string`&&n.length>0&&(e=RO.test(n)?`Embed only supports cross-origin URLs`:`URL must start with http:// or https://`);let r;return t[7]===e?r=t[8]:(r=(0,X.jsx)(`div`,{className:`ok-embed ok-embed--placeholder`,contentEditable:!1,children:(0,X.jsx)(`span`,{children:e})}),t[7]=e,t[8]=r),r}let m;t[9]===s?m=t[10]:(m=e=>{if(!s)return;let{editor:t,getPos:n}=s,r=n();if(typeof r==`number`)try{let n=t.state.doc.nodeAt(r);if(!n||n.type.name!==`jsxComponent`)return;let i={...n.attrs.props??{},width:`${Math.round(e.width)}px`,height:`${Math.round(e.height)}px`};t.view.dispatch(t.state.tr.setNodeMarkup(r,null,{...n.attrs,props:i,sourceDirty:!0}))}catch(e){let t=e;if(t instanceof RangeError)return;throw t}},t[9]=s,t[10]=m);let h=m,g=r||LO,_;t[11]!==n||t[12]!==g?(_=(0,X.jsx)(`iframe`,{title:g,src:n,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation`,referrerPolicy:`no-referrer`,loading:`lazy`,className:`ok-embed-frame`}),t[11]=n,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==s||t[15]!==h?(v=s?(0,X.jsx)(FO,{targetRef:o,bounds:{minWidth:192,maxWidth:2e3,minHeight:128,maxHeight:Math.round(window.innerHeight*.9)},onResize:e=>{let t=o.current;t&&(t.style.width=`${e.width}px`,t.style.height=`${e.height}px`)},onResizeEnd:h}):null,t[14]=s,t[15]=h,t[16]=v):v=t[16];let y;return t[17]!==d||t[18]!==_||t[19]!==v?(y=(0,X.jsxs)(`div`,{className:`ok-embed`,style:d,ref:o,contentEditable:!1,children:[_,v]}),t[17]=d,t[18]=_,t[19]=v,t[20]=y):y=t[20],y}function HO(e){if(!e)return``;let t,n=null;try{let r=new URL(e,`https://placeholder.local`);n=r.protocol,t=r.pathname}catch{t=e.split(`?`)[0]??e}if(n===`data:`||n===`blob:`)return``;let r=t.split(`/`),i=r[r.length-1]??``;try{return decodeURIComponent(i)}catch{return i}}function UO(e){let t=(0,J.c)(18),n;t[0]!==e.name||t[1]!==e.src?(n=e.name?.trim()||HO(e.src)||`Untitled file`,t[0]=e.name,t[1]=e.src,t[2]=n):n=t[2];let r=n,i=e.size?.trim()?e.size:null,a;t[3]===e.src?a=t[4]:(a=e.src?ae(e.src):void 0,t[3]=e.src,t[4]=a);let o=a,s;t[5]===o?s=t[6]:(s=e=>{e.stopPropagation(),e.preventDefault(),o&&window.open(o,`_blank`,`noopener,noreferrer`)},t[5]=o,t[6]=s);let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(Ui,{className:`ok-file-icon`,"aria-hidden":`true`}),t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,X.jsx)(`span`,{className:`ok-file-name`,children:r}),t[8]=r,t[9]=u);let d;t[10]===i?d=t[11]:(d=i?(0,X.jsx)(`span`,{className:`ok-file-size`,children:i}):null,t[10]=i,t[11]=d);let f;return t[12]!==c||t[13]!==o||t[14]!==e.title||t[15]!==u||t[16]!==d?(f=(0,X.jsxs)(`a`,{href:o,title:e.title,className:`ok-file-attachment`,target:`_blank`,rel:`noopener noreferrer`,onMouseDown:WO,onClick:c,children:[l,u,d]}),t[12]=c,t[13]=o,t[14]=e.title,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function WO(e){return e.stopPropagation()}function GO(){return Y.createElement(`svg`,{"aria-hidden":`true`,"data-rmiz-btn-unzoom-icon":!0,fill:`currentColor`,focusable:`false`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`},Y.createElement(`path`,{d:`M 14.144531 1.148438 L 9 6.292969 L 9 3 L 8 3 L 8 8 L 13 8 L 13 7 L 9.707031 7 L 14.855469 1.851563 Z M 8 8 L 3 8 L 3 9 L 6.292969 9 L 1.148438 14.144531 L 1.851563 14.855469 L 7 9.707031 L 7 13 L 8 13 Z`}))}function KO(){return Y.createElement(`svg`,{"aria-hidden":`true`,"data-rmiz-btn-zoom-icon":!0,fill:`currentColor`,focusable:`false`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`},Y.createElement(`path`,{d:`M 9 1 L 9 2 L 12.292969 2 L 2 12.292969 L 2 9 L 1 9 L 1 14 L 6 14 L 6 13 L 2.707031 13 L 13 2.707031 L 13 6 L 14 6 L 14 1 Z`}))}function qO(e){return typeof Element>`u`?!1:e instanceof Element}var JO=(e,t)=>qO(t)&&t.tagName.toUpperCase()===e,YO=e=>JO(`DIV`,e)||JO(`SPAN`,e),XO=e=>JO(`IMG`,e),ZO=e=>e.complete&&e.naturalHeight!==0,QO=e=>JO(`SVG`,e),$O=({height:e,offset:t,width:n})=>Math.min((window.innerWidth-t*2)/n,(window.innerHeight-t*2)/e),ek=({containerHeight:e,containerWidth:t,offset:n,targetHeight:r,targetWidth:i})=>{let a=$O({height:r,offset:n,width:i}),o=i>r?i/t:r/e;return a>1?o:a*o},tk=({containerHeight:e,containerWidth:t,hasScalableSrc:n,offset:r,targetHeight:i,targetWidth:a})=>e===0||t===0?1:!n&&i!==0&&a!==0?ek({containerHeight:e,containerWidth:t,offset:r,targetHeight:i,targetWidth:a}):$O({height:e,offset:r,width:t}),nk=/url(?:\(['"]?)(?<url>.*?)(?:['"]?\))/,rk=e=>{if(e!==null){if(XO(e))return e.currentSrc===``?void 0:e.currentSrc;if(YO(e)){let{backgroundImage:t}=window.getComputedStyle(e);if(t!==``)return nk.exec(t)?.[1]}}},ik=e=>{if(e!==null)return XO(e)?e.alt:e.getAttribute(`aria-label`)??void 0},ak=({containerHeight:e,containerLeft:t,containerTop:n,containerWidth:r,hasScalableSrc:i,offset:a,targetHeight:o,targetWidth:s})=>{let c=tk({containerHeight:e,containerWidth:r,hasScalableSrc:i,offset:a,targetHeight:o,targetWidth:s});return{top:n,left:t,width:r*c,height:e*c,transform:`translate(0,0) scale(${1/c})`}},ok=({position:e,relativeNum:t})=>{let n=parseFloat(e);return e.endsWith(`%`)?t*n/100:n},sk=({containerHeight:e,containerLeft:t,containerTop:n,containerWidth:r,hasScalableSrc:i,objectFit:a,objectPosition:o,offset:s,targetHeight:c,targetWidth:l})=>{let u=a;if(u===`scale-down`&&(u=l<=r&&c<=e?`none`:`contain`),u===`cover`||u===`contain`){let a=r/l,d=e/c,f=u===`cover`?Math.max(a,d):Math.min(a,d),[p=`50%`,m=`50%`]=o.split(` `),h=ok({position:p,relativeNum:r-l*f}),g=ok({position:m,relativeNum:e-c*f}),_=tk({containerHeight:c*f,containerWidth:l*f,hasScalableSrc:i,offset:s,targetHeight:c,targetWidth:l});return{top:n+g,left:t+h,width:l*f*_,height:c*f*_,transform:`translate(0,0) scale(${1/_})`}}else if(u===`none`){let[a=`50%`,u=`50%`]=o.split(` `),d=ok({position:a,relativeNum:r-l}),f=ok({position:u,relativeNum:e-c}),p=tk({containerHeight:c,containerWidth:l,hasScalableSrc:i,offset:s,targetHeight:c,targetWidth:l});return{top:n+f,left:t+d,width:l*p,height:c*p,transform:`translate(0,0) scale(${1/p})`}}else if(u===`fill`){let t=r/l,n=e/c,a=Math.max(t,n),o=tk({containerHeight:c*a,containerWidth:l*a,hasScalableSrc:i,offset:s,targetHeight:c,targetWidth:l});return{width:r*o,height:e*o,transform:`translate(0,0) scale(${1/o})`}}else return{}},ck=({backgroundPosition:e,backgroundSize:t,containerHeight:n,containerLeft:r,containerTop:i,containerWidth:a,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l})=>{if(t===`cover`||t===`contain`){let u=a/l,d=n/c,f=t===`cover`?Math.max(u,d):Math.min(u,d),[p=`50%`,m=`50%`]=e.split(` `),h=ok({position:p,relativeNum:a-l*f}),g=ok({position:m,relativeNum:n-c*f}),_=tk({containerHeight:c*f,containerWidth:l*f,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l});return{top:i+g,left:r+h,width:l*f*_,height:c*f*_,transform:`translate(0,0) scale(${1/_})`}}else if(t===`auto`){let[t=`50%`,u=`50%`]=e.split(` `),d=ok({position:t,relativeNum:a-l}),f=ok({position:u,relativeNum:n-c}),p=tk({containerHeight:c,containerWidth:l,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l});return{top:i+f,left:r+d,width:l*p,height:c*p,transform:`translate(0,0) scale(${1/p})`}}else{let[u=`50%`,d=`50%`]=t.split(` `),f=ok({position:u,relativeNum:a}),p=ok({position:d,relativeNum:n}),m=f/l,h=p/c,g=Math.min(m,h),[_=`50%`,v=`50%`]=e.split(` `),y=ok({position:_,relativeNum:a-l*g}),b=ok({position:v,relativeNum:n-c*g}),x=tk({containerHeight:c*g,containerWidth:l*g,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l});return{top:i+b,left:r+y,width:l*g*x,height:c*g*x,transform:`translate(0,0) scale(${1/x})`}}},lk=/\.svg$/i,uk=({hasZoomImg:e,imgSrc:t,isSvg:n,isZoomed:r,loadedImgEl:i,offset:a,shouldRefresh:o,targetEl:s})=>{let c=n||t?.slice(0,18)===`data:image/svg+xml`||e||t!==void 0&&lk.test(t),l=s.getBoundingClientRect(),u=window.getComputedStyle(s),d=i!=null&&YO(s),f=i!=null&&!d,p=i!=null&&i.naturalHeight!==0?i.naturalHeight:l.height,m=i!=null&&i.naturalWidth!==0?i.naturalWidth:l.width,h=ak({containerHeight:l.height,containerLeft:l.left,containerTop:l.top,containerWidth:l.width,hasScalableSrc:c,offset:a,targetHeight:p,targetWidth:m}),g=f?sk({containerHeight:l.height,containerLeft:l.left,containerTop:l.top,containerWidth:l.width,hasScalableSrc:c,objectFit:u.objectFit,objectPosition:u.objectPosition,offset:a,targetHeight:p,targetWidth:m}):void 0,_=d?ck({backgroundPosition:u.backgroundPosition,backgroundSize:u.backgroundSize,containerHeight:l.height,containerLeft:l.left,containerTop:l.top,containerWidth:l.width,hasScalableSrc:c,offset:a,targetHeight:p,targetWidth:m}):void 0,v={...h,...g,..._};if(r){let e=window.innerWidth/2,t=window.innerHeight/2,n=parseFloat(String(v.left??0))+parseFloat(String(v.width??0))/2,r=parseFloat(String(v.top??0))+parseFloat(String(v.height??0))/2,i=e-n,a=t-r;o&&(v.transitionDuration=`0.01ms`),v.transform=`translate(${i}px,${a}px) scale(1)`}return v},dk=e=>{if(e==null)return{};if(QO(e)){let{parentElement:t}=e,n=e.getBoundingClientRect();if(t==null)return{height:n.height,left:n.left,width:n.width,top:n.top};{let e=t.getBoundingClientRect();return{height:n.height,left:e.left-n.left,top:e.top-n.top,width:n.width}}}else return{height:e.offsetHeight,left:e.offsetLeft,width:e.offsetWidth,top:e.offsetTop}},fk=e=>{let t=`-zoom`,n=[`clip-path`,`fill`,`mask`,`marker-start`,`marker-mid`,`marker-end`],r=new Map;if(e.hasAttribute(`id`)){let{id:n}=e,i=n+t;r.set(n,i);let a=e;a.id=i}e.querySelectorAll(`[id]`).forEach(e=>{let{id:n}=e,i=n+t;r.set(n,i);let a=e;a.id=i}),r.forEach((t,r)=>{let i=`url(#${r})`,a=`url(#${t})`,o=n.map(e=>`[${e}="${i}"]`).join(`, `);e.querySelectorAll(o).forEach(e=>{n.forEach(t=>{e.getAttribute(t)===i&&e.setAttribute(t,a)})})}),e.querySelectorAll(`style`).forEach(e=>{r.forEach((t,n)=>{let{textContent:r}=e;if(r!==``){let i=e;i.textContent=r.replaceAll(`#${n}`,`#${t}`)}})})},pk=[`img`,`svg`,`[role="img"]`,`[data-zoom]`].map(e=>`${e}:not([aria-hidden="true"])`).join(`,`),mk={overflow:``,width:``};function hk(){let e=document.querySelector(`[data-rmiz-portal]`);if(e!=null)return e;let t=document.createElement(`div`);return t.setAttribute(`data-rmiz-portal`,``),document.body.appendChild(t),t}function gk(e){e.preventDefault()}function _k(e){return Y.createElement(vk,{...e})}var vk=class extends Y.Component{constructor(){super(...arguments),this.state={id:``,isZoomImgLoaded:!1,loadedImgEl:void 0,modalState:`UNLOADED`,shouldRefresh:!1,styleGhost:{}},this.refContent=Y.createRef(),this.refDialog=Y.createRef(),this.refModalContent=Y.createRef(),this.refModalImg=Y.createRef(),this.refWrap=Y.createRef(),this.imgEl=null,this.isScaling=!1,this.prevBodyAttrs=mk,this.styleModalImg={},this.handleModalStateChange=e=>{let{state:{modalState:t}}=this;e!==`LOADING`&&t===`LOADING`?(this.loadZoomImg(),window.addEventListener(`resize`,this.handleResize,{passive:!0}),window.addEventListener(`touchstart`,this.handleTouchStart,{passive:!0}),window.addEventListener(`touchmove`,this.handleTouchMove,{passive:!0}),window.addEventListener(`touchend`,this.handleTouchEnd,{passive:!0}),window.addEventListener(`touchcancel`,this.handleTouchCancel,{passive:!0}),document.addEventListener(`keydown`,this.handleKeyDown,!0)):e!==`LOADED`&&t===`LOADED`?window.addEventListener(`wheel`,this.handleWheel,{passive:!0}):e!==`UNLOADING`&&t===`UNLOADING`?(this.ensureImgTransitionEnd(),window.removeEventListener(`wheel`,this.handleWheel),window.removeEventListener(`touchstart`,this.handleTouchStart),window.removeEventListener(`touchmove`,this.handleTouchMove),window.removeEventListener(`touchend`,this.handleTouchEnd),window.removeEventListener(`touchcancel`,this.handleTouchCancel),document.removeEventListener(`keydown`,this.handleKeyDown,!0)):e!==`UNLOADED`&&t===`UNLOADED`&&(this.bodyScrollEnable(),window.removeEventListener(`resize`,this.handleResize),this.refModalImg.current?.removeEventListener(`transitionend`,this.handleImgTransitionEnd),this.refDialog.current?.close())},this.setId=()=>{let e=()=>Math.random().toString(16).slice(-4);this.setState({id:e()+e()+e()})},this.setAndTrackImg=()=>{let{refContent:{current:e}}=this;e!=null&&(this.imgEl=e.querySelector(pk),this.imgEl===null?this.contentNotFoundChangeObserver??(this.contentNotFoundChangeObserver=new MutationObserver(this.setAndTrackImg),this.contentNotFoundChangeObserver.observe(e,{childList:!0,subtree:!0})):(this.contentNotFoundChangeObserver?.disconnect(),this.imgEl.addEventListener(`load`,this.handleImgLoad),this.imgEl.addEventListener(`click`,this.handleZoom),this.state.loadedImgEl??this.handleImgLoad(),this.imgElResizeObserver=new ResizeObserver(e=>{let[t]=e;t?.target!==void 0&&(this.imgEl=t.target,this.setState({styleGhost:dk(this.imgEl)}))}),this.imgElResizeObserver.observe(this.imgEl),this.contentChangeObserver??(this.contentChangeObserver=new MutationObserver(()=>{this.setState({styleGhost:dk(this.imgEl)})}),this.contentChangeObserver.observe(e,{attributes:!0,childList:!0,subtree:!0}))))},this.handleIfZoomChanged=e=>{let{props:{isZoomed:t}}=this;!e&&t?this.zoom():e&&!t&&this.unzoom()},this.handleImgLoad=()=>{let e=rk(this.imgEl);if(e==null||e===``)return;let t=new Image,{imgEl:n}=this;if(XO(n)){let{sizes:e,srcset:r,crossOrigin:i}=n;t.sizes=e,t.srcset=r,t.crossOrigin=i}t.src=e;let r=()=>{this.setState({loadedImgEl:t,styleGhost:dk(this.imgEl)})};t.decode().then(r).catch(()=>{if(ZO(t)){r();return}t.onload=r})},this.handleZoom=e=>{this.props.isDisabled!==!0&&this.hasImage()&&this.props.onZoomChange?.(!0,{event:e})},this.handleUnzoom=e=>{this.props.isDisabled!==!0&&this.props.onZoomChange?.(!1,{event:e})},this.handleBtnUnzoomClick=e=>{e.preventDefault(),e.stopPropagation(),this.handleUnzoom(e)},this.handleDialogClick=e=>{(e.target===this.refModalContent.current||e.target===this.refModalImg.current)&&(e.stopPropagation(),this.handleUnzoom(e))},this.handleDialogClose=e=>{e.stopPropagation(),this.handleUnzoom(e)},this.handleKeyDown=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.handleUnzoom(e))},this.handleWheel=e=>{e.ctrlKey||(e.stopPropagation(),queueMicrotask(()=>{this.handleUnzoom(e)}))},this.handleTouchStart=e=>{if(e.touches.length>1){this.isScaling=!0;return}let{changedTouches:t}=e,[n]=t;if(t.length===1&&n!==void 0){let{screenY:e}=n;this.touchYStart=e}},this.handleTouchMove=e=>{let t=window.visualViewport?.scale??1,{changedTouches:n}=e,[r]=n;if(this.props.canSwipeToUnzoom&&!this.isScaling&&t<=1&&this.touchYStart!=null&&r!==void 0){let{screenY:t}=r;this.touchYEnd=t;let n=Math.max(this.touchYStart,this.touchYEnd),i=Math.min(this.touchYStart,this.touchYEnd);Math.abs(n-i)>this.props.swipeToUnzoomThreshold&&(this.touchYStart=void 0,this.touchYEnd=void 0,this.handleUnzoom(e))}},this.handleTouchEnd=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleTouchCancel=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleResize=()=>{this.setState({shouldRefresh:!0})},this.hasImage=()=>this.imgEl!==null&&(this.state.loadedImgEl!==void 0||QO(this.imgEl))&&window.getComputedStyle(this.imgEl).display!==`none`,this.zoom=()=>{this.bodyScrollDisable(),this.refDialog.current?.showModal(),this.refModalImg.current?.addEventListener(`transitionend`,this.handleImgTransitionEnd),this.setState({modalState:`LOADING`})},this.unzoom=()=>{this.setState({modalState:`UNLOADING`})},this.handleImgTransitionEnd=()=>{clearTimeout(this.timeoutTransitionEnd),this.state.modalState===`LOADING`?this.setState({modalState:`LOADED`}):this.state.modalState===`UNLOADING`&&this.setState({shouldRefresh:!1,modalState:`UNLOADED`})},this.ensureImgTransitionEnd=()=>{if(this.refModalImg.current!==null){let{transitionDuration:e}=window.getComputedStyle(this.refModalImg.current),t=parseFloat(e);if(t!==0&&!Number.isNaN(t)){let n=t*(e.endsWith(`ms`)?1:1e3)+50;this.timeoutTransitionEnd=setTimeout(this.handleImgTransitionEnd,n)}}},this.bodyScrollDisable=()=>{this.prevBodyAttrs={overflow:document.body.style.overflow,width:document.body.style.width};let{body:{clientWidth:e}}=document;document.body.style.overflow=`hidden`,document.body.style.width=`${e}px`},this.bodyScrollEnable=()=>{let{prevBodyAttrs:{overflow:e,width:t}}=this;document.body.style.width=t,document.body.style.overflow=e,this.prevBodyAttrs=mk},this.loadZoomImg=()=>{let{props:{zoomImg:e}}=this;if(e==null)return;let{src:t}=e;if(t!==void 0&&t!==``){let n=new Image;n.sizes=e.sizes??``,n.srcset=e.srcSet??``,n.crossOrigin=e.crossOrigin??void 0,n.src=t;let r=()=>{this.setState({isZoomImgLoaded:!0})};n.decode().then(r).catch(()=>{if(ZO(n)){r();return}n.onload=r})}},this.UNSAFE_handleSvg=()=>{let{imgEl:e,refModalImg:t,styleModalImg:n}=this;if(QO(e)){let r=e.cloneNode(!0);fk(r),r.style.width=`${n.width??0}px`,r.style.height=`${n.height??0}px`,r.addEventListener(`click`,this.handleUnzoom),t.current?.firstChild?.remove(),t.current?.appendChild(r)}}}render(){let{handleBtnUnzoomClick:e,handleDialogClick:t,handleDialogClose:n,handleUnzoom:r,handleZoom:i,imgEl:a,props:{a11yNameButtonUnzoom:o,a11yNameButtonZoom:s,children:c,classDialog:l,IconUnzoom:u,IconZoom:d,isZoomed:f,wrapElement:p,ZoomContent:m,zoomImg:h,zoomMargin:g},refContent:_,refDialog:v,refModalContent:y,refModalImg:b,refWrap:x,state:{id:S,isZoomImgLoaded:C,loadedImgEl:w,modalState:T,shouldRefresh:E,styleGhost:D}}=this,O=`rmiz-modal-${S}`,k=`rmiz-modal-img-${S}`,A=YO(a),j=XO(a),M=QO(a),N=ik(a),P=rk(a),F=j?a.sizes:void 0,I=j?a.srcset:void 0,L=j?a.crossOrigin:void 0,R=h?.src!==void 0&&h.src!==``,ee=this.hasImage(),te=N!==void 0&&N!==``?`${s}: ${N}`:s,ne=T===`LOADING`||T===`LOADED`,z=ee?`found`:`not-found`,B=T===`UNLOADED`||T===`UNLOADING`?`hidden`:`visible`,re={visibility:T===`UNLOADED`?`visible`:`hidden`};this.styleModalImg=ee&&a!==null?uk({hasZoomImg:R,imgSrc:P,isSvg:M,isZoomed:f&&ne,loadedImgEl:w,offset:g,shouldRefresh:E,targetEl:a}):{};let V=null;if(ee){let t=j||A?Y.createElement(`img`,{alt:N,crossOrigin:L,sizes:F,src:P,srcSet:I,...C&&T===`LOADED`?h:{},"data-rmiz-modal-img":``,height:this.styleModalImg.height??void 0,id:k,ref:b,style:this.styleModalImg,width:this.styleModalImg.width??void 0}):M?Y.createElement(`div`,{"data-rmiz-modal-img":!0,ref:b,style:this.styleModalImg}):null,n=Y.createElement(`button`,{"aria-label":o,"data-rmiz-btn-unzoom":``,onClick:e,type:`button`},Y.createElement(u,null));V=m==null?Y.createElement(Y.Fragment,null,t,n):Y.createElement(m,{buttonUnzoom:n,modalState:T,img:t,isZoomImgLoaded:C,onUnzoom:r})}return Y.createElement(p,{"aria-owns":ee?O:void 0,"data-rmiz":``,ref:x},Y.createElement(p,{"data-rmiz-content":z,ref:_,style:re},c),ee&&Y.createElement(p,{"data-rmiz-ghost":``,style:D},Y.createElement(`button`,{"aria-label":te,"data-rmiz-btn-zoom":``,onClick:i,type:`button`},Y.createElement(d,null))),ee&&Va.createPortal(Y.createElement(`dialog`,{"aria-labelledby":k,"aria-modal":`true`,className:l,"data-rmiz-modal":``,id:O,onClick:t,onClose:n,onCancel:gk,ref:v,role:`dialog`},Y.createElement(`div`,{"data-rmiz-modal-overlay":B}),Y.createElement(`div`,{"data-rmiz-modal-content":``,ref:y},V)),hk()))}componentDidMount(){this.setId(),this.setAndTrackImg(),this.handleImgLoad(),this.UNSAFE_handleSvg()}componentWillUnmount(){this.state.modalState!==`UNLOADED`&&this.bodyScrollEnable(),this.contentChangeObserver?.disconnect(),this.contentNotFoundChangeObserver?.disconnect(),this.imgElResizeObserver?.disconnect(),this.imgEl?.removeEventListener(`load`,this.handleImgLoad),this.imgEl?.removeEventListener(`click`,this.handleZoom),this.refModalImg.current?.removeEventListener(`transitionend`,this.handleImgTransitionEnd),window.removeEventListener(`wheel`,this.handleWheel),window.removeEventListener(`touchstart`,this.handleTouchStart),window.removeEventListener(`touchmove`,this.handleTouchMove),window.removeEventListener(`touchend`,this.handleTouchEnd),window.removeEventListener(`touchcancel`,this.handleTouchCancel),window.removeEventListener(`resize`,this.handleResize),document.removeEventListener(`keydown`,this.handleKeyDown,!0)}componentDidUpdate(e,t){this.handleModalStateChange(t.modalState),this.UNSAFE_handleSvg(),this.handleIfZoomChanged(e.isZoomed)}};vk.defaultProps={a11yNameButtonUnzoom:`Minimize image`,a11yNameButtonZoom:`Expand image`,canSwipeToUnzoom:!0,IconUnzoom:GO,IconZoom:KO,isDisabled:!1,swipeToUnzoomThreshold:10,wrapElement:`div`,zoomMargin:0};function yk({onZoomChange:e,...t}){let[n,r]=Y.useState(!1),i=Y.useCallback((t,{event:n})=>{r(t),e?.(t,{event:n})},[e]);return Y.createElement(_k,{...t,isZoomed:n,onZoomChange:i})}function bk(e,t){return typeof e==`number`&&typeof t==`number`&&e>0&&t>0}function xk(e,t,n){return bk(e,t)?{...n,width:`${e}px`,aspectRatio:`${e} / ${t}`}:n}function Sk(e){let t=(0,J.c)(52),n,r,a,o,s,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({width:m,height:r,loadingTestId:d,slotTestId:f,slotClassName:c,className:n,onLoad:s,onError:o,src:l,style:u,alt:p,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=d===void 0?`image-loading-skeleton`:d,g=f===void 0?`image-slot`:f,_=p===void 0?``:p,{_:v}=i(),y=(0,Y.useRef)(null),[b,x]=(0,Y.useState)(!1),S;t[13]!==r||t[14]!==m?(S=bk(m,r),t[13]=r,t[14]=m,t[15]=S):S=t[15];let C=S,w;t[16]!==r||t[17]!==u||t[18]!==m?(w=xk(m,r,u),t[16]=r,t[17]=u,t[18]=m,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{y.current?.complete?x(!0):x(!1)},t[20]=E):E=t[20];let D;t[21]===l?D=t[22]:(D=[l],t[21]=l,t[22]=D),(0,Y.useLayoutEffect)(E,D);let O=!C&&!b&&`aspect-[16/9] w-full max-w-full`,k;t[23]!==c||t[24]!==O?(k=pn(`relative inline-block overflow-hidden`,O,c),t[23]=c,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==v||t[27]!==b||t[28]!==h?(A=!b&&(0,X.jsx)(`span`,{"data-testid":h,role:`status`,"aria-busy":`true`,"aria-label":v({id:`N1YYa7`}),className:`absolute inset-0 animate-pulse rounded-md bg-muted motion-reduce:animate-none`}),t[26]=v,t[27]=b,t[28]=h,t[29]=A):A=t[29];let j=b?`opacity-100`:`opacity-0`,M;t[30]!==n||t[31]!==j?(M=pn(`block max-w-full transition-opacity motion-reduce:transition-none`,j,n),t[30]=n,t[31]=j,t[32]=M):M=t[32];let N;t[33]===s?N=t[34]:(N=e=>{x(!0),s?.(e)},t[33]=s,t[34]=N);let P;t[35]===o?P=t[36]:(P=e=>{x(!0),o?.(e)},t[35]=o,t[36]=P);let F;t[37]!==_||t[38]!==r||t[39]!==a||t[40]!==l||t[41]!==M||t[42]!==N||t[43]!==P||t[44]!==m?(F=(0,X.jsx)(`img`,{...a,ref:y,src:l,alt:_,width:m,height:r,className:M,onLoad:N,onError:P}),t[37]=_,t[38]=r,t[39]=a,t[40]=l,t[41]=M,t[42]=N,t[43]=P,t[44]=m,t[45]=F):F=t[45];let I;return t[46]!==T||t[47]!==g||t[48]!==A||t[49]!==F||t[50]!==k?(I=(0,X.jsxs)(`span`,{"data-testid":g,className:k,style:T,children:[A,F]}),t[46]=T,t[47]=g,t[48]=A,t[49]=F,t[50]=k,t[51]=I):I=t[51],I}function Ck(e){return e??`lazy`}function wk(e){if(typeof e!=`string`)return e;let t=Number(e);return Number.isFinite(t)&&t>0?t:e}function Tk(e){let t=(0,J.c)(21),n;t[0]===e.src?n=t[1]:(n=e.src===void 0?void 0:ae(e.src),t[0]=e.src,t[1]=n);let r=e.alt??``,i;t[2]===e.width?i=t[3]:(i=wk(e.width),t[2]=e.width,t[3]=i);let a;t[4]===e.height?a=t[5]:(a=wk(e.height),t[4]=e.height,t[5]=a);let o=e.title,s;t[6]===e.loading?s=t[7]:(s=Ck(e.loading),t[6]=e.loading,t[7]=s);let c;return t[8]!==e.crossorigin||t[9]!==e.decoding||t[10]!==e.fetchpriority||t[11]!==e.referrerpolicy||t[12]!==e.sizes||t[13]!==e.srcset||t[14]!==e.title||t[15]!==n||t[16]!==r||t[17]!==i||t[18]!==a||t[19]!==s?(c=(0,X.jsx)(Sk,{src:n,alt:r,width:i,height:a,title:o,loading:s,srcSet:e.srcset,sizes:e.sizes,decoding:e.decoding,fetchPriority:e.fetchpriority,crossOrigin:e.crossorigin,referrerPolicy:e.referrerpolicy}),t[8]=e.crossorigin,t[9]=e.decoding,t[10]=e.fetchpriority,t[11]=e.referrerpolicy,t[12]=e.sizes,t[13]=e.srcset,t[14]=e.title,t[15]=n,t[16]=r,t[17]=i,t[18]=a,t[19]=s,t[20]=c):c=t[20],c}function Ek(e){let t=(0,J.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={sizes:void 0},t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,X.jsx)(yk,{wrapElement:`span`,zoomMargin:20,zoomImg:n,children:(0,X.jsx)(Tk,{...e})}),t[1]=e,t[2]=r),r}var Dk=(0,Y.lazy)(async()=>{let{default:e}=await n(async()=>{let{default:e}=await import(`./katex-DX-tM4Fr.js`);return{default:e}},[],import.meta.url);function t(t){let n=(0,J.c)(7),r;n[0]===t.formula?r=n[1]:(r=e.renderToString(t.formula,{displayMode:!0,throwOnError:!1,strict:`ignore`,trust:!1}),n[0]=t.formula,n[1]=r);let i=r,a;n[2]===i?a=n[3]:(a={__html:i},n[2]=i,n[3]=a);let o;return n[4]!==t.id||n[5]!==a?(o=(0,X.jsx)(`div`,{className:`math math-display`,"data-component-type":`math`,id:t.id,dangerouslySetInnerHTML:a}),n[4]=t.id,n[5]=a,n[6]=o):o=n[6],o}return{default:t}});function Ok(e){let t=(0,J.c)(3),n=e.formula||`\xA0`,r;return t[0]!==e.id||t[1]!==n?(r=(0,X.jsx)(`div`,{className:`math math-placeholder`,"data-component-type":`math`,id:e.id,children:n}),t[0]=e.id,t[1]=n,t[2]=r):r=t[2],r}function kk(e){let t=(0,J.c)(6),n=e.formula??``;if(!n){let r;return t[0]!==n||t[1]!==e.id?(r=(0,X.jsx)(Ok,{formula:n,id:e.id}),t[0]=n,t[1]=e.id,t[2]=r):r=t[2],r}let r;return t[3]!==n||t[4]!==e.id?(r=(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ok,{formula:n,id:e.id}),children:(0,X.jsx)(Dk,{formula:n,id:e.id})}),t[3]=n,t[4]=e.id,t[5]=r):r=t[5],r}var Ak=null;function jk(){return Ak||=n(()=>import(`./mermaid.core-DRx0wZe0.js`).then(e=>{let t=e.default;return t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`default`,suppressErrorRendering:!0}),t}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url).catch(e=>{throw Ak=null,e}),Ak}function Mk(e){let t=(0,J.c)(22),n=e.chart??``,r=(0,Y.useId)(),i;if(t[0]!==r){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/:/g,t[2]=e):e=t[2],i=r.replace(e,`_`),t[0]=r,t[1]=i}else i=t[1];let a=`mermaid-${i}`,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={status:`idle`,svg:``,error:``},t[3]=o):o=t[3];let[s,c]=(0,Y.useState)(o),l,u;if(t[4]!==n||t[5]!==a?(l=()=>{if(!n.trim()){c({status:`idle`,svg:``,error:``});return}let e=!1;return c(Nk),jk().then(async t=>{try{let r=await t.render(a,n);e||c({status:`ready`,svg:r.svg,error:``})}catch(t){let n=t;e||c({status:`error`,svg:``,error:n instanceof Error?n.message:String(n)})}}).catch(t=>{e||c({status:`error`,svg:``,error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},u=[n,a],t[4]=n,t[5]=a,t[6]=l,t[7]=u):(l=t[6],u=t[7]),(0,Y.useEffect)(l,u),!n.trim()){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`mermaid mermaid-placeholder`,"data-component-type":`mermaid`,children:(0,X.jsx)(`span`,{className:`mermaid-empty`,children:` `})}),t[8]=e):e=t[8],e}if(s.status===`error`){let e;t[9]===n?e=t[10]:(e=(0,X.jsx)(`pre`,{className:`mermaid-error-source`,children:n}),t[9]=n,t[10]=e);let r;t[11]===s.error?r=t[12]:(r=(0,X.jsx)(`p`,{className:`mermaid-error-message`,children:s.error}),t[11]=s.error,t[12]=r);let i;return t[13]!==s.error||t[14]!==e||t[15]!==r?(i=(0,X.jsxs)(`div`,{className:`mermaid mermaid-error`,"data-component-type":`mermaid`,title:s.error,children:[e,r]}),t[13]=s.error,t[14]=e,t[15]=r,t[16]=i):i=t[16],i}let d=`mermaid mermaid-${s.status}`,f;t[17]===s.svg?f=t[18]:(f={__html:s.svg},t[17]=s.svg,t[18]=f);let p;return t[19]!==d||t[20]!==f?(p=(0,X.jsx)(`div`,{className:d,"data-component-type":`mermaid`,dangerouslySetInnerHTML:f}),t[19]=d,t[20]=f,t[21]=p):p=t[21],p}function Nk(e){return{...e,status:`rendering`}}var Pk=null;function Fk(){return Pk||=new be({extensions:z}),Pk}function Ik(e,t){if(e.type===`mdxJsxFlowElement`){let n=e;if(n.name===`MirrorSource`){for(let e of n.attributes??[])if(e.type===`mdxJsxAttribute`&&e.name===`id`&&typeof e.value==`string`&&e.value===t)return n}}let n=e.children;if(Array.isArray(n))for(let e of n){let n=Ik(e,t);if(n)return n}return null}function Lk(e){return Zt({type:`root`,children:e.children??[]})}var Rk=new Map,zk=30,Bk=150,Vk=1e4;function Hk(e,t){let n=`${e}|${t}`,r=Rk.get(n);if(r)return r.refcount+=1,r;let i=new Fm,a=new TE({url:e,name:t,document:i}),o=new Set,s={provider:a,ySource:i.getText(`source`),refcount:1,synced:!1,subscribers:o};return a.on(`synced`,()=>{s.synced=!0;for(let e of o)e.onSynced()}),s.ySource.observe(()=>{for(let e of o)e.onUpdate()}),Rk.set(n,s),Rk.size>zk&&console.warn(`[Mirror] provider pool exceeded ${zk} entries (current=${Rk.size}). Many Mirrors pointing at distinct source docs — investigate if this is a runaway pattern.`),s}function Uk(e,t){let n=`${e}|${t}`,r=Rk.get(n);if(r&&(--r.refcount,r.refcount<=0)){try{r.provider.destroy()}catch(e){console.warn(`[Mirror] provider.destroy() failed during release`,{src:t,err:e})}Rk.delete(n)}}function Wk(e,t){let n=(0,J.c)(8),{collabUrl:r}=kx(),i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`loading`},n[0]=i):i=n[0];let[a,o]=(0,Y.useState)(i),s=(0,Y.useRef)(t),c=(0,Y.useRef)(null),l,u;n[1]!==r||n[2]!==e?(l=()=>{if(!e){o({kind:`empty-props`});return}if(!r){o({kind:`loading`});return}let t=Hk(r,e),n=()=>{let n=s.current;if(!n){o({kind:`empty-props`});return}let r=t.ySource.toString();if(!r){o(t.synced?{kind:`source-removed`}:{kind:`loading`});return}let i;try{i=Fk().parseToMdast(r)}catch(t){console.warn(`[Mirror] parseToMdast failed`,{src:e,anchor:n,err:t}),o({kind:`source-removed`});return}let a=Ik(i,n);if(!a){o({kind:`anchor-not-found`});return}let c;try{c=Lk(a)}catch(t){console.warn(`[Mirror] renderMirrorSubtree failed`,{src:e,anchor:n,err:t}),o({kind:`anchor-not-found`});return}o({kind:`ready`,html:c})},i=null,a={onUpdate:()=>{i&&clearTimeout(i),i=setTimeout(()=>{i=null,n()},Bk)},onSynced:()=>{i&&=(clearTimeout(i),null),n()}};t.subscribers.add(a),c.current=n;let l=setTimeout(()=>{t.synced||o({kind:`source-removed`})},Vk);return n(),()=>{clearTimeout(l),i&&clearTimeout(i),t.subscribers.delete(a),c.current=null,Uk(r,e)}},u=[r,e],n[1]=r,n[2]=e,n[3]=l,n[4]=u):(l=n[3],u=n[4]),(0,Y.useEffect)(l,u);let d,f;return n[5]===t?(d=n[6],f=n[7]):(d=()=>{s.current=t,c.current?.()},f=[t],n[5]=t,n[6]=d,n[7]=f),(0,Y.useEffect)(d,f),a}function Gk(e){let t=(0,J.c)(8),n=`ok-mirror-state flex items-start gap-2 rounded-md border border-dashed px-3 py-2 text-sm ${e.tone===`error`?`border-destructive/40 text-destructive`:`border-border text-muted-foreground`}`,r;t[0]===e.tone?r=t[1]:(r=e.tone===`error`?(0,X.jsx)(ia,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}):(0,X.jsx)(oa,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}),t[0]=e.tone,t[1]=r);let i;t[2]===e.children?i=t[3]:(i=(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:e.children}),t[2]=e.children,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,X.jsxs)(`div`,{className:n,children:[r,i]}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Kk(e){let t=(0,J.c)(30),n=e.src??``,r=e.anchor??``,i=Wk(n,r);if(i.kind===`empty-props`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Gk,{tone:`placeholder`,children:(0,X.jsx)(o,{id:`3SDfZl`,components:{0:(0,X.jsx)(`span`,{className:`font-medium`}),1:(0,X.jsx)(`code`,{}),2:(0,X.jsx)(`code`,{}),3:(0,X.jsx)(`code`,{})}})}),t[0]=e):e=t[0],e}if(i.kind===`loading`){let e=n&&r?`${n}#${r}`:``,i;t[1]===e?i=t[2]:(i={mirrorRef:e},t[1]=e,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a={0:(0,X.jsx)(`code`,{})},t[3]=a):a=t[3];let s;return t[4]===i?s=t[5]:(s=(0,X.jsx)(Gk,{tone:`placeholder`,children:(0,X.jsx)(o,{id:`92rbk2`,values:i,components:a})}),t[4]=i,t[5]=s),s}if(i.kind===`source-removed`){let e;t[6]===n?e=t[7]:(e={src:n},t[6]=n,t[7]=e);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,X.jsx)(`span`,{className:`font-medium`}),1:(0,X.jsx)(`code`,{})},t[8]=r):r=t[8];let i;return t[9]===e?i=t[10]:(i=(0,X.jsx)(Gk,{tone:`error`,children:(0,X.jsx)(o,{id:`Ud0Pj9`,values:e,components:r})}),t[9]=e,t[10]=i),i}if(i.kind===`anchor-not-found`){let e=`<MirrorSource id="${r}">`,i;t[11]!==e||t[12]!==n?(i={mirrorSourceTag:e,src:n},t[11]=e,t[12]=n,t[13]=i):i=t[13];let a;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(a={0:(0,X.jsx)(`span`,{className:`font-medium`}),1:(0,X.jsx)(`code`,{}),2:(0,X.jsx)(`code`,{})},t[14]=a):a=t[14];let s;return t[15]===i?s=t[16]:(s=(0,X.jsx)(Gk,{tone:`error`,children:(0,X.jsx)(o,{id:`mqSwZH`,values:i,components:a})}),t[15]=i,t[16]=s),s}let a;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Li,{className:`size-3`,"aria-hidden":`true`}),t[17]=a):a=t[17];let s;t[18]===n?s=t[19]:(s={src:n},t[18]=n,t[19]=s);let c;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(c={0:(0,X.jsx)(`code`,{className:`font-mono`})},t[20]=c):c=t[20];let l;t[21]===s?l=t[22]:(l=(0,X.jsxs)(`div`,{className:`ok-mirror-badge pointer-events-none absolute -top-2.5 left-2 flex items-center gap-1 rounded-md bg-background px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity [.jsx-component-wrapper:hover_&]:opacity-100 [.jsx-component-wrapper[data-selected="true"]_&]:opacity-100`,"aria-hidden":`true`,children:[a,(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`wQp1V3`,values:s,components:c})})]}),t[21]=s,t[22]=l);let u;t[23]===i.html?u=t[24]:(u=(0,X.jsx)(`div`,{dangerouslySetInnerHTML:{__html:i.html}}),t[23]=i.html,t[24]=u);let d;return t[25]!==r||t[26]!==n||t[27]!==l||t[28]!==u?(d=(0,X.jsxs)(`div`,{className:`ok-mirror-resolved relative -mx-3 prose-no-margin rounded-md border border-dashed border-transparent px-3 py-2 transition-colors [.jsx-component-wrapper:hover_&]:border-border/40 [.jsx-component-wrapper[data-selected="true"]_&]:border-border/40`,"data-mirror-src":n,"data-mirror-anchor":r,children:[l,u]}),t[25]=r,t[26]=n,t[27]=l,t[28]=u,t[29]=d):d=t[29],d}function qk(e){let t=(0,J.c)(15),{_:n}=i(),r=e.id??``,a;t[0]!==n||t[1]!==r?(a=r||n({id:`12F9WL`}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let s=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(Ii,{className:`size-3`,"aria-hidden":`true`}),t[3]=c):c=t[3];let l;t[4]===s?l=t[5]:(l={label:s},t[4]=s,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={0:(0,X.jsx)(`code`,{className:`font-mono`})},t[6]=u):u=t[6];let d;t[7]===l?d=t[8]:(d=(0,X.jsxs)(`div`,{className:`ok-mirror-source-badge pointer-events-none absolute -top-2.5 left-2 flex items-center gap-1 rounded-md bg-background px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity [.jsx-component-wrapper:hover_&]:opacity-100 [.jsx-component-wrapper[data-selected="true"]_&]:opacity-100`,children:[c,(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`Zon_qG`,values:l,components:u})})]}),t[7]=l,t[8]=d);let f;t[9]===e.children?f=t[10]:(f=(0,X.jsx)(`div`,{children:e.children}),t[9]=e.children,t[10]=f);let p;return t[11]!==r||t[12]!==d||t[13]!==f?(p=(0,X.jsxs)(`div`,{className:`ok-mirror-source relative -mx-3 rounded-md border border-dashed border-transparent px-3 py-1 transition-colors [.jsx-component-wrapper:hover_&]:border-border/50 [.jsx-component-wrapper[data-selected="true"]_&]:border-border/50`,"data-mirror-source-id":r,children:[d,f]}),t[11]=r,t[12]=d,t[13]=f,t[14]=p):p=t[14],p}var Jk=24,Yk=24,Xk=12,Zk=.1;function Qk(e,t,n,r){if(n<=0&&(e===`fit-width`||e===`two-odd`||e===`two-even`)||r<=0&&e===`fit-height`)return 1;switch(e){case`fit-width`:return Math.max(Zk,(n-Jk)/t.naturalWidth);case`fit-height`:return Math.max(Zk,(r-Yk)/t.naturalHeight);case`single`:return 1;case`two-odd`:case`two-even`:return Math.max(Zk,((n-Jk)/2-Xk)/t.naturalWidth)}}var $k=600,eA=.5,tA=3,nA=.25,rA=null;function iA(){return rA||(rA=(async()=>{let e=await n(()=>import(`./pdf-wFLJduM2.js`),__vite__mapDeps([24,1]),import.meta.url);if(!e.GlobalWorkerOptions.workerSrc){let t=(await n(async()=>{let{default:e}=await import(`./pdf.worker-CP44mBOj.js`);return{default:e}},[],import.meta.url)).default;e.GlobalWorkerOptions.workerSrc=t}return e})(),rA.catch(()=>{rA=null})),rA}function aA(e){return e instanceof Error&&e.name===`RenderingCancelledException`}function oA(e){let t=(0,J.c)(96),n,r;if(t[0]!==e.anchor||t[1]!==e.fillContainer){let{height:i,viewerFragment:a}=he(e.anchor);n=i===null?e.fillContainer?`100%`:`${$k}px`:`${i}px`,r=fA(a),t[0]=e.anchor,t[1]=e.fillContainer,t[2]=n,t[3]=r}else n=t[2],r=t[3];let a=r,s=(0,Y.useRef)(null),c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[4]=c):c=t[4];let l=(0,Y.useRef)(c),u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[5]=u):u=t[5];let d=(0,Y.useRef)(u),f=(0,Y.useRef)(null),p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[6]=p):p=t[6];let[m,h]=(0,Y.useState)(p),[g,_]=(0,Y.useState)(!0),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(a??1),[S,C]=(0,Y.useState)(String(a??1)),[w,T]=(0,Y.useState)(1),[E,D]=(0,Y.useState)(`fit-width`),[O,k]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(!1),[M,N]=(0,Y.useState)(0),[P,F]=(0,Y.useState)(0),{_:I}=i(),L=m.length,R,ee;t[7]!==I||t[8]!==e.src?(R=()=>{if(!e.src){_(!1);return}let t=ae(e.src),n=!1,r=null;return _(!0),y(null),(async()=>{try{let e=await(await iA()).getDocument({url:t,isEvalSupported:!1}).promise;if(n){await e.destroy();return}r=e,f.current=e;let i=[];for(let t=1;t<=e.numPages;t++){if(n)return;let r=(await e.getPage(t)).getViewport({scale:1});i.push({pageNumber:t,naturalWidth:r.width,naturalHeight:r.height})}if(n)return;h(i)}catch(e){let t=e;if(n)return;y(t instanceof Error?t.message:I({id:`jRHdCz`})),_(!1)}})(),()=>{n=!0,r&&=(r.destroy(),null),f.current=null}},ee=[e.src,I],t[7]=I,t[8]=e.src,t[9]=R,t[10]=ee):(R=t[9],ee=t[10]),(0,Y.useEffect)(R,ee);let te,ne;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>{let e=s.current;if(!e)return;let t=()=>{N(e.clientWidth),F(e.clientHeight)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},ne=[],t[11]=te,t[12]=ne):(te=t[11],ne=t[12]),(0,Y.useEffect)(te,ne);let z,B;t[13]!==I||t[14]!==P||t[15]!==M||t[16]!==E||t[17]!==m||t[18]!==w?(z=()=>{let e=f.current;if(!e||m.length===0||M===0)return;let t=!1,n=null;return(async()=>{try{let r=window.devicePixelRatio||1;for(let i of m){if(t)return;let a=l.current[i.pageNumber-1];if(!a)continue;let o=Qk(E,i,M,P)*w,s=await e.getPage(i.pageNumber);if(t)return;let c=s.getViewport({scale:o});a.width=Math.floor(c.width*r),a.height=Math.floor(c.height*r),a.style.width=`${c.width}px`,a.style.height=`${c.height}px`;let u=a.getContext(`2d`);u&&(u.setTransform(r,0,0,r,0,0),n=s.render({canvas:a,canvasContext:u,viewport:c}),await n.promise,n=null)}t||_(!1)}catch(e){let n=e;if(t||aA(n))return;console.warn(`[Pdf] page render failed:`,n),y(n instanceof Error?n.message:I({id:`_TF8ep`})),_(!1)}})(),()=>{if(t=!0,n){try{n.cancel()}catch{}n=null}}},B=[m,E,w,M,P,I],t[13]=I,t[14]=P,t[15]=M,t[16]=E,t[17]=m,t[18]=w,t[19]=z,t[20]=B):(z=t[19],B=t[20]),(0,Y.useEffect)(z,B);let re,V;t[21]!==m||t[22]!==O?(re=()=>{if(!O)return;let e=f.current;if(!e||m.length===0)return;let t=!1,n=null;return(async()=>{try{let r=window.devicePixelRatio||1;for(let i of m){if(t)return;let a=d.current[i.pageNumber-1];if(!a)continue;let o=120/i.naturalWidth,s=await e.getPage(i.pageNumber);if(t)return;let c=s.getViewport({scale:o});a.width=Math.floor(c.width*r),a.height=Math.floor(c.height*r),a.style.width=`${c.width}px`,a.style.height=`${c.height}px`;let l=a.getContext(`2d`);l&&(l.setTransform(r,0,0,r,0,0),n=s.render({canvas:a,canvasContext:l,viewport:c}),await n.promise,n=null)}}catch(e){let t=e;aA(t)||console.warn(`[Pdf] thumbnail render failed:`,t)}})(),()=>{if(t=!0,n){try{n.cancel()}catch{}n=null}}},V=[O,m],t[21]=m,t[22]=O,t[23]=re,t[24]=V):(re=t[23],V=t[24]),(0,Y.useEffect)(re,V);let ie,H;t[25]!==g||t[26]!==a?(ie=()=>{if(g||!a)return;let e=s.current,t=l.current[a-1];e&&t&&(e.scrollTop=t.offsetTop-e.offsetTop)},H=[g,a],t[25]=g,t[26]=a,t[27]=ie,t[28]=H):(ie=t[27],H=t[28]),(0,Y.useEffect)(ie,H);let oe,se;t[29]===m?(oe=t[30],se=t[31]):(oe=()=>{let e=s.current;if(!e||m.length===0)return;let t=!1,n=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let n=e.scrollTop,r=1;for(let t of m){let i=l.current[t.pageNumber-1];i&&i.offsetTop-e.offsetTop<=n+40&&(r=t.pageNumber)}x(r),C(String(r))}))};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},se=[m],t[29]=m,t[30]=oe,t[31]=se),(0,Y.useEffect)(oe,se);let U,ce;t[32]===A?(U=t[33],ce=t[34]):(U=()=>{if(!A)return;let e=e=>{let t=e.target,n=s.current?.closest(`.ok-pdf`);if(!n||!t||!n.contains(t)){j(!1);return}let r=n.querySelector(`.ok-pdf-layout-menu`);r&&!r.contains(t)&&j(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},ce=[A],t[32]=A,t[33]=U,t[34]=ce),(0,Y.useEffect)(U,ce);let le;t[35]===L?le=t[36]:(le=e=>{let t=Math.max(1,Math.min(L||1,e));x(t),C(String(t));let n=s.current,r=l.current[t-1];n&&r&&n.scrollTo({top:r.offsetTop-n.offsetTop,behavior:`smooth`})},t[35]=L,t[36]=le);let ue=le,de;t[37]!==b||t[38]!==ue||t[39]!==S?(de=()=>{let e=Number.parseInt(S,10);if(Number.isNaN(e)){C(String(b));return}ue(e)},t[37]=b,t[38]=ue,t[39]=S,t[40]=de):de=t[40];let fe=de,pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>T(uA),t[41]=pe):pe=t[41];let me=pe,ge;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>T(lA),t[42]=ge):ge=t[42];let _e=ge,ve;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>{D(e),j(!1),T(1)},t[43]=ve):ve=t[43];let ye=ve,be;t[44]===n?be=t[45]:(be={height:n},t[44]=n,t[45]=be);let xe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>k(cA),t[46]=xe):xe=t[46];let Se;t[47]!==I||t[48]!==O?(Se=I(O?{id:`JK-Ave`}:{id:`iEYxO4`}),t[47]=I,t[48]=O,t[49]=Se):Se=t[49];let Ce;t[50]===I?Ce=t[51]:(Ce=I({id:`zo3Dl7`}),t[50]=I,t[51]=Ce);let we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,X.jsx)(ma,{size:14,"aria-hidden":`true`}),t[52]=we):we=t[52];let Te;t[53]!==O||t[54]!==Se||t[55]!==Ce?(Te=(0,X.jsx)(`button`,{type:`button`,onClick:xe,"aria-label":Se,"aria-pressed":O,className:`ok-pdf-btn`,title:Ce,children:we}),t[53]=O,t[54]=Se,t[55]=Ce,t[56]=Te):Te=t[56];let Ee=e.title??`PDF`,De;t[57]===Ee?De=t[58]:(De=(0,X.jsx)(`span`,{className:`ok-pdf-title`,children:Ee}),t[57]=Ee,t[58]=De);let Oe;t[59]!==I||t[60]!==A||t[61]!==E||t[62]!==S||t[63]!==fe||t[64]!==L||t[65]!==w?(Oe=L>0&&(0,X.jsxs)(`div`,{className:`ok-pdf-controls`,children:[(0,X.jsx)(`form`,{className:`ok-pdf-page-form`,onSubmit:e=>{e.preventDefault(),fe()},children:(0,X.jsx)(`input`,{type:`text`,inputMode:`numeric`,pattern:`[0-9]*`,className:`ok-pdf-page-input`,value:S,onChange:e=>C(e.target.value.replace(/[^0-9]/g,``)),onBlur:fe,"aria-label":I({id:`xsZhu-`})})}),(0,X.jsx)(`span`,{className:`ok-pdf-page-of`,children:(0,X.jsx)(o,{id:`1GhYxC`,values:{totalPages:L}})}),(0,X.jsx)(`span`,{className:`ok-pdf-divider`,"aria-hidden":`true`}),(0,X.jsx)(`button`,{type:`button`,onClick:_e,disabled:w<=eA,"aria-label":I({id:`FjkaiT`}),className:`ok-pdf-btn`,title:I({id:`FjkaiT`}),children:(0,X.jsx)(La,{size:14,"aria-hidden":`true`})}),(0,X.jsxs)(`span`,{className:`ok-pdf-zoom-display`,"aria-live":`polite`,children:[Math.round(w*100),`%`]}),(0,X.jsx)(`button`,{type:`button`,onClick:me,disabled:w>=tA,"aria-label":I({id:`AWOSPo`}),className:`ok-pdf-btn`,title:I({id:`AWOSPo`}),children:(0,X.jsx)(Ia,{size:14,"aria-hidden":`true`})}),(0,X.jsx)(`span`,{className:`ok-pdf-divider`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{className:`ok-pdf-layout-menu`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>j(sA),"aria-label":I({id:`GQDSBN`}),"aria-haspopup":`menu`,"aria-expanded":A,className:`ok-pdf-btn`,title:I({id:`rdU729`}),children:(0,X.jsx)(ki,{size:14,"aria-hidden":`true`})}),A&&(0,X.jsxs)(`div`,{role:`menu`,className:`ok-pdf-menu`,children:[(0,X.jsx)(dA,{label:I({id:`vIxrEk`}),active:E===`fit-width`,onSelect:()=>ye(`fit-width`)}),(0,X.jsx)(dA,{label:I({id:`YlDuro`}),active:E===`fit-height`,onSelect:()=>ye(`fit-height`)}),(0,X.jsx)(`hr`,{className:`ok-pdf-menu-divider`}),(0,X.jsx)(dA,{label:I({id:`BGHHtQ`}),active:E===`single`,onSelect:()=>ye(`single`)}),(0,X.jsx)(dA,{label:I({id:`xK291b`}),active:E===`two-odd`,onSelect:()=>ye(`two-odd`)}),(0,X.jsx)(dA,{label:I({id:`NSnIUP`}),active:E===`two-even`,onSelect:()=>ye(`two-even`)})]})]})]}),t[59]=I,t[60]=A,t[61]=E,t[62]=S,t[63]=fe,t[64]=L,t[65]=w,t[66]=Oe):Oe=t[66];let ke;t[67]!==Te||t[68]!==De||t[69]!==Oe?(ke=(0,X.jsxs)(`div`,{className:`ok-pdf-toolbar`,contentEditable:!1,children:[Te,De,Oe]}),t[67]=Te,t[68]=De,t[69]=Oe,t[70]=ke):ke=t[70];let Ae;t[71]!==I||t[72]!==b||t[73]!==ue||t[74]!==m||t[75]!==O?(Ae=O&&(0,X.jsx)(`aside`,{className:`ok-pdf-sidebar`,"aria-label":I({id:`nzaV6Q`}),children:m.map((e,t)=>{let{pageNumber:n}=e;return(0,X.jsxs)(`button`,{type:`button`,className:`ok-pdf-thumb`,"data-active":b===n||void 0,onClick:()=>ue(n),"aria-label":I({id:`qioCwA`,values:{pageNumber:n}}),children:[(0,X.jsx)(`canvas`,{ref:e=>{d.current[t]=e},className:`ok-pdf-thumb-canvas`}),(0,X.jsx)(`span`,{className:`ok-pdf-thumb-num`,children:n})]},n)})}),t[71]=I,t[72]=b,t[73]=ue,t[74]=m,t[75]=O,t[76]=Ae):Ae=t[76];let je;t[77]===g?je=t[78]:(je=g&&(0,X.jsx)(`div`,{className:`ok-pdf-loading`,children:(0,X.jsx)(o,{id:`T-654M`})}),t[77]=g,t[78]=je);let Me;t[79]===v?Me=t[80]:(Me=v&&(0,X.jsx)(`div`,{className:`ok-pdf-error`,children:(0,X.jsx)(o,{id:`WamGNs`,values:{error:v}})}),t[79]=v,t[80]=Me);let Ne;t[81]!==I||t[82]!==L?(Ne=Array.from({length:L},(e,t)=>{let n=t+1;return(0,X.jsx)(`canvas`,{ref:e=>{l.current[t]=e},className:`ok-pdf-page`,"aria-label":I({id:`XtRoxT`,values:{pageNumber:n}})},n)}),t[81]=I,t[82]=L,t[83]=Ne):Ne=t[83];let Pe;t[84]!==E||t[85]!==je||t[86]!==Me||t[87]!==Ne?(Pe=(0,X.jsxs)(`div`,{className:`ok-pdf-pages`,ref:s,"data-layout":E,children:[je,Me,Ne]}),t[84]=E,t[85]=je,t[86]=Me,t[87]=Ne,t[88]=Pe):Pe=t[88];let Fe;t[89]!==Ae||t[90]!==Pe?(Fe=(0,X.jsxs)(`div`,{className:`ok-pdf-body`,children:[Ae,Pe]}),t[89]=Ae,t[90]=Pe,t[91]=Fe):Fe=t[91];let Ie;return t[92]!==be||t[93]!==ke||t[94]!==Fe?(Ie=(0,X.jsxs)(`div`,{className:`ok-pdf`,style:be,children:[ke,Fe]}),t[92]=be,t[93]=ke,t[94]=Fe,t[95]=Ie):Ie=t[95],Ie}function sA(e){return!e}function cA(e){return!e}function lA(e){return Math.max(eA,+(e-nA).toFixed(2))}function uA(e){return Math.min(tA,+(e+nA).toFixed(2))}function dA(e){let t=(0,J.c)(10),n=e.active||void 0,r;t[0]===e.active?r=t[1]:(r=e.active&&(0,X.jsx)(Mn,{size:14}),t[0]=e.active,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,X.jsx)(`span`,{className:`ok-pdf-menu-check`,"aria-hidden":`true`,children:r}),t[2]=r,t[3]=i);let a;return t[4]!==e.active||t[5]!==e.label||t[6]!==e.onSelect||t[7]!==n||t[8]!==i?(a=(0,X.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e.active,className:`ok-pdf-menu-item`,"data-active":n,onClick:e.onSelect,children:[i,e.label]}),t[4]=e.active,t[5]=e.label,t[6]=e.onSelect,t[7]=n,t[8]=i,t[9]=a):a=t[9],a}function fA(e){if(!e)return null;for(let t of e.split(`&`)){let e=t.indexOf(`=`);if(!(e<0)&&t.slice(0,e)===`page`){let n=Number.parseInt(t.slice(e+1),10);if(!Number.isNaN(n)&&n>=1)return n}}return null}function pA(e){let t=(0,J.c)(10),{label:n,id:r,children:i}=e,a=(0,Y.useId)(),o;t[0]!==r||t[1]!==a?(o=r||`tab-panel-${a.replace(/:/g,``)}`,t[0]=r,t[1]=a,t[2]=o):o=t[2];let s=o,c=`${s}-tab`,l;t[3]===n?l=t[4]:(l=n?.trim()||`Tab`,t[3]=n,t[4]=l);let u=l,d;return t[5]!==i||t[6]!==s||t[7]!==u||t[8]!==c?(d=(0,X.jsx)(`section`,{className:`tab-panel`,id:s,role:`tabpanel`,"aria-labelledby":c,"data-tab-label":u,"data-tab-id":s,children:i}),t[5]=i,t[6]=s,t[7]=u,t[8]=c,t[9]=d):d=t[9],d}var mA=`[data-component-type="tabs"]`,hA=`[data-node-view-content-react] > .react-renderer`;function gA(e){let t=e.closest(mA);return t?Array.from(e.querySelectorAll(hA)).filter(e=>e.parentElement?.closest(mA)===t).map((e,t)=>{let n=e.querySelector(`[data-tab-label]`);return{index:t,label:(n?.getAttribute(`data-tab-label`))?.trim()||`Tab ${t+1}`,panelId:n?.getAttribute(`data-tab-id`)??null}}):[]}function _A(e){let t=(0,J.c)(26),{id:n,children:r}=e,[i,a]=(0,Y.useState)(0),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Y.useState)(o),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=(0,Y.useRef)(0),f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=l.current;if(!e)return;let t=gA(e);c(e=>{if(e.length!==t.length)return t;for(let n=0;n<e.length;n++)if(e[n].label!==t[n].label||e[n].panelId!==t[n].panelId)return t;return e})},t[1]=f):f=t[1],(0,Y.useLayoutEffect)(f);let p,m;t[2]===s.length?(p=t[3],m=t[4]):(p=()=>{s.length>d.current&&s.length>0&&a(s.length-1),d.current=s.length},m=[s.length],t[2]=s.length,t[3]=p,t[4]=m),(0,Y.useLayoutEffect)(p,m);let h;t[5]===n?h=t[6]:(h=()=>{let e=()=>{let e=window.location.hash.slice(1);if(!e)return;if(n&&e===n){a(0);return}let t=l.current;if(!t)return;let r=gA(t).findIndex(t=>t.panelId===e);r<0||(a(r),queueMicrotask(()=>{t.ownerDocument.getElementById(e)?.scrollIntoView({block:`start`,behavior:`auto`})}))};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},t[5]=n,t[6]=h),(0,Y.useLayoutEffect)(h);let g=s.length===0?0:Math.min(Math.max(i,0),s.length-1),_;t[7]!==s.length||t[8]!==g?(_=e=>{if(s.length===0)return;let t=null;e.key===`ArrowRight`?t=(g+1)%s.length:e.key===`ArrowLeft`?t=(g-1+s.length)%s.length:e.key===`Home`?t=0:e.key===`End`&&(t=s.length-1),t!==null&&(e.preventDefault(),a(t),(u.current?.querySelectorAll(`[role="tab"]`))?.[t]?.focus())},t[7]=s.length,t[8]=g,t[9]=_):_=t[9];let v=_,y=n?`Tabs: ${n}`:`Tabs`,b;if(t[10]!==s||t[11]!==g){let e;t[13]===g?e=t[14]:(e=e=>(0,X.jsx)(`button`,{id:e.panelId?`${e.panelId}-tab`:void 0,type:`button`,role:`tab`,className:`tabs-strip-pill`,"data-active":e.index===g,"aria-selected":e.index===g,"aria-controls":e.panelId??void 0,tabIndex:e.index===g?0:-1,onMouseDown:vA,onClick:()=>a(e.index),children:e.label},e.index),t[13]=g,t[14]=e),b=s.map(e),t[10]=s,t[11]=g,t[12]=b}else b=t[12];let x;t[15]!==v||t[16]!==y||t[17]!==b?(x=(0,X.jsx)(`div`,{ref:u,role:`tablist`,"aria-label":y,className:`tabs-strip`,contentEditable:!1,onKeyDown:v,children:b}),t[15]=v,t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]!==r||t[20]!==g?(S=(0,X.jsx)(`div`,{ref:l,className:`tabs-content`,"data-active-index":g,children:r}),t[19]=r,t[20]=g,t[21]=S):S=t[21];let C;return t[22]!==n||t[23]!==S||t[24]!==x?(C=(0,X.jsxs)(`div`,{className:`tabs`,id:n,children:[x,S]}),t[22]=n,t[23]=S,t[24]=x,t[25]=C):C=t[25],C}function vA(e){return e.preventDefault()}var yA=typeof global<`u`&&{}.toString.call(global)===`[object global]`,bA=typeof Bun<`u`,xA=typeof Deno<`u`,SA=typeof WebSocketPair==`function`&&caches?.default!==void 0,CA=yA||bA||xA||SA;function wA(e,t){return e.indexOf(t.toLowerCase())===0?e:`${t.toLowerCase()}${e.substr(0,1).toUpperCase()}${e.substr(1)}`}function TA(e){return!!(e&&e.nodeType===1&&`nodeName`in e&&e.ownerDocument&&e.ownerDocument.defaultView)}function EA(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function DA(e){return/^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(e)}function OA(e){return/^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/.test(e)}function kA(e){let t=(e||``).match(/^(?:https?:)?(?:\/\/)?([^/?]+)/),n=(t&&t[1]||``).replace(`player.`,``);for(let e of[`.videoji.hk`,`.vimeo.work`,`.videoji.cn`])if(n.endsWith(e))return n;return`vimeo.com`}function AA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.id,n=e.url,r=t||n;if(!r)throw Error(`An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.`);if(EA(r))return`https://vimeo.com/${r}`;if(DA(r))return r.replace(`http:`,`https:`);throw TypeError(t?`“${t}” is not a valid video id.`:`“${r}” is not a vimeo.com url.`)}var jA=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`addEventListener`,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:`removeEventListener`,a=typeof t==`string`?[t]:t;return a.forEach(t=>{e[r](t,n)}),{cancel:()=>a.forEach(t=>e[i](t,n))}};function MA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document;if(!e||!t||typeof t.querySelectorAll!=`function`)return null;let n=t.querySelectorAll(`iframe`);for(let t=0;t<n.length;t++)if(n[t]&&n[t].contentWindow===e)return n[t];return null}var NA=Array.prototype.indexOf!==void 0,PA=typeof window<`u`&&window.postMessage!==void 0;if(!CA&&(!NA||!PA))throw Error(`Sorry, the Vimeo Player API is not available in this browser.`);var FA=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function IA(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e){if(e.WeakMap)return;var t=Object.prototype.hasOwnProperty,n=Object.defineProperty&&function(){try{return Object.defineProperty({},`x`,{value:1}).x===1}catch{}}(),r=function(e,t,r){n?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r}):e[t]=r};e.WeakMap=function(){function e(){if(this===void 0)throw TypeError(`Constructor WeakMap requires 'new'`);if(r(this,`_id`,a(`_WeakMap`)),arguments.length>0)throw TypeError(`WeakMap iterable is not supported`)}r(e.prototype,`delete`,function(e){if(n(this,`delete`),!i(e))return!1;var t=e[this._id];return t&&t[0]===e?(delete e[this._id],!0):!1}),r(e.prototype,`get`,function(e){if(n(this,`get`),i(e)){var t=e[this._id];if(t&&t[0]===e)return t[1]}}),r(e.prototype,`has`,function(e){if(n(this,`has`),!i(e))return!1;var t=e[this._id];return!!(t&&t[0]===e)}),r(e.prototype,`set`,function(e,t){if(n(this,`set`),!i(e))throw TypeError(`Invalid value used as weak map key`);var a=e[this._id];return a&&a[0]===e?(a[1]=t,this):(r(e,this._id,[e,t]),this)});function n(e,n){if(!i(e)||!t.call(e,`_id`))throw TypeError(n+` method called on incompatible receiver `+typeof e)}function a(e){return e+`_`+o()+`.`+o()}function o(){return Math.random().toString().substring(2)}return r(e,`_polyfill`,!0),e}();function i(e){return Object(e)===e}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:FA);var LA=IA(function(e){(function(t,n,r){n[t]=n[t]||r(),e.exports&&=n[t]})(`Promise`,FA,function(){var e,t,n,r=Object.prototype.toString,i=typeof setImmediate<`u`?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},`x`,{}),e=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:r!==!1})}}catch{e=function(e,t,n){return e[t]=n,e}}n=function(){var e,n,r;function i(e,t){this.fn=e,this.self=t,this.next=void 0}return{add:function(t,a){r=new i(t,a),n?n.next=r:e=r,n=r,r=void 0},drain:function(){var r=e;for(e=n=t=void 0;r;)r.fn.call(r.self),r=r.next}}}();function a(e,r){n.add(e,r),t||=i(n.drain)}function o(e){var t,n=typeof e;return e!=null&&(n==`object`||n==`function`)&&(t=e.then),typeof t==`function`?t:!1}function s(){for(var e=0;e<this.chain.length;e++)c(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,t,n){var r,i;try{t===!1?n.reject(e.msg):(r=t===!0?e.msg:t.call(void 0,e.msg),r===n.promise?n.reject(TypeError(`Promise-chain cycle`)):(i=o(r))?i.call(r,n.resolve,n.reject):n.resolve(r))}catch(e){n.reject(e)}}function l(e){var t,n=this;if(!n.triggered){n.triggered=!0,n.def&&(n=n.def);try{(t=o(e))?a(function(){var r=new f(n);try{t.call(e,function(){l.apply(r,arguments)},function(){u.apply(r,arguments)})}catch(e){u.call(r,e)}}):(n.msg=e,n.state=1,n.chain.length>0&&a(s,n))}catch(e){u.call(new f(n),e)}}}function u(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&a(s,t))}function d(e,t,n,r){for(var i=0;i<t.length;i++)(function(i){e.resolve(t[i]).then(function(e){n(i,e)},r)})(i)}function f(e){this.def=e,this.triggered=!1}function p(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function m(e){if(typeof e!=`function`)throw TypeError(`Not a function`);if(this.__NPO__!==0)throw TypeError(`Not a promise`);this.__NPO__=1;var t=new p(this);this.then=function(e,n){var r={success:typeof e==`function`?e:!0,failure:typeof n==`function`?n:!1};return r.promise=new this.constructor(function(e,t){if(typeof e!=`function`||typeof t!=`function`)throw TypeError(`Not a function`);r.resolve=e,r.reject=t}),t.chain.push(r),t.state!==0&&a(s,t),r.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){l.call(t,e)},function(e){u.call(t,e)})}catch(e){u.call(t,e)}}var h=e({},`constructor`,m,!1);return m.prototype=h,e(h,`__NPO__`,0,!1),e(m,`resolve`,function(e){var t=this;return e&&typeof e==`object`&&e.__NPO__===1?e:new t(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);t(e)})}),e(m,`reject`,function(e){return new this(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);n(e)})}),e(m,`all`,function(e){var t=this;return r.call(e)==`[object Array]`?e.length===0?t.resolve([]):new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);var i=e.length,a=Array(i),o=0;d(t,e,function(e,t){a[e]=t,++o===i&&n(a)},r)}):t.reject(TypeError(`Not an array`))}),e(m,`race`,function(e){var t=this;return r.call(e)==`[object Array]`?new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);d(t,e,function(e,t){n(t)},r)}):t.reject(TypeError(`Not an array`))}),m})}),RA=new WeakMap;function zA(e,t,n){let r=RA.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),RA.set(e.element,r)}function BA(e,t){return(RA.get(e.element)||{})[t]||[]}function VA(e,t,n){let r=RA.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],RA.set(e.element,r),!0;let i=r[t].indexOf(n);return i!==-1&&r[t].splice(i,1),RA.set(e.element,r),r[t]&&r[t].length===0}function HA(e,t){let n=BA(e,t);if(n.length<1)return!1;let r=n.shift();return VA(e,t,r),r}function UA(e,t){let n=RA.get(e);RA.set(t,n),RA.delete(e)}function WA(e){if(typeof e==`string`)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return e}function GA(e,t,n){if(!e.element.contentWindow||!e.element.contentWindow.postMessage)return;let r={method:t};n!==void 0&&(r.value=n);let i=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,`$1`));i>=8&&i<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}function KA(e,t){t=WA(t);let n=[],r;if(t.event)t.event===`error`&&BA(e,t.data.method).forEach(n=>{let r=Error(t.data.message);r.name=t.data.name,n.reject(r),VA(e,t.data.method,n)}),n=BA(e,`event:${t.event}`),r=t.data;else if(t.method){let i=HA(e,t.method);i&&(n.push(i),r=t.value)}n.forEach(t=>{try{if(typeof t==`function`){t.call(e,r);return}t.resolve(r)}catch{}})}var qA=`airplay.audio_tracks.audiotrack.autopause.autoplay.background.byline.cc.chapter_id.chapters.chromecast.color.colors.controls.disable_context_menu.dnt.end_time.fullscreen.height.id.initial_quality.interactive_params.keyboard.loop.maxheight.max_quality.maxwidth.min_quality.muted.play_button_position.playsinline.portrait.preload.progress_bar.quality.quality_selector.responsive.skipping_forward.speed.start_time.texttrack.thumbnail_id.title.transcript.transparent.unmute_button.url.vimeo_logo.volume.watch_full_video.width`.split(`.`);function JA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return qA.reduce((t,n)=>{let r=e.getAttribute(`data-vimeo-${n}`);return(r||r===``)&&(t[n]=r===``?1:r),t},t)}function YA(e,t){let{html:n}=e;if(!t)throw TypeError(`An element must be provided`);if(t.getAttribute(`data-vimeo-initialized`)!==null)return t.querySelector(`iframe`);let r=document.createElement(`div`);return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute(`data-vimeo-initialized`,`true`),t.querySelector(`iframe`)}function XA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return new Promise((r,i)=>{if(!DA(e))throw TypeError(`“${e}” is not a vimeo.com url.`);let a=`https://${kA(e)}/api/oembed.json?url=${encodeURIComponent(e)}`;for(let e in t)t.hasOwnProperty(e)&&(a+=`&${e}=${encodeURIComponent(t[e])}`);let o=`XDomainRequest`in window?new XDomainRequest:new XMLHttpRequest;o.open(`GET`,a,!0),o.onload=function(){if(o.status===404){i(Error(`“${e}” was not found.`));return}if(o.status===403){i(Error(`“${e}” is not embeddable.`));return}try{let t=JSON.parse(o.responseText);if(t.domain_status_code===403){YA(t,n),i(Error(`“${e}” is not embeddable.`));return}r(t)}catch(e){i(e)}},o.onerror=function(){let e=o.status?` (${o.status})`:``;i(Error(`There was an error fetching the embed code from Vimeo${e}.`))},o.send()})}function ZA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,t=[].slice.call(e.querySelectorAll(`[data-vimeo-id], [data-vimeo-url]`)),n=e=>{`console`in window&&console.error&&console.error(`There was an error creating an embed: ${e}`)};t.forEach(e=>{try{if(e.getAttribute(`data-vimeo-defer`)!==null)return;let t=JA(e);XA(AA(t),t,e).then(t=>YA(t,e)).catch(n)}catch(e){n(e)}})}function QA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoPlayerResizeEmbeds_||(window.VimeoPlayerResizeEmbeds_=!0,window.addEventListener(`message`,t=>{if(!DA(t.origin)||!t.data||t.data.event!==`spacechange`)return;let n=t.source?MA(t.source,e):null;if(n){let e=n.parentElement;e.style.paddingBottom=`${t.data.data[0].bottom}px`}}))}function $A(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoSeoMetadataAppended||(window.VimeoSeoMetadataAppended=!0,window.addEventListener(`message`,t=>{if(!DA(t.origin))return;let n=WA(t.data);if(!n||n.event!==`ready`)return;let r=t.source?MA(t.source,e):null;r&&OA(r.src)&&new cj(r).callMethod(`appendVideoMetadata`,window.location.href)}))}function ej(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(window.VimeoCheckedUrlTimeParam)return;window.VimeoCheckedUrlTimeParam=!0;let t=e=>{`console`in window&&console.error&&console.error(`There was an error getting video Id: ${e}`)};window.addEventListener(`message`,n=>{if(!DA(n.origin))return;let r=WA(n.data);if(!r||r.event!==`ready`)return;let i=n.source?MA(n.source,e):null;if(i&&OA(i.src)){let e=new cj(i);e.getVideoId().then(t=>{let n=RegExp(`[?&]vimeo_t_${t}=([^&#]*)`).exec(window.location.href);if(n&&n[1]){let t=decodeURI(n[1]);e.setCurrentTime(t)}}).catch(t)}})}function tj(){window.VimeoDRMEmbedsUpdated||(window.VimeoDRMEmbedsUpdated=!0,window.addEventListener(`message`,e=>{if(!DA(e.origin))return;let t=WA(e.data);if(!t||t.event!==`drminitfailed`)return;let n=e.source?MA(e.source):null;if(!n)return;let r=n.getAttribute(`allow`)||``;if(!r.includes(`encrypted-media`)){n.setAttribute(`allow`,`${r}; encrypted-media`);let e=new URL(n.getAttribute(`src`));e.searchParams.set(`forcereload`,`drm`),n.setAttribute(`src`,e.toString());return}}))}function nj(){let e=function(){let e,t=[[`requestFullscreen`,`exitFullscreen`,`fullscreenElement`,`fullscreenEnabled`,`fullscreenchange`,`fullscreenerror`],[`webkitRequestFullscreen`,`webkitExitFullscreen`,`webkitFullscreenElement`,`webkitFullscreenEnabled`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`webkitRequestFullScreen`,`webkitCancelFullScreen`,`webkitCurrentFullScreenElement`,`webkitCancelFullScreen`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`mozRequestFullScreen`,`mozCancelFullScreen`,`mozFullScreenElement`,`mozFullScreenEnabled`,`mozfullscreenchange`,`mozfullscreenerror`],[`msRequestFullscreen`,`msExitFullscreen`,`msFullscreenElement`,`msFullscreenEnabled`,`MSFullscreenChange`,`MSFullscreenError`]],n=0,r=t.length,i={};for(;n<r;n++)if(e=t[n],e&&e[1]in document){for(n=0;n<e.length;n++)i[t[0][n]]=e[n];return i}return!1}(),t={fullscreenchange:e.fullscreenchange,fullscreenerror:e.fullscreenerror},n={request(t){return new Promise((r,i)=>{let a=function(){n.off(`fullscreenchange`,a),r()};n.on(`fullscreenchange`,a),t||=document.documentElement;let o=t[e.requestFullscreen]();o instanceof Promise&&o.then(a).catch(i)})},exit(){return new Promise((t,r)=>{if(!n.isFullscreen){t();return}let i=function(){n.off(`fullscreenchange`,i),t()};n.on(`fullscreenchange`,i);let a=document[e.exitFullscreen]();a instanceof Promise&&a.then(i).catch(r)})},on(e,n){let r=t[e];r&&document.addEventListener(r,n)},off(e,n){let r=t[e];r&&document.removeEventListener(r,n)}};return Object.defineProperties(n,{isFullscreen:{get(){return!!document[e.fullscreenElement]}},element:{enumerable:!0,get(){return document[e.fullscreenElement]}},isEnabled:{enumerable:!0,get(){return!!document[e.fullscreenEnabled]}}}),n}var rj={role:`viewer`,autoPlayMuted:!0,allowedDrift:.3,maxAllowedDrift:1,minCheckInterval:.1,maxRateAdjustment:.2,maxTimeToCatchUp:1},ij=class extends EventTarget{logger;constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;super(),this.logger=r,this.init(t,e,{...rj,...n})}disconnect(){this.dispatchEvent(new Event(`disconnect`))}async init(e,t,n){if(await this.waitForTOReadyState(e,`open`),n.role===`viewer`){await this.updatePlayer(e,t,n);let r=jA(e,`change`,()=>this.updatePlayer(e,t,n)),i=this.maintainPlaybackPosition(e,t,n);this.addEventListener(`disconnect`,()=>{i.cancel(),r.cancel()})}else{await this.updateTimingObject(e,t);let n=jA(t,[`seeked`,`play`,`pause`,`ratechange`],()=>this.updateTimingObject(e,t),`on`,`off`);this.addEventListener(`disconnect`,()=>n.cancel())}}async updateTimingObject(e,t){let[n,r,i]=await Promise.all([t.getCurrentTime(),t.getPaused(),t.getPlaybackRate()]);e.update({position:n,velocity:r?0:i})}async updatePlayer(e,t,n){let{position:r,velocity:i}=e.query();typeof r==`number`&&t.setCurrentTime(r),typeof i==`number`&&(i===0?await t.getPaused()===!1&&t.pause():i>0&&(await t.getPaused()===!0&&(await t.play().catch(async e=>{e.name===`NotAllowedError`&&n.autoPlayMuted&&(await t.setMuted(!0),await t.play().catch(e=>console.error(`Couldn't play the video from TimingSrcConnector. Error:`,e)))}),this.updatePlayer(e,t,n)),await t.getPlaybackRate()!==i&&t.setPlaybackRate(i)))}maintainPlaybackPosition(e,t,n){let{allowedDrift:r,maxAllowedDrift:i,minCheckInterval:a,maxRateAdjustment:o,maxTimeToCatchUp:s}=n,c=Math.min(s,Math.max(a,i))*1e3,l=async()=>{if(e.query().velocity===0||await t.getPaused()===!0)return;let n=e.query().position-await t.getCurrentTime(),a=Math.abs(n);if(this.log(`Drift: ${n}`),a>i)await this.adjustSpeed(t,0),t.setCurrentTime(e.query().position),this.log(`Resync by currentTime`);else if(a>r){let e=a/s,r=o,i=e<r?(r-e)/2:r;await this.adjustSpeed(t,i*Math.sign(n)),this.log(`Resync by playbackRate`)}},u=setInterval(()=>l(),c);return{cancel:()=>clearInterval(u)}}log(e){this.logger?.(`TimingSrcConnector: ${e}`)}speedAdjustment=0;adjustSpeed=async(e,t)=>{if(this.speedAdjustment===t)return;let n=await e.getPlaybackRate()-this.speedAdjustment+t;this.log(`New playbackRate: ${n}`),await e.setPlaybackRate(n),this.speedAdjustment=t};waitForTOReadyState(e,t){return new Promise(n=>{let r=()=>{e.readyState===t?n():e.addEventListener(`readystatechange`,r,{once:!0})};r()})}},aj=new WeakMap,oj=new WeakMap,sj={},cj=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(window.jQuery&&e instanceof jQuery&&(e.length>1&&window.console&&console.warn&&console.warn(`A jQuery object with multiple elements was passed, using the first element.`),e=e[0]),typeof document<`u`&&typeof e==`string`&&(e=document.getElementById(e)),!TA(e))throw TypeError(`You must pass either a valid element or a valid id.`);if(e.nodeName!==`IFRAME`){let t=e.querySelector(`iframe`);t&&(e=t)}if(e.nodeName===`IFRAME`&&!DA(e.getAttribute(`src`)||``))throw Error(`The player element passed isn’t a Vimeo embed.`);if(aj.has(e))return aj.get(e);this._window=e.ownerDocument.defaultView,this.element=e,this.origin=`*`;let n=new LA((n,r)=>{if(this._onMessage=e=>{if(!DA(e.origin)||this.element.contentWindow!==e.source)return;this.origin===`*`&&(this.origin=e.origin);let t=WA(e.data);if(t&&t.event===`error`&&t.data&&t.data.method===`ready`){let e=Error(t.data.message);e.name=t.data.name,r(e);return}let i=t&&t.event===`ready`,a=t&&t.method===`ping`;if(i||a){this.element.setAttribute(`data-ready`,`true`),n();return}KA(this,t)},this._window.addEventListener(`message`,this._onMessage),this.element.nodeName!==`IFRAME`){let n=JA(e,t);XA(AA(n),n,e).then(t=>{let n=YA(t,e);return this.element=n,this._originalElement=e,UA(e,n),aj.set(this.element,this),t}).catch(r)}});if(oj.set(this,n),aj.set(this.element,this),this.element.nodeName===`IFRAME`&&GA(this,`ping`),sj.isEnabled){let e=()=>sj.exit();this.fullscreenchangeHandler=()=>{sj.isFullscreen?zA(this,`event:exitFullscreen`,e):VA(this,`event:exitFullscreen`,e),this.ready().then(()=>{GA(this,`fullscreenchange`,sj.isFullscreen)})},sj.on(`fullscreenchange`,this.fullscreenchangeHandler)}return this}static isVimeoUrl(e){return DA(e)}callMethod(e){var t=[...arguments].slice(1);if(e==null)throw TypeError(`You must pass a method name.`);return new LA((n,r)=>this.ready().then(()=>{zA(this,e,{resolve:n,reject:r}),t.length===0?t={}:t.length===1&&(t=t[0]),GA(this,e,t)}).catch(r))}get(e){return new LA((t,n)=>(e=wA(e,`get`),this.ready().then(()=>{zA(this,e,{resolve:t,reject:n}),GA(this,e)}).catch(n)))}set(e,t){return new LA((n,r)=>{if(e=wA(e,`set`),t==null)throw TypeError(`There must be a value to set.`);return this.ready().then(()=>{zA(this,e,{resolve:n,reject:r}),GA(this,e,t)}).catch(r)})}on(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(!t)throw TypeError(`You must pass a callback function.`);if(typeof t!=`function`)throw TypeError(`The callback must be a function.`);BA(this,`event:${e}`).length===0&&this.callMethod(`addEventListener`,e).catch(()=>{}),zA(this,`event:${e}`,t)}off(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(t&&typeof t!=`function`)throw TypeError(`The callback must be a function.`);VA(this,`event:${e}`,t)&&this.callMethod(`removeEventListener`,e).catch(e=>{})}loadVideo(e){return this.callMethod(`loadVideo`,e)}ready(){let e=oj.get(this)||new LA((e,t)=>{t(Error(`Unknown player. Probably unloaded.`))});return LA.resolve(e)}addCuePoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.callMethod(`addCuePoint`,{time:e,data:t})}removeCuePoint(e){return this.callMethod(`removeCuePoint`,e)}enableTextTrack(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`enableTextTrack`,{language:e,kind:t,showing:n})}disableTextTrack(){return this.callMethod(`disableTextTrack`)}selectAudioTrack(e,t){if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`selectAudioTrack`,{language:e,kind:t})}selectDefaultAudioTrack(){return this.callMethod(`selectDefaultAudioTrack`)}pause(){return this.callMethod(`pause`)}play(){return this.callMethod(`play`)}requestFullscreen(){return sj.isEnabled?sj.request(this.element):this.callMethod(`requestFullscreen`)}exitFullscreen(){return sj.isEnabled?sj.exit():this.callMethod(`exitFullscreen`)}getFullscreen(){return sj.isEnabled?LA.resolve(sj.isFullscreen):this.get(`fullscreen`)}requestPictureInPicture(){return this.callMethod(`requestPictureInPicture`)}exitPictureInPicture(){return this.callMethod(`exitPictureInPicture`)}getPictureInPicture(){return this.get(`pictureInPicture`)}remotePlaybackPrompt(){return this.callMethod(`remotePlaybackPrompt`)}unload(){return this.callMethod(`unload`)}destroy(){return new LA(e=>{if(oj.delete(this),aj.delete(this.element),this._originalElement&&(aj.delete(this._originalElement),this._originalElement.removeAttribute(`data-vimeo-initialized`)),this.element&&this.element.nodeName===`IFRAME`&&this.element.parentNode&&(this.element.parentNode.parentNode&&this._originalElement&&this._originalElement!==this.element.parentNode?this.element.parentNode.parentNode.removeChild(this.element.parentNode):this.element.parentNode.removeChild(this.element)),this.element&&this.element.nodeName===`DIV`&&this.element.parentNode){this.element.removeAttribute(`data-vimeo-initialized`);let e=this.element.querySelector(`iframe`);e&&e.parentNode&&(e.parentNode.parentNode&&this._originalElement&&this._originalElement!==e.parentNode?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))}this._window.removeEventListener(`message`,this._onMessage),sj.isEnabled&&sj.off(`fullscreenchange`,this.fullscreenchangeHandler),e()})}getAutopause(){return this.get(`autopause`)}setAutopause(e){return this.set(`autopause`,e)}getBuffered(){return this.get(`buffered`)}getCameraProps(){return this.get(`cameraProps`)}setCameraProps(e){return this.set(`cameraProps`,e)}getChapters(){return this.get(`chapters`)}getCurrentChapter(){return this.get(`currentChapter`)}getColor(){return this.get(`color`)}getColors(){return LA.all([this.get(`colorOne`),this.get(`colorTwo`),this.get(`colorThree`),this.get(`colorFour`)])}setColor(e){return this.set(`color`,e)}setColors(e){if(!Array.isArray(e))return new LA((e,t)=>t(TypeError(`Argument must be an array.`)));let t=new LA(e=>e(null)),n=[e[0]?this.set(`colorOne`,e[0]):t,e[1]?this.set(`colorTwo`,e[1]):t,e[2]?this.set(`colorThree`,e[2]):t,e[3]?this.set(`colorFour`,e[3]):t];return LA.all(n)}getCuePoints(){return this.get(`cuePoints`)}getCurrentTime(){return this.get(`currentTime`)}setCurrentTime(e){return this.set(`currentTime`,e)}getDuration(){return this.get(`duration`)}getEnded(){return this.get(`ended`)}getLoop(){return this.get(`loop`)}setLoop(e){return this.set(`loop`,e)}setMuted(e){return this.set(`muted`,e)}getMuted(){return this.get(`muted`)}getPaused(){return this.get(`paused`)}getPlaybackRate(){return this.get(`playbackRate`)}setPlaybackRate(e){return this.set(`playbackRate`,e)}getPlayed(){return this.get(`played`)}getQualities(){return this.get(`qualities`)}getQuality(){return this.get(`quality`)}setQuality(e){return this.set(`quality`,e)}getRemotePlaybackAvailability(){return this.get(`remotePlaybackAvailability`)}getRemotePlaybackState(){return this.get(`remotePlaybackState`)}getSeekable(){return this.get(`seekable`)}getSeeking(){return this.get(`seeking`)}getTextTracks(){return this.get(`textTracks`)}getAudioTracks(){return this.get(`audioTracks`)}getEnabledAudioTrack(){return this.get(`enabledAudioTrack`)}getDefaultAudioTrack(){return this.get(`defaultAudioTrack`)}getVideoEmbedCode(){return this.get(`videoEmbedCode`)}getVideoId(){return this.get(`videoId`)}getVideoTitle(){return this.get(`videoTitle`)}getVideoWidth(){return this.get(`videoWidth`)}getVideoHeight(){return this.get(`videoHeight`)}getVideoUrl(){return this.get(`videoUrl`)}getVolume(){return this.get(`volume`)}setVolume(e){return this.set(`volume`,e)}async setTimingSrc(e,t){if(!e)throw TypeError(`A Timing Object must be provided.`);await this.ready();let n=new ij(this,e,t);return GA(this,`notifyTimingObjectConnect`),n.addEventListener(`disconnect`,()=>GA(this,`notifyTimingObjectDisconnect`)),n}};CA||(sj=nj(),ZA(),QA(),$A(),ej(),tj());function lj(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,uj(e,t)}function uj(e,t){return uj=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},uj(e,t)}var dj={play:`onPlay`,playing:`onPlaying`,pause:`onPause`,ended:`onEnd`,timeupdate:`onTimeUpdate`,progress:`onProgress`,seeked:`onSeeked`,texttrackchange:`onTextTrackChange`,cuechange:`onCueChange`,cuepoint:`onCuePoint`,volumechange:`onVolumeChange`,playbackratechange:`onPlaybackRateChange`,error:`onError`,loaded:`onLoaded`},fj=function(e){function t(t){var n=e.call(this,t)||this;return n.refContainer=n.refContainer.bind(n),n}lj(t,e);var n=t.prototype;return n.componentDidMount=function(){this.createPlayer()},n.componentDidUpdate=function(e){var t=this,n=Object.keys(this.props).filter(function(n){return t.props[n]!==e[n]});this.updateProps(n)},n.componentWillUnmount=function(){this.player.destroy()},n.getInitialOptions=function(){var e,t=this.props.video,n=/^https?:/i.test(t)?`url`:`id`;return e={},e[n]=t,e.width=this.props.width,e.height=this.props.height,e.autopause=this.props.autopause,e.autoplay=this.props.autoplay,e.byline=this.props.showByline,e.color=this.props.color,e.controls=this.props.controls,e.loop=this.props.loop,e.portrait=this.props.showPortrait,e.title=this.props.showTitle,e.muted=this.props.muted,e.background=this.props.background,e.responsive=this.props.responsive,e.dnt=this.props.dnt,e.speed=this.props.speed,e.keyboard=this.props.keyboard,e.pip=this.props.pip,e.playsinline=this.props.playsInline,e.quality=this.props.quality,e.texttrack=this.props.textTrack,e.transparent=this.props.transparent,e},n.updateProps=function(e){var t=this,n=this.player;e.forEach(function(e){var r=t.props[e];switch(e){case`autopause`:n.setAutopause(r);break;case`color`:n.setColor(r);break;case`loop`:n.setLoop(r);break;case`volume`:n.setVolume(r);break;case`paused`:n.getPaused().then(function(e){return r&&!e?n.pause():!r&&e?n.play():null});break;case`width`:case`height`:n.element[e]=r;break;case`video`:if(r){var i=t.props.start,a=n.loadVideo(r);typeof i==`number`&&a.then(function(){n.setCurrentTime(i)})}else n.unload();break;case`playbackRate`:n.setPlaybackRate(r);break;case`quality`:n.setQuality(r);break}})},n.createPlayer=function(){var e=this,t=this.props,n=t.start,r=t.volume,i=t.playbackRate;this.player=new cj(this.container,this.getInitialOptions()),Object.keys(dj).forEach(function(t){var n=dj[t];e.player.on(t,function(t){var r=e.props[n];r&&r(t)})});var a=this.props,o=a.onError,s=a.onReady;this.player.ready().then(function(){s&&s(e.player)},function(e){if(o)o(e);else throw e}),typeof n==`number`&&this.player.setCurrentTime(n),typeof r==`number`&&this.updateProps([`volume`]),typeof i==`number`&&this.updateProps([`playbackRate`])},n.refContainer=function(e){this.container=e},n.render=function(){var e=this.props,t=e.id,n=e.className,r=e.style;return Y.createElement(`div`,{id:t,className:n,style:r,ref:this.refContainer})},t}(Y.Component);fj.defaultProps={autopause:!0,autoplay:!1,showByline:!0,controls:!0,loop:!1,showPortrait:!0,showTitle:!0,muted:!1,background:!1,responsive:!1,dnt:!1,speed:!1,keyboard:!0,pip:!1,playsInline:!0,transparent:!0};var pj={default:120,mqdefault:320,hqdefault:480,sddefault:640,maxresdefault:1280},mj=(e,t,n,r=`maxresdefault`)=>{let[i,a]=(0,Y.useState)(``);return(0,Y.useEffect)(()=>{let i=`https://img.youtube.com/${t}/${e}/${r}.${n}`,o=`https://img.youtube.com/${t}/${e}/hqdefault.${n}`,s=pj[r],c=new Image;c.onload=()=>{c.width<s?a(o):a(i)},c.onerror=()=>a(o),c.src=i},[e,t,n,r]),i};function hj(e,t,n,r,i){let a={"@context":`https://schema.org`,"@type":`VideoObject`,name:i?.name||t,thumbnailUrl:[i?.thumbnailUrl||n],embedUrl:i?.embedUrl||`${r}/embed/${e}`,contentUrl:i?.contentUrl||`https://www.youtube.com/watch?v=${e}`,...i?.description&&{description:i.description},...i?.uploadDate&&{uploadDate:i.uploadDate},...i?.duration&&{duration:i.duration}};return JSON.stringify(a)}function gj(e,t){let[n,r]=Y.useState(!1),[i,a]=Y.useState(e.alwaysLoadIframe||!1),o=encodeURIComponent(e.id),s=typeof e.playlistCoverId==`string`?encodeURIComponent(e.playlistCoverId):null,c=e.title,l=e.poster||`hqdefault`,u=e.announce||`Watch`,d=e.alwaysLoadIframe?e.autoplay&&e.muted:!0,f=Y.useMemo(()=>{let t=new URLSearchParams({...e.muted?{mute:`1`}:{},...d?{autoplay:`1`}:{},...e.enableJsApi?{enablejsapi:`1`}:{},...e.enableJsApi&&typeof window<`u`?{origin:window.location.origin}:{},...e.playlist?{list:o}:{}});return e.params&&new URLSearchParams(e.params.startsWith(`&`)?e.params.slice(1):e.params).forEach((e,n)=>{t.append(n,e)}),t},[e.muted,d,e.enableJsApi,e.playlist,o,e.params]),p=Y.useMemo(()=>e.cookie?`https://www.youtube.com`:`https://www.youtube-nocookie.com`,[e.cookie]),m=Y.useMemo(()=>e.playlist?`${p}/embed/videoseries?${f.toString()}`:`${p}/embed/${o}?${f.toString()}`,[e.playlist,p,o,f]),h=!e.thumbnail&&!e.playlist&&l===`maxresdefault`,g=e.webp?`webp`:`jpg`,_=e.webp?`vi_webp`:`vi`,v=h?mj(e.id,_,g,l):null,y=Y.useMemo(()=>e.thumbnail||v||`https://i.ytimg.com/${_}/${e.playlist?s:o}/${l}.${g}`,[e.thumbnail,v,_,e.playlist,s,o,l,g]),b=e.activatedClass||`lyt-activated`,x=e.adNetwork||!1,S=e.aspectHeight||9,C=e.aspectWidth||16,w=e.iframeClass||``,T=e.playerClass||`lty-playbtn`,E=e.wrapperClass||`yt-lite`,D=Y.useCallback(e.onIframeAdded||function(){},[e.onIframeAdded]),O=e.rel?`prefetch`:`preload`,k=e.containerElement||`article`,A=e.noscriptFallback!==!1,j=()=>{n||r(!0)},M=()=>{i||a(!0)};return Y.useEffect(()=>{i&&(D(),e.focusOnLoad&&typeof t==`object`&&t?.current&&t.current.focus())},[i,D,e.focusOnLoad,t]),Y.useEffect(()=>{if(!i||!e.enableJsApi||!(e.onReady||e.onStateChange||e.onError||e.onPlay||e.onPause||e.onEnd||e.onBuffering||e.onPlaybackRateChange||e.onPlaybackQualityChange))return;let n=!1,r=!1,a=r=>{if(r.origin!==`https://www.youtube.com`&&r.origin!==`https://www.youtube-nocookie.com`)return;let i;try{i=typeof r.data==`string`?JSON.parse(r.data):r.data}catch{return}switch(i.event){case`onReady`:n||(n=!0,e.onReady&&e.onReady({videoId:e.id,title:c}));break;case`infoDelivery`:if(i.info?.playerState!==void 0){let n=i.info.playerState;switch(e.onStateChange&&e.onStateChange({state:n,currentTime:i.info.currentTime,duration:i.info.duration}),n){case 1:e.onPlay?.();break;case 2:e.onPause?.();break;case 0:e.onEnd?.(),e.stopOnEnd&&typeof t==`object`&&t?.current?.contentWindow&&t.current.contentWindow.postMessage(`{"event":"command","func":"stopVideo","args":""}`,`*`);break;case 3:e.onBuffering?.();break}}i.info?.playbackRate!==void 0&&e.onPlaybackRateChange?.(i.info.playbackRate),i.info?.playbackQuality!==void 0&&e.onPlaybackQualityChange?.(i.info.playbackQuality);break;case`onStateChange`:if(i.info?.playerState!==void 0){let n=i.info.playerState;switch(e.onStateChange&&e.onStateChange({state:n,currentTime:i.info.currentTime,duration:i.info.duration}),n){case 1:e.onPlay?.();break;case 2:e.onPause?.();break;case 0:e.onEnd?.(),e.stopOnEnd&&typeof t==`object`&&t?.current?.contentWindow&&t.current.contentWindow.postMessage(`{"event":"command","func":"stopVideo","args":""}`,`*`);break;case 3:e.onBuffering?.();break}}break;case`onError`:if(i.info&&`errorCode`in i.info){let t=i.info.errorCode;e.onError&&e.onError(t)}break;case`onPlaybackRateChange`:i.info?.playbackRate!==void 0&&e.onPlaybackRateChange?.(i.info.playbackRate);break;case`onPlaybackQualityChange`:i.info?.playbackQuality!==void 0&&e.onPlaybackQualityChange?.(i.info.playbackQuality);break}};window.addEventListener(`message`,a);let s=[],l=()=>{typeof t==`object`&&t?.current?.contentWindow&&t.current.contentWindow.postMessage(`{"event":"listening","id":"`+o+`"}`,`*`)},u=()=>{r||(r=!0,l(),[100,300,600,1200,2400].forEach(e=>{s.push(setTimeout(l,e))}))};return typeof t==`object`&&t?.current?(t.current.addEventListener(`load`,u),t.current.contentDocument?.readyState===`complete`&&u()):[200,500,1e3,2e3,3e3].forEach(e=>{s.push(setTimeout(l,e))}),()=>{window.removeEventListener(`message`,a),s.forEach(clearTimeout),typeof t==`object`&&t?.current&&t.current.removeEventListener(`load`,u)}},[i,e.enableJsApi,e.onReady,e.onStateChange,e.onError,e.onPlay,e.onPause,e.onEnd,e.onBuffering,e.onPlaybackRateChange,e.onPlaybackQualityChange,e.stopOnEnd,e.id,o,c,t]),(0,X.jsxs)(X.Fragment,{children:[!e.lazyLoad&&(0,X.jsx)(`link`,{rel:O,href:y,as:`image`}),(0,X.jsx)(X.Fragment,{children:n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`link`,{rel:`preconnect`,href:p}),(0,X.jsx)(`link`,{rel:`preconnect`,href:`https://www.google.com`}),x&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`link`,{rel:`preconnect`,href:`https://static.doubleclick.net`}),(0,X.jsx)(`link`,{rel:`preconnect`,href:`https://googleads.g.doubleclick.net`})]})]})}),e.seo&&!e.playlist&&(0,X.jsx)(`script`,{type:`application/ld+json`,dangerouslySetInnerHTML:{__html:hj(e.id,c,y,p,e.seo)}}),A&&!e.playlist&&(0,X.jsx)(`noscript`,{children:(0,X.jsxs)(`a`,{href:`https://www.youtube.com/watch?v=${e.id}`,"aria-label":`Watch ${c} on YouTube`,children:[`Watch "`,c,`" on YouTube`]})}),(0,X.jsxs)(k,{onPointerOver:j,onClick:M,className:`${E} ${i?b:``}`,"data-title":c,role:!i&&!e.lazyLoad?`img`:void 0,"aria-label":i?void 0:`${c} - YouTube video preview`,style:{...!e.lazyLoad&&{backgroundImage:`url(${y})`},"--aspect-ratio":`${S/C*100}%`,...e.style||{}},children:[e.lazyLoad&&!i&&(0,X.jsx)(`img`,{src:y,alt:`${c} - YouTube thumbnail`,className:`lty-thumbnail`,loading:`lazy`}),e.playlist&&!i&&(0,X.jsx)(`div`,{className:`lty-playlist-icon`,"aria-hidden":`true`}),!(e.hideButtonOnActivate&&i)&&(0,X.jsx)(`button`,{type:`button`,className:T,"aria-label":`${u} ${c}`,"aria-hidden":i||void 0,tabIndex:i?-1:0,onClick:M,children:(0,X.jsx)(`span`,{className:`lty-visually-hidden`,children:u})}),i&&(0,X.jsx)(`iframe`,{ref:t,className:w,title:c,width:`560`,height:`315`,allow:`accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,src:m,referrerPolicy:e.referrerPolicy||`strict-origin-when-cross-origin`})]})]})}var _j=Y.forwardRef(gj);function vj(e){return e!==!1}function yj(e,t){let n=[];return t.startSeconds!==null&&n.push(`start=${t.startSeconds}`),e.controls===!1&&n.push(`controls=0`),e.loop===!0&&n.push(`loop=1`,`playlist=${t.id}`),e.playsinline===!0&&n.push(`playsinline=1`),n.length>0?n.join(`&`):void 0}function bj(e){if(e.width!==void 0)return{width:e.width}}function xj(e){if(!(e.width===void 0||e.height===void 0))return{aspectRatio:`${e.width} / ${e.height}`}}function Sj(e){let t=(0,J.c)(23),n=(0,Y.useRef)(null),r=e.title??`Vimeo video player`,i;t[0]===r?i=t[1]:(i=e=>{let t=e;n.current=t,t.element&&(t.element.title=r)},t[0]=r,t[1]=i);let a=i,o,s;t[2]===r?(o=t[3],s=t[4]):(o=()=>{let e=n.current;e?.element&&(e.element.title=r)},s=[r],t[2]=r,t[3]=o,t[4]=s),(0,Y.useEffect)(o,s);let c;t[5]===e?c=t[6]:(c=bj(e),t[5]=e,t[6]=c);let l=e.width===void 0,u=e.autoplay===!0,d=e.muted===!0,f=e.muted===!0?0:1,p=e.loop===!0,m=e.controls!==!1,h=e.playsinline!==!1,g;t[7]!==a||t[8]!==e.height||t[9]!==e.src||t[10]!==e.width||t[11]!==h||t[12]!==l||t[13]!==u||t[14]!==d||t[15]!==f||t[16]!==p||t[17]!==m?(g=(0,X.jsx)(fj,{video:e.src,responsive:l,width:e.width,height:e.height,autoplay:u,muted:d,volume:f,loop:p,controls:m,playsInline:h,onReady:a}),t[7]=a,t[8]=e.height,t[9]=e.src,t[10]=e.width,t[11]=h,t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=g):g=t[18];let _;return t[19]!==e.title||t[20]!==g||t[21]!==c?(_=(0,X.jsx)(`div`,{className:`ok-video ok-video-vimeo`,style:c,title:e.title,children:g}),t[19]=e.title,t[20]=g,t[21]=c,t[22]=_):_=t[22],_}function Cj(e){let t=(0,J.c)(17),n;t[0]===e.src?n=t[1]:(n=nn(e.src),t[0]=e.src,t[1]=n);let r=n;if(!r)return null;let i;t[2]!==r.startRaw||t[3]!==e.autoplay||t[4]!==e.muted?(i=[],r.startRaw!==null&&i.push(`t=${r.startRaw}`),e.autoplay===!0&&i.push(`autoplay=true`),e.muted===!0&&i.push(`muted=true`),t[2]=r.startRaw,t[3]=e.autoplay,t[4]=e.muted,t[5]=i):i=t[5];let a=i.length>0?`https://www.loom.com/embed/${r.id}?${i.join(`&`)}`:`https://www.loom.com/embed/${r.id}`,o;t[6]===e?o=t[7]:(o=bj(e),t[6]=e,t[7]=o);let s=e.title??`Loom video player`,c;t[8]!==a||t[9]!==e.height||t[10]!==e.width||t[11]!==s?(c=(0,X.jsx)(`iframe`,{className:`ok-video-loom-iframe`,src:a,title:s,width:e.width,height:e.height,allow:`autoplay; fullscreen`,referrerPolicy:`strict-origin-when-cross-origin`,allowFullScreen:!0}),t[8]=a,t[9]=e.height,t[10]=e.width,t[11]=s,t[12]=c):c=t[12];let l;return t[13]!==e.title||t[14]!==o||t[15]!==c?(l=(0,X.jsx)(`div`,{className:`ok-video ok-video-loom`,style:o,title:e.title,children:c}),t[13]=e.title,t[14]=o,t[15]=c,t[16]=l):l=t[16],l}function wj(e){let t=(0,J.c)(29);if(e.src!==void 0&&He(e.src)){let n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Cj,{...e,src:e.src}),t[0]=e,t[1]=n),n}if(e.src!==void 0&&Qe(e.src)){let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(Sj,{...e,src:e.src}),t[2]=e,t[3]=n),n}let n;if(t[4]!==e){n=Symbol.for(`react.early_return_sentinel`);bb0:{let r=e.src===void 0?null:y(e.src);if(r!==null){let i=e.autoplay===!0&&e.muted===!0,a=e.width!==void 0&&e.height!==void 0,o=bj(e),s;t[6]===e.poster?s=t[7]:(s=e.poster===void 0?void 0:ae(e.poster),t[6]=e.poster,t[7]=s);let c=(0,X.jsx)(_j,{id:r.id,title:e.title??`YouTube video player`,cookie:!r.noCookie,params:yj(e,r),muted:e.muted===!0,autoplay:e.autoplay===!0,alwaysLoadIframe:i,thumbnail:s,aspectWidth:a?Number(e.width):void 0,aspectHeight:a?Number(e.height):void 0,style:xj(e)}),l;t[8]!==o||t[9]!==c?(l=(0,X.jsx)(`div`,{className:`ok-video ok-video-youtube`,style:o,children:c}),t[8]=o,t[9]=c,t[10]=l):l=t[10],n=l;break bb0}}t[4]=e,t[5]=n}else n=t[5];if(n!==Symbol.for(`react.early_return_sentinel`))return n;let r;t[11]===e.src?r=t[12]:(r=e.src===void 0?void 0:ae(e.src),t[11]=e.src,t[12]=r);let i=e.title,a;t[13]===e.controls?a=t[14]:(a=vj(e.controls),t[13]=e.controls,t[14]=a);let o;t[15]===e.poster?o=t[16]:(o=e.poster===void 0?void 0:ae(e.poster),t[15]=e.poster,t[16]=o);let s;return t[17]!==e.autoplay||t[18]!==e.height||t[19]!==e.loop||t[20]!==e.muted||t[21]!==e.playsinline||t[22]!==e.preload||t[23]!==e.title||t[24]!==e.width||t[25]!==r||t[26]!==a||t[27]!==o?(s=(0,X.jsx)(`video`,{className:`ok-video`,src:r,title:i,controls:a,autoPlay:e.autoplay,muted:e.muted,loop:e.loop,playsInline:e.playsinline,poster:o,preload:e.preload,width:e.width,height:e.height}),t[17]=e.autoplay,t[18]=e.height,t[19]=e.loop,t[20]=e.muted,t[21]=e.playsinline,t[22]=e.preload,t[23]=e.title,t[24]=e.width,t[25]=r,t[26]=a,t[27]=o,t[28]=s):s=t[28],s}function Tj(e){let t=(0,J.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,X.jsx)(`div`,{className:`prose-no-margin`,children:e.children}),t[0]=e.children,t[1]=n),n}var Ej={Callout:AO,img:Ek,video:wj,audio:wO,Pdf:oA,File:UO,Embed:VO,Accordion:SO,Tabs:_A,Tab:pA,Math:kk,MermaidFence:Mk,Mirror:Kk,MirrorSource:qk,"*":Tj};function Dj(e){let t=new Set;for(let n of e)n.type===`reactnode`&&t.add(n.name);return t}var Oj=B(),kj=new Map;function Aj(e){if(e.surface===`compat`){let t=Ej[e.rendersAs];if(!t)throw Error(`Compat descriptor '${e.name}' declares rendersAs: '${e.rendersAs}', but no React component is registered under that name in componentMap. Add the canonical component before registering the compat descriptor.`);return{Component:t,reactNodePropNames:Dj(e.props)}}let t=Ej[e.name];return t?{Component:t,reactNodePropNames:Dj(e.props)}:null}for(let[e,t]of Oj.entries()){let n=Aj(t);n&&kj.set(e,n)}function jj(e,t){return{...e,Component:t.Component,reactNodePropNames:t.reactNodePropNames}}function Mj(e){let t=Oj.getOrWildcard(e),n=kj.get(t.name)??kj.get(`*`);if(!n)throw Error(`No React component registered for ${t.name} (and no '*' wildcard)`);return jj(t,n)}function Nj(){let e=[];for(let[t,n]of Oj.entries()){if(t===`*`)continue;let r=kj.get(t);r&&e.push(jj(n,r))}return e}var Pj=``+new URL(`image-preview-BJSGEOo4.png`,import.meta.url).href,Fj=``+new URL(`video-preview-vLovc_Vy.png`,import.meta.url).href,Ij={Callout:{description:{id:`322lyb`},props:{type:`note`,title:`Heads up`},children:`Callouts draw attention to key information.`},Accordion:{description:{id:`mWVJRX`},props:{title:`Click to expand`,defaultOpen:!0},children:`Hidden content goes here.`},img:{description:{id:`VUijjF`},props:{src:Pj,alt:`Sample image`}},video:{description:{id:`e1hptq`},props:{controls:!0,poster:Fj}},audio:{description:{id:`9jnjV0`},props:{controls:!0}},Math:{description:{id:`Y-Urt2`},props:{formula:`c = \\pm\\sqrt{a^2 + b^2}`}},Embed:{description:{id:`jTLWxh`},render:()=>(0,X.jsxs)(`div`,{className:`flex h-full w-full flex-col overflow-hidden rounded-md border border-border bg-background`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border bg-muted/40 px-2 py-1.5`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,X.jsx)(`span`,{className:`ml-1.5 flex-1 truncate rounded-sm bg-background px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:`https://example.com/embed`})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1.5 px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1.5 w-full rounded-sm bg-muted-foreground/20`}),(0,X.jsx)(`span`,{className:`h-1.5 w-5/6 rounded-sm bg-muted-foreground/20`}),(0,X.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-sm bg-muted-foreground/20`})]})]})},Pdf:{description:{id:`Fqr8BP`},render:()=>(0,X.jsxs)(`div`,{className:`flex h-full w-full flex-col overflow-hidden rounded-md border border-border bg-background`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border bg-muted/40 px-1.5 py-1`,children:[(0,X.jsxs)(`svg`,{viewBox:`0 0 12 12`,className:`size-3 text-muted-foreground`,"aria-hidden":`true`,children:[(0,X.jsx)(`title`,{children:`Thumbnails`}),(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`}),(0,X.jsx)(`rect`,{x:`7`,y:`1`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`}),(0,X.jsx)(`rect`,{x:`1`,y:`7`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`}),(0,X.jsx)(`rect`,{x:`7`,y:`7`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`})]}),(0,X.jsxs)(`span`,{className:`ml-1 flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`rounded-sm bg-background px-1 py-0.5 font-mono`,children:`2`}),(0,X.jsx)(`span`,{children:`/ 12`})]}),(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-[10px] font-mono text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`rounded-sm bg-background px-1 py-0.5`,children:`−`}),(0,X.jsx)(`span`,{children:`100%`}),(0,X.jsx)(`span`,{className:`rounded-sm bg-background px-1 py-0.5`,children:`+`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 gap-1 p-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex w-6 flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`h-3 rounded-sm bg-muted-foreground/20`}),(0,X.jsx)(`span`,{className:`h-3 rounded-sm border border-foreground/60 bg-background`}),(0,X.jsx)(`span`,{className:`h-3 rounded-sm bg-muted-foreground/20`})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1 rounded-sm bg-background p-1.5`,children:[(0,X.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-sm bg-foreground/50`}),(0,X.jsx)(`span`,{className:`h-1 w-full rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1 w-5/6 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1 w-full rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1 w-2/3 rounded-sm bg-muted-foreground/30`})]})]})]})},MermaidFence:{description:{id:`z0a2EA`},render:()=>(0,X.jsxs)(`svg`,{viewBox:`0 0 200 120`,className:`h-full w-full text-foreground`,"aria-hidden":`true`,preserveAspectRatio:`xMidYMid meet`,children:[(0,X.jsx)(`title`,{children:`Mermaid flowchart preview`}),(0,X.jsx)(`defs`,{children:(0,X.jsx)(`marker`,{id:`mermaid-preview-arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,X.jsx)(`path`,{d:`M 0 0 L 10 5 L 0 10 z`,fill:`currentColor`})})}),(0,X.jsx)(`rect`,{x:`14`,y:`20`,width:`56`,height:`28`,rx:`14`,fill:`currentColor`,fillOpacity:`0.1`,stroke:`currentColor`,strokeOpacity:`0.7`}),(0,X.jsx)(`text`,{x:`42`,y:`38`,textAnchor:`middle`,fontSize:`10`,fill:`currentColor`,children:`Start`}),(0,X.jsx)(`polygon`,{points:`100,18 140,50 100,82 60,50`,fill:`currentColor`,fillOpacity:`0.1`,stroke:`currentColor`,strokeOpacity:`0.7`}),(0,X.jsx)(`text`,{x:`100`,y:`54`,textAnchor:`middle`,fontSize:`10`,fill:`currentColor`,children:`Ready?`}),(0,X.jsx)(`rect`,{x:`130`,y:`84`,width:`56`,height:`28`,rx:`14`,fill:`currentColor`,fillOpacity:`0.1`,stroke:`currentColor`,strokeOpacity:`0.7`}),(0,X.jsx)(`text`,{x:`158`,y:`102`,textAnchor:`middle`,fontSize:`10`,fill:`currentColor`,children:`End`}),(0,X.jsx)(`line`,{x1:`70`,y1:`34`,x2:`80`,y2:`40`,stroke:`currentColor`,strokeOpacity:`0.7`,strokeWidth:`1.2`,markerEnd:`url(#mermaid-preview-arrow)`}),(0,X.jsx)(`line`,{x1:`124`,y1:`62`,x2:`138`,y2:`82`,stroke:`currentColor`,strokeOpacity:`0.7`,strokeWidth:`1.2`,markerEnd:`url(#mermaid-preview-arrow)`}),(0,X.jsx)(`text`,{x:`138`,y:`74`,fontSize:`8`,fill:`currentColor`,opacity:`0.6`,children:`yes`})]})},Tabs:{description:{id:`75Y1dk`},render:()=>(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex gap-1 border-b border-border pb-1`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-foreground/10 px-2 py-0.5 text-xs font-medium text-foreground`,children:`Tab 1`}),(0,X.jsx)(`span`,{className:`rounded-md px-2 py-0.5 text-xs text-muted-foreground`,children:`Tab 2`})]}),(0,X.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:(0,X.jsx)(o,{id:`m6YGpY`})})]})},Mirror:{description:{id:`8TLE9g`},render:()=>(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`div`,{className:`relative rounded-md border border-dashed border-border/40 px-2 py-1.5`,children:[(0,X.jsxs)(`span`,{className:`absolute -top-2 right-1.5 flex items-center gap-1 rounded-md bg-background px-1 text-[10px] text-muted-foreground`,children:[(0,X.jsx)(Ri,{className:`size-2.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`EL_YRd`,components:{0:(0,X.jsx)(`code`,{className:`font-mono`})}})})]}),(0,X.jsx)(`span`,{className:`block h-1.5 w-3/4 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`mt-1 block h-1.5 w-2/3 rounded-sm bg-muted-foreground/20`})]}),(0,X.jsx)(`p`,{className:`px-1 text-[10px] text-muted-foreground`,children:(0,X.jsx)(o,{id:`qNOgUu`})})]})},MirrorSource:{description:{id:`-KCZ6n`},render:()=>(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`div`,{className:`relative rounded-md border border-dashed border-border/50 px-2 py-1.5`,children:[(0,X.jsxs)(`span`,{className:`absolute -top-2 left-1.5 flex items-center gap-1 rounded-md bg-background px-1 text-[10px] text-muted-foreground`,children:[(0,X.jsx)(Ii,{className:`size-2.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`maDWIB`,components:{0:(0,X.jsx)(`code`,{className:`font-mono`})}})})]}),(0,X.jsx)(`span`,{className:`block h-1.5 w-4/5 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`mt-1 block h-1.5 w-3/5 rounded-sm bg-muted-foreground/20`})]}),(0,X.jsx)(`p`,{className:`px-1 text-[10px] text-muted-foreground`,children:(0,X.jsx)(o,{id:`emgiet`})})]})}};function Lj(e){let t={};for(let n of e.props)n.type!==`reactnode`&&`defaultValue`in n&&n.defaultValue!==void 0&&(t[n.name]=n.defaultValue);return t}function Rj(e){let t=Mj(e),n=Lj(t);return{type:`jsxComponent`,attrs:{componentName:t.name,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!0,props:n},content:t.hasChildren?[{type:`paragraph`}]:void 0}}var zj=new Set;function Bj(e){zj.add(e)}function Vj(e){if(typeof e==`number`)return zj.delete(e);let t=zj.values().next();return t.done?!1:(zj.delete(t.value),!0)}function Hj(e,t,n){n.props.some(e=>!(`hidden`in e&&e.hidden)&&e.type!==`reactnode`)?(Bj(t),requestAnimationFrame(()=>{e.commands.setNodeSelection(t)})):n.hasChildren&&e.commands.setTextSelection(t+2)}function Uj(e){return t=>{let n=new WeakSet;t.state.doc.descendants(t=>{t.type.name===`jsxComponent`&&t.attrs.componentName===e.name&&n.add(t)});let r=Rj(e.name);if(e.name===`Tabs`){let e=Rj(`Tab`),t=Rj(`Tab`),n=e.attrs,i=t.attrs;n.props={...n.props,label:`Tab 1`},i.props={...i.props,label:`Tab 2`},r.content=[e,t]}t.chain().focus().insertContent(r).run();let i=-1;t.state.doc.descendants((t,r)=>{if(i>=0)return!1;t.type.name===`jsxComponent`&&t.attrs.componentName===e.name&&!n.has(t)&&(i=r)}),!(i<0)&&Hj(t,i,e)}}var Wj=new Set([`File`,`Tab`]);function Gj(){return[{name:`component-File`,label:_._({id:`J2eKUI`}),icon:Ui,category:`media`,aliases:[`file`,`attachment`,`download`,`upload`,`document`,`doc`,`docx`,`zip`],description:"Attach a downloadable file (`.pdf` / `.docx` / `.zip` / …)",command:qj,preview:{description:_._({id:`t-JXbf`}),render:()=>(0,X.jsxs)(`div`,{className:`flex w-full items-baseline gap-2 rounded-md px-2 py-1.5`,children:[(0,X.jsx)(Ui,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:`quarterly-report.pdf`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`1.4 MB`})]})}}]}function Kj(){return[...Nj().filter(e=>e.surface===`canonical`&&!Wj.has(e.name)).map(e=>{let t=Ij[e.name],n=e.Component,r=t?{description:_._(t.description),render:t.render??(()=>(0,X.jsx)(n,{...t.props,children:t.children}))}:void 0;return{name:`component-${e.name}`,label:e.displayName??e.name,icon:yO(e.icon),category:e.category??`content`,command:Uj(e),aliases:e.searchTerms,description:e.description,preview:r}}),...Gj()]}function qj(e){let t=document.createElement(`input`);t.type=`file`,t.accept=`*/*`,t.style.display=`none`,t.addEventListener(`change`,()=>{let n=t.files?.[0];if(n){let t=e.state.selection.from;qD(n,e,t)}t.remove()},{once:!0}),t.addEventListener(`cancel`,()=>t.remove(),{once:!0}),document.body.appendChild(t),t.click()}function Jj(e,t){let n=QD.getState(e.state);if(!n)return null;for(let e of n.byId.values())if(e.markType===`link`&&e.from<=t&&t<e.to)return e.id;return null}function Yj(){return[{name:`wikiLink`,label:_._({id:`mZHJju`}),icon:oa,category:`insert`,aliases:[`wiki`,`wikilink`,`[[`,`internal`,`page`,`backlink`,`cross-link`],description:"Link to another page (`[[page]]`) — opens a page picker",preview:{description:_._({id:`cqA3od`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-7`,children:(0,X.jsx)(o,{id:`u-9fWA`,components:{0:(0,X.jsx)(`span`,{className:`font-medium text-azure-blue underline underline-offset-2 dark:text-sky-blue`})}})})},command:e=>{e.chain().focus().insertContent(`[[`).run()}},{name:`externalLink`,label:_._({id:`0R4wMK`}),icon:Ri,category:`insert`,aliases:[`link`,`url`,`href`,`external`,`web`,`hyperlink`],description:"Link to an external URL (`https://…`)",preview:{description:_._({id:`ClDdyg`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-7`,children:(0,X.jsx)(o,{id:`QWT-Z9`,components:{0:(0,X.jsx)(`span`,{className:`font-medium text-azure-blue underline underline-offset-2 dark:text-sky-blue`}),1:(0,X.jsx)(`span`,{className:`text-[0.85em] opacity-60`})}})})},command:e=>{let t=e.state.selection.from;e.chain().focus().insertContent({type:`text`,text:`link`,marks:[{type:`link`,attrs:{href:`https://`}}]}).run();let n=Jj(e,t);n&&(XD(n),requestAnimationFrame(()=>{_O(e).setActiveNode(n)}))}},{name:`component-Tag`,label:_._({id:`UL8A9w`}),icon:Yi,category:`content`,aliases:[`#`,`hashtag`,`label`],description:"Inline tag (`#tagname`) for cross-doc linking",preview:{description:_._({id:`5ClEAu`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-7`,children:(0,X.jsx)(o,{id:`KZLdgR`,components:{0:(0,X.jsx)(`a`,{className:`tag pointer-events-none`})}})})},command:e=>{e.chain().insertTag(``).run()}}]}function Xj(e){return t=>{t.chain().focus().insertContent({type:`codeBlock`,attrs:{language:`html`,meta:`preview`},content:[{type:`text`,text:e}]}).run()}}var Zj={chart:{icon:Oi,aliases:[`chart`,`bar`,`graph`,`plot`,`viz`,`data`,`embed`,`preview`],render:()=>(0,X.jsxs)(`div`,{className:`flex h-20 items-end gap-1.5`,children:[(0,X.jsx)(`div`,{className:`h-[45%] flex-1 rounded-t-sm bg-chart-1`}),(0,X.jsx)(`div`,{className:`h-[70%] flex-1 rounded-t-sm bg-chart-2`}),(0,X.jsx)(`div`,{className:`h-[90%] flex-1 rounded-t-sm bg-chart-3`}),(0,X.jsx)(`div`,{className:`h-[60%] flex-1 rounded-t-sm bg-chart-4`}),(0,X.jsx)(`div`,{className:`h-[80%] flex-1 rounded-t-sm bg-chart-5`})]})},"stat-cards":{icon:ta,aliases:[`stat`,`stats`,`metric`,`metrics`,`cards`,`kpi`,`embed`,`preview`],render:()=>(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex-1 rounded-md border border-border bg-card p-2`,children:[(0,X.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Users`}),(0,X.jsx)(`div`,{className:`text-sm font-bold text-card-foreground`,children:`12.4k`}),(0,X.jsx)(`div`,{className:`text-[10px] font-semibold text-chart-2`,children:`+8.2%`})]}),(0,X.jsxs)(`div`,{className:`flex-1 rounded-md border border-border bg-card p-2`,children:[(0,X.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Revenue`}),(0,X.jsx)(`div`,{className:`text-sm font-bold text-card-foreground`,children:`$48k`}),(0,X.jsx)(`div`,{className:`text-[10px] font-semibold text-chart-1`,children:`+3.1%`})]})]})},"custom-svg":{icon:Sa,aliases:[`svg`,`vector`,`graphic`,`illustration`,`ring`,`embed`,`preview`],render:()=>(0,X.jsx)(`div`,{className:`flex items-center justify-center text-chart-1`,children:(0,X.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{cx:`36`,cy:`36`,r:`28`,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.15`,strokeWidth:`9`}),(0,X.jsx)(`circle`,{cx:`36`,cy:`36`,r:`28`,fill:`none`,stroke:`currentColor`,strokeWidth:`9`,strokeLinecap:`round`,strokeDasharray:`176`,strokeDashoffset:`53`,transform:`rotate(-90 36 36)`})]})})},"interactive-control":{icon:wa,aliases:[`interactive`,`slider`,`control`,`widget`,`input`,`embed`,`preview`],render:()=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`div`,{className:`text-lg font-bold text-chart-1`,children:`$2,500`}),(0,X.jsxs)(`div`,{className:`relative h-1.5 rounded-full bg-muted`,children:[(0,X.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1/3 rounded-full bg-primary`}),(0,X.jsx)(`div`,{className:`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/3 size-3 rounded-full bg-primary`})]}),(0,X.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Drag to adjust`})]})}};function Qj(){return T.map(e=>{let t=Zj[e.id];return{name:`embed-starter-${e.id}`,label:e.title,icon:t.icon,category:`embed`,command:Xj(e.html),aliases:t.aliases,description:e.description,preview:{description:e.description,render:t.render}}})}function $j(){return[{name:`heading1`,label:_._({id:`lXKZGw`}),icon:Xi,category:`basic`,command:e=>e.chain().focus().toggleHeading({level:1}).run(),aliases:[`h1`],preview:{description:_._({id:`3J7d2N`}),render:()=>(0,X.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:(0,X.jsx)(o,{id:`lXKZGw`})})}},{name:`heading2`,label:_._({id:`El7NbA`}),icon:Zi,category:`basic`,command:e=>e.chain().focus().toggleHeading({level:2}).run(),aliases:[`h2`],preview:{description:_._({id:`LXdWeS`}),render:()=>(0,X.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:(0,X.jsx)(o,{id:`El7NbA`})})}},{name:`heading3`,label:_._({id:`SFN6dN`}),icon:Qi,category:`basic`,command:e=>e.chain().focus().toggleHeading({level:3}).run(),aliases:[`h3`],preview:{description:_._({id:`g4XBm0`}),render:()=>(0,X.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:(0,X.jsx)(o,{id:`SFN6dN`})})}},{name:`bulletList`,label:_._({id:`s1c0ja`}),icon:la,category:`basic`,command:e=>e.chain().focus().toggleBulletList().run(),aliases:[`ul`,`unordered`],preview:{description:_._({id:`fYjgXu`}),render:()=>(0,X.jsxs)(`ul`,{className:`list-disc pl-5 text-sm leading-7`,children:[(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`FCxvG5`})}),(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`saIASg`})})]})}},{name:`orderedList`,label:_._({id:`Uci-Ph`}),icon:sa,category:`basic`,command:e=>e.chain().focus().toggleOrderedList().run(),aliases:[`ol`,`numbered`],preview:{description:_._({id:`rXz97P`}),render:()=>(0,X.jsxs)(`ol`,{className:`list-decimal pl-5 text-sm leading-7`,children:[(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`FCxvG5`})}),(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`saIASg`})})]})}},{name:`taskList`,label:_._({id:`G_686w`}),icon:ca,category:`basic`,command:e=>e.chain().focus().toggleTaskList().run(),aliases:[`todo`,`checklist`,`checkbox`],preview:{description:_._({id:`yutJKi`}),render:()=>(0,X.jsxs)(`ul`,{className:`space-y-1.5 text-sm`,children:[(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:!0,readOnly:!0,className:`size-3.5`}),(0,X.jsx)(`span`,{className:`text-muted-foreground line-through`,children:(0,X.jsx)(o,{id:`DPfwMq`})})]}),(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`checkbox`,readOnly:!0,className:`size-3.5`}),(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`rZ9HZq`})})]})]})}},{name:`blockquote`,label:_._({id:`ZhhOwV`}),icon:ya,category:`basic`,command:e=>e.chain().focus().toggleBlockquote().run(),aliases:[`quote`],preview:{description:_._({id:`w7nm4K`}),render:()=>(0,X.jsx)(`blockquote`,{className:`border-l-2 border-muted-foreground/40 pl-3 text-sm italic text-muted-foreground`,children:(0,X.jsx)(o,{id:`74-bX-`})})}},{name:`codeBlock`,label:_._({id:`N2eHWq`}),icon:Fi,category:`basic`,command:e=>e.chain().focus().toggleCodeBlock().run(),aliases:[`code`,`fence`],preview:{description:_._({id:`XpIZmv`}),render:()=>(0,X.jsx)(`pre`,{className:`rounded-md bg-muted px-2.5 py-2 font-mono text-xs leading-5`,children:(0,X.jsx)(`code`,{children:`const greeting = "Hello";
|
|
6
|
+
`);return/\s/.test(n)}):!1}var jy=new W(`suggestion`);function My({pluginKey:e=jy,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=ky,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!Ay(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let T=new Gt({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=T.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=T.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=T.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),Tt.create(e.doc,[Pe.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var Ny=My;function Py(e){return e.kind===`create`?`create:${e.value}`:`tag:${e.value}`}function Fy(e){if(e.kind===`create`){let t=e.value;return _._({id:`XPqe3B`,values:{tagValue:t}})}let t=_._({id:`pckX1A`,values:{0:e.count}}),n=e.value;return _._({id:`m2T1Xj`,values:{tagValue:n,uses:t}})}function Iy(e){let t=(0,J.c)(38),{items:n,query:r,selectedIndex:a,onSelect:s,onHover:c,loading:l,error:u}=e,d=l===void 0?!1:l,f=u===void 0?null:u,{_:p}=i(),m=(0,Y.useRef)(null),h=(0,Y.useId)(),g=a>=0&&a<n.length?`${h}-option-${a}`:void 0,_,v;t[0]===a?(_=t[1],v=t[2]):(_=()=>{let e=m.current;if(!e)return;let t=e.querySelectorAll(`[role="option"]`).item(a);t&&t.scrollIntoView({block:`nearest`})},v=[a],t[0]=a,t[1]=_,t[2]=v),(0,Y.useEffect)(_,v);let y=Ly;if(d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{ref:m,role:`status`,"aria-live":`polite`,className:`w-64 rounded-lg border bg-popover p-2 shadow-md text-sm text-muted-foreground`,style:e,onMouseDown:y,children:(0,X.jsx)(o,{id:`a_u4ck`})}),t[4]=n):n=t[4],n}if(n.length===0){let e;if(t[5]!==p||t[6]!==f||t[7]!==r){let n=r.trim();e=f??p(n?{id:`9R7pRC`,values:{trimmed:n}}:{id:`KRJ6xh`}),t[5]=p,t[6]=f,t[7]=r,t[8]=e}else e=t[8];let n=e,i;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(i={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[9]=i):i=t[9];let a;return t[10]===n?a=t[11]:(a=(0,X.jsx)(`div`,{ref:m,role:`status`,"aria-live":`polite`,className:`w-64 rounded-lg border bg-popover p-2 shadow-md text-sm text-muted-foreground`,style:i,onMouseDown:y,children:n}),t[10]=n,t[11]=a),a}let b=a>=0&&a<n.length?n[a]:null,x;t[12]===p?x=t[13]:(x=p({id:`SCoBBH`}),t[12]=p,t[13]=x);let S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S={maxHeight:`var(--suggestion-menu-max-height, 40vh)`},t[14]=S):S=t[14];let C;t[15]===b?C=t[16]:(C=b?Fy(b):``,t[15]=b,t[16]=C);let w;t[17]===C?w=t[18]:(w=(0,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:C}),t[17]=C,t[18]=w);let T;t[19]===f?T=t[20]:(T=f&&(0,X.jsx)(`div`,{className:`rounded-md px-2 py-1.5 text-xs text-amber-700 dark:text-amber-300`,children:f}),t[19]=f,t[20]=T);let E;if(t[21]!==n||t[22]!==h||t[23]!==c||t[24]!==s||t[25]!==a){let e;t[27]!==h||t[28]!==c||t[29]!==s||t[30]!==a?(e=(e,t)=>{let n=t===a,r=Py(e),i=e.kind===`create`;return(0,X.jsxs)(`button`,{id:`${h}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-selected":n,"data-testid":i?`tag-suggestion-create`:`tag-suggestion-tag-${e.value}`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),s(e)},onPointerMove:c?()=>c(t):void 0,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-xs text-muted-foreground`,children:`#`}),(0,X.jsx)(`span`,{className:`truncate font-medium flex-1`,children:e.value}),i?(0,X.jsx)(`span`,{className:`shrink-0 rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary`,children:(0,X.jsx)(o,{id:`isRobC`})}):(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:e.count})]},r)},t[27]=h,t[28]=c,t[29]=s,t[30]=a,t[31]=e):e=t[31],E=n.map(e),t[21]=n,t[22]=h,t[23]=c,t[24]=s,t[25]=a,t[26]=E}else E=t[26];let D;return t[32]!==g||t[33]!==E||t[34]!==x||t[35]!==w||t[36]!==T?(D=(0,X.jsxs)(`div`,{ref:m,role:`listbox`,"aria-label":x,"aria-activedescendant":g,tabIndex:-1,onMouseDown:y,className:`w-64 overflow-y-auto subtle-scrollbar rounded-lg border bg-popover p-1 shadow-md`,style:S,children:[w,T,E]}),t[32]=g,t[33]=E,t[34]=x,t[35]=w,t[36]=T,t[37]=D):D=t[37],D}function Ly(e){return e.preventDefault()}var Ry=new WeakMap;function zy(e,t){Ry.set(e,t)}function By(e){return Ry.get(e)??!1}function Vy(e,t){let n=document.createElement(`div`);n.style.position=`fixed`,n.style.zIndex=`50`,n.style.visibility=`hidden`,document.body.appendChild(n);let r={getBoundingClientRect:()=>e()?.clientRect?.()??new DOMRect,get contextElement(){return e()?.editor.view.dom}},i=!1,a=!1,o=()=>{n.isConnected&&(n.style.removeProperty(`--suggestion-menu-max-height`),ge(r,n,{placement:`bottom-start`,middleware:[jt(4),xe(),M({padding:8}),Ee({apply({availableHeight:e}){n.isConnected&&n.style.setProperty(`--suggestion-menu-max-height`,`${Math.min(e,window.innerHeight*.4)}px`)}})]}).then(({x:e,y:t})=>{n.isConnected&&(n.style.left=`${e}px`,n.style.top=`${t}px`,i&&!a&&(n.style.removeProperty(`visibility`),a=!0))}).catch(e=>{n.isConnected&&console.warn(`[${t}] computePosition failed`,e)}))};return{popup:n,doPosition:o,startAutoUpdate:()=>E(r,n,o),reveal:()=>{a||(i=!0,o())}}}function Hy(e){e.stopAutoUpdate?.(),e.stopAutoUpdate=null,e.popup?.remove(),e.popup=null}var Uy=new W(`tagSuggestion`),Wy=8,Gy=/^[a-zA-Z][\w/-]*$/;async function Ky(){let e=await fetch(`/api/tags`);if(!e.ok)throw Error(`/api/tags responded with ${e.status}`);let t=await e.json();return Array.isArray(t.tags)?t.tags:[]}function qy(e,t){let n=t.trim(),r=n.toLowerCase(),i=n===``?e.slice():e.filter(e=>e.name.toLowerCase().includes(r));return i.sort((e,t)=>{let n=+!e.name.toLowerCase().startsWith(r),i=+!t.name.toLowerCase().startsWith(r);return n===i?t.count===e.count?e.name.localeCompare(t.name):t.count-e.count:n-i}),i}function Jy(e,t){let n=qy(e,t).slice(0,Wy).map(e=>({kind:`tag`,value:e.name,count:e.count,isLeaf:e.isLeaf})),r=t.trim();return r&&Gy.test(r)&&!e.some(e=>e.name===r)&&n.push({kind:`create`,value:r}),n}function Yy(e){let{$position:t}=e,n=t.parent.textBetween(0,t.parentOffset,void 0,``).match(/(^|[\s])#([a-zA-Z][\w/-]*)?$/);if(!n)return null;let r=n[2]??``,i=t.start(),a=n[1].length;return{range:{from:i+((n.index??0)+a),to:t.pos},query:r,text:`#${r}`}}function Xy(e){let t=[],n=!1,r=null,i=null;return Ny({editor:e,pluginKey:Uy,char:`#`,allowedPrefixes:null,findSuggestionMatch:Yy,allow:({editor:e})=>!By(e),items:async({query:e})=>{if(!n){r||=Ky();try{t=await r,i=null}catch(e){console.error(`[tag-suggestion] Failed to fetch tags:`,e),i=`Failed to load tags. Press Escape and type # again to retry, or continue typing to create a new tag.`,t=[]}finally{n=!0,r=null}}return Jy(t,e)},command:({editor:e,range:t,props:n})=>{try{let r=n.value;if(!r||!Gy.test(r))return;e.chain().focus().deleteRange(t).insertContent({type:`tag`,attrs:{value:r}}).insertContent(` `).run()}catch(e){console.error(`[tag-suggestion] command failed`,{item:n,range:t},e)}},render:()=>{let e=null,a=null,o=0,s={popup:null,stopAutoUpdate:null},c=null,l=null,u=e=>{a?.command(e)},d=e=>{o!==e&&(o=e,p(null))};function f(e,t,r){let a=t===null?!n:t;return{items:e.items,query:e.query??``,selectedIndex:o,onSelect:r,onHover:d,loading:a,error:i}}let p=t=>{!e||!a||e.updateProps(f(a,t,u))};return{onBeforeStart(t){a=t,o=0;let n=Vy(()=>a,`tag-suggestion`);s.popup=n.popup,c=n.doPosition,l=n.reveal,e=new Bl(Iy,{props:f(t,!0,u),editor:t.editor}),n.popup.appendChild(e.element),s.stopAutoUpdate=n.startAutoUpdate()},onStart(e){a=e,o=0,p(null),l?.()},onUpdate(e){a=e,o=Math.min(o,Math.max(0,e.items.length-1)),p(null),c?.()},onKeyDown({event:e}){if(!a)return!1;let t=a.items;if(e.key===`ArrowDown`)return t.length===0?!1:(o=(o+1)%t.length,p(null),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(o=(o-1+t.length)%t.length,p(null),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[o];if(e)return a.command(e),!0;let n=(a.query??``).trim();return n&&Gy.test(n)?(a.command({kind:`create`,value:n}),!0):!1}return e.key,!1},onExit(){Hy(s),c=null,l=null,e?.destroy(),e=null,a=null,o=0,t=[],i=null,n=!1,r=null}}}})}var Zy=1,Qy=.9,$y=.8,eb=.17,tb=.1,nb=.999,rb=.9999,ib=.99,ab=/[\\\/_+.#"@\[\(\{&]/,ob=/[\\\/_+.#"@\[\(\{&]/g,sb=/[\s-]/,cb=/[\s-]/g;function lb(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Zy:ib;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=lb(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Zy:ab.test(e.charAt(l-1))?(d*=$y,p=e.slice(i,l-1).match(ob),p&&i>0&&(d*=nb**+p.length)):sb.test(e.charAt(l-1))?(d*=Qy,m=e.slice(i,l-1).match(cb),m&&i>0&&(d*=nb**+m.length)):(d*=eb,i>0&&(d*=nb**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=rb)),(d<tb&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=lb(e,t,n,r,l+1,a+2,o),f*tb>d&&(d=f*tb)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ub(e){return e.toLowerCase().replace(cb,` `)}function db(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,lb(e,t,ub(e),ub(t),0,0,{})}var fb=`[cmdk-group=""]`,pb=`[cmdk-group-items=""]`,mb=`[cmdk-group-heading=""]`,hb=`[cmdk-item=""]`,gb=`${hb}:not([aria-disabled="true"])`,_b=`cmdk-item-select`,vb=`data-value`,yb=(e,t,n)=>db(e,t,n),bb=Y.createContext(void 0),xb=()=>Y.useContext(bb),Sb=Y.createContext(void 0),Cb=()=>Y.useContext(Sb),wb=Y.createContext(void 0),Tb=Y.forwardRef((e,t)=>{let n=zb(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=zb(()=>new Set),i=zb(()=>new Map),a=zb(()=>new Map),o=zb(()=>new Set),s=Lb(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=En(),y=En(),b=En(),x=Y.useRef(null),S=Hb();Rb(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Rb(()=>{S(6,k)},[]);let C=Y.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=Y.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??yb;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(pb);t?t.appendChild(e.parentElement===t?e:e.closest(`${pb} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${pb} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${fb}[${vb}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(vb);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(fb)?.querySelector(mb))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${hb}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(gb)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(vb))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(vb))}function P(e){let t=A()?.closest(fb),n;for(;t&&!n;)t=e>0?Fb(t,fb):Ib(t,fb),n=t?.querySelector(gb);n?C.setState(`value`,n.getAttribute(vb)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return Y.createElement(Sn.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(_b);t.dispatchEvent(e)}}}}},Y.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Gb},c),Wb(e,e=>Y.createElement(Sb.Provider,{value:C},Y.createElement(bb.Provider,{value:w},e))))}),Eb=Y.forwardRef((e,t)=>{let n=En(),r=Y.useRef(null),i=Y.useContext(wb),a=xb(),o=Lb(e),s=o.current?.forceMount??i?.forceMount;Rb(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Vb(n,r,[e.value,e.children,r],e.keywords),l=Cb(),u=Bb(e=>e.value&&e.value===c.current),d=Bb(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);Y.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(_b,f),()=>t.removeEventListener(_b,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return Y.createElement(Sn.div,{ref:jn(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Db=Y.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=En(),s=Y.useRef(null),c=Y.useRef(null),l=En(),u=xb(),d=Bb(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);Rb(()=>u.group(o),[]),Vb(o,s,[e.value,e.heading,c]);let f=Y.useMemo(()=>({id:o,forceMount:i}),[i]);return Y.createElement(Sn.div,{ref:jn(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&Y.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Wb(e,e=>Y.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Y.createElement(wb.Provider,{value:f},e))))}),Ob=Y.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Y.useRef(null),a=Bb(e=>!e.search);return!n&&!a?null:Y.createElement(Sn.div,{ref:jn(i,t),...r,"cmdk-separator":``,role:`separator`})}),kb=Y.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Cb(),o=Bb(e=>e.search),s=Bb(e=>e.selectedItemId),c=xb();return Y.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Y.createElement(Sn.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ab=Y.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Y.useRef(null),o=Y.useRef(null),s=Bb(e=>e.selectedItemId),c=xb();return Y.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Y.createElement(Sn.div,{ref:jn(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Wb(e,e=>Y.createElement(`div`,{ref:jn(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),jb=Y.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Y.createElement(Vn,{open:n,onOpenChange:r},Y.createElement(Wn,{container:o},Y.createElement(Ln,{"cmdk-overlay":``,className:i}),Y.createElement(In,{"aria-label":e.label,"cmdk-dialog":``,className:a},Y.createElement(Tb,{ref:t,...s}))))}),Mb=Y.forwardRef((e,t)=>Bb(e=>e.filtered.count===0)?Y.createElement(Sn.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Nb=Y.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Y.createElement(Sn.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Wb(e,e=>Y.createElement(`div`,{"aria-hidden":!0},e)))}),Pb=Object.assign(Tb,{List:Ab,Item:Eb,Input:kb,Group:Db,Separator:Ob,Dialog:jb,Empty:Mb,Loading:Nb});function Fb(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ib(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Lb(e){let t=Y.useRef(e);return Rb(()=>{t.current=e}),t}var Rb=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function zb(e){let t=Y.useRef();return t.current===void 0&&(t.current=e()),t}function Bb(e){let t=Cb(),n=()=>e(t.snapshot());return Y.useSyncExternalStore(t.subscribe,n,n)}function Vb(e,t,n,r=[]){let i=Y.useRef(),a=xb();return Rb(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(vb,s),i.current=s}),i}var Hb=()=>{let[e,t]=Y.useState(),n=zb(()=>new Map);return Rb(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ub(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Wb({asChild:e,children:t},n){return e&&Y.isValidElement(t)?Y.cloneElement(Ub(t),{ref:t.ref},n(t.props.children)):n(t)}var Gb={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function Kb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb,{"data-slot":`command`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qb(e){let t=(0,J.c)(34),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({title:o,description:s,children:n,className:r,showCloseButton:c,commandProps:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`Command Palette`:o,u=s===void 0?`Search for a command to run`:s,d=c===void 0?!0:c,f;t[8]===i?f=t[9]:(f=i??{},t[8]=i,t[9]=f);let p,m;t[10]===f?(p=t[11],m=t[12]):({className:p,...m}=f,t[10]=f,t[11]=p,t[12]=m);let h;t[13]===r?h=t[14]:(h=pn(`top-[12vh] translate-y-0 overflow-hidden p-0`,r),t[13]=r,t[14]=h);let g;t[15]===l?g=t[16]:(g=(0,X.jsx)(Fn,{className:`sr-only`,children:l}),t[15]=l,t[16]=g);let _;t[17]===u?_=t[18]:(_=(0,X.jsx)(Pn,{className:`sr-only`,children:u}),t[17]=u,t[18]=_);let v;t[19]===p?v=t[20]:(v=pn(`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,p),t[19]=p,t[20]=v);let y;t[21]!==n||t[22]!==m||t[23]!==v?(y=(0,X.jsx)(Kb,{className:v,...m,children:n}),t[21]=n,t[22]=m,t[23]=v,t[24]=y):y=t[24];let b;t[25]!==d||t[26]!==h||t[27]!==g||t[28]!==_||t[29]!==y?(b=(0,X.jsxs)(zn,{className:h,showCloseButton:d,children:[g,_,y]}),t[25]=d,t[26]=h,t[27]=g,t[28]=_,t[29]=y,t[30]=b):b=t[30];let x;return t[31]!==a||t[32]!==b?(x=(0,X.jsx)(qn,{...a,children:b}),t[31]=a,t[32]=b,t[33]=x):x=t[33],x}function Jb(e){let t=(0,J.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(ba,{className:`size-4 shrink-0 opacity-50`}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=pn(`flex w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,X.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex items-center gap-2 border-b px-3`,children:[i,(0,X.jsx)(Pb.Input,{"data-slot":`command-input`,className:a,...r})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function Yb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb.List,{"data-slot":`command-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xb(e){let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Pb.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e}),t[0]=e,t[1]=n),n}function Zb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-mono [&_[cmdk-group-heading]]:uppercase **:[[cmdk-group-heading]]:tracking-wider`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qb(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Pb.Item,{"data-slot":`command-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $b(e){let t=(0,J.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=pn(`ml-auto text-muted-foreground text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`span`,{"data-slot":`command-shortcut`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function ex(e,t){let n=null,r;try{n=await e.json()}catch(e){r=e}if(e.ok)return r!==void 0&&console.warn(`[parse-server-response] 2xx response with non-JSON body:`,r instanceof Error?r.message:String(r)),{ok:!0,body:r===void 0?n:null};if(r!==void 0){let t=r instanceof Error?r.message:String(r);return{ok:!1,title:`Server error (HTTP ${e.status}): ${t}`}}return{ok:!1,title:d(n)??t}}function tx(e,t,n,r){let i=e.safeParse(t);return i.success?i.data:(console.warn(`[parse-server-response] schema drift:`,n,`bodyShape=`,typeof t==`object`&&t?Object.keys(t):typeof t,`issues=`,i.error.issues),r)}var nx=new Map,rx=null;function ix(){return dc(`PREWARM_CORRELATION_WINDOW_MS`,5e3)}function ax(){if(rx!==null)return;let e=Math.max(50,Math.floor(ix()/2));rx=setTimeout(()=>{rx=null,ox(Date.now()),nx.size>0&&ax()},e)}function ox(e){let t=ix();for(let[n,r]of nx)e-r.emittedAt>=t&&(nx.delete(n),Z.count(`ok/sidebar/prewarm`,{hit:!1}))}function sx(e,t,n=Date.now()){nx.has(e)&&Z.count(`ok/sidebar/prewarm`,{hit:!1}),nx.set(e,{poolEventId:t,emittedAt:n}),ax()}function cx(e,t,n=Date.now()){let r=nx.get(e);return!r||r.poolEventId!==t||n-r.emittedAt>=ix()?!1:(nx.delete(e),Z(`ok/sidebar/prewarm-clicked`,{docName:e,t:n,poolEventId:t}),Z.count(`ok/sidebar/prewarm`,{hit:!0}),!0)}en({event:p(`ok-branch-switched-clear-failed`),branch:pe(),docName:pe(),reason:pe()});async function lx(e,t){let n=[];for(let[r,i]of e.entries)i.kind===`active`&&i.persistence!==null&&n.push(i.persistence.clearData().catch(e=>{let n={event:`ok-branch-switched-clear-failed`,docName:r,branch:t,reason:e instanceof Error?e.message:String(e)};console.warn(JSON.stringify(n))}));await Promise.all(n),e.clearBufferedUpdates(),e.recycleAllEntries()}function ux(e){let t=!1;return()=>{t?e():t=!0}}function dx(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}async function fx(e,t=``){let n;try{n=await fetch(`${t}/api/server-info`,{signal:AbortSignal.timeout(5e3)})}catch{return}if(!n.ok)return;let r;try{r=await n.json()}catch{return}let i=St.safeParse(r);if(!i.success){console.warn(JSON.stringify({event:`ok-server-info-schema-mismatch`,issues:i.error.issues}));return}if(e.setExpectedServerInstanceId(i.data.serverInstanceId),i.data.currentBranch!==void 0&&e.compareAndUpdateObservedBranch(i.data.currentBranch)&&lx(e,i.data.currentBranch),i.data.currentDiskAckSVs!==void 0){let t={};for(let[e,n]of Object.entries(i.data.currentDiskAckSVs))try{t[e]=dx(n)}catch{}e.observeDiskAckBatch(t)}}async function px(e){let t;try{t=await fetch(`/api/config`,{signal:e,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return{status:`error`,code:`network`}}if(t.status===404||t.status===501)return{status:`absent`};if(!t.ok)return{status:`error`,code:t.status};let n;try{n=await t.json()}catch{return{status:`error`,code:`invalid-body`}}if(typeof n!=`object`||!n||Array.isArray(n))return{status:`error`,code:`invalid-body`};let r=n;return{status:`ok`,config:{collabUrl:typeof r.collabUrl==`string`?r.collabUrl:null,previewUrl:typeof r.previewUrl==`string`?r.previewUrl:null,port:typeof r.port==`number`?r.port:0}}}function mx(e){return Sx(e,qt)}function hx(e){return Sx(e,Je)}function gx(e){return Sx(e,Vt)}function _x(e){return Sx(e,gt)}function vx(e){return Sx(e,ze)}function yx(e){let t=Sx(e,Ue);if(!t)return null;try{return{docName:t.docName,sv:bx(t.sv)}}catch{return null}}function bx(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function xx(e,t){let n=hx(e);if(n){t.onServerInfo?.(n);return}let r=gx(e);if(r){t.onBranchSwitched?.(r);return}let i=yx(e);if(i){t.onDiskAck?.(i);return}let a=mx(e);if(a){t.onDerivedView?.(a);return}let o=_x(e);if(o){t.onConfigValidationRejected?.(o);return}let s=vx(e);if(s){t.onConfigIgnoreNestedError?.(s);return}t.onUnknown?.(e)}function Sx(e,t){let n;try{n=JSON.parse(e)}catch{return null}let r=t.safeParse(n);return r.success?r.data:null}function Cx(){return typeof location>`u`?`ws://localhost/collab`:`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/collab`}function wx(e){if(e===void 0)return null;let t=e.okDesktop;return!t||!t.config.collabUrl||t.config.collabUrl.length===0?null:t}function Tx(e){return{collabUrl:e.collabUrl,attempts:0,terminal:!1,lastError:null}}var Ex=2e3,Dx=15e3;function Ox(e){let t=e.terminalAfterMs??3e4,n=e.initialDelayMs??Ex,r=e.maxDelayMs??Dx,i=e.log??{info:console.info,warn:console.warn},a=new AbortController,o=null,s=n,c=0,l=!1,u=!1,d=null,f=e.now(),p=async()=>{c+=1;let n=null;try{let t=await e.fetchConfig(a.signal);t.status===`absent`?(n=e.fallbackUrl(),d=null):t.status===`ok`&&t.config.collabUrl!==null?(n=t.config.collabUrl,d=null):t.status===`ok`?(u||(u=!0,i.info(`[collab-url] ok ui responded but server.lock has no port yet — retrying`)),d={kind:`null-collab`}):t.status===`error`&&(i.warn(`[collab-url] /api/config error (${t.code}) — retrying in ${s}ms`),d={kind:`error`,code:t.code})}catch(e){if(e.name===`AbortError`)return;d={kind:`error`,code:`network`}}if(!l){if(n!==null){e.onStateChange({collabUrl:n,attempts:c,terminal:!1,lastError:null});return}if(e.now()-f>=t){e.onStateChange({collabUrl:null,attempts:c,terminal:!0,lastError:d});return}e.onStateChange({collabUrl:null,attempts:c,terminal:!1,lastError:d}),o=e.setTimeout(()=>{p()},s),s=Math.min(s*2,r)}};return p(),{cancel:()=>{l=!0,a.abort(),o!==null&&(e.clearTimeout(o),o=null)}}}function kx(){let e=(0,J.c)(8),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={collabUrl:null,attempts:0,terminal:!1,lastError:null},e[0]=t):t=e[0];let[n,r]=(0,Y.useState)(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i={token:0},e[1]=i):i=e[1];let a=(0,Y.useRef)(i),[o,s]=(0,Y.useState)(0),c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=a.current.token=a.current.token+1,t=wx(window);if(t){r(Tx(t.config));let n=t.onProjectSwitched(t=>{e===a.current.token&&r(Tx(t))});return()=>{n()}}let n=Ox({fetchConfig:px,fallbackUrl:Cx,now:Date.now,setTimeout:Nx,clearTimeout:Mx,onStateChange:t=>{e===a.current.token&&r(t)}});return()=>{n.cancel()}},e[2]=c):c=e[2];let l;e[3]===o?l=e[4]:(l=[o],e[3]=o,e[4]=l),(0,Y.useEffect)(c,l);let u;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a.current.token=a.current.token+1,r(jx),s(Ax)},e[5]=u):u=e[5];let d=u,f;return e[6]===n?f=e[7]:(f={...n,retry:d},e[6]=n,e[7]=f),f}function Ax(e){return e+1}function jx(e){return{...e,terminal:!1,lastError:null}}function Mx(e){return globalThis.clearTimeout(e)}function Nx(e,t){return globalThis.setTimeout(e,t)}var Px=new Map,Fx=new Set;function Ix(){for(let e of Fx)e()}function Lx(e,t){Px.set(e,t),Ix()}function Rx(e,t){Px.get(e)===t&&(Px.delete(e),Ix())}function zx(e){return Px.get(e)??null}function Bx(e){return Fx.add(e),()=>Fx.delete(e)}var Vx=new Map;function Hx(e){return Vx.get(e)}function Ux(e,t){Vx.set(e,t)}function Wx(e){Vx.delete(e)}var Gx=`open-knowledge-app`,Kx=new Map,qx=new Set,Jx=1024,Yx=1024;function Xx(){return nr.getTracer(Gx)}function Zx(e,t,n){if(qx.has(e))return null;let r=Kx.get(e);if(r)return r;if(Kx.size>=Yx){let e=Kx.keys().next().value;if(e!==void 0){let t=Kx.get(e);Kx.delete(e);try{t?.span.end()}catch(e){console.warn(`[otel-spans] eviction span.end failed:`,e instanceof Error?e:String(e))}}}let i={span:Xx().startSpan(`ok.cold-mount`,{attributes:{"mount.id":e,...t},startTime:n}),startTimeMs:n};return Kx.set(e,i),i}function Qx(e,t,n,r,i){try{let a=Zx(e,n,r),o=a?nr.setSpan(rr.active(),a.span):rr.active();Xx().startSpan(t,{attributes:{"mount.id":e,...n},startTime:r},o).end(i??Date.now())}catch(e){console.warn(`[otel-spans] emitColdMountChild failed:`,e instanceof Error?e:String(e))}}function $x(e,t){try{let n=Kx.get(e);if(n&&(Kx.delete(e),n.span.end(t??Date.now())),!qx.has(e)){if(qx.size>=Jx){let e=qx.values().next().value;e!==void 0&&qx.delete(e)}qx.add(e)}}catch(e){console.warn(`[otel-spans] finalizeColdMountSpan failed:`,e instanceof Error?e:String(e))}}var eS=class extends Error{docName;constructor(e){super(`Mount aborted for "${e}"`),this.name=`MountAbortError`,this.docName=e}};function tS(){return dc(`MOUNT_STALLED_THRESHOLD_MS`,1e4)}function nS(e){e.stalledHandle!==null&&(clearTimeout(e.stalledHandle),e.stalledHandle=null)}function rS(e,t,n){if(e.stalledMarkEmitted)return;e.stalledMarkEmitted=!0;let r=n-e.createdAt;Z(`ok/mount/stalled`,{docName:t,mountId:e.mountId,elapsedMs:r})}var iS=new Map,aS=new Set;function oS(e){aS.add(e);for(let[t,n]of iS)if(n.stalledMarkEmitted&&!n.settled)try{e(t,n.mountId)}catch{}return()=>{aS.delete(e)}}function sS(e,t){for(let n of aS)try{n(e,t.mountId)}catch{}}var cS=!1;function lS(){typeof document>`u`||document.visibilityState===`visible`&&fS(Date.now())}function uS(){cS||typeof document>`u`||typeof document.addEventListener==`function`&&(document.addEventListener(`visibilitychange`,lS),cS=!0)}function dS(){cS&&(typeof document>`u`||typeof document.removeEventListener==`function`&&(document.removeEventListener(`visibilitychange`,lS),cS=!1))}function fS(e){let t=tS();for(let[n,r]of iS)r.settled||r.stalledMarkEmitted||e-r.createdAt<t||(rS(r,n,e),sS(n,r))}function pS(e){let{docName:t,mountId:n,construct:r,sizeStats:i}=e,a=iS.get(t);if(a)return a.promise;let o=new AbortController,s=Date.now(),c=()=>{},l=()=>{},u=new Promise((e,t)=>{c=e,l=t}),d={promise:u,rejectFn:l,controller:o,mountId:n,createdAt:s,settled:!1,resolved:!1,preMountEditor:null,stalledHandle:null,stalledMarkEmitted:!1};return d.stalledHandle=setTimeout(()=>{d.settled||(rS(d,t,Date.now()),sS(t,d))},tS()),o.signal.addEventListener(`abort`,()=>{d.settled||(d.settled=!0,nS(d),d.preMountEditor&&=(_S(t,d.preMountEditor,`aborted`),null),iS.delete(t),iS.size===0&&dS(),Z(`ok/mount/reject`,{docName:t,mountId:d.mountId,reason:`aborted`}),l(new eS(t)),$x(d.mountId))}),iS.set(t,d),uS(),Z(`ok/mount/create`,{docName:t,mountId:d.mountId}),vS({docName:t,construct:r,sizeStats:i,entry:d,resolveFn:c,rejectFn:l}).catch(e=>{if(d.preMountEditor&&=(_S(t,d.preMountEditor,`backstop`),null),d.settled){Z(`ok/mount/post-settle-throw`,{docName:t,mountId:d.mountId,message:e instanceof Error?e.message:String(e)});return}d.settled=!0,nS(d);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:d.mountId,reason:`unhandled-body-throw`}),l(n),$x(d.mountId)}),u}function mS(e){return iS.get(e)?.resolved===!0}function hS(e){return iS.get(e)?.controller??null}function gS(e){let t=iS.get(e);t&&(t.settled=!0,nS(t),t.preMountEditor&&=(_S(e,t.preMountEditor,`aborted`),null),iS.delete(e),iS.size===0&&dS(),Z(`ok/mount/invalidate`,{docName:e,mountId:t.mountId}),$x(t.mountId),t.controller.abort())}function _S(e,t,n){let r=yS(t);try{t.destroy()}catch(t){Z(`ok/mount/destroy-failed`,{docName:e,stage:n,message:t instanceof Error?t.message:String(t)})}r&&(r.restore=void 0)}async function vS(e){let{docName:t,construct:n,sizeStats:r,entry:i,resolveFn:a,rejectFn:o}=e,s=document.createElement(`div`);if($S(t)!==void 0){let e=LS({docName:t,container:s,factory:()=>{throw Error(`mount-promise: V2 cache contract violation — factory invoked on HIT for "${t}"`)}});i.settled=!0,i.resolved=!0,nS(i),a(e);return}if(await scheduler.yield(),i.controller.signal.aborted)return;let c=null;try{c=n()}catch(e){i.settled=!0,nS(i);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:i.mountId,reason:`construct-failed`}),o(n),$x(i.mountId);return}if(i.preMountEditor=c.editor,await scheduler.yield(),i.controller.signal.aborted){i.preMountEditor=null;return}try{c.editor.mount(s)}catch(e){_S(t,c.editor,`mount-failed`),i.preMountEditor=null,i.settled=!0,nS(i);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:i.mountId,reason:`mount-failed`}),o(n),$x(i.mountId);return}let l;try{l=LS({docName:t,container:s,sizeStats:r,factory:()=>c})}catch(e){_S(t,c.editor,`v2-register-failed`),i.preMountEditor=null,i.settled=!0,nS(i);let n=e instanceof Error?e:Error(String(e));Z(`ok/mount/reject`,{docName:t,mountId:i.mountId,reason:`v2-register-failed`}),o(n),$x(i.mountId);return}i.preMountEditor=null,i.settled=!0,i.resolved=!0,nS(i);let u=Date.now()-i.createdAt;Z(`ok/mount/resolve`,{docName:t,mountId:i.mountId,elapsedMs:u}),Z.histogram(`ok/mount/resolve-elapsed-ms`,{docName:t,mountId:i.mountId},u),a(l);let d=Date.now();Qx(i.mountId,`ok.mount-promise`,{"doc.name":t,elapsed_ms:u},i.createdAt,d),$x(i.mountId,d)}function yS(e){try{let t=e.state;return kv.getState(t)?.undoManager??null}catch(e){return Z(`ok/cache/undo-manager-read-failed`,{message:e instanceof Error?e.message:String(e)}),null}}var bS=dc(`MAX_CACHE`,10),xS=dc(`VIEW_COUNT_CACHE_THRESHOLD`,50),SS=dc(`BYTES_CACHE_THRESHOLD`,8e6);function CS(e){return!(e.viewCount>0&&e.viewCount>=xS||e.bytes>SS)}var wS=new Map,TS=new Map,ES=new Map;function DS(e,t){if(ES.size>=bS){let e=ES.keys().next().value;e!==void 0&&ES.delete(e)}ES.set(e,t),Z(`ok/cache/snapshot-stored`,{toDocName:e,htmlBytes:t.html.length,hasScroll:t.scrollTop>0,hasSelection:t.selection!==null})}function OS(e){return ES.get(e)??null}function kS(e){if(!ES.has(e))return;let t=ES.get(e)??null;ES.delete(e),Z(`ok/cache/snapshot-consumed`,{docName:e,hit:t!==null,hasScroll:t!==null&&t.scrollTop>0,hasSelection:t!==null&&t.selection!==null})}function AS(){try{return typeof document>`u`?0:document.querySelector(`[data-testid="editor-scroll-container"]`)?.scrollTop??0}catch(e){return Z(`ok/cache/snapshot-scroll-read-failed`,{message:e instanceof Error?e.message:String(e)}),0}}function jS(e){try{let t=e.state.selection;return t instanceof vt?{type:`text`,anchor:t.anchor,head:t.head}:t instanceof pt?{type:`node`,from:t.from}:null}catch(e){return Z(`ok/cache/snapshot-selection-read-failed`,{message:e instanceof Error?e.message:String(e)}),null}}function MS(e){for(let t of e)try{let e=$S(t.fromDocName);e&&!e.editor.isDestroyed?DS(t.toDocName,{html:e.editor.getHTML(),scrollTop:AS(),selection:jS(e.editor)}):Z(`ok/cache/snapshot-skipped`,{fromDocName:t.fromDocName})}catch(e){Z(`ok/cache/snapshot-capture-failed`,{fromDocName:t.fromDocName,message:e instanceof Error?e.message:String(e)})}}var NS=[],PS=[],FS=new Set;function IS(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-parking`,``),e.style.display=`none`,e.style.position=`absolute`,e.style.left=`-99999px`,e}function LS(e){let{docName:t,container:n,factory:r,sizeStats:i}=e;if(i&&!CS(i)){let e=r(n);return Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`size-gate`}),{editor:e.editor,ydoc:e.ydoc,ytext:e.ytext,provider:e.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null,__uncached:!0}}let a=wS.get(t);if(a){if(Z(`ok/cache/reparent-start`,{docName:t,mountId:Hx(t),kind:`tiptap`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),GS(a,n),a.activeMountKey=t,qS(NS,t),n.scrollTop=a.scrollTop,a.hadFocus)try{a.editor.commands.focus()}catch{}return Z(`ok/cache/reparent-end`,{docName:t,mountId:Hx(t),kind:`tiptap`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),Z(`ok/cache/hit`,{docName:t,mountId:Hx(t),kind:`tiptap`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!0,kind:`tiptap`}),a}for(;wS.size>=bS;){let e=JS(NS,t);if(!e)break;zS(e)}let o=r(n),s={editor:o.editor,ydoc:o.ydoc,ytext:o.ytext,provider:o.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null};return wS.set(t,s),qS(NS,t),Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`cold`,kind:`tiptap`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!1,kind:`tiptap`}),s}function RS(e){let t=e.activeMountKey;if(e.__uncached){t&&gS(t);let n=yS(e.editor);try{e.editor.destroy()}catch(e){Z(`ok/cache/park-destroy-failed`,{docName:t??``,kind:`tiptap`,message:e instanceof Error?e.message:String(e)})}n&&(n.restore=void 0),e.activeMountKey=null;return}let n=US(e.editor);if(n){e.hadFocus=WS(n.dom),e.scrollTop=(n.scrollDOM??n.dom.parentElement??n.dom).scrollTop??0;let t=n.dom.parentElement;t&&t.removeChild(n.dom),e.parkingNode||=IS(),e.parkingNode&&e.parkingNode.appendChild(n.dom)}e.activeMountKey=null}function zS(e){gS(e);let t=wS.get(e);if(!t)return!1;let n=yS(t.editor);try{t.editor.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`tiptap`,stage:`editor`,message:t instanceof Error?t.message:String(t)})}n&&(n.restore=void 0);try{t.provider.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`tiptap`,stage:`provider`,message:t instanceof Error?t.message:String(t)})}try{t.ydoc.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`tiptap`,stage:`ydoc`,message:t instanceof Error?t.message:String(t)})}wS.delete(e);let r=NS.indexOf(e);return r!==-1&&NS.splice(r,1),Z(`ok/cache/evict`,{docName:e,kind:`tiptap`}),!0}function BS(e){let{docName:t,container:n,factory:r,sizeStats:i}=e;if(i&&!CS(i)){let e=r(n);return Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`size-gate`,kind:`cm`}),{view:e.view,ydoc:e.ydoc,ytext:e.ytext,provider:e.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null,__uncached:!0}}let a=TS.get(t);if(a){if(Z(`ok/cache/reparent-start`,{docName:t,mountId:Hx(t),kind:`cm`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),KS(a,n),a.activeMountKey=t,qS(PS,t),n.scrollTop=a.scrollTop,a.hadFocus)try{a.view.focus()}catch{}return Z(`ok/cache/reparent-end`,{docName:t,mountId:Hx(t),kind:`cm`,viewCount:i?.viewCount??-1,bytes:i?.bytes??-1}),Z(`ok/cache/hit`,{docName:t,mountId:Hx(t),kind:`cm`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!0,kind:`cm`}),a}for(;TS.size>=bS;){let e=JS(PS,t);if(!e)break;HS(e)}let o=r(n),s={view:o.view,ydoc:o.ydoc,ytext:o.ytext,provider:o.provider,scrollTop:0,hadFocus:!1,activeMountKey:t,parkingNode:null};return TS.set(t,s),qS(PS,t),Z(`ok/cache/miss`,{docName:t,mountId:Hx(t),viewCount:i?.viewCount??-1,bytes:i?.bytes??-1,reason:`cold`,kind:`cm`}),i&&Z(`ok/cold/editor-mount-stats`,{docName:t,mountId:Hx(t),viewCount:i.viewCount,bytes:i.bytes,cacheHit:!1,kind:`cm`}),s}function VS(e){if(e.__uncached){try{e.view.destroy()}catch(t){Z(`ok/cache/park-destroy-failed`,{docName:e.activeMountKey??``,kind:`cm`,message:t instanceof Error?t.message:String(t)})}e.activeMountKey=null;return}let t=e.view.dom;e.hadFocus=WS(t),e.scrollTop=(e.view.scrollDOM??t).scrollTop??0;let n=t.parentElement;n&&n.removeChild(t),e.parkingNode||=IS(),e.parkingNode&&e.parkingNode.appendChild(t),e.activeMountKey=null}function HS(e){let t=TS.get(e);if(!t)return!1;try{t.view.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`cm`,stage:`view`,message:t instanceof Error?t.message:String(t)})}try{t.provider.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`cm`,stage:`provider`,message:t instanceof Error?t.message:String(t)})}try{t.ydoc.destroy()}catch(t){Z(`ok/cache/evict-failed`,{docName:e,kind:`cm`,stage:`ydoc`,message:t instanceof Error?t.message:String(t)})}TS.delete(e);let n=PS.indexOf(e);return n!==-1&&PS.splice(n,1),Z(`ok/cache/evict`,{docName:e,kind:`cm`}),!0}function US(e){return e.editorView??null}function WS(e){if(typeof document>`u`)return!1;let t=document.activeElement;return t?t===e?!0:e.contains(t):!1}function GS(e,t){let n=US(e.editor);if(!n)return;let r=n.dom,i=r.parentElement;i&&i!==t&&i.removeChild(r),r.parentElement!==t&&t.appendChild(r)}function KS(e,t){let n=e.view.dom,r=n.parentElement;r&&r!==t&&r.removeChild(n),n.parentElement!==t&&t.appendChild(n)}function qS(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1),e.push(t)}function JS(e,t){for(let n of e)if(n!==t&&!FS.has(n))return n;Z(`ok/cache/evict-fallback-activity-saturated`,{mountingDocName:t,lruLength:e.length,activityMountCount:FS.size});for(let n of e)if(n!==t)return n;return null}function YS(e){let t=FS,n=new Set(e);for(let e of t){if(n.has(e))continue;let t=ZS(e);if(t)try{t.disconnect(),Z(`ok/cache/disconnect`,{docName:e})}catch(t){Z(`ok/cache/disconnect-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}}for(let e of n){if(t.has(e))continue;let n=ZS(e);if(!n)continue;let r=t=>{Z(`ok/cache/connect-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})};try{let t=n.connect();t&&typeof t.then==`function`?t.then(()=>Z(`ok/cache/connect`,{docName:e}),e=>r(e)):Z(`ok/cache/connect`,{docName:e})}catch(e){r(e)}}FS=n}var XS=null;function ZS(e){let t=wS.get(e);if(t)return t.provider;let n=TS.get(e);if(n)return n.provider;if(XS){let t=XS.entries.get(e);if(t)return t.provider}return null}function QS(e){XS=e;let t=e.onEvict(e=>{zS(e),HS(e)});return()=>{t(),XS===e&&(XS=null)}}function $S(e){return wS.get(e)}var eC=`ok-editor-tabs-v1:`,tC=`\0folder:`,nC=`\0asset:`,rC=`\0doc-tab:`;function iC(e){let t=e.lastIndexOf(rC);return t<0?{baseTabId:e,instanceSuffix:``}:{baseTabId:e.slice(0,t),instanceSuffix:e.slice(t)}}function aC(e){return iC(e).baseTabId}function oC(e){if(typeof e!=`string`||e.length===0)return!1;let t=aC(e);return t.startsWith(tC)?t.length>8:t.startsWith(nC)?t.length>7:!0}function sC(e){return e}function cC(e,t){return`${aC(e)}${rC}${t}`}function lC(e,t){return uC(e,sC(t))}function uC(e,t){let n=yC(e,2**53-1),r=aC(t);if(!n.includes(r))return r;let i=1,a;do a=cC(r,i),i++;while(n.includes(a));return a}function dC(e,t){let n=aC(t);return yC(e,2**53-1).find(e=>aC(e)===n)??null}function fC(e,t){return aC(e)===aC(t)}function pC(e){return`${tC}${e}`}function mC(e){return`${nC}${e}`}function hC(e,t){let n=e.lastIndexOf(`/`),r=n<0?e:e.slice(n+1),i=`${r}${t}`;return n<0?{baseName:r,extension:t,label:i,prefix:``}:{baseName:r,extension:t,label:i,prefix:`${e.slice(0,n)}/`}}function gC(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return sC(e.docName);case`folder`:return pC(e.folderPath);case`missing`:return sC(e.target);case`asset`:return mC(e.assetPath)}}function _C(e){let t=aC(e);return t.startsWith(tC)?{kind:`folder`,folderPath:t.slice(8)}:t.startsWith(nC)?{kind:`asset`,assetPath:t.slice(7)}:{kind:`doc`,docName:t}}function vC(e){let t=_C(e);return t.kind===`doc`?t.docName:null}function yC(e,t){if(!Array.isArray(e)||t<=0)return[];let n=[],r=new Set;for(let i of e)if(oC(i)&&!r.has(i)&&(r.add(i),n.push(i),n.length>=t))break;return n}function bC(e,t){let n=new Set(yC(t,2**53-1));return yC(e,2**53-1).filter(e=>n.has(e))}function xC(e,t,n){if(t<=0)return[];let r=new Set(yC(n,2**53-1)),i=yC(e,2**53-1);if(r.size===0&&i.length<=t)return i;let a=[],o=0;for(let e=i.length-1;e>=0;e--){let n=i[e];if(r.has(n)){a.push(n);continue}o>=t||(o++,a.push(n))}return a.reverse()}function SC(e,t,n){let r=bC(e,n);return!yC(n,2**53-1).includes(t)||r.includes(t)?r:[...r,t]}function CC(e,t){return yC(e,2**53-1).filter(e=>e!==t)}function wC(e,t){let n=new Set(yC(t,2**53-1));return yC(e,2**53-1).filter(e=>!n.has(e))}function TC(e,t,n){let r=yC(e,2**53-1),i=bC(t,r),a=r.indexOf(n);if(a<0)return i;let o=i.includes(n),s=a<i.length;return o===s?i:s?SC(i,n,r):CC(i,n)}function EC(e,t,n,r=[]){let i=xC(e,n,r);return!oC(t)||i.includes(t)?i:xC([...i,t],n,r)}function DC(e,t,n,r,i=[]){let a=xC(e,r,i);if(!oC(n))return a;if(!t||t===n)return EC(a,n,r,i);let o=a.filter(e=>e!==n),s=o.indexOf(t);if(s<0)return EC(o,n,r,i);let c=[...o];return c[s]=n,xC(c,r,i)}function OC(e,t,n){return kC(e,sC(t),n)}function kC(e,t,{behavior:n,currentTabId:r,limit:i,pinnedTabIds:a=[]}){let o=xC(e,i,a),s=aC(t);if(r&&o.includes(r)&&aC(r)===s)return{tabs:o,activeTabId:r};if(n!==`replace-active`)return{tabs:EC(o,s,i,a),activeTabId:s};let c=dC(o,s);if(c)return{tabs:o,activeTabId:c};let l=uC(o,s);return{tabs:DC(o,r,l,i,a),activeTabId:l}}function AC(e,t){return e.filter(e=>e!==t)}function jC(e,t,n){let r=yC(t,2**53-1),i=new Set(r),a=new Set(n),o=new Set,s=[];for(let t of e)o.has(t)||!i.has(t)&&!a.has(t)||(o.add(t),s.push(t));for(let e of[...r,...n])o.has(e)||(o.add(e),s.push(e));return s}function MC(e,{pages:t,folderPaths:n,assetPaths:r,keepMissingDocName:i=null}){return yC(e,2**53-1).filter(e=>{let a=_C(e);return a.kind===`folder`?n.has(a.folderPath):a.kind===`asset`?r.has(a.assetPath):t.has(a.docName)||a.docName===i})}function NC(e,t,n,r=[],i=[]){if(t.length===0&&r.length===0)return yC(e,n);let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=[],s=new Set;for(let t of e){let{instanceSuffix:e}=iC(t),c=_C(t),l=`${c.kind===`doc`?a.get(c.docName)??aC(t):c.kind===`folder`?pC(FC(c.folderPath,r)):mC(FC(c.assetPath,r))}${e}`;if(!s.has(l)&&(s.add(l),o.push(l),i.length===0&&o.length>=n))break}return i.length===0?o:xC(o,n,i.map(e=>{let t=_C(e);return t.kind===`doc`?a.get(t.docName)??e:t.kind===`folder`?pC(FC(t.folderPath,r)):mC(FC(t.assetPath,r))}))}function PC(e,t,n=[]){return NC(e,t,2**53-1,n)}function FC(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function IC(e,t,n){if(t!==n)return t;let r=e.indexOf(n);return r<0?e[0]??null:e[r+1]??e[r-1]??null}function LC(e,t,n){if(!t)return null;let r=new Set(n);if(!r.has(t))return t;let i=e.indexOf(t);if(i<0)return e.find(e=>!r.has(e))??null;for(let t=i+1;t<e.length;t++)if(!r.has(e[t]))return e[t];for(let t=i-1;t>=0;t--)if(!r.has(e[t]))return e[t];return null}function RC(e,t){if(typeof e!=`object`||!e)return{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null};let n=e,r=yC(n.openTabs,2**53-1),i=bC(n.pinnedTabIds,r),a=i.length===0?yC(n.openTabs,t):xC(r,t,i),o=bC(n.pinnedTabIds,a),s=typeof n.activeTabId==`string`&&a.includes(n.activeTabId)?n.activeTabId:typeof n.activeDocName==`string`&&a.includes(n.activeDocName)?n.activeDocName:null,c=s?_C(s):null;return{openTabs:a,pinnedTabIds:o,activeDocName:c?.kind===`doc`?c.docName:null,activeTabId:s,updatedAt:typeof n.updatedAt==`string`?n.updatedAt:null}}function zC(e,t,n=[],r=()=>new Date){let i=yC(e,2**53-1),a=t&&i.includes(t)?t:null,o=a?_C(a):null;return{openTabs:i,pinnedTabIds:bC(n,i),activeDocName:o?.kind===`doc`?o.docName:null,activeTabId:a,updatedAt:r().toISOString()}}function BC(e){return`${eC}${e}`}function VC(e,t,n){if(!e)return{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null};try{let r=e.getItem(t);return r?RC(JSON.parse(r),n):{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null}}catch(e){return console.warn(`[editor-tabs] failed to read local tab session:`,e),{openTabs:[],pinnedTabIds:[],activeDocName:null,activeTabId:null,updatedAt:null}}}function HC(e,t,n){if(e)try{e.setItem(t,JSON.stringify(n))}catch(e){console.warn(`[editor-tabs] failed to write local tab session:`,e)}}var UC=Math.floor,WC=(e,t)=>e<t?e:t,GC=(e,t)=>e>t?e:t;Number.isNaN;var KC=128,qC=1<<17,JC=1<<18,YC=1<<19,XC=1<<20,ZC=1<<21,QC=1<<22,$C=1<<23,ew=1<<24,tw=1<<25,nw=1<<26,rw=1<<27,iw=1<<28,aw=1<<29,ow=1<<30,sw=127;qC-1,JC-1,YC-1,XC-1,ZC-1,QC-1,$C-1,ew-1,tw-1,nw-1,rw-1,iw-1,aw-1,ow-1;var cw=2**53-1;Number.isInteger,Number.isNaN,Number.parseInt;var lw=String.fromCharCode;String.fromCodePoint,lw(65535);var uw=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},dw=typeof TextEncoder<`u`?new TextEncoder:null,fw=dw?e=>dw.encode(e):uw,pw=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});pw&&pw.decode(new Uint8Array).length===1&&(pw=null);var mw=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},hw=(e,t)=>{for(;t>sw;)mw(e,KC|sw&t),t=UC(t/128);mw(e,sw&t)},gw=new Uint8Array(3e4),_w=gw.length/3,vw=dw&&dw.encodeInto?(e,t)=>{if(t.length<_w){let n=dw.encodeInto(t,gw).written||0;hw(e,n);for(let t=0;t<n;t++)mw(e,gw[t])}else bw(e,fw(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;hw(e,r);for(let t=0;t<r;t++)mw(e,n.codePointAt(t))},yw=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=WC(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(GC(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},bw=(e,t)=>{hw(e,t.byteLength),yw(e,t)},xw=e=>Error(e),Sw=xw(`Unexpected end of array`),Cw=xw(`Integer out of Range`),ww=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},Tw=e=>ww(e,Dw(e)),Ew=e=>e.arr[e.pos++],Dw=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&sw)*n,n*=128,r<KC)return t;if(t>cw)throw Cw}throw Sw},Ow=pw?e=>pw.decode(Tw(e)):e=>{let t=Dw(e);if(t===0)return``;{let n=String.fromCodePoint(Ew(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Ew(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},kw=function(e){return e[e.Token=0]=`Token`,e[e.PermissionDenied=1]=`PermissionDenied`,e[e.Authenticated=2]=`Authenticated`,e}({}),Aw=(e,t)=>{hw(e,kw.Token),vw(e,t)},jw=(e,t,n,r)=>{switch(Dw(e)){case kw.Token:t();break;case kw.PermissionDenied:n(Ow(e));break;case kw.Authenticated:r(Ow(e));break;default:}},Mw=e=>Array.from(e.entries()).map(([e,t])=>({clientId:e,...t})),Nw=`\0`;function Pw(e,t){return e+Nw+t}function Fw(e){let t=e.indexOf(Nw);return t===-1?{documentName:e,sessionId:null}:{documentName:e.substring(0,t),sessionId:e.substring(t+1)}}var Iw=function(e){return e[e.Connecting=0]=`Connecting`,e[e.Open=1]=`Open`,e[e.Closing=2]=`Closing`,e[e.Closed=3]=`Closed`,e}({});function Lw(e){return e||={},{delay:e.delay===void 0?200:e.delay,initialDelay:e.initialDelay===void 0?0:e.initialDelay,minDelay:e.minDelay===void 0?0:e.minDelay,maxDelay:e.maxDelay===void 0?0:e.maxDelay,factor:e.factor===void 0?0:e.factor,maxAttempts:e.maxAttempts===void 0?3:e.maxAttempts,timeout:e.timeout===void 0?0:e.timeout,jitter:e.jitter===!0,initialJitter:e.initialJitter===!0,handleError:e.handleError===void 0?null:e.handleError,handleTimeout:e.handleTimeout===void 0?null:e.handleTimeout,beforeAttempt:e.beforeAttempt===void 0?null:e.beforeAttempt,calculateDelay:e.calculateDelay===void 0?null:e.calculateDelay}}async function Rw(e){return new Promise(t=>setTimeout(t,e))}function zw(e,t){let n=t.delay;if(n===0)return 0;if(t.factor&&(n*=t.factor**(e.attemptNum-1),t.maxDelay!==0&&(n=Math.min(n,t.maxDelay))),t.jitter){let e=Math.ceil(t.minDelay);n=Math.floor(Math.random()*(Math.floor(n)-e+1))+e}return Math.round(n)}async function Bw(e,t){let n=Lw(t);for(let e of[`delay`,`initialDelay`,`minDelay`,`maxDelay`,`maxAttempts`,`timeout`]){let t=n[e];if(!Number.isInteger(t)||t<0)throw Error(`Value for ${e} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw Error(`Value for factor must be a number greater than or equal to 0`);if(n.delay<n.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);let r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||zw;async function a(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){let e=Error(`Attempt aborted`);throw e.code=`ATTEMPT_ABORTED`,e}let t=async e=>{if(n.handleError&&await n.handleError(e,r,n),r.aborted||r.attemptsRemaining===0)throw e;r.attemptNum++;let t=i(r,n);return t&&await Rw(t),a()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((i,a)=>{let o=setTimeout(()=>{if(n.handleTimeout)try{i(n.handleTimeout(r,n))}catch(e){a(e)}else{let e=Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);e.code=`ATTEMPT_TIMEOUT`,a(e)}},n.timeout);e(r,n).then(e=>{clearTimeout(o),i(e)}).catch(e=>{clearTimeout(o),t(e).then(i).catch(a)})}):e(r,n).catch(t)}let o=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(o&&await Rw(o),r.attemptNum<1&&n.initialJitter){let e=i(r,n);e&&await Rw(e)}return a()}var Vw=Math.floor,Hw=(e,t)=>e<t?e:t,Uw=(e,t)=>e>t?e:t;Number.isNaN;var Ww=64,Gw=128,Kw=1<<17,qw=1<<18,Jw=1<<19,Yw=1<<20,Xw=1<<21,Zw=1<<22,Qw=1<<23,$w=1<<24,eT=1<<25,tT=1<<26,nT=1<<27,rT=1<<28,iT=1<<29,aT=1<<30,oT=63,sT=127;Kw-1,qw-1,Jw-1,Yw-1,Xw-1,Zw-1,Qw-1,$w-1,eT-1,tT-1,nT-1,rT-1,iT-1,aT-1;var cT=2**53-1;Number.isInteger,Number.isNaN,Number.parseInt;var lT=()=>new Set,uT=Array.from;Array.isArray;var dT=String.fromCharCode;String.fromCodePoint,dT(65535);var fT=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},pT=typeof TextEncoder<`u`?new TextEncoder:null,mT=pT?e=>pT.encode(e):fT,hT=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});hT&&hT.decode(new Uint8Array).length===1&&(hT=null);var gT=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},_T=()=>new gT,vT=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},yT=e=>{let t=new Uint8Array(vT(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},bT=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},xT=(e,t)=>{for(;t>sT;)bT(e,Gw|sT&t),t=Vw(t/128);bT(e,sT&t)},ST=new Uint8Array(3e4),CT=ST.length/3,wT=pT&&pT.encodeInto?(e,t)=>{if(t.length<CT){let n=pT.encodeInto(t,ST).written||0;xT(e,n);for(let t=0;t<n;t++)bT(e,ST[t])}else ET(e,mT(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;xT(e,r);for(let t=0;t<r;t++)bT(e,n.codePointAt(t))},TT=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=Hw(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Uw(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},ET=(e,t)=>{xT(e,t.byteLength),TT(e,t)},DT=e=>Error(e),OT=DT(`Unexpected end of array`),kT=DT(`Integer out of Range`),AT=class{constructor(e){this.arr=e,this.pos=0}},jT=e=>new AT(e),MT=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},NT=e=>MT(e,FT(e)),PT=e=>e.arr[e.pos++],FT=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&sT)*n,n*=128,r<Gw)return t;if(t>cT)throw kT}throw OT},IT=e=>{let t=e.arr[e.pos++],n=t&oT,r=64,i=(t&Ww)>0?-1:1;if((t&Gw)===0)return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&sT)*r,r*=128,t<Gw)return i*n;if(n>cT)throw kT}throw OT},LT=hT?e=>hT.decode(NT(e)):e=>{let t=FT(e);if(t===0)return``;{let n=String.fromCodePoint(PT(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(PT(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},RT=e=>{let t=e.pos,n=LT(e);return e.pos=t,n},zT=Date.now,BT=()=>new Map,VT=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},HT=class{constructor(){this._observers=BT()}on(e,t){VT(this._observers,e,lT).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return uT((this._observers.get(e)||BT()).values()).forEach(e=>e(...t))}destroy(){this._observers=BT()}},UT=Symbol(`Equality`),WT=Object.keys,GT=e=>WT(e).length,KT=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),qT=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[UT]!=null)return e[UT](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!qT(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(GT(e)!==GT(t))return!1;for(let n in e)if(!KT(e,n)||!qT(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qT(e[n],t[n]))return!1;break;default:return!1}return!0},JT=3e4,YT=class extends HT{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=zT();this.getLocalState()!==null&&JT/2<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&JT<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&XT(this,t,`timeout`)},Vw(JT/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){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:zT()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null&&a.push(t):(o.push(t),qT(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)&&this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},XT=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:zT()})}r.push(i)}}r.length>0&&(e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},ZT=(e,t,n=e.states)=>{let r=t.length,i=_T();xT(i,r);for(let a=0;a<r;a++){let r=t[a],o=n.get(r)||null,s=e.meta.get(r).clock;xT(i,r),xT(i,s),wT(i,JSON.stringify(o))}return yT(i)},QT=(e,t,n)=>{let r=jT(t),i=zT(),a=[],o=[],s=[],c=[],l=FT(r);for(let t=0;t<l;t++){let t=FT(r),n=FT(r),l=JSON.parse(LT(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0?0:u.clock;(f<n||f===n&&l===null&&e.states.has(t))&&(l===null?t===e.clientID&&e.getLocalState()!=null?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),u===void 0&&l!==null?a.push(t):u!==void 0&&l===null?c.push(t):l!==null&&(qT(l,d)||s.push(t),o.push(t)))}(a.length>0||s.length>0||c.length>0)&&e.emit(`change`,[{added:a,updated:s,removed:c},n]),(a.length>0||o.length>0||c.length>0)&&e.emit(`update`,[{added:a,updated:o,removed:c},n])},$T=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}},eE=class{constructor(e){this.data=e,this.encoder=_T(),this.decoder=jT(new Uint8Array(this.data))}peekVarString(){return RT(this.decoder)}readVarUint(){return FT(this.decoder)}readVarString(){return LT(this.decoder)}readVarUint8Array(){return NT(this.decoder)}writeVarUint(e){return xT(this.encoder,e)}writeVarString(e){return wT(this.encoder,e)}writeVarUint8Array(e){return ET(this.encoder,e)}length(){return vT(this.encoder)}},tE=function(e){return e[e.Sync=0]=`Sync`,e[e.Awareness=1]=`Awareness`,e[e.Auth=2]=`Auth`,e[e.QueryAwareness=3]=`QueryAwareness`,e[e.Stateless=5]=`Stateless`,e[e.CLOSE=7]=`CLOSE`,e[e.SyncStatus=8]=`SyncStatus`,e[e.Ping=9]=`Ping`,e[e.Pong=10]=`Pong`,e}({}),nE=function(e){return e.Connecting=`connecting`,e.Connected=`connected`,e.Disconnected=`disconnected`,e}({}),rE=class{constructor(){this.encoder=_T()}get(e){return e.encoder}toUint8Array(){return yT(this.encoder)}},iE=class extends rE{constructor(...e){super(...e),this.type=tE.CLOSE,this.description=`Ask the server to close the connection`}get(e){return wT(this.encoder,e.documentName),xT(this.encoder,this.type),this.encoder}},aE=class e extends $T{static{this.DEDUPLICATABLE_TYPES=new Set([tE.Awareness,tE.QueryAwareness])}constructor(e){super(),this.messageQueue=[],this.configuration={url:``,autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,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,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=nE.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=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(`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),this.shouldConnect&&this.connect()}async onOpen(e){this.status=nE.Connected,this.emit(`status`,{status:nE.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){let t=e.effectiveName,n=this.configuration.providerMap.get(t);if(n&&n!==e&&n.isAuthenticated)throw Error(`Cannot attach two providers with the same effective name "${t}". Use sessionAwareness: true to multiplex providers with the same document name.`);this.configuration.providerMap.set(t,e),this.status===nE.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===nE.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){let t=e.effectiveName;this.configuration.providerMap.has(t)&&(e.send(iE,{documentName:t}),this.configuration.providerMap.delete(t))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===nE.Connected)return;this.cancelWebsocketRetry&&=(this.cancelWebsocketRetry(),void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;let{retryPromise:e,cancelFunc:t}=(()=>{let e=!1;return{retryPromise:Bw(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,handleTimeout:this.configuration.handleTimeout,beforeAttempt:t=>{(!this.shouldConnect||e)&&t.abort()}}).catch(e=>{if(e&&e.code!==`ATTEMPT_ABORTED`)throw e}),cancelFunc:()=>{e=!0}}})();return this.cancelWebsocketRetry=t,e}attachWebSocketListeners(e,t){let{identifier:n}=e,r=e=>this.emit(`message`,e),i=e=>this.emit(`close`,{event:e}),a=e=>this.emit(`open`,e),o=e=>{t(e)};this.webSocketHandlers[n]={message:r,close:i,open:a,error:o};let s=this.webSocketHandlers[e.identifier];Object.keys(s).forEach(t=>{e.addEventListener(t,s[t])})}cleanupWebSocket(){if(!this.webSocket)return;let{identifier:e}=this.webSocket,t=this.webSocketHandlers[e];Object.keys(t).forEach(n=>{this.webSocket?.removeEventListener(n,t[n]),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;let n=new this.configuration.WebSocketPolyfill(this.url);n.binaryType=`arraybuffer`,n.identifier=this.identifier,this.attachWebSocketListeners(n,t),this.webSocket=n,this.status=nE.Connecting,this.emit(`status`,{status:nE.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){this.resolveConnectionAttempt(),this.lastMessageReceived=zT();let t=new Uint8Array(e.data);if(t.length===1&&t[0]===tE.Ping){this.sendPong();return}let n=new eE(t).peekVarString();this.configuration.providerMap.get(n)?.onMessage(e)}sendPong(){let e=_T();xT(e,tE.Pong),this.send(yT(e))}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=nE.Connected,this.emit(`status`,{status:nE.Connected}),this.emit(`connect`),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){this.connectionAttempt?.reject(),this.connectionAttempt=null}checkConnection(){this.status===nE.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=zT()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:`forced`}}),this.closeTries=0):(this.webSocket?.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]===`/`;)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}parseQueuedMessage(e){try{let t=jT(e);return{documentName:LT(t),messageType:FT(t)}}catch{return null}}addToQueue(t){if(t instanceof Uint8Array){let n=this.parseQueuedMessage(t);n&&e.DEDUPLICATABLE_TYPES.has(n.messageType)&&(this.messageQueue=this.messageQueue.filter(e=>{if(!(e instanceof Uint8Array))return!0;let t=this.parseQueuedMessage(e);return t?!(t.documentName===n.documentName&&t.messageType===n.messageType):!0}))}this.messageQueue.push(t)}send(e){this.webSocket?.readyState===Iw.Open?this.webSocket.send(e):this.addToQueue(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=nE.Disconnected,this.emit(`status`,{status:nE.Disconnected}),this.emit(`disconnect`,{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit(`destroy`),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}},oE=0,sE=1,cE=2,lE=(e,t)=>{xT(e,oE),ET(e,oh(t))},uE=(e,t,n)=>{xT(e,sE),ET(e,eh(t,n))},dE=(e,t,n)=>uE(t,n,NT(e)),fE=(e,t,n,r)=>{try{Zm(t,NT(e),n)}catch(e){r?.(e),console.error(`Caught error while handling a Yjs update`,e)}},pE=(e,t)=>{xT(e,cE),ET(e,t)},mE=fE,hE=(e,t,n,r,i)=>{let a=FT(e);switch(a){case oE:dE(e,t,n);break;case sE:fE(e,n,r,i);break;case cE:mE(e,n,r,i);break;default:throw Error(`Unknown message type`)}return a},gE=class{constructor(e){this.message=e}apply(e,t){let{message:n}=this,r=n.readVarUint(),i=n.length();switch(r){case tE.Sync:this.applySyncMessage(e,t);break;case tE.Awareness:this.applyAwarenessMessage(e);break;case tE.Auth:this.applyAuthMessage(e);break;case tE.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case tE.Stateless:e.receiveStateless(LT(n.decoder));break;case tE.SyncStatus:this.applySyncStatusMessage(e,IT(n.decoder)===1);break;case tE.CLOSE:let i={code:1e3,reason:LT(n.decoder)};e.onClose(),e.configuration.onClose({event:i}),e.forwardClose({event:i});break;default:console.error(`Can’t apply message of unknown type: ${r}`)}n.length()>i+1&&e.send(rE,{encoder:n.encoder})}applySyncMessage(e,t){let{message:n}=this;n.writeVarUint(tE.Sync);let r=hE(n.decoder,n.encoder,e.document,e);t&&r===sE&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;QT(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){let{message:t}=this;jw(t.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;t.writeVarUint(tE.Awareness),t.writeVarUint8Array(ZT(e.awareness,Array.from(e.awareness.getStates().keys())))}},_E=class{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return yT(this.encoder)}send(e){e?.send(this.create())}},vE=`4.0.0-rc.1`,yE=class extends rE{constructor(...e){super(...e),this.type=tE.Auth,this.description=`Authentication`}get(e){if(e.token===void 0)throw Error("The authentication message requires `token` as an argument.");return wT(this.encoder,e.documentName),xT(this.encoder,this.type),Aw(this.encoder,e.token),wT(this.encoder,vE),this.encoder}},bE=class extends rE{constructor(...e){super(...e),this.type=tE.Awareness,this.description=`Awareness states update`}get(e){if(e.awareness===void 0)throw Error(`The awareness message requires awareness as an argument`);if(e.clients===void 0)throw Error(`The awareness message requires clients as an argument`);wT(this.encoder,e.documentName),xT(this.encoder,this.type);let t;return t=e.states===void 0?ZT(e.awareness,e.clients):ZT(e.awareness,e.clients,e.states),ET(this.encoder,t),this.encoder}},xE=class extends rE{constructor(...e){super(...e),this.type=tE.Stateless,this.description=`A stateless message`}get(e){return wT(this.encoder,e.documentName),xT(this.encoder,this.type),wT(this.encoder,e.payload??``),this.encoder}},SE=class extends rE{constructor(...e){super(...e),this.type=tE.Sync,this.description=`First sync step`}get(e){if(e.document===void 0)throw Error(`The sync step one message requires document as an argument`);return wT(this.encoder,e.documentName),xT(this.encoder,this.type),lE(this.encoder,e.document),this.encoder}},CE=class extends rE{constructor(...e){super(...e),this.type=tE.Sync,this.description=`A document update`}get(e){return wT(this.encoder,e.documentName),xT(this.encoder,this.type),pE(this.encoder,e.update),this.encoder}},wE=class extends Error{constructor(...e){super(...e),this.code=1001}},TE=class extends $T{get effectiveName(){return this.configuration.sessionAwareness?Pw(this.configuration.name,this.sessionId):this.configuration.name}constructor(e){super(),this.configuration={name:``,document:void 0,awareness:void 0,token:null,sessionAwareness:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.sessionId=Math.random().toString(36).slice(2),this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit(`connect`),this.forwardStatus=e=>this.emit(`status`,e),this.forwardClose=e=>this.emit(`close`,e),this.forwardDisconnect=e=>this.emit(`disconnect`,e),this.forwardDestroy=()=>this.emit(`destroy`),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Fm,this.configuration.awareness=e.awareness===void 0?new YT(this.document):e.awareness,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(`unsyncedChanges`,this.configuration.onUnsyncedChanges),this.on(`authenticated`,this.configuration.onAuthenticated),this.on(`authenticationFailed`,this.configuration.onAuthenticationFailed),this.awareness?.on(`update`,()=>{this.emit(`awarenessUpdate`,{states:Mw(this.awareness.getStates())})}),this.awareness?.on(`change`,()=>{this.emit(`awarenessChange`,{states:Mw(this.awareness.getStates())})}),this.document.on(`update`,this.boundDocumentUpdateHandler),this.awareness?.on(`update`,this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval==`number`&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new aE(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&--this.unsyncedChanges,this.unsyncedChanges===0&&(this.synced=!0),this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(SE,{document:this.document,documentName:this.effectiveName})}pageHide(){this.awareness&&XT(this.awareness,[this.document.clientID],`page hide`)}registerEventListeners(){typeof window>`u`||!(`addEventListener`in window)||window.addEventListener(`pagehide`,this.boundPageHide)}sendStateless(e){this.send(xE,{documentName:this.effectiveName,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(e){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${e}`);return}this.send(yE,{token:e??``,documentName:this.effectiveName})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send(CE,{update:e,documentName:this.effectiveName}))}awarenessUpdateHandler({added:e,updated:t,removed:n},r){let i=e.concat(t).concat(n);this.send(bE,{awareness:this.awareness,clients:i,documentName:this.effectiveName})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit(`synced`,{state:e}))}receiveStateless(e){this.emit(`stateless`,{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn(`HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn(`HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}async onOpen(e){this.isAuthenticated=!1,this.emit(`open`,{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token==`function`?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(SE,{document:this.document,documentName:this.effectiveName}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(bE,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.effectiveName})}send(e,t){if(!this._isAttached)return;let n=new _E(e,t);this.emit(`outgoingMessage`,{message:n.message}),n.send(this.configuration.websocketProvider)}onMessage(e){let t=new eE(e.data),{documentName:n}=Fw(t.readVarString());t.writeVarString(this.effectiveName),this.emit(`message`,{event:e,message:new eE(e.data)}),new gE(t).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&XT(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit(`destroy`),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(XT(this.awareness,[this.document.clientID],`provider destroy`),this.awareness.off(`update`,this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off(`update`,this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>`u`||!(`removeEventListener`in window))&&window.removeEventListener(`pagehide`,this.boundPageHide)}detach(){this.configuration.websocketProvider.off(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.off(`connect`,this.forwardConnect),this.configuration.websocketProvider.off(`status`,this.forwardStatus),this.configuration.websocketProvider.off(`status`,this.configuration.onStatus),this.configuration.websocketProvider.off(`open`,this.boundOnOpen),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(`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.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||=(this.configuration.websocketProvider.on(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.on(`connect`,this.forwardConnect),this.configuration.websocketProvider.on(`status`,this.configuration.onStatus),this.configuration.websocketProvider.on(`status`,this.forwardStatus),this.configuration.websocketProvider.on(`open`,this.boundOnOpen),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(`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),this.configuration.websocketProvider.attach(this),!0)}permissionDeniedHandler(e){this.emit(`authenticationFailed`,{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit(`authenticated`,{scope:e})}setAwarenessField(e,t){if(!this.awareness)throw new wE(`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)}},EE=e=>Hd((t,n)=>{e.onerror=e=>n(Error(e.target.error)),e.onsuccess=e=>t(e.target.result)}),DE=(e,t)=>Hd((n,r)=>{let i=indexedDB.open(e);i.onupgradeneeded=e=>t(e.target.result),i.onerror=e=>r(md(e.target.error)),i.onsuccess=e=>{let t=e.target.result;t.onversionchange=()=>{t.close()},n(t)}}),OE=e=>EE(indexedDB.deleteDatabase(e)),kE=(e,t)=>t.forEach(t=>e.createObjectStore.apply(e,t)),AE=(e,t,n=`readwrite`)=>{let r=e.transaction(t,n);return t.map(e=>VE(r,e))},jE=(e,t)=>EE(e.count(t)),ME=(e,t)=>EE(e.get(t)),NE=(e,t)=>EE(e.delete(t)),PE=(e,t,n)=>EE(e.put(t,n)),FE=(e,t)=>EE(e.add(t)),IE=(e,t,n)=>EE(e.getAll(t,n)),LE=(e,t,n)=>{let r=null;return BE(e,t,e=>(r=e,!1),n).then(()=>r)},RE=(e,t=null)=>LE(e,t,`prev`),zE=(e,t)=>Hd((n,r)=>{e.onerror=r,e.onsuccess=async e=>{let r=e.target.result;if(r===null||await t(r)===!1)return n();r.continue()}}),BE=(e,t,n,r=`next`)=>zE(e.openKeyCursor(t,r),e=>n(e.key)),VE=(e,t)=>e.objectStore(t),HE=(e,t)=>IDBKeyRange.upperBound(e,t),UE=(e,t)=>IDBKeyRange.lowerBound(e,t),WE=`custom`,GE=`updates`,KE=(e,t=()=>{},n=()=>{})=>{let[r]=AE(e.db,[GE]);return IE(r,UE(e._dbref,!1)).then(i=>{e._destroyed||(t(r),Xh(e.doc,()=>{i.forEach(t=>Zm(e.doc,t))},e,!1),n(r))}).then(()=>RE(r).then(t=>{e._dbref=t+1})).then(()=>jE(r).then(t=>{e._dbsize=t})).then(()=>r)},qE=(e,t=!0)=>KE(e).then(n=>{(t||e._dbsize>=500)&&FE(n,eh(e.doc)).then(()=>NE(n,HE(e._dbref,!0))).then(()=>jE(n).then(t=>{e._dbsize=t}))}),JE=class extends su{constructor(e,t){super(),this.doc=t,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=DE(e,e=>kE(e,[[`updates`,{autoIncrement:!0}],[`custom`]])),this.whenSynced=Hd(e=>this.on(`synced`,()=>e(this))),this._db.then(e=>{this.db=e,KE(this,async e=>{await jE(e)>0&&FE(e,eh(t))},()=>{if(this._destroyed)return this;this.synced=!0,this.emit(`synced`,[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(e,t)=>{if(this.db&&t!==this){let[t]=AE(this.db,[GE]);FE(t,e).catch(e=>{globalThis.__okYdbWriteWarned||(globalThis.__okYdbWriteWarned=!0,console.warn(JSON.stringify({event:`ok-ydb-write-failed`,cause:e?.name??`unknown`,message:e?.message??String(e)})))}),++this._dbsize>=500&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{qE(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},t.on(`update`,this._storeUpdate),this.destroy=this.destroy.bind(this),t.on(`destroy`,this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off(`update`,this._storeUpdate),this.doc.off(`destroy`,this.destroy),this._destroyed=!0,this._db.then(e=>{e.close()})}clearData(){return this.destroy().then(()=>{OE(this.name)})}get(e){return this._db.then(t=>{let[n]=AE(t,[WE],`readonly`);return ME(n,e)})}set(e,t){return this._db.then(n=>{let[r]=AE(n,[WE]);return PE(r,t,e)})}del(e){return this._db.then(t=>{let[n]=AE(t,[WE]);return NE(n,e)})}};function YE(){return!0}var XE=class{_idb;_dbName;whenSynced;constructor({branch:e,serverInstanceId:t,docName:n,doc:r}){if(typeof t!=`string`||t.length===0)throw Error(`createClientPersistence: serverInstanceId is required and must be non-empty`);this._dbName=`ok-ydoc:${e}:${t}:${n}`;let i=YE()?0:performance.now();this._idb=new JE(this._dbName,r),this.whenSynced=this._idb.whenSynced.then(()=>{if(!YE()){let e=performance.now();Z(`ok/pool/idb-whensynced`,{docName:n,durationMs:Math.round((e-i)*1e3)/1e3},{startTime:i,duration:e-i})}return this})}get synced(){return this._idb.synced}async destroy(){let e=YE()?0:performance.now();try{await this._idb.destroy()}finally{if(!YE()){let t=performance.now();Z(`ok/pool/idb-destroy`,{dbName:this._dbName,durationMs:Math.round((t-e)*1e3)/1e3},{startTime:e,duration:t-e})}}}async clearData(){let e=YE()?0:performance.now();try{await this._idb.destroy();let e=this._dbName;await new Promise((t,n)=>{let r=indexedDB.deleteDatabase(e);r.onsuccess=()=>t(),r.onerror=()=>n(r.error),r.onblocked=()=>{console.warn(JSON.stringify({event:`ok-client-persistence-clear-blocked`,dbName:e}))}})}finally{if(!YE()){let t=performance.now();Z(`ok/pool/idb-cleardata`,{dbName:this._dbName,durationMs:Math.round((t-e)*1e3)/1e3},{startTime:e,duration:t-e})}}}};function ZE(e){return new XE(e)}function QE(e){return oh(e)}function $E(e,t){return t===null?eh(e):eh(e,t)}function eD(e,t){if(e===null)return t;if(t===null)return e;let n=nh(e),r=nh(t),i=new Map;for(let[e,t]of n)i.set(e,t);for(let[e,t]of r){let n=i.get(e);(n===void 0||t>n)&&i.set(e,t)}return oh(i)}function tD(e){let t={};if(ir.inject(rr.active(),t),!t.traceparent)return e;let n=e.includes(`?`)?`&`:`?`,r=[`traceparent=${encodeURIComponent(t.traceparent)}`];return t.tracestate&&r.push(`tracestate=${encodeURIComponent(t.tracestate)}`),`${e}${n}${r.join(`&`)}`}var nD=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:i})=>new Gt({key:e||new W(`fileHandler`),props:{handleDrop(e,n){if(!r||!n.dataTransfer?.files.length)return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY}),o=Array.from(n.dataTransfer.files);return i&&(o=o.filter(e=>i.includes(e.type))),o.length===0?!1:(n.preventDefault(),n.stopPropagation(),r(t,o,a?.pos||0),!0)},handlePaste(e,r){if(!n||!r.clipboardData?.files.length)return!1;let a=Array.from(r.clipboardData.files),o=r.clipboardData.getData(`text/html`);return i&&(a=a.filter(e=>i.includes(e.type))),!(a.length===0||(r.preventDefault(),r.stopPropagation(),n(t,a,o),o.length>0))}}}),rD=D.create({name:`fileHandler`,addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0}},addProseMirrorPlugins(){return[nD({key:new W(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste})]}});function iD(e,t){let{state:n,view:r}=e;if(!n.selection.empty||!r.endOfTextblock(t))return!1;let i=n.selection.$head,a=t===`down`||t===`right`,o=null,s=-1;if(a){let e=i.after();if(e>=n.doc.content.size)return!1;o=n.doc.nodeAt(e),s=e}else{let e=i.before();if(e<=0||(o=n.doc.resolve(e).nodeBefore,!o))return!1;s=e-o.nodeSize}if(!o||o.type.name!==`jsxComponent`||o.childCount!==0||!pt.isSelectable(o))return!1;try{let t=pt.create(n.doc,s);return e.view.dispatch(n.tr.setSelection(t).scrollIntoView()),!0}catch(e){if(!(e instanceof RangeError))throw e;return Ae(t),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:t,tier:`L0`,reason:e.message.slice(0,500)})),!0}}function aD(e){let{state:t,view:n}=e;if(!(t.selection instanceof vt)||!t.selection.empty||!n.endOfTextblock(`up`))return!1;let r=t.selection.$head,i=-1;for(let e=r.depth-1;e>=1;e--)if(r.node(e).type.name===`jsxComponent`){i=e;break}if(i<0)return!1;for(let e=r.depth;e>i;e--)if(r.index(e-1)!==0)return!1;let a=r.before(i);try{let n=t.doc.resolve(a),r=Ke.findFrom(n,-1,!0);return!r||!(r instanceof vt)?!1:(e.view.dispatch(t.tr.setSelection(r).scrollIntoView()),!0)}catch(e){if(!(e instanceof RangeError))throw e;return Ae(`up`),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:`up`,tier:`L2c`,reason:e.message.slice(0,500)})),!0}}var oD=D.create({name:`keyboardNav`,priority:50,addKeyboardShortcuts(){return{Escape:({editor:e})=>{let{state:t}=e;if(t.selection instanceof pt){let n=t.selection.from+t.selection.node.nodeSize,r=t.doc.resolve(Math.min(n,t.doc.content.size)),i=vt.near(r);return e.view.dispatch(t.tr.setSelection(i)),!0}return t.selection instanceof vt?e.commands.selectParentNode():!1},ArrowUp:({editor:e})=>{if(iD(e,`up`)||aD(e))return!0;let{state:t}=e;if(!(t.selection instanceof pt))return!1;let n=t.selection.from,r=t.doc.resolve(n);if(r.index(r.depth)===0)return!1;let i=r.before(r.depth);if(i<=0)return!1;let a=t.doc.resolve(i-1).nodeBefore;if(!a||i-1-a.nodeSize+1<0)return!1;try{let n=pt.create(t.doc,i-a.nodeSize);return e.view.dispatch(t.tr.setSelection(n).scrollIntoView()),!0}catch(e){if(!(e instanceof RangeError))throw e;return Ae(`up`),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:`up`,tier:`L2`,reason:e.message.slice(0,500)})),!1}},ArrowDown:({editor:e})=>{if(iD(e,`down`))return!0;let{state:t}=e;if(!(t.selection instanceof pt))return!1;let n=t.selection.from+t.selection.node.nodeSize;if(n>=t.doc.content.size)return!1;try{if(!t.doc.nodeAt(n))return!1;let r=pt.create(t.doc,n);return e.view.dispatch(t.tr.setSelection(r).scrollIntoView()),!0}catch(e){if(!(e instanceof RangeError))throw e;return Ae(`down`),console.warn(JSON.stringify({event:`jsx-component-arrow-node-select-failed`,direction:`down`,tier:`L2`,reason:e.message.slice(0,500)})),!1}},ArrowLeft:({editor:e})=>iD(e,`left`),ArrowRight:({editor:e})=>iD(e,`right`),Enter:({editor:e})=>{let{state:t}=e;if(!(t.selection instanceof vt)||!t.selection.empty)return!1;let n=t.selection.$from,r=n.parent;if(r.type.name!==`paragraph`||r.textContent!==``||n.depth<2)return!1;let i=-1;for(let e=n.depth-1;e>=1;e--)if(n.node(e).type.name===`jsxComponent`){i=e;break}if(i<0)return!1;let a=n.node(i);if(n.index(i)!==a.childCount-1)return!1;let o=n.after(i);if(o>t.doc.content.size)return!1;let s=t.tr,c=n.before(n.depth),l=n.after(n.depth);s.delete(c,l);let u=o-(l-c),d=t.schema.nodes.paragraph.create();s.insert(u,d);let f=u+1;return s.setSelection(vt.create(s.doc,f)),e.view.dispatch(s.scrollIntoView()),!0}}}}),sD={query:``,options:{caseSensitive:!1,wholeWord:!1},activeIndex:0,matches:[]},cD=/[A-Za-z0-9_]/;function lD(e){return e!==void 0&&cD.test(e)}function uD(e,t,n){return!lD(e[t-1])&&!lD(e[n])}function dD(e,t,n){if(t.length===0)return[];let r=n.caseSensitive?e:e.toLocaleLowerCase(),i=n.caseSensitive?t:t.toLocaleLowerCase(),a=[],o=0;for(;o<=r.length-i.length;){let t=r.indexOf(i,o);if(t===-1)break;let s=t+i.length;(!n.wholeWord||uD(e,t,s))&&a.push({start:t,end:s,text:e.slice(t,s)}),o=s}return a}function fD(e,t,n){if(t.length===0)return[];let r=[];return e.descendants((e,i)=>{if(!(!e.isText||typeof e.text!=`string`))for(let a of dD(e.text,t,n))r.push({from:i+a.start,to:i+a.end,text:a.text})}),r}var pD=new W(`findReplace`);function mD(e,t){return t<=0||!Number.isFinite(e)?0:Math.min(Math.max(Math.trunc(e),0),t-1)}function hD(e,t,n,r){let i=fD(e.doc,t,n);return{query:t,options:n,activeIndex:mD(r,i.length),matches:i}}function gD(e,t,n){return t<=0?0:(mD(e,t)+n+t)%t}function _D(e,t,n){if(e.length===0)return 0;let r=t+n,i=e.findIndex(e=>e.from>=r);return i===-1?0:i}function vD(e,t,n){if(t.matches.length===0)return null;let r=e.tr;for(let e of[...t.matches].reverse())r.insertText(n,e.from,e.to);let i=fD(r.doc,t.query,t.options),a=mD(0,i.length),o=i[a];return r.setMeta(pD,{type:`setActiveIndex`,activeIndex:a}),o&&r.setSelection(vt.create(r.doc,o.from,o.to)),r.scrollIntoView()}function yD(e,t){let n=pD.getState(e)?.matches[t];return n?e.tr.setMeta(pD,{type:`setActiveIndex`,activeIndex:t}).setSelection(vt.create(e.doc,n.from,n.to)).scrollIntoView():null}function bD(e){return pD.getState(e)??sD}function xD(){return new Gt({key:pD,state:{init:()=>sD,apply(e,t,n,r){let i=e.getMeta(pD);if(i?.type===`clear`)return sD;let a=t.query,o=t.options,s=t.activeIndex;if(i?.type===`setQuery`)a=i.query,o={...o,...i.options},s=i.activeIndex??0;else if(i?.type===`setOptions`)o={...o,...i.options},s=i.activeIndex??s;else if(i?.type===`setActiveIndex`)s=i.activeIndex;else if(!e.docChanged)return t;return a.length===0?{query:a,options:o,activeIndex:0,matches:[]}:hD(r,a,o,s)}},props:{decorations(e){let t=pD.getState(e);return!t||t.matches.length===0?null:Tt.create(e.doc,t.matches.map((e,n)=>Pe.inline(e.from,e.to,{class:n===t.activeIndex?`ok-find-match ok-find-match-active`:`ok-find-match`})))}}})}var SD=D.create({name:`findReplace`,addCommands(){return{setFindQuery:(e,t)=>({state:n,dispatch:r})=>(r&&r(n.tr.setMeta(pD,{type:`setQuery`,query:e,options:t?.options,activeIndex:t?.activeIndex})),!0),setFindOptions:(e,t)=>({state:n,dispatch:r})=>(r&&r(n.tr.setMeta(pD,{type:`setOptions`,options:e,activeIndex:t})),!0),setActiveFindIndex:e=>({state:t,dispatch:n})=>(n&&n(t.tr.setMeta(pD,{type:`setActiveIndex`,activeIndex:e})),!0),selectNextFindMatch:()=>({state:e,dispatch:t})=>{let n=bD(e),r=yD(e,gD(n.activeIndex,n.matches.length,1));return r?(t?.(r),!0):!1},selectPreviousFindMatch:()=>({state:e,dispatch:t})=>{let n=bD(e),r=yD(e,gD(n.activeIndex,n.matches.length,-1));return r?(t?.(r),!0):!1},replaceCurrentFindMatch:e=>({state:t,dispatch:n})=>{let r=bD(t),i=r.matches[r.activeIndex];if(!i||!n)return!1;let a=t.tr.insertText(e,i.from,i.to),o=fD(a.doc,r.query,r.options),s=_D(o,i.from,e.length),c=o[s];return a.setMeta(pD,{type:`setActiveIndex`,activeIndex:s}),c&&a.setSelection(vt.create(a.doc,c.from,c.to)),a.scrollIntoView(),n(a),!0},replaceAllFindMatches:e=>({state:t,dispatch:n})=>{let r=bD(t);if(!n)return!1;let i=vD(t,r,e);return i?(n(i),!0):!1},clearFindMatches:()=>({state:e,dispatch:t})=>(t&&t(e.tr.setMeta(pD,{type:`clear`})),!0)}},addProseMirrorPlugins(){return[xD()]}}),CD=new WeakMap;function wD(e,t){if(t===null){CD.delete(e);return}CD.set(e,t)}function TD(e){return CD.get(e)??null}function ED(e){return`pagesBySlug`in e}function DD(e){return ED(e)?e.pages:e}function OD(e,t){return ED(e)?e.assetPaths??new Set:t??new Set}function kD(e,t){let n=S(e);if(n){if(ED(t))return t.pagesBySlug.get(n);for(let e of t)if(S(e)===n)return e}}function AD(e){let t=e.trim();if(!t)return null;let n=S(t);return n?{target:n,alias:n===t?null:t,anchor:null}:null}function jD(e){let t=e.trim();if(!t)return[];let n=S(t);return n.length>0&&n!==t?[n]:[]}function MD(e,t){let n=e.trim();if(!n)return;let r=DD(t);if(r.has(n))return n;let i=kD(n,t);if(i)return i;for(let e of jD(n))if(r.has(e))return e}function ND(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function PD(e,t){let n=ND(e);if(!n)return null;if(t.has(n))return n;let r=n.toLowerCase();for(let e of t)if(e.toLowerCase()===r)return e;if(n.includes(`/`))return null;let i=[...t].filter(e=>{let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1)).toLowerCase()===r});return i.length===0?null:i.sort((e,t)=>e.localeCompare(t))[0]??null}function FD(e,t,n){let r=e.trim();if(!r)return!1;if(PD(r,OD(t,n)))return!0;let i=DD(t);return i.has(r)||jD(r).some(e=>i.has(e))?!0:kD(r,t)!==void 0}var ID=class extends Error{status;instance;constructor(e,t={}){super(e,t.cause===void 0?void 0:{cause:t.cause}),this.name=`HttpResponseParseError`,this.status=t.status,this.instance=t.instance}},LD=new W(`imageUpload`);function RD(e){let t=document.createElement(`div`);t.className=`image-upload-skeleton w-full h-40 rounded-md bg-muted animate-pulse motion-reduce:animate-none my-2`,t.setAttribute(`data-upload-widget`,`loading`),t.setAttribute(`role`,`status`);let n=e?.name;return t.setAttribute(`aria-label`,n?_._({id:`KDuPiY`,values:{fileName:n}}):_._({id:`bGa3Fk`})),t}var zD=new Gt({key:LD,state:{init(){return{decorations:Tt.empty,uploads:new Map}},apply(e,t){let n=t.decorations.map(e.mapping,e.doc),r=new Map;for(let[n,i]of t.uploads)r.set(n,e.mapping.map(i));let i=e.getMeta(LD);if(!i)return{decorations:n,uploads:r};if(i.type===`add`){let t=Pe.widget(i.pos,i.widget,{id:i.id,stopEvent:()=>!0}),a=n.add(e.doc,[t]),o=new Map(r);return o.set(i.id,e.mapping.map(i.pos)),{decorations:a,uploads:o}}if(i.type===`remove`){let e=n.find(void 0,void 0,e=>e.id===i.id),t=n.remove(e),a=new Map(r);return a.delete(i.id),{decorations:t,uploads:a}}return{decorations:n,uploads:r}}},props:{decorations(e){return LD.getState(e)?.decorations??Tt.empty}}});function BD(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function VD(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function HD(e){return e.split(`/`).filter(e=>e!==``)}function UD(e,t){let n=BD(e),r=BD(t),i=VD(e);if(n===r)return i;let a=HD(r),o=HD(n),s=0;for(;s<a.length&&s<o.length&&a[s]===o[s];)s++;let c=a.length-s,l=o.slice(s);return c===0?`./${[...l,i].join(`/`)}`:[...Array(c).fill(`..`),...l,i].join(`/`)}function WD(e){return TD(e)}function GD(e,t){return{type:`jsxComponent`,attrs:{componentName:e===`jsx-img`?`img`:e===`jsx-video`?`video`:`audio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!0,props:e===`jsx-img`?{src:t}:{src:t,controls:!0}}}}function KD(e){let t=ue(e);return t===`md`||t===`mdx`?{kind:`wiki-link`,ext:t}:j.has(t)?{kind:`jsx-img`,ext:t}:Kt.has(t)?{kind:`jsx-video`,ext:t}:Rt.has(t)?{kind:`jsx-audio`,ext:t}:V.has(t)?{kind:`jsx-file`,ext:t}:Ve.has(t)?{kind:`wikiembed`,ext:t}:{kind:`markdown-link`,ext:t}}async function qD(e,t,n){let r=WD(t),i=r?`${r}.md`:``;if(!i){Yn.error(_._({id:`z5pqI8`}));return}let a=crypto.randomUUID(),o=RD(e);t.view.dispatch(t.state.tr.setMeta(LD,{type:`add`,id:a,pos:n,widget:o}));let s=new FormData;s.append(`file`,e),s.append(`parentDocName`,i);let c;try{c=await fetch(`/api/upload`,{method:`POST`,body:s})}catch(e){console.error(`[uploadAndInsert] Network error:`,e),JD(t,a);return}let l;try{l=await c.json()}catch(e){console.error(`[uploadAndInsert] Response is not JSON:`,e),JD(t,a);return}if(!c.ok){let e=Te.safeParse(l);if(!e.success){let n=new ID(`Upload response did not match ProblemDetails.`,{cause:e.error,status:c.status});console.error(`[uploadAndInsert] Server error (unparseable):`,n),JD(t,a);return}console.error(`[uploadAndInsert] Server error:`,e.data),JD(t,a,e.data.title);return}let u=mt.safeParse(l);if(!u.success){let e=new ID(`Upload success response did not match UploadAssetSuccess.`,{cause:u.error,status:c.status});console.error(`[uploadAndInsert] Response missing src:`,e),JD(t,a);return}let d=u.data,f=d.src,p=d.deduped===!0,m=BD(i),h=typeof d.path==`string`&&d.path.length>0?d.path:m?`${m}/${f}`:f;p&&Yn.info(_._({id:`VbqhBI`,values:{assetContentPath:h}}));let g=KD(e.name),{state:v}=t,y=LD.getState(v)?.uploads.get(a)??n,b=v.tr.setMeta(LD,{type:`remove`,id:a}),x=UD(h,i),S=`/${h}`;if(g.kind===`jsx-file`){if(!v.schema.nodes.jsxComponent){console.error(`[uploadAndInsert] jsxComponent node missing from schema`),JD(t,a);return}let n={type:`jsxComponent`,attrs:{componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!0,props:{src:S,target:f,alias:null,anchor:null,size:ye(e.size)}}};t.chain().command(({tr:e})=>(e.setMeta(LD,{type:`remove`,id:a}),!0)).focus().insertContentAt(y,n).command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=e.mapping.map(y);return e.doc.nodeAt(n)?.type.name===`jsxComponent`&&e.setSelection(pt.create(e.doc,n)),!0}).run();return}if(g.kind===`jsx-img`||g.kind===`jsx-video`||g.kind===`jsx-audio`){if(!v.schema.nodes.jsxComponent){console.error(`[uploadAndInsert] jsxComponent node missing from schema`),JD(t,a);return}let e=GD(g.kind,S);t.chain().command(({tr:e})=>(e.setMeta(LD,{type:`remove`,id:a}),!0)).focus().insertContentAt(y,e).command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=e.mapping.map(y);return e.doc.nodeAt(n)?.type.name===`jsxComponent`&&e.setSelection(pt.create(e.doc,n)),!0}).run();return}if(g.kind===`wikiembed`){let e=v.schema.nodes.wikiLinkEmbed;if(!e){console.error(`[uploadAndInsert] wikiLinkEmbed node missing from schema`),JD(t,a);return}b.insert(y,e.create({target:f,alias:null,anchor:null,resolvedSrc:S}))}else if(g.kind===`wiki-link`){let n=v.schema.nodes.wikiLink;if(!n){console.error(`[uploadAndInsert] wikiLink node missing from schema`),JD(t,a);return}let r=AD(e.name.replace(/\.(md|mdx)$/i,``));r?b.insert(y,n.create(r)):b.insert(y,v.schema.text(e.name))}else{let t=v.schema.marks.link;if(t){let n=v.schema.text(e.name,[t.create({href:x})]);b.insert(y,n)}else b.insert(y,v.schema.text(e.name))}t.view.dispatch(b)}function JD(e,t,n){e.view.dispatch(e.state.tr.setMeta(LD,{type:`remove`,id:t})),Yn.error(n??_._({id:`b3Thhd`}))}var YD=new Set;function XD(e){YD.add(e)}function ZD(e){return YD.delete(e)}var QD=new W(`markIdentity`);function $D(){return{byId:new Map,counter:0}}function eO(e,t,n,r,i){let a=[];for(let e of t.byId.values()){let t=i?i.map(e.from,-1):e.from,n=i?i.map(e.to,1):e.to;n<=t||a.push({id:e.id,markType:e.markType,attrs:e.attrs,from:t,to:n})}let o=new Map,s=new Set,c=t.counter;return e.descendants((e,t)=>{if(!(!e.isInline||e.marks.length===0))for(let i of e.marks){if(!n.has(i.type.name)||r&&!r(i))continue;let l=null;for(let e of a)if(!s.has(e.id)&&e.markType===i.type.name&&tO(e.attrs,i.attrs)&&!(t<e.from||t>=e.to)){l=e.id;break}let u=l??`m${++c}`;s.add(u);let d=t,f=t+e.nodeSize,p=o.get(u);p?p.to=Math.max(p.to,f):o.set(u,{id:u,markType:i.type.name,attrs:i.attrs,from:d,to:f})}}),{byId:o,counter:c}}function tO(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(n!==i&&!(typeof n==`object`&&n&&typeof i==`object`&&i&&tO(n,i)))return!1}return!0}function nO(e,t,n,r){let i=new Set(t.byId.keys());for(let[r,i]of t.byId)e.has(r)||n?.(i);for(let t of e)i.has(t)||r?.(t);return i}function rO(e){let{markTypes:t,predicate:n,onRegister:r,onDeregister:i}=e,a=new Set(t);return new Gt({key:QD,state:{init(e,t){return eO(t.doc,$D(),a,n)},apply(e,t,r,i){return e.docChanged?eO(i.doc,t,a,n,e.mapping):t}},view(){let e=new Set;return{update(t){let n=QD.getState(t.state);n&&(e=nO(e,n,r,i))},destroy(){for(let t of e)i?.(t);e=new Set}}}})}var iO=300,aO=150,oO=500,sO=class{registry=new Map;_activeNodeId=null;listeners=new Set;_snapshot={activeNodeId:null,active:null};register(e){this.registry.set(e.nodeId,e),this._activeNodeId===e.nodeId&&this.refreshSnapshot()}deregister(e){this.registry.delete(e)&&this._activeNodeId===e&&(this._activeNodeId=null,this.refreshSnapshot())}setActiveNode(e){this._activeNodeId!==e&&(e!==null&&!this.registry.has(e)||(this._activeNodeId=e,this.refreshSnapshot()))}getActiveNode(){return this._activeNodeId}getRegistration(e){return this.registry.get(e)}hasRegistration(e){return this.registry.has(e)}clear(){this.registry.clear(),this._activeNodeId=null,this.refreshSnapshot()}getSnapshot=()=>this._snapshot;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});refreshSnapshot(){let e=this._activeNodeId==null?null:this.registry.get(this._activeNodeId)??null;this._snapshot={activeNodeId:this._activeNodeId,active:e};for(let e of this.listeners)e()}};function cO(e,t){let n=e??null;for(;n&&typeof n==`object`;){let e=n.getAttribute;if(typeof e==`function`){let r=e.call(n,`data-mark-id`);if(r&&t.hasRegistration(r))return r;let i=e.call(n,`data-node-id`);if(i&&t.hasRegistration(i))return i}n=n.parentElement??null}return null}function lO(e){return e?e.closest(`[data-ok-prop-panel]`)!==null:!1}function uO(){return typeof document>`u`?!1:document.querySelector(`[data-ok-layer-spawned]`)!==null}var dO=e=>{let t=(0,J.c)(18),{store:n}=e,r;t[0]===n?r=t[1]:(r=()=>n.getSnapshot(),t[0]=n,t[1]=r);let[i,a]=(0,Y.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>(a(n.getSnapshot()),n.subscribe(()=>{a(n.getSnapshot())})),s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Y.useEffect)(o,s);let{active:c}=i;if(!c)return null;let l;t[5]===n?l=t[6]:(l=()=>n.setActiveNode(null),t[5]=n,t[6]=l);let u,d,f;if(t[7]!==c.controls||t[8]!==c.nodeId||t[9]!==c.type||t[10]!==l){let e={nodeId:c.nodeId,type:c.type,deactivate:l};u=c.controls.propPanel?.(e),d=c.controls.toolbar?.(e),f=c.controls.breadcrumb?.(e),t[7]=c.controls,t[8]=c.nodeId,t[9]=c.type,t[10]=l,t[11]=u,t[12]=d,t[13]=f}else u=t[11],d=t[12],f=t[13];let p;return t[14]!==u||t[15]!==d||t[16]!==f?(p=(0,X.jsxs)(X.Fragment,{children:[u,d,f]}),t[14]=u,t[15]=d,t[16]=f,t[17]=p):p=t[17],p};function fO(e){return e.editorView?.dom??null}function pO(e,t){let n=e;for(;n;){if(n.getAttribute?.(`data-mark-id`)===t||n.getAttribute?.(`data-node-id`)===t)return!0;n=n.parentElement}return!1}function mO(e){let{editor:t}=e,n=new sO,r=fO(t),i=!1,a=null,o=null,s=null,c=null,l=null,u=()=>{a!==null&&(clearTimeout(a),a=null),s=null},d=()=>{o!==null&&(clearTimeout(o),o=null)},f=()=>{c!==null&&(clearTimeout(c),c=null)},p=e=>{if(n.getActiveNode()===e){d();return}s===e&&a!==null||(u(),d(),s=e,a=setTimeout(()=>{a=null,s=null,n.setActiveNode(e)},iO))},m=()=>{n.getActiveNode()!==null&&o===null&&(o=setTimeout(()=>{o=null,!uO()&&n.setActiveNode(null)},aO))},h=null,g=!1,_=e=>{try{g=!0,e.focus({preventScroll:!0})}catch{}finally{g=!1}},v=n.subscribe(()=>{let e=n.getActiveNode();if(e!==null){if(typeof document<`u`){let t=document.activeElement;h=t&&pO(t,e)?t:null}return}if(typeof document>`u`)return;let i=h;if(h=null,i&&document.contains(i)&&typeof i.focus==`function`){_(i);return}let a=r??fO(t);a&&typeof a.focus==`function`&&_(a)}),y=e=>{let t=e;if(t.button!==2){if(t.metaKey||t.ctrlKey||t.button===1){u(),t.button===1&&t.preventDefault?.();return}if(t.pointerType===`touch`){let t=cO(e.target,n);if(t===null)return;f(),c=setTimeout(()=>{c=null,l=t,n.setActiveNode(t)},oO);return}u()}},b=()=>{f()},x=e=>{e.pointerType===`touch`&&c!==null&&f()},S=e=>{let t=e;if(t.button===2||t.type===`click`&&t.button===1)return;let r=cO(e.target,n);if(r===null)return;if(l!==null){let e=l===r;if(l=null,e){t.preventDefault?.();return}}let i=t.metaKey||t.ctrlKey||t.button===1,a=n.getRegistration(r);if(a?.handlePrimary&&a.handlePrimary({nodeId:r,type:a.type,newTab:i})){t.preventDefault?.(),i||(u(),d(),n.getActiveNode()===r&&n.setActiveNode(null));return}i||(u(),d(),n.setActiveNode(r))},C=e=>{let t=e;if(t.key===`Escape`){n.getActiveNode()!==null&&(u(),d(),n.setActiveNode(null),t.preventDefault?.());return}if(t.key===`Tab`&&!t.shiftKey&&!t.altKey&&!t.metaKey&&!t.ctrlKey){let r=cO(e.target,n);if(r!==null&&n.getActiveNode()===r){let e=document.querySelector(`[data-ok-prop-panel]`);if(e){let n=e.querySelector(`button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])`);if(n){t.preventDefault?.(),n.focus();return}}}return}let r=t.key===`Enter`,i=t.key===` `||t.key===`Spacebar`;if(!r&&!i)return;let a=cO(e.target,n);if(a===null||i&&((e.target instanceof Element?e.target:null)?.closest(`[data-mark-id], [data-node-id]`)??null)?.getAttribute(`role`)===`link`)return;let o=n.getRegistration(a);if(t.preventDefault?.(),o?.handlePrimary&&o.handlePrimary({nodeId:a,type:o.type,newTab:!1})){u(),d(),n.getActiveNode()===a&&n.setActiveNode(null);return}n.setActiveNode(a)},w=e=>{let t=e;if(t.pointerType!==`mouse`)return;let r=t.target;if(!(r instanceof Element))return;if(lO(r)){d();return}let i=cO(r,n);i!==null&&p(i)},T=e=>{let t=e;if(t.pointerType!==`mouse`)return;let r=t.target,i=t.relatedTarget;if(!(r instanceof Element))return;let a=i instanceof Element?i:null,o=cO(r,n);if(o!==null){if(a&&lO(a)){d();return}if(a&&cO(a,n)===o)return;s===o&&u(),m();return}if(lO(r)){if(a&&lO(a))return;let e=n.getActiveNode();if(e!==null&&a&&cO(a,n)===e)return;m()}},E=e=>{if(g)return;let t=e.target;if(!(t instanceof Element))return;let r=cO(t,n);r!==null&&(u(),d(),n.setActiveNode(r))},D=e=>{let t=e;if(n.getActiveNode()===null)return;let r=t.relatedTarget,i=r instanceof Element?r:null;i&&lO(i)||i&&cO(i,n)!==null||m()},O=e=>{if(n.getActiveNode()===null)return;let t=e.target;t&&(r?.contains(t)||t instanceof Element&&(t.closest(`[data-ok-interaction-layer]`)||t.closest(`[data-ok-prop-panel]`)||t.closest(`[data-ok-layer-spawned]`))||(u(),d(),n.setActiveNode(null)))},k=()=>{i||(r=fO(t),r&&(r.addEventListener(`pointerdown`,y,!0),r.addEventListener(`pointerup`,b,!0),r.addEventListener(`pointercancel`,b,!0),r.addEventListener(`pointermove`,x,!0),r.addEventListener(`click`,S,!0),r.addEventListener(`auxclick`,S,!0),r.addEventListener(`keydown`,C,!0),typeof document<`u`&&(document.addEventListener(`pointerover`,w,!0),document.addEventListener(`pointerout`,T,!0),document.addEventListener(`focusin`,E,!0),document.addEventListener(`focusout`,D,!0),document.addEventListener(`pointerdown`,O,!0)),i=!0))},A=()=>{i&&=(r?.removeEventListener(`pointerdown`,y,!0),r?.removeEventListener(`pointerup`,b,!0),r?.removeEventListener(`pointercancel`,b,!0),r?.removeEventListener(`pointermove`,x,!0),r?.removeEventListener(`click`,S,!0),r?.removeEventListener(`auxclick`,S,!0),r?.removeEventListener(`keydown`,C,!0),typeof document<`u`&&(document.removeEventListener(`pointerover`,w,!0),document.removeEventListener(`pointerout`,T,!0),document.removeEventListener(`focusin`,E,!0),document.removeEventListener(`focusout`,D,!0),document.removeEventListener(`pointerdown`,O,!0)),!1)};return k(),{register(e){n.register(e),i||k()},deregister(e){n.deregister(e)},setActiveNode(e){n.setActiveNode(e)},getActiveNode(){return n.getActiveNode()},getRegistration(e){return n.getRegistration(e)},destroy(){A(),u(),d(),f(),v(),n.clear()},store:n}}var hO=e=>{let t=(0,J.c)(2),{store:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{"data-ok-interaction-layer":``,className:`contents`,children:(0,X.jsx)(dO,{store:n})}),t[0]=n,t[1]=r),r},gO=new WeakMap;function _O(e){let t=gO.get(e);if(t)return t;let n=mO({editor:e});return gO.set(e,n),e.on(`destroy`,()=>{n.destroy(),gO.delete(e)}),n}var vO={AppWindow:Si,ChevronRight:Zn,CopyPlus:Ii,FileText:Hi,Film:Gi,GitBranch:Ji,Image:$i,LayoutPanelTop:na,MessageSquareWarning:da,PanelTop:ha,Paperclip:ga,Sigma:Ca,SquarePlay:Ta,Volume2:Na,Workflow:Pa,ZoomIn:Ia};function yO(e){return e&&Object.hasOwn(vO,e)?vO[e]:Ei}var bO={ChevronRight:Zn};function xO(e){if(!e||!e.startsWith(`lucide:`))return null;let t=e.slice(7);return Object.hasOwn(bO,t)?bO[t]:null}function SO(e){let t=(0,J.c)(24),n;t[0]===e.icon?n=t[1]:(n=xO(e.icon),t[0]=e.icon,t[1]=n);let r=n,i=r?`custom`:void 0,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Zn,{size:14,className:`accordion-chevron`,"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=r?(0,X.jsx)(r,{size:16,className:`accordion-icon`,"aria-hidden":`true`}):null,t[3]=r,t[4]=o);let s=e.title??`Accordion`,c;t[5]===s?c=t[6]:(c=(0,X.jsx)(`span`,{className:`accordion-title`,children:s}),t[5]=s,t[6]=c);let l;t[7]===e.description?l=t[8]:(l=e.description?(0,X.jsx)(`span`,{className:`accordion-description`,children:e.description}):null,t[7]=e.description,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`span`,{className:`accordion-title-group`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==u?(d=(0,X.jsxs)(`summary`,{className:`accordion-summary`,contentEditable:!1,children:[a,o,u]}),t[12]=o,t[13]=u,t[14]=d):d=t[14];let f;t[15]===e.children?f=t[16]:(f=(0,X.jsx)(`div`,{className:`accordion-body`,children:e.children}),t[15]=e.children,t[16]=f);let p;return t[17]!==e.defaultOpen||t[18]!==e.id||t[19]!==e.name||t[20]!==i||t[21]!==d||t[22]!==f?(p=(0,X.jsxs)(`details`,{className:`accordion`,"data-accordion-icon":i,open:e.defaultOpen,id:e.id,name:e.name,children:[d,f]}),t[17]=e.defaultOpen,t[18]=e.id,t[19]=e.name,t[20]=i,t[21]=d,t[22]=f,t[23]=p):p=t[23],p}function CO(e){return e!==!1}function wO(e){let t=(0,J.c)(12),n;t[0]===e.src?n=t[1]:(n=e.src===void 0?void 0:ae(e.src),t[0]=e.src,t[1]=n);let r=e.title,i;t[2]===e.controls?i=t[3]:(i=CO(e.controls),t[2]=e.controls,t[3]=i);let a;return t[4]!==e.autoplay||t[5]!==e.loop||t[6]!==e.muted||t[7]!==e.preload||t[8]!==e.title||t[9]!==n||t[10]!==i?(a=(0,X.jsx)(`audio`,{className:`ok-audio`,src:n,title:r,controls:i,autoPlay:e.autoplay,loop:e.loop,muted:e.muted,preload:e.preload}),t[4]=e.autoplay,t[5]=e.loop,t[6]=e.muted,t[7]=e.preload,t[8]=e.title,t[9]=n,t[10]=i,t[11]=a):a=t[11],a}var TO={note:ea,tip:ra,important:da,warning:g,caution:pa,abstract:Pi,info:Ti,todo:ca,success:ut,question:Mi,failure:Ni,danger:Fa,bug:Di,example:Ki,quote:ya},EO={Info:ea,Lightbulb:ra,MessageSquareWarning:da,AlertTriangle:g,AlertOctagon:pa,ClipboardList:Pi,BookOpen:Ti,ListTodo:ca,CircleCheck:ut,CircleHelp:Mi,CircleX:Ni,Zap:Fa,Bug:Di,FlaskConical:Ki,Quote:ya};function DO(e,t){if(!e||!e.startsWith(`lucide:`))return TO[t];let n=e.slice(7);return Object.hasOwn(EO,n)?EO[n]:TO[t]}var OO=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]);function kO(e){return typeof e==`string`&&OO.has(e)?e:`note`}function AO(e){let t=(0,J.c)(29),n,r;t[0]!==e.icon||t[1]!==e.type?(r=kO(e.type),n=DO(e.icon,r),t[0]=e.icon,t[1]=e.type,t[2]=n,t[3]=r):(n=t[2],r=t[3]);let i=n,a;t[4]===e.color?a=t[5]:(a=e.color?{"--callout-type-color":e.color}:{},t[4]=e.color,t[5]=a);let s=a,c;t[6]!==i||t[7]!==e.title?(c=e.title||i?(0,X.jsxs)(`span`,{className:`callout-header`,contentEditable:!1,children:[(0,X.jsx)(i,{size:16,className:`callout-icon`,"aria-hidden":`true`}),e.title?(0,X.jsx)(`span`,{className:`callout-title`,children:e.title}):null]}):null,t[6]=i,t[7]=e.title,t[8]=c):c=t[8];let l=c;if(e.collapsible){let n=e.defaultOpen??!0,i;t[9]===l?i=t[10]:(i=l??(0,X.jsx)(`span`,{className:`callout-title`,children:(0,X.jsx)(o,{id:`URmyfc`})}),t[9]=l,t[10]=i);let a;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ki,{size:16,className:`callout-chevron`,"aria-hidden":`true`}),t[11]=a):a=t[11];let c;t[12]===i?c=t[13]:(c=(0,X.jsxs)(`summary`,{className:`callout-summary`,contentEditable:!1,children:[i,a]}),t[12]=i,t[13]=c);let u;t[14]===e.children?u=t[15]:(u=(0,X.jsx)(`div`,{className:`callout-body`,children:e.children}),t[14]=e.children,t[15]=u);let d;return t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==u||t[20]!==r?(d=(0,X.jsxs)(`details`,{className:`callout callout-collapsible`,"data-callout-type":r,open:n,style:s,children:[c,u]}),t[16]=n,t[17]=s,t[18]=c,t[19]=u,t[20]=r,t[21]=d):d=t[21],d}let u;t[22]===e.children?u=t[23]:(u=(0,X.jsx)(`div`,{className:`callout-body`,children:e.children}),t[22]=e.children,t[23]=u);let d;return t[24]!==l||t[25]!==s||t[26]!==u||t[27]!==r?(d=(0,X.jsxs)(`div`,{className:`callout callout-static`,"data-callout-type":r,style:s,children:[l,u]}),t[24]=l,t[25]=s,t[26]=u,t[27]=r,t[28]=d):d=t[28],d}var jO=(0,Y.createContext)(null);function MO(e){let t=(0,J.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(jO.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function NO(){return(0,Y.use)(jO)}var PO=[{key:`tl`,dx:-1,dy:-1,cursor:`nwse-resize`,className:`ok-resize-handle ok-resize-handle--tl`},{key:`t`,dx:0,dy:-1,cursor:`ns-resize`,className:`ok-resize-handle ok-resize-handle--t`},{key:`tr`,dx:1,dy:-1,cursor:`nesw-resize`,className:`ok-resize-handle ok-resize-handle--tr`},{key:`r`,dx:1,dy:0,cursor:`ew-resize`,className:`ok-resize-handle ok-resize-handle--r`},{key:`br`,dx:1,dy:1,cursor:`nwse-resize`,className:`ok-resize-handle ok-resize-handle--br`},{key:`b`,dx:0,dy:1,cursor:`ns-resize`,className:`ok-resize-handle ok-resize-handle--b`},{key:`bl`,dx:-1,dy:1,cursor:`nesw-resize`,className:`ok-resize-handle ok-resize-handle--bl`},{key:`l`,dx:-1,dy:0,cursor:`ew-resize`,className:`ok-resize-handle ok-resize-handle--l`}];function FO(e){let t=(0,J.c)(7),{targetRef:n,onResize:r,onResizeEnd:a,bounds:o}=e,{_:s}=i(),c=(0,Y.useRef)(null),l;t[0]!==o?.maxHeight||t[1]!==o?.maxWidth||t[2]!==o?.minHeight||t[3]!==o?.minWidth?(l=function(e,t){let n=t===`w`?o?.minWidth??64:o?.minHeight??64,r=t===`w`?o?.maxWidth??1/0:o?.maxHeight??1/0;return Math.max(n,Math.min(r,e))},t[0]=o?.maxHeight,t[1]=o?.maxWidth,t[2]=o?.minHeight,t[3]=o?.minWidth,t[4]=l):l=t[4];let u=l,d=function(e,t){let i=n.current;if(!i)return;e.preventDefault(),e.stopPropagation();let o=i.getBoundingClientRect();c.current={handle:t,startX:e.clientX,startY:e.clientY,startWidth:o.width,startHeight:o.height,latestWidth:o.width,latestHeight:o.height,hasMoved:!1},document.body.style.setProperty(`cursor`,t.cursor),document.body.style.setProperty(`user-select`,`none`);let s=function(e){let t=c.current;if(!t)return;let n=(e.clientX-t.startX)*t.handle.dx,i=(e.clientY-t.startY)*t.handle.dy,a=t.handle.dx===0?t.startWidth:u(t.startWidth+n,`w`),o=t.handle.dy===0?t.startHeight:u(t.startHeight+i,`h`);t.latestWidth=a,t.latestHeight=o,t.hasMoved=!0,r({width:a,height:o})};function l(){let e=c.current;if(!e)return;let t={width:e.latestWidth,height:e.latestHeight},n=e.hasMoved;c.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,l),window.removeEventListener(`pointercancel`,l),n&&a?.(t)}window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,l),window.addEventListener(`pointercancel`,l)},f=PO.map(e=>{let t=e.key;return(0,X.jsx)(`button`,{type:`button`,className:pn(e.className),"aria-label":s({id:`NxW-md`,values:{handleKey:t}}),tabIndex:-1,style:{cursor:e.cursor},onPointerDown:t=>d(t,e)},t)}),p;return t[5]===f?p=t[6]:(p=(0,X.jsx)(`div`,{className:`ok-resize-overlay`,contentEditable:!1,"aria-hidden":`true`,children:f}),t[5]=f,t[6]=p),p}var IO=`26rem`,LO=`Embedded content`,RO=/^https?:\/\//i;function zO(e){try{return new URL(e).origin!==window.location.origin}catch{return!1}}function BO(e){return!(typeof e!=`string`||!RO.test(e)||!zO(e))}function VO(e){let t=(0,J.c)(21),{src:n,title:r,width:i,height:a}=e,o=(0,Y.useRef)(null),s=NO(),c=i||void 0,l=a||IO,u;t[0]!==c||t[1]!==l?(u={width:c,height:l},t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f,p;if(t[3]!==a||t[4]!==i?(f=()=>{let e=o.current;e&&(e.style.width=i||``,e.style.height=a||IO)},p=[i,a],t[3]=a,t[4]=i,t[5]=f,t[6]=p):(f=t[5],p=t[6]),(0,Y.useEffect)(f,p),!BO(n)){let e=`Embed a URL`;typeof n==`string`&&n.length>0&&(e=RO.test(n)?`Embed only supports cross-origin URLs`:`URL must start with http:// or https://`);let r;return t[7]===e?r=t[8]:(r=(0,X.jsx)(`div`,{className:`ok-embed ok-embed--placeholder`,contentEditable:!1,children:(0,X.jsx)(`span`,{children:e})}),t[7]=e,t[8]=r),r}let m;t[9]===s?m=t[10]:(m=e=>{if(!s)return;let{editor:t,getPos:n}=s,r=n();if(typeof r==`number`)try{let n=t.state.doc.nodeAt(r);if(!n||n.type.name!==`jsxComponent`)return;let i={...n.attrs.props??{},width:`${Math.round(e.width)}px`,height:`${Math.round(e.height)}px`};t.view.dispatch(t.state.tr.setNodeMarkup(r,null,{...n.attrs,props:i,sourceDirty:!0}))}catch(e){let t=e;if(t instanceof RangeError)return;throw t}},t[9]=s,t[10]=m);let h=m,g=r||LO,_;t[11]!==n||t[12]!==g?(_=(0,X.jsx)(`iframe`,{title:g,src:n,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation`,referrerPolicy:`no-referrer`,loading:`lazy`,className:`ok-embed-frame`}),t[11]=n,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==s||t[15]!==h?(v=s?(0,X.jsx)(FO,{targetRef:o,bounds:{minWidth:192,maxWidth:2e3,minHeight:128,maxHeight:Math.round(window.innerHeight*.9)},onResize:e=>{let t=o.current;t&&(t.style.width=`${e.width}px`,t.style.height=`${e.height}px`)},onResizeEnd:h}):null,t[14]=s,t[15]=h,t[16]=v):v=t[16];let y;return t[17]!==d||t[18]!==_||t[19]!==v?(y=(0,X.jsxs)(`div`,{className:`ok-embed`,style:d,ref:o,contentEditable:!1,children:[_,v]}),t[17]=d,t[18]=_,t[19]=v,t[20]=y):y=t[20],y}function HO(e){if(!e)return``;let t,n=null;try{let r=new URL(e,`https://placeholder.local`);n=r.protocol,t=r.pathname}catch{t=e.split(`?`)[0]??e}if(n===`data:`||n===`blob:`)return``;let r=t.split(`/`),i=r[r.length-1]??``;try{return decodeURIComponent(i)}catch{return i}}function UO(e){let t=(0,J.c)(18),n;t[0]!==e.name||t[1]!==e.src?(n=e.name?.trim()||HO(e.src)||`Untitled file`,t[0]=e.name,t[1]=e.src,t[2]=n):n=t[2];let r=n,i=e.size?.trim()?e.size:null,a;t[3]===e.src?a=t[4]:(a=e.src?ae(e.src):void 0,t[3]=e.src,t[4]=a);let o=a,s;t[5]===o?s=t[6]:(s=e=>{e.stopPropagation(),e.preventDefault(),o&&window.open(o,`_blank`,`noopener,noreferrer`)},t[5]=o,t[6]=s);let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(Ui,{className:`ok-file-icon`,"aria-hidden":`true`}),t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,X.jsx)(`span`,{className:`ok-file-name`,children:r}),t[8]=r,t[9]=u);let d;t[10]===i?d=t[11]:(d=i?(0,X.jsx)(`span`,{className:`ok-file-size`,children:i}):null,t[10]=i,t[11]=d);let f;return t[12]!==c||t[13]!==o||t[14]!==e.title||t[15]!==u||t[16]!==d?(f=(0,X.jsxs)(`a`,{href:o,title:e.title,className:`ok-file-attachment`,target:`_blank`,rel:`noopener noreferrer`,onMouseDown:WO,onClick:c,children:[l,u,d]}),t[12]=c,t[13]=o,t[14]=e.title,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function WO(e){return e.stopPropagation()}function GO(){return Y.createElement(`svg`,{"aria-hidden":`true`,"data-rmiz-btn-unzoom-icon":!0,fill:`currentColor`,focusable:`false`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`},Y.createElement(`path`,{d:`M 14.144531 1.148438 L 9 6.292969 L 9 3 L 8 3 L 8 8 L 13 8 L 13 7 L 9.707031 7 L 14.855469 1.851563 Z M 8 8 L 3 8 L 3 9 L 6.292969 9 L 1.148438 14.144531 L 1.851563 14.855469 L 7 9.707031 L 7 13 L 8 13 Z`}))}function KO(){return Y.createElement(`svg`,{"aria-hidden":`true`,"data-rmiz-btn-zoom-icon":!0,fill:`currentColor`,focusable:`false`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`},Y.createElement(`path`,{d:`M 9 1 L 9 2 L 12.292969 2 L 2 12.292969 L 2 9 L 1 9 L 1 14 L 6 14 L 6 13 L 2.707031 13 L 13 2.707031 L 13 6 L 14 6 L 14 1 Z`}))}function qO(e){return typeof Element>`u`?!1:e instanceof Element}var JO=(e,t)=>qO(t)&&t.tagName.toUpperCase()===e,YO=e=>JO(`DIV`,e)||JO(`SPAN`,e),XO=e=>JO(`IMG`,e),ZO=e=>e.complete&&e.naturalHeight!==0,QO=e=>JO(`SVG`,e),$O=({height:e,offset:t,width:n})=>Math.min((window.innerWidth-t*2)/n,(window.innerHeight-t*2)/e),ek=({containerHeight:e,containerWidth:t,offset:n,targetHeight:r,targetWidth:i})=>{let a=$O({height:r,offset:n,width:i}),o=i>r?i/t:r/e;return a>1?o:a*o},tk=({containerHeight:e,containerWidth:t,hasScalableSrc:n,offset:r,targetHeight:i,targetWidth:a})=>e===0||t===0?1:!n&&i!==0&&a!==0?ek({containerHeight:e,containerWidth:t,offset:r,targetHeight:i,targetWidth:a}):$O({height:e,offset:r,width:t}),nk=/url(?:\(['"]?)(?<url>.*?)(?:['"]?\))/,rk=e=>{if(e!==null){if(XO(e))return e.currentSrc===``?void 0:e.currentSrc;if(YO(e)){let{backgroundImage:t}=window.getComputedStyle(e);if(t!==``)return nk.exec(t)?.[1]}}},ik=e=>{if(e!==null)return XO(e)?e.alt:e.getAttribute(`aria-label`)??void 0},ak=({containerHeight:e,containerLeft:t,containerTop:n,containerWidth:r,hasScalableSrc:i,offset:a,targetHeight:o,targetWidth:s})=>{let c=tk({containerHeight:e,containerWidth:r,hasScalableSrc:i,offset:a,targetHeight:o,targetWidth:s});return{top:n,left:t,width:r*c,height:e*c,transform:`translate(0,0) scale(${1/c})`}},ok=({position:e,relativeNum:t})=>{let n=parseFloat(e);return e.endsWith(`%`)?t*n/100:n},sk=({containerHeight:e,containerLeft:t,containerTop:n,containerWidth:r,hasScalableSrc:i,objectFit:a,objectPosition:o,offset:s,targetHeight:c,targetWidth:l})=>{let u=a;if(u===`scale-down`&&(u=l<=r&&c<=e?`none`:`contain`),u===`cover`||u===`contain`){let a=r/l,d=e/c,f=u===`cover`?Math.max(a,d):Math.min(a,d),[p=`50%`,m=`50%`]=o.split(` `),h=ok({position:p,relativeNum:r-l*f}),g=ok({position:m,relativeNum:e-c*f}),_=tk({containerHeight:c*f,containerWidth:l*f,hasScalableSrc:i,offset:s,targetHeight:c,targetWidth:l});return{top:n+g,left:t+h,width:l*f*_,height:c*f*_,transform:`translate(0,0) scale(${1/_})`}}else if(u===`none`){let[a=`50%`,u=`50%`]=o.split(` `),d=ok({position:a,relativeNum:r-l}),f=ok({position:u,relativeNum:e-c}),p=tk({containerHeight:c,containerWidth:l,hasScalableSrc:i,offset:s,targetHeight:c,targetWidth:l});return{top:n+f,left:t+d,width:l*p,height:c*p,transform:`translate(0,0) scale(${1/p})`}}else if(u===`fill`){let t=r/l,n=e/c,a=Math.max(t,n),o=tk({containerHeight:c*a,containerWidth:l*a,hasScalableSrc:i,offset:s,targetHeight:c,targetWidth:l});return{width:r*o,height:e*o,transform:`translate(0,0) scale(${1/o})`}}else return{}},ck=({backgroundPosition:e,backgroundSize:t,containerHeight:n,containerLeft:r,containerTop:i,containerWidth:a,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l})=>{if(t===`cover`||t===`contain`){let u=a/l,d=n/c,f=t===`cover`?Math.max(u,d):Math.min(u,d),[p=`50%`,m=`50%`]=e.split(` `),h=ok({position:p,relativeNum:a-l*f}),g=ok({position:m,relativeNum:n-c*f}),_=tk({containerHeight:c*f,containerWidth:l*f,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l});return{top:i+g,left:r+h,width:l*f*_,height:c*f*_,transform:`translate(0,0) scale(${1/_})`}}else if(t===`auto`){let[t=`50%`,u=`50%`]=e.split(` `),d=ok({position:t,relativeNum:a-l}),f=ok({position:u,relativeNum:n-c}),p=tk({containerHeight:c,containerWidth:l,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l});return{top:i+f,left:r+d,width:l*p,height:c*p,transform:`translate(0,0) scale(${1/p})`}}else{let[u=`50%`,d=`50%`]=t.split(` `),f=ok({position:u,relativeNum:a}),p=ok({position:d,relativeNum:n}),m=f/l,h=p/c,g=Math.min(m,h),[_=`50%`,v=`50%`]=e.split(` `),y=ok({position:_,relativeNum:a-l*g}),b=ok({position:v,relativeNum:n-c*g}),x=tk({containerHeight:c*g,containerWidth:l*g,hasScalableSrc:o,offset:s,targetHeight:c,targetWidth:l});return{top:i+b,left:r+y,width:l*g*x,height:c*g*x,transform:`translate(0,0) scale(${1/x})`}}},lk=/\.svg$/i,uk=({hasZoomImg:e,imgSrc:t,isSvg:n,isZoomed:r,loadedImgEl:i,offset:a,shouldRefresh:o,targetEl:s})=>{let c=n||t?.slice(0,18)===`data:image/svg+xml`||e||t!==void 0&&lk.test(t),l=s.getBoundingClientRect(),u=window.getComputedStyle(s),d=i!=null&&YO(s),f=i!=null&&!d,p=i!=null&&i.naturalHeight!==0?i.naturalHeight:l.height,m=i!=null&&i.naturalWidth!==0?i.naturalWidth:l.width,h=ak({containerHeight:l.height,containerLeft:l.left,containerTop:l.top,containerWidth:l.width,hasScalableSrc:c,offset:a,targetHeight:p,targetWidth:m}),g=f?sk({containerHeight:l.height,containerLeft:l.left,containerTop:l.top,containerWidth:l.width,hasScalableSrc:c,objectFit:u.objectFit,objectPosition:u.objectPosition,offset:a,targetHeight:p,targetWidth:m}):void 0,_=d?ck({backgroundPosition:u.backgroundPosition,backgroundSize:u.backgroundSize,containerHeight:l.height,containerLeft:l.left,containerTop:l.top,containerWidth:l.width,hasScalableSrc:c,offset:a,targetHeight:p,targetWidth:m}):void 0,v={...h,...g,..._};if(r){let e=window.innerWidth/2,t=window.innerHeight/2,n=parseFloat(String(v.left??0))+parseFloat(String(v.width??0))/2,r=parseFloat(String(v.top??0))+parseFloat(String(v.height??0))/2,i=e-n,a=t-r;o&&(v.transitionDuration=`0.01ms`),v.transform=`translate(${i}px,${a}px) scale(1)`}return v},dk=e=>{if(e==null)return{};if(QO(e)){let{parentElement:t}=e,n=e.getBoundingClientRect();if(t==null)return{height:n.height,left:n.left,width:n.width,top:n.top};{let e=t.getBoundingClientRect();return{height:n.height,left:e.left-n.left,top:e.top-n.top,width:n.width}}}else return{height:e.offsetHeight,left:e.offsetLeft,width:e.offsetWidth,top:e.offsetTop}},fk=e=>{let t=`-zoom`,n=[`clip-path`,`fill`,`mask`,`marker-start`,`marker-mid`,`marker-end`],r=new Map;if(e.hasAttribute(`id`)){let{id:n}=e,i=n+t;r.set(n,i);let a=e;a.id=i}e.querySelectorAll(`[id]`).forEach(e=>{let{id:n}=e,i=n+t;r.set(n,i);let a=e;a.id=i}),r.forEach((t,r)=>{let i=`url(#${r})`,a=`url(#${t})`,o=n.map(e=>`[${e}="${i}"]`).join(`, `);e.querySelectorAll(o).forEach(e=>{n.forEach(t=>{e.getAttribute(t)===i&&e.setAttribute(t,a)})})}),e.querySelectorAll(`style`).forEach(e=>{r.forEach((t,n)=>{let{textContent:r}=e;if(r!==``){let i=e;i.textContent=r.replaceAll(`#${n}`,`#${t}`)}})})},pk=[`img`,`svg`,`[role="img"]`,`[data-zoom]`].map(e=>`${e}:not([aria-hidden="true"])`).join(`,`),mk={overflow:``,width:``};function hk(){let e=document.querySelector(`[data-rmiz-portal]`);if(e!=null)return e;let t=document.createElement(`div`);return t.setAttribute(`data-rmiz-portal`,``),document.body.appendChild(t),t}function gk(e){e.preventDefault()}function _k(e){return Y.createElement(vk,{...e})}var vk=class extends Y.Component{constructor(){super(...arguments),this.state={id:``,isZoomImgLoaded:!1,loadedImgEl:void 0,modalState:`UNLOADED`,shouldRefresh:!1,styleGhost:{}},this.refContent=Y.createRef(),this.refDialog=Y.createRef(),this.refModalContent=Y.createRef(),this.refModalImg=Y.createRef(),this.refWrap=Y.createRef(),this.imgEl=null,this.isScaling=!1,this.prevBodyAttrs=mk,this.styleModalImg={},this.handleModalStateChange=e=>{let{state:{modalState:t}}=this;e!==`LOADING`&&t===`LOADING`?(this.loadZoomImg(),window.addEventListener(`resize`,this.handleResize,{passive:!0}),window.addEventListener(`touchstart`,this.handleTouchStart,{passive:!0}),window.addEventListener(`touchmove`,this.handleTouchMove,{passive:!0}),window.addEventListener(`touchend`,this.handleTouchEnd,{passive:!0}),window.addEventListener(`touchcancel`,this.handleTouchCancel,{passive:!0}),document.addEventListener(`keydown`,this.handleKeyDown,!0)):e!==`LOADED`&&t===`LOADED`?window.addEventListener(`wheel`,this.handleWheel,{passive:!0}):e!==`UNLOADING`&&t===`UNLOADING`?(this.ensureImgTransitionEnd(),window.removeEventListener(`wheel`,this.handleWheel),window.removeEventListener(`touchstart`,this.handleTouchStart),window.removeEventListener(`touchmove`,this.handleTouchMove),window.removeEventListener(`touchend`,this.handleTouchEnd),window.removeEventListener(`touchcancel`,this.handleTouchCancel),document.removeEventListener(`keydown`,this.handleKeyDown,!0)):e!==`UNLOADED`&&t===`UNLOADED`&&(this.bodyScrollEnable(),window.removeEventListener(`resize`,this.handleResize),this.refModalImg.current?.removeEventListener(`transitionend`,this.handleImgTransitionEnd),this.refDialog.current?.close())},this.setId=()=>{let e=()=>Math.random().toString(16).slice(-4);this.setState({id:e()+e()+e()})},this.setAndTrackImg=()=>{let{refContent:{current:e}}=this;e!=null&&(this.imgEl=e.querySelector(pk),this.imgEl===null?this.contentNotFoundChangeObserver??(this.contentNotFoundChangeObserver=new MutationObserver(this.setAndTrackImg),this.contentNotFoundChangeObserver.observe(e,{childList:!0,subtree:!0})):(this.contentNotFoundChangeObserver?.disconnect(),this.imgEl.addEventListener(`load`,this.handleImgLoad),this.imgEl.addEventListener(`click`,this.handleZoom),this.state.loadedImgEl??this.handleImgLoad(),this.imgElResizeObserver=new ResizeObserver(e=>{let[t]=e;t?.target!==void 0&&(this.imgEl=t.target,this.setState({styleGhost:dk(this.imgEl)}))}),this.imgElResizeObserver.observe(this.imgEl),this.contentChangeObserver??(this.contentChangeObserver=new MutationObserver(()=>{this.setState({styleGhost:dk(this.imgEl)})}),this.contentChangeObserver.observe(e,{attributes:!0,childList:!0,subtree:!0}))))},this.handleIfZoomChanged=e=>{let{props:{isZoomed:t}}=this;!e&&t?this.zoom():e&&!t&&this.unzoom()},this.handleImgLoad=()=>{let e=rk(this.imgEl);if(e==null||e===``)return;let t=new Image,{imgEl:n}=this;if(XO(n)){let{sizes:e,srcset:r,crossOrigin:i}=n;t.sizes=e,t.srcset=r,t.crossOrigin=i}t.src=e;let r=()=>{this.setState({loadedImgEl:t,styleGhost:dk(this.imgEl)})};t.decode().then(r).catch(()=>{if(ZO(t)){r();return}t.onload=r})},this.handleZoom=e=>{this.props.isDisabled!==!0&&this.hasImage()&&this.props.onZoomChange?.(!0,{event:e})},this.handleUnzoom=e=>{this.props.isDisabled!==!0&&this.props.onZoomChange?.(!1,{event:e})},this.handleBtnUnzoomClick=e=>{e.preventDefault(),e.stopPropagation(),this.handleUnzoom(e)},this.handleDialogClick=e=>{(e.target===this.refModalContent.current||e.target===this.refModalImg.current)&&(e.stopPropagation(),this.handleUnzoom(e))},this.handleDialogClose=e=>{e.stopPropagation(),this.handleUnzoom(e)},this.handleKeyDown=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.handleUnzoom(e))},this.handleWheel=e=>{e.ctrlKey||(e.stopPropagation(),queueMicrotask(()=>{this.handleUnzoom(e)}))},this.handleTouchStart=e=>{if(e.touches.length>1){this.isScaling=!0;return}let{changedTouches:t}=e,[n]=t;if(t.length===1&&n!==void 0){let{screenY:e}=n;this.touchYStart=e}},this.handleTouchMove=e=>{let t=window.visualViewport?.scale??1,{changedTouches:n}=e,[r]=n;if(this.props.canSwipeToUnzoom&&!this.isScaling&&t<=1&&this.touchYStart!=null&&r!==void 0){let{screenY:t}=r;this.touchYEnd=t;let n=Math.max(this.touchYStart,this.touchYEnd),i=Math.min(this.touchYStart,this.touchYEnd);Math.abs(n-i)>this.props.swipeToUnzoomThreshold&&(this.touchYStart=void 0,this.touchYEnd=void 0,this.handleUnzoom(e))}},this.handleTouchEnd=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleTouchCancel=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleResize=()=>{this.setState({shouldRefresh:!0})},this.hasImage=()=>this.imgEl!==null&&(this.state.loadedImgEl!==void 0||QO(this.imgEl))&&window.getComputedStyle(this.imgEl).display!==`none`,this.zoom=()=>{this.bodyScrollDisable(),this.refDialog.current?.showModal(),this.refModalImg.current?.addEventListener(`transitionend`,this.handleImgTransitionEnd),this.setState({modalState:`LOADING`})},this.unzoom=()=>{this.setState({modalState:`UNLOADING`})},this.handleImgTransitionEnd=()=>{clearTimeout(this.timeoutTransitionEnd),this.state.modalState===`LOADING`?this.setState({modalState:`LOADED`}):this.state.modalState===`UNLOADING`&&this.setState({shouldRefresh:!1,modalState:`UNLOADED`})},this.ensureImgTransitionEnd=()=>{if(this.refModalImg.current!==null){let{transitionDuration:e}=window.getComputedStyle(this.refModalImg.current),t=parseFloat(e);if(t!==0&&!Number.isNaN(t)){let n=t*(e.endsWith(`ms`)?1:1e3)+50;this.timeoutTransitionEnd=setTimeout(this.handleImgTransitionEnd,n)}}},this.bodyScrollDisable=()=>{this.prevBodyAttrs={overflow:document.body.style.overflow,width:document.body.style.width};let{body:{clientWidth:e}}=document;document.body.style.overflow=`hidden`,document.body.style.width=`${e}px`},this.bodyScrollEnable=()=>{let{prevBodyAttrs:{overflow:e,width:t}}=this;document.body.style.width=t,document.body.style.overflow=e,this.prevBodyAttrs=mk},this.loadZoomImg=()=>{let{props:{zoomImg:e}}=this;if(e==null)return;let{src:t}=e;if(t!==void 0&&t!==``){let n=new Image;n.sizes=e.sizes??``,n.srcset=e.srcSet??``,n.crossOrigin=e.crossOrigin??void 0,n.src=t;let r=()=>{this.setState({isZoomImgLoaded:!0})};n.decode().then(r).catch(()=>{if(ZO(n)){r();return}n.onload=r})}},this.UNSAFE_handleSvg=()=>{let{imgEl:e,refModalImg:t,styleModalImg:n}=this;if(QO(e)){let r=e.cloneNode(!0);fk(r),r.style.width=`${n.width??0}px`,r.style.height=`${n.height??0}px`,r.addEventListener(`click`,this.handleUnzoom),t.current?.firstChild?.remove(),t.current?.appendChild(r)}}}render(){let{handleBtnUnzoomClick:e,handleDialogClick:t,handleDialogClose:n,handleUnzoom:r,handleZoom:i,imgEl:a,props:{a11yNameButtonUnzoom:o,a11yNameButtonZoom:s,children:c,classDialog:l,IconUnzoom:u,IconZoom:d,isZoomed:f,wrapElement:p,ZoomContent:m,zoomImg:h,zoomMargin:g},refContent:_,refDialog:v,refModalContent:y,refModalImg:b,refWrap:x,state:{id:S,isZoomImgLoaded:C,loadedImgEl:w,modalState:T,shouldRefresh:E,styleGhost:D}}=this,O=`rmiz-modal-${S}`,k=`rmiz-modal-img-${S}`,A=YO(a),j=XO(a),M=QO(a),N=ik(a),P=rk(a),F=j?a.sizes:void 0,I=j?a.srcset:void 0,L=j?a.crossOrigin:void 0,R=h?.src!==void 0&&h.src!==``,ee=this.hasImage(),te=N!==void 0&&N!==``?`${s}: ${N}`:s,ne=T===`LOADING`||T===`LOADED`,z=ee?`found`:`not-found`,B=T===`UNLOADED`||T===`UNLOADING`?`hidden`:`visible`,re={visibility:T===`UNLOADED`?`visible`:`hidden`};this.styleModalImg=ee&&a!==null?uk({hasZoomImg:R,imgSrc:P,isSvg:M,isZoomed:f&&ne,loadedImgEl:w,offset:g,shouldRefresh:E,targetEl:a}):{};let V=null;if(ee){let t=j||A?Y.createElement(`img`,{alt:N,crossOrigin:L,sizes:F,src:P,srcSet:I,...C&&T===`LOADED`?h:{},"data-rmiz-modal-img":``,height:this.styleModalImg.height??void 0,id:k,ref:b,style:this.styleModalImg,width:this.styleModalImg.width??void 0}):M?Y.createElement(`div`,{"data-rmiz-modal-img":!0,ref:b,style:this.styleModalImg}):null,n=Y.createElement(`button`,{"aria-label":o,"data-rmiz-btn-unzoom":``,onClick:e,type:`button`},Y.createElement(u,null));V=m==null?Y.createElement(Y.Fragment,null,t,n):Y.createElement(m,{buttonUnzoom:n,modalState:T,img:t,isZoomImgLoaded:C,onUnzoom:r})}return Y.createElement(p,{"aria-owns":ee?O:void 0,"data-rmiz":``,ref:x},Y.createElement(p,{"data-rmiz-content":z,ref:_,style:re},c),ee&&Y.createElement(p,{"data-rmiz-ghost":``,style:D},Y.createElement(`button`,{"aria-label":te,"data-rmiz-btn-zoom":``,onClick:i,type:`button`},Y.createElement(d,null))),ee&&Va.createPortal(Y.createElement(`dialog`,{"aria-labelledby":k,"aria-modal":`true`,className:l,"data-rmiz-modal":``,id:O,onClick:t,onClose:n,onCancel:gk,ref:v,role:`dialog`},Y.createElement(`div`,{"data-rmiz-modal-overlay":B}),Y.createElement(`div`,{"data-rmiz-modal-content":``,ref:y},V)),hk()))}componentDidMount(){this.setId(),this.setAndTrackImg(),this.handleImgLoad(),this.UNSAFE_handleSvg()}componentWillUnmount(){this.state.modalState!==`UNLOADED`&&this.bodyScrollEnable(),this.contentChangeObserver?.disconnect(),this.contentNotFoundChangeObserver?.disconnect(),this.imgElResizeObserver?.disconnect(),this.imgEl?.removeEventListener(`load`,this.handleImgLoad),this.imgEl?.removeEventListener(`click`,this.handleZoom),this.refModalImg.current?.removeEventListener(`transitionend`,this.handleImgTransitionEnd),window.removeEventListener(`wheel`,this.handleWheel),window.removeEventListener(`touchstart`,this.handleTouchStart),window.removeEventListener(`touchmove`,this.handleTouchMove),window.removeEventListener(`touchend`,this.handleTouchEnd),window.removeEventListener(`touchcancel`,this.handleTouchCancel),window.removeEventListener(`resize`,this.handleResize),document.removeEventListener(`keydown`,this.handleKeyDown,!0)}componentDidUpdate(e,t){this.handleModalStateChange(t.modalState),this.UNSAFE_handleSvg(),this.handleIfZoomChanged(e.isZoomed)}};vk.defaultProps={a11yNameButtonUnzoom:`Minimize image`,a11yNameButtonZoom:`Expand image`,canSwipeToUnzoom:!0,IconUnzoom:GO,IconZoom:KO,isDisabled:!1,swipeToUnzoomThreshold:10,wrapElement:`div`,zoomMargin:0};function yk({onZoomChange:e,...t}){let[n,r]=Y.useState(!1),i=Y.useCallback((t,{event:n})=>{r(t),e?.(t,{event:n})},[e]);return Y.createElement(_k,{...t,isZoomed:n,onZoomChange:i})}function bk(e,t){return typeof e==`number`&&typeof t==`number`&&e>0&&t>0}function xk(e,t,n){return bk(e,t)?{...n,width:`${e}px`,aspectRatio:`${e} / ${t}`}:n}function Sk(e){let t=(0,J.c)(52),n,r,a,o,s,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({width:m,height:r,loadingTestId:d,slotTestId:f,slotClassName:c,className:n,onLoad:s,onError:o,src:l,style:u,alt:p,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=d===void 0?`image-loading-skeleton`:d,g=f===void 0?`image-slot`:f,_=p===void 0?``:p,{_:v}=i(),y=(0,Y.useRef)(null),[b,x]=(0,Y.useState)(!1),S;t[13]!==r||t[14]!==m?(S=bk(m,r),t[13]=r,t[14]=m,t[15]=S):S=t[15];let C=S,w;t[16]!==r||t[17]!==u||t[18]!==m?(w=xk(m,r,u),t[16]=r,t[17]=u,t[18]=m,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{y.current?.complete?x(!0):x(!1)},t[20]=E):E=t[20];let D;t[21]===l?D=t[22]:(D=[l],t[21]=l,t[22]=D),(0,Y.useLayoutEffect)(E,D);let O=!C&&!b&&`aspect-[16/9] w-full max-w-full`,k;t[23]!==c||t[24]!==O?(k=pn(`relative inline-block overflow-hidden`,O,c),t[23]=c,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==v||t[27]!==b||t[28]!==h?(A=!b&&(0,X.jsx)(`span`,{"data-testid":h,role:`status`,"aria-busy":`true`,"aria-label":v({id:`N1YYa7`}),className:`absolute inset-0 animate-pulse rounded-md bg-muted motion-reduce:animate-none`}),t[26]=v,t[27]=b,t[28]=h,t[29]=A):A=t[29];let j=b?`opacity-100`:`opacity-0`,M;t[30]!==n||t[31]!==j?(M=pn(`block max-w-full transition-opacity motion-reduce:transition-none`,j,n),t[30]=n,t[31]=j,t[32]=M):M=t[32];let N;t[33]===s?N=t[34]:(N=e=>{x(!0),s?.(e)},t[33]=s,t[34]=N);let P;t[35]===o?P=t[36]:(P=e=>{x(!0),o?.(e)},t[35]=o,t[36]=P);let F;t[37]!==_||t[38]!==r||t[39]!==a||t[40]!==l||t[41]!==M||t[42]!==N||t[43]!==P||t[44]!==m?(F=(0,X.jsx)(`img`,{...a,ref:y,src:l,alt:_,width:m,height:r,className:M,onLoad:N,onError:P}),t[37]=_,t[38]=r,t[39]=a,t[40]=l,t[41]=M,t[42]=N,t[43]=P,t[44]=m,t[45]=F):F=t[45];let I;return t[46]!==T||t[47]!==g||t[48]!==A||t[49]!==F||t[50]!==k?(I=(0,X.jsxs)(`span`,{"data-testid":g,className:k,style:T,children:[A,F]}),t[46]=T,t[47]=g,t[48]=A,t[49]=F,t[50]=k,t[51]=I):I=t[51],I}function Ck(e){return e??`lazy`}function wk(e){if(typeof e!=`string`)return e;let t=Number(e);return Number.isFinite(t)&&t>0?t:e}function Tk(e){let t=(0,J.c)(21),n;t[0]===e.src?n=t[1]:(n=e.src===void 0?void 0:ae(e.src),t[0]=e.src,t[1]=n);let r=e.alt??``,i;t[2]===e.width?i=t[3]:(i=wk(e.width),t[2]=e.width,t[3]=i);let a;t[4]===e.height?a=t[5]:(a=wk(e.height),t[4]=e.height,t[5]=a);let o=e.title,s;t[6]===e.loading?s=t[7]:(s=Ck(e.loading),t[6]=e.loading,t[7]=s);let c;return t[8]!==e.crossorigin||t[9]!==e.decoding||t[10]!==e.fetchpriority||t[11]!==e.referrerpolicy||t[12]!==e.sizes||t[13]!==e.srcset||t[14]!==e.title||t[15]!==n||t[16]!==r||t[17]!==i||t[18]!==a||t[19]!==s?(c=(0,X.jsx)(Sk,{src:n,alt:r,width:i,height:a,title:o,loading:s,srcSet:e.srcset,sizes:e.sizes,decoding:e.decoding,fetchPriority:e.fetchpriority,crossOrigin:e.crossorigin,referrerPolicy:e.referrerpolicy}),t[8]=e.crossorigin,t[9]=e.decoding,t[10]=e.fetchpriority,t[11]=e.referrerpolicy,t[12]=e.sizes,t[13]=e.srcset,t[14]=e.title,t[15]=n,t[16]=r,t[17]=i,t[18]=a,t[19]=s,t[20]=c):c=t[20],c}function Ek(e){let t=(0,J.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={sizes:void 0},t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,X.jsx)(yk,{wrapElement:`span`,zoomMargin:20,zoomImg:n,children:(0,X.jsx)(Tk,{...e})}),t[1]=e,t[2]=r),r}var Dk=(0,Y.lazy)(async()=>{let{default:e}=await n(async()=>{let{default:e}=await import(`./katex-DX-tM4Fr.js`);return{default:e}},[],import.meta.url);function t(t){let n=(0,J.c)(7),r;n[0]===t.formula?r=n[1]:(r=e.renderToString(t.formula,{displayMode:!0,throwOnError:!1,strict:`ignore`,trust:!1}),n[0]=t.formula,n[1]=r);let i=r,a;n[2]===i?a=n[3]:(a={__html:i},n[2]=i,n[3]=a);let o;return n[4]!==t.id||n[5]!==a?(o=(0,X.jsx)(`div`,{className:`math math-display`,"data-component-type":`math`,id:t.id,dangerouslySetInnerHTML:a}),n[4]=t.id,n[5]=a,n[6]=o):o=n[6],o}return{default:t}});function Ok(e){let t=(0,J.c)(3),n=e.formula||`\xA0`,r;return t[0]!==e.id||t[1]!==n?(r=(0,X.jsx)(`div`,{className:`math math-placeholder`,"data-component-type":`math`,id:e.id,children:n}),t[0]=e.id,t[1]=n,t[2]=r):r=t[2],r}function kk(e){let t=(0,J.c)(6),n=e.formula??``;if(!n){let r;return t[0]!==n||t[1]!==e.id?(r=(0,X.jsx)(Ok,{formula:n,id:e.id}),t[0]=n,t[1]=e.id,t[2]=r):r=t[2],r}let r;return t[3]!==n||t[4]!==e.id?(r=(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ok,{formula:n,id:e.id}),children:(0,X.jsx)(Dk,{formula:n,id:e.id})}),t[3]=n,t[4]=e.id,t[5]=r):r=t[5],r}var Ak=null;function jk(){return Ak||=n(()=>import(`./mermaid.core-DRx0wZe0.js`).then(e=>{let t=e.default;return t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`default`,suppressErrorRendering:!0}),t}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url).catch(e=>{throw Ak=null,e}),Ak}function Mk(e){let t=(0,J.c)(22),n=e.chart??``,r=(0,Y.useId)(),i;if(t[0]!==r){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/:/g,t[2]=e):e=t[2],i=r.replace(e,`_`),t[0]=r,t[1]=i}else i=t[1];let a=`mermaid-${i}`,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={status:`idle`,svg:``,error:``},t[3]=o):o=t[3];let[s,c]=(0,Y.useState)(o),l,u;if(t[4]!==n||t[5]!==a?(l=()=>{if(!n.trim()){c({status:`idle`,svg:``,error:``});return}let e=!1;return c(Nk),jk().then(async t=>{try{let r=await t.render(a,n);e||c({status:`ready`,svg:r.svg,error:``})}catch(t){let n=t;e||c({status:`error`,svg:``,error:n instanceof Error?n.message:String(n)})}}).catch(t=>{e||c({status:`error`,svg:``,error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},u=[n,a],t[4]=n,t[5]=a,t[6]=l,t[7]=u):(l=t[6],u=t[7]),(0,Y.useEffect)(l,u),!n.trim()){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`mermaid mermaid-placeholder`,"data-component-type":`mermaid`,children:(0,X.jsx)(`span`,{className:`mermaid-empty`,children:` `})}),t[8]=e):e=t[8],e}if(s.status===`error`){let e;t[9]===n?e=t[10]:(e=(0,X.jsx)(`pre`,{className:`mermaid-error-source`,children:n}),t[9]=n,t[10]=e);let r;t[11]===s.error?r=t[12]:(r=(0,X.jsx)(`p`,{className:`mermaid-error-message`,children:s.error}),t[11]=s.error,t[12]=r);let i;return t[13]!==s.error||t[14]!==e||t[15]!==r?(i=(0,X.jsxs)(`div`,{className:`mermaid mermaid-error`,"data-component-type":`mermaid`,title:s.error,children:[e,r]}),t[13]=s.error,t[14]=e,t[15]=r,t[16]=i):i=t[16],i}let d=`mermaid mermaid-${s.status}`,f;t[17]===s.svg?f=t[18]:(f={__html:s.svg},t[17]=s.svg,t[18]=f);let p;return t[19]!==d||t[20]!==f?(p=(0,X.jsx)(`div`,{className:d,"data-component-type":`mermaid`,dangerouslySetInnerHTML:f}),t[19]=d,t[20]=f,t[21]=p):p=t[21],p}function Nk(e){return{...e,status:`rendering`}}var Pk=null;function Fk(){return Pk||=new be({extensions:z}),Pk}function Ik(e,t){if(e.type===`mdxJsxFlowElement`){let n=e;if(n.name===`MirrorSource`){for(let e of n.attributes??[])if(e.type===`mdxJsxAttribute`&&e.name===`id`&&typeof e.value==`string`&&e.value===t)return n}}let n=e.children;if(Array.isArray(n))for(let e of n){let n=Ik(e,t);if(n)return n}return null}function Lk(e){return Zt({type:`root`,children:e.children??[]})}var Rk=new Map,zk=30,Bk=150,Vk=1e4;function Hk(e,t){let n=`${e}|${t}`,r=Rk.get(n);if(r)return r.refcount+=1,r;let i=new Fm,a=new TE({url:e,name:t,document:i}),o=new Set,s={provider:a,ySource:i.getText(`source`),refcount:1,synced:!1,subscribers:o};return a.on(`synced`,()=>{s.synced=!0;for(let e of o)e.onSynced()}),s.ySource.observe(()=>{for(let e of o)e.onUpdate()}),Rk.set(n,s),Rk.size>zk&&console.warn(`[Mirror] provider pool exceeded ${zk} entries (current=${Rk.size}). Many Mirrors pointing at distinct source docs — investigate if this is a runaway pattern.`),s}function Uk(e,t){let n=`${e}|${t}`,r=Rk.get(n);if(r&&(--r.refcount,r.refcount<=0)){try{r.provider.destroy()}catch(e){console.warn(`[Mirror] provider.destroy() failed during release`,{src:t,err:e})}Rk.delete(n)}}function Wk(e,t){let n=(0,J.c)(8),{collabUrl:r}=kx(),i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`loading`},n[0]=i):i=n[0];let[a,o]=(0,Y.useState)(i),s=(0,Y.useRef)(t),c=(0,Y.useRef)(null),l,u;n[1]!==r||n[2]!==e?(l=()=>{if(!e){o({kind:`empty-props`});return}if(!r){o({kind:`loading`});return}let t=Hk(r,e),n=()=>{let n=s.current;if(!n){o({kind:`empty-props`});return}let r=t.ySource.toString();if(!r){o(t.synced?{kind:`source-removed`}:{kind:`loading`});return}let i;try{i=Fk().parseToMdast(r)}catch(t){console.warn(`[Mirror] parseToMdast failed`,{src:e,anchor:n,err:t}),o({kind:`source-removed`});return}let a=Ik(i,n);if(!a){o({kind:`anchor-not-found`});return}let c;try{c=Lk(a)}catch(t){console.warn(`[Mirror] renderMirrorSubtree failed`,{src:e,anchor:n,err:t}),o({kind:`anchor-not-found`});return}o({kind:`ready`,html:c})},i=null,a={onUpdate:()=>{i&&clearTimeout(i),i=setTimeout(()=>{i=null,n()},Bk)},onSynced:()=>{i&&=(clearTimeout(i),null),n()}};t.subscribers.add(a),c.current=n;let l=setTimeout(()=>{t.synced||o({kind:`source-removed`})},Vk);return n(),()=>{clearTimeout(l),i&&clearTimeout(i),t.subscribers.delete(a),c.current=null,Uk(r,e)}},u=[r,e],n[1]=r,n[2]=e,n[3]=l,n[4]=u):(l=n[3],u=n[4]),(0,Y.useEffect)(l,u);let d,f;return n[5]===t?(d=n[6],f=n[7]):(d=()=>{s.current=t,c.current?.()},f=[t],n[5]=t,n[6]=d,n[7]=f),(0,Y.useEffect)(d,f),a}function Gk(e){let t=(0,J.c)(8),n=`ok-mirror-state flex items-start gap-2 rounded-md border border-dashed px-3 py-2 text-sm ${e.tone===`error`?`border-destructive/40 text-destructive`:`border-border text-muted-foreground`}`,r;t[0]===e.tone?r=t[1]:(r=e.tone===`error`?(0,X.jsx)(ia,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}):(0,X.jsx)(oa,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}),t[0]=e.tone,t[1]=r);let i;t[2]===e.children?i=t[3]:(i=(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:e.children}),t[2]=e.children,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,X.jsxs)(`div`,{className:n,children:[r,i]}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Kk(e){let t=(0,J.c)(30),n=e.src??``,r=e.anchor??``,i=Wk(n,r);if(i.kind===`empty-props`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Gk,{tone:`placeholder`,children:(0,X.jsx)(o,{id:`3SDfZl`,components:{0:(0,X.jsx)(`span`,{className:`font-medium`}),1:(0,X.jsx)(`code`,{}),2:(0,X.jsx)(`code`,{}),3:(0,X.jsx)(`code`,{})}})}),t[0]=e):e=t[0],e}if(i.kind===`loading`){let e=n&&r?`${n}#${r}`:``,i;t[1]===e?i=t[2]:(i={mirrorRef:e},t[1]=e,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a={0:(0,X.jsx)(`code`,{})},t[3]=a):a=t[3];let s;return t[4]===i?s=t[5]:(s=(0,X.jsx)(Gk,{tone:`placeholder`,children:(0,X.jsx)(o,{id:`92rbk2`,values:i,components:a})}),t[4]=i,t[5]=s),s}if(i.kind===`source-removed`){let e;t[6]===n?e=t[7]:(e={src:n},t[6]=n,t[7]=e);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,X.jsx)(`span`,{className:`font-medium`}),1:(0,X.jsx)(`code`,{})},t[8]=r):r=t[8];let i;return t[9]===e?i=t[10]:(i=(0,X.jsx)(Gk,{tone:`error`,children:(0,X.jsx)(o,{id:`Ud0Pj9`,values:e,components:r})}),t[9]=e,t[10]=i),i}if(i.kind===`anchor-not-found`){let e=`<MirrorSource id="${r}">`,i;t[11]!==e||t[12]!==n?(i={mirrorSourceTag:e,src:n},t[11]=e,t[12]=n,t[13]=i):i=t[13];let a;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(a={0:(0,X.jsx)(`span`,{className:`font-medium`}),1:(0,X.jsx)(`code`,{}),2:(0,X.jsx)(`code`,{})},t[14]=a):a=t[14];let s;return t[15]===i?s=t[16]:(s=(0,X.jsx)(Gk,{tone:`error`,children:(0,X.jsx)(o,{id:`mqSwZH`,values:i,components:a})}),t[15]=i,t[16]=s),s}let a;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Li,{className:`size-3`,"aria-hidden":`true`}),t[17]=a):a=t[17];let s;t[18]===n?s=t[19]:(s={src:n},t[18]=n,t[19]=s);let c;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(c={0:(0,X.jsx)(`code`,{className:`font-mono`})},t[20]=c):c=t[20];let l;t[21]===s?l=t[22]:(l=(0,X.jsxs)(`div`,{className:`ok-mirror-badge pointer-events-none absolute -top-2.5 left-2 flex items-center gap-1 rounded-md bg-background px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity [.jsx-component-wrapper:hover_&]:opacity-100 [.jsx-component-wrapper[data-selected="true"]_&]:opacity-100`,"aria-hidden":`true`,children:[a,(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`wQp1V3`,values:s,components:c})})]}),t[21]=s,t[22]=l);let u;t[23]===i.html?u=t[24]:(u=(0,X.jsx)(`div`,{dangerouslySetInnerHTML:{__html:i.html}}),t[23]=i.html,t[24]=u);let d;return t[25]!==r||t[26]!==n||t[27]!==l||t[28]!==u?(d=(0,X.jsxs)(`div`,{className:`ok-mirror-resolved relative -mx-3 prose-no-margin rounded-md border border-dashed border-transparent px-3 py-2 transition-colors [.jsx-component-wrapper:hover_&]:border-border/40 [.jsx-component-wrapper[data-selected="true"]_&]:border-border/40`,"data-mirror-src":n,"data-mirror-anchor":r,children:[l,u]}),t[25]=r,t[26]=n,t[27]=l,t[28]=u,t[29]=d):d=t[29],d}function qk(e){let t=(0,J.c)(15),{_:n}=i(),r=e.id??``,a;t[0]!==n||t[1]!==r?(a=r||n({id:`12F9WL`}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let s=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(Ii,{className:`size-3`,"aria-hidden":`true`}),t[3]=c):c=t[3];let l;t[4]===s?l=t[5]:(l={label:s},t[4]=s,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={0:(0,X.jsx)(`code`,{className:`font-mono`})},t[6]=u):u=t[6];let d;t[7]===l?d=t[8]:(d=(0,X.jsxs)(`div`,{className:`ok-mirror-source-badge pointer-events-none absolute -top-2.5 left-2 flex items-center gap-1 rounded-md bg-background px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity [.jsx-component-wrapper:hover_&]:opacity-100 [.jsx-component-wrapper[data-selected="true"]_&]:opacity-100`,children:[c,(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`Zon_qG`,values:l,components:u})})]}),t[7]=l,t[8]=d);let f;t[9]===e.children?f=t[10]:(f=(0,X.jsx)(`div`,{children:e.children}),t[9]=e.children,t[10]=f);let p;return t[11]!==r||t[12]!==d||t[13]!==f?(p=(0,X.jsxs)(`div`,{className:`ok-mirror-source relative -mx-3 rounded-md border border-dashed border-transparent px-3 py-1 transition-colors [.jsx-component-wrapper:hover_&]:border-border/50 [.jsx-component-wrapper[data-selected="true"]_&]:border-border/50`,"data-mirror-source-id":r,children:[d,f]}),t[11]=r,t[12]=d,t[13]=f,t[14]=p):p=t[14],p}var Jk=24,Yk=24,Xk=12,Zk=.1;function Qk(e,t,n,r){if(n<=0&&(e===`fit-width`||e===`two-odd`||e===`two-even`)||r<=0&&e===`fit-height`)return 1;switch(e){case`fit-width`:return Math.max(Zk,(n-Jk)/t.naturalWidth);case`fit-height`:return Math.max(Zk,(r-Yk)/t.naturalHeight);case`single`:return 1;case`two-odd`:case`two-even`:return Math.max(Zk,((n-Jk)/2-Xk)/t.naturalWidth)}}var $k=600,eA=.5,tA=3,nA=.25,rA=null;function iA(){return rA||(rA=(async()=>{let e=await n(()=>import(`./pdf-wFLJduM2.js`),__vite__mapDeps([24,1]),import.meta.url);if(!e.GlobalWorkerOptions.workerSrc){let t=(await n(async()=>{let{default:e}=await import(`./pdf.worker-CP44mBOj.js`);return{default:e}},[],import.meta.url)).default;e.GlobalWorkerOptions.workerSrc=t}return e})(),rA.catch(()=>{rA=null})),rA}function aA(e){return e instanceof Error&&e.name===`RenderingCancelledException`}function oA(e){let t=(0,J.c)(96),n,r;if(t[0]!==e.anchor||t[1]!==e.fillContainer){let{height:i,viewerFragment:a}=he(e.anchor);n=i===null?e.fillContainer?`100%`:`${$k}px`:`${i}px`,r=fA(a),t[0]=e.anchor,t[1]=e.fillContainer,t[2]=n,t[3]=r}else n=t[2],r=t[3];let a=r,s=(0,Y.useRef)(null),c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[4]=c):c=t[4];let l=(0,Y.useRef)(c),u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[5]=u):u=t[5];let d=(0,Y.useRef)(u),f=(0,Y.useRef)(null),p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[6]=p):p=t[6];let[m,h]=(0,Y.useState)(p),[g,_]=(0,Y.useState)(!0),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(a??1),[S,C]=(0,Y.useState)(String(a??1)),[w,T]=(0,Y.useState)(1),[E,D]=(0,Y.useState)(`fit-width`),[O,k]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(!1),[M,N]=(0,Y.useState)(0),[P,F]=(0,Y.useState)(0),{_:I}=i(),L=m.length,R,ee;t[7]!==I||t[8]!==e.src?(R=()=>{if(!e.src){_(!1);return}let t=ae(e.src),n=!1,r=null;return _(!0),y(null),(async()=>{try{let e=await(await iA()).getDocument({url:t,isEvalSupported:!1}).promise;if(n){await e.destroy();return}r=e,f.current=e;let i=[];for(let t=1;t<=e.numPages;t++){if(n)return;let r=(await e.getPage(t)).getViewport({scale:1});i.push({pageNumber:t,naturalWidth:r.width,naturalHeight:r.height})}if(n)return;h(i)}catch(e){let t=e;if(n)return;y(t instanceof Error?t.message:I({id:`jRHdCz`})),_(!1)}})(),()=>{n=!0,r&&=(r.destroy(),null),f.current=null}},ee=[e.src,I],t[7]=I,t[8]=e.src,t[9]=R,t[10]=ee):(R=t[9],ee=t[10]),(0,Y.useEffect)(R,ee);let te,ne;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>{let e=s.current;if(!e)return;let t=()=>{N(e.clientWidth),F(e.clientHeight)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},ne=[],t[11]=te,t[12]=ne):(te=t[11],ne=t[12]),(0,Y.useEffect)(te,ne);let z,B;t[13]!==I||t[14]!==P||t[15]!==M||t[16]!==E||t[17]!==m||t[18]!==w?(z=()=>{let e=f.current;if(!e||m.length===0||M===0)return;let t=!1,n=null;return(async()=>{try{let r=window.devicePixelRatio||1;for(let i of m){if(t)return;let a=l.current[i.pageNumber-1];if(!a)continue;let o=Qk(E,i,M,P)*w,s=await e.getPage(i.pageNumber);if(t)return;let c=s.getViewport({scale:o});a.width=Math.floor(c.width*r),a.height=Math.floor(c.height*r),a.style.width=`${c.width}px`,a.style.height=`${c.height}px`;let u=a.getContext(`2d`);u&&(u.setTransform(r,0,0,r,0,0),n=s.render({canvas:a,canvasContext:u,viewport:c}),await n.promise,n=null)}t||_(!1)}catch(e){let n=e;if(t||aA(n))return;console.warn(`[Pdf] page render failed:`,n),y(n instanceof Error?n.message:I({id:`_TF8ep`})),_(!1)}})(),()=>{if(t=!0,n){try{n.cancel()}catch{}n=null}}},B=[m,E,w,M,P,I],t[13]=I,t[14]=P,t[15]=M,t[16]=E,t[17]=m,t[18]=w,t[19]=z,t[20]=B):(z=t[19],B=t[20]),(0,Y.useEffect)(z,B);let re,V;t[21]!==m||t[22]!==O?(re=()=>{if(!O)return;let e=f.current;if(!e||m.length===0)return;let t=!1,n=null;return(async()=>{try{let r=window.devicePixelRatio||1;for(let i of m){if(t)return;let a=d.current[i.pageNumber-1];if(!a)continue;let o=120/i.naturalWidth,s=await e.getPage(i.pageNumber);if(t)return;let c=s.getViewport({scale:o});a.width=Math.floor(c.width*r),a.height=Math.floor(c.height*r),a.style.width=`${c.width}px`,a.style.height=`${c.height}px`;let l=a.getContext(`2d`);l&&(l.setTransform(r,0,0,r,0,0),n=s.render({canvas:a,canvasContext:l,viewport:c}),await n.promise,n=null)}}catch(e){let t=e;aA(t)||console.warn(`[Pdf] thumbnail render failed:`,t)}})(),()=>{if(t=!0,n){try{n.cancel()}catch{}n=null}}},V=[O,m],t[21]=m,t[22]=O,t[23]=re,t[24]=V):(re=t[23],V=t[24]),(0,Y.useEffect)(re,V);let ie,H;t[25]!==g||t[26]!==a?(ie=()=>{if(g||!a)return;let e=s.current,t=l.current[a-1];e&&t&&(e.scrollTop=t.offsetTop-e.offsetTop)},H=[g,a],t[25]=g,t[26]=a,t[27]=ie,t[28]=H):(ie=t[27],H=t[28]),(0,Y.useEffect)(ie,H);let oe,se;t[29]===m?(oe=t[30],se=t[31]):(oe=()=>{let e=s.current;if(!e||m.length===0)return;let t=!1,n=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let n=e.scrollTop,r=1;for(let t of m){let i=l.current[t.pageNumber-1];i&&i.offsetTop-e.offsetTop<=n+40&&(r=t.pageNumber)}x(r),C(String(r))}))};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},se=[m],t[29]=m,t[30]=oe,t[31]=se),(0,Y.useEffect)(oe,se);let U,ce;t[32]===A?(U=t[33],ce=t[34]):(U=()=>{if(!A)return;let e=e=>{let t=e.target,n=s.current?.closest(`.ok-pdf`);if(!n||!t||!n.contains(t)){j(!1);return}let r=n.querySelector(`.ok-pdf-layout-menu`);r&&!r.contains(t)&&j(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},ce=[A],t[32]=A,t[33]=U,t[34]=ce),(0,Y.useEffect)(U,ce);let le;t[35]===L?le=t[36]:(le=e=>{let t=Math.max(1,Math.min(L||1,e));x(t),C(String(t));let n=s.current,r=l.current[t-1];n&&r&&n.scrollTo({top:r.offsetTop-n.offsetTop,behavior:`smooth`})},t[35]=L,t[36]=le);let ue=le,de;t[37]!==b||t[38]!==ue||t[39]!==S?(de=()=>{let e=Number.parseInt(S,10);if(Number.isNaN(e)){C(String(b));return}ue(e)},t[37]=b,t[38]=ue,t[39]=S,t[40]=de):de=t[40];let fe=de,pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>T(uA),t[41]=pe):pe=t[41];let me=pe,ge;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>T(lA),t[42]=ge):ge=t[42];let _e=ge,ve;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>{D(e),j(!1),T(1)},t[43]=ve):ve=t[43];let ye=ve,be;t[44]===n?be=t[45]:(be={height:n},t[44]=n,t[45]=be);let xe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>k(cA),t[46]=xe):xe=t[46];let Se;t[47]!==I||t[48]!==O?(Se=I(O?{id:`JK-Ave`}:{id:`iEYxO4`}),t[47]=I,t[48]=O,t[49]=Se):Se=t[49];let Ce;t[50]===I?Ce=t[51]:(Ce=I({id:`zo3Dl7`}),t[50]=I,t[51]=Ce);let we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,X.jsx)(ma,{size:14,"aria-hidden":`true`}),t[52]=we):we=t[52];let Te;t[53]!==O||t[54]!==Se||t[55]!==Ce?(Te=(0,X.jsx)(`button`,{type:`button`,onClick:xe,"aria-label":Se,"aria-pressed":O,className:`ok-pdf-btn`,title:Ce,children:we}),t[53]=O,t[54]=Se,t[55]=Ce,t[56]=Te):Te=t[56];let Ee=e.title??`PDF`,De;t[57]===Ee?De=t[58]:(De=(0,X.jsx)(`span`,{className:`ok-pdf-title`,children:Ee}),t[57]=Ee,t[58]=De);let Oe;t[59]!==I||t[60]!==A||t[61]!==E||t[62]!==S||t[63]!==fe||t[64]!==L||t[65]!==w?(Oe=L>0&&(0,X.jsxs)(`div`,{className:`ok-pdf-controls`,children:[(0,X.jsx)(`form`,{className:`ok-pdf-page-form`,onSubmit:e=>{e.preventDefault(),fe()},children:(0,X.jsx)(`input`,{type:`text`,inputMode:`numeric`,pattern:`[0-9]*`,className:`ok-pdf-page-input`,value:S,onChange:e=>C(e.target.value.replace(/[^0-9]/g,``)),onBlur:fe,"aria-label":I({id:`xsZhu-`})})}),(0,X.jsx)(`span`,{className:`ok-pdf-page-of`,children:(0,X.jsx)(o,{id:`1GhYxC`,values:{totalPages:L}})}),(0,X.jsx)(`span`,{className:`ok-pdf-divider`,"aria-hidden":`true`}),(0,X.jsx)(`button`,{type:`button`,onClick:_e,disabled:w<=eA,"aria-label":I({id:`FjkaiT`}),className:`ok-pdf-btn`,title:I({id:`FjkaiT`}),children:(0,X.jsx)(La,{size:14,"aria-hidden":`true`})}),(0,X.jsxs)(`span`,{className:`ok-pdf-zoom-display`,"aria-live":`polite`,children:[Math.round(w*100),`%`]}),(0,X.jsx)(`button`,{type:`button`,onClick:me,disabled:w>=tA,"aria-label":I({id:`AWOSPo`}),className:`ok-pdf-btn`,title:I({id:`AWOSPo`}),children:(0,X.jsx)(Ia,{size:14,"aria-hidden":`true`})}),(0,X.jsx)(`span`,{className:`ok-pdf-divider`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{className:`ok-pdf-layout-menu`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>j(sA),"aria-label":I({id:`GQDSBN`}),"aria-haspopup":`menu`,"aria-expanded":A,className:`ok-pdf-btn`,title:I({id:`rdU729`}),children:(0,X.jsx)(ki,{size:14,"aria-hidden":`true`})}),A&&(0,X.jsxs)(`div`,{role:`menu`,className:`ok-pdf-menu`,children:[(0,X.jsx)(dA,{label:I({id:`vIxrEk`}),active:E===`fit-width`,onSelect:()=>ye(`fit-width`)}),(0,X.jsx)(dA,{label:I({id:`YlDuro`}),active:E===`fit-height`,onSelect:()=>ye(`fit-height`)}),(0,X.jsx)(`hr`,{className:`ok-pdf-menu-divider`}),(0,X.jsx)(dA,{label:I({id:`BGHHtQ`}),active:E===`single`,onSelect:()=>ye(`single`)}),(0,X.jsx)(dA,{label:I({id:`xK291b`}),active:E===`two-odd`,onSelect:()=>ye(`two-odd`)}),(0,X.jsx)(dA,{label:I({id:`NSnIUP`}),active:E===`two-even`,onSelect:()=>ye(`two-even`)})]})]})]}),t[59]=I,t[60]=A,t[61]=E,t[62]=S,t[63]=fe,t[64]=L,t[65]=w,t[66]=Oe):Oe=t[66];let ke;t[67]!==Te||t[68]!==De||t[69]!==Oe?(ke=(0,X.jsxs)(`div`,{className:`ok-pdf-toolbar`,contentEditable:!1,children:[Te,De,Oe]}),t[67]=Te,t[68]=De,t[69]=Oe,t[70]=ke):ke=t[70];let Ae;t[71]!==I||t[72]!==b||t[73]!==ue||t[74]!==m||t[75]!==O?(Ae=O&&(0,X.jsx)(`aside`,{className:`ok-pdf-sidebar`,"aria-label":I({id:`nzaV6Q`}),children:m.map((e,t)=>{let{pageNumber:n}=e;return(0,X.jsxs)(`button`,{type:`button`,className:`ok-pdf-thumb`,"data-active":b===n||void 0,onClick:()=>ue(n),"aria-label":I({id:`qioCwA`,values:{pageNumber:n}}),children:[(0,X.jsx)(`canvas`,{ref:e=>{d.current[t]=e},className:`ok-pdf-thumb-canvas`}),(0,X.jsx)(`span`,{className:`ok-pdf-thumb-num`,children:n})]},n)})}),t[71]=I,t[72]=b,t[73]=ue,t[74]=m,t[75]=O,t[76]=Ae):Ae=t[76];let je;t[77]===g?je=t[78]:(je=g&&(0,X.jsx)(`div`,{className:`ok-pdf-loading`,children:(0,X.jsx)(o,{id:`T-654M`})}),t[77]=g,t[78]=je);let Me;t[79]===v?Me=t[80]:(Me=v&&(0,X.jsx)(`div`,{className:`ok-pdf-error`,children:(0,X.jsx)(o,{id:`WamGNs`,values:{error:v}})}),t[79]=v,t[80]=Me);let Ne;t[81]!==I||t[82]!==L?(Ne=Array.from({length:L},(e,t)=>{let n=t+1;return(0,X.jsx)(`canvas`,{ref:e=>{l.current[t]=e},className:`ok-pdf-page`,"aria-label":I({id:`XtRoxT`,values:{pageNumber:n}})},n)}),t[81]=I,t[82]=L,t[83]=Ne):Ne=t[83];let Pe;t[84]!==E||t[85]!==je||t[86]!==Me||t[87]!==Ne?(Pe=(0,X.jsxs)(`div`,{className:`ok-pdf-pages`,ref:s,"data-layout":E,children:[je,Me,Ne]}),t[84]=E,t[85]=je,t[86]=Me,t[87]=Ne,t[88]=Pe):Pe=t[88];let Fe;t[89]!==Ae||t[90]!==Pe?(Fe=(0,X.jsxs)(`div`,{className:`ok-pdf-body`,children:[Ae,Pe]}),t[89]=Ae,t[90]=Pe,t[91]=Fe):Fe=t[91];let Ie;return t[92]!==be||t[93]!==ke||t[94]!==Fe?(Ie=(0,X.jsxs)(`div`,{className:`ok-pdf`,style:be,children:[ke,Fe]}),t[92]=be,t[93]=ke,t[94]=Fe,t[95]=Ie):Ie=t[95],Ie}function sA(e){return!e}function cA(e){return!e}function lA(e){return Math.max(eA,+(e-nA).toFixed(2))}function uA(e){return Math.min(tA,+(e+nA).toFixed(2))}function dA(e){let t=(0,J.c)(10),n=e.active||void 0,r;t[0]===e.active?r=t[1]:(r=e.active&&(0,X.jsx)(Mn,{size:14}),t[0]=e.active,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,X.jsx)(`span`,{className:`ok-pdf-menu-check`,"aria-hidden":`true`,children:r}),t[2]=r,t[3]=i);let a;return t[4]!==e.active||t[5]!==e.label||t[6]!==e.onSelect||t[7]!==n||t[8]!==i?(a=(0,X.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e.active,className:`ok-pdf-menu-item`,"data-active":n,onClick:e.onSelect,children:[i,e.label]}),t[4]=e.active,t[5]=e.label,t[6]=e.onSelect,t[7]=n,t[8]=i,t[9]=a):a=t[9],a}function fA(e){if(!e)return null;for(let t of e.split(`&`)){let e=t.indexOf(`=`);if(!(e<0)&&t.slice(0,e)===`page`){let n=Number.parseInt(t.slice(e+1),10);if(!Number.isNaN(n)&&n>=1)return n}}return null}function pA(e){let t=(0,J.c)(10),{label:n,id:r,children:i}=e,a=(0,Y.useId)(),o;t[0]!==r||t[1]!==a?(o=r||`tab-panel-${a.replace(/:/g,``)}`,t[0]=r,t[1]=a,t[2]=o):o=t[2];let s=o,c=`${s}-tab`,l;t[3]===n?l=t[4]:(l=n?.trim()||`Tab`,t[3]=n,t[4]=l);let u=l,d;return t[5]!==i||t[6]!==s||t[7]!==u||t[8]!==c?(d=(0,X.jsx)(`section`,{className:`tab-panel`,id:s,role:`tabpanel`,"aria-labelledby":c,"data-tab-label":u,"data-tab-id":s,children:i}),t[5]=i,t[6]=s,t[7]=u,t[8]=c,t[9]=d):d=t[9],d}var mA=`[data-component-type="tabs"]`,hA=`[data-node-view-content-react] > .react-renderer`;function gA(e){let t=e.closest(mA);return t?Array.from(e.querySelectorAll(hA)).filter(e=>e.parentElement?.closest(mA)===t).map((e,t)=>{let n=e.querySelector(`[data-tab-label]`);return{index:t,label:(n?.getAttribute(`data-tab-label`))?.trim()||`Tab ${t+1}`,panelId:n?.getAttribute(`data-tab-id`)??null}}):[]}function _A(e){let t=(0,J.c)(26),{id:n,children:r}=e,[i,a]=(0,Y.useState)(0),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Y.useState)(o),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=(0,Y.useRef)(0),f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=l.current;if(!e)return;let t=gA(e);c(e=>{if(e.length!==t.length)return t;for(let n=0;n<e.length;n++)if(e[n].label!==t[n].label||e[n].panelId!==t[n].panelId)return t;return e})},t[1]=f):f=t[1],(0,Y.useLayoutEffect)(f);let p,m;t[2]===s.length?(p=t[3],m=t[4]):(p=()=>{s.length>d.current&&s.length>0&&a(s.length-1),d.current=s.length},m=[s.length],t[2]=s.length,t[3]=p,t[4]=m),(0,Y.useLayoutEffect)(p,m);let h;t[5]===n?h=t[6]:(h=()=>{let e=()=>{let e=window.location.hash.slice(1);if(!e)return;if(n&&e===n){a(0);return}let t=l.current;if(!t)return;let r=gA(t).findIndex(t=>t.panelId===e);r<0||(a(r),queueMicrotask(()=>{t.ownerDocument.getElementById(e)?.scrollIntoView({block:`start`,behavior:`auto`})}))};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},t[5]=n,t[6]=h),(0,Y.useLayoutEffect)(h);let g=s.length===0?0:Math.min(Math.max(i,0),s.length-1),_;t[7]!==s.length||t[8]!==g?(_=e=>{if(s.length===0)return;let t=null;e.key===`ArrowRight`?t=(g+1)%s.length:e.key===`ArrowLeft`?t=(g-1+s.length)%s.length:e.key===`Home`?t=0:e.key===`End`&&(t=s.length-1),t!==null&&(e.preventDefault(),a(t),(u.current?.querySelectorAll(`[role="tab"]`))?.[t]?.focus())},t[7]=s.length,t[8]=g,t[9]=_):_=t[9];let v=_,y=n?`Tabs: ${n}`:`Tabs`,b;if(t[10]!==s||t[11]!==g){let e;t[13]===g?e=t[14]:(e=e=>(0,X.jsx)(`button`,{id:e.panelId?`${e.panelId}-tab`:void 0,type:`button`,role:`tab`,className:`tabs-strip-pill`,"data-active":e.index===g,"aria-selected":e.index===g,"aria-controls":e.panelId??void 0,tabIndex:e.index===g?0:-1,onMouseDown:vA,onClick:()=>a(e.index),children:e.label},e.index),t[13]=g,t[14]=e),b=s.map(e),t[10]=s,t[11]=g,t[12]=b}else b=t[12];let x;t[15]!==v||t[16]!==y||t[17]!==b?(x=(0,X.jsx)(`div`,{ref:u,role:`tablist`,"aria-label":y,className:`tabs-strip`,contentEditable:!1,onKeyDown:v,children:b}),t[15]=v,t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]!==r||t[20]!==g?(S=(0,X.jsx)(`div`,{ref:l,className:`tabs-content`,"data-active-index":g,children:r}),t[19]=r,t[20]=g,t[21]=S):S=t[21];let C;return t[22]!==n||t[23]!==S||t[24]!==x?(C=(0,X.jsxs)(`div`,{className:`tabs`,id:n,children:[x,S]}),t[22]=n,t[23]=S,t[24]=x,t[25]=C):C=t[25],C}function vA(e){return e.preventDefault()}var yA=typeof global<`u`&&{}.toString.call(global)===`[object global]`,bA=typeof Bun<`u`,xA=typeof Deno<`u`,SA=typeof WebSocketPair==`function`&&caches?.default!==void 0,CA=yA||bA||xA||SA;function wA(e,t){return e.indexOf(t.toLowerCase())===0?e:`${t.toLowerCase()}${e.substr(0,1).toUpperCase()}${e.substr(1)}`}function TA(e){return!!(e&&e.nodeType===1&&`nodeName`in e&&e.ownerDocument&&e.ownerDocument.defaultView)}function EA(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function DA(e){return/^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(e)}function OA(e){return/^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/.test(e)}function kA(e){let t=(e||``).match(/^(?:https?:)?(?:\/\/)?([^/?]+)/),n=(t&&t[1]||``).replace(`player.`,``);for(let e of[`.videoji.hk`,`.vimeo.work`,`.videoji.cn`])if(n.endsWith(e))return n;return`vimeo.com`}function AA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.id,n=e.url,r=t||n;if(!r)throw Error(`An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.`);if(EA(r))return`https://vimeo.com/${r}`;if(DA(r))return r.replace(`http:`,`https:`);throw TypeError(t?`“${t}” is not a valid video id.`:`“${r}” is not a vimeo.com url.`)}var jA=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`addEventListener`,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:`removeEventListener`,a=typeof t==`string`?[t]:t;return a.forEach(t=>{e[r](t,n)}),{cancel:()=>a.forEach(t=>e[i](t,n))}};function MA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document;if(!e||!t||typeof t.querySelectorAll!=`function`)return null;let n=t.querySelectorAll(`iframe`);for(let t=0;t<n.length;t++)if(n[t]&&n[t].contentWindow===e)return n[t];return null}var NA=Array.prototype.indexOf!==void 0,PA=typeof window<`u`&&window.postMessage!==void 0;if(!CA&&(!NA||!PA))throw Error(`Sorry, the Vimeo Player API is not available in this browser.`);var FA=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function IA(e,t){return t={exports:{}},e(t,t.exports),t.exports}(function(e){if(e.WeakMap)return;var t=Object.prototype.hasOwnProperty,n=Object.defineProperty&&function(){try{return Object.defineProperty({},`x`,{value:1}).x===1}catch{}}(),r=function(e,t,r){n?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r}):e[t]=r};e.WeakMap=function(){function e(){if(this===void 0)throw TypeError(`Constructor WeakMap requires 'new'`);if(r(this,`_id`,a(`_WeakMap`)),arguments.length>0)throw TypeError(`WeakMap iterable is not supported`)}r(e.prototype,`delete`,function(e){if(n(this,`delete`),!i(e))return!1;var t=e[this._id];return t&&t[0]===e?(delete e[this._id],!0):!1}),r(e.prototype,`get`,function(e){if(n(this,`get`),i(e)){var t=e[this._id];if(t&&t[0]===e)return t[1]}}),r(e.prototype,`has`,function(e){if(n(this,`has`),!i(e))return!1;var t=e[this._id];return!!(t&&t[0]===e)}),r(e.prototype,`set`,function(e,t){if(n(this,`set`),!i(e))throw TypeError(`Invalid value used as weak map key`);var a=e[this._id];return a&&a[0]===e?(a[1]=t,this):(r(e,this._id,[e,t]),this)});function n(e,n){if(!i(e)||!t.call(e,`_id`))throw TypeError(n+` method called on incompatible receiver `+typeof e)}function a(e){return e+`_`+o()+`.`+o()}function o(){return Math.random().toString().substring(2)}return r(e,`_polyfill`,!0),e}();function i(e){return Object(e)===e}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:FA);var LA=IA(function(e){(function(t,n,r){n[t]=n[t]||r(),e.exports&&=n[t]})(`Promise`,FA,function(){var e,t,n,r=Object.prototype.toString,i=typeof setImmediate<`u`?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},`x`,{}),e=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:r!==!1})}}catch{e=function(e,t,n){return e[t]=n,e}}n=function(){var e,n,r;function i(e,t){this.fn=e,this.self=t,this.next=void 0}return{add:function(t,a){r=new i(t,a),n?n.next=r:e=r,n=r,r=void 0},drain:function(){var r=e;for(e=n=t=void 0;r;)r.fn.call(r.self),r=r.next}}}();function a(e,r){n.add(e,r),t||=i(n.drain)}function o(e){var t,n=typeof e;return e!=null&&(n==`object`||n==`function`)&&(t=e.then),typeof t==`function`?t:!1}function s(){for(var e=0;e<this.chain.length;e++)c(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,t,n){var r,i;try{t===!1?n.reject(e.msg):(r=t===!0?e.msg:t.call(void 0,e.msg),r===n.promise?n.reject(TypeError(`Promise-chain cycle`)):(i=o(r))?i.call(r,n.resolve,n.reject):n.resolve(r))}catch(e){n.reject(e)}}function l(e){var t,n=this;if(!n.triggered){n.triggered=!0,n.def&&(n=n.def);try{(t=o(e))?a(function(){var r=new f(n);try{t.call(e,function(){l.apply(r,arguments)},function(){u.apply(r,arguments)})}catch(e){u.call(r,e)}}):(n.msg=e,n.state=1,n.chain.length>0&&a(s,n))}catch(e){u.call(new f(n),e)}}}function u(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&a(s,t))}function d(e,t,n,r){for(var i=0;i<t.length;i++)(function(i){e.resolve(t[i]).then(function(e){n(i,e)},r)})(i)}function f(e){this.def=e,this.triggered=!1}function p(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function m(e){if(typeof e!=`function`)throw TypeError(`Not a function`);if(this.__NPO__!==0)throw TypeError(`Not a promise`);this.__NPO__=1;var t=new p(this);this.then=function(e,n){var r={success:typeof e==`function`?e:!0,failure:typeof n==`function`?n:!1};return r.promise=new this.constructor(function(e,t){if(typeof e!=`function`||typeof t!=`function`)throw TypeError(`Not a function`);r.resolve=e,r.reject=t}),t.chain.push(r),t.state!==0&&a(s,t),r.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){l.call(t,e)},function(e){u.call(t,e)})}catch(e){u.call(t,e)}}var h=e({},`constructor`,m,!1);return m.prototype=h,e(h,`__NPO__`,0,!1),e(m,`resolve`,function(e){var t=this;return e&&typeof e==`object`&&e.__NPO__===1?e:new t(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);t(e)})}),e(m,`reject`,function(e){return new this(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);n(e)})}),e(m,`all`,function(e){var t=this;return r.call(e)==`[object Array]`?e.length===0?t.resolve([]):new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);var i=e.length,a=Array(i),o=0;d(t,e,function(e,t){a[e]=t,++o===i&&n(a)},r)}):t.reject(TypeError(`Not an array`))}),e(m,`race`,function(e){var t=this;return r.call(e)==`[object Array]`?new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);d(t,e,function(e,t){n(t)},r)}):t.reject(TypeError(`Not an array`))}),m})}),RA=new WeakMap;function zA(e,t,n){let r=RA.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),RA.set(e.element,r)}function BA(e,t){return(RA.get(e.element)||{})[t]||[]}function VA(e,t,n){let r=RA.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],RA.set(e.element,r),!0;let i=r[t].indexOf(n);return i!==-1&&r[t].splice(i,1),RA.set(e.element,r),r[t]&&r[t].length===0}function HA(e,t){let n=BA(e,t);if(n.length<1)return!1;let r=n.shift();return VA(e,t,r),r}function UA(e,t){let n=RA.get(e);RA.set(t,n),RA.delete(e)}function WA(e){if(typeof e==`string`)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return e}function GA(e,t,n){if(!e.element.contentWindow||!e.element.contentWindow.postMessage)return;let r={method:t};n!==void 0&&(r.value=n);let i=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,`$1`));i>=8&&i<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}function KA(e,t){t=WA(t);let n=[],r;if(t.event)t.event===`error`&&BA(e,t.data.method).forEach(n=>{let r=Error(t.data.message);r.name=t.data.name,n.reject(r),VA(e,t.data.method,n)}),n=BA(e,`event:${t.event}`),r=t.data;else if(t.method){let i=HA(e,t.method);i&&(n.push(i),r=t.value)}n.forEach(t=>{try{if(typeof t==`function`){t.call(e,r);return}t.resolve(r)}catch{}})}var qA=`airplay.audio_tracks.audiotrack.autopause.autoplay.background.byline.cc.chapter_id.chapters.chromecast.color.colors.controls.disable_context_menu.dnt.end_time.fullscreen.height.id.initial_quality.interactive_params.keyboard.loop.maxheight.max_quality.maxwidth.min_quality.muted.play_button_position.playsinline.portrait.preload.progress_bar.quality.quality_selector.responsive.skipping_forward.speed.start_time.texttrack.thumbnail_id.title.transcript.transparent.unmute_button.url.vimeo_logo.volume.watch_full_video.width`.split(`.`);function JA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return qA.reduce((t,n)=>{let r=e.getAttribute(`data-vimeo-${n}`);return(r||r===``)&&(t[n]=r===``?1:r),t},t)}function YA(e,t){let{html:n}=e;if(!t)throw TypeError(`An element must be provided`);if(t.getAttribute(`data-vimeo-initialized`)!==null)return t.querySelector(`iframe`);let r=document.createElement(`div`);return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute(`data-vimeo-initialized`,`true`),t.querySelector(`iframe`)}function XA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return new Promise((r,i)=>{if(!DA(e))throw TypeError(`“${e}” is not a vimeo.com url.`);let a=`https://${kA(e)}/api/oembed.json?url=${encodeURIComponent(e)}`;for(let e in t)t.hasOwnProperty(e)&&(a+=`&${e}=${encodeURIComponent(t[e])}`);let o=`XDomainRequest`in window?new XDomainRequest:new XMLHttpRequest;o.open(`GET`,a,!0),o.onload=function(){if(o.status===404){i(Error(`“${e}” was not found.`));return}if(o.status===403){i(Error(`“${e}” is not embeddable.`));return}try{let t=JSON.parse(o.responseText);if(t.domain_status_code===403){YA(t,n),i(Error(`“${e}” is not embeddable.`));return}r(t)}catch(e){i(e)}},o.onerror=function(){let e=o.status?` (${o.status})`:``;i(Error(`There was an error fetching the embed code from Vimeo${e}.`))},o.send()})}function ZA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,t=[].slice.call(e.querySelectorAll(`[data-vimeo-id], [data-vimeo-url]`)),n=e=>{`console`in window&&console.error&&console.error(`There was an error creating an embed: ${e}`)};t.forEach(e=>{try{if(e.getAttribute(`data-vimeo-defer`)!==null)return;let t=JA(e);XA(AA(t),t,e).then(t=>YA(t,e)).catch(n)}catch(e){n(e)}})}function QA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoPlayerResizeEmbeds_||(window.VimeoPlayerResizeEmbeds_=!0,window.addEventListener(`message`,t=>{if(!DA(t.origin)||!t.data||t.data.event!==`spacechange`)return;let n=t.source?MA(t.source,e):null;if(n){let e=n.parentElement;e.style.paddingBottom=`${t.data.data[0].bottom}px`}}))}function $A(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoSeoMetadataAppended||(window.VimeoSeoMetadataAppended=!0,window.addEventListener(`message`,t=>{if(!DA(t.origin))return;let n=WA(t.data);if(!n||n.event!==`ready`)return;let r=t.source?MA(t.source,e):null;r&&OA(r.src)&&new cj(r).callMethod(`appendVideoMetadata`,window.location.href)}))}function ej(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(window.VimeoCheckedUrlTimeParam)return;window.VimeoCheckedUrlTimeParam=!0;let t=e=>{`console`in window&&console.error&&console.error(`There was an error getting video Id: ${e}`)};window.addEventListener(`message`,n=>{if(!DA(n.origin))return;let r=WA(n.data);if(!r||r.event!==`ready`)return;let i=n.source?MA(n.source,e):null;if(i&&OA(i.src)){let e=new cj(i);e.getVideoId().then(t=>{let n=RegExp(`[?&]vimeo_t_${t}=([^&#]*)`).exec(window.location.href);if(n&&n[1]){let t=decodeURI(n[1]);e.setCurrentTime(t)}}).catch(t)}})}function tj(){window.VimeoDRMEmbedsUpdated||(window.VimeoDRMEmbedsUpdated=!0,window.addEventListener(`message`,e=>{if(!DA(e.origin))return;let t=WA(e.data);if(!t||t.event!==`drminitfailed`)return;let n=e.source?MA(e.source):null;if(!n)return;let r=n.getAttribute(`allow`)||``;if(!r.includes(`encrypted-media`)){n.setAttribute(`allow`,`${r}; encrypted-media`);let e=new URL(n.getAttribute(`src`));e.searchParams.set(`forcereload`,`drm`),n.setAttribute(`src`,e.toString());return}}))}function nj(){let e=function(){let e,t=[[`requestFullscreen`,`exitFullscreen`,`fullscreenElement`,`fullscreenEnabled`,`fullscreenchange`,`fullscreenerror`],[`webkitRequestFullscreen`,`webkitExitFullscreen`,`webkitFullscreenElement`,`webkitFullscreenEnabled`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`webkitRequestFullScreen`,`webkitCancelFullScreen`,`webkitCurrentFullScreenElement`,`webkitCancelFullScreen`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`mozRequestFullScreen`,`mozCancelFullScreen`,`mozFullScreenElement`,`mozFullScreenEnabled`,`mozfullscreenchange`,`mozfullscreenerror`],[`msRequestFullscreen`,`msExitFullscreen`,`msFullscreenElement`,`msFullscreenEnabled`,`MSFullscreenChange`,`MSFullscreenError`]],n=0,r=t.length,i={};for(;n<r;n++)if(e=t[n],e&&e[1]in document){for(n=0;n<e.length;n++)i[t[0][n]]=e[n];return i}return!1}(),t={fullscreenchange:e.fullscreenchange,fullscreenerror:e.fullscreenerror},n={request(t){return new Promise((r,i)=>{let a=function(){n.off(`fullscreenchange`,a),r()};n.on(`fullscreenchange`,a),t||=document.documentElement;let o=t[e.requestFullscreen]();o instanceof Promise&&o.then(a).catch(i)})},exit(){return new Promise((t,r)=>{if(!n.isFullscreen){t();return}let i=function(){n.off(`fullscreenchange`,i),t()};n.on(`fullscreenchange`,i);let a=document[e.exitFullscreen]();a instanceof Promise&&a.then(i).catch(r)})},on(e,n){let r=t[e];r&&document.addEventListener(r,n)},off(e,n){let r=t[e];r&&document.removeEventListener(r,n)}};return Object.defineProperties(n,{isFullscreen:{get(){return!!document[e.fullscreenElement]}},element:{enumerable:!0,get(){return document[e.fullscreenElement]}},isEnabled:{enumerable:!0,get(){return!!document[e.fullscreenEnabled]}}}),n}var rj={role:`viewer`,autoPlayMuted:!0,allowedDrift:.3,maxAllowedDrift:1,minCheckInterval:.1,maxRateAdjustment:.2,maxTimeToCatchUp:1},ij=class extends EventTarget{logger;constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;super(),this.logger=r,this.init(t,e,{...rj,...n})}disconnect(){this.dispatchEvent(new Event(`disconnect`))}async init(e,t,n){if(await this.waitForTOReadyState(e,`open`),n.role===`viewer`){await this.updatePlayer(e,t,n);let r=jA(e,`change`,()=>this.updatePlayer(e,t,n)),i=this.maintainPlaybackPosition(e,t,n);this.addEventListener(`disconnect`,()=>{i.cancel(),r.cancel()})}else{await this.updateTimingObject(e,t);let n=jA(t,[`seeked`,`play`,`pause`,`ratechange`],()=>this.updateTimingObject(e,t),`on`,`off`);this.addEventListener(`disconnect`,()=>n.cancel())}}async updateTimingObject(e,t){let[n,r,i]=await Promise.all([t.getCurrentTime(),t.getPaused(),t.getPlaybackRate()]);e.update({position:n,velocity:r?0:i})}async updatePlayer(e,t,n){let{position:r,velocity:i}=e.query();typeof r==`number`&&t.setCurrentTime(r),typeof i==`number`&&(i===0?await t.getPaused()===!1&&t.pause():i>0&&(await t.getPaused()===!0&&(await t.play().catch(async e=>{e.name===`NotAllowedError`&&n.autoPlayMuted&&(await t.setMuted(!0),await t.play().catch(e=>console.error(`Couldn't play the video from TimingSrcConnector. Error:`,e)))}),this.updatePlayer(e,t,n)),await t.getPlaybackRate()!==i&&t.setPlaybackRate(i)))}maintainPlaybackPosition(e,t,n){let{allowedDrift:r,maxAllowedDrift:i,minCheckInterval:a,maxRateAdjustment:o,maxTimeToCatchUp:s}=n,c=Math.min(s,Math.max(a,i))*1e3,l=async()=>{if(e.query().velocity===0||await t.getPaused()===!0)return;let n=e.query().position-await t.getCurrentTime(),a=Math.abs(n);if(this.log(`Drift: ${n}`),a>i)await this.adjustSpeed(t,0),t.setCurrentTime(e.query().position),this.log(`Resync by currentTime`);else if(a>r){let e=a/s,r=o,i=e<r?(r-e)/2:r;await this.adjustSpeed(t,i*Math.sign(n)),this.log(`Resync by playbackRate`)}},u=setInterval(()=>l(),c);return{cancel:()=>clearInterval(u)}}log(e){this.logger?.(`TimingSrcConnector: ${e}`)}speedAdjustment=0;adjustSpeed=async(e,t)=>{if(this.speedAdjustment===t)return;let n=await e.getPlaybackRate()-this.speedAdjustment+t;this.log(`New playbackRate: ${n}`),await e.setPlaybackRate(n),this.speedAdjustment=t};waitForTOReadyState(e,t){return new Promise(n=>{let r=()=>{e.readyState===t?n():e.addEventListener(`readystatechange`,r,{once:!0})};r()})}},aj=new WeakMap,oj=new WeakMap,sj={},cj=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(window.jQuery&&e instanceof jQuery&&(e.length>1&&window.console&&console.warn&&console.warn(`A jQuery object with multiple elements was passed, using the first element.`),e=e[0]),typeof document<`u`&&typeof e==`string`&&(e=document.getElementById(e)),!TA(e))throw TypeError(`You must pass either a valid element or a valid id.`);if(e.nodeName!==`IFRAME`){let t=e.querySelector(`iframe`);t&&(e=t)}if(e.nodeName===`IFRAME`&&!DA(e.getAttribute(`src`)||``))throw Error(`The player element passed isn’t a Vimeo embed.`);if(aj.has(e))return aj.get(e);this._window=e.ownerDocument.defaultView,this.element=e,this.origin=`*`;let n=new LA((n,r)=>{if(this._onMessage=e=>{if(!DA(e.origin)||this.element.contentWindow!==e.source)return;this.origin===`*`&&(this.origin=e.origin);let t=WA(e.data);if(t&&t.event===`error`&&t.data&&t.data.method===`ready`){let e=Error(t.data.message);e.name=t.data.name,r(e);return}let i=t&&t.event===`ready`,a=t&&t.method===`ping`;if(i||a){this.element.setAttribute(`data-ready`,`true`),n();return}KA(this,t)},this._window.addEventListener(`message`,this._onMessage),this.element.nodeName!==`IFRAME`){let n=JA(e,t);XA(AA(n),n,e).then(t=>{let n=YA(t,e);return this.element=n,this._originalElement=e,UA(e,n),aj.set(this.element,this),t}).catch(r)}});if(oj.set(this,n),aj.set(this.element,this),this.element.nodeName===`IFRAME`&&GA(this,`ping`),sj.isEnabled){let e=()=>sj.exit();this.fullscreenchangeHandler=()=>{sj.isFullscreen?zA(this,`event:exitFullscreen`,e):VA(this,`event:exitFullscreen`,e),this.ready().then(()=>{GA(this,`fullscreenchange`,sj.isFullscreen)})},sj.on(`fullscreenchange`,this.fullscreenchangeHandler)}return this}static isVimeoUrl(e){return DA(e)}callMethod(e){var t=[...arguments].slice(1);if(e==null)throw TypeError(`You must pass a method name.`);return new LA((n,r)=>this.ready().then(()=>{zA(this,e,{resolve:n,reject:r}),t.length===0?t={}:t.length===1&&(t=t[0]),GA(this,e,t)}).catch(r))}get(e){return new LA((t,n)=>(e=wA(e,`get`),this.ready().then(()=>{zA(this,e,{resolve:t,reject:n}),GA(this,e)}).catch(n)))}set(e,t){return new LA((n,r)=>{if(e=wA(e,`set`),t==null)throw TypeError(`There must be a value to set.`);return this.ready().then(()=>{zA(this,e,{resolve:n,reject:r}),GA(this,e,t)}).catch(r)})}on(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(!t)throw TypeError(`You must pass a callback function.`);if(typeof t!=`function`)throw TypeError(`The callback must be a function.`);BA(this,`event:${e}`).length===0&&this.callMethod(`addEventListener`,e).catch(()=>{}),zA(this,`event:${e}`,t)}off(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(t&&typeof t!=`function`)throw TypeError(`The callback must be a function.`);VA(this,`event:${e}`,t)&&this.callMethod(`removeEventListener`,e).catch(e=>{})}loadVideo(e){return this.callMethod(`loadVideo`,e)}ready(){let e=oj.get(this)||new LA((e,t)=>{t(Error(`Unknown player. Probably unloaded.`))});return LA.resolve(e)}addCuePoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.callMethod(`addCuePoint`,{time:e,data:t})}removeCuePoint(e){return this.callMethod(`removeCuePoint`,e)}enableTextTrack(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`enableTextTrack`,{language:e,kind:t,showing:n})}disableTextTrack(){return this.callMethod(`disableTextTrack`)}selectAudioTrack(e,t){if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`selectAudioTrack`,{language:e,kind:t})}selectDefaultAudioTrack(){return this.callMethod(`selectDefaultAudioTrack`)}pause(){return this.callMethod(`pause`)}play(){return this.callMethod(`play`)}requestFullscreen(){return sj.isEnabled?sj.request(this.element):this.callMethod(`requestFullscreen`)}exitFullscreen(){return sj.isEnabled?sj.exit():this.callMethod(`exitFullscreen`)}getFullscreen(){return sj.isEnabled?LA.resolve(sj.isFullscreen):this.get(`fullscreen`)}requestPictureInPicture(){return this.callMethod(`requestPictureInPicture`)}exitPictureInPicture(){return this.callMethod(`exitPictureInPicture`)}getPictureInPicture(){return this.get(`pictureInPicture`)}remotePlaybackPrompt(){return this.callMethod(`remotePlaybackPrompt`)}unload(){return this.callMethod(`unload`)}destroy(){return new LA(e=>{if(oj.delete(this),aj.delete(this.element),this._originalElement&&(aj.delete(this._originalElement),this._originalElement.removeAttribute(`data-vimeo-initialized`)),this.element&&this.element.nodeName===`IFRAME`&&this.element.parentNode&&(this.element.parentNode.parentNode&&this._originalElement&&this._originalElement!==this.element.parentNode?this.element.parentNode.parentNode.removeChild(this.element.parentNode):this.element.parentNode.removeChild(this.element)),this.element&&this.element.nodeName===`DIV`&&this.element.parentNode){this.element.removeAttribute(`data-vimeo-initialized`);let e=this.element.querySelector(`iframe`);e&&e.parentNode&&(e.parentNode.parentNode&&this._originalElement&&this._originalElement!==e.parentNode?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))}this._window.removeEventListener(`message`,this._onMessage),sj.isEnabled&&sj.off(`fullscreenchange`,this.fullscreenchangeHandler),e()})}getAutopause(){return this.get(`autopause`)}setAutopause(e){return this.set(`autopause`,e)}getBuffered(){return this.get(`buffered`)}getCameraProps(){return this.get(`cameraProps`)}setCameraProps(e){return this.set(`cameraProps`,e)}getChapters(){return this.get(`chapters`)}getCurrentChapter(){return this.get(`currentChapter`)}getColor(){return this.get(`color`)}getColors(){return LA.all([this.get(`colorOne`),this.get(`colorTwo`),this.get(`colorThree`),this.get(`colorFour`)])}setColor(e){return this.set(`color`,e)}setColors(e){if(!Array.isArray(e))return new LA((e,t)=>t(TypeError(`Argument must be an array.`)));let t=new LA(e=>e(null)),n=[e[0]?this.set(`colorOne`,e[0]):t,e[1]?this.set(`colorTwo`,e[1]):t,e[2]?this.set(`colorThree`,e[2]):t,e[3]?this.set(`colorFour`,e[3]):t];return LA.all(n)}getCuePoints(){return this.get(`cuePoints`)}getCurrentTime(){return this.get(`currentTime`)}setCurrentTime(e){return this.set(`currentTime`,e)}getDuration(){return this.get(`duration`)}getEnded(){return this.get(`ended`)}getLoop(){return this.get(`loop`)}setLoop(e){return this.set(`loop`,e)}setMuted(e){return this.set(`muted`,e)}getMuted(){return this.get(`muted`)}getPaused(){return this.get(`paused`)}getPlaybackRate(){return this.get(`playbackRate`)}setPlaybackRate(e){return this.set(`playbackRate`,e)}getPlayed(){return this.get(`played`)}getQualities(){return this.get(`qualities`)}getQuality(){return this.get(`quality`)}setQuality(e){return this.set(`quality`,e)}getRemotePlaybackAvailability(){return this.get(`remotePlaybackAvailability`)}getRemotePlaybackState(){return this.get(`remotePlaybackState`)}getSeekable(){return this.get(`seekable`)}getSeeking(){return this.get(`seeking`)}getTextTracks(){return this.get(`textTracks`)}getAudioTracks(){return this.get(`audioTracks`)}getEnabledAudioTrack(){return this.get(`enabledAudioTrack`)}getDefaultAudioTrack(){return this.get(`defaultAudioTrack`)}getVideoEmbedCode(){return this.get(`videoEmbedCode`)}getVideoId(){return this.get(`videoId`)}getVideoTitle(){return this.get(`videoTitle`)}getVideoWidth(){return this.get(`videoWidth`)}getVideoHeight(){return this.get(`videoHeight`)}getVideoUrl(){return this.get(`videoUrl`)}getVolume(){return this.get(`volume`)}setVolume(e){return this.set(`volume`,e)}async setTimingSrc(e,t){if(!e)throw TypeError(`A Timing Object must be provided.`);await this.ready();let n=new ij(this,e,t);return GA(this,`notifyTimingObjectConnect`),n.addEventListener(`disconnect`,()=>GA(this,`notifyTimingObjectDisconnect`)),n}};CA||(sj=nj(),ZA(),QA(),$A(),ej(),tj());function lj(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,uj(e,t)}function uj(e,t){return uj=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},uj(e,t)}var dj={play:`onPlay`,playing:`onPlaying`,pause:`onPause`,ended:`onEnd`,timeupdate:`onTimeUpdate`,progress:`onProgress`,seeked:`onSeeked`,texttrackchange:`onTextTrackChange`,cuechange:`onCueChange`,cuepoint:`onCuePoint`,volumechange:`onVolumeChange`,playbackratechange:`onPlaybackRateChange`,error:`onError`,loaded:`onLoaded`},fj=function(e){function t(t){var n=e.call(this,t)||this;return n.refContainer=n.refContainer.bind(n),n}lj(t,e);var n=t.prototype;return n.componentDidMount=function(){this.createPlayer()},n.componentDidUpdate=function(e){var t=this,n=Object.keys(this.props).filter(function(n){return t.props[n]!==e[n]});this.updateProps(n)},n.componentWillUnmount=function(){this.player.destroy()},n.getInitialOptions=function(){var e,t=this.props.video,n=/^https?:/i.test(t)?`url`:`id`;return e={},e[n]=t,e.width=this.props.width,e.height=this.props.height,e.autopause=this.props.autopause,e.autoplay=this.props.autoplay,e.byline=this.props.showByline,e.color=this.props.color,e.controls=this.props.controls,e.loop=this.props.loop,e.portrait=this.props.showPortrait,e.title=this.props.showTitle,e.muted=this.props.muted,e.background=this.props.background,e.responsive=this.props.responsive,e.dnt=this.props.dnt,e.speed=this.props.speed,e.keyboard=this.props.keyboard,e.pip=this.props.pip,e.playsinline=this.props.playsInline,e.quality=this.props.quality,e.texttrack=this.props.textTrack,e.transparent=this.props.transparent,e},n.updateProps=function(e){var t=this,n=this.player;e.forEach(function(e){var r=t.props[e];switch(e){case`autopause`:n.setAutopause(r);break;case`color`:n.setColor(r);break;case`loop`:n.setLoop(r);break;case`volume`:n.setVolume(r);break;case`paused`:n.getPaused().then(function(e){return r&&!e?n.pause():!r&&e?n.play():null});break;case`width`:case`height`:n.element[e]=r;break;case`video`:if(r){var i=t.props.start,a=n.loadVideo(r);typeof i==`number`&&a.then(function(){n.setCurrentTime(i)})}else n.unload();break;case`playbackRate`:n.setPlaybackRate(r);break;case`quality`:n.setQuality(r);break}})},n.createPlayer=function(){var e=this,t=this.props,n=t.start,r=t.volume,i=t.playbackRate;this.player=new cj(this.container,this.getInitialOptions()),Object.keys(dj).forEach(function(t){var n=dj[t];e.player.on(t,function(t){var r=e.props[n];r&&r(t)})});var a=this.props,o=a.onError,s=a.onReady;this.player.ready().then(function(){s&&s(e.player)},function(e){if(o)o(e);else throw e}),typeof n==`number`&&this.player.setCurrentTime(n),typeof r==`number`&&this.updateProps([`volume`]),typeof i==`number`&&this.updateProps([`playbackRate`])},n.refContainer=function(e){this.container=e},n.render=function(){var e=this.props,t=e.id,n=e.className,r=e.style;return Y.createElement(`div`,{id:t,className:n,style:r,ref:this.refContainer})},t}(Y.Component);fj.defaultProps={autopause:!0,autoplay:!1,showByline:!0,controls:!0,loop:!1,showPortrait:!0,showTitle:!0,muted:!1,background:!1,responsive:!1,dnt:!1,speed:!1,keyboard:!0,pip:!1,playsInline:!0,transparent:!0};var pj={default:120,mqdefault:320,hqdefault:480,sddefault:640,maxresdefault:1280},mj=(e,t,n,r=`maxresdefault`)=>{let[i,a]=(0,Y.useState)(``);return(0,Y.useEffect)(()=>{let i=`https://img.youtube.com/${t}/${e}/${r}.${n}`,o=`https://img.youtube.com/${t}/${e}/hqdefault.${n}`,s=pj[r],c=new Image;c.onload=()=>{c.width<s?a(o):a(i)},c.onerror=()=>a(o),c.src=i},[e,t,n,r]),i};function hj(e,t,n,r,i){let a={"@context":`https://schema.org`,"@type":`VideoObject`,name:i?.name||t,thumbnailUrl:[i?.thumbnailUrl||n],embedUrl:i?.embedUrl||`${r}/embed/${e}`,contentUrl:i?.contentUrl||`https://www.youtube.com/watch?v=${e}`,...i?.description&&{description:i.description},...i?.uploadDate&&{uploadDate:i.uploadDate},...i?.duration&&{duration:i.duration}};return JSON.stringify(a)}function gj(e,t){let[n,r]=Y.useState(!1),[i,a]=Y.useState(e.alwaysLoadIframe||!1),o=encodeURIComponent(e.id),s=typeof e.playlistCoverId==`string`?encodeURIComponent(e.playlistCoverId):null,c=e.title,l=e.poster||`hqdefault`,u=e.announce||`Watch`,d=e.alwaysLoadIframe?e.autoplay&&e.muted:!0,f=Y.useMemo(()=>{let t=new URLSearchParams({...e.muted?{mute:`1`}:{},...d?{autoplay:`1`}:{},...e.enableJsApi?{enablejsapi:`1`}:{},...e.enableJsApi&&typeof window<`u`?{origin:window.location.origin}:{},...e.playlist?{list:o}:{}});return e.params&&new URLSearchParams(e.params.startsWith(`&`)?e.params.slice(1):e.params).forEach((e,n)=>{t.append(n,e)}),t},[e.muted,d,e.enableJsApi,e.playlist,o,e.params]),p=Y.useMemo(()=>e.cookie?`https://www.youtube.com`:`https://www.youtube-nocookie.com`,[e.cookie]),m=Y.useMemo(()=>e.playlist?`${p}/embed/videoseries?${f.toString()}`:`${p}/embed/${o}?${f.toString()}`,[e.playlist,p,o,f]),h=!e.thumbnail&&!e.playlist&&l===`maxresdefault`,g=e.webp?`webp`:`jpg`,_=e.webp?`vi_webp`:`vi`,v=h?mj(e.id,_,g,l):null,y=Y.useMemo(()=>e.thumbnail||v||`https://i.ytimg.com/${_}/${e.playlist?s:o}/${l}.${g}`,[e.thumbnail,v,_,e.playlist,s,o,l,g]),b=e.activatedClass||`lyt-activated`,x=e.adNetwork||!1,S=e.aspectHeight||9,C=e.aspectWidth||16,w=e.iframeClass||``,T=e.playerClass||`lty-playbtn`,E=e.wrapperClass||`yt-lite`,D=Y.useCallback(e.onIframeAdded||function(){},[e.onIframeAdded]),O=e.rel?`prefetch`:`preload`,k=e.containerElement||`article`,A=e.noscriptFallback!==!1,j=()=>{n||r(!0)},M=()=>{i||a(!0)};return Y.useEffect(()=>{i&&(D(),e.focusOnLoad&&typeof t==`object`&&t?.current&&t.current.focus())},[i,D,e.focusOnLoad,t]),Y.useEffect(()=>{if(!i||!e.enableJsApi||!(e.onReady||e.onStateChange||e.onError||e.onPlay||e.onPause||e.onEnd||e.onBuffering||e.onPlaybackRateChange||e.onPlaybackQualityChange))return;let n=!1,r=!1,a=r=>{if(r.origin!==`https://www.youtube.com`&&r.origin!==`https://www.youtube-nocookie.com`)return;let i;try{i=typeof r.data==`string`?JSON.parse(r.data):r.data}catch{return}switch(i.event){case`onReady`:n||(n=!0,e.onReady&&e.onReady({videoId:e.id,title:c}));break;case`infoDelivery`:if(i.info?.playerState!==void 0){let n=i.info.playerState;switch(e.onStateChange&&e.onStateChange({state:n,currentTime:i.info.currentTime,duration:i.info.duration}),n){case 1:e.onPlay?.();break;case 2:e.onPause?.();break;case 0:e.onEnd?.(),e.stopOnEnd&&typeof t==`object`&&t?.current?.contentWindow&&t.current.contentWindow.postMessage(`{"event":"command","func":"stopVideo","args":""}`,`*`);break;case 3:e.onBuffering?.();break}}i.info?.playbackRate!==void 0&&e.onPlaybackRateChange?.(i.info.playbackRate),i.info?.playbackQuality!==void 0&&e.onPlaybackQualityChange?.(i.info.playbackQuality);break;case`onStateChange`:if(i.info?.playerState!==void 0){let n=i.info.playerState;switch(e.onStateChange&&e.onStateChange({state:n,currentTime:i.info.currentTime,duration:i.info.duration}),n){case 1:e.onPlay?.();break;case 2:e.onPause?.();break;case 0:e.onEnd?.(),e.stopOnEnd&&typeof t==`object`&&t?.current?.contentWindow&&t.current.contentWindow.postMessage(`{"event":"command","func":"stopVideo","args":""}`,`*`);break;case 3:e.onBuffering?.();break}}break;case`onError`:if(i.info&&`errorCode`in i.info){let t=i.info.errorCode;e.onError&&e.onError(t)}break;case`onPlaybackRateChange`:i.info?.playbackRate!==void 0&&e.onPlaybackRateChange?.(i.info.playbackRate);break;case`onPlaybackQualityChange`:i.info?.playbackQuality!==void 0&&e.onPlaybackQualityChange?.(i.info.playbackQuality);break}};window.addEventListener(`message`,a);let s=[],l=()=>{typeof t==`object`&&t?.current?.contentWindow&&t.current.contentWindow.postMessage(`{"event":"listening","id":"`+o+`"}`,`*`)},u=()=>{r||(r=!0,l(),[100,300,600,1200,2400].forEach(e=>{s.push(setTimeout(l,e))}))};return typeof t==`object`&&t?.current?(t.current.addEventListener(`load`,u),t.current.contentDocument?.readyState===`complete`&&u()):[200,500,1e3,2e3,3e3].forEach(e=>{s.push(setTimeout(l,e))}),()=>{window.removeEventListener(`message`,a),s.forEach(clearTimeout),typeof t==`object`&&t?.current&&t.current.removeEventListener(`load`,u)}},[i,e.enableJsApi,e.onReady,e.onStateChange,e.onError,e.onPlay,e.onPause,e.onEnd,e.onBuffering,e.onPlaybackRateChange,e.onPlaybackQualityChange,e.stopOnEnd,e.id,o,c,t]),(0,X.jsxs)(X.Fragment,{children:[!e.lazyLoad&&(0,X.jsx)(`link`,{rel:O,href:y,as:`image`}),(0,X.jsx)(X.Fragment,{children:n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`link`,{rel:`preconnect`,href:p}),(0,X.jsx)(`link`,{rel:`preconnect`,href:`https://www.google.com`}),x&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`link`,{rel:`preconnect`,href:`https://static.doubleclick.net`}),(0,X.jsx)(`link`,{rel:`preconnect`,href:`https://googleads.g.doubleclick.net`})]})]})}),e.seo&&!e.playlist&&(0,X.jsx)(`script`,{type:`application/ld+json`,dangerouslySetInnerHTML:{__html:hj(e.id,c,y,p,e.seo)}}),A&&!e.playlist&&(0,X.jsx)(`noscript`,{children:(0,X.jsxs)(`a`,{href:`https://www.youtube.com/watch?v=${e.id}`,"aria-label":`Watch ${c} on YouTube`,children:[`Watch "`,c,`" on YouTube`]})}),(0,X.jsxs)(k,{onPointerOver:j,onClick:M,className:`${E} ${i?b:``}`,"data-title":c,role:!i&&!e.lazyLoad?`img`:void 0,"aria-label":i?void 0:`${c} - YouTube video preview`,style:{...!e.lazyLoad&&{backgroundImage:`url(${y})`},"--aspect-ratio":`${S/C*100}%`,...e.style||{}},children:[e.lazyLoad&&!i&&(0,X.jsx)(`img`,{src:y,alt:`${c} - YouTube thumbnail`,className:`lty-thumbnail`,loading:`lazy`}),e.playlist&&!i&&(0,X.jsx)(`div`,{className:`lty-playlist-icon`,"aria-hidden":`true`}),!(e.hideButtonOnActivate&&i)&&(0,X.jsx)(`button`,{type:`button`,className:T,"aria-label":`${u} ${c}`,"aria-hidden":i||void 0,tabIndex:i?-1:0,onClick:M,children:(0,X.jsx)(`span`,{className:`lty-visually-hidden`,children:u})}),i&&(0,X.jsx)(`iframe`,{ref:t,className:w,title:c,width:`560`,height:`315`,allow:`accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,src:m,referrerPolicy:e.referrerPolicy||`strict-origin-when-cross-origin`})]})]})}var _j=Y.forwardRef(gj);function vj(e){return e!==!1}function yj(e,t){let n=[];return t.startSeconds!==null&&n.push(`start=${t.startSeconds}`),e.controls===!1&&n.push(`controls=0`),e.loop===!0&&n.push(`loop=1`,`playlist=${t.id}`),e.playsinline===!0&&n.push(`playsinline=1`),n.length>0?n.join(`&`):void 0}function bj(e){if(e.width!==void 0)return{width:e.width}}function xj(e){if(!(e.width===void 0||e.height===void 0))return{aspectRatio:`${e.width} / ${e.height}`}}function Sj(e){let t=(0,J.c)(23),n=(0,Y.useRef)(null),r=e.title??`Vimeo video player`,i;t[0]===r?i=t[1]:(i=e=>{let t=e;n.current=t,t.element&&(t.element.title=r)},t[0]=r,t[1]=i);let a=i,o,s;t[2]===r?(o=t[3],s=t[4]):(o=()=>{let e=n.current;e?.element&&(e.element.title=r)},s=[r],t[2]=r,t[3]=o,t[4]=s),(0,Y.useEffect)(o,s);let c;t[5]===e?c=t[6]:(c=bj(e),t[5]=e,t[6]=c);let l=e.width===void 0,u=e.autoplay===!0,d=e.muted===!0,f=e.muted===!0?0:1,p=e.loop===!0,m=e.controls!==!1,h=e.playsinline!==!1,g;t[7]!==a||t[8]!==e.height||t[9]!==e.src||t[10]!==e.width||t[11]!==h||t[12]!==l||t[13]!==u||t[14]!==d||t[15]!==f||t[16]!==p||t[17]!==m?(g=(0,X.jsx)(fj,{video:e.src,responsive:l,width:e.width,height:e.height,autoplay:u,muted:d,volume:f,loop:p,controls:m,playsInline:h,onReady:a}),t[7]=a,t[8]=e.height,t[9]=e.src,t[10]=e.width,t[11]=h,t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=g):g=t[18];let _;return t[19]!==e.title||t[20]!==g||t[21]!==c?(_=(0,X.jsx)(`div`,{className:`ok-video ok-video-vimeo`,style:c,title:e.title,children:g}),t[19]=e.title,t[20]=g,t[21]=c,t[22]=_):_=t[22],_}function Cj(e){let t=(0,J.c)(17),n;t[0]===e.src?n=t[1]:(n=nn(e.src),t[0]=e.src,t[1]=n);let r=n;if(!r)return null;let i;t[2]!==r.startRaw||t[3]!==e.autoplay||t[4]!==e.muted?(i=[],r.startRaw!==null&&i.push(`t=${r.startRaw}`),e.autoplay===!0&&i.push(`autoplay=true`),e.muted===!0&&i.push(`muted=true`),t[2]=r.startRaw,t[3]=e.autoplay,t[4]=e.muted,t[5]=i):i=t[5];let a=i.length>0?`https://www.loom.com/embed/${r.id}?${i.join(`&`)}`:`https://www.loom.com/embed/${r.id}`,o;t[6]===e?o=t[7]:(o=bj(e),t[6]=e,t[7]=o);let s=e.title??`Loom video player`,c;t[8]!==a||t[9]!==e.height||t[10]!==e.width||t[11]!==s?(c=(0,X.jsx)(`iframe`,{className:`ok-video-loom-iframe`,src:a,title:s,width:e.width,height:e.height,allow:`autoplay; fullscreen`,referrerPolicy:`strict-origin-when-cross-origin`,allowFullScreen:!0}),t[8]=a,t[9]=e.height,t[10]=e.width,t[11]=s,t[12]=c):c=t[12];let l;return t[13]!==e.title||t[14]!==o||t[15]!==c?(l=(0,X.jsx)(`div`,{className:`ok-video ok-video-loom`,style:o,title:e.title,children:c}),t[13]=e.title,t[14]=o,t[15]=c,t[16]=l):l=t[16],l}function wj(e){let t=(0,J.c)(29);if(e.src!==void 0&&He(e.src)){let n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Cj,{...e,src:e.src}),t[0]=e,t[1]=n),n}if(e.src!==void 0&&Qe(e.src)){let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(Sj,{...e,src:e.src}),t[2]=e,t[3]=n),n}let n;if(t[4]!==e){n=Symbol.for(`react.early_return_sentinel`);bb0:{let r=e.src===void 0?null:y(e.src);if(r!==null){let i=e.autoplay===!0&&e.muted===!0,a=e.width!==void 0&&e.height!==void 0,o=bj(e),s;t[6]===e.poster?s=t[7]:(s=e.poster===void 0?void 0:ae(e.poster),t[6]=e.poster,t[7]=s);let c=(0,X.jsx)(_j,{id:r.id,title:e.title??`YouTube video player`,cookie:!r.noCookie,params:yj(e,r),muted:e.muted===!0,autoplay:e.autoplay===!0,alwaysLoadIframe:i,thumbnail:s,aspectWidth:a?Number(e.width):void 0,aspectHeight:a?Number(e.height):void 0,style:xj(e)}),l;t[8]!==o||t[9]!==c?(l=(0,X.jsx)(`div`,{className:`ok-video ok-video-youtube`,style:o,children:c}),t[8]=o,t[9]=c,t[10]=l):l=t[10],n=l;break bb0}}t[4]=e,t[5]=n}else n=t[5];if(n!==Symbol.for(`react.early_return_sentinel`))return n;let r;t[11]===e.src?r=t[12]:(r=e.src===void 0?void 0:ae(e.src),t[11]=e.src,t[12]=r);let i=e.title,a;t[13]===e.controls?a=t[14]:(a=vj(e.controls),t[13]=e.controls,t[14]=a);let o;t[15]===e.poster?o=t[16]:(o=e.poster===void 0?void 0:ae(e.poster),t[15]=e.poster,t[16]=o);let s;return t[17]!==e.autoplay||t[18]!==e.height||t[19]!==e.loop||t[20]!==e.muted||t[21]!==e.playsinline||t[22]!==e.preload||t[23]!==e.title||t[24]!==e.width||t[25]!==r||t[26]!==a||t[27]!==o?(s=(0,X.jsx)(`video`,{className:`ok-video`,src:r,title:i,controls:a,autoPlay:e.autoplay,muted:e.muted,loop:e.loop,playsInline:e.playsinline,poster:o,preload:e.preload,width:e.width,height:e.height}),t[17]=e.autoplay,t[18]=e.height,t[19]=e.loop,t[20]=e.muted,t[21]=e.playsinline,t[22]=e.preload,t[23]=e.title,t[24]=e.width,t[25]=r,t[26]=a,t[27]=o,t[28]=s):s=t[28],s}function Tj(e){let t=(0,J.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,X.jsx)(`div`,{className:`prose-no-margin`,children:e.children}),t[0]=e.children,t[1]=n),n}var Ej={Callout:AO,img:Ek,video:wj,audio:wO,Pdf:oA,File:UO,Embed:VO,Accordion:SO,Tabs:_A,Tab:pA,Math:kk,MermaidFence:Mk,Mirror:Kk,MirrorSource:qk,"*":Tj};function Dj(e){let t=new Set;for(let n of e)n.type===`reactnode`&&t.add(n.name);return t}var Oj=B(),kj=new Map;function Aj(e){if(e.surface===`compat`){let t=Ej[e.rendersAs];if(!t)throw Error(`Compat descriptor '${e.name}' declares rendersAs: '${e.rendersAs}', but no React component is registered under that name in componentMap. Add the canonical component before registering the compat descriptor.`);return{Component:t,reactNodePropNames:Dj(e.props)}}let t=Ej[e.name];return t?{Component:t,reactNodePropNames:Dj(e.props)}:null}for(let[e,t]of Oj.entries()){let n=Aj(t);n&&kj.set(e,n)}function jj(e,t){return{...e,Component:t.Component,reactNodePropNames:t.reactNodePropNames}}function Mj(e){let t=Oj.getOrWildcard(e),n=kj.get(t.name)??kj.get(`*`);if(!n)throw Error(`No React component registered for ${t.name} (and no '*' wildcard)`);return jj(t,n)}function Nj(){let e=[];for(let[t,n]of Oj.entries()){if(t===`*`)continue;let r=kj.get(t);r&&e.push(jj(n,r))}return e}var Pj=``+new URL(`image-preview-BJSGEOo4.png`,import.meta.url).href,Fj=``+new URL(`video-preview-vLovc_Vy.png`,import.meta.url).href,Ij={Callout:{description:{id:`322lyb`},props:{type:`note`,title:`Heads up`},children:`Callouts draw attention to key information.`},Accordion:{description:{id:`mWVJRX`},props:{title:`Click to expand`,defaultOpen:!0},children:`Hidden content goes here.`},img:{description:{id:`VUijjF`},props:{src:Pj,alt:`Sample image`}},video:{description:{id:`e1hptq`},props:{controls:!0,poster:Fj}},audio:{description:{id:`9jnjV0`},props:{controls:!0}},Math:{description:{id:`Y-Urt2`},props:{formula:`c = \\pm\\sqrt{a^2 + b^2}`}},Embed:{description:{id:`jTLWxh`},render:()=>(0,X.jsxs)(`div`,{className:`flex h-full w-full flex-col overflow-hidden rounded-md border border-border bg-background`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border bg-muted/40 px-2 py-1.5`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,X.jsx)(`span`,{className:`ml-1.5 flex-1 truncate rounded-sm bg-background px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:`https://example.com/embed`})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1.5 px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1.5 w-full rounded-sm bg-muted-foreground/20`}),(0,X.jsx)(`span`,{className:`h-1.5 w-5/6 rounded-sm bg-muted-foreground/20`}),(0,X.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-sm bg-muted-foreground/20`})]})]})},Pdf:{description:{id:`Fqr8BP`},render:()=>(0,X.jsxs)(`div`,{className:`flex h-full w-full flex-col overflow-hidden rounded-md border border-border bg-background`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border bg-muted/40 px-1.5 py-1`,children:[(0,X.jsxs)(`svg`,{viewBox:`0 0 12 12`,className:`size-3 text-muted-foreground`,"aria-hidden":`true`,children:[(0,X.jsx)(`title`,{children:`Thumbnails`}),(0,X.jsx)(`rect`,{x:`1`,y:`1`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`}),(0,X.jsx)(`rect`,{x:`7`,y:`1`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`}),(0,X.jsx)(`rect`,{x:`1`,y:`7`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`}),(0,X.jsx)(`rect`,{x:`7`,y:`7`,width:`4`,height:`4`,fill:`currentColor`,rx:`0.5`})]}),(0,X.jsxs)(`span`,{className:`ml-1 flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`rounded-sm bg-background px-1 py-0.5 font-mono`,children:`2`}),(0,X.jsx)(`span`,{children:`/ 12`})]}),(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-[10px] font-mono text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`rounded-sm bg-background px-1 py-0.5`,children:`−`}),(0,X.jsx)(`span`,{children:`100%`}),(0,X.jsx)(`span`,{className:`rounded-sm bg-background px-1 py-0.5`,children:`+`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 gap-1 p-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex w-6 flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`h-3 rounded-sm bg-muted-foreground/20`}),(0,X.jsx)(`span`,{className:`h-3 rounded-sm border border-foreground/60 bg-background`}),(0,X.jsx)(`span`,{className:`h-3 rounded-sm bg-muted-foreground/20`})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1 rounded-sm bg-background p-1.5`,children:[(0,X.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-sm bg-foreground/50`}),(0,X.jsx)(`span`,{className:`h-1 w-full rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1 w-5/6 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1 w-full rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`h-1 w-2/3 rounded-sm bg-muted-foreground/30`})]})]})]})},MermaidFence:{description:{id:`z0a2EA`},render:()=>(0,X.jsxs)(`svg`,{viewBox:`0 0 200 120`,className:`h-full w-full text-foreground`,"aria-hidden":`true`,preserveAspectRatio:`xMidYMid meet`,children:[(0,X.jsx)(`title`,{children:`Mermaid flowchart preview`}),(0,X.jsx)(`defs`,{children:(0,X.jsx)(`marker`,{id:`mermaid-preview-arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,X.jsx)(`path`,{d:`M 0 0 L 10 5 L 0 10 z`,fill:`currentColor`})})}),(0,X.jsx)(`rect`,{x:`14`,y:`20`,width:`56`,height:`28`,rx:`14`,fill:`currentColor`,fillOpacity:`0.1`,stroke:`currentColor`,strokeOpacity:`0.7`}),(0,X.jsx)(`text`,{x:`42`,y:`38`,textAnchor:`middle`,fontSize:`10`,fill:`currentColor`,children:`Start`}),(0,X.jsx)(`polygon`,{points:`100,18 140,50 100,82 60,50`,fill:`currentColor`,fillOpacity:`0.1`,stroke:`currentColor`,strokeOpacity:`0.7`}),(0,X.jsx)(`text`,{x:`100`,y:`54`,textAnchor:`middle`,fontSize:`10`,fill:`currentColor`,children:`Ready?`}),(0,X.jsx)(`rect`,{x:`130`,y:`84`,width:`56`,height:`28`,rx:`14`,fill:`currentColor`,fillOpacity:`0.1`,stroke:`currentColor`,strokeOpacity:`0.7`}),(0,X.jsx)(`text`,{x:`158`,y:`102`,textAnchor:`middle`,fontSize:`10`,fill:`currentColor`,children:`End`}),(0,X.jsx)(`line`,{x1:`70`,y1:`34`,x2:`80`,y2:`40`,stroke:`currentColor`,strokeOpacity:`0.7`,strokeWidth:`1.2`,markerEnd:`url(#mermaid-preview-arrow)`}),(0,X.jsx)(`line`,{x1:`124`,y1:`62`,x2:`138`,y2:`82`,stroke:`currentColor`,strokeOpacity:`0.7`,strokeWidth:`1.2`,markerEnd:`url(#mermaid-preview-arrow)`}),(0,X.jsx)(`text`,{x:`138`,y:`74`,fontSize:`8`,fill:`currentColor`,opacity:`0.6`,children:`yes`})]})},Tabs:{description:{id:`75Y1dk`},render:()=>(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex gap-1 border-b border-border pb-1`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-foreground/10 px-2 py-0.5 text-xs font-medium text-foreground`,children:`Tab 1`}),(0,X.jsx)(`span`,{className:`rounded-md px-2 py-0.5 text-xs text-muted-foreground`,children:`Tab 2`})]}),(0,X.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:(0,X.jsx)(o,{id:`m6YGpY`})})]})},Mirror:{description:{id:`8TLE9g`},render:()=>(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`div`,{className:`relative rounded-md border border-dashed border-border/40 px-2 py-1.5`,children:[(0,X.jsxs)(`span`,{className:`absolute -top-2 right-1.5 flex items-center gap-1 rounded-md bg-background px-1 text-[10px] text-muted-foreground`,children:[(0,X.jsx)(Ri,{className:`size-2.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`EL_YRd`,components:{0:(0,X.jsx)(`code`,{className:`font-mono`})}})})]}),(0,X.jsx)(`span`,{className:`block h-1.5 w-3/4 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`mt-1 block h-1.5 w-2/3 rounded-sm bg-muted-foreground/20`})]}),(0,X.jsx)(`p`,{className:`px-1 text-[10px] text-muted-foreground`,children:(0,X.jsx)(o,{id:`qNOgUu`})})]})},MirrorSource:{description:{id:`-KCZ6n`},render:()=>(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`div`,{className:`relative rounded-md border border-dashed border-border/50 px-2 py-1.5`,children:[(0,X.jsxs)(`span`,{className:`absolute -top-2 left-1.5 flex items-center gap-1 rounded-md bg-background px-1 text-[10px] text-muted-foreground`,children:[(0,X.jsx)(Ii,{className:`size-2.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`maDWIB`,components:{0:(0,X.jsx)(`code`,{className:`font-mono`})}})})]}),(0,X.jsx)(`span`,{className:`block h-1.5 w-4/5 rounded-sm bg-muted-foreground/30`}),(0,X.jsx)(`span`,{className:`mt-1 block h-1.5 w-3/5 rounded-sm bg-muted-foreground/20`})]}),(0,X.jsx)(`p`,{className:`px-1 text-[10px] text-muted-foreground`,children:(0,X.jsx)(o,{id:`emgiet`})})]})}};function Lj(e){let t={};for(let n of e.props)n.type!==`reactnode`&&`defaultValue`in n&&n.defaultValue!==void 0&&(t[n.name]=n.defaultValue);return t}function Rj(e){let t=Mj(e),n=Lj(t);return{type:`jsxComponent`,attrs:{componentName:t.name,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!0,props:n},content:t.hasChildren?[{type:`paragraph`}]:void 0}}var zj=new Set;function Bj(e){zj.add(e)}function Vj(e){if(typeof e==`number`)return zj.delete(e);let t=zj.values().next();return t.done?!1:(zj.delete(t.value),!0)}function Hj(e,t,n){n.props.some(e=>!(`hidden`in e&&e.hidden)&&e.type!==`reactnode`)?(Bj(t),requestAnimationFrame(()=>{e.commands.setNodeSelection(t)})):n.hasChildren&&e.commands.setTextSelection(t+2)}function Uj(e){return t=>{let n=new WeakSet;t.state.doc.descendants(t=>{t.type.name===`jsxComponent`&&t.attrs.componentName===e.name&&n.add(t)});let r=Rj(e.name);if(e.name===`Tabs`){let e=Rj(`Tab`),t=Rj(`Tab`),n=e.attrs,i=t.attrs;n.props={...n.props,label:`Tab 1`},i.props={...i.props,label:`Tab 2`},r.content=[e,t]}t.chain().focus().insertContent(r).run();let i=-1;t.state.doc.descendants((t,r)=>{if(i>=0)return!1;t.type.name===`jsxComponent`&&t.attrs.componentName===e.name&&!n.has(t)&&(i=r)}),!(i<0)&&Hj(t,i,e)}}var Wj=new Set([`File`,`Tab`]);function Gj(){return[{name:`component-File`,label:_._({id:`J2eKUI`}),icon:Ui,category:`media`,aliases:[`file`,`attachment`,`download`,`upload`,`document`,`doc`,`docx`,`zip`],description:"Attach a downloadable file (`.pdf` / `.docx` / `.zip` / …)",command:qj,preview:{description:_._({id:`t-JXbf`}),render:()=>(0,X.jsxs)(`div`,{className:`flex w-full items-baseline gap-2 rounded-md px-2 py-1.5`,children:[(0,X.jsx)(Ui,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:`quarterly-report.pdf`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`1.4 MB`})]})}}]}function Kj(){return[...Nj().filter(e=>e.surface===`canonical`&&!Wj.has(e.name)).map(e=>{let t=Ij[e.name],n=e.Component,r=t?{description:_._(t.description),render:t.render??(()=>(0,X.jsx)(n,{...t.props,children:t.children}))}:void 0;return{name:`component-${e.name}`,label:e.displayName??e.name,icon:yO(e.icon),category:e.category??`content`,command:Uj(e),aliases:e.searchTerms,description:e.description,preview:r}}),...Gj()]}function qj(e){let t=document.createElement(`input`);t.type=`file`,t.accept=`*/*`,t.style.display=`none`,t.addEventListener(`change`,()=>{let n=t.files?.[0];if(n){let t=e.state.selection.from;qD(n,e,t)}t.remove()},{once:!0}),t.addEventListener(`cancel`,()=>t.remove(),{once:!0}),document.body.appendChild(t),t.click()}function Jj(e,t){let n=QD.getState(e.state);if(!n)return null;for(let e of n.byId.values())if(e.markType===`link`&&e.from<=t&&t<e.to)return e.id;return null}function Yj(){return[{name:`wikiLink`,label:_._({id:`mZHJju`}),icon:oa,category:`insert`,aliases:[`wiki`,`wikilink`,`[[`,`internal`,`page`,`backlink`,`cross-link`],description:"Link to another page (`[[page]]`) — opens a page picker",preview:{description:_._({id:`cqA3od`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-7`,children:(0,X.jsx)(o,{id:`u-9fWA`,components:{0:(0,X.jsx)(`span`,{className:`font-medium text-azure-blue underline underline-offset-2 dark:text-sky-blue`})}})})},command:e=>{e.chain().focus().insertContent(`[[`).run()}},{name:`externalLink`,label:_._({id:`0R4wMK`}),icon:Ri,category:`insert`,aliases:[`link`,`url`,`href`,`external`,`web`,`hyperlink`],description:"Link to an external URL (`https://…`)",preview:{description:_._({id:`ClDdyg`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-7`,children:(0,X.jsx)(o,{id:`QWT-Z9`,components:{0:(0,X.jsx)(`span`,{className:`font-medium text-azure-blue underline underline-offset-2 dark:text-sky-blue`}),1:(0,X.jsx)(`span`,{className:`text-[0.85em] opacity-60`})}})})},command:e=>{let t=e.state.selection.from;e.chain().focus().insertContent({type:`text`,text:`link`,marks:[{type:`link`,attrs:{href:`https://`}}]}).run();let n=Jj(e,t);n&&(XD(n),requestAnimationFrame(()=>{_O(e).setActiveNode(n)}))}},{name:`component-Tag`,label:_._({id:`UL8A9w`}),icon:Yi,category:`content`,aliases:[`#`,`hashtag`,`label`],description:"Inline tag (`#tagname`) for cross-doc linking",preview:{description:_._({id:`5ClEAu`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-7`,children:(0,X.jsx)(o,{id:`KZLdgR`,components:{0:(0,X.jsx)(`a`,{className:`tag pointer-events-none`})}})})},command:e=>{e.chain().insertTag(``).run()}}]}function Xj(e){return t=>{t.chain().focus().insertContent({type:`codeBlock`,attrs:{language:`html`,meta:`preview`},content:[{type:`text`,text:e}]}).run()}}var Zj={chart:{icon:Oi,aliases:[`chart`,`bar`,`graph`,`plot`,`viz`,`data`,`embed`,`preview`],render:()=>(0,X.jsxs)(`div`,{className:`flex h-20 items-end gap-1.5`,children:[(0,X.jsx)(`div`,{className:`h-[45%] flex-1 rounded-t-sm bg-chart-1`}),(0,X.jsx)(`div`,{className:`h-[70%] flex-1 rounded-t-sm bg-chart-2`}),(0,X.jsx)(`div`,{className:`h-[90%] flex-1 rounded-t-sm bg-chart-3`}),(0,X.jsx)(`div`,{className:`h-[60%] flex-1 rounded-t-sm bg-chart-4`}),(0,X.jsx)(`div`,{className:`h-[80%] flex-1 rounded-t-sm bg-chart-5`})]})},"stat-cards":{icon:ta,aliases:[`stat`,`stats`,`metric`,`metrics`,`cards`,`kpi`,`embed`,`preview`],render:()=>(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex-1 rounded-md border border-border bg-card p-2`,children:[(0,X.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Users`}),(0,X.jsx)(`div`,{className:`text-sm font-bold text-card-foreground`,children:`12.4k`}),(0,X.jsx)(`div`,{className:`text-[10px] font-semibold text-chart-2`,children:`+8.2%`})]}),(0,X.jsxs)(`div`,{className:`flex-1 rounded-md border border-border bg-card p-2`,children:[(0,X.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Revenue`}),(0,X.jsx)(`div`,{className:`text-sm font-bold text-card-foreground`,children:`$48k`}),(0,X.jsx)(`div`,{className:`text-[10px] font-semibold text-chart-1`,children:`+3.1%`})]})]})},"custom-svg":{icon:Sa,aliases:[`svg`,`vector`,`graphic`,`illustration`,`ring`,`embed`,`preview`],render:()=>(0,X.jsx)(`div`,{className:`flex items-center justify-center text-chart-1`,children:(0,X.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{cx:`36`,cy:`36`,r:`28`,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.15`,strokeWidth:`9`}),(0,X.jsx)(`circle`,{cx:`36`,cy:`36`,r:`28`,fill:`none`,stroke:`currentColor`,strokeWidth:`9`,strokeLinecap:`round`,strokeDasharray:`176`,strokeDashoffset:`53`,transform:`rotate(-90 36 36)`})]})})},"interactive-control":{icon:wa,aliases:[`interactive`,`slider`,`control`,`widget`,`input`,`embed`,`preview`],render:()=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`div`,{className:`text-lg font-bold text-chart-1`,children:`$2,500`}),(0,X.jsxs)(`div`,{className:`relative h-1.5 rounded-full bg-muted`,children:[(0,X.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1/3 rounded-full bg-primary`}),(0,X.jsx)(`div`,{className:`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/3 size-3 rounded-full bg-primary`})]}),(0,X.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Drag to adjust`})]})}};function Qj(){return T.map(e=>{let t=Zj[e.id];return{name:`embed-starter-${e.id}`,label:e.title,icon:t.icon,category:`embed`,command:Xj(e.html),aliases:t.aliases,description:e.description,preview:{description:e.description,render:t.render}}})}function $j(){return[{name:`heading1`,label:_._({id:`lXKZGw`}),icon:Xi,category:`basic`,command:e=>e.chain().focus().toggleHeading({level:1}).run(),aliases:[`h1`],preview:{description:_._({id:`3J7d2N`}),render:()=>(0,X.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:(0,X.jsx)(o,{id:`lXKZGw`})})}},{name:`heading2`,label:_._({id:`El7NbA`}),icon:Zi,category:`basic`,command:e=>e.chain().focus().toggleHeading({level:2}).run(),aliases:[`h2`],preview:{description:_._({id:`LXdWeS`}),render:()=>(0,X.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight`,children:(0,X.jsx)(o,{id:`El7NbA`})})}},{name:`heading3`,label:_._({id:`SFN6dN`}),icon:Qi,category:`basic`,command:e=>e.chain().focus().toggleHeading({level:3}).run(),aliases:[`h3`],preview:{description:_._({id:`g4XBm0`}),render:()=>(0,X.jsx)(`h3`,{className:`text-base font-semibold tracking-tight`,children:(0,X.jsx)(o,{id:`SFN6dN`})})}},{name:`bulletList`,label:_._({id:`s1c0ja`}),icon:la,category:`basic`,command:e=>e.chain().focus().toggleBulletList().run(),aliases:[`ul`,`unordered`],preview:{description:_._({id:`fYjgXu`}),render:()=>(0,X.jsxs)(`ul`,{className:`list-disc pl-5 text-sm leading-7`,children:[(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`FCxvG5`})}),(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`saIASg`})})]})}},{name:`orderedList`,label:_._({id:`Uci-Ph`}),icon:sa,category:`basic`,command:e=>e.chain().focus().toggleOrderedList().run(),aliases:[`ol`,`numbered`],preview:{description:_._({id:`rXz97P`}),render:()=>(0,X.jsxs)(`ol`,{className:`list-decimal pl-5 text-sm leading-7`,children:[(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`FCxvG5`})}),(0,X.jsx)(`li`,{children:(0,X.jsx)(o,{id:`saIASg`})})]})}},{name:`taskList`,label:_._({id:`G_686w`}),icon:ca,category:`basic`,command:e=>e.chain().focus().toggleTaskList().run(),aliases:[`todo`,`checklist`,`checkbox`],preview:{description:_._({id:`yutJKi`}),render:()=>(0,X.jsxs)(`ul`,{className:`space-y-1.5 text-sm`,children:[(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:!0,readOnly:!0,className:`size-3.5`}),(0,X.jsx)(`span`,{className:`text-muted-foreground line-through`,children:(0,X.jsx)(o,{id:`DPfwMq`})})]}),(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`checkbox`,readOnly:!0,className:`size-3.5`}),(0,X.jsx)(`span`,{children:(0,X.jsx)(o,{id:`rZ9HZq`})})]})]})}},{name:`blockquote`,label:_._({id:`ZhhOwV`}),icon:ya,category:`basic`,command:e=>e.chain().focus().toggleBlockquote().run(),aliases:[`quote`],preview:{description:_._({id:`w7nm4K`}),render:()=>(0,X.jsx)(`blockquote`,{className:`border-l-2 border-muted-foreground/40 pl-3 text-sm italic text-muted-foreground`,children:(0,X.jsx)(o,{id:`74-bX-`})})}},{name:`codeBlock`,label:_._({id:`N2eHWq`}),icon:Fi,category:`basic`,command:e=>e.chain().focus().toggleCodeBlock().run(),aliases:[`code`,`fence`],preview:{description:_._({id:`XpIZmv`}),render:()=>(0,X.jsx)(`pre`,{className:`rounded-md bg-muted px-2.5 py-2 font-mono text-xs leading-5`,children:(0,X.jsx)(`code`,{children:`const greeting = "Hello";
|
|
7
7
|
console.log(greeting);`})})}},{name:`table`,label:_._({id:`4hJhzz`}),icon:Da,category:`insert`,command:e=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),aliases:[`grid`],preview:{description:_._({id:`H0WlWQ`}),render:()=>(0,X.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`border border-border bg-muted/50 px-2 py-1 text-left font-semibold`,children:(0,X.jsx)(o,{id:`6YtxFj`})}),(0,X.jsx)(`th`,{className:`border border-border bg-muted/50 px-2 py-1 text-left font-semibold`,children:(0,X.jsx)(o,{id:`GDvlUT`})})]})}),(0,X.jsxs)(`tbody`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`td`,{className:`border border-border px-2 py-1`,children:`Ada`}),(0,X.jsx)(`td`,{className:`border border-border px-2 py-1`,children:`Engineer`})]}),(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`td`,{className:`border border-border px-2 py-1`,children:`Grace`}),(0,X.jsx)(`td`,{className:`border border-border px-2 py-1`,children:`Admiral`})]})]})]})}},{name:`separator`,label:_._({id:`yLq4w4`}),icon:fa,category:`insert`,command:e=>e.chain().focus().setHorizontalRule().run(),aliases:[`hr`,`divider`,`rule`],preview:{description:_._({id:`0wswKc`}),render:()=>(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:(0,X.jsx)(o,{id:`KYcZ6Y`})}),(0,X.jsx)(`hr`,{className:`border-border`}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:(0,X.jsx)(o,{id:`tAPZEx`})})]})}},{name:`footnote`,label:_._({id:`dOxPd4`}),icon:Ea,category:`insert`,command:e=>{let t=0;e.state.doc.descendants(e=>{if(e.type.name===`footnoteDefinition`){let n=String(e.attrs.identifier??``),r=Number.parseInt(n,10);!Number.isNaN(r)&&r>t&&(t=r)}return!0});let n=String(t+1),r=e.state.doc.content.size;e.chain().focus().insertFootnoteReference(n).insertContentAt(r+1,{type:`footnoteDefinition`,attrs:{identifier:n,label:n},content:[{type:`paragraph`}]}).run()},aliases:[`fn`,`ref`,`[^`],preview:{description:_._({id:`kFLlsI`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-6`,children:(0,X.jsx)(o,{id:`hxBHxQ`,components:{0:(0,X.jsx)(`sup`,{className:`footnote-ref`}),1:(0,X.jsx)(`a`,{className:`footnote-ref-link`,href:`#fn-1`})}})})}},{name:`inlineMath`,label:_._({id:`q2kXMG`}),icon:Ca,category:`insert`,command:e=>{let t=e.state.selection.from;e.chain().focus().insertMathInline(``).run(),Bj(t),requestAnimationFrame(()=>{e.commands.setNodeSelection(t)})},aliases:[`math`,`latex`,`equation`,`formula`,`katex`,`inlinemath`],preview:{description:_._({id:`eNQGRb`}),render:()=>(0,X.jsx)(`p`,{className:`text-sm leading-7`,children:(0,X.jsx)(o,{id:`5Ajb15`,components:{0:(0,X.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-serif italic`})}})})}}]}function eM(e,t){if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)||e.aliases?.some(e=>e.toLowerCase().includes(n)))}function tM(e){let{$from:t}=e.selection;return t.depth===0?null:{from:t.before(1),to:t.after(1)}}function nM(e,t){let n=tM(e);if(!n)return!1;let{from:r,to:i}=n;if(r===0)return!1;let a=e.doc.resolve(r-1);if(a.depth===0)return!1;let o=a.before(1),s=e.doc.slice(r,i).content,c=e.doc.slice(o,r).content;if(!t)return!0;let l=e.tr;l.replaceWith(o,i,s.append(c));let u=o+1,d=o+s.size,f=e.selection.from-r,p=Math.min(u+f,d);return l.setSelection(vt.near(l.doc.resolve(p))),l.scrollIntoView(),t(l),!0}function rM(e,t){let n=tM(e);if(!n)return!1;let{from:r,to:i}=n;if(i>=e.doc.content.size)return!1;let a=e.doc.resolve(i+1);if(a.depth===0)return!1;let o=a.after(1),s=e.doc.slice(r,i).content,c=e.doc.slice(i,o).content;if(!t)return!0;let l=e.tr;l.replaceWith(r,o,c.append(s));let u=r+c.size+1,d=r+c.size+s.size,f=e.selection.from-r,p=Math.min(u+f,d);return l.setSelection(vt.near(l.doc.resolve(p))),l.scrollIntoView(),t(l),!0}var iM=D.create({name:`blockMover`,addKeyboardShortcuts(){return{"Mod-Shift-ArrowUp":({editor:e})=>nM(e.state,e.view.dispatch),"Mod-Shift-ArrowDown":({editor:e})=>rM(e.state,e.view.dispatch)}}}),aM=new W(`bridgeId`);function oM(e){let t=Ov.getState(e);return t?.binding?.mapping?t.binding.mapping:null}function sM(e){let t=oM(e);if(!t)return null;let n=new Map;for(let[e,r]of t)r&&`nodeName`in e&&typeof e.getAttribute==`function`&&n.set(r,e);return n}function cM(e,t){return e?e.get(t)??null:null}var lM=D.create({name:`bridgeIdPlugin`,priority:1e3,addProseMirrorPlugins(){return[new Gt({key:aM,state:{init(e,t){let n={yElementToId:new WeakMap,posToId:new Map,counter:0},r=sM(t);return t.doc.descendants((e,t)=>{if(e.type.name!==`jsxComponent`)return;let i=cM(r,e);if(i){let e=`b${++n.counter}`;n.yElementToId.set(i,e),n.posToId.set(t,e)}else{let e=`b${++n.counter}`;n.posToId.set(t,e)}}),n},apply(e,t,n,r){if(!e.docChanged){let n=new Map;for(let[i,a]of t.posToId){let t=e.mapping.map(i);r.doc.nodeAt(t)?.type.name===`jsxComponent`&&n.set(t,a)}return{...t,posToId:n}}let i=new Map,{counter:a}=t,{yElementToId:o}=t,s=sM(r);return r.doc.descendants((n,r)=>{if(n.type.name!==`jsxComponent`)return;let c=cM(s,n);if(c){let e=o.get(c);if(e)i.set(r,e);else{let e=`b${++a}`;o.set(c,e),i.set(r,e)}}else{let n=!1;for(let[a,o]of t.posToId)if(e.mapping.map(a)===r){i.set(r,o),n=!0;break}if(!n){let e=`b${++a}`;i.set(r,e)}}}),{yElementToId:o,posToId:i,counter:a}}}})]}}),uM=new W(`chunkWrapperDecoration`),dM=`ok-chunk-wrapper`,fM=!1;function pM(){return globalThis.CSS===void 0||typeof globalThis.CSS.supports!=`function`?!0:globalThis.CSS.supports(`content-visibility`,`auto`)}var mM=pM();function hM(){return mM?new Gt({key:uM,props:{decorations(e){let t=[];return e.doc.forEach((e,n)=>{e.isInline||e.type.name!==`jsxComponent`&&e.type.name!==`heading`&&t.push(Pe.node(n,n+e.nodeSize,{class:dM}))}),t.length===0?null:(fM||(fM=!0,Z(`ok/render/cv-auto-skip`,{chunkCount:t.length},{startTime:performance.now(),duration:0})),Tt.create(e.doc,t))}}}):new Gt({key:uM})}function gM(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`decltype\\(auto\\)`,i=`[a-zA-Z_]\\w*::`,a=`(?!struct)(`+r+`|`+t.optional(i)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,o={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},s={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},l={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},u={className:`title`,begin:t.optional(i)+e.IDENT_RE,relevance:0},d=t.optional(i)+e.IDENT_RE+`\\s*\\(`,f=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),p=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],m=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),h=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),g={type:p,keyword:f,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:m},_={className:`function.dispatch`,relevance:0,keywords:{_hint:h},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},v=[_,l,o,n,e.C_BLOCK_COMMENT_MODE,c,s],y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:g,contains:v.concat([{begin:/\(/,end:/\)/,keywords:g,contains:v.concat([`self`]),relevance:0}]),relevance:0},b={className:`function`,begin:`(`+a+`[\\*&\\s]+)+`+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[u],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[s,c]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,s,c,o,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,s,c,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,l]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:g,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(y,b,_,v,[l,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:g,contains:[`self`,o]},{begin:e.IDENT_RE+`::`,keywords:g},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function _M(e){let t={type:[`boolean`,`byte`,`word`,`String`],built_in:`KeyboardController.MouseController.SoftwareSerial.EthernetServer.EthernetClient.LiquidCrystal.RobotControl.GSMVoiceCall.EthernetUDP.EsploraTFT.HttpClient.RobotMotor.WiFiClient.GSMScanner.FileSystem.Scheduler.GSMServer.YunClient.YunServer.IPAddress.GSMClient.GSMModem.Keyboard.Ethernet.Console.GSMBand.Esplora.Stepper.Process.WiFiUDP.GSM_SMS.Mailbox.USBHost.Firmata.PImage.Client.Server.GSMPIN.FileIO.Bridge.Serial.EEPROM.Stream.Mouse.Audio.Servo.File.Task.GPRS.WiFi.Wire.TFT.GSM.SPI.SD`.split(`.`),_hints:`setup.loop.runShellCommandAsynchronously.analogWriteResolution.retrieveCallingNumber.printFirmwareVersion.analogReadResolution.sendDigitalPortPair.noListenOnLocalhost.readJoystickButton.setFirmwareVersion.readJoystickSwitch.scrollDisplayRight.getVoiceCallStatus.scrollDisplayLeft.writeMicroseconds.delayMicroseconds.beginTransmission.getSignalStrength.runAsynchronously.getAsynchronously.listenOnLocalhost.getCurrentCarrier.readAccelerometer.messageAvailable.sendDigitalPorts.lineFollowConfig.countryNameWrite.runShellCommand.readStringUntil.rewindDirectory.readTemperature.setClockDivider.readLightSensor.endTransmission.analogReference.detachInterrupt.countryNameRead.attachInterrupt.encryptionType.readBytesUntil.robotNameWrite.readMicrophone.robotNameRead.cityNameWrite.userNameWrite.readJoystickY.readJoystickX.mouseReleased.openNextFile.scanNetworks.noInterrupts.digitalWrite.beginSpeaker.mousePressed.isActionDone.mouseDragged.displayLogos.noAutoscroll.addParameter.remoteNumber.getModifiers.keyboardRead.userNameRead.waitContinue.processInput.parseCommand.printVersion.readNetworks.writeMessage.blinkVersion.cityNameRead.readMessage.setDataMode.parsePacket.isListening.setBitOrder.beginPacket.isDirectory.motorsWrite.drawCompass.digitalRead.clearScreen.serialEvent.rightToLeft.setTextSize.leftToRight.requestFrom.keyReleased.compassRead.analogWrite.interrupts.WiFiServer.disconnect.playMelody.parseFloat.autoscroll.getPINUsed.setPINUsed.setTimeout.sendAnalog.readSlider.analogRead.beginWrite.createChar.motorsStop.keyPressed.tempoWrite.readButton.subnetMask.debugPrint.macAddress.writeGreen.randomSeed.attachGPRS.readString.sendString.remotePort.releaseAll.mouseMoved.background.getXChange.getYChange.answerCall.getResult.voiceCall.endPacket.constrain.getSocket.writeJSON.getButton.available.connected.findUntil.readBytes.exitValue.readGreen.writeBlue.startLoop.IPAddress.isPressed.sendSysex.pauseMode.gatewayIP.setCursor.getOemKey.tuneWrite.noDisplay.loadImage.switchPIN.onRequest.onReceive.changePIN.playFile.noBuffer.parseInt.overflow.checkPIN.knobRead.beginTFT.bitClear.updateIR.bitWrite.position.writeRGB.highByte.writeRed.setSpeed.readBlue.noStroke.remoteIP.transfer.shutdown.hangCall.beginSMS.endWrite.attached.maintain.noCursor.checkReg.checkPUK.shiftOut.isValid.shiftIn.pulseIn.connect.println.localIP.pinMode.getIMEI.display.noBlink.process.getBand.running.beginSD.drawBMP.lowByte.setBand.release.bitRead.prepare.pointTo.readRed.setMode.noFill.remove.listen.stroke.detach.attach.noTone.exists.buffer.height.bitSet.circle.config.cursor.random.IRread.setDNS.endSMS.getKey.micros.millis.begin.print.write.ready.flush.width.isPIN.blink.clear.press.mkdir.rmdir.close.point.yield.image.BSSID.click.delay.read.text.move.peek.beep.rect.line.open.seek.fill.size.turn.stop.home.find.step.tone.sqrt.RSSI.SSID.end.bit.tan.cos.sin.pow.map.abs.max.min.get.run.put`.split(`.`),literal:[`DIGITAL_MESSAGE`,`FIRMATA_STRING`,`ANALOG_MESSAGE`,`REPORT_DIGITAL`,`REPORT_ANALOG`,`INPUT_PULLUP`,`SET_PIN_MODE`,`INTERNAL2V56`,`SYSTEM_RESET`,`LED_BUILTIN`,`INTERNAL1V1`,`SYSEX_START`,`INTERNAL`,`EXTERNAL`,`DEFAULT`,`OUTPUT`,`INPUT`,`HIGH`,`LOW`]},n=gM(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name=`Arduino`,n.aliases=[`ino`],n.supersetOf=`cpp`,n}function vM(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}function yM(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`decltype\\(auto\\)`,i=`[a-zA-Z_]\\w*::`,a=`(`+r+`|`+t.optional(i)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,o={className:`type`,variants:[{begin:`\\b[a-z\\d_]*_t\\b`},{match:/\batomic_[a-z]{3,6}\b/}]},s={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:`number`,variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},l={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},u={className:`title`,begin:t.optional(i)+e.IDENT_RE,relevance:0},d=t.optional(i)+e.IDENT_RE+`\\s*\\(`,f={keyword:`asm.auto.break.case.continue.default.do.else.enum.extern.for.fortran.goto.if.inline.register.restrict.return.sizeof.typeof.typeof_unqual.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local.alignas.alignof.noreturn.static_assert.thread_local._Pragma`.split(`.`),type:`float.double.signed.unsigned.int.short.long.char.void._Bool._BitInt._Complex._Imaginary._Decimal32._Decimal64._Decimal96._Decimal128._Decimal64x._Decimal128x._Float16._Float32._Float64._Float128._Float32x._Float64x._Float128x.const.static.constexpr.complex.bool.imaginary`.split(`.`),literal:`true false NULL`,built_in:`std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr`},p=[l,o,n,e.C_BLOCK_COMMENT_MODE,c,s],m={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:f,contains:p.concat([{begin:/\(/,end:/\)/,keywords:f,contains:p.concat([`self`]),relevance:0}]),relevance:0},h={begin:`(`+a+`[\\*&\\s]+)+`+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:f,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:f,relevance:0},{begin:d,returnBegin:!0,contains:[e.inherit(u,{className:`title.function`})],relevance:0},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:f,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,s,c,o,{begin:/\(/,end:/\)/,keywords:f,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,s,c,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,l]};return{name:`C`,aliases:[`h`],keywords:f,disableAutodetect:!0,illegal:`</`,contains:[].concat(m,h,p,[l,{begin:e.IDENT_RE+`::`,keywords:f},{className:`class`,beginKeywords:`enum class struct union`,end:/[{;:<>=]/,contains:[{beginKeywords:`final class struct`},e.TITLE_MODE]}]),exports:{preprocessor:l,strings:s,keywords:f}}}function bM(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`decltype\\(auto\\)`,i=`[a-zA-Z_]\\w*::`,a=`(?!struct)(`+r+`|`+t.optional(i)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,o={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},s={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},l={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},u={className:`title`,begin:t.optional(i)+e.IDENT_RE,relevance:0},d=t.optional(i)+e.IDENT_RE+`\\s*\\(`,f=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),p=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],m=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),h=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),g={type:p,keyword:f,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:m},_={className:`function.dispatch`,relevance:0,keywords:{_hint:h},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},v=[_,l,o,n,e.C_BLOCK_COMMENT_MODE,c,s],y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:g,contains:v.concat([{begin:/\(/,end:/\)/,keywords:g,contains:v.concat([`self`]),relevance:0}]),relevance:0},b={className:`function`,begin:`(`+a+`[\\*&\\s]+)+`+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[u],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[s,c]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,s,c,o,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,s,c,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,l]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:g,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(y,b,_,v,[l,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:g,contains:[`self`,o]},{begin:e.IDENT_RE+`::`,keywords:g},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function xM(e){let t=[`bool`,`byte`,`char`,`decimal`,`delegate`,`double`,`dynamic`,`enum`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`ulong`,`uint`,`ushort`],n=[`public`,`private`,`protected`,`static`,`internal`,`protected`,`abstract`,`async`,`extern`,`override`,`unsafe`,`virtual`,`new`,`sealed`,`partial`],r={keyword:`abstract.as.base.break.case.catch.class.const.continue.do.else.event.explicit.extern.finally.fixed.for.foreach.goto.if.implicit.in.interface.internal.is.lock.namespace.new.operator.out.override.params.private.protected.public.readonly.record.ref.return.scoped.sealed.sizeof.stackalloc.static.struct.switch.this.throw.try.typeof.unchecked.unsafe.using.virtual.void.volatile.while`.split(`.`).concat(`add.alias.and.ascending.args.async.await.by.descending.dynamic.equals.file.from.get.global.group.init.into.join.let.nameof.not.notnull.on.or.orderby.partial.record.remove.required.scoped.select.set.unmanaged.value|0.var.when.where.with.yield`.split(`.`)),built_in:t,literal:[`default`,`false`,`null`,`true`]},i=e.inherit(e.TITLE_MODE,{begin:`[a-zA-Z](\\.?\\w)*`}),a={className:`number`,variants:[{begin:`\\b(0b[01']+)`},{begin:`(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)`},{begin:`(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)`}],relevance:0},o={className:`string`,begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},s={className:`string`,begin:`@"`,end:`"`,contains:[{begin:`""`}]},c=e.inherit(s,{illegal:/\n/}),l={className:`subst`,begin:/\{/,end:/\}/,keywords:r},u=e.inherit(l,{illegal:/\n/}),d={className:`string`,begin:/\$"/,end:`"`,illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,u]},f={className:`string`,begin:/\$@"/,end:`"`,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},l]},p=e.inherit(f,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},u]});l.contains=[f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],u.contains=[p,d,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let m={variants:[o,f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h={begin:`<`,end:`>`,contains:[{beginKeywords:`in out`},i]},g=e.IDENT_RE+`(<`+e.IDENT_RE+`(\\s*,\\s*`+e.IDENT_RE+`)*>)?(\\[\\])?`,_={begin:`@`+e.IDENT_RE,relevance:0};return{name:`C#`,aliases:[`cs`,`c#`],keywords:r,illegal:/::/,contains:[e.COMMENT(`///`,`$`,{returnBegin:!0,contains:[{className:`doctag`,variants:[{begin:`///`,relevance:0},{begin:`<!--|-->`},{begin:`</?`,end:`>`}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`meta`,begin:`#`,end:`$`,keywords:{keyword:`if else elif endif define undef warning error line region endregion pragma checksum`}},m,a,{beginKeywords:`class interface`,relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:`where class`},i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`namespace`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`record`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`meta`,begin:`^\\s*\\[(?=[\\w])`,excludeBegin:!0,end:`\\]`,excludeEnd:!0,contains:[{className:`string`,begin:/"/,end:/"/}]},{beginKeywords:`new return throw await else`,relevance:0},{className:`function`,begin:`(`+g+`\\s+)+`+e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:r,contains:[{beginKeywords:n.join(` `),relevance:0},{begin:e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,contains:[e.TITLE_MODE,h],relevance:0},{match:/\(\)/},{className:`params`,begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,relevance:0,contains:[m,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}var SM=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),CM=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),wM=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),TM=[...CM,...wM],EM=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),DM=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),OM=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),kM=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function AM(e){let t=e.regex,n=SM(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+DM.join(`|`)+`)`},{begin:`:(:)?(`+OM.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+kM.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:EM.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+TM.join(`|`)+`)\\b`}]}}function jM(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}function MM(e){let t={keyword:[`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`],type:[`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int8`,`int16`,`int32`,`int64`,`string`,`uint8`,`uint16`,`uint32`,`uint64`,`int`,`uint`,`uintptr`,`rune`],literal:[`true`,`false`,`iota`,`nil`],built_in:[`append`,`cap`,`close`,`complex`,`copy`,`imag`,`len`,`make`,`new`,`panic`,`print`,`println`,`real`,`recover`,`delete`]};return{name:`Go`,aliases:[`golang`],keywords:t,illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:`number`,variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:`function`,beginKeywords:`func`,end:`\\s*(\\{|$)`,excludeEnd:!0,contains:[e.TITLE_MODE,{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}function NM(e){let t=e.regex;return{name:`GraphQL`,aliases:[`gql`],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:[`query`,`mutation`,`subscription`,`type`,`input`,`schema`,`directive`,`interface`,`union`,`scalar`,`fragment`,`enum`,`on`],literal:[`true`,`false`,`null`]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:`punctuation`,match:/[.]{3}/,relevance:0},{scope:`punctuation`,begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:`variable`,begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:`meta`,match:/@\w+/,excludeEnd:!0},{scope:`symbol`,begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function PM(e){let t=e.regex,n={className:`number`,relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:`variable`,variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},a={className:`literal`,begin:/\bon|off|true|false|yes|no\b/},o={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:`'''`,end:`'''`,relevance:10},{begin:`"""`,end:`"""`,relevance:10},{begin:`"`,end:`"`},{begin:`'`,end:`'`}]},s={begin:/\[/,end:/\]/,contains:[r,a,i,o,n,`self`],relevance:0},c=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:`TOML, also INI`,aliases:[`toml`],case_insensitive:!0,illegal:/\S/,contains:[r,{className:`section`,begin:/\[+/,end:/\]+/},{begin:t.concat(c,`(\\s*\\.\\s*`,c,`)*`,t.lookahead(/\s*=\s*[^#\s]/)),className:`attr`,starts:{end:/$/,contains:[r,s,a,i,o,n]}}]}}var FM=`[0-9](_*[0-9])*`,IM=`\\.(${FM})`,LM=`[0-9a-fA-F](_*[0-9a-fA-F])*`,RM={className:`number`,variants:[{begin:`(\\b(${FM})((${IM})|\\.)?|(${IM}))[eE][+-]?(${FM})[fFdD]?\\b`},{begin:`\\b(${FM})((${IM})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${IM})[fFdD]?\\b`},{begin:`\\b(${FM})[fFdD]\\b`},{begin:`\\b0[xX]((${LM})\\.?|(${LM})?\\.(${LM}))[pP][+-]?(${FM})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${LM})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function zM(e,t,n){return n===-1?``:e.replace(t,r=>zM(e,t,n-1))}function BM(e){let t=e.regex,n=`[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,r=n+zM(`(?:<`+n+`~~~(?:\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~)*>)?`,/~~~/g,2),i={keyword:`synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when`.split(`.`),literal:[`false`,`true`,`null`],type:[`char`,`boolean`,`long`,`float`,`int`,`byte`,`short`,`double`],built_in:[`super`,`this`]},a={className:`meta`,begin:`@`+n,contains:[{begin:/\(/,end:/\)/,contains:[`self`]}]},o={className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:`Java`,aliases:[`jsp`],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:`doctag`,begin:`@[A-Za-z]+`}]}),{begin:/import java\.[a-z]+\./,keywords:`import`,relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:`string`,contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:`keyword`,3:`title.class`}},{match:/non-sealed/,scope:`keyword`},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:`type`,3:`variable`,5:`operator`}},{begin:[/record/,/\s+/,n],className:{1:`keyword`,3:`title.class`},contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`new throw return else`,relevance:0},{begin:[`(?:`+r+`\\s+)`,e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:`title.function`},keywords:i,contains:[{className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,RM,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},RM,a]}}var VM=`[A-Za-z$_][0-9A-Za-z$_]*`,HM=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),UM=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],WM=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),GM=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],KM=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],qM=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],JM=[].concat(KM,WM,GM);function YM(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=VM,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:VM,keyword:HM,literal:UM,built_in:JM,"variable.language":qM},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...WM,...GM]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...KM,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function XM(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}var ZM=`[0-9](_*[0-9])*`,QM=`\\.(${ZM})`,$M=`[0-9a-fA-F](_*[0-9a-fA-F])*`,eN={className:`number`,variants:[{begin:`(\\b(${ZM})((${QM})|\\.)?|(${QM}))[eE][+-]?(${ZM})[fFdD]?\\b`},{begin:`\\b(${ZM})((${QM})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${QM})[fFdD]?\\b`},{begin:`\\b(${ZM})[fFdD]\\b`},{begin:`\\b0[xX]((${$M})\\.?|(${$M})?\\.(${$M}))[pP][+-]?(${ZM})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${$M})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function tN(e){let t={keyword:`abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual`,built_in:`Byte Short Char Int Long Boolean Float Double Void Unit Nothing`,literal:`true false null`},n={className:`keyword`,begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:`symbol`,begin:/@\w+/}]}},r={className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`@`},i={className:`subst`,begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:`variable`,begin:`\\$`+e.UNDERSCORE_IDENT_RE},o={className:`string`,variants:[{begin:`"""`,end:`"""(?=[^"])`,contains:[a,i]},{begin:`'`,end:`'`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,i]}]};i.contains.push(o);let s={className:`meta`,begin:`@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*`+e.UNDERSCORE_IDENT_RE+`)?`},c={className:`meta`,begin:`@`+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:`string`}),`self`]}]},l=eN,u=e.COMMENT(`/\\*`,`\\*/`,{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:`type`,begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:`Kotlin`,aliases:[`kt`,`kts`],keywords:t,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`}]}),e.C_LINE_COMMENT_MODE,u,n,r,s,c,{className:`function`,beginKeywords:`fun`,end:`[(]|$`,returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+`\\s*\\(`,returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:`type`,begin:/</,end:/>/,keywords:`reified`,relevance:0},{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,u],relevance:0},e.C_LINE_COMMENT_MODE,u,s,c,o,e.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:`title.class`},keywords:`class interface trait`,end:/[:\{(]|$/,excludeEnd:!0,illegal:`extends implements`,contains:[{beginKeywords:`public protected internal private constructor`},e.UNDERSCORE_TITLE_MODE,{className:`type`,begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,c]},o,{className:`meta`,begin:`^#!/usr/bin/env`,end:`$`,illegal:`
|
|
8
8
|
`},l]}}var nN=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),rN=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),iN=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),aN=[...rN,...iN],oN=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),sN=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),cN=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),lN=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse(),uN=sN.concat(cN).sort().reverse();function dN(e){let t=nN(e),n=uN,r=`[\\w-]+`,i=`(`+r+`|@\\{[\\w-]+\\})`,a=[],o=[],s=function(e){return{className:`string`,begin:`~?`+e+`.*?`+e}},c=function(e,t,n){return{className:e,begin:t,relevance:n}},l={$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:oN.join(` `)},u={begin:`\\(`,end:`\\)`,contains:o,keywords:l,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s(`'`),s(`"`),t.CSS_NUMBER_MODE,{begin:`(url|data-uri)\\(`,starts:{className:`string`,end:`[\\)\\n]`,excludeEnd:!0}},t.HEXCOLOR,u,c(`variable`,`@@?`+r,10),c(`variable`,`@\\{`+r+`\\}`),c(`built_in`,"~?`[^`]*?`"),{className:`attribute`,begin:r+`\\s*:`,end:`:`,returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:`and not`},t.FUNCTION_DISPATCH);let d=o.concat({begin:/\{/,end:/\}/,contains:a}),f={beginKeywords:`when`,endsWithParent:!0,contains:[{beginKeywords:`and not`}].concat(o)},p={begin:i+`\\s*:`,returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+lN.join(`|`)+`)\\b`,end:/(?=:)/,starts:{endsWithParent:!0,illegal:`[<=$]`,relevance:0,contains:o}}]},m={className:`keyword`,begin:`@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b`,starts:{end:`[;{}]`,keywords:l,returnEnd:!0,contains:o,relevance:0}},h={className:`variable`,variants:[{begin:`@`+r+`\\s*:`,relevance:15},{begin:`@`+r}],starts:{end:`[;}]`,returnEnd:!0,contains:d}},g={variants:[{begin:`[\\.#:&\\[>]`,end:`[;{}]`},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,f,c(`keyword`,`all\\b`),c(`variable`,`@\\{`+r+`\\}`),{begin:`\\b(`+aN.join(`|`)+`)\\b`,className:`selector-tag`},t.CSS_NUMBER_MODE,c(`selector-tag`,i,0),c(`selector-id`,`#`+i),c(`selector-class`,`\\.`+i,0),c(`selector-tag`,`&`,0),t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,begin:`:(`+sN.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+cN.join(`|`)+`)`},{begin:/\(/,end:/\)/,relevance:0,contains:d},{begin:`!important`},t.FUNCTION_DISPATCH]},_={begin:`[\\w-]+:(:)?(${n.join(`|`)})`,returnBegin:!0,contains:[g]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m,h,_,p,g,f,t.FUNCTION_DISPATCH),{name:`Less`,case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function fN(e){let t=`\\[=*\\[`,n=`\\]=*\\]`,r={begin:t,end:n,contains:[`self`]},i=[e.COMMENT(`--(?!`+t+`)`,`$`),e.COMMENT(`--`+t,n,{contains:[r],relevance:10})];return{name:`Lua`,aliases:[`pluto`],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:`true false nil`,keyword:`and break do else elseif end for goto if in local not or repeat return then until while`,built_in:`_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove`},contains:i.concat([{className:`function`,beginKeywords:`function`,end:`\\)`,contains:[e.inherit(e.TITLE_MODE,{begin:`([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*`}),{className:`params`,begin:`\\(`,endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:`string`,begin:t,end:n,contains:[r],relevance:5}])}}function pN(e){let t={className:`variable`,variants:[{begin:`\\$\\(`+e.UNDERSCORE_IDENT_RE+`\\)`,contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:`variable`,begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:`subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value`},contains:[t,n]},i={begin:`^`+e.UNDERSCORE_IDENT_RE+`\\s*(?=[:+?]?=)`},a={className:`meta`,begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:`.PHONY`}},o={className:`section`,begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:`Makefile`,aliases:[`mk`,`mak`,`make`],keywords:{$pattern:/[\w-]+/,keyword:`define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath`},contains:[e.HASH_COMMENT_MODE,t,n,r,i,a,o]}}function mN(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function hN(e){let t={className:`built_in`,begin:`\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+`},n=/[a-zA-Z@][a-zA-Z0-9_]*/,r={"variable.language":[`this`,`super`],$pattern:n,keyword:`while.export.sizeof.typedef.const.struct.for.union.volatile.static.mutable.if.do.return.goto.enum.else.break.extern.asm.case.default.register.explicit.typename.switch.continue.inline.readonly.assign.readwrite.self.@synchronized.id.typeof.nonatomic.IBOutlet.IBAction.strong.weak.copy.in.out.inout.bycopy.byref.oneway.__strong.__weak.__block.__autoreleasing.@private.@protected.@public.@try.@property.@end.@throw.@catch.@finally.@autoreleasepool.@synthesize.@dynamic.@selector.@optional.@required.@encode.@package.@import.@defs.@compatibility_alias.__bridge.__bridge_transfer.__bridge_retained.__bridge_retain.__covariant.__contravariant.__kindof._Nonnull._Nullable._Null_unspecified.__FUNCTION__.__PRETTY_FUNCTION__.__attribute__.getter.setter.retain.unsafe_unretained.nonnull.nullable.null_unspecified.null_resettable.class.instancetype.NS_DESIGNATED_INITIALIZER.NS_UNAVAILABLE.NS_REQUIRES_SUPER.NS_RETURNS_INNER_POINTER.NS_INLINE.NS_AVAILABLE.NS_DEPRECATED.NS_ENUM.NS_OPTIONS.NS_SWIFT_UNAVAILABLE.NS_ASSUME_NONNULL_BEGIN.NS_ASSUME_NONNULL_END.NS_REFINED_FOR_SWIFT.NS_SWIFT_NAME.NS_SWIFT_NOTHROW.NS_DURING.NS_HANDLER.NS_ENDHANDLER.NS_VALUERETURN.NS_VOIDRETURN`.split(`.`),literal:[`false`,`true`,`FALSE`,`TRUE`,`nil`,`YES`,`NO`,`NULL`],built_in:[`dispatch_once_t`,`dispatch_queue_t`,`dispatch_sync`,`dispatch_async`,`dispatch_once`],type:[`int`,`float`,`char`,`unsigned`,`signed`,`short`,`long`,`double`,`wchar_t`,`unichar`,`void`,`bool`,`BOOL`,`id|0`,`_Bool`]},i={$pattern:n,keyword:[`@interface`,`@class`,`@protocol`,`@implementation`]};return{name:`Objective-C`,aliases:[`mm`,`objc`,`obj-c`,`obj-c++`,`objective-c++`],keywords:r,illegal:`</`,contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:`string`,variants:[{begin:`@"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]}]},{className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),{className:`string`,begin:/<.*?>/,end:/$/,illegal:`\\n`},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`class`,begin:`(`+i.keyword.join(`|`)+`)\\b`,end:/(\{|$)/,excludeEnd:!0,keywords:i,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:`\\.`+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function gN(e){let t=e.regex,n=`abs.accept.alarm.and.atan2.bind.binmode.bless.break.caller.chdir.chmod.chomp.chop.chown.chr.chroot.class.close.closedir.connect.continue.cos.crypt.dbmclose.dbmopen.defined.delete.die.do.dump.each.else.elsif.endgrent.endhostent.endnetent.endprotoent.endpwent.endservent.eof.eval.exec.exists.exit.exp.fcntl.field.fileno.flock.for.foreach.fork.format.formline.getc.getgrent.getgrgid.getgrnam.gethostbyaddr.gethostbyname.gethostent.getlogin.getnetbyaddr.getnetbyname.getnetent.getpeername.getpgrp.getpriority.getprotobyname.getprotobynumber.getprotoent.getpwent.getpwnam.getpwuid.getservbyname.getservbyport.getservent.getsockname.getsockopt.given.glob.gmtime.goto.grep.gt.hex.if.index.int.ioctl.join.keys.kill.last.lc.lcfirst.length.link.listen.local.localtime.log.lstat.lt.ma.map.method.mkdir.msgctl.msgget.msgrcv.msgsnd.my.ne.next.no.not.oct.open.opendir.or.ord.our.pack.package.pipe.pop.pos.print.printf.prototype.push.q|0.qq.quotemeta.qw.qx.rand.read.readdir.readline.readlink.readpipe.recv.redo.ref.rename.require.reset.return.reverse.rewinddir.rindex.rmdir.say.scalar.seek.seekdir.select.semctl.semget.semop.send.setgrent.sethostent.setnetent.setpgrp.setpriority.setprotoent.setpwent.setservent.setsockopt.shift.shmctl.shmget.shmread.shmwrite.shutdown.sin.sleep.socket.socketpair.sort.splice.split.sprintf.sqrt.srand.stat.state.study.sub.substr.symlink.syscall.sysopen.sysread.sysseek.system.syswrite.tell.telldir.tie.tied.time.times.tr.truncate.uc.ucfirst.umask.undef.unless.unlink.unpack.unshift.untie.until.use.utime.values.vec.wait.waitpid.wantarray.warn.when.while.write.x|0.xor.y|0`.split(`.`),r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(` `)},a={className:`subst`,begin:`[$@]\\{`,end:`\\}`,keywords:i},o={begin:/->\{/,end:/\}/},s={scope:`attr`,match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:`variable`,variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,`(?![A-Za-z])(?![@$%])`)},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:`number`,variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,a,c],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(e,n,i=`\\1`)=>{let a=i===`\\1`?i:t.concat(i,n);return t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,i,r)},p=(e,n,i)=>t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,i,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:`string`,contains:u,variants:[{begin:`q[qwxr]?\\s*\\(`,end:`\\)`,relevance:5},{begin:`q[qwxr]?\\s*\\[`,end:`\\]`,relevance:5},{begin:`q[qwxr]?\\s*\\{`,end:`\\}`,relevance:5},{begin:`q[qwxr]?\\s*\\|`,end:`\\|`,relevance:5},{begin:`q[qwxr]?\\s*<`,end:`>`,relevance:5},{begin:`qw\\s+q`,end:`q`,relevance:5},{begin:`'`,end:`'`,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:`-?\\w+\\s*=>`,relevance:0}]},l,{begin:`(\\/\\/|`+e.RE_STARTERS_RE+`|\\b(split|return|print|reverse|grep)\\b)\\s*`,keywords:`split return print reverse grep`,relevance:0,contains:[e.HASH_COMMENT_MODE,{className:`regexp`,variants:[{begin:f(`s|tr|y`,t.either(...d,{capture:!0}))},{begin:f(`s|tr|y`,`\\(`,`\\)`)},{begin:f(`s|tr|y`,`\\[`,`\\]`)},{begin:f(`s|tr|y`,`\\{`,`\\}`)}],relevance:2},{className:`regexp`,variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p(`(?:m|qr)?`,/\//,/\//)},{begin:p(`m|qr`,t.either(...d,{capture:!0}),/\1/)},{begin:p(`m|qr`,/\(/,/\)/)},{begin:p(`m|qr`,/\[/,/\]/)},{begin:p(`m|qr`,/\{/,/\}/)}]}]},{className:`function`,beginKeywords:`sub method`,end:`(\\s*\\(.*?\\))?[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:`class`,beginKeywords:`class`,end:`[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:`-\\w\\b`,relevance:0},{begin:`^__DATA__$`,end:`^__END__$`,subLanguage:`mojolicious`,contains:[{begin:`^@@.*`,end:`$`,className:`comment`}]}];return a.contains=m,o.contains=m,{name:`Perl`,aliases:[`pl`,`pm`],keywords:i,contains:m}}function _N(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:`variable`,match:`\\$+`+r},s={scope:`meta`,variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:`subst`,variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
|
|
9
9
|
]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,m,h,x],O={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[O,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,O,o,C,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}function vN(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function yN(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}function bN(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function xN(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function SN(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function CN(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:[`alias`,`and`,`begin`,`BEGIN`,`break`,`case`,`class`,`defined`,`do`,`else`,`elsif`,`end`,`END`,`ensure`,`for`,`if`,`in`,`module`,`next`,`not`,`or`,`redo`,`require`,`rescue`,`retry`,`return`,`then`,`undef`,`unless`,`until`,`when`,`while`,`yield`,...[`include`,`extend`,`prepend`,`public`,`private`,`protected`,`raise`,`throw`]],built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},o={className:`doctag`,begin:`@[A-Za-z]+`},s={begin:`#<`,end:`>`},c=[e.COMMENT(`#`,`$`,{contains:[o]}),e.COMMENT(`^=begin`,`^=end`,{contains:[o],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],l={className:`subst`,begin:/#\{/,end:/\}/,keywords:a},u={className:`string`,contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},d=`[0-9](_?[0-9])*`,f={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},p={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},m=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},{relevance:0,match:r,scope:`title.class`},{match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[p]},{begin:e.IDENT_RE+`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[u,{begin:n}],relevance:0},f,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(s,c),relevance:0}].concat(s,c);l.contains=m,p.contains=m;let h=[{begin:/^\s*=>/,starts:{end:`$`,contains:m}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:a,contains:m}}];return c.unshift(s),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(h,c,m)}}function wN(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`([ui](8|16|32|64|128|size)|f(32|64))?`,s=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),c=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],l=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),u=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:u,keyword:s,literal:c,built_in:l},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)`+o},{begin:`\\b0o([0-7_]+)`+o},{begin:`\\b0x([A-Fa-f0-9_]+)`+o},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)`+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:l,type:u}},{className:`punctuation`,begin:`->`},a]}}var TN=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),EN=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),DN=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),ON=[...EN,...DN],kN=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),AN=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),jN=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),MN=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function NN(e){let t=TN(e),n=jN,r=AN,i=`@[a-z-]+`,a={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+ON.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+r.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+n.join(`|`)+`)`},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+MN.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:i,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:kN.join(` `)},contains:[{begin:i,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function PN(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function FN(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}function IN(e){return e?typeof e==`string`?e:e.source:null}function LN(e){return RN(`(?=`,e,`)`)}function RN(...e){return e.map(e=>IN(e)).join(``)}function zN(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function BN(...e){return`(`+(zN(e).capture?``:`?:`)+e.map(e=>IN(e)).join(`|`)+`)`}var VN=e=>RN(/\b/,e,/\w$/.test(e)?/\b/:/\B/),HN=[`Protocol`,`Type`].map(VN),UN=[`init`,`self`].map(VN),WN=[`Any`,`Self`],GN=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],KN=[`false`,`nil`,`true`],qN=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],JN=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],YN=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),XN=BN(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ZN=BN(XN,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),QN=RN(XN,ZN,`*`),$N=BN(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),eP=BN($N,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),tP=RN($N,eP,`*`),nP=RN(/[A-Z]/,eP,`*`),rP=[`attached`,`autoclosure`,RN(/convention\(/,BN(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,RN(/objc\(/,tP,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],iP=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function aP(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,BN(...HN,...UN)],className:{2:`keyword`}},a={match:RN(/\./,BN(...GN)),relevance:0},o=GN.filter(e=>typeof e==`string`).concat([`_|0`]),s={variants:[{className:`keyword`,match:BN(...GN.filter(e=>typeof e!=`string`).concat(WN).map(VN),...UN)}]},c={$pattern:BN(/\b\w+/,/#\w+/),keyword:o.concat(JN),literal:KN},l=[i,a,s],u=[{match:RN(/\./,BN(...YN)),relevance:0},{className:`built_in`,match:RN(/\b/,BN(...YN),/(?=\()/)}],d={match:/->/,relevance:0},f=[d,{className:`operator`,relevance:0,variants:[{match:QN},{match:`\\.(\\.|${ZN})+`}]}],p=`([0-9]_*)+`,m=`([0-9a-fA-F]_*)+`,h={className:`number`,relevance:0,variants:[{match:`\\b(${p})(\\.(${p}))?([eE][+-]?(${p}))?\\b`},{match:`\\b0x(${m})(\\.(${m}))?([pP][+-]?(${p}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e=``)=>({className:`subst`,variants:[{match:RN(/\\/,e,/[0\\tnr"']/)},{match:RN(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e=``)=>({className:`subst`,match:RN(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(e=``)=>({className:`subst`,label:`interpol`,begin:RN(/\\/,e,/\(/),end:/\)/}),y=(e=``)=>({begin:RN(e,/"""/),end:RN(/"""/,e),contains:[g(e),_(e),v(e)]}),b=(e=``)=>({begin:RN(e,/"/),end:RN(/"/,e),contains:[g(e),v(e)]}),x={className:`string`,variants:[y(),y(`#`),y(`##`),y(`###`),b(),b(`#`),b(`##`),b(`###`)]},S=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],C={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:S},w=e=>{let t=RN(e,/\//),n=RN(/\//,e);return{begin:t,end:n,contains:[...S,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},T={scope:`regexp`,variants:[w(`###`),w(`##`),w(`#`),C]},E={match:RN(/`/,tP,/`/)},D=[E,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${eP}+`}],O=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:iP,contains:[...f,h,x]}]}},{scope:`keyword`,match:RN(/@/,BN(...rP),LN(BN(/\(/,/\s+/)))},{scope:`meta`,match:RN(/@/,tP)}],k={match:LN(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:RN(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,eP,`+`)},{className:`type`,match:nP,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:RN(/\s+&\s+/,LN(nP)),relevance:0}]},A={begin:/</,end:/>/,keywords:c,contains:[...r,...l,...O,d,k]};k.contains.push(A);let j={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:[`self`,{match:RN(tP,/\s*:/),keywords:`_|0`,relevance:0},...r,T,...l,...u,...f,h,x,...D,...O,k]},M={begin:/</,end:/>/,keywords:`repeat each`,contains:[...r,k]},N={begin:/\(/,end:/\)/,keywords:c,contains:[{begin:BN(LN(RN(tP,/\s*:/)),LN(RN(tP,/\s+/,tP,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:tP}]},...r,...l,...f,h,x,...O,k,j],endsParent:!0,illegal:/["']/},P={match:[/(func|macro)/,/\s+/,BN(E.match,tP,QN)],className:{1:`keyword`,3:`title.function`},contains:[M,N,t],illegal:[/\[/,/%/]},F={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[M,N,t],illegal:/\[|%/},I={match:[/operator/,/\s+/,QN],className:{1:`keyword`,3:`title`}},L={begin:[/precedencegroup/,/\s+/,nP],className:{1:`keyword`,3:`title`},contains:[k],keywords:[...qN,...KN],end:/}/},R={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},ee={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},te={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,tP,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:c,contains:[M,...l,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:`title.class.inherited`,match:nP},...l],relevance:0}]};for(let e of x.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=c;let n=[...l,...u,...f,h,x,...D];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:c,contains:[...r,P,F,R,ee,te,I,L,{beginKeywords:`import`,end:/$/,contains:[...r],relevance:0},T,...l,...u,...f,h,x,...D,...O,k,j]}}var oP=`[A-Za-z$_][0-9A-Za-z$_]*`,sP=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),cP=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],lP=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),uP=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],dP=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],fP=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],pP=[].concat(dP,lP,uP);function mP(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=oP,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:oP,keyword:sP,literal:cP,built_in:pP,"variable.language":fP},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...lP,...uP]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...dP,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function hP(e){let t=e.regex,n=mP(e),r=oP,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:oP,keyword:sP.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:cP,built_in:pP.concat(i),"variable.language":fP},l={className:`meta`,begin:`@`+r},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function gP(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}function _P(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}function vP(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function yP(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}var bP={arduino:_M,bash:vM,c:yM,cpp:bM,csharp:xM,css:AM,diff:jM,go:MM,graphql:NM,ini:PM,java:BM,javascript:YM,json:XM,kotlin:tN,less:dN,lua:fN,makefile:pN,markdown:mN,objectivec:hN,perl:gN,php:_N,"php-template":vN,plaintext:yN,python:bN,"python-repl":xN,r:SN,ruby:CN,rust:wN,scss:NN,shell:PN,sql:FN,swift:aP,typescript:hP,vbnet:gP,wasm:_P,xml:vP,yaml:yP},xP=e(t(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),ee=I(`#`,`$`),te={scope:`number`,begin:D,relevance:0},ne={scope:`number`,begin:O,relevance:0},z={scope:`number`,begin:k,relevance:0},B={scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},re={scope:`title`,begin:T,relevance:0},V={scope:`title`,begin:E,relevance:0},ie={begin:`\\.\\s*`+E,relevance:0},H=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:z,BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:ne,C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:ee,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:ie,NUMBER_MODE:te,NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:B,RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:re,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:V});function ae(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function oe(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function se(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=ae,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function U(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function ce(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function le(e,t){e.relevance===void 0&&(e.relevance=1)}var ue=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},de=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],fe=`keyword`;function pe(e,t,n=fe){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,pe(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,me(n[0],n[1])]})}}function me(e,t){return t?Number(t):+!he(e)}function he(e){return de.includes(e.toLowerCase())}var ge={},_e=e=>{console.error(e)},ve=(e,...t)=>{console.log(`WARN: ${e}`,...t)},ye=(e,t)=>{ge[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),ge[`${e}/${t}`]=!0)},be=Error();function xe(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function Se(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw _e(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),be;if(typeof e.beginScope!=`object`||e.beginScope===null)throw _e(`beginScope must be object`),be;xe(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function Ce(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw _e(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),be;if(typeof e.endScope!=`object`||e.endScope===null)throw _e(`endScope must be object`),be;xe(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function we(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Te(e){we(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),Se(e),Ce(e)}function Ee(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null),this.matcherRe=t(C(this.regexes.map(e=>e[1]),{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[oe,ce,Te,ue].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[se,U,le].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=pe(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Oe(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function De(e){return e?e.endsWithParent||De(e.starts):!1}function Oe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:De(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var ke=`11.11.1`,Ae=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},je=i,Me=a,Ne=Symbol(`nomatch`),Pe=7,Fe=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(ve(s.replace(`{}`,n[1])),ve(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(ye(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),ye(`10.7.0`,`Please use highlight(code, options) instead.
|